@prometheus-ags/entity-graph-core 3.0.5 → 3.1.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/CHANGELOG.md +2 -0
- package/README.md +248 -0
- package/dist/chunk-BE3BMRKF.mjs +938 -0
- package/dist/chunk-BE3BMRKF.mjs.map +1 -0
- package/dist/devtools.cjs +2561 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.d.cts +531 -0
- package/dist/devtools.d.ts +531 -0
- package/dist/devtools.mjs +2019 -0
- package/dist/devtools.mjs.map +1 -0
- package/dist/graph-ClW3HD8B.d.cts +990 -0
- package/dist/graph-ClW3HD8B.d.ts +990 -0
- package/dist/index.cjs +352 -322
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +60 -1059
- package/dist/index.d.ts +60 -1059
- package/dist/index.mjs +45 -917
- package/dist/index.mjs.map +1 -1
- package/fixtures/devtools/README.md +37 -0
- package/fixtures/devtools/entity-inspection-v1.json +304 -0
- package/fixtures/devtools/time-travel-v1.json +110 -0
- package/package.json +25 -1
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
import { s as GraphState, G as GraphStore } from './graph-ClW3HD8B.js';
|
|
2
|
+
import 'zustand/vanilla';
|
|
3
|
+
|
|
4
|
+
/** Stable wire protocol identifier for every DevTools envelope. */
|
|
5
|
+
declare const GRAPH_DEVTOOLS_PROTOCOL: "prometheus.entity-graph.devtools";
|
|
6
|
+
/** Current wire protocol major. Incompatible envelopes must be rejected. */
|
|
7
|
+
declare const GRAPH_DEVTOOLS_PROTOCOL_VERSION: 1;
|
|
8
|
+
type GraphDevtoolsChangeCategory = "entity" | "patch" | "entity-state" | "sync" | "list" | "store";
|
|
9
|
+
type GraphDevtoolsChangeAction = "added" | "updated" | "removed" | "replaced";
|
|
10
|
+
interface GraphDevtoolsCounts {
|
|
11
|
+
entityTypes: number;
|
|
12
|
+
entities: number;
|
|
13
|
+
patchedEntities: number;
|
|
14
|
+
entityStates: number;
|
|
15
|
+
syncMetadata: number;
|
|
16
|
+
lists: number;
|
|
17
|
+
listMemberships: number;
|
|
18
|
+
fetching: number;
|
|
19
|
+
stale: number;
|
|
20
|
+
errors: number;
|
|
21
|
+
}
|
|
22
|
+
interface GraphDevtoolsChange {
|
|
23
|
+
category: GraphDevtoolsChangeCategory;
|
|
24
|
+
action: GraphDevtoolsChangeAction;
|
|
25
|
+
/** Entity type, entity-state key, or list query key. */
|
|
26
|
+
key: string;
|
|
27
|
+
/** Entity id when the change targets one normalized entity. */
|
|
28
|
+
id?: string;
|
|
29
|
+
beforeCount?: number;
|
|
30
|
+
afterCount?: number;
|
|
31
|
+
valueState: "hidden-by-policy" | "included" | "redacted" | "redaction-error" | "truncated";
|
|
32
|
+
/** Omitted under the default metadata-only policy. */
|
|
33
|
+
before?: unknown;
|
|
34
|
+
/** Omitted under the default metadata-only policy. */
|
|
35
|
+
after?: unknown;
|
|
36
|
+
}
|
|
37
|
+
interface GraphDevtoolsCapabilities {
|
|
38
|
+
protocolVersion: typeof GRAPH_DEVTOOLS_PROTOCOL_VERSION;
|
|
39
|
+
metadataOnlyByDefault: true;
|
|
40
|
+
commands: ReadonlyArray<GraphDevtoolsCommandName>;
|
|
41
|
+
features: ReadonlyArray<"semantic-events" | "diagnostic-events" | "bounded-history" | "multi-client" | "multi-store" | "entity-inspection" | "view-inspection" | "relationship-inspection" | "local-preview" | "snapshot-history" | "time-travel" | "history-import">;
|
|
42
|
+
limits: {
|
|
43
|
+
historyEvents: number;
|
|
44
|
+
historyBytes: number;
|
|
45
|
+
eventBytes: number;
|
|
46
|
+
snapshots: number;
|
|
47
|
+
snapshotBytes: number;
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
type GraphDevtoolsSnapshotReference = {
|
|
51
|
+
cursor: number;
|
|
52
|
+
capturedAt: string;
|
|
53
|
+
eventSequence: number | null;
|
|
54
|
+
label?: string;
|
|
55
|
+
status: "retained";
|
|
56
|
+
bytes: number;
|
|
57
|
+
} | {
|
|
58
|
+
cursor: number;
|
|
59
|
+
capturedAt: string;
|
|
60
|
+
eventSequence: number | null;
|
|
61
|
+
label?: string;
|
|
62
|
+
status: "unavailable";
|
|
63
|
+
reason: "retention-disabled" | "capture-failed" | "oversize";
|
|
64
|
+
};
|
|
65
|
+
interface GraphDevtoolsSnapshotHistoryStatus {
|
|
66
|
+
mode: "live" | "rewound";
|
|
67
|
+
cursor: number | null;
|
|
68
|
+
source: "retained" | "import" | null;
|
|
69
|
+
retainedSnapshots: number;
|
|
70
|
+
retainedBytes: number;
|
|
71
|
+
snapshotLimit: number;
|
|
72
|
+
byteLimit: number;
|
|
73
|
+
baselineCursor: number | null;
|
|
74
|
+
oldestCursor: number | null;
|
|
75
|
+
newestCursor: number | null;
|
|
76
|
+
latestCursor: number | null;
|
|
77
|
+
lastUnavailable: Extract<GraphDevtoolsSnapshotReference, {
|
|
78
|
+
status: "unavailable";
|
|
79
|
+
}> | null;
|
|
80
|
+
importCandidate: {
|
|
81
|
+
candidateId: string;
|
|
82
|
+
snapshots: number;
|
|
83
|
+
bytes: number;
|
|
84
|
+
} | null;
|
|
85
|
+
}
|
|
86
|
+
interface GraphDevtoolsEventBase {
|
|
87
|
+
protocol: typeof GRAPH_DEVTOOLS_PROTOCOL;
|
|
88
|
+
version: typeof GRAPH_DEVTOOLS_PROTOCOL_VERSION;
|
|
89
|
+
storeId: string;
|
|
90
|
+
sequence: number;
|
|
91
|
+
eventId: string;
|
|
92
|
+
/** For v1 mutation events one event represents one Zustand publication. */
|
|
93
|
+
correlationId: string;
|
|
94
|
+
observedAt: string;
|
|
95
|
+
}
|
|
96
|
+
interface GraphDevtoolsMutationEvent extends GraphDevtoolsEventBase {
|
|
97
|
+
type: "mutation";
|
|
98
|
+
payload: {
|
|
99
|
+
/** Capture outcome at this publication; later eviction does not rewrite the event. */
|
|
100
|
+
snapshot: GraphDevtoolsSnapshotReference;
|
|
101
|
+
changes: GraphDevtoolsChange[];
|
|
102
|
+
/** Entity identities touched by this exact publication. */
|
|
103
|
+
affectedEntities?: GraphDevtoolsViewMembership[];
|
|
104
|
+
/** Registered views affected at this publication boundary. */
|
|
105
|
+
affectedViewIds?: string[];
|
|
106
|
+
before: GraphDevtoolsCounts;
|
|
107
|
+
after: GraphDevtoolsCounts;
|
|
108
|
+
/** Time spent projecting the already-completed store publication. */
|
|
109
|
+
projectionDurationMs: number;
|
|
110
|
+
valuesTruncated: boolean;
|
|
111
|
+
/** Semantic changes omitted only when metadata itself exceeds the event byte limit. */
|
|
112
|
+
changesOmitted: number;
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
interface GraphDevtoolsLifecycleEvent extends GraphDevtoolsEventBase {
|
|
116
|
+
type: "lifecycle";
|
|
117
|
+
payload: {
|
|
118
|
+
state: "attached" | "client-connected" | "client-disconnected" | "disposed";
|
|
119
|
+
clientId?: string;
|
|
120
|
+
activeClients: number;
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
interface GraphDevtoolsDiagnosticEvent extends GraphDevtoolsEventBase {
|
|
124
|
+
type: "diagnostic";
|
|
125
|
+
payload: {
|
|
126
|
+
code: "projection-failed";
|
|
127
|
+
message: string;
|
|
128
|
+
/** The graph publication is still captured even when semantic projection fails. */
|
|
129
|
+
snapshot: GraphDevtoolsSnapshotReference;
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
interface GraphDevtoolsViewEvent extends GraphDevtoolsEventBase {
|
|
133
|
+
type: "view";
|
|
134
|
+
payload: {
|
|
135
|
+
state: "registered" | "membership-changed" | "unregistered";
|
|
136
|
+
viewId: string;
|
|
137
|
+
membershipCount: number;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
interface GraphDevtoolsTimeTravelEvent extends GraphDevtoolsEventBase {
|
|
141
|
+
type: "time-travel";
|
|
142
|
+
payload: {
|
|
143
|
+
state: "rewound" | "live";
|
|
144
|
+
cursor: number | null;
|
|
145
|
+
previousCursor: number | null;
|
|
146
|
+
source: "retained" | "import" | null;
|
|
147
|
+
previousSource: "retained" | "import" | null;
|
|
148
|
+
reason: "command" | "import" | "mutation";
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
type GraphDevtoolsEvent = GraphDevtoolsMutationEvent | GraphDevtoolsLifecycleEvent | GraphDevtoolsDiagnosticEvent | GraphDevtoolsViewEvent | GraphDevtoolsTimeTravelEvent;
|
|
152
|
+
interface GraphDevtoolsSnapshot {
|
|
153
|
+
protocol: typeof GRAPH_DEVTOOLS_PROTOCOL;
|
|
154
|
+
version: typeof GRAPH_DEVTOOLS_PROTOCOL_VERSION;
|
|
155
|
+
storeId: string;
|
|
156
|
+
capturedAt: string;
|
|
157
|
+
counts: GraphDevtoolsCounts;
|
|
158
|
+
history: GraphDevtoolsHistoryStatus;
|
|
159
|
+
snapshots: GraphDevtoolsSnapshotHistoryStatus;
|
|
160
|
+
}
|
|
161
|
+
interface GraphDevtoolsHistoryStatus {
|
|
162
|
+
retainedEvents: number;
|
|
163
|
+
retainedBytes: number;
|
|
164
|
+
eventLimit: number;
|
|
165
|
+
byteLimit: number;
|
|
166
|
+
oldestSequence: number | null;
|
|
167
|
+
newestSequence: number | null;
|
|
168
|
+
}
|
|
169
|
+
interface GraphDevtoolsEntityError {
|
|
170
|
+
kind: "entity-fetch";
|
|
171
|
+
message: string;
|
|
172
|
+
/** `null` when the graph only retained the compatibility error string. */
|
|
173
|
+
retryable: boolean | null;
|
|
174
|
+
}
|
|
175
|
+
interface GraphDevtoolsEntityDirtyReason {
|
|
176
|
+
kind: "local-patch" | "sync-state";
|
|
177
|
+
field: string | null;
|
|
178
|
+
change: "added" | "changed" | "unsynced";
|
|
179
|
+
}
|
|
180
|
+
interface GraphDevtoolsEntityRecord {
|
|
181
|
+
key: string;
|
|
182
|
+
type: string;
|
|
183
|
+
id: string;
|
|
184
|
+
presence: "present" | "missing-canonical";
|
|
185
|
+
canonical: unknown | null;
|
|
186
|
+
patch: unknown | null;
|
|
187
|
+
merged: unknown | null;
|
|
188
|
+
dirty: boolean;
|
|
189
|
+
dirtyReasons: GraphDevtoolsEntityDirtyReason[];
|
|
190
|
+
entityState: {
|
|
191
|
+
isFetching: boolean;
|
|
192
|
+
lastFetchedAt: string | null;
|
|
193
|
+
stale: boolean;
|
|
194
|
+
error: GraphDevtoolsEntityError | null;
|
|
195
|
+
};
|
|
196
|
+
sync: {
|
|
197
|
+
synced: boolean;
|
|
198
|
+
origin: "server" | "client" | "optimistic";
|
|
199
|
+
updatedAt: string | null;
|
|
200
|
+
};
|
|
201
|
+
/** Store-local revision; increments once per publication that touches this entity. */
|
|
202
|
+
revision: number;
|
|
203
|
+
/** Stable IDs of registered views currently displaying this entity. */
|
|
204
|
+
viewIds: string[];
|
|
205
|
+
}
|
|
206
|
+
interface GraphDevtoolsEntityRecordsSnapshot {
|
|
207
|
+
protocol: typeof GRAPH_DEVTOOLS_PROTOCOL;
|
|
208
|
+
version: typeof GRAPH_DEVTOOLS_PROTOCOL_VERSION;
|
|
209
|
+
storeId: string;
|
|
210
|
+
capturedAt: string;
|
|
211
|
+
entityRecords: GraphDevtoolsEntityRecord[];
|
|
212
|
+
}
|
|
213
|
+
interface GraphDevtoolsViewDefinition {
|
|
214
|
+
viewId: string;
|
|
215
|
+
label: string;
|
|
216
|
+
kind: "entity" | "list";
|
|
217
|
+
entityType: string;
|
|
218
|
+
queryKey?: string | null;
|
|
219
|
+
}
|
|
220
|
+
interface GraphDevtoolsViewMembership {
|
|
221
|
+
type: string;
|
|
222
|
+
id: string;
|
|
223
|
+
}
|
|
224
|
+
interface GraphDevtoolsViewListStats {
|
|
225
|
+
visibleCount: number;
|
|
226
|
+
graphCount: number;
|
|
227
|
+
total: number | null;
|
|
228
|
+
isFetching: boolean;
|
|
229
|
+
isFetchingMore: boolean;
|
|
230
|
+
stale: boolean;
|
|
231
|
+
hasNextPage: boolean;
|
|
232
|
+
hasPreviousPage: boolean;
|
|
233
|
+
}
|
|
234
|
+
interface GraphDevtoolsViewRecord extends GraphDevtoolsViewDefinition {
|
|
235
|
+
queryKey: string | null;
|
|
236
|
+
registeredAt: string;
|
|
237
|
+
lastRenderedAt: string | null;
|
|
238
|
+
renderCount: number;
|
|
239
|
+
/** Active rendered registrations contributing to this view record. */
|
|
240
|
+
subscriberCount: number;
|
|
241
|
+
membership: GraphDevtoolsViewMembership[];
|
|
242
|
+
list: GraphDevtoolsViewListStats | null;
|
|
243
|
+
}
|
|
244
|
+
interface GraphDevtoolsEntityViewMembership extends GraphDevtoolsViewMembership {
|
|
245
|
+
viewIds: string[];
|
|
246
|
+
}
|
|
247
|
+
interface GraphDevtoolsViewsSnapshot {
|
|
248
|
+
protocol: typeof GRAPH_DEVTOOLS_PROTOCOL;
|
|
249
|
+
version: typeof GRAPH_DEVTOOLS_PROTOCOL_VERSION;
|
|
250
|
+
storeId: string;
|
|
251
|
+
capturedAt: string;
|
|
252
|
+
views: GraphDevtoolsViewRecord[];
|
|
253
|
+
entityViewMembership: GraphDevtoolsEntityViewMembership[];
|
|
254
|
+
}
|
|
255
|
+
interface GraphDevtoolsRelationshipEndpoint {
|
|
256
|
+
type: string;
|
|
257
|
+
id: string;
|
|
258
|
+
field?: string | null;
|
|
259
|
+
}
|
|
260
|
+
interface GraphDevtoolsRelationship {
|
|
261
|
+
relation: string;
|
|
262
|
+
cardinality: "belongsTo" | "hasMany" | "manyToMany";
|
|
263
|
+
direction: "outgoing" | "reverse";
|
|
264
|
+
source: GraphDevtoolsRelationshipEndpoint;
|
|
265
|
+
target: GraphDevtoolsRelationshipEndpoint;
|
|
266
|
+
status: "resolved" | "missing-target";
|
|
267
|
+
}
|
|
268
|
+
interface GraphDevtoolsRelationshipsSnapshot {
|
|
269
|
+
protocol: typeof GRAPH_DEVTOOLS_PROTOCOL;
|
|
270
|
+
version: typeof GRAPH_DEVTOOLS_PROTOCOL_VERSION;
|
|
271
|
+
storeId: string;
|
|
272
|
+
capturedAt: string;
|
|
273
|
+
relationships: GraphDevtoolsRelationship[];
|
|
274
|
+
}
|
|
275
|
+
interface GraphDevtoolsPreviewEntityPatchPayload {
|
|
276
|
+
type: string;
|
|
277
|
+
id: string;
|
|
278
|
+
patch: Record<string, unknown>;
|
|
279
|
+
}
|
|
280
|
+
interface GraphDevtoolsRestoreEntityPreviewPayload {
|
|
281
|
+
previewId: string;
|
|
282
|
+
}
|
|
283
|
+
interface GraphDevtoolsRewindPayload {
|
|
284
|
+
cursor: number;
|
|
285
|
+
}
|
|
286
|
+
interface GraphDevtoolsRewindReceipt {
|
|
287
|
+
status: "rewound";
|
|
288
|
+
cursor: number;
|
|
289
|
+
source: "retained";
|
|
290
|
+
previousCursor: number | null;
|
|
291
|
+
previousSource: "retained" | "import" | null;
|
|
292
|
+
changedAt: string;
|
|
293
|
+
}
|
|
294
|
+
interface GraphDevtoolsExpiredHistoryReceipt {
|
|
295
|
+
status: "expired-history";
|
|
296
|
+
cursor: number;
|
|
297
|
+
reason: "evicted" | "cleared" | "unavailable";
|
|
298
|
+
unavailableReason?: Extract<GraphDevtoolsSnapshotReference, {
|
|
299
|
+
status: "unavailable";
|
|
300
|
+
}>["reason"];
|
|
301
|
+
oldestCursor: number | null;
|
|
302
|
+
newestCursor: number | null;
|
|
303
|
+
latestCursor: number | null;
|
|
304
|
+
}
|
|
305
|
+
type GraphDevtoolsRewindResult = GraphDevtoolsRewindReceipt | GraphDevtoolsExpiredHistoryReceipt;
|
|
306
|
+
interface GraphDevtoolsReturnToLiveReceipt {
|
|
307
|
+
status: "live";
|
|
308
|
+
cursor: null;
|
|
309
|
+
previousCursor: number;
|
|
310
|
+
previousSource: "retained" | "import";
|
|
311
|
+
reason: "command";
|
|
312
|
+
changedAt: string;
|
|
313
|
+
}
|
|
314
|
+
type GraphDevtoolsGraphData = Pick<GraphState, "entities" | "patches" | "entityStates" | "syncMetadata" | "lists">;
|
|
315
|
+
interface GraphDevtoolsHistoryImportSnapshot {
|
|
316
|
+
cursor: number;
|
|
317
|
+
capturedAt: string;
|
|
318
|
+
eventSequence: number | null;
|
|
319
|
+
data: GraphDevtoolsGraphData;
|
|
320
|
+
}
|
|
321
|
+
interface GraphDevtoolsHistoryImportEnvelope {
|
|
322
|
+
protocol: typeof GRAPH_DEVTOOLS_PROTOCOL;
|
|
323
|
+
version: typeof GRAPH_DEVTOOLS_PROTOCOL_VERSION;
|
|
324
|
+
storeId: string;
|
|
325
|
+
exportedAt: string;
|
|
326
|
+
snapshots: ReadonlyArray<GraphDevtoolsHistoryImportSnapshot>;
|
|
327
|
+
}
|
|
328
|
+
interface GraphDevtoolsInspectHistoryImportPayload {
|
|
329
|
+
candidate: unknown;
|
|
330
|
+
}
|
|
331
|
+
interface GraphDevtoolsHistoryImportInspectionReceipt {
|
|
332
|
+
status: "awaiting-confirmation";
|
|
333
|
+
candidateId: string;
|
|
334
|
+
storeId: string;
|
|
335
|
+
protocolVersion: typeof GRAPH_DEVTOOLS_PROTOCOL_VERSION;
|
|
336
|
+
inspectedAt: string;
|
|
337
|
+
bytes: number;
|
|
338
|
+
snapshots: ReadonlyArray<{
|
|
339
|
+
cursor: number;
|
|
340
|
+
capturedAt: string;
|
|
341
|
+
eventSequence: number | null;
|
|
342
|
+
bytes: number;
|
|
343
|
+
}>;
|
|
344
|
+
}
|
|
345
|
+
interface GraphDevtoolsHistoryImportRejectedReceipt {
|
|
346
|
+
status: "rejected";
|
|
347
|
+
reason: "invalid-envelope" | "wrong-store" | "unsupported-version" | "snapshot-limit-exceeded" | "byte-limit-exceeded" | "time-travel-unavailable" | "disposed";
|
|
348
|
+
message: string;
|
|
349
|
+
}
|
|
350
|
+
type GraphDevtoolsHistoryImportInspectionResult = GraphDevtoolsHistoryImportInspectionReceipt | GraphDevtoolsHistoryImportRejectedReceipt;
|
|
351
|
+
interface GraphDevtoolsConfirmHistoryImportPayload {
|
|
352
|
+
candidateId: string;
|
|
353
|
+
cursor: number;
|
|
354
|
+
confirm: true;
|
|
355
|
+
}
|
|
356
|
+
interface GraphDevtoolsHistoryImportRestoreReceipt {
|
|
357
|
+
status: "rewound";
|
|
358
|
+
source: "import";
|
|
359
|
+
candidateId: string;
|
|
360
|
+
cursor: number;
|
|
361
|
+
previousCursor: number | null;
|
|
362
|
+
previousSource: "retained" | "import" | null;
|
|
363
|
+
changedAt: string;
|
|
364
|
+
}
|
|
365
|
+
interface GraphDevtoolsHistoryImportRestoreRejectedReceipt {
|
|
366
|
+
status: "rejected";
|
|
367
|
+
reason: "candidate-not-found" | "snapshot-not-found" | "restore-failed" | "time-travel-unavailable" | "disposed";
|
|
368
|
+
message: string;
|
|
369
|
+
}
|
|
370
|
+
type GraphDevtoolsHistoryImportRestoreResult = GraphDevtoolsHistoryImportRestoreReceipt | GraphDevtoolsHistoryImportRestoreRejectedReceipt;
|
|
371
|
+
interface GraphDevtoolsPreviewAppliedReceipt {
|
|
372
|
+
previewId: string;
|
|
373
|
+
entity: {
|
|
374
|
+
type: string;
|
|
375
|
+
id: string;
|
|
376
|
+
};
|
|
377
|
+
priorPatch: unknown | null;
|
|
378
|
+
previewPatch: unknown;
|
|
379
|
+
appliedPatch: unknown;
|
|
380
|
+
baselineRevision: number;
|
|
381
|
+
previewRevision: number;
|
|
382
|
+
appliedAt: string;
|
|
383
|
+
}
|
|
384
|
+
interface GraphDevtoolsPreviewRestoredReceipt {
|
|
385
|
+
previewId: string;
|
|
386
|
+
status: "restored";
|
|
387
|
+
restoredPatch: unknown | null;
|
|
388
|
+
observedRevision: number;
|
|
389
|
+
restoredAt: string;
|
|
390
|
+
}
|
|
391
|
+
interface GraphDevtoolsPreviewConflictReceipt {
|
|
392
|
+
previewId: string;
|
|
393
|
+
status: "conflict";
|
|
394
|
+
reason: "entity-changed-since-preview";
|
|
395
|
+
expectedRevision: number;
|
|
396
|
+
observedRevision: number;
|
|
397
|
+
currentPatch: unknown | null;
|
|
398
|
+
priorPatch: unknown | null;
|
|
399
|
+
}
|
|
400
|
+
type GraphDevtoolsPreviewRestoreReceipt = GraphDevtoolsPreviewRestoredReceipt | GraphDevtoolsPreviewConflictReceipt;
|
|
401
|
+
type GraphDevtoolsCommandName = "get-capabilities" | "get-snapshot" | "get-history" | "get-history-status" | "get-entity-records" | "get-views" | "get-relationships" | "preview-entity-patch" | "restore-entity-preview" | "get-time-travel-status" | "rewind" | "return-to-live" | "inspect-history-import" | "confirm-history-import" | "clear-history";
|
|
402
|
+
interface GraphDevtoolsCommand {
|
|
403
|
+
protocol: typeof GRAPH_DEVTOOLS_PROTOCOL;
|
|
404
|
+
version: typeof GRAPH_DEVTOOLS_PROTOCOL_VERSION;
|
|
405
|
+
requestId: string;
|
|
406
|
+
storeId: string;
|
|
407
|
+
command: GraphDevtoolsCommandName;
|
|
408
|
+
payload?: unknown;
|
|
409
|
+
}
|
|
410
|
+
type GraphDevtoolsResultPayload = GraphDevtoolsCapabilities | GraphDevtoolsSnapshot | GraphDevtoolsHistoryStatus | GraphDevtoolsEntityRecordsSnapshot | GraphDevtoolsViewsSnapshot | GraphDevtoolsRelationshipsSnapshot | GraphDevtoolsPreviewAppliedReceipt | GraphDevtoolsPreviewRestoreReceipt | GraphDevtoolsSnapshotHistoryStatus | GraphDevtoolsRewindResult | GraphDevtoolsReturnToLiveReceipt | GraphDevtoolsHistoryImportInspectionResult | GraphDevtoolsHistoryImportRestoreResult | ReadonlyArray<GraphDevtoolsEvent> | {
|
|
411
|
+
cleared: true;
|
|
412
|
+
};
|
|
413
|
+
type GraphDevtoolsResult = {
|
|
414
|
+
protocol: typeof GRAPH_DEVTOOLS_PROTOCOL;
|
|
415
|
+
version: typeof GRAPH_DEVTOOLS_PROTOCOL_VERSION;
|
|
416
|
+
requestId: string;
|
|
417
|
+
storeId: string;
|
|
418
|
+
ok: true;
|
|
419
|
+
result: GraphDevtoolsResultPayload;
|
|
420
|
+
} | {
|
|
421
|
+
protocol: typeof GRAPH_DEVTOOLS_PROTOCOL;
|
|
422
|
+
version: typeof GRAPH_DEVTOOLS_PROTOCOL_VERSION;
|
|
423
|
+
requestId: string;
|
|
424
|
+
storeId: string;
|
|
425
|
+
ok: false;
|
|
426
|
+
error: {
|
|
427
|
+
code: "invalid-envelope" | "invalid-payload" | "unsupported-version" | "wrong-store" | "unsupported-command" | "entity-not-found" | "preview-not-found" | "snapshot-not-found" | "time-travel-unavailable" | "not-rewound" | "confirmation-required" | "disposed";
|
|
428
|
+
message: string;
|
|
429
|
+
};
|
|
430
|
+
};
|
|
431
|
+
interface GraphDevtoolsValueContext {
|
|
432
|
+
storeId: string;
|
|
433
|
+
category: GraphDevtoolsChangeCategory;
|
|
434
|
+
key: string;
|
|
435
|
+
id?: string;
|
|
436
|
+
/** Empty means the redactor is receiving the whole current change value. */
|
|
437
|
+
fieldPath: ReadonlyArray<string | number>;
|
|
438
|
+
side: "before" | "after";
|
|
439
|
+
destination: "history" | "inspection";
|
|
440
|
+
}
|
|
441
|
+
/** Values never leave the graph under the default metadata-only policy. */
|
|
442
|
+
type GraphDevtoolsValuePolicy = {
|
|
443
|
+
mode?: "metadata-only";
|
|
444
|
+
} | {
|
|
445
|
+
mode: "include";
|
|
446
|
+
redact?: (value: unknown, context: GraphDevtoolsValueContext) => unknown;
|
|
447
|
+
};
|
|
448
|
+
interface GraphDevtoolsTransport {
|
|
449
|
+
request(command: unknown): Promise<GraphDevtoolsResult>;
|
|
450
|
+
subscribe(listener: (event: GraphDevtoolsEvent) => void): () => void;
|
|
451
|
+
close(): void;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
type GraphInspectionState = Pick<GraphState, "entities" | "patches" | "entityStates" | "syncMetadata">;
|
|
455
|
+
/** Project the current entity inspection model without retaining graph values. */
|
|
456
|
+
declare function projectGraphDevtoolsEntityRecords(state: GraphInspectionState, storeId: string, revisions: ReadonlyMap<string, number>, valuePolicy?: GraphDevtoolsValuePolicy, viewIdsByEntity?: ReadonlyMap<string, readonly string[]>): GraphDevtoolsEntityRecordsSnapshot;
|
|
457
|
+
|
|
458
|
+
/** Project relationships exclusively from the existing CRUD schema registry and graph state. */
|
|
459
|
+
declare function projectGraphDevtoolsRelationships(state: GraphState, storeId: string): GraphDevtoolsRelationshipsSnapshot;
|
|
460
|
+
|
|
461
|
+
interface GraphDevtoolsViewRegistration {
|
|
462
|
+
readonly viewId: string;
|
|
463
|
+
updateMembership(entityIds: readonly string[]): void;
|
|
464
|
+
unregister(): void;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
interface AttachGraphDevtoolsOptions {
|
|
468
|
+
/**
|
|
469
|
+
* `false` makes only this attachment a no-op. It never tears down references
|
|
470
|
+
* already held by other attachments to the same store.
|
|
471
|
+
*/
|
|
472
|
+
enabled?: boolean;
|
|
473
|
+
storeId?: string;
|
|
474
|
+
historyLimit?: number;
|
|
475
|
+
historyBytesLimit?: number;
|
|
476
|
+
eventBytesLimit?: number;
|
|
477
|
+
snapshotLimit?: number;
|
|
478
|
+
snapshotBytesLimit?: number;
|
|
479
|
+
values?: GraphDevtoolsValuePolicy;
|
|
480
|
+
}
|
|
481
|
+
interface GraphDevtoolsController {
|
|
482
|
+
readonly storeId: string;
|
|
483
|
+
readonly capabilities: GraphDevtoolsCapabilities;
|
|
484
|
+
getSnapshot(): GraphDevtoolsSnapshot;
|
|
485
|
+
getHistory(): ReadonlyArray<GraphDevtoolsEvent>;
|
|
486
|
+
getHistoryStatus(): GraphDevtoolsHistoryStatus;
|
|
487
|
+
getSnapshotHistoryStatus(): GraphDevtoolsSnapshotHistoryStatus;
|
|
488
|
+
getSnapshotReferences(): ReadonlyArray<Extract<GraphDevtoolsSnapshotReference, {
|
|
489
|
+
status: "retained";
|
|
490
|
+
}>>;
|
|
491
|
+
getCompatibilitySnapshotReferences(): ReadonlyArray<Extract<GraphDevtoolsSnapshotReference, {
|
|
492
|
+
status: "retained";
|
|
493
|
+
}>>;
|
|
494
|
+
captureCompatibilitySnapshot(label?: string): number;
|
|
495
|
+
configureSnapshotLimit(snapshotLimit: number): void;
|
|
496
|
+
subscribeSnapshotHistory(listener: () => void): () => void;
|
|
497
|
+
clearSnapshotHistory(): void;
|
|
498
|
+
getEntityRecords(): GraphDevtoolsEntityRecordsSnapshot;
|
|
499
|
+
getViews(): GraphDevtoolsViewsSnapshot;
|
|
500
|
+
getRelationships(): GraphDevtoolsRelationshipsSnapshot;
|
|
501
|
+
registerView(definition: GraphDevtoolsViewDefinition): GraphDevtoolsViewRegistration;
|
|
502
|
+
rewind(cursor: number): GraphDevtoolsRewindResult | null;
|
|
503
|
+
returnToLive(): GraphDevtoolsReturnToLiveReceipt | null;
|
|
504
|
+
inspectHistoryImport(candidate: unknown): GraphDevtoolsHistoryImportInspectionResult;
|
|
505
|
+
confirmHistoryImport(candidateId: string, cursor: number): GraphDevtoolsHistoryImportRestoreResult;
|
|
506
|
+
clearHistory(): void;
|
|
507
|
+
subscribe(listener: (event: GraphDevtoolsEvent) => void, replay?: boolean): () => void;
|
|
508
|
+
connect(clientId?: string): GraphDevtoolsTransport;
|
|
509
|
+
handleCommand(command: unknown): GraphDevtoolsResult;
|
|
510
|
+
isDisposed(): boolean;
|
|
511
|
+
}
|
|
512
|
+
interface GraphDevtoolsAttachment {
|
|
513
|
+
readonly enabled: boolean;
|
|
514
|
+
readonly controller: GraphDevtoolsController | null;
|
|
515
|
+
detach(): void;
|
|
516
|
+
}
|
|
517
|
+
/** Attach or reference the one DevTools controller owned by `store`. */
|
|
518
|
+
declare function attachGraphDevtools(store: GraphStore, options?: AttachGraphDevtoolsOptions): GraphDevtoolsAttachment;
|
|
519
|
+
/** Return the currently attached controller without changing its lifetime. */
|
|
520
|
+
declare function getGraphDevtoolsController(store: GraphStore): GraphDevtoolsController | null;
|
|
521
|
+
|
|
522
|
+
interface GraphDevtoolsClient {
|
|
523
|
+
readonly storeId: string;
|
|
524
|
+
request(command: GraphDevtoolsCommandName, payload?: unknown): Promise<GraphDevtoolsResult>;
|
|
525
|
+
subscribe(listener: (event: GraphDevtoolsEvent) => void): () => void;
|
|
526
|
+
disconnect(): void;
|
|
527
|
+
}
|
|
528
|
+
/** Protocol client that depends only on a transport, not Zustand or a UI runtime. */
|
|
529
|
+
declare function createGraphDevtoolsClient(storeId: string, transport: GraphDevtoolsTransport): GraphDevtoolsClient;
|
|
530
|
+
|
|
531
|
+
export { type AttachGraphDevtoolsOptions, GRAPH_DEVTOOLS_PROTOCOL, GRAPH_DEVTOOLS_PROTOCOL_VERSION, type GraphDevtoolsAttachment, type GraphDevtoolsCapabilities, type GraphDevtoolsChange, type GraphDevtoolsChangeAction, type GraphDevtoolsChangeCategory, type GraphDevtoolsClient, type GraphDevtoolsCommand, type GraphDevtoolsCommandName, type GraphDevtoolsConfirmHistoryImportPayload, type GraphDevtoolsController, type GraphDevtoolsCounts, type GraphDevtoolsDiagnosticEvent, type GraphDevtoolsEntityDirtyReason, type GraphDevtoolsEntityError, type GraphDevtoolsEntityRecord, type GraphDevtoolsEntityRecordsSnapshot, type GraphDevtoolsEntityViewMembership, type GraphDevtoolsEvent, type GraphDevtoolsExpiredHistoryReceipt, type GraphDevtoolsGraphData, type GraphDevtoolsHistoryImportEnvelope, type GraphDevtoolsHistoryImportInspectionReceipt, type GraphDevtoolsHistoryImportInspectionResult, type GraphDevtoolsHistoryImportRejectedReceipt, type GraphDevtoolsHistoryImportRestoreReceipt, type GraphDevtoolsHistoryImportRestoreRejectedReceipt, type GraphDevtoolsHistoryImportRestoreResult, type GraphDevtoolsHistoryImportSnapshot, type GraphDevtoolsHistoryStatus, type GraphDevtoolsInspectHistoryImportPayload, type GraphDevtoolsLifecycleEvent, type GraphDevtoolsMutationEvent, type GraphDevtoolsPreviewAppliedReceipt, type GraphDevtoolsPreviewConflictReceipt, type GraphDevtoolsPreviewEntityPatchPayload, type GraphDevtoolsPreviewRestoreReceipt, type GraphDevtoolsPreviewRestoredReceipt, type GraphDevtoolsRelationship, type GraphDevtoolsRelationshipEndpoint, type GraphDevtoolsRelationshipsSnapshot, type GraphDevtoolsRestoreEntityPreviewPayload, type GraphDevtoolsResult, type GraphDevtoolsReturnToLiveReceipt, type GraphDevtoolsRewindPayload, type GraphDevtoolsRewindReceipt, type GraphDevtoolsRewindResult, type GraphDevtoolsSnapshot, type GraphDevtoolsSnapshotHistoryStatus, type GraphDevtoolsSnapshotReference, type GraphDevtoolsTimeTravelEvent, type GraphDevtoolsTransport, type GraphDevtoolsValueContext, type GraphDevtoolsValuePolicy, type GraphDevtoolsViewDefinition, type GraphDevtoolsViewEvent, type GraphDevtoolsViewListStats, type GraphDevtoolsViewMembership, type GraphDevtoolsViewRecord, type GraphDevtoolsViewRegistration, type GraphDevtoolsViewsSnapshot, attachGraphDevtools, createGraphDevtoolsClient, getGraphDevtoolsController, projectGraphDevtoolsEntityRecords, projectGraphDevtoolsRelationships };
|