@tinycloud/node-sdk 2.1.0-beta.4 → 2.1.0-beta.6

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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, IWasmBindings, SiweConfig, Manifest, ClientSession, TinyCloudSession, Extension, Delegation, DelegatedResource, IKVService, ISQLService, IDuckDbService, IHooksService, INotificationHandler, IENSResolver, IDataVaultService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISharingService, CreateDelegationParams, DelegationResult, PermissionEntry, KeyProvider, ISessionManager, JWK } from '@tinycloud/sdk-core';
2
- export { AutoApproveSpaceCreationHandler, 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, IENSResolver, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IngestOptions, InvokeFunction, JWK, KVResponse, KVService, KVServiceConfig, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestDelegation, ManifestValidationError, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, ResolvedCapabilities, ResolvedDelegate, ResourceCapability, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceConfig, SpaceCreationContext, 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, defaultSpaceCreationHandler, expandActionShortNames, isCapabilitySubset, loadManifest, makePublicSpaceId, parseExpiry, parseSpaceUri, resolveManifest, validateManifest } from '@tinycloud/sdk-core';
1
+ import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, IWasmBindings, SiweConfig, Manifest, ClientSession, TinyCloudSession, Extension, SignInOptions, Delegation, DelegatedResource, IKVService, ISQLService, IDuckDbService, IHooksService, INotificationHandler, IENSResolver, IDataVaultService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISharingService, CreateDelegationParams, DelegationResult, PermissionEntry, KeyProvider, ISessionManager, JWK } from '@tinycloud/sdk-core';
2
+ export { AutoApproveSpaceCreationHandler, 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, IENSResolver, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IngestOptions, InvokeFunction, JWK, KVResponse, KVService, KVServiceConfig, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestDelegation, ManifestValidationError, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, ResolvedCapabilities, ResolvedDelegate, ResourceCapability, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceConfig, SpaceCreationContext, 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, defaultSpaceCreationHandler, expandActionShortNames, isCapabilitySubset, loadManifest, makePublicSpaceId, parseExpiry, parseSpaceUri, resolveManifest, validateManifest } from '@tinycloud/sdk-core';
3
3
  import { EventEmitter } from 'events';
4
4
  import { InvokeFunction } from '@tinycloud/sdk-services';
5
5
 
@@ -342,6 +342,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
342
342
  * - resources are appended to the default resources
343
343
  * - uri triggers a warning (overwriting delegation target)
344
344
  * - all other fields override directly
345
+ * - per-call nonce overrides siweConfig.nonce when provided
345
346
  */
346
347
  private buildSiweOverrides;
347
348
  /**
@@ -379,8 +380,10 @@ declare class NodeUserAuthorization implements IUserAuthorization {
379
380
  * 2. Call prepareSession() which generates the SIWE with ReCap capabilities
380
381
  * 3. Sign the SIWE string from prepareSession
381
382
  * 4. Call completeSessionSetup() with the prepared session + signature
383
+ *
384
+ * @param options - Optional per-call SIWE overrides for this sign-in only
382
385
  */
383
- signIn(): Promise<ClientSession>;
386
+ signIn(options?: SignInOptions): Promise<ClientSession>;
384
387
  /**
385
388
  * Sign out and clear the current session.
386
389
  */
@@ -800,8 +803,10 @@ declare class TinyCloudNode {
800
803
  * Sign in and create a new session.
801
804
  * This creates the user's space if it doesn't exist.
802
805
  * Requires wallet mode (privateKey in config).
806
+ *
807
+ * @param options - Optional per-call SIWE overrides for this sign-in only
803
808
  */
804
- signIn(): Promise<void>;
809
+ signIn(options?: SignInOptions): Promise<void>;
805
810
  /**
806
811
  * Restore a previously established session from stored delegation data.
807
812
  *
package/dist/core.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, IWasmBindings, SiweConfig, Manifest, ClientSession, TinyCloudSession, Extension, Delegation, DelegatedResource, IKVService, ISQLService, IDuckDbService, IHooksService, INotificationHandler, IENSResolver, IDataVaultService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISharingService, CreateDelegationParams, DelegationResult, PermissionEntry, KeyProvider, ISessionManager, JWK } from '@tinycloud/sdk-core';
2
- export { AutoApproveSpaceCreationHandler, 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, IENSResolver, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IngestOptions, InvokeFunction, JWK, KVResponse, KVService, KVServiceConfig, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestDelegation, ManifestValidationError, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, ResolvedCapabilities, ResolvedDelegate, ResourceCapability, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceConfig, SpaceCreationContext, 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, defaultSpaceCreationHandler, expandActionShortNames, isCapabilitySubset, loadManifest, makePublicSpaceId, parseExpiry, parseSpaceUri, resolveManifest, validateManifest } from '@tinycloud/sdk-core';
1
+ import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, IWasmBindings, SiweConfig, Manifest, ClientSession, TinyCloudSession, Extension, SignInOptions, Delegation, DelegatedResource, IKVService, ISQLService, IDuckDbService, IHooksService, INotificationHandler, IENSResolver, IDataVaultService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISharingService, CreateDelegationParams, DelegationResult, PermissionEntry, KeyProvider, ISessionManager, JWK } from '@tinycloud/sdk-core';
2
+ export { AutoApproveSpaceCreationHandler, 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, IENSResolver, IKVService, INotificationHandler, IPrefixedKVService, ISQLService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IngestOptions, InvokeFunction, JWK, KVResponse, KVService, KVServiceConfig, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestDelegation, ManifestValidationError, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, ResolvedCapabilities, ResolvedDelegate, ResourceCapability, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceConfig, SpaceCreationContext, 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, defaultSpaceCreationHandler, expandActionShortNames, isCapabilitySubset, loadManifest, makePublicSpaceId, parseExpiry, parseSpaceUri, resolveManifest, validateManifest } from '@tinycloud/sdk-core';
3
3
  import { EventEmitter } from 'events';
4
4
  import { InvokeFunction } from '@tinycloud/sdk-services';
5
5
 
@@ -342,6 +342,7 @@ declare class NodeUserAuthorization implements IUserAuthorization {
342
342
  * - resources are appended to the default resources
343
343
  * - uri triggers a warning (overwriting delegation target)
344
344
  * - all other fields override directly
345
+ * - per-call nonce overrides siweConfig.nonce when provided
345
346
  */
346
347
  private buildSiweOverrides;
347
348
  /**
@@ -379,8 +380,10 @@ declare class NodeUserAuthorization implements IUserAuthorization {
379
380
  * 2. Call prepareSession() which generates the SIWE with ReCap capabilities
380
381
  * 3. Sign the SIWE string from prepareSession
381
382
  * 4. Call completeSessionSetup() with the prepared session + signature
383
+ *
384
+ * @param options - Optional per-call SIWE overrides for this sign-in only
382
385
  */
383
- signIn(): Promise<ClientSession>;
386
+ signIn(options?: SignInOptions): Promise<ClientSession>;
384
387
  /**
385
388
  * Sign out and clear the current session.
386
389
  */
@@ -800,8 +803,10 @@ declare class TinyCloudNode {
800
803
  * Sign in and create a new session.
801
804
  * This creates the user's space if it doesn't exist.
802
805
  * Requires wallet mode (privateKey in config).
806
+ *
807
+ * @param options - Optional per-call SIWE overrides for this sign-in only
803
808
  */
804
- signIn(): Promise<void>;
809
+ signIn(options?: SignInOptions): Promise<void>;
805
810
  /**
806
811
  * Restore a previously established session from stored delegation data.
807
812
  *
package/dist/core.js CHANGED
@@ -349,14 +349,17 @@ var NodeUserAuthorization = class {
349
349
  * - resources are appended to the default resources
350
350
  * - uri triggers a warning (overwriting delegation target)
351
351
  * - all other fields override directly
352
+ * - per-call nonce overrides siweConfig.nonce when provided
352
353
  */
353
- buildSiweOverrides() {
354
+ buildSiweOverrides(options) {
354
355
  const base = { uri: this.uri };
355
356
  if (this.nonce !== void 0) {
356
357
  base.nonce = this.nonce;
357
358
  }
358
- if (!this.siweConfig) return base;
359
- const { statement, resources, uri, ...rest } = this.siweConfig;
359
+ if (!this.siweConfig && !options?.nonce) {
360
+ return base;
361
+ }
362
+ const { statement, resources, uri, ...rest } = this.siweConfig ?? {};
360
363
  const overrides = { ...base, ...rest };
361
364
  if (statement) {
362
365
  overrides.statement = this.statement ? `${statement} ${this.statement}` : statement;
@@ -370,6 +373,9 @@ var NodeUserAuthorization = class {
370
373
  );
371
374
  overrides.uri = uri;
372
375
  }
376
+ if (options?.nonce) {
377
+ overrides.nonce = options.nonce;
378
+ }
373
379
  return overrides;
374
380
  }
375
381
  /**
@@ -528,8 +534,10 @@ var NodeUserAuthorization = class {
528
534
  * 2. Call prepareSession() which generates the SIWE with ReCap capabilities
529
535
  * 3. Sign the SIWE string from prepareSession
530
536
  * 4. Call completeSessionSetup() with the prepared session + signature
537
+ *
538
+ * @param options - Optional per-call SIWE overrides for this sign-in only
531
539
  */
532
- async signIn() {
540
+ async signIn(options) {
533
541
  this._address = await this.signer.getAddress();
534
542
  this._chainId = await this.signer.getChainId();
535
543
  const address = this.wasm.ensureEip55(this._address);
@@ -553,7 +561,7 @@ var NodeUserAuthorization = class {
553
561
  expirationTime: expirationTime.toISOString(),
554
562
  spaceId,
555
563
  jwk,
556
- ...this.buildSiweOverrides()
564
+ ...this.buildSiweOverrides(options)
557
565
  });
558
566
  const signature = await this.requestSignature({
559
567
  address,
@@ -1312,8 +1320,10 @@ var _TinyCloudNode = class _TinyCloudNode {
1312
1320
  * Sign in and create a new session.
1313
1321
  * This creates the user's space if it doesn't exist.
1314
1322
  * Requires wallet mode (privateKey in config).
1323
+ *
1324
+ * @param options - Optional per-call SIWE overrides for this sign-in only
1315
1325
  */
1316
- async signIn() {
1326
+ async signIn(options) {
1317
1327
  if (!this.signer || !this.tc) {
1318
1328
  throw new Error(
1319
1329
  "Cannot signIn() in session-only mode. Provide a privateKey in config to create your own space."
@@ -1327,7 +1337,7 @@ var _TinyCloudNode = class _TinyCloudNode {
1327
1337
  this._duckdb = void 0;
1328
1338
  this._hooks = void 0;
1329
1339
  this._serviceContext = void 0;
1330
- await this.tc.signIn();
1340
+ await this.tc.signIn(options);
1331
1341
  this.initializeServices();
1332
1342
  this.notificationHandler.success("Successfully signed in");
1333
1343
  }
@@ -2443,7 +2453,7 @@ var _TinyCloudNode = class _TinyCloudNode {
2443
2453
  expirationSecs
2444
2454
  });
2445
2455
  const primary = result.resources[0];
2446
- const delegationHeader = { Authorization: `Bearer ${result.delegation}` };
2456
+ const delegationHeader = { Authorization: result.delegation };
2447
2457
  const activateResult = await activateSessionWithHost2(
2448
2458
  this.config.host,
2449
2459
  delegationHeader