@tinycloud/sdk-core 2.0.1 → 2.0.2-beta.0
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/index.cjs +3816 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3867 -0
- package/dist/index.d.ts +3861 -21
- package/dist/index.js +3767 -61
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
- package/dist/TinyCloud.d.ts +0 -271
- package/dist/TinyCloud.d.ts.map +0 -1
- package/dist/TinyCloud.js +0 -458
- package/dist/TinyCloud.js.map +0 -1
- package/dist/TinyCloud.schema.d.ts +0 -173
- package/dist/TinyCloud.schema.d.ts.map +0 -1
- package/dist/TinyCloud.schema.js +0 -136
- package/dist/TinyCloud.schema.js.map +0 -1
- package/dist/TinyCloud.schema.test.d.ts +0 -5
- package/dist/TinyCloud.schema.test.d.ts.map +0 -1
- package/dist/TinyCloud.schema.test.js +0 -286
- package/dist/TinyCloud.schema.test.js.map +0 -1
- package/dist/authorization/CapabilityKeyRegistry.d.ts +0 -317
- package/dist/authorization/CapabilityKeyRegistry.d.ts.map +0 -1
- package/dist/authorization/CapabilityKeyRegistry.js +0 -509
- package/dist/authorization/CapabilityKeyRegistry.js.map +0 -1
- package/dist/authorization/authorization.schema.d.ts +0 -233
- package/dist/authorization/authorization.schema.d.ts.map +0 -1
- package/dist/authorization/authorization.schema.js +0 -220
- package/dist/authorization/authorization.schema.js.map +0 -1
- package/dist/authorization/authorization.schema.test.d.ts +0 -5
- package/dist/authorization/authorization.schema.test.d.ts.map +0 -1
- package/dist/authorization/authorization.schema.test.js +0 -618
- package/dist/authorization/authorization.schema.test.js.map +0 -1
- package/dist/authorization/index.d.ts +0 -38
- package/dist/authorization/index.d.ts.map +0 -1
- package/dist/authorization/index.js +0 -52
- package/dist/authorization/index.js.map +0 -1
- package/dist/authorization/spaceCreation.d.ts +0 -96
- package/dist/authorization/spaceCreation.d.ts.map +0 -1
- package/dist/authorization/spaceCreation.js +0 -35
- package/dist/authorization/spaceCreation.js.map +0 -1
- package/dist/authorization/spaceCreation.schema.d.ts +0 -67
- package/dist/authorization/spaceCreation.schema.d.ts.map +0 -1
- package/dist/authorization/spaceCreation.schema.js +0 -95
- package/dist/authorization/spaceCreation.schema.js.map +0 -1
- package/dist/authorization/spaceCreation.schema.test.d.ts +0 -5
- package/dist/authorization/spaceCreation.schema.test.d.ts.map +0 -1
- package/dist/authorization/spaceCreation.schema.test.js +0 -168
- package/dist/authorization/spaceCreation.schema.test.js.map +0 -1
- package/dist/authorization/strategies.d.ts +0 -134
- package/dist/authorization/strategies.d.ts.map +0 -1
- package/dist/authorization/strategies.js +0 -15
- package/dist/authorization/strategies.js.map +0 -1
- package/dist/authorization/strategies.schema.d.ts +0 -185
- package/dist/authorization/strategies.schema.d.ts.map +0 -1
- package/dist/authorization/strategies.schema.js +0 -147
- package/dist/authorization/strategies.schema.js.map +0 -1
- package/dist/authorization/strategies.schema.test.d.ts +0 -5
- package/dist/authorization/strategies.schema.test.d.ts.map +0 -1
- package/dist/authorization/strategies.schema.test.js +0 -253
- package/dist/authorization/strategies.schema.test.js.map +0 -1
- package/dist/client-types.d.ts +0 -128
- package/dist/client-types.d.ts.map +0 -1
- package/dist/client-types.js +0 -40
- package/dist/client-types.js.map +0 -1
- package/dist/delegations/DelegationManager.d.ts +0 -164
- package/dist/delegations/DelegationManager.d.ts.map +0 -1
- package/dist/delegations/DelegationManager.js +0 -428
- package/dist/delegations/DelegationManager.js.map +0 -1
- package/dist/delegations/SharingService.d.ts +0 -341
- package/dist/delegations/SharingService.d.ts.map +0 -1
- package/dist/delegations/SharingService.js +0 -722
- package/dist/delegations/SharingService.js.map +0 -1
- package/dist/delegations/SharingService.schema.d.ts +0 -409
- package/dist/delegations/SharingService.schema.d.ts.map +0 -1
- package/dist/delegations/SharingService.schema.js +0 -222
- package/dist/delegations/SharingService.schema.js.map +0 -1
- package/dist/delegations/index.d.ts +0 -38
- package/dist/delegations/index.d.ts.map +0 -1
- package/dist/delegations/index.js +0 -42
- package/dist/delegations/index.js.map +0 -1
- package/dist/delegations/types.d.ts +0 -13
- package/dist/delegations/types.d.ts.map +0 -1
- package/dist/delegations/types.js +0 -42
- package/dist/delegations/types.js.map +0 -1
- package/dist/delegations/types.schema.d.ts +0 -1773
- package/dist/delegations/types.schema.d.ts.map +0 -1
- package/dist/delegations/types.schema.js +0 -535
- package/dist/delegations/types.schema.js.map +0 -1
- package/dist/delegations/types.schema.test.d.ts +0 -5
- package/dist/delegations/types.schema.test.d.ts.map +0 -1
- package/dist/delegations/types.schema.test.js +0 -627
- package/dist/delegations/types.schema.test.js.map +0 -1
- package/dist/ens.d.ts +0 -17
- package/dist/ens.d.ts.map +0 -1
- package/dist/ens.js +0 -10
- package/dist/ens.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/json-schema.d.ts +0 -327
- package/dist/json-schema.d.ts.map +0 -1
- package/dist/json-schema.js +0 -703
- package/dist/json-schema.js.map +0 -1
- package/dist/json-schema.test.d.ts +0 -7
- package/dist/json-schema.test.d.ts.map +0 -1
- package/dist/json-schema.test.js +0 -365
- package/dist/json-schema.test.js.map +0 -1
- package/dist/notifications.d.ts +0 -33
- package/dist/notifications.d.ts.map +0 -1
- package/dist/notifications.js +0 -15
- package/dist/notifications.js.map +0 -1
- package/dist/signer.d.ts +0 -28
- package/dist/signer.d.ts.map +0 -1
- package/dist/signer.js +0 -2
- package/dist/signer.js.map +0 -1
- package/dist/space.d.ts +0 -57
- package/dist/space.d.ts.map +0 -1
- package/dist/space.js +0 -87
- package/dist/space.js.map +0 -1
- package/dist/space.schema.d.ts +0 -65
- package/dist/space.schema.d.ts.map +0 -1
- package/dist/space.schema.js +0 -65
- package/dist/space.schema.js.map +0 -1
- package/dist/space.schema.test.d.ts +0 -5
- package/dist/space.schema.test.d.ts.map +0 -1
- package/dist/space.schema.test.js +0 -148
- package/dist/space.schema.test.js.map +0 -1
- package/dist/space.test.d.ts +0 -5
- package/dist/space.test.d.ts.map +0 -1
- package/dist/space.test.js +0 -87
- package/dist/space.test.js.map +0 -1
- package/dist/spaces/Space.d.ts +0 -175
- package/dist/spaces/Space.d.ts.map +0 -1
- package/dist/spaces/Space.js +0 -84
- package/dist/spaces/Space.js.map +0 -1
- package/dist/spaces/SpaceService.d.ts +0 -291
- package/dist/spaces/SpaceService.d.ts.map +0 -1
- package/dist/spaces/SpaceService.js +0 -740
- package/dist/spaces/SpaceService.js.map +0 -1
- package/dist/spaces/index.d.ts +0 -11
- package/dist/spaces/index.d.ts.map +0 -1
- package/dist/spaces/index.js +0 -22
- package/dist/spaces/index.js.map +0 -1
- package/dist/spaces/spaces.schema.d.ts +0 -421
- package/dist/spaces/spaces.schema.d.ts.map +0 -1
- package/dist/spaces/spaces.schema.js +0 -342
- package/dist/spaces/spaces.schema.js.map +0 -1
- package/dist/spaces/spaces.schema.test.d.ts +0 -5
- package/dist/spaces/spaces.schema.test.d.ts.map +0 -1
- package/dist/spaces/spaces.schema.test.js +0 -471
- package/dist/spaces/spaces.schema.test.js.map +0 -1
- package/dist/storage.d.ts +0 -47
- package/dist/storage.d.ts.map +0 -1
- package/dist/storage.js +0 -14
- package/dist/storage.js.map +0 -1
- package/dist/storage.schema.d.ts +0 -291
- package/dist/storage.schema.d.ts.map +0 -1
- package/dist/storage.schema.js +0 -189
- package/dist/storage.schema.js.map +0 -1
- package/dist/storage.schema.test.d.ts +0 -5
- package/dist/storage.schema.test.d.ts.map +0 -1
- package/dist/storage.schema.test.js +0 -346
- package/dist/storage.schema.test.js.map +0 -1
- package/dist/userAuthorization.d.ts +0 -117
- package/dist/userAuthorization.d.ts.map +0 -1
- package/dist/userAuthorization.js +0 -3
- package/dist/userAuthorization.js.map +0 -1
- package/dist/userAuthorization.schema.d.ts +0 -260
- package/dist/userAuthorization.schema.d.ts.map +0 -1
- package/dist/userAuthorization.schema.js +0 -169
- package/dist/userAuthorization.schema.js.map +0 -1
- package/dist/userAuthorization.schema.test.d.ts +0 -5
- package/dist/userAuthorization.schema.test.d.ts.map +0 -1
- package/dist/userAuthorization.schema.test.js +0 -356
- package/dist/userAuthorization.schema.test.js.map +0 -1
- package/dist/version.d.ts +0 -32
- package/dist/version.d.ts.map +0 -1
- package/dist/version.js +0 -59
- package/dist/version.js.map +0 -1
- package/dist/wasm-validation.d.ts +0 -291
- package/dist/wasm-validation.d.ts.map +0 -1
- package/dist/wasm-validation.js +0 -221
- package/dist/wasm-validation.js.map +0 -1
- package/dist/wasm-validation.test.d.ts +0 -5
- package/dist/wasm-validation.test.d.ts.map +0 -1
- package/dist/wasm-validation.test.js +0 -233
- package/dist/wasm-validation.test.js.map +0 -1
- package/dist/wasm.d.ts +0 -66
- package/dist/wasm.d.ts.map +0 -1
- package/dist/wasm.js +0 -10
- package/dist/wasm.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinycloud/sdk-core",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2-beta.0",
|
|
4
4
|
"description": "Core TinyCloud SDK - shared interfaces and TinyCloud class",
|
|
5
5
|
"author": "TinyCloud, Inc.",
|
|
6
6
|
"license": "EGPL",
|
|
7
7
|
"type": "module",
|
|
8
|
-
"main": "dist/index.
|
|
8
|
+
"main": "dist/index.cjs",
|
|
9
9
|
"module": "dist/index.js",
|
|
10
10
|
"types": "dist/index.d.ts",
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"import": "./dist/index.js",
|
|
15
|
-
"
|
|
15
|
+
"require": "./dist/index.cjs"
|
|
16
16
|
}
|
|
17
17
|
},
|
|
18
18
|
"files": [
|
|
19
19
|
"dist"
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
|
-
"build": "
|
|
22
|
+
"build": "tsup",
|
|
23
23
|
"clean": "rm -rf dist",
|
|
24
24
|
"test": "bun test"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tinycloud/sdk-services": "
|
|
27
|
+
"@tinycloud/sdk-services": "workspace:*",
|
|
28
28
|
"siwe": "^2.3.2",
|
|
29
29
|
"zod": "^3.22.0",
|
|
30
30
|
"zod-to-json-schema": "^3.22.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^20",
|
|
34
|
+
"tsup": "^8.0.0",
|
|
34
35
|
"typescript": "^5.0.0"
|
|
35
36
|
},
|
|
36
37
|
"repository": {
|
package/dist/TinyCloud.d.ts
DELETED
|
@@ -1,271 +0,0 @@
|
|
|
1
|
-
import { IUserAuthorization, ClientSession, Extension } from "./userAuthorization";
|
|
2
|
-
import { IService, IServiceContext, IKVService, ISQLService, IDuckDbService, IDataVaultService, InvokeFunction, FetchFunction, RetryPolicy, ServiceConstructor, Result, ServiceError } from "@tinycloud/sdk-services";
|
|
3
|
-
/**
|
|
4
|
-
* Configuration for the TinyCloud SDK.
|
|
5
|
-
*/
|
|
6
|
-
export interface TinyCloudConfig {
|
|
7
|
-
/** Whether to automatically resolve ENS names */
|
|
8
|
-
resolveEns?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* TinyCloud host URLs.
|
|
11
|
-
* Required when using services.
|
|
12
|
-
*/
|
|
13
|
-
hosts?: string[];
|
|
14
|
-
/**
|
|
15
|
-
* Platform-specific invoke function from WASM binding.
|
|
16
|
-
* Required when using services.
|
|
17
|
-
*/
|
|
18
|
-
invoke?: InvokeFunction;
|
|
19
|
-
/**
|
|
20
|
-
* Custom fetch implementation.
|
|
21
|
-
* Defaults to globalThis.fetch.
|
|
22
|
-
*/
|
|
23
|
-
fetch?: FetchFunction;
|
|
24
|
-
/**
|
|
25
|
-
* Service constructors to register.
|
|
26
|
-
* Built-in services (like KVService) are registered by default unless overridden.
|
|
27
|
-
*
|
|
28
|
-
* @example
|
|
29
|
-
* ```typescript
|
|
30
|
-
* services: {
|
|
31
|
-
* kv: KVService, // default
|
|
32
|
-
* files: MyFileService, // custom
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
services?: Record<string, ServiceConstructor>;
|
|
37
|
-
/**
|
|
38
|
-
* Per-service configuration.
|
|
39
|
-
*
|
|
40
|
-
* @example
|
|
41
|
-
* ```typescript
|
|
42
|
-
* serviceConfigs: {
|
|
43
|
-
* kv: { prefix: 'myapp' },
|
|
44
|
-
* files: { maxSize: 10_000_000 },
|
|
45
|
-
* }
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
serviceConfigs?: Record<string, Record<string, unknown>>;
|
|
49
|
-
/**
|
|
50
|
-
* Retry policy for service operations.
|
|
51
|
-
*/
|
|
52
|
-
retryPolicy?: Partial<RetryPolicy>;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* TinyCloud SDK - Unified entry point for web and node.
|
|
56
|
-
*
|
|
57
|
-
* This class provides the main SDK interface. Platform-specific behavior
|
|
58
|
-
* is injected through the IUserAuthorization implementation:
|
|
59
|
-
* - WebUserAuthorization for browser environments
|
|
60
|
-
* - NodeUserAuthorization for Node.js environments
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* ```typescript
|
|
64
|
-
* // Web usage
|
|
65
|
-
* import { TinyCloud } from '@tinycloud/sdk-core';
|
|
66
|
-
* import { WebUserAuthorization } from '@tinycloud/web-sdk';
|
|
67
|
-
*
|
|
68
|
-
* const auth = new WebUserAuthorization({ ... });
|
|
69
|
-
* const tc = new TinyCloud(auth);
|
|
70
|
-
* await tc.signIn();
|
|
71
|
-
* const result = await tc.kv.put('key', 'value');
|
|
72
|
-
*
|
|
73
|
-
* // Node usage
|
|
74
|
-
* import { TinyCloud } from '@tinycloud/sdk-core';
|
|
75
|
-
* import { NodeUserAuthorization, PrivateKeySigner } from '@tinycloud/node-sdk';
|
|
76
|
-
*
|
|
77
|
-
* const signer = new PrivateKeySigner(process.env.PRIVATE_KEY);
|
|
78
|
-
* const auth = new NodeUserAuthorization({
|
|
79
|
-
* signStrategy: { type: 'auto-sign' },
|
|
80
|
-
* signer,
|
|
81
|
-
* domain: 'api.myapp.com'
|
|
82
|
-
* });
|
|
83
|
-
* const tc = new TinyCloud(auth);
|
|
84
|
-
* await tc.signIn();
|
|
85
|
-
* ```
|
|
86
|
-
*/
|
|
87
|
-
export declare class TinyCloud {
|
|
88
|
-
/**
|
|
89
|
-
* User authorization handler.
|
|
90
|
-
* Provides authentication and signing capabilities.
|
|
91
|
-
*/
|
|
92
|
-
readonly userAuthorization: IUserAuthorization;
|
|
93
|
-
/**
|
|
94
|
-
* SDK configuration.
|
|
95
|
-
*/
|
|
96
|
-
private config;
|
|
97
|
-
/**
|
|
98
|
-
* Registered extensions.
|
|
99
|
-
*/
|
|
100
|
-
private extensions;
|
|
101
|
-
/**
|
|
102
|
-
* Service context providing platform dependencies to services.
|
|
103
|
-
*/
|
|
104
|
-
private _serviceContext?;
|
|
105
|
-
/**
|
|
106
|
-
* Registered services by name.
|
|
107
|
-
*/
|
|
108
|
-
private _services;
|
|
109
|
-
/**
|
|
110
|
-
* Whether services have been initialized.
|
|
111
|
-
*/
|
|
112
|
-
private _servicesInitialized;
|
|
113
|
-
/**
|
|
114
|
-
* Create a new TinyCloud SDK instance.
|
|
115
|
-
*
|
|
116
|
-
* @param userAuthorization - Platform-specific authorization implementation
|
|
117
|
-
* @param config - Optional SDK configuration
|
|
118
|
-
*/
|
|
119
|
-
constructor(userAuthorization: IUserAuthorization, config?: TinyCloudConfig);
|
|
120
|
-
/**
|
|
121
|
-
* Initialize services with platform dependencies.
|
|
122
|
-
* Must be called before using services.
|
|
123
|
-
*
|
|
124
|
-
* @param invoke - Platform-specific invoke function from WASM binding
|
|
125
|
-
* @param hosts - TinyCloud host URLs (optional, uses config.hosts)
|
|
126
|
-
* @param fetchFn - Custom fetch implementation (optional)
|
|
127
|
-
*/
|
|
128
|
-
initializeServices(invoke?: InvokeFunction, hosts?: string[], fetchFn?: FetchFunction): void;
|
|
129
|
-
/**
|
|
130
|
-
* Get the service context.
|
|
131
|
-
* @throws Error if services are not initialized
|
|
132
|
-
*/
|
|
133
|
-
get serviceContext(): IServiceContext;
|
|
134
|
-
/**
|
|
135
|
-
* Get a registered service by name.
|
|
136
|
-
*
|
|
137
|
-
* @param name - Service name (e.g., 'kv')
|
|
138
|
-
* @returns The service instance or undefined
|
|
139
|
-
*/
|
|
140
|
-
getService<T extends IService>(name: string): T | undefined;
|
|
141
|
-
/**
|
|
142
|
-
* Get the KV service.
|
|
143
|
-
* @throws Error if services are not initialized
|
|
144
|
-
*/
|
|
145
|
-
get kv(): IKVService;
|
|
146
|
-
/**
|
|
147
|
-
* Get the SQL service.
|
|
148
|
-
* @throws Error if services are not initialized
|
|
149
|
-
*/
|
|
150
|
-
get sql(): ISQLService;
|
|
151
|
-
/**
|
|
152
|
-
* Get the DuckDB service.
|
|
153
|
-
* @throws Error if services are not initialized
|
|
154
|
-
*/
|
|
155
|
-
get duckdb(): IDuckDbService;
|
|
156
|
-
/**
|
|
157
|
-
* Get the Data Vault service.
|
|
158
|
-
* @throws Error if services are not initialized or vault service is not registered
|
|
159
|
-
*/
|
|
160
|
-
get vault(): IDataVaultService;
|
|
161
|
-
/**
|
|
162
|
-
* Notify services of session change.
|
|
163
|
-
* Called internally after sign-in and sign-out.
|
|
164
|
-
*
|
|
165
|
-
* @param session - The new session, or null if signed out
|
|
166
|
-
*/
|
|
167
|
-
private notifyServicesOfSessionChange;
|
|
168
|
-
/**
|
|
169
|
-
* Abort all pending service operations.
|
|
170
|
-
* Called internally before sign-out.
|
|
171
|
-
*/
|
|
172
|
-
private abortServiceOperations;
|
|
173
|
-
/**
|
|
174
|
-
* Convert ClientSession to ServiceSession.
|
|
175
|
-
* Returns null if session lacks required fields.
|
|
176
|
-
*/
|
|
177
|
-
private toServiceSession;
|
|
178
|
-
/**
|
|
179
|
-
* Add an extension to the SDK.
|
|
180
|
-
* Extensions can add capabilities and lifecycle hooks.
|
|
181
|
-
*/
|
|
182
|
-
extend(extension: Extension): void;
|
|
183
|
-
/**
|
|
184
|
-
* Check if an extension is enabled.
|
|
185
|
-
* @param namespace - The extension namespace to check
|
|
186
|
-
*/
|
|
187
|
-
isExtensionEnabled(namespace: string): boolean;
|
|
188
|
-
/**
|
|
189
|
-
* Get the current session, if signed in.
|
|
190
|
-
*/
|
|
191
|
-
get session(): ClientSession | undefined;
|
|
192
|
-
/**
|
|
193
|
-
* Check if the user is signed in.
|
|
194
|
-
*/
|
|
195
|
-
get isSignedIn(): boolean;
|
|
196
|
-
/**
|
|
197
|
-
* Sign in and create a new session.
|
|
198
|
-
* Notifies services of the new session after successful sign-in.
|
|
199
|
-
* @returns The new session
|
|
200
|
-
*/
|
|
201
|
-
signIn(): Promise<ClientSession>;
|
|
202
|
-
/**
|
|
203
|
-
* Sign out and clear the current session.
|
|
204
|
-
* Aborts pending service operations and notifies services.
|
|
205
|
-
*/
|
|
206
|
-
signOut(): Promise<void>;
|
|
207
|
-
/**
|
|
208
|
-
* Get the current wallet address.
|
|
209
|
-
*/
|
|
210
|
-
address(): string | undefined;
|
|
211
|
-
/**
|
|
212
|
-
* Get the current chain ID.
|
|
213
|
-
*/
|
|
214
|
-
chainId(): number | undefined;
|
|
215
|
-
/**
|
|
216
|
-
* Sign a message with the connected wallet.
|
|
217
|
-
* @param message - Message to sign
|
|
218
|
-
*/
|
|
219
|
-
signMessage(message: string): Promise<string>;
|
|
220
|
-
/**
|
|
221
|
-
* Cached public KV service instance.
|
|
222
|
-
*/
|
|
223
|
-
private _publicKV?;
|
|
224
|
-
/**
|
|
225
|
-
* Construct the deterministic public space ID for a given address and chain ID.
|
|
226
|
-
*
|
|
227
|
-
* @param address - Ethereum address (0x-prefixed)
|
|
228
|
-
* @param chainId - Chain ID (e.g., 1 for mainnet)
|
|
229
|
-
* @returns The public space ID
|
|
230
|
-
*/
|
|
231
|
-
static makePublicSpaceId(address: string, chainId: number): string;
|
|
232
|
-
/**
|
|
233
|
-
* Ensure the user's public space exists.
|
|
234
|
-
* Creates it via spaces.create('public') if it doesn't.
|
|
235
|
-
* Called automatically by modules that need to publish data.
|
|
236
|
-
*
|
|
237
|
-
* Requires the user to be signed in and services to be initialized.
|
|
238
|
-
*/
|
|
239
|
-
ensurePublicSpace(): Promise<Result<void, ServiceError>>;
|
|
240
|
-
/**
|
|
241
|
-
* Get a KVService scoped to the user's own public space.
|
|
242
|
-
* Writes require authentication (owner/delegate).
|
|
243
|
-
*
|
|
244
|
-
* @throws Error if not signed in or services not initialized
|
|
245
|
-
*/
|
|
246
|
-
get publicKV(): IKVService;
|
|
247
|
-
/**
|
|
248
|
-
* Read from any user's public space (unauthenticated).
|
|
249
|
-
* Uses the public REST endpoint — no session needed.
|
|
250
|
-
*
|
|
251
|
-
* @param host - TinyCloud server URL (e.g., "https://node.tinycloud.xyz")
|
|
252
|
-
* @param spaceId - Full public space ID
|
|
253
|
-
* @param key - Key to read
|
|
254
|
-
* @param fetchFn - Optional custom fetch function
|
|
255
|
-
* @returns The data at the key
|
|
256
|
-
*/
|
|
257
|
-
static readPublicSpace<T = unknown>(host: string, spaceId: string, key: string, fetchFn?: FetchFunction): Promise<Result<T, ServiceError>>;
|
|
258
|
-
/**
|
|
259
|
-
* Read from any user's public space by address (unauthenticated).
|
|
260
|
-
* Convenience method that constructs the space ID from address and chain ID.
|
|
261
|
-
*
|
|
262
|
-
* @param host - TinyCloud server URL
|
|
263
|
-
* @param address - Ethereum address (0x-prefixed)
|
|
264
|
-
* @param chainId - Chain ID (e.g., 1 for mainnet)
|
|
265
|
-
* @param key - Key to read
|
|
266
|
-
* @param fetchFn - Optional custom fetch function
|
|
267
|
-
* @returns The data at the key
|
|
268
|
-
*/
|
|
269
|
-
static readPublicKey<T = unknown>(host: string, address: string, chainId: number, key: string, fetchFn?: FetchFunction): Promise<Result<T, ServiceError>>;
|
|
270
|
-
}
|
|
271
|
-
//# sourceMappingURL=TinyCloud.d.ts.map
|
package/dist/TinyCloud.d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