@tinycloud/node-sdk 3.2.0-beta.3 → 3.2.0-beta.5
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-DjfRu9aL.d.cts → WasmKeyProvider-D2gBxuiY.d.cts} +6 -1
- package/dist/{WasmKeyProvider-DjfRu9aL.d.ts → WasmKeyProvider-D2gBxuiY.d.ts} +6 -1
- package/dist/{authority-mTQEgN56.d.cts → authority-DDGtccBK.d.cts} +5 -6
- package/dist/{authority-mTQEgN56.d.ts → authority-DDGtccBK.d.ts} +5 -6
- package/dist/core.cjs +66 -36
- package/dist/core.cjs.map +1 -1
- package/dist/core.d.cts +3 -3
- package/dist/core.d.ts +3 -3
- package/dist/core.js +68 -37
- package/dist/core.js.map +1 -1
- package/dist/index.cjs +96 -65
- 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 +88 -57
- package/dist/index.js.map +1 -1
- package/dist/replication/authority.cjs +51 -37
- package/dist/replication/authority.cjs.map +1 -1
- package/dist/replication/authority.d.cts +1 -1
- package/dist/replication/authority.d.ts +1 -1
- package/dist/replication/authority.js +48 -36
- package/dist/replication/authority.js.map +1 -1
- package/dist/replication/runtime.cjs +1 -0
- package/dist/replication/runtime.cjs.map +1 -1
- package/dist/replication/runtime.d.cts +1 -1
- package/dist/replication/runtime.d.ts +1 -1
- package/dist/replication/runtime.js +1 -0
- package/dist/replication/runtime.js.map +1 -1
- package/dist/{runtime-DyYwHW8j.d.cts → runtime-B5P5SRpC.d.cts} +1 -0
- package/dist/{runtime-DyYwHW8j.d.ts → runtime-B5P5SRpC.d.ts} +1 -0
- package/package.json +4 -4
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
|
-
import { _ as __authority } from './authority-
|
|
3
|
-
import { _ as __runtime } from './runtime-
|
|
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-
|
|
2
|
+
import { _ as __authority } from './authority-DDGtccBK.cjs';
|
|
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-D2gBxuiY.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
|
-
import { _ as __authority } from './authority-
|
|
3
|
-
import { _ as __runtime } from './runtime-
|
|
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-
|
|
2
|
+
import { _ as __authority } from './authority-DDGtccBK.js';
|
|
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-D2gBxuiY.js';
|
|
5
5
|
import '@tinycloud/sdk-services';
|
|
6
6
|
import 'events';
|
|
7
7
|
|
package/dist/core.js
CHANGED
|
@@ -271,18 +271,17 @@ import {
|
|
|
271
271
|
|
|
272
272
|
// src/replication/authority-sign-in.ts
|
|
273
273
|
import {
|
|
274
|
-
grantPathsForSelector,
|
|
275
274
|
KV,
|
|
276
275
|
isCapabilitySubset
|
|
277
276
|
} from "@tinycloud/sdk-core";
|
|
278
277
|
import { requiresSecretsOptIn } from "@tinycloud/sdk-services";
|
|
278
|
+
import { assertFolderPrefix } from "@tinycloud/sdk-services/kv/replication/prefix";
|
|
279
279
|
var KV_GET = KV.GET;
|
|
280
280
|
var KV_SYNC = KV.SYNC;
|
|
281
281
|
var KV_SERVICE = "tinycloud.kv";
|
|
282
282
|
function hasUnrestrictedGetCoverage(entries, spaceId, prefix) {
|
|
283
|
-
const requiredPaths = grantPathsForSelector(prefix);
|
|
284
283
|
return isCapabilitySubset(
|
|
285
|
-
|
|
284
|
+
[{ service: KV_SERVICE, space: spaceId, path: prefix, actions: [KV_GET] }],
|
|
286
285
|
[...entries]
|
|
287
286
|
).subset;
|
|
288
287
|
}
|
|
@@ -290,21 +289,33 @@ function augmentSignInEntriesWithReplication(input) {
|
|
|
290
289
|
const out = [];
|
|
291
290
|
const replication = input.replication;
|
|
292
291
|
if (replication === void 0) return out;
|
|
292
|
+
const eligiblePaths = [];
|
|
293
293
|
for (const prefix of replication.prefixes) {
|
|
294
|
+
assertFolderPrefix(prefix);
|
|
295
|
+
const path = prefix === "/" ? "" : prefix;
|
|
294
296
|
if (requiresSecretsOptIn(input.primarySpaceId, prefix) && replication.allowSecrets !== true) {
|
|
295
297
|
continue;
|
|
296
298
|
}
|
|
297
|
-
if (!hasUnrestrictedGetCoverage(input.entries, input.primarySpaceId,
|
|
299
|
+
if (!hasUnrestrictedGetCoverage(input.entries, input.primarySpaceId, path)) {
|
|
298
300
|
continue;
|
|
299
301
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
302
|
+
eligiblePaths.push(path);
|
|
303
|
+
}
|
|
304
|
+
if (eligiblePaths.length === replication.prefixes.length && eligiblePaths.length > 0 && hasUnrestrictedGetCoverage(input.entries, input.primarySpaceId, "")) {
|
|
305
|
+
return [{
|
|
306
|
+
service: KV_SERVICE,
|
|
307
|
+
space: input.primarySpaceId,
|
|
308
|
+
path: "",
|
|
309
|
+
actions: [KV_GET, KV_SYNC]
|
|
310
|
+
}];
|
|
311
|
+
}
|
|
312
|
+
for (const path of eligiblePaths) {
|
|
313
|
+
out.push({
|
|
314
|
+
service: KV_SERVICE,
|
|
315
|
+
space: input.primarySpaceId,
|
|
316
|
+
path,
|
|
317
|
+
actions: [KV_GET, KV_SYNC]
|
|
318
|
+
});
|
|
308
319
|
}
|
|
309
320
|
return out;
|
|
310
321
|
}
|
|
@@ -373,6 +384,7 @@ var NodeUserAuthorization = class {
|
|
|
373
384
|
this.activeSessionKeyId = "default";
|
|
374
385
|
this.extensions = [];
|
|
375
386
|
this._nodeFeatures = [];
|
|
387
|
+
this._nodeFeaturesKnown = false;
|
|
376
388
|
this._lastActivationSkippedSpaceIds = [];
|
|
377
389
|
this.wasm = config.wasmBindings;
|
|
378
390
|
this.signer = config.signer;
|
|
@@ -496,8 +508,11 @@ var NodeUserAuthorization = class {
|
|
|
496
508
|
}
|
|
497
509
|
}
|
|
498
510
|
/** @internal Atomically adopt the state staged by TinyCloudNode.restoreSession. */
|
|
499
|
-
installRestoredSession(sessionManager, session, hosts) {
|
|
511
|
+
installRestoredSession(sessionManager, session, hosts, nodeFeatures) {
|
|
500
512
|
this.sessionManager = sessionManager;
|
|
513
|
+
this._nodeFeatures = nodeFeatures === void 0 ? [] : [...nodeFeatures];
|
|
514
|
+
this._nodeFeaturesKnown = nodeFeatures !== void 0;
|
|
515
|
+
this._nodeInfoIdentity = void 0;
|
|
501
516
|
this.tinycloudHosts = hosts && hosts.length > 0 ? [...hosts] : void 0;
|
|
502
517
|
this._lastActivationSkippedSpaceIds = [];
|
|
503
518
|
if (!session) {
|
|
@@ -572,6 +587,16 @@ var NodeUserAuthorization = class {
|
|
|
572
587
|
get nodeFeatures() {
|
|
573
588
|
return this._nodeFeatures;
|
|
574
589
|
}
|
|
590
|
+
get nodeFeaturesKnown() {
|
|
591
|
+
return this._nodeFeaturesKnown;
|
|
592
|
+
}
|
|
593
|
+
async refreshNodeInfo() {
|
|
594
|
+
const infoHost = this.primaryTinyCloudHost;
|
|
595
|
+
const nodeInfo = await checkNodeInfo(infoHost, this.wasm.protocolVersion());
|
|
596
|
+
this._nodeFeatures = nodeInfo.features;
|
|
597
|
+
this._nodeFeaturesKnown = true;
|
|
598
|
+
this._nodeInfoIdentity = nodeInfo.nodeId ? { host: infoHost, nodeId: nodeInfo.nodeId } : void 0;
|
|
599
|
+
}
|
|
575
600
|
/**
|
|
576
601
|
* The node DID reported by `GET /info` for `host`, if the sign-in (or
|
|
577
602
|
* restore) that populated it targeted that same host. Returns `undefined`
|
|
@@ -1235,13 +1260,7 @@ var NodeUserAuthorization = class {
|
|
|
1235
1260
|
this._tinyCloudSession = tinyCloudSession;
|
|
1236
1261
|
this._address = address;
|
|
1237
1262
|
this._chainId = chainId;
|
|
1238
|
-
|
|
1239
|
-
const nodeInfo = await checkNodeInfo(
|
|
1240
|
-
infoHost,
|
|
1241
|
-
this.wasm.protocolVersion()
|
|
1242
|
-
);
|
|
1243
|
-
this._nodeFeatures = nodeInfo.features;
|
|
1244
|
-
this._nodeInfoIdentity = nodeInfo.nodeId ? { host: infoHost, nodeId: nodeInfo.nodeId } : void 0;
|
|
1263
|
+
await this.refreshNodeInfo();
|
|
1245
1264
|
for (const ext of this.extensions) {
|
|
1246
1265
|
if (ext.afterSignIn) {
|
|
1247
1266
|
await ext.afterSignIn(clientSession);
|
|
@@ -1407,13 +1426,7 @@ var NodeUserAuthorization = class {
|
|
|
1407
1426
|
this._tinyCloudSession = tinyCloudSession;
|
|
1408
1427
|
this._address = address;
|
|
1409
1428
|
this._chainId = chainId;
|
|
1410
|
-
|
|
1411
|
-
const nodeInfo = await checkNodeInfo(
|
|
1412
|
-
infoHost,
|
|
1413
|
-
this.wasm.protocolVersion()
|
|
1414
|
-
);
|
|
1415
|
-
this._nodeFeatures = nodeInfo.features;
|
|
1416
|
-
this._nodeInfoIdentity = nodeInfo.nodeId ? { host: infoHost, nodeId: nodeInfo.nodeId } : void 0;
|
|
1429
|
+
await this.refreshNodeInfo();
|
|
1417
1430
|
for (const ext of this.extensions) {
|
|
1418
1431
|
if (ext.afterSignIn) {
|
|
1419
1432
|
await ext.afterSignIn(clientSession);
|
|
@@ -2370,7 +2383,7 @@ function deserializeDelegation(data) {
|
|
|
2370
2383
|
}
|
|
2371
2384
|
|
|
2372
2385
|
// src/replication/config.ts
|
|
2373
|
-
import { kvPrefixCovers } from "@tinycloud/sdk-services";
|
|
2386
|
+
import { assertFolderPrefix as assertPureFolderPrefix, kvPrefixCovers } from "@tinycloud/sdk-services/kv/replication/prefix";
|
|
2374
2387
|
function assertValidReplicationConfig(replication) {
|
|
2375
2388
|
if (replication === void 0 || replication.enabled !== true) return;
|
|
2376
2389
|
if (replication.storage === void 0 || replication.storage === null) {
|
|
@@ -2380,8 +2393,10 @@ function assertValidReplicationConfig(replication) {
|
|
|
2380
2393
|
throw new TypeError("replication.prefixes must be a non-empty array");
|
|
2381
2394
|
}
|
|
2382
2395
|
for (const prefix of replication.prefixes) {
|
|
2383
|
-
|
|
2384
|
-
|
|
2396
|
+
try {
|
|
2397
|
+
assertPureFolderPrefix(prefix);
|
|
2398
|
+
} catch (error) {
|
|
2399
|
+
throw new TypeError(error instanceof Error ? error.message : String(error));
|
|
2385
2400
|
}
|
|
2386
2401
|
}
|
|
2387
2402
|
for (const [index, prefix] of replication.prefixes.entries()) {
|
|
@@ -2392,7 +2407,7 @@ function assertValidReplicationConfig(replication) {
|
|
|
2392
2407
|
);
|
|
2393
2408
|
}
|
|
2394
2409
|
}
|
|
2395
|
-
if (prefix.split("/", 1)[0] === "vault" && replication.allowSecrets !== true) {
|
|
2410
|
+
if ((prefix === "/" || prefix.split("/", 1)[0] === "vault") && replication.allowSecrets !== true) {
|
|
2396
2411
|
throw new TypeError(
|
|
2397
2412
|
`replication prefix ${JSON.stringify(prefix)} overlaps the vault namespace; pass allowSecrets to opt in`
|
|
2398
2413
|
);
|
|
@@ -2403,6 +2418,8 @@ function assertValidReplicationConfig(replication) {
|
|
|
2403
2418
|
// src/TinyCloudNode.ts
|
|
2404
2419
|
import {
|
|
2405
2420
|
TinyCloud,
|
|
2421
|
+
checkNodeInfo as checkNodeInfo2,
|
|
2422
|
+
VersionCheckError,
|
|
2406
2423
|
activateSessionWithHost as activateSessionWithHost2,
|
|
2407
2424
|
authorizationVerdictOf,
|
|
2408
2425
|
httpResponseError,
|
|
@@ -3584,7 +3601,11 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
3584
3601
|
return this._bootstrapStatus;
|
|
3585
3602
|
}
|
|
3586
3603
|
get nodeFeatures() {
|
|
3587
|
-
return this.auth?.nodeFeatures ?? [];
|
|
3604
|
+
return this.auth?.nodeFeatures ?? this._restoredNodeFeatures ?? [];
|
|
3605
|
+
}
|
|
3606
|
+
get replicationNodeFeatures() {
|
|
3607
|
+
if (this.auth) return this.auth.nodeFeaturesKnown ? this.auth.nodeFeatures : void 0;
|
|
3608
|
+
return this._restoredNodeFeatures;
|
|
3588
3609
|
}
|
|
3589
3610
|
/** SIWE domain — uses config override or defaults to app.tinycloud.xyz */
|
|
3590
3611
|
get siweDomain() {
|
|
@@ -4937,6 +4958,14 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
4937
4958
|
sessionData.chainId
|
|
4938
4959
|
);
|
|
4939
4960
|
const stagedHost = resolvedHost ?? this.config.host;
|
|
4961
|
+
let restoredNodeFeatures;
|
|
4962
|
+
if (this.config.replication?.enabled) {
|
|
4963
|
+
try {
|
|
4964
|
+
restoredNodeFeatures = (await checkNodeInfo2(stagedHost, this.wasmBindings.protocolVersion())).features;
|
|
4965
|
+
} catch (error) {
|
|
4966
|
+
if (!(error instanceof VersionCheckError)) throw error;
|
|
4967
|
+
}
|
|
4968
|
+
}
|
|
4940
4969
|
const stagedAddress = restoredAddress;
|
|
4941
4970
|
const stagedChainId = sessionData.chainId ?? 1;
|
|
4942
4971
|
let replicationPrincipal;
|
|
@@ -5039,8 +5068,9 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
5039
5068
|
this._recapOperationsCache = stagedPrimary.cache;
|
|
5040
5069
|
this.runtimePermissionGrants = stagedPrimary.grants;
|
|
5041
5070
|
this.confirmedHostedSpaceIds.clear();
|
|
5071
|
+
this._restoredNodeFeatures = restoredNodeFeatures;
|
|
5042
5072
|
if (this.auth) {
|
|
5043
|
-
this.auth.installRestoredSession(stagedManager, stagedTcSession, [stagedHost]);
|
|
5073
|
+
this.auth.installRestoredSession(stagedManager, stagedTcSession, [stagedHost], restoredNodeFeatures);
|
|
5044
5074
|
this._restoredTcSession = void 0;
|
|
5045
5075
|
} else {
|
|
5046
5076
|
this._restoredTcSession = stagedTcSession;
|
|
@@ -7614,6 +7644,7 @@ var _TinyCloudNode = class _TinyCloudNode {
|
|
|
7614
7644
|
session,
|
|
7615
7645
|
principal: identityPrincipal,
|
|
7616
7646
|
authority,
|
|
7647
|
+
nodeFeatures: this.replicationNodeFeatures,
|
|
7617
7648
|
primaryKV: [{ space: session.spaceId, kv }]
|
|
7618
7649
|
});
|
|
7619
7650
|
}
|
|
@@ -8804,9 +8835,9 @@ import {
|
|
|
8804
8835
|
} from "@tinycloud/sdk-core";
|
|
8805
8836
|
import {
|
|
8806
8837
|
ProtocolMismatchError,
|
|
8807
|
-
VersionCheckError,
|
|
8838
|
+
VersionCheckError as VersionCheckError2,
|
|
8808
8839
|
UnsupportedFeatureError as UnsupportedFeatureError2,
|
|
8809
|
-
checkNodeInfo as
|
|
8840
|
+
checkNodeInfo as checkNodeInfo3
|
|
8810
8841
|
} from "@tinycloud/sdk-core";
|
|
8811
8842
|
import { ServiceContext as ServiceContext3 } from "@tinycloud/sdk-core";
|
|
8812
8843
|
export {
|
|
@@ -8857,7 +8888,7 @@ export {
|
|
|
8857
8888
|
VAULT_PERMISSION_SERVICE,
|
|
8858
8889
|
VaultHeaders,
|
|
8859
8890
|
VaultPublicSpaceKVActions,
|
|
8860
|
-
VersionCheckError,
|
|
8891
|
+
VersionCheckError2 as VersionCheckError,
|
|
8861
8892
|
WasmKeyProvider,
|
|
8862
8893
|
activateCompactRuntimeDelegation,
|
|
8863
8894
|
addressStorageKey,
|
|
@@ -8867,7 +8898,7 @@ export {
|
|
|
8867
8898
|
canonicalizeDidUrl,
|
|
8868
8899
|
canonicalizeNetworkId,
|
|
8869
8900
|
canonicalizeSecretScope,
|
|
8870
|
-
|
|
8901
|
+
checkNodeInfo3 as checkNodeInfo,
|
|
8871
8902
|
clearTinyCloudDebugLogs,
|
|
8872
8903
|
composeManifestRequest2 as composeManifestRequest,
|
|
8873
8904
|
createCapabilityKeyRegistry,
|