@oimdb/core 2.2.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +447 -109
- package/dist/index.d.cts +163 -19
- package/dist/index.d.ts +163 -19
- package/dist/index.js +445 -109
- package/llms.txt +30 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,13 @@ type TOIMPk = string | number;
|
|
|
3
3
|
type TOIMEntitySlot<TEntity extends object, TPk extends TOIMPk> = {
|
|
4
4
|
pk: TPk;
|
|
5
5
|
item: TEntity | undefined;
|
|
6
|
+
/**
|
|
7
|
+
* Per-pk subscribers, attached lazily by the slot-based keyed emitter so
|
|
8
|
+
* notification needs no per-key map lookup. The slot is retained while this
|
|
9
|
+
* is non-empty (even with `item: undefined`) so a subscription survives a
|
|
10
|
+
* remove → re-add of its entity. Undefined when nothing is subscribed.
|
|
11
|
+
*/
|
|
12
|
+
subscribers?: Set<() => void>;
|
|
6
13
|
};
|
|
7
14
|
type TOIMAnyEntitySlot<TPk extends TOIMPk> = TOIMEntitySlot<object, TPk>;
|
|
8
15
|
type TOIMEntitySlotResolver<TPk extends TOIMPk> = (pk: TPk) => TOIMAnyEntitySlot<TPk> | undefined;
|
|
@@ -17,6 +24,12 @@ declare abstract class OIMCollectionStore<TEntity extends object, TPk extends TO
|
|
|
17
24
|
* hold it ahead of the entity's arrival without crashing.
|
|
18
25
|
*/
|
|
19
26
|
abstract getOrReserveSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk>;
|
|
27
|
+
/**
|
|
28
|
+
* Returns the existing slot for `pk` (live or reserved) without creating
|
|
29
|
+
* one. Used by the slot-based emitter to resolve a slot for delivery /
|
|
30
|
+
* unsubscribe without side effects.
|
|
31
|
+
*/
|
|
32
|
+
abstract findSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
20
33
|
abstract getSlotsByPks(pks: readonly TPk[]): TOIMEntitySlot<TEntity, TPk>[];
|
|
21
34
|
abstract getAllSlots(): TOIMEntitySlot<TEntity, TPk>[];
|
|
22
35
|
abstract removeOneByPk(pk: TPk): void;
|
|
@@ -83,8 +96,8 @@ declare abstract class OIMIndex<TKey extends TOIMPk, TPk extends TOIMPk, TBucket
|
|
|
83
96
|
getKeySize(key: TKey): number;
|
|
84
97
|
get size(): number;
|
|
85
98
|
get isEmpty(): boolean;
|
|
86
|
-
getEntitiesByKey<TEntity extends object = object>(key: TKey): TEntity[];
|
|
87
|
-
getEntitiesByKeys<TEntity extends object = object>(keys: readonly TKey[]): Map<TKey, TEntity[]>;
|
|
99
|
+
getEntitiesByKey<TEntity extends object = object>(key: TKey): (TEntity | undefined)[];
|
|
100
|
+
getEntitiesByKeys<TEntity extends object = object>(keys: readonly TKey[]): Map<TKey, (TEntity | undefined)[]>;
|
|
88
101
|
getMetrics(): {
|
|
89
102
|
totalKeys: number;
|
|
90
103
|
totalPks: number;
|
|
@@ -95,7 +108,15 @@ declare abstract class OIMIndex<TKey extends TOIMPk, TPk extends TOIMPk, TBucket
|
|
|
95
108
|
destroy(): void;
|
|
96
109
|
protected emitUpdate(keys: TKey[]): void;
|
|
97
110
|
protected emitUpdateOne(key: TKey): void;
|
|
98
|
-
|
|
111
|
+
/**
|
|
112
|
+
* Maps a bucket's slots to entities, preserving positional holes: a slot
|
|
113
|
+
* whose entity is not present yet (reserved by an index ahead of its data)
|
|
114
|
+
* or was removed yields `undefined` at its position rather than being
|
|
115
|
+
* dropped. This keeps the result aligned with `getPksByKey`, so callers can
|
|
116
|
+
* render a per-item loading/placeholder state instead of a silently shorter
|
|
117
|
+
* list.
|
|
118
|
+
*/
|
|
119
|
+
protected slotsToEntities<TEntity extends object>(slots: Iterable<TOIMAnyEntitySlot<TPk>>): (TEntity | undefined)[];
|
|
99
120
|
}
|
|
100
121
|
|
|
101
122
|
declare abstract class OIMIndexStoreSetBased<TKey extends TOIMPk, TPk extends TOIMPk> {
|
|
@@ -264,12 +285,19 @@ declare class OIMUpdateEventEmitter<TKey extends TOIMPk> {
|
|
|
264
285
|
markAllUpdated(): void;
|
|
265
286
|
protected readonly onFlush: () => void;
|
|
266
287
|
private deliverImmediate;
|
|
288
|
+
/**
|
|
289
|
+
* Notifies all handlers for a key. The overwhelmingly common case is a
|
|
290
|
+
* single subscriber per key (one component per pk), handled without any
|
|
291
|
+
* allocation. For multiple subscribers a snapshot is taken so a handler may
|
|
292
|
+
* (un)subscribe during iteration without corrupting the walk.
|
|
293
|
+
*/
|
|
294
|
+
private notifyHandlers;
|
|
267
295
|
private readonly onAfterFlush;
|
|
268
296
|
/**
|
|
269
297
|
* Deliver updated keys and notify handlers once.
|
|
270
298
|
* Re-entrant updates during delivery are forbidden and will throw in markUpdatedKeys().
|
|
271
299
|
*/
|
|
272
|
-
protected runSinglePass(
|
|
300
|
+
protected runSinglePass(): void;
|
|
273
301
|
destroy(): void;
|
|
274
302
|
/**
|
|
275
303
|
* Get performance metrics for monitoring and debugging
|
|
@@ -303,8 +331,8 @@ declare abstract class OIMReactiveIndex<TKey extends TOIMPk, TPk extends TOIMPk,
|
|
|
303
331
|
readonly index: TIndex;
|
|
304
332
|
protected readonly updateEmitter: OIMUpdateEventEmitter<TKey>;
|
|
305
333
|
constructor(queue: OIMEventQueue, createIndex: (updateEmitter: OIMUpdateEventEmitter<TKey>) => TIndex);
|
|
306
|
-
getEntitiesByKey<TEntity extends object = object>(key: TKey): TEntity[];
|
|
307
|
-
getEntitiesByKeys<TEntity extends object = object>(keys: readonly TKey[]): Map<TKey, TEntity[]>;
|
|
334
|
+
getEntitiesByKey<TEntity extends object = object>(key: TKey): (TEntity | undefined)[];
|
|
335
|
+
getEntitiesByKeys<TEntity extends object = object>(keys: readonly TKey[]): Map<TKey, (TEntity | undefined)[]>;
|
|
308
336
|
hasKey(key: TKey): boolean;
|
|
309
337
|
getKeys(): readonly TKey[];
|
|
310
338
|
getKeySize(key: TKey): number;
|
|
@@ -407,9 +435,76 @@ declare class OIMCollection<TEntity extends object, TPk extends TOIMPk> {
|
|
|
407
435
|
destroy(): void;
|
|
408
436
|
}
|
|
409
437
|
|
|
438
|
+
/**
|
|
439
|
+
* A carrier that can hold per-key subscribers directly on itself, so the keyed
|
|
440
|
+
* emitter delivers without a per-key map lookup. Implemented by the entity slot
|
|
441
|
+
* (collection carrier) and the index bucket (index carrier).
|
|
442
|
+
*/
|
|
443
|
+
interface IOIMSubscribable {
|
|
444
|
+
subscribers?: Set<() => void>;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Resolves a key to its carrier — the object that holds the key's subscribers.
|
|
449
|
+
* `getOrReserveCarrier` is used on subscribe (creates the carrier if absent so a
|
|
450
|
+
* subscription can exist before its data); `findCarrier` resolves an existing
|
|
451
|
+
* carrier for delivery/unsubscribe without creating one.
|
|
452
|
+
*
|
|
453
|
+
* Collection carrier = the entity slot (by pk); index carrier = the bucket
|
|
454
|
+
* (by index key).
|
|
455
|
+
*/
|
|
456
|
+
interface IOIMCarrierResolver<TKey extends TOIMPk, TCarrier> {
|
|
457
|
+
getOrReserveCarrier(key: TKey): TCarrier;
|
|
458
|
+
findCarrier(key: TKey): TCarrier | undefined;
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Keyed (per-key) pub/sub that stores handlers ON the carrier object
|
|
462
|
+
* (`carrier.subscribers`) instead of a `Map<key, handlers>`. The hot path —
|
|
463
|
+
* marking a written carrier dirty and delivering — needs no per-key map lookup
|
|
464
|
+
* or hashing: the writer already holds the carrier.
|
|
465
|
+
*
|
|
466
|
+
* Same public surface as `OIMUpdateEventEmitter` (queue delivery) plus a fast
|
|
467
|
+
* `markUpdatedCarrier(carrier)`, so it is a drop-in for the collection's and
|
|
468
|
+
* index's keyed emitter. Reused with carrier = slot (collection) or carrier =
|
|
469
|
+
* bucket (index).
|
|
470
|
+
*/
|
|
471
|
+
declare class OIMCarrierKeyedEmitter<TKey extends TOIMPk, TCarrier extends IOIMSubscribable> {
|
|
472
|
+
private readonly queue;
|
|
473
|
+
private readonly resolver;
|
|
474
|
+
private readonly subscribedCarriers;
|
|
475
|
+
private dirtyCarriers;
|
|
476
|
+
private isFlushEnqueued;
|
|
477
|
+
private dequeueFlush?;
|
|
478
|
+
constructor(queue: OIMEventQueue, resolver: IOIMCarrierResolver<TKey, TCarrier>);
|
|
479
|
+
subscribeOnKey(key: TKey, handler: TOIMEventHandler<void>): () => void;
|
|
480
|
+
subscribeOnKeys(keys: readonly TKey[], handler: TOIMEventHandler<void>): () => void;
|
|
481
|
+
unsubscribeFromKey(key: TKey, handler: TOIMEventHandler<void>): void;
|
|
482
|
+
unsubscribeFromKeys(keys: readonly TKey[], handler: TOIMEventHandler<void>): void;
|
|
483
|
+
private addHandler;
|
|
484
|
+
private removeHandler;
|
|
485
|
+
/** Fast path: the writer already holds the carrier. */
|
|
486
|
+
markUpdatedCarrier(carrier: TCarrier): void;
|
|
487
|
+
markUpdatedKey(key: TKey): void;
|
|
488
|
+
markUpdatedKeys(keys: readonly TKey[]): void;
|
|
489
|
+
markAllUpdated(): void;
|
|
490
|
+
hasSubscriptions(): boolean;
|
|
491
|
+
getHandlerCount(key: TKey): number;
|
|
492
|
+
getMetrics(): {
|
|
493
|
+
totalKeys: number;
|
|
494
|
+
totalHandlers: number;
|
|
495
|
+
averageHandlersPerKey: number;
|
|
496
|
+
queueLength: number;
|
|
497
|
+
};
|
|
498
|
+
destroy(): void;
|
|
499
|
+
private assertNotInFlush;
|
|
500
|
+
private scheduleFlush;
|
|
501
|
+
private readonly onFlush;
|
|
502
|
+
private notify;
|
|
503
|
+
}
|
|
504
|
+
|
|
410
505
|
declare class OIMReactiveCollection<TEntity extends object, TPk extends TOIMPk> extends OIMCollection<TEntity, TPk> implements IOIMKeyedSubscription<TPk> {
|
|
411
506
|
private readonly queue;
|
|
412
|
-
protected readonly updateEmitter:
|
|
507
|
+
protected readonly updateEmitter: OIMCarrierKeyedEmitter<TPk, TOIMEntitySlot<TEntity, TPk>>;
|
|
413
508
|
private readonly anyUpdateHandlers;
|
|
414
509
|
private pendingAnyUpdatePks;
|
|
415
510
|
private isAnyUpdateClearPending;
|
|
@@ -430,6 +525,8 @@ declare class OIMReactiveCollection<TEntity extends object, TPk extends TOIMPk>
|
|
|
430
525
|
queueLength: number;
|
|
431
526
|
};
|
|
432
527
|
subscribeOnAnyUpdate(handler: (pks: readonly TPk[]) => void): () => void;
|
|
528
|
+
private notifyLegacy;
|
|
529
|
+
private notifyLegacyMany;
|
|
433
530
|
upsertOneByPk(pk: TPk, entity: Partial<TEntity>): TOIMEntitySlot<TEntity, TPk>;
|
|
434
531
|
upsertOne(entity: TEntity | Partial<TEntity>): TOIMEntitySlot<TEntity, TPk>;
|
|
435
532
|
upsertMany(entities: (TEntity | Partial<TEntity>)[]): TOIMEntitySlot<TEntity, TPk>[];
|
|
@@ -567,8 +664,8 @@ declare class OIMCollectionIndexManualOrderedArrayBased<TKey extends TOIMPk, TPk
|
|
|
567
664
|
push(key: TKey, pk: TPk): number;
|
|
568
665
|
insertAt(key: TKey, index: number, pk: TPk): number;
|
|
569
666
|
reset(key: TKey, pks: readonly TPk[]): void;
|
|
570
|
-
getEntitiesByKey<TItem extends object = TEntity>(key: TKey): TItem[];
|
|
571
|
-
getEntitiesByKeys<TItem extends object = TEntity>(keys: readonly TKey[]): Map<TKey, TItem[]>;
|
|
667
|
+
getEntitiesByKey<TItem extends object = TEntity>(key: TKey): (TItem | undefined)[];
|
|
668
|
+
getEntitiesByKeys<TItem extends object = TEntity>(keys: readonly TKey[]): Map<TKey, (TItem | undefined)[]>;
|
|
572
669
|
resolvePk(pk: TPk): TOIMAnyEntitySlot<TPk>;
|
|
573
670
|
private resolveSlots;
|
|
574
671
|
private resolveRequiredSlot;
|
|
@@ -617,7 +714,7 @@ declare class OIMOrderedListCommandStream<TKey extends TOIMPk, TPk extends TOIMP
|
|
|
617
714
|
constructor(queue: OIMEventQueue, index?: OIMIndexManualOrderedArrayBased<TKey, TPk>);
|
|
618
715
|
getPksByKey(key: TKey): readonly TPk[];
|
|
619
716
|
getSlotsByKey(key: TKey): readonly TOIMEntitySlot<TEntity, TPk>[];
|
|
620
|
-
getEntitiesByKey(key: TKey): TEntity[];
|
|
717
|
+
getEntitiesByKey(key: TKey): (TEntity | undefined)[];
|
|
621
718
|
hasKey(key: TKey): boolean;
|
|
622
719
|
getKeys(): readonly TKey[];
|
|
623
720
|
pushSlot(key: TKey, slot: TOIMEntitySlot<TEntity, TPk>): void;
|
|
@@ -649,7 +746,7 @@ declare class OIMCollectionOrderedListCommandStream<TKey extends TOIMPk, TPk ext
|
|
|
649
746
|
insertAt(key: TKey, index: number, pk: TPk): void;
|
|
650
747
|
set(key: TKey, pks: readonly TPk[]): void;
|
|
651
748
|
getSlotsByKey(key: TKey): readonly TOIMEntitySlot<TEntity, TPk>[];
|
|
652
|
-
getEntitiesByKey(key: TKey): TEntity[];
|
|
749
|
+
getEntitiesByKey(key: TKey): (TEntity | undefined)[];
|
|
653
750
|
private resolvePk;
|
|
654
751
|
}
|
|
655
752
|
|
|
@@ -663,6 +760,12 @@ declare class OIMIndexManualArrayBased<TIndexKey extends TOIMPk, TPk extends TOI
|
|
|
663
760
|
store?: OIMIndexStoreArrayBased<TIndexKey, TPk>;
|
|
664
761
|
});
|
|
665
762
|
setSlots(key: TIndexKey, slots: TOIMAnyEntitySlot<TPk>[]): void;
|
|
763
|
+
/**
|
|
764
|
+
* Appends pre-deduplicated slots to a key's bucket IN PLACE (no copy of the
|
|
765
|
+
* existing bucket) and emits once. Callers own dedup (so this stays O(added),
|
|
766
|
+
* not O(bucket)); used by collection-bound indexes for fast `addPks`.
|
|
767
|
+
*/
|
|
768
|
+
appendSlots(key: TIndexKey, slots: readonly TOIMAnyEntitySlot<TPk>[]): void;
|
|
666
769
|
/**
|
|
667
770
|
* Clear all primary keys for a specific index key, or all keys if no key specified
|
|
668
771
|
*/
|
|
@@ -677,6 +780,7 @@ declare class OIMReactiveIndexManualArrayBased<TKey extends TOIMPk, TPk extends
|
|
|
677
780
|
};
|
|
678
781
|
});
|
|
679
782
|
setSlots(key: TKey, slots: TOIMAnyEntitySlot<TPk>[]): void;
|
|
783
|
+
appendSlots(key: TKey, slots: readonly TOIMAnyEntitySlot<TPk>[]): void;
|
|
680
784
|
clear(key?: TKey): void;
|
|
681
785
|
}
|
|
682
786
|
|
|
@@ -688,12 +792,19 @@ declare class OIMReactiveIndexManualArrayBased<TKey extends TOIMPk, TPk extends
|
|
|
688
792
|
*/
|
|
689
793
|
declare class OIMReactiveCollectionIndexManualArrayBased<TKey extends TOIMPk, TPk extends TOIMPk, TEntity extends object = object> extends OIMReactiveIndexManualArrayBased<TKey, TPk> {
|
|
690
794
|
private readonly resolveSlot;
|
|
795
|
+
private readonly pksByKey;
|
|
691
796
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionIndexArrayBasedOptions<TEntity, TKey, TPk>);
|
|
692
797
|
setPks(key: TKey, pks: readonly TPk[]): void;
|
|
693
798
|
addPks(key: TKey, pks: readonly TPk[]): void;
|
|
694
799
|
removePks(key: TKey, pks: readonly TPk[]): void;
|
|
695
|
-
|
|
696
|
-
|
|
800
|
+
clear(key?: TKey): void;
|
|
801
|
+
/**
|
|
802
|
+
* The membership set for a key, lazily seeded from the current bucket so it
|
|
803
|
+
* stays correct even if slots were set through a lower-level path.
|
|
804
|
+
*/
|
|
805
|
+
private membershipOf;
|
|
806
|
+
getEntitiesByKey<TItem extends object = TEntity>(key: TKey): (TItem | undefined)[];
|
|
807
|
+
getEntitiesByKeys<TItem extends object = TEntity>(keys: readonly TKey[]): Map<TKey, (TItem | undefined)[]>;
|
|
697
808
|
private resolveSlots;
|
|
698
809
|
private resolveRequiredSlot;
|
|
699
810
|
}
|
|
@@ -708,6 +819,15 @@ declare class OIMIndexManualSetBased<TIndexKey extends TOIMPk, TPk extends TOIMP
|
|
|
708
819
|
store?: OIMIndexStoreSetBased<TIndexKey, TPk>;
|
|
709
820
|
});
|
|
710
821
|
setSlots(key: TIndexKey, slots: Iterable<TOIMAnyEntitySlot<TPk>>): void;
|
|
822
|
+
/**
|
|
823
|
+
* Adds slots to a key's bucket IN PLACE (no copy of the existing Set) and
|
|
824
|
+
* emits once. O(added). Used by collection-bound indexes for fast `addPks`.
|
|
825
|
+
*/
|
|
826
|
+
addSlots(key: TIndexKey, slots: readonly TOIMAnyEntitySlot<TPk>[]): void;
|
|
827
|
+
/**
|
|
828
|
+
* Removes slots from a key's bucket IN PLACE (O(removed)) and emits once.
|
|
829
|
+
*/
|
|
830
|
+
removeSlots(key: TIndexKey, slots: readonly TOIMAnyEntitySlot<TPk>[]): void;
|
|
711
831
|
/**
|
|
712
832
|
* Clear all primary keys for a specific index key, or all keys if no key specified
|
|
713
833
|
*/
|
|
@@ -722,6 +842,8 @@ declare class OIMReactiveIndexManualSetBased<TKey extends TOIMPk, TPk extends TO
|
|
|
722
842
|
};
|
|
723
843
|
});
|
|
724
844
|
setSlots(key: TKey, slots: Iterable<TOIMAnyEntitySlot<TPk>>): void;
|
|
845
|
+
addSlots(key: TKey, slots: readonly TOIMAnyEntitySlot<TPk>[]): void;
|
|
846
|
+
removeSlots(key: TKey, slots: readonly TOIMAnyEntitySlot<TPk>[]): void;
|
|
725
847
|
clear(key?: TKey): void;
|
|
726
848
|
}
|
|
727
849
|
|
|
@@ -733,13 +855,19 @@ declare class OIMReactiveIndexManualSetBased<TKey extends TOIMPk, TPk extends TO
|
|
|
733
855
|
*/
|
|
734
856
|
declare class OIMReactiveCollectionIndexManualSetBased<TKey extends TOIMPk, TPk extends TOIMPk, TEntity extends object = object> extends OIMReactiveIndexManualSetBased<TKey, TPk> {
|
|
735
857
|
private readonly resolveSlot;
|
|
858
|
+
private readonly slotByPk;
|
|
736
859
|
constructor(queue: OIMEventQueue, opts: TOIMCollectionIndexSetBasedOptions<TEntity, TKey, TPk>);
|
|
737
860
|
setPks(key: TKey, pks: readonly TPk[]): void;
|
|
738
861
|
addPks(key: TKey, pks: readonly TPk[]): void;
|
|
739
862
|
removePks(key: TKey, pks: readonly TPk[]): void;
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
863
|
+
clear(key?: TKey): void;
|
|
864
|
+
/**
|
|
865
|
+
* The pk→slot map for a key, lazily seeded from the current bucket so it
|
|
866
|
+
* stays correct even if slots were set through a lower-level path.
|
|
867
|
+
*/
|
|
868
|
+
private membershipOf;
|
|
869
|
+
getEntitiesByKey<TItem extends object = TEntity>(key: TKey): (TItem | undefined)[];
|
|
870
|
+
getEntitiesByKeys<TItem extends object = TEntity>(keys: readonly TKey[]): Map<TKey, (TItem | undefined)[]>;
|
|
743
871
|
private resolveRequiredSlot;
|
|
744
872
|
}
|
|
745
873
|
|
|
@@ -776,13 +904,12 @@ declare class OIMDerivedCollectionIndexArrayBased<TKey extends TOIMPk, TPk exten
|
|
|
776
904
|
private readonly orderBy?;
|
|
777
905
|
private readonly unsubscribeFromCollection;
|
|
778
906
|
private readonly keysByPk;
|
|
907
|
+
private readonly orderValueByPk;
|
|
779
908
|
constructor(queue: OIMEventQueue, collection: OIMReactiveCollection<TEntity, TPk>, opts: TOIMDerivedCollectionIndexArrayBasedOptions<TEntity, TKey, TPk>);
|
|
780
909
|
rebuildFromCollection(): void;
|
|
781
910
|
clear(key?: TKey): void;
|
|
782
911
|
destroy(): void;
|
|
783
912
|
private readonly onCollectionUpdate;
|
|
784
|
-
private trackPkKeys;
|
|
785
|
-
private rebuildKey;
|
|
786
913
|
private sortSlots;
|
|
787
914
|
private normalizeKeys;
|
|
788
915
|
}
|
|
@@ -862,6 +989,8 @@ declare class OIMCollectionStoreMapDriven<TEntity extends object, TPk extends TO
|
|
|
862
989
|
getOrReserveSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk>;
|
|
863
990
|
setManyByPks(pks: readonly TPk[], entities: TEntity[]): TOIMEntitySlot<TEntity, TPk>[];
|
|
864
991
|
getSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
992
|
+
findSlotByPk(pk: TPk): TOIMEntitySlot<TEntity, TPk> | undefined;
|
|
993
|
+
private hasSubscribers;
|
|
865
994
|
getSlotsByPks(pks: readonly TPk[]): TOIMEntitySlot<TEntity, TPk>[];
|
|
866
995
|
getAllSlots(): TOIMEntitySlot<TEntity, TPk>[];
|
|
867
996
|
removeOneByPk(pk: TPk): void;
|
|
@@ -948,6 +1077,21 @@ declare class OIMEntityUpdaterFactory<TEntity extends object> {
|
|
|
948
1077
|
createMergeEntityUpdater(): TOIMEntityUpdater<TEntity>;
|
|
949
1078
|
}
|
|
950
1079
|
|
|
1080
|
+
/**
|
|
1081
|
+
* Entity updater that mutates the existing entity in place instead of building a
|
|
1082
|
+
* new merged object. It skips the per-update allocation/copy of the default
|
|
1083
|
+
* merge updater (`{ ...prev, ...draft }`), which is the single biggest data-layer
|
|
1084
|
+
* cost on update-heavy workloads.
|
|
1085
|
+
*
|
|
1086
|
+
* Pair it with a signal-driven binding (re-read the entity on the keyed
|
|
1087
|
+
* notification, e.g. `@oimdb/react`'s `*Signal` hooks): since the stored entity
|
|
1088
|
+
* reference stays stable across updates, reference-comparison bindings
|
|
1089
|
+
* (React's `Object.is` / `useSyncExternalStore`, `React.memo` on entities,
|
|
1090
|
+
* prev/next diffing, time-travel) will NOT see the change. Use only where every
|
|
1091
|
+
* reader is subscription-driven.
|
|
1092
|
+
*/
|
|
1093
|
+
declare function createInPlaceEntityUpdater<TEntity extends object>(): TOIMEntityUpdater<TEntity>;
|
|
1094
|
+
|
|
951
1095
|
/**
|
|
952
1096
|
* Factory for creating index comparators.
|
|
953
1097
|
* Provides common comparison strategies for primary key arrays.
|
|
@@ -1489,4 +1633,4 @@ declare class OIMEntitiesByIndexKeyArrayBasedSelector<TEntity extends object, TP
|
|
|
1489
1633
|
protected areEqual(prev: readonly (TEntity | undefined)[], next: readonly (TEntity | undefined)[]): boolean;
|
|
1490
1634
|
}
|
|
1491
1635
|
|
|
1492
|
-
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMComputedEventSource, type IOIMEffectDependency, type IOIMEventQueueSchedulerEvents, type IOIMIndexStore, OIMCollection, OIMCollectionByPkSelector, OIMCollectionByPksSelector, OIMCollectionChangedFields, OIMCollectionIndexFactory, OIMCollectionIndexManualOrderedArrayBased, OIMCollectionOrderedListCommandStream, OIMCollectionSelectors, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMComputeRuntime, OIMComputed, OIMDBSettings, OIMDerivedCollectionIndexArrayBased, OIMDerivedCollectionIndexSetBased, OIMEffect, OIMEffectDependencyComputed, OIMEffectDependencyKeyed, OIMEffectDependencyKeyedCollection, OIMEffectDependencyKeyedIndex, OIMEffectDependencyKeyedObject, OIMEntitiesByIndexKeyArrayBasedSelector, OIMEntitiesByIndexKeySetBasedSelector, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndex, OIMIndexArrayBased, OIMIndexComparatorFactory, OIMIndexManualArrayBased, OIMIndexManualOrderedArrayBased, OIMIndexManualSetBased, OIMIndexPksByKeyArrayBasedSelector, OIMIndexPksByKeySetBasedSelector, OIMIndexPksByKeysArrayBasedSelector, OIMIndexPksByKeysSetBasedSelector, OIMIndexSetBased, OIMIndexStoreArrayBased, OIMIndexStoreMapDrivenArrayBased, OIMIndexStoreMapDrivenSetBased, OIMIndexStoreSetBased, OIMMap2Keys, OIMObject, OIMObjectStore, OIMObjectStoreMapDriven, OIMObjectStoreRecordDriven, OIMObjectValueByKeySelector, OIMObjectValuesByKeysSelector, OIMOrderedListCommandStream, OIMPkSelectorFactory, OIMReactiveCollection, OIMReactiveCollectionIndexManualArrayBased, OIMReactiveCollectionIndexManualSetBased, OIMReactiveIndex, OIMReactiveIndexArrayBased, OIMReactiveIndexManualArrayBased, OIMReactiveIndexManualSetBased, OIMReactiveIndexSetBased, OIMReactiveObject, OIMSelector, type TOIMAnyEntitySlot, type TOIMCollectionEntitiesSelector, type TOIMCollectionEntitySelector, type TOIMCollectionIndexArrayBasedOptions, type TOIMCollectionIndexSetBasedOptions, type TOIMCollectionKit, type TOIMCollectionOptions, type TOIMCollectionOrderedIndexOptions, type TOIMCollectionOrderedListCommandStreamOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMComputedOptions, type TOIMComputedUpdatePayload, type TOIMDerivedCollectionIndexArrayBasedOptions, type TOIMDerivedCollectionIndexSetBasedOptions, type TOIMDerivedEntityComparator, type TOIMDerivedEntityOrderSelector, type TOIMDerivedEntityOrderValue, type TOIMDerivedIndexKeySelector, type TOIMEffectOptions, type TOIMEntitySlot, type TOIMEntitySlotResolver, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptionsArrayBased, type TOIMIndexOptionsSetBased, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMObjectOptions, type TOIMOrderedListCommand, type TOIMPk, type TOIMPkSelector, type TOIMReactiveCollectionFactoryOptions, type TOIMRelationsArrayIndexOptions, type TOIMRelationsDerivedArrayIndexOptions, type TOIMRelationsDerivedSetIndexOptions, type TOIMRelationsOrderedListOptions, type TOIMRelationsSetIndexOptions, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdatePayload, createOIMCollectionIndexFactory, createOIMCollectionKit };
|
|
1636
|
+
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMCarrierResolver, type IOIMComputedEventSource, type IOIMEffectDependency, type IOIMEventQueueSchedulerEvents, type IOIMIndexStore, type IOIMSubscribable, OIMCarrierKeyedEmitter, OIMCollection, OIMCollectionByPkSelector, OIMCollectionByPksSelector, OIMCollectionChangedFields, OIMCollectionIndexFactory, OIMCollectionIndexManualOrderedArrayBased, OIMCollectionOrderedListCommandStream, OIMCollectionSelectors, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMComputeRuntime, OIMComputed, OIMDBSettings, OIMDerivedCollectionIndexArrayBased, OIMDerivedCollectionIndexSetBased, OIMEffect, OIMEffectDependencyComputed, OIMEffectDependencyKeyed, OIMEffectDependencyKeyedCollection, OIMEffectDependencyKeyedIndex, OIMEffectDependencyKeyedObject, OIMEntitiesByIndexKeyArrayBasedSelector, OIMEntitiesByIndexKeySetBasedSelector, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndex, OIMIndexArrayBased, OIMIndexComparatorFactory, OIMIndexManualArrayBased, OIMIndexManualOrderedArrayBased, OIMIndexManualSetBased, OIMIndexPksByKeyArrayBasedSelector, OIMIndexPksByKeySetBasedSelector, OIMIndexPksByKeysArrayBasedSelector, OIMIndexPksByKeysSetBasedSelector, OIMIndexSetBased, OIMIndexStoreArrayBased, OIMIndexStoreMapDrivenArrayBased, OIMIndexStoreMapDrivenSetBased, OIMIndexStoreSetBased, OIMMap2Keys, OIMObject, OIMObjectStore, OIMObjectStoreMapDriven, OIMObjectStoreRecordDriven, OIMObjectValueByKeySelector, OIMObjectValuesByKeysSelector, OIMOrderedListCommandStream, OIMPkSelectorFactory, OIMReactiveCollection, OIMReactiveCollectionIndexManualArrayBased, OIMReactiveCollectionIndexManualSetBased, OIMReactiveIndex, OIMReactiveIndexArrayBased, OIMReactiveIndexManualArrayBased, OIMReactiveIndexManualSetBased, OIMReactiveIndexSetBased, OIMReactiveObject, OIMSelector, type TOIMAnyEntitySlot, type TOIMCollectionEntitiesSelector, type TOIMCollectionEntitySelector, type TOIMCollectionIndexArrayBasedOptions, type TOIMCollectionIndexSetBasedOptions, type TOIMCollectionKit, type TOIMCollectionOptions, type TOIMCollectionOrderedIndexOptions, type TOIMCollectionOrderedListCommandStreamOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMComputedOptions, type TOIMComputedUpdatePayload, type TOIMDerivedCollectionIndexArrayBasedOptions, type TOIMDerivedCollectionIndexSetBasedOptions, type TOIMDerivedEntityComparator, type TOIMDerivedEntityOrderSelector, type TOIMDerivedEntityOrderValue, type TOIMDerivedIndexKeySelector, type TOIMEffectOptions, type TOIMEntitySlot, type TOIMEntitySlotResolver, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptionsArrayBased, type TOIMIndexOptionsSetBased, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMObjectOptions, type TOIMOrderedListCommand, type TOIMPk, type TOIMPkSelector, type TOIMReactiveCollectionFactoryOptions, type TOIMRelationsArrayIndexOptions, type TOIMRelationsDerivedArrayIndexOptions, type TOIMRelationsDerivedSetIndexOptions, type TOIMRelationsOrderedListOptions, type TOIMRelationsSetIndexOptions, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdatePayload, createInPlaceEntityUpdater, createOIMCollectionIndexFactory, createOIMCollectionKit };
|