@tinycloud/sdk-services 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{types.d.ts → BaseService-D9BFm_rV.d.cts} +179 -27
- package/dist/BaseService-D9BFm_rV.d.ts +440 -0
- package/dist/index.cjs +3221 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1843 -0
- package/dist/index.d.ts +1826 -41
- package/dist/index.js +3136 -58
- package/dist/index.js.map +1 -1
- package/dist/kv/index.cjs +909 -0
- package/dist/kv/index.cjs.map +1 -0
- package/dist/kv/index.d.cts +748 -0
- package/dist/kv/index.d.ts +745 -7
- package/dist/kv/index.js +877 -9
- package/dist/kv/index.js.map +1 -1
- package/dist/sql/index.cjs +596 -0
- package/dist/sql/index.cjs.map +1 -0
- package/dist/sql/index.d.cts +228 -0
- package/dist/sql/index.d.ts +225 -7
- package/dist/sql/index.js +566 -8
- package/dist/sql/index.js.map +1 -1
- package/package.json +7 -6
- package/dist/base/BaseService.d.ts +0 -151
- package/dist/base/BaseService.d.ts.map +0 -1
- package/dist/base/BaseService.js +0 -221
- package/dist/base/BaseService.js.map +0 -1
- package/dist/base/index.d.ts +0 -6
- package/dist/base/index.d.ts.map +0 -1
- package/dist/base/index.js +0 -6
- package/dist/base/index.js.map +0 -1
- package/dist/base/types.d.ts +0 -36
- package/dist/base/types.d.ts.map +0 -1
- package/dist/base/types.js +0 -7
- package/dist/base/types.js.map +0 -1
- package/dist/context.d.ts +0 -142
- package/dist/context.d.ts.map +0 -1
- package/dist/context.js +0 -218
- package/dist/context.js.map +0 -1
- package/dist/duckdb/DuckDbDatabaseHandle.d.ts +0 -23
- package/dist/duckdb/DuckDbDatabaseHandle.d.ts.map +0 -1
- package/dist/duckdb/DuckDbDatabaseHandle.js +0 -36
- package/dist/duckdb/DuckDbDatabaseHandle.js.map +0 -1
- package/dist/duckdb/DuckDbService.d.ts +0 -50
- package/dist/duckdb/DuckDbService.d.ts.map +0 -1
- package/dist/duckdb/DuckDbService.js +0 -285
- package/dist/duckdb/DuckDbService.js.map +0 -1
- package/dist/duckdb/IDuckDbService.d.ts +0 -84
- package/dist/duckdb/IDuckDbService.d.ts.map +0 -1
- package/dist/duckdb/IDuckDbService.js +0 -7
- package/dist/duckdb/IDuckDbService.js.map +0 -1
- package/dist/duckdb/index.d.ts +0 -10
- package/dist/duckdb/index.d.ts.map +0 -1
- package/dist/duckdb/index.js +0 -9
- package/dist/duckdb/index.js.map +0 -1
- package/dist/duckdb/types.d.ts +0 -148
- package/dist/duckdb/types.d.ts.map +0 -1
- package/dist/duckdb/types.js +0 -19
- package/dist/duckdb/types.js.map +0 -1
- package/dist/errors.d.ts +0 -62
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -149
- package/dist/errors.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/kv/IKVService.d.ts +0 -148
- package/dist/kv/IKVService.d.ts.map +0 -1
- package/dist/kv/IKVService.js +0 -8
- package/dist/kv/IKVService.js.map +0 -1
- package/dist/kv/KVService.d.ts +0 -155
- package/dist/kv/KVService.d.ts.map +0 -1
- package/dist/kv/KVService.js +0 -419
- package/dist/kv/KVService.js.map +0 -1
- package/dist/kv/PrefixedKVService.d.ts +0 -246
- package/dist/kv/PrefixedKVService.d.ts.map +0 -1
- package/dist/kv/PrefixedKVService.js +0 -145
- package/dist/kv/PrefixedKVService.js.map +0 -1
- package/dist/kv/index.d.ts.map +0 -1
- package/dist/kv/types.d.ts +0 -204
- package/dist/kv/types.d.ts.map +0 -1
- package/dist/kv/types.js +0 -16
- package/dist/kv/types.js.map +0 -1
- package/dist/quota/TinyCloudQuota.d.ts +0 -27
- package/dist/quota/TinyCloudQuota.d.ts.map +0 -1
- package/dist/quota/TinyCloudQuota.js +0 -31
- package/dist/quota/TinyCloudQuota.js.map +0 -1
- package/dist/quota/index.d.ts +0 -3
- package/dist/quota/index.d.ts.map +0 -1
- package/dist/quota/index.js +0 -2
- package/dist/quota/index.js.map +0 -1
- package/dist/sql/DatabaseHandle.d.ts +0 -20
- package/dist/sql/DatabaseHandle.d.ts.map +0 -1
- package/dist/sql/DatabaseHandle.js +0 -27
- package/dist/sql/DatabaseHandle.js.map +0 -1
- package/dist/sql/ISQLService.d.ts +0 -67
- package/dist/sql/ISQLService.d.ts.map +0 -1
- package/dist/sql/ISQLService.js +0 -7
- package/dist/sql/ISQLService.js.map +0 -1
- package/dist/sql/SQLService.d.ts +0 -44
- package/dist/sql/SQLService.d.ts.map +0 -1
- package/dist/sql/SQLService.js +0 -216
- package/dist/sql/SQLService.js.map +0 -1
- package/dist/sql/index.d.ts.map +0 -1
- package/dist/sql/types.d.ts +0 -102
- package/dist/sql/types.d.ts.map +0 -1
- package/dist/sql/types.js +0 -21
- package/dist/sql/types.js.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -94
- package/dist/types.js.map +0 -1
- package/dist/types.schema.d.ts +0 -712
- package/dist/types.schema.d.ts.map +0 -1
- package/dist/types.schema.js +0 -342
- package/dist/types.schema.js.map +0 -1
- package/dist/types.schema.test.d.ts +0 -5
- package/dist/types.schema.test.d.ts.map +0 -1
- package/dist/types.schema.test.js +0 -677
- package/dist/types.schema.test.js.map +0 -1
- package/dist/vault/DataVaultService.d.ts +0 -267
- package/dist/vault/DataVaultService.d.ts.map +0 -1
- package/dist/vault/DataVaultService.js +0 -1040
- package/dist/vault/DataVaultService.js.map +0 -1
- package/dist/vault/IDataVaultService.d.ts +0 -158
- package/dist/vault/IDataVaultService.d.ts.map +0 -1
- package/dist/vault/IDataVaultService.js +0 -8
- package/dist/vault/IDataVaultService.js.map +0 -1
- package/dist/vault/SignatureCache.d.ts +0 -20
- package/dist/vault/SignatureCache.d.ts.map +0 -1
- package/dist/vault/SignatureCache.js +0 -167
- package/dist/vault/SignatureCache.js.map +0 -1
- package/dist/vault/createVaultCrypto.d.ts +0 -16
- package/dist/vault/createVaultCrypto.d.ts.map +0 -1
- package/dist/vault/createVaultCrypto.js +0 -12
- package/dist/vault/createVaultCrypto.js.map +0 -1
- package/dist/vault/index.d.ts +0 -11
- package/dist/vault/index.d.ts.map +0 -1
- package/dist/vault/index.js +0 -12
- package/dist/vault/index.js.map +0 -1
- package/dist/vault/types.d.ts +0 -141
- package/dist/vault/types.d.ts.map +0 -1
- package/dist/vault/types.js +0 -31
- package/dist/vault/types.js.map +0 -1
package/dist/kv/IKVService.d.ts
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* IKVService - Interface for KV (Key-Value) service.
|
|
3
|
-
*
|
|
4
|
-
* Platform-agnostic interface for key-value storage operations.
|
|
5
|
-
* Implementations use dependency injection via IServiceContext.
|
|
6
|
-
*/
|
|
7
|
-
import { IService, Result } from "../types";
|
|
8
|
-
import type { IPrefixedKVService } from "./PrefixedKVService";
|
|
9
|
-
import { KVServiceConfig, KVGetOptions, KVPutOptions, KVListOptions, KVDeleteOptions, KVHeadOptions, KVResponse, KVListResponse } from "./types";
|
|
10
|
-
/**
|
|
11
|
-
* KV service interface.
|
|
12
|
-
*
|
|
13
|
-
* Provides key-value storage operations with:
|
|
14
|
-
* - Result type pattern (no throwing)
|
|
15
|
-
* - Optional prefix namespacing
|
|
16
|
-
* - Configurable timeouts
|
|
17
|
-
* - Abort signal support
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```typescript
|
|
21
|
-
* const result = await kv.get('user/settings');
|
|
22
|
-
* if (result.ok) {
|
|
23
|
-
* console.log('Settings:', result.data.data);
|
|
24
|
-
* } else {
|
|
25
|
-
* console.error('Error:', result.error.code);
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
export interface IKVService extends IService {
|
|
30
|
-
/**
|
|
31
|
-
* Get a value by key.
|
|
32
|
-
*
|
|
33
|
-
* @param key - The key to retrieve
|
|
34
|
-
* @param options - Optional get configuration
|
|
35
|
-
* @returns Result with the stored value and headers
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```typescript
|
|
39
|
-
* const result = await kv.get<UserSettings>('settings');
|
|
40
|
-
* if (result.ok) {
|
|
41
|
-
* const settings = result.data.data;
|
|
42
|
-
* const etag = result.data.headers.etag;
|
|
43
|
-
* }
|
|
44
|
-
* ```
|
|
45
|
-
*/
|
|
46
|
-
get<T = unknown>(key: string, options?: KVGetOptions): Promise<Result<KVResponse<T>>>;
|
|
47
|
-
/**
|
|
48
|
-
* Store a value at a key.
|
|
49
|
-
*
|
|
50
|
-
* Objects are automatically JSON stringified.
|
|
51
|
-
* Strings are stored as-is.
|
|
52
|
-
*
|
|
53
|
-
* @param key - The key to store under
|
|
54
|
-
* @param value - The value to store
|
|
55
|
-
* @param options - Optional put configuration
|
|
56
|
-
* @returns Result indicating success/failure
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```typescript
|
|
60
|
-
* // Store an object (auto-stringified)
|
|
61
|
-
* const result = await kv.put('settings', { theme: 'dark' });
|
|
62
|
-
*
|
|
63
|
-
* // Store a string
|
|
64
|
-
* const result = await kv.put('name', 'Alice');
|
|
65
|
-
* ```
|
|
66
|
-
*/
|
|
67
|
-
put(key: string, value: unknown, options?: KVPutOptions): Promise<Result<KVResponse<void>>>;
|
|
68
|
-
/**
|
|
69
|
-
* List keys with optional prefix filtering.
|
|
70
|
-
*
|
|
71
|
-
* @param options - Optional list configuration
|
|
72
|
-
* @returns Result with array of matching keys
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```typescript
|
|
76
|
-
* // List all keys
|
|
77
|
-
* const result = await kv.list();
|
|
78
|
-
*
|
|
79
|
-
* // List keys with a specific prefix
|
|
80
|
-
* const result = await kv.list({ prefix: 'users/' });
|
|
81
|
-
* ```
|
|
82
|
-
*/
|
|
83
|
-
list(options?: KVListOptions): Promise<Result<KVListResponse>>;
|
|
84
|
-
/**
|
|
85
|
-
* Delete a key.
|
|
86
|
-
*
|
|
87
|
-
* @param key - The key to delete
|
|
88
|
-
* @param options - Optional delete configuration
|
|
89
|
-
* @returns Result indicating success/failure
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* ```typescript
|
|
93
|
-
* const result = await kv.delete('old-key');
|
|
94
|
-
* if (!result.ok && result.error.code === 'KV_NOT_FOUND') {
|
|
95
|
-
* console.log('Key already deleted');
|
|
96
|
-
* }
|
|
97
|
-
* ```
|
|
98
|
-
*/
|
|
99
|
-
delete(key: string, options?: KVDeleteOptions): Promise<Result<void>>;
|
|
100
|
-
/**
|
|
101
|
-
* Get metadata for a key without retrieving the value.
|
|
102
|
-
*
|
|
103
|
-
* Useful for checking if a key exists or getting headers
|
|
104
|
-
* without downloading the full value.
|
|
105
|
-
*
|
|
106
|
-
* @param key - The key to check
|
|
107
|
-
* @param options - Optional head configuration
|
|
108
|
-
* @returns Result with headers only
|
|
109
|
-
*
|
|
110
|
-
* @example
|
|
111
|
-
* ```typescript
|
|
112
|
-
* const result = await kv.head('large-file');
|
|
113
|
-
* if (result.ok) {
|
|
114
|
-
* console.log('Size:', result.data.headers.contentLength);
|
|
115
|
-
* }
|
|
116
|
-
* ```
|
|
117
|
-
*/
|
|
118
|
-
head(key: string, options?: KVHeadOptions): Promise<Result<KVResponse<void>>>;
|
|
119
|
-
/**
|
|
120
|
-
* Create a prefix-scoped view of this KV service.
|
|
121
|
-
*
|
|
122
|
-
* Returns a PrefixedKVService that automatically prefixes all
|
|
123
|
-
* key operations with the specified prefix. This enables apps
|
|
124
|
-
* to isolate their data within a shared space.
|
|
125
|
-
*
|
|
126
|
-
* @param prefix - The prefix to apply to all operations
|
|
127
|
-
* @returns A PrefixedKVService scoped to the prefix
|
|
128
|
-
*
|
|
129
|
-
* @example
|
|
130
|
-
* ```typescript
|
|
131
|
-
* const myApp = kv.withPrefix('/app.myapp.com');
|
|
132
|
-
*
|
|
133
|
-
* // Operations are automatically prefixed
|
|
134
|
-
* await myApp.put('settings.json', { theme: 'dark' });
|
|
135
|
-
* // -> Actually writes to: /app.myapp.com/settings.json
|
|
136
|
-
*
|
|
137
|
-
* // Nested prefixes
|
|
138
|
-
* const settings = myApp.withPrefix('/settings');
|
|
139
|
-
* await settings.get('theme.json'); // -> /app.myapp.com/settings/theme.json
|
|
140
|
-
* ```
|
|
141
|
-
*/
|
|
142
|
-
withPrefix(prefix: string): IPrefixedKVService;
|
|
143
|
-
/**
|
|
144
|
-
* Service configuration.
|
|
145
|
-
*/
|
|
146
|
-
readonly config: KVServiceConfig;
|
|
147
|
-
}
|
|
148
|
-
//# sourceMappingURL=IKVService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IKVService.d.ts","sourceRoot":"","sources":["../../src/kv/IKVService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAC5C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EACL,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,eAAe,EACf,aAAa,EACb,UAAU,EACV,cAAc,EACf,MAAM,SAAS,CAAC;AAEjB;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,UAAW,SAAQ,QAAQ;IAC1C;;;;;;;;;;;;;;;OAeG;IACH,GAAG,CAAC,CAAC,GAAG,OAAO,EACb,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAElC;;;;;;;;;;;;;;;;;;;OAmBG;IACH,GAAG,CACD,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,OAAO,EACd,OAAO,CAAC,EAAE,YAAY,GACrB,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAErC;;;;;;;;;;;;;;OAcG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;IAE/D;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;IAEtE;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAE9E;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,CAAC;IAE/C;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAE,eAAe,CAAC;CAClC"}
|
package/dist/kv/IKVService.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IKVService.js","sourceRoot":"","sources":["../../src/kv/IKVService.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
package/dist/kv/KVService.d.ts
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* KVService - Key-Value storage service implementation.
|
|
3
|
-
*
|
|
4
|
-
* Platform-agnostic KV service that works with both web-sdk and node-sdk.
|
|
5
|
-
* Uses dependency injection via IServiceContext for platform dependencies.
|
|
6
|
-
*/
|
|
7
|
-
import { BaseService } from "../base/BaseService";
|
|
8
|
-
import { Result } from "../types";
|
|
9
|
-
import { IKVService } from "./IKVService";
|
|
10
|
-
import { IPrefixedKVService } from "./PrefixedKVService";
|
|
11
|
-
import { KVServiceConfig, KVGetOptions, KVPutOptions, KVListOptions, KVDeleteOptions, KVHeadOptions, KVResponse, KVListResponse } from "./types";
|
|
12
|
-
/**
|
|
13
|
-
* KV service implementation.
|
|
14
|
-
*
|
|
15
|
-
* Provides key-value storage operations using TinyCloud's KV API.
|
|
16
|
-
* Uses the Result type pattern for explicit error handling.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* // Register with SDK
|
|
21
|
-
* const sdk = new TinyCloud({
|
|
22
|
-
* services: { kv: KVService },
|
|
23
|
-
* serviceConfigs: { kv: { prefix: 'myapp' } },
|
|
24
|
-
* });
|
|
25
|
-
*
|
|
26
|
-
* // Use the service
|
|
27
|
-
* const result = await sdk.kv.get('settings');
|
|
28
|
-
* if (result.ok) {
|
|
29
|
-
* console.log(result.data.data);
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
export declare class KVService extends BaseService implements IKVService {
|
|
34
|
-
/**
|
|
35
|
-
* Service identifier for registration.
|
|
36
|
-
*/
|
|
37
|
-
static readonly serviceName = "kv";
|
|
38
|
-
/**
|
|
39
|
-
* Service configuration.
|
|
40
|
-
*/
|
|
41
|
-
protected _config: KVServiceConfig;
|
|
42
|
-
/**
|
|
43
|
-
* Create a new KVService instance.
|
|
44
|
-
*
|
|
45
|
-
* @param config - Service configuration
|
|
46
|
-
*/
|
|
47
|
-
constructor(config?: KVServiceConfig);
|
|
48
|
-
/**
|
|
49
|
-
* Get the service configuration.
|
|
50
|
-
*/
|
|
51
|
-
get config(): KVServiceConfig;
|
|
52
|
-
private parseQuotaInfo;
|
|
53
|
-
private handleQuotaErrorResponse;
|
|
54
|
-
/**
|
|
55
|
-
* Get the full path with optional prefix.
|
|
56
|
-
*
|
|
57
|
-
* @param key - The key
|
|
58
|
-
* @param prefixOverride - Optional prefix override
|
|
59
|
-
* @returns The full path
|
|
60
|
-
*/
|
|
61
|
-
private getFullPath;
|
|
62
|
-
/**
|
|
63
|
-
* Get the host URL.
|
|
64
|
-
*/
|
|
65
|
-
private get host();
|
|
66
|
-
/**
|
|
67
|
-
* Execute an invoke operation.
|
|
68
|
-
*
|
|
69
|
-
* @param path - Resource path
|
|
70
|
-
* @param action - KV action
|
|
71
|
-
* @param body - Optional request body
|
|
72
|
-
* @param signal - Optional abort signal
|
|
73
|
-
* @returns Fetch response
|
|
74
|
-
*/
|
|
75
|
-
private invokeOperation;
|
|
76
|
-
/**
|
|
77
|
-
* Create KVResponseHeaders from fetch response headers.
|
|
78
|
-
*
|
|
79
|
-
* @param headers - Fetch response headers
|
|
80
|
-
* @returns KVResponseHeaders object
|
|
81
|
-
*/
|
|
82
|
-
private createResponseHeaders;
|
|
83
|
-
/**
|
|
84
|
-
* Parse response body based on content type.
|
|
85
|
-
*
|
|
86
|
-
* @param response - Fetch response
|
|
87
|
-
* @param raw - Whether to return raw text
|
|
88
|
-
* @returns Parsed data
|
|
89
|
-
*/
|
|
90
|
-
private parseResponse;
|
|
91
|
-
/**
|
|
92
|
-
* Get a value by key.
|
|
93
|
-
*/
|
|
94
|
-
get<T = unknown>(key: string, options?: KVGetOptions): Promise<Result<KVResponse<T>>>;
|
|
95
|
-
/**
|
|
96
|
-
* Store a value at a key.
|
|
97
|
-
*/
|
|
98
|
-
put(key: string, value: unknown, options?: KVPutOptions): Promise<Result<KVResponse<void>>>;
|
|
99
|
-
/**
|
|
100
|
-
* List keys with optional prefix filtering.
|
|
101
|
-
*/
|
|
102
|
-
list(options?: KVListOptions): Promise<Result<KVListResponse>>;
|
|
103
|
-
/**
|
|
104
|
-
* Delete a key.
|
|
105
|
-
*/
|
|
106
|
-
delete(key: string, options?: KVDeleteOptions): Promise<Result<void>>;
|
|
107
|
-
/**
|
|
108
|
-
* Get metadata for a key without retrieving the value.
|
|
109
|
-
*/
|
|
110
|
-
head(key: string, options?: KVHeadOptions): Promise<Result<KVResponse<void>>>;
|
|
111
|
-
/**
|
|
112
|
-
* Create a prefix-scoped view of this KV service.
|
|
113
|
-
*
|
|
114
|
-
* Returns a PrefixedKVService that automatically prefixes all
|
|
115
|
-
* key operations with the specified prefix. This enables apps
|
|
116
|
-
* to isolate their data within a shared space.
|
|
117
|
-
*
|
|
118
|
-
* @param prefix - The prefix to apply to all operations
|
|
119
|
-
* @returns A PrefixedKVService scoped to the prefix
|
|
120
|
-
*
|
|
121
|
-
* ## Prefix Conventions
|
|
122
|
-
*
|
|
123
|
-
* | Pattern | Use Case | Example |
|
|
124
|
-
* | -- | -- | -- |
|
|
125
|
-
* | `/app.{domain}/` | App-private data | `/app.photos.xyz/settings.json` |
|
|
126
|
-
* | `/{type}/` | Shared data type | `/photos/vacation.jpg` |
|
|
127
|
-
* | `/.{name}/` | Hidden/system data | `/.cache/thumbnails/` |
|
|
128
|
-
* | `/public/` | Explicitly shareable | `/public/profile.json` |
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* ```typescript
|
|
132
|
-
* const space = sdk.space('default');
|
|
133
|
-
*
|
|
134
|
-
* // Create prefix-scoped views
|
|
135
|
-
* const myApp = space.kv.withPrefix('/app.myapp.com');
|
|
136
|
-
* const sharedPhotos = space.kv.withPrefix('/photos');
|
|
137
|
-
*
|
|
138
|
-
* // Operations are automatically prefixed
|
|
139
|
-
* await myApp.put('settings.json', { theme: 'dark' });
|
|
140
|
-
* // -> Actually writes to: /app.myapp.com/settings.json
|
|
141
|
-
*
|
|
142
|
-
* await myApp.get('settings.json');
|
|
143
|
-
* // -> Actually reads from: /app.myapp.com/settings.json
|
|
144
|
-
*
|
|
145
|
-
* await sharedPhotos.list();
|
|
146
|
-
* // -> Lists: /photos/*
|
|
147
|
-
*
|
|
148
|
-
* // Nested prefixes
|
|
149
|
-
* const settings = myApp.withPrefix('/settings');
|
|
150
|
-
* await settings.get('theme.json'); // -> /app.myapp.com/settings/theme.json
|
|
151
|
-
* ```
|
|
152
|
-
*/
|
|
153
|
-
withPrefix(prefix: string): IPrefixedKVService;
|
|
154
|
-
}
|
|
155
|
-
//# sourceMappingURL=KVService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"KVService.d.ts","sourceRoot":"","sources":["../../src/kv/KVService.ts"],"names":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