@tinycloud/sdk-services 3.7.0 → 3.8.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/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/kv/index.d.cts +2 -2
- package/dist/kv/index.d.ts +2 -2
- package/dist/kv/replication/index.cjs.map +1 -1
- package/dist/kv/replication/index.d.cts +2 -2
- package/dist/kv/replication/index.d.ts +2 -2
- package/dist/{scope-44m8GKdi.d.cts → scope-D7bzmU6F.d.cts} +72 -2
- package/dist/{scope-CAJbG-yz.d.ts → scope-_HAUxOPl.d.ts} +72 -2
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { K as KVReplicationDeps, a as KVReplicationController, R as ReplicationIdentity, P as PendingWriteStore } from '../../scope-
|
|
2
|
-
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, b as KVListPage, c as KVReadThrough, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, m as PinnedKey, n as ProfileReplicaApprovalEntry, o as ProfileReplicaDeferredDenyOutcome, p as ProfileReplicaDeferredToken, q as ProfileReplicaLogoutPending, r as ProfileReplicaPreflight, s as ProfileReplicaPurge, t as ProfileReplicaRemoteLogoutState, u as ProfileReplicaRootIdentity, v as ProfileReplicaUnknownEntry, w as PurgeTarget, x as ReplicaAccountGate, y as ReplicaAdmitHook, z as ReplicaAuthorityState, B as ReplicaBrowserGateAccess, D as ReplicaBrowserGateSnapshot, E as ReplicaBrowserGateTx, F as ReplicaBrowserPageAdmission, G as ReplicaClock, H as ReplicaCoverage, I as ReplicaDeliveryDecision, J as ReplicaDenyInput, M as ReplicaDenyOutcome, N as ReplicaDevice, O as ReplicaEraseReport, Q as ReplicaGateAccess, S as ReplicaGateReason, T as ReplicaGateScope, U as ReplicaGateSnapshot, V as ReplicaGateTx, W as ReplicaGatedError, X as ReplicaGatedHandle, Y as ReplicaGatedSpec, Z as ReplicaGatedStorage, _ as ReplicaGrantInfo, $ as ReplicaGuardedStore, a0 as ReplicaInspectedStatus, a1 as ReplicaLifecycleGate, a2 as
|
|
1
|
+
import { K as KVReplicationDeps, a as KVReplicationController, R as ReplicationIdentity, P as PendingWriteStore } from '../../scope-D7bzmU6F.cjs';
|
|
2
|
+
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, b as KVListPage, c as KVReadThrough, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, m as PinnedKey, n as ProfileReplicaApprovalEntry, o as ProfileReplicaDeferredDenyOutcome, p as ProfileReplicaDeferredToken, q as ProfileReplicaLogoutPending, r as ProfileReplicaPreflight, s as ProfileReplicaPurge, t as ProfileReplicaRemoteLogoutState, u as ProfileReplicaRootIdentity, v as ProfileReplicaUnknownEntry, w as PurgeTarget, x as ReplicaAccountGate, y as ReplicaAdmitHook, z as ReplicaAuthorityState, B as ReplicaBrowserGateAccess, D as ReplicaBrowserGateSnapshot, E as ReplicaBrowserGateTx, F as ReplicaBrowserPageAdmission, G as ReplicaClock, H as ReplicaCoverage, I as ReplicaDeliveryDecision, J as ReplicaDenyInput, M as ReplicaDenyOutcome, N as ReplicaDevice, O as ReplicaEraseReport, Q as ReplicaGateAccess, S as ReplicaGateReason, T as ReplicaGateScope, U as ReplicaGateSnapshot, V as ReplicaGateTx, W as ReplicaGatedError, X as ReplicaGatedHandle, Y as ReplicaGatedSpec, Z as ReplicaGatedStorage, _ as ReplicaGrantInfo, $ as ReplicaGuardedStore, a0 as ReplicaInspectedStatus, a1 as ReplicaLifecycleGate, a2 as ReplicaLocalEraseOutcome, a3 as ReplicaPageAdmission, a4 as ReplicaPartitionEraser, a5 as ReplicaPartitionIndexEntry, a6 as ReplicaPeerCommit, a7 as ReplicaPrivateGateHash, a8 as ReplicaPurgeError, a9 as ReplicaPurgeFailedEvent, aa as ReplicaPurgeIntent, ab as ReplicaPurgeLocalCopyResult, ac as ReplicaPurgeTrigger, ad as ReplicaQuotaLedger, ae as ReplicaQuotaSpec, af as ReplicaSessionStamp, ag as ReplicaStampedReply, ah as ReplicaState, ai as ReplicaStatusEntry, aj as ReplicationAuthority, ak as ReplicationControl, al as ReplicationEvent, am as ReplicationOptions, an as ReplicationPurgeReport, ao as ReplicationReason, ap as ReplicationScheduler, aq as ResolvedReplicationOptions, ar as SaltedHash, as as canonicalReplicationIdentity, at as replicationIdentityKey, au as requiresSecretsOptIn } from '../../scope-D7bzmU6F.cjs';
|
|
3
3
|
export { ClampConsentAnchor, ConsentDeadlineMs, EffectiveGrantExpiry, EffectiveGrantExpiryInput, MintRemainingMs, NeedsSilentRenewal, ReplicaConsentAnchor, ReplicaConsentSource, ReplicaGrantPolicy } from './grantPolicyTypes.cjs';
|
|
4
4
|
export { kvPrefixCovers } from './prefix.cjs';
|
|
5
5
|
import '../../types-DAOyIbXu.cjs';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { K as KVReplicationDeps, a as KVReplicationController, R as ReplicationIdentity, P as PendingWriteStore } from '../../scope-
|
|
2
|
-
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, b as KVListPage, c as KVReadThrough, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, m as PinnedKey, n as ProfileReplicaApprovalEntry, o as ProfileReplicaDeferredDenyOutcome, p as ProfileReplicaDeferredToken, q as ProfileReplicaLogoutPending, r as ProfileReplicaPreflight, s as ProfileReplicaPurge, t as ProfileReplicaRemoteLogoutState, u as ProfileReplicaRootIdentity, v as ProfileReplicaUnknownEntry, w as PurgeTarget, x as ReplicaAccountGate, y as ReplicaAdmitHook, z as ReplicaAuthorityState, B as ReplicaBrowserGateAccess, D as ReplicaBrowserGateSnapshot, E as ReplicaBrowserGateTx, F as ReplicaBrowserPageAdmission, G as ReplicaClock, H as ReplicaCoverage, I as ReplicaDeliveryDecision, J as ReplicaDenyInput, M as ReplicaDenyOutcome, N as ReplicaDevice, O as ReplicaEraseReport, Q as ReplicaGateAccess, S as ReplicaGateReason, T as ReplicaGateScope, U as ReplicaGateSnapshot, V as ReplicaGateTx, W as ReplicaGatedError, X as ReplicaGatedHandle, Y as ReplicaGatedSpec, Z as ReplicaGatedStorage, _ as ReplicaGrantInfo, $ as ReplicaGuardedStore, a0 as ReplicaInspectedStatus, a1 as ReplicaLifecycleGate, a2 as
|
|
1
|
+
import { K as KVReplicationDeps, a as KVReplicationController, R as ReplicationIdentity, P as PendingWriteStore } from '../../scope-_HAUxOPl.js';
|
|
2
|
+
export { A as AuthorityRefusal, C as CLEAR_PENDING_WARNING, b as KVListPage, c as KVReadThrough, d as KVReplicaHandle, e as KVReplicaSpec, f as KVReplicaStorage, L as LocalGetResult, g as LocalListResult, h as LocalReadMeta, i as LocalReplicaStatus, j as LocalSyncResult, k as PendingWriteRecord, l as PendingWriteState, m as PinnedKey, n as ProfileReplicaApprovalEntry, o as ProfileReplicaDeferredDenyOutcome, p as ProfileReplicaDeferredToken, q as ProfileReplicaLogoutPending, r as ProfileReplicaPreflight, s as ProfileReplicaPurge, t as ProfileReplicaRemoteLogoutState, u as ProfileReplicaRootIdentity, v as ProfileReplicaUnknownEntry, w as PurgeTarget, x as ReplicaAccountGate, y as ReplicaAdmitHook, z as ReplicaAuthorityState, B as ReplicaBrowserGateAccess, D as ReplicaBrowserGateSnapshot, E as ReplicaBrowserGateTx, F as ReplicaBrowserPageAdmission, G as ReplicaClock, H as ReplicaCoverage, I as ReplicaDeliveryDecision, J as ReplicaDenyInput, M as ReplicaDenyOutcome, N as ReplicaDevice, O as ReplicaEraseReport, Q as ReplicaGateAccess, S as ReplicaGateReason, T as ReplicaGateScope, U as ReplicaGateSnapshot, V as ReplicaGateTx, W as ReplicaGatedError, X as ReplicaGatedHandle, Y as ReplicaGatedSpec, Z as ReplicaGatedStorage, _ as ReplicaGrantInfo, $ as ReplicaGuardedStore, a0 as ReplicaInspectedStatus, a1 as ReplicaLifecycleGate, a2 as ReplicaLocalEraseOutcome, a3 as ReplicaPageAdmission, a4 as ReplicaPartitionEraser, a5 as ReplicaPartitionIndexEntry, a6 as ReplicaPeerCommit, a7 as ReplicaPrivateGateHash, a8 as ReplicaPurgeError, a9 as ReplicaPurgeFailedEvent, aa as ReplicaPurgeIntent, ab as ReplicaPurgeLocalCopyResult, ac as ReplicaPurgeTrigger, ad as ReplicaQuotaLedger, ae as ReplicaQuotaSpec, af as ReplicaSessionStamp, ag as ReplicaStampedReply, ah as ReplicaState, ai as ReplicaStatusEntry, aj as ReplicationAuthority, ak as ReplicationControl, al as ReplicationEvent, am as ReplicationOptions, an as ReplicationPurgeReport, ao as ReplicationReason, ap as ReplicationScheduler, aq as ResolvedReplicationOptions, ar as SaltedHash, as as canonicalReplicationIdentity, at as replicationIdentityKey, au as requiresSecretsOptIn } from '../../scope-_HAUxOPl.js';
|
|
3
3
|
export { ClampConsentAnchor, ConsentDeadlineMs, EffectiveGrantExpiry, EffectiveGrantExpiryInput, MintRemainingMs, NeedsSilentRenewal, ReplicaConsentAnchor, ReplicaConsentSource, ReplicaGrantPolicy } from './grantPolicyTypes.js';
|
|
4
4
|
export { kvPrefixCovers } from './prefix.js';
|
|
5
5
|
import '../../types-DAOyIbXu.js';
|
|
@@ -591,7 +591,9 @@ type ReplicaGateReason =
|
|
|
591
591
|
/** Browser only: the `localStorage` logout marker is set. */
|
|
592
592
|
| "logout_pending"
|
|
593
593
|
/** The gate store itself could not be read; fail closed. */
|
|
594
|
-
| "gate_unavailable"
|
|
594
|
+
| "gate_unavailable"
|
|
595
|
+
/** Browser: replication is configured but no wallet provider can prove the connected account. */
|
|
596
|
+
| "wallet_provider_required";
|
|
595
597
|
/** Shape of every gate refusal error: `Error & { code: "REPLICA_GATED"; gate }`. */
|
|
596
598
|
interface ReplicaGatedError extends Error {
|
|
597
599
|
code: "REPLICA_GATED";
|
|
@@ -877,6 +879,63 @@ interface ReplicaLifecycleGate {
|
|
|
877
879
|
}): Promise<ReplicaEraseReport>;
|
|
878
880
|
/** Outstanding intents; non-empty means status `purgePending: true`. */
|
|
879
881
|
pendingPurge(): Promise<ReplicaPurgeIntent[]>;
|
|
882
|
+
/**
|
|
883
|
+
* Browser only. Under the gate lock, erases pending intents and deletes the whole origin
|
|
884
|
+
* database. Deletes only when nothing live is at stake: the gate is denied (null principal),
|
|
885
|
+
* the gate is behind the persisted deny tombstone, or the logout marker is set with a tombstone.
|
|
886
|
+
* A live or other-account gate is `refused` and left untouched. On a failed delete it sets the
|
|
887
|
+
* logout marker (when a tombstone exists) so `recover` finishes the erase on the next load.
|
|
888
|
+
* Never clears the deny tombstone.
|
|
889
|
+
*/
|
|
890
|
+
eraseLocalCopy?(o: {
|
|
891
|
+
signal: AbortSignal;
|
|
892
|
+
}): Promise<ReplicaLocalEraseOutcome>;
|
|
893
|
+
}
|
|
894
|
+
/** Result of {@link ReplicaLifecycleGate.eraseLocalCopy}. */
|
|
895
|
+
type ReplicaLocalEraseOutcome =
|
|
896
|
+
/** The database is gone and the logout marker (if any) is cleared. */
|
|
897
|
+
{
|
|
898
|
+
status: "erased";
|
|
899
|
+
}
|
|
900
|
+
/** Delete blocked or storage error; a retry can succeed. `marker` is true when the next-load marker is set. */
|
|
901
|
+
| {
|
|
902
|
+
status: "failed";
|
|
903
|
+
code: string;
|
|
904
|
+
marker: boolean;
|
|
905
|
+
}
|
|
906
|
+
/** The gate does not authorize destruction; nothing was deleted. A retry cannot succeed until the gate is denied. */
|
|
907
|
+
| {
|
|
908
|
+
status: "refused";
|
|
909
|
+
code: string;
|
|
910
|
+
};
|
|
911
|
+
/** What triggered a local-copy erase. */
|
|
912
|
+
type ReplicaPurgeTrigger = "sign_out" | "account_switch" | "purge_local_copy";
|
|
913
|
+
/** Result of `replication.purgeLocalCopy()`. `retryNow` means a short bounded retry is meaningful. */
|
|
914
|
+
type ReplicaPurgeLocalCopyResult = {
|
|
915
|
+
ok: true;
|
|
916
|
+
} | {
|
|
917
|
+
ok: false;
|
|
918
|
+
retryNow: boolean;
|
|
919
|
+
};
|
|
920
|
+
/**
|
|
921
|
+
* Emitted (`on("replica.purge.failed", …)`) when the local copy could not be erased after the
|
|
922
|
+
* bounded retries. The SDK finishes the erase on the next load through the logout marker.
|
|
923
|
+
*/
|
|
924
|
+
interface ReplicaPurgeFailedEvent {
|
|
925
|
+
type: "replica.purge.failed";
|
|
926
|
+
trigger: ReplicaPurgeTrigger;
|
|
927
|
+
/** Typed reason: `logout_pending` (marker set, erase retried on next load) or `gate_unavailable`. */
|
|
928
|
+
reason: ReplicaGateReason;
|
|
929
|
+
/** Storage error code of the last attempt. */
|
|
930
|
+
code: string;
|
|
931
|
+
/** True when a short bounded retry is meaningful (delete blocked or storage error). */
|
|
932
|
+
retryNow: boolean;
|
|
933
|
+
}
|
|
934
|
+
/** Rejection of `signOut()` when the deny itself was `unguarded` and the erase did not complete. */
|
|
935
|
+
interface ReplicaPurgeError extends Error {
|
|
936
|
+
code: "REPLICA_PURGE_FAILED";
|
|
937
|
+
reason: ReplicaGateReason;
|
|
938
|
+
retryNow: boolean;
|
|
880
939
|
}
|
|
881
940
|
/** Node/CLI profile-local fencing token, not a secret capability; the profile lock remains authoritative. */
|
|
882
941
|
interface ProfileReplicaDeferredToken {
|
|
@@ -1764,6 +1823,15 @@ interface ReplicationControl {
|
|
|
1764
1823
|
* and committed records remain. Exposed callers MUST show CLEAR_PENDING_WARNING first.
|
|
1765
1824
|
*/
|
|
1766
1825
|
clearPending(): Promise<number>;
|
|
1826
|
+
/**
|
|
1827
|
+
* Browser: erases the whole local copy (the IndexedDB database) once the account has been
|
|
1828
|
+
* denied by sign-out or account switch; `signOut()` and account switch already do this. Retries
|
|
1829
|
+
* a few times when the delete is blocked. `{ ok: false, retryNow: true }`: the copy is still
|
|
1830
|
+
* there and a short bounded retry is meaningful (the deny outcome kept the keys, or the delete
|
|
1831
|
+
* is blocked); the SDK also finishes the erase on the next load. `retryNow: false`: nothing is
|
|
1832
|
+
* erasable now (a session is live, or the storage has no browser database). Never rejects.
|
|
1833
|
+
*/
|
|
1834
|
+
purgeLocalCopy(): Promise<ReplicaPurgeLocalCopyResult>;
|
|
1767
1835
|
close(): Promise<void>;
|
|
1768
1836
|
}
|
|
1769
1837
|
interface ReplicationOptions {
|
|
@@ -1772,6 +1840,8 @@ interface ReplicationOptions {
|
|
|
1772
1840
|
prefixes: string[];
|
|
1773
1841
|
/** Required for prefixes/spaces where requiresSecretsOptIn returns true. */
|
|
1774
1842
|
allowSecrets?: boolean;
|
|
1843
|
+
/** Sign-in asks for kv/sync on each declared prefix only and never widens to a root entry that covers them. */
|
|
1844
|
+
syncScope?: "prefixes";
|
|
1775
1845
|
/** Background interval; default 60 seconds. */
|
|
1776
1846
|
syncIntervalMs?: number;
|
|
1777
1847
|
maxStalenessMs?: number;
|
|
@@ -1970,4 +2040,4 @@ declare function replicationIdentityKey(id: ReplicationIdentity): string;
|
|
|
1970
2040
|
/** Whether replicating this space/prefix can copy encrypted secret material to disk. */
|
|
1971
2041
|
declare function requiresSecretsOptIn(space: string, prefix: string): boolean;
|
|
1972
2042
|
|
|
1973
|
-
export { type ReplicaGuardedStore as $, type AuthorityRefusal as A, type ReplicaBrowserGateAccess as B, CLEAR_PENDING_WARNING as C, type ReplicaBrowserGateSnapshot as D, type ReplicaBrowserGateTx as E, type ReplicaBrowserPageAdmission as F, type ReplicaClock as G, type ReplicaCoverage as H, type ReplicaDeliveryDecision as I, type ReplicaDenyInput as J, type KVReplicationDeps as K, type LocalGetResult as L, type ReplicaDenyOutcome as M, type ReplicaDevice as N, type ReplicaEraseReport as O, type PendingWriteStore as P, type ReplicaGateAccess as Q, type ReplicationIdentity as R, type ReplicaGateReason as S, type ReplicaGateScope as T, type ReplicaGateSnapshot as U, type ReplicaGateTx as V, type ReplicaGatedError as W, type ReplicaGatedHandle as X, type ReplicaGatedSpec as Y, type ReplicaGatedStorage as Z, type ReplicaGrantInfo as _, type KVReplicationController as a, type ReplicaInspectedStatus as a0, type ReplicaLifecycleGate as a1, type
|
|
2043
|
+
export { type ReplicaGuardedStore as $, type AuthorityRefusal as A, type ReplicaBrowserGateAccess as B, CLEAR_PENDING_WARNING as C, type ReplicaBrowserGateSnapshot as D, type ReplicaBrowserGateTx as E, type ReplicaBrowserPageAdmission as F, type ReplicaClock as G, type ReplicaCoverage as H, type ReplicaDeliveryDecision as I, type ReplicaDenyInput as J, type KVReplicationDeps as K, type LocalGetResult as L, type ReplicaDenyOutcome as M, type ReplicaDevice as N, type ReplicaEraseReport as O, type PendingWriteStore as P, type ReplicaGateAccess as Q, type ReplicationIdentity as R, type ReplicaGateReason as S, type ReplicaGateScope as T, type ReplicaGateSnapshot as U, type ReplicaGateTx as V, type ReplicaGatedError as W, type ReplicaGatedHandle as X, type ReplicaGatedSpec as Y, type ReplicaGatedStorage as Z, type ReplicaGrantInfo as _, type KVReplicationController as a, type ReplicaInspectedStatus as a0, type ReplicaLifecycleGate as a1, type ReplicaLocalEraseOutcome as a2, type ReplicaPageAdmission as a3, type ReplicaPartitionEraser as a4, type ReplicaPartitionIndexEntry as a5, type ReplicaPeerCommit as a6, type ReplicaPrivateGateHash as a7, type ReplicaPurgeError as a8, type ReplicaPurgeFailedEvent as a9, type KVBatchPutResponse as aA, type KVBatchReadResponse as aB, type KVChange as aC, type KVChangesAuthority as aD, type KVChangesOptions as aE, type KVChangesResponse as aF, type KVCreateSignedReadUrlOptions as aG, type KVDeleteOptions as aH, type KVGetOptions as aI, type KVHeadOptions as aJ, type KVListOptions as aK, type KVListResponse as aL, type KVPutOptions as aM, type KVResponse as aN, type KVResponseHeaders as aO, type KVServiceConfig as aP, type KVSignedReadUrlResponse as aQ, type ReplicaPurgeIntent as aa, type ReplicaPurgeLocalCopyResult as ab, type ReplicaPurgeTrigger as ac, type ReplicaQuotaLedger as ad, type ReplicaQuotaSpec as ae, type ReplicaSessionStamp as af, type ReplicaStampedReply as ag, type ReplicaState as ah, type ReplicaStatusEntry as ai, type ReplicationAuthority as aj, type ReplicationControl as ak, type ReplicationEvent as al, type ReplicationOptions as am, type ReplicationPurgeReport as an, type ReplicationReason as ao, type ReplicationScheduler as ap, type ResolvedReplicationOptions as aq, type SaltedHash as ar, canonicalReplicationIdentity as as, replicationIdentityKey as at, requiresSecretsOptIn as au, DEFAULT_SIGNED_READ_URL_EXPIRY_MS as av, KVAction as aw, type KVActionType as ax, type KVBatchPutItem as ay, type KVBatchPutOptions as az, type KVListPage as b, type KVReadThrough as c, type KVReplicaHandle as d, type KVReplicaSpec as e, type KVReplicaStorage as f, type LocalListResult as g, type LocalReadMeta as h, type LocalReplicaStatus as i, type LocalSyncResult as j, type PendingWriteRecord as k, type PendingWriteState as l, type PinnedKey as m, type ProfileReplicaApprovalEntry as n, type ProfileReplicaDeferredDenyOutcome as o, type ProfileReplicaDeferredToken as p, type ProfileReplicaLogoutPending as q, type ProfileReplicaPreflight as r, type ProfileReplicaPurge as s, type ProfileReplicaRemoteLogoutState as t, type ProfileReplicaRootIdentity as u, type ProfileReplicaUnknownEntry as v, type PurgeTarget as w, type ReplicaAccountGate as x, type ReplicaAdmitHook as y, type ReplicaAuthorityState as z };
|
|
@@ -591,7 +591,9 @@ type ReplicaGateReason =
|
|
|
591
591
|
/** Browser only: the `localStorage` logout marker is set. */
|
|
592
592
|
| "logout_pending"
|
|
593
593
|
/** The gate store itself could not be read; fail closed. */
|
|
594
|
-
| "gate_unavailable"
|
|
594
|
+
| "gate_unavailable"
|
|
595
|
+
/** Browser: replication is configured but no wallet provider can prove the connected account. */
|
|
596
|
+
| "wallet_provider_required";
|
|
595
597
|
/** Shape of every gate refusal error: `Error & { code: "REPLICA_GATED"; gate }`. */
|
|
596
598
|
interface ReplicaGatedError extends Error {
|
|
597
599
|
code: "REPLICA_GATED";
|
|
@@ -877,6 +879,63 @@ interface ReplicaLifecycleGate {
|
|
|
877
879
|
}): Promise<ReplicaEraseReport>;
|
|
878
880
|
/** Outstanding intents; non-empty means status `purgePending: true`. */
|
|
879
881
|
pendingPurge(): Promise<ReplicaPurgeIntent[]>;
|
|
882
|
+
/**
|
|
883
|
+
* Browser only. Under the gate lock, erases pending intents and deletes the whole origin
|
|
884
|
+
* database. Deletes only when nothing live is at stake: the gate is denied (null principal),
|
|
885
|
+
* the gate is behind the persisted deny tombstone, or the logout marker is set with a tombstone.
|
|
886
|
+
* A live or other-account gate is `refused` and left untouched. On a failed delete it sets the
|
|
887
|
+
* logout marker (when a tombstone exists) so `recover` finishes the erase on the next load.
|
|
888
|
+
* Never clears the deny tombstone.
|
|
889
|
+
*/
|
|
890
|
+
eraseLocalCopy?(o: {
|
|
891
|
+
signal: AbortSignal;
|
|
892
|
+
}): Promise<ReplicaLocalEraseOutcome>;
|
|
893
|
+
}
|
|
894
|
+
/** Result of {@link ReplicaLifecycleGate.eraseLocalCopy}. */
|
|
895
|
+
type ReplicaLocalEraseOutcome =
|
|
896
|
+
/** The database is gone and the logout marker (if any) is cleared. */
|
|
897
|
+
{
|
|
898
|
+
status: "erased";
|
|
899
|
+
}
|
|
900
|
+
/** Delete blocked or storage error; a retry can succeed. `marker` is true when the next-load marker is set. */
|
|
901
|
+
| {
|
|
902
|
+
status: "failed";
|
|
903
|
+
code: string;
|
|
904
|
+
marker: boolean;
|
|
905
|
+
}
|
|
906
|
+
/** The gate does not authorize destruction; nothing was deleted. A retry cannot succeed until the gate is denied. */
|
|
907
|
+
| {
|
|
908
|
+
status: "refused";
|
|
909
|
+
code: string;
|
|
910
|
+
};
|
|
911
|
+
/** What triggered a local-copy erase. */
|
|
912
|
+
type ReplicaPurgeTrigger = "sign_out" | "account_switch" | "purge_local_copy";
|
|
913
|
+
/** Result of `replication.purgeLocalCopy()`. `retryNow` means a short bounded retry is meaningful. */
|
|
914
|
+
type ReplicaPurgeLocalCopyResult = {
|
|
915
|
+
ok: true;
|
|
916
|
+
} | {
|
|
917
|
+
ok: false;
|
|
918
|
+
retryNow: boolean;
|
|
919
|
+
};
|
|
920
|
+
/**
|
|
921
|
+
* Emitted (`on("replica.purge.failed", …)`) when the local copy could not be erased after the
|
|
922
|
+
* bounded retries. The SDK finishes the erase on the next load through the logout marker.
|
|
923
|
+
*/
|
|
924
|
+
interface ReplicaPurgeFailedEvent {
|
|
925
|
+
type: "replica.purge.failed";
|
|
926
|
+
trigger: ReplicaPurgeTrigger;
|
|
927
|
+
/** Typed reason: `logout_pending` (marker set, erase retried on next load) or `gate_unavailable`. */
|
|
928
|
+
reason: ReplicaGateReason;
|
|
929
|
+
/** Storage error code of the last attempt. */
|
|
930
|
+
code: string;
|
|
931
|
+
/** True when a short bounded retry is meaningful (delete blocked or storage error). */
|
|
932
|
+
retryNow: boolean;
|
|
933
|
+
}
|
|
934
|
+
/** Rejection of `signOut()` when the deny itself was `unguarded` and the erase did not complete. */
|
|
935
|
+
interface ReplicaPurgeError extends Error {
|
|
936
|
+
code: "REPLICA_PURGE_FAILED";
|
|
937
|
+
reason: ReplicaGateReason;
|
|
938
|
+
retryNow: boolean;
|
|
880
939
|
}
|
|
881
940
|
/** Node/CLI profile-local fencing token, not a secret capability; the profile lock remains authoritative. */
|
|
882
941
|
interface ProfileReplicaDeferredToken {
|
|
@@ -1764,6 +1823,15 @@ interface ReplicationControl {
|
|
|
1764
1823
|
* and committed records remain. Exposed callers MUST show CLEAR_PENDING_WARNING first.
|
|
1765
1824
|
*/
|
|
1766
1825
|
clearPending(): Promise<number>;
|
|
1826
|
+
/**
|
|
1827
|
+
* Browser: erases the whole local copy (the IndexedDB database) once the account has been
|
|
1828
|
+
* denied by sign-out or account switch; `signOut()` and account switch already do this. Retries
|
|
1829
|
+
* a few times when the delete is blocked. `{ ok: false, retryNow: true }`: the copy is still
|
|
1830
|
+
* there and a short bounded retry is meaningful (the deny outcome kept the keys, or the delete
|
|
1831
|
+
* is blocked); the SDK also finishes the erase on the next load. `retryNow: false`: nothing is
|
|
1832
|
+
* erasable now (a session is live, or the storage has no browser database). Never rejects.
|
|
1833
|
+
*/
|
|
1834
|
+
purgeLocalCopy(): Promise<ReplicaPurgeLocalCopyResult>;
|
|
1767
1835
|
close(): Promise<void>;
|
|
1768
1836
|
}
|
|
1769
1837
|
interface ReplicationOptions {
|
|
@@ -1772,6 +1840,8 @@ interface ReplicationOptions {
|
|
|
1772
1840
|
prefixes: string[];
|
|
1773
1841
|
/** Required for prefixes/spaces where requiresSecretsOptIn returns true. */
|
|
1774
1842
|
allowSecrets?: boolean;
|
|
1843
|
+
/** Sign-in asks for kv/sync on each declared prefix only and never widens to a root entry that covers them. */
|
|
1844
|
+
syncScope?: "prefixes";
|
|
1775
1845
|
/** Background interval; default 60 seconds. */
|
|
1776
1846
|
syncIntervalMs?: number;
|
|
1777
1847
|
maxStalenessMs?: number;
|
|
@@ -1970,4 +2040,4 @@ declare function replicationIdentityKey(id: ReplicationIdentity): string;
|
|
|
1970
2040
|
/** Whether replicating this space/prefix can copy encrypted secret material to disk. */
|
|
1971
2041
|
declare function requiresSecretsOptIn(space: string, prefix: string): boolean;
|
|
1972
2042
|
|
|
1973
|
-
export { type ReplicaGuardedStore as $, type AuthorityRefusal as A, type ReplicaBrowserGateAccess as B, CLEAR_PENDING_WARNING as C, type ReplicaBrowserGateSnapshot as D, type ReplicaBrowserGateTx as E, type ReplicaBrowserPageAdmission as F, type ReplicaClock as G, type ReplicaCoverage as H, type ReplicaDeliveryDecision as I, type ReplicaDenyInput as J, type KVReplicationDeps as K, type LocalGetResult as L, type ReplicaDenyOutcome as M, type ReplicaDevice as N, type ReplicaEraseReport as O, type PendingWriteStore as P, type ReplicaGateAccess as Q, type ReplicationIdentity as R, type ReplicaGateReason as S, type ReplicaGateScope as T, type ReplicaGateSnapshot as U, type ReplicaGateTx as V, type ReplicaGatedError as W, type ReplicaGatedHandle as X, type ReplicaGatedSpec as Y, type ReplicaGatedStorage as Z, type ReplicaGrantInfo as _, type KVReplicationController as a, type ReplicaInspectedStatus as a0, type ReplicaLifecycleGate as a1, type
|
|
2043
|
+
export { type ReplicaGuardedStore as $, type AuthorityRefusal as A, type ReplicaBrowserGateAccess as B, CLEAR_PENDING_WARNING as C, type ReplicaBrowserGateSnapshot as D, type ReplicaBrowserGateTx as E, type ReplicaBrowserPageAdmission as F, type ReplicaClock as G, type ReplicaCoverage as H, type ReplicaDeliveryDecision as I, type ReplicaDenyInput as J, type KVReplicationDeps as K, type LocalGetResult as L, type ReplicaDenyOutcome as M, type ReplicaDevice as N, type ReplicaEraseReport as O, type PendingWriteStore as P, type ReplicaGateAccess as Q, type ReplicationIdentity as R, type ReplicaGateReason as S, type ReplicaGateScope as T, type ReplicaGateSnapshot as U, type ReplicaGateTx as V, type ReplicaGatedError as W, type ReplicaGatedHandle as X, type ReplicaGatedSpec as Y, type ReplicaGatedStorage as Z, type ReplicaGrantInfo as _, type KVReplicationController as a, type ReplicaInspectedStatus as a0, type ReplicaLifecycleGate as a1, type ReplicaLocalEraseOutcome as a2, type ReplicaPageAdmission as a3, type ReplicaPartitionEraser as a4, type ReplicaPartitionIndexEntry as a5, type ReplicaPeerCommit as a6, type ReplicaPrivateGateHash as a7, type ReplicaPurgeError as a8, type ReplicaPurgeFailedEvent as a9, type KVBatchPutResponse as aA, type KVBatchReadResponse as aB, type KVChange as aC, type KVChangesAuthority as aD, type KVChangesOptions as aE, type KVChangesResponse as aF, type KVCreateSignedReadUrlOptions as aG, type KVDeleteOptions as aH, type KVGetOptions as aI, type KVHeadOptions as aJ, type KVListOptions as aK, type KVListResponse as aL, type KVPutOptions as aM, type KVResponse as aN, type KVResponseHeaders as aO, type KVServiceConfig as aP, type KVSignedReadUrlResponse as aQ, type ReplicaPurgeIntent as aa, type ReplicaPurgeLocalCopyResult as ab, type ReplicaPurgeTrigger as ac, type ReplicaQuotaLedger as ad, type ReplicaQuotaSpec as ae, type ReplicaSessionStamp as af, type ReplicaStampedReply as ag, type ReplicaState as ah, type ReplicaStatusEntry as ai, type ReplicationAuthority as aj, type ReplicationControl as ak, type ReplicationEvent as al, type ReplicationOptions as am, type ReplicationPurgeReport as an, type ReplicationReason as ao, type ReplicationScheduler as ap, type ResolvedReplicationOptions as aq, type SaltedHash as ar, canonicalReplicationIdentity as as, replicationIdentityKey as at, requiresSecretsOptIn as au, DEFAULT_SIGNED_READ_URL_EXPIRY_MS as av, KVAction as aw, type KVActionType as ax, type KVBatchPutItem as ay, type KVBatchPutOptions as az, type KVListPage as b, type KVReadThrough as c, type KVReplicaHandle as d, type KVReplicaSpec as e, type KVReplicaStorage as f, type LocalListResult as g, type LocalReadMeta as h, type LocalReplicaStatus as i, type LocalSyncResult as j, type PendingWriteRecord as k, type PendingWriteState as l, type PinnedKey as m, type ProfileReplicaApprovalEntry as n, type ProfileReplicaDeferredDenyOutcome as o, type ProfileReplicaDeferredToken as p, type ProfileReplicaLogoutPending as q, type ProfileReplicaPreflight as r, type ProfileReplicaPurge as s, type ProfileReplicaRemoteLogoutState as t, type ProfileReplicaRootIdentity as u, type ProfileReplicaUnknownEntry as v, type PurgeTarget as w, type ReplicaAccountGate as x, type ReplicaAdmitHook as y, type ReplicaAuthorityState as z };
|