@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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { ISigner, Bytes, ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ClientSession, TinyCloudSession, Extension, Delegation, IKVService, ISQLService, IDataVaultService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISharingService, CreateDelegationParams, DelegationResult, KeyProvider, JWK } from '@tinycloud/sdk-core';
2
- export { AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, ClientSession, CreateDelegationParams, DataVaultConfig, DataVaultService, DatabaseHandle, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, EncodedShareData, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IKVService, IPrefixedKVService, ISQLService, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IngestOptions, InvokeFunction, JWK, KVResponse, KVService, KVServiceConfig, KeyInfo, KeyProvider, KeyType, PersistedSessionData, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, SQLAction, SQLActionType, SQLService, SQLServiceConfig, ServiceContext, ServiceContextConfig, ServiceSession, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignRequest, SignResponse, Space, SpaceConfig, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, TinyCloud, TinyCloudConfig, TinyCloudSession, VaultAction, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPutOptions, VersionCheckError, WasmVaultFunctions, buildSpaceUri, checkNodeVersion, createCapabilityKeyRegistry, createSharingService, createSpaceService, createVaultCrypto, makePublicSpaceId, parseSpaceUri } from '@tinycloud/sdk-core';
1
+ import { ISigner, Bytes, ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ClientSession, TinyCloudSession, Extension, Delegation, IKVService, ISQLService, IDuckDbService, IDataVaultService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISharingService, CreateDelegationParams, DelegationResult, KeyProvider, JWK } from '@tinycloud/sdk-core';
2
+ export { AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, ClientSession, ColumnInfo, CreateDelegationParams, DataVaultConfig, DataVaultService, DatabaseHandle, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, EncodedShareData, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IKVService, IPrefixedKVService, ISQLService, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IngestOptions, InvokeFunction, JWK, KVResponse, KVService, KVServiceConfig, KeyInfo, KeyProvider, KeyType, PersistedSessionData, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceSession, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignRequest, SignResponse, Space, SpaceConfig, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, TableInfo, TinyCloud, TinyCloudConfig, TinyCloudSession, UnsupportedFeatureError, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, VersionCheckError, ViewInfo, WasmVaultFunctions, buildSpaceUri, checkNodeInfo, createCapabilityKeyRegistry, createSharingService, createSpaceService, createVaultCrypto, makePublicSpaceId, parseSpaceUri } from '@tinycloud/sdk-core';
3
3
  import { EventEmitter } from 'events';
4
4
  import { TCWSessionManager } from '@tinycloud/node-sdk-wasm';
5
5
 
@@ -292,6 +292,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
292
292
  private _tinyCloudSession?;
293
293
  private _address?;
294
294
  private _chainId?;
295
+ private _nodeFeatures;
295
296
  constructor(config: NodeUserAuthorizationConfig);
296
297
  /**
297
298
  * The current active session (web-core compatible).
@@ -302,6 +303,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
302
303
  * Includes spaceId, delegationHeader, and delegationCid.
303
304
  */
304
305
  get tinyCloudSession(): TinyCloudSession | undefined;
306
+ get nodeFeatures(): string[];
305
307
  /**
306
308
  * Add an extension to the authorization flow.
307
309
  */
@@ -440,6 +442,8 @@ interface PortableDelegation extends Omit<Delegation, "isRevoked"> {
440
442
  host?: string;
441
443
  /** Whether the recipient is prevented from creating sub-delegations */
442
444
  disableSubDelegation?: boolean;
445
+ /** Companion delegation for the user's public space (auto-created when includePublicSpace is true) */
446
+ publicDelegation?: PortableDelegation;
443
447
  }
444
448
  /**
445
449
  * Serialize a PortableDelegation for transport (e.g., over network).
@@ -463,6 +467,7 @@ declare class DelegatedAccess {
463
467
  private _serviceContext;
464
468
  private _kv;
465
469
  private _sql;
470
+ private _duckdb;
466
471
  constructor(session: TinyCloudSession, delegation: PortableDelegation, host: string);
467
472
  /**
468
473
  * Get the delegation this access was created from.
@@ -484,6 +489,10 @@ declare class DelegatedAccess {
484
489
  * SQL operations on the delegated space.
485
490
  */
486
491
  get sql(): ISQLService;
492
+ /**
493
+ * DuckDB operations on the delegated space.
494
+ */
495
+ get duckdb(): IDuckDbService;
487
496
  }
488
497
 
489
498
  /**
@@ -562,6 +571,7 @@ declare class TinyCloudNode {
562
571
  private _serviceContext?;
563
572
  private _kv?;
564
573
  private _sql?;
574
+ private _duckdb?;
565
575
  private _vault?;
566
576
  /** Cached public KV with proper delegation (set by ensurePublicSpace) */
567
577
  private _publicKV?;
@@ -574,6 +584,7 @@ declare class TinyCloudNode {
574
584
  private _sharingService;
575
585
  private _delegationManager?;
576
586
  private _spaceService?;
587
+ private get nodeFeatures();
577
588
  /**
578
589
  * Create a new TinyCloudNode instance.
579
590
  *
@@ -722,6 +733,10 @@ declare class TinyCloudNode {
722
733
  * SQL database operations on this user's space.
723
734
  */
724
735
  get sql(): ISQLService;
736
+ /**
737
+ * DuckDB database operations on this user's space.
738
+ */
739
+ get duckdb(): IDuckDbService;
725
740
  /**
726
741
  * Data Vault operations - client-side encrypted KV storage.
727
742
  * Call `vault.unlock(signer)` after signIn() to derive encryption keys.
@@ -940,6 +955,8 @@ declare class TinyCloudNode {
940
955
  expiryMs?: number;
941
956
  /** Override space ID (for creating delegations to non-primary spaces like public) */
942
957
  spaceIdOverride?: string;
958
+ /** Include a companion delegation for the user's public space (default: true) */
959
+ includePublicSpace?: boolean;
943
960
  }): Promise<PortableDelegation>;
944
961
  /**
945
962
  * Use a delegation received from another user.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ISigner, Bytes, ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ClientSession, TinyCloudSession, Extension, Delegation, IKVService, ISQLService, IDataVaultService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISharingService, CreateDelegationParams, DelegationResult, KeyProvider, JWK } from '@tinycloud/sdk-core';
2
- export { AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, ClientSession, CreateDelegationParams, DataVaultConfig, DataVaultService, DatabaseHandle, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, EncodedShareData, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IKVService, IPrefixedKVService, ISQLService, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IngestOptions, InvokeFunction, JWK, KVResponse, KVService, KVServiceConfig, KeyInfo, KeyProvider, KeyType, PersistedSessionData, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, SQLAction, SQLActionType, SQLService, SQLServiceConfig, ServiceContext, ServiceContextConfig, ServiceSession, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignRequest, SignResponse, Space, SpaceConfig, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, TinyCloud, TinyCloudConfig, TinyCloudSession, VaultAction, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPutOptions, VersionCheckError, WasmVaultFunctions, buildSpaceUri, checkNodeVersion, createCapabilityKeyRegistry, createSharingService, createSpaceService, createVaultCrypto, makePublicSpaceId, parseSpaceUri } from '@tinycloud/sdk-core';
1
+ import { ISigner, Bytes, ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ClientSession, TinyCloudSession, Extension, Delegation, IKVService, ISQLService, IDuckDbService, IDataVaultService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISharingService, CreateDelegationParams, DelegationResult, KeyProvider, JWK } from '@tinycloud/sdk-core';
2
+ export { AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, ClientSession, ColumnInfo, CreateDelegationParams, DataVaultConfig, DataVaultService, DatabaseHandle, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DuckDbAction, DuckDbActionType, DuckDbBatchOptions, DuckDbBatchResponse, DuckDbDatabaseHandle, DuckDbExecuteOptions, DuckDbExecuteResponse, DuckDbOptions, DuckDbQueryOptions, DuckDbQueryResponse, DuckDbService, DuckDbServiceConfig, DuckDbStatement, DuckDbValue, EncodedShareData, ExecuteOptions, ExecuteResponse, Extension, FetchFunction, GenerateShareParams, ICapabilityKeyRegistry, IDataVaultService, IDatabaseHandle, IDuckDbDatabaseHandle, IDuckDbService, IKVService, IPrefixedKVService, ISQLService, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IngestOptions, InvokeFunction, JWK, KVResponse, KVService, KVServiceConfig, KeyInfo, KeyProvider, KeyType, PersistedSessionData, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceSession, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignRequest, SignResponse, Space, SpaceConfig, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, TableInfo, TinyCloud, TinyCloudConfig, TinyCloudSession, UnsupportedFeatureError, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPublicSpaceKVActions, VaultPutOptions, VersionCheckError, ViewInfo, WasmVaultFunctions, buildSpaceUri, checkNodeInfo, createCapabilityKeyRegistry, createSharingService, createSpaceService, createVaultCrypto, makePublicSpaceId, parseSpaceUri } from '@tinycloud/sdk-core';
3
3
  import { EventEmitter } from 'events';
4
4
  import { TCWSessionManager } from '@tinycloud/node-sdk-wasm';
5
5
 
@@ -292,6 +292,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
292
292
  private _tinyCloudSession?;
293
293
  private _address?;
294
294
  private _chainId?;
295
+ private _nodeFeatures;
295
296
  constructor(config: NodeUserAuthorizationConfig);
296
297
  /**
297
298
  * The current active session (web-core compatible).
@@ -302,6 +303,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
302
303
  * Includes spaceId, delegationHeader, and delegationCid.
303
304
  */
304
305
  get tinyCloudSession(): TinyCloudSession | undefined;
306
+ get nodeFeatures(): string[];
305
307
  /**
306
308
  * Add an extension to the authorization flow.
307
309
  */
@@ -440,6 +442,8 @@ interface PortableDelegation extends Omit<Delegation, "isRevoked"> {
440
442
  host?: string;
441
443
  /** Whether the recipient is prevented from creating sub-delegations */
442
444
  disableSubDelegation?: boolean;
445
+ /** Companion delegation for the user's public space (auto-created when includePublicSpace is true) */
446
+ publicDelegation?: PortableDelegation;
443
447
  }
444
448
  /**
445
449
  * Serialize a PortableDelegation for transport (e.g., over network).
@@ -463,6 +467,7 @@ declare class DelegatedAccess {
463
467
  private _serviceContext;
464
468
  private _kv;
465
469
  private _sql;
470
+ private _duckdb;
466
471
  constructor(session: TinyCloudSession, delegation: PortableDelegation, host: string);
467
472
  /**
468
473
  * Get the delegation this access was created from.
@@ -484,6 +489,10 @@ declare class DelegatedAccess {
484
489
  * SQL operations on the delegated space.
485
490
  */
486
491
  get sql(): ISQLService;
492
+ /**
493
+ * DuckDB operations on the delegated space.
494
+ */
495
+ get duckdb(): IDuckDbService;
487
496
  }
488
497
 
489
498
  /**
@@ -562,6 +571,7 @@ declare class TinyCloudNode {
562
571
  private _serviceContext?;
563
572
  private _kv?;
564
573
  private _sql?;
574
+ private _duckdb?;
565
575
  private _vault?;
566
576
  /** Cached public KV with proper delegation (set by ensurePublicSpace) */
567
577
  private _publicKV?;
@@ -574,6 +584,7 @@ declare class TinyCloudNode {
574
584
  private _sharingService;
575
585
  private _delegationManager?;
576
586
  private _spaceService?;
587
+ private get nodeFeatures();
577
588
  /**
578
589
  * Create a new TinyCloudNode instance.
579
590
  *
@@ -722,6 +733,10 @@ declare class TinyCloudNode {
722
733
  * SQL database operations on this user's space.
723
734
  */
724
735
  get sql(): ISQLService;
736
+ /**
737
+ * DuckDB database operations on this user's space.
738
+ */
739
+ get duckdb(): IDuckDbService;
725
740
  /**
726
741
  * Data Vault operations - client-side encrypted KV storage.
727
742
  * Call `vault.unlock(signer)` after signIn() to derive encryption keys.
@@ -940,6 +955,8 @@ declare class TinyCloudNode {
940
955
  expiryMs?: number;
941
956
  /** Override space ID (for creating delegations to non-primary spaces like public) */
942
957
  spaceIdOverride?: string;
958
+ /** Include a companion delegation for the user's public space (default: true) */
959
+ includePublicSpace?: boolean;
943
960
  }): Promise<PortableDelegation>;
944
961
  /**
945
962
  * Use a delegation received from another user.
package/dist/index.js CHANGED
@@ -13756,9 +13756,9 @@ var init_lib20 = __esm({
13756
13756
  }
13757
13757
  });
13758
13758
 
13759
- // ../../node_modules/aes-js/index.js
13759
+ // ../../node_modules/@ethersproject/json-wallets/node_modules/aes-js/index.js
13760
13760
  var require_aes_js = __commonJS({
13761
- "../../node_modules/aes-js/index.js"(exports, module) {
13761
+ "../../node_modules/@ethersproject/json-wallets/node_modules/aes-js/index.js"(exports, module) {
13762
13762
  "use strict";
13763
13763
  (function(root) {
13764
13764
  function checkInt(value) {
@@ -17292,7 +17292,7 @@ import {
17292
17292
  fetchPeerId,
17293
17293
  submitHostDelegation,
17294
17294
  activateSessionWithHost,
17295
- checkNodeVersion
17295
+ checkNodeInfo
17296
17296
  } from "@tinycloud/sdk-core";
17297
17297
  import {
17298
17298
  TCWSessionManager as SessionManager,
@@ -17313,6 +17313,7 @@ var defaultSignStrategy = { type: "auto-sign" };
17313
17313
  var _NodeUserAuthorization = class _NodeUserAuthorization {
17314
17314
  constructor(config) {
17315
17315
  this.extensions = [];
17316
+ this._nodeFeatures = [];
17316
17317
  if (!_NodeUserAuthorization.wasmInitialized) {
17317
17318
  initPanicHook();
17318
17319
  _NodeUserAuthorization.wasmInitialized = true;
@@ -17342,6 +17343,17 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17342
17343
  "tinycloud.sql/export"
17343
17344
  ]
17344
17345
  },
17346
+ duckdb: {
17347
+ "": [
17348
+ "tinycloud.duckdb/read",
17349
+ "tinycloud.duckdb/write",
17350
+ "tinycloud.duckdb/admin",
17351
+ "tinycloud.duckdb/describe",
17352
+ "tinycloud.duckdb/export",
17353
+ "tinycloud.duckdb/import",
17354
+ "tinycloud.duckdb/execute"
17355
+ ]
17356
+ },
17345
17357
  capabilities: {
17346
17358
  "": ["tinycloud.capabilities/read"]
17347
17359
  }
@@ -17365,6 +17377,9 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17365
17377
  get tinyCloudSession() {
17366
17378
  return this._tinyCloudSession;
17367
17379
  }
17380
+ get nodeFeatures() {
17381
+ return this._nodeFeatures;
17382
+ }
17368
17383
  /**
17369
17384
  * Add an extension to the authorization flow.
17370
17385
  */
@@ -17560,7 +17575,8 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17560
17575
  this._tinyCloudSession = tinyCloudSession;
17561
17576
  this._address = address;
17562
17577
  this._chainId = chainId;
17563
- await checkNodeVersion(this.tinycloudHosts[0], protocolVersion());
17578
+ const nodeInfo = await checkNodeInfo(this.tinycloudHosts[0], protocolVersion());
17579
+ this._nodeFeatures = nodeInfo.features;
17564
17580
  for (const ext of this.extensions) {
17565
17581
  if (ext.afterSignIn) {
17566
17582
  await ext.afterSignIn(clientSession);
@@ -17718,7 +17734,8 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17718
17734
  this._tinyCloudSession = tinyCloudSession;
17719
17735
  this._address = address;
17720
17736
  this._chainId = chainId;
17721
- await checkNodeVersion(this.tinycloudHosts[0], protocolVersion());
17737
+ const nodeInfo = await checkNodeInfo(this.tinycloudHosts[0], protocolVersion());
17738
+ this._nodeFeatures = nodeInfo.features;
17722
17739
  for (const ext of this.extensions) {
17723
17740
  if (ext.afterSignIn) {
17724
17741
  await ext.afterSignIn(clientSession);
@@ -17804,13 +17821,16 @@ import {
17804
17821
  activateSessionWithHost as activateSessionWithHost2,
17805
17822
  KVService as KVService2,
17806
17823
  SQLService as SQLService2,
17824
+ DuckDbService as DuckDbService2,
17807
17825
  DataVaultService,
17808
17826
  createVaultCrypto,
17809
17827
  ServiceContext as ServiceContext2,
17810
17828
  DelegationManager,
17811
17829
  SpaceService,
17812
17830
  CapabilityKeyRegistry,
17813
- SharingService
17831
+ SharingService,
17832
+ UnsupportedFeatureError,
17833
+ makePublicSpaceId
17814
17834
  } from "@tinycloud/sdk-core";
17815
17835
  import {
17816
17836
  TCWSessionManager as SessionManager2,
@@ -17833,6 +17853,7 @@ import {
17833
17853
  import {
17834
17854
  KVService,
17835
17855
  SQLService,
17856
+ DuckDbService,
17836
17857
  ServiceContext
17837
17858
  } from "@tinycloud/sdk-core";
17838
17859
  import { invoke } from "@tinycloud/node-sdk-wasm";
@@ -17853,6 +17874,9 @@ var DelegatedAccess = class {
17853
17874
  this._sql = new SQLService({});
17854
17875
  this._sql.initialize(this._serviceContext);
17855
17876
  this._serviceContext.registerService("sql", this._sql);
17877
+ this._duckdb = new DuckDbService({});
17878
+ this._duckdb.initialize(this._serviceContext);
17879
+ this._serviceContext.registerService("duckdb", this._duckdb);
17856
17880
  const serviceSession = {
17857
17881
  delegationHeader: session.delegationHeader,
17858
17882
  delegationCid: session.delegationCid,
@@ -17892,6 +17916,12 @@ var DelegatedAccess = class {
17892
17916
  get sql() {
17893
17917
  return this._sql;
17894
17918
  }
17919
+ /**
17920
+ * DuckDB operations on the delegated space.
17921
+ */
17922
+ get duckdb() {
17923
+ return this._duckdb;
17924
+ }
17895
17925
  };
17896
17926
 
17897
17927
  // src/keys/WasmKeyProvider.ts
@@ -18064,6 +18094,9 @@ var _TinyCloudNode = class _TinyCloudNode {
18064
18094
  this.tc = new TinyCloud(this.auth);
18065
18095
  }
18066
18096
  }
18097
+ get nodeFeatures() {
18098
+ return this.auth?.nodeFeatures ?? [];
18099
+ }
18067
18100
  /**
18068
18101
  * Get the primary identity DID for this user.
18069
18102
  * - If wallet connected and signed in: returns PKH DID (did:pkh:eip155:{chainId}:{address})
@@ -18129,6 +18162,7 @@ var _TinyCloudNode = class _TinyCloudNode {
18129
18162
  this._chainId = await this.signer.getChainId();
18130
18163
  this._kv = void 0;
18131
18164
  this._sql = void 0;
18165
+ this._duckdb = void 0;
18132
18166
  this._serviceContext = void 0;
18133
18167
  await this.tc.signIn();
18134
18168
  this.initializeServices();
@@ -18145,6 +18179,7 @@ var _TinyCloudNode = class _TinyCloudNode {
18145
18179
  async restoreSession(sessionData) {
18146
18180
  this._kv = void 0;
18147
18181
  this._sql = void 0;
18182
+ this._duckdb = void 0;
18148
18183
  this._serviceContext = void 0;
18149
18184
  if (sessionData.address) {
18150
18185
  this._address = sessionData.address;
@@ -18163,6 +18198,9 @@ var _TinyCloudNode = class _TinyCloudNode {
18163
18198
  this._sql = new SQLService2({});
18164
18199
  this._sql.initialize(this._serviceContext);
18165
18200
  this._serviceContext.registerService("sql", this._sql);
18201
+ this._duckdb = new DuckDbService2({});
18202
+ this._duckdb.initialize(this._serviceContext);
18203
+ this._serviceContext.registerService("duckdb", this._duckdb);
18166
18204
  const serviceSession = {
18167
18205
  delegationHeader: sessionData.delegationHeader,
18168
18206
  delegationCid: sessionData.delegationCid,
@@ -18238,9 +18276,17 @@ var _TinyCloudNode = class _TinyCloudNode {
18238
18276
  this._kv = new KVService2({});
18239
18277
  this._kv.initialize(this._serviceContext);
18240
18278
  this._serviceContext.registerService("kv", this._kv);
18241
- this._sql = new SQLService2({});
18242
- this._sql.initialize(this._serviceContext);
18243
- this._serviceContext.registerService("sql", this._sql);
18279
+ const features = this.nodeFeatures;
18280
+ if (features.length === 0 || features.includes("sql")) {
18281
+ this._sql = new SQLService2({});
18282
+ this._sql.initialize(this._serviceContext);
18283
+ this._serviceContext.registerService("sql", this._sql);
18284
+ }
18285
+ if (features.length === 0 || features.includes("duckdb")) {
18286
+ this._duckdb = new DuckDbService2({});
18287
+ this._duckdb.initialize(this._serviceContext);
18288
+ this._serviceContext.registerService("duckdb", this._duckdb);
18289
+ }
18244
18290
  const serviceSession = {
18245
18291
  delegationHeader: session.delegationHeader,
18246
18292
  delegationCid: session.delegationCid,
@@ -18320,7 +18366,14 @@ var _TinyCloudNode = class _TinyCloudNode {
18320
18366
  "tinycloud.sql/read",
18321
18367
  "tinycloud.sql/write",
18322
18368
  "tinycloud.sql/admin",
18323
- "tinycloud.sql/*"
18369
+ "tinycloud.sql/*",
18370
+ "tinycloud.duckdb/read",
18371
+ "tinycloud.duckdb/write",
18372
+ "tinycloud.duckdb/admin",
18373
+ "tinycloud.duckdb/describe",
18374
+ "tinycloud.duckdb/export",
18375
+ "tinycloud.duckdb/import",
18376
+ "tinycloud.duckdb/*"
18324
18377
  ],
18325
18378
  expiry: this.getSessionExpiry(),
18326
18379
  isRevoked: false,
@@ -18343,7 +18396,14 @@ var _TinyCloudNode = class _TinyCloudNode {
18343
18396
  "tinycloud.sql/read",
18344
18397
  "tinycloud.sql/write",
18345
18398
  "tinycloud.sql/admin",
18346
- "tinycloud.sql/*"
18399
+ "tinycloud.sql/*",
18400
+ "tinycloud.duckdb/read",
18401
+ "tinycloud.duckdb/write",
18402
+ "tinycloud.duckdb/admin",
18403
+ "tinycloud.duckdb/describe",
18404
+ "tinycloud.duckdb/export",
18405
+ "tinycloud.duckdb/import",
18406
+ "tinycloud.duckdb/*"
18347
18407
  ],
18348
18408
  expiry: this.getSessionExpiry(),
18349
18409
  isRevoked: false,
@@ -18509,10 +18569,27 @@ var _TinyCloudNode = class _TinyCloudNode {
18509
18569
  */
18510
18570
  get sql() {
18511
18571
  if (!this._sql) {
18572
+ const features = this.nodeFeatures;
18573
+ if (features.length > 0 && !features.includes("sql")) {
18574
+ throw new UnsupportedFeatureError("sql", this.config.host, features);
18575
+ }
18512
18576
  throw new Error("Not signed in. Call signIn() first.");
18513
18577
  }
18514
18578
  return this._sql;
18515
18579
  }
18580
+ /**
18581
+ * DuckDB database operations on this user's space.
18582
+ */
18583
+ get duckdb() {
18584
+ if (!this._duckdb) {
18585
+ const features = this.nodeFeatures;
18586
+ if (features.length > 0 && !features.includes("duckdb")) {
18587
+ throw new UnsupportedFeatureError("duckdb", this.config.host, features);
18588
+ }
18589
+ throw new Error("Not signed in. Call signIn() first.");
18590
+ }
18591
+ return this._duckdb;
18592
+ }
18516
18593
  /**
18517
18594
  * Data Vault operations - client-side encrypted KV storage.
18518
18595
  * Call `vault.unlock(signer)` after signIn() to derive encryption keys.
@@ -18870,12 +18947,16 @@ var _TinyCloudNode = class _TinyCloudNode {
18870
18947
  const abilities = {};
18871
18948
  const kvActions = params.actions.filter((a) => a.startsWith("tinycloud.kv/"));
18872
18949
  const sqlActions = params.actions.filter((a) => a.startsWith("tinycloud.sql/"));
18950
+ const duckdbActions = params.actions.filter((a) => a.startsWith("tinycloud.duckdb/"));
18873
18951
  if (kvActions.length > 0) {
18874
18952
  abilities.kv = { [params.path]: kvActions };
18875
18953
  }
18876
18954
  if (sqlActions.length > 0) {
18877
18955
  abilities.sql = { [params.path]: sqlActions };
18878
18956
  }
18957
+ if (duckdbActions.length > 0) {
18958
+ abilities.duckdb = { [params.path]: duckdbActions };
18959
+ }
18879
18960
  const now = /* @__PURE__ */ new Date();
18880
18961
  const expiryMs = params.expiryMs ?? 60 * 60 * 1e3;
18881
18962
  const expirationTime = new Date(now.getTime() + expiryMs);
@@ -18902,7 +18983,7 @@ var _TinyCloudNode = class _TinyCloudNode {
18902
18983
  if (!activateResult.success) {
18903
18984
  throw new Error(`Failed to activate delegation: ${activateResult.error}`);
18904
18985
  }
18905
- return {
18986
+ const result = {
18906
18987
  cid: delegationSession.delegationCid,
18907
18988
  delegationHeader: delegationSession.delegationHeader,
18908
18989
  spaceId: params.spaceIdOverride ?? session.spaceId,
@@ -18915,6 +18996,52 @@ var _TinyCloudNode = class _TinyCloudNode {
18915
18996
  chainId: session.chainId,
18916
18997
  host: this.config.host
18917
18998
  };
18999
+ const hasKvActions = params.actions.some((a) => a.startsWith("tinycloud.kv/"));
19000
+ if (hasKvActions && params.includePublicSpace !== false) {
19001
+ const publicSpaceId = makePublicSpaceId(
19002
+ ensureEip553(session.address),
19003
+ session.chainId
19004
+ );
19005
+ const publicAbilities = {
19006
+ kv: { "": ["tinycloud.kv/get", "tinycloud.kv/put", "tinycloud.kv/metadata"] }
19007
+ };
19008
+ const publicPrepared = prepareSession2({
19009
+ abilities: publicAbilities,
19010
+ address: ensureEip553(session.address),
19011
+ chainId: session.chainId,
19012
+ domain: new URL(this.config.host).hostname,
19013
+ issuedAt: now.toISOString(),
19014
+ expirationTime: expirationTime.toISOString(),
19015
+ spaceId: publicSpaceId,
19016
+ delegateUri: params.delegateDID,
19017
+ parents: [session.delegationCid]
19018
+ });
19019
+ const publicSignature = await this.signer.signMessage(publicPrepared.siwe);
19020
+ const publicSession = completeSessionSetup2({
19021
+ ...publicPrepared,
19022
+ signature: publicSignature
19023
+ });
19024
+ const publicActivateResult = await activateSessionWithHost2(
19025
+ this.config.host,
19026
+ publicSession.delegationHeader
19027
+ );
19028
+ if (publicActivateResult.success) {
19029
+ result.publicDelegation = {
19030
+ cid: publicSession.delegationCid,
19031
+ delegationHeader: publicSession.delegationHeader,
19032
+ spaceId: publicSpaceId,
19033
+ path: "",
19034
+ actions: ["tinycloud.kv/get", "tinycloud.kv/put", "tinycloud.kv/metadata"],
19035
+ disableSubDelegation: params.disableSubDelegation ?? false,
19036
+ expiry: expirationTime,
19037
+ delegateDID: params.delegateDID,
19038
+ ownerAddress: session.address,
19039
+ chainId: session.chainId,
19040
+ host: this.config.host
19041
+ };
19042
+ }
19043
+ }
19044
+ return result;
18918
19045
  }
18919
19046
  /**
18920
19047
  * Use a delegation received from another user.
@@ -18964,12 +19091,16 @@ var _TinyCloudNode = class _TinyCloudNode {
18964
19091
  const abilities = {};
18965
19092
  const kvActions = delegation.actions.filter((a) => a.startsWith("tinycloud.kv/"));
18966
19093
  const sqlActions = delegation.actions.filter((a) => a.startsWith("tinycloud.sql/"));
19094
+ const duckdbActions = delegation.actions.filter((a) => a.startsWith("tinycloud.duckdb/"));
18967
19095
  if (kvActions.length > 0) {
18968
19096
  abilities.kv = { [delegation.path]: kvActions };
18969
19097
  }
18970
19098
  if (sqlActions.length > 0) {
18971
19099
  abilities.sql = { [delegation.path]: sqlActions };
18972
19100
  }
19101
+ if (duckdbActions.length > 0) {
19102
+ abilities.duckdb = { [delegation.path]: duckdbActions };
19103
+ }
18973
19104
  const now = /* @__PURE__ */ new Date();
18974
19105
  const maxExpiry = new Date(now.getTime() + 60 * 60 * 1e3);
18975
19106
  const expirationTime = delegation.expiry < maxExpiry ? delegation.expiry : maxExpiry;
@@ -19051,12 +19182,16 @@ var _TinyCloudNode = class _TinyCloudNode {
19051
19182
  const abilities = {};
19052
19183
  const kvActions = params.actions.filter((a) => a.startsWith("tinycloud.kv/"));
19053
19184
  const sqlActions = params.actions.filter((a) => a.startsWith("tinycloud.sql/"));
19185
+ const duckdbActions = params.actions.filter((a) => a.startsWith("tinycloud.duckdb/"));
19054
19186
  if (kvActions.length > 0) {
19055
19187
  abilities.kv = { [params.path]: kvActions };
19056
19188
  }
19057
19189
  if (sqlActions.length > 0) {
19058
19190
  abilities.sql = { [params.path]: sqlActions };
19059
19191
  }
19192
+ if (duckdbActions.length > 0) {
19193
+ abilities.duckdb = { [params.path]: duckdbActions };
19194
+ }
19060
19195
  const targetHost = parentDelegation.host ?? this.config.host;
19061
19196
  const prepared = prepareSession2({
19062
19197
  abilities,
@@ -19119,7 +19254,8 @@ function deserializeDelegation(data) {
19119
19254
  // src/index.ts
19120
19255
  import { KVService as KVService3, PrefixedKVService } from "@tinycloud/sdk-core";
19121
19256
  import { SQLService as SQLService3, SQLAction, DatabaseHandle } from "@tinycloud/sdk-core";
19122
- import { DataVaultService as DataVaultService2, VaultAction, VaultHeaders, createVaultCrypto as createVaultCrypto2 } from "@tinycloud/sdk-core";
19257
+ import { DuckDbService as DuckDbService3, DuckDbDatabaseHandle, DuckDbAction } from "@tinycloud/sdk-core";
19258
+ import { DataVaultService as DataVaultService2, VaultHeaders, VaultPublicSpaceKVActions, createVaultCrypto as createVaultCrypto2 } from "@tinycloud/sdk-core";
19123
19259
  import {
19124
19260
  DelegationManager as DelegationManager2,
19125
19261
  SharingService as SharingService2,
@@ -19137,13 +19273,14 @@ import {
19137
19273
  createSpaceService,
19138
19274
  parseSpaceUri,
19139
19275
  buildSpaceUri,
19140
- makePublicSpaceId,
19276
+ makePublicSpaceId as makePublicSpaceId2,
19141
19277
  Space
19142
19278
  } from "@tinycloud/sdk-core";
19143
19279
  import {
19144
19280
  ProtocolMismatchError,
19145
19281
  VersionCheckError,
19146
- checkNodeVersion as checkNodeVersion2
19282
+ UnsupportedFeatureError as UnsupportedFeatureError2,
19283
+ checkNodeInfo as checkNodeInfo2
19147
19284
  } from "@tinycloud/sdk-core";
19148
19285
  import { ServiceContext as ServiceContext3 } from "@tinycloud/sdk-core";
19149
19286
  export {
@@ -19154,6 +19291,9 @@ export {
19154
19291
  DelegatedAccess,
19155
19292
  DelegationErrorCodes,
19156
19293
  DelegationManager2 as DelegationManager,
19294
+ DuckDbAction,
19295
+ DuckDbDatabaseHandle,
19296
+ DuckDbService3 as DuckDbService,
19157
19297
  FileSessionStorage,
19158
19298
  KVService3 as KVService,
19159
19299
  MemorySessionStorage,
@@ -19170,12 +19310,13 @@ export {
19170
19310
  SpaceService2 as SpaceService,
19171
19311
  TinyCloud2 as TinyCloud,
19172
19312
  TinyCloudNode,
19173
- VaultAction,
19313
+ UnsupportedFeatureError2 as UnsupportedFeatureError,
19174
19314
  VaultHeaders,
19315
+ VaultPublicSpaceKVActions,
19175
19316
  VersionCheckError,
19176
19317
  WasmKeyProvider,
19177
19318
  buildSpaceUri,
19178
- checkNodeVersion2 as checkNodeVersion,
19319
+ checkNodeInfo2 as checkNodeInfo,
19179
19320
  createCapabilityKeyRegistry,
19180
19321
  createSharingService,
19181
19322
  createSpaceService,
@@ -19183,7 +19324,7 @@ export {
19183
19324
  createWasmKeyProvider,
19184
19325
  defaultSignStrategy,
19185
19326
  deserializeDelegation,
19186
- makePublicSpaceId,
19327
+ makePublicSpaceId2 as makePublicSpaceId,
19187
19328
  parseSpaceUri,
19188
19329
  serializeDelegation
19189
19330
  };