@graphrefly/ts 0.0.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/LICENSE +21 -0
- package/dist/adapters/index.cjs +9015 -0
- package/dist/adapters/index.cjs.map +1 -0
- package/dist/adapters/index.d.cts +678 -0
- package/dist/adapters/index.d.ts +678 -0
- package/dist/adapters/index.js +2894 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/observe-storage.cjs +260 -0
- package/dist/adapters/observe-storage.cjs.map +1 -0
- package/dist/adapters/observe-storage.d.cts +77 -0
- package/dist/adapters/observe-storage.d.ts +77 -0
- package/dist/adapters/observe-storage.js +161 -0
- package/dist/adapters/observe-storage.js.map +1 -0
- package/dist/append-log-DisvEReb.d.cts +189 -0
- package/dist/append-log-DzKMmjxx.d.ts +189 -0
- package/dist/chunk-2ILL7HQI.js +1189 -0
- package/dist/chunk-2ILL7HQI.js.map +1 -0
- package/dist/chunk-4VLAQHZI.js +330 -0
- package/dist/chunk-4VLAQHZI.js.map +1 -0
- package/dist/chunk-6PHB5CJS.js +229 -0
- package/dist/chunk-6PHB5CJS.js.map +1 -0
- package/dist/chunk-COHO25CZ.js +2449 -0
- package/dist/chunk-COHO25CZ.js.map +1 -0
- package/dist/chunk-D6BG7U6A.js +161 -0
- package/dist/chunk-D6BG7U6A.js.map +1 -0
- package/dist/chunk-DJC4CHLQ.js +818 -0
- package/dist/chunk-DJC4CHLQ.js.map +1 -0
- package/dist/chunk-DK554R7P.js +67 -0
- package/dist/chunk-DK554R7P.js.map +1 -0
- package/dist/chunk-DKP56CSW.js +322 -0
- package/dist/chunk-DKP56CSW.js.map +1 -0
- package/dist/chunk-G4M3NHRJ.js +688 -0
- package/dist/chunk-G4M3NHRJ.js.map +1 -0
- package/dist/chunk-GAJW5I5P.js +1 -0
- package/dist/chunk-GAJW5I5P.js.map +1 -0
- package/dist/chunk-GDL26N2T.js +282 -0
- package/dist/chunk-GDL26N2T.js.map +1 -0
- package/dist/chunk-GTPCOEOZ.js +741 -0
- package/dist/chunk-GTPCOEOZ.js.map +1 -0
- package/dist/chunk-H2HTHFVN.js +1 -0
- package/dist/chunk-H2HTHFVN.js.map +1 -0
- package/dist/chunk-HDRL4VQQ.js +218 -0
- package/dist/chunk-HDRL4VQQ.js.map +1 -0
- package/dist/chunk-I3IHOHCJ.js +2267 -0
- package/dist/chunk-I3IHOHCJ.js.map +1 -0
- package/dist/chunk-JIMUDQN3.js +965 -0
- package/dist/chunk-JIMUDQN3.js.map +1 -0
- package/dist/chunk-JR4IKCR2.js +462 -0
- package/dist/chunk-JR4IKCR2.js.map +1 -0
- package/dist/chunk-K3FXTC3I.js +165 -0
- package/dist/chunk-K3FXTC3I.js.map +1 -0
- package/dist/chunk-OOEN33FB.js +65 -0
- package/dist/chunk-OOEN33FB.js.map +1 -0
- package/dist/chunk-PKVBHGBM.js +554 -0
- package/dist/chunk-PKVBHGBM.js.map +1 -0
- package/dist/chunk-RIIOUTGM.js +1857 -0
- package/dist/chunk-RIIOUTGM.js.map +1 -0
- package/dist/chunk-SCRFRCGR.js +33 -0
- package/dist/chunk-SCRFRCGR.js.map +1 -0
- package/dist/chunk-SWTLEQL6.js +53 -0
- package/dist/chunk-SWTLEQL6.js.map +1 -0
- package/dist/chunk-SZAETNNA.js +1 -0
- package/dist/chunk-SZAETNNA.js.map +1 -0
- package/dist/chunk-TEW47IVR.js +49 -0
- package/dist/chunk-TEW47IVR.js.map +1 -0
- package/dist/chunk-Y3ZLRGHC.js +1482 -0
- package/dist/chunk-Y3ZLRGHC.js.map +1 -0
- package/dist/chunk-Z2ANQ6JW.js +149 -0
- package/dist/chunk-Z2ANQ6JW.js.map +1 -0
- package/dist/codec-BB7p8fJc.d.cts +38 -0
- package/dist/codec-BB7p8fJc.d.ts +38 -0
- package/dist/composition/index.cjs +2505 -0
- package/dist/composition/index.cjs.map +1 -0
- package/dist/composition/index.d.cts +95 -0
- package/dist/composition/index.d.ts +95 -0
- package/dist/composition/index.js +19 -0
- package/dist/composition/index.js.map +1 -0
- package/dist/core/index.cjs +2475 -0
- package/dist/core/index.cjs.map +1 -0
- package/dist/core/index.d.cts +25 -0
- package/dist/core/index.d.ts +25 -0
- package/dist/core/index.js +74 -0
- package/dist/core/index.js.map +1 -0
- package/dist/cqrs/index.cjs +595 -0
- package/dist/cqrs/index.cjs.map +1 -0
- package/dist/cqrs/index.d.cts +200 -0
- package/dist/cqrs/index.d.ts +200 -0
- package/dist/cqrs/index.js +557 -0
- package/dist/cqrs/index.js.map +1 -0
- package/dist/data-structures/index.cjs +4277 -0
- package/dist/data-structures/index.cjs.map +1 -0
- package/dist/data-structures/index.d.cts +22 -0
- package/dist/data-structures/index.d.ts +22 -0
- package/dist/data-structures/index.js +31 -0
- package/dist/data-structures/index.js.map +1 -0
- package/dist/describe-BZb7AS2y.d.ts +57 -0
- package/dist/describe-Ciu8SUnN.d.cts +57 -0
- package/dist/graph/index.cjs +7832 -0
- package/dist/graph/index.cjs.map +1 -0
- package/dist/graph/index.d.cts +251 -0
- package/dist/graph/index.d.ts +251 -0
- package/dist/graph/index.js +131 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph-DfdF9zy4.d.ts +666 -0
- package/dist/graph-s23RbbFO.d.cts +666 -0
- package/dist/index-CAEmLCYF.d.cts +166 -0
- package/dist/index-SnzZu3x7.d.ts +166 -0
- package/dist/index.cjs +15409 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +582 -0
- package/dist/index.js.map +1 -0
- package/dist/messages-BZqrGGm1.d.cts +55 -0
- package/dist/messages-BZqrGGm1.d.ts +55 -0
- package/dist/messaging/index.cjs +818 -0
- package/dist/messaging/index.cjs.map +1 -0
- package/dist/messaging/index.d.cts +235 -0
- package/dist/messaging/index.d.ts +235 -0
- package/dist/messaging/index.js +767 -0
- package/dist/messaging/index.js.map +1 -0
- package/dist/observe-event-log-0SVsx7JG.d.cts +88 -0
- package/dist/observe-event-log-Dnm76owp.d.ts +88 -0
- package/dist/operators/index.cjs +3774 -0
- package/dist/operators/index.cjs.map +1 -0
- package/dist/operators/index.d.cts +308 -0
- package/dist/operators/index.d.ts +308 -0
- package/dist/operators/index.js +112 -0
- package/dist/operators/index.js.map +1 -0
- package/dist/orchestration/index.cjs +3541 -0
- package/dist/orchestration/index.cjs.map +1 -0
- package/dist/orchestration/index.d.cts +302 -0
- package/dist/orchestration/index.d.ts +302 -0
- package/dist/orchestration/index.js +1004 -0
- package/dist/orchestration/index.js.map +1 -0
- package/dist/patterns/index.cjs +1045 -0
- package/dist/patterns/index.cjs.map +1 -0
- package/dist/patterns/index.d.cts +39 -0
- package/dist/patterns/index.d.ts +39 -0
- package/dist/patterns/index.js +33 -0
- package/dist/patterns/index.js.map +1 -0
- package/dist/reactive-collection-BxBqtIOE.d.cts +344 -0
- package/dist/reactive-collection-Cb1II1Fi.d.ts +344 -0
- package/dist/reactive-collection-storage-BNiEc-Gd.d.ts +217 -0
- package/dist/reactive-collection-storage-D-KmjE0J.d.cts +217 -0
- package/dist/reactive-map-BcB4KsQR.d.ts +256 -0
- package/dist/reactive-map-D-g3dv8I.d.cts +256 -0
- package/dist/read-through-B1CYPfq_.d.cts +82 -0
- package/dist/read-through-DwyJhGs1.d.ts +82 -0
- package/dist/render/index.cjs +250 -0
- package/dist/render/index.cjs.map +1 -0
- package/dist/render/index.d.cts +58 -0
- package/dist/render/index.d.ts +58 -0
- package/dist/render/index.js +20 -0
- package/dist/render/index.js.map +1 -0
- package/dist/resilience-Dig3Q7n0.d.cts +45 -0
- package/dist/resilience-Dig3Q7n0.d.ts +45 -0
- package/dist/semantic-memory-graph-BYoIlP35.d.cts +356 -0
- package/dist/semantic-memory-graph-CxyXLms3.d.ts +356 -0
- package/dist/solutions/index.cjs +3249 -0
- package/dist/solutions/index.cjs.map +1 -0
- package/dist/solutions/index.d.cts +520 -0
- package/dist/solutions/index.d.ts +520 -0
- package/dist/solutions/index.js +31 -0
- package/dist/solutions/index.js.map +1 -0
- package/dist/sources/browser.cjs +3095 -0
- package/dist/sources/browser.cjs.map +1 -0
- package/dist/sources/browser.d.cts +39 -0
- package/dist/sources/browser.d.ts +39 -0
- package/dist/sources/browser.js +137 -0
- package/dist/sources/browser.js.map +1 -0
- package/dist/sources/index.cjs +3021 -0
- package/dist/sources/index.cjs.map +1 -0
- package/dist/sources/index.d.cts +7 -0
- package/dist/sources/index.d.ts +7 -0
- package/dist/sources/index.js +63 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/node.cjs +675 -0
- package/dist/sources/node.cjs.map +1 -0
- package/dist/sources/node.d.cts +109 -0
- package/dist/sources/node.d.ts +109 -0
- package/dist/sources/node.js +639 -0
- package/dist/sources/node.js.map +1 -0
- package/dist/storage/browser.cjs +777 -0
- package/dist/storage/browser.cjs.map +1 -0
- package/dist/storage/browser.d.cts +40 -0
- package/dist/storage/browser.d.ts +40 -0
- package/dist/storage/browser.js +275 -0
- package/dist/storage/browser.js.map +1 -0
- package/dist/storage/index.cjs +1989 -0
- package/dist/storage/index.cjs.map +1 -0
- package/dist/storage/index.d.cts +92 -0
- package/dist/storage/index.d.ts +92 -0
- package/dist/storage/index.js +161 -0
- package/dist/storage/index.js.map +1 -0
- package/dist/storage/node.cjs +898 -0
- package/dist/storage/node.cjs.map +1 -0
- package/dist/storage/node.d.cts +66 -0
- package/dist/storage/node.d.ts +66 -0
- package/dist/storage/node.js +402 -0
- package/dist/storage/node.js.map +1 -0
- package/dist/testing/index.cjs +95 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +20 -0
- package/dist/testing/index.d.ts +20 -0
- package/dist/testing/index.js +8 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/types-bNMSWKqF.d.cts +732 -0
- package/dist/types-h12mNYbq.d.ts +732 -0
- package/package.json +250 -0
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { C as Codec } from './codec-BB7p8fJc.cjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Byte storage backends (D82): passive adapter-owned storage, no graph methods.
|
|
5
|
+
*/
|
|
6
|
+
/** Passive byte-addressed backend used by D82 storage binding tiers. */
|
|
7
|
+
interface StorageBackend {
|
|
8
|
+
get(key: string): undefined | Uint8Array | PromiseLike<undefined | Uint8Array>;
|
|
9
|
+
put(key: string, value: Uint8Array): void | PromiseLike<void>;
|
|
10
|
+
putIfAbsent?(key: string, value: Uint8Array): boolean | PromiseLike<boolean>;
|
|
11
|
+
getVersioned?(key: string): StorageVersionedRead | PromiseLike<StorageVersionedRead>;
|
|
12
|
+
setIfMatch?(key: string, value: Uint8Array, generation: StorageGeneration): boolean | PromiseLike<boolean>;
|
|
13
|
+
delete?(key: string): void | PromiseLike<void>;
|
|
14
|
+
list?(prefix?: string): readonly string[] | PromiseLike<readonly string[]>;
|
|
15
|
+
}
|
|
16
|
+
/** Passive D85 conditional-create capability for multi-writer storage helpers. */
|
|
17
|
+
interface PutIfAbsentStorageBackend extends StorageBackend {
|
|
18
|
+
putIfAbsent(key: string, value: Uint8Array): boolean | PromiseLike<boolean>;
|
|
19
|
+
}
|
|
20
|
+
/** Opaque D108 per-key generation token for passive storage versioned reads. */
|
|
21
|
+
type StorageGeneration = unknown;
|
|
22
|
+
/** D108 versioned byte read result with explicit present/absent observations. */
|
|
23
|
+
type StorageVersionedRead = {
|
|
24
|
+
readonly kind: "hit";
|
|
25
|
+
readonly value: Uint8Array;
|
|
26
|
+
readonly generation: StorageGeneration;
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: "miss";
|
|
29
|
+
readonly generation: StorageGeneration;
|
|
30
|
+
};
|
|
31
|
+
/** Passive D108 versioned read + generation-conditional set capability. */
|
|
32
|
+
interface VersionedStorageBackend extends StorageBackend {
|
|
33
|
+
getVersioned(key: string): StorageVersionedRead | PromiseLike<StorageVersionedRead>;
|
|
34
|
+
setIfMatch(key: string, value: Uint8Array, generation: StorageGeneration): boolean | PromiseLike<boolean>;
|
|
35
|
+
}
|
|
36
|
+
/** Runtime guard for D85 conditional-create capable byte backends. */
|
|
37
|
+
declare function hasStoragePutIfAbsent(backend: StorageBackend): backend is PutIfAbsentStorageBackend;
|
|
38
|
+
/** Require D85 conditional-create support and produce a clear adapter error when absent. */
|
|
39
|
+
declare function requireStoragePutIfAbsent(backend: StorageBackend, label?: string): PutIfAbsentStorageBackend;
|
|
40
|
+
/** Runtime guard for D108 versioned byte backends. */
|
|
41
|
+
declare function hasStorageVersioned(backend: StorageBackend): backend is VersionedStorageBackend;
|
|
42
|
+
/** Require D108 versioned support and produce a clear adapter error when absent. */
|
|
43
|
+
declare function requireStorageVersioned(backend: StorageBackend, label?: string): VersionedStorageBackend;
|
|
44
|
+
/** Browser/storage-adapter shape for deterministic byte helpers (DOM-free for portability). */
|
|
45
|
+
interface WebStorageLike {
|
|
46
|
+
readonly length?: number;
|
|
47
|
+
getItem(key: string): string | null | undefined;
|
|
48
|
+
setItem(key: string, value: string): void;
|
|
49
|
+
removeItem(key: string): void;
|
|
50
|
+
key?(index: number): string | null | undefined;
|
|
51
|
+
keys?(): readonly string[];
|
|
52
|
+
}
|
|
53
|
+
/** Storage helper options for namespace isolation and logical-key prefixing. */
|
|
54
|
+
interface StorageNamespaceOptions {
|
|
55
|
+
/**
|
|
56
|
+
* Optional namespace for logical keys.
|
|
57
|
+
*
|
|
58
|
+
* Namespace is part of key mapping only and is not returned from `list()`.
|
|
59
|
+
*/
|
|
60
|
+
namespace?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Build a deterministic byte backend backed by a browser-like key/value store (D103/D82). */
|
|
63
|
+
declare function webStorageBackend(storage: WebStorageLike, opts?: StorageNamespaceOptions): StorageBackend;
|
|
64
|
+
/** In-memory backend for tests, adapters, and lightweight local storage. */
|
|
65
|
+
interface MemoryBackend extends StorageBackend {
|
|
66
|
+
readonly entries: ReadonlyMap<string, Uint8Array>;
|
|
67
|
+
clear(): void;
|
|
68
|
+
}
|
|
69
|
+
/** Create a byte-cloning in-memory backend. */
|
|
70
|
+
declare function memoryBackend(initial?: Iterable<readonly [string, Uint8Array]>): MemoryBackend;
|
|
71
|
+
|
|
72
|
+
/** Codec-backed key/value tier over a passive byte backend (D82). */
|
|
73
|
+
interface KvStorageTier<T = unknown> {
|
|
74
|
+
get(key: string): Promise<T | undefined>;
|
|
75
|
+
set(key: string, value: T): Promise<void>;
|
|
76
|
+
putIfAbsent?(key: string, value: T): Promise<boolean>;
|
|
77
|
+
getVersioned?(key: string): Promise<KvVersionedRead<T>>;
|
|
78
|
+
setIfMatch?(key: string, value: T, generation: StorageGeneration): Promise<boolean>;
|
|
79
|
+
delete(key: string): Promise<void>;
|
|
80
|
+
list(prefix?: string): Promise<readonly string[]>;
|
|
81
|
+
}
|
|
82
|
+
/** Typed D85 conditional-create capability over a KV tier. */
|
|
83
|
+
interface PutIfAbsentKvStorageTier<T = unknown> extends KvStorageTier<T> {
|
|
84
|
+
putIfAbsent(key: string, value: T): Promise<boolean>;
|
|
85
|
+
}
|
|
86
|
+
/** Opaque D108 per-key generation token for typed KV versioned reads. */
|
|
87
|
+
type KvGeneration = StorageGeneration;
|
|
88
|
+
/** D108 versioned typed read result with explicit present/absent observations. */
|
|
89
|
+
type KvVersionedRead<T> = {
|
|
90
|
+
readonly kind: "hit";
|
|
91
|
+
readonly value: T;
|
|
92
|
+
readonly generation: KvGeneration;
|
|
93
|
+
} | {
|
|
94
|
+
readonly kind: "miss";
|
|
95
|
+
readonly generation: KvGeneration;
|
|
96
|
+
};
|
|
97
|
+
/** Typed D108 versioned read + generation-conditional set capability over a KV tier. */
|
|
98
|
+
interface VersionedKvStorageTier<T = unknown> extends KvStorageTier<T> {
|
|
99
|
+
getVersioned(key: string): Promise<KvVersionedRead<T>>;
|
|
100
|
+
setIfMatch(key: string, value: T, generation: KvGeneration): Promise<boolean>;
|
|
101
|
+
}
|
|
102
|
+
/** Runtime guard for typed KV tiers that expose D85 conditional create. */
|
|
103
|
+
declare function hasKvPutIfAbsent<T>(tier: KvStorageTier<T>): tier is PutIfAbsentKvStorageTier<T>;
|
|
104
|
+
/** Require D85 conditional-create support and produce a clear adapter error when absent. */
|
|
105
|
+
declare function requireKvPutIfAbsent<T>(tier: KvStorageTier<T>, label?: string): PutIfAbsentKvStorageTier<T>;
|
|
106
|
+
/** Runtime guard for typed KV tiers that expose D108 versioned read/set-if-match. */
|
|
107
|
+
declare function hasKvVersioned<T>(tier: KvStorageTier<T>): tier is VersionedKvStorageTier<T>;
|
|
108
|
+
/** Require D108 versioned KV support and produce a clear adapter error when absent. */
|
|
109
|
+
declare function requireKvVersioned<T>(tier: KvStorageTier<T>, label?: string): VersionedKvStorageTier<T>;
|
|
110
|
+
/** Options for wrapping a byte backend as a typed KV tier. */
|
|
111
|
+
interface KvStorageOptions<T> {
|
|
112
|
+
backend: StorageBackend;
|
|
113
|
+
codec?: Codec<T>;
|
|
114
|
+
}
|
|
115
|
+
/** Build a typed KV tier from a byte backend and codec. */
|
|
116
|
+
declare function kvStorage<T = unknown>(opts: KvStorageOptions<T>): KvStorageTier<T>;
|
|
117
|
+
/** Create an in-memory typed KV tier. */
|
|
118
|
+
declare function memoryKv<T = unknown>(codec?: Codec<T>): KvStorageTier<T>;
|
|
119
|
+
/** Create an in-memory typed KV tier preloaded from a record. */
|
|
120
|
+
declare function dictKv<T = unknown>(entries?: Record<string, T>, codec?: Codec<T>): KvStorageTier<T>;
|
|
121
|
+
/** Convenience wrapper for deterministic prefix listing. */
|
|
122
|
+
declare function listByPrefix<T>(tier: KvStorageTier<T>, prefix?: string): Promise<readonly string[]>;
|
|
123
|
+
|
|
124
|
+
declare const APPEND_LOG_SEQ_PAD = 20;
|
|
125
|
+
/** One append-log record with its storage key and monotonic sequence. */
|
|
126
|
+
interface AppendLogEntry<T> {
|
|
127
|
+
readonly key: string;
|
|
128
|
+
readonly seq: number;
|
|
129
|
+
readonly value: T;
|
|
130
|
+
}
|
|
131
|
+
/** Cursor and page-size options for append-log reads. */
|
|
132
|
+
interface AppendLogReadOptions {
|
|
133
|
+
/** Return entries with seq > after. */
|
|
134
|
+
after?: number;
|
|
135
|
+
limit?: number;
|
|
136
|
+
}
|
|
137
|
+
/** One bounded append-log page with the cursor for the next read. */
|
|
138
|
+
interface AppendLogPage<T> {
|
|
139
|
+
readonly entries: readonly AppendLogEntry<T>[];
|
|
140
|
+
readonly nextAfter: number;
|
|
141
|
+
readonly done: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Append-only tier for durable event/change logs (D82), not graph restore replay.
|
|
145
|
+
*
|
|
146
|
+
* This first-cut helper serializes operations within one handle. Concurrent writers sharing the
|
|
147
|
+
* same KV prefix need an external single-writer discipline or a future CAS-capable backend.
|
|
148
|
+
*/
|
|
149
|
+
interface AppendLogStorageTier<T = unknown> {
|
|
150
|
+
append(value: T): Promise<AppendLogEntry<T>>;
|
|
151
|
+
read(opts?: AppendLogReadOptions): Promise<readonly AppendLogEntry<T>[]>;
|
|
152
|
+
truncateAfter(seq: number): Promise<void>;
|
|
153
|
+
size(): Promise<number>;
|
|
154
|
+
}
|
|
155
|
+
/** D85 multi-writer append log; requires a passive conditional-create KV capability. */
|
|
156
|
+
type MultiWriterAppendLogStorageTier<T = unknown> = AppendLogStorageTier<T>;
|
|
157
|
+
/** Build the deterministic storage key for an append-log sequence number. */
|
|
158
|
+
declare function appendLogKey(prefix: string, seq: number): string;
|
|
159
|
+
/** Read one ordered append-log page without assigning replay or restore semantics. */
|
|
160
|
+
declare function readAppendLogPage<T>(log: AppendLogStorageTier<T>, opts?: AppendLogReadOptions): Promise<AppendLogPage<T>>;
|
|
161
|
+
/** Options for a typed append log over a KV tier. */
|
|
162
|
+
interface AppendLogOptions<T> {
|
|
163
|
+
kv: KvStorageTier<T>;
|
|
164
|
+
prefix?: string;
|
|
165
|
+
}
|
|
166
|
+
/** Options for D85 multi-writer append logs over conditional-create capable KV. */
|
|
167
|
+
interface MultiWriterAppendLogOptions<T> extends AppendLogOptions<T> {
|
|
168
|
+
/** Bound retry work before refreshing the listed tail after another writer wins slots. */
|
|
169
|
+
maxAttempts?: number;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Build a single-writer append-only log over a KV tier, serializing all operations in call order
|
|
173
|
+
* for this handle. D85 multi-handle concurrent appends require multiWriterAppendLogStorage.
|
|
174
|
+
*/
|
|
175
|
+
declare function appendLogStorage<T = unknown>(opts: AppendLogOptions<T>): AppendLogStorageTier<T>;
|
|
176
|
+
/**
|
|
177
|
+
* Build a D85 multi-writer append log over a conditional-create capable KV tier.
|
|
178
|
+
*
|
|
179
|
+
* Sequence allocation is passive storage work: each writer proposes a padded key and retries the
|
|
180
|
+
* next key when another writer already created that slot. This does not provide general CAS,
|
|
181
|
+
* locks, leases, transactions, unsafe truncation, WAL replay, or graph restore semantics.
|
|
182
|
+
*/
|
|
183
|
+
declare function multiWriterAppendLogStorage<T = unknown>(opts: MultiWriterAppendLogOptions<T>): MultiWriterAppendLogStorageTier<T>;
|
|
184
|
+
/** Create an in-memory append log. */
|
|
185
|
+
declare function memoryAppendLog<T = unknown>(prefix?: string): AppendLogStorageTier<T>;
|
|
186
|
+
/** Create an in-memory D85 multi-writer append log. */
|
|
187
|
+
declare function memoryMultiWriterAppendLog<T = unknown>(prefix?: string): MultiWriterAppendLogStorageTier<T>;
|
|
188
|
+
|
|
189
|
+
export { APPEND_LOG_SEQ_PAD as A, memoryMultiWriterAppendLog as B, multiWriterAppendLogStorage as C, readAppendLogPage as D, requireKvPutIfAbsent as E, requireKvVersioned as F, requireStoragePutIfAbsent as G, requireStorageVersioned as H, webStorageBackend as I, type KvGeneration as K, type MemoryBackend as M, type PutIfAbsentKvStorageTier as P, type StorageBackend as S, type VersionedKvStorageTier as V, type WebStorageLike as W, type AppendLogEntry as a, type AppendLogPage as b, type AppendLogReadOptions as c, type AppendLogStorageTier as d, type KvStorageOptions as e, type KvStorageTier as f, type KvVersionedRead as g, type MultiWriterAppendLogOptions as h, type MultiWriterAppendLogStorageTier as i, type PutIfAbsentStorageBackend as j, type StorageGeneration as k, type StorageNamespaceOptions as l, type StorageVersionedRead as m, type VersionedStorageBackend as n, appendLogKey as o, appendLogStorage as p, dictKv as q, hasKvPutIfAbsent as r, hasKvVersioned as s, hasStoragePutIfAbsent as t, hasStorageVersioned as u, kvStorage as v, listByPrefix as w, memoryAppendLog as x, memoryBackend as y, memoryKv as z };
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import { C as Codec } from './codec-BB7p8fJc.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Byte storage backends (D82): passive adapter-owned storage, no graph methods.
|
|
5
|
+
*/
|
|
6
|
+
/** Passive byte-addressed backend used by D82 storage binding tiers. */
|
|
7
|
+
interface StorageBackend {
|
|
8
|
+
get(key: string): undefined | Uint8Array | PromiseLike<undefined | Uint8Array>;
|
|
9
|
+
put(key: string, value: Uint8Array): void | PromiseLike<void>;
|
|
10
|
+
putIfAbsent?(key: string, value: Uint8Array): boolean | PromiseLike<boolean>;
|
|
11
|
+
getVersioned?(key: string): StorageVersionedRead | PromiseLike<StorageVersionedRead>;
|
|
12
|
+
setIfMatch?(key: string, value: Uint8Array, generation: StorageGeneration): boolean | PromiseLike<boolean>;
|
|
13
|
+
delete?(key: string): void | PromiseLike<void>;
|
|
14
|
+
list?(prefix?: string): readonly string[] | PromiseLike<readonly string[]>;
|
|
15
|
+
}
|
|
16
|
+
/** Passive D85 conditional-create capability for multi-writer storage helpers. */
|
|
17
|
+
interface PutIfAbsentStorageBackend extends StorageBackend {
|
|
18
|
+
putIfAbsent(key: string, value: Uint8Array): boolean | PromiseLike<boolean>;
|
|
19
|
+
}
|
|
20
|
+
/** Opaque D108 per-key generation token for passive storage versioned reads. */
|
|
21
|
+
type StorageGeneration = unknown;
|
|
22
|
+
/** D108 versioned byte read result with explicit present/absent observations. */
|
|
23
|
+
type StorageVersionedRead = {
|
|
24
|
+
readonly kind: "hit";
|
|
25
|
+
readonly value: Uint8Array;
|
|
26
|
+
readonly generation: StorageGeneration;
|
|
27
|
+
} | {
|
|
28
|
+
readonly kind: "miss";
|
|
29
|
+
readonly generation: StorageGeneration;
|
|
30
|
+
};
|
|
31
|
+
/** Passive D108 versioned read + generation-conditional set capability. */
|
|
32
|
+
interface VersionedStorageBackend extends StorageBackend {
|
|
33
|
+
getVersioned(key: string): StorageVersionedRead | PromiseLike<StorageVersionedRead>;
|
|
34
|
+
setIfMatch(key: string, value: Uint8Array, generation: StorageGeneration): boolean | PromiseLike<boolean>;
|
|
35
|
+
}
|
|
36
|
+
/** Runtime guard for D85 conditional-create capable byte backends. */
|
|
37
|
+
declare function hasStoragePutIfAbsent(backend: StorageBackend): backend is PutIfAbsentStorageBackend;
|
|
38
|
+
/** Require D85 conditional-create support and produce a clear adapter error when absent. */
|
|
39
|
+
declare function requireStoragePutIfAbsent(backend: StorageBackend, label?: string): PutIfAbsentStorageBackend;
|
|
40
|
+
/** Runtime guard for D108 versioned byte backends. */
|
|
41
|
+
declare function hasStorageVersioned(backend: StorageBackend): backend is VersionedStorageBackend;
|
|
42
|
+
/** Require D108 versioned support and produce a clear adapter error when absent. */
|
|
43
|
+
declare function requireStorageVersioned(backend: StorageBackend, label?: string): VersionedStorageBackend;
|
|
44
|
+
/** Browser/storage-adapter shape for deterministic byte helpers (DOM-free for portability). */
|
|
45
|
+
interface WebStorageLike {
|
|
46
|
+
readonly length?: number;
|
|
47
|
+
getItem(key: string): string | null | undefined;
|
|
48
|
+
setItem(key: string, value: string): void;
|
|
49
|
+
removeItem(key: string): void;
|
|
50
|
+
key?(index: number): string | null | undefined;
|
|
51
|
+
keys?(): readonly string[];
|
|
52
|
+
}
|
|
53
|
+
/** Storage helper options for namespace isolation and logical-key prefixing. */
|
|
54
|
+
interface StorageNamespaceOptions {
|
|
55
|
+
/**
|
|
56
|
+
* Optional namespace for logical keys.
|
|
57
|
+
*
|
|
58
|
+
* Namespace is part of key mapping only and is not returned from `list()`.
|
|
59
|
+
*/
|
|
60
|
+
namespace?: string;
|
|
61
|
+
}
|
|
62
|
+
/** Build a deterministic byte backend backed by a browser-like key/value store (D103/D82). */
|
|
63
|
+
declare function webStorageBackend(storage: WebStorageLike, opts?: StorageNamespaceOptions): StorageBackend;
|
|
64
|
+
/** In-memory backend for tests, adapters, and lightweight local storage. */
|
|
65
|
+
interface MemoryBackend extends StorageBackend {
|
|
66
|
+
readonly entries: ReadonlyMap<string, Uint8Array>;
|
|
67
|
+
clear(): void;
|
|
68
|
+
}
|
|
69
|
+
/** Create a byte-cloning in-memory backend. */
|
|
70
|
+
declare function memoryBackend(initial?: Iterable<readonly [string, Uint8Array]>): MemoryBackend;
|
|
71
|
+
|
|
72
|
+
/** Codec-backed key/value tier over a passive byte backend (D82). */
|
|
73
|
+
interface KvStorageTier<T = unknown> {
|
|
74
|
+
get(key: string): Promise<T | undefined>;
|
|
75
|
+
set(key: string, value: T): Promise<void>;
|
|
76
|
+
putIfAbsent?(key: string, value: T): Promise<boolean>;
|
|
77
|
+
getVersioned?(key: string): Promise<KvVersionedRead<T>>;
|
|
78
|
+
setIfMatch?(key: string, value: T, generation: StorageGeneration): Promise<boolean>;
|
|
79
|
+
delete(key: string): Promise<void>;
|
|
80
|
+
list(prefix?: string): Promise<readonly string[]>;
|
|
81
|
+
}
|
|
82
|
+
/** Typed D85 conditional-create capability over a KV tier. */
|
|
83
|
+
interface PutIfAbsentKvStorageTier<T = unknown> extends KvStorageTier<T> {
|
|
84
|
+
putIfAbsent(key: string, value: T): Promise<boolean>;
|
|
85
|
+
}
|
|
86
|
+
/** Opaque D108 per-key generation token for typed KV versioned reads. */
|
|
87
|
+
type KvGeneration = StorageGeneration;
|
|
88
|
+
/** D108 versioned typed read result with explicit present/absent observations. */
|
|
89
|
+
type KvVersionedRead<T> = {
|
|
90
|
+
readonly kind: "hit";
|
|
91
|
+
readonly value: T;
|
|
92
|
+
readonly generation: KvGeneration;
|
|
93
|
+
} | {
|
|
94
|
+
readonly kind: "miss";
|
|
95
|
+
readonly generation: KvGeneration;
|
|
96
|
+
};
|
|
97
|
+
/** Typed D108 versioned read + generation-conditional set capability over a KV tier. */
|
|
98
|
+
interface VersionedKvStorageTier<T = unknown> extends KvStorageTier<T> {
|
|
99
|
+
getVersioned(key: string): Promise<KvVersionedRead<T>>;
|
|
100
|
+
setIfMatch(key: string, value: T, generation: KvGeneration): Promise<boolean>;
|
|
101
|
+
}
|
|
102
|
+
/** Runtime guard for typed KV tiers that expose D85 conditional create. */
|
|
103
|
+
declare function hasKvPutIfAbsent<T>(tier: KvStorageTier<T>): tier is PutIfAbsentKvStorageTier<T>;
|
|
104
|
+
/** Require D85 conditional-create support and produce a clear adapter error when absent. */
|
|
105
|
+
declare function requireKvPutIfAbsent<T>(tier: KvStorageTier<T>, label?: string): PutIfAbsentKvStorageTier<T>;
|
|
106
|
+
/** Runtime guard for typed KV tiers that expose D108 versioned read/set-if-match. */
|
|
107
|
+
declare function hasKvVersioned<T>(tier: KvStorageTier<T>): tier is VersionedKvStorageTier<T>;
|
|
108
|
+
/** Require D108 versioned KV support and produce a clear adapter error when absent. */
|
|
109
|
+
declare function requireKvVersioned<T>(tier: KvStorageTier<T>, label?: string): VersionedKvStorageTier<T>;
|
|
110
|
+
/** Options for wrapping a byte backend as a typed KV tier. */
|
|
111
|
+
interface KvStorageOptions<T> {
|
|
112
|
+
backend: StorageBackend;
|
|
113
|
+
codec?: Codec<T>;
|
|
114
|
+
}
|
|
115
|
+
/** Build a typed KV tier from a byte backend and codec. */
|
|
116
|
+
declare function kvStorage<T = unknown>(opts: KvStorageOptions<T>): KvStorageTier<T>;
|
|
117
|
+
/** Create an in-memory typed KV tier. */
|
|
118
|
+
declare function memoryKv<T = unknown>(codec?: Codec<T>): KvStorageTier<T>;
|
|
119
|
+
/** Create an in-memory typed KV tier preloaded from a record. */
|
|
120
|
+
declare function dictKv<T = unknown>(entries?: Record<string, T>, codec?: Codec<T>): KvStorageTier<T>;
|
|
121
|
+
/** Convenience wrapper for deterministic prefix listing. */
|
|
122
|
+
declare function listByPrefix<T>(tier: KvStorageTier<T>, prefix?: string): Promise<readonly string[]>;
|
|
123
|
+
|
|
124
|
+
declare const APPEND_LOG_SEQ_PAD = 20;
|
|
125
|
+
/** One append-log record with its storage key and monotonic sequence. */
|
|
126
|
+
interface AppendLogEntry<T> {
|
|
127
|
+
readonly key: string;
|
|
128
|
+
readonly seq: number;
|
|
129
|
+
readonly value: T;
|
|
130
|
+
}
|
|
131
|
+
/** Cursor and page-size options for append-log reads. */
|
|
132
|
+
interface AppendLogReadOptions {
|
|
133
|
+
/** Return entries with seq > after. */
|
|
134
|
+
after?: number;
|
|
135
|
+
limit?: number;
|
|
136
|
+
}
|
|
137
|
+
/** One bounded append-log page with the cursor for the next read. */
|
|
138
|
+
interface AppendLogPage<T> {
|
|
139
|
+
readonly entries: readonly AppendLogEntry<T>[];
|
|
140
|
+
readonly nextAfter: number;
|
|
141
|
+
readonly done: boolean;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Append-only tier for durable event/change logs (D82), not graph restore replay.
|
|
145
|
+
*
|
|
146
|
+
* This first-cut helper serializes operations within one handle. Concurrent writers sharing the
|
|
147
|
+
* same KV prefix need an external single-writer discipline or a future CAS-capable backend.
|
|
148
|
+
*/
|
|
149
|
+
interface AppendLogStorageTier<T = unknown> {
|
|
150
|
+
append(value: T): Promise<AppendLogEntry<T>>;
|
|
151
|
+
read(opts?: AppendLogReadOptions): Promise<readonly AppendLogEntry<T>[]>;
|
|
152
|
+
truncateAfter(seq: number): Promise<void>;
|
|
153
|
+
size(): Promise<number>;
|
|
154
|
+
}
|
|
155
|
+
/** D85 multi-writer append log; requires a passive conditional-create KV capability. */
|
|
156
|
+
type MultiWriterAppendLogStorageTier<T = unknown> = AppendLogStorageTier<T>;
|
|
157
|
+
/** Build the deterministic storage key for an append-log sequence number. */
|
|
158
|
+
declare function appendLogKey(prefix: string, seq: number): string;
|
|
159
|
+
/** Read one ordered append-log page without assigning replay or restore semantics. */
|
|
160
|
+
declare function readAppendLogPage<T>(log: AppendLogStorageTier<T>, opts?: AppendLogReadOptions): Promise<AppendLogPage<T>>;
|
|
161
|
+
/** Options for a typed append log over a KV tier. */
|
|
162
|
+
interface AppendLogOptions<T> {
|
|
163
|
+
kv: KvStorageTier<T>;
|
|
164
|
+
prefix?: string;
|
|
165
|
+
}
|
|
166
|
+
/** Options for D85 multi-writer append logs over conditional-create capable KV. */
|
|
167
|
+
interface MultiWriterAppendLogOptions<T> extends AppendLogOptions<T> {
|
|
168
|
+
/** Bound retry work before refreshing the listed tail after another writer wins slots. */
|
|
169
|
+
maxAttempts?: number;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Build a single-writer append-only log over a KV tier, serializing all operations in call order
|
|
173
|
+
* for this handle. D85 multi-handle concurrent appends require multiWriterAppendLogStorage.
|
|
174
|
+
*/
|
|
175
|
+
declare function appendLogStorage<T = unknown>(opts: AppendLogOptions<T>): AppendLogStorageTier<T>;
|
|
176
|
+
/**
|
|
177
|
+
* Build a D85 multi-writer append log over a conditional-create capable KV tier.
|
|
178
|
+
*
|
|
179
|
+
* Sequence allocation is passive storage work: each writer proposes a padded key and retries the
|
|
180
|
+
* next key when another writer already created that slot. This does not provide general CAS,
|
|
181
|
+
* locks, leases, transactions, unsafe truncation, WAL replay, or graph restore semantics.
|
|
182
|
+
*/
|
|
183
|
+
declare function multiWriterAppendLogStorage<T = unknown>(opts: MultiWriterAppendLogOptions<T>): MultiWriterAppendLogStorageTier<T>;
|
|
184
|
+
/** Create an in-memory append log. */
|
|
185
|
+
declare function memoryAppendLog<T = unknown>(prefix?: string): AppendLogStorageTier<T>;
|
|
186
|
+
/** Create an in-memory D85 multi-writer append log. */
|
|
187
|
+
declare function memoryMultiWriterAppendLog<T = unknown>(prefix?: string): MultiWriterAppendLogStorageTier<T>;
|
|
188
|
+
|
|
189
|
+
export { APPEND_LOG_SEQ_PAD as A, memoryMultiWriterAppendLog as B, multiWriterAppendLogStorage as C, readAppendLogPage as D, requireKvPutIfAbsent as E, requireKvVersioned as F, requireStoragePutIfAbsent as G, requireStorageVersioned as H, webStorageBackend as I, type KvGeneration as K, type MemoryBackend as M, type PutIfAbsentKvStorageTier as P, type StorageBackend as S, type VersionedKvStorageTier as V, type WebStorageLike as W, type AppendLogEntry as a, type AppendLogPage as b, type AppendLogReadOptions as c, type AppendLogStorageTier as d, type KvStorageOptions as e, type KvStorageTier as f, type KvVersionedRead as g, type MultiWriterAppendLogOptions as h, type MultiWriterAppendLogStorageTier as i, type PutIfAbsentStorageBackend as j, type StorageGeneration as k, type StorageNamespaceOptions as l, type StorageVersionedRead as m, type VersionedStorageBackend as n, appendLogKey as o, appendLogStorage as p, dictKv as q, hasKvPutIfAbsent as r, hasKvVersioned as s, hasStoragePutIfAbsent as t, hasStorageVersioned as u, kvStorage as v, listByPrefix as w, memoryAppendLog as x, memoryBackend as y, memoryKv as z };
|