@interncom/diplomatic 0.3.0 → 0.3.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.
@@ -136,6 +136,8 @@ export interface IClient<Handle extends HostHandle> {
136
136
  setSeed(seed: MasterSeed): Promise<void>;
137
137
  link(host: IHostConnectionInfo<Handle>): Promise<void>;
138
138
  unlink(label: string): Promise<void>;
139
+ /** Linked hosts from the protocol store (handle, label, lastSeq, …). */
140
+ hosts(): Promise<IHostRow<Handle>[]>;
139
141
  connect(): Promise<void>;
140
142
  disconnect(): Promise<void>;
141
143
  insertRaw(content: SerializedContent): Promise<ValStat<IMessageHead>>;
@@ -143,6 +145,8 @@ export interface IClient<Handle extends HostHandle> {
143
145
  insert<T = unknown>(op: IInsertParams<T>): Promise<ValStat<IMessageHead>>;
144
146
  upsert<T = unknown>(op: IUpsertParams<T>, force?: boolean): Promise<ValStat<IMessageHead>>;
145
147
  delete(eid: EntityID): Promise<ValStat<IMessageHead>>;
148
+ /** Allocate an entity id (optional 8-byte id material; else random). */
149
+ genEID(id?: Uint8Array): Promise<ValStat<EntityID>>;
146
150
  sync(): Promise<Status>;
147
151
  wipe(): Promise<void>;
148
152
  import(file: File): Promise<Status>;
@@ -2,7 +2,7 @@ import { IClock } from "../shared/clock";
2
2
  import { Status } from "../shared/consts";
3
3
  import type { EntityID, IHostConnectionInfo, IInsertParams, IMessageHead, IStateManager, IUpsertParams, MasterSeed, SerializedContent } from "../shared/types";
4
4
  import type { ValStat } from "../shared/valstat";
5
- import type { IClient, IDiplomaticClientState, IDiplomaticClientXferState, IStateEmitter, IStore } from "../types";
5
+ import type { IClient, IDiplomaticClientState, IDiplomaticClientXferState, IHostRow, IStateEmitter, IStore } from "../types";
6
6
  /**
7
7
  * Options for attaching to an app-owned sync Worker.
8
8
  *
@@ -62,6 +62,8 @@ export declare class WorkerClient implements IClient<URL> {
62
62
  setSeed(seed: MasterSeed): Promise<void>;
63
63
  link(host: IHostConnectionInfo<URL>, connect?: boolean): Promise<void>;
64
64
  unlink(label: string): Promise<void>;
65
+ /** Hosts live in shared main IDB (same as local writer). */
66
+ hosts(): Promise<IHostRow<URL>[]>;
65
67
  connect(listen?: boolean, sync?: boolean): Promise<void>;
66
68
  disconnect(): Promise<void>;
67
69
  /** Local UI write: archive + apply on main (fast UI); upload/sync via worker. */
@@ -70,6 +72,7 @@ export declare class WorkerClient implements IClient<URL> {
70
72
  insert<T = unknown>(op: IInsertParams<T>): Promise<ValStat<IMessageHead>>;
71
73
  upsert<T = unknown>(op: IUpsertParams<T>, force?: boolean): Promise<ValStat<IMessageHead>>;
72
74
  delete(eid: EntityID): Promise<ValStat<IMessageHead>>;
75
+ genEID(id?: Uint8Array): Promise<ValStat<EntityID>>;
73
76
  sync(): Promise<Status>;
74
77
  wipe(): Promise<void>;
75
78
  import(file: File): Promise<Status>;