@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,678 @@
|
|
|
1
|
+
export { A as AGENTIC_MEMORY_RECORD_CHANGE_FORMAT, a as AGENTIC_MEMORY_RECORD_SNAPSHOT_FORMAT, b as AGENTIC_MEMORY_RECORD_STORAGE_FRAME_VERSION, c as AgenticMemoryRecordChangeFrame, d as AgenticMemoryRecordSnapshotFrame, e as AgenticMemoryRecordsPersistenceCursor, f as AgenticMemoryRecordsPersistenceError, g as AgenticMemoryRecordsPersistenceHandle, h as AgenticMemoryRecordsPersistenceStatus, i as AgenticMemoryRecordsRestoreState, L as LoadAgenticMemoryRecordsStateOptions, O as OpenPersistentAgenticMemoryRecordsOptions, j as OpenPersistentReactiveIndexOptions, k as OpenPersistentReactiveListOptions, l as OpenPersistentReactiveLogOptions, m as OpenPersistentReactiveMapOptions, P as PersistAgenticMemoryRecordsOptions, n as PersistReactiveCollectionOptions, o as PersistentAgenticMemoryRecords, p as PersistentReactiveIndex, q as PersistentReactiveList, r as PersistentReactiveLog, s as PersistentReactiveMap, R as ReactiveCollectionPersistenceCursor, t as ReactiveCollectionPersistenceError, u as ReactiveCollectionPersistenceHandle, v as ReactiveCollectionPersistenceStatus, w as agenticMemoryRecordChangeFrame, x as agenticMemoryRecordSnapshotFrame, y as agenticMemoryRecordsSnapshotKey, z as assertAgenticMemoryRecordChangeFrame, B as assertAgenticMemoryRecordSnapshotFrame, C as loadAgenticMemoryRecordsState, D as openPersistentAgenticMemoryRecords, E as openPersistentReactiveIndex, F as openPersistentReactiveList, G as openPersistentReactiveLog, H as openPersistentReactiveMap, I as persistAgenticMemoryRecords, J as persistReactiveCollection } from '../reactive-collection-storage-D-KmjE0J.cjs';
|
|
2
|
+
import { d as Graph } from '../graph-s23RbbFO.cjs';
|
|
3
|
+
import { R as RetryPolicy } from '../resilience-Dig3Q7n0.cjs';
|
|
4
|
+
import { N as Node, g as HttpRequest, w as ProcessCommand, O as WebSocketSend, h as HttpResponse, x as ProcessResult, M as WebSocketRequest, Q as WebSocketSendResult } from '../types-bNMSWKqF.cjs';
|
|
5
|
+
import '../solutions/index.cjs';
|
|
6
|
+
import '../codec-BB7p8fJc.cjs';
|
|
7
|
+
import '../semantic-memory-graph-BYoIlP35.cjs';
|
|
8
|
+
import '../append-log-DisvEReb.cjs';
|
|
9
|
+
import '../reactive-collection-BxBqtIOE.cjs';
|
|
10
|
+
import '../reactive-map-D-g3dv8I.cjs';
|
|
11
|
+
import '../core/index.cjs';
|
|
12
|
+
import '../messages-BZqrGGm1.cjs';
|
|
13
|
+
import '../describe-Ciu8SUnN.cjs';
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Graph-visible wire bridge envelope helpers (D134).
|
|
17
|
+
*
|
|
18
|
+
* This first slice is transport-free: commands become outbound envelope facts,
|
|
19
|
+
* remote receipts enter only through the inbound fact node, and retry/ack timeout
|
|
20
|
+
* state is surfaced through graph-visible attempts/status/errors nodes.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
type WireBridgeEnvelopeType = "start" | "data" | "ack" | "nack" | "status" | "error" | "close";
|
|
24
|
+
interface WireBridgeMetadata {
|
|
25
|
+
/** Monotonic envelope sequence within the bridge session. */
|
|
26
|
+
readonly seq: number;
|
|
27
|
+
/** Monotonic accepted inbound cursor observed by the sending side. */
|
|
28
|
+
readonly cursor: number;
|
|
29
|
+
/** D151: correlation/idempotency metadata, not an authoritative duplicate lookup key. */
|
|
30
|
+
readonly idempotencyKey: string;
|
|
31
|
+
readonly attempt: number;
|
|
32
|
+
readonly maxAttempts: number;
|
|
33
|
+
readonly timestampMs?: number;
|
|
34
|
+
/** D151 ack/nack correlation target; receipt duplicate recognition still uses seq/cursor. */
|
|
35
|
+
readonly ackForSeq?: number;
|
|
36
|
+
readonly requestId?: string;
|
|
37
|
+
}
|
|
38
|
+
type WireBridgePayload<TData = unknown> = {
|
|
39
|
+
readonly kind: "data";
|
|
40
|
+
readonly value: TData;
|
|
41
|
+
} | {
|
|
42
|
+
readonly kind: "error";
|
|
43
|
+
readonly error: unknown;
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: "status";
|
|
46
|
+
readonly status: unknown;
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: "close";
|
|
49
|
+
readonly reason?: unknown;
|
|
50
|
+
};
|
|
51
|
+
interface WireBridgeEnvelope<TData = unknown> {
|
|
52
|
+
readonly sessionId: string;
|
|
53
|
+
readonly type: WireBridgeEnvelopeType;
|
|
54
|
+
readonly payload?: WireBridgePayload<TData>;
|
|
55
|
+
readonly metadata: WireBridgeMetadata;
|
|
56
|
+
}
|
|
57
|
+
type WireBridgeCommand<TData = unknown> = {
|
|
58
|
+
readonly kind: "start";
|
|
59
|
+
readonly idempotencyKey?: string;
|
|
60
|
+
readonly requestId?: string;
|
|
61
|
+
} | {
|
|
62
|
+
readonly kind: "send";
|
|
63
|
+
readonly payload: TData;
|
|
64
|
+
readonly idempotencyKey?: string;
|
|
65
|
+
readonly requestId?: string;
|
|
66
|
+
} | {
|
|
67
|
+
readonly kind: "ack";
|
|
68
|
+
readonly ackForSeq: number;
|
|
69
|
+
readonly idempotencyKey?: string;
|
|
70
|
+
readonly requestId?: string;
|
|
71
|
+
} | {
|
|
72
|
+
readonly kind: "nack";
|
|
73
|
+
readonly ackForSeq: number;
|
|
74
|
+
readonly error: unknown;
|
|
75
|
+
readonly idempotencyKey?: string;
|
|
76
|
+
readonly requestId?: string;
|
|
77
|
+
} | {
|
|
78
|
+
readonly kind: "close";
|
|
79
|
+
readonly reason?: unknown;
|
|
80
|
+
readonly idempotencyKey?: string;
|
|
81
|
+
};
|
|
82
|
+
type WireBridgeEvent<TOutbound = unknown, TInbound = unknown> = {
|
|
83
|
+
readonly kind: "outbound";
|
|
84
|
+
readonly envelope: WireBridgeEnvelope<TOutbound>;
|
|
85
|
+
} | {
|
|
86
|
+
readonly kind: "inbound";
|
|
87
|
+
readonly envelope: WireBridgeEnvelope<TInbound>;
|
|
88
|
+
} | {
|
|
89
|
+
readonly kind: "ack";
|
|
90
|
+
readonly ackForSeq: number;
|
|
91
|
+
readonly envelope: WireBridgeEnvelope<TInbound>;
|
|
92
|
+
readonly outbound: WireBridgeEnvelope<TOutbound>;
|
|
93
|
+
} | {
|
|
94
|
+
readonly kind: "nack";
|
|
95
|
+
readonly ackForSeq: number;
|
|
96
|
+
readonly envelope: WireBridgeEnvelope<TInbound>;
|
|
97
|
+
readonly outbound: WireBridgeEnvelope<TOutbound>;
|
|
98
|
+
readonly error: unknown;
|
|
99
|
+
} | {
|
|
100
|
+
readonly kind: "timeout";
|
|
101
|
+
readonly seq: number;
|
|
102
|
+
readonly attempt: number;
|
|
103
|
+
} | {
|
|
104
|
+
readonly kind: "retry";
|
|
105
|
+
readonly seq: number;
|
|
106
|
+
readonly attempt: number;
|
|
107
|
+
readonly delayMs: number;
|
|
108
|
+
readonly error: unknown;
|
|
109
|
+
} | {
|
|
110
|
+
readonly kind: "exhausted";
|
|
111
|
+
readonly seq: number;
|
|
112
|
+
readonly attempt: number;
|
|
113
|
+
readonly error: unknown;
|
|
114
|
+
} | {
|
|
115
|
+
readonly kind: "cursor";
|
|
116
|
+
readonly cursor: number;
|
|
117
|
+
} | {
|
|
118
|
+
readonly kind: "duplicate";
|
|
119
|
+
readonly seq: number;
|
|
120
|
+
readonly cursor: number;
|
|
121
|
+
} | {
|
|
122
|
+
readonly kind: "out-of-order";
|
|
123
|
+
readonly seq: number;
|
|
124
|
+
readonly expected: number;
|
|
125
|
+
} | {
|
|
126
|
+
readonly kind: "session-mismatch";
|
|
127
|
+
readonly expected: string;
|
|
128
|
+
readonly actual: string;
|
|
129
|
+
} | {
|
|
130
|
+
readonly kind: "late-receipt";
|
|
131
|
+
readonly receipt: "ack" | "nack";
|
|
132
|
+
readonly ackForSeq: number;
|
|
133
|
+
} | {
|
|
134
|
+
readonly kind: "invalid";
|
|
135
|
+
readonly error: string;
|
|
136
|
+
};
|
|
137
|
+
interface WireBridgeAck {
|
|
138
|
+
readonly ackForSeq: number;
|
|
139
|
+
readonly envelope: WireBridgeEnvelope;
|
|
140
|
+
}
|
|
141
|
+
interface WireBridgeNack {
|
|
142
|
+
readonly ackForSeq: number;
|
|
143
|
+
readonly envelope: WireBridgeEnvelope;
|
|
144
|
+
readonly error: unknown;
|
|
145
|
+
}
|
|
146
|
+
interface WireBridgeAttempt {
|
|
147
|
+
readonly seq: number;
|
|
148
|
+
readonly attempt: number;
|
|
149
|
+
readonly maxAttempts: number;
|
|
150
|
+
}
|
|
151
|
+
interface WireBridgeStatus {
|
|
152
|
+
readonly sessionId: string;
|
|
153
|
+
readonly state: "idle" | "started" | "open" | "waiting" | "closed" | "errored" | "exhausted";
|
|
154
|
+
readonly cursor: number;
|
|
155
|
+
readonly nextSeq: number;
|
|
156
|
+
readonly pending: number;
|
|
157
|
+
readonly attempts: number;
|
|
158
|
+
readonly acked: number;
|
|
159
|
+
readonly nacked: number;
|
|
160
|
+
readonly errors: number;
|
|
161
|
+
readonly lastSeq?: number;
|
|
162
|
+
readonly lastDelayMs?: number;
|
|
163
|
+
}
|
|
164
|
+
interface WireBridgeOptions {
|
|
165
|
+
readonly name?: string;
|
|
166
|
+
readonly sessionId: string;
|
|
167
|
+
readonly retry?: RetryPolicy;
|
|
168
|
+
/** Finite D134 ack timeout. Defaults to 30s so pending ack tracking is bounded. */
|
|
169
|
+
readonly ackTimeoutMs?: number;
|
|
170
|
+
readonly now?: () => number;
|
|
171
|
+
}
|
|
172
|
+
interface WireBridgeBundle<TOutbound = unknown, TInbound = unknown> {
|
|
173
|
+
readonly sessionId: string;
|
|
174
|
+
readonly command: Node<WireBridgeCommand<TOutbound>>;
|
|
175
|
+
readonly outbound: Node<WireBridgeEnvelope<TOutbound>>;
|
|
176
|
+
readonly inbound: Node<WireBridgeEnvelope<TInbound>>;
|
|
177
|
+
readonly events: Node<WireBridgeEvent<TOutbound, TInbound>>;
|
|
178
|
+
readonly acks: Node<WireBridgeAck>;
|
|
179
|
+
readonly nacks: Node<WireBridgeNack>;
|
|
180
|
+
readonly status: Node<WireBridgeStatus>;
|
|
181
|
+
readonly errors: Node<unknown>;
|
|
182
|
+
readonly cursor: Node<number>;
|
|
183
|
+
readonly attempts: Node<WireBridgeAttempt>;
|
|
184
|
+
start(): void;
|
|
185
|
+
send(payload: TOutbound, opts?: {
|
|
186
|
+
idempotencyKey?: string;
|
|
187
|
+
requestId?: string;
|
|
188
|
+
}): void;
|
|
189
|
+
ack(ackForSeq: number, opts?: {
|
|
190
|
+
idempotencyKey?: string;
|
|
191
|
+
requestId?: string;
|
|
192
|
+
}): void;
|
|
193
|
+
nack(ackForSeq: number, error: unknown, opts?: {
|
|
194
|
+
idempotencyKey?: string;
|
|
195
|
+
requestId?: string;
|
|
196
|
+
}): void;
|
|
197
|
+
close(reason?: unknown, opts?: {
|
|
198
|
+
idempotencyKey?: string;
|
|
199
|
+
}): void;
|
|
200
|
+
}
|
|
201
|
+
interface RemoteCallRequest<T = unknown> {
|
|
202
|
+
readonly operation: string;
|
|
203
|
+
readonly requestId: string;
|
|
204
|
+
readonly payload: T;
|
|
205
|
+
}
|
|
206
|
+
type RemoteCallResponse<T = unknown> = {
|
|
207
|
+
readonly kind: "result";
|
|
208
|
+
readonly operation: string;
|
|
209
|
+
readonly requestId: string;
|
|
210
|
+
readonly payload: T;
|
|
211
|
+
} | {
|
|
212
|
+
readonly kind: "error";
|
|
213
|
+
readonly operation: string;
|
|
214
|
+
readonly requestId: string;
|
|
215
|
+
readonly error: string;
|
|
216
|
+
} | {
|
|
217
|
+
readonly kind: "status";
|
|
218
|
+
readonly operation: string;
|
|
219
|
+
readonly requestId: string;
|
|
220
|
+
readonly status: string;
|
|
221
|
+
};
|
|
222
|
+
interface RemoteCallResult<T = unknown> {
|
|
223
|
+
readonly operation: string;
|
|
224
|
+
readonly requestId: string;
|
|
225
|
+
readonly payload: T;
|
|
226
|
+
}
|
|
227
|
+
type RemoteCallStatusState = "idle" | "requested" | "responded" | "errored" | "timed-out" | "bridge-errored";
|
|
228
|
+
interface RemoteCallStatus {
|
|
229
|
+
readonly state: RemoteCallStatusState;
|
|
230
|
+
readonly operation?: string;
|
|
231
|
+
readonly requestId?: string;
|
|
232
|
+
readonly pending: number;
|
|
233
|
+
readonly completed: number;
|
|
234
|
+
readonly errors: number;
|
|
235
|
+
readonly timeouts: number;
|
|
236
|
+
}
|
|
237
|
+
interface RemoteCallError {
|
|
238
|
+
readonly operation?: string;
|
|
239
|
+
readonly requestId?: string;
|
|
240
|
+
readonly error: string;
|
|
241
|
+
}
|
|
242
|
+
interface RemoteCallTimeout {
|
|
243
|
+
readonly operation?: string;
|
|
244
|
+
readonly requestId: string;
|
|
245
|
+
readonly error: string;
|
|
246
|
+
}
|
|
247
|
+
interface RemoteCallOptions {
|
|
248
|
+
readonly name?: string;
|
|
249
|
+
}
|
|
250
|
+
interface RemoteCallBundle<TRequest = unknown, TResponse = unknown> {
|
|
251
|
+
readonly responses: Node<RemoteCallResponse<TResponse>>;
|
|
252
|
+
readonly results: Node<RemoteCallResult<TResponse>>;
|
|
253
|
+
readonly status: Node<RemoteCallStatus>;
|
|
254
|
+
readonly errors: Node<RemoteCallError>;
|
|
255
|
+
readonly timeouts: Node<RemoteCallTimeout>;
|
|
256
|
+
call(operation: string, requestId: string, payload: TRequest, opts?: {
|
|
257
|
+
readonly idempotencyKey?: string;
|
|
258
|
+
}): RemoteCallRequest<TRequest>;
|
|
259
|
+
timeout(requestId: string, operation: string | undefined, error: string): RemoteCallTimeout;
|
|
260
|
+
}
|
|
261
|
+
type RemoteResponderHandler<TRequest = unknown, TResponse = unknown> = (request: RemoteCallRequest<TRequest>) => TResponse;
|
|
262
|
+
interface RemoteResponderHandlerDefinition<TRequest = unknown, TResponse = unknown> {
|
|
263
|
+
readonly operation: string;
|
|
264
|
+
readonly handle: RemoteResponderHandler<TRequest, TResponse>;
|
|
265
|
+
}
|
|
266
|
+
type RemoteResponderEvent<TRequest = unknown, TResponse = unknown> = {
|
|
267
|
+
readonly kind: "request";
|
|
268
|
+
readonly request: RemoteCallRequest<TRequest>;
|
|
269
|
+
readonly seq: number;
|
|
270
|
+
} | {
|
|
271
|
+
readonly kind: "response";
|
|
272
|
+
readonly requestId: string;
|
|
273
|
+
readonly operation: string;
|
|
274
|
+
readonly command: WireBridgeCommand<RemoteCallResponse<TResponse>>;
|
|
275
|
+
} | {
|
|
276
|
+
readonly kind: "rejected";
|
|
277
|
+
readonly requestId?: string;
|
|
278
|
+
readonly operation?: string;
|
|
279
|
+
readonly error: string;
|
|
280
|
+
readonly command?: WireBridgeCommand<RemoteCallResponse<TResponse>>;
|
|
281
|
+
} | {
|
|
282
|
+
readonly kind: "invalid";
|
|
283
|
+
readonly error: string;
|
|
284
|
+
};
|
|
285
|
+
type RemoteResponderStatusState = "idle" | "responded" | "rejected" | "errored";
|
|
286
|
+
interface RemoteResponderStatus {
|
|
287
|
+
readonly state: RemoteResponderStatusState;
|
|
288
|
+
readonly operation?: string;
|
|
289
|
+
readonly requestId?: string;
|
|
290
|
+
readonly handled: number;
|
|
291
|
+
readonly rejected: number;
|
|
292
|
+
readonly errors: number;
|
|
293
|
+
}
|
|
294
|
+
interface RemoteResponderOptions<TRequest = unknown, TResponse = unknown> {
|
|
295
|
+
readonly name?: string;
|
|
296
|
+
readonly handlers?: readonly RemoteResponderHandlerDefinition<TRequest, TResponse>[];
|
|
297
|
+
/** Default false: non-owned operations are ignored so multiple responders may share one bridge. */
|
|
298
|
+
readonly rejectUnknown?: boolean;
|
|
299
|
+
}
|
|
300
|
+
interface RemoteResponderBundle<TRequest = unknown, TResponse = unknown> {
|
|
301
|
+
readonly events: Node<RemoteResponderEvent<TRequest, TResponse>>;
|
|
302
|
+
readonly responseCommands: Node<WireBridgeCommand<RemoteCallResponse<TResponse>>>;
|
|
303
|
+
readonly requests: Node<RemoteCallRequest<TRequest>>;
|
|
304
|
+
readonly status: Node<RemoteResponderStatus>;
|
|
305
|
+
readonly errors: Node<RemoteCallError>;
|
|
306
|
+
release(): void;
|
|
307
|
+
}
|
|
308
|
+
/** Stable D134 idempotency key helper scoped to one bridge session and sequence. */
|
|
309
|
+
declare function wireBridgeIdempotencyKey(sessionId: string, seq: number): string;
|
|
310
|
+
/** Create a D134 wire bridge envelope with ordered metadata. */
|
|
311
|
+
declare function wireBridgeEnvelope<TData = unknown>(input: {
|
|
312
|
+
readonly sessionId: string;
|
|
313
|
+
readonly type: WireBridgeEnvelopeType;
|
|
314
|
+
readonly seq: number;
|
|
315
|
+
readonly cursor?: number;
|
|
316
|
+
readonly payload?: WireBridgePayload<TData>;
|
|
317
|
+
readonly idempotencyKey?: string;
|
|
318
|
+
readonly attempt?: number;
|
|
319
|
+
readonly maxAttempts?: number;
|
|
320
|
+
readonly timestampMs?: number;
|
|
321
|
+
readonly ackForSeq?: number;
|
|
322
|
+
readonly requestId?: string;
|
|
323
|
+
}): WireBridgeEnvelope<TData>;
|
|
324
|
+
declare function wireBridge<TOutbound = unknown, TInbound = unknown>(graph: Graph, opts: WireBridgeOptions): WireBridgeBundle<TOutbound, TInbound>;
|
|
325
|
+
/** D147 remote dispatcher call helper over explicit wireBridge request/response facts. */
|
|
326
|
+
declare function remoteCall<TRequest = unknown, TResponse = unknown>(graph: Graph, bridge: WireBridgeBundle<RemoteCallRequest<TRequest>, RemoteCallResponse<TResponse>>, opts?: RemoteCallOptions): RemoteCallBundle<TRequest, TResponse>;
|
|
327
|
+
declare function remoteResponderHandler<TRequest = unknown, TResponse = unknown>(operation: string, handle: RemoteResponderHandler<TRequest, TResponse>): RemoteResponderHandlerDefinition<TRequest, TResponse>;
|
|
328
|
+
/** D147 remote responder over inbound wireBridge request facts and outbound command facts. */
|
|
329
|
+
declare function remoteResponder<TRequest = unknown, TResponse = unknown>(graph: Graph, bridge: WireBridgeBundle<RemoteCallResponse<TResponse>, RemoteCallRequest<TRequest>>, opts?: RemoteResponderOptions<TRequest, TResponse>): RemoteResponderBundle<TRequest, TResponse>;
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Graph-visible outbound environment adapters (D130/D132).
|
|
333
|
+
*
|
|
334
|
+
* Async transport work is confined to graph-local EnvironmentDrivers. Each
|
|
335
|
+
* helper returns declared nodes for events/status/attempts/errors instead of a
|
|
336
|
+
* hidden sink side channel.
|
|
337
|
+
*/
|
|
338
|
+
|
|
339
|
+
type OutboundEvent<TValue, TResult> = {
|
|
340
|
+
readonly kind: "attempt";
|
|
341
|
+
readonly value: TValue;
|
|
342
|
+
readonly attempt: number;
|
|
343
|
+
} | {
|
|
344
|
+
readonly kind: "retry";
|
|
345
|
+
readonly value: TValue;
|
|
346
|
+
readonly attempt: number;
|
|
347
|
+
readonly delayMs: number;
|
|
348
|
+
readonly error: unknown;
|
|
349
|
+
} | {
|
|
350
|
+
readonly kind: "sent";
|
|
351
|
+
readonly value: TValue;
|
|
352
|
+
readonly attempt: number;
|
|
353
|
+
readonly result: TResult;
|
|
354
|
+
} | {
|
|
355
|
+
readonly kind: "failed";
|
|
356
|
+
readonly value: TValue;
|
|
357
|
+
readonly attempt: number;
|
|
358
|
+
readonly error: unknown;
|
|
359
|
+
} | {
|
|
360
|
+
readonly kind: "exhausted";
|
|
361
|
+
readonly value: TValue;
|
|
362
|
+
readonly attempt: number;
|
|
363
|
+
readonly error: unknown;
|
|
364
|
+
} | {
|
|
365
|
+
readonly kind: "upstream-complete";
|
|
366
|
+
} | {
|
|
367
|
+
readonly kind: "upstream-error";
|
|
368
|
+
readonly error: unknown;
|
|
369
|
+
};
|
|
370
|
+
interface OutboundStatus {
|
|
371
|
+
readonly state: "idle" | "running" | "waiting" | "succeeded" | "failed" | "exhausted" | "completed";
|
|
372
|
+
readonly inFlight: number;
|
|
373
|
+
readonly attempt: number;
|
|
374
|
+
readonly sent: number;
|
|
375
|
+
readonly failed: number;
|
|
376
|
+
readonly lastDelayMs?: number;
|
|
377
|
+
}
|
|
378
|
+
interface OutboundBundle<TValue, TResult> {
|
|
379
|
+
readonly events: Node<OutboundEvent<TValue, TResult>>;
|
|
380
|
+
readonly status: Node<OutboundStatus>;
|
|
381
|
+
readonly attempts: Node<number>;
|
|
382
|
+
readonly errors: Node<unknown>;
|
|
383
|
+
}
|
|
384
|
+
interface OutboundAdapterOptions {
|
|
385
|
+
readonly name?: string;
|
|
386
|
+
readonly retry?: RetryPolicy;
|
|
387
|
+
}
|
|
388
|
+
type HttpRequestOf<T> = (value: T) => HttpRequest;
|
|
389
|
+
type ProcessCommandOf<T> = (value: T) => ProcessCommand;
|
|
390
|
+
type WebSocketSendOf<T> = (value: T) => WebSocketSend;
|
|
391
|
+
/** D133 command facts for a graph-visible WebSocket SessionBundle. */
|
|
392
|
+
type WebSocketSessionCommand = {
|
|
393
|
+
readonly kind: "start";
|
|
394
|
+
} | {
|
|
395
|
+
readonly kind: "send";
|
|
396
|
+
readonly message: WebSocketSend;
|
|
397
|
+
} | {
|
|
398
|
+
readonly kind: "close";
|
|
399
|
+
readonly code?: number;
|
|
400
|
+
readonly reason?: string;
|
|
401
|
+
};
|
|
402
|
+
/** Inbound facts emitted by the live WebSocket session connection. */
|
|
403
|
+
type WebSocketSessionInbound = {
|
|
404
|
+
readonly kind: "text";
|
|
405
|
+
readonly data: string;
|
|
406
|
+
} | {
|
|
407
|
+
readonly kind: "binary";
|
|
408
|
+
readonly data: Uint8Array;
|
|
409
|
+
};
|
|
410
|
+
/** Observable lifecycle facts for bounded D133 reconnect/session progress. */
|
|
411
|
+
type WebSocketSessionLifecycle = {
|
|
412
|
+
readonly kind: "starting";
|
|
413
|
+
readonly attempt: number;
|
|
414
|
+
readonly maxAttempts: number;
|
|
415
|
+
} | {
|
|
416
|
+
readonly kind: "open";
|
|
417
|
+
readonly attempt: number;
|
|
418
|
+
} | {
|
|
419
|
+
readonly kind: "sent";
|
|
420
|
+
readonly message: WebSocketSend;
|
|
421
|
+
} | {
|
|
422
|
+
readonly kind: "closing";
|
|
423
|
+
readonly code?: number;
|
|
424
|
+
readonly reason?: string;
|
|
425
|
+
} | {
|
|
426
|
+
readonly kind: "closed";
|
|
427
|
+
readonly code?: number;
|
|
428
|
+
readonly reason?: string;
|
|
429
|
+
} | {
|
|
430
|
+
readonly kind: "retrying";
|
|
431
|
+
readonly attempt: number;
|
|
432
|
+
readonly nextAttempt: number;
|
|
433
|
+
readonly delayMs: number;
|
|
434
|
+
readonly error: unknown;
|
|
435
|
+
} | {
|
|
436
|
+
readonly kind: "exhausted";
|
|
437
|
+
readonly attempt: number;
|
|
438
|
+
readonly error: unknown;
|
|
439
|
+
};
|
|
440
|
+
/** D175 graph-visible outbound disposition for a WebSocket SessionBundle send. */
|
|
441
|
+
type WebSocketSessionOutbound = {
|
|
442
|
+
readonly kind: "queued";
|
|
443
|
+
readonly seq: number;
|
|
444
|
+
readonly message: WebSocketSend;
|
|
445
|
+
} | {
|
|
446
|
+
readonly kind: "sending";
|
|
447
|
+
readonly seq: number;
|
|
448
|
+
readonly message: WebSocketSend;
|
|
449
|
+
} | {
|
|
450
|
+
readonly kind: "sent";
|
|
451
|
+
readonly seq: number;
|
|
452
|
+
readonly message: WebSocketSend;
|
|
453
|
+
} | {
|
|
454
|
+
readonly kind: "rejected";
|
|
455
|
+
readonly seq: number;
|
|
456
|
+
readonly message: WebSocketSend;
|
|
457
|
+
readonly error: unknown;
|
|
458
|
+
} | {
|
|
459
|
+
readonly kind: "canceled";
|
|
460
|
+
readonly seq: number;
|
|
461
|
+
readonly message: WebSocketSend;
|
|
462
|
+
readonly reason: unknown;
|
|
463
|
+
};
|
|
464
|
+
/** Current graph-visible WebSocket session status projection. */
|
|
465
|
+
interface WebSocketSessionStatus {
|
|
466
|
+
readonly state: "idle" | "connecting" | "open" | "closing" | "closed" | "waiting" | "exhausted" | "errored";
|
|
467
|
+
readonly attempt: number;
|
|
468
|
+
readonly maxAttempts: number;
|
|
469
|
+
readonly sent: number;
|
|
470
|
+
readonly received: number;
|
|
471
|
+
readonly errors: number;
|
|
472
|
+
readonly lastDelayMs?: number;
|
|
473
|
+
}
|
|
474
|
+
/** D133 SessionBundle: all session commands, inbound data, attempts, status, and errors are nodes. */
|
|
475
|
+
interface WebSocketSessionBundle {
|
|
476
|
+
readonly command: Node<WebSocketSessionCommand>;
|
|
477
|
+
readonly inbound: Node<WebSocketSessionInbound>;
|
|
478
|
+
readonly lifecycle: Node<WebSocketSessionLifecycle>;
|
|
479
|
+
readonly outbound: Node<WebSocketSessionOutbound>;
|
|
480
|
+
readonly status: Node<WebSocketSessionStatus>;
|
|
481
|
+
readonly errors: Node<unknown>;
|
|
482
|
+
readonly attempts: Node<number>;
|
|
483
|
+
start(): void;
|
|
484
|
+
send(message: WebSocketSend | string | Uint8Array): void;
|
|
485
|
+
close(code?: number, reason?: string): void;
|
|
486
|
+
}
|
|
487
|
+
type WebSocketSessionSendPolicy = {
|
|
488
|
+
readonly kind?: "reject";
|
|
489
|
+
} | {
|
|
490
|
+
readonly kind: "buffer";
|
|
491
|
+
readonly maxPending: number;
|
|
492
|
+
};
|
|
493
|
+
/** Options for the D133 WebSocket SessionBundle; retry is bounded unless configured otherwise. */
|
|
494
|
+
interface WebSocketSessionOptions {
|
|
495
|
+
readonly name?: string;
|
|
496
|
+
readonly retry?: RetryPolicy;
|
|
497
|
+
readonly sendPolicy?: WebSocketSessionSendPolicy;
|
|
498
|
+
}
|
|
499
|
+
/**
|
|
500
|
+
* Create a graph-visible D133 WebSocket SessionBundle.
|
|
501
|
+
*
|
|
502
|
+
* The convenience start/send/close methods publish command facts only; hidden
|
|
503
|
+
* session state is driven by the command node and graph-local EnvironmentDrivers.
|
|
504
|
+
*/
|
|
505
|
+
declare function webSocketSession(graph: Graph, request: WebSocketRequest, opts?: WebSocketSessionOptions): WebSocketSessionBundle;
|
|
506
|
+
declare function toHttp<T>(graph: Graph, source: Node<T>, requestOf: HttpRequestOf<T>, opts?: OutboundAdapterOptions): OutboundBundle<T, HttpResponse>;
|
|
507
|
+
declare function toProcess<T>(graph: Graph, source: Node<T>, commandOf: ProcessCommandOf<T>, opts?: OutboundAdapterOptions): OutboundBundle<T, ProcessResult>;
|
|
508
|
+
declare function toWebSocket<T>(graph: Graph, source: Node<T>, request: WebSocketRequest, sendOf: WebSocketSendOf<T>, opts?: OutboundAdapterOptions): OutboundBundle<T, WebSocketSendResult>;
|
|
509
|
+
|
|
510
|
+
/**
|
|
511
|
+
* Dependency-free NestJS adapter tokens and method metadata.
|
|
512
|
+
*
|
|
513
|
+
* The old compat layer imported `@nestjs/common` for DI decorators. Clean-slate keeps the
|
|
514
|
+
* retainable token/metadata vocabulary here and leaves actual `Inject(...)` composition to
|
|
515
|
+
* user-land NestJS code, so @graphrefly/ts keeps zero framework dependencies (D125/B61).
|
|
516
|
+
*/
|
|
517
|
+
/** Injection token for a root graph singleton. */
|
|
518
|
+
declare const GRAPHREFLY_ROOT_GRAPH: unique symbol;
|
|
519
|
+
/** Injection token for adapter module options. */
|
|
520
|
+
declare const GRAPHREFLY_MODULE_OPTIONS: unique symbol;
|
|
521
|
+
/** Injection token for a request-scoped graph. */
|
|
522
|
+
declare const GRAPHREFLY_REQUEST_GRAPH: unique symbol;
|
|
523
|
+
type DecoratorHostConstructor = abstract new (...args: unknown[]) => unknown;
|
|
524
|
+
type DecoratorBoundMethod = (...args: unknown[]) => unknown;
|
|
525
|
+
interface OnGraphEventMeta {
|
|
526
|
+
nodeName: string;
|
|
527
|
+
methodKey: string | symbol;
|
|
528
|
+
}
|
|
529
|
+
interface GraphIntervalMeta {
|
|
530
|
+
ms: number;
|
|
531
|
+
methodKey: string | symbol;
|
|
532
|
+
}
|
|
533
|
+
interface GraphCronMeta {
|
|
534
|
+
expr: string;
|
|
535
|
+
methodKey: string | symbol;
|
|
536
|
+
}
|
|
537
|
+
declare const EVENT_HANDLERS: Map<DecoratorHostConstructor, OnGraphEventMeta[]>;
|
|
538
|
+
declare const INTERVAL_HANDLERS: Map<DecoratorHostConstructor, GraphIntervalMeta[]>;
|
|
539
|
+
declare const CRON_HANDLERS: Map<DecoratorHostConstructor, GraphCronMeta[]>;
|
|
540
|
+
type GraphMethodDecorator = MethodDecorator & ((value: DecoratorBoundMethod, context: ClassMethodDecoratorContext) => void);
|
|
541
|
+
/** Get the injection token for a named feature graph. */
|
|
542
|
+
declare function getGraphToken(name: string): symbol;
|
|
543
|
+
/** Get the injection token for a node at a qualified path. */
|
|
544
|
+
declare function getNodeToken(path: string): symbol;
|
|
545
|
+
/** Register a method as a DATA-event handler for a graph observe path. */
|
|
546
|
+
declare function OnGraphEvent(nodeName: string): GraphMethodDecorator;
|
|
547
|
+
/** Register fixed-interval metadata for a user-land NestJS scheduler bridge. */
|
|
548
|
+
declare function GraphInterval(ms: number): GraphMethodDecorator;
|
|
549
|
+
/** Register cron metadata for a user-land NestJS scheduler bridge. */
|
|
550
|
+
declare function GraphCron(expr: string): GraphMethodDecorator;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Framework-neutral store adapters.
|
|
554
|
+
*
|
|
555
|
+
* React/Vue/Solid/Svelte/Zustand/Jotai/Nanostores bindings can build on this
|
|
556
|
+
* tiny Node-facing layer without importing framework packages or reviving the
|
|
557
|
+
* old `compat` namespace (D125/B61).
|
|
558
|
+
*/
|
|
559
|
+
|
|
560
|
+
/** A minimal readable store contract shared by Svelte/Nanostores-style adapters. */
|
|
561
|
+
interface ReadableStore<T> {
|
|
562
|
+
get(): T | undefined;
|
|
563
|
+
subscribe(run: (value: T | undefined) => void): () => void;
|
|
564
|
+
}
|
|
565
|
+
/** A minimal writable store contract over a clean-slate writable node. */
|
|
566
|
+
interface WritableStore<T> extends ReadableStore<T> {
|
|
567
|
+
set(value: T): void;
|
|
568
|
+
update(fn: (value: T | undefined) => T): void;
|
|
569
|
+
}
|
|
570
|
+
/** React `useSyncExternalStore`-compatible shape, without importing React. */
|
|
571
|
+
interface ExternalStore<T> {
|
|
572
|
+
getSnapshot(): T | undefined;
|
|
573
|
+
getServerSnapshot(): T | undefined;
|
|
574
|
+
subscribe(onStoreChange: () => void): () => void;
|
|
575
|
+
}
|
|
576
|
+
/** Object-of-nodes factory used by record subscription adapters. */
|
|
577
|
+
type NodeRecordFactory<K extends string, R extends Record<string, unknown>> = (key: K) => {
|
|
578
|
+
[P in keyof R]: Node<R[P]>;
|
|
579
|
+
};
|
|
580
|
+
/** Zustand-compatible store API over a caller-owned clean-slate state node. */
|
|
581
|
+
interface ZustandStoreApi<T extends object> {
|
|
582
|
+
getState(): T;
|
|
583
|
+
setState(partial: T | Partial<T> | ((state: T) => T | Partial<T>), replace?: boolean): void;
|
|
584
|
+
getInitialState(): T;
|
|
585
|
+
subscribe(listener: (state: T, prevState: T) => void): () => void;
|
|
586
|
+
destroy(): void;
|
|
587
|
+
}
|
|
588
|
+
/** Jotai-style atom facade over a caller-owned node. */
|
|
589
|
+
interface JotaiAtom<T> {
|
|
590
|
+
get(): T | undefined;
|
|
591
|
+
subscribe(callback: (value: T | undefined) => void): () => void;
|
|
592
|
+
readonly _node: Node<T>;
|
|
593
|
+
}
|
|
594
|
+
/** Writable Jotai-style atom facade over a caller-owned writable node. */
|
|
595
|
+
interface WritableJotaiAtom<T> extends JotaiAtom<T> {
|
|
596
|
+
set(value: T): void;
|
|
597
|
+
update(fn: (value: T | undefined) => T): void;
|
|
598
|
+
}
|
|
599
|
+
/** Nanostores-style atom facade over a caller-owned node. */
|
|
600
|
+
interface NanoAtom<T> {
|
|
601
|
+
get(): T | undefined;
|
|
602
|
+
subscribe(callback: (value: T | undefined) => void): () => void;
|
|
603
|
+
listen(callback: (value: T | undefined) => void): () => void;
|
|
604
|
+
readonly _node: Node<T>;
|
|
605
|
+
}
|
|
606
|
+
/** Writable Nanostores-style atom facade over a caller-owned writable node. */
|
|
607
|
+
interface WritableNanoAtom<T> extends NanoAtom<T> {
|
|
608
|
+
set(value: T): void;
|
|
609
|
+
update(fn: (value: T | undefined) => T): void;
|
|
610
|
+
}
|
|
611
|
+
/** TC39-Signals-style facade over a caller-owned node. */
|
|
612
|
+
interface SignalLike<T> {
|
|
613
|
+
get(): T | undefined;
|
|
614
|
+
subscribe(callback: (value: T | undefined) => void): () => void;
|
|
615
|
+
readonly _node: Node<T>;
|
|
616
|
+
}
|
|
617
|
+
/** Writable TC39-Signals-style facade over a caller-owned writable node. */
|
|
618
|
+
interface WritableSignalLike<T> extends SignalLike<T> {
|
|
619
|
+
set(value: T): void;
|
|
620
|
+
update(fn: (value: T | undefined) => T): void;
|
|
621
|
+
}
|
|
622
|
+
interface SubscribeValuesOptions<T> {
|
|
623
|
+
/** Emit the current cache snapshot immediately. `undefined` means SENTINEL/no DATA. */
|
|
624
|
+
immediate?: boolean;
|
|
625
|
+
/** Suppress synchronous push-on-subscribe/replay DATA. Useful for change-only store listeners. */
|
|
626
|
+
changesOnly?: boolean;
|
|
627
|
+
onError?: (error: unknown) => void;
|
|
628
|
+
onComplete?: () => void;
|
|
629
|
+
/** Custom cache reader for wrappers that keep their own snapshot object. */
|
|
630
|
+
getSnapshot?: () => T | undefined;
|
|
631
|
+
}
|
|
632
|
+
interface WritableNode<T> extends Node<T> {
|
|
633
|
+
set(value: T): void;
|
|
634
|
+
}
|
|
635
|
+
interface WritableStoreOptions<T> extends SubscribeValuesOptions<T> {
|
|
636
|
+
/** Override writes for adapters that need a framework-owned reducer. */
|
|
637
|
+
write?: (node: WritableNode<T>, value: T) => void;
|
|
638
|
+
}
|
|
639
|
+
/** Read a node cache without activating it. */
|
|
640
|
+
declare function nodeSnapshot<T>(node: Node<T>): T | undefined;
|
|
641
|
+
/**
|
|
642
|
+
* Subscribe to DATA values from a Node. Protocol internals stay below the adapter boundary:
|
|
643
|
+
* DATA drives value listeners, ERROR/COMPLETE route to optional lifecycle callbacks.
|
|
644
|
+
*/
|
|
645
|
+
declare function subscribeNodeValues<T>(node: Node<T>, run: (value: T | undefined) => void, opts?: SubscribeValuesOptions<T>): () => void;
|
|
646
|
+
/** Build a Svelte/Nanostores-style readable store from a clean-slate Node. */
|
|
647
|
+
declare function readableStore<T>(node: Node<T>, opts?: SubscribeValuesOptions<T>): ReadableStore<T>;
|
|
648
|
+
/** Build a writable store over a StateNode or compatible clean-slate writable Node. */
|
|
649
|
+
declare function writableStore<T>(node: WritableNode<T>, opts?: WritableStoreOptions<T>): WritableStore<T>;
|
|
650
|
+
declare function writableStore<T>(node: Node<T>, opts: WritableStoreOptions<T> & {
|
|
651
|
+
write: (node: WritableNode<T>, value: T) => void;
|
|
652
|
+
}): WritableStore<T>;
|
|
653
|
+
/** Build the tiny shape React's `useSyncExternalStore` expects, without importing React. */
|
|
654
|
+
declare function externalStore<T>(node: Node<T>, opts?: Pick<SubscribeValuesOptions<T>, "getSnapshot" | "onError" | "onComplete">): ExternalStore<T>;
|
|
655
|
+
/** Alias for React-facing bindings; dependency-free so React stays a peer of user code. */
|
|
656
|
+
declare const reactExternalStore: typeof externalStore;
|
|
657
|
+
/** Alias for Svelte-style readable stores. */
|
|
658
|
+
declare const svelteReadableStore: typeof readableStore;
|
|
659
|
+
/** Alias for Svelte-style writable stores. */
|
|
660
|
+
declare const svelteWritableStore: typeof writableStore;
|
|
661
|
+
/** Build a framework-neutral keyed record store (the core of old useSubscribeRecord helpers). */
|
|
662
|
+
declare function recordReadableStore<K extends string, R extends Record<string, unknown>>(keysNode: Node<readonly K[]>, factory: NodeRecordFactory<K, R>, opts?: SubscribeValuesOptions<Record<K, R>>): ReadableStore<Record<K, R>>;
|
|
663
|
+
/** Build a Zustand-compatible StoreApi over a caller-owned clean-slate state node. */
|
|
664
|
+
declare function zustandStore<T extends object>(node: WritableNode<T>, initialState?: T, opts?: WritableStoreOptions<T>): ZustandStoreApi<T>;
|
|
665
|
+
declare function zustandStore<T extends object>(node: Node<T>, initialState: T | undefined, opts: WritableStoreOptions<T> & {
|
|
666
|
+
write: (node: WritableNode<T>, value: T) => void;
|
|
667
|
+
}): ZustandStoreApi<T>;
|
|
668
|
+
/** Build a Jotai-style atom facade over a caller-owned node. */
|
|
669
|
+
declare function jotaiAtom<T>(node: WritableNode<T>, opts?: WritableStoreOptions<T>): WritableJotaiAtom<T>;
|
|
670
|
+
declare function jotaiAtom<T>(node: Node<T>, opts?: SubscribeValuesOptions<T>): JotaiAtom<T>;
|
|
671
|
+
/** Build a Nanostores-style atom facade over a caller-owned node. */
|
|
672
|
+
declare function nanoAtom<T>(node: WritableNode<T>, opts?: WritableStoreOptions<T>): WritableNanoAtom<T>;
|
|
673
|
+
declare function nanoAtom<T>(node: Node<T>, opts?: SubscribeValuesOptions<T>): NanoAtom<T>;
|
|
674
|
+
/** Build a TC39-Signals-style facade over a caller-owned node. */
|
|
675
|
+
declare function signalFromNode<T>(node: WritableNode<T>, opts?: WritableStoreOptions<T>): WritableSignalLike<T>;
|
|
676
|
+
declare function signalFromNode<T>(node: Node<T>, opts?: SubscribeValuesOptions<T>): SignalLike<T>;
|
|
677
|
+
|
|
678
|
+
export { CRON_HANDLERS, type DecoratorBoundMethod, type DecoratorHostConstructor, EVENT_HANDLERS, type ExternalStore, GRAPHREFLY_MODULE_OPTIONS, GRAPHREFLY_REQUEST_GRAPH, GRAPHREFLY_ROOT_GRAPH, GraphCron, type GraphCronMeta, GraphInterval, type GraphIntervalMeta, type GraphMethodDecorator, type HttpRequestOf, INTERVAL_HANDLERS, type JotaiAtom, type NanoAtom, type NodeRecordFactory, OnGraphEvent, type OnGraphEventMeta, type OutboundAdapterOptions, type OutboundBundle, type OutboundEvent, type OutboundStatus, type ProcessCommandOf, type ReadableStore, type RemoteCallBundle, type RemoteCallError, type RemoteCallOptions, type RemoteCallRequest, type RemoteCallResponse, type RemoteCallResult, type RemoteCallStatus, type RemoteCallStatusState, type RemoteCallTimeout, type RemoteResponderBundle, type RemoteResponderEvent, type RemoteResponderHandler, type RemoteResponderHandlerDefinition, type RemoteResponderOptions, type RemoteResponderStatus, type RemoteResponderStatusState, type SignalLike, type SubscribeValuesOptions, type WebSocketSendOf, type WebSocketSessionBundle, type WebSocketSessionCommand, type WebSocketSessionInbound, type WebSocketSessionLifecycle, type WebSocketSessionOptions, type WebSocketSessionOutbound, type WebSocketSessionSendPolicy, type WebSocketSessionStatus, type WireBridgeAck, type WireBridgeAttempt, type WireBridgeBundle, type WireBridgeCommand, type WireBridgeEnvelope, type WireBridgeEnvelopeType, type WireBridgeEvent, type WireBridgeMetadata, type WireBridgeNack, type WireBridgeOptions, type WireBridgePayload, type WireBridgeStatus, type WritableJotaiAtom, type WritableNanoAtom, type WritableNode, type WritableSignalLike, type WritableStore, type WritableStoreOptions, type ZustandStoreApi, externalStore, getGraphToken, getNodeToken, jotaiAtom, nanoAtom, nodeSnapshot, reactExternalStore, readableStore, recordReadableStore, remoteCall, remoteResponder, remoteResponderHandler, signalFromNode, subscribeNodeValues, svelteReadableStore, svelteWritableStore, toHttp, toProcess, toWebSocket, webSocketSession, wireBridge, wireBridgeEnvelope, wireBridgeIdempotencyKey, writableStore, zustandStore };
|