@tinycloud/node-sdk 1.5.0 → 1.7.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 +174 -34
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +19 -2
- package/dist/index.d.ts +19 -2
- package/dist/index.js +159 -18
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -13751,9 +13751,9 @@ var init_lib20 = __esm({
|
|
|
13751
13751
|
}
|
|
13752
13752
|
});
|
|
13753
13753
|
|
|
13754
|
-
// ../../node_modules/aes-js/index.js
|
|
13754
|
+
// ../../node_modules/@ethersproject/json-wallets/node_modules/aes-js/index.js
|
|
13755
13755
|
var require_aes_js = __commonJS({
|
|
13756
|
-
"../../node_modules/aes-js/index.js"(exports2, module2) {
|
|
13756
|
+
"../../node_modules/@ethersproject/json-wallets/node_modules/aes-js/index.js"(exports2, module2) {
|
|
13757
13757
|
"use strict";
|
|
13758
13758
|
(function(root) {
|
|
13759
13759
|
function checkInt(value) {
|
|
@@ -17025,44 +17025,48 @@ var require_utils2 = __commonJS({
|
|
|
17025
17025
|
// src/index.ts
|
|
17026
17026
|
var index_exports = {};
|
|
17027
17027
|
__export(index_exports, {
|
|
17028
|
-
CapabilityKeyRegistry: () =>
|
|
17029
|
-
CapabilityKeyRegistryErrorCodes: () =>
|
|
17030
|
-
DataVaultService: () =>
|
|
17028
|
+
CapabilityKeyRegistry: () => import_sdk_core11.CapabilityKeyRegistry,
|
|
17029
|
+
CapabilityKeyRegistryErrorCodes: () => import_sdk_core11.CapabilityKeyRegistryErrorCodes,
|
|
17030
|
+
DataVaultService: () => import_sdk_core9.DataVaultService,
|
|
17031
17031
|
DatabaseHandle: () => import_sdk_core7.DatabaseHandle,
|
|
17032
17032
|
DelegatedAccess: () => DelegatedAccess,
|
|
17033
|
-
DelegationErrorCodes: () =>
|
|
17034
|
-
DelegationManager: () =>
|
|
17033
|
+
DelegationErrorCodes: () => import_sdk_core10.DelegationErrorCodes,
|
|
17034
|
+
DelegationManager: () => import_sdk_core10.DelegationManager,
|
|
17035
|
+
DuckDbAction: () => import_sdk_core8.DuckDbAction,
|
|
17036
|
+
DuckDbDatabaseHandle: () => import_sdk_core8.DuckDbDatabaseHandle,
|
|
17037
|
+
DuckDbService: () => import_sdk_core8.DuckDbService,
|
|
17035
17038
|
FileSessionStorage: () => FileSessionStorage,
|
|
17036
17039
|
KVService: () => import_sdk_core6.KVService,
|
|
17037
17040
|
MemorySessionStorage: () => MemorySessionStorage,
|
|
17038
17041
|
NodeUserAuthorization: () => NodeUserAuthorization,
|
|
17039
17042
|
PrefixedKVService: () => import_sdk_core6.PrefixedKVService,
|
|
17040
17043
|
PrivateKeySigner: () => PrivateKeySigner,
|
|
17041
|
-
ProtocolMismatchError: () =>
|
|
17044
|
+
ProtocolMismatchError: () => import_sdk_core13.ProtocolMismatchError,
|
|
17042
17045
|
SQLAction: () => import_sdk_core7.SQLAction,
|
|
17043
17046
|
SQLService: () => import_sdk_core7.SQLService,
|
|
17044
|
-
ServiceContext: () =>
|
|
17045
|
-
SharingService: () =>
|
|
17046
|
-
Space: () =>
|
|
17047
|
-
SpaceErrorCodes: () =>
|
|
17048
|
-
SpaceService: () =>
|
|
17047
|
+
ServiceContext: () => import_sdk_core14.ServiceContext,
|
|
17048
|
+
SharingService: () => import_sdk_core10.SharingService,
|
|
17049
|
+
Space: () => import_sdk_core12.Space,
|
|
17050
|
+
SpaceErrorCodes: () => import_sdk_core12.SpaceErrorCodes,
|
|
17051
|
+
SpaceService: () => import_sdk_core12.SpaceService,
|
|
17049
17052
|
TinyCloud: () => import_sdk_core5.TinyCloud,
|
|
17050
17053
|
TinyCloudNode: () => TinyCloudNode,
|
|
17051
|
-
|
|
17052
|
-
VaultHeaders: () =>
|
|
17053
|
-
|
|
17054
|
+
UnsupportedFeatureError: () => import_sdk_core13.UnsupportedFeatureError,
|
|
17055
|
+
VaultHeaders: () => import_sdk_core9.VaultHeaders,
|
|
17056
|
+
VaultPublicSpaceKVActions: () => import_sdk_core9.VaultPublicSpaceKVActions,
|
|
17057
|
+
VersionCheckError: () => import_sdk_core13.VersionCheckError,
|
|
17054
17058
|
WasmKeyProvider: () => WasmKeyProvider,
|
|
17055
|
-
buildSpaceUri: () =>
|
|
17056
|
-
|
|
17057
|
-
createCapabilityKeyRegistry: () =>
|
|
17058
|
-
createSharingService: () =>
|
|
17059
|
-
createSpaceService: () =>
|
|
17060
|
-
createVaultCrypto: () =>
|
|
17059
|
+
buildSpaceUri: () => import_sdk_core12.buildSpaceUri,
|
|
17060
|
+
checkNodeInfo: () => import_sdk_core13.checkNodeInfo,
|
|
17061
|
+
createCapabilityKeyRegistry: () => import_sdk_core11.createCapabilityKeyRegistry,
|
|
17062
|
+
createSharingService: () => import_sdk_core10.createSharingService,
|
|
17063
|
+
createSpaceService: () => import_sdk_core12.createSpaceService,
|
|
17064
|
+
createVaultCrypto: () => import_sdk_core9.createVaultCrypto,
|
|
17061
17065
|
createWasmKeyProvider: () => createWasmKeyProvider,
|
|
17062
17066
|
defaultSignStrategy: () => defaultSignStrategy,
|
|
17063
17067
|
deserializeDelegation: () => deserializeDelegation,
|
|
17064
|
-
makePublicSpaceId: () =>
|
|
17065
|
-
parseSpaceUri: () =>
|
|
17068
|
+
makePublicSpaceId: () => import_sdk_core12.makePublicSpaceId,
|
|
17069
|
+
parseSpaceUri: () => import_sdk_core12.parseSpaceUri,
|
|
17066
17070
|
serializeDelegation: () => serializeDelegation
|
|
17067
17071
|
});
|
|
17068
17072
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -17333,6 +17337,7 @@ var defaultSignStrategy = { type: "auto-sign" };
|
|
|
17333
17337
|
var _NodeUserAuthorization = class _NodeUserAuthorization {
|
|
17334
17338
|
constructor(config) {
|
|
17335
17339
|
this.extensions = [];
|
|
17340
|
+
this._nodeFeatures = [];
|
|
17336
17341
|
if (!_NodeUserAuthorization.wasmInitialized) {
|
|
17337
17342
|
(0, import_node_sdk_wasm2.initPanicHook)();
|
|
17338
17343
|
_NodeUserAuthorization.wasmInitialized = true;
|
|
@@ -17362,6 +17367,17 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
|
|
|
17362
17367
|
"tinycloud.sql/export"
|
|
17363
17368
|
]
|
|
17364
17369
|
},
|
|
17370
|
+
duckdb: {
|
|
17371
|
+
"": [
|
|
17372
|
+
"tinycloud.duckdb/read",
|
|
17373
|
+
"tinycloud.duckdb/write",
|
|
17374
|
+
"tinycloud.duckdb/admin",
|
|
17375
|
+
"tinycloud.duckdb/describe",
|
|
17376
|
+
"tinycloud.duckdb/export",
|
|
17377
|
+
"tinycloud.duckdb/import",
|
|
17378
|
+
"tinycloud.duckdb/execute"
|
|
17379
|
+
]
|
|
17380
|
+
},
|
|
17365
17381
|
capabilities: {
|
|
17366
17382
|
"": ["tinycloud.capabilities/read"]
|
|
17367
17383
|
}
|
|
@@ -17385,6 +17401,9 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
|
|
|
17385
17401
|
get tinyCloudSession() {
|
|
17386
17402
|
return this._tinyCloudSession;
|
|
17387
17403
|
}
|
|
17404
|
+
get nodeFeatures() {
|
|
17405
|
+
return this._nodeFeatures;
|
|
17406
|
+
}
|
|
17388
17407
|
/**
|
|
17389
17408
|
* Add an extension to the authorization flow.
|
|
17390
17409
|
*/
|
|
@@ -17580,7 +17599,8 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
|
|
|
17580
17599
|
this._tinyCloudSession = tinyCloudSession;
|
|
17581
17600
|
this._address = address;
|
|
17582
17601
|
this._chainId = chainId;
|
|
17583
|
-
await (0, import_sdk_core2.
|
|
17602
|
+
const nodeInfo = await (0, import_sdk_core2.checkNodeInfo)(this.tinycloudHosts[0], (0, import_node_sdk_wasm2.protocolVersion)());
|
|
17603
|
+
this._nodeFeatures = nodeInfo.features;
|
|
17584
17604
|
for (const ext of this.extensions) {
|
|
17585
17605
|
if (ext.afterSignIn) {
|
|
17586
17606
|
await ext.afterSignIn(clientSession);
|
|
@@ -17738,7 +17758,8 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
|
|
|
17738
17758
|
this._tinyCloudSession = tinyCloudSession;
|
|
17739
17759
|
this._address = address;
|
|
17740
17760
|
this._chainId = chainId;
|
|
17741
|
-
await (0, import_sdk_core2.
|
|
17761
|
+
const nodeInfo = await (0, import_sdk_core2.checkNodeInfo)(this.tinycloudHosts[0], (0, import_node_sdk_wasm2.protocolVersion)());
|
|
17762
|
+
this._nodeFeatures = nodeInfo.features;
|
|
17742
17763
|
for (const ext of this.extensions) {
|
|
17743
17764
|
if (ext.afterSignIn) {
|
|
17744
17765
|
await ext.afterSignIn(clientSession);
|
|
@@ -17842,6 +17863,9 @@ var DelegatedAccess = class {
|
|
|
17842
17863
|
this._sql = new import_sdk_core3.SQLService({});
|
|
17843
17864
|
this._sql.initialize(this._serviceContext);
|
|
17844
17865
|
this._serviceContext.registerService("sql", this._sql);
|
|
17866
|
+
this._duckdb = new import_sdk_core3.DuckDbService({});
|
|
17867
|
+
this._duckdb.initialize(this._serviceContext);
|
|
17868
|
+
this._serviceContext.registerService("duckdb", this._duckdb);
|
|
17845
17869
|
const serviceSession = {
|
|
17846
17870
|
delegationHeader: session.delegationHeader,
|
|
17847
17871
|
delegationCid: session.delegationCid,
|
|
@@ -17881,6 +17905,12 @@ var DelegatedAccess = class {
|
|
|
17881
17905
|
get sql() {
|
|
17882
17906
|
return this._sql;
|
|
17883
17907
|
}
|
|
17908
|
+
/**
|
|
17909
|
+
* DuckDB operations on the delegated space.
|
|
17910
|
+
*/
|
|
17911
|
+
get duckdb() {
|
|
17912
|
+
return this._duckdb;
|
|
17913
|
+
}
|
|
17884
17914
|
};
|
|
17885
17915
|
|
|
17886
17916
|
// src/keys/WasmKeyProvider.ts
|
|
@@ -18053,6 +18083,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18053
18083
|
this.tc = new import_sdk_core4.TinyCloud(this.auth);
|
|
18054
18084
|
}
|
|
18055
18085
|
}
|
|
18086
|
+
get nodeFeatures() {
|
|
18087
|
+
return this.auth?.nodeFeatures ?? [];
|
|
18088
|
+
}
|
|
18056
18089
|
/**
|
|
18057
18090
|
* Get the primary identity DID for this user.
|
|
18058
18091
|
* - If wallet connected and signed in: returns PKH DID (did:pkh:eip155:{chainId}:{address})
|
|
@@ -18118,6 +18151,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18118
18151
|
this._chainId = await this.signer.getChainId();
|
|
18119
18152
|
this._kv = void 0;
|
|
18120
18153
|
this._sql = void 0;
|
|
18154
|
+
this._duckdb = void 0;
|
|
18121
18155
|
this._serviceContext = void 0;
|
|
18122
18156
|
await this.tc.signIn();
|
|
18123
18157
|
this.initializeServices();
|
|
@@ -18134,6 +18168,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18134
18168
|
async restoreSession(sessionData) {
|
|
18135
18169
|
this._kv = void 0;
|
|
18136
18170
|
this._sql = void 0;
|
|
18171
|
+
this._duckdb = void 0;
|
|
18137
18172
|
this._serviceContext = void 0;
|
|
18138
18173
|
if (sessionData.address) {
|
|
18139
18174
|
this._address = sessionData.address;
|
|
@@ -18152,6 +18187,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18152
18187
|
this._sql = new import_sdk_core4.SQLService({});
|
|
18153
18188
|
this._sql.initialize(this._serviceContext);
|
|
18154
18189
|
this._serviceContext.registerService("sql", this._sql);
|
|
18190
|
+
this._duckdb = new import_sdk_core4.DuckDbService({});
|
|
18191
|
+
this._duckdb.initialize(this._serviceContext);
|
|
18192
|
+
this._serviceContext.registerService("duckdb", this._duckdb);
|
|
18155
18193
|
const serviceSession = {
|
|
18156
18194
|
delegationHeader: sessionData.delegationHeader,
|
|
18157
18195
|
delegationCid: sessionData.delegationCid,
|
|
@@ -18227,9 +18265,17 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18227
18265
|
this._kv = new import_sdk_core4.KVService({});
|
|
18228
18266
|
this._kv.initialize(this._serviceContext);
|
|
18229
18267
|
this._serviceContext.registerService("kv", this._kv);
|
|
18230
|
-
|
|
18231
|
-
|
|
18232
|
-
|
|
18268
|
+
const features = this.nodeFeatures;
|
|
18269
|
+
if (features.length === 0 || features.includes("sql")) {
|
|
18270
|
+
this._sql = new import_sdk_core4.SQLService({});
|
|
18271
|
+
this._sql.initialize(this._serviceContext);
|
|
18272
|
+
this._serviceContext.registerService("sql", this._sql);
|
|
18273
|
+
}
|
|
18274
|
+
if (features.length === 0 || features.includes("duckdb")) {
|
|
18275
|
+
this._duckdb = new import_sdk_core4.DuckDbService({});
|
|
18276
|
+
this._duckdb.initialize(this._serviceContext);
|
|
18277
|
+
this._serviceContext.registerService("duckdb", this._duckdb);
|
|
18278
|
+
}
|
|
18233
18279
|
const serviceSession = {
|
|
18234
18280
|
delegationHeader: session.delegationHeader,
|
|
18235
18281
|
delegationCid: session.delegationCid,
|
|
@@ -18309,7 +18355,14 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18309
18355
|
"tinycloud.sql/read",
|
|
18310
18356
|
"tinycloud.sql/write",
|
|
18311
18357
|
"tinycloud.sql/admin",
|
|
18312
|
-
"tinycloud.sql/*"
|
|
18358
|
+
"tinycloud.sql/*",
|
|
18359
|
+
"tinycloud.duckdb/read",
|
|
18360
|
+
"tinycloud.duckdb/write",
|
|
18361
|
+
"tinycloud.duckdb/admin",
|
|
18362
|
+
"tinycloud.duckdb/describe",
|
|
18363
|
+
"tinycloud.duckdb/export",
|
|
18364
|
+
"tinycloud.duckdb/import",
|
|
18365
|
+
"tinycloud.duckdb/*"
|
|
18313
18366
|
],
|
|
18314
18367
|
expiry: this.getSessionExpiry(),
|
|
18315
18368
|
isRevoked: false,
|
|
@@ -18332,7 +18385,14 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18332
18385
|
"tinycloud.sql/read",
|
|
18333
18386
|
"tinycloud.sql/write",
|
|
18334
18387
|
"tinycloud.sql/admin",
|
|
18335
|
-
"tinycloud.sql/*"
|
|
18388
|
+
"tinycloud.sql/*",
|
|
18389
|
+
"tinycloud.duckdb/read",
|
|
18390
|
+
"tinycloud.duckdb/write",
|
|
18391
|
+
"tinycloud.duckdb/admin",
|
|
18392
|
+
"tinycloud.duckdb/describe",
|
|
18393
|
+
"tinycloud.duckdb/export",
|
|
18394
|
+
"tinycloud.duckdb/import",
|
|
18395
|
+
"tinycloud.duckdb/*"
|
|
18336
18396
|
],
|
|
18337
18397
|
expiry: this.getSessionExpiry(),
|
|
18338
18398
|
isRevoked: false,
|
|
@@ -18498,10 +18558,27 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18498
18558
|
*/
|
|
18499
18559
|
get sql() {
|
|
18500
18560
|
if (!this._sql) {
|
|
18561
|
+
const features = this.nodeFeatures;
|
|
18562
|
+
if (features.length > 0 && !features.includes("sql")) {
|
|
18563
|
+
throw new import_sdk_core4.UnsupportedFeatureError("sql", this.config.host, features);
|
|
18564
|
+
}
|
|
18501
18565
|
throw new Error("Not signed in. Call signIn() first.");
|
|
18502
18566
|
}
|
|
18503
18567
|
return this._sql;
|
|
18504
18568
|
}
|
|
18569
|
+
/**
|
|
18570
|
+
* DuckDB database operations on this user's space.
|
|
18571
|
+
*/
|
|
18572
|
+
get duckdb() {
|
|
18573
|
+
if (!this._duckdb) {
|
|
18574
|
+
const features = this.nodeFeatures;
|
|
18575
|
+
if (features.length > 0 && !features.includes("duckdb")) {
|
|
18576
|
+
throw new import_sdk_core4.UnsupportedFeatureError("duckdb", this.config.host, features);
|
|
18577
|
+
}
|
|
18578
|
+
throw new Error("Not signed in. Call signIn() first.");
|
|
18579
|
+
}
|
|
18580
|
+
return this._duckdb;
|
|
18581
|
+
}
|
|
18505
18582
|
/**
|
|
18506
18583
|
* Data Vault operations - client-side encrypted KV storage.
|
|
18507
18584
|
* Call `vault.unlock(signer)` after signIn() to derive encryption keys.
|
|
@@ -18859,12 +18936,16 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18859
18936
|
const abilities = {};
|
|
18860
18937
|
const kvActions = params.actions.filter((a) => a.startsWith("tinycloud.kv/"));
|
|
18861
18938
|
const sqlActions = params.actions.filter((a) => a.startsWith("tinycloud.sql/"));
|
|
18939
|
+
const duckdbActions = params.actions.filter((a) => a.startsWith("tinycloud.duckdb/"));
|
|
18862
18940
|
if (kvActions.length > 0) {
|
|
18863
18941
|
abilities.kv = { [params.path]: kvActions };
|
|
18864
18942
|
}
|
|
18865
18943
|
if (sqlActions.length > 0) {
|
|
18866
18944
|
abilities.sql = { [params.path]: sqlActions };
|
|
18867
18945
|
}
|
|
18946
|
+
if (duckdbActions.length > 0) {
|
|
18947
|
+
abilities.duckdb = { [params.path]: duckdbActions };
|
|
18948
|
+
}
|
|
18868
18949
|
const now = /* @__PURE__ */ new Date();
|
|
18869
18950
|
const expiryMs = params.expiryMs ?? 60 * 60 * 1e3;
|
|
18870
18951
|
const expirationTime = new Date(now.getTime() + expiryMs);
|
|
@@ -18891,7 +18972,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18891
18972
|
if (!activateResult.success) {
|
|
18892
18973
|
throw new Error(`Failed to activate delegation: ${activateResult.error}`);
|
|
18893
18974
|
}
|
|
18894
|
-
|
|
18975
|
+
const result = {
|
|
18895
18976
|
cid: delegationSession.delegationCid,
|
|
18896
18977
|
delegationHeader: delegationSession.delegationHeader,
|
|
18897
18978
|
spaceId: params.spaceIdOverride ?? session.spaceId,
|
|
@@ -18904,6 +18985,52 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18904
18985
|
chainId: session.chainId,
|
|
18905
18986
|
host: this.config.host
|
|
18906
18987
|
};
|
|
18988
|
+
const hasKvActions = params.actions.some((a) => a.startsWith("tinycloud.kv/"));
|
|
18989
|
+
if (hasKvActions && params.includePublicSpace !== false) {
|
|
18990
|
+
const publicSpaceId = (0, import_sdk_core4.makePublicSpaceId)(
|
|
18991
|
+
(0, import_node_sdk_wasm4.ensureEip55)(session.address),
|
|
18992
|
+
session.chainId
|
|
18993
|
+
);
|
|
18994
|
+
const publicAbilities = {
|
|
18995
|
+
kv: { "": ["tinycloud.kv/get", "tinycloud.kv/put", "tinycloud.kv/metadata"] }
|
|
18996
|
+
};
|
|
18997
|
+
const publicPrepared = (0, import_node_sdk_wasm4.prepareSession)({
|
|
18998
|
+
abilities: publicAbilities,
|
|
18999
|
+
address: (0, import_node_sdk_wasm4.ensureEip55)(session.address),
|
|
19000
|
+
chainId: session.chainId,
|
|
19001
|
+
domain: new URL(this.config.host).hostname,
|
|
19002
|
+
issuedAt: now.toISOString(),
|
|
19003
|
+
expirationTime: expirationTime.toISOString(),
|
|
19004
|
+
spaceId: publicSpaceId,
|
|
19005
|
+
delegateUri: params.delegateDID,
|
|
19006
|
+
parents: [session.delegationCid]
|
|
19007
|
+
});
|
|
19008
|
+
const publicSignature = await this.signer.signMessage(publicPrepared.siwe);
|
|
19009
|
+
const publicSession = (0, import_node_sdk_wasm4.completeSessionSetup)({
|
|
19010
|
+
...publicPrepared,
|
|
19011
|
+
signature: publicSignature
|
|
19012
|
+
});
|
|
19013
|
+
const publicActivateResult = await (0, import_sdk_core4.activateSessionWithHost)(
|
|
19014
|
+
this.config.host,
|
|
19015
|
+
publicSession.delegationHeader
|
|
19016
|
+
);
|
|
19017
|
+
if (publicActivateResult.success) {
|
|
19018
|
+
result.publicDelegation = {
|
|
19019
|
+
cid: publicSession.delegationCid,
|
|
19020
|
+
delegationHeader: publicSession.delegationHeader,
|
|
19021
|
+
spaceId: publicSpaceId,
|
|
19022
|
+
path: "",
|
|
19023
|
+
actions: ["tinycloud.kv/get", "tinycloud.kv/put", "tinycloud.kv/metadata"],
|
|
19024
|
+
disableSubDelegation: params.disableSubDelegation ?? false,
|
|
19025
|
+
expiry: expirationTime,
|
|
19026
|
+
delegateDID: params.delegateDID,
|
|
19027
|
+
ownerAddress: session.address,
|
|
19028
|
+
chainId: session.chainId,
|
|
19029
|
+
host: this.config.host
|
|
19030
|
+
};
|
|
19031
|
+
}
|
|
19032
|
+
}
|
|
19033
|
+
return result;
|
|
18907
19034
|
}
|
|
18908
19035
|
/**
|
|
18909
19036
|
* Use a delegation received from another user.
|
|
@@ -18953,12 +19080,16 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
18953
19080
|
const abilities = {};
|
|
18954
19081
|
const kvActions = delegation.actions.filter((a) => a.startsWith("tinycloud.kv/"));
|
|
18955
19082
|
const sqlActions = delegation.actions.filter((a) => a.startsWith("tinycloud.sql/"));
|
|
19083
|
+
const duckdbActions = delegation.actions.filter((a) => a.startsWith("tinycloud.duckdb/"));
|
|
18956
19084
|
if (kvActions.length > 0) {
|
|
18957
19085
|
abilities.kv = { [delegation.path]: kvActions };
|
|
18958
19086
|
}
|
|
18959
19087
|
if (sqlActions.length > 0) {
|
|
18960
19088
|
abilities.sql = { [delegation.path]: sqlActions };
|
|
18961
19089
|
}
|
|
19090
|
+
if (duckdbActions.length > 0) {
|
|
19091
|
+
abilities.duckdb = { [delegation.path]: duckdbActions };
|
|
19092
|
+
}
|
|
18962
19093
|
const now = /* @__PURE__ */ new Date();
|
|
18963
19094
|
const maxExpiry = new Date(now.getTime() + 60 * 60 * 1e3);
|
|
18964
19095
|
const expirationTime = delegation.expiry < maxExpiry ? delegation.expiry : maxExpiry;
|
|
@@ -19040,12 +19171,16 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
19040
19171
|
const abilities = {};
|
|
19041
19172
|
const kvActions = params.actions.filter((a) => a.startsWith("tinycloud.kv/"));
|
|
19042
19173
|
const sqlActions = params.actions.filter((a) => a.startsWith("tinycloud.sql/"));
|
|
19174
|
+
const duckdbActions = params.actions.filter((a) => a.startsWith("tinycloud.duckdb/"));
|
|
19043
19175
|
if (kvActions.length > 0) {
|
|
19044
19176
|
abilities.kv = { [params.path]: kvActions };
|
|
19045
19177
|
}
|
|
19046
19178
|
if (sqlActions.length > 0) {
|
|
19047
19179
|
abilities.sql = { [params.path]: sqlActions };
|
|
19048
19180
|
}
|
|
19181
|
+
if (duckdbActions.length > 0) {
|
|
19182
|
+
abilities.duckdb = { [params.path]: duckdbActions };
|
|
19183
|
+
}
|
|
19049
19184
|
const targetHost = parentDelegation.host ?? this.config.host;
|
|
19050
19185
|
const prepared = (0, import_node_sdk_wasm4.prepareSession)({
|
|
19051
19186
|
abilities,
|
|
@@ -19114,6 +19249,7 @@ var import_sdk_core10 = require("@tinycloud/sdk-core");
|
|
|
19114
19249
|
var import_sdk_core11 = require("@tinycloud/sdk-core");
|
|
19115
19250
|
var import_sdk_core12 = require("@tinycloud/sdk-core");
|
|
19116
19251
|
var import_sdk_core13 = require("@tinycloud/sdk-core");
|
|
19252
|
+
var import_sdk_core14 = require("@tinycloud/sdk-core");
|
|
19117
19253
|
// Annotate the CommonJS export names for ESM import in node:
|
|
19118
19254
|
0 && (module.exports = {
|
|
19119
19255
|
CapabilityKeyRegistry,
|
|
@@ -19123,6 +19259,9 @@ var import_sdk_core13 = require("@tinycloud/sdk-core");
|
|
|
19123
19259
|
DelegatedAccess,
|
|
19124
19260
|
DelegationErrorCodes,
|
|
19125
19261
|
DelegationManager,
|
|
19262
|
+
DuckDbAction,
|
|
19263
|
+
DuckDbDatabaseHandle,
|
|
19264
|
+
DuckDbService,
|
|
19126
19265
|
FileSessionStorage,
|
|
19127
19266
|
KVService,
|
|
19128
19267
|
MemorySessionStorage,
|
|
@@ -19139,12 +19278,13 @@ var import_sdk_core13 = require("@tinycloud/sdk-core");
|
|
|
19139
19278
|
SpaceService,
|
|
19140
19279
|
TinyCloud,
|
|
19141
19280
|
TinyCloudNode,
|
|
19142
|
-
|
|
19281
|
+
UnsupportedFeatureError,
|
|
19143
19282
|
VaultHeaders,
|
|
19283
|
+
VaultPublicSpaceKVActions,
|
|
19144
19284
|
VersionCheckError,
|
|
19145
19285
|
WasmKeyProvider,
|
|
19146
19286
|
buildSpaceUri,
|
|
19147
|
-
|
|
19287
|
+
checkNodeInfo,
|
|
19148
19288
|
createCapabilityKeyRegistry,
|
|
19149
19289
|
createSharingService,
|
|
19150
19290
|
createSpaceService,
|