@interncom/diplomatic 0.1.0 → 0.1.1
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/client.d.ts +5 -4
- package/dist/entdb/entdb.d.ts +10 -4
- package/dist/entdb/idb.d.ts +1 -0
- package/dist/index.d.ts +4 -5
- package/dist/index.mjs +1328 -1450
- package/dist/react/useClient.d.ts +14 -3
- package/dist/shared/bag.d.ts +1 -2
- package/dist/shared/endpoint.d.ts +1 -1
- package/dist/shared/http.d.ts +2 -1
- package/dist/shared/sync.d.ts +9 -0
- package/dist/shared/types.d.ts +1 -1
- package/dist/stores/idb/store.d.ts +2 -1
- package/dist/sync.d.ts +1 -8
- package/package.json +2 -2
package/dist/client.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { Status } from "./shared/consts";
|
|
|
4
4
|
import { EncodedMessage } from "./shared/message";
|
|
5
5
|
import { EntityID, HostHandle, ICrypto, IHostConnectionInfo, IInsertParams, IMessageHead, ITransport, IUpsertParams, MasterSeed } from "./shared/types";
|
|
6
6
|
import { ValStat } from "./shared/valstat";
|
|
7
|
-
import { IClient, IDiplomaticClientState, IDiplomaticClientXferState,
|
|
7
|
+
import { IClient, IDiplomaticClientState, IDiplomaticClientXferState, IStateEmitter, IStateManager, IStore } from "./types";
|
|
8
8
|
export declare class SyncClient<Handle extends HostHandle> implements IClient<Handle> {
|
|
9
9
|
private clock;
|
|
10
10
|
private state;
|
|
@@ -16,7 +16,7 @@ export declare class SyncClient<Handle extends HostHandle> implements IClient<Ha
|
|
|
16
16
|
private currentSync;
|
|
17
17
|
clientState: IStateEmitter<IDiplomaticClientState>;
|
|
18
18
|
xferState: IStateEmitter<IDiplomaticClientXferState>;
|
|
19
|
-
constructor(clock: IClock, state: IStateManager, store: IStore<Handle>, transport: (host:
|
|
19
|
+
constructor(clock: IClock, state: IStateManager, store: IStore<Handle>, transport: (host: IHostConnectionInfo<Handle>) => ITransport, crypto?: ICrypto, forceSkewHandlingByDefault?: boolean);
|
|
20
20
|
private readonly SYNC_DEBOUNCE_DELAY_MS;
|
|
21
21
|
private syncTimeout;
|
|
22
22
|
setSeed(seed: MasterSeed): Promise<void>;
|
|
@@ -37,8 +37,9 @@ export declare class SyncClient<Handle extends HostHandle> implements IClient<Ha
|
|
|
37
37
|
}) => Promise<Status>;
|
|
38
38
|
private scheduleSync;
|
|
39
39
|
export(filename: string): Promise<Status.Success | import("./shared/valstat").StatusNOK>;
|
|
40
|
-
link(host: IHostConnectionInfo<Handle
|
|
40
|
+
link(host: IHostConnectionInfo<Handle>, connect?: boolean): Promise<void>;
|
|
41
41
|
unlink(label: string): Promise<void>;
|
|
42
|
-
|
|
42
|
+
private connectToHost;
|
|
43
|
+
connect(listen?: boolean, sync?: boolean): Promise<void>;
|
|
43
44
|
disconnect: () => Promise<void>;
|
|
44
45
|
}
|
package/dist/entdb/entdb.d.ts
CHANGED
|
@@ -15,9 +15,15 @@ export interface IDateRange {
|
|
|
15
15
|
}
|
|
16
16
|
export type EntitiesQuery = {
|
|
17
17
|
type: string;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
} | {
|
|
19
|
+
type: string;
|
|
20
|
+
gid: GroupID;
|
|
21
|
+
} | {
|
|
22
|
+
type: string;
|
|
23
|
+
pid: EntityID;
|
|
24
|
+
} | {
|
|
25
|
+
type: string;
|
|
26
|
+
updatedBetween: IDateRange;
|
|
21
27
|
};
|
|
22
28
|
export interface IEntDB {
|
|
23
29
|
apply: (ops: IOp[]) => Promise<{
|
|
@@ -26,7 +32,7 @@ export interface IEntDB {
|
|
|
26
32
|
}>;
|
|
27
33
|
clear: () => Promise<Status>;
|
|
28
34
|
getEnt<T>(eid: EntityID): Promise<ValStat<IEntity<T> | undefined>>;
|
|
29
|
-
getEntities<T>(
|
|
35
|
+
getEntities<T>(query: EntitiesQuery): Promise<ValStat<IEntity<T>[]>>;
|
|
30
36
|
countEntities({ type }: {
|
|
31
37
|
type: string;
|
|
32
38
|
}): Promise<ValStat<number>>;
|
package/dist/entdb/idb.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { SyncClient } from "./client";
|
|
2
2
|
import libsodiumCrypto from "./crypto";
|
|
3
3
|
import { EntitiesQuery, entStateManager, IEntDB, IEntity, nullEntDB } from "./entdb/entdb";
|
|
4
|
-
import { EntIDB } from "./entdb/idb";
|
|
4
|
+
import { EntIDB, openEntIDB } from "./entdb/idb";
|
|
5
5
|
import { EntDBMemory } from "./entdb/memory";
|
|
6
|
-
import { useClientState, useClientXferState, useSyncOnResume } from "./react/useClient";
|
|
6
|
+
import { useClient, useClientState, useClientXferState, useSyncOnResume } from "./react/useClient";
|
|
7
7
|
import useStateWatcher, { useStateWatcherSuspense } from "./react/useStateWatcher";
|
|
8
8
|
import { btoh, htob } from "./shared/binary";
|
|
9
9
|
import { Clock } from "./shared/clock";
|
|
@@ -14,11 +14,10 @@ import { EntityID, GroupID, type IOp, MasterSeed } from "./shared/types";
|
|
|
14
14
|
import { nullStateManager, StateManager } from "./state";
|
|
15
15
|
import { IDBStore, openIDBStore } from "./stores/idb/store";
|
|
16
16
|
import { MemoryStore } from "./stores/memory/store";
|
|
17
|
-
import type { IDiplomaticClientState,
|
|
18
|
-
export declare const hostHTTPTransport: (host: IHostRow<URL>) => HTTPTransport;
|
|
17
|
+
import type { IDiplomaticClientState, IStateManager, IStore } from "./types";
|
|
19
18
|
export declare function genWebClient(stateMgr: StateManager, url: URL): Promise<{
|
|
20
19
|
client: SyncClient<URL>;
|
|
21
20
|
setSeed: (seedHex: string) => Promise<void>;
|
|
22
21
|
}>;
|
|
23
|
-
export { btoh, Clock, EntDBMemory, EntIDB, EntitiesQuery, EntityID, entStateManager, genSingletonEID, GroupID, htob, HTTPTransport, IDBStore, IEntDB, IEntity, IStateManager, IStore, libsodiumCrypto, MasterSeed, MemoryStore, nullEntDB, nullStateManager, openIDBStore, StateManager, Status, SyncClient, useClientState, useClientXferState, useStateWatcher, useStateWatcherSuspense, useSyncOnResume, };
|
|
22
|
+
export { btoh, Clock, EntDBMemory, EntIDB, EntitiesQuery, EntityID, entStateManager, genSingletonEID, GroupID, htob, HTTPTransport, IDBStore, IEntDB, IEntity, IStateManager, IStore, libsodiumCrypto, MasterSeed, MemoryStore, nullEntDB, nullStateManager, openEntIDB, openIDBStore, StateManager, Status, SyncClient, useClient, useClientState, useClientXferState, useStateWatcher, useStateWatcherSuspense, useSyncOnResume, };
|
|
24
23
|
export type { IDiplomaticClientState, IOp };
|