@tinycloud/node-sdk 3.2.6-beta.0 → 3.2.6-beta.2
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/{WasmKeyProvider-LXRTjZTA.d.cts → WasmKeyProvider-CYU_dqOx.d.cts} +69 -3
- package/dist/{WasmKeyProvider-LXRTjZTA.d.ts → WasmKeyProvider-CYU_dqOx.d.ts} +69 -3
- package/dist/core.cjs +295 -59
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +295 -59
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +295 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +295 -59
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _tinycloud_sdk_core from '@tinycloud/sdk-core';
|
|
2
|
-
import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ReplicationOptions, ClientSession, TinyCloudSession, PermissionEntry, Extension, SignRequest, SpaceHostResult, SignInOptions, CapabilityPresentationEnvelopeV1, Delegation, DelegatedResource, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, StorageFullEvent, IStorageService, INotificationHandler, IENSResolver, KVReplicaStorage, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ServiceSession, ReplicationControl, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
|
|
2
|
+
import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ReplicationOptions, ClientSession, TinyCloudSession, PermissionEntry, Extension, SignRequest, SpaceHostResult, SignInOptions, CapabilityPresentationEnvelopeV1, Delegation, DelegatedResource, TelemetryConfig, ServiceContext, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, StorageFullEvent, IStorageService, INotificationHandler, IENSResolver, KVReplicaStorage, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ServiceSession, ReplicationControl, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
|
-
import { InvokeFunction, InvokeAnyFunction } from '@tinycloud/sdk-services';
|
|
4
|
+
import { InvokeFunction, InvokeAnyFunction, FetchFunction } from '@tinycloud/sdk-services';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* In-memory session storage for Node.js.
|
|
@@ -323,6 +323,13 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
323
323
|
private readonly includeAccountRegistryPermissions;
|
|
324
324
|
private sessionManager;
|
|
325
325
|
private activeSessionKeyId;
|
|
326
|
+
/** Incremented by resetSession; a sign-in started earlier publishes nothing. */
|
|
327
|
+
private sessionGeneration;
|
|
328
|
+
/**
|
|
329
|
+
* Sign-in saves run one at a time, in order, each together with its own
|
|
330
|
+
* cancellation cleanup, so no later write can land between the two.
|
|
331
|
+
*/
|
|
332
|
+
private persistenceQueue;
|
|
326
333
|
private extensions;
|
|
327
334
|
private _session?;
|
|
328
335
|
private _tinyCloudSession?;
|
|
@@ -388,6 +395,15 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
388
395
|
* {@link ensureTinyCloudHosts}.
|
|
389
396
|
*/
|
|
390
397
|
setRestoredTinyCloudSession(session: TinyCloudSession, hosts?: string[]): void;
|
|
398
|
+
/**
|
|
399
|
+
* @internal End the session: adopt a fresh session manager whose active key
|
|
400
|
+
* is `sessionKeyId`, and return to the constructed state.
|
|
401
|
+
*/
|
|
402
|
+
resetSession(sessionManager: ISessionManager, sessionKeyId: string, hosts?: string[]): void;
|
|
403
|
+
/** Throws when the session was reset (signed out) after `generation` was read. */
|
|
404
|
+
private assertSignInCurrent;
|
|
405
|
+
/** Runs `task` after every earlier queued persistence task has settled. */
|
|
406
|
+
private enqueuePersistence;
|
|
391
407
|
/** @internal Atomically adopt the state staged by TinyCloudNode.restoreSession. */
|
|
392
408
|
installRestoredSession(sessionManager: ISessionManager, session: TinyCloudSession | undefined, hosts?: string[], nodeFeatures?: string[]): void;
|
|
393
409
|
/**
|
|
@@ -1066,7 +1082,16 @@ declare class DelegatedAccess {
|
|
|
1066
1082
|
private _sql;
|
|
1067
1083
|
private _duckdb;
|
|
1068
1084
|
private _hooks;
|
|
1069
|
-
|
|
1085
|
+
/**
|
|
1086
|
+
* @param lifetime - Optional owner of this access: its `fetch` is used for
|
|
1087
|
+
* requests and the service context is registered with `track`, so the
|
|
1088
|
+
* owner can cancel and retire the access (TinyCloudNode does this when its
|
|
1089
|
+
* session is replaced or signed out).
|
|
1090
|
+
*/
|
|
1091
|
+
constructor(session: TinyCloudSession, delegation: PortableDelegation, host: string, invoke: InvokeFunction, invokeAny?: InvokeAnyFunction, telemetry?: TelemetryConfig, lifetime?: {
|
|
1092
|
+
fetch: FetchFunction;
|
|
1093
|
+
track(context: ServiceContext): ServiceContext;
|
|
1094
|
+
});
|
|
1070
1095
|
/**
|
|
1071
1096
|
* Get the delegation this access was created from.
|
|
1072
1097
|
*/
|
|
@@ -1515,6 +1540,18 @@ declare class TinyCloudNode {
|
|
|
1515
1540
|
private _restoredTcSession?;
|
|
1516
1541
|
private _restoredNodeFeatures?;
|
|
1517
1542
|
private _activeServiceSession?;
|
|
1543
|
+
/** The sign-out in progress; signIn and restoreSession wait for it. */
|
|
1544
|
+
private signOutInFlight?;
|
|
1545
|
+
/**
|
|
1546
|
+
* Incremented by every sign-out. A sign-in or restore records it when it
|
|
1547
|
+
* starts and does not establish its session once it has changed.
|
|
1548
|
+
*/
|
|
1549
|
+
private sessionEpoch;
|
|
1550
|
+
/**
|
|
1551
|
+
* Numbers sign-in and restore attempts. A cancelled attempt cleans up only
|
|
1552
|
+
* while it is still the latest, so it never ends a newer session.
|
|
1553
|
+
*/
|
|
1554
|
+
private latestSessionAttempt;
|
|
1518
1555
|
/**
|
|
1519
1556
|
* True when the last signIn() detected an interactive signer and skipped
|
|
1520
1557
|
* client-side bootstrap. Apps can read this to know whether bootstrap was
|
|
@@ -1610,6 +1647,12 @@ declare class TinyCloudNode {
|
|
|
1610
1647
|
* ```
|
|
1611
1648
|
*/
|
|
1612
1649
|
constructor(config?: TinyCloudNodeConfig);
|
|
1650
|
+
/**
|
|
1651
|
+
* SharingService for receive-only access (no session required), bound to the
|
|
1652
|
+
* current service graph. This lets session-only users receive sharing links
|
|
1653
|
+
* without signIn(); full capabilities (generate) are added after signIn().
|
|
1654
|
+
*/
|
|
1655
|
+
private createReceiveOnlySharing;
|
|
1613
1656
|
/**
|
|
1614
1657
|
* Set up authorization handler and TinyCloud instance.
|
|
1615
1658
|
* @internal
|
|
@@ -1705,6 +1748,28 @@ declare class TinyCloudNode {
|
|
|
1705
1748
|
* pass back to {@link restoreSession}.
|
|
1706
1749
|
*/
|
|
1707
1750
|
get restorableSession(): TinyCloudSession | undefined;
|
|
1751
|
+
/**
|
|
1752
|
+
* Sign out and end the session on this instance.
|
|
1753
|
+
*
|
|
1754
|
+
* Every service built for the session (and every `useDelegation()` result)
|
|
1755
|
+
* is retired and the session key is replaced before anything is awaited, so
|
|
1756
|
+
* nothing captured from the session can sign once sign-out has started.
|
|
1757
|
+
* Pending work is aborted and the persisted session is cleared from the
|
|
1758
|
+
* configured session storage. Afterwards session accessors return
|
|
1759
|
+
* `undefined` and service calls fail with "Not signed in" until
|
|
1760
|
+
* {@link signIn} or {@link restoreSession}, which wait for a sign-out in
|
|
1761
|
+
* progress.
|
|
1762
|
+
*/
|
|
1763
|
+
signOut(): Promise<void>;
|
|
1764
|
+
private endSession;
|
|
1765
|
+
/**
|
|
1766
|
+
* Synchronously drop every piece of in-memory session authority and
|
|
1767
|
+
* invalidate sign-ins and restores still in flight (see `sessionEpoch`).
|
|
1768
|
+
*/
|
|
1769
|
+
private teardownSession;
|
|
1770
|
+
private clearPersistedSessionFor;
|
|
1771
|
+
/** Throws when a sign-out started after `epoch` was read. */
|
|
1772
|
+
private assertSessionEpoch;
|
|
1708
1773
|
/**
|
|
1709
1774
|
* Sign in and create a new session.
|
|
1710
1775
|
* This creates the user's space if it doesn't exist.
|
|
@@ -1713,6 +1778,7 @@ declare class TinyCloudNode {
|
|
|
1713
1778
|
* @param options - Optional per-call SIWE overrides for this sign-in only
|
|
1714
1779
|
*/
|
|
1715
1780
|
signIn(options?: SignInOptions): Promise<void>;
|
|
1781
|
+
private establishSignIn;
|
|
1716
1782
|
/**
|
|
1717
1783
|
* Wait for the account-registry sync that {@link signIn} starts in the
|
|
1718
1784
|
* background (account index, this app's manifest record, space list).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as _tinycloud_sdk_core from '@tinycloud/sdk-core';
|
|
2
|
-
import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ReplicationOptions, ClientSession, TinyCloudSession, PermissionEntry, Extension, SignRequest, SpaceHostResult, SignInOptions, CapabilityPresentationEnvelopeV1, Delegation, DelegatedResource, TelemetryConfig, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, StorageFullEvent, IStorageService, INotificationHandler, IENSResolver, KVReplicaStorage, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ServiceSession, ReplicationControl, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
|
|
2
|
+
import { ISessionStorage, PersistedSessionData, AutoSignStrategy, AutoRejectStrategy, CallbackStrategy, IUserAuthorization, ISigner, ISpaceCreationHandler, LocalNodeIdentityStore, IWasmBindings, ISessionManager, SiweConfig, Manifest, ComposedManifestRequest, ReplicationOptions, ClientSession, TinyCloudSession, PermissionEntry, Extension, SignRequest, SpaceHostResult, SignInOptions, CapabilityPresentationEnvelopeV1, Delegation, DelegatedResource, TelemetryConfig, ServiceContext, IKVService, ISQLService, IDuckDbService, IHooksService, CreateOwnerDelegationParams as CreateOwnerDelegationParams$1, OwnerDelegationReceipt as OwnerDelegationReceipt$1, StorageFullEvent, IStorageService, INotificationHandler, IENSResolver, KVReplicaStorage, AccountService, InvokeAnyFunction as InvokeAnyFunction$1, UnifiedPolicyCapability, RegisterPolicyV3Input, RegisterPolicyV3Receipt, CanonicalJson, ShareDeliveryAuthorizationV3Receipt, IDataVaultService, IEncryptionService, NetworkDescriptor, ISecretsService, ICapabilityKeyRegistry, DelegationManager, ISpaceService, ISpace, ISharingService, CreateDelegationParams, DelegationResult, DelegationRevocationReceipt, DelegationStatus, ServiceSession, ReplicationControl, ResolvedDelegate, KeyProvider, JWK } from '@tinycloud/sdk-core';
|
|
3
3
|
import { EventEmitter } from 'events';
|
|
4
|
-
import { InvokeFunction, InvokeAnyFunction } from '@tinycloud/sdk-services';
|
|
4
|
+
import { InvokeFunction, InvokeAnyFunction, FetchFunction } from '@tinycloud/sdk-services';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* In-memory session storage for Node.js.
|
|
@@ -323,6 +323,13 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
323
323
|
private readonly includeAccountRegistryPermissions;
|
|
324
324
|
private sessionManager;
|
|
325
325
|
private activeSessionKeyId;
|
|
326
|
+
/** Incremented by resetSession; a sign-in started earlier publishes nothing. */
|
|
327
|
+
private sessionGeneration;
|
|
328
|
+
/**
|
|
329
|
+
* Sign-in saves run one at a time, in order, each together with its own
|
|
330
|
+
* cancellation cleanup, so no later write can land between the two.
|
|
331
|
+
*/
|
|
332
|
+
private persistenceQueue;
|
|
326
333
|
private extensions;
|
|
327
334
|
private _session?;
|
|
328
335
|
private _tinyCloudSession?;
|
|
@@ -388,6 +395,15 @@ declare class NodeUserAuthorization implements IUserAuthorization {
|
|
|
388
395
|
* {@link ensureTinyCloudHosts}.
|
|
389
396
|
*/
|
|
390
397
|
setRestoredTinyCloudSession(session: TinyCloudSession, hosts?: string[]): void;
|
|
398
|
+
/**
|
|
399
|
+
* @internal End the session: adopt a fresh session manager whose active key
|
|
400
|
+
* is `sessionKeyId`, and return to the constructed state.
|
|
401
|
+
*/
|
|
402
|
+
resetSession(sessionManager: ISessionManager, sessionKeyId: string, hosts?: string[]): void;
|
|
403
|
+
/** Throws when the session was reset (signed out) after `generation` was read. */
|
|
404
|
+
private assertSignInCurrent;
|
|
405
|
+
/** Runs `task` after every earlier queued persistence task has settled. */
|
|
406
|
+
private enqueuePersistence;
|
|
391
407
|
/** @internal Atomically adopt the state staged by TinyCloudNode.restoreSession. */
|
|
392
408
|
installRestoredSession(sessionManager: ISessionManager, session: TinyCloudSession | undefined, hosts?: string[], nodeFeatures?: string[]): void;
|
|
393
409
|
/**
|
|
@@ -1066,7 +1082,16 @@ declare class DelegatedAccess {
|
|
|
1066
1082
|
private _sql;
|
|
1067
1083
|
private _duckdb;
|
|
1068
1084
|
private _hooks;
|
|
1069
|
-
|
|
1085
|
+
/**
|
|
1086
|
+
* @param lifetime - Optional owner of this access: its `fetch` is used for
|
|
1087
|
+
* requests and the service context is registered with `track`, so the
|
|
1088
|
+
* owner can cancel and retire the access (TinyCloudNode does this when its
|
|
1089
|
+
* session is replaced or signed out).
|
|
1090
|
+
*/
|
|
1091
|
+
constructor(session: TinyCloudSession, delegation: PortableDelegation, host: string, invoke: InvokeFunction, invokeAny?: InvokeAnyFunction, telemetry?: TelemetryConfig, lifetime?: {
|
|
1092
|
+
fetch: FetchFunction;
|
|
1093
|
+
track(context: ServiceContext): ServiceContext;
|
|
1094
|
+
});
|
|
1070
1095
|
/**
|
|
1071
1096
|
* Get the delegation this access was created from.
|
|
1072
1097
|
*/
|
|
@@ -1515,6 +1540,18 @@ declare class TinyCloudNode {
|
|
|
1515
1540
|
private _restoredTcSession?;
|
|
1516
1541
|
private _restoredNodeFeatures?;
|
|
1517
1542
|
private _activeServiceSession?;
|
|
1543
|
+
/** The sign-out in progress; signIn and restoreSession wait for it. */
|
|
1544
|
+
private signOutInFlight?;
|
|
1545
|
+
/**
|
|
1546
|
+
* Incremented by every sign-out. A sign-in or restore records it when it
|
|
1547
|
+
* starts and does not establish its session once it has changed.
|
|
1548
|
+
*/
|
|
1549
|
+
private sessionEpoch;
|
|
1550
|
+
/**
|
|
1551
|
+
* Numbers sign-in and restore attempts. A cancelled attempt cleans up only
|
|
1552
|
+
* while it is still the latest, so it never ends a newer session.
|
|
1553
|
+
*/
|
|
1554
|
+
private latestSessionAttempt;
|
|
1518
1555
|
/**
|
|
1519
1556
|
* True when the last signIn() detected an interactive signer and skipped
|
|
1520
1557
|
* client-side bootstrap. Apps can read this to know whether bootstrap was
|
|
@@ -1610,6 +1647,12 @@ declare class TinyCloudNode {
|
|
|
1610
1647
|
* ```
|
|
1611
1648
|
*/
|
|
1612
1649
|
constructor(config?: TinyCloudNodeConfig);
|
|
1650
|
+
/**
|
|
1651
|
+
* SharingService for receive-only access (no session required), bound to the
|
|
1652
|
+
* current service graph. This lets session-only users receive sharing links
|
|
1653
|
+
* without signIn(); full capabilities (generate) are added after signIn().
|
|
1654
|
+
*/
|
|
1655
|
+
private createReceiveOnlySharing;
|
|
1613
1656
|
/**
|
|
1614
1657
|
* Set up authorization handler and TinyCloud instance.
|
|
1615
1658
|
* @internal
|
|
@@ -1705,6 +1748,28 @@ declare class TinyCloudNode {
|
|
|
1705
1748
|
* pass back to {@link restoreSession}.
|
|
1706
1749
|
*/
|
|
1707
1750
|
get restorableSession(): TinyCloudSession | undefined;
|
|
1751
|
+
/**
|
|
1752
|
+
* Sign out and end the session on this instance.
|
|
1753
|
+
*
|
|
1754
|
+
* Every service built for the session (and every `useDelegation()` result)
|
|
1755
|
+
* is retired and the session key is replaced before anything is awaited, so
|
|
1756
|
+
* nothing captured from the session can sign once sign-out has started.
|
|
1757
|
+
* Pending work is aborted and the persisted session is cleared from the
|
|
1758
|
+
* configured session storage. Afterwards session accessors return
|
|
1759
|
+
* `undefined` and service calls fail with "Not signed in" until
|
|
1760
|
+
* {@link signIn} or {@link restoreSession}, which wait for a sign-out in
|
|
1761
|
+
* progress.
|
|
1762
|
+
*/
|
|
1763
|
+
signOut(): Promise<void>;
|
|
1764
|
+
private endSession;
|
|
1765
|
+
/**
|
|
1766
|
+
* Synchronously drop every piece of in-memory session authority and
|
|
1767
|
+
* invalidate sign-ins and restores still in flight (see `sessionEpoch`).
|
|
1768
|
+
*/
|
|
1769
|
+
private teardownSession;
|
|
1770
|
+
private clearPersistedSessionFor;
|
|
1771
|
+
/** Throws when a sign-out started after `epoch` was read. */
|
|
1772
|
+
private assertSessionEpoch;
|
|
1708
1773
|
/**
|
|
1709
1774
|
* Sign in and create a new session.
|
|
1710
1775
|
* This creates the user's space if it doesn't exist.
|
|
@@ -1713,6 +1778,7 @@ declare class TinyCloudNode {
|
|
|
1713
1778
|
* @param options - Optional per-call SIWE overrides for this sign-in only
|
|
1714
1779
|
*/
|
|
1715
1780
|
signIn(options?: SignInOptions): Promise<void>;
|
|
1781
|
+
private establishSignIn;
|
|
1716
1782
|
/**
|
|
1717
1783
|
* Wait for the account-registry sync that {@link signIn} starts in the
|
|
1718
1784
|
* background (account index, this app's manifest record, space list).
|