@interncom/diplomatic 0.9.0 → 0.11.0

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.
@@ -4,7 +4,7 @@ import { Status } from "./shared/consts";
4
4
  import { EncodedMessage } from "./shared/message";
5
5
  import { EntityID, Hash, HostHandle, ICrypto, IDeleteParams, IEntRev, IHostConnectionInfo, IInsertParams, IMessageHead, IStateManager, ITransport, IUpdateParams, MasterSeed } from "./shared/types";
6
6
  import { ValStat } from "./shared/valstat";
7
- import { ApldState, IClient, IDiplomaticClientState, IDiplomaticClientXferState, IHostRow, IStateEmitter, IStore, IStoredMessage, ListMsgsOpts, ReconcileOpts, ReconcileReport } from "./types";
7
+ import { ApldState, IClient, IDiplomaticClientState, IDiplomaticClientXferState, IHostRow, IStateEmitter, IStore, IStoredMessage, ListMsgsOpts, ReconcileOpts, ReconcileReport, SetSeedOpts, WipeOpts } from "./types";
8
8
  export declare class SyncClient<Handle extends HostHandle> implements IClient<Handle> {
9
9
  private clock;
10
10
  private state;
@@ -54,7 +54,7 @@ export declare class SyncClient<Handle extends HostHandle> implements IClient<Ha
54
54
  onScheduleSync?: (() => void) | undefined);
55
55
  /** Record phase progress and notify xferState listeners. */
56
56
  private emitProgress;
57
- setSeed(seed: MasterSeed): Promise<void>;
57
+ setSeed(seed: MasterSeed, opts?: SetSeedOpts): Promise<void>;
58
58
  private getClientState;
59
59
  private getXferState;
60
60
  /**
@@ -177,7 +177,11 @@ export declare class SyncClient<Handle extends HostHandle> implements IClient<Ha
177
177
  * Caller must hold applyChain.
178
178
  */
179
179
  private replay;
180
- wipe(): Promise<void>;
180
+ /**
181
+ * Clear local app/protocol state. Default: msgs + ents + meta; **not** seed
182
+ * (no passkey/largeBlob interaction unless `{ seed: true }`).
183
+ */
184
+ wipe(opts?: WipeOpts): Promise<void>;
181
185
  import: (file: File, options?: {
182
186
  onProgress?: (index: number, total: number, status: Status) => void;
183
187
  }) => Promise<Status>;
@@ -7,12 +7,12 @@ export declare const typeIndexName = "entity_type_created_at";
7
7
  export declare const typeUpdatedAtIndexName = "entity_type_updated_at";
8
8
  export declare const typeGroupIndexName = "entity_type_group_id";
9
9
  export declare const typeParentIndexName = "entity_type_parent_id";
10
- /** multiEntry index on tags[]; query by tag then filter by type. */
10
+ /** multiEntry index on tgs[]; query by tag then filter by type. */
11
11
  export declare const tagsIndexName = "entity_tags";
12
12
  /** Shared by main thread and sync worker — must stay in lockstep. */
13
13
  export declare const ENT_IDB_NAME = "db";
14
- /** v12: multiEntry tags index (entity_tags). */
15
- export declare const ENT_IDB_VERSION = 12;
14
+ /** v13: stored field tags tgs (3-letter keys); multiEntry on tgs. */
15
+ export declare const ENT_IDB_VERSION = 13;
16
16
  export declare class EntIDB implements IEntDB {
17
17
  db: IDBDatabase | undefined;
18
18
  /** In-flight open; coalesces concurrent ensureDb / peer upgrade reopen. */
@@ -18,17 +18,20 @@ import { nullStateManager, StateManager } from "./state";
18
18
  import { IDBStore, openIDBStore } from "./stores/idb/store";
19
19
  import { MemoryStore } from "./stores/memory/store";
20
20
  import { SingletonStateManager } from "./shared/singleton";
21
- import type { ApldState, Applier, HostStatsUpdate, IClient, IDiplomaticClientState, IHostRow, IStore, IStoredMessage, IStoredMessageData, IStoredMessageWrite, ListMsgsOpts, ReconcileOpts, ReconcileReport } from "./types";
21
+ import type { ApldState, Applier, HostStatsUpdate, IClient, IDiplomaticClientState, IHostRow, IStore, IStoredMessage, IStoredMessageData, IStoredMessageWrite, ListMsgsOpts, ReconcileOpts, ReconcileReport, SetSeedOpts } from "./types";
22
22
  import { APLD_APPLIED, APLD_ERROR, APLD_PENDING, apldFromStored, isApldState, isPendingApply, isTerminalApplyFailure, setApld } from "./types";
23
23
  import type { SyncProgressEvent } from "./progress";
24
24
  import { defaultPeekProgressEvery, idleProgress, shouldEmitItemProgress } from "./progress";
25
+ import { clearLargeBlobSeed, createLargeBlobCred, largeBlobCapable, PasskeySeedStore, readLargeBlobSeed, storeSeedLargeBlob, writeLargeBlobSeed } from "./passkey/seed";
26
+ import type { LargeBlobRp } from "./passkey/seed";
25
27
  import { checksumEntRevs, checksumSet, cmpBytes, encodeEntRev } from "./shared/checksum";
26
28
  import { openDiplomaticClient, type OpenDiplomaticClientMainOptions, type OpenDiplomaticClientOptions, type OpenDiplomaticClientWorkerOptions, type OpenedDiplomaticClient } from "./openClient";
27
29
  import { WorkerClient } from "./worker/client";
28
30
  import type { WorkerClientOptions } from "./worker/client";
31
+ import type { WipeOpts } from "./types";
29
32
  export declare function genWebClient(stateMgr: IStateManager, url: URL): Promise<{
30
33
  client: SyncClient<URL>;
31
34
  setSeed: (seedHex: string) => Promise<void>;
32
35
  }>;
33
- export { APLD_APPLIED, APLD_ERROR, APLD_PENDING, apldFromStored, b64tob, btob64, btoh, CachedEntDB, checksumEntRevs, checksumSet, Clock, cmpBytes, crypto, Decoder, defaultPeekProgressEvery, eidCodec, encodeEntRev, Encoder, EntDBMemory, EntIDB, EntitiesQuery, EntityID, entStateManager, genSingletonEID, GroupID, hostHTTPTransport, htob, HTTPTransport, IDBStore, idleProgress, IEntDB, IEntity, isApldState, isLiveEnt, isPendingApply, isTerminalApplyFailure, isTombstone, IStore, MasterSeed, MemoryStore, normalizeTags, nullEntDB, nullStateManager, openDiplomaticClient, openEntDB, openIDBStore, revFromEntity, revFromHead, setApld, shouldEmitItemProgress, SingletonStateManager, StateManager, Status, SyncClient, TypedEventEmitter, useClient, useClientState, useClientXferState, useStateWatcher, useStateWatcherSuspense, useSyncOnResume, WorkerClient, };
34
- export type { ApldState, Applier, CachedEntDBOptions, EntDBMemoryOptions, HostHandle, HostStatsUpdate, IClient, ICrypto, IDeleteParams, IDiplomaticClientState, IEntRev, IEntRow, IHostConnectionInfo, IHostRow, IMessage, IMutateOp, IOp, IStateManager, IStoredMessage, IStoredMessageData, IStoredMessageWrite, ITombstone, ITransport, IUpdateParams, ListMsgsOpts, OpenDiplomaticClientMainOptions, OpenDiplomaticClientOptions, OpenDiplomaticClientWorkerOptions, OpenedDiplomaticClient, OpenEntDBOptions, ReconcileOpts, ReconcileReport, SyncProgressEvent, WorkerClientOptions, };
36
+ export { APLD_APPLIED, APLD_ERROR, APLD_PENDING, apldFromStored, b64tob, btob64, btoh, CachedEntDB, checksumEntRevs, checksumSet, clearLargeBlobSeed, Clock, cmpBytes, createLargeBlobCred, crypto, Decoder, defaultPeekProgressEvery, eidCodec, encodeEntRev, Encoder, EntDBMemory, EntIDB, EntitiesQuery, EntityID, entStateManager, genSingletonEID, GroupID, hostHTTPTransport, htob, HTTPTransport, IDBStore, idleProgress, IEntDB, IEntity, isApldState, isLiveEnt, isPendingApply, isTerminalApplyFailure, isTombstone, IStore, largeBlobCapable, MasterSeed, MemoryStore, normalizeTags, nullEntDB, nullStateManager, openDiplomaticClient, openEntDB, openIDBStore, PasskeySeedStore, readLargeBlobSeed, revFromEntity, revFromHead, setApld, shouldEmitItemProgress, SingletonStateManager, StateManager, Status, storeSeedLargeBlob, SyncClient, TypedEventEmitter, useClient, useClientState, useClientXferState, useStateWatcher, useStateWatcherSuspense, useSyncOnResume, WorkerClient, writeLargeBlobSeed, };
37
+ export type { ApldState, Applier, CachedEntDBOptions, EntDBMemoryOptions, HostHandle, HostStatsUpdate, IClient, ICrypto, IDeleteParams, IDiplomaticClientState, IEntRev, IEntRow, IHostConnectionInfo, IHostRow, IMessage, IMutateOp, IOp, IStateManager, IStoredMessage, IStoredMessageData, IStoredMessageWrite, ITombstone, ITransport, IUpdateParams, LargeBlobRp, ListMsgsOpts, OpenDiplomaticClientMainOptions, OpenDiplomaticClientOptions, OpenDiplomaticClientWorkerOptions, OpenedDiplomaticClient, OpenEntDBOptions, ReconcileOpts, ReconcileReport, SetSeedOpts, SyncProgressEvent, WipeOpts, WorkerClientOptions, };