@tinycloud/node-sdk 1.5.0 → 1.6.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, VaultAction, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPutOptions, VersionCheckError, ViewInfo, WasmVaultFunctions, buildSpaceUri, checkNodeVersion, 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
  */
@@ -463,6 +465,7 @@ declare class DelegatedAccess {
463
465
  private _serviceContext;
464
466
  private _kv;
465
467
  private _sql;
468
+ private _duckdb;
466
469
  constructor(session: TinyCloudSession, delegation: PortableDelegation, host: string);
467
470
  /**
468
471
  * Get the delegation this access was created from.
@@ -484,6 +487,10 @@ declare class DelegatedAccess {
484
487
  * SQL operations on the delegated space.
485
488
  */
486
489
  get sql(): ISQLService;
490
+ /**
491
+ * DuckDB operations on the delegated space.
492
+ */
493
+ get duckdb(): IDuckDbService;
487
494
  }
488
495
 
489
496
  /**
@@ -562,6 +569,7 @@ declare class TinyCloudNode {
562
569
  private _serviceContext?;
563
570
  private _kv?;
564
571
  private _sql?;
572
+ private _duckdb?;
565
573
  private _vault?;
566
574
  /** Cached public KV with proper delegation (set by ensurePublicSpace) */
567
575
  private _publicKV?;
@@ -574,6 +582,7 @@ declare class TinyCloudNode {
574
582
  private _sharingService;
575
583
  private _delegationManager?;
576
584
  private _spaceService?;
585
+ private get nodeFeatures();
577
586
  /**
578
587
  * Create a new TinyCloudNode instance.
579
588
  *
@@ -722,6 +731,10 @@ declare class TinyCloudNode {
722
731
  * SQL database operations on this user's space.
723
732
  */
724
733
  get sql(): ISQLService;
734
+ /**
735
+ * DuckDB database operations on this user's space.
736
+ */
737
+ get duckdb(): IDuckDbService;
725
738
  /**
726
739
  * Data Vault operations - client-side encrypted KV storage.
727
740
  * Call `vault.unlock(signer)` after signIn() to derive encryption keys.
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, VaultAction, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultPutOptions, VersionCheckError, ViewInfo, WasmVaultFunctions, buildSpaceUri, checkNodeVersion, 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
  */
@@ -463,6 +465,7 @@ declare class DelegatedAccess {
463
465
  private _serviceContext;
464
466
  private _kv;
465
467
  private _sql;
468
+ private _duckdb;
466
469
  constructor(session: TinyCloudSession, delegation: PortableDelegation, host: string);
467
470
  /**
468
471
  * Get the delegation this access was created from.
@@ -484,6 +487,10 @@ declare class DelegatedAccess {
484
487
  * SQL operations on the delegated space.
485
488
  */
486
489
  get sql(): ISQLService;
490
+ /**
491
+ * DuckDB operations on the delegated space.
492
+ */
493
+ get duckdb(): IDuckDbService;
487
494
  }
488
495
 
489
496
  /**
@@ -562,6 +569,7 @@ declare class TinyCloudNode {
562
569
  private _serviceContext?;
563
570
  private _kv?;
564
571
  private _sql?;
572
+ private _duckdb?;
565
573
  private _vault?;
566
574
  /** Cached public KV with proper delegation (set by ensurePublicSpace) */
567
575
  private _publicKV?;
@@ -574,6 +582,7 @@ declare class TinyCloudNode {
574
582
  private _sharingService;
575
583
  private _delegationManager?;
576
584
  private _spaceService?;
585
+ private get nodeFeatures();
577
586
  /**
578
587
  * Create a new TinyCloudNode instance.
579
588
  *
@@ -722,6 +731,10 @@ declare class TinyCloudNode {
722
731
  * SQL database operations on this user's space.
723
732
  */
724
733
  get sql(): ISQLService;
734
+ /**
735
+ * DuckDB database operations on this user's space.
736
+ */
737
+ get duckdb(): IDuckDbService;
725
738
  /**
726
739
  * Data Vault operations - client-side encrypted KV storage.
727
740
  * Call `vault.unlock(signer)` after signIn() to derive encryption keys.
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) {
@@ -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,7 @@ 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
+ this._nodeFeatures = await checkNodeVersion(this.tinycloudHosts[0], protocolVersion());
17564
17579
  for (const ext of this.extensions) {
17565
17580
  if (ext.afterSignIn) {
17566
17581
  await ext.afterSignIn(clientSession);
@@ -17718,7 +17733,7 @@ var _NodeUserAuthorization = class _NodeUserAuthorization {
17718
17733
  this._tinyCloudSession = tinyCloudSession;
17719
17734
  this._address = address;
17720
17735
  this._chainId = chainId;
17721
- await checkNodeVersion(this.tinycloudHosts[0], protocolVersion());
17736
+ this._nodeFeatures = await checkNodeVersion(this.tinycloudHosts[0], protocolVersion());
17722
17737
  for (const ext of this.extensions) {
17723
17738
  if (ext.afterSignIn) {
17724
17739
  await ext.afterSignIn(clientSession);
@@ -17804,13 +17819,15 @@ import {
17804
17819
  activateSessionWithHost as activateSessionWithHost2,
17805
17820
  KVService as KVService2,
17806
17821
  SQLService as SQLService2,
17822
+ DuckDbService as DuckDbService2,
17807
17823
  DataVaultService,
17808
17824
  createVaultCrypto,
17809
17825
  ServiceContext as ServiceContext2,
17810
17826
  DelegationManager,
17811
17827
  SpaceService,
17812
17828
  CapabilityKeyRegistry,
17813
- SharingService
17829
+ SharingService,
17830
+ UnsupportedFeatureError
17814
17831
  } from "@tinycloud/sdk-core";
17815
17832
  import {
17816
17833
  TCWSessionManager as SessionManager2,
@@ -17833,6 +17850,7 @@ import {
17833
17850
  import {
17834
17851
  KVService,
17835
17852
  SQLService,
17853
+ DuckDbService,
17836
17854
  ServiceContext
17837
17855
  } from "@tinycloud/sdk-core";
17838
17856
  import { invoke } from "@tinycloud/node-sdk-wasm";
@@ -17853,6 +17871,9 @@ var DelegatedAccess = class {
17853
17871
  this._sql = new SQLService({});
17854
17872
  this._sql.initialize(this._serviceContext);
17855
17873
  this._serviceContext.registerService("sql", this._sql);
17874
+ this._duckdb = new DuckDbService({});
17875
+ this._duckdb.initialize(this._serviceContext);
17876
+ this._serviceContext.registerService("duckdb", this._duckdb);
17856
17877
  const serviceSession = {
17857
17878
  delegationHeader: session.delegationHeader,
17858
17879
  delegationCid: session.delegationCid,
@@ -17892,6 +17913,12 @@ var DelegatedAccess = class {
17892
17913
  get sql() {
17893
17914
  return this._sql;
17894
17915
  }
17916
+ /**
17917
+ * DuckDB operations on the delegated space.
17918
+ */
17919
+ get duckdb() {
17920
+ return this._duckdb;
17921
+ }
17895
17922
  };
17896
17923
 
17897
17924
  // src/keys/WasmKeyProvider.ts
@@ -18064,6 +18091,9 @@ var _TinyCloudNode = class _TinyCloudNode {
18064
18091
  this.tc = new TinyCloud(this.auth);
18065
18092
  }
18066
18093
  }
18094
+ get nodeFeatures() {
18095
+ return this.auth?.nodeFeatures ?? [];
18096
+ }
18067
18097
  /**
18068
18098
  * Get the primary identity DID for this user.
18069
18099
  * - If wallet connected and signed in: returns PKH DID (did:pkh:eip155:{chainId}:{address})
@@ -18129,6 +18159,7 @@ var _TinyCloudNode = class _TinyCloudNode {
18129
18159
  this._chainId = await this.signer.getChainId();
18130
18160
  this._kv = void 0;
18131
18161
  this._sql = void 0;
18162
+ this._duckdb = void 0;
18132
18163
  this._serviceContext = void 0;
18133
18164
  await this.tc.signIn();
18134
18165
  this.initializeServices();
@@ -18145,6 +18176,7 @@ var _TinyCloudNode = class _TinyCloudNode {
18145
18176
  async restoreSession(sessionData) {
18146
18177
  this._kv = void 0;
18147
18178
  this._sql = void 0;
18179
+ this._duckdb = void 0;
18148
18180
  this._serviceContext = void 0;
18149
18181
  if (sessionData.address) {
18150
18182
  this._address = sessionData.address;
@@ -18163,6 +18195,9 @@ var _TinyCloudNode = class _TinyCloudNode {
18163
18195
  this._sql = new SQLService2({});
18164
18196
  this._sql.initialize(this._serviceContext);
18165
18197
  this._serviceContext.registerService("sql", this._sql);
18198
+ this._duckdb = new DuckDbService2({});
18199
+ this._duckdb.initialize(this._serviceContext);
18200
+ this._serviceContext.registerService("duckdb", this._duckdb);
18166
18201
  const serviceSession = {
18167
18202
  delegationHeader: sessionData.delegationHeader,
18168
18203
  delegationCid: sessionData.delegationCid,
@@ -18238,9 +18273,17 @@ var _TinyCloudNode = class _TinyCloudNode {
18238
18273
  this._kv = new KVService2({});
18239
18274
  this._kv.initialize(this._serviceContext);
18240
18275
  this._serviceContext.registerService("kv", this._kv);
18241
- this._sql = new SQLService2({});
18242
- this._sql.initialize(this._serviceContext);
18243
- this._serviceContext.registerService("sql", this._sql);
18276
+ const features = this.nodeFeatures;
18277
+ if (features.length === 0 || features.includes("sql")) {
18278
+ this._sql = new SQLService2({});
18279
+ this._sql.initialize(this._serviceContext);
18280
+ this._serviceContext.registerService("sql", this._sql);
18281
+ }
18282
+ if (features.length === 0 || features.includes("duckdb")) {
18283
+ this._duckdb = new DuckDbService2({});
18284
+ this._duckdb.initialize(this._serviceContext);
18285
+ this._serviceContext.registerService("duckdb", this._duckdb);
18286
+ }
18244
18287
  const serviceSession = {
18245
18288
  delegationHeader: session.delegationHeader,
18246
18289
  delegationCid: session.delegationCid,
@@ -18320,7 +18363,14 @@ var _TinyCloudNode = class _TinyCloudNode {
18320
18363
  "tinycloud.sql/read",
18321
18364
  "tinycloud.sql/write",
18322
18365
  "tinycloud.sql/admin",
18323
- "tinycloud.sql/*"
18366
+ "tinycloud.sql/*",
18367
+ "tinycloud.duckdb/read",
18368
+ "tinycloud.duckdb/write",
18369
+ "tinycloud.duckdb/admin",
18370
+ "tinycloud.duckdb/describe",
18371
+ "tinycloud.duckdb/export",
18372
+ "tinycloud.duckdb/import",
18373
+ "tinycloud.duckdb/*"
18324
18374
  ],
18325
18375
  expiry: this.getSessionExpiry(),
18326
18376
  isRevoked: false,
@@ -18343,7 +18393,14 @@ var _TinyCloudNode = class _TinyCloudNode {
18343
18393
  "tinycloud.sql/read",
18344
18394
  "tinycloud.sql/write",
18345
18395
  "tinycloud.sql/admin",
18346
- "tinycloud.sql/*"
18396
+ "tinycloud.sql/*",
18397
+ "tinycloud.duckdb/read",
18398
+ "tinycloud.duckdb/write",
18399
+ "tinycloud.duckdb/admin",
18400
+ "tinycloud.duckdb/describe",
18401
+ "tinycloud.duckdb/export",
18402
+ "tinycloud.duckdb/import",
18403
+ "tinycloud.duckdb/*"
18347
18404
  ],
18348
18405
  expiry: this.getSessionExpiry(),
18349
18406
  isRevoked: false,
@@ -18509,10 +18566,27 @@ var _TinyCloudNode = class _TinyCloudNode {
18509
18566
  */
18510
18567
  get sql() {
18511
18568
  if (!this._sql) {
18569
+ const features = this.nodeFeatures;
18570
+ if (features.length > 0 && !features.includes("sql")) {
18571
+ throw new UnsupportedFeatureError("sql", this.config.host, features);
18572
+ }
18512
18573
  throw new Error("Not signed in. Call signIn() first.");
18513
18574
  }
18514
18575
  return this._sql;
18515
18576
  }
18577
+ /**
18578
+ * DuckDB database operations on this user's space.
18579
+ */
18580
+ get duckdb() {
18581
+ if (!this._duckdb) {
18582
+ const features = this.nodeFeatures;
18583
+ if (features.length > 0 && !features.includes("duckdb")) {
18584
+ throw new UnsupportedFeatureError("duckdb", this.config.host, features);
18585
+ }
18586
+ throw new Error("Not signed in. Call signIn() first.");
18587
+ }
18588
+ return this._duckdb;
18589
+ }
18516
18590
  /**
18517
18591
  * Data Vault operations - client-side encrypted KV storage.
18518
18592
  * Call `vault.unlock(signer)` after signIn() to derive encryption keys.
@@ -18870,12 +18944,16 @@ var _TinyCloudNode = class _TinyCloudNode {
18870
18944
  const abilities = {};
18871
18945
  const kvActions = params.actions.filter((a) => a.startsWith("tinycloud.kv/"));
18872
18946
  const sqlActions = params.actions.filter((a) => a.startsWith("tinycloud.sql/"));
18947
+ const duckdbActions = params.actions.filter((a) => a.startsWith("tinycloud.duckdb/"));
18873
18948
  if (kvActions.length > 0) {
18874
18949
  abilities.kv = { [params.path]: kvActions };
18875
18950
  }
18876
18951
  if (sqlActions.length > 0) {
18877
18952
  abilities.sql = { [params.path]: sqlActions };
18878
18953
  }
18954
+ if (duckdbActions.length > 0) {
18955
+ abilities.duckdb = { [params.path]: duckdbActions };
18956
+ }
18879
18957
  const now = /* @__PURE__ */ new Date();
18880
18958
  const expiryMs = params.expiryMs ?? 60 * 60 * 1e3;
18881
18959
  const expirationTime = new Date(now.getTime() + expiryMs);
@@ -18964,12 +19042,16 @@ var _TinyCloudNode = class _TinyCloudNode {
18964
19042
  const abilities = {};
18965
19043
  const kvActions = delegation.actions.filter((a) => a.startsWith("tinycloud.kv/"));
18966
19044
  const sqlActions = delegation.actions.filter((a) => a.startsWith("tinycloud.sql/"));
19045
+ const duckdbActions = delegation.actions.filter((a) => a.startsWith("tinycloud.duckdb/"));
18967
19046
  if (kvActions.length > 0) {
18968
19047
  abilities.kv = { [delegation.path]: kvActions };
18969
19048
  }
18970
19049
  if (sqlActions.length > 0) {
18971
19050
  abilities.sql = { [delegation.path]: sqlActions };
18972
19051
  }
19052
+ if (duckdbActions.length > 0) {
19053
+ abilities.duckdb = { [delegation.path]: duckdbActions };
19054
+ }
18973
19055
  const now = /* @__PURE__ */ new Date();
18974
19056
  const maxExpiry = new Date(now.getTime() + 60 * 60 * 1e3);
18975
19057
  const expirationTime = delegation.expiry < maxExpiry ? delegation.expiry : maxExpiry;
@@ -19051,12 +19133,16 @@ var _TinyCloudNode = class _TinyCloudNode {
19051
19133
  const abilities = {};
19052
19134
  const kvActions = params.actions.filter((a) => a.startsWith("tinycloud.kv/"));
19053
19135
  const sqlActions = params.actions.filter((a) => a.startsWith("tinycloud.sql/"));
19136
+ const duckdbActions = params.actions.filter((a) => a.startsWith("tinycloud.duckdb/"));
19054
19137
  if (kvActions.length > 0) {
19055
19138
  abilities.kv = { [params.path]: kvActions };
19056
19139
  }
19057
19140
  if (sqlActions.length > 0) {
19058
19141
  abilities.sql = { [params.path]: sqlActions };
19059
19142
  }
19143
+ if (duckdbActions.length > 0) {
19144
+ abilities.duckdb = { [params.path]: duckdbActions };
19145
+ }
19060
19146
  const targetHost = parentDelegation.host ?? this.config.host;
19061
19147
  const prepared = prepareSession2({
19062
19148
  abilities,
@@ -19119,6 +19205,7 @@ function deserializeDelegation(data) {
19119
19205
  // src/index.ts
19120
19206
  import { KVService as KVService3, PrefixedKVService } from "@tinycloud/sdk-core";
19121
19207
  import { SQLService as SQLService3, SQLAction, DatabaseHandle } from "@tinycloud/sdk-core";
19208
+ import { DuckDbService as DuckDbService3, DuckDbDatabaseHandle, DuckDbAction } from "@tinycloud/sdk-core";
19122
19209
  import { DataVaultService as DataVaultService2, VaultAction, VaultHeaders, createVaultCrypto as createVaultCrypto2 } from "@tinycloud/sdk-core";
19123
19210
  import {
19124
19211
  DelegationManager as DelegationManager2,
@@ -19143,6 +19230,7 @@ import {
19143
19230
  import {
19144
19231
  ProtocolMismatchError,
19145
19232
  VersionCheckError,
19233
+ UnsupportedFeatureError as UnsupportedFeatureError2,
19146
19234
  checkNodeVersion as checkNodeVersion2
19147
19235
  } from "@tinycloud/sdk-core";
19148
19236
  import { ServiceContext as ServiceContext3 } from "@tinycloud/sdk-core";
@@ -19154,6 +19242,9 @@ export {
19154
19242
  DelegatedAccess,
19155
19243
  DelegationErrorCodes,
19156
19244
  DelegationManager2 as DelegationManager,
19245
+ DuckDbAction,
19246
+ DuckDbDatabaseHandle,
19247
+ DuckDbService3 as DuckDbService,
19157
19248
  FileSessionStorage,
19158
19249
  KVService3 as KVService,
19159
19250
  MemorySessionStorage,
@@ -19170,6 +19261,7 @@ export {
19170
19261
  SpaceService2 as SpaceService,
19171
19262
  TinyCloud2 as TinyCloud,
19172
19263
  TinyCloudNode,
19264
+ UnsupportedFeatureError2 as UnsupportedFeatureError,
19173
19265
  VaultAction,
19174
19266
  VaultHeaders,
19175
19267
  VersionCheckError,