@prometheus-ags/entity-graph-core 3.0.0-alpha.0 → 3.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -0
- package/LICENSE +21 -0
- package/README.md +124 -0
- package/dist/{index.js → index.cjs} +376 -291
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +458 -127
- package/dist/index.d.ts +458 -127
- package/dist/index.mjs +371 -289
- package/dist/index.mjs.map +1 -1
- package/package.json +33 -9
- package/dist/index.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import React from 'react';
|
|
1
|
+
import * as zustand_vanilla from 'zustand/vanilla';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* Typed errors used throughout 2.0 to drive retry policy and consumer
|
|
@@ -140,7 +139,8 @@ declare const EMPTY_SYNC_METADATA: EntitySyncMetadata;
|
|
|
140
139
|
declare const EMPTY_LIST_STATE: ListState;
|
|
141
140
|
/**
|
|
142
141
|
* Canonical Zustand store: **entities** (server truth), **patches** (UI-only overlay), **lists** (id order + list meta), and **entityStates** (per-entity fetch state).
|
|
143
|
-
*
|
|
142
|
+
* Framework bindings subscribe to the vanilla store; stores, adapters, and
|
|
143
|
+
* engines can read it synchronously through `graphStore.getState()`.
|
|
144
144
|
*/
|
|
145
145
|
interface GraphState {
|
|
146
146
|
/** Normalized server-confirmed records. Mutate only via upsert/replace/remove — not from components. */
|
|
@@ -245,11 +245,209 @@ interface GraphState {
|
|
|
245
245
|
*/
|
|
246
246
|
readEntitySnapshot: <T = Record<string, unknown>>(type: EntityType, id: EntityId) => EntitySnapshot<T & Record<string, unknown>> | null;
|
|
247
247
|
}
|
|
248
|
+
/** Creates an isolated, framework-neutral entity graph store. */
|
|
249
|
+
declare function createGraphStore(): Omit<Omit<zustand_vanilla.StoreApi<GraphState>, "subscribe"> & {
|
|
250
|
+
subscribe: {
|
|
251
|
+
(listener: (selectedState: GraphState, previousSelectedState: GraphState) => void): () => void;
|
|
252
|
+
<U>(selector: (state: GraphState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
253
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
254
|
+
fireImmediately?: boolean;
|
|
255
|
+
} | undefined): () => void;
|
|
256
|
+
};
|
|
257
|
+
}, "setState"> & {
|
|
258
|
+
setState(nextStateOrUpdater: GraphState | Partial<GraphState> | ((state: {
|
|
259
|
+
entities: {
|
|
260
|
+
[x: string]: {
|
|
261
|
+
[x: string]: {
|
|
262
|
+
[x: string]: unknown;
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
patches: {
|
|
267
|
+
[x: string]: {
|
|
268
|
+
[x: string]: {
|
|
269
|
+
[x: string]: unknown;
|
|
270
|
+
};
|
|
271
|
+
};
|
|
272
|
+
};
|
|
273
|
+
entityStates: {
|
|
274
|
+
[x: string]: {
|
|
275
|
+
isFetching: boolean;
|
|
276
|
+
lastFetched: number | null;
|
|
277
|
+
error: string | null;
|
|
278
|
+
stale: boolean;
|
|
279
|
+
};
|
|
280
|
+
};
|
|
281
|
+
syncMetadata: {
|
|
282
|
+
[x: string]: {
|
|
283
|
+
synced: boolean;
|
|
284
|
+
origin: SyncOrigin;
|
|
285
|
+
updatedAt: number | null;
|
|
286
|
+
};
|
|
287
|
+
};
|
|
288
|
+
lists: {
|
|
289
|
+
[x: string]: {
|
|
290
|
+
ids: string[];
|
|
291
|
+
total: number | null;
|
|
292
|
+
nextCursor: string | null;
|
|
293
|
+
prevCursor: string | null;
|
|
294
|
+
hasNextPage: boolean;
|
|
295
|
+
hasPrevPage: boolean;
|
|
296
|
+
isFetching: boolean;
|
|
297
|
+
isFetchingMore: boolean;
|
|
298
|
+
error: string | null;
|
|
299
|
+
lastError: {
|
|
300
|
+
kind: "terminal";
|
|
301
|
+
status?: number | undefined;
|
|
302
|
+
name: string;
|
|
303
|
+
message: string;
|
|
304
|
+
stack?: string | undefined;
|
|
305
|
+
cause?: unknown;
|
|
306
|
+
} | {
|
|
307
|
+
kind: "transient";
|
|
308
|
+
status?: number | undefined;
|
|
309
|
+
name: string;
|
|
310
|
+
message: string;
|
|
311
|
+
stack?: string | undefined;
|
|
312
|
+
cause?: unknown;
|
|
313
|
+
} | null;
|
|
314
|
+
lastFetched: number | null;
|
|
315
|
+
stale: boolean;
|
|
316
|
+
currentPage: number | null;
|
|
317
|
+
pageSize: number | null;
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
upsertEntity: (type: EntityType, id: EntityId, data: Record<string, unknown>) => void;
|
|
321
|
+
upsertEntities: (type: EntityType, entries: Array<{
|
|
322
|
+
id: EntityId;
|
|
323
|
+
data: Record<string, unknown>;
|
|
324
|
+
}>) => void;
|
|
325
|
+
replaceEntity: (type: EntityType, id: EntityId, data: Record<string, unknown>) => void;
|
|
326
|
+
removeEntity: (type: EntityType, id: EntityId) => void;
|
|
327
|
+
patchEntity: (type: EntityType, id: EntityId, patch: Record<string, unknown>) => void;
|
|
328
|
+
unpatchEntity: (type: EntityType, id: EntityId, keys: string[]) => void;
|
|
329
|
+
clearPatch: (type: EntityType, id: EntityId) => void;
|
|
330
|
+
setEntityFetching: (type: EntityType, id: EntityId, fetching: boolean) => void;
|
|
331
|
+
setEntityError: (type: EntityType, id: EntityId, error: string | null) => void;
|
|
332
|
+
setEntityFetched: (type: EntityType, id: EntityId) => void;
|
|
333
|
+
setEntityStale: (type: EntityType, id: EntityId, stale: boolean) => void;
|
|
334
|
+
setEntitySyncMetadata: (type: EntityType, id: EntityId, metadata: Partial<EntitySyncMetadata>) => void;
|
|
335
|
+
clearEntitySyncMetadata: (type: EntityType, id: EntityId) => void;
|
|
336
|
+
setListResult: (key: QueryKey, ids: EntityId[], meta: Partial<Omit<ListState, "ids" | "isFetching" | "isFetchingMore" | "error" | "stale">>) => void;
|
|
337
|
+
appendListResult: (key: QueryKey, ids: EntityId[], meta: Partial<Omit<ListState, "ids" | "isFetching" | "isFetchingMore" | "error" | "stale">>) => void;
|
|
338
|
+
prependListResult: (key: QueryKey, ids: EntityId[], meta?: Partial<ListState>) => void;
|
|
339
|
+
removeIdFromAllLists: (type: EntityType, id: EntityId) => void;
|
|
340
|
+
insertIdInList: (key: QueryKey, id: EntityId, position: "start" | "end" | number) => void;
|
|
341
|
+
setListFetching: (key: QueryKey, fetching: boolean) => void;
|
|
342
|
+
setListFetchingMore: (key: QueryKey, fetchingMore: boolean) => void;
|
|
343
|
+
setListError: (key: QueryKey, error: string | null, typed?: EntityError | null) => void;
|
|
344
|
+
setListStale: (key: QueryKey, stale: boolean) => void;
|
|
345
|
+
invalidateEntity: (type: EntityType, id?: EntityId) => void;
|
|
346
|
+
invalidateLists: (matcher: string | ((key: QueryKey) => boolean)) => void;
|
|
347
|
+
invalidateType: (type: EntityType) => void;
|
|
348
|
+
readEntity: <T = Record<string, unknown>>(type: EntityType, id: EntityId) => T | null;
|
|
349
|
+
readEntitySnapshot: <T = Record<string, unknown>>(type: EntityType, id: EntityId) => EntitySnapshot<T & Record<string, unknown>> | null;
|
|
350
|
+
}) => void), shouldReplace?: false): void;
|
|
351
|
+
setState(nextStateOrUpdater: GraphState | ((state: {
|
|
352
|
+
entities: {
|
|
353
|
+
[x: string]: {
|
|
354
|
+
[x: string]: {
|
|
355
|
+
[x: string]: unknown;
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
};
|
|
359
|
+
patches: {
|
|
360
|
+
[x: string]: {
|
|
361
|
+
[x: string]: {
|
|
362
|
+
[x: string]: unknown;
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
entityStates: {
|
|
367
|
+
[x: string]: {
|
|
368
|
+
isFetching: boolean;
|
|
369
|
+
lastFetched: number | null;
|
|
370
|
+
error: string | null;
|
|
371
|
+
stale: boolean;
|
|
372
|
+
};
|
|
373
|
+
};
|
|
374
|
+
syncMetadata: {
|
|
375
|
+
[x: string]: {
|
|
376
|
+
synced: boolean;
|
|
377
|
+
origin: SyncOrigin;
|
|
378
|
+
updatedAt: number | null;
|
|
379
|
+
};
|
|
380
|
+
};
|
|
381
|
+
lists: {
|
|
382
|
+
[x: string]: {
|
|
383
|
+
ids: string[];
|
|
384
|
+
total: number | null;
|
|
385
|
+
nextCursor: string | null;
|
|
386
|
+
prevCursor: string | null;
|
|
387
|
+
hasNextPage: boolean;
|
|
388
|
+
hasPrevPage: boolean;
|
|
389
|
+
isFetching: boolean;
|
|
390
|
+
isFetchingMore: boolean;
|
|
391
|
+
error: string | null;
|
|
392
|
+
lastError: {
|
|
393
|
+
kind: "terminal";
|
|
394
|
+
status?: number | undefined;
|
|
395
|
+
name: string;
|
|
396
|
+
message: string;
|
|
397
|
+
stack?: string | undefined;
|
|
398
|
+
cause?: unknown;
|
|
399
|
+
} | {
|
|
400
|
+
kind: "transient";
|
|
401
|
+
status?: number | undefined;
|
|
402
|
+
name: string;
|
|
403
|
+
message: string;
|
|
404
|
+
stack?: string | undefined;
|
|
405
|
+
cause?: unknown;
|
|
406
|
+
} | null;
|
|
407
|
+
lastFetched: number | null;
|
|
408
|
+
stale: boolean;
|
|
409
|
+
currentPage: number | null;
|
|
410
|
+
pageSize: number | null;
|
|
411
|
+
};
|
|
412
|
+
};
|
|
413
|
+
upsertEntity: (type: EntityType, id: EntityId, data: Record<string, unknown>) => void;
|
|
414
|
+
upsertEntities: (type: EntityType, entries: Array<{
|
|
415
|
+
id: EntityId;
|
|
416
|
+
data: Record<string, unknown>;
|
|
417
|
+
}>) => void;
|
|
418
|
+
replaceEntity: (type: EntityType, id: EntityId, data: Record<string, unknown>) => void;
|
|
419
|
+
removeEntity: (type: EntityType, id: EntityId) => void;
|
|
420
|
+
patchEntity: (type: EntityType, id: EntityId, patch: Record<string, unknown>) => void;
|
|
421
|
+
unpatchEntity: (type: EntityType, id: EntityId, keys: string[]) => void;
|
|
422
|
+
clearPatch: (type: EntityType, id: EntityId) => void;
|
|
423
|
+
setEntityFetching: (type: EntityType, id: EntityId, fetching: boolean) => void;
|
|
424
|
+
setEntityError: (type: EntityType, id: EntityId, error: string | null) => void;
|
|
425
|
+
setEntityFetched: (type: EntityType, id: EntityId) => void;
|
|
426
|
+
setEntityStale: (type: EntityType, id: EntityId, stale: boolean) => void;
|
|
427
|
+
setEntitySyncMetadata: (type: EntityType, id: EntityId, metadata: Partial<EntitySyncMetadata>) => void;
|
|
428
|
+
clearEntitySyncMetadata: (type: EntityType, id: EntityId) => void;
|
|
429
|
+
setListResult: (key: QueryKey, ids: EntityId[], meta: Partial<Omit<ListState, "ids" | "isFetching" | "isFetchingMore" | "error" | "stale">>) => void;
|
|
430
|
+
appendListResult: (key: QueryKey, ids: EntityId[], meta: Partial<Omit<ListState, "ids" | "isFetching" | "isFetchingMore" | "error" | "stale">>) => void;
|
|
431
|
+
prependListResult: (key: QueryKey, ids: EntityId[], meta?: Partial<ListState>) => void;
|
|
432
|
+
removeIdFromAllLists: (type: EntityType, id: EntityId) => void;
|
|
433
|
+
insertIdInList: (key: QueryKey, id: EntityId, position: "start" | "end" | number) => void;
|
|
434
|
+
setListFetching: (key: QueryKey, fetching: boolean) => void;
|
|
435
|
+
setListFetchingMore: (key: QueryKey, fetchingMore: boolean) => void;
|
|
436
|
+
setListError: (key: QueryKey, error: string | null, typed?: EntityError | null) => void;
|
|
437
|
+
setListStale: (key: QueryKey, stale: boolean) => void;
|
|
438
|
+
invalidateEntity: (type: EntityType, id?: EntityId) => void;
|
|
439
|
+
invalidateLists: (matcher: string | ((key: QueryKey) => boolean)) => void;
|
|
440
|
+
invalidateType: (type: EntityType) => void;
|
|
441
|
+
readEntity: <T = Record<string, unknown>>(type: EntityType, id: EntityId) => T | null;
|
|
442
|
+
readEntitySnapshot: <T = Record<string, unknown>>(type: EntityType, id: EntityId) => EntitySnapshot<T & Record<string, unknown>> | null;
|
|
443
|
+
}) => void), shouldReplace: true): void;
|
|
444
|
+
};
|
|
248
445
|
/**
|
|
249
|
-
*
|
|
250
|
-
*
|
|
446
|
+
* Default process-wide entity graph store. Framework bindings subscribe to
|
|
447
|
+
* this vanilla store; non-React consumers use its `getState`, `setState`, and
|
|
448
|
+
* `subscribe` methods directly.
|
|
251
449
|
*/
|
|
252
|
-
declare const
|
|
450
|
+
declare const graphStore: Omit<Omit<zustand_vanilla.StoreApi<GraphState>, "subscribe"> & {
|
|
253
451
|
subscribe: {
|
|
254
452
|
(listener: (selectedState: GraphState, previousSelectedState: GraphState) => void): () => void;
|
|
255
453
|
<U>(selector: (state: GraphState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
@@ -444,7 +642,208 @@ declare const useGraphStore: zustand.UseBoundStore<Omit<Omit<zustand.StoreApi<Gr
|
|
|
444
642
|
readEntity: <T = Record<string, unknown>>(type: EntityType, id: EntityId) => T | null;
|
|
445
643
|
readEntitySnapshot: <T = Record<string, unknown>>(type: EntityType, id: EntityId) => EntitySnapshot<T & Record<string, unknown>> | null;
|
|
446
644
|
}) => void), shouldReplace: true): void;
|
|
447
|
-
}
|
|
645
|
+
};
|
|
646
|
+
type GraphStore$1 = ReturnType<typeof createGraphStore>;
|
|
647
|
+
/**
|
|
648
|
+
* @deprecated Import `graphStore` from core, or `useGraphStore` from the React
|
|
649
|
+
* binding. This StoreApi-shaped alias remains for non-React 2.x migrations.
|
|
650
|
+
*/
|
|
651
|
+
declare const useGraphStore: Omit<Omit<zustand_vanilla.StoreApi<GraphState>, "subscribe"> & {
|
|
652
|
+
subscribe: {
|
|
653
|
+
(listener: (selectedState: GraphState, previousSelectedState: GraphState) => void): () => void;
|
|
654
|
+
<U>(selector: (state: GraphState) => U, listener: (selectedState: U, previousSelectedState: U) => void, options?: {
|
|
655
|
+
equalityFn?: ((a: U, b: U) => boolean) | undefined;
|
|
656
|
+
fireImmediately?: boolean;
|
|
657
|
+
} | undefined): () => void;
|
|
658
|
+
};
|
|
659
|
+
}, "setState"> & {
|
|
660
|
+
setState(nextStateOrUpdater: GraphState | Partial<GraphState> | ((state: {
|
|
661
|
+
entities: {
|
|
662
|
+
[x: string]: {
|
|
663
|
+
[x: string]: {
|
|
664
|
+
[x: string]: unknown;
|
|
665
|
+
};
|
|
666
|
+
};
|
|
667
|
+
};
|
|
668
|
+
patches: {
|
|
669
|
+
[x: string]: {
|
|
670
|
+
[x: string]: {
|
|
671
|
+
[x: string]: unknown;
|
|
672
|
+
};
|
|
673
|
+
};
|
|
674
|
+
};
|
|
675
|
+
entityStates: {
|
|
676
|
+
[x: string]: {
|
|
677
|
+
isFetching: boolean;
|
|
678
|
+
lastFetched: number | null;
|
|
679
|
+
error: string | null;
|
|
680
|
+
stale: boolean;
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
syncMetadata: {
|
|
684
|
+
[x: string]: {
|
|
685
|
+
synced: boolean;
|
|
686
|
+
origin: SyncOrigin;
|
|
687
|
+
updatedAt: number | null;
|
|
688
|
+
};
|
|
689
|
+
};
|
|
690
|
+
lists: {
|
|
691
|
+
[x: string]: {
|
|
692
|
+
ids: string[];
|
|
693
|
+
total: number | null;
|
|
694
|
+
nextCursor: string | null;
|
|
695
|
+
prevCursor: string | null;
|
|
696
|
+
hasNextPage: boolean;
|
|
697
|
+
hasPrevPage: boolean;
|
|
698
|
+
isFetching: boolean;
|
|
699
|
+
isFetchingMore: boolean;
|
|
700
|
+
error: string | null;
|
|
701
|
+
lastError: {
|
|
702
|
+
kind: "terminal";
|
|
703
|
+
status?: number | undefined;
|
|
704
|
+
name: string;
|
|
705
|
+
message: string;
|
|
706
|
+
stack?: string | undefined;
|
|
707
|
+
cause?: unknown;
|
|
708
|
+
} | {
|
|
709
|
+
kind: "transient";
|
|
710
|
+
status?: number | undefined;
|
|
711
|
+
name: string;
|
|
712
|
+
message: string;
|
|
713
|
+
stack?: string | undefined;
|
|
714
|
+
cause?: unknown;
|
|
715
|
+
} | null;
|
|
716
|
+
lastFetched: number | null;
|
|
717
|
+
stale: boolean;
|
|
718
|
+
currentPage: number | null;
|
|
719
|
+
pageSize: number | null;
|
|
720
|
+
};
|
|
721
|
+
};
|
|
722
|
+
upsertEntity: (type: EntityType, id: EntityId, data: Record<string, unknown>) => void;
|
|
723
|
+
upsertEntities: (type: EntityType, entries: Array<{
|
|
724
|
+
id: EntityId;
|
|
725
|
+
data: Record<string, unknown>;
|
|
726
|
+
}>) => void;
|
|
727
|
+
replaceEntity: (type: EntityType, id: EntityId, data: Record<string, unknown>) => void;
|
|
728
|
+
removeEntity: (type: EntityType, id: EntityId) => void;
|
|
729
|
+
patchEntity: (type: EntityType, id: EntityId, patch: Record<string, unknown>) => void;
|
|
730
|
+
unpatchEntity: (type: EntityType, id: EntityId, keys: string[]) => void;
|
|
731
|
+
clearPatch: (type: EntityType, id: EntityId) => void;
|
|
732
|
+
setEntityFetching: (type: EntityType, id: EntityId, fetching: boolean) => void;
|
|
733
|
+
setEntityError: (type: EntityType, id: EntityId, error: string | null) => void;
|
|
734
|
+
setEntityFetched: (type: EntityType, id: EntityId) => void;
|
|
735
|
+
setEntityStale: (type: EntityType, id: EntityId, stale: boolean) => void;
|
|
736
|
+
setEntitySyncMetadata: (type: EntityType, id: EntityId, metadata: Partial<EntitySyncMetadata>) => void;
|
|
737
|
+
clearEntitySyncMetadata: (type: EntityType, id: EntityId) => void;
|
|
738
|
+
setListResult: (key: QueryKey, ids: EntityId[], meta: Partial<Omit<ListState, "ids" | "isFetching" | "isFetchingMore" | "error" | "stale">>) => void;
|
|
739
|
+
appendListResult: (key: QueryKey, ids: EntityId[], meta: Partial<Omit<ListState, "ids" | "isFetching" | "isFetchingMore" | "error" | "stale">>) => void;
|
|
740
|
+
prependListResult: (key: QueryKey, ids: EntityId[], meta?: Partial<ListState>) => void;
|
|
741
|
+
removeIdFromAllLists: (type: EntityType, id: EntityId) => void;
|
|
742
|
+
insertIdInList: (key: QueryKey, id: EntityId, position: "start" | "end" | number) => void;
|
|
743
|
+
setListFetching: (key: QueryKey, fetching: boolean) => void;
|
|
744
|
+
setListFetchingMore: (key: QueryKey, fetchingMore: boolean) => void;
|
|
745
|
+
setListError: (key: QueryKey, error: string | null, typed?: EntityError | null) => void;
|
|
746
|
+
setListStale: (key: QueryKey, stale: boolean) => void;
|
|
747
|
+
invalidateEntity: (type: EntityType, id?: EntityId) => void;
|
|
748
|
+
invalidateLists: (matcher: string | ((key: QueryKey) => boolean)) => void;
|
|
749
|
+
invalidateType: (type: EntityType) => void;
|
|
750
|
+
readEntity: <T = Record<string, unknown>>(type: EntityType, id: EntityId) => T | null;
|
|
751
|
+
readEntitySnapshot: <T = Record<string, unknown>>(type: EntityType, id: EntityId) => EntitySnapshot<T & Record<string, unknown>> | null;
|
|
752
|
+
}) => void), shouldReplace?: false): void;
|
|
753
|
+
setState(nextStateOrUpdater: GraphState | ((state: {
|
|
754
|
+
entities: {
|
|
755
|
+
[x: string]: {
|
|
756
|
+
[x: string]: {
|
|
757
|
+
[x: string]: unknown;
|
|
758
|
+
};
|
|
759
|
+
};
|
|
760
|
+
};
|
|
761
|
+
patches: {
|
|
762
|
+
[x: string]: {
|
|
763
|
+
[x: string]: {
|
|
764
|
+
[x: string]: unknown;
|
|
765
|
+
};
|
|
766
|
+
};
|
|
767
|
+
};
|
|
768
|
+
entityStates: {
|
|
769
|
+
[x: string]: {
|
|
770
|
+
isFetching: boolean;
|
|
771
|
+
lastFetched: number | null;
|
|
772
|
+
error: string | null;
|
|
773
|
+
stale: boolean;
|
|
774
|
+
};
|
|
775
|
+
};
|
|
776
|
+
syncMetadata: {
|
|
777
|
+
[x: string]: {
|
|
778
|
+
synced: boolean;
|
|
779
|
+
origin: SyncOrigin;
|
|
780
|
+
updatedAt: number | null;
|
|
781
|
+
};
|
|
782
|
+
};
|
|
783
|
+
lists: {
|
|
784
|
+
[x: string]: {
|
|
785
|
+
ids: string[];
|
|
786
|
+
total: number | null;
|
|
787
|
+
nextCursor: string | null;
|
|
788
|
+
prevCursor: string | null;
|
|
789
|
+
hasNextPage: boolean;
|
|
790
|
+
hasPrevPage: boolean;
|
|
791
|
+
isFetching: boolean;
|
|
792
|
+
isFetchingMore: boolean;
|
|
793
|
+
error: string | null;
|
|
794
|
+
lastError: {
|
|
795
|
+
kind: "terminal";
|
|
796
|
+
status?: number | undefined;
|
|
797
|
+
name: string;
|
|
798
|
+
message: string;
|
|
799
|
+
stack?: string | undefined;
|
|
800
|
+
cause?: unknown;
|
|
801
|
+
} | {
|
|
802
|
+
kind: "transient";
|
|
803
|
+
status?: number | undefined;
|
|
804
|
+
name: string;
|
|
805
|
+
message: string;
|
|
806
|
+
stack?: string | undefined;
|
|
807
|
+
cause?: unknown;
|
|
808
|
+
} | null;
|
|
809
|
+
lastFetched: number | null;
|
|
810
|
+
stale: boolean;
|
|
811
|
+
currentPage: number | null;
|
|
812
|
+
pageSize: number | null;
|
|
813
|
+
};
|
|
814
|
+
};
|
|
815
|
+
upsertEntity: (type: EntityType, id: EntityId, data: Record<string, unknown>) => void;
|
|
816
|
+
upsertEntities: (type: EntityType, entries: Array<{
|
|
817
|
+
id: EntityId;
|
|
818
|
+
data: Record<string, unknown>;
|
|
819
|
+
}>) => void;
|
|
820
|
+
replaceEntity: (type: EntityType, id: EntityId, data: Record<string, unknown>) => void;
|
|
821
|
+
removeEntity: (type: EntityType, id: EntityId) => void;
|
|
822
|
+
patchEntity: (type: EntityType, id: EntityId, patch: Record<string, unknown>) => void;
|
|
823
|
+
unpatchEntity: (type: EntityType, id: EntityId, keys: string[]) => void;
|
|
824
|
+
clearPatch: (type: EntityType, id: EntityId) => void;
|
|
825
|
+
setEntityFetching: (type: EntityType, id: EntityId, fetching: boolean) => void;
|
|
826
|
+
setEntityError: (type: EntityType, id: EntityId, error: string | null) => void;
|
|
827
|
+
setEntityFetched: (type: EntityType, id: EntityId) => void;
|
|
828
|
+
setEntityStale: (type: EntityType, id: EntityId, stale: boolean) => void;
|
|
829
|
+
setEntitySyncMetadata: (type: EntityType, id: EntityId, metadata: Partial<EntitySyncMetadata>) => void;
|
|
830
|
+
clearEntitySyncMetadata: (type: EntityType, id: EntityId) => void;
|
|
831
|
+
setListResult: (key: QueryKey, ids: EntityId[], meta: Partial<Omit<ListState, "ids" | "isFetching" | "isFetchingMore" | "error" | "stale">>) => void;
|
|
832
|
+
appendListResult: (key: QueryKey, ids: EntityId[], meta: Partial<Omit<ListState, "ids" | "isFetching" | "isFetchingMore" | "error" | "stale">>) => void;
|
|
833
|
+
prependListResult: (key: QueryKey, ids: EntityId[], meta?: Partial<ListState>) => void;
|
|
834
|
+
removeIdFromAllLists: (type: EntityType, id: EntityId) => void;
|
|
835
|
+
insertIdInList: (key: QueryKey, id: EntityId, position: "start" | "end" | number) => void;
|
|
836
|
+
setListFetching: (key: QueryKey, fetching: boolean) => void;
|
|
837
|
+
setListFetchingMore: (key: QueryKey, fetchingMore: boolean) => void;
|
|
838
|
+
setListError: (key: QueryKey, error: string | null, typed?: EntityError | null) => void;
|
|
839
|
+
setListStale: (key: QueryKey, stale: boolean) => void;
|
|
840
|
+
invalidateEntity: (type: EntityType, id?: EntityId) => void;
|
|
841
|
+
invalidateLists: (matcher: string | ((key: QueryKey) => boolean)) => void;
|
|
842
|
+
invalidateType: (type: EntityType) => void;
|
|
843
|
+
readEntity: <T = Record<string, unknown>>(type: EntityType, id: EntityId) => T | null;
|
|
844
|
+
readEntitySnapshot: <T = Record<string, unknown>>(type: EntityType, id: EntityId) => EntitySnapshot<T & Record<string, unknown>> | null;
|
|
845
|
+
}) => void), shouldReplace: true): void;
|
|
846
|
+
};
|
|
448
847
|
|
|
449
848
|
/**
|
|
450
849
|
* Compiles a {@link FilterSpec} into a Prisma `where` object (plain JSON-serializable shape).
|
|
@@ -906,6 +1305,9 @@ declare function hasMergeStrategy(type: string): boolean;
|
|
|
906
1305
|
* contract), keeping per-write resolution off the async path.
|
|
907
1306
|
*/
|
|
908
1307
|
|
|
1308
|
+
type LoroModuleLoader = () => Promise<{
|
|
1309
|
+
LoroDoc: unknown;
|
|
1310
|
+
}>;
|
|
909
1311
|
/**
|
|
910
1312
|
* Build a Loro-backed {@link MergeStrategy}. Resolves `loro-crdt` lazily; throws
|
|
911
1313
|
* a clear error if the optional peer is not installed.
|
|
@@ -916,7 +1318,7 @@ declare function hasMergeStrategy(type: string): boolean;
|
|
|
916
1318
|
* registerMergeStrategy("Document", loro);
|
|
917
1319
|
* ```
|
|
918
1320
|
*/
|
|
919
|
-
declare function createLoroMergeStrategy(): Promise<MergeStrategy>;
|
|
1321
|
+
declare function createLoroMergeStrategy(loadLoro?: LoroModuleLoader): Promise<MergeStrategy>;
|
|
920
1322
|
|
|
921
1323
|
type GraphStore = ReturnType<typeof useGraphStore.getState>;
|
|
922
1324
|
type GraphIncludeMap = Record<string, GraphIncludeRelation>;
|
|
@@ -967,11 +1369,11 @@ declare function queryOnce<TEntity extends object>(opts: GraphQueryOptions<TEnti
|
|
|
967
1369
|
declare const selectGraph: typeof queryOnce;
|
|
968
1370
|
|
|
969
1371
|
interface GraphDataSnapshot {
|
|
970
|
-
entities: ReturnType<typeof
|
|
971
|
-
patches: ReturnType<typeof
|
|
972
|
-
entityStates: ReturnType<typeof
|
|
973
|
-
syncMetadata: ReturnType<typeof
|
|
974
|
-
lists: ReturnType<typeof
|
|
1372
|
+
entities: ReturnType<typeof graphStore.getState>["entities"];
|
|
1373
|
+
patches: ReturnType<typeof graphStore.getState>["patches"];
|
|
1374
|
+
entityStates: ReturnType<typeof graphStore.getState>["entityStates"];
|
|
1375
|
+
syncMetadata: ReturnType<typeof graphStore.getState>["syncMetadata"];
|
|
1376
|
+
lists: ReturnType<typeof graphStore.getState>["lists"];
|
|
975
1377
|
}
|
|
976
1378
|
interface GraphTransaction {
|
|
977
1379
|
upsertEntity: (type: EntityType, id: EntityId, data: Record<string, unknown>) => GraphTransaction;
|
|
@@ -1008,7 +1410,7 @@ type GraphActionEvent = {
|
|
|
1008
1410
|
type: "settled";
|
|
1009
1411
|
record: GraphActionRecord$1;
|
|
1010
1412
|
};
|
|
1011
|
-
declare function createGraphTransaction(): GraphTransaction;
|
|
1413
|
+
declare function createGraphTransaction(storeApi?: GraphStore$1): GraphTransaction;
|
|
1012
1414
|
declare function createGraphAction<TInput, TResult>(opts: GraphActionOptions<TInput, TResult>): (input: TInput) => Promise<TResult>;
|
|
1013
1415
|
|
|
1014
1416
|
interface GraphEffectEvent<T> {
|
|
@@ -1132,22 +1534,24 @@ interface GraphSyncStatus {
|
|
|
1132
1534
|
interface GraphSnapshotPayload {
|
|
1133
1535
|
version: 1;
|
|
1134
1536
|
snapshot: {
|
|
1135
|
-
entities: ReturnType<typeof
|
|
1136
|
-
patches: ReturnType<typeof
|
|
1137
|
-
entityStates: ReturnType<typeof
|
|
1138
|
-
syncMetadata: ReturnType<typeof
|
|
1139
|
-
lists: ReturnType<typeof
|
|
1537
|
+
entities: ReturnType<typeof graphStore.getState>["entities"];
|
|
1538
|
+
patches: ReturnType<typeof graphStore.getState>["patches"];
|
|
1539
|
+
entityStates: ReturnType<typeof graphStore.getState>["entityStates"];
|
|
1540
|
+
syncMetadata: ReturnType<typeof graphStore.getState>["syncMetadata"];
|
|
1541
|
+
lists: ReturnType<typeof graphStore.getState>["lists"];
|
|
1140
1542
|
};
|
|
1141
1543
|
pendingActions: GraphActionRecord[];
|
|
1142
1544
|
}
|
|
1143
1545
|
interface PersistGraphToStorageOptions {
|
|
1144
1546
|
storage: GraphPersistenceAdapter;
|
|
1145
1547
|
key: string;
|
|
1548
|
+
store?: GraphStore$1;
|
|
1146
1549
|
pendingActions?: GraphActionRecord[];
|
|
1147
1550
|
}
|
|
1148
1551
|
interface HydrateGraphFromStorageOptions {
|
|
1149
1552
|
storage: GraphPersistenceAdapter;
|
|
1150
1553
|
key: string;
|
|
1554
|
+
store?: GraphStore$1;
|
|
1151
1555
|
}
|
|
1152
1556
|
/**
|
|
1153
1557
|
* Retry-with-backoff policy for replaying pending offline actions.
|
|
@@ -1171,6 +1575,7 @@ interface ReplayRetryPolicy {
|
|
|
1171
1575
|
}
|
|
1172
1576
|
interface StartLocalFirstGraphOptions {
|
|
1173
1577
|
storage: GraphPersistenceAdapter;
|
|
1578
|
+
store?: GraphStore$1;
|
|
1174
1579
|
key?: string;
|
|
1175
1580
|
replayPendingActions?: boolean;
|
|
1176
1581
|
onlineSource?: {
|
|
@@ -1188,7 +1593,11 @@ interface LocalFirstGraphRuntime {
|
|
|
1188
1593
|
hydrate: () => Promise<Awaited<ReturnType<typeof hydrateGraphFromStorage>>>;
|
|
1189
1594
|
getStatus: () => GraphSyncStatus;
|
|
1190
1595
|
}
|
|
1191
|
-
declare
|
|
1596
|
+
declare const graphSyncStatusStore: zustand_vanilla.StoreApi<{
|
|
1597
|
+
status: GraphSyncStatus;
|
|
1598
|
+
setStatus: (status: Partial<GraphSyncStatus>) => void;
|
|
1599
|
+
}>;
|
|
1600
|
+
declare function getGraphSyncStatus(): GraphSyncStatus;
|
|
1192
1601
|
declare function persistGraphToStorage(opts: PersistGraphToStorageOptions): Promise<{
|
|
1193
1602
|
ok: true;
|
|
1194
1603
|
key: string;
|
|
@@ -1226,7 +1635,7 @@ interface ResolvedRetryPolicy {
|
|
|
1226
1635
|
* action goes to "poison" — the optional handler is invoked and the function
|
|
1227
1636
|
* resolves. Exposed for unit testing.
|
|
1228
1637
|
*/
|
|
1229
|
-
declare function replayActionWithRetry(action: GraphActionRecord, policy: ResolvedRetryPolicy): Promise<{
|
|
1638
|
+
declare function replayActionWithRetry(action: GraphActionRecord, policy: ResolvedRetryPolicy, storeApi?: GraphStore$1): Promise<{
|
|
1230
1639
|
ok: true;
|
|
1231
1640
|
} | {
|
|
1232
1641
|
ok: false;
|
|
@@ -1259,7 +1668,7 @@ interface EntityQueryOptions<TRaw, TEntity extends object> {
|
|
|
1259
1668
|
fetch: (id: EntityId) => Promise<TRaw>;
|
|
1260
1669
|
normalize: (raw: TRaw) => TEntity;
|
|
1261
1670
|
idField?: string;
|
|
1262
|
-
sideEffects?: (raw: TRaw, store:
|
|
1671
|
+
sideEffects?: (raw: TRaw, store: GraphStore$1) => void;
|
|
1263
1672
|
staleTime?: number;
|
|
1264
1673
|
enabled?: boolean;
|
|
1265
1674
|
onSuccess?: (entity: TEntity) => void;
|
|
@@ -1304,7 +1713,7 @@ interface ListQueryOptions<TRaw, TEntity extends object> {
|
|
|
1304
1713
|
id: EntityId;
|
|
1305
1714
|
data: TEntity;
|
|
1306
1715
|
};
|
|
1307
|
-
sideEffects?: (items: TRaw[], store:
|
|
1716
|
+
sideEffects?: (items: TRaw[], store: GraphStore$1) => void;
|
|
1308
1717
|
mode?: "replace" | "append";
|
|
1309
1718
|
staleTime?: number;
|
|
1310
1719
|
enabled?: boolean;
|
|
@@ -1321,21 +1730,21 @@ declare function serializeKey(key: unknown[]): string;
|
|
|
1321
1730
|
* @param key - Logical dedupe key (e.g. `type:id` or serialized list key)
|
|
1322
1731
|
* @param fn - Async work that performs the fetch + graph writes
|
|
1323
1732
|
*/
|
|
1324
|
-
declare function dedupe<T>(key: string, fn: () => Promise<T
|
|
1733
|
+
declare function dedupe<T>(key: string, fn: () => Promise<T>, store?: GraphStore$1): Promise<T>;
|
|
1325
1734
|
/**
|
|
1326
1735
|
* Ref-count graph interest for a subscriber key (`${type}:${id}`). Background revalidation skips keys with zero subscribers.
|
|
1327
1736
|
* @returns Opaque token required for `unregisterSubscriber`
|
|
1328
1737
|
*/
|
|
1329
|
-
declare function registerSubscriber(key: string): symbol;
|
|
1738
|
+
declare function registerSubscriber(key: string, store?: GraphStore$1): symbol;
|
|
1330
1739
|
/** Pair with `registerSubscriber` on unmount so idle entities stop refetching. */
|
|
1331
|
-
declare function unregisterSubscriber(key: string, token: symbol): void;
|
|
1740
|
+
declare function unregisterSubscriber(key: string, token: symbol, store?: GraphStore$1): void;
|
|
1332
1741
|
/**
|
|
1333
1742
|
* Subscribe to ref-count changes for `registerSubscriber` / `unregisterSubscriber`.
|
|
1334
1743
|
* Used by `useGraphDevTools` so subscriber totals update without graph mutations.
|
|
1335
1744
|
*/
|
|
1336
1745
|
declare function subscribeSubscriberStats(onChange: () => void): () => boolean;
|
|
1337
1746
|
/** Total active entity subscriber tokens across all keys (sum of ref-counts). */
|
|
1338
|
-
declare function getActiveSubscriberCount(): number;
|
|
1747
|
+
declare function getActiveSubscriberCount(store?: GraphStore$1): number;
|
|
1339
1748
|
/**
|
|
1340
1749
|
* Discriminated union of devtools events.
|
|
1341
1750
|
*
|
|
@@ -1388,15 +1797,15 @@ type DevtoolsListener = (event: DevtoolsEvent) => void;
|
|
|
1388
1797
|
*/
|
|
1389
1798
|
declare function subscribeDevtoolsEvent(cb: DevtoolsListener): () => void;
|
|
1390
1799
|
/**
|
|
1391
|
-
* Stops the periodic garbage-collection timer
|
|
1800
|
+
* Stops the periodic garbage-collection timer for the selected graph.
|
|
1392
1801
|
*/
|
|
1393
|
-
declare function stopGarbageCollector(): void;
|
|
1802
|
+
declare function stopGarbageCollector(storeApi?: GraphStore$1): void;
|
|
1394
1803
|
/**
|
|
1395
1804
|
* Starts periodic garbage collection using current `getEngineOptions().gcInterval`.
|
|
1396
1805
|
* Stops any previous interval first. No-ops during SSR (`window` is undefined) or without `setInterval`.
|
|
1397
|
-
* @returns Disposer that stops this collector
|
|
1806
|
+
* @returns Disposer that stops this graph's collector.
|
|
1398
1807
|
*/
|
|
1399
|
-
declare function startGarbageCollector(): () => void;
|
|
1808
|
+
declare function startGarbageCollector(storeApi?: GraphStore$1): () => void;
|
|
1400
1809
|
/** Override global engine behavior (typically once at app bootstrap). Restarts GC with merged options. */
|
|
1401
1810
|
declare function configureEngine(opts: EngineOptions): void;
|
|
1402
1811
|
/** Read merged engine options; hooks use this for default `staleTime` and retry behavior. */
|
|
@@ -1405,17 +1814,18 @@ declare function getEngineOptions(): Required<EngineOptions>;
|
|
|
1405
1814
|
* Run a single-entity fetch with dedupe, retries, normalization, and graph updates.
|
|
1406
1815
|
* Call from hooks/adapters — not from presentational components.
|
|
1407
1816
|
*/
|
|
1408
|
-
declare function fetchEntity<TRaw, TEntity extends object>(opts: EntityQueryOptions<TRaw, TEntity>, engineOpts: Required<EngineOptions
|
|
1817
|
+
declare function fetchEntity<TRaw, TEntity extends object>(opts: EntityQueryOptions<TRaw, TEntity>, engineOpts: Required<EngineOptions>, storeApi?: GraphStore$1): Promise<void>;
|
|
1409
1818
|
/**
|
|
1410
1819
|
* Fetch a list page: upserts all rows, writes ids to the list key, supports append mode for pagination.
|
|
1411
1820
|
* @param isLoadMore - When true, uses a separate dedupe key and `appendListResult` / `setListFetchingMore`.
|
|
1412
1821
|
*/
|
|
1413
|
-
declare function fetchList<TRaw, TEntity extends object>(opts: ListQueryOptions<TRaw, TEntity>, params: ListFetchParams, engineOpts: Required<EngineOptions>, isLoadMore?: boolean): Promise<void>;
|
|
1822
|
+
declare function fetchList<TRaw, TEntity extends object>(opts: ListQueryOptions<TRaw, TEntity>, params: ListFetchParams, engineOpts: Required<EngineOptions>, isLoadMore?: boolean, storeApi?: GraphStore$1): Promise<void>;
|
|
1414
1823
|
/**
|
|
1415
1824
|
* Opt-in window listeners that mark **subscribed** entities stale on focus/reconnect so hooks can SWR-refetch.
|
|
1416
|
-
*
|
|
1825
|
+
* Reference-counted per graph and safe for SSR (no-ops without `window`).
|
|
1826
|
+
* @returns Disposer that releases this attachment and removes listeners plus GC when the last owner releases it.
|
|
1417
1827
|
*/
|
|
1418
|
-
declare function attachGlobalListeners(): void;
|
|
1828
|
+
declare function attachGlobalListeners(storeApi?: GraphStore$1): () => void;
|
|
1419
1829
|
|
|
1420
1830
|
/**
|
|
1421
1831
|
* devtools-event-bus — W5 (seim-em-explorer-event-bus-registry)
|
|
@@ -1490,7 +1900,7 @@ declare function getRegisteredStores(): ReadonlyArray<RegisteredStore>;
|
|
|
1490
1900
|
* not in production data paths.
|
|
1491
1901
|
*/
|
|
1492
1902
|
|
|
1493
|
-
type GraphSlice = Pick<ReturnType<typeof
|
|
1903
|
+
type GraphSlice = Pick<ReturnType<typeof graphStore.getState>, "entities" | "patches" | "entityStates" | "syncMetadata" | "lists">;
|
|
1494
1904
|
interface TimeTravelSnapshot {
|
|
1495
1905
|
/** Monotonic id (capture order). */
|
|
1496
1906
|
seq: number;
|
|
@@ -1511,18 +1921,18 @@ declare function configureTimeTravel(opts: {
|
|
|
1511
1921
|
capacity?: number;
|
|
1512
1922
|
}): void;
|
|
1513
1923
|
/** Capture the current live graph state into the ring. Returns the snapshot seq. */
|
|
1514
|
-
declare function recordGraphSnapshot(label?: string): number;
|
|
1924
|
+
declare function recordGraphSnapshot(label?: string, storeApi?: GraphStore$1): number;
|
|
1515
1925
|
/**
|
|
1516
1926
|
* Restore the live graph to the snapshot at ring `index` (0-based into the
|
|
1517
1927
|
* current ring). The Zustand store is overwritten with a deep clone of the
|
|
1518
1928
|
* captured slice, so all subscribers re-render at that historical state.
|
|
1519
1929
|
* Returns true if restored.
|
|
1520
1930
|
*/
|
|
1521
|
-
declare function restoreGraphSnapshot(index: number): boolean;
|
|
1931
|
+
declare function restoreGraphSnapshot(index: number, storeApi?: GraphStore$1): boolean;
|
|
1522
1932
|
/** Restore by capture seq (stable across ring eviction within capacity). */
|
|
1523
|
-
declare function restoreGraphSnapshotBySeq(seq: number): boolean;
|
|
1933
|
+
declare function restoreGraphSnapshotBySeq(seq: number, storeApi?: GraphStore$1): boolean;
|
|
1524
1934
|
/** Step the cursor by `delta` (negative = back in time) and restore. */
|
|
1525
|
-
declare function stepTimeTravel(delta: number): boolean;
|
|
1935
|
+
declare function stepTimeTravel(delta: number, storeApi?: GraphStore$1): boolean;
|
|
1526
1936
|
/** Snapshot metadata + cursor for the devtools UI (no heavy data payloads). */
|
|
1527
1937
|
declare function getTimeTravelState(): TimeTravelState;
|
|
1528
1938
|
/** Subscribe to ring/cursor changes (for useSyncExternalStore in the UI). */
|
|
@@ -1684,12 +2094,12 @@ declare function getSchema(type: EntityType): EntitySchema | null;
|
|
|
1684
2094
|
* After a successful mutation, mark related entities/lists stale so hooks refetch without manually hunting query keys.
|
|
1685
2095
|
* Traverses registered schemas (including reverse `hasMany`) so denormalized UIs stay eventually consistent with the graph.
|
|
1686
2096
|
*/
|
|
1687
|
-
declare function cascadeInvalidation(ctx: CascadeContext): void;
|
|
2097
|
+
declare function cascadeInvalidation(ctx: CascadeContext, storeApi?: GraphStore$1): void;
|
|
1688
2098
|
/**
|
|
1689
2099
|
* Resolve relation **placeholders** for detail panels: joins graph reads for belongs-to targets, has-many id lists, or many-to-many id arrays.
|
|
1690
2100
|
* Returns plain objects suitable for rendering; does not mutate the graph.
|
|
1691
2101
|
*/
|
|
1692
|
-
declare function readRelations(type: EntityType, entity: Record<string, unknown
|
|
2102
|
+
declare function readRelations(type: EntityType, entity: Record<string, unknown>, storeApi?: GraphStore$1): Record<string, unknown>;
|
|
1693
2103
|
|
|
1694
2104
|
/**
|
|
1695
2105
|
* agent/json-patch.ts — Minimal RFC-6902 JSON Patch applier.
|
|
@@ -1856,6 +2266,7 @@ interface ChannelConfig {
|
|
|
1856
2266
|
|
|
1857
2267
|
interface ManagerOptions {
|
|
1858
2268
|
flushInterval?: number;
|
|
2269
|
+
store?: GraphStore$1;
|
|
1859
2270
|
onStatusChange?: (adapter: string, status: AdapterStatus) => void;
|
|
1860
2271
|
onChangeReceived?: (adapter: string, change: EntityChange) => void;
|
|
1861
2272
|
}
|
|
@@ -1865,6 +2276,7 @@ declare class RealtimeManager {
|
|
|
1865
2276
|
private pendingListKeys;
|
|
1866
2277
|
private flushTimer;
|
|
1867
2278
|
private opts;
|
|
2279
|
+
private store;
|
|
1868
2280
|
constructor(opts?: ManagerOptions);
|
|
1869
2281
|
register(adapter: RealtimeAdapter, channels: ChannelConfig[], normalize?: (raw: unknown) => EntityChange | null): UnsubscribeFn;
|
|
1870
2282
|
unregister(name: string): void;
|
|
@@ -2435,11 +2847,10 @@ declare function registerEntityFromSql(opts: RegisterEntityFromSqlOptions): Enti
|
|
|
2435
2847
|
/**
|
|
2436
2848
|
* table/types.ts
|
|
2437
2849
|
*
|
|
2438
|
-
* Pure table engine type definitions — zero
|
|
2850
|
+
* Pure table engine type definitions — zero framework dependencies.
|
|
2439
2851
|
* Structurally compatible with TanStack Table v8 for easy migration,
|
|
2440
2852
|
* but fully self-contained within the prometheus-entity-management library.
|
|
2441
2853
|
*/
|
|
2442
|
-
|
|
2443
2854
|
type ViewMode = "table" | "gallery" | "list";
|
|
2444
2855
|
type Updater<T> = T | ((prev: T) => T);
|
|
2445
2856
|
type AccessorFn<TData, TValue = unknown> = (row: TData, index: number) => TValue;
|
|
@@ -2456,8 +2867,8 @@ type CellContext<TData> = {
|
|
|
2456
2867
|
getValue: <T = unknown>() => T;
|
|
2457
2868
|
renderValue: <T = unknown>() => T | null;
|
|
2458
2869
|
};
|
|
2459
|
-
type HeaderRenderer<TData> = string | ((context: HeaderContext<TData>) =>
|
|
2460
|
-
type CellRenderer<TData> = string | ((context: CellContext<TData>) =>
|
|
2870
|
+
type HeaderRenderer<TData> = string | ((context: HeaderContext<TData>) => unknown);
|
|
2871
|
+
type CellRenderer<TData> = string | ((context: CellContext<TData>) => unknown);
|
|
2461
2872
|
type FilterFn<TData> = (row: Row<TData>, columnId: string, filterValue: unknown) => boolean;
|
|
2462
2873
|
type SortingFn<TData> = (rowA: Row<TData>, rowB: Row<TData>, columnId: string) => number;
|
|
2463
2874
|
type AggregationFn<TData> = (columnId: string, leafRows: Row<TData>[], childRows: Row<TData>[]) => unknown;
|
|
@@ -2788,86 +3199,6 @@ interface TableInstance<TData> {
|
|
|
2788
3199
|
getCanSomeRowsExpand: () => boolean;
|
|
2789
3200
|
getExpandedDepth: () => number;
|
|
2790
3201
|
}
|
|
2791
|
-
interface ActionDef<TData> {
|
|
2792
|
-
id: string;
|
|
2793
|
-
label: string;
|
|
2794
|
-
icon?: React.ComponentType<{
|
|
2795
|
-
className?: string;
|
|
2796
|
-
}>;
|
|
2797
|
-
onClick: (item: TData) => void;
|
|
2798
|
-
destructive?: boolean;
|
|
2799
|
-
hidden?: (item: TData) => boolean;
|
|
2800
|
-
disabled?: (item: TData) => boolean;
|
|
2801
|
-
confirm?: string | ((item: TData) => string);
|
|
2802
|
-
variant?: "primary" | "default" | "ghost" | "destructive";
|
|
2803
|
-
}
|
|
2804
|
-
interface ItemDescriptorBadge<TData> {
|
|
2805
|
-
field: keyof TData & string;
|
|
2806
|
-
options?: Array<{
|
|
2807
|
-
value: string;
|
|
2808
|
-
label: string;
|
|
2809
|
-
className?: string;
|
|
2810
|
-
}>;
|
|
2811
|
-
}
|
|
2812
|
-
interface ItemDescriptorMeta<TData> {
|
|
2813
|
-
field: keyof TData & string;
|
|
2814
|
-
label: string;
|
|
2815
|
-
format?: (value: unknown) => string;
|
|
2816
|
-
}
|
|
2817
|
-
interface ItemDescriptor<TData> {
|
|
2818
|
-
title: keyof TData & string;
|
|
2819
|
-
subtitle?: keyof TData & string;
|
|
2820
|
-
image?: keyof TData & string;
|
|
2821
|
-
icon?: (keyof TData & string) | React.ComponentType<{
|
|
2822
|
-
className?: string;
|
|
2823
|
-
}>;
|
|
2824
|
-
avatar?: keyof TData & string;
|
|
2825
|
-
badges?: ItemDescriptorBadge<TData>[];
|
|
2826
|
-
metadata?: ItemDescriptorMeta<TData>[];
|
|
2827
|
-
description?: keyof TData & string;
|
|
2828
|
-
}
|
|
2829
|
-
interface ItemRenderContext<TData> {
|
|
2830
|
-
isSelected: boolean;
|
|
2831
|
-
isEditing: boolean;
|
|
2832
|
-
isMultiSelectMode: boolean;
|
|
2833
|
-
onToggleSelect: () => void;
|
|
2834
|
-
onEdit: () => void;
|
|
2835
|
-
onSave: (changes: Partial<TData>) => void;
|
|
2836
|
-
onCancel: () => void;
|
|
2837
|
-
actions: ActionDef<TData>[];
|
|
2838
|
-
row: Row<TData>;
|
|
2839
|
-
}
|
|
2840
|
-
interface EmptyStateConfig {
|
|
2841
|
-
icon?: React.ComponentType<{
|
|
2842
|
-
className?: string;
|
|
2843
|
-
}>;
|
|
2844
|
-
title?: string;
|
|
2845
|
-
description?: string;
|
|
2846
|
-
action?: {
|
|
2847
|
-
label: string;
|
|
2848
|
-
onClick: () => void;
|
|
2849
|
-
};
|
|
2850
|
-
filteredTitle?: string;
|
|
2851
|
-
filteredDescription?: string;
|
|
2852
|
-
filteredAction?: {
|
|
2853
|
-
label: string;
|
|
2854
|
-
onClick: () => void;
|
|
2855
|
-
};
|
|
2856
|
-
}
|
|
2857
|
-
interface BatchActionDef {
|
|
2858
|
-
id: string;
|
|
2859
|
-
label: string;
|
|
2860
|
-
icon?: React.ComponentType<{
|
|
2861
|
-
className?: string;
|
|
2862
|
-
}>;
|
|
2863
|
-
destructive?: boolean;
|
|
2864
|
-
}
|
|
2865
|
-
interface GalleryColumns {
|
|
2866
|
-
sm?: number;
|
|
2867
|
-
md?: number;
|
|
2868
|
-
lg?: number;
|
|
2869
|
-
xl?: number;
|
|
2870
|
-
}
|
|
2871
3202
|
|
|
2872
3203
|
/**
|
|
2873
3204
|
* table/row-models.ts
|
|
@@ -2910,4 +3241,4 @@ declare function getFacetedMinMaxValues<TData>(rowModel: RowModel<TData>, column
|
|
|
2910
3241
|
*/
|
|
2911
3242
|
declare function getFacetedRowModel<TData>(preFilteredRowModel: RowModel<TData>, columnId: string, allFilteredRowModel: RowModel<TData>): RowModel<TData>;
|
|
2912
3243
|
|
|
2913
|
-
export { type AccessorFn, type
|
|
3244
|
+
export { type AccessorFn, type AdapterStatus, type AgUiStateDeltaEvent, type AgUiStateMapping, type AgUiStateSnapshotEvent, type AggregationFn, type ApplyAgUiOptions, type BelongsToRelation, type CascadeContext, type Cell, type CellContext, type CellRenderer, type ChangeEvent, type ChangeOp, type ChangeOperation, type ChangeSet, type ChannelConfig, type Column, type ColumnDef, type ColumnFiltersState, type ColumnMeta, type ColumnOrderState, type ColumnPinningState, type ColumnSizingInfoState, type ColumnSizingState, type ColumnVisibilityState, type CompletenessMode, type CreateFlintAdapterOptions, type CreatePGlitePersistenceAdapterOptions, type CreateTauriSqlPersistenceAdapterOptions, type DevtoolsEvent, type DevtoolsEventBus, type DevtoolsEventBusOptions, type DevtoolsSourceFn, EMPTY_ENTITY_STATE, EMPTY_IDS, EMPTY_LIST_STATE, EMPTY_SYNC_METADATA, type ElectricAdapterOptions, type ElectricTableConfig, type EngineOptions, type EntityChange, type EntityError, type EntityErrorOptions, type EntityId, type EntityJsonSchemaConfig, type EntityQueryOptions, type EntitySchema, type EntitySnapshot, type EntityState, type EntitySyncMetadata, type EntityTransport, type EntityType, type ExpandedState, type FilterClause, type FilterFn, type FilterGroup, type FilterOperator, type FilterSpec, type FlintCheckpointStore, type FlintClientLike, type FlintEntityEvent, type FlintEntityQuery, type FlintEntityRecord, type GetEntityJsonSchemaOptions, type GraphActionEvent, type GraphActionOptions, type GraphActionRecord$1 as GraphActionRecord, type GraphEffectEvent, type GraphEffectHandle, type GraphEffectOptions, type GraphIncludeMap, type GraphIncludeRelation, type GraphPersistenceAdapter, type GraphQueryOptions, type GraphSnapshotExportOptions, type GraphSnapshotPayload, type GraphSnapshotWithSchemasOptions, type GraphState, type GraphStore$1 as GraphStore, type GraphSyncStatus, type GraphToolContext, type GraphTransaction, type GroupingState, type HasManyRelation, type Header, type HeaderContext, type HeaderGroup, type HeaderRenderer, IncrementalView, type IncrementalViewOptions, type JsonPatchOp, type JsonSchemaObject, type ListFetchParams, type ListQuery, type ListQueryOptions, type ListResponse, type ListResult, type ListState, type LocalFirstGraphRuntime, type LoroModuleLoader, type MakeRestTransportOptions, type ManagerOptions, type ManyToManyRelation, type MergeContext, type MergeStrategy, type PGlitePersistenceClient, type PaginationState, type ColumnDef as PureColumnDef, type ColumnMeta as PureColumnMeta, type QueryKey, type RealtimeAdapter, RealtimeManager, type RegisterEntityFromSqlOptions, type RegisteredStore, type RelationDescriptor, type ReplayRetryPolicy, type Row, type RowModel, type RowSelectionState, type SchemaGraphToolContext, type SortClause, type SortDirection, type SortSpec, type SortingFn, type SortingState, type StartLocalFirstGraphOptions, type SubscriptionConfig, type SupabaseAdapterOptions, type SupabaseLike, type SupabaseQueryBuilderLike, type SurrealCheckpointStore, type SurrealLike, type SurrealLiveAction, type SurrealLiveAdapterOptions, type SurrealTableConfig, type SyncAdapter, type SyncOrigin, type TableInstance, type TableOptions, type TableState, type TauriSqlClient, type TenantClaim, type TenantScopedAdapterOptions, type TenantScopedTableConfig, TerminalError, type TimeTravelSnapshot, type TimeTravelState, TransientError, type UnsubscribeFn, type Updater, type ViewDescriptor, type ViewMode, type WebSocketAdapterOptions, __resetEntityTransports, __resetStoreRegistry, applyAgUiDelta, applyAgUiSnapshot, applyJsonPatch, applyView, attachGlobalListeners, buildTenantWhere, cascadeInvalidation, checkCompleteness, collectDirtyPaths, compareEntities, configureEngine, configureTimeTravel, createConvexAdapter, createDevtoolsEventBus, createElectricAdapter, createFlintAdapter, createGraphAction, createGraphEffect, createGraphQLSubscriptionAdapter, createGraphStore, createGraphTool, createGraphTransaction, createLoroMergeStrategy, createPGlitePersistenceAdapter, createRow, createSchemaGraphTool, createSupabaseRealtimeAdapter, createSurrealLiveAdapter, createTauriSqlPersistenceAdapter, createTenantScopedElectricAdapter, createWebSocketAdapter, dedupe, escapeHtml, exportGraphSnapshot, exportGraphSnapshotWithSchemas, fetchEntity, fetchList, findInsertionIndex, flattenClauses, getActiveSubscriberCount, getCoreRowModel, getRealtimeManager as getElectricRealtimeManager, getEngineOptions, getEntityJsonSchema, getEntityTransport, getExpandedRowModel, getFacetedMinMaxValues, getFacetedRowModel, getFacetedUniqueValues, getFilteredRowModel, getGraphSyncStatus, getGroupedRowModel, getMergeStrategy, getPaginatedRowModel, getRealtimeManager, getRegisteredEntityTypes, getRegisteredStores, getSchema, getSelectedRowModel, getSortedRowModel, getTimeTravelState, getValueAtPath, graphStore, graphSyncStatusStore, hasCustomPredicates, hasMergeStrategy, humanizeFieldName, hydrateGraphFromStorage, inferSchemaFieldType, lwwStrategy, makeRestTransport, matchesFilter, matchesSearch, parseCreateTable, persistGraphToStorage, publishFlintMutation, queryOnce, readRelations, recordGraphSnapshot, registerEntityFromSql, registerEntityJsonSchema, registerEntityTransport, registerMergeStrategy, registerRuntimeSchema, registerSchema, registerStore, registerSubscriber, registryKey, renderMarkdownToHtml, replayActionWithRetry, resetRealtimeManager, restoreGraphSnapshot, restoreGraphSnapshotBySeq, selectGraph, serializeKey, setDefaultMergeStrategy, setValueAtPath, sqlTypeToJsonSchema, startGarbageCollector, startLocalFirstGraph, stepTimeTravel, stopGarbageCollector, subscribeDevtoolsEvent, subscribeSubscriberStats, subscribeTimeTravel, toEntityError, toGraphQLVariables, toPrismaOrderBy, toPrismaWhere, toRestParams, toSQLClauses, unregisterSubscriber, useGraphStore };
|