@oimdb/core 3.8.0 → 3.10.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/README.md +23 -4
- package/dist/index.cjs +238 -251
- package/dist/index.d.cts +153 -183
- package/dist/index.d.ts +153 -183
- package/dist/index.js +236 -247
- package/llms.txt +43 -1
- package/package.json +2 -1
package/dist/index.d.cts
CHANGED
|
@@ -16,7 +16,7 @@ type TOIMKeyPath = readonly TOIMPk[];
|
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* The key bound shared by every keyed node (index, keyed emitter, carrier
|
|
19
|
-
*
|
|
19
|
+
* provider): either a single primitive PK (`TOIMPk`) or a composite key path
|
|
20
20
|
* (`TOIMKeyPath`).
|
|
21
21
|
*
|
|
22
22
|
* It exists purely to widen the generic bound from `TOIMPk` to also admit
|
|
@@ -39,72 +39,9 @@ type TOIMEntitySlot<TEntity extends object, TPk extends TOIMKey> = {
|
|
|
39
39
|
subscribers?: Set<() => void>;
|
|
40
40
|
};
|
|
41
41
|
type TOIMAnyEntitySlot<TPk extends TOIMKey> = TOIMEntitySlot<object, TPk>;
|
|
42
|
-
type
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* The Map surface the PK / index-key axis needs, abstracted so the concrete
|
|
46
|
-
* keying strategy is pluggable. A native `Map` satisfies this interface
|
|
47
|
-
* structurally (so the primitive default is a plain `Map`, zero wrapper), while
|
|
48
|
-
* a composite key uses a trie-backed implementation (`OIMTrieMap`) that matches
|
|
49
|
-
* array keys by content instead of by reference.
|
|
50
|
-
*/
|
|
51
|
-
interface IOIMKeyedMap<TKey, TValue> {
|
|
52
|
-
get(key: TKey): TValue | undefined;
|
|
53
|
-
set(key: TKey, value: TValue): void;
|
|
54
|
-
has(key: TKey): boolean;
|
|
55
|
-
delete(key: TKey): boolean;
|
|
56
|
-
readonly size: number;
|
|
57
|
-
keys(): IterableIterator<TKey>;
|
|
58
|
-
entries(): IterableIterator<[TKey, TValue]>;
|
|
59
|
-
values(): IterableIterator<TValue>;
|
|
60
|
-
clear(): void;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The Set surface the PK / index-key axis needs, abstracted so the concrete
|
|
65
|
-
* keying strategy is pluggable. A native `Set` satisfies this interface
|
|
66
|
-
* structurally (primitive default is a plain `Set`, zero wrapper); a composite
|
|
67
|
-
* key uses a trie-backed implementation matching array keys by content.
|
|
68
|
-
*/
|
|
69
|
-
interface IOIMKeyedSet<TKey> {
|
|
70
|
-
add(key: TKey): void;
|
|
71
|
-
has(key: TKey): boolean;
|
|
72
|
-
delete(key: TKey): boolean;
|
|
73
|
-
readonly size: number;
|
|
74
|
-
values(): IterableIterator<TKey>;
|
|
75
|
-
clear(): void;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
* Owns "how a key is stored, compared, and identified" for one keying axis
|
|
80
|
-
* (a collection's PK, or an index's key). It is the single seam every PK-keyed
|
|
81
|
-
* `Map`/`Set` on the hot path goes through, so the whole engine is agnostic to
|
|
82
|
-
* whether the key is a primitive or a composite path.
|
|
83
|
-
*
|
|
84
|
-
* - `OIMKeyDomainNative` (default): native `Map`/`Set`, `canonicalize` is
|
|
85
|
-
* identity — byte-for-byte the current behavior and cost for primitive keys.
|
|
86
|
-
* - `OIMKeyDomainTrie`: trie-backed `Map`/`Set` matching array keys by content,
|
|
87
|
-
* and `canonicalize` interns each logical key to one stable reference so that
|
|
88
|
-
* downstream native `Set<slot.pk>` keep working by reference.
|
|
89
|
-
*/
|
|
90
|
-
interface IOIMKeyDomain<TKey extends TOIMKey> {
|
|
91
|
-
createMap<TValue>(): IOIMKeyedMap<TKey, TValue>;
|
|
92
|
-
createSet(): IOIMKeyedSet<TKey>;
|
|
93
|
-
/**
|
|
94
|
-
* Returns the canonical reference for a logical key. Native domain returns
|
|
95
|
-
* the key unchanged; a composite domain interns it so equal-content keys
|
|
96
|
-
* share one reference (making reference-keyed structures downstream correct).
|
|
97
|
-
*/
|
|
98
|
-
canonicalize(key: TKey): TKey;
|
|
99
|
-
}
|
|
42
|
+
type TOIMEntitySlotGetter<TPk extends TOIMKey> = (pk: TPk) => TOIMAnyEntitySlot<TPk> | undefined;
|
|
100
43
|
|
|
101
44
|
declare abstract class OIMCollectionStore<TEntity extends object, TPk extends TOIMKey> {
|
|
102
|
-
/**
|
|
103
|
-
* The keying strategy for this store's PKs. Every PK-keyed structure built
|
|
104
|
-
* off a collection (indexes, wrappers) reads it so the whole engine keys PKs
|
|
105
|
-
* the same way — native `Map` for primitives, trie for composite paths.
|
|
106
|
-
*/
|
|
107
|
-
abstract get keyDomain(): IOIMKeyDomain<TPk>;
|
|
108
45
|
abstract setOneByPk(pk: TPk, entity: TEntity): TOIMEntitySlot<TEntity, TPk>;
|
|
109
46
|
abstract getSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
110
47
|
/**
|
|
@@ -226,6 +163,25 @@ interface IOIMSubscribable {
|
|
|
226
163
|
dirty?: boolean;
|
|
227
164
|
}
|
|
228
165
|
|
|
166
|
+
/**
|
|
167
|
+
* The Map surface the PK / index-key axis needs, abstracted so the concrete
|
|
168
|
+
* keying strategy is pluggable. A native `Map` satisfies this interface
|
|
169
|
+
* structurally (so the primitive default is a plain `Map`, zero wrapper), while
|
|
170
|
+
* a composite key uses a trie-backed implementation (`OIMTrieMap`) that matches
|
|
171
|
+
* array keys by content instead of by reference.
|
|
172
|
+
*/
|
|
173
|
+
interface IOIMKeyedMap<TKey, TValue> {
|
|
174
|
+
get(key: TKey): TValue | undefined;
|
|
175
|
+
set(key: TKey, value: TValue): void;
|
|
176
|
+
has(key: TKey): boolean;
|
|
177
|
+
delete(key: TKey): boolean;
|
|
178
|
+
readonly size: number;
|
|
179
|
+
keys(): IterableIterator<TKey>;
|
|
180
|
+
entries(): IterableIterator<[TKey, TValue]>;
|
|
181
|
+
values(): IterableIterator<TValue>;
|
|
182
|
+
clear(): void;
|
|
183
|
+
}
|
|
184
|
+
|
|
229
185
|
/**
|
|
230
186
|
* A set-based index bucket that is ALSO its own subscription carrier AND holds
|
|
231
187
|
* its own pk→slot membership.
|
|
@@ -428,18 +384,34 @@ type TOIMEventQueueOptions = {
|
|
|
428
384
|
* If not provided, flush() must be called manually.
|
|
429
385
|
*/
|
|
430
386
|
scheduler?: OIMEventQueueScheduler;
|
|
387
|
+
/**
|
|
388
|
+
* Handler for an error thrown by a task during flush. When set, the queue
|
|
389
|
+
* treats the error as handled — it is NOT re-raised out of `flush()`. When
|
|
390
|
+
* NOT set, the error propagates (loud by default: uncaught in async/scheduled
|
|
391
|
+
* mode, thrown to the caller of a manual `flush()`).
|
|
392
|
+
*
|
|
393
|
+
* Either way the queue's own state is always restored (one failing task never
|
|
394
|
+
* wedges the queue) and a `FLUSH_ERROR` event is emitted for tooling.
|
|
395
|
+
*/
|
|
396
|
+
onError?: (error: unknown) => void;
|
|
431
397
|
};
|
|
432
398
|
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
399
|
+
/** Payload of the `EOIMEventQueueEventType.FLUSH_ERROR` event. */
|
|
400
|
+
type TOIMFlushError = {
|
|
401
|
+
/** The value a queue task threw (not necessarily an `Error`). */
|
|
402
|
+
error: unknown;
|
|
403
|
+
};
|
|
437
404
|
|
|
438
405
|
/**
|
|
439
406
|
* Event queue that can optionally integrate with a scheduler for automatic flushing.
|
|
440
407
|
*/
|
|
441
408
|
declare class OIMEventQueue {
|
|
442
|
-
readonly emitter: OIMEventEmitter<
|
|
409
|
+
readonly emitter: OIMEventEmitter<{
|
|
410
|
+
1: void;
|
|
411
|
+
0: void;
|
|
412
|
+
2: TOIMFlushError;
|
|
413
|
+
}>;
|
|
414
|
+
protected readonly onError?: (error: unknown) => void;
|
|
443
415
|
protected tasks: Set<() => void>;
|
|
444
416
|
protected tasksSpare: Set<() => void>;
|
|
445
417
|
protected flushing?: Set<() => void>;
|
|
@@ -492,13 +464,13 @@ declare class OIMEventQueue {
|
|
|
492
464
|
* Collection carrier = the entity slot (by pk); index carrier = the bucket
|
|
493
465
|
* (by index key).
|
|
494
466
|
*/
|
|
495
|
-
interface
|
|
467
|
+
interface IOIMCarrierProvider<TKey extends TOIMKey, TCarrier> {
|
|
496
468
|
getOrReserveCarrier(key: TKey): TCarrier;
|
|
497
469
|
findCarrier(key: TKey): TCarrier | undefined;
|
|
498
470
|
/**
|
|
499
|
-
* Optional: called when a carrier loses its last subscriber, so a
|
|
471
|
+
* Optional: called when a carrier loses its last subscriber, so a carrierProvider
|
|
500
472
|
* that owns standalone carriers (e.g. the index's key→carrier map) can prune
|
|
501
|
-
* it and not leak the key space.
|
|
473
|
+
* it and not leak the key space. Providers whose carriers are owned
|
|
502
474
|
* elsewhere (e.g. the collection's slots) leave this unset.
|
|
503
475
|
*/
|
|
504
476
|
onCarrierEmptied?(carrier: TCarrier): void;
|
|
@@ -516,11 +488,11 @@ interface IOIMCarrierResolver<TKey extends TOIMKey, TCarrier> {
|
|
|
516
488
|
*/
|
|
517
489
|
declare class OIMCarrierKeyedEmitter<TKey extends TOIMKey, TCarrier extends IOIMSubscribable> implements IOIMKeyedUpdateEmitter<TKey> {
|
|
518
490
|
private readonly queue;
|
|
519
|
-
private readonly
|
|
491
|
+
private readonly carrierProvider;
|
|
520
492
|
private readonly subscribedCarriers;
|
|
521
493
|
private dirtyCarriers;
|
|
522
494
|
private isFlushEnqueued;
|
|
523
|
-
constructor(queue: OIMEventQueue,
|
|
495
|
+
constructor(queue: OIMEventQueue, carrierProvider: IOIMCarrierProvider<TKey, TCarrier>);
|
|
524
496
|
subscribeOnKey(key: TKey, handler: TOIMEventHandler<void>): () => void;
|
|
525
497
|
subscribeOnKeys(keys: readonly TKey[], handler: TOIMEventHandler<void>): () => void;
|
|
526
498
|
unsubscribeFromKey(key: TKey, handler: TOIMEventHandler<void>): void;
|
|
@@ -550,7 +522,7 @@ declare class OIMCarrierKeyedEmitter<TKey extends TOIMKey, TCarrier extends IOIM
|
|
|
550
522
|
/**
|
|
551
523
|
* Carrier for a single index key: holds that key's subscribers + dirty flag
|
|
552
524
|
* (via `IOIMSubscribable`) so the keyed emitter delivers straight off the
|
|
553
|
-
* carrier with no per-key map lookup. Carries its own `key` so the
|
|
525
|
+
* carrier with no per-key map lookup. Carries its own `key` so the provider can
|
|
554
526
|
* prune it from the key→carrier map when its last subscriber leaves.
|
|
555
527
|
*/
|
|
556
528
|
interface IOIMKeyCarrier<TKey extends TOIMKey> extends IOIMSubscribable {
|
|
@@ -567,13 +539,13 @@ declare abstract class OIMReactiveIndex<TKey extends TOIMKey, TPk extends TOIMKe
|
|
|
567
539
|
protected readonly updateEmitter: IOIMKeyedUpdateEmitter<TKey>;
|
|
568
540
|
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: IOIMKeyedUpdateEmitter<TKey>) => TIndex,
|
|
569
541
|
/**
|
|
570
|
-
* How to build the key→carrier
|
|
571
|
-
* Defaults to the native-`Map`
|
|
542
|
+
* How to build the key→carrier carrierProvider backing the keyed emitter.
|
|
543
|
+
* Defaults to the native-`Map` carrierProvider used by every primitive-keyed
|
|
572
544
|
* index (its fast path is unchanged). A composite (trie-backed) index
|
|
573
|
-
* passes a
|
|
545
|
+
* passes a carrierProvider that keys carriers by key path instead. Called once
|
|
574
546
|
* at construction — no per-operation cost.
|
|
575
547
|
*/
|
|
576
|
-
|
|
548
|
+
createCarrierProvider?: () => IOIMCarrierProvider<TKey, IOIMKeyCarrier<TKey>>);
|
|
577
549
|
getEntitiesByKey<TEntity extends object = object>(key: TKey): (TEntity | undefined)[];
|
|
578
550
|
getEntitiesByKeys<TEntity extends object = object>(keys: readonly TKey[]): Map<TKey, (TEntity | undefined)[]>;
|
|
579
551
|
hasKey(key: TKey): boolean;
|
|
@@ -604,7 +576,7 @@ declare abstract class OIMReactiveIndex<TKey extends TOIMKey, TPk extends TOIMKe
|
|
|
604
576
|
}
|
|
605
577
|
|
|
606
578
|
declare abstract class OIMReactiveIndexSetBased<TKey extends TOIMKey, TPk extends TOIMKey, TIndex extends OIMIndexSetBased<TKey, TPk>> extends OIMReactiveIndex<TKey, TPk, TIndex> {
|
|
607
|
-
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: IOIMKeyedUpdateEmitter<TKey>) => TIndex,
|
|
579
|
+
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: IOIMKeyedUpdateEmitter<TKey>) => TIndex, createCarrierProvider?: () => IOIMCarrierProvider<TKey, IOIMKeyCarrier<TKey>>);
|
|
608
580
|
getPksByKey(key: TKey): Set<TPk>;
|
|
609
581
|
getPksByKeys(keys: readonly TKey[]): Map<TKey, Set<TPk>>;
|
|
610
582
|
getSlotsByKey(key: TKey): ReadonlySet<TOIMAnyEntitySlot<TPk>>;
|
|
@@ -612,7 +584,7 @@ declare abstract class OIMReactiveIndexSetBased<TKey extends TOIMKey, TPk extend
|
|
|
612
584
|
}
|
|
613
585
|
|
|
614
586
|
declare abstract class OIMReactiveIndexArrayBased<TKey extends TOIMKey, TPk extends TOIMKey, TIndex extends OIMIndexArrayBased<TKey, TPk>> extends OIMReactiveIndex<TKey, TPk, TIndex> {
|
|
615
|
-
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: IOIMKeyedUpdateEmitter<TKey>) => TIndex,
|
|
587
|
+
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: IOIMKeyedUpdateEmitter<TKey>) => TIndex, createCarrierProvider?: () => IOIMCarrierProvider<TKey, IOIMKeyCarrier<TKey>>);
|
|
616
588
|
getPksByKey(key: TKey): TPk[];
|
|
617
589
|
getPksByKeys(keys: readonly TKey[]): Map<TKey, TPk[]>;
|
|
618
590
|
getSlotsByKey(key: TKey): readonly TOIMAnyEntitySlot<TPk>[];
|
|
@@ -713,7 +685,7 @@ interface IOIMSubscription {
|
|
|
713
685
|
* The keyless pub/sub surface a reactive Global node needs from its update
|
|
714
686
|
* emitter: subscribe + a batched "mark updated" delivery. The counterpart of
|
|
715
687
|
* {@link IOIMKeyedUpdateEmitter}, but for exactly one carrier — so there is no
|
|
716
|
-
* key parameter, no
|
|
688
|
+
* key parameter, no provider, and no per-key map.
|
|
717
689
|
*/
|
|
718
690
|
interface IOIMSingleUpdateEmitter extends IOIMSubscription {
|
|
719
691
|
markUpdated(): void;
|
|
@@ -723,7 +695,7 @@ interface IOIMSingleUpdateEmitter extends IOIMSubscription {
|
|
|
723
695
|
|
|
724
696
|
/**
|
|
725
697
|
* Reactive wrapper around a keyless {@link OIMGlobalIndex}. Owns a single-carrier
|
|
726
|
-
* emitter (no
|
|
698
|
+
* emitter (no provider, no key→carrier map), so `subscribe(handler)` is keyless
|
|
727
699
|
* and directly satisfies `IOIMSelectorSourceDependency`. Mirrors
|
|
728
700
|
* {@link OIMReactiveIndex} minus the key.
|
|
729
701
|
*/
|
|
@@ -781,13 +753,17 @@ declare class OIMCollection<TEntity extends object, TPk extends TOIMKey> {
|
|
|
781
753
|
readonly selectPk: TOIMPkSelector<TEntity, TPk>;
|
|
782
754
|
protected readonly store: OIMCollectionStore<TEntity, TPk>;
|
|
783
755
|
protected readonly updateEntity: TOIMEntityUpdater<TEntity>;
|
|
784
|
-
/** The collection's PK keying strategy — read by indexes and wrappers. */
|
|
785
|
-
get keyDomain(): IOIMKeyDomain<TPk>;
|
|
786
756
|
constructor(opts?: TOIMCollectionOptions<TEntity, TPk>);
|
|
787
757
|
getOneByPk(pk: TPk): TEntity | undefined;
|
|
788
758
|
getManyByPks(pks: readonly TPk[]): TEntity[];
|
|
789
759
|
getSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
790
760
|
getOrReserveSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk>;
|
|
761
|
+
/**
|
|
762
|
+
* The existing slot for `pk` (live or reserved) WITHOUT creating one — used
|
|
763
|
+
* by indexes to resolve a pk to its canonical slot for removal (delete by
|
|
764
|
+
* reference), with no side effect for a pk that is not present.
|
|
765
|
+
*/
|
|
766
|
+
findSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
791
767
|
getSlotsByPks(pks: readonly TPk[]): TOIMEntitySlot<TEntity, TPk>[];
|
|
792
768
|
getAllSlots(): TOIMEntitySlot<TEntity, TPk>[];
|
|
793
769
|
upsertOneByPk(pk: TPk, entity: Partial<TEntity>): TOIMEntitySlot<TEntity, TPk>;
|
|
@@ -853,10 +829,10 @@ type TOIMCollectionIndexSetBasedOptions<TEntity extends object, TKey extends TOI
|
|
|
853
829
|
};
|
|
854
830
|
} & ({
|
|
855
831
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
856
|
-
|
|
832
|
+
getSlot?: never;
|
|
857
833
|
} | {
|
|
858
834
|
collection?: never;
|
|
859
|
-
|
|
835
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
860
836
|
});
|
|
861
837
|
type TOIMCollectionIndexArrayBasedOptions<TEntity extends object, TKey extends TOIMKey, TPk extends TOIMKey> = {
|
|
862
838
|
indexOptions?: {
|
|
@@ -865,26 +841,26 @@ type TOIMCollectionIndexArrayBasedOptions<TEntity extends object, TKey extends T
|
|
|
865
841
|
};
|
|
866
842
|
} & ({
|
|
867
843
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
868
|
-
|
|
844
|
+
getSlot?: never;
|
|
869
845
|
} | {
|
|
870
846
|
collection?: never;
|
|
871
|
-
|
|
847
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
872
848
|
});
|
|
873
849
|
type TOIMCollectionOrderedIndexOptions<TEntity extends object, TPk extends TOIMKey> = {
|
|
874
850
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
875
|
-
|
|
851
|
+
getSlot?: never;
|
|
876
852
|
} | {
|
|
877
853
|
collection?: never;
|
|
878
|
-
|
|
854
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
879
855
|
};
|
|
880
856
|
type TOIMCollectionOrderedListCommandStreamOptions<TKey extends TOIMKey, TPk extends TOIMKey, TEntity extends object> = {
|
|
881
857
|
index?: OIMCollectionIndexManualOrderedArrayBased<TKey, TPk, TEntity>;
|
|
882
858
|
} & ({
|
|
883
859
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
884
|
-
|
|
860
|
+
getSlot?: never;
|
|
885
861
|
} | {
|
|
886
862
|
collection?: never;
|
|
887
|
-
|
|
863
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
888
864
|
});
|
|
889
865
|
type TOIMRelationsSetIndexOptions<TKey extends TOIMKey, TPk extends TOIMKey> = {
|
|
890
866
|
indexOptions?: {
|
|
@@ -910,10 +886,10 @@ type TOIMCollectionIndexCompositeSetBasedOptions<TEntity extends object, TPk ext
|
|
|
910
886
|
};
|
|
911
887
|
} & ({
|
|
912
888
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
913
|
-
|
|
889
|
+
getSlot?: never;
|
|
914
890
|
} | {
|
|
915
891
|
collection?: never;
|
|
916
|
-
|
|
892
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
917
893
|
});
|
|
918
894
|
type TOIMRelationsCompositeSetIndexOptions<TPk extends TOIMKey> = {
|
|
919
895
|
indexOptions?: {
|
|
@@ -933,10 +909,10 @@ type TOIMCollectionIndexCompositeArrayBasedOptions<TEntity extends object, TPk e
|
|
|
933
909
|
};
|
|
934
910
|
} & ({
|
|
935
911
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
936
|
-
|
|
912
|
+
getSlot?: never;
|
|
937
913
|
} | {
|
|
938
914
|
collection?: never;
|
|
939
|
-
|
|
915
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
940
916
|
});
|
|
941
917
|
type TOIMRelationsCompositeArrayIndexOptions<TPk extends TOIMKey> = {
|
|
942
918
|
indexOptions?: {
|
|
@@ -1023,16 +999,15 @@ declare class OIMIndexManualOrderedArrayBased<TKey extends TOIMKey, TPk extends
|
|
|
1023
999
|
* them to canonical collection slots at construction-bound write time.
|
|
1024
1000
|
*/
|
|
1025
1001
|
declare class OIMCollectionIndexManualOrderedArrayBased<TKey extends TOIMKey, TPk extends TOIMKey, TEntity extends object = object> extends OIMIndexManualOrderedArrayBased<TKey, TPk> {
|
|
1026
|
-
private readonly
|
|
1002
|
+
private readonly getSlot;
|
|
1027
1003
|
constructor(opts: TOIMCollectionOrderedIndexOptions<TEntity, TPk>);
|
|
1028
1004
|
push(key: TKey, pk: TPk): number;
|
|
1029
1005
|
insertAt(key: TKey, index: number, pk: TPk): number;
|
|
1030
1006
|
reset(key: TKey, pks: readonly TPk[]): void;
|
|
1031
1007
|
getEntitiesByKey<TItem extends object = TEntity>(key: TKey): (TItem | undefined)[];
|
|
1032
1008
|
getEntitiesByKeys<TItem extends object = TEntity>(keys: readonly TKey[]): Map<TKey, (TItem | undefined)[]>;
|
|
1033
|
-
|
|
1034
|
-
private
|
|
1035
|
-
private resolveRequiredSlot;
|
|
1009
|
+
getRequiredSlot(pk: TPk): TOIMAnyEntitySlot<TPk>;
|
|
1010
|
+
private getRequiredSlots;
|
|
1036
1011
|
}
|
|
1037
1012
|
|
|
1038
1013
|
type TOIMUpdateEventEmitterDeliveryMode = 'queue' | 'after_flush' | 'immediate';
|
|
@@ -1248,7 +1223,7 @@ declare class OIMCollectionOrderedListCommandStream<TKey extends TOIMKey, TPk ex
|
|
|
1248
1223
|
set(key: TKey, pks: readonly TPk[]): void;
|
|
1249
1224
|
getSlotsByKey(key: TKey): readonly TOIMEntitySlot<TEntity, TPk>[];
|
|
1250
1225
|
getEntitiesByKey(key: TKey): (TEntity | undefined)[];
|
|
1251
|
-
private
|
|
1226
|
+
private getRequiredSlot;
|
|
1252
1227
|
}
|
|
1253
1228
|
|
|
1254
1229
|
/**
|
|
@@ -1301,9 +1276,9 @@ declare class OIMReactiveIndexManualArrayBased<TKey extends TOIMKey, TPk extends
|
|
|
1301
1276
|
* through the collection binding supplied at construction time.
|
|
1302
1277
|
*/
|
|
1303
1278
|
declare class OIMReactiveCollectionIndexManualArrayBased<TKey extends TOIMKey, TPk extends TOIMKey, TEntity extends object = object> extends OIMReactiveIndexManualArrayBased<TKey, TPk> {
|
|
1304
|
-
private readonly
|
|
1305
|
-
private readonly
|
|
1306
|
-
private readonly
|
|
1279
|
+
private readonly getSlot;
|
|
1280
|
+
private readonly findSlotForRemoval;
|
|
1281
|
+
private readonly slotsByKey;
|
|
1307
1282
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionIndexArrayBasedOptions<TEntity, TKey, TPk>);
|
|
1308
1283
|
setPks(key: TKey, pks: readonly TPk[]): void;
|
|
1309
1284
|
addPks(key: TKey, pks: readonly TPk[]): void;
|
|
@@ -1316,8 +1291,8 @@ declare class OIMReactiveCollectionIndexManualArrayBased<TKey extends TOIMKey, T
|
|
|
1316
1291
|
private membershipOf;
|
|
1317
1292
|
getEntitiesByKey<TItem extends object = TEntity>(key: TKey): (TItem | undefined)[];
|
|
1318
1293
|
getEntitiesByKeys<TItem extends object = TEntity>(keys: readonly TKey[]): Map<TKey, (TItem | undefined)[]>;
|
|
1319
|
-
private
|
|
1320
|
-
private
|
|
1294
|
+
private getSlotsOrTransient;
|
|
1295
|
+
private getSlotOrTransient;
|
|
1321
1296
|
}
|
|
1322
1297
|
|
|
1323
1298
|
/**
|
|
@@ -1331,15 +1306,18 @@ declare class OIMReactiveCollectionIndexManualArrayBased<TKey extends TOIMKey, T
|
|
|
1331
1306
|
* and re-filling.
|
|
1332
1307
|
*/
|
|
1333
1308
|
declare class OIMIndexManualSetBased<TIndexKey extends TOIMKey, TPk extends TOIMKey> extends OIMIndexSetBased<TIndexKey, TPk> {
|
|
1334
|
-
protected readonly pkDomain: IOIMKeyDomain<TPk>;
|
|
1335
1309
|
constructor(options?: {
|
|
1336
1310
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
1337
1311
|
store?: OIMIndexStoreSetBased<TIndexKey, TPk>;
|
|
1338
|
-
pkDomain?: IOIMKeyDomain<TPk>;
|
|
1339
1312
|
});
|
|
1340
1313
|
setSlots(key: TIndexKey, slots: Iterable<TOIMAnyEntitySlot<TPk>>): void;
|
|
1341
|
-
setPks(key: TIndexKey, pks: readonly TPk[],
|
|
1342
|
-
addPks(key: TIndexKey, pks: readonly TPk[],
|
|
1314
|
+
setPks(key: TIndexKey, pks: readonly TPk[], getSlot: (pk: TPk) => TOIMAnyEntitySlot<TPk>): void;
|
|
1315
|
+
addPks(key: TIndexKey, pks: readonly TPk[], getSlot: (pk: TPk) => TOIMAnyEntitySlot<TPk>): void;
|
|
1316
|
+
/**
|
|
1317
|
+
* Removes by pk. `pks` must be canonical `slot.pk` references (membership is
|
|
1318
|
+
* keyed by them): for primitive pks that is just the pk; a collection-bound
|
|
1319
|
+
* composite index canonicalizes raw pks to `slot.pk` before calling this.
|
|
1320
|
+
*/
|
|
1343
1321
|
removePks(key: TIndexKey, pks: readonly TPk[]): void;
|
|
1344
1322
|
/**
|
|
1345
1323
|
* The bucket's pk → slot membership, lazily created and seeded from the
|
|
@@ -1374,12 +1352,6 @@ declare class OIMReactiveIndexManualSetBased<TKey extends TOIMKey, TPk extends T
|
|
|
1374
1352
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
1375
1353
|
store?: OIMIndexStoreSetBased<TKey, TPk>;
|
|
1376
1354
|
};
|
|
1377
|
-
/**
|
|
1378
|
-
* PK key domain for the per-bucket membership — native for primitive
|
|
1379
|
-
* PKs, trie for a composite-PK collection. Threaded from the bound
|
|
1380
|
-
* collection's `keyDomain`.
|
|
1381
|
-
*/
|
|
1382
|
-
pkDomain?: IOIMKeyDomain<TPk>;
|
|
1383
1355
|
});
|
|
1384
1356
|
setSlots(key: TKey, slots: Iterable<TOIMAnyEntitySlot<TPk>>): void;
|
|
1385
1357
|
addSlots(key: TKey, slots: readonly TOIMAnyEntitySlot<TPk>[]): void;
|
|
@@ -1396,9 +1368,10 @@ declare class OIMReactiveIndexManualSetBased<TKey extends TOIMKey, TPk extends T
|
|
|
1396
1368
|
* the key's store bucket exactly once (no separate membership map/trie).
|
|
1397
1369
|
*/
|
|
1398
1370
|
declare class OIMReactiveCollectionIndexManualSetBased<TKey extends TOIMKey, TPk extends TOIMKey, TEntity extends object = object> extends OIMReactiveIndexManualSetBased<TKey, TPk> {
|
|
1399
|
-
private readonly
|
|
1400
|
-
private readonly
|
|
1371
|
+
private readonly getSlot;
|
|
1372
|
+
private readonly getSlotOrTransient;
|
|
1401
1373
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionIndexSetBasedOptions<TEntity, TKey, TPk>);
|
|
1374
|
+
private readonly findSlotForRemoval;
|
|
1402
1375
|
setPks(key: TKey, pks: readonly TPk[]): void;
|
|
1403
1376
|
addPks(key: TKey, pks: readonly TPk[]): void;
|
|
1404
1377
|
removePks(key: TKey, pks: readonly TPk[]): void;
|
|
@@ -1423,9 +1396,10 @@ declare class OIMReactiveCollectionIndexManualSetBased<TKey extends TOIMKey, TPk
|
|
|
1423
1396
|
* path — the trie cost is paid only by this opt-in index.
|
|
1424
1397
|
*/
|
|
1425
1398
|
declare class OIMReactiveCollectionIndexCompositeTrieSetBased<TPk extends TOIMKey, TEntity extends object = object> extends OIMReactiveIndexManualSetBased<TOIMKeyPath, TPk> {
|
|
1426
|
-
private readonly
|
|
1427
|
-
private readonly
|
|
1399
|
+
private readonly getSlot;
|
|
1400
|
+
private readonly getSlotOrTransient;
|
|
1428
1401
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionIndexCompositeSetBasedOptions<TEntity, TPk>);
|
|
1402
|
+
private readonly findSlotForRemoval;
|
|
1429
1403
|
setPks(key: TOIMKeyPath, pks: readonly TPk[]): void;
|
|
1430
1404
|
addPks(key: TOIMKeyPath, pks: readonly TPk[]): void;
|
|
1431
1405
|
removePks(key: TOIMKeyPath, pks: readonly TPk[]): void;
|
|
@@ -1444,7 +1418,7 @@ declare class OIMReactiveCollectionIndexCompositeTrieSetBased<TPk extends TOIMKe
|
|
|
1444
1418
|
* paid only by this opt-in index.
|
|
1445
1419
|
*/
|
|
1446
1420
|
declare class OIMReactiveCollectionIndexCompositeTrieArrayBased<TPk extends TOIMKey, TEntity extends object = object> extends OIMReactiveIndexManualArrayBased<TOIMKeyPath, TPk> {
|
|
1447
|
-
private readonly
|
|
1421
|
+
private readonly getSlot;
|
|
1448
1422
|
private readonly pksByKey;
|
|
1449
1423
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionIndexCompositeArrayBasedOptions<TEntity, TPk>);
|
|
1450
1424
|
setPks(key: TOIMKeyPath, pks: readonly TPk[]): void;
|
|
@@ -1458,8 +1432,8 @@ declare class OIMReactiveCollectionIndexCompositeTrieArrayBased<TPk extends TOIM
|
|
|
1458
1432
|
private membershipOf;
|
|
1459
1433
|
getEntitiesByKey<TItem extends object = TEntity>(key: TOIMKeyPath): (TItem | undefined)[];
|
|
1460
1434
|
getEntitiesByKeys<TItem extends object = TEntity>(keys: readonly TOIMKeyPath[]): Map<TOIMKeyPath, (TItem | undefined)[]>;
|
|
1461
|
-
private
|
|
1462
|
-
private
|
|
1435
|
+
private getSlotsOrTransient;
|
|
1436
|
+
private getSlotOrTransient;
|
|
1463
1437
|
}
|
|
1464
1438
|
|
|
1465
1439
|
/**
|
|
@@ -1548,10 +1522,10 @@ type TOIMCollectionGlobalIndexArrayBasedOptions<TEntity extends object, TPk exte
|
|
|
1548
1522
|
};
|
|
1549
1523
|
} & ({
|
|
1550
1524
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
1551
|
-
|
|
1525
|
+
getSlot?: never;
|
|
1552
1526
|
} | {
|
|
1553
1527
|
collection?: never;
|
|
1554
|
-
|
|
1528
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
1555
1529
|
});
|
|
1556
1530
|
type TOIMCollectionGlobalIndexSetBasedOptions<TEntity extends object, TPk extends TOIMKey> = {
|
|
1557
1531
|
indexOptions?: {
|
|
@@ -1559,10 +1533,10 @@ type TOIMCollectionGlobalIndexSetBasedOptions<TEntity extends object, TPk extend
|
|
|
1559
1533
|
};
|
|
1560
1534
|
} & ({
|
|
1561
1535
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
1562
|
-
|
|
1536
|
+
getSlot?: never;
|
|
1563
1537
|
} | {
|
|
1564
1538
|
collection?: never;
|
|
1565
|
-
|
|
1539
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
1566
1540
|
});
|
|
1567
1541
|
type TOIMDerivedCollectionGlobalIndexArrayBasedOptions<TEntity extends object, TPk extends TOIMKey> = {
|
|
1568
1542
|
/** Build initial state from existing collection slots. Defaults to true. */
|
|
@@ -1608,7 +1582,7 @@ type TOIMRelationsDerivedGlobalSetIndexOptions<TEntity extends object, TPk exten
|
|
|
1608
1582
|
* key (one bucket instead of a per-key map).
|
|
1609
1583
|
*/
|
|
1610
1584
|
declare class OIMReactiveCollectionGlobalIndexManualArrayBased<TPk extends TOIMKey, TEntity extends object = object> extends OIMReactiveGlobalIndexManualArrayBased<TPk> {
|
|
1611
|
-
private readonly
|
|
1585
|
+
private readonly getSlot;
|
|
1612
1586
|
private readonly membership;
|
|
1613
1587
|
private membershipSeeded;
|
|
1614
1588
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionGlobalIndexArrayBasedOptions<TEntity, TPk>);
|
|
@@ -1618,8 +1592,8 @@ declare class OIMReactiveCollectionGlobalIndexManualArrayBased<TPk extends TOIMK
|
|
|
1618
1592
|
clear(): void;
|
|
1619
1593
|
private membershipOf;
|
|
1620
1594
|
getEntities<TItem extends object = TEntity>(): (TItem | undefined)[];
|
|
1621
|
-
private
|
|
1622
|
-
private
|
|
1595
|
+
private getSlotsOrTransient;
|
|
1596
|
+
private getSlotOrTransient;
|
|
1623
1597
|
}
|
|
1624
1598
|
|
|
1625
1599
|
/**
|
|
@@ -1663,7 +1637,7 @@ declare class OIMReactiveGlobalIndexManualSetBased<TPk extends TOIMKey> extends
|
|
|
1663
1637
|
* {@link OIMReactiveCollectionIndexManualSetBased} minus the key.
|
|
1664
1638
|
*/
|
|
1665
1639
|
declare class OIMReactiveCollectionGlobalIndexManualSetBased<TPk extends TOIMKey, TEntity extends object = object> extends OIMReactiveGlobalIndexManualSetBased<TPk> {
|
|
1666
|
-
private readonly
|
|
1640
|
+
private readonly getSlot;
|
|
1667
1641
|
private readonly membership;
|
|
1668
1642
|
private membershipSeeded;
|
|
1669
1643
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionGlobalIndexSetBasedOptions<TEntity, TPk>);
|
|
@@ -1673,7 +1647,7 @@ declare class OIMReactiveCollectionGlobalIndexManualSetBased<TPk extends TOIMKey
|
|
|
1673
1647
|
clear(): void;
|
|
1674
1648
|
private membershipOf;
|
|
1675
1649
|
getEntities<TItem extends object = TEntity>(): (TItem | undefined)[];
|
|
1676
|
-
private
|
|
1650
|
+
private getSlotOrTransient;
|
|
1677
1651
|
}
|
|
1678
1652
|
|
|
1679
1653
|
/**
|
|
@@ -1835,11 +1809,9 @@ declare class OIMReactiveObject<TKey extends string, TValue> extends OIMObject<T
|
|
|
1835
1809
|
* Native-`Map` collection store for primitive PKs. The hot path is a plain
|
|
1836
1810
|
* `Map` — this class NEVER holds a trie, so its `.get`/`.set` call sites stay
|
|
1837
1811
|
* monomorphic even in a process that also runs composite-PK collections (those
|
|
1838
|
-
* use `OIMCollectionStoreTrieDriven`). Byte-for-byte the pre-seam behavior
|
|
1839
|
-
* only addition is a shared native `keyDomain` object the indexes read.
|
|
1812
|
+
* use `OIMCollectionStoreTrieDriven`). Byte-for-byte the pre-seam behavior.
|
|
1840
1813
|
*/
|
|
1841
1814
|
declare class OIMCollectionStoreMapDriven<TEntity extends object, TPk extends TOIMKey> extends OIMCollectionStore<TEntity, TPk> {
|
|
1842
|
-
readonly keyDomain: IOIMKeyDomain<TPk>;
|
|
1843
1815
|
protected readonly slots: Map<TPk, TOIMEntitySlot<TEntity, TPk>>;
|
|
1844
1816
|
protected readonly reservedSlots: Map<TPk, TOIMEntitySlot<TEntity, TPk>>;
|
|
1845
1817
|
setOneByPk(pk: TPk, entity: TEntity): TOIMEntitySlot<TEntity, TPk>;
|
|
@@ -1861,23 +1833,6 @@ declare class OIMCollectionStoreMapDriven<TEntity extends object, TPk extends TO
|
|
|
1861
1833
|
destroy(): void;
|
|
1862
1834
|
}
|
|
1863
1835
|
|
|
1864
|
-
/**
|
|
1865
|
-
* Key domain for composite key paths (`TOIMKeyPath`) — the trie counterpart of
|
|
1866
|
-
* `OIMKeyDomainNative`. Maps/Sets are trie-backed (match array keys by content),
|
|
1867
|
-
* and `canonicalize` interns each logical key into one stable reference via a
|
|
1868
|
-
* shared pool, so a collection's `slot.pk` is a single reference per logical key
|
|
1869
|
-
* and every downstream native `Set<slot.pk>`/`Map<slot.pk>` stays correct.
|
|
1870
|
-
*
|
|
1871
|
-
* Object-key support later: swap in a `keyToSegments` that sorts object entries;
|
|
1872
|
-
* nothing else here or at the call sites changes.
|
|
1873
|
-
*/
|
|
1874
|
-
declare class OIMKeyDomainTrie implements IOIMKeyDomain<TOIMKeyPath> {
|
|
1875
|
-
private readonly pool;
|
|
1876
|
-
createMap<TValue>(): IOIMKeyedMap<TOIMKeyPath, TValue>;
|
|
1877
|
-
createSet(): IOIMKeyedSet<TOIMKeyPath>;
|
|
1878
|
-
canonicalize(key: TOIMKeyPath): TOIMKeyPath;
|
|
1879
|
-
}
|
|
1880
|
-
|
|
1881
1836
|
declare class OIMTrieMap<TSegment, TValue> {
|
|
1882
1837
|
private readonly root;
|
|
1883
1838
|
private _size;
|
|
@@ -1908,10 +1863,8 @@ declare class OIMTrieMap<TSegment, TValue> {
|
|
|
1908
1863
|
* pollution. Method bodies mirror the Map store.
|
|
1909
1864
|
*/
|
|
1910
1865
|
declare class OIMCollectionStoreTrieDriven<TEntity extends object> extends OIMCollectionStore<TEntity, TOIMKeyPath> {
|
|
1911
|
-
readonly keyDomain: IOIMKeyDomain<TOIMKeyPath>;
|
|
1912
1866
|
protected readonly slots: OIMTrieMap<TOIMPk, TOIMEntitySlot<TEntity, TOIMKeyPath>>;
|
|
1913
1867
|
protected readonly reservedSlots: OIMTrieMap<TOIMPk, TOIMEntitySlot<TEntity, TOIMKeyPath>>;
|
|
1914
|
-
constructor(keyDomain?: OIMKeyDomainTrie);
|
|
1915
1868
|
setOneByPk(pk: TOIMKeyPath, entity: TEntity): TOIMEntitySlot<TEntity, TOIMKeyPath>;
|
|
1916
1869
|
getOrReserveSlotByPk(pk: TOIMKeyPath): TOIMEntitySlot<TEntity, TOIMKeyPath>;
|
|
1917
1870
|
setManyByPks(pks: readonly TOIMKeyPath[], entities: TEntity[]): TOIMEntitySlot<TEntity, TOIMKeyPath>[];
|
|
@@ -2058,7 +2011,7 @@ declare class OIMIndexStoreTrieDrivenArrayBased<TPk extends TOIMKey> extends OIM
|
|
|
2058
2011
|
}
|
|
2059
2012
|
|
|
2060
2013
|
/**
|
|
2061
|
-
* Composite-key counterpart of `
|
|
2014
|
+
* Composite-key counterpart of `OIMKeyedCarrierProvider`: backs the index keyed
|
|
2062
2015
|
* emitter for key paths. Maps each key path to a carrier holding that path's
|
|
2063
2016
|
* subscribers + dirty flag, via a trie (`OIMTrieMap`) so a freshly built
|
|
2064
2017
|
* `[a, b, c]` resolves to the same carrier as the one subscribed earlier.
|
|
@@ -2067,7 +2020,7 @@ declare class OIMIndexStoreTrieDrivenArrayBased<TPk extends TOIMKey> extends OIM
|
|
|
2067
2020
|
* when their last subscriber leaves (`onCarrierEmptied`) — the trie drops the
|
|
2068
2021
|
* empty branch, so a churning key-path space does not leak carriers.
|
|
2069
2022
|
*/
|
|
2070
|
-
declare class
|
|
2023
|
+
declare class OIMKeyPathCarrierProvider implements IOIMCarrierProvider<TOIMKeyPath, IOIMKeyCarrier<TOIMKeyPath>> {
|
|
2071
2024
|
private readonly carriers;
|
|
2072
2025
|
getOrReserveCarrier(key: TOIMKeyPath): IOIMKeyCarrier<TOIMKeyPath>;
|
|
2073
2026
|
findCarrier(key: TOIMKeyPath): IOIMKeyCarrier<TOIMKeyPath> | undefined;
|
|
@@ -2075,7 +2028,7 @@ declare class OIMKeyPathCarrierResolver implements IOIMCarrierResolver<TOIMKeyPa
|
|
|
2075
2028
|
}
|
|
2076
2029
|
|
|
2077
2030
|
/**
|
|
2078
|
-
* The bucket-lifecycle surface a carrier
|
|
2031
|
+
* The bucket-lifecycle surface a carrier provider needs from an index store —
|
|
2079
2032
|
* implemented by both the set-based and array-based stores. `getOrReserveBucket`
|
|
2080
2033
|
* creates a reserved (empty) bucket so a subscription can exist before its data;
|
|
2081
2034
|
* `dropIfReserved` prunes such a bucket once its last subscriber leaves.
|
|
@@ -2087,7 +2040,7 @@ interface IOIMCarrierBucketStore<TKey extends TOIMKey, TBucket extends IOIMSubsc
|
|
|
2087
2040
|
}
|
|
2088
2041
|
/**
|
|
2089
2042
|
* Resolves an index key to its carrier — where the carrier IS the index bucket,
|
|
2090
|
-
* owned by the store. Mirrors the collection's slot-based
|
|
2043
|
+
* owned by the store. Mirrors the collection's slot-based provider: subscribers
|
|
2091
2044
|
* live on the bucket, so on a write the reactive index marks the bucket it just
|
|
2092
2045
|
* touched in O(1) with no key→carrier map/trie. Works uniformly for primitive
|
|
2093
2046
|
* (Map) and composite (trie) stores, and for set- and array-based buckets.
|
|
@@ -2096,9 +2049,9 @@ interface IOIMCarrierBucketStore<TKey extends TOIMKey, TBucket extends IOIMSubsc
|
|
|
2096
2049
|
* exist before its data; `onCarrierEmptied` drops such a bucket once its last
|
|
2097
2050
|
* subscriber leaves and it holds no slots.
|
|
2098
2051
|
*/
|
|
2099
|
-
declare class
|
|
2052
|
+
declare class OIMBucketCarrierProvider<TKey extends TOIMKey, TBucket extends IOIMSubscribable & {
|
|
2100
2053
|
readonly key: TKey;
|
|
2101
|
-
}> implements
|
|
2054
|
+
}> implements IOIMCarrierProvider<TKey, TBucket> {
|
|
2102
2055
|
private readonly store;
|
|
2103
2056
|
constructor(store: IOIMCarrierBucketStore<TKey, TBucket>);
|
|
2104
2057
|
getOrReserveCarrier(key: TKey): TBucket;
|
|
@@ -2146,7 +2099,7 @@ declare function createMergeEntityUpdater<TEntity extends object>(): TOIMEntityU
|
|
|
2146
2099
|
/**
|
|
2147
2100
|
* Keyless (single-carrier) pub/sub. The emitter IS the carrier: it holds one
|
|
2148
2101
|
* subscriber set and one dirty flag, so the hot path — marking updated and
|
|
2149
|
-
* delivering — needs no
|
|
2102
|
+
* delivering — needs no provider, no `Map`, no per-key hashing, and no
|
|
2150
2103
|
* `dirtyCarriers[]` batch (there is only ever one carrier).
|
|
2151
2104
|
*
|
|
2152
2105
|
* This is the {@link OIMCarrierKeyedEmitter} analogue for a whole-collection
|
|
@@ -2280,6 +2233,21 @@ declare class OIMDisposeScope implements IOIMDisposable {
|
|
|
2280
2233
|
}
|
|
2281
2234
|
declare function createOIMDisposeScope(): OIMDisposeScope;
|
|
2282
2235
|
|
|
2236
|
+
/**
|
|
2237
|
+
* The Set surface the PK / index-key axis needs, abstracted so the concrete
|
|
2238
|
+
* keying strategy is pluggable. A native `Set` satisfies this interface
|
|
2239
|
+
* structurally (primitive default is a plain `Set`, zero wrapper); a composite
|
|
2240
|
+
* key uses a trie-backed implementation matching array keys by content.
|
|
2241
|
+
*/
|
|
2242
|
+
interface IOIMKeyedSet<TKey> {
|
|
2243
|
+
add(key: TKey): void;
|
|
2244
|
+
has(key: TKey): boolean;
|
|
2245
|
+
delete(key: TKey): boolean;
|
|
2246
|
+
readonly size: number;
|
|
2247
|
+
values(): IterableIterator<TKey>;
|
|
2248
|
+
clear(): void;
|
|
2249
|
+
}
|
|
2250
|
+
|
|
2283
2251
|
/**
|
|
2284
2252
|
* Trie-backed Set of composite key paths — the `Set` counterpart of
|
|
2285
2253
|
* `OIMTrieMap`. Membership is by content, so a freshly built `[a, b]` is the
|
|
@@ -2296,24 +2264,12 @@ declare class OIMTrieSet implements IOIMKeyedSet<TOIMKeyPath> {
|
|
|
2296
2264
|
clear(): void;
|
|
2297
2265
|
}
|
|
2298
2266
|
|
|
2299
|
-
/**
|
|
2300
|
-
* Default key domain for primitive keys (`string | number`): plain native
|
|
2301
|
-
* `Map`/`Set` and identity `canonicalize`. A native `Map`/`Set` structurally
|
|
2302
|
-
* satisfies `IOIMKeyedMap`/`IOIMKeyedSet`, so there is no wrapper and no
|
|
2303
|
-
* indirection — the hot path is byte-for-byte what it was before the seam.
|
|
2304
|
-
*/
|
|
2305
|
-
declare class OIMKeyDomainNative<TKey extends TOIMKey> implements IOIMKeyDomain<TKey> {
|
|
2306
|
-
createMap<TValue>(): IOIMKeyedMap<TKey, TValue>;
|
|
2307
|
-
createSet(): IOIMKeyedSet<TKey>;
|
|
2308
|
-
canonicalize(key: TKey): TKey;
|
|
2309
|
-
}
|
|
2310
|
-
|
|
2311
2267
|
/**
|
|
2312
2268
|
* Projects a PK to/from a string, for the serialization boundaries that can only
|
|
2313
2269
|
* key state by a string: the Redux adapter (state object keyed by id), persist
|
|
2314
2270
|
* storage, JSON snapshots. In-memory core never needs this — it keys PKs by
|
|
2315
|
-
* content via
|
|
2316
|
-
*
|
|
2271
|
+
* content via a trie — but a composite PK path cannot be a string key, so those
|
|
2272
|
+
* boundaries require a codec.
|
|
2317
2273
|
*
|
|
2318
2274
|
* There is intentionally NO default codec for composite keys: a hidden
|
|
2319
2275
|
* `JSON.stringify` would silently couple correctness to key order / escaping.
|
|
@@ -2954,6 +2910,18 @@ declare enum EOIMIndexEventType {
|
|
|
2954
2910
|
UPDATE = 0
|
|
2955
2911
|
}
|
|
2956
2912
|
|
|
2913
|
+
declare enum EOIMEventQueueEventType {
|
|
2914
|
+
AFTER_FLUSH = 0,
|
|
2915
|
+
BEFORE_FLUSH = 1,
|
|
2916
|
+
/**
|
|
2917
|
+
* A task threw during flush. Emitted once per failing task, ALWAYS (whether
|
|
2918
|
+
* or not an `onError` handler is installed) — an observation channel for
|
|
2919
|
+
* tooling (devtools / MCP). It does not replace the error being raised: with
|
|
2920
|
+
* no `onError` handler the error still propagates out of `flush()`.
|
|
2921
|
+
*/
|
|
2922
|
+
FLUSH_ERROR = 2
|
|
2923
|
+
}
|
|
2924
|
+
|
|
2957
2925
|
declare enum EOIMObjectEventType {
|
|
2958
2926
|
UPDATE = 0
|
|
2959
2927
|
}
|
|
@@ -3073,18 +3041,22 @@ declare class OIMEffect {
|
|
|
3073
3041
|
private readonly onAfterFlush;
|
|
3074
3042
|
}
|
|
3075
3043
|
|
|
3044
|
+
/**
|
|
3045
|
+
* Depends on updates to ONE key of a keyed source. The key argument is the whole
|
|
3046
|
+
* key — a composite key `[a, b]` is one key, never split — so there is no
|
|
3047
|
+
* `key | key[]` ambiguity to guess at. To depend on several keys, use several
|
|
3048
|
+
* dependencies (an effect already takes a `deps` array).
|
|
3049
|
+
*/
|
|
3076
3050
|
declare class OIMEffectDependencyKeyed<TKey extends TOIMKey> implements IOIMEffectDependency {
|
|
3077
3051
|
readonly source: IOIMKeyedSubscription<TKey>;
|
|
3078
3052
|
private readonly key;
|
|
3079
|
-
|
|
3080
|
-
constructor(source: IOIMKeyedSubscription<TKey>, keyOrKeys: TKey | readonly TKey[]);
|
|
3053
|
+
constructor(source: IOIMKeyedSubscription<TKey>, key: TKey);
|
|
3081
3054
|
subscribe(onUpdate: () => void): () => void;
|
|
3082
3055
|
}
|
|
3083
3056
|
|
|
3084
3057
|
declare class OIMEffectDependencyKeyedObject<TKey extends string, TValue> implements IOIMEffectDependency {
|
|
3085
3058
|
private readonly dep;
|
|
3086
3059
|
constructor(object: OIMReactiveObject<TKey, TValue>, key: TKey);
|
|
3087
|
-
constructor(object: OIMReactiveObject<TKey, TValue>, keys: readonly TKey[]);
|
|
3088
3060
|
get source(): OIMReactiveObject<TKey, TValue>;
|
|
3089
3061
|
subscribe(onUpdate: () => void): () => void;
|
|
3090
3062
|
}
|
|
@@ -3092,7 +3064,6 @@ declare class OIMEffectDependencyKeyedObject<TKey extends string, TValue> implem
|
|
|
3092
3064
|
declare class OIMEffectDependencyKeyedCollection<TEntity extends object, TPk extends TOIMKey> implements IOIMEffectDependency {
|
|
3093
3065
|
private readonly dep;
|
|
3094
3066
|
constructor(collection: OIMReactiveCollection<TEntity, TPk>, pk: TPk);
|
|
3095
|
-
constructor(collection: OIMReactiveCollection<TEntity, TPk>, pks: readonly TPk[]);
|
|
3096
3067
|
get source(): OIMReactiveCollection<TEntity, TPk>;
|
|
3097
3068
|
subscribe(onUpdate: () => void): () => void;
|
|
3098
3069
|
}
|
|
@@ -3100,7 +3071,6 @@ declare class OIMEffectDependencyKeyedCollection<TEntity extends object, TPk ext
|
|
|
3100
3071
|
declare class OIMEffectDependencyKeyedIndex<TKey extends TOIMKey> implements IOIMEffectDependency {
|
|
3101
3072
|
private readonly dep;
|
|
3102
3073
|
constructor(index: IOIMKeyedSubscription<TKey>, key: TKey);
|
|
3103
|
-
constructor(index: IOIMKeyedSubscription<TKey>, keys: readonly TKey[]);
|
|
3104
3074
|
get source(): IOIMKeyedSubscription<TKey>;
|
|
3105
3075
|
subscribe(onUpdate: () => void): () => void;
|
|
3106
3076
|
}
|
|
@@ -3216,4 +3186,4 @@ declare class OIMEntitiesByGlobalIndexArrayBasedSelector<TEntity extends object,
|
|
|
3216
3186
|
protected areEqual(prev: readonly (TEntity | undefined)[], next: readonly (TEntity | undefined)[]): boolean;
|
|
3217
3187
|
}
|
|
3218
3188
|
|
|
3219
|
-
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMCarrierBucketStore, type
|
|
3189
|
+
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMCarrierBucketStore, type IOIMCarrierProvider, type IOIMComputedEventSource, type IOIMDisposable, type IOIMEffectDependency, type IOIMEventQueueSchedulerEvents, type IOIMGlobalIndexSlotSource, type IOIMIndexSlotSource, type IOIMIndexStore, type IOIMKeyedMap, type IOIMKeyedSet, type IOIMKeyedUpdateEmitter, type IOIMOrderedListCommandSource, type IOIMPkCodec, type IOIMSingleUpdateEmitter, type IOIMSubscribable, type IOIMSubscription, OIMBucketCarrierProvider, OIMCarrierKeyedEmitter, OIMCarrierSingleEmitter, OIMCollection, OIMCollectionByPkSelector, OIMCollectionByPksSelector, OIMCollectionChangedFields, OIMCollectionIndexFactory, OIMCollectionIndexManualOrderedArrayBased, OIMCollectionOrderedListCommandStream, OIMCollectionSelectors, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMCollectionStoreTrieDriven, OIMComparatorFactory, OIMComputeRuntime, OIMComputed, OIMDBSettings, OIMDerivedCollectionGlobalIndexArrayBased, OIMDerivedCollectionGlobalIndexSetBased, OIMDerivedCollectionIndexArrayBased, OIMDerivedCollectionIndexSetBased, OIMDisposeScope, OIMEffect, OIMEffectDependencyComputed, OIMEffectDependencyKeyed, OIMEffectDependencyKeyedCollection, OIMEffectDependencyKeyedIndex, OIMEffectDependencyKeyedObject, OIMEntitiesByGlobalIndexArrayBasedSelector, OIMEntitiesByGlobalIndexSetBasedSelector, OIMEntitiesByIndexKeyArrayBasedSelector, OIMEntitiesByIndexKeySetBasedSelector, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerSync, OIMEventQueueSchedulerTimeout, OIMGlobalIndex, OIMGlobalIndexArrayBased, OIMGlobalIndexManualArrayBased, OIMGlobalIndexManualSetBased, OIMGlobalIndexSetBased, OIMGlobalIndexSlotMap, OIMIndex, OIMIndexArrayBased, OIMIndexComparatorFactory, OIMIndexManualArrayBased, OIMIndexManualOrderedArrayBased, OIMIndexManualSetBased, OIMIndexPksByKeyArrayBasedSelector, OIMIndexPksByKeySetBasedSelector, OIMIndexPksByKeysArrayBasedSelector, OIMIndexPksByKeysSetBasedSelector, OIMIndexSetBased, OIMIndexSlotMap, OIMIndexStoreArrayBased, OIMIndexStoreMapDrivenArrayBased, OIMIndexStoreMapDrivenSetBased, OIMIndexStoreSetBased, OIMIndexStoreTrieDrivenArrayBased, OIMIndexStoreTrieDrivenSetBased, OIMKeyPathCarrierProvider, OIMKeyedBucketArrayBased, OIMKeyedBucketSetBased, OIMMap2Keys, OIMObject, OIMObjectStore, OIMObjectStoreMapDriven, OIMObjectStoreRecordDriven, OIMObjectValueByKeySelector, OIMObjectValuesByKeysSelector, OIMOrderedListCommandBuffer, OIMOrderedListCommandStream, OIMOrderedListCommandStreamDiffDriven, OIMOrderedListMappedCommandStream, OIMPkCodecKeyPath, OIMPkSelectorFactory, OIMReactiveCollection, OIMReactiveCollectionGlobalIndexManualArrayBased, OIMReactiveCollectionGlobalIndexManualSetBased, OIMReactiveCollectionIndexCompositeTrieArrayBased, OIMReactiveCollectionIndexCompositeTrieSetBased, OIMReactiveCollectionIndexManualArrayBased, OIMReactiveCollectionIndexManualSetBased, OIMReactiveGlobalIndex, OIMReactiveGlobalIndexArrayBased, OIMReactiveGlobalIndexManualArrayBased, OIMReactiveGlobalIndexManualSetBased, OIMReactiveGlobalIndexSetBased, OIMReactiveIndex, OIMReactiveIndexArrayBased, OIMReactiveIndexManualArrayBased, OIMReactiveIndexManualSetBased, OIMReactiveIndexSetBased, OIMReactiveObject, OIMSelector, OIMTrieMap, OIMTrieSet, type TOIMAnyEntitySlot, type TOIMCollectionEntitiesSelector, type TOIMCollectionEntitySelector, type TOIMCollectionGlobalIndexArrayBasedOptions, type TOIMCollectionGlobalIndexSetBasedOptions, type TOIMCollectionIndexArrayBasedOptions, type TOIMCollectionIndexCompositeArrayBasedOptions, type TOIMCollectionIndexCompositeSetBasedOptions, type TOIMCollectionIndexSetBasedOptions, type TOIMCollectionKit, type TOIMCollectionOptions, type TOIMCollectionOrderedIndexOptions, type TOIMCollectionOrderedListCommandStreamOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMComputedOptions, type TOIMComputedUpdatePayload, type TOIMDerivedCollectionGlobalIndexArrayBasedOptions, type TOIMDerivedCollectionGlobalIndexSetBasedOptions, type TOIMDerivedCollectionIndexArrayBasedOptions, type TOIMDerivedCollectionIndexSetBasedOptions, type TOIMDerivedEntityComparator, type TOIMDerivedEntityOrderSelector, type TOIMDerivedEntityOrderValue, type TOIMDerivedIndexKeySelector, type TOIMDisposable, type TOIMEffectOptions, type TOIMEntitySlot, type TOIMEntitySlotGetter, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMFlushError, type TOIMGlobalIndexFilter, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptionsArrayBased, type TOIMIndexOptionsSetBased, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMKey, type TOIMKeyPath, type TOIMObjectOptions, type TOIMOrderedListCommand, type TOIMOrderedListDiffOptions, type TOIMPk, type TOIMPkSelector, type TOIMReactiveCollectionFactoryOptions, type TOIMRelationsArrayIndexOptions, type TOIMRelationsCompositeArrayIndexOptions, type TOIMRelationsCompositeSetIndexOptions, type TOIMRelationsDerivedArrayIndexOptions, type TOIMRelationsDerivedGlobalArrayIndexOptions, type TOIMRelationsDerivedGlobalSetIndexOptions, type TOIMRelationsDerivedSetIndexOptions, type TOIMRelationsGlobalArrayIndexOptions, type TOIMRelationsGlobalSetIndexOptions, type TOIMRelationsOrderedListOptions, type TOIMRelationsSetIndexOptions, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdatePayload, createInPlaceEntityUpdater, createMergeEntityUpdater, createOIMCollectionIndexFactory, createOIMCollectionKit, createOIMDisposeScope, createOIMGlobalIndexSlotMap, createOIMIndexSlotMap, createOIMOrderedListCommandStreamDiffDriven, createOIMOrderedListMappedCommandStream, diffOrderedListByPk };
|