@tinycloud/node-sdk 3.2.0-beta.7 → 3.2.0-beta.9
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-DlfIZM_l.d.cts → WasmKeyProvider-6_YwgSkd.d.cts} +9 -0
- package/dist/{WasmKeyProvider-DlfIZM_l.d.ts → WasmKeyProvider-6_YwgSkd.d.ts} +9 -0
- package/dist/core.cjs +77 -7
- 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 +77 -7
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +77 -7
- 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 +77 -7
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/core.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AuthorityRefusal, 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, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, ReceiveOptions, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGrantInfo, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, 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
2
|
import { _ as __authority } from './authority-DDGtccBK.cjs';
|
|
3
3
|
import { _ as __runtime } from './runtime-B5P5SRpC.cjs';
|
|
4
|
-
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, p as RuntimePermissionGrantOptions, S as SecretPermissionHint, q as SecretReadInput, r as SecretReadResult, t as SignStrategy, T as TinyCloudNode, u as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, v as UnifiedOwnerRootReceipt, w as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, y as WasmKeyProviderConfig, z as activateCompactRuntimeDelegation, H as createWasmKeyProvider, J as defaultSignStrategy, K as deserializeDelegation, Q as serializeDelegation } from './WasmKeyProvider-
|
|
4
|
+
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, p as RuntimePermissionGrantOptions, S as SecretPermissionHint, q as SecretReadInput, r as SecretReadResult, t as SignStrategy, T as TinyCloudNode, u as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, v as UnifiedOwnerRootReceipt, w as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, y as WasmKeyProviderConfig, z as activateCompactRuntimeDelegation, H as createWasmKeyProvider, J as defaultSignStrategy, K as deserializeDelegation, Q as serializeDelegation } from './WasmKeyProvider-6_YwgSkd.cjs';
|
|
5
5
|
import '@tinycloud/sdk-services';
|
|
6
6
|
import 'events';
|
|
7
7
|
|
package/dist/core.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { ACCOUNT_REGISTRY_PATH, ACCOUNT_REGISTRY_SPACE, AccountApplication, AccountApplicationListOptions, AccountApplicationRegisterOptions, AccountDelegation, AccountDelegationListOptions, AccountDelegationRevokeOptions, AccountIndexEnsureResult, AccountIndexRebuildResult, AccountIndexStatus, AccountIndexedReadOptions, AccountService, AccountServiceConfig, AccountSpace, AccountSpaceListOptions, AccountStatus, AuthorityRefusal, 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, KVListPage, KVReadThrough, KVReplicaHandle, KVReplicaSpec, KVReplicaStorage, KVReplicationController, KVReplicationDeps, KVResponse, KVService, KVServiceConfig, KVSignedReadUrlResponse, KeyInfo, KeyProvider, KeyType, LocalGetResult, LocalListResult, LocalReadMeta, LocalReplicaStatus, LocalSyncResult, Manifest, ManifestDefaults, ManifestRegistryRecord, ManifestSecretActions, ManifestValidationError, OpenKeyCallbackStrategy, OpenKeySigningRequestBody, OpenKeySigningResponseBody, OpenKeySigningStrategyOptions, ParsedSecretCatalogKey, PendingWriteRecord, PendingWriteState, PendingWriteStore, PermissionEntry, PermissionNotInManifestError, PersistedSessionData, PinnedKey, PkhDidParts, PrefixedKVService, ProtocolMismatchError, PurgeTarget, QueryOptions, QueryResponse, ReceiveOptions, RegisterBatchSuccess, RegisterPolicyV3Input, RegisterPolicyV3Receipt, ReplicaAuthorityState, ReplicaCoverage, ReplicaDevice, ReplicaGrantInfo, ReplicaState, ReplicaStatusEntry, ReplicationAuthority, ReplicationControl, ReplicationEvent, ReplicationIdentity, ReplicationOptions, ReplicationPurgeReport, ReplicationReason, ReplicationScheduler, ResolvedCapabilities, ResolvedDelegate, ResolvedReplicationOptions, 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
2
|
import { _ as __authority } from './authority-DDGtccBK.js';
|
|
3
3
|
import { _ as __runtime } from './runtime-B5P5SRpC.js';
|
|
4
|
-
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, p as RuntimePermissionGrantOptions, S as SecretPermissionHint, q as SecretReadInput, r as SecretReadResult, t as SignStrategy, T as TinyCloudNode, u as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, v as UnifiedOwnerRootReceipt, w as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, y as WasmKeyProviderConfig, z as activateCompactRuntimeDelegation, H as createWasmKeyProvider, J as defaultSignStrategy, K as deserializeDelegation, Q as serializeDelegation } from './WasmKeyProvider-
|
|
4
|
+
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, p as RuntimePermissionGrantOptions, S as SecretPermissionHint, q as SecretReadInput, r as SecretReadResult, t as SignStrategy, T as TinyCloudNode, u as TinyCloudNodeConfig, U as UnifiedOwnerRootInput, v as UnifiedOwnerRootReceipt, w as UnsupportedSessionRestoreError, V as ValidatedRuntimeDelegation, W as WasmKeyProvider, y as WasmKeyProviderConfig, z as activateCompactRuntimeDelegation, H as createWasmKeyProvider, J as defaultSignStrategy, K as deserializeDelegation, Q as serializeDelegation } from './WasmKeyProvider-6_YwgSkd.js';
|
|
5
5
|
import '@tinycloud/sdk-services';
|
|
6
6
|
import 'events';
|
|
7
7
|
|
package/dist/core.js
CHANGED
|
@@ -325,6 +325,10 @@ import { createOpenKeyCallbackSigningStrategy } from "@tinycloud/sdk-core";
|
|
|
325
325
|
var defaultSignStrategy = { type: "auto-sign" };
|
|
326
326
|
|
|
327
327
|
// src/authorization/NodeUserAuthorization.ts
|
|
328
|
+
function pkhSpaceIdentity(spaceId) {
|
|
329
|
+
const match = /^(tinycloud:pkh:eip155:\d+:)(0x[0-9a-fA-F]{40})(:.+)$/.exec(spaceId);
|
|
330
|
+
return match === null ? spaceId : `${match[1]}${match[2].toLowerCase()}${match[3]}`;
|
|
331
|
+
}
|
|
328
332
|
var DECRYPT_ACTION = ENCRYPTION.DECRYPT;
|
|
329
333
|
var NETWORK_CREATE_ACTION = ENCRYPTION.NETWORK_CREATE;
|
|
330
334
|
function describeHostFailure(result) {
|
|
@@ -1123,11 +1127,26 @@ var NodeUserAuthorization = class {
|
|
|
1123
1127
|
const jwk = JSON.parse(jwkString);
|
|
1124
1128
|
const now = /* @__PURE__ */ new Date();
|
|
1125
1129
|
const expirationTime = new Date(now.getTime() + this.sessionExpirationMs);
|
|
1126
|
-
const
|
|
1127
|
-
|
|
1128
|
-
)
|
|
1130
|
+
const primaryIdentity = pkhSpaceIdentity(options.spaceId);
|
|
1131
|
+
const resourcesBySpace = /* @__PURE__ */ new Map();
|
|
1132
|
+
for (const resource of options.capabilityRequest.resources) {
|
|
1133
|
+
const resolved = this.resolveSpaceName(resource.space, address, chainId);
|
|
1134
|
+
const identity = pkhSpaceIdentity(resolved);
|
|
1135
|
+
const group = resourcesBySpace.get(identity) ?? {
|
|
1136
|
+
spaceId: identity === primaryIdentity ? options.spaceId : resolved,
|
|
1137
|
+
resources: []
|
|
1138
|
+
};
|
|
1139
|
+
group.resources.push(resource);
|
|
1140
|
+
resourcesBySpace.set(identity, group);
|
|
1141
|
+
}
|
|
1142
|
+
const spaceAbilities = {};
|
|
1143
|
+
for (const { spaceId, resources } of resourcesBySpace.values()) {
|
|
1144
|
+
spaceAbilities[spaceId] = resourceCapabilitiesToAbilitiesMap(resources);
|
|
1145
|
+
}
|
|
1146
|
+
const abilities = spaceAbilities[options.spaceId] ?? resourceCapabilitiesToAbilitiesMap([]);
|
|
1129
1147
|
const prepared = this.wasm.prepareSession({
|
|
1130
1148
|
abilities,
|
|
1149
|
+
spaceAbilities,
|
|
1131
1150
|
...options.rawAbilities !== void 0 ? { rawAbilities: options.rawAbilities } : {},
|
|
1132
1151
|
address,
|
|
1133
1152
|
chainId,
|
|
@@ -3372,6 +3391,32 @@ function authorizationHeader(headers) {
|
|
|
3372
3391
|
}
|
|
3373
3392
|
return value;
|
|
3374
3393
|
}
|
|
3394
|
+
function accountIndexWarningDiagnostic(error) {
|
|
3395
|
+
const diagnostic = {};
|
|
3396
|
+
let current = error;
|
|
3397
|
+
for (let depth = 0; depth < 8 && current !== null && typeof current === "object"; depth += 1) {
|
|
3398
|
+
const record = current;
|
|
3399
|
+
if (diagnostic.status === void 0) {
|
|
3400
|
+
if (typeof record.status === "number" && Number.isFinite(record.status)) {
|
|
3401
|
+
diagnostic.status = record.status;
|
|
3402
|
+
} else if (typeof record.statusCode === "number" && Number.isFinite(record.statusCode)) {
|
|
3403
|
+
diagnostic.status = record.statusCode;
|
|
3404
|
+
} else {
|
|
3405
|
+
const meta = record.meta;
|
|
3406
|
+
if (meta !== null && typeof meta === "object") {
|
|
3407
|
+
const status = meta.status;
|
|
3408
|
+
if (typeof status === "number" && Number.isFinite(status)) diagnostic.status = status;
|
|
3409
|
+
}
|
|
3410
|
+
}
|
|
3411
|
+
}
|
|
3412
|
+
if (diagnostic.code === void 0 && typeof record.code === "string" && /^[A-Z][A-Z0-9_]*$/.test(record.code)) {
|
|
3413
|
+
diagnostic.code = record.code;
|
|
3414
|
+
}
|
|
3415
|
+
if (diagnostic.status !== void 0 && diagnostic.code !== void 0) break;
|
|
3416
|
+
current = record.cause;
|
|
3417
|
+
}
|
|
3418
|
+
return diagnostic;
|
|
3419
|
+
}
|
|
3375
3420
|
var _TinyCloudNode = class _TinyCloudNode {
|
|
3376
3421
|
/**
|
|
3377
3422
|
* Create a new TinyCloudNode instance.
|
|
@@ -3453,7 +3498,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3453
3498
|
const grantedOperation = grant?.operations.find(
|
|
3454
3499
|
(candidate) => this.operationCovers(candidate, operation)
|
|
3455
3500
|
);
|
|
3456
|
-
const invocationSession = !grant || grant.provenance === "primary" ? session : grant.
|
|
3501
|
+
const invocationSession = !grant || grant.provenance === "primary" ? session : this.grantSessionForSpace(grant, session.spaceId);
|
|
3457
3502
|
if ((grantedOperation?.caveats?.length ?? 0) > 0) {
|
|
3458
3503
|
if (!this.wasmBindings.invokeAny) {
|
|
3459
3504
|
throw new Error("WASM binding does not support caveat-preserving invocation");
|
|
@@ -4615,13 +4660,27 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4615
4660
|
jwk: current.jwk
|
|
4616
4661
|
});
|
|
4617
4662
|
const registry = this.createAccountRegistryServices(context, controller.signal);
|
|
4663
|
+
let indexWarningLogged = false;
|
|
4618
4664
|
try {
|
|
4619
4665
|
await this.withAccountRegistryRetry(async () => {
|
|
4620
4666
|
if (controller.signal.aborted) throw controller.signal.reason;
|
|
4621
4667
|
if (this.currentTinyCloudSession() !== session || this.ownStorageFull) return;
|
|
4622
|
-
|
|
4668
|
+
let indexFailure;
|
|
4669
|
+
try {
|
|
4670
|
+
const index = await registry.account.index.ensure();
|
|
4671
|
+
if (!index.ok) indexFailure = index.error;
|
|
4672
|
+
} catch (error) {
|
|
4673
|
+
indexFailure = error;
|
|
4674
|
+
}
|
|
4623
4675
|
if (controller.signal.aborted) throw controller.signal.reason;
|
|
4624
4676
|
if (this.currentTinyCloudSession() !== session || this.ownStorageFull) return;
|
|
4677
|
+
if (indexFailure !== void 0 && !indexWarningLogged) {
|
|
4678
|
+
indexWarningLogged = true;
|
|
4679
|
+
console.warn(
|
|
4680
|
+
"TinyCloud account index initialization failed; continuing registry sync",
|
|
4681
|
+
accountIndexWarningDiagnostic(indexFailure)
|
|
4682
|
+
);
|
|
4683
|
+
}
|
|
4625
4684
|
await this.writeManifestRegistryRecords(registry.account, controller.signal);
|
|
4626
4685
|
if (controller.signal.aborted) throw controller.signal.reason;
|
|
4627
4686
|
if (this.currentTinyCloudSession() !== session || this.ownStorageFull) return;
|
|
@@ -4707,7 +4766,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4707
4766
|
}
|
|
4708
4767
|
const verdict = authorizationVerdictOf(error);
|
|
4709
4768
|
const message = error instanceof Error ? error.message : String(error);
|
|
4710
|
-
const isAuthorizationVerdict = verdict === void 0 ?
|
|
4769
|
+
const isAuthorizationVerdict = verdict === void 0 ? /^(?:Unauthorized Action\b|(?:(?:request failed|HTTP request failed|status(?: code)?|response status)\s*:\s*)?(?:HTTP\s*)?(?:401|403)\b)/i.test(message) : verdict !== "other";
|
|
4711
4770
|
if (isAuthorizationVerdict) {
|
|
4712
4771
|
console.warn(
|
|
4713
4772
|
"TinyCloud account registry sync stopped: authorization verdict is not retryable",
|
|
@@ -8355,7 +8414,18 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
8355
8414
|
if (!grant) {
|
|
8356
8415
|
return fallback;
|
|
8357
8416
|
}
|
|
8358
|
-
return grant.provenance === "primary" ? fallback : grant.
|
|
8417
|
+
return grant.provenance === "primary" ? fallback : this.grantSessionForSpace(grant, fallback.spaceId);
|
|
8418
|
+
}
|
|
8419
|
+
/**
|
|
8420
|
+
* A non-primary grant's session, aimed at `spaceId`. The grant's delegation
|
|
8421
|
+
* may span spaces (the widened default bootstrap session also carries
|
|
8422
|
+
* account-space entries, TC-957); its session's own `spaceId` is the space
|
|
8423
|
+
* it was minted for, so an op on another covered space must keep the grant's
|
|
8424
|
+
* key and proof but target that space. A grant on the target space itself is
|
|
8425
|
+
* returned unchanged, keeping its own spelling of the space id.
|
|
8426
|
+
*/
|
|
8427
|
+
grantSessionForSpace(grant, spaceId) {
|
|
8428
|
+
return this.spaceIdsEqual(grant.session.spaceId, spaceId) ? grant.session : { ...grant.session, spaceId };
|
|
8359
8429
|
}
|
|
8360
8430
|
findGrantForOperations(operations, options) {
|
|
8361
8431
|
if (operations.length === 0) {
|