@oimdb/core 1.0.5 → 1.1.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/dist/index.d.cts CHANGED
@@ -61,10 +61,23 @@ interface TOIMIndexUpdatePayload<TKey> {
61
61
  * Returns true if the arrays are considered equal, false if they differ. */
62
62
  type TOIMIndexComparator<TPk extends TOIMPk> = (existingPks: readonly TPk[], newPks: readonly TPk[]) => boolean;
63
63
 
64
+ declare abstract class OIMIndexStore<TKey extends TOIMPk, TPk extends TOIMPk> {
65
+ abstract setOneByKey(key: TKey, pks: Set<TPk>): void;
66
+ abstract removeOneByKey(key: TKey): void;
67
+ abstract removeManyByKeys(keys: readonly TKey[]): void;
68
+ abstract getOneByKey(key: TKey): Set<TPk> | undefined;
69
+ abstract getManyByKeys(keys: readonly TKey[]): Map<TKey, Set<TPk>>;
70
+ abstract getAllKeys(): TKey[];
71
+ abstract getAll(): Map<TKey, Set<TPk>>;
72
+ abstract countAll(): number;
73
+ abstract clear(): void;
74
+ }
75
+
64
76
  /**
65
77
  * Configuration options for index instances */
66
- type TOIMIndexOptions<TPk extends TOIMPk> = {
78
+ type TOIMIndexOptions<TIndexKey extends TOIMPk, TPk extends TOIMPk> = {
67
79
  comparePks?: TOIMIndexComparator<TPk>;
80
+ store?: OIMIndexStore<TIndexKey, TPk>;
68
81
  };
69
82
 
70
83
  /**
@@ -72,12 +85,12 @@ type TOIMIndexOptions<TPk extends TOIMPk> = {
72
85
  * Provides common functionality and event system for key-to-PKs mappings.
73
86
  */
74
87
  declare abstract class OIMIndex<TKey extends TOIMPk, TPk extends TOIMPk> {
75
- protected readonly pks: Map<TKey, Set<TPk>>;
76
88
  protected readonly comparePks?: TOIMIndexComparator<TPk>;
89
+ protected readonly store: OIMIndexStore<TKey, TPk>;
77
90
  readonly emitter: OIMEventEmitter<{
78
91
  0: TOIMIndexUpdatePayload<TKey>;
79
92
  }>;
80
- constructor(options?: TOIMIndexOptions<TPk>);
93
+ constructor(options?: TOIMIndexOptions<TKey, TPk>);
81
94
  /**
82
95
  * Get primary keys for multiple index keys
83
96
  */
@@ -136,16 +149,54 @@ declare abstract class OIMIndex<TKey extends TOIMPk, TPk extends TOIMPk> {
136
149
  protected emitUpdate(keys: TKey[]): void;
137
150
  }
138
151
 
152
+ /**
153
+ * Manual index that allows direct manipulation of key-to-primary-keys mappings.
154
+ * Extends the abstract OIMIndex with manual control methods and optional comparison.
155
+ */
156
+ declare class OIMIndexManual<TIndexKey extends TOIMPk, TPk extends TOIMPk> extends OIMIndex<TIndexKey, TPk> {
157
+ constructor(options?: TOIMIndexOptions<TIndexKey, TPk>);
158
+ /**
159
+ * Set primary keys for a specific index key, replacing any existing values.
160
+ * Uses optional comparator to skip updates if PKs haven't actually changed.
161
+ */
162
+ setPks(key: TIndexKey, pks: TPk[]): void;
163
+ /**
164
+ * Add primary keys to a specific index key
165
+ */
166
+ addPks(key: TIndexKey, pks: readonly TPk[]): void;
167
+ /**
168
+ * Remove primary keys from a specific index key
169
+ */
170
+ removePks(key: TIndexKey, pks: readonly TPk[]): void;
171
+ /**
172
+ * Clear all primary keys for a specific index key, or all keys if no key specified
173
+ */
174
+ clear(key?: TIndexKey): void;
175
+ }
176
+
177
+ /**
178
+ * Static class containing OIMDB settings and constants.
179
+ * Provides access to configuration values used throughout the library.
180
+ */
181
+ declare class OIMDBSettings {
182
+ /**
183
+ * Fixed key used in the manual index to store updated keys set in coalescers.
184
+ * This constant is exported so users can create their own indexes and pass them to coalescers.
185
+ */
186
+ static readonly UPDATED_KEYS_INDEX_KEY: "__updatedKeys__";
187
+ }
188
+
139
189
  /**
140
190
  * Base abstract coalescer that groups updates by keys and emits consolidated events.
141
191
  * Designed to be extended for different entity types (collections, indexes, etc.).
142
192
  */
143
- declare abstract class OIMUpdateEventCoalescer<TKey> {
193
+ declare abstract class OIMUpdateEventCoalescer<TKey extends TOIMPk> {
144
194
  readonly emitter: OIMEventEmitter<{
145
195
  0: void;
146
196
  }>;
147
- protected updatedKeys: Set<TKey>;
197
+ protected readonly updatedKeysIndex: OIMIndexManual<typeof OIMDBSettings.UPDATED_KEYS_INDEX_KEY, TKey>;
148
198
  private hasEmittedChanges;
199
+ constructor(index?: OIMIndexManual<typeof OIMDBSettings.UPDATED_KEYS_INDEX_KEY, TKey>);
149
200
  /**
150
201
  * Get the set of keys that have been updated since last clear
151
202
  */
@@ -157,7 +208,7 @@ declare abstract class OIMUpdateEventCoalescer<TKey> {
157
208
  /**
158
209
  * Add keys to the updated set and emit HAS_CHANGES event if needed
159
210
  */
160
- protected addUpdatedKeys(keys: TKey[]): void;
211
+ protected addUpdatedKeys(keys: readonly TKey[]): void;
161
212
  /**
162
213
  * Clean up event listeners when coalescer is no longer needed
163
214
  */
@@ -214,7 +265,7 @@ declare class OIMEventQueue {
214
265
 
215
266
  /**
216
267
  * Options for creating an update event emitter */
217
- type TOIMUpdateEventEmitterOptions<TKey> = {
268
+ type TOIMUpdateEventEmitterOptions<TKey extends TOIMPk> = {
218
269
  coalescer: OIMUpdateEventCoalescer<TKey>;
219
270
  queue: OIMEventQueue;
220
271
  };
@@ -223,7 +274,7 @@ type TOIMUpdateEventEmitterOptions<TKey> = {
223
274
  * Universal event emitter that handles subscriptions and notifications for any key type.
224
275
  * Optimized for performance with adaptive algorithms and memory management.
225
276
  */
226
- declare class OIMUpdateEventEmitter<TKey> {
277
+ declare class OIMUpdateEventEmitter<TKey extends TOIMPk> {
227
278
  protected keyHandlers: Map<TKey, Set<TOIMEventHandler<void>>>;
228
279
  protected coalescer: OIMUpdateEventCoalescer<TKey>;
229
280
  protected queue: OIMEventQueue;
@@ -261,7 +312,7 @@ declare enum EOIMIndexEventType {
261
312
  * Index-specific coalescer that tracks index key updates and emits consolidated change events.
262
313
  * Takes an event emitter directly instead of the whole index to avoid circular dependencies.
263
314
  */
264
- declare class OIMUpdateEventCoalescerIndex<TIndexKey> extends OIMUpdateEventCoalescer<TIndexKey> {
315
+ declare class OIMUpdateEventCoalescerIndex<TIndexKey extends TOIMPk> extends OIMUpdateEventCoalescer<TIndexKey> {
265
316
  private readonly indexEmitter;
266
317
  constructor(indexEmitter: OIMEventEmitter<{
267
318
  [EOIMIndexEventType.UPDATE]: TOIMIndexUpdatePayload<TIndexKey>;
@@ -354,48 +405,10 @@ declare class OIMUpdateEventCoalescerCollection<TPk extends TOIMPk> extends OIMU
354
405
  private handleUpdate;
355
406
  }
356
407
 
357
- declare class OIMReactiveCollection<TEntity extends object, TPk extends TOIMPk> {
358
- readonly collection: OIMCollection<TEntity, TPk>;
408
+ declare class OIMReactiveCollection<TEntity extends object, TPk extends TOIMPk> extends OIMCollection<TEntity, TPk> {
359
409
  readonly updateEventEmitter: OIMUpdateEventEmitter<TPk>;
360
410
  readonly coalescer: OIMUpdateEventCoalescerCollection<TPk>;
361
- constructor(queue: OIMEventQueue, opts?: {
362
- collectionOpts?: TOIMCollectionOptions<TEntity, TPk>;
363
- });
364
- upsertMany(entities: TEntity[]): void;
365
- upsertOne(entity: TEntity): void;
366
- removeMany(entities: TEntity[]): void;
367
- removeOne(entity: TEntity): void;
368
- getOneByPk(pk: TPk): TEntity | undefined;
369
- getManyByPks(pks: readonly TPk[]): TEntity[];
370
- clear(): void;
371
- countAll(): number;
372
- getAll(): TEntity[];
373
- getAllPks(): TPk[];
374
- }
375
-
376
- /**
377
- * Manual index that allows direct manipulation of key-to-primary-keys mappings.
378
- * Extends the abstract OIMIndex with manual control methods and optional comparison.
379
- */
380
- declare class OIMIndexManual<TIndexKey extends TOIMPk, TPk extends TOIMPk> extends OIMIndex<TIndexKey, TPk> {
381
- constructor(options?: TOIMIndexOptions<TPk>);
382
- /**
383
- * Set primary keys for a specific index key, replacing any existing values.
384
- * Uses optional comparator to skip updates if PKs haven't actually changed.
385
- */
386
- setPks(key: TIndexKey, pks: TPk[]): void;
387
- /**
388
- * Add primary keys to a specific index key
389
- */
390
- addPks(key: TIndexKey, pks: readonly TPk[]): void;
391
- /**
392
- * Remove primary keys from a specific index key
393
- */
394
- removePks(key: TIndexKey, pks: readonly TPk[]): void;
395
- /**
396
- * Clear all primary keys for a specific index key, or all keys if no key specified
397
- */
398
- clear(key?: TIndexKey): void;
411
+ constructor(queue: OIMEventQueue, opts?: TOIMCollectionOptions<TEntity, TPk>);
399
412
  }
400
413
 
401
414
  declare class OIMReactiveIndexManual<TKey extends TOIMPk, TPk extends TOIMPk> extends OIMReactiveIndex<TKey, TPk, OIMIndexManual<TKey, TPk>> {
@@ -409,11 +422,11 @@ declare class OIMReactiveIndexManual<TKey extends TOIMPk, TPk extends TOIMPk> ex
409
422
  clear(key?: TKey): void;
410
423
  }
411
424
 
412
- declare class OIMRICollection<TEntity extends object, TPk extends TOIMPk, TIndexName extends string, TIndexKey extends TOIMPk, TIndex extends OIMIndex<TIndexKey, TPk>, TReactiveIndex extends OIMReactiveIndex<TIndexKey, TPk, TIndex>> extends OIMReactiveCollection<TEntity, TPk> {
413
- readonly indexes: Record<TIndexName, TReactiveIndex>;
425
+ declare class OIMRICollection<TEntity extends object, TPk extends TOIMPk, TIndexName extends string, TIndexKey extends TOIMPk, TIndex extends OIMIndex<TIndexKey, TPk>, TReactiveIndex extends OIMReactiveIndex<TIndexKey, TPk, TIndex>, TReactiveIndexMap extends Record<TIndexName, TReactiveIndex> = Record<TIndexName, TReactiveIndex>> extends OIMReactiveCollection<TEntity, TPk> {
426
+ readonly indexes?: TReactiveIndexMap;
414
427
  constructor(queue: OIMEventQueue, opts: {
415
428
  collectionOpts?: TOIMCollectionOptions<TEntity, TPk>;
416
- indexes: Record<TIndexName, TReactiveIndex>;
429
+ indexes?: TReactiveIndexMap;
417
430
  });
418
431
  }
419
432
 
@@ -601,4 +614,4 @@ type TOIMUpdatePayload<TKey> = {
601
614
  keys: readonly TKey[];
602
615
  };
603
616
 
604
- export { EOIMCollectionEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMUpdateEventCoalescerEventType, type IOIMEventQueueSchedulerEvents, OIMCollection, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndex, OIMIndexComparatorFactory, OIMIndexManual, OIMMap2Keys, OIMPkSelectorFactory, OIMRICollection, OIMReactiveCollection, OIMReactiveIndex, OIMReactiveIndexManual, OIMUpdateEventCoalescer, OIMUpdateEventCoalescerCollection, OIMUpdateEventCoalescerIndex, OIMUpdateEventEmitter, type TOIMCollectionOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptions, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMPk, type TOIMPkSelector, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdateEventEmitterOptions, type TOIMUpdatePayload };
617
+ export { EOIMCollectionEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMUpdateEventCoalescerEventType, type IOIMEventQueueSchedulerEvents, OIMCollection, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMDBSettings, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndex, OIMIndexComparatorFactory, OIMIndexManual, OIMMap2Keys, OIMPkSelectorFactory, OIMRICollection, OIMReactiveCollection, OIMReactiveIndex, OIMReactiveIndexManual, OIMUpdateEventCoalescer, OIMUpdateEventCoalescerCollection, OIMUpdateEventCoalescerIndex, OIMUpdateEventEmitter, type TOIMCollectionOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptions, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMPk, type TOIMPkSelector, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdateEventEmitterOptions, type TOIMUpdatePayload };
package/dist/index.d.ts CHANGED
@@ -61,10 +61,23 @@ interface TOIMIndexUpdatePayload<TKey> {
61
61
  * Returns true if the arrays are considered equal, false if they differ. */
62
62
  type TOIMIndexComparator<TPk extends TOIMPk> = (existingPks: readonly TPk[], newPks: readonly TPk[]) => boolean;
63
63
 
64
+ declare abstract class OIMIndexStore<TKey extends TOIMPk, TPk extends TOIMPk> {
65
+ abstract setOneByKey(key: TKey, pks: Set<TPk>): void;
66
+ abstract removeOneByKey(key: TKey): void;
67
+ abstract removeManyByKeys(keys: readonly TKey[]): void;
68
+ abstract getOneByKey(key: TKey): Set<TPk> | undefined;
69
+ abstract getManyByKeys(keys: readonly TKey[]): Map<TKey, Set<TPk>>;
70
+ abstract getAllKeys(): TKey[];
71
+ abstract getAll(): Map<TKey, Set<TPk>>;
72
+ abstract countAll(): number;
73
+ abstract clear(): void;
74
+ }
75
+
64
76
  /**
65
77
  * Configuration options for index instances */
66
- type TOIMIndexOptions<TPk extends TOIMPk> = {
78
+ type TOIMIndexOptions<TIndexKey extends TOIMPk, TPk extends TOIMPk> = {
67
79
  comparePks?: TOIMIndexComparator<TPk>;
80
+ store?: OIMIndexStore<TIndexKey, TPk>;
68
81
  };
69
82
 
70
83
  /**
@@ -72,12 +85,12 @@ type TOIMIndexOptions<TPk extends TOIMPk> = {
72
85
  * Provides common functionality and event system for key-to-PKs mappings.
73
86
  */
74
87
  declare abstract class OIMIndex<TKey extends TOIMPk, TPk extends TOIMPk> {
75
- protected readonly pks: Map<TKey, Set<TPk>>;
76
88
  protected readonly comparePks?: TOIMIndexComparator<TPk>;
89
+ protected readonly store: OIMIndexStore<TKey, TPk>;
77
90
  readonly emitter: OIMEventEmitter<{
78
91
  0: TOIMIndexUpdatePayload<TKey>;
79
92
  }>;
80
- constructor(options?: TOIMIndexOptions<TPk>);
93
+ constructor(options?: TOIMIndexOptions<TKey, TPk>);
81
94
  /**
82
95
  * Get primary keys for multiple index keys
83
96
  */
@@ -136,16 +149,54 @@ declare abstract class OIMIndex<TKey extends TOIMPk, TPk extends TOIMPk> {
136
149
  protected emitUpdate(keys: TKey[]): void;
137
150
  }
138
151
 
152
+ /**
153
+ * Manual index that allows direct manipulation of key-to-primary-keys mappings.
154
+ * Extends the abstract OIMIndex with manual control methods and optional comparison.
155
+ */
156
+ declare class OIMIndexManual<TIndexKey extends TOIMPk, TPk extends TOIMPk> extends OIMIndex<TIndexKey, TPk> {
157
+ constructor(options?: TOIMIndexOptions<TIndexKey, TPk>);
158
+ /**
159
+ * Set primary keys for a specific index key, replacing any existing values.
160
+ * Uses optional comparator to skip updates if PKs haven't actually changed.
161
+ */
162
+ setPks(key: TIndexKey, pks: TPk[]): void;
163
+ /**
164
+ * Add primary keys to a specific index key
165
+ */
166
+ addPks(key: TIndexKey, pks: readonly TPk[]): void;
167
+ /**
168
+ * Remove primary keys from a specific index key
169
+ */
170
+ removePks(key: TIndexKey, pks: readonly TPk[]): void;
171
+ /**
172
+ * Clear all primary keys for a specific index key, or all keys if no key specified
173
+ */
174
+ clear(key?: TIndexKey): void;
175
+ }
176
+
177
+ /**
178
+ * Static class containing OIMDB settings and constants.
179
+ * Provides access to configuration values used throughout the library.
180
+ */
181
+ declare class OIMDBSettings {
182
+ /**
183
+ * Fixed key used in the manual index to store updated keys set in coalescers.
184
+ * This constant is exported so users can create their own indexes and pass them to coalescers.
185
+ */
186
+ static readonly UPDATED_KEYS_INDEX_KEY: "__updatedKeys__";
187
+ }
188
+
139
189
  /**
140
190
  * Base abstract coalescer that groups updates by keys and emits consolidated events.
141
191
  * Designed to be extended for different entity types (collections, indexes, etc.).
142
192
  */
143
- declare abstract class OIMUpdateEventCoalescer<TKey> {
193
+ declare abstract class OIMUpdateEventCoalescer<TKey extends TOIMPk> {
144
194
  readonly emitter: OIMEventEmitter<{
145
195
  0: void;
146
196
  }>;
147
- protected updatedKeys: Set<TKey>;
197
+ protected readonly updatedKeysIndex: OIMIndexManual<typeof OIMDBSettings.UPDATED_KEYS_INDEX_KEY, TKey>;
148
198
  private hasEmittedChanges;
199
+ constructor(index?: OIMIndexManual<typeof OIMDBSettings.UPDATED_KEYS_INDEX_KEY, TKey>);
149
200
  /**
150
201
  * Get the set of keys that have been updated since last clear
151
202
  */
@@ -157,7 +208,7 @@ declare abstract class OIMUpdateEventCoalescer<TKey> {
157
208
  /**
158
209
  * Add keys to the updated set and emit HAS_CHANGES event if needed
159
210
  */
160
- protected addUpdatedKeys(keys: TKey[]): void;
211
+ protected addUpdatedKeys(keys: readonly TKey[]): void;
161
212
  /**
162
213
  * Clean up event listeners when coalescer is no longer needed
163
214
  */
@@ -214,7 +265,7 @@ declare class OIMEventQueue {
214
265
 
215
266
  /**
216
267
  * Options for creating an update event emitter */
217
- type TOIMUpdateEventEmitterOptions<TKey> = {
268
+ type TOIMUpdateEventEmitterOptions<TKey extends TOIMPk> = {
218
269
  coalescer: OIMUpdateEventCoalescer<TKey>;
219
270
  queue: OIMEventQueue;
220
271
  };
@@ -223,7 +274,7 @@ type TOIMUpdateEventEmitterOptions<TKey> = {
223
274
  * Universal event emitter that handles subscriptions and notifications for any key type.
224
275
  * Optimized for performance with adaptive algorithms and memory management.
225
276
  */
226
- declare class OIMUpdateEventEmitter<TKey> {
277
+ declare class OIMUpdateEventEmitter<TKey extends TOIMPk> {
227
278
  protected keyHandlers: Map<TKey, Set<TOIMEventHandler<void>>>;
228
279
  protected coalescer: OIMUpdateEventCoalescer<TKey>;
229
280
  protected queue: OIMEventQueue;
@@ -261,7 +312,7 @@ declare enum EOIMIndexEventType {
261
312
  * Index-specific coalescer that tracks index key updates and emits consolidated change events.
262
313
  * Takes an event emitter directly instead of the whole index to avoid circular dependencies.
263
314
  */
264
- declare class OIMUpdateEventCoalescerIndex<TIndexKey> extends OIMUpdateEventCoalescer<TIndexKey> {
315
+ declare class OIMUpdateEventCoalescerIndex<TIndexKey extends TOIMPk> extends OIMUpdateEventCoalescer<TIndexKey> {
265
316
  private readonly indexEmitter;
266
317
  constructor(indexEmitter: OIMEventEmitter<{
267
318
  [EOIMIndexEventType.UPDATE]: TOIMIndexUpdatePayload<TIndexKey>;
@@ -354,48 +405,10 @@ declare class OIMUpdateEventCoalescerCollection<TPk extends TOIMPk> extends OIMU
354
405
  private handleUpdate;
355
406
  }
356
407
 
357
- declare class OIMReactiveCollection<TEntity extends object, TPk extends TOIMPk> {
358
- readonly collection: OIMCollection<TEntity, TPk>;
408
+ declare class OIMReactiveCollection<TEntity extends object, TPk extends TOIMPk> extends OIMCollection<TEntity, TPk> {
359
409
  readonly updateEventEmitter: OIMUpdateEventEmitter<TPk>;
360
410
  readonly coalescer: OIMUpdateEventCoalescerCollection<TPk>;
361
- constructor(queue: OIMEventQueue, opts?: {
362
- collectionOpts?: TOIMCollectionOptions<TEntity, TPk>;
363
- });
364
- upsertMany(entities: TEntity[]): void;
365
- upsertOne(entity: TEntity): void;
366
- removeMany(entities: TEntity[]): void;
367
- removeOne(entity: TEntity): void;
368
- getOneByPk(pk: TPk): TEntity | undefined;
369
- getManyByPks(pks: readonly TPk[]): TEntity[];
370
- clear(): void;
371
- countAll(): number;
372
- getAll(): TEntity[];
373
- getAllPks(): TPk[];
374
- }
375
-
376
- /**
377
- * Manual index that allows direct manipulation of key-to-primary-keys mappings.
378
- * Extends the abstract OIMIndex with manual control methods and optional comparison.
379
- */
380
- declare class OIMIndexManual<TIndexKey extends TOIMPk, TPk extends TOIMPk> extends OIMIndex<TIndexKey, TPk> {
381
- constructor(options?: TOIMIndexOptions<TPk>);
382
- /**
383
- * Set primary keys for a specific index key, replacing any existing values.
384
- * Uses optional comparator to skip updates if PKs haven't actually changed.
385
- */
386
- setPks(key: TIndexKey, pks: TPk[]): void;
387
- /**
388
- * Add primary keys to a specific index key
389
- */
390
- addPks(key: TIndexKey, pks: readonly TPk[]): void;
391
- /**
392
- * Remove primary keys from a specific index key
393
- */
394
- removePks(key: TIndexKey, pks: readonly TPk[]): void;
395
- /**
396
- * Clear all primary keys for a specific index key, or all keys if no key specified
397
- */
398
- clear(key?: TIndexKey): void;
411
+ constructor(queue: OIMEventQueue, opts?: TOIMCollectionOptions<TEntity, TPk>);
399
412
  }
400
413
 
401
414
  declare class OIMReactiveIndexManual<TKey extends TOIMPk, TPk extends TOIMPk> extends OIMReactiveIndex<TKey, TPk, OIMIndexManual<TKey, TPk>> {
@@ -409,11 +422,11 @@ declare class OIMReactiveIndexManual<TKey extends TOIMPk, TPk extends TOIMPk> ex
409
422
  clear(key?: TKey): void;
410
423
  }
411
424
 
412
- declare class OIMRICollection<TEntity extends object, TPk extends TOIMPk, TIndexName extends string, TIndexKey extends TOIMPk, TIndex extends OIMIndex<TIndexKey, TPk>, TReactiveIndex extends OIMReactiveIndex<TIndexKey, TPk, TIndex>> extends OIMReactiveCollection<TEntity, TPk> {
413
- readonly indexes: Record<TIndexName, TReactiveIndex>;
425
+ declare class OIMRICollection<TEntity extends object, TPk extends TOIMPk, TIndexName extends string, TIndexKey extends TOIMPk, TIndex extends OIMIndex<TIndexKey, TPk>, TReactiveIndex extends OIMReactiveIndex<TIndexKey, TPk, TIndex>, TReactiveIndexMap extends Record<TIndexName, TReactiveIndex> = Record<TIndexName, TReactiveIndex>> extends OIMReactiveCollection<TEntity, TPk> {
426
+ readonly indexes?: TReactiveIndexMap;
414
427
  constructor(queue: OIMEventQueue, opts: {
415
428
  collectionOpts?: TOIMCollectionOptions<TEntity, TPk>;
416
- indexes: Record<TIndexName, TReactiveIndex>;
429
+ indexes?: TReactiveIndexMap;
417
430
  });
418
431
  }
419
432
 
@@ -601,4 +614,4 @@ type TOIMUpdatePayload<TKey> = {
601
614
  keys: readonly TKey[];
602
615
  };
603
616
 
604
- export { EOIMCollectionEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMUpdateEventCoalescerEventType, type IOIMEventQueueSchedulerEvents, OIMCollection, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndex, OIMIndexComparatorFactory, OIMIndexManual, OIMMap2Keys, OIMPkSelectorFactory, OIMRICollection, OIMReactiveCollection, OIMReactiveIndex, OIMReactiveIndexManual, OIMUpdateEventCoalescer, OIMUpdateEventCoalescerCollection, OIMUpdateEventCoalescerIndex, OIMUpdateEventEmitter, type TOIMCollectionOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptions, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMPk, type TOIMPkSelector, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdateEventEmitterOptions, type TOIMUpdatePayload };
617
+ export { EOIMCollectionEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMUpdateEventCoalescerEventType, type IOIMEventQueueSchedulerEvents, OIMCollection, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMDBSettings, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndex, OIMIndexComparatorFactory, OIMIndexManual, OIMMap2Keys, OIMPkSelectorFactory, OIMRICollection, OIMReactiveCollection, OIMReactiveIndex, OIMReactiveIndexManual, OIMUpdateEventCoalescer, OIMUpdateEventCoalescerCollection, OIMUpdateEventCoalescerIndex, OIMUpdateEventEmitter, type TOIMCollectionOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptions, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMPk, type TOIMPkSelector, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdateEventEmitterOptions, type TOIMUpdatePayload };