@interncom/diplomatic 0.15.1 → 0.16.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.
- package/dist/web/entdb/entdb.d.ts +23 -1
- package/dist/web/entdb/idb.d.ts +2 -2
- package/dist/web/entdb/memory.d.ts +7 -14
- package/dist/web/index.d.ts +2 -1
- package/dist/web/index.mjs +1 -1
- package/dist/web/worker.mjs +1 -1
- package/package.json +1 -1
|
@@ -30,6 +30,19 @@ export interface IDateRange {
|
|
|
30
30
|
start: Date;
|
|
31
31
|
end: Date;
|
|
32
32
|
}
|
|
33
|
+
/** Lexicographic tag range. Inclusive unless excludeStart / excludeEnd. */
|
|
34
|
+
export type ITagRange = {
|
|
35
|
+
start: string;
|
|
36
|
+
end: string;
|
|
37
|
+
excludeStart?: boolean;
|
|
38
|
+
excludeEnd?: boolean;
|
|
39
|
+
};
|
|
40
|
+
/** Exact tag, lexicographic range, or prefix. One shape per query. */
|
|
41
|
+
export type TagSpec = string | {
|
|
42
|
+
range: ITagRange;
|
|
43
|
+
} | {
|
|
44
|
+
prefix: string;
|
|
45
|
+
};
|
|
33
46
|
export type EntitiesQuery = {
|
|
34
47
|
type: string;
|
|
35
48
|
} | {
|
|
@@ -40,11 +53,20 @@ export type EntitiesQuery = {
|
|
|
40
53
|
pid: EntityID;
|
|
41
54
|
} | {
|
|
42
55
|
type: string;
|
|
43
|
-
tag:
|
|
56
|
+
tag: TagSpec;
|
|
44
57
|
} | {
|
|
45
58
|
type: string;
|
|
46
59
|
updatedBetween: IDateRange;
|
|
47
60
|
};
|
|
61
|
+
/** Whether tag falls in r (inclusive by default). Does not check start > end. */
|
|
62
|
+
export declare function tagInRange(tag: string, r: ITagRange): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Whether a tag spec can match. InvalidParam if range start > end.
|
|
65
|
+
* False (Success) for empty exact string or empty prefix.
|
|
66
|
+
*/
|
|
67
|
+
export declare function tagSpecMayMatch(spec: TagSpec): ValStat<boolean>;
|
|
68
|
+
/** Whether tag satisfies an exact / range / prefix spec. */
|
|
69
|
+
export declare function tagMatches(tag: string, spec: TagSpec): boolean;
|
|
48
70
|
/**
|
|
49
71
|
* Normalize tags for storage/index: drop non-strings and empty strings, dedupe
|
|
50
72
|
* (first occurrence wins). Returns undefined when there are no tags left.
|
package/dist/web/entdb/idb.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Status } from "../shared/consts";
|
|
2
2
|
import { EntityID, GroupID, Hash, ICrypto, IOp } from "../shared/types";
|
|
3
3
|
import { ValStat } from "../shared/valstat.ts";
|
|
4
|
-
import { EntitiesQuery, IEntDB, IEntity, IEntRow } from "./entdb";
|
|
4
|
+
import { EntitiesQuery, IEntDB, IEntity, IEntRow, TagSpec } from "./entdb";
|
|
5
5
|
export declare const entityTableName = "entities";
|
|
6
6
|
export declare const typeIndexName = "entity_type_created_at";
|
|
7
7
|
export declare const typeUpdatedAtIndexName = "entity_type_updated_at";
|
|
@@ -35,7 +35,7 @@ export declare class EntIDB implements IEntDB {
|
|
|
35
35
|
getAllOfTypeUpdatedBetween<T>(opType: string, start: Date, end: Date): Promise<ValStat<IEntity<T>[]>>;
|
|
36
36
|
getGroupMembers<T>(opType: string, gid: GroupID): Promise<ValStat<IEntity<T>[]>>;
|
|
37
37
|
getAllOfType<T>(opType: string): Promise<ValStat<IEntity<T>[]>>;
|
|
38
|
-
getByTag<T>(opType: string,
|
|
38
|
+
getByTag<T>(opType: string, spec: TagSpec): Promise<ValStat<IEntity<T>[]>>;
|
|
39
39
|
private getAllEntities;
|
|
40
40
|
getEntities<T>(query: EntitiesQuery): Promise<ValStat<IEntity<T>[]>>;
|
|
41
41
|
countEntities({ type }: {
|
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import { IEntDB, IEntity, IEntRow } from "./entdb";
|
|
1
|
+
import { EntitiesQuery, IEntDB, IEntity, IEntRow } from "./entdb";
|
|
2
2
|
import { Status } from "../shared/consts";
|
|
3
|
-
import { EntityID,
|
|
3
|
+
import { EntityID, Hash, ICrypto, IOp } from "../shared/types";
|
|
4
4
|
import { ValStat } from "../shared/valstat.ts";
|
|
5
|
-
interface IDateRange {
|
|
6
|
-
start: Date;
|
|
7
|
-
end: Date;
|
|
8
|
-
}
|
|
9
|
-
type EntitiesQuery = {
|
|
10
|
-
type: string;
|
|
11
|
-
gid?: GroupID;
|
|
12
|
-
pid?: EntityID;
|
|
13
|
-
tag?: string;
|
|
14
|
-
updatedBetween?: IDateRange;
|
|
15
|
-
};
|
|
16
5
|
/** Options for {@link EntDBMemory}. */
|
|
17
6
|
export type EntDBMemoryOptions = {
|
|
18
7
|
/**
|
|
@@ -42,6 +31,11 @@ export declare class EntDBMemory implements IEntDB {
|
|
|
42
31
|
private unindex;
|
|
43
32
|
private clearIndexes;
|
|
44
33
|
private bucketList;
|
|
34
|
+
/**
|
|
35
|
+
* List by tag spec. Exact uses the tag map; range/prefix scan tag keys
|
|
36
|
+
* (Map order is insertion, not lexicographic).
|
|
37
|
+
*/
|
|
38
|
+
private byTagSpec;
|
|
45
39
|
apply(ops: IOp[]): Promise<{
|
|
46
40
|
stats: Status[];
|
|
47
41
|
types: Set<string>;
|
|
@@ -57,4 +51,3 @@ export declare class EntDBMemory implements IEntDB {
|
|
|
57
51
|
}): Promise<ValStat<number>>;
|
|
58
52
|
checksum(crypto: ICrypto): Promise<ValStat<Hash>>;
|
|
59
53
|
}
|
|
60
|
-
export {};
|
package/dist/web/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { SyncClient } from "./client";
|
|
|
2
2
|
import crypto from "./crypto";
|
|
3
3
|
import { CachedEntDB, type CachedEntDBOptions, openEntDB, type OpenEntDBOptions } from "./entdb/cached";
|
|
4
4
|
import { EntitiesQuery, entStateManager, IEntDB, IEntity, IEntRow, isLiveEnt, isTombstone, ITombstone, normalizeTags, nullEntDB, revFromEntity, revFromHead } from "./entdb/entdb";
|
|
5
|
+
import type { ITagRange, TagSpec } from "./entdb/entdb";
|
|
5
6
|
import { EntIDB } from "./entdb/idb";
|
|
6
7
|
import { EntDBMemory, type EntDBMemoryOptions } from "./entdb/memory";
|
|
7
8
|
import { useClient, useClientState, useClientXferState, useSyncOnResume } from "./react/useClient";
|
|
@@ -43,4 +44,4 @@ import type { WipeOpts } from "./types";
|
|
|
43
44
|
export { largeBlobCapable } from "./shared/webauthn/largeBlob";
|
|
44
45
|
export { webAuthnLastError } from "./shared/webauthn/common";
|
|
45
46
|
export { APLD_APPLIED, APLD_ERROR, APLD_PENDING, apldFromStored, asDHKEReq, asDHKEResp, asSealedMasterKey, b64tob, b64urltob, btob64, btob64url, btoh, CachedEntDB, checksumEntRevs, checksumSet, Clock, cmpBytes, crypto, Decoder, DEFAULT_PRF_SALT, defaultPeekProgressEvery, defaultWebAuthnRpId, eidCodec, Enclave, encodeEntRev, Encoder, EntDBMemory, EntIDB, EntitiesQuery, EntityID, entStateManager, genSingletonEID, GroupID, hostHTTPTransport, htob, HTTPTransport, IDBSeedStore, IDBStore, idleProgress, IEntDB, IEntity, isApldState, isLiveEnt, isPendingApply, isTerminalApplyFailure, isTombstone, IStore, KEYRING_MAX, keyringCredIds, keyringKind, keyringLabel, MASTER_SEED_LEN, MemoryStore, normalizeTags, nullEntDB, nullStateManager, openDiplomaticClient, openEntDB, openIDBStore, PairRequest, PasskeySeedStore, prfCapable, PrfSeedStore, revFromEntity, revFromHead, SEALED_MASTER_KEY_LEN, setApld, shouldEmitItemProgress, SingletonStateManager, StateManager, Status, SyncClient, TypedEventEmitter, useClient, useClientState, useClientXferState, useStateWatcher, useStateWatcherSuspense, useSyncOnResume, WorkerClient, };
|
|
46
|
-
export type { ApldState, Applier, BundleHost, CachedEntDBOptions, DHKEReq, DHKEResp, EntDBMemoryOptions, HostHandle, HostStatsUpdate, IClient, ICrypto, IDeleteParams, IDiplomaticClientState, IEntRev, IEntRow, IHostConnectionInfo, IHostRow, IMessage, IMutateOp, IOp, IStateManager, IStoredMessage, IStoredMessageData, IStoredMessageWrite, ITombstone, ITransport, IUpdateParams, Keyring, KeyringEntry, KeyringRow, ListMsgsOpts, OpenDiplomaticClientMainOptions, OpenDiplomaticClientOptions, OpenDiplomaticClientWorkerOptions, OpenedDiplomaticClient, OpenEntDBOptions, PasskeySeedStoreOpts, PersistKeyring, PrfRp, PrfSeedStoreOpts, ReconcileOpts, ReconcileReport, SealedMasterKey, SetSeedOpts, SyncProgressEvent, WipeOpts, WorkerClientOptions, };
|
|
47
|
+
export type { ApldState, Applier, BundleHost, CachedEntDBOptions, DHKEReq, DHKEResp, EntDBMemoryOptions, HostHandle, HostStatsUpdate, IClient, ICrypto, IDeleteParams, IDiplomaticClientState, IEntRev, IEntRow, IHostConnectionInfo, IHostRow, IMessage, IMutateOp, IOp, IStateManager, IStoredMessage, IStoredMessageData, IStoredMessageWrite, ITagRange, ITombstone, ITransport, IUpdateParams, Keyring, KeyringEntry, KeyringRow, ListMsgsOpts, OpenDiplomaticClientMainOptions, OpenDiplomaticClientOptions, OpenDiplomaticClientWorkerOptions, OpenedDiplomaticClient, OpenEntDBOptions, PasskeySeedStoreOpts, PersistKeyring, PrfRp, PrfSeedStoreOpts, ReconcileOpts, ReconcileReport, SealedMasterKey, SetSeedOpts, SyncProgressEvent, TagSpec, WipeOpts, WorkerClientOptions, };
|