@oimdb/core 1.4.1 → 1.5.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 +27 -13
- package/dist/index.cjs +308 -98
- package/dist/index.d.cts +70 -20
- package/dist/index.d.ts +70 -20
- package/dist/index.js +308 -98
- package/package.json +4 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
type TOIMPk = string | number;
|
|
2
2
|
|
|
3
|
+
type TOIMEntitySlot<TEntity extends object, TPk extends TOIMPk> = {
|
|
4
|
+
pk: TPk;
|
|
5
|
+
item: TEntity | undefined;
|
|
6
|
+
};
|
|
7
|
+
type TOIMAnyEntitySlot<TPk extends TOIMPk> = TOIMEntitySlot<object, TPk>;
|
|
8
|
+
type TOIMEntitySlotResolver<TPk extends TOIMPk> = (pk: TPk) => TOIMAnyEntitySlot<TPk> | undefined;
|
|
9
|
+
|
|
3
10
|
declare abstract class OIMCollectionStore<TEntity extends object, TPk extends TOIMPk> {
|
|
4
11
|
abstract setOneByPk(pk: TPk, entity: TEntity): void;
|
|
12
|
+
abstract getSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
13
|
+
abstract getSlotsByPks(pks: readonly TPk[]): TOIMEntitySlot<TEntity, TPk>[];
|
|
14
|
+
abstract getAllSlots(): TOIMEntitySlot<TEntity, TPk>[];
|
|
5
15
|
abstract removeOneByPk(pk: TPk): void;
|
|
6
16
|
abstract removeManyByPks(pks: readonly TPk[]): void;
|
|
7
17
|
abstract getOneByPk(pk: TPk): TEntity | undefined;
|
|
@@ -14,25 +24,25 @@ declare abstract class OIMCollectionStore<TEntity extends object, TPk extends TO
|
|
|
14
24
|
}
|
|
15
25
|
|
|
16
26
|
declare abstract class OIMIndexStoreSetBased<TKey extends TOIMPk, TPk extends TOIMPk> {
|
|
17
|
-
abstract setOneByKey(key: TKey,
|
|
27
|
+
abstract setOneByKey(key: TKey, slots: Set<TOIMAnyEntitySlot<TPk>>): void;
|
|
18
28
|
abstract removeOneByKey(key: TKey): void;
|
|
19
29
|
abstract removeManyByKeys(keys: readonly TKey[]): void;
|
|
20
|
-
abstract getOneByKey(key: TKey): Set<TPk
|
|
21
|
-
abstract getManyByKeys(keys: readonly TKey[]): Map<TKey, Set<TPk
|
|
30
|
+
abstract getOneByKey(key: TKey): Set<TOIMAnyEntitySlot<TPk>> | undefined;
|
|
31
|
+
abstract getManyByKeys(keys: readonly TKey[]): Map<TKey, Set<TOIMAnyEntitySlot<TPk>>>;
|
|
22
32
|
abstract getAllKeys(): TKey[];
|
|
23
|
-
abstract getAll(): Map<TKey, Set<TPk
|
|
33
|
+
abstract getAll(): Map<TKey, Set<TOIMAnyEntitySlot<TPk>>>;
|
|
24
34
|
abstract countAll(): number;
|
|
25
35
|
abstract clear(): void;
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
declare abstract class OIMIndexStoreArrayBased<TKey extends TOIMPk, TPk extends TOIMPk> {
|
|
29
|
-
abstract setOneByKey(key: TKey,
|
|
39
|
+
abstract setOneByKey(key: TKey, slots: TOIMAnyEntitySlot<TPk>[]): void;
|
|
30
40
|
abstract removeOneByKey(key: TKey): void;
|
|
31
41
|
abstract removeManyByKeys(keys: readonly TKey[]): void;
|
|
32
|
-
abstract getOneByKey(key: TKey): TPk[] | undefined;
|
|
33
|
-
abstract getManyByKeys(keys: readonly TKey[]): Map<TKey, TPk[]>;
|
|
42
|
+
abstract getOneByKey(key: TKey): TOIMAnyEntitySlot<TPk>[] | undefined;
|
|
43
|
+
abstract getManyByKeys(keys: readonly TKey[]): Map<TKey, TOIMAnyEntitySlot<TPk>[]>;
|
|
34
44
|
abstract getAllKeys(): TKey[];
|
|
35
|
-
abstract getAll(): Map<TKey, TPk[]>;
|
|
45
|
+
abstract getAll(): Map<TKey, TOIMAnyEntitySlot<TPk>[]>;
|
|
36
46
|
abstract countAll(): number;
|
|
37
47
|
abstract clear(): void;
|
|
38
48
|
}
|
|
@@ -99,17 +109,21 @@ type TOIMIndexComparator<TPk extends TOIMPk> = (existingPks: readonly TPk[], new
|
|
|
99
109
|
declare abstract class OIMIndexSetBased<TKey extends TOIMPk, TPk extends TOIMPk> {
|
|
100
110
|
protected readonly comparePks?: TOIMIndexComparator<TPk>;
|
|
101
111
|
protected readonly store: OIMIndexStoreSetBased<TKey, TPk>;
|
|
112
|
+
protected resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
113
|
+
private readonly fallbackSlots;
|
|
102
114
|
readonly emitter: OIMEventEmitter<{
|
|
103
115
|
0: TOIMIndexUpdatePayload<TKey>;
|
|
104
116
|
}>;
|
|
105
117
|
constructor(options?: {
|
|
106
118
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
107
119
|
store?: OIMIndexStoreSetBased<TKey, TPk>;
|
|
120
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
108
121
|
});
|
|
109
122
|
/**
|
|
110
123
|
* Get primary keys for multiple index keys
|
|
111
124
|
*/
|
|
112
125
|
getPksByKeys(keys: readonly TKey[]): Map<TKey, Set<TPk>>;
|
|
126
|
+
setSlotResolver(resolveSlot: TOIMEntitySlotResolver<TPk>): void;
|
|
113
127
|
/**
|
|
114
128
|
* @deprecated Use getPksByKey instead
|
|
115
129
|
* Get primary keys for a specific index key
|
|
@@ -119,6 +133,8 @@ declare abstract class OIMIndexSetBased<TKey extends TOIMPk, TPk extends TOIMPk>
|
|
|
119
133
|
* Get primary keys for a specific index key
|
|
120
134
|
*/
|
|
121
135
|
getPksByKey(key: TKey): Set<TPk>;
|
|
136
|
+
getSlotsByKey(key: TKey): ReadonlySet<TOIMAnyEntitySlot<TPk>>;
|
|
137
|
+
getSlotsByKeys(keys: readonly TKey[]): Map<TKey, ReadonlySet<TOIMAnyEntitySlot<TPk>>>;
|
|
122
138
|
/**
|
|
123
139
|
* Check if an index key exists
|
|
124
140
|
*/
|
|
@@ -158,6 +174,10 @@ declare abstract class OIMIndexSetBased<TKey extends TOIMPk, TPk extends TOIMPk>
|
|
|
158
174
|
* If comparator is provided and returns true (no changes), skip the update.
|
|
159
175
|
*/
|
|
160
176
|
protected setPksWithComparison(key: TKey, newPks: Set<TPk>): boolean;
|
|
177
|
+
protected setSlotsWithComparison(key: TKey, newSlots: Set<TOIMAnyEntitySlot<TPk>>): boolean;
|
|
178
|
+
protected resolveSlots(pks: Iterable<TPk>): Set<TOIMAnyEntitySlot<TPk>>;
|
|
179
|
+
protected getOrCreateSlot(pk: TPk): TOIMAnyEntitySlot<TPk>;
|
|
180
|
+
protected slotsToPks(slots: Iterable<TOIMAnyEntitySlot<TPk>>): Set<TPk>;
|
|
161
181
|
/**
|
|
162
182
|
* Emit update event with changed keys
|
|
163
183
|
*/
|
|
@@ -175,21 +195,27 @@ declare abstract class OIMIndexSetBased<TKey extends TOIMPk, TPk extends TOIMPk>
|
|
|
175
195
|
declare abstract class OIMIndexArrayBased<TKey extends TOIMPk, TPk extends TOIMPk> {
|
|
176
196
|
protected readonly comparePks?: TOIMIndexComparator<TPk>;
|
|
177
197
|
protected readonly store: OIMIndexStoreArrayBased<TKey, TPk>;
|
|
198
|
+
protected resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
199
|
+
private readonly fallbackSlots;
|
|
178
200
|
readonly emitter: OIMEventEmitter<{
|
|
179
201
|
0: TOIMIndexUpdatePayload<TKey>;
|
|
180
202
|
}>;
|
|
181
203
|
constructor(options?: {
|
|
182
204
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
183
205
|
store?: OIMIndexStoreArrayBased<TKey, TPk>;
|
|
206
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
184
207
|
});
|
|
185
208
|
/**
|
|
186
209
|
* Get primary keys for multiple index keys
|
|
187
210
|
*/
|
|
188
211
|
getPksByKeys(keys: readonly TKey[]): Map<TKey, TPk[]>;
|
|
212
|
+
setSlotResolver(resolveSlot: TOIMEntitySlotResolver<TPk>): void;
|
|
189
213
|
/**
|
|
190
214
|
* Get primary keys for a specific index key
|
|
191
215
|
*/
|
|
192
216
|
getPksByKey(key: TKey): TPk[];
|
|
217
|
+
getSlotsByKey(key: TKey): readonly TOIMAnyEntitySlot<TPk>[];
|
|
218
|
+
getSlotsByKeys(keys: readonly TKey[]): Map<TKey, readonly TOIMAnyEntitySlot<TPk>[]>;
|
|
193
219
|
/**
|
|
194
220
|
* Check if an index key exists
|
|
195
221
|
*/
|
|
@@ -229,6 +255,10 @@ declare abstract class OIMIndexArrayBased<TKey extends TOIMPk, TPk extends TOIMP
|
|
|
229
255
|
* If comparator is provided and returns true (no changes), skip the update.
|
|
230
256
|
*/
|
|
231
257
|
protected setPksWithComparison(key: TKey, newPks: TPk[]): boolean;
|
|
258
|
+
protected setSlotsWithComparison(key: TKey, newSlots: TOIMAnyEntitySlot<TPk>[]): boolean;
|
|
259
|
+
protected resolveSlots(pks: readonly TPk[]): TOIMAnyEntitySlot<TPk>[];
|
|
260
|
+
protected getOrCreateSlot(pk: TPk): TOIMAnyEntitySlot<TPk>;
|
|
261
|
+
protected slotsToPks(slots: readonly TOIMAnyEntitySlot<TPk>[]): TPk[];
|
|
232
262
|
/**
|
|
233
263
|
* Emit update event with changed keys
|
|
234
264
|
*/
|
|
@@ -368,6 +398,8 @@ declare abstract class OIMReactiveIndexSetBased<TKey extends TOIMPk, TPk extends
|
|
|
368
398
|
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: OIMUpdateEventEmitter<TKey>) => TIndex);
|
|
369
399
|
getPksByKey(key: TKey): Set<TPk>;
|
|
370
400
|
getPksByKeys(keys: readonly TKey[]): Map<TKey, Set<TPk>>;
|
|
401
|
+
getSlotsByKey(key: TKey): ReadonlySet<TOIMAnyEntitySlot<TPk>>;
|
|
402
|
+
getSlotsByKeys(keys: readonly TKey[]): Map<TKey, ReadonlySet<TOIMAnyEntitySlot<TPk>>>;
|
|
371
403
|
hasKey(key: TKey): boolean;
|
|
372
404
|
getKeys(): readonly TKey[];
|
|
373
405
|
getKeySize(key: TKey): number;
|
|
@@ -401,6 +433,8 @@ declare abstract class OIMReactiveIndexArrayBased<TKey extends TOIMPk, TPk exten
|
|
|
401
433
|
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: OIMUpdateEventEmitter<TKey>) => TIndex);
|
|
402
434
|
getPksByKey(key: TKey): TPk[];
|
|
403
435
|
getPksByKeys(keys: readonly TKey[]): Map<TKey, TPk[]>;
|
|
436
|
+
getSlotsByKey(key: TKey): readonly TOIMAnyEntitySlot<TPk>[];
|
|
437
|
+
getSlotsByKeys(keys: readonly TKey[]): Map<TKey, readonly TOIMAnyEntitySlot<TPk>[]>;
|
|
404
438
|
hasKey(key: TKey): boolean;
|
|
405
439
|
getKeys(): readonly TKey[];
|
|
406
440
|
getKeySize(key: TKey): number;
|
|
@@ -467,6 +501,9 @@ declare class OIMCollection<TEntity extends object, TPk extends TOIMPk> {
|
|
|
467
501
|
constructor(opts?: TOIMCollectionOptions<TEntity, TPk>);
|
|
468
502
|
getOneByPk(pk: TPk): TEntity | undefined;
|
|
469
503
|
getManyByPks(pks: readonly TPk[]): TEntity[];
|
|
504
|
+
getSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
505
|
+
getSlotsByPks(pks: readonly TPk[]): TOIMEntitySlot<TEntity, TPk>[];
|
|
506
|
+
getAllSlots(): TOIMEntitySlot<TEntity, TPk>[];
|
|
470
507
|
upsertOneByPk(pk: TPk, entity: Partial<TEntity>): void;
|
|
471
508
|
upsertOne(entity: TEntity | Partial<TEntity>): void;
|
|
472
509
|
upsertMany(entities: (TEntity | Partial<TEntity>)[]): void;
|
|
@@ -578,12 +615,14 @@ declare class OIMIndexManualSetBased<TIndexKey extends TOIMPk, TPk extends TOIMP
|
|
|
578
615
|
constructor(options?: {
|
|
579
616
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
580
617
|
store?: OIMIndexStoreSetBased<TIndexKey, TPk>;
|
|
618
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
581
619
|
});
|
|
582
620
|
/**
|
|
583
621
|
* Set primary keys for a specific index key, replacing any existing values.
|
|
584
622
|
* Uses optional comparator to skip updates if PKs haven't actually changed.
|
|
585
623
|
*/
|
|
586
624
|
setPks(key: TIndexKey, pks: TPk[]): void;
|
|
625
|
+
setSlots(key: TIndexKey, slots: Iterable<TOIMAnyEntitySlot<TPk>>): void;
|
|
587
626
|
/**
|
|
588
627
|
* Add primary keys to a specific index key
|
|
589
628
|
*/
|
|
@@ -603,9 +642,11 @@ declare class OIMReactiveIndexManualSetBased<TKey extends TOIMPk, TPk extends TO
|
|
|
603
642
|
indexOptions?: {
|
|
604
643
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
605
644
|
store?: OIMIndexStoreSetBased<TKey, TPk>;
|
|
645
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
606
646
|
};
|
|
607
647
|
});
|
|
608
648
|
setPks(key: TKey, pks: TPk[]): void;
|
|
649
|
+
setSlots(key: TKey, slots: Iterable<TOIMAnyEntitySlot<TPk>>): void;
|
|
609
650
|
addPks(key: TKey, pks: readonly TPk[]): void;
|
|
610
651
|
removePks(key: TKey, pks: readonly TPk[]): void;
|
|
611
652
|
clear(key?: TKey): void;
|
|
@@ -619,12 +660,14 @@ declare class OIMIndexManualArrayBased<TIndexKey extends TOIMPk, TPk extends TOI
|
|
|
619
660
|
constructor(options?: {
|
|
620
661
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
621
662
|
store?: OIMIndexStoreArrayBased<TIndexKey, TPk>;
|
|
663
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
622
664
|
});
|
|
623
665
|
/**
|
|
624
666
|
* Set primary keys for a specific index key, replacing any existing values.
|
|
625
667
|
* Uses optional comparator to skip updates if PKs haven't actually changed.
|
|
626
668
|
*/
|
|
627
669
|
setPks(key: TIndexKey, pks: TPk[]): void;
|
|
670
|
+
setSlots(key: TIndexKey, slots: TOIMAnyEntitySlot<TPk>[]): void;
|
|
628
671
|
/**
|
|
629
672
|
* Add primary keys to a specific index key
|
|
630
673
|
*/
|
|
@@ -644,9 +687,11 @@ declare class OIMReactiveIndexManualArrayBased<TKey extends TOIMPk, TPk extends
|
|
|
644
687
|
indexOptions?: {
|
|
645
688
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
646
689
|
store?: OIMIndexStoreArrayBased<TKey, TPk>;
|
|
690
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
647
691
|
};
|
|
648
692
|
});
|
|
649
693
|
setPks(key: TKey, pks: TPk[]): void;
|
|
694
|
+
setSlots(key: TKey, slots: TOIMAnyEntitySlot<TPk>[]): void;
|
|
650
695
|
addPks(key: TKey, pks: readonly TPk[]): void;
|
|
651
696
|
removePks(key: TKey, pks: readonly TPk[]): void;
|
|
652
697
|
clear(key?: TKey): void;
|
|
@@ -662,9 +707,12 @@ declare class OIMRICollection<TEntity extends object, TPk extends TOIMPk, TIndex
|
|
|
662
707
|
}
|
|
663
708
|
|
|
664
709
|
declare class OIMCollectionStoreMapDriven<TEntity extends object, TPk extends TOIMPk> extends OIMCollectionStore<TEntity, TPk> {
|
|
665
|
-
protected readonly
|
|
710
|
+
protected readonly slots: Map<TPk, TOIMEntitySlot<TEntity, TPk>>;
|
|
666
711
|
setOneByPk(pk: TPk, entity: TEntity): void;
|
|
667
712
|
setManyByPks(pks: readonly TPk[], entities: TEntity[]): void;
|
|
713
|
+
getSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
714
|
+
getSlotsByPks(pks: readonly TPk[]): TOIMEntitySlot<TEntity, TPk>[];
|
|
715
|
+
getAllSlots(): TOIMEntitySlot<TEntity, TPk>[];
|
|
668
716
|
removeOneByPk(pk: TPk): void;
|
|
669
717
|
removeManyByPks(pks: readonly TPk[]): void;
|
|
670
718
|
getOneByPk(pk: TPk): TEntity | undefined;
|
|
@@ -714,27 +762,27 @@ declare class OIMObjectStoreRecordDriven<TKey extends string, TValue> extends OI
|
|
|
714
762
|
}
|
|
715
763
|
|
|
716
764
|
declare class OIMIndexStoreMapDrivenSetBased<TKey extends TOIMPk, TPk extends TOIMPk> extends OIMIndexStoreSetBased<TKey, TPk> {
|
|
717
|
-
protected readonly
|
|
718
|
-
setOneByKey(key: TKey,
|
|
765
|
+
protected readonly slots: Map<TKey, Set<TOIMAnyEntitySlot<TPk>>>;
|
|
766
|
+
setOneByKey(key: TKey, slots: Set<TOIMAnyEntitySlot<TPk>>): void;
|
|
719
767
|
removeOneByKey(key: TKey): void;
|
|
720
768
|
removeManyByKeys(keys: readonly TKey[]): void;
|
|
721
|
-
getOneByKey(key: TKey): Set<TPk
|
|
722
|
-
getManyByKeys(keys: readonly TKey[]): Map<TKey, Set<TPk
|
|
769
|
+
getOneByKey(key: TKey): Set<TOIMAnyEntitySlot<TPk>> | undefined;
|
|
770
|
+
getManyByKeys(keys: readonly TKey[]): Map<TKey, Set<TOIMAnyEntitySlot<TPk>>>;
|
|
723
771
|
getAllKeys(): TKey[];
|
|
724
|
-
getAll(): Map<TKey, Set<TPk
|
|
772
|
+
getAll(): Map<TKey, Set<TOIMAnyEntitySlot<TPk>>>;
|
|
725
773
|
countAll(): number;
|
|
726
774
|
clear(): void;
|
|
727
775
|
}
|
|
728
776
|
|
|
729
777
|
declare class OIMIndexStoreMapDrivenArrayBased<TKey extends TOIMPk, TPk extends TOIMPk> extends OIMIndexStoreArrayBased<TKey, TPk> {
|
|
730
|
-
protected readonly
|
|
731
|
-
setOneByKey(key: TKey,
|
|
778
|
+
protected readonly slots: Map<TKey, TOIMAnyEntitySlot<TPk>[]>;
|
|
779
|
+
setOneByKey(key: TKey, slots: TOIMAnyEntitySlot<TPk>[]): void;
|
|
732
780
|
removeOneByKey(key: TKey): void;
|
|
733
781
|
removeManyByKeys(keys: readonly TKey[]): void;
|
|
734
|
-
getOneByKey(key: TKey): TPk[] | undefined;
|
|
735
|
-
getManyByKeys(keys: readonly TKey[]): Map<TKey, TPk[]>;
|
|
782
|
+
getOneByKey(key: TKey): TOIMAnyEntitySlot<TPk>[] | undefined;
|
|
783
|
+
getManyByKeys(keys: readonly TKey[]): Map<TKey, TOIMAnyEntitySlot<TPk>[]>;
|
|
736
784
|
getAllKeys(): TKey[];
|
|
737
|
-
getAll(): Map<TKey, TPk[]>;
|
|
785
|
+
getAll(): Map<TKey, TOIMAnyEntitySlot<TPk>[]>;
|
|
738
786
|
countAll(): number;
|
|
739
787
|
clear(): void;
|
|
740
788
|
}
|
|
@@ -1048,12 +1096,14 @@ type TOIMIndexKey = string | number | bigint;
|
|
|
1048
1096
|
type TOIMIndexOptionsSetBased<TIndexKey extends TOIMPk, TPk extends TOIMPk> = {
|
|
1049
1097
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
1050
1098
|
store?: OIMIndexStoreSetBased<TIndexKey, TPk>;
|
|
1099
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
1051
1100
|
};
|
|
1052
1101
|
/**
|
|
1053
1102
|
* Configuration options for Array-based index instances */
|
|
1054
1103
|
type TOIMIndexOptionsArrayBased<TIndexKey extends TOIMPk, TPk extends TOIMPk> = {
|
|
1055
1104
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
1056
1105
|
store?: OIMIndexStoreArrayBased<TIndexKey, TPk>;
|
|
1106
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
1057
1107
|
};
|
|
1058
1108
|
/**
|
|
1059
1109
|
* @deprecated Use TOIMIndexOptionsSetBased or TOIMIndexOptionsArrayBased instead
|
|
@@ -1349,4 +1399,4 @@ declare class OIMEntitiesByIndexKeyArrayBasedSelector<TEntity extends object, TP
|
|
|
1349
1399
|
protected areEqual(prev: readonly (TEntity | undefined)[], next: readonly (TEntity | undefined)[]): boolean;
|
|
1350
1400
|
}
|
|
1351
1401
|
|
|
1352
|
-
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMComputedEventSource, type IOIMEffectDependency, type IOIMEventQueueSchedulerEvents, OIMCollection, OIMCollectionByPkSelector, OIMCollectionByPksSelector, OIMCollectionChangedFieldsWrapper, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMComputativeRuntime, OIMComputed, OIMDBSettings, OIMEffect, OIMEffectDependencyComputed, OIMEffectDependencyKeyed, OIMEffectDependencyKeyedCollection, OIMEffectDependencyKeyedIndex, OIMEffectDependencyKeyedObject, OIMEntitiesByIndexKeyArrayBasedSelector, OIMEntitiesByIndexKeySetBasedSelector, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndexArrayBased, OIMIndexComparatorFactory, OIMIndexManualArrayBased, OIMIndexManualOrderedArrayBased, OIMIndexManualSetBased, OIMIndexPksByKeyArrayBasedSelector, OIMIndexPksByKeySetBasedSelector, OIMIndexPksByKeysArrayBasedSelector, OIMIndexPksByKeysSetBasedSelector, OIMIndexSetBased, OIMIndexStoreArrayBased, OIMIndexStoreMapDrivenArrayBased, OIMIndexStoreMapDrivenSetBased, OIMIndexStoreSetBased, OIMMap2Keys, OIMObject, OIMObjectStore, OIMObjectStoreMapDriven, OIMObjectStoreRecordDriven, OIMObjectValueByKeySelector, OIMObjectValuesByKeysSelector, OIMOrderedListIndexCommandStreamWrapper, OIMPkSelectorFactory, OIMRICollection, OIMReactiveCollection, OIMReactiveIndexArrayBased, OIMReactiveIndexManualArrayBased, OIMReactiveIndexManualSetBased, OIMReactiveIndexSetBased, OIMReactiveObject, OIMSelector, type TOIMCollectionOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMComputedOptions, type TOIMComputedUpdatePayload, type TOIMEffectOptions, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptions, type TOIMIndexOptionsArrayBased, type TOIMIndexOptionsSetBased, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMObjectOptions, type TOIMOrderedListCommand, type TOIMPk, type TOIMPkSelector, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdatePayload };
|
|
1402
|
+
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMComputedEventSource, type IOIMEffectDependency, type IOIMEventQueueSchedulerEvents, OIMCollection, OIMCollectionByPkSelector, OIMCollectionByPksSelector, OIMCollectionChangedFieldsWrapper, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMComputativeRuntime, OIMComputed, OIMDBSettings, OIMEffect, OIMEffectDependencyComputed, OIMEffectDependencyKeyed, OIMEffectDependencyKeyedCollection, OIMEffectDependencyKeyedIndex, OIMEffectDependencyKeyedObject, OIMEntitiesByIndexKeyArrayBasedSelector, OIMEntitiesByIndexKeySetBasedSelector, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndexArrayBased, OIMIndexComparatorFactory, OIMIndexManualArrayBased, OIMIndexManualOrderedArrayBased, OIMIndexManualSetBased, OIMIndexPksByKeyArrayBasedSelector, OIMIndexPksByKeySetBasedSelector, OIMIndexPksByKeysArrayBasedSelector, OIMIndexPksByKeysSetBasedSelector, OIMIndexSetBased, OIMIndexStoreArrayBased, OIMIndexStoreMapDrivenArrayBased, OIMIndexStoreMapDrivenSetBased, OIMIndexStoreSetBased, OIMMap2Keys, OIMObject, OIMObjectStore, OIMObjectStoreMapDriven, OIMObjectStoreRecordDriven, OIMObjectValueByKeySelector, OIMObjectValuesByKeysSelector, OIMOrderedListIndexCommandStreamWrapper, OIMPkSelectorFactory, OIMRICollection, OIMReactiveCollection, OIMReactiveIndexArrayBased, OIMReactiveIndexManualArrayBased, OIMReactiveIndexManualSetBased, OIMReactiveIndexSetBased, OIMReactiveObject, OIMSelector, type TOIMAnyEntitySlot, type TOIMCollectionOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMComputedOptions, type TOIMComputedUpdatePayload, type TOIMEffectOptions, type TOIMEntitySlot, type TOIMEntitySlotResolver, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptions, type TOIMIndexOptionsArrayBased, type TOIMIndexOptionsSetBased, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMObjectOptions, type TOIMOrderedListCommand, type TOIMPk, type TOIMPkSelector, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdatePayload };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
type TOIMPk = string | number;
|
|
2
2
|
|
|
3
|
+
type TOIMEntitySlot<TEntity extends object, TPk extends TOIMPk> = {
|
|
4
|
+
pk: TPk;
|
|
5
|
+
item: TEntity | undefined;
|
|
6
|
+
};
|
|
7
|
+
type TOIMAnyEntitySlot<TPk extends TOIMPk> = TOIMEntitySlot<object, TPk>;
|
|
8
|
+
type TOIMEntitySlotResolver<TPk extends TOIMPk> = (pk: TPk) => TOIMAnyEntitySlot<TPk> | undefined;
|
|
9
|
+
|
|
3
10
|
declare abstract class OIMCollectionStore<TEntity extends object, TPk extends TOIMPk> {
|
|
4
11
|
abstract setOneByPk(pk: TPk, entity: TEntity): void;
|
|
12
|
+
abstract getSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
13
|
+
abstract getSlotsByPks(pks: readonly TPk[]): TOIMEntitySlot<TEntity, TPk>[];
|
|
14
|
+
abstract getAllSlots(): TOIMEntitySlot<TEntity, TPk>[];
|
|
5
15
|
abstract removeOneByPk(pk: TPk): void;
|
|
6
16
|
abstract removeManyByPks(pks: readonly TPk[]): void;
|
|
7
17
|
abstract getOneByPk(pk: TPk): TEntity | undefined;
|
|
@@ -14,25 +24,25 @@ declare abstract class OIMCollectionStore<TEntity extends object, TPk extends TO
|
|
|
14
24
|
}
|
|
15
25
|
|
|
16
26
|
declare abstract class OIMIndexStoreSetBased<TKey extends TOIMPk, TPk extends TOIMPk> {
|
|
17
|
-
abstract setOneByKey(key: TKey,
|
|
27
|
+
abstract setOneByKey(key: TKey, slots: Set<TOIMAnyEntitySlot<TPk>>): void;
|
|
18
28
|
abstract removeOneByKey(key: TKey): void;
|
|
19
29
|
abstract removeManyByKeys(keys: readonly TKey[]): void;
|
|
20
|
-
abstract getOneByKey(key: TKey): Set<TPk
|
|
21
|
-
abstract getManyByKeys(keys: readonly TKey[]): Map<TKey, Set<TPk
|
|
30
|
+
abstract getOneByKey(key: TKey): Set<TOIMAnyEntitySlot<TPk>> | undefined;
|
|
31
|
+
abstract getManyByKeys(keys: readonly TKey[]): Map<TKey, Set<TOIMAnyEntitySlot<TPk>>>;
|
|
22
32
|
abstract getAllKeys(): TKey[];
|
|
23
|
-
abstract getAll(): Map<TKey, Set<TPk
|
|
33
|
+
abstract getAll(): Map<TKey, Set<TOIMAnyEntitySlot<TPk>>>;
|
|
24
34
|
abstract countAll(): number;
|
|
25
35
|
abstract clear(): void;
|
|
26
36
|
}
|
|
27
37
|
|
|
28
38
|
declare abstract class OIMIndexStoreArrayBased<TKey extends TOIMPk, TPk extends TOIMPk> {
|
|
29
|
-
abstract setOneByKey(key: TKey,
|
|
39
|
+
abstract setOneByKey(key: TKey, slots: TOIMAnyEntitySlot<TPk>[]): void;
|
|
30
40
|
abstract removeOneByKey(key: TKey): void;
|
|
31
41
|
abstract removeManyByKeys(keys: readonly TKey[]): void;
|
|
32
|
-
abstract getOneByKey(key: TKey): TPk[] | undefined;
|
|
33
|
-
abstract getManyByKeys(keys: readonly TKey[]): Map<TKey, TPk[]>;
|
|
42
|
+
abstract getOneByKey(key: TKey): TOIMAnyEntitySlot<TPk>[] | undefined;
|
|
43
|
+
abstract getManyByKeys(keys: readonly TKey[]): Map<TKey, TOIMAnyEntitySlot<TPk>[]>;
|
|
34
44
|
abstract getAllKeys(): TKey[];
|
|
35
|
-
abstract getAll(): Map<TKey, TPk[]>;
|
|
45
|
+
abstract getAll(): Map<TKey, TOIMAnyEntitySlot<TPk>[]>;
|
|
36
46
|
abstract countAll(): number;
|
|
37
47
|
abstract clear(): void;
|
|
38
48
|
}
|
|
@@ -99,17 +109,21 @@ type TOIMIndexComparator<TPk extends TOIMPk> = (existingPks: readonly TPk[], new
|
|
|
99
109
|
declare abstract class OIMIndexSetBased<TKey extends TOIMPk, TPk extends TOIMPk> {
|
|
100
110
|
protected readonly comparePks?: TOIMIndexComparator<TPk>;
|
|
101
111
|
protected readonly store: OIMIndexStoreSetBased<TKey, TPk>;
|
|
112
|
+
protected resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
113
|
+
private readonly fallbackSlots;
|
|
102
114
|
readonly emitter: OIMEventEmitter<{
|
|
103
115
|
0: TOIMIndexUpdatePayload<TKey>;
|
|
104
116
|
}>;
|
|
105
117
|
constructor(options?: {
|
|
106
118
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
107
119
|
store?: OIMIndexStoreSetBased<TKey, TPk>;
|
|
120
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
108
121
|
});
|
|
109
122
|
/**
|
|
110
123
|
* Get primary keys for multiple index keys
|
|
111
124
|
*/
|
|
112
125
|
getPksByKeys(keys: readonly TKey[]): Map<TKey, Set<TPk>>;
|
|
126
|
+
setSlotResolver(resolveSlot: TOIMEntitySlotResolver<TPk>): void;
|
|
113
127
|
/**
|
|
114
128
|
* @deprecated Use getPksByKey instead
|
|
115
129
|
* Get primary keys for a specific index key
|
|
@@ -119,6 +133,8 @@ declare abstract class OIMIndexSetBased<TKey extends TOIMPk, TPk extends TOIMPk>
|
|
|
119
133
|
* Get primary keys for a specific index key
|
|
120
134
|
*/
|
|
121
135
|
getPksByKey(key: TKey): Set<TPk>;
|
|
136
|
+
getSlotsByKey(key: TKey): ReadonlySet<TOIMAnyEntitySlot<TPk>>;
|
|
137
|
+
getSlotsByKeys(keys: readonly TKey[]): Map<TKey, ReadonlySet<TOIMAnyEntitySlot<TPk>>>;
|
|
122
138
|
/**
|
|
123
139
|
* Check if an index key exists
|
|
124
140
|
*/
|
|
@@ -158,6 +174,10 @@ declare abstract class OIMIndexSetBased<TKey extends TOIMPk, TPk extends TOIMPk>
|
|
|
158
174
|
* If comparator is provided and returns true (no changes), skip the update.
|
|
159
175
|
*/
|
|
160
176
|
protected setPksWithComparison(key: TKey, newPks: Set<TPk>): boolean;
|
|
177
|
+
protected setSlotsWithComparison(key: TKey, newSlots: Set<TOIMAnyEntitySlot<TPk>>): boolean;
|
|
178
|
+
protected resolveSlots(pks: Iterable<TPk>): Set<TOIMAnyEntitySlot<TPk>>;
|
|
179
|
+
protected getOrCreateSlot(pk: TPk): TOIMAnyEntitySlot<TPk>;
|
|
180
|
+
protected slotsToPks(slots: Iterable<TOIMAnyEntitySlot<TPk>>): Set<TPk>;
|
|
161
181
|
/**
|
|
162
182
|
* Emit update event with changed keys
|
|
163
183
|
*/
|
|
@@ -175,21 +195,27 @@ declare abstract class OIMIndexSetBased<TKey extends TOIMPk, TPk extends TOIMPk>
|
|
|
175
195
|
declare abstract class OIMIndexArrayBased<TKey extends TOIMPk, TPk extends TOIMPk> {
|
|
176
196
|
protected readonly comparePks?: TOIMIndexComparator<TPk>;
|
|
177
197
|
protected readonly store: OIMIndexStoreArrayBased<TKey, TPk>;
|
|
198
|
+
protected resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
199
|
+
private readonly fallbackSlots;
|
|
178
200
|
readonly emitter: OIMEventEmitter<{
|
|
179
201
|
0: TOIMIndexUpdatePayload<TKey>;
|
|
180
202
|
}>;
|
|
181
203
|
constructor(options?: {
|
|
182
204
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
183
205
|
store?: OIMIndexStoreArrayBased<TKey, TPk>;
|
|
206
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
184
207
|
});
|
|
185
208
|
/**
|
|
186
209
|
* Get primary keys for multiple index keys
|
|
187
210
|
*/
|
|
188
211
|
getPksByKeys(keys: readonly TKey[]): Map<TKey, TPk[]>;
|
|
212
|
+
setSlotResolver(resolveSlot: TOIMEntitySlotResolver<TPk>): void;
|
|
189
213
|
/**
|
|
190
214
|
* Get primary keys for a specific index key
|
|
191
215
|
*/
|
|
192
216
|
getPksByKey(key: TKey): TPk[];
|
|
217
|
+
getSlotsByKey(key: TKey): readonly TOIMAnyEntitySlot<TPk>[];
|
|
218
|
+
getSlotsByKeys(keys: readonly TKey[]): Map<TKey, readonly TOIMAnyEntitySlot<TPk>[]>;
|
|
193
219
|
/**
|
|
194
220
|
* Check if an index key exists
|
|
195
221
|
*/
|
|
@@ -229,6 +255,10 @@ declare abstract class OIMIndexArrayBased<TKey extends TOIMPk, TPk extends TOIMP
|
|
|
229
255
|
* If comparator is provided and returns true (no changes), skip the update.
|
|
230
256
|
*/
|
|
231
257
|
protected setPksWithComparison(key: TKey, newPks: TPk[]): boolean;
|
|
258
|
+
protected setSlotsWithComparison(key: TKey, newSlots: TOIMAnyEntitySlot<TPk>[]): boolean;
|
|
259
|
+
protected resolveSlots(pks: readonly TPk[]): TOIMAnyEntitySlot<TPk>[];
|
|
260
|
+
protected getOrCreateSlot(pk: TPk): TOIMAnyEntitySlot<TPk>;
|
|
261
|
+
protected slotsToPks(slots: readonly TOIMAnyEntitySlot<TPk>[]): TPk[];
|
|
232
262
|
/**
|
|
233
263
|
* Emit update event with changed keys
|
|
234
264
|
*/
|
|
@@ -368,6 +398,8 @@ declare abstract class OIMReactiveIndexSetBased<TKey extends TOIMPk, TPk extends
|
|
|
368
398
|
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: OIMUpdateEventEmitter<TKey>) => TIndex);
|
|
369
399
|
getPksByKey(key: TKey): Set<TPk>;
|
|
370
400
|
getPksByKeys(keys: readonly TKey[]): Map<TKey, Set<TPk>>;
|
|
401
|
+
getSlotsByKey(key: TKey): ReadonlySet<TOIMAnyEntitySlot<TPk>>;
|
|
402
|
+
getSlotsByKeys(keys: readonly TKey[]): Map<TKey, ReadonlySet<TOIMAnyEntitySlot<TPk>>>;
|
|
371
403
|
hasKey(key: TKey): boolean;
|
|
372
404
|
getKeys(): readonly TKey[];
|
|
373
405
|
getKeySize(key: TKey): number;
|
|
@@ -401,6 +433,8 @@ declare abstract class OIMReactiveIndexArrayBased<TKey extends TOIMPk, TPk exten
|
|
|
401
433
|
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: OIMUpdateEventEmitter<TKey>) => TIndex);
|
|
402
434
|
getPksByKey(key: TKey): TPk[];
|
|
403
435
|
getPksByKeys(keys: readonly TKey[]): Map<TKey, TPk[]>;
|
|
436
|
+
getSlotsByKey(key: TKey): readonly TOIMAnyEntitySlot<TPk>[];
|
|
437
|
+
getSlotsByKeys(keys: readonly TKey[]): Map<TKey, readonly TOIMAnyEntitySlot<TPk>[]>;
|
|
404
438
|
hasKey(key: TKey): boolean;
|
|
405
439
|
getKeys(): readonly TKey[];
|
|
406
440
|
getKeySize(key: TKey): number;
|
|
@@ -467,6 +501,9 @@ declare class OIMCollection<TEntity extends object, TPk extends TOIMPk> {
|
|
|
467
501
|
constructor(opts?: TOIMCollectionOptions<TEntity, TPk>);
|
|
468
502
|
getOneByPk(pk: TPk): TEntity | undefined;
|
|
469
503
|
getManyByPks(pks: readonly TPk[]): TEntity[];
|
|
504
|
+
getSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
505
|
+
getSlotsByPks(pks: readonly TPk[]): TOIMEntitySlot<TEntity, TPk>[];
|
|
506
|
+
getAllSlots(): TOIMEntitySlot<TEntity, TPk>[];
|
|
470
507
|
upsertOneByPk(pk: TPk, entity: Partial<TEntity>): void;
|
|
471
508
|
upsertOne(entity: TEntity | Partial<TEntity>): void;
|
|
472
509
|
upsertMany(entities: (TEntity | Partial<TEntity>)[]): void;
|
|
@@ -578,12 +615,14 @@ declare class OIMIndexManualSetBased<TIndexKey extends TOIMPk, TPk extends TOIMP
|
|
|
578
615
|
constructor(options?: {
|
|
579
616
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
580
617
|
store?: OIMIndexStoreSetBased<TIndexKey, TPk>;
|
|
618
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
581
619
|
});
|
|
582
620
|
/**
|
|
583
621
|
* Set primary keys for a specific index key, replacing any existing values.
|
|
584
622
|
* Uses optional comparator to skip updates if PKs haven't actually changed.
|
|
585
623
|
*/
|
|
586
624
|
setPks(key: TIndexKey, pks: TPk[]): void;
|
|
625
|
+
setSlots(key: TIndexKey, slots: Iterable<TOIMAnyEntitySlot<TPk>>): void;
|
|
587
626
|
/**
|
|
588
627
|
* Add primary keys to a specific index key
|
|
589
628
|
*/
|
|
@@ -603,9 +642,11 @@ declare class OIMReactiveIndexManualSetBased<TKey extends TOIMPk, TPk extends TO
|
|
|
603
642
|
indexOptions?: {
|
|
604
643
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
605
644
|
store?: OIMIndexStoreSetBased<TKey, TPk>;
|
|
645
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
606
646
|
};
|
|
607
647
|
});
|
|
608
648
|
setPks(key: TKey, pks: TPk[]): void;
|
|
649
|
+
setSlots(key: TKey, slots: Iterable<TOIMAnyEntitySlot<TPk>>): void;
|
|
609
650
|
addPks(key: TKey, pks: readonly TPk[]): void;
|
|
610
651
|
removePks(key: TKey, pks: readonly TPk[]): void;
|
|
611
652
|
clear(key?: TKey): void;
|
|
@@ -619,12 +660,14 @@ declare class OIMIndexManualArrayBased<TIndexKey extends TOIMPk, TPk extends TOI
|
|
|
619
660
|
constructor(options?: {
|
|
620
661
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
621
662
|
store?: OIMIndexStoreArrayBased<TIndexKey, TPk>;
|
|
663
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
622
664
|
});
|
|
623
665
|
/**
|
|
624
666
|
* Set primary keys for a specific index key, replacing any existing values.
|
|
625
667
|
* Uses optional comparator to skip updates if PKs haven't actually changed.
|
|
626
668
|
*/
|
|
627
669
|
setPks(key: TIndexKey, pks: TPk[]): void;
|
|
670
|
+
setSlots(key: TIndexKey, slots: TOIMAnyEntitySlot<TPk>[]): void;
|
|
628
671
|
/**
|
|
629
672
|
* Add primary keys to a specific index key
|
|
630
673
|
*/
|
|
@@ -644,9 +687,11 @@ declare class OIMReactiveIndexManualArrayBased<TKey extends TOIMPk, TPk extends
|
|
|
644
687
|
indexOptions?: {
|
|
645
688
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
646
689
|
store?: OIMIndexStoreArrayBased<TKey, TPk>;
|
|
690
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
647
691
|
};
|
|
648
692
|
});
|
|
649
693
|
setPks(key: TKey, pks: TPk[]): void;
|
|
694
|
+
setSlots(key: TKey, slots: TOIMAnyEntitySlot<TPk>[]): void;
|
|
650
695
|
addPks(key: TKey, pks: readonly TPk[]): void;
|
|
651
696
|
removePks(key: TKey, pks: readonly TPk[]): void;
|
|
652
697
|
clear(key?: TKey): void;
|
|
@@ -662,9 +707,12 @@ declare class OIMRICollection<TEntity extends object, TPk extends TOIMPk, TIndex
|
|
|
662
707
|
}
|
|
663
708
|
|
|
664
709
|
declare class OIMCollectionStoreMapDriven<TEntity extends object, TPk extends TOIMPk> extends OIMCollectionStore<TEntity, TPk> {
|
|
665
|
-
protected readonly
|
|
710
|
+
protected readonly slots: Map<TPk, TOIMEntitySlot<TEntity, TPk>>;
|
|
666
711
|
setOneByPk(pk: TPk, entity: TEntity): void;
|
|
667
712
|
setManyByPks(pks: readonly TPk[], entities: TEntity[]): void;
|
|
713
|
+
getSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
714
|
+
getSlotsByPks(pks: readonly TPk[]): TOIMEntitySlot<TEntity, TPk>[];
|
|
715
|
+
getAllSlots(): TOIMEntitySlot<TEntity, TPk>[];
|
|
668
716
|
removeOneByPk(pk: TPk): void;
|
|
669
717
|
removeManyByPks(pks: readonly TPk[]): void;
|
|
670
718
|
getOneByPk(pk: TPk): TEntity | undefined;
|
|
@@ -714,27 +762,27 @@ declare class OIMObjectStoreRecordDriven<TKey extends string, TValue> extends OI
|
|
|
714
762
|
}
|
|
715
763
|
|
|
716
764
|
declare class OIMIndexStoreMapDrivenSetBased<TKey extends TOIMPk, TPk extends TOIMPk> extends OIMIndexStoreSetBased<TKey, TPk> {
|
|
717
|
-
protected readonly
|
|
718
|
-
setOneByKey(key: TKey,
|
|
765
|
+
protected readonly slots: Map<TKey, Set<TOIMAnyEntitySlot<TPk>>>;
|
|
766
|
+
setOneByKey(key: TKey, slots: Set<TOIMAnyEntitySlot<TPk>>): void;
|
|
719
767
|
removeOneByKey(key: TKey): void;
|
|
720
768
|
removeManyByKeys(keys: readonly TKey[]): void;
|
|
721
|
-
getOneByKey(key: TKey): Set<TPk
|
|
722
|
-
getManyByKeys(keys: readonly TKey[]): Map<TKey, Set<TPk
|
|
769
|
+
getOneByKey(key: TKey): Set<TOIMAnyEntitySlot<TPk>> | undefined;
|
|
770
|
+
getManyByKeys(keys: readonly TKey[]): Map<TKey, Set<TOIMAnyEntitySlot<TPk>>>;
|
|
723
771
|
getAllKeys(): TKey[];
|
|
724
|
-
getAll(): Map<TKey, Set<TPk
|
|
772
|
+
getAll(): Map<TKey, Set<TOIMAnyEntitySlot<TPk>>>;
|
|
725
773
|
countAll(): number;
|
|
726
774
|
clear(): void;
|
|
727
775
|
}
|
|
728
776
|
|
|
729
777
|
declare class OIMIndexStoreMapDrivenArrayBased<TKey extends TOIMPk, TPk extends TOIMPk> extends OIMIndexStoreArrayBased<TKey, TPk> {
|
|
730
|
-
protected readonly
|
|
731
|
-
setOneByKey(key: TKey,
|
|
778
|
+
protected readonly slots: Map<TKey, TOIMAnyEntitySlot<TPk>[]>;
|
|
779
|
+
setOneByKey(key: TKey, slots: TOIMAnyEntitySlot<TPk>[]): void;
|
|
732
780
|
removeOneByKey(key: TKey): void;
|
|
733
781
|
removeManyByKeys(keys: readonly TKey[]): void;
|
|
734
|
-
getOneByKey(key: TKey): TPk[] | undefined;
|
|
735
|
-
getManyByKeys(keys: readonly TKey[]): Map<TKey, TPk[]>;
|
|
782
|
+
getOneByKey(key: TKey): TOIMAnyEntitySlot<TPk>[] | undefined;
|
|
783
|
+
getManyByKeys(keys: readonly TKey[]): Map<TKey, TOIMAnyEntitySlot<TPk>[]>;
|
|
736
784
|
getAllKeys(): TKey[];
|
|
737
|
-
getAll(): Map<TKey, TPk[]>;
|
|
785
|
+
getAll(): Map<TKey, TOIMAnyEntitySlot<TPk>[]>;
|
|
738
786
|
countAll(): number;
|
|
739
787
|
clear(): void;
|
|
740
788
|
}
|
|
@@ -1048,12 +1096,14 @@ type TOIMIndexKey = string | number | bigint;
|
|
|
1048
1096
|
type TOIMIndexOptionsSetBased<TIndexKey extends TOIMPk, TPk extends TOIMPk> = {
|
|
1049
1097
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
1050
1098
|
store?: OIMIndexStoreSetBased<TIndexKey, TPk>;
|
|
1099
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
1051
1100
|
};
|
|
1052
1101
|
/**
|
|
1053
1102
|
* Configuration options for Array-based index instances */
|
|
1054
1103
|
type TOIMIndexOptionsArrayBased<TIndexKey extends TOIMPk, TPk extends TOIMPk> = {
|
|
1055
1104
|
comparePks?: TOIMIndexComparator<TPk>;
|
|
1056
1105
|
store?: OIMIndexStoreArrayBased<TIndexKey, TPk>;
|
|
1106
|
+
resolveSlot?: TOIMEntitySlotResolver<TPk>;
|
|
1057
1107
|
};
|
|
1058
1108
|
/**
|
|
1059
1109
|
* @deprecated Use TOIMIndexOptionsSetBased or TOIMIndexOptionsArrayBased instead
|
|
@@ -1349,4 +1399,4 @@ declare class OIMEntitiesByIndexKeyArrayBasedSelector<TEntity extends object, TP
|
|
|
1349
1399
|
protected areEqual(prev: readonly (TEntity | undefined)[], next: readonly (TEntity | undefined)[]): boolean;
|
|
1350
1400
|
}
|
|
1351
1401
|
|
|
1352
|
-
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMComputedEventSource, type IOIMEffectDependency, type IOIMEventQueueSchedulerEvents, OIMCollection, OIMCollectionByPkSelector, OIMCollectionByPksSelector, OIMCollectionChangedFieldsWrapper, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMComputativeRuntime, OIMComputed, OIMDBSettings, OIMEffect, OIMEffectDependencyComputed, OIMEffectDependencyKeyed, OIMEffectDependencyKeyedCollection, OIMEffectDependencyKeyedIndex, OIMEffectDependencyKeyedObject, OIMEntitiesByIndexKeyArrayBasedSelector, OIMEntitiesByIndexKeySetBasedSelector, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndexArrayBased, OIMIndexComparatorFactory, OIMIndexManualArrayBased, OIMIndexManualOrderedArrayBased, OIMIndexManualSetBased, OIMIndexPksByKeyArrayBasedSelector, OIMIndexPksByKeySetBasedSelector, OIMIndexPksByKeysArrayBasedSelector, OIMIndexPksByKeysSetBasedSelector, OIMIndexSetBased, OIMIndexStoreArrayBased, OIMIndexStoreMapDrivenArrayBased, OIMIndexStoreMapDrivenSetBased, OIMIndexStoreSetBased, OIMMap2Keys, OIMObject, OIMObjectStore, OIMObjectStoreMapDriven, OIMObjectStoreRecordDriven, OIMObjectValueByKeySelector, OIMObjectValuesByKeysSelector, OIMOrderedListIndexCommandStreamWrapper, OIMPkSelectorFactory, OIMRICollection, OIMReactiveCollection, OIMReactiveIndexArrayBased, OIMReactiveIndexManualArrayBased, OIMReactiveIndexManualSetBased, OIMReactiveIndexSetBased, OIMReactiveObject, OIMSelector, type TOIMCollectionOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMComputedOptions, type TOIMComputedUpdatePayload, type TOIMEffectOptions, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptions, type TOIMIndexOptionsArrayBased, type TOIMIndexOptionsSetBased, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMObjectOptions, type TOIMOrderedListCommand, type TOIMPk, type TOIMPkSelector, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdatePayload };
|
|
1402
|
+
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMComputedEventSource, type IOIMEffectDependency, type IOIMEventQueueSchedulerEvents, OIMCollection, OIMCollectionByPkSelector, OIMCollectionByPksSelector, OIMCollectionChangedFieldsWrapper, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMComputativeRuntime, OIMComputed, OIMDBSettings, OIMEffect, OIMEffectDependencyComputed, OIMEffectDependencyKeyed, OIMEffectDependencyKeyedCollection, OIMEffectDependencyKeyedIndex, OIMEffectDependencyKeyedObject, OIMEntitiesByIndexKeyArrayBasedSelector, OIMEntitiesByIndexKeySetBasedSelector, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndexArrayBased, OIMIndexComparatorFactory, OIMIndexManualArrayBased, OIMIndexManualOrderedArrayBased, OIMIndexManualSetBased, OIMIndexPksByKeyArrayBasedSelector, OIMIndexPksByKeySetBasedSelector, OIMIndexPksByKeysArrayBasedSelector, OIMIndexPksByKeysSetBasedSelector, OIMIndexSetBased, OIMIndexStoreArrayBased, OIMIndexStoreMapDrivenArrayBased, OIMIndexStoreMapDrivenSetBased, OIMIndexStoreSetBased, OIMMap2Keys, OIMObject, OIMObjectStore, OIMObjectStoreMapDriven, OIMObjectStoreRecordDriven, OIMObjectValueByKeySelector, OIMObjectValuesByKeysSelector, OIMOrderedListIndexCommandStreamWrapper, OIMPkSelectorFactory, OIMRICollection, OIMReactiveCollection, OIMReactiveIndexArrayBased, OIMReactiveIndexManualArrayBased, OIMReactiveIndexManualSetBased, OIMReactiveIndexSetBased, OIMReactiveObject, OIMSelector, type TOIMAnyEntitySlot, type TOIMCollectionOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMComputedOptions, type TOIMComputedUpdatePayload, type TOIMEffectOptions, type TOIMEntitySlot, type TOIMEntitySlotResolver, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptions, type TOIMIndexOptionsArrayBased, type TOIMIndexOptionsSetBased, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMObjectOptions, type TOIMOrderedListCommand, type TOIMPk, type TOIMPkSelector, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdatePayload };
|