mirror of
https://github.com/hanzoai/js-sdk.git
synced 2026-10-30 15:02:31 +00:00
The lock sat at 574d1f1d while the product had moved on, so the team surface stopped at rooms: no messages path, no way to open a room. An app written against this client had to reach past it with its own fetch, which is the duplication a generated client exists to prevent. Three examples and the smoke test named classes the document no longer emits. Chat and models fold into AiApi at unchanged routes; the KV provisioning plane moved to /v1/provisioning. None of that was caused by this regeneration — the suite has been red since those tags folded, which is what let the drift sit unread.
39 lines
1.5 KiB
TypeScript
39 lines
1.5 KiB
TypeScript
// store — a KV round-trip: provision a store, read it back, delete it.
|
|
//
|
|
// POST /v1/provisioning/kv post_provisioning_kv provision
|
|
// GET /v1/provisioning/kv/{name} get_provisioning_kv_by_name read back
|
|
// DELETE /v1/provisioning/kv/{name} delete_provisioning_kv_by_name tear down
|
|
//
|
|
// KV used to sit at /v1/kv beside its own siblings — datastore, docdb, s3,
|
|
// search, sql, vector — each with its own class and its own spelling of the
|
|
// same three verbs. They are one shape now, under /v1/provisioning, so this
|
|
// example reads as the others do and switching store kinds is switching a word.
|
|
//
|
|
// This is the PROVISIONING plane: it hands back where the store lives, not what
|
|
// is in it. Nothing here writes a key.
|
|
//
|
|
// The delete runs in `finally`, so a failed read still tears the store down
|
|
// rather than leaving it billable for the next run to collide with.
|
|
import { ProvisioningApi } from 'hanzoai';
|
|
import { config, fail } from '../client';
|
|
|
|
const name = `example-store-${Date.now()}`;
|
|
|
|
async function main() {
|
|
const kv = new ProvisioningApi(config());
|
|
|
|
await kv.postProvisioningKv({ provisionRequest: { name } });
|
|
console.log(`provisioned ${name}`);
|
|
|
|
try {
|
|
const { data: store } = await kv.getProvisioningKvByName({ name });
|
|
console.log(`read back: ${store.name} · ${store.kind} · status ${store.status}`);
|
|
console.log(` host ${store.host}:${store.port}`);
|
|
} finally {
|
|
await kv.deleteProvisioningKvByName({ name });
|
|
console.log(`deleted ${name}`);
|
|
}
|
|
}
|
|
|
|
main().catch(fail);
|