@tinycloud/node-sdk 2.3.0-beta.7 → 2.3.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/{core-CNyXnUx9.d.cts → core-BdlIWB-K.d.cts} +19 -2
- package/dist/{core-CNyXnUx9.d.ts → core-BdlIWB-K.d.ts} +19 -2
- package/dist/core.cjs +66 -14
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +2 -2
- package/dist/core.d.ts +2 -2
- package/dist/core.js +66 -14
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +66 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +66 -14
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -17537,11 +17537,13 @@ var NodeUserAuthorization = class {
|
|
|
17537
17537
|
const request = this.getCapabilityRequest();
|
|
17538
17538
|
if (request === void 0) {
|
|
17539
17539
|
const defaultNetworkId = this.defaultEncryptionNetworkId(address, chainId);
|
|
17540
|
+
const primarySpaceId2 = (0, import_sdk_core.makePkhSpaceId)(address, chainId, this.spacePrefix);
|
|
17540
17541
|
const secretsSpaceId = (0, import_sdk_core.makePkhSpaceId)(address, chainId, "secrets");
|
|
17541
17542
|
return {
|
|
17542
17543
|
abilities: this.defaultActions,
|
|
17543
|
-
spaceId:
|
|
17544
|
+
spaceId: primarySpaceId2,
|
|
17544
17545
|
spaceAbilities: {
|
|
17546
|
+
[primarySpaceId2]: this.defaultActions,
|
|
17545
17547
|
[secretsSpaceId]: {
|
|
17546
17548
|
kv: {
|
|
17547
17549
|
"vault/secrets/": [
|
|
@@ -18138,14 +18140,15 @@ var NodeUserAuthorization = class {
|
|
|
18138
18140
|
// src/DelegatedAccess.ts
|
|
18139
18141
|
var import_sdk_core2 = require("@tinycloud/sdk-core");
|
|
18140
18142
|
var DelegatedAccess = class {
|
|
18141
|
-
constructor(session, delegation, host, invoke2) {
|
|
18143
|
+
constructor(session, delegation, host, invoke2, telemetry) {
|
|
18142
18144
|
this.session = session;
|
|
18143
18145
|
this._delegation = delegation;
|
|
18144
18146
|
this.host = host;
|
|
18145
18147
|
this._serviceContext = new import_sdk_core2.ServiceContext({
|
|
18146
18148
|
invoke: invoke2,
|
|
18147
18149
|
fetch: globalThis.fetch.bind(globalThis),
|
|
18148
|
-
hosts: [host]
|
|
18150
|
+
hosts: [host],
|
|
18151
|
+
telemetry
|
|
18149
18152
|
});
|
|
18150
18153
|
const prefix = this._delegation.path.replace(/\/$/, "");
|
|
18151
18154
|
this._kv = new import_sdk_core2.KVService({ prefix });
|
|
@@ -18726,7 +18729,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18726
18729
|
const kvContext = new import_sdk_core5.ServiceContext({
|
|
18727
18730
|
invoke: config2.invoke,
|
|
18728
18731
|
fetch: config2.fetch ?? globalThis.fetch.bind(globalThis),
|
|
18729
|
-
hosts: config2.hosts
|
|
18732
|
+
hosts: config2.hosts,
|
|
18733
|
+
telemetry: this.config.telemetry
|
|
18730
18734
|
});
|
|
18731
18735
|
kvContext.setSession(config2.session);
|
|
18732
18736
|
kvService.initialize(kvContext);
|
|
@@ -18783,7 +18787,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18783
18787
|
includeAccountRegistryPermissions: config.includeAccountRegistryPermissions
|
|
18784
18788
|
});
|
|
18785
18789
|
this.tc = new import_sdk_core5.TinyCloud(this.auth, {
|
|
18786
|
-
invokeAny: this.invokeAnyWithRuntimePermissions
|
|
18790
|
+
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
18791
|
+
telemetry: config.telemetry
|
|
18787
18792
|
});
|
|
18788
18793
|
}
|
|
18789
18794
|
syncResolvedHostFromAuth() {
|
|
@@ -19015,7 +19020,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19015
19020
|
invoke: this.invokeWithRuntimePermissions,
|
|
19016
19021
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
19017
19022
|
fetch: globalThis.fetch.bind(globalThis),
|
|
19018
|
-
hosts: [this.config.host]
|
|
19023
|
+
hosts: [this.config.host],
|
|
19024
|
+
telemetry: this.config.telemetry
|
|
19019
19025
|
});
|
|
19020
19026
|
this._kv = new import_sdk_core5.KVService({});
|
|
19021
19027
|
this._kv.initialize(this._serviceContext);
|
|
@@ -19126,7 +19132,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19126
19132
|
includeAccountRegistryPermissions: this.config.includeAccountRegistryPermissions
|
|
19127
19133
|
});
|
|
19128
19134
|
this.tc = new import_sdk_core5.TinyCloud(this.auth, {
|
|
19129
|
-
invokeAny: this.invokeAnyWithRuntimePermissions
|
|
19135
|
+
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
19136
|
+
telemetry: this.config.telemetry
|
|
19130
19137
|
});
|
|
19131
19138
|
this.config.prefix = prefix;
|
|
19132
19139
|
}
|
|
@@ -19170,7 +19177,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19170
19177
|
includeAccountRegistryPermissions: this.config.includeAccountRegistryPermissions
|
|
19171
19178
|
});
|
|
19172
19179
|
this.tc = new import_sdk_core5.TinyCloud(this.auth, {
|
|
19173
|
-
invokeAny: this.invokeAnyWithRuntimePermissions
|
|
19180
|
+
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
19181
|
+
telemetry: this.config.telemetry
|
|
19174
19182
|
});
|
|
19175
19183
|
this.config.prefix = prefix;
|
|
19176
19184
|
}
|
|
@@ -19188,7 +19196,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19188
19196
|
invoke: this.invokeWithRuntimePermissions,
|
|
19189
19197
|
invokeAny: this.invokeAnyWithRuntimePermissions,
|
|
19190
19198
|
fetch: globalThis.fetch.bind(globalThis),
|
|
19191
|
-
hosts: [this.config.host]
|
|
19199
|
+
hosts: [this.config.host],
|
|
19200
|
+
telemetry: this.config.telemetry
|
|
19192
19201
|
});
|
|
19193
19202
|
this._kv = new import_sdk_core5.KVService({});
|
|
19194
19203
|
this._kv.initialize(this._serviceContext);
|
|
@@ -19227,7 +19236,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19227
19236
|
const spaceScopedContext = new import_sdk_core5.ServiceContext({
|
|
19228
19237
|
invoke: this._serviceContext.invoke,
|
|
19229
19238
|
fetch: this._serviceContext.fetch,
|
|
19230
|
-
hosts: this._serviceContext.hosts
|
|
19239
|
+
hosts: this._serviceContext.hosts,
|
|
19240
|
+
telemetry: this.config.telemetry
|
|
19231
19241
|
});
|
|
19232
19242
|
const session = this._serviceContext.session;
|
|
19233
19243
|
if (session) {
|
|
@@ -19792,12 +19802,41 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19792
19802
|
const spaceScopedContext = new import_sdk_core5.ServiceContext({
|
|
19793
19803
|
invoke: this._serviceContext.invoke,
|
|
19794
19804
|
fetch: this._serviceContext.fetch,
|
|
19795
|
-
hosts: this._serviceContext.hosts
|
|
19805
|
+
hosts: this._serviceContext.hosts,
|
|
19806
|
+
telemetry: this.config.telemetry
|
|
19796
19807
|
});
|
|
19797
19808
|
spaceScopedContext.setSession({ ...this._serviceContext.session, spaceId });
|
|
19798
19809
|
sql.initialize(spaceScopedContext);
|
|
19799
19810
|
return sql;
|
|
19800
19811
|
}
|
|
19812
|
+
/**
|
|
19813
|
+
* Get a KV service scoped to a specific space.
|
|
19814
|
+
*
|
|
19815
|
+
* The KV counterpart to {@link sqlForSpace}: clones the active service
|
|
19816
|
+
* context and overrides its session's spaceId so that subsequent
|
|
19817
|
+
* `kv/<action>` invocations route to that space. Useful for reading data
|
|
19818
|
+
* that a manifest app stores outside the primary space (e.g. transcripts a
|
|
19819
|
+
* `defaults: true` app keeps under the owner's `applications` space), when
|
|
19820
|
+
* the caller already holds a delegation covering the target space.
|
|
19821
|
+
*
|
|
19822
|
+
* Does NOT auto-create the space.
|
|
19823
|
+
*
|
|
19824
|
+
* @param spaceId - Full space URI (`tinycloud:pkh:eip155:<chain>:<addr>:<name>`).
|
|
19825
|
+
*/
|
|
19826
|
+
kvForSpace(spaceId) {
|
|
19827
|
+
if (!this._serviceContext || !this._serviceContext.session) {
|
|
19828
|
+
throw new Error("Not signed in. Call signIn() first.");
|
|
19829
|
+
}
|
|
19830
|
+
const kv = new import_sdk_core5.KVService({});
|
|
19831
|
+
const spaceScopedContext = new import_sdk_core5.ServiceContext({
|
|
19832
|
+
invoke: this._serviceContext.invoke,
|
|
19833
|
+
fetch: this._serviceContext.fetch,
|
|
19834
|
+
hosts: this._serviceContext.hosts
|
|
19835
|
+
});
|
|
19836
|
+
spaceScopedContext.setSession({ ...this._serviceContext.session, spaceId });
|
|
19837
|
+
kv.initialize(spaceScopedContext);
|
|
19838
|
+
return kv;
|
|
19839
|
+
}
|
|
19801
19840
|
/**
|
|
19802
19841
|
* DuckDB database operations on this user's space.
|
|
19803
19842
|
*/
|
|
@@ -20364,7 +20403,8 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
20364
20403
|
const publicContext = new import_sdk_core5.ServiceContext({
|
|
20365
20404
|
invoke: this.invokeWithRuntimePermissions,
|
|
20366
20405
|
fetch: this._serviceContext.fetch,
|
|
20367
|
-
hosts: this._serviceContext.hosts
|
|
20406
|
+
hosts: this._serviceContext.hosts,
|
|
20407
|
+
telemetry: this.config.telemetry
|
|
20368
20408
|
});
|
|
20369
20409
|
publicContext.setSession({
|
|
20370
20410
|
delegationHeader: delegationSession.delegationHeader,
|
|
@@ -21260,7 +21300,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21260
21300
|
},
|
|
21261
21301
|
delegation.expiry
|
|
21262
21302
|
);
|
|
21263
|
-
return new DelegatedAccess(
|
|
21303
|
+
return new DelegatedAccess(
|
|
21304
|
+
session2,
|
|
21305
|
+
delegation,
|
|
21306
|
+
targetHost,
|
|
21307
|
+
this.wasmBindings.invoke,
|
|
21308
|
+
this.config.telemetry
|
|
21309
|
+
);
|
|
21264
21310
|
}
|
|
21265
21311
|
const mySession = this.auth?.tinyCloudSession;
|
|
21266
21312
|
if (!mySession) {
|
|
@@ -21338,7 +21384,13 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
21338
21384
|
},
|
|
21339
21385
|
expirationTime
|
|
21340
21386
|
);
|
|
21341
|
-
return new DelegatedAccess(
|
|
21387
|
+
return new DelegatedAccess(
|
|
21388
|
+
session,
|
|
21389
|
+
delegation,
|
|
21390
|
+
targetHost,
|
|
21391
|
+
this.wasmBindings.invoke,
|
|
21392
|
+
this.config.telemetry
|
|
21393
|
+
);
|
|
21342
21394
|
}
|
|
21343
21395
|
/**
|
|
21344
21396
|
* Create a sub-delegation from a received delegation.
|