Optional
config: ClientConfigProtected
apiProtected
asyncProtected
defaultProtected
Optional
onProtected
timeoutA list of strings representing the namespace path.
The unique identifier for the item.
Promise
Protected
fetchOptional
options: RequestInit & {Retrieve a single item.
A list of strings representing the namespace path.
The unique identifier for the item.
Optional
options: { refreshTtl?: null | boolean }Optional
refreshTtl?: null | booleanWhether to refresh the TTL on this read operation. If null, uses the store's default behavior.
Promise
const item = await client.store.getItem(
["documents", "user123"],
"item456",
{ refreshTtl: true }
);
console.log(item);
// {
// namespace: ["documents", "user123"],
// key: "item456",
// value: { title: "My Document", content: "Hello World" },
// createdAt: "2024-07-30T12:00:00Z",
// updatedAt: "2024-07-30T12:00:00Z"
// }
List namespaces with optional match conditions.
Optional
options: {Optional
limit?: numberMaximum number of namespaces to return (default is 100).
Optional
maxDepth?: numberOptional integer specifying the maximum depth of namespaces to return.
Optional
offset?: numberNumber of namespaces to skip before returning results (default is 0).
Optional
prefix?: string[]Optional list of strings representing the prefix to filter namespaces.
Optional
suffix?: string[]Optional list of strings representing the suffix to filter namespaces.
Promise
Protected
prepareOptional
options: RequestInit & {Store or update an item.
A list of strings representing the namespace path.
The unique identifier for the item within the namespace.
A dictionary containing the item's data.
Optional
options: { index?: null | false | string[]; ttl?: null | number }Optional
index?: null | false | string[]Controls search indexing - null (use defaults), false (disable), or list of field paths to index.
Optional
ttl?: null | numberOptional time-to-live in minutes for the item, or null for no expiration.
Promise
Search for items within a namespace prefix.
List of strings representing the namespace prefix.
Optional
options: {Optional
filter?: Record<string, unknown>Optional dictionary of key-value pairs to filter results.
Optional
limit?: numberMaximum number of items to return (default is 10).
Optional
offset?: numberNumber of items to skip before returning results (default is 0).
Optional
query?: stringOptional search query.
Optional
refreshTtl?: null | booleanWhether to refresh the TTL on items returned by this search. If null, uses the store's default behavior.
Promise
const results = await client.store.searchItems(
["documents"],
{
filter: { author: "John Doe" },
limit: 5,
refreshTtl: true
}
);
console.log(results);
// {
// items: [
// {
// namespace: ["documents", "user123"],
// key: "item789",
// value: { title: "Another Document", author: "John Doe" },
// createdAt: "2024-07-30T12:00:00Z",
// updatedAt: "2024-07-30T12:00:00Z"
// },
// // ... additional items ...
// ]
// }
Delete an item.