@tinycloud/node-sdk 3.0.1-beta.0 → 3.1.0-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/{core-DufYfxi-.d.cts → core-Bm76PnOz.d.cts} +7 -1
- package/dist/{core-DufYfxi-.d.ts → core-Bm76PnOz.d.ts} +7 -1
- package/dist/core.cjs +48 -17
- 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 +53 -18
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +54 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +60 -19
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/core.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CanonicalAddress, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DidCacheKeyOptions, DidEqualsOptions, 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, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, ParsedSecretCatalogKey, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ResolvedCapabilities, ResolvedDelegate, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloud, TinyCloudConfig, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, TinyCloudSession, UnsupportedFeatureError, VAULT_PERMISSION_SERVICE, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VersionCheckError, ViewInfo, WasmVaultFunctions, addressStorageKey, buildSpaceUri, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeNetworkId, canonicalizeSecretScope, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, defaultSpaceCreationHandler, didCacheKey, didEquals, disableTinyCloudDebug, enableTinyCloudDebug, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, loadManifest, makePkhSpaceId, makePublicSpaceId, parseCanonicalNetworkId, parseExpiry, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateManifest } from '@tinycloud/sdk-core';
|
|
2
|
-
export { e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, G as serializeDelegation } from './core-
|
|
2
|
+
export { e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, G as serializeDelegation } from './core-Bm76PnOz.cjs';
|
|
3
3
|
import 'events';
|
|
4
4
|
import '@tinycloud/sdk-services';
|
package/dist/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AutoApproveSpaceCreationHandler, AutoRejectStrategy, AutoSignStrategy, BatchOptions, BatchResponse, CallbackStrategy, CanonicalAddress, CanonicalParsedNetworkId, CapabilityEntry, CapabilityKeyRegistry, CapabilityKeyRegistryErrorCode, CapabilityKeyRegistryErrorCodes, CaveatedDelegationUnsupportedError, ClientSession, ColumnInfo, ComposeManifestOptions, ComposedManifestRequest, CreateDelegationParams, DEFAULT_MANIFEST_SPACE, DEFAULT_MANIFEST_VERSION, DEFAULT_SIGNED_READ_URL_EXPIRY_MS, DataVaultConfig, DataVaultService, DatabaseHandle, DelegateReceivedShareParams, DelegatedShareAccess, Delegation, DelegationChain, DelegationChainV2, DelegationDirection, DelegationError, DelegationErrorCode, DelegationErrorCodes, DelegationFilters, DelegationManager, DelegationManagerConfig, DelegationRecord, DelegationResult, DidCacheKeyOptions, DidEqualsOptions, 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, ISecretsService, ISessionManager, ISessionStorage, ISharingService, ISigner, ISpace, ISpaceCreationHandler, ISpaceScopedDelegations, ISpaceScopedSharing, ISpaceService, IUserAuthorization, IWasmBindings, IdentityParseError, IngestOptions, InvokeFunction, JWK, KVBatchReadResponse, KVCreateSignedReadUrlOptions, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, ParsedSecretCatalogKey, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PkhDidParts, PrefixedKVService, ProtocolMismatchError, QueryOptions, QueryResponse, ReceiveOptions, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ResolvedCapabilities, ResolvedDelegate, ResolvedSecretPath, ResourceCapability, SECRET_NAME_RE, SQLAction, SQLActionType, SQLService, SQLServiceConfig, SchemaInfo, SecretCatalogEntry, SecretPayload, SecretScopeOptions, SecretsError, SecretsService, ServiceContext, ServiceContextConfig, ServiceSession, SessionExpiredError, ShareAccess, ShareLink, ShareLinkData, ShareSchema, SharingService, SharingServiceConfig, SignCallback, SignInOptions, SignRequest, SignResponse, SilentNotificationHandler, Space, SpaceAbilitiesMap, SpaceConfig, SpaceCreationContext, SpaceErrorCode, SpaceErrorCodes, SpaceInfo, SpaceOwnership, SpaceService, SpaceServiceConfig, SqlStatement, SqlValue, StoredDelegationChain, TableInfo, TelemetryConfig, TelemetryEventHandler, TinyCloud, TinyCloudConfig, TinyCloudDebugEnableOptions, TinyCloudDebugEvent, TinyCloudDebugLevel, TinyCloudDebugLogger, TinyCloudDebugTimer, TinyCloudSession, UnsupportedFeatureError, VAULT_PERMISSION_SERVICE, VaultCrypto, VaultEntry, VaultError, VaultGetOptions, VaultGrantOptions, VaultHeaders, VaultListOptions, VaultNetworkReadResult, VaultPublicSpaceKVActions, VaultPutOptions, VersionCheckError, ViewInfo, WasmVaultFunctions, addressStorageKey, buildSpaceUri, canonicalizeAddress, canonicalizeDid, canonicalizeDidUrl, canonicalizeNetworkId, canonicalizeSecretScope, checkNodeInfo, clearTinyCloudDebugLogs, composeManifestRequest, createCapabilityKeyRegistry, createOpenKeyCallbackSigningStrategy, createSharingService, createSpaceService, createVaultCrypto, defaultSpaceCreationHandler, didCacheKey, didEquals, disableTinyCloudDebug, enableTinyCloudDebug, expandActionShortNames, expandPermissionEntries, expandPermissionEntry, getTinyCloudDebugLogs, installTinyCloudDebugGlobals, isCapabilitySubset, isEvmAddress, loadManifest, makePkhSpaceId, makePublicSpaceId, parseCanonicalNetworkId, parseExpiry, parsePkhDid, parseSecretCatalogKey, parseSpaceUri, pkhDid, principalDid, principalDidEquals, resolveManifest, resolveSecretListPrefix, resolveSecretPath, resourceCapabilitiesToSpaceAbilitiesMap, tinyCloudDebugLogger, validateManifest } from '@tinycloud/sdk-core';
|
|
2
|
-
export { e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, G as serializeDelegation } from './core-
|
|
2
|
+
export { e as BootstrapWarning, C as CompactRuntimeDelegationInput, f as CreateOwnerDelegationParams, D as DelegateToOptions, g as DelegateToResult, h as DelegatedAccess, E as EnsureEncryptionNetworkOptions, F as FileSessionStorage, I as InvalidRestoredSessionError, M as MemorySessionStorage, N as NodeEventEmitterStrategy, j as NodeUserAuthorization, k as NodeUserAuthorizationConfig, O as OwnerDelegationReceipt, P as PortableDelegation, m as RuntimePermissionGrantOptions, S as SecretPermissionHint, n as SecretReadInput, o as SecretReadResult, p as SignStrategy, T as TinyCloudNode, q as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, r as UnifiedOwnerRootReceipt, s as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, t as WasmKeyProviderConfig, u as activateCompactRuntimeDelegation, w as createWasmKeyProvider, x as defaultSignStrategy, y as deserializeDelegation, G as serializeDelegation } from './core-Bm76PnOz.js';
|
|
3
3
|
import 'events';
|
|
4
4
|
import '@tinycloud/sdk-services';
|
package/dist/core.js
CHANGED
|
@@ -726,21 +726,28 @@ var NodeUserAuthorization = class {
|
|
|
726
726
|
});
|
|
727
727
|
const signature = await this.signMessage(siwe, purpose);
|
|
728
728
|
const headers = this.wasm.siweToDelegationHeaders({ siwe, signature });
|
|
729
|
-
|
|
730
|
-
return result.success;
|
|
729
|
+
return submitHostDelegation(host, headers);
|
|
731
730
|
}
|
|
732
731
|
/**
|
|
733
732
|
* Create a specific space on the server via host delegation.
|
|
734
733
|
* Used for lazy creation of additional spaces (e.g., public).
|
|
735
734
|
*/
|
|
736
735
|
async hostPublicSpace(spaceId) {
|
|
737
|
-
return this.hostSpace(spaceId);
|
|
736
|
+
return (await this.hostSpace(spaceId)).success;
|
|
738
737
|
}
|
|
739
738
|
/**
|
|
740
739
|
* Create a specific owned space on the server via host delegation.
|
|
741
740
|
* Used by manifest registry setup for the account space.
|
|
742
741
|
*/
|
|
743
742
|
async hostOwnedSpace(spaceId, purpose) {
|
|
743
|
+
return (await this.hostOwnedSpaceResult(spaceId, purpose)).success;
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* {@link hostOwnedSpace} with the full host-delegation result, so a failure
|
|
747
|
+
* keeps its HTTP status (e.g. a typed 401/403) instead of collapsing to
|
|
748
|
+
* `false`.
|
|
749
|
+
*/
|
|
750
|
+
async hostOwnedSpaceResult(spaceId, purpose) {
|
|
744
751
|
return this.hostSpace(spaceId, purpose);
|
|
745
752
|
}
|
|
746
753
|
/**
|
|
@@ -783,7 +790,7 @@ var NodeUserAuthorization = class {
|
|
|
783
790
|
return;
|
|
784
791
|
}
|
|
785
792
|
try {
|
|
786
|
-
const created = await this.hostSpace();
|
|
793
|
+
const created = (await this.hostSpace()).success;
|
|
787
794
|
if (!created) {
|
|
788
795
|
const err = new Error(`Failed to create space: ${primarySpaceId}`);
|
|
789
796
|
handler.onSpaceCreationFailed?.(creationContext, err);
|
|
@@ -820,7 +827,7 @@ var NodeUserAuthorization = class {
|
|
|
820
827
|
return;
|
|
821
828
|
}
|
|
822
829
|
try {
|
|
823
|
-
const created = await this.hostSpace();
|
|
830
|
+
const created = (await this.hostSpace()).success;
|
|
824
831
|
if (!created) {
|
|
825
832
|
const err = new Error(`Failed to create space: ${primarySpaceId}`);
|
|
826
833
|
handler.onSpaceCreationFailed?.(creationContext, err);
|
|
@@ -1662,6 +1669,7 @@ var NodeUserAuthorization = class {
|
|
|
1662
1669
|
import {
|
|
1663
1670
|
TinyCloud,
|
|
1664
1671
|
activateSessionWithHost as activateSessionWithHost2,
|
|
1672
|
+
authorizationVerdictOf,
|
|
1665
1673
|
KVService as KVService2,
|
|
1666
1674
|
SQLService as SQLService2,
|
|
1667
1675
|
DuckDbService as DuckDbService2,
|
|
@@ -1717,7 +1725,10 @@ import {
|
|
|
1717
1725
|
CREDENTIAL_INVITATION_REQUEST_DOMAIN,
|
|
1718
1726
|
validateShareDeliveryAuthorizationV3Bytes,
|
|
1719
1727
|
verifyEip191MessageSignature,
|
|
1720
|
-
signCompactUcanRootAuthorization
|
|
1728
|
+
signCompactUcanRootAuthorization,
|
|
1729
|
+
isStorageFullError,
|
|
1730
|
+
STORAGE_FULL_MESSAGE,
|
|
1731
|
+
STORAGE_WRITE_TOO_LARGE_MESSAGE
|
|
1721
1732
|
} from "@tinycloud/sdk-core";
|
|
1722
1733
|
import {
|
|
1723
1734
|
parsePermissionHint
|
|
@@ -2400,6 +2411,10 @@ function persistedExpiry(value) {
|
|
|
2400
2411
|
function sameInstant(left, right) {
|
|
2401
2412
|
return left.getTime() === right.getTime();
|
|
2402
2413
|
}
|
|
2414
|
+
function describeHostFailure(result) {
|
|
2415
|
+
const text = result.error?.trim();
|
|
2416
|
+
return text ? `${result.status} - ${text}` : `${result.status}`;
|
|
2417
|
+
}
|
|
2403
2418
|
function ownerDelegationPermissions(params) {
|
|
2404
2419
|
const hasPermissions = Object.prototype.hasOwnProperty.call(params, "permissions");
|
|
2405
2420
|
const hasLegacy = Object.prototype.hasOwnProperty.call(params, "path") || Object.prototype.hasOwnProperty.call(params, "actions");
|
|
@@ -3513,8 +3528,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3513
3528
|
await this.ensureOwnedSpaceHostedById(accountSpaceId);
|
|
3514
3529
|
const result = await this.account.applications.register(request.manifests);
|
|
3515
3530
|
if (!result.ok) {
|
|
3516
|
-
throw
|
|
3517
|
-
`Failed to write manifest registry records: ${result.error.message}`
|
|
3531
|
+
throw Object.assign(
|
|
3532
|
+
new Error(`Failed to write manifest registry records: ${result.error.message}`),
|
|
3533
|
+
{ cause: result.error }
|
|
3518
3534
|
);
|
|
3519
3535
|
}
|
|
3520
3536
|
}
|
|
@@ -3539,7 +3555,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3539
3555
|
if (this.currentSessionCanListSpaces()) {
|
|
3540
3556
|
const spaces = await this.account.spaces.syncAccessible();
|
|
3541
3557
|
if (!spaces.ok) {
|
|
3542
|
-
throw
|
|
3558
|
+
throw Object.assign(
|
|
3559
|
+
new Error(`Failed to sync account spaces: ${spaces.error.message}`),
|
|
3560
|
+
{ cause: spaces.error }
|
|
3561
|
+
);
|
|
3543
3562
|
}
|
|
3544
3563
|
}
|
|
3545
3564
|
});
|
|
@@ -3594,14 +3613,20 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3594
3613
|
await task();
|
|
3595
3614
|
return;
|
|
3596
3615
|
} catch (error) {
|
|
3616
|
+
const verdict = authorizationVerdictOf(error);
|
|
3597
3617
|
const message = error instanceof Error ? error.message : String(error);
|
|
3598
|
-
|
|
3618
|
+
const isAuthorizationVerdict = verdict === void 0 ? /Unauthorized Action|\b(?:401|403)\b/.test(message) : verdict !== "other";
|
|
3619
|
+
if (isAuthorizationVerdict) {
|
|
3599
3620
|
console.warn(
|
|
3600
3621
|
"TinyCloud account registry sync stopped: authorization verdict is not retryable",
|
|
3601
3622
|
error
|
|
3602
3623
|
);
|
|
3603
3624
|
return;
|
|
3604
3625
|
}
|
|
3626
|
+
if (isStorageFullError(error) || isStorageFullError(error?.cause) || message.includes(STORAGE_FULL_MESSAGE) || message.includes(STORAGE_WRITE_TOO_LARGE_MESSAGE)) {
|
|
3627
|
+
console.warn("TinyCloud account registry sync stopped: storage is full", error);
|
|
3628
|
+
return;
|
|
3629
|
+
}
|
|
3605
3630
|
lastError = error;
|
|
3606
3631
|
if (attempt < delays.length - 1) {
|
|
3607
3632
|
await new Promise((resolve) => setTimeout(resolve, delays[attempt]));
|
|
@@ -3675,19 +3700,26 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3675
3700
|
return;
|
|
3676
3701
|
}
|
|
3677
3702
|
if (!activation.success && activation.status !== 404) {
|
|
3678
|
-
throw
|
|
3679
|
-
`Failed to check owned space ${spaceId}: ${activation
|
|
3703
|
+
throw Object.assign(
|
|
3704
|
+
new Error(`Failed to check owned space ${spaceId}: ${describeHostFailure(activation)}`),
|
|
3705
|
+
{ cause: activation }
|
|
3680
3706
|
);
|
|
3681
3707
|
}
|
|
3682
|
-
const created = await this.auth.
|
|
3683
|
-
if (!created) {
|
|
3684
|
-
throw
|
|
3708
|
+
const created = await this.auth.hostOwnedSpaceResult(spaceId);
|
|
3709
|
+
if (!created.success) {
|
|
3710
|
+
throw Object.assign(
|
|
3711
|
+
new Error(`Failed to create owned space ${spaceId}: ${describeHostFailure(created)}`),
|
|
3712
|
+
{ cause: created }
|
|
3713
|
+
);
|
|
3685
3714
|
}
|
|
3686
3715
|
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
3687
3716
|
const retry = await activateSessionWithHost2(host, session.delegationHeader);
|
|
3688
3717
|
if (!retry.success || retry.skipped?.includes(spaceId)) {
|
|
3689
|
-
throw
|
|
3690
|
-
|
|
3718
|
+
throw Object.assign(
|
|
3719
|
+
new Error(
|
|
3720
|
+
`Failed to activate session after creating owned space ${spaceId}: ${retry.success ? "space was skipped" : describeHostFailure(retry)}`
|
|
3721
|
+
),
|
|
3722
|
+
{ cause: retry }
|
|
3691
3723
|
);
|
|
3692
3724
|
}
|
|
3693
3725
|
this.confirmedHostedSpaceIds.add(spaceId);
|
|
@@ -5235,7 +5267,10 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
5235
5267
|
const activation = await activateSessionWithHost2(host, delegationSession.delegationHeader);
|
|
5236
5268
|
assertOwnerGraphActive();
|
|
5237
5269
|
if (!activation.success) {
|
|
5238
|
-
throw
|
|
5270
|
+
throw Object.assign(
|
|
5271
|
+
new Error(`Owner delegation import failed: ${activation.status} ${activation.error ?? ""}`.trim()),
|
|
5272
|
+
{ cause: activation }
|
|
5273
|
+
);
|
|
5239
5274
|
}
|
|
5240
5275
|
const delegation = {
|
|
5241
5276
|
cid: delegationSession.delegationCid,
|