StoreAPI
Defined in: namespaces-core-plugins.ts:83
Durable, Promise-shaped document + KV storage (fn-71). This is the storage
plane every core plugin builds on. context.storage remains the legacy
synchronous KV tier.
Scopes: store.namespace.own, store.namespace.declare,
store.namespace.shared.read, store.namespace.enumerate, plus
contributor scopes store.{backend,migrator,indexer}.register.
fn-71
Methods
Section titled “Methods”declareNamespace()
Section titled “declareNamespace()”declareNamespace(
spec):Promise<void>
Defined in: namespaces-core-plugins.ts:85
Declares (or re-declares idempotently) a namespace.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”Promise<void>
put(
namespace,id,doc):Promise<void>
Defined in: namespaces-core-plugins.ts:87
Upserts a document by id.
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
string
Returns
Section titled “Returns”Promise<void>
get(
namespace,id):Promise<AnyJSONValue>
Defined in: namespaces-core-plugins.ts:89
Gets a document by id, or null.
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
string
Returns
Section titled “Returns”Promise<AnyJSONValue>
delete()
Section titled “delete()”delete(
namespace,id):Promise<void>
Defined in: namespaces-core-plugins.ts:91
Deletes a document by id.
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
string
Returns
Section titled “Returns”Promise<void>
query()
Section titled “query()”query(
namespace,query):Promise<AnyJSONValue[]>
Defined in: namespaces-core-plugins.ts:93
Queries documents in a namespace.
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
Returns
Section titled “Returns”Promise<AnyJSONValue[]>
setKV()
Section titled “setKV()”setKV(
namespace,key,value):Promise<void>
Defined in: namespaces-core-plugins.ts:95
Sets a KV entry.
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
string
Returns
Section titled “Returns”Promise<void>
getKV()
Section titled “getKV()”getKV(
namespace,key):Promise<AnyJSONValue>
Defined in: namespaces-core-plugins.ts:97
Gets a KV entry, or null.
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
string
Returns
Section titled “Returns”Promise<AnyJSONValue>
deleteKV()
Section titled “deleteKV()”deleteKV(
namespace,key):Promise<void>
Defined in: namespaces-core-plugins.ts:99
Deletes a KV entry.
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
string
Returns
Section titled “Returns”Promise<void>
listKV()
Section titled “listKV()”listKV(
namespace,prefix?):Promise<string[]>
Defined in: namespaces-core-plugins.ts:101
Lists KV keys, optionally filtered by prefix.
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
prefix?
Section titled “prefix?”string
Returns
Section titled “Returns”Promise<string[]>
compact()
Section titled “compact()”compact(
namespace):Promise<void>
Defined in: namespaces-core-plugins.ts:103
Compacts a namespace.
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
Returns
Section titled “Returns”Promise<void>
export()
Section titled “export()”export(
namespace):Promise<string>
Defined in: namespaces-core-plugins.ts:105
Exports a namespace as base64 JSONL.
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
Returns
Section titled “Returns”Promise<string>
importData()
Section titled “importData()”importData(
namespace,data):Promise<void>
Defined in: namespaces-core-plugins.ts:111
Imports namespace data previously produced by export().
QUIRK: the JS method name is importData (NOT import — reserved word).
Parameters
Section titled “Parameters”namespace
Section titled “namespace”string
string
Returns
Section titled “Returns”Promise<void>