@oimdb/core 3.8.0 → 3.9.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 +209 -246
- package/dist/index.d.cts +120 -178
- package/dist/index.d.ts +120 -178
- package/dist/index.js +207 -242
- package/llms.txt +40 -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.
|
|
@@ -492,13 +448,13 @@ declare class OIMEventQueue {
|
|
|
492
448
|
* Collection carrier = the entity slot (by pk); index carrier = the bucket
|
|
493
449
|
* (by index key).
|
|
494
450
|
*/
|
|
495
|
-
interface
|
|
451
|
+
interface IOIMCarrierProvider<TKey extends TOIMKey, TCarrier> {
|
|
496
452
|
getOrReserveCarrier(key: TKey): TCarrier;
|
|
497
453
|
findCarrier(key: TKey): TCarrier | undefined;
|
|
498
454
|
/**
|
|
499
|
-
* Optional: called when a carrier loses its last subscriber, so a
|
|
455
|
+
* Optional: called when a carrier loses its last subscriber, so a carrierProvider
|
|
500
456
|
* that owns standalone carriers (e.g. the index's key→carrier map) can prune
|
|
501
|
-
* it and not leak the key space.
|
|
457
|
+
* it and not leak the key space. Providers whose carriers are owned
|
|
502
458
|
* elsewhere (e.g. the collection's slots) leave this unset.
|
|
503
459
|
*/
|
|
504
460
|
onCarrierEmptied?(carrier: TCarrier): void;
|
|
@@ -516,11 +472,11 @@ interface IOIMCarrierResolver<TKey extends TOIMKey, TCarrier> {
|
|
|
516
472
|
*/
|
|
517
473
|
declare class OIMCarrierKeyedEmitter<TKey extends TOIMKey, TCarrier extends IOIMSubscribable> implements IOIMKeyedUpdateEmitter<TKey> {
|
|
518
474
|
private readonly queue;
|
|
519
|
-
private readonly
|
|
475
|
+
private readonly carrierProvider;
|
|
520
476
|
private readonly subscribedCarriers;
|
|
521
477
|
private dirtyCarriers;
|
|
522
478
|
private isFlushEnqueued;
|
|
523
|
-
constructor(queue: OIMEventQueue,
|
|
479
|
+
constructor(queue: OIMEventQueue, carrierProvider: IOIMCarrierProvider<TKey, TCarrier>);
|
|
524
480
|
subscribeOnKey(key: TKey, handler: TOIMEventHandler<void>): () => void;
|
|
525
481
|
subscribeOnKeys(keys: readonly TKey[], handler: TOIMEventHandler<void>): () => void;
|
|
526
482
|
unsubscribeFromKey(key: TKey, handler: TOIMEventHandler<void>): void;
|
|
@@ -550,7 +506,7 @@ declare class OIMCarrierKeyedEmitter<TKey extends TOIMKey, TCarrier extends IOIM
|
|
|
550
506
|
/**
|
|
551
507
|
* Carrier for a single index key: holds that key's subscribers + dirty flag
|
|
552
508
|
* (via `IOIMSubscribable`) so the keyed emitter delivers straight off the
|
|
553
|
-
* carrier with no per-key map lookup. Carries its own `key` so the
|
|
509
|
+
* carrier with no per-key map lookup. Carries its own `key` so the provider can
|
|
554
510
|
* prune it from the key→carrier map when its last subscriber leaves.
|
|
555
511
|
*/
|
|
556
512
|
interface IOIMKeyCarrier<TKey extends TOIMKey> extends IOIMSubscribable {
|
|
@@ -567,13 +523,13 @@ declare abstract class OIMReactiveIndex<TKey extends TOIMKey, TPk extends TOIMKe
|
|
|
567
523
|
protected readonly updateEmitter: IOIMKeyedUpdateEmitter<TKey>;
|
|
568
524
|
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: IOIMKeyedUpdateEmitter<TKey>) => TIndex,
|
|
569
525
|
/**
|
|
570
|
-
* How to build the key→carrier
|
|
571
|
-
* Defaults to the native-`Map`
|
|
526
|
+
* How to build the key→carrier carrierProvider backing the keyed emitter.
|
|
527
|
+
* Defaults to the native-`Map` carrierProvider used by every primitive-keyed
|
|
572
528
|
* index (its fast path is unchanged). A composite (trie-backed) index
|
|
573
|
-
* passes a
|
|
529
|
+
* passes a carrierProvider that keys carriers by key path instead. Called once
|
|
574
530
|
* at construction — no per-operation cost.
|
|
575
531
|
*/
|
|
576
|
-
|
|
532
|
+
createCarrierProvider?: () => IOIMCarrierProvider<TKey, IOIMKeyCarrier<TKey>>);
|
|
577
533
|
getEntitiesByKey<TEntity extends object = object>(key: TKey): (TEntity | undefined)[];
|
|
578
534
|
getEntitiesByKeys<TEntity extends object = object>(keys: readonly TKey[]): Map<TKey, (TEntity | undefined)[]>;
|
|
579
535
|
hasKey(key: TKey): boolean;
|
|
@@ -604,7 +560,7 @@ declare abstract class OIMReactiveIndex<TKey extends TOIMKey, TPk extends TOIMKe
|
|
|
604
560
|
}
|
|
605
561
|
|
|
606
562
|
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,
|
|
563
|
+
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: IOIMKeyedUpdateEmitter<TKey>) => TIndex, createCarrierProvider?: () => IOIMCarrierProvider<TKey, IOIMKeyCarrier<TKey>>);
|
|
608
564
|
getPksByKey(key: TKey): Set<TPk>;
|
|
609
565
|
getPksByKeys(keys: readonly TKey[]): Map<TKey, Set<TPk>>;
|
|
610
566
|
getSlotsByKey(key: TKey): ReadonlySet<TOIMAnyEntitySlot<TPk>>;
|
|
@@ -612,7 +568,7 @@ declare abstract class OIMReactiveIndexSetBased<TKey extends TOIMKey, TPk extend
|
|
|
612
568
|
}
|
|
613
569
|
|
|
614
570
|
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,
|
|
571
|
+
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: IOIMKeyedUpdateEmitter<TKey>) => TIndex, createCarrierProvider?: () => IOIMCarrierProvider<TKey, IOIMKeyCarrier<TKey>>);
|
|
616
572
|
getPksByKey(key: TKey): TPk[];
|
|
617
573
|
getPksByKeys(keys: readonly TKey[]): Map<TKey, TPk[]>;
|
|
618
574
|
getSlotsByKey(key: TKey): readonly TOIMAnyEntitySlot<TPk>[];
|
|
@@ -713,7 +669,7 @@ interface IOIMSubscription {
|
|
|
713
669
|
* The keyless pub/sub surface a reactive Global node needs from its update
|
|
714
670
|
* emitter: subscribe + a batched "mark updated" delivery. The counterpart of
|
|
715
671
|
* {@link IOIMKeyedUpdateEmitter}, but for exactly one carrier — so there is no
|
|
716
|
-
* key parameter, no
|
|
672
|
+
* key parameter, no provider, and no per-key map.
|
|
717
673
|
*/
|
|
718
674
|
interface IOIMSingleUpdateEmitter extends IOIMSubscription {
|
|
719
675
|
markUpdated(): void;
|
|
@@ -723,7 +679,7 @@ interface IOIMSingleUpdateEmitter extends IOIMSubscription {
|
|
|
723
679
|
|
|
724
680
|
/**
|
|
725
681
|
* Reactive wrapper around a keyless {@link OIMGlobalIndex}. Owns a single-carrier
|
|
726
|
-
* emitter (no
|
|
682
|
+
* emitter (no provider, no key→carrier map), so `subscribe(handler)` is keyless
|
|
727
683
|
* and directly satisfies `IOIMSelectorSourceDependency`. Mirrors
|
|
728
684
|
* {@link OIMReactiveIndex} minus the key.
|
|
729
685
|
*/
|
|
@@ -781,13 +737,17 @@ declare class OIMCollection<TEntity extends object, TPk extends TOIMKey> {
|
|
|
781
737
|
readonly selectPk: TOIMPkSelector<TEntity, TPk>;
|
|
782
738
|
protected readonly store: OIMCollectionStore<TEntity, TPk>;
|
|
783
739
|
protected readonly updateEntity: TOIMEntityUpdater<TEntity>;
|
|
784
|
-
/** The collection's PK keying strategy — read by indexes and wrappers. */
|
|
785
|
-
get keyDomain(): IOIMKeyDomain<TPk>;
|
|
786
740
|
constructor(opts?: TOIMCollectionOptions<TEntity, TPk>);
|
|
787
741
|
getOneByPk(pk: TPk): TEntity | undefined;
|
|
788
742
|
getManyByPks(pks: readonly TPk[]): TEntity[];
|
|
789
743
|
getSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
790
744
|
getOrReserveSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk>;
|
|
745
|
+
/**
|
|
746
|
+
* The existing slot for `pk` (live or reserved) WITHOUT creating one — used
|
|
747
|
+
* by indexes to resolve a pk to its canonical slot for removal (delete by
|
|
748
|
+
* reference), with no side effect for a pk that is not present.
|
|
749
|
+
*/
|
|
750
|
+
findSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
791
751
|
getSlotsByPks(pks: readonly TPk[]): TOIMEntitySlot<TEntity, TPk>[];
|
|
792
752
|
getAllSlots(): TOIMEntitySlot<TEntity, TPk>[];
|
|
793
753
|
upsertOneByPk(pk: TPk, entity: Partial<TEntity>): TOIMEntitySlot<TEntity, TPk>;
|
|
@@ -853,10 +813,10 @@ type TOIMCollectionIndexSetBasedOptions<TEntity extends object, TKey extends TOI
|
|
|
853
813
|
};
|
|
854
814
|
} & ({
|
|
855
815
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
856
|
-
|
|
816
|
+
getSlot?: never;
|
|
857
817
|
} | {
|
|
858
818
|
collection?: never;
|
|
859
|
-
|
|
819
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
860
820
|
});
|
|
861
821
|
type TOIMCollectionIndexArrayBasedOptions<TEntity extends object, TKey extends TOIMKey, TPk extends TOIMKey> = {
|
|
862
822
|
indexOptions?: {
|
|
@@ -865,26 +825,26 @@ type TOIMCollectionIndexArrayBasedOptions<TEntity extends object, TKey extends T
|
|
|
865
825
|
};
|
|
866
826
|
} & ({
|
|
867
827
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
868
|
-
|
|
828
|
+
getSlot?: never;
|
|
869
829
|
} | {
|
|
870
830
|
collection?: never;
|
|
871
|
-
|
|
831
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
872
832
|
});
|
|
873
833
|
type TOIMCollectionOrderedIndexOptions<TEntity extends object, TPk extends TOIMKey> = {
|
|
874
834
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
875
|
-
|
|
835
|
+
getSlot?: never;
|
|
876
836
|
} | {
|
|
877
837
|
collection?: never;
|
|
878
|
-
|
|
838
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
879
839
|
};
|
|
880
840
|
type TOIMCollectionOrderedListCommandStreamOptions<TKey extends TOIMKey, TPk extends TOIMKey, TEntity extends object> = {
|
|
881
841
|
index?: OIMCollectionIndexManualOrderedArrayBased<TKey, TPk, TEntity>;
|
|
882
842
|
} & ({
|
|
883
843
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
884
|
-
|
|
844
|
+
getSlot?: never;
|
|
885
845
|
} | {
|
|
886
846
|
collection?: never;
|
|
887
|
-
|
|
847
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
888
848
|
});
|
|
889
849
|
type TOIMRelationsSetIndexOptions<TKey extends TOIMKey, TPk extends TOIMKey> = {
|
|
890
850
|
indexOptions?: {
|
|
@@ -910,10 +870,10 @@ type TOIMCollectionIndexCompositeSetBasedOptions<TEntity extends object, TPk ext
|
|
|
910
870
|
};
|
|
911
871
|
} & ({
|
|
912
872
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
913
|
-
|
|
873
|
+
getSlot?: never;
|
|
914
874
|
} | {
|
|
915
875
|
collection?: never;
|
|
916
|
-
|
|
876
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
917
877
|
});
|
|
918
878
|
type TOIMRelationsCompositeSetIndexOptions<TPk extends TOIMKey> = {
|
|
919
879
|
indexOptions?: {
|
|
@@ -933,10 +893,10 @@ type TOIMCollectionIndexCompositeArrayBasedOptions<TEntity extends object, TPk e
|
|
|
933
893
|
};
|
|
934
894
|
} & ({
|
|
935
895
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
936
|
-
|
|
896
|
+
getSlot?: never;
|
|
937
897
|
} | {
|
|
938
898
|
collection?: never;
|
|
939
|
-
|
|
899
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
940
900
|
});
|
|
941
901
|
type TOIMRelationsCompositeArrayIndexOptions<TPk extends TOIMKey> = {
|
|
942
902
|
indexOptions?: {
|
|
@@ -1023,16 +983,15 @@ declare class OIMIndexManualOrderedArrayBased<TKey extends TOIMKey, TPk extends
|
|
|
1023
983
|
* them to canonical collection slots at construction-bound write time.
|
|
1024
984
|
*/
|
|
1025
985
|
declare class OIMCollectionIndexManualOrderedArrayBased<TKey extends TOIMKey, TPk extends TOIMKey, TEntity extends object = object> extends OIMIndexManualOrderedArrayBased<TKey, TPk> {
|
|
1026
|
-
private readonly
|
|
986
|
+
private readonly getSlot;
|
|
1027
987
|
constructor(opts: TOIMCollectionOrderedIndexOptions<TEntity, TPk>);
|
|
1028
988
|
push(key: TKey, pk: TPk): number;
|
|
1029
989
|
insertAt(key: TKey, index: number, pk: TPk): number;
|
|
1030
990
|
reset(key: TKey, pks: readonly TPk[]): void;
|
|
1031
991
|
getEntitiesByKey<TItem extends object = TEntity>(key: TKey): (TItem | undefined)[];
|
|
1032
992
|
getEntitiesByKeys<TItem extends object = TEntity>(keys: readonly TKey[]): Map<TKey, (TItem | undefined)[]>;
|
|
1033
|
-
|
|
1034
|
-
private
|
|
1035
|
-
private resolveRequiredSlot;
|
|
993
|
+
getRequiredSlot(pk: TPk): TOIMAnyEntitySlot<TPk>;
|
|
994
|
+
private getRequiredSlots;
|
|
1036
995
|
}
|
|
1037
996
|
|
|
1038
997
|
type TOIMUpdateEventEmitterDeliveryMode = 'queue' | 'after_flush' | 'immediate';
|
|
@@ -1248,7 +1207,7 @@ declare class OIMCollectionOrderedListCommandStream<TKey extends TOIMKey, TPk ex
|
|
|
1248
1207
|
set(key: TKey, pks: readonly TPk[]): void;
|
|
1249
1208
|
getSlotsByKey(key: TKey): readonly TOIMEntitySlot<TEntity, TPk>[];
|
|
1250
1209
|
getEntitiesByKey(key: TKey): (TEntity | undefined)[];
|
|
1251
|
-
private
|
|
1210
|
+
private getRequiredSlot;
|
|
1252
1211
|
}
|
|
1253
1212
|
|
|
1254
1213
|
/**
|
|
@@ -1301,9 +1260,9 @@ declare class OIMReactiveIndexManualArrayBased<TKey extends TOIMKey, TPk extends
|
|
|
1301
1260
|
* through the collection binding supplied at construction time.
|
|
1302
1261
|
*/
|
|
1303
1262
|
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
|
|
1263
|
+
private readonly getSlot;
|
|
1264
|
+
private readonly findSlotForRemoval;
|
|
1265
|
+
private readonly slotsByKey;
|
|
1307
1266
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionIndexArrayBasedOptions<TEntity, TKey, TPk>);
|
|
1308
1267
|
setPks(key: TKey, pks: readonly TPk[]): void;
|
|
1309
1268
|
addPks(key: TKey, pks: readonly TPk[]): void;
|
|
@@ -1316,8 +1275,8 @@ declare class OIMReactiveCollectionIndexManualArrayBased<TKey extends TOIMKey, T
|
|
|
1316
1275
|
private membershipOf;
|
|
1317
1276
|
getEntitiesByKey<TItem extends object = TEntity>(key: TKey): (TItem | undefined)[];
|
|
1318
1277
|
getEntitiesByKeys<TItem extends object = TEntity>(keys: readonly TKey[]): Map<TKey, (TItem | undefined)[]>;
|
|
1319
|
-
private
|
|
1320
|
-
private
|
|
1278
|
+
private getSlotsOrTransient;
|
|
1279
|
+
private getSlotOrTransient;
|
|
1321
1280
|
}
|
|
1322
1281
|
|
|
1323
1282
|
/**
|
|
@@ -1331,15 +1290,18 @@ declare class OIMReactiveCollectionIndexManualArrayBased<TKey extends TOIMKey, T
|
|
|
1331
1290
|
* and re-filling.
|
|
1332
1291
|
*/
|
|
1333
1292
|
declare class OIMIndexManualSetBased<TIndexKey extends TOIMKey, TPk extends TOIMKey> extends OIMIndexSetBased<TIndexKey, TPk> {
|
|
1334
|
-
protected readonly pkDomain: IOIMKeyDomain<TPk>;
|
|
1335
1293
|
constructor(options?: {
|
|
1336
1294
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
1337
1295
|
store?: OIMIndexStoreSetBased<TIndexKey, TPk>;
|
|
1338
|
-
pkDomain?: IOIMKeyDomain<TPk>;
|
|
1339
1296
|
});
|
|
1340
1297
|
setSlots(key: TIndexKey, slots: Iterable<TOIMAnyEntitySlot<TPk>>): void;
|
|
1341
|
-
setPks(key: TIndexKey, pks: readonly TPk[],
|
|
1342
|
-
addPks(key: TIndexKey, pks: readonly TPk[],
|
|
1298
|
+
setPks(key: TIndexKey, pks: readonly TPk[], getSlot: (pk: TPk) => TOIMAnyEntitySlot<TPk>): void;
|
|
1299
|
+
addPks(key: TIndexKey, pks: readonly TPk[], getSlot: (pk: TPk) => TOIMAnyEntitySlot<TPk>): void;
|
|
1300
|
+
/**
|
|
1301
|
+
* Removes by pk. `pks` must be canonical `slot.pk` references (membership is
|
|
1302
|
+
* keyed by them): for primitive pks that is just the pk; a collection-bound
|
|
1303
|
+
* composite index canonicalizes raw pks to `slot.pk` before calling this.
|
|
1304
|
+
*/
|
|
1343
1305
|
removePks(key: TIndexKey, pks: readonly TPk[]): void;
|
|
1344
1306
|
/**
|
|
1345
1307
|
* The bucket's pk → slot membership, lazily created and seeded from the
|
|
@@ -1374,12 +1336,6 @@ declare class OIMReactiveIndexManualSetBased<TKey extends TOIMKey, TPk extends T
|
|
|
1374
1336
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
1375
1337
|
store?: OIMIndexStoreSetBased<TKey, TPk>;
|
|
1376
1338
|
};
|
|
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
1339
|
});
|
|
1384
1340
|
setSlots(key: TKey, slots: Iterable<TOIMAnyEntitySlot<TPk>>): void;
|
|
1385
1341
|
addSlots(key: TKey, slots: readonly TOIMAnyEntitySlot<TPk>[]): void;
|
|
@@ -1396,9 +1352,10 @@ declare class OIMReactiveIndexManualSetBased<TKey extends TOIMKey, TPk extends T
|
|
|
1396
1352
|
* the key's store bucket exactly once (no separate membership map/trie).
|
|
1397
1353
|
*/
|
|
1398
1354
|
declare class OIMReactiveCollectionIndexManualSetBased<TKey extends TOIMKey, TPk extends TOIMKey, TEntity extends object = object> extends OIMReactiveIndexManualSetBased<TKey, TPk> {
|
|
1399
|
-
private readonly
|
|
1400
|
-
private readonly
|
|
1355
|
+
private readonly getSlot;
|
|
1356
|
+
private readonly getSlotOrTransient;
|
|
1401
1357
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionIndexSetBasedOptions<TEntity, TKey, TPk>);
|
|
1358
|
+
private readonly findSlotForRemoval;
|
|
1402
1359
|
setPks(key: TKey, pks: readonly TPk[]): void;
|
|
1403
1360
|
addPks(key: TKey, pks: readonly TPk[]): void;
|
|
1404
1361
|
removePks(key: TKey, pks: readonly TPk[]): void;
|
|
@@ -1423,9 +1380,10 @@ declare class OIMReactiveCollectionIndexManualSetBased<TKey extends TOIMKey, TPk
|
|
|
1423
1380
|
* path — the trie cost is paid only by this opt-in index.
|
|
1424
1381
|
*/
|
|
1425
1382
|
declare class OIMReactiveCollectionIndexCompositeTrieSetBased<TPk extends TOIMKey, TEntity extends object = object> extends OIMReactiveIndexManualSetBased<TOIMKeyPath, TPk> {
|
|
1426
|
-
private readonly
|
|
1427
|
-
private readonly
|
|
1383
|
+
private readonly getSlot;
|
|
1384
|
+
private readonly getSlotOrTransient;
|
|
1428
1385
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionIndexCompositeSetBasedOptions<TEntity, TPk>);
|
|
1386
|
+
private readonly findSlotForRemoval;
|
|
1429
1387
|
setPks(key: TOIMKeyPath, pks: readonly TPk[]): void;
|
|
1430
1388
|
addPks(key: TOIMKeyPath, pks: readonly TPk[]): void;
|
|
1431
1389
|
removePks(key: TOIMKeyPath, pks: readonly TPk[]): void;
|
|
@@ -1444,7 +1402,7 @@ declare class OIMReactiveCollectionIndexCompositeTrieSetBased<TPk extends TOIMKe
|
|
|
1444
1402
|
* paid only by this opt-in index.
|
|
1445
1403
|
*/
|
|
1446
1404
|
declare class OIMReactiveCollectionIndexCompositeTrieArrayBased<TPk extends TOIMKey, TEntity extends object = object> extends OIMReactiveIndexManualArrayBased<TOIMKeyPath, TPk> {
|
|
1447
|
-
private readonly
|
|
1405
|
+
private readonly getSlot;
|
|
1448
1406
|
private readonly pksByKey;
|
|
1449
1407
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionIndexCompositeArrayBasedOptions<TEntity, TPk>);
|
|
1450
1408
|
setPks(key: TOIMKeyPath, pks: readonly TPk[]): void;
|
|
@@ -1458,8 +1416,8 @@ declare class OIMReactiveCollectionIndexCompositeTrieArrayBased<TPk extends TOIM
|
|
|
1458
1416
|
private membershipOf;
|
|
1459
1417
|
getEntitiesByKey<TItem extends object = TEntity>(key: TOIMKeyPath): (TItem | undefined)[];
|
|
1460
1418
|
getEntitiesByKeys<TItem extends object = TEntity>(keys: readonly TOIMKeyPath[]): Map<TOIMKeyPath, (TItem | undefined)[]>;
|
|
1461
|
-
private
|
|
1462
|
-
private
|
|
1419
|
+
private getSlotsOrTransient;
|
|
1420
|
+
private getSlotOrTransient;
|
|
1463
1421
|
}
|
|
1464
1422
|
|
|
1465
1423
|
/**
|
|
@@ -1548,10 +1506,10 @@ type TOIMCollectionGlobalIndexArrayBasedOptions<TEntity extends object, TPk exte
|
|
|
1548
1506
|
};
|
|
1549
1507
|
} & ({
|
|
1550
1508
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
1551
|
-
|
|
1509
|
+
getSlot?: never;
|
|
1552
1510
|
} | {
|
|
1553
1511
|
collection?: never;
|
|
1554
|
-
|
|
1512
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
1555
1513
|
});
|
|
1556
1514
|
type TOIMCollectionGlobalIndexSetBasedOptions<TEntity extends object, TPk extends TOIMKey> = {
|
|
1557
1515
|
indexOptions?: {
|
|
@@ -1559,10 +1517,10 @@ type TOIMCollectionGlobalIndexSetBasedOptions<TEntity extends object, TPk extend
|
|
|
1559
1517
|
};
|
|
1560
1518
|
} & ({
|
|
1561
1519
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
1562
|
-
|
|
1520
|
+
getSlot?: never;
|
|
1563
1521
|
} | {
|
|
1564
1522
|
collection?: never;
|
|
1565
|
-
|
|
1523
|
+
getSlot: TOIMEntitySlotGetter<TPk>;
|
|
1566
1524
|
});
|
|
1567
1525
|
type TOIMDerivedCollectionGlobalIndexArrayBasedOptions<TEntity extends object, TPk extends TOIMKey> = {
|
|
1568
1526
|
/** Build initial state from existing collection slots. Defaults to true. */
|
|
@@ -1608,7 +1566,7 @@ type TOIMRelationsDerivedGlobalSetIndexOptions<TEntity extends object, TPk exten
|
|
|
1608
1566
|
* key (one bucket instead of a per-key map).
|
|
1609
1567
|
*/
|
|
1610
1568
|
declare class OIMReactiveCollectionGlobalIndexManualArrayBased<TPk extends TOIMKey, TEntity extends object = object> extends OIMReactiveGlobalIndexManualArrayBased<TPk> {
|
|
1611
|
-
private readonly
|
|
1569
|
+
private readonly getSlot;
|
|
1612
1570
|
private readonly membership;
|
|
1613
1571
|
private membershipSeeded;
|
|
1614
1572
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionGlobalIndexArrayBasedOptions<TEntity, TPk>);
|
|
@@ -1618,8 +1576,8 @@ declare class OIMReactiveCollectionGlobalIndexManualArrayBased<TPk extends TOIMK
|
|
|
1618
1576
|
clear(): void;
|
|
1619
1577
|
private membershipOf;
|
|
1620
1578
|
getEntities<TItem extends object = TEntity>(): (TItem | undefined)[];
|
|
1621
|
-
private
|
|
1622
|
-
private
|
|
1579
|
+
private getSlotsOrTransient;
|
|
1580
|
+
private getSlotOrTransient;
|
|
1623
1581
|
}
|
|
1624
1582
|
|
|
1625
1583
|
/**
|
|
@@ -1663,7 +1621,7 @@ declare class OIMReactiveGlobalIndexManualSetBased<TPk extends TOIMKey> extends
|
|
|
1663
1621
|
* {@link OIMReactiveCollectionIndexManualSetBased} minus the key.
|
|
1664
1622
|
*/
|
|
1665
1623
|
declare class OIMReactiveCollectionGlobalIndexManualSetBased<TPk extends TOIMKey, TEntity extends object = object> extends OIMReactiveGlobalIndexManualSetBased<TPk> {
|
|
1666
|
-
private readonly
|
|
1624
|
+
private readonly getSlot;
|
|
1667
1625
|
private readonly membership;
|
|
1668
1626
|
private membershipSeeded;
|
|
1669
1627
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionGlobalIndexSetBasedOptions<TEntity, TPk>);
|
|
@@ -1673,7 +1631,7 @@ declare class OIMReactiveCollectionGlobalIndexManualSetBased<TPk extends TOIMKey
|
|
|
1673
1631
|
clear(): void;
|
|
1674
1632
|
private membershipOf;
|
|
1675
1633
|
getEntities<TItem extends object = TEntity>(): (TItem | undefined)[];
|
|
1676
|
-
private
|
|
1634
|
+
private getSlotOrTransient;
|
|
1677
1635
|
}
|
|
1678
1636
|
|
|
1679
1637
|
/**
|
|
@@ -1835,11 +1793,9 @@ declare class OIMReactiveObject<TKey extends string, TValue> extends OIMObject<T
|
|
|
1835
1793
|
* Native-`Map` collection store for primitive PKs. The hot path is a plain
|
|
1836
1794
|
* `Map` — this class NEVER holds a trie, so its `.get`/`.set` call sites stay
|
|
1837
1795
|
* 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.
|
|
1796
|
+
* use `OIMCollectionStoreTrieDriven`). Byte-for-byte the pre-seam behavior.
|
|
1840
1797
|
*/
|
|
1841
1798
|
declare class OIMCollectionStoreMapDriven<TEntity extends object, TPk extends TOIMKey> extends OIMCollectionStore<TEntity, TPk> {
|
|
1842
|
-
readonly keyDomain: IOIMKeyDomain<TPk>;
|
|
1843
1799
|
protected readonly slots: Map<TPk, TOIMEntitySlot<TEntity, TPk>>;
|
|
1844
1800
|
protected readonly reservedSlots: Map<TPk, TOIMEntitySlot<TEntity, TPk>>;
|
|
1845
1801
|
setOneByPk(pk: TPk, entity: TEntity): TOIMEntitySlot<TEntity, TPk>;
|
|
@@ -1861,23 +1817,6 @@ declare class OIMCollectionStoreMapDriven<TEntity extends object, TPk extends TO
|
|
|
1861
1817
|
destroy(): void;
|
|
1862
1818
|
}
|
|
1863
1819
|
|
|
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
1820
|
declare class OIMTrieMap<TSegment, TValue> {
|
|
1882
1821
|
private readonly root;
|
|
1883
1822
|
private _size;
|
|
@@ -1908,10 +1847,8 @@ declare class OIMTrieMap<TSegment, TValue> {
|
|
|
1908
1847
|
* pollution. Method bodies mirror the Map store.
|
|
1909
1848
|
*/
|
|
1910
1849
|
declare class OIMCollectionStoreTrieDriven<TEntity extends object> extends OIMCollectionStore<TEntity, TOIMKeyPath> {
|
|
1911
|
-
readonly keyDomain: IOIMKeyDomain<TOIMKeyPath>;
|
|
1912
1850
|
protected readonly slots: OIMTrieMap<TOIMPk, TOIMEntitySlot<TEntity, TOIMKeyPath>>;
|
|
1913
1851
|
protected readonly reservedSlots: OIMTrieMap<TOIMPk, TOIMEntitySlot<TEntity, TOIMKeyPath>>;
|
|
1914
|
-
constructor(keyDomain?: OIMKeyDomainTrie);
|
|
1915
1852
|
setOneByPk(pk: TOIMKeyPath, entity: TEntity): TOIMEntitySlot<TEntity, TOIMKeyPath>;
|
|
1916
1853
|
getOrReserveSlotByPk(pk: TOIMKeyPath): TOIMEntitySlot<TEntity, TOIMKeyPath>;
|
|
1917
1854
|
setManyByPks(pks: readonly TOIMKeyPath[], entities: TEntity[]): TOIMEntitySlot<TEntity, TOIMKeyPath>[];
|
|
@@ -2058,7 +1995,7 @@ declare class OIMIndexStoreTrieDrivenArrayBased<TPk extends TOIMKey> extends OIM
|
|
|
2058
1995
|
}
|
|
2059
1996
|
|
|
2060
1997
|
/**
|
|
2061
|
-
* Composite-key counterpart of `
|
|
1998
|
+
* Composite-key counterpart of `OIMKeyedCarrierProvider`: backs the index keyed
|
|
2062
1999
|
* emitter for key paths. Maps each key path to a carrier holding that path's
|
|
2063
2000
|
* subscribers + dirty flag, via a trie (`OIMTrieMap`) so a freshly built
|
|
2064
2001
|
* `[a, b, c]` resolves to the same carrier as the one subscribed earlier.
|
|
@@ -2067,7 +2004,7 @@ declare class OIMIndexStoreTrieDrivenArrayBased<TPk extends TOIMKey> extends OIM
|
|
|
2067
2004
|
* when their last subscriber leaves (`onCarrierEmptied`) — the trie drops the
|
|
2068
2005
|
* empty branch, so a churning key-path space does not leak carriers.
|
|
2069
2006
|
*/
|
|
2070
|
-
declare class
|
|
2007
|
+
declare class OIMKeyPathCarrierProvider implements IOIMCarrierProvider<TOIMKeyPath, IOIMKeyCarrier<TOIMKeyPath>> {
|
|
2071
2008
|
private readonly carriers;
|
|
2072
2009
|
getOrReserveCarrier(key: TOIMKeyPath): IOIMKeyCarrier<TOIMKeyPath>;
|
|
2073
2010
|
findCarrier(key: TOIMKeyPath): IOIMKeyCarrier<TOIMKeyPath> | undefined;
|
|
@@ -2075,7 +2012,7 @@ declare class OIMKeyPathCarrierResolver implements IOIMCarrierResolver<TOIMKeyPa
|
|
|
2075
2012
|
}
|
|
2076
2013
|
|
|
2077
2014
|
/**
|
|
2078
|
-
* The bucket-lifecycle surface a carrier
|
|
2015
|
+
* The bucket-lifecycle surface a carrier provider needs from an index store —
|
|
2079
2016
|
* implemented by both the set-based and array-based stores. `getOrReserveBucket`
|
|
2080
2017
|
* creates a reserved (empty) bucket so a subscription can exist before its data;
|
|
2081
2018
|
* `dropIfReserved` prunes such a bucket once its last subscriber leaves.
|
|
@@ -2087,7 +2024,7 @@ interface IOIMCarrierBucketStore<TKey extends TOIMKey, TBucket extends IOIMSubsc
|
|
|
2087
2024
|
}
|
|
2088
2025
|
/**
|
|
2089
2026
|
* 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
|
|
2027
|
+
* owned by the store. Mirrors the collection's slot-based provider: subscribers
|
|
2091
2028
|
* live on the bucket, so on a write the reactive index marks the bucket it just
|
|
2092
2029
|
* touched in O(1) with no key→carrier map/trie. Works uniformly for primitive
|
|
2093
2030
|
* (Map) and composite (trie) stores, and for set- and array-based buckets.
|
|
@@ -2096,9 +2033,9 @@ interface IOIMCarrierBucketStore<TKey extends TOIMKey, TBucket extends IOIMSubsc
|
|
|
2096
2033
|
* exist before its data; `onCarrierEmptied` drops such a bucket once its last
|
|
2097
2034
|
* subscriber leaves and it holds no slots.
|
|
2098
2035
|
*/
|
|
2099
|
-
declare class
|
|
2036
|
+
declare class OIMBucketCarrierProvider<TKey extends TOIMKey, TBucket extends IOIMSubscribable & {
|
|
2100
2037
|
readonly key: TKey;
|
|
2101
|
-
}> implements
|
|
2038
|
+
}> implements IOIMCarrierProvider<TKey, TBucket> {
|
|
2102
2039
|
private readonly store;
|
|
2103
2040
|
constructor(store: IOIMCarrierBucketStore<TKey, TBucket>);
|
|
2104
2041
|
getOrReserveCarrier(key: TKey): TBucket;
|
|
@@ -2146,7 +2083,7 @@ declare function createMergeEntityUpdater<TEntity extends object>(): TOIMEntityU
|
|
|
2146
2083
|
/**
|
|
2147
2084
|
* Keyless (single-carrier) pub/sub. The emitter IS the carrier: it holds one
|
|
2148
2085
|
* subscriber set and one dirty flag, so the hot path — marking updated and
|
|
2149
|
-
* delivering — needs no
|
|
2086
|
+
* delivering — needs no provider, no `Map`, no per-key hashing, and no
|
|
2150
2087
|
* `dirtyCarriers[]` batch (there is only ever one carrier).
|
|
2151
2088
|
*
|
|
2152
2089
|
* This is the {@link OIMCarrierKeyedEmitter} analogue for a whole-collection
|
|
@@ -2280,6 +2217,21 @@ declare class OIMDisposeScope implements IOIMDisposable {
|
|
|
2280
2217
|
}
|
|
2281
2218
|
declare function createOIMDisposeScope(): OIMDisposeScope;
|
|
2282
2219
|
|
|
2220
|
+
/**
|
|
2221
|
+
* The Set surface the PK / index-key axis needs, abstracted so the concrete
|
|
2222
|
+
* keying strategy is pluggable. A native `Set` satisfies this interface
|
|
2223
|
+
* structurally (primitive default is a plain `Set`, zero wrapper); a composite
|
|
2224
|
+
* key uses a trie-backed implementation matching array keys by content.
|
|
2225
|
+
*/
|
|
2226
|
+
interface IOIMKeyedSet<TKey> {
|
|
2227
|
+
add(key: TKey): void;
|
|
2228
|
+
has(key: TKey): boolean;
|
|
2229
|
+
delete(key: TKey): boolean;
|
|
2230
|
+
readonly size: number;
|
|
2231
|
+
values(): IterableIterator<TKey>;
|
|
2232
|
+
clear(): void;
|
|
2233
|
+
}
|
|
2234
|
+
|
|
2283
2235
|
/**
|
|
2284
2236
|
* Trie-backed Set of composite key paths — the `Set` counterpart of
|
|
2285
2237
|
* `OIMTrieMap`. Membership is by content, so a freshly built `[a, b]` is the
|
|
@@ -2296,24 +2248,12 @@ declare class OIMTrieSet implements IOIMKeyedSet<TOIMKeyPath> {
|
|
|
2296
2248
|
clear(): void;
|
|
2297
2249
|
}
|
|
2298
2250
|
|
|
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
2251
|
/**
|
|
2312
2252
|
* Projects a PK to/from a string, for the serialization boundaries that can only
|
|
2313
2253
|
* key state by a string: the Redux adapter (state object keyed by id), persist
|
|
2314
2254
|
* storage, JSON snapshots. In-memory core never needs this — it keys PKs by
|
|
2315
|
-
* content via
|
|
2316
|
-
*
|
|
2255
|
+
* content via a trie — but a composite PK path cannot be a string key, so those
|
|
2256
|
+
* boundaries require a codec.
|
|
2317
2257
|
*
|
|
2318
2258
|
* There is intentionally NO default codec for composite keys: a hidden
|
|
2319
2259
|
* `JSON.stringify` would silently couple correctness to key order / escaping.
|
|
@@ -3073,18 +3013,22 @@ declare class OIMEffect {
|
|
|
3073
3013
|
private readonly onAfterFlush;
|
|
3074
3014
|
}
|
|
3075
3015
|
|
|
3016
|
+
/**
|
|
3017
|
+
* Depends on updates to ONE key of a keyed source. The key argument is the whole
|
|
3018
|
+
* key — a composite key `[a, b]` is one key, never split — so there is no
|
|
3019
|
+
* `key | key[]` ambiguity to guess at. To depend on several keys, use several
|
|
3020
|
+
* dependencies (an effect already takes a `deps` array).
|
|
3021
|
+
*/
|
|
3076
3022
|
declare class OIMEffectDependencyKeyed<TKey extends TOIMKey> implements IOIMEffectDependency {
|
|
3077
3023
|
readonly source: IOIMKeyedSubscription<TKey>;
|
|
3078
3024
|
private readonly key;
|
|
3079
|
-
|
|
3080
|
-
constructor(source: IOIMKeyedSubscription<TKey>, keyOrKeys: TKey | readonly TKey[]);
|
|
3025
|
+
constructor(source: IOIMKeyedSubscription<TKey>, key: TKey);
|
|
3081
3026
|
subscribe(onUpdate: () => void): () => void;
|
|
3082
3027
|
}
|
|
3083
3028
|
|
|
3084
3029
|
declare class OIMEffectDependencyKeyedObject<TKey extends string, TValue> implements IOIMEffectDependency {
|
|
3085
3030
|
private readonly dep;
|
|
3086
3031
|
constructor(object: OIMReactiveObject<TKey, TValue>, key: TKey);
|
|
3087
|
-
constructor(object: OIMReactiveObject<TKey, TValue>, keys: readonly TKey[]);
|
|
3088
3032
|
get source(): OIMReactiveObject<TKey, TValue>;
|
|
3089
3033
|
subscribe(onUpdate: () => void): () => void;
|
|
3090
3034
|
}
|
|
@@ -3092,7 +3036,6 @@ declare class OIMEffectDependencyKeyedObject<TKey extends string, TValue> implem
|
|
|
3092
3036
|
declare class OIMEffectDependencyKeyedCollection<TEntity extends object, TPk extends TOIMKey> implements IOIMEffectDependency {
|
|
3093
3037
|
private readonly dep;
|
|
3094
3038
|
constructor(collection: OIMReactiveCollection<TEntity, TPk>, pk: TPk);
|
|
3095
|
-
constructor(collection: OIMReactiveCollection<TEntity, TPk>, pks: readonly TPk[]);
|
|
3096
3039
|
get source(): OIMReactiveCollection<TEntity, TPk>;
|
|
3097
3040
|
subscribe(onUpdate: () => void): () => void;
|
|
3098
3041
|
}
|
|
@@ -3100,7 +3043,6 @@ declare class OIMEffectDependencyKeyedCollection<TEntity extends object, TPk ext
|
|
|
3100
3043
|
declare class OIMEffectDependencyKeyedIndex<TKey extends TOIMKey> implements IOIMEffectDependency {
|
|
3101
3044
|
private readonly dep;
|
|
3102
3045
|
constructor(index: IOIMKeyedSubscription<TKey>, key: TKey);
|
|
3103
|
-
constructor(index: IOIMKeyedSubscription<TKey>, keys: readonly TKey[]);
|
|
3104
3046
|
get source(): IOIMKeyedSubscription<TKey>;
|
|
3105
3047
|
subscribe(onUpdate: () => void): () => void;
|
|
3106
3048
|
}
|
|
@@ -3216,4 +3158,4 @@ declare class OIMEntitiesByGlobalIndexArrayBasedSelector<TEntity extends object,
|
|
|
3216
3158
|
protected areEqual(prev: readonly (TEntity | undefined)[], next: readonly (TEntity | undefined)[]): boolean;
|
|
3217
3159
|
}
|
|
3218
3160
|
|
|
3219
|
-
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMCarrierBucketStore, type
|
|
3161
|
+
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 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 };
|