@oimdb/core 4.0.1 → 4.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
@@ -10,27 +10,26 @@ interface IOIMEffectService {
10
10
  setPositionInSubscribedSlot(effect: TOIMEffect, edge: number, positionInSlot: number): void;
11
11
  }
12
12
 
13
- type TOIMKeyedSlot<TKey = unknown> = TOIMSlot & {
14
- readonly key: TKey;
15
- };
16
-
17
- type TOIMIndexableSlot<TKey = unknown> = TOIMKeyedSlot<TKey> & {
18
- readonly indexKeys: unknown[] | undefined;
13
+ type TOIMSlotEditable<TSlot> = {
14
+ -readonly [K in keyof TSlot]: TSlot[K];
19
15
  };
20
16
 
21
17
  interface IOIMSlotOwner {
22
18
  holdSlot(slot: TOIMSlot): void;
23
19
  unholdSlot(slot: TOIMSlot): void;
24
20
  releaseSlotIfUnheld(slot: TOIMSlot): void;
21
+ unsafeMutateSlot(slot: TOIMSlot, mutateSlot: (slotEditable: TOIMSlotEditable<TOIMSlot>) => void): void;
25
22
  subscribeToSlot(slot: TOIMSlot, effect: TOIMEffect, edge: number): number;
26
23
  unsubscribeFromSlot(slot: TOIMSlot, positionInSlot: number, effect: TOIMEffect): boolean;
24
+ onSlotFirstSubscribed(slot: TOIMSlot): void;
25
+ onSlotLastUnsubscribed(slot: TOIMSlot): void;
27
26
  }
28
27
 
29
28
  interface IOIMComputedValueService<TValue = unknown> {
30
- getValueForSlot(computedSlot: TOIMComputedSlot<TValue>): TValue;
29
+ getValueForSlot(computedSlot: TOIMComputedContentSlot<TValue>): TValue;
31
30
  }
32
31
 
33
- type TOIMComputedSlot<TValue = unknown, TKey = unknown> = TOIMIndexableSlot<TKey> & Readonly<TOIMDerivation> & {
32
+ type TOIMComputedContentSlot<TValue = unknown> = TOIMSlot & Readonly<TOIMDerivation> & {
34
33
  readonly owner: IOIMSlotOwner;
35
34
  readonly computedValueService: IOIMComputedValueService<TValue>;
36
35
  readonly value: TValue;
@@ -42,7 +41,7 @@ type TOIMComputedSlot<TValue = unknown, TKey = unknown> = TOIMIndexableSlot<TKey
42
41
 
43
42
  type TOIMComputedSources = {
44
43
  readonly sourceSlots: readonly TOIMSlot[];
45
- readonly sourceComputeds: readonly TOIMComputedSlot[];
44
+ readonly sourceComputeds: readonly TOIMComputedContentSlot[];
46
45
  };
47
46
 
48
47
  type TOIMDerivation = TOIMComputedSources & {
@@ -84,8 +83,9 @@ type TOIMColumnReaders = {
84
83
  readonly columnGroups: TOIMColumnGroup[];
85
84
  };
86
85
 
87
- type TOIMStoreSlot<TStore = unknown, TSlot extends TOIMSlot = TOIMSlot, TPatch = unknown> = {
86
+ type TOIMStoreSlot<TStore = unknown, TSlot extends TOIMSlot = TOIMSlot, TPatch = unknown, TSlotService = unknown> = {
88
87
  readonly store: TStore;
88
+ readonly slotService: TSlotService;
89
89
  readonly channelSlot: TOIMChannelSlot;
90
90
  readonly contentChangeListeners: IOIMContentChangeListener<TSlot, TPatch>[] | undefined;
91
91
  readonly contentChangeListenerReadColumnNames: (readonly string[] | undefined)[] | undefined;
@@ -96,10 +96,10 @@ type TOIMStoreSlot<TStore = unknown, TSlot extends TOIMSlot = TOIMSlot, TPatch =
96
96
  readonly columnGroupSlotCountsByKey: Map<string, number> | undefined;
97
97
  readonly columnReadersByColumnName: Map<string, TOIMColumnReaders> | undefined;
98
98
  readonly anyColumnSlotCount: number;
99
- readonly subframeSlotChannelQueues: OIMChannelQueue<TSlot>[] | undefined;
100
- readonly subframePatchChannelQueues: OIMChannelQueue<TPatch | undefined>[] | undefined;
101
- readonly subframeChangedColumnsChannelQueues: OIMChannelQueue<readonly string[] | undefined>[] | undefined;
102
- readonly changedBucketSlotChannelQueue: OIMChannelQueue<TSlot> | undefined;
99
+ readonly batchDepth: number;
100
+ readonly batchSlotChannelQueue: OIMChannelQueue<TSlot> | undefined;
101
+ readonly batchPatchChannelQueue: OIMChannelQueue<TPatch | undefined> | undefined;
102
+ readonly batchChangedColumnsChannelQueue: OIMChannelQueue<readonly string[] | undefined> | undefined;
103
103
  readonly arrivedBucketMemberSlotChannelQueues: OIMChannelQueue<TOIMSlot>[] | undefined;
104
104
  readonly departedBucketMemberSlotChannelQueues: OIMChannelQueue<TOIMSlot>[] | undefined;
105
105
  readonly removedAtChannelQueues: OIMChannelQueue<number>[] | undefined;
@@ -117,10 +117,6 @@ type TOIMStoreSlot<TStore = unknown, TSlot extends TOIMSlot = TOIMSlot, TPatch =
117
117
  readonly isDisposed: boolean;
118
118
  };
119
119
 
120
- interface IOIMSubframeCloseListener {
121
- onStoreSlotSubframeClosed(storeSlot: TOIMStoreSlot): void;
122
- }
123
-
124
120
  type TOIMUnusedSlotCollectorSlot = {
125
121
  readonly unusedSlotChannelQueue: OIMChannelQueue<TOIMSlot>;
126
122
  openDepth: number;
@@ -129,32 +125,84 @@ type TOIMUnusedSlotCollectorSlot = {
129
125
 
130
126
  type TOIMTimer = (run: () => void, inMs: number) => TOIMDisposer;
131
127
 
128
+ interface IOIMErrorPolicy {
129
+ onErrorCaught(error: unknown): void;
130
+ }
131
+
132
+ type TOIMSlotWheelOptions = {
133
+ getNowMs: () => number;
134
+ timer: TOIMTimer;
135
+ errorPolicy: IOIMErrorPolicy;
136
+ };
137
+
138
+ type TOIMSlotReleaseWheelOptions = TOIMSlotWheelOptions & {
139
+ getReleaseDueMs: (slot: TOIMSlot) => number;
140
+ setReleaseDueMs: (slot: TOIMSlot, releaseDueMs: number) => void;
141
+ releaseScheduledSlotFlag: number;
142
+ };
143
+
132
144
  type TOIMFlushSchedulerSlot = {
133
145
  readonly timer: TOIMTimer | undefined;
134
146
  scheduledCallback: (() => void) | undefined;
135
147
  timerDisposer: TOIMDisposer | undefined;
136
148
  };
137
149
 
138
- interface IOIMErrorPolicy {
139
- onErrorCaught(error: unknown): void;
150
+ interface IOIMFlushSchedulerListener<TFlushSchedulerSlot extends TOIMFlushSchedulerSlot> {
151
+ onSchedulerTimerFired(flushSchedulerSlot: TFlushSchedulerSlot): void;
140
152
  }
141
153
 
142
- type TOIMReleaseSlotCollectorSlot = TOIMFlushSchedulerSlot & {
154
+ declare abstract class OIMSlotWheel implements TOIMFlushSchedulerSlot, IOIMFlushSchedulerListener<OIMSlotWheel> {
155
+ readonly timer: TOIMTimer;
156
+ scheduledCallback: (() => void) | undefined;
157
+ timerDisposer: TOIMDisposer | undefined;
143
158
  readonly getNowMs: () => number;
144
- readonly errorPolicy: IOIMErrorPolicy;
145
- scheduledUntilMs: number;
146
- readonly slotsBySliceNumber: Map<number, Set<TOIMSlot>>;
147
- readonly sliceNumberBySlot: Map<TOIMSlot, number>;
148
- floorSliceNumber: number;
149
- nextSliceNumber: number | undefined;
150
- nextSliceNumberNeedsRescan: boolean;
151
- };
159
+ private readonly errorPolicy;
160
+ private scheduledUntilMs;
161
+ private readonly slotsBySliceNumber;
162
+ private lastFiledSliceNumber;
163
+ private lastFiledSliceSlots;
164
+ private floorSliceNumber;
165
+ private nextSliceNumber;
166
+ private nextSliceNumberNeedsRescan;
167
+ constructor(options: TOIMSlotWheelOptions);
168
+ getNextSliceNumber(): number | undefined;
169
+ sweepUpToSliceNumber(upToSliceNumber: number): void;
170
+ flush(): void;
171
+ cancelAllSlots(): void;
172
+ protected fileSlot(sliceNumber: number, slot: TOIMSlot): void;
173
+ protected scheduleNextSweep(): void;
174
+ private cancelSlotWheelSchedule;
175
+ onSchedulerTimerFired(): void;
176
+ protected getSweptSliceNumberAt(nowMs: number): number;
177
+ protected abstract onSlotDue(slot: TOIMSlot, nowMs: number): void;
178
+ protected onSlotDropped(_slot: TOIMSlot): void;
179
+ protected onSweepFinished(): void;
180
+ private lowerNextSliceNumber;
181
+ private sweepSlice;
182
+ }
183
+
184
+ declare class OIMSlotReleaseWheel extends OIMSlotWheel {
185
+ readonly getReleaseDueMs: (slot: TOIMSlot) => number;
186
+ private readonly setReleaseDueMs;
187
+ private readonly releaseScheduledSlotFlag;
188
+ constructor(options: TOIMSlotReleaseWheelOptions);
189
+ markSlotReleaseDue(slot: TOIMSlot, keepMs: number): number;
190
+ markSlotReleaseDueNow(slot: TOIMSlot): void;
191
+ scheduleSlotRelease(slot: TOIMSlot, nowMs: number): void;
192
+ isSlotReleasable(slot: TOIMSlot): boolean;
193
+ cancelSlotRelease(slot: TOIMSlot): void;
194
+ isSlotReleaseScheduled(slot: TOIMSlot): boolean;
195
+ protected onSlotDue(slot: TOIMSlot, nowMs: number): void;
196
+ protected onSlotDropped(slot: TOIMSlot): void;
197
+ private fileReleaseSlot;
198
+ }
152
199
 
153
200
  type TOIMCollectorSlot = {
154
201
  readonly unusedSlotCollectorSlot: TOIMUnusedSlotCollectorSlot;
155
- readonly afterIdleReleaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot;
156
- readonly afterWriteReleaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot;
157
- readonly afterUnholdReleaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot;
202
+ readonly slotWheelOptions: TOIMSlotWheelOptions;
203
+ afterIdleSlotReleaseWheel: OIMSlotReleaseWheel | undefined;
204
+ afterWriteSlotReleaseWheel: OIMSlotReleaseWheel | undefined;
205
+ afterUnholdSlotReleaseWheel: OIMSlotReleaseWheel | undefined;
158
206
  };
159
207
 
160
208
  type TOIMChannelClock = {
@@ -178,15 +226,8 @@ type TOIMChannelSlot = TOIMFlushSchedulerSlot & {
178
226
  readonly effectChannelQueue: OIMChannelQueue<TOIMEffect>;
179
227
  readonly afterEachFlush: Set<() => void>;
180
228
  readonly afterEachFrameHandlerChannelQueue: OIMChannelQueue<() => void>;
181
- readonly subframeStoreSlotChannelQueues: OIMChannelQueue<TOIMStoreSlot>[];
182
- readonly changedStoreSlotChannelQueue: OIMChannelQueue<TOIMStoreSlot>;
183
- readonly changedStoreSlotOwnerChannelQueue: OIMChannelQueue<IOIMSubframeCloseListener>;
184
229
  commandsStoreSlotChannelQueue: OIMChannelQueue<TOIMStoreSlot> | undefined;
185
230
  changedColumnNames: string[] | undefined;
186
- subframesOpen: number;
187
- contentSubframeDepth: number;
188
- subframeDeliveryDepth: number;
189
- flushRequestedInSubframe: boolean;
190
231
  flushRequested: boolean;
191
232
  isFlushing: boolean;
192
233
  dropped: boolean;
@@ -228,36 +269,64 @@ interface IOIMStoreSlotListener {
228
269
  onStoreSlotCreated<TStore, TSlot extends TOIMSlot, TPatch>(storeSlot: TOIMStoreSlot<TStore, TSlot, TPatch>): void;
229
270
  }
230
271
 
231
- declare class OIMStoreSlotListenerNone implements IOIMStoreSlotListener {
232
- static readonly INSTANCE: OIMStoreSlotListenerNone;
272
+ declare class OIMNoStoreSlotListener implements IOIMStoreSlotListener {
273
+ static readonly INSTANCE: OIMNoStoreSlotListener;
233
274
  onStoreSlotCreated(): void;
234
275
  }
235
276
 
277
+ interface IOIMSlotSubscriptionListener {
278
+ onSlotFirstSubscribed(slot: TOIMSlot): void;
279
+ onSlotLastUnsubscribed(slot: TOIMSlot): void;
280
+ }
281
+
282
+ declare class OIMNoSlotSubscriptionListener implements IOIMSlotSubscriptionListener {
283
+ static readonly INSTANCE: OIMNoSlotSubscriptionListener;
284
+ onSlotFirstSubscribed(): void;
285
+ onSlotLastUnsubscribed(): void;
286
+ }
287
+
236
288
  declare function oimIsSlotEmpty(slot: TOIMSlot): boolean;
237
289
 
238
290
  declare function oimIsSlotReleased(slot: TOIMSlot): boolean;
239
291
 
240
- type TOIMEntitySlot<TEntity extends object = object, TKey = unknown> = TOIMIndexableSlot<TKey> & {
292
+ type TOIMKeyedSlot<TKey extends NonNullable<unknown> = NonNullable<unknown>> = TOIMSlot & {
293
+ readonly key: TKey;
294
+ };
295
+
296
+ type TOIMIndexableSlot<TKey extends NonNullable<unknown> = NonNullable<unknown>> = TOIMKeyedSlot<TKey> & {
297
+ readonly indexKeys: unknown[] | undefined;
298
+ };
299
+
300
+ type TOIMEntityContentSlot<TEntity extends object = object> = TOIMSlot & {
241
301
  readonly entity: TEntity | undefined;
242
302
  readonly data: unknown[] | undefined;
243
303
  };
244
304
 
305
+ type TOIMEntitySlot<TEntity extends object = object, TKey extends NonNullable<unknown> = NonNullable<unknown>> = TOIMEntityContentSlot<TEntity> & TOIMIndexableSlot<TKey>;
306
+
245
307
  type TOIMColumnSlot = TOIMSlot & {
246
308
  readonly carrierSlot: TOIMSlot;
247
309
  readonly key: string;
248
310
  };
249
311
 
312
+ type TOIMComputedSlot<TValue = unknown, TKey extends NonNullable<unknown> = NonNullable<unknown>> = TOIMComputedContentSlot<TValue> & TOIMIndexableSlot<TKey>;
313
+
250
314
  type TOIMComputedColumnSlot = TOIMComputedSlot<unknown, string>;
251
315
 
252
- interface IOIMSlotStoreService<TKey, TSlot extends TOIMKeyedSlot = TOIMKeyedSlot, TStore = unknown> {
316
+ interface IOIMSlotFilingService<TSlot extends TOIMSlot = TOIMSlot, TStore = unknown> {
253
317
  createStore(): TStore;
318
+ fileSlot(store: TStore, slot: TSlot): void;
319
+ unfileSlot(store: TStore, slot: TSlot): void;
320
+ getSlots(store: TStore): IterableIterator<TSlot>;
321
+ getSlotCount(store: TStore): number;
322
+ }
323
+
324
+ interface IOIMSlotStoreService<TKey extends NonNullable<unknown>, TSlot extends TOIMKeyedSlot<TKey> = TOIMKeyedSlot<TKey>, TStore = unknown> extends IOIMSlotFilingService<TSlot, TStore> {
254
325
  ownKey<TOwnedKey extends TKey>(key: TOwnedKey): TOwnedKey;
255
326
  isSameKey(key: TKey, otherKey: TKey): boolean;
256
327
  get(store: TStore, key: TKey): TSlot | undefined;
257
328
  set(store: TStore, key: TKey, slot: TSlot): void;
258
329
  remove(store: TStore, key: TKey): void;
259
- getSlots(store: TStore): IterableIterator<TSlot>;
260
- getSlotCount(store: TStore): number;
261
330
  }
262
331
 
263
332
  declare class OIMSlotOwner implements IOIMSlotOwner {
@@ -266,12 +335,15 @@ declare class OIMSlotOwner implements IOIMSlotOwner {
266
335
  subscribeToSlot(slot: TOIMSlot, effect: TOIMEffect, edge: number): number;
267
336
  unsubscribeFromSlot(slot: TOIMSlot, positionInSlot: number, effect: TOIMEffect): boolean;
268
337
  releaseSlotIfUnheld(_slot: TOIMSlot): void;
338
+ unsafeMutateSlot(slot: TOIMSlot, mutateSlot: (slotEditable: TOIMSlotEditable<TOIMSlot>) => void): void;
339
+ onSlotFirstSubscribed(_slot: TOIMSlot): void;
340
+ onSlotLastUnsubscribed(_slot: TOIMSlot): void;
269
341
  protected onSlotIdle(_slot: TOIMSlot): void;
270
342
  protected onSlotUnheld(_slot: TOIMSlot): void;
271
343
  protected assertNotReleased(slot: TOIMSlot): void;
272
344
  }
273
345
 
274
- declare abstract class OIMColumnOwner<TCarrierSlot extends TOIMSlot, TColumnSlot extends TOIMKeyedSlot<string>> extends OIMSlotOwner {
346
+ declare abstract class OIMColumnSlotOwner<TCarrierSlot extends TOIMSlot, TColumnSlot extends TOIMKeyedSlot<string>> extends OIMSlotOwner {
275
347
  protected readonly columnSlotStoreService: IOIMSlotStoreService<string, TColumnSlot>;
276
348
  protected constructor(columnSlotStoreService: IOIMSlotStoreService<string, TColumnSlot>);
277
349
  protected abstract createColumnSlot(carrierSlot: TCarrierSlot, key: string): TColumnSlot;
@@ -284,6 +356,8 @@ declare abstract class OIMColumnOwner<TCarrierSlot extends TOIMSlot, TColumnSlot
284
356
  holdColumn(carrierSlot: TCarrierSlot, key: string): TColumnSlot;
285
357
  isAnyColumnReferenced(storeSlot: TOIMStoreSlot, changedColumns: readonly string[]): boolean;
286
358
  releaseSlotIfUnheld(slot: TOIMSlot): void;
359
+ onSlotFirstSubscribed(slot: TOIMSlot): void;
360
+ onSlotLastUnsubscribed(slot: TOIMSlot): void;
287
361
  protected getColumnGroupsByKeyOf(carrierSlot: TCarrierSlot): Map<string, TOIMColumnGroup> | undefined;
288
362
  protected getColumnReadersOf(carrierSlot: TCarrierSlot): Map<string, TOIMColumnReaders> | undefined;
289
363
  private getColumnIfFiled;
@@ -292,7 +366,7 @@ declare abstract class OIMColumnOwner<TCarrierSlot extends TOIMSlot, TColumnSlot
292
366
  private fileColumnSlot;
293
367
  }
294
368
 
295
- type TOIMColumnOwnerOptions<TColumnSlot extends TOIMKeyedSlot<string>, TColumnName extends string = string> = {
369
+ type TOIMColumnSlotOwnerOptions<TColumnSlot extends TOIMKeyedSlot<string>, TColumnName extends string = string> = {
296
370
  columnSlotStoreService: IOIMSlotStoreService<string, TColumnSlot>;
297
371
  columnNames?: undefined;
298
372
  } | {
@@ -300,8 +374,8 @@ type TOIMColumnOwnerOptions<TColumnSlot extends TOIMKeyedSlot<string>, TColumnNa
300
374
  columnSlotStoreService?: undefined;
301
375
  };
302
376
 
303
- declare class OIMColumnOwnerPushDriven extends OIMColumnOwner<TOIMSlot, TOIMColumnSlot> {
304
- constructor(options: TOIMColumnOwnerOptions<TOIMColumnSlot>);
377
+ declare class OIMPushColumnSlotOwner extends OIMColumnSlotOwner<TOIMSlot, TOIMColumnSlot> {
378
+ constructor(options: TOIMColumnSlotOwnerOptions<TOIMColumnSlot>);
305
379
  protected createColumnSlot(carrierSlot: TOIMSlot, key: string): TOIMColumnSlot;
306
380
  protected carrierSlotOf(columnSlot: TOIMColumnSlot): TOIMSlot;
307
381
  markColumnsChanged(carrierSlot: TOIMSlot, patch: object | undefined, changedColumns: readonly string[] | undefined, channelSlot: TOIMChannelSlot): void;
@@ -310,20 +384,16 @@ declare class OIMColumnOwnerPushDriven extends OIMColumnOwner<TOIMSlot, TOIMColu
310
384
  private markValueColumnsChanged;
311
385
  }
312
386
 
313
- declare class OIMColumnOwnerPullDriven extends OIMColumnOwner<TOIMComputedSlot, TOIMComputedColumnSlot> implements IOIMComputedValueService {
314
- constructor(options: TOIMColumnOwnerOptions<TOIMComputedColumnSlot>);
387
+ declare class OIMPullColumnSlotOwner extends OIMColumnSlotOwner<TOIMComputedContentSlot, TOIMComputedColumnSlot> implements IOIMComputedValueService {
388
+ constructor(options: TOIMColumnSlotOwnerOptions<TOIMComputedColumnSlot>);
315
389
  private readonly deriveColumnSlotValue;
316
- getValueForSlot(computedSlot: TOIMComputedSlot): unknown;
317
- protected createColumnSlot(carrierSlot: TOIMComputedSlot, key: string): TOIMComputedColumnSlot;
318
- protected carrierSlotOf(columnSlot: TOIMComputedColumnSlot): TOIMComputedSlot;
390
+ getValueForSlot(computedSlot: TOIMComputedContentSlot): unknown;
391
+ protected createColumnSlot(carrierSlot: TOIMComputedContentSlot, key: string): TOIMComputedColumnSlot;
392
+ protected carrierSlotOf(columnSlot: TOIMComputedColumnSlot): TOIMComputedContentSlot;
319
393
  private deriveColumnValue;
320
394
  private deriveColumnValues;
321
395
  }
322
396
 
323
- type TOIMSlotEditable<TSlot> = {
324
- -readonly [K in keyof TSlot]: TSlot[K];
325
- };
326
-
327
397
  interface IOIMSlotStamp<TSlot> {
328
398
  stamp(slotEditable: TOIMSlotEditable<TSlot>): void;
329
399
  }
@@ -344,18 +414,18 @@ type TOIMOrderedListCommand = {
344
414
  slots: readonly TOIMSlot[];
345
415
  };
346
416
 
347
- type TOIMBucketSlot<TSlots = unknown, TKey = unknown> = TOIMIndexableSlot<TKey> & {
417
+ type TOIMBucketContentSlot<TSlots = unknown> = TOIMSlot & {
348
418
  readonly owner: IOIMSlotOwner;
349
- readonly storeSlot: TOIMStoreSlot<unknown, TOIMBucketSlot<TSlots>>;
419
+ readonly storeSlot: TOIMStoreSlot<unknown, TOIMBucketContentSlot<TSlots>>;
350
420
  readonly bucketSlotsStore: TSlots;
351
421
  readonly commands: readonly TOIMOrderedListCommand[] | undefined;
352
422
  readonly isWholeListRecorded: boolean;
353
423
  readonly commandsStartedAtRevision: number;
354
424
  readonly commandsStartedAtEpoch: number;
355
- readonly wasEmptyBeforeChange: boolean | undefined;
356
- readonly isChangedAgainInSubframe: boolean;
357
425
  };
358
426
 
427
+ type TOIMBucketSlot<TSlots = unknown, TKey extends NonNullable<unknown> = NonNullable<unknown>> = TOIMBucketContentSlot<TSlots> & TOIMIndexableSlot<TKey>;
428
+
359
429
  type TOIMSameValueGuard<TValue = unknown> = (prevValue: TValue, nextValue: TValue) => boolean;
360
430
 
361
431
  declare function oimSameValueZeroGuard(prevValue: unknown, nextValue: unknown): boolean;
@@ -373,12 +443,12 @@ declare function oimUnholdSlotsIfAlive(slots: readonly TOIMSlot[]): void;
373
443
  type TOIMChannelScheduler = (flush: () => void) => void;
374
444
 
375
445
  interface IOIMEntityWriter {
376
- readonly fillEntity: (slot: TOIMEntitySlot, entity: object) => void;
377
- readonly putEntity: (slot: TOIMEntitySlot, entity: object, changedColumnNames: string[] | undefined) => boolean;
378
- readonly patchEntity: (slot: TOIMEntitySlot, patch: object, changedColumnNames: string[] | undefined) => boolean;
379
- readonly patchColumn: (slot: TOIMEntitySlot, columnName: string, value: unknown, changedColumnNames: string[] | undefined) => boolean;
380
- readonly deleteColumns: (slot: TOIMEntitySlot, names: readonly string[]) => readonly string[];
381
- readonly clearEntity: (slot: TOIMEntitySlot) => void;
446
+ readonly fillEntity: (slot: TOIMEntityContentSlot, entity: object) => void;
447
+ readonly putEntity: (slot: TOIMEntityContentSlot, entity: object, changedColumnNames: string[] | undefined) => boolean;
448
+ readonly patchEntity: (slot: TOIMEntityContentSlot, patch: object, changedColumnNames: string[] | undefined) => boolean;
449
+ readonly patchColumn: (slot: TOIMEntityContentSlot, columnName: string, value: unknown, changedColumnNames: string[] | undefined) => boolean;
450
+ readonly deleteColumns: (slot: TOIMEntityContentSlot, names: readonly string[]) => readonly string[];
451
+ readonly clearEntity: (slot: TOIMEntityContentSlot) => void;
382
452
  }
383
453
 
384
454
  type TOIMEntityColumnName<TEntity extends object> = [
@@ -387,23 +457,11 @@ type TOIMEntityColumnName<TEntity extends object> = [
387
457
 
388
458
  type TOIMEntityColumnValue<TEntity extends object, TColumnName> = object extends TEntity ? unknown : TColumnName extends keyof TEntity ? TEntity[TColumnName] : never;
389
459
 
390
- declare abstract class OIMFlushSchedulerService<TFlushSchedulerSlot extends TOIMFlushSchedulerSlot> {
391
- abstract flush(flushSchedulerSlot: TFlushSchedulerSlot): void;
392
- protected onSchedulerTimerFired(flushSchedulerSlot: TFlushSchedulerSlot): void;
393
- protected isScheduled(flushSchedulerSlot: TFlushSchedulerSlot): boolean;
394
- protected schedule(flushSchedulerSlot: TFlushSchedulerSlot, delayMs: number): void;
395
- protected cancelSchedule(flushSchedulerSlot: TFlushSchedulerSlot): void;
396
- }
397
-
398
- declare class OIMChannelService extends OIMFlushSchedulerService<TOIMChannelSlot> {
460
+ declare class OIMChannelService implements IOIMFlushSchedulerListener<TOIMChannelSlot> {
399
461
  static readonly INSTANCE: OIMChannelService;
400
462
  scheduleEffectRun(channelSlot: TOIMChannelSlot, effect: TOIMEffect): void;
401
463
  isRefusingWrites(channelSlot: TOIMChannelSlot): boolean;
402
464
  assertNotFlushing(channelSlot: TOIMChannelSlot): void;
403
- isSubframeOpen(channelSlot: TOIMChannelSlot): boolean;
404
- listChangedStoreSlot(channelSlot: TOIMChannelSlot, storeSlot: TOIMStoreSlot, subframeCloseListener: IOIMSubframeCloseListener): void;
405
- openSubframe(channelSlot: TOIMChannelSlot): void;
406
- closeSubframe(channelSlot: TOIMChannelSlot): void;
407
465
  subscribeAfterEachFrame(channelSlot: TOIMChannelSlot, handler: () => void): TOIMDisposer;
408
466
  subscribeAfterEachFlush(channelSlot: TOIMChannelSlot, handler: () => void): TOIMDisposer;
409
467
  subscribeOnceAfterFrame(channelSlot: TOIMChannelSlot, handler: () => void): TOIMDisposer;
@@ -412,6 +470,7 @@ declare class OIMChannelService extends OIMFlushSchedulerService<TOIMChannelSlot
412
470
  writeWithoutFlushCheck(channelSlot: TOIMChannelSlot, slot: TOIMSlot): void;
413
471
  private requestFlush;
414
472
  dropChannelSlot(channelSlot: TOIMChannelSlot): void;
473
+ onSchedulerTimerFired(channelSlot: TOIMChannelSlot): void;
415
474
  flush(channelSlot: TOIMChannelSlot): void;
416
475
  private runFrame;
417
476
  private dispatchAfterEachFrame;
@@ -432,18 +491,18 @@ interface IOIMChannelMap {
432
491
  readonly defaultChannelSlot: TOIMChannelSlot;
433
492
  }
434
493
 
435
- type TOIMErrorPolicyLogAndContinueOptions = {
494
+ type TOIMLogAndContinueErrorPolicyOptions = {
436
495
  onError?: ((error: unknown) => void) | undefined;
437
496
  };
438
497
 
439
- declare class OIMErrorPolicyLogAndContinue implements IOIMErrorPolicy {
440
- static readonly INSTANCE: OIMErrorPolicyLogAndContinue;
498
+ declare class OIMLogAndContinueErrorPolicy implements IOIMErrorPolicy {
499
+ static readonly INSTANCE: OIMLogAndContinueErrorPolicy;
441
500
  private readonly onError;
442
- constructor(options?: TOIMErrorPolicyLogAndContinueOptions);
501
+ constructor(options?: TOIMLogAndContinueErrorPolicyOptions);
443
502
  onErrorCaught(error: unknown): void;
444
503
  }
445
504
 
446
- declare class OIMErrorPolicyThrowAtOnce implements IOIMErrorPolicy {
505
+ declare class OIMThrowAtOnceErrorPolicy implements IOIMErrorPolicy {
447
506
  onErrorCaught(error: unknown): void;
448
507
  }
449
508
 
@@ -454,11 +513,11 @@ declare class OIMEffectSourceTracker {
454
513
  private trackedAllRootSlots;
455
514
  private isTrackedAllRootSlotsChanged;
456
515
  readSourceSlot<TSlot extends TOIMSlot>(slot: TSlot): TSlot;
457
- readSourceComputedValue<TValue>(computedSlot: TOIMComputedSlot<TValue, unknown>): TValue;
516
+ readSourceComputedValue<TValue>(computedSlot: TOIMComputedContentSlot<TValue>): TValue;
458
517
  openSourceTracking(): void;
459
518
  closeSourceTracking(): boolean;
460
519
  getTrackedSourceSlots(): readonly TOIMSlot[];
461
- getTrackedSourceComputeds(): readonly TOIMComputedSlot[];
520
+ getTrackedSourceComputeds(): readonly TOIMComputedContentSlot[];
462
521
  getTrackedAllRootSlots(): readonly TOIMSlot[];
463
522
  commitTrackedSources(): void;
464
523
  private trackAllRootSlots;
@@ -468,9 +527,9 @@ type TOIMEffectBodyWithSourceTracking = (effectSourceTracker: OIMEffectSourceTra
468
527
 
469
528
  declare class OIMEffectService implements IOIMEffectService {
470
529
  static readonly INSTANCE: OIMEffectService;
471
- createEffect(channelMap: IOIMChannelMap, sourceSlots: readonly TOIMSlot[], sourceComputeds: readonly TOIMComputedSlot[], body: TOIMEffectBody): TOIMEffect;
472
- subscribeEffect(channelMap: IOIMChannelMap, sourceSlots: readonly TOIMSlot[], sourceComputeds: readonly TOIMComputedSlot[], body: TOIMEffectBody): TOIMDisposer;
473
- createEffectImmediate(channelMap: IOIMChannelMap, sourceSlots: readonly TOIMSlot[], sourceComputeds: readonly TOIMComputedSlot[], body: TOIMEffectBody): TOIMEffect;
530
+ createEffect(channelMap: IOIMChannelMap, sourceSlots: readonly TOIMSlot[], sourceComputeds: readonly TOIMComputedContentSlot[], body: TOIMEffectBody): TOIMEffect;
531
+ subscribeEffect(channelMap: IOIMChannelMap, sourceSlots: readonly TOIMSlot[], sourceComputeds: readonly TOIMComputedContentSlot[], body: TOIMEffectBody): TOIMDisposer;
532
+ createEffectImmediate(channelMap: IOIMChannelMap, sourceSlots: readonly TOIMSlot[], sourceComputeds: readonly TOIMComputedContentSlot[], body: TOIMEffectBody): TOIMEffect;
474
533
  createEffectWithSourceTracking(channelMap: IOIMChannelMap, effectBodyWithSourceTracking: TOIMEffectBodyWithSourceTracking): TOIMEffect;
475
534
  markEffectRunScheduled(effect: TOIMEffect, isSourceCheckOwed: boolean): boolean;
476
535
  runScheduledEffect(effect: TOIMEffect): void;
@@ -485,19 +544,52 @@ declare class OIMEffectService implements IOIMEffectService {
485
544
  private unsubscribeFrom;
486
545
  }
487
546
 
488
- type TOIMComputedValueServiceOptions<TKey, TValue> = {
489
- derive?: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => TValue) | undefined;
547
+ type TOIMComputedValueServiceOptions<TValue, TComputedSlot extends TOIMComputedContentSlot<TValue>> = {
548
+ derive?: ((computedSlot: TComputedSlot) => TValue) | undefined;
490
549
  sameValueGuard?: TOIMSameValueGuard<TValue> | undefined;
491
550
  };
492
551
 
493
- declare class OIMComputedValueService<TKey, TValue> implements IOIMComputedValueService<TValue> {
552
+ declare class OIMComputedValueService<TValue, TComputedSlot extends TOIMComputedContentSlot<TValue> = TOIMComputedContentSlot<TValue>> implements IOIMComputedValueService<TValue> {
494
553
  private readonly derive;
495
554
  private readonly sameValueGuard;
496
- constructor(options: TOIMComputedValueServiceOptions<TKey, TValue>);
497
- getValueForSlot(computedSlot: TOIMComputedSlot<TValue, TKey>): TValue;
555
+ constructor(options: TOIMComputedValueServiceOptions<TValue, TComputedSlot>);
556
+ getValueForSlot(computedSlot: TComputedSlot): TValue;
557
+ }
558
+
559
+ interface IOIMSlotContentService<TSlot extends TOIMSlot, TSlotOwnerService extends IOIMSlotOwner = IOIMSlotOwner> {
560
+ isSlotEmpty(slot: TSlot): boolean;
561
+ releaseSlotContent(slot: TSlot, slotOwnerService: TSlotOwnerService): void;
562
+ hasReference(slot: TSlot): boolean;
563
+ }
564
+
565
+ interface IOIMKeyedSlotCreator<TKey extends NonNullable<unknown>, TSlot extends TOIMKeyedSlot> {
566
+ createSlot(key: TKey, storeSlot: TOIMStoreSlot, slotOwner: IOIMSlotOwner): TSlot;
567
+ }
568
+
569
+ interface IOIMSingleSlotCreator<TSlot extends TOIMSlot> {
570
+ createSingleSlot(storeSlot: TOIMStoreSlot, slotOwner: IOIMSlotOwner): TSlot;
571
+ }
572
+
573
+ type TOIMSlotContentComputedServiceOptions<TValue, TComputedSlot extends TOIMComputedContentSlot<TValue>> = {
574
+ computedValueService: OIMComputedValueService<TValue, TComputedSlot>;
575
+ createSources?: ((computedSlot: TComputedSlot) => Partial<TOIMComputedSources>) | undefined;
576
+ initialValue?: TValue | undefined;
577
+ };
578
+
579
+ declare class OIMSlotContentComputedService<TValue, TComputedSlot extends TOIMComputedContentSlot<TValue> = TOIMComputedContentSlot<TValue>> implements IOIMSlotContentService<TComputedSlot>, IOIMKeyedSlotCreator<NonNullable<unknown>, TOIMComputedSlot<TValue>>, IOIMSingleSlotCreator<TOIMComputedContentSlot<TValue>> {
580
+ private readonly computedValueService;
581
+ private readonly createSources;
582
+ private readonly initialValue;
583
+ constructor(options: TOIMSlotContentComputedServiceOptions<TValue, TComputedSlot>);
584
+ createSlot<TKey extends NonNullable<unknown>>(key: TKey, storeSlot: TOIMStoreSlot, slotOwner: IOIMSlotOwner): TComputedSlot & TOIMComputedSlot<TValue, TKey>;
585
+ createSingleSlot(storeSlot: TOIMStoreSlot, slotOwner: IOIMSlotOwner): TOIMComputedContentSlot<TValue>;
586
+ isSlotEmpty(): boolean;
587
+ releaseSlotContent(computedSlot: TComputedSlot): void;
588
+ hasReference(): boolean;
589
+ private attachSources;
498
590
  }
499
591
 
500
- declare function oimRefreshSourceComputeds(sourceComputeds: readonly TOIMComputedSlot[]): void;
592
+ declare function oimRefreshSourceComputeds(sourceComputeds: readonly TOIMComputedContentSlot[]): void;
501
593
 
502
594
  interface IOIMSlotReleasePolicy {
503
595
  readonly releasesWrittenSlots: boolean;
@@ -510,40 +602,27 @@ interface IOIMSlotReleasePolicy {
510
602
  cancelSlotRelease(slot: TOIMSlot): void;
511
603
  }
512
604
 
513
- interface IOIMSlotContentStrategy<TSlot extends TOIMSlot, TKey, TSlotOwnerService extends IOIMSlotOwner = IOIMSlotOwner> {
514
- createSlot(key: TKey, storeSlot: TOIMStoreSlot | undefined, slotOwnerService: TSlotOwnerService): TSlot;
515
- isSlotEmpty(slot: TSlot): boolean;
516
- releaseSlotContent(slot: TSlot, slotOwnerService: TSlotOwnerService): void;
517
- hasReference(slot: TSlot): boolean;
518
- }
519
-
520
- interface IOIMSlotContentFlushStrategy<TSlot extends TOIMSlot, TSlotOwnerService extends IOIMSlotOwner = IOIMSlotOwner> {
521
- onSubframeClosed(storeSlot: TOIMStoreSlot<unknown, TSlot>, slotOwnerService: TSlotOwnerService): void;
522
- }
523
-
524
- type TOIMSlotOwnerServiceOptions<TKey, TSlot extends TOIMKeyedSlot<TKey>, TStore, TColumnName extends string, TColumnSlot extends TOIMKeyedSlot<string>, TColumnOwner extends OIMColumnOwner<TOIMSlot, TColumnSlot>, TPatch> = {
605
+ type TOIMSlotOwnerServiceOptions<TSlot extends TOIMSlot, TStore, TColumnName extends string, TColumnSlot extends TOIMKeyedSlot<string>, TColumnSlotOwner extends OIMColumnSlotOwner<TOIMSlot, TColumnSlot>, TPatch> = {
525
606
  slotStamp?: IOIMSlotStamp<TSlot> | undefined;
526
607
  slotReleasePolicy?: IOIMSlotReleasePolicy | undefined;
527
- slotStoreService: IOIMSlotStoreService<TKey, TSlot, TStore>;
528
- slotContentStrategy: IOIMSlotContentStrategy<TSlot, TKey, OIMSlotOwnerService<TKey, TSlot, TStore, TColumnName, TColumnSlot, TColumnOwner, TPatch>>;
529
- slotContentFlushStrategy?: IOIMSlotContentFlushStrategy<TSlot, OIMSlotOwnerService<TKey, TSlot, TStore, TColumnName, TColumnSlot, TColumnOwner, TPatch>> | undefined;
530
- columnOwnerOptions: TOIMColumnOwnerOptions<TColumnSlot, TColumnName>;
531
- createColumnOwner: (columnOwnerOptions: TOIMColumnOwnerOptions<TColumnSlot, TColumnName>) => TColumnOwner;
608
+ slotSubscriptionListener?: IOIMSlotSubscriptionListener | undefined;
609
+ slotFilingService: IOIMSlotFilingService<TSlot, TStore>;
610
+ slotContentService: IOIMSlotContentService<TSlot, OIMSlotOwnerService<TSlot, TStore, TColumnName, TColumnSlot, TColumnSlotOwner, TPatch>>;
611
+ columnSlotOwnerOptions: TOIMColumnSlotOwnerOptions<TColumnSlot, TColumnName>;
612
+ createColumnSlotOwner: (columnSlotOwnerOptions: TOIMColumnSlotOwnerOptions<TColumnSlot, TColumnName>) => TColumnSlotOwner;
532
613
  };
533
614
 
534
- declare class OIMSlotOwnerService<TKey, TSlot extends TOIMKeyedSlot<TKey>, TStore, TColumnName extends string, TColumnSlot extends TOIMKeyedSlot<string>, TColumnOwner extends OIMColumnOwner<TOIMSlot, TColumnSlot>, TPatch = unknown> extends OIMSlotOwner implements IOIMSubframeCloseListener {
535
- private readonly slotContentStrategy;
536
- private readonly slotStoreService;
615
+ declare class OIMSlotOwnerService<TSlot extends TOIMSlot, TStore, TColumnName extends string, TColumnSlot extends TOIMKeyedSlot<string>, TColumnSlotOwner extends OIMColumnSlotOwner<TOIMSlot, TColumnSlot>, TPatch = unknown> extends OIMSlotOwner {
616
+ private readonly slotContentService;
617
+ private readonly slotFilingService;
537
618
  private readonly slotStamp;
538
619
  private readonly slotReleasePolicy;
539
620
  private readonly releasesWrittenSlots;
540
621
  private readonly schedulesReleaseOnWrite;
541
- readonly columnOwner: TColumnOwner;
542
- private readonly slotContentFlushStrategy;
543
- constructor(options: TOIMSlotOwnerServiceOptions<TKey, TSlot, TStore, TColumnName, TColumnSlot, TColumnOwner, TPatch>);
544
- listChangedStoreSlot(storeSlot: TOIMStoreSlot<unknown, TSlot>): void;
545
- onStoreSlotSubframeClosed(storeSlot: TOIMStoreSlot): void;
546
- createSlot(key: TKey, storeSlot: TOIMStoreSlot | undefined): TSlot;
622
+ readonly settlesWrittenSlots: boolean;
623
+ private readonly slotSubscriptionListener;
624
+ readonly columnSlotOwner: TColumnSlotOwner;
625
+ constructor(options: TOIMSlotOwnerServiceOptions<TSlot, TStore, TColumnName, TColumnSlot, TColumnSlotOwner, TPatch>);
547
626
  isSlotEmpty(slot: TSlot): boolean;
548
627
  hasColumnSlots(slot: TOIMSlot): boolean;
549
628
  hasContentChangeListeners(slot: TOIMSlot): boolean;
@@ -554,19 +633,27 @@ declare class OIMSlotOwnerService<TKey, TSlot extends TOIMKeyedSlot<TKey>, TStor
554
633
  releaseSlotIfUnheldAfterListeners(slot: TSlot): void;
555
634
  releaseWrittenSlotIfUnheld(slot: TSlot): void;
556
635
  assertWritable(slot: TOIMSlot): void;
557
- fileSlot(storeSlot: TOIMStoreSlot<TStore, TSlot>, slot: TSlot): void;
636
+ fileSlot(slot: TSlot): void;
558
637
  writeSlotToChannelAndSettle(slot: TSlot, wasEmpty: boolean): void;
559
638
  settleEmptiness(slot: TSlot, isEmpty: boolean): void;
560
639
  markEmptiness(slot: TSlot, isEmpty: boolean): void;
561
640
  private settleWrite;
562
641
  private scheduleSlotRelease;
563
642
  protected onSlotIdle(slot: TSlot): void;
643
+ onSlotFirstSubscribed(slot: TOIMSlot): void;
644
+ onSlotLastUnsubscribed(slot: TOIMSlot): void;
564
645
  protected onSlotUnheld(slot: TSlot): void;
565
646
  releaseSlotIfUnheld(slot: TOIMSlot): void;
566
647
  private isReleasable;
567
648
  private releaseSlot;
568
649
  }
569
650
 
651
+ interface IOIMSlotContentWriter<TSlot extends TOIMSlot, TContent> {
652
+ insertSlotContent(slot: TSlot, content: TContent, changedSlots?: TSlot[]): void;
653
+ writeSlotContent(slot: TSlot, content: TContent): boolean;
654
+ clearSlotContent(slot: TSlot): void;
655
+ }
656
+
570
657
  declare class OIMContentChangeListenerService {
571
658
  static readonly INSTANCE: OIMContentChangeListenerService;
572
659
  addContentChangeListener<TSlot extends TOIMSlot, TPatch>(storeSlot: TOIMStoreSlot<unknown, TSlot, TPatch>, listener: IOIMContentChangeListener<TSlot, TPatch>, readColumnNames: readonly string[] | undefined): void;
@@ -577,17 +664,16 @@ declare class OIMContentChangeListenerService {
577
664
  removeReadAnyColumn(storeSlot: TOIMStoreSlot): void;
578
665
  }
579
666
 
580
- interface IOIMSlotEmptiness<TSlot> {
667
+ interface IOIMSlotEmptinessPolicy<TSlot> {
581
668
  isEmpty(slot: TSlot): boolean;
582
669
  }
583
670
 
584
- type TOIMSlotContentEntityServiceOptions<TEntity extends object, TKey, TStore, TColumnName extends string> = Pick<TOIMSlotOwnerServiceOptions<TKey, TOIMEntitySlot<TEntity, TKey>, TStore, TColumnName, TOIMColumnSlot, OIMColumnOwnerPushDriven, Partial<TEntity>>, 'slotStamp' | 'slotReleasePolicy' | 'slotStoreService' | 'columnOwnerOptions' | 'createColumnOwner'> & {
585
- keyOf: (entity: TEntity) => TKey;
671
+ type TOIMSlotContentEntityServiceOptions<TEntity extends object> = {
586
672
  entityWriter: IOIMEntityWriter;
587
- slotEmptiness: IOIMSlotEmptiness<TOIMEntitySlot<TEntity, TKey>>;
673
+ slotEmptinessPolicy: IOIMSlotEmptinessPolicy<TOIMEntityContentSlot<TEntity>>;
588
674
  };
589
675
 
590
- type TOIMEntitySlotOwnerService<TEntity extends object, TKey, TStore = unknown, TColumnName extends string = string> = OIMSlotOwnerService<TKey, TOIMEntitySlot<TEntity, TKey>, TStore, TColumnName, TOIMColumnSlot, OIMColumnOwnerPushDriven, Partial<TEntity>>;
676
+ type TOIMEntitySlotOwnerService<TEntity extends object, TEntitySlot extends TOIMEntityContentSlot<TEntity> = TOIMEntitySlot<TEntity>, TStore = unknown, TColumnName extends string = string> = OIMSlotOwnerService<TEntitySlot, TStore, TColumnName, TOIMColumnSlot, OIMPushColumnSlotOwner, Partial<TEntity>>;
591
677
 
592
678
  declare class OIMUnusedSlotCollectorService {
593
679
  static readonly INSTANCE: OIMUnusedSlotCollectorService;
@@ -608,9 +694,9 @@ type TOIMCollectorSlotOptions = {
608
694
 
609
695
  declare function createOIMCollectorSlot(options: TOIMCollectorSlotOptions): TOIMCollectorSlot;
610
696
 
611
- declare abstract class OIMSlotColumnService<TSlot extends TOIMSlot, TColumnName extends string, TColumnSlot extends TOIMKeyedSlot<string>, TColumnOwner extends OIMColumnOwner<TOIMSlot, TColumnSlot>> {
612
- protected readonly columnOwner: TColumnOwner;
613
- protected constructor(columnOwner: TColumnOwner);
697
+ declare class OIMColumnSlotService<TSlot extends TOIMSlot, TColumnName extends string, TColumnSlot extends TOIMKeyedSlot<string>, TColumnSlotOwner extends OIMColumnSlotOwner<TOIMSlot, TColumnSlot>> {
698
+ private readonly columnSlotOwner;
699
+ constructor(columnSlotOwner: TColumnSlotOwner);
614
700
  getColumn(slot: TSlot, columnName: TColumnName): TColumnSlot;
615
701
  holdColumn(slot: TSlot, columnName: TColumnName): TColumnSlot;
616
702
  getAnyColumn(slot: TSlot): TColumnSlot;
@@ -620,21 +706,23 @@ declare abstract class OIMSlotColumnService<TSlot extends TOIMSlot, TColumnName
620
706
  unholdColumn(columnSlot: TColumnSlot): void;
621
707
  }
622
708
 
623
- type TOIMSlotCollectionServiceOptions<TKey, TSlot extends TOIMKeyedSlot<TKey>, TStore, TSlotContentService, TColumnName extends string = string, TColumnSlot extends TOIMKeyedSlot<string> = TOIMKeyedSlot<string>, TColumnOwner extends OIMColumnOwner<TOIMSlot, TColumnSlot> = OIMColumnOwner<TOIMSlot, TColumnSlot>, TPatch = unknown> = {
624
- slotOwnerService: OIMSlotOwnerService<TKey, TSlot, TStore, TColumnName, TColumnSlot, TColumnOwner, TPatch>;
709
+ type TOIMSlotCollectionServiceOptions<TKey extends NonNullable<unknown>, TSlot extends TOIMKeyedSlot<TKey>, TStore, TSlotContentService, TColumnName extends string = string, TColumnSlot extends TOIMKeyedSlot<string> = TOIMKeyedSlot<string>, TColumnSlotOwner extends OIMColumnSlotOwner<TOIMSlot, TColumnSlot> = OIMColumnSlotOwner<TOIMSlot, TColumnSlot>, TPatch = unknown> = Omit<TOIMSlotOwnerServiceOptions<TSlot, TStore, TColumnName, TColumnSlot, TColumnSlotOwner, TPatch>, 'slotFilingService' | 'slotContentService'> & {
625
710
  slotStoreService: IOIMSlotStoreService<TKey, TSlot, TStore>;
626
- slotContentService: TSlotContentService;
711
+ slotContentService: TSlotContentService & IOIMSlotContentService<TSlot> & IOIMKeyedSlotCreator<TKey, TSlot>;
627
712
  storeSlotListener?: IOIMStoreSlotListener | undefined;
628
713
  };
629
714
 
630
- declare class OIMSlotCollectionService<TKey, TSlot extends TOIMKeyedSlot<TKey>, TStore, TSlotContentService, TColumnName extends string = string, TColumnSlot extends TOIMKeyedSlot<string> = TOIMKeyedSlot<string>, TColumnOwner extends OIMColumnOwner<TOIMSlot, TColumnSlot> = OIMColumnOwner<TOIMSlot, TColumnSlot>, TPatch = unknown> extends OIMSlotColumnService<TSlot, TColumnName, TColumnSlot, TColumnOwner> {
715
+ declare class OIMSlotCollectionService<TKey extends NonNullable<unknown>, TSlot extends TOIMKeyedSlot<TKey>, TStore, TSlotContentService, TColumnName extends string = string, TColumnSlot extends TOIMKeyedSlot<string> = TOIMKeyedSlot<string>, TColumnSlotOwner extends OIMColumnSlotOwner<TOIMSlot, TColumnSlot> = OIMColumnSlotOwner<TOIMSlot, TColumnSlot>, TPatch = unknown> {
631
716
  readonly slotContentService: TSlotContentService;
632
- protected readonly slotOwnerService: OIMSlotOwnerService<TKey, TSlot, TStore, TColumnName, TColumnSlot, TColumnOwner, TPatch>;
633
- private readonly slotStoreService;
717
+ readonly columnSlotService: OIMColumnSlotService<TSlot, TColumnName, TColumnSlot, TColumnSlotOwner>;
718
+ protected readonly slotOwnerService: OIMSlotOwnerService<TSlot, TStore, TColumnName, TColumnSlot, TColumnSlotOwner, TPatch>;
719
+ protected readonly slotStoreService: IOIMSlotStoreService<TKey, TSlot, TStore>;
720
+ protected readonly keyedSlotCreator: IOIMKeyedSlotCreator<TKey, TSlot>;
634
721
  private readonly storeSlotListener;
635
- constructor(options: TOIMSlotCollectionServiceOptions<TKey, TSlot, TStore, TSlotContentService, TColumnName, TColumnSlot, TColumnOwner, TPatch>);
636
- createStoreSlot(channelMap: IOIMChannelMap): TOIMStoreSlot<TStore, TSlot, TPatch>;
637
- createStoreSlotFrom(sourceStoreSlot: TOIMStoreSlot): TOIMStoreSlot<TStore, TSlot, TPatch>;
722
+ constructor(options: TOIMSlotCollectionServiceOptions<TKey, TSlot, TStore, TSlotContentService, TColumnName, TColumnSlot, TColumnSlotOwner, TPatch>);
723
+ get slotOwner(): IOIMSlotOwner;
724
+ createStoreSlot(channelMap: IOIMChannelMap): TOIMStoreSlot<TStore, TSlot, TPatch, this>;
725
+ createStoreSlotFrom(sourceStoreSlot: TOIMStoreSlot): TOIMStoreSlot<TStore, TSlot, TPatch, this>;
638
726
  protected createStoreSlotWith<TStoreSlot extends TOIMStoreSlot<TStore, TSlot, TPatch>>(createStoreSlotLiteral: (store: TStore) => TStoreSlot): TStoreSlot;
639
727
  findSlotByKey(storeSlot: TOIMStoreSlot<TStore, TSlot, TPatch>, key: TKey): TSlot | undefined;
640
728
  hasSlotContentByKey(storeSlot: TOIMStoreSlot<TStore, TSlot, TPatch>, key: TKey): boolean;
@@ -643,36 +731,43 @@ declare class OIMSlotCollectionService<TKey, TSlot extends TOIMKeyedSlot<TKey>,
643
731
  getSlots(storeSlot: TOIMStoreSlot<TStore, TSlot, TPatch>): IterableIterator<TSlot>;
644
732
  getSlotCount(storeSlot: TOIMStoreSlot<TStore, TSlot, TPatch>): number;
645
733
  isSameKey(key: TKey, otherKey: TKey): boolean;
734
+ openBatch(storeSlot: TOIMStoreSlot<TStore, TSlot, TPatch>): void;
735
+ closeBatch(storeSlot: TOIMStoreSlot<TStore, TSlot, TPatch>): void;
736
+ writeInBatch<TResult>(storeSlot: TOIMStoreSlot<TStore, TSlot, TPatch>, write: () => TResult): TResult;
646
737
  protected onSlotMinted(_storeSlot: TOIMStoreSlot<TStore, TSlot, TPatch>, _slot: TSlot): void;
647
738
  private mintSlotByKey;
648
739
  }
649
740
 
650
- declare class OIMSlotStoreServiceSingleSlotDriven<TSlot extends TOIMKeyedSlot<void>> implements IOIMSlotStoreService<void, TSlot, TOIMSingleSlotStore<TSlot>> {
651
- static readonly INSTANCE: OIMSlotStoreServiceSingleSlotDriven<TOIMKeyedSlot<void>>;
741
+ declare class OIMWritableSlotCollectionService<TKey extends NonNullable<unknown>, TSlot extends TOIMKeyedSlot<TKey>, TStore, TContent, TSlotContentService extends IOIMSlotContentWriter<TSlot, TContent> & IOIMSlotContentService<TSlot> & IOIMKeyedSlotCreator<TKey, TSlot>, TColumnName extends string = string, TColumnSlot extends TOIMKeyedSlot<string> = TOIMKeyedSlot<string>, TColumnSlotOwner extends OIMColumnSlotOwner<TOIMSlot, TColumnSlot> = OIMColumnSlotOwner<TOIMSlot, TColumnSlot>, TPatch = unknown> extends OIMSlotCollectionService<TKey, TSlot, TStore, TSlotContentService, TColumnName, TColumnSlot, TColumnSlotOwner, TPatch> {
742
+ writeSlotContentByKey(storeSlot: TOIMStoreSlot<TStore, TSlot, TPatch>, key: TKey, content: TContent, changedSlots?: TSlot[]): TSlot;
743
+ }
744
+
745
+ declare class OIMSingleSlotStoreService<TSlot extends TOIMSlot> implements IOIMSlotFilingService<TSlot, TOIMSingleSlotStore<TSlot>> {
746
+ static readonly INSTANCE: OIMSingleSlotStoreService<TOIMSlot>;
652
747
  createStore(): TOIMSingleSlotStore<TSlot>;
653
- ownKey<TOwnedKey extends void>(key: TOwnedKey): TOwnedKey;
654
- isSameKey(): boolean;
655
- get(store: TOIMSingleSlotStore<TSlot>): TSlot | undefined;
656
- set(store: TOIMSingleSlotStore<TSlot>, _key: void, slot: TSlot): void;
657
- remove(store: TOIMSingleSlotStore<TSlot>): void;
748
+ getSingleSlot(store: TOIMSingleSlotStore<TSlot>): TSlot | undefined;
749
+ fileSlot(store: TOIMSingleSlotStore<TSlot>, slot: TSlot): void;
750
+ unfileSlot(store: TOIMSingleSlotStore<TSlot>): void;
658
751
  getSlots(store: TOIMSingleSlotStore<TSlot>): IterableIterator<TSlot>;
659
752
  getSlotCount(store: TOIMSingleSlotStore<TSlot>): number;
660
753
  }
661
754
 
662
- type TOIMSingleSlotServiceOptions<TSlot extends TOIMKeyedSlot<void>, TSlotContentService, TColumnName extends string = string, TColumnSlot extends TOIMKeyedSlot<string> = TOIMKeyedSlot<string>, TColumnOwner extends OIMColumnOwner<TOIMSlot, TColumnSlot> = OIMColumnOwner<TOIMSlot, TColumnSlot>, TPatch = unknown> = {
663
- slotOwnerService: OIMSlotOwnerService<void, TSlot, TOIMSingleSlotStore<TSlot>, TColumnName, TColumnSlot, TColumnOwner, TPatch>;
664
- slotStoreService: OIMSlotStoreServiceSingleSlotDriven<TSlot>;
665
- slotContentService: TSlotContentService;
755
+ type TOIMSingleSlotServiceOptions<TSlot extends TOIMSlot, TSlotContentService, TColumnName extends string = string, TColumnSlot extends TOIMKeyedSlot<string> = TOIMKeyedSlot<string>, TColumnSlotOwner extends OIMColumnSlotOwner<TOIMSlot, TColumnSlot> = OIMColumnSlotOwner<TOIMSlot, TColumnSlot>, TPatch = unknown> = Omit<TOIMSlotOwnerServiceOptions<TSlot, TOIMSingleSlotStore<TSlot>, TColumnName, TColumnSlot, TColumnSlotOwner, TPatch>, 'slotFilingService' | 'slotContentService'> & {
756
+ slotStoreService: OIMSingleSlotStoreService<TSlot>;
757
+ slotContentService: TSlotContentService & IOIMSlotContentService<TSlot> & IOIMSingleSlotCreator<TSlot>;
666
758
  storeSlotListener?: IOIMStoreSlotListener | undefined;
667
759
  };
668
760
 
669
- declare class OIMSingleSlotService<TSlot extends TOIMKeyedSlot<void>, TSlotContentService, TColumnName extends string = string, TColumnSlot extends TOIMKeyedSlot<string> = TOIMKeyedSlot<string>, TColumnOwner extends OIMColumnOwner<TOIMSlot, TColumnSlot> = OIMColumnOwner<TOIMSlot, TColumnSlot>, TPatch = unknown> extends OIMSlotColumnService<TSlot, TColumnName, TColumnSlot, TColumnOwner> {
761
+ declare class OIMSingleSlotService<TSlot extends TOIMSlot, TSlotContentService, TColumnName extends string = string, TColumnSlot extends TOIMKeyedSlot<string> = TOIMKeyedSlot<string>, TColumnSlotOwner extends OIMColumnSlotOwner<TOIMSlot, TColumnSlot> = OIMColumnSlotOwner<TOIMSlot, TColumnSlot>, TPatch = unknown> {
670
762
  readonly slotContentService: TSlotContentService;
671
- protected readonly slotOwnerService: OIMSlotOwnerService<void, TSlot, TOIMSingleSlotStore<TSlot>, TColumnName, TColumnSlot, TColumnOwner, TPatch>;
672
- private readonly slotStoreService;
763
+ readonly columnSlotService: OIMColumnSlotService<TSlot, TColumnName, TColumnSlot, TColumnSlotOwner>;
764
+ protected readonly slotOwnerService: OIMSlotOwnerService<TSlot, TOIMSingleSlotStore<TSlot>, TColumnName, TColumnSlot, TColumnSlotOwner, TPatch>;
765
+ protected readonly slotStoreService: OIMSingleSlotStoreService<TSlot>;
766
+ protected readonly singleSlotCreator: IOIMSingleSlotCreator<TSlot>;
673
767
  private readonly storeSlotListener;
674
- constructor(options: TOIMSingleSlotServiceOptions<TSlot, TSlotContentService, TColumnName, TColumnSlot, TColumnOwner, TPatch>);
675
- createStoreSlot(channelMap: IOIMChannelMap): TOIMStoreSlot<TOIMSingleSlotStore<TSlot>, TSlot, TPatch>;
768
+ constructor(options: TOIMSingleSlotServiceOptions<TSlot, TSlotContentService, TColumnName, TColumnSlot, TColumnSlotOwner, TPatch>);
769
+ get slotOwner(): IOIMSlotOwner;
770
+ createStoreSlot(channelMap: IOIMChannelMap): TOIMStoreSlot<TOIMSingleSlotStore<TSlot>, TSlot, TPatch, this>;
676
771
  findSingleSlot(storeSlot: TOIMStoreSlot<TOIMSingleSlotStore<TSlot>, TSlot, TPatch>): TSlot | undefined;
677
772
  hasSingleSlotContent(storeSlot: TOIMStoreSlot<TOIMSingleSlotStore<TSlot>, TSlot, TPatch>): boolean;
678
773
  getSingleSlot(storeSlot: TOIMStoreSlot<TOIMSingleSlotStore<TSlot>, TSlot, TPatch>): TSlot;
@@ -680,65 +775,45 @@ declare class OIMSingleSlotService<TSlot extends TOIMKeyedSlot<void>, TSlotConte
680
775
  private mintSingleSlot;
681
776
  }
682
777
 
683
- declare class OIMSlotContentEntityService<TEntity extends object, TKey, TStore = unknown, TColumnName extends string = string> {
684
- readonly keyOf: (entity: TEntity) => TKey;
685
- readonly slotStoreService: IOIMSlotStoreService<TKey, TOIMEntitySlot<TEntity, TKey>, TStore>;
686
- private readonly slotOwnerService;
778
+ declare class OIMWritableSingleSlotService<TSlot extends TOIMSlot, TContent, TSlotContentService extends IOIMSlotContentWriter<TSlot, TContent> & IOIMSlotContentService<TSlot> & IOIMSingleSlotCreator<TSlot>, TColumnName extends string = string, TColumnSlot extends TOIMKeyedSlot<string> = TOIMKeyedSlot<string>, TColumnSlotOwner extends OIMColumnSlotOwner<TOIMSlot, TColumnSlot> = OIMColumnSlotOwner<TOIMSlot, TColumnSlot>, TPatch = unknown> extends OIMSingleSlotService<TSlot, TSlotContentService, TColumnName, TColumnSlot, TColumnSlotOwner, TPatch> {
779
+ writeSingleSlotContent(storeSlot: TOIMStoreSlot<TOIMSingleSlotStore<TSlot>, TSlot, TPatch>, content: TContent, changedSlots?: TSlot[]): TSlot;
780
+ clearSingleSlotContent(storeSlot: TOIMStoreSlot<TOIMSingleSlotStore<TSlot>, TSlot, TPatch>): void;
781
+ }
782
+
783
+ declare class OIMSlotContentEntityService<TEntity extends object, TKey extends NonNullable<unknown> = TOIMStoreKey, TColumnName extends string = string> implements IOIMSlotContentWriter<TOIMEntityContentSlot<TEntity>, TEntity>, IOIMSlotContentService<TOIMEntityContentSlot<TEntity>>, IOIMKeyedSlotCreator<TKey, TOIMEntitySlot<TEntity, TKey>>, IOIMSingleSlotCreator<TOIMEntityContentSlot<TEntity>> {
687
784
  private readonly entityWriter;
688
- private readonly slotEmptiness;
689
- private readonly updatesEmptinessOnColumnWrite;
690
- constructor(options: TOIMSlotContentEntityServiceOptions<TEntity, TKey, TStore, TColumnName>);
691
- get slotOwner(): IOIMSlotOwner;
692
- findEntityByKey(storeSlot: TOIMStoreSlot<TStore, TOIMEntitySlot<TEntity, TKey>>, key: TKey): TEntity | undefined;
693
- upsertEntity(storeSlot: TOIMStoreSlot<TStore, TOIMEntitySlot<TEntity, TKey>>, entity: TEntity, changedEntitySlots?: TOIMEntitySlot<TEntity, TKey>[]): TOIMEntitySlot<TEntity, TKey>;
694
- upsertEntities(storeSlot: TOIMStoreSlot<TStore, TOIMEntitySlot<TEntity, TKey>>, entities: readonly TEntity[], changedEntitySlots?: TOIMEntitySlot<TEntity, TKey>[]): TOIMEntitySlot<TEntity, TKey>[];
695
- insertEntity(storeSlot: TOIMStoreSlot<TStore, TOIMEntitySlot<TEntity, TKey>>, key: TKey, entity: TEntity, changedEntitySlots?: TOIMEntitySlot<TEntity, TKey>[]): TOIMEntitySlot<TEntity, TKey>;
696
- insertEntities(storeSlot: TOIMStoreSlot<TStore, TOIMEntitySlot<TEntity, TKey>>, entities: readonly TEntity[]): void;
697
- fillEntities(storeSlot: TOIMStoreSlot<TStore, TOIMEntitySlot<TEntity, TKey>>, keys: readonly TKey[], entities: readonly TEntity[]): void;
698
- private fillEntitiesUnderKeys;
699
- clearAllEntities(storeSlot: TOIMStoreSlot<TStore, TOIMEntitySlot<TEntity, TKey>>): void;
700
- private fillEachEntity;
701
- private refileRepeatedKey;
785
+ private readonly slotEmptinessPolicy;
786
+ private readonly isSlotEmptinessCustom;
787
+ constructor(options: TOIMSlotContentEntityServiceOptions<TEntity>);
788
+ createSlot(key: TKey, storeSlot: TOIMStoreSlot, slotOwner: IOIMSlotOwner): TOIMEntitySlot<TEntity, TKey>;
789
+ createSingleSlot(storeSlot: TOIMStoreSlot, slotOwner: IOIMSlotOwner): TOIMEntityContentSlot<TEntity>;
790
+ isSlotEmpty(entitySlot: TOIMEntityContentSlot<TEntity>): boolean;
791
+ hasReference(): boolean;
792
+ private updatesEmptinessOnColumnWriteOf;
793
+ private slotOwnerServiceOf;
794
+ insertSlotContent(entitySlot: TOIMEntityContentSlot<TEntity>, entity: TEntity, changedEntitySlots?: TOIMEntityContentSlot<TEntity>[]): void;
702
795
  private insertEntityOnFastPath;
703
- private insertEntityInSubframe;
704
- writeEntity(entitySlot: TOIMEntitySlot<TEntity, TKey>, entity: TEntity): boolean;
705
- updateEntity(entitySlot: TOIMEntitySlot<TEntity, TKey>, patch: Partial<TEntity>): TOIMEntitySlot<TEntity, TKey>;
706
- updateEntityColumn<TColumn extends keyof TEntity & string>(entitySlot: TOIMEntitySlot<TEntity, TKey>, columnName: TColumn, value: TEntity[TColumn]): TOIMEntitySlot<TEntity, TKey>;
707
- deleteEntityColumns(entitySlot: TOIMEntitySlot<TEntity, TKey>, columnNames: readonly TOIMEntityColumnName<TEntity>[]): TOIMEntitySlot<TEntity, TKey>;
708
- markEntityChanged(entitySlot: TOIMEntitySlot<TEntity, TKey>, changedColumns?: readonly (keyof TEntity & string)[]): void;
709
- deleteEntity(entitySlot: TOIMEntitySlot<TEntity, TKey>): void;
710
- deleteEntities(storeSlot: TOIMStoreSlot<TStore, TOIMEntitySlot<TEntity, TKey>>, entitySlots: readonly TOIMEntitySlot<TEntity, TKey>[]): void;
711
- private updateEntityInSubframe;
796
+ private insertEntityOffFastPath;
797
+ writeSlotContent(entitySlot: TOIMEntityContentSlot<TEntity>, entity: TEntity): boolean;
798
+ updateEntity<TEntitySlot extends TOIMEntityContentSlot<TEntity>>(entitySlot: TEntitySlot, patch: Partial<TEntity>): TEntitySlot;
799
+ updateEntityColumn<TColumn extends keyof TEntity & string, TEntitySlot extends TOIMEntityContentSlot<TEntity>>(entitySlot: TEntitySlot, columnName: TColumn, value: TEntity[TColumn]): TEntitySlot;
800
+ deleteEntityColumns<TEntitySlot extends TOIMEntityContentSlot<TEntity>>(entitySlot: TEntitySlot, columnNames: readonly TOIMEntityColumnName<TEntity>[]): TEntitySlot;
801
+ markEntityChanged(entitySlot: TOIMEntityContentSlot<TEntity>, changedColumns?: readonly (keyof TEntity & string)[]): void;
802
+ clearSlotContent(entitySlot: TOIMEntityContentSlot<TEntity>): void;
803
+ private updateEntityOffFastPath;
712
804
  private updateEntityColumnOffFastPath;
713
- private updateEntityColumnInSubframe;
805
+ private updateEntityColumnAndDispatch;
714
806
  private dispatchPatchWritten;
715
807
  private writeSlotToChannelAndReleaseIfUnheld;
716
808
  private dispatchContentChangeAndReleaseIfUnheld;
717
- private releaseSlotContent;
718
- private fillSlotContent;
719
- private withdrawSlotContent;
720
- private clearSlotContent;
809
+ releaseSlotContent(entitySlot: TOIMEntityContentSlot<TEntity>): void;
721
810
  private isOnFastPath;
722
811
  private hasChangedColumnReaders;
723
812
  private updateEntitySlotEmptiness;
724
- private writeEntityWithoutSubframe;
813
+ private writeEntityToSlot;
725
814
  private dispatchColumnsChanged;
726
815
  }
727
816
 
728
- declare function createOIMSlotCollectionService<TKey, TSlot extends TOIMKeyedSlot<TKey>, TStore, TSlotContentService extends object, TColumnName extends string = string, TPatch = unknown>(options: {
729
- slotContentService: TSlotContentService & {
730
- readonly slotOwner: IOIMSlotOwner;
731
- readonly slotStoreService: IOIMSlotStoreService<TKey, TSlot, TStore>;
732
- };
733
- }): OIMSlotCollectionService<TKey, TSlot, TStore, TSlotContentService, TColumnName, TOIMColumnSlot, OIMColumnOwnerPushDriven, TPatch>;
734
-
735
- declare function createOIMSingleSlotService<TSlot extends TOIMKeyedSlot<void>, TSlotContentService extends {
736
- readonly slotOwner: IOIMSlotOwner;
737
- readonly slotStoreService: IOIMSlotStoreService<void, TSlot, TOIMSingleSlotStore<TSlot>>;
738
- }, TColumnName extends string = string, TPatch = unknown>(options: {
739
- slotContentService: TSlotContentService;
740
- }): OIMSingleSlotService<TSlot, TSlotContentService, TColumnName, TOIMColumnSlot, OIMColumnOwnerPushDriven, TPatch>;
741
-
742
817
  interface IOIMIndexKeysService {
743
818
  createPositions(): TOIMIndexKeysPositions;
744
819
  allocatePosition(positions: TOIMIndexKeysPositions): number;
@@ -771,202 +846,217 @@ declare class OIMDB implements IOIMChannelMap {
771
846
  flush(): void;
772
847
  }
773
848
 
774
- type TOIMSlotContentEntityServiceFactoryOptions<TEntity extends object, TKey, TColumnName extends string> = {
775
- entityWriter?: IOIMEntityWriter | undefined;
776
- slotEmptiness?: IOIMSlotEmptiness<TOIMEntitySlot<TEntity, TKey>> | undefined;
849
+ type TOIMSlotContentServiceKey<TSlotContentService> = TSlotContentService extends {
850
+ createSlot(key: infer TKey, ...rest: never[]): unknown;
851
+ } ? Extract<TKey, NonNullable<unknown>> : never;
852
+
853
+ type TOIMSlotContentServiceSlot<TSlotContentService> = TSlotContentService extends {
854
+ createSlot(...args: never[]): infer TSlot;
855
+ } ? Extract<TSlot, TOIMKeyedSlot<TOIMSlotContentServiceKey<TSlotContentService>>> : never;
856
+
857
+ type TOIMSlotContentServiceContent<TSlotContentService> = TSlotContentService extends {
858
+ writeSlotContent(slot: never, content: infer TContent): boolean;
859
+ } ? TContent : never;
860
+
861
+ type TOIMSlotContentServicePatch<TSlotContentService> = TOIMSlotContentServiceContent<TSlotContentService> extends readonly unknown[] ? TOIMSlotContentServiceContent<TSlotContentService> : Partial<TOIMSlotContentServiceContent<TSlotContentService>>;
862
+
863
+ declare function createOIMSlotCollectionService<TSlotContentService extends object, TStore = Map<TOIMSlotContentServiceKey<TSlotContentService>, TOIMSlotContentServiceSlot<TSlotContentService>>, TColumnName extends string = string>(db: OIMDB, options: {
864
+ slotContentService: TSlotContentService & IOIMKeyedSlotCreator<TOIMSlotContentServiceKey<TSlotContentService>, TOIMSlotContentServiceSlot<TSlotContentService>> & IOIMSlotContentWriter<TOIMSlotContentServiceSlot<TSlotContentService>, TOIMSlotContentServiceContent<TSlotContentService>> & IOIMSlotContentService<TOIMSlotContentServiceSlot<TSlotContentService>>;
777
865
  slotReleasePolicy?: IOIMSlotReleasePolicy | undefined;
866
+ slotSubscriptionListener?: IOIMSlotSubscriptionListener | undefined;
778
867
  columnSlotStoreService?: IOIMSlotStoreService<string, TOIMColumnSlot> | undefined;
779
868
  columnNames?: readonly TColumnName[] | undefined;
780
- };
869
+ } & (TOIMSlotContentServiceKey<TSlotContentService> extends readonly unknown[] ? {
870
+ slotStoreService: IOIMSlotStoreService<TOIMSlotContentServiceKey<TSlotContentService>, TOIMSlotContentServiceSlot<TSlotContentService>, TStore>;
871
+ } : {
872
+ slotStoreService?: IOIMSlotStoreService<TOIMSlotContentServiceKey<TSlotContentService>, TOIMSlotContentServiceSlot<TSlotContentService>, TStore> | undefined;
873
+ })): OIMWritableSlotCollectionService<TOIMSlotContentServiceKey<TSlotContentService>, TOIMSlotContentServiceSlot<TSlotContentService>, TStore, TOIMSlotContentServiceContent<TSlotContentService>, TSlotContentService & IOIMKeyedSlotCreator<TOIMSlotContentServiceKey<TSlotContentService>, TOIMSlotContentServiceSlot<TSlotContentService>> & IOIMSlotContentWriter<TOIMSlotContentServiceSlot<TSlotContentService>, TOIMSlotContentServiceContent<TSlotContentService>> & IOIMSlotContentService<TOIMSlotContentServiceSlot<TSlotContentService>>, TColumnName, TOIMColumnSlot, OIMPushColumnSlotOwner, TOIMSlotContentServicePatch<TSlotContentService>>;
781
874
 
782
- declare function createOIMSlotContentEntityService<TEntity extends object, TColumnName extends TOIMEntityColumnName<TEntity> = TOIMEntityColumnName<TEntity>>(db: OIMDB, options: TOIMSlotContentEntityServiceFactoryOptions<TEntity, void, TColumnName> & {
783
- keyOf?: undefined;
784
- slotStoreService: OIMSlotStoreServiceSingleSlotDriven<TOIMEntitySlot<TEntity, void>>;
785
- }): OIMSlotContentEntityService<TEntity, void, TOIMSingleSlotStore<TOIMEntitySlot<TEntity, void>>, TColumnName>;
786
- declare function createOIMSlotContentEntityService<TEntity extends object, TColumnName extends TOIMEntityColumnName<TEntity> = TOIMEntityColumnName<TEntity>, TKey extends TOIMStoreKey = TOIMStoreKey>(db: OIMDB, options: TOIMSlotContentEntityServiceFactoryOptions<TEntity, TKey, TColumnName> & {
787
- keyOf: (entity: TEntity) => TKey;
788
- slotStoreService?: undefined;
789
- }): OIMSlotContentEntityService<TEntity, TKey, Map<TKey, TOIMEntitySlot<TEntity, TKey>>, TColumnName>;
790
- declare function createOIMSlotContentEntityService<TEntity extends object, TColumnName extends TOIMEntityColumnName<TEntity> = TOIMEntityColumnName<TEntity>, TKey extends TOIMStoreKey | readonly unknown[] = TOIMStoreKey, TStore = Map<TKey, TOIMEntitySlot<TEntity, TKey>>>(db: OIMDB, options: TOIMSlotContentEntityServiceFactoryOptions<TEntity, TKey, TColumnName> & {
791
- keyOf: (entity: TEntity) => TKey;
792
- slotStoreService: IOIMSlotStoreService<TKey, TOIMEntitySlot<TEntity, TKey>, TStore>;
793
- }): OIMSlotContentEntityService<TEntity, TKey, TStore, TColumnName>;
875
+ type TOIMSlotContentServiceSingleSlot<TSlotContentService> = TSlotContentService extends {
876
+ createSingleSlot(...args: never[]): infer TSlot;
877
+ } ? Extract<TSlot, TOIMSlot> : never;
794
878
 
795
- declare function createOIMEntityService<TEntity extends object, TColumnName extends TOIMEntityColumnName<TEntity> = TOIMEntityColumnName<TEntity>, TKey extends TOIMStoreKey = TOIMStoreKey>(db: OIMDB, options: TOIMSlotContentEntityServiceFactoryOptions<TEntity, TKey, TColumnName> & {
796
- keyOf: (entity: TEntity) => TKey;
797
- entitySlotStoreService?: undefined;
798
- }): OIMSlotCollectionService<TKey, TOIMEntitySlot<TEntity, TKey>, Map<TKey, TOIMEntitySlot<TEntity, TKey>>, OIMSlotContentEntityService<TEntity, TKey, Map<TKey, TOIMEntitySlot<TEntity, TKey>>, TColumnName>, TColumnName, TOIMColumnSlot, OIMColumnOwnerPushDriven, Partial<TEntity>>;
799
- declare function createOIMEntityService<TEntity extends object, TColumnName extends TOIMEntityColumnName<TEntity> = TOIMEntityColumnName<TEntity>, TKey extends TOIMStoreKey | readonly unknown[] = TOIMStoreKey, TStore = Map<TKey, TOIMEntitySlot<TEntity, TKey>>>(db: OIMDB, options: TOIMSlotContentEntityServiceFactoryOptions<TEntity, TKey, TColumnName> & {
800
- keyOf: (entity: TEntity) => TKey;
801
- entitySlotStoreService: IOIMSlotStoreService<TKey, TOIMEntitySlot<TEntity, TKey>, TStore>;
802
- }): OIMSlotCollectionService<TKey, TOIMEntitySlot<TEntity, TKey>, TStore, OIMSlotContentEntityService<TEntity, TKey, TStore, TColumnName>, TColumnName, TOIMColumnSlot, OIMColumnOwnerPushDriven, Partial<TEntity>>;
879
+ declare function createOIMSingleSlotService<TSlotContentService extends object, TColumnName extends string = string>(db: OIMDB, options: {
880
+ slotContentService: TSlotContentService & IOIMSingleSlotCreator<TOIMSlotContentServiceSingleSlot<TSlotContentService>> & IOIMSlotContentWriter<TOIMSlotContentServiceSingleSlot<TSlotContentService>, TOIMSlotContentServiceContent<TSlotContentService>> & IOIMSlotContentService<TOIMSlotContentServiceSingleSlot<TSlotContentService>>;
881
+ slotReleasePolicy?: IOIMSlotReleasePolicy | undefined;
882
+ slotSubscriptionListener?: IOIMSlotSubscriptionListener | undefined;
883
+ columnSlotStoreService?: IOIMSlotStoreService<string, TOIMColumnSlot> | undefined;
884
+ columnNames?: readonly TColumnName[] | undefined;
885
+ }): OIMWritableSingleSlotService<TOIMSlotContentServiceSingleSlot<TSlotContentService>, TOIMSlotContentServiceContent<TSlotContentService>, TSlotContentService & IOIMSingleSlotCreator<TOIMSlotContentServiceSingleSlot<TSlotContentService>> & IOIMSlotContentWriter<TOIMSlotContentServiceSingleSlot<TSlotContentService>, TOIMSlotContentServiceContent<TSlotContentService>> & IOIMSlotContentService<TOIMSlotContentServiceSingleSlot<TSlotContentService>>, TColumnName, TOIMColumnSlot, OIMPushColumnSlotOwner>;
803
886
 
804
- declare function createOIMSingleEntityService<TEntity extends object, TColumnName extends TOIMEntityColumnName<TEntity> = TOIMEntityColumnName<TEntity>>(db: OIMDB, options?: TOIMSlotContentEntityServiceFactoryOptions<TEntity, void, TColumnName>): OIMSingleSlotService<TOIMEntitySlot<TEntity, void>, OIMSlotContentEntityService<TEntity, void, TOIMSingleSlotStore<TOIMEntitySlot<TEntity, void>>, TColumnName>, TColumnName, TOIMColumnSlot, OIMColumnOwnerPushDriven, Partial<TEntity>>;
887
+ declare function createOIMSlotContentEntityService<TEntity extends object, TKey extends NonNullable<unknown> = TOIMStoreKey, TColumnName extends TOIMEntityColumnName<TEntity> = TOIMEntityColumnName<TEntity>>(db: OIMDB, options?: {
888
+ entityWriter?: IOIMEntityWriter | undefined;
889
+ slotEmptinessPolicy?: IOIMSlotEmptinessPolicy<TOIMEntityContentSlot<TEntity>> | undefined;
890
+ }): OIMSlotContentEntityService<TEntity, TKey, TColumnName>;
805
891
 
806
892
  interface IOIMBucketCommands {
807
- recordInsert(bucketSlot: TOIMBucketSlot<unknown>, index: number, bucketMemberSlot: TOIMSlot, bucketMemberSlotCount: number): void;
808
- recordRemove(bucketSlot: TOIMBucketSlot<unknown>, index: number, count: number, bucketMemberSlotCount: number): void;
809
- recordMove(bucketSlot: TOIMBucketSlot<unknown>, from: number, to: number, bucketMemberSlotCount: number): void;
810
- recordWholeList(bucketSlot: TOIMBucketSlot<unknown>): void;
893
+ recordInsert(bucketSlot: TOIMBucketContentSlot<unknown>, index: number, bucketMemberSlot: TOIMSlot, bucketMemberSlotCount: number): void;
894
+ recordRemove(bucketSlot: TOIMBucketContentSlot<unknown>, index: number, count: number, bucketMemberSlotCount: number): void;
895
+ recordMove(bucketSlot: TOIMBucketContentSlot<unknown>, from: number, to: number, bucketMemberSlotCount: number): void;
896
+ recordWholeList(bucketSlot: TOIMBucketContentSlot<unknown>): void;
811
897
  }
812
898
 
813
- type TOIMBucketSlotOwnerService<TSlots, TBucketMemberSlot extends TOIMSlot = TOIMSlot, TKey = unknown, TStore = unknown> = OIMSlotOwnerService<TKey, TOIMBucketSlot<TSlots, TKey>, TStore, string, TOIMColumnSlot, OIMColumnOwnerPushDriven, readonly TBucketMemberSlot[]>;
899
+ type TOIMBucketSlotOwnerService<TSlots, TBucketMemberSlot extends TOIMSlot = TOIMSlot, TBucketSlot extends TOIMBucketContentSlot<TSlots> = TOIMBucketContentSlot<TSlots>, TStore = unknown> = OIMSlotOwnerService<TBucketSlot, TStore, string, TOIMColumnSlot, OIMPushColumnSlotOwner, readonly TBucketMemberSlot[]>;
814
900
 
815
901
  type TOIMSlotContentBucketServiceOptions = {
816
902
  bucketCommands?: IOIMBucketCommands | undefined;
817
903
  };
818
904
 
819
- declare abstract class OIMSlotContentBucketService<TBucketMemberSlot extends TOIMSlot, TSlots> {
905
+ declare abstract class OIMSlotContentBucketService<TBucketMemberSlot extends TOIMSlot, TSlots, TKey extends NonNullable<unknown> = TOIMStoreKey> implements IOIMSlotContentService<TOIMBucketContentSlot<TSlots>, TOIMBucketSlotOwnerService<TSlots>>, IOIMKeyedSlotCreator<TKey, TOIMBucketSlot<TSlots, TKey>>, IOIMSingleSlotCreator<TOIMBucketContentSlot<TSlots>>, IOIMSlotContentWriter<TOIMBucketContentSlot<TSlots>, readonly TBucketMemberSlot[]> {
820
906
  protected readonly bucketCommands: IOIMBucketCommands;
821
- private readonly slotContentStrategy;
822
907
  protected constructor(options: TOIMSlotContentBucketServiceOptions);
823
- createSlotOwnerService<TKey, TStore>(slotOwnerServiceOptions: Omit<TOIMSlotOwnerServiceOptions<TKey, TOIMBucketSlot<TSlots, TKey>, TStore, string, TOIMColumnSlot, OIMColumnOwnerPushDriven, readonly TBucketMemberSlot[]>, 'slotContentStrategy' | 'slotContentFlushStrategy'>): TOIMBucketSlotOwnerService<TSlots, TBucketMemberSlot, TKey, TStore>;
824
908
  protected abstract createBucketMemberSlotsStore(): TSlots;
825
- protected abstract addSlot(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): boolean;
826
- protected abstract removeSlot(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): number;
827
- protected abstract removeSlots(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[], removedChannelQueue: OIMChannelQueue<TOIMSlot>, removedAtChannelQueue: OIMChannelQueue<number>): void;
828
- protected abstract reconcileSlots(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[], arrivedChannelQueue: OIMChannelQueue<TOIMSlot>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
829
- protected abstract drainSlots(bucketSlot: TOIMBucketSlot<TSlots>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
830
- abstract hasBucketMemberSlot(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): boolean;
831
- abstract getBucketMemberSlotCount(bucketSlot: TOIMBucketSlot<TSlots>): number;
832
- abstract getBucketMemberSlots(bucketSlot: TOIMBucketSlot<TSlots>): Iterable<TBucketMemberSlot>;
833
- protected createSlot<TKey>(key: TKey, storeSlot: TOIMStoreSlot | undefined, slotOwnerService: TOIMBucketSlotOwnerService<TSlots>): TOIMBucketSlot<TSlots, TKey>;
834
- isSlotEmpty(bucketSlot: TOIMBucketSlot<TSlots>): boolean;
835
- protected hasReference(bucketSlot: TOIMBucketSlot<TSlots>): boolean;
836
- protected releaseSlotContent(bucketSlot: TOIMBucketSlot<TSlots>, slotOwnerService: TOIMBucketSlotOwnerService<TSlots>): void;
837
- protected onSubframeClosed(storeSlot: TOIMStoreSlot<unknown, TOIMBucketSlot<TSlots>>, slotOwnerService: TOIMBucketSlotOwnerService<TSlots>): void;
838
- markContentChanged(bucketSlot: TOIMBucketSlot<TSlots>): void;
839
- markBucketColumnsChanged(bucketSlot: TOIMBucketSlot<TSlots>, patch: object | undefined, changedColumns: readonly string[] | undefined): void;
840
- addBucketMemberSlot(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): void;
841
- removeBucketMemberSlot(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): void;
842
- addBucketMemberSlots(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[]): void;
843
- removeBucketMemberSlots(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[]): void;
844
- writeBucketMemberSlots(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[]): boolean;
845
- clearBucketMemberSlots(bucketSlot: TOIMBucketSlot<TSlots>): void;
846
- fillBucketMemberSlots(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[]): void;
847
- protected markBucketSlotChanged(bucketSlot: TOIMBucketSlot<TSlots>): void;
848
- protected letGoOfRemovedBucketMemberSlot(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlot: TOIMSlot, at: number): void;
909
+ protected abstract addSlot(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): boolean;
910
+ protected abstract removeSlot(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): number;
911
+ protected abstract removeSlots(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[], removedChannelQueue: OIMChannelQueue<TOIMSlot>, removedAtChannelQueue: OIMChannelQueue<number>): void;
912
+ protected abstract reconcileSlots(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[], arrivedChannelQueue: OIMChannelQueue<TOIMSlot>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
913
+ protected abstract drainSlots(bucketSlot: TOIMBucketContentSlot<TSlots>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
914
+ abstract hasBucketMemberSlot(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): boolean;
915
+ abstract getBucketMemberSlotCount(bucketSlot: TOIMBucketContentSlot<TSlots>): number;
916
+ abstract getBucketMemberSlots(bucketSlot: TOIMBucketContentSlot<TSlots>): Iterable<TBucketMemberSlot>;
917
+ getBucketMemberSlotsMissingFrom(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[]): TBucketMemberSlot[];
918
+ createSlot(key: TKey, storeSlot: TOIMStoreSlot, slotOwner: IOIMSlotOwner): TOIMBucketSlot<TSlots, TKey>;
919
+ createSingleSlot(storeSlot: TOIMStoreSlot, slotOwner: IOIMSlotOwner): TOIMBucketContentSlot<TSlots>;
920
+ isSlotEmpty(bucketSlot: TOIMBucketContentSlot<TSlots>): boolean;
921
+ hasReference(): boolean;
922
+ releaseSlotContent(bucketSlot: TOIMBucketContentSlot<TSlots>, slotOwnerService: TOIMBucketSlotOwnerService<TSlots>): void;
923
+ markContentChanged(bucketSlot: TOIMBucketContentSlot<TSlots>): void;
924
+ markBucketColumnsChanged(bucketSlot: TOIMBucketContentSlot<TSlots>, patch: object | undefined, changedColumns: readonly string[] | undefined): void;
925
+ addBucketMemberSlot(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): void;
926
+ removeBucketMemberSlot(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): void;
927
+ addBucketMemberSlots(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[]): void;
928
+ removeBucketMemberSlots(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[]): void;
929
+ insertSlotContent(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[], changedBucketSlots?: TOIMBucketContentSlot<TSlots>[]): void;
930
+ writeSlotContent(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[]): boolean;
931
+ clearSlotContent(bucketSlot: TOIMBucketContentSlot<TSlots>): void;
932
+ fillBucketMemberSlots(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[]): void;
933
+ protected markBucketSlotChanged(bucketSlot: TOIMBucketContentSlot<TSlots>): void;
934
+ protected letGoOfRemovedBucketMemberSlot(bucketSlot: TOIMBucketContentSlot<TSlots>, bucketMemberSlot: TOIMSlot, at: number): void;
849
935
  protected assertBucketMemberSlotNotReleased(bucketMemberSlot: TOIMSlot): void;
850
936
  private assertBucketMemberSlotsNotReleased;
851
- private addBucketMemberSlotWithoutSubframe;
937
+ private addBucketMemberSlotUnannounced;
852
938
  private reconcileBucketMemberSlots;
853
939
  private drainBucketMemberSlots;
854
940
  private unholdAllBucketMemberSlots;
855
- private writeChangedBucketSlot;
856
- private flushChangedBucketSlot;
857
941
  }
858
942
 
859
943
  type TOIMBucketSlotsSetStore<TBucketMemberSlot extends TOIMSlot = TOIMSlot> = Set<TBucketMemberSlot>;
860
944
 
861
- declare class OIMSlotContentBucketServiceSetDriven<TBucketMemberSlot extends TOIMSlot = TOIMSlot> extends OIMSlotContentBucketService<TBucketMemberSlot, TOIMBucketSlotsSetStore<TBucketMemberSlot>> {
945
+ declare class OIMSlotContentSetBucketService<TBucketMemberSlot extends TOIMSlot = TOIMSlot, TKey extends NonNullable<unknown> = TOIMStoreKey> extends OIMSlotContentBucketService<TBucketMemberSlot, TOIMBucketSlotsSetStore<TBucketMemberSlot>, TKey> {
862
946
  constructor(options?: TOIMSlotContentBucketServiceOptions);
863
947
  protected createBucketMemberSlotsStore(): TOIMBucketSlotsSetStore<TBucketMemberSlot>;
864
- protected addSlot(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): boolean;
865
- protected removeSlot(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): number;
866
- protected removeSlots(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>, bucketMemberSlots: readonly TBucketMemberSlot[], removedChannelQueue: OIMChannelQueue<TOIMSlot>, removedAtChannelQueue: OIMChannelQueue<number>): void;
867
- protected reconcileSlots(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>, bucketMemberSlots: readonly TBucketMemberSlot[], arrivedChannelQueue: OIMChannelQueue<TOIMSlot>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
868
- protected drainSlots(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
869
- hasBucketMemberSlot(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): boolean;
870
- getBucketMemberSlotCount(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>): number;
871
- getBucketMemberSlots(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>): Iterable<TBucketMemberSlot>;
948
+ protected addSlot(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): boolean;
949
+ protected removeSlot(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): number;
950
+ protected removeSlots(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>, bucketMemberSlots: readonly TBucketMemberSlot[], removedChannelQueue: OIMChannelQueue<TOIMSlot>, removedAtChannelQueue: OIMChannelQueue<number>): void;
951
+ protected reconcileSlots(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>, bucketMemberSlots: readonly TBucketMemberSlot[], arrivedChannelQueue: OIMChannelQueue<TOIMSlot>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
952
+ protected drainSlots(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
953
+ hasBucketMemberSlot(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): boolean;
954
+ getBucketMemberSlotCount(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>): number;
955
+ getBucketMemberSlots(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsSetStore<TBucketMemberSlot>>): Iterable<TBucketMemberSlot>;
872
956
  }
873
957
 
874
958
  type TOIMBucketSlotsArrayStore<TBucketMemberSlot extends TOIMSlot = TOIMSlot> = {
875
959
  bucketMemberSlots: TBucketMemberSlot[];
960
+ uniqueBucketMemberSlots: Set<TBucketMemberSlot> | undefined;
961
+ sortedCount: number;
876
962
  };
877
963
 
878
- interface IOIMBucketArrayMembership<TBucketMemberSlot extends TOIMSlot = TOIMSlot, TSlots extends TOIMBucketSlotsArrayStore<TBucketMemberSlot> = TOIMBucketSlotsArrayStore<TBucketMemberSlot>> {
879
- createStore(): TSlots;
880
- addSlot(bucketSlotsArrayStore: TSlots, bucketMemberSlot: TBucketMemberSlot): boolean;
881
- removeSlot(bucketSlotsArrayStore: TSlots, bucketMemberSlot: TBucketMemberSlot): boolean;
882
- hasSlot(bucketSlotsArrayStore: TSlots, bucketMemberSlot: TBucketMemberSlot): boolean;
883
- clearSlots(bucketSlotsArrayStore: TSlots): void;
884
- containsTheSameSequence(bucketSlotsArrayStore: TSlots, bucketMemberSlots: readonly TBucketMemberSlot[]): boolean;
885
- }
886
-
887
- declare abstract class OIMSlotContentBucketServiceArrayBased<TBucketMemberSlot extends TOIMSlot, TSlots extends TOIMBucketSlotsArrayStore<TBucketMemberSlot>> extends OIMSlotContentBucketService<TBucketMemberSlot, TSlots> {
888
- protected readonly bucketArrayMembership: Omit<IOIMBucketArrayMembership<TBucketMemberSlot, TSlots>, 'createStore'>;
889
- protected constructor(options: TOIMSlotContentBucketServiceOptions, bucketArrayMembership: Omit<IOIMBucketArrayMembership<TBucketMemberSlot, TSlots>, 'createStore'>);
890
- protected addSlot(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): boolean;
891
- protected removeSlot(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): number;
892
- protected removeSlots(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[], removedChannelQueue: OIMChannelQueue<TOIMSlot>, removedAtChannelQueue: OIMChannelQueue<number>): void;
893
- protected reconcileSlots(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlots: readonly TBucketMemberSlot[], arrivedChannelQueue: OIMChannelQueue<TOIMSlot>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
894
- protected drainSlots(bucketSlot: TOIMBucketSlot<TSlots>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
895
- hasBucketMemberSlot(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): boolean;
896
- getBucketMemberSlotCount(bucketSlot: TOIMBucketSlot<TSlots>): number;
897
- getBucketMemberSlots(bucketSlot: TOIMBucketSlot<TSlots>): Iterable<TBucketMemberSlot>;
898
- getBucketMemberSlotAt(bucketSlot: TOIMBucketSlot<TSlots>, at: number): TBucketMemberSlot | undefined;
899
- getBucketMemberSlotPosition(bucketSlot: TOIMBucketSlot<TSlots>, bucketMemberSlot: TBucketMemberSlot): number;
900
- private emptyBucketMemberSlotsStore;
901
- }
902
-
903
- declare class OIMSlotContentBucketServiceArrayDriven<TBucketMemberSlot extends TOIMSlot = TOIMSlot, TSlots extends TOIMBucketSlotsArrayStore<TBucketMemberSlot> = TOIMBucketSlotsArrayStore<TBucketMemberSlot>> extends OIMSlotContentBucketServiceArrayBased<TBucketMemberSlot, TSlots> {
904
- protected readonly bucketArrayMembership: IOIMBucketArrayMembership<TBucketMemberSlot, TSlots>;
905
- constructor(options?: TOIMSlotContentBucketServiceOptions & {
906
- bucketArrayMembership?: IOIMBucketArrayMembership<TBucketMemberSlot, TSlots> | undefined;
907
- });
908
- protected createBucketMemberSlotsStore(): TSlots;
909
- insertBucketMemberSlotAt(bucketSlot: TOIMBucketSlot<TSlots>, at: number, bucketMemberSlot: TBucketMemberSlot): void;
910
- removeBucketMemberSlotAt(bucketSlot: TOIMBucketSlot<TSlots>, at: number): TBucketMemberSlot | undefined;
911
- removeBucketMemberSlotRange(bucketSlot: TOIMBucketSlot<TSlots>, at: number, count: number): readonly TBucketMemberSlot[];
912
- moveBucketMemberSlotToPosition(bucketSlot: TOIMBucketSlot<TSlots>, from: number, to: number): TBucketMemberSlot | undefined;
913
- moveBucketMemberSlotRangeToPosition(bucketSlot: TOIMBucketSlot<TSlots>, from: number, count: number, to: number): void;
914
- }
915
-
916
- type TOIMBucketSlotsSortedArrayStore<TBucketMemberSlot extends TOIMSlot = TOIMSlot> = TOIMBucketSlotsArrayStore<TBucketMemberSlot> & {
917
- sortedCount: number;
964
+ interface IOIMBucketMemberSlotsArrayService<TBucketMemberSlot extends TOIMSlot = TOIMSlot> {
965
+ createBucketSlotsArrayStore(): TOIMBucketSlotsArrayStore<TBucketMemberSlot>;
966
+ hasBucketMemberSlot(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): boolean;
967
+ appendBucketMemberSlot(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): boolean;
968
+ insertBucketMemberSlotAt(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, at: number, bucketMemberSlot: TBucketMemberSlot): number;
969
+ removeBucketMemberSlot(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): number;
970
+ removeBucketMemberSlotAt(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, at: number): TBucketMemberSlot;
971
+ removeBucketMemberSlotRange(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, at: number, count: number): TBucketMemberSlot[];
972
+ removeBucketMemberSlots(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlots: readonly TBucketMemberSlot[], removedChannelQueue: OIMChannelQueue<TOIMSlot>, removedAtChannelQueue: OIMChannelQueue<number>): void;
973
+ moveBucketMemberSlotRange(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, from: number, count: number, landing: number): boolean;
974
+ sortBucketMemberSlots(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, compareBucketMemberSlots: (left: TBucketMemberSlot, right: TBucketMemberSlot) => number): void;
975
+ isSameBucketMemberSlotSequence(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlots: readonly TBucketMemberSlot[]): boolean;
976
+ clearBucketMemberSlots(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>): void;
977
+ }
978
+
979
+ type TOIMSlotContentArrayBucketServiceOptions<TBucketMemberSlot extends TOIMSlot = TOIMSlot> = TOIMSlotContentBucketServiceOptions & {
980
+ bucketMemberSlotsArrayService?: IOIMBucketMemberSlotsArrayService<TBucketMemberSlot> | undefined;
918
981
  };
919
982
 
920
- type TOIMSlotContentBucketServiceSortedArrayDrivenOptions<TBucketMemberSlot extends TOIMSlot = TOIMSlot> = {
983
+ declare abstract class OIMSlotContentArrayBucketService<TBucketMemberSlot extends TOIMSlot, TKey extends NonNullable<unknown> = TOIMStoreKey> extends OIMSlotContentBucketService<TBucketMemberSlot, TOIMBucketSlotsArrayStore<TBucketMemberSlot>, TKey> {
984
+ protected readonly bucketMemberSlotsArrayService: IOIMBucketMemberSlotsArrayService<TBucketMemberSlot>;
985
+ protected constructor(options: TOIMSlotContentArrayBucketServiceOptions<TBucketMemberSlot>);
986
+ protected createBucketMemberSlotsStore(): TOIMBucketSlotsArrayStore<TBucketMemberSlot>;
987
+ protected addSlot(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): boolean;
988
+ protected removeSlot(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): number;
989
+ protected removeSlots(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, bucketMemberSlots: readonly TBucketMemberSlot[], removedChannelQueue: OIMChannelQueue<TOIMSlot>, removedAtChannelQueue: OIMChannelQueue<number>): void;
990
+ protected reconcileSlots(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, bucketMemberSlots: readonly TBucketMemberSlot[], arrivedChannelQueue: OIMChannelQueue<TOIMSlot>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
991
+ protected drainSlots(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
992
+ hasBucketMemberSlot(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): boolean;
993
+ getBucketMemberSlotCount(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>): number;
994
+ getBucketMemberSlots(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>): Iterable<TBucketMemberSlot>;
995
+ getBucketMemberSlotAt(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, at: number): TBucketMemberSlot | undefined;
996
+ getBucketMemberSlotPosition(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): number;
997
+ }
998
+
999
+ declare class OIMSlotContentPositionalArrayBucketService<TBucketMemberSlot extends TOIMSlot = TOIMSlot, TKey extends NonNullable<unknown> = TOIMStoreKey> extends OIMSlotContentArrayBucketService<TBucketMemberSlot, TKey> {
1000
+ constructor(options?: TOIMSlotContentArrayBucketServiceOptions<TBucketMemberSlot>);
1001
+ insertBucketMemberSlotAt(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, at: number, bucketMemberSlot: TBucketMemberSlot): void;
1002
+ removeBucketMemberSlotAt(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, at: number): TBucketMemberSlot | undefined;
1003
+ removeBucketMemberSlotRange(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, at: number, count: number): readonly TBucketMemberSlot[];
1004
+ moveBucketMemberSlotToPosition(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, from: number, to: number): TBucketMemberSlot | undefined;
1005
+ moveBucketMemberSlotRangeToPosition(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, from: number, count: number, to: number): void;
1006
+ }
1007
+
1008
+ declare class OIMBucketMemberSlotsArrayService<TBucketMemberSlot extends TOIMSlot = TOIMSlot> implements IOIMBucketMemberSlotsArrayService<TBucketMemberSlot> {
1009
+ static readonly INSTANCE: OIMBucketMemberSlotsArrayService<TOIMSlot>;
1010
+ createBucketSlotsArrayStore(): TOIMBucketSlotsArrayStore<TBucketMemberSlot>;
1011
+ hasBucketMemberSlot(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): boolean;
1012
+ appendBucketMemberSlot(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): boolean;
1013
+ insertBucketMemberSlotAt(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, at: number, bucketMemberSlot: TBucketMemberSlot): number;
1014
+ removeBucketMemberSlot(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): number;
1015
+ removeBucketMemberSlotAt(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, at: number): TBucketMemberSlot;
1016
+ removeBucketMemberSlotRange(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, at: number, count: number): TBucketMemberSlot[];
1017
+ removeBucketMemberSlots(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlots: readonly TBucketMemberSlot[], removedChannelQueue: OIMChannelQueue<TOIMSlot>, removedAtChannelQueue: OIMChannelQueue<number>): void;
1018
+ moveBucketMemberSlotRange(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, from: number, count: number, landing: number): boolean;
1019
+ sortBucketMemberSlots(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, compareBucketMemberSlots: (left: TBucketMemberSlot, right: TBucketMemberSlot) => number): void;
1020
+ isSameBucketMemberSlotSequence(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlots: readonly TBucketMemberSlot[]): boolean;
1021
+ clearBucketMemberSlots(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>): void;
1022
+ }
1023
+
1024
+ declare class OIMBucketUniqueMemberSlotsArrayService<TBucketMemberSlot extends TOIMSlot = TOIMSlot> extends OIMBucketMemberSlotsArrayService<TBucketMemberSlot> {
1025
+ static readonly INSTANCE: OIMBucketUniqueMemberSlotsArrayService<TOIMSlot>;
1026
+ createBucketSlotsArrayStore(): TOIMBucketSlotsArrayStore<TBucketMemberSlot>;
1027
+ hasBucketMemberSlot(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): boolean;
1028
+ appendBucketMemberSlot(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): boolean;
1029
+ insertBucketMemberSlotAt(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, at: number, bucketMemberSlot: TBucketMemberSlot): number;
1030
+ removeBucketMemberSlot(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): number;
1031
+ removeBucketMemberSlotAt(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, at: number): TBucketMemberSlot;
1032
+ removeBucketMemberSlotRange(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, at: number, count: number): TBucketMemberSlot[];
1033
+ removeBucketMemberSlots(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlots: readonly TBucketMemberSlot[], removedChannelQueue: OIMChannelQueue<TOIMSlot>, removedAtChannelQueue: OIMChannelQueue<number>): void;
1034
+ isSameBucketMemberSlotSequence(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlots: readonly TBucketMemberSlot[]): boolean;
1035
+ clearBucketMemberSlots(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>): void;
1036
+ }
1037
+
1038
+ type TOIMSlotContentSortedArrayBucketServiceOptions<TBucketMemberSlot extends TOIMSlot = TOIMSlot> = TOIMSlotContentArrayBucketServiceOptions<TBucketMemberSlot> & {
921
1039
  compareBucketMemberSlots: (left: TBucketMemberSlot, right: TBucketMemberSlot) => number;
922
1040
  };
923
1041
 
924
- declare class OIMSlotContentBucketServiceSortedArrayDriven<TBucketMemberSlot extends TOIMSlot = TOIMSlot> extends OIMSlotContentBucketServiceArrayBased<TBucketMemberSlot, TOIMBucketSlotsSortedArrayStore<TBucketMemberSlot>> {
1042
+ declare class OIMSlotContentSortedArrayBucketService<TBucketMemberSlot extends TOIMSlot = TOIMSlot, TKey extends NonNullable<unknown> = TOIMStoreKey> extends OIMSlotContentArrayBucketService<TBucketMemberSlot, TKey> {
925
1043
  private readonly compareBucketMemberSlots;
926
- constructor(options: TOIMSlotContentBucketServiceSortedArrayDrivenOptions<TBucketMemberSlot>);
927
- protected createBucketMemberSlotsStore(): TOIMBucketSlotsSortedArrayStore<TBucketMemberSlot>;
928
- protected removeSlot(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): number;
929
- protected removeSlots(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TBucketMemberSlot>>, bucketMemberSlots: readonly TBucketMemberSlot[], removedChannelQueue: OIMChannelQueue<TOIMSlot>, removedAtChannelQueue: OIMChannelQueue<number>): void;
930
- protected reconcileSlots(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TBucketMemberSlot>>, bucketMemberSlots: readonly TBucketMemberSlot[], arrivedChannelQueue: OIMChannelQueue<TOIMSlot>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
931
- protected drainSlots(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TBucketMemberSlot>>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
932
- getBucketMemberSlots(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TBucketMemberSlot>>): Iterable<TBucketMemberSlot>;
933
- getBucketMemberSlotAt(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TBucketMemberSlot>>, at: number): TBucketMemberSlot | undefined;
934
- getBucketMemberSlotPosition(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): number;
935
- repositionBucketMemberSlot(bucketSlot: TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): void;
936
- private settle;
937
- }
938
-
939
- type TOIMBucketCollectionFactoryArguments<TKey, TBucketSlot, TStore, TOptions extends {
940
- bucketSlotStoreService?: unknown;
941
- }> = [
942
- TKey
943
- ] extends [readonly unknown[]] ? [bucketCollectionFactoryOptions: TOptions & Required<Pick<TOptions, 'bucketSlotStoreService'>>] : [TStore] extends [Map<TKey, TBucketSlot>] ? [bucketCollectionFactoryOptions?: TOptions] : [bucketCollectionFactoryOptions: TOptions & Required<Pick<TOptions, 'bucketSlotStoreService'>>];
944
-
945
- declare function createOIMBucketService<TBucketMemberSlot extends TOIMSlot = TOIMEntitySlot, TKey extends TOIMStoreKey | readonly unknown[] = TOIMStoreKey, TSlots = TOIMBucketSlotsArrayStore<TBucketMemberSlot>, TSlotContentService extends OIMSlotContentBucketService<TBucketMemberSlot, TSlots> = OIMSlotContentBucketServiceArrayDriven<TBucketMemberSlot> & OIMSlotContentBucketService<TBucketMemberSlot, TSlots>, TStore = Map<TKey, TOIMBucketSlot<TSlots, TKey>>>(db: OIMDB, ...[options]: TOIMBucketCollectionFactoryArguments<TKey, TOIMBucketSlot<TSlots, TKey>, TStore, {
946
- slotContentService?: (TSlotContentService & OIMSlotContentBucketService<TBucketMemberSlot, TSlots>) | undefined;
947
- bucketSlotStoreService?: IOIMSlotStoreService<TKey, TOIMBucketSlot<TSlots, TKey>, TStore> | undefined;
948
- maxCommandsPerSlot?: number | undefined;
949
- slotReleasePolicy?: IOIMSlotReleasePolicy | undefined;
950
- columnSlotStoreService?: IOIMSlotStoreService<string, TOIMColumnSlot> | undefined;
951
- columnNames?: readonly string[] | undefined;
952
- }>): OIMSlotCollectionService<TKey, TOIMBucketSlot<TSlots, TKey>, TStore, TSlotContentService, string, TOIMColumnSlot, OIMColumnOwnerPushDriven, readonly TBucketMemberSlot[]>;
953
-
954
- declare function createOIMSingleBucketService<TBucketMemberSlot extends TOIMSlot = TOIMEntitySlot, TSlots = TOIMBucketSlotsArrayStore<TBucketMemberSlot>, TSlotContentService extends OIMSlotContentBucketService<TBucketMemberSlot, TSlots> = OIMSlotContentBucketServiceArrayDriven<TBucketMemberSlot> & OIMSlotContentBucketService<TBucketMemberSlot, TSlots>>(db: OIMDB, options?: {
955
- slotContentService?: (TSlotContentService & OIMSlotContentBucketService<TBucketMemberSlot, TSlots>) | undefined;
956
- maxCommandsPerSlot?: number | undefined;
957
- slotReleasePolicy?: IOIMSlotReleasePolicy | undefined;
958
- columnSlotStoreService?: IOIMSlotStoreService<string, TOIMColumnSlot> | undefined;
959
- columnNames?: readonly string[] | undefined;
960
- }): OIMSingleSlotService<TOIMBucketSlot<TSlots, void>, TSlotContentService, string, TOIMColumnSlot, OIMColumnOwnerPushDriven, readonly TBucketMemberSlot[]>;
1044
+ constructor(options: TOIMSlotContentSortedArrayBucketServiceOptions<TBucketMemberSlot>);
1045
+ protected drainSlots(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, departedChannelQueue: OIMChannelQueue<TOIMSlot>): void;
1046
+ getBucketMemberSlots(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>): Iterable<TBucketMemberSlot>;
1047
+ getBucketMemberSlotAt(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, at: number): TBucketMemberSlot | undefined;
1048
+ getBucketMemberSlotPosition(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): number;
1049
+ repositionBucketMemberSlot(bucketSlot: TOIMBucketContentSlot<TOIMBucketSlotsArrayStore<TBucketMemberSlot>>, bucketMemberSlot: TBucketMemberSlot): void;
1050
+ }
961
1051
 
962
1052
  declare class OIMDefaults {
963
1053
  static readonly COLUMN_SLOT_STORE_SERVICE: OIMDefaultValue<IOIMSlotStoreService<string, TOIMColumnSlot, unknown>>;
964
1054
  static readonly COMPUTED_COLUMN_SLOT_STORE_SERVICE: OIMDefaultValue<IOIMSlotStoreService<string, TOIMComputedColumnSlot, unknown>>;
965
- static readonly KEY_TREE_WALK_SCALAR: OIMDefaultValue<OIMKeyTreeWalkScalar>;
966
- static readonly KEY_TREE_WALK_COMPOSITE: OIMDefaultValue<OIMKeyTreeWalkComposite>;
1055
+ static readonly KEY_TREE_WALK_SCALAR: OIMDefaultValue<OIMScalarKeyTreeWalk>;
1056
+ static readonly KEY_TREE_WALK_COMPOSITE: OIMDefaultValue<OIMCompositeKeyTreeWalk>;
967
1057
  static readonly STANDALONE_SLOT_OWNER: OIMDefaultValue<OIMSlotOwner>;
968
1058
  static readonly ENTITY_WRITER: OIMDefaultValue<IOIMEntityWriter>;
969
- static readonly ENTITY_SLOT_EMPTINESS: OIMDefaultValue<IOIMSlotEmptiness<TOIMEntitySlot>>;
1059
+ static readonly ENTITY_SLOT_EMPTINESS: OIMDefaultValue<IOIMSlotEmptinessPolicy<TOIMEntityContentSlot>>;
970
1060
  static readonly INDEX_KEYS_SERVICE: OIMDefaultValue<IOIMIndexKeysService>;
971
1061
  static readonly STORE_SLOT_LISTENER: OIMDefaultValue<IOIMStoreSlotListener>;
972
1062
  }
@@ -982,50 +1072,72 @@ declare class OIMDefaultValue<TValue> {
982
1072
  private assertNoLateOverride;
983
1073
  }
984
1074
 
985
- type TOIMComputedStoreSlot<TStore = unknown, TValue = unknown, TKey = unknown> = TOIMStoreSlot<TStore, TOIMComputedSlot<TValue, TKey>> & {
986
- readonly derive: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => TValue) | undefined;
987
- readonly createSources: ((key: TKey, storeSlot: TOIMStoreSlot | undefined) => Partial<TOIMComputedSources>) | undefined;
1075
+ declare class OIMFlushSchedulerService {
1076
+ static readonly INSTANCE: OIMFlushSchedulerService;
1077
+ isScheduled(flushSchedulerSlot: TOIMFlushSchedulerSlot): boolean;
1078
+ schedule<TFlushSchedulerSlot extends TOIMFlushSchedulerSlot>(flushSchedulerSlot: TFlushSchedulerSlot, delayMs: number, flushSchedulerListener: IOIMFlushSchedulerListener<TFlushSchedulerSlot>): void;
1079
+ cancelSchedule(flushSchedulerSlot: TOIMFlushSchedulerSlot): void;
1080
+ }
1081
+
1082
+ type TOIMComputedStoreSlot<TStore = unknown, TValue = unknown, TComputedSlot extends TOIMComputedContentSlot<TValue> = TOIMComputedContentSlot<TValue>> = TOIMStoreSlot<TStore, TComputedSlot> & {
1083
+ readonly derive: ((computedSlot: TComputedSlot) => TValue) | undefined;
1084
+ readonly createSources: ((computedSlot: TComputedSlot) => Partial<TOIMComputedSources>) | undefined;
988
1085
  };
989
1086
 
990
- type TOIMComputedServiceOptions<TKey, TValue, TComputedStore> = {
991
- computedSlotStoreService: IOIMSlotStoreService<TKey, TOIMComputedSlot<TValue, TKey>, TComputedStore>;
992
- columnOwnerOptions: TOIMColumnOwnerOptions<TOIMComputedColumnSlot, Extract<keyof TValue, string>>;
1087
+ type TOIMComputedDerivationOptions<TValue, TComputedSlot extends TOIMComputedContentSlot<TValue>> = {
1088
+ columnSlotOwnerOptions: TOIMColumnSlotOwnerOptions<TOIMComputedColumnSlot, Extract<keyof TValue, string>>;
993
1089
  slotReleasePolicy: IOIMSlotReleasePolicy;
994
1090
  storeSlotListener: IOIMStoreSlotListener;
995
- createSources?: ((key: TKey, storeSlot: TOIMStoreSlot | undefined) => Partial<TOIMComputedSources>) | undefined;
996
- derive?: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => TValue) | undefined;
1091
+ createSources?: ((computedSlot: TComputedSlot) => Partial<TOIMComputedSources>) | undefined;
1092
+ derive?: ((computedSlot: TComputedSlot) => TValue) | undefined;
997
1093
  sameValueGuard?: TOIMSameValueGuard<TValue> | undefined;
998
1094
  initialValue?: TValue | undefined;
999
1095
  };
1000
1096
 
1001
- declare class OIMComputedService<TKey, TValue, TComputedStore> {
1002
- readonly computedCollectionService: OIMSlotCollectionService<TKey, TOIMComputedSlot<TValue, TKey>, TComputedStore, OIMComputedValueService<TKey, TValue>, Extract<keyof TValue, string>, TOIMComputedColumnSlot, OIMColumnOwnerPullDriven>;
1097
+ type TOIMComputedServiceOptions<TKey extends NonNullable<unknown>, TValue, TComputedStore> = TOIMComputedDerivationOptions<TValue, TOIMComputedSlot<TValue, TKey>> & {
1098
+ computedSlotStoreService: IOIMSlotStoreService<TKey, TOIMComputedSlot<TValue, TKey>, TComputedStore>;
1099
+ };
1100
+
1101
+ declare class OIMComputedService<TKey extends NonNullable<unknown>, TValue, TComputedStore> {
1102
+ readonly computedCollectionService: OIMSlotCollectionService<TKey, TOIMComputedSlot<TValue, TKey>, TComputedStore, OIMSlotContentComputedService<TValue, TOIMComputedSlot<TValue, TKey>>, Extract<keyof TValue, string>, TOIMComputedColumnSlot, OIMPullColumnSlotOwner>;
1003
1103
  private readonly hasDerive;
1004
1104
  private readonly hasCreateSources;
1005
1105
  constructor(options: TOIMComputedServiceOptions<TKey, TValue, TComputedStore>);
1006
- createComputedStoreSlot(channelMap: IOIMChannelMap, derive?: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => TValue) | undefined, createSources?: ((key: TKey, storeSlot: TOIMStoreSlot | undefined) => Partial<TOIMComputedSources>) | undefined): TOIMComputedStoreSlot<TComputedStore, TValue, TKey>;
1007
- private assertDeriveAndCreateSources;
1106
+ createComputedStoreSlot(channelMap: IOIMChannelMap, derive?: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => TValue) | undefined, createSources?: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => Partial<TOIMComputedSources>) | undefined): TOIMComputedStoreSlot<TComputedStore, TValue, TOIMComputedSlot<TValue, TKey>>;
1008
1107
  }
1009
1108
 
1010
- type TOIMDefaultSlotStore<TKey, TSlot> = [TKey] extends [void] ? TOIMSingleSlotStore<TSlot> : Map<TKey, TSlot>;
1011
-
1012
- declare function createOIMComputedService<TKey, TValue, TComputedStore = TOIMDefaultSlotStore<TKey, TOIMComputedSlot<TValue, TKey>>>(options: {
1013
- createSources?: ((key: TKey, storeSlot: TOIMStoreSlot | undefined) => Partial<TOIMComputedSources>) | undefined;
1109
+ declare function createOIMComputedService<TKey extends NonNullable<unknown>, TValue, TComputedStore = Map<TKey, TOIMComputedSlot<TValue, TKey>>>(options: {
1110
+ createSources?: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => Partial<TOIMComputedSources>) | undefined;
1014
1111
  derive?: ((computedSlot: TOIMComputedSlot<TValue, TKey>) => TValue) | undefined;
1015
1112
  sameValueGuard?: TOIMSameValueGuard<TValue> | undefined;
1016
1113
  initialValue?: TValue | undefined;
1017
1114
  slotReleasePolicy?: IOIMSlotReleasePolicy | undefined;
1018
1115
  columnSlotStoreService?: IOIMSlotStoreService<string, TOIMComputedColumnSlot> | undefined;
1019
1116
  columnNames?: readonly Extract<keyof TValue, string>[] | undefined;
1020
- } & ([TComputedStore] extends [Map<TKey, TOIMComputedSlot<TValue, TKey>>] ? {
1021
1117
  computedSlotStoreService?: IOIMSlotStoreService<TKey, TOIMComputedSlot<TValue, TKey>, TComputedStore> | undefined;
1022
- } : {
1023
- computedSlotStoreService: IOIMSlotStoreService<TKey, TOIMComputedSlot<TValue, TKey>, TComputedStore>;
1024
- })): OIMComputedService<TKey, TValue, TComputedStore>;
1118
+ }): OIMComputedService<TKey, TValue, TComputedStore>;
1025
1119
 
1026
- type TOIMSortedComputedSlot<TEntity extends object, TKey> = TOIMComputedSlot<readonly TOIMEntitySlot<TEntity>[], TKey>;
1120
+ declare class OIMSingleComputedService<TValue> {
1121
+ readonly computedSingleSlotService: OIMSingleSlotService<TOIMComputedContentSlot<TValue>, OIMSlotContentComputedService<TValue>, Extract<keyof TValue, string>, TOIMComputedColumnSlot, OIMPullColumnSlotOwner>;
1122
+ private readonly hasDerive;
1123
+ private readonly hasCreateSources;
1124
+ constructor(options: TOIMComputedDerivationOptions<TValue, TOIMComputedContentSlot<TValue>>);
1125
+ createComputedStoreSlot(channelMap: IOIMChannelMap, derive?: ((computedSlot: TOIMComputedContentSlot<TValue>) => TValue) | undefined, createSources?: ((computedSlot: TOIMComputedContentSlot<TValue>) => Partial<TOIMComputedSources>) | undefined): TOIMComputedStoreSlot<TOIMSingleSlotStore<TOIMComputedContentSlot<TValue>>, TValue>;
1126
+ }
1027
1127
 
1028
- type TOIMIndexStoreSlot<TStore = unknown, TBucketSlot extends TOIMSlot = TOIMSlot, TBucketPatch = unknown, TSourceSlot extends TOIMSlot = TOIMSlot, TSourcePatch = unknown, TKey = unknown, TSourceStore = unknown> = TOIMStoreSlot<TStore, TBucketSlot, TBucketPatch> & {
1128
+ declare function createOIMSingleComputedService<TValue>(options?: {
1129
+ createSources?: ((computedSlot: TOIMComputedContentSlot<TValue>) => Partial<TOIMComputedSources>) | undefined;
1130
+ derive?: ((computedSlot: TOIMComputedContentSlot<TValue>) => TValue) | undefined;
1131
+ sameValueGuard?: TOIMSameValueGuard<TValue> | undefined;
1132
+ initialValue?: TValue | undefined;
1133
+ slotReleasePolicy?: IOIMSlotReleasePolicy | undefined;
1134
+ columnSlotStoreService?: IOIMSlotStoreService<string, TOIMComputedColumnSlot> | undefined;
1135
+ columnNames?: readonly Extract<keyof TValue, string>[] | undefined;
1136
+ }): OIMSingleComputedService<TValue>;
1137
+
1138
+ type TOIMSortedComputedSlot<TEntity extends object, TKey extends NonNullable<unknown>> = TOIMComputedSlot<readonly TOIMEntitySlot<TEntity>[], TKey>;
1139
+
1140
+ type TOIMIndexStoreSlot<TStore = unknown, TBucketSlot extends TOIMSlot = TOIMSlot, TBucketPatch = unknown, TSourceSlot extends TOIMSlot = TOIMSlot, TSourcePatch = unknown, TKey = unknown, TSourceStore = unknown, TSlotService = unknown> = TOIMStoreSlot<TStore, TBucketSlot, TBucketPatch, TSlotService> & {
1029
1141
  readonly sourceStoreSlot: TOIMStoreSlot<TSourceStore, TSourceSlot, TSourcePatch>;
1030
1142
  readonly indexKeysPosition: number;
1031
1143
  readonly contentChangeListener: IOIMContentChangeListener<TSourceSlot, TSourcePatch>;
@@ -1035,21 +1147,21 @@ type TOIMIndexStoreSlot<TStore = unknown, TBucketSlot extends TOIMSlot = TOIMSlo
1035
1147
  readonly isDisposed: boolean;
1036
1148
  };
1037
1149
 
1038
- type TOIMIndexServiceOptions<TKey, TEntity extends object, TBucketSlot extends TOIMKeyedSlot<TKey>, TStore, TSlotContentService, TSourceKey, TSourceStore> = TOIMSlotCollectionServiceOptions<TKey, TBucketSlot, TStore, TSlotContentService, string, TOIMColumnSlot, OIMColumnOwnerPushDriven, readonly TOIMEntitySlot<TEntity>[]> & {
1150
+ type TOIMSlotCollectionIndexServiceOptions<TKey extends NonNullable<unknown>, TEntity extends object, TBucketSlot extends TOIMKeyedSlot<TKey>, TStore, TSlotContentService, TSourceKey extends NonNullable<unknown>, TSourceStore> = TOIMSlotCollectionServiceOptions<TKey, TBucketSlot, TStore, TSlotContentService, string, TOIMColumnSlot, OIMPushColumnSlotOwner, readonly TOIMEntitySlot<TEntity>[]> & {
1039
1151
  keyOf: (entity: TEntity) => TKey;
1040
1152
  columns?: readonly string[] | undefined;
1041
1153
  sourceSlotCollectionService: Pick<OIMSlotCollectionService<TSourceKey, TOIMEntitySlot<TEntity, TSourceKey>, TSourceStore, unknown>, 'getSlots'>;
1042
1154
  indexKeysService: IOIMIndexKeysService;
1043
1155
  };
1044
1156
 
1045
- declare class OIMIndexService<TKey, TEntity extends object, TSlots, TSourceKey = unknown, TSourceStore = unknown, TSlotContentService extends OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots> = OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, TBucketSlot extends TOIMBucketSlot<TSlots, TKey> = TOIMBucketSlot<TSlots, TKey>, TStore = Map<TKey, TBucketSlot>> extends OIMSlotCollectionService<TKey, TBucketSlot, TStore, Pick<TSlotContentService, Extract<keyof TSlotContentService, 'getBucketMemberSlots' | 'getBucketMemberSlotCount' | 'hasBucketMemberSlot' | 'getBucketMemberSlotAt' | 'getBucketMemberSlotPosition'>>, string, TOIMColumnSlot, OIMColumnOwnerPushDriven, readonly TOIMEntitySlot<TEntity>[]> {
1157
+ declare class OIMSlotCollectionIndexService<TKey extends NonNullable<unknown>, TEntity extends object, TSlots, TSourceKey extends NonNullable<unknown> = NonNullable<unknown>, TSourceStore = unknown, TSlotContentService extends OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots, TKey> = OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots, TKey>, TBucketSlot extends TOIMBucketSlot<TSlots, TKey> = TOIMBucketSlot<TSlots, TKey>, TStore = Map<TKey, TBucketSlot>> extends OIMSlotCollectionService<TKey, TBucketSlot, TStore, Pick<TSlotContentService, Extract<keyof TSlotContentService, 'getBucketMemberSlots' | 'getBucketMemberSlotCount' | 'hasBucketMemberSlot' | 'getBucketMemberSlotAt' | 'getBucketMemberSlotPosition'>>, string, TOIMColumnSlot, OIMPushColumnSlotOwner, readonly TOIMEntitySlot<TEntity>[]> {
1046
1158
  protected readonly slotContentBucketService: TSlotContentService;
1047
1159
  private readonly keyOf;
1048
1160
  private readonly keyColumns;
1049
1161
  private readonly sourceSlotCollectionService;
1050
1162
  private readonly indexKeysService;
1051
- constructor(options: TOIMIndexServiceOptions<TKey, TEntity, TBucketSlot, TStore, TSlotContentService, TSourceKey, TSourceStore>);
1052
- createIndexStoreSlot(sourceStoreSlot: TOIMStoreSlot<TSourceStore, TOIMEntitySlot<TEntity, TSourceKey>, Partial<TEntity>>): TOIMIndexStoreSlot<TStore, TBucketSlot, readonly TOIMEntitySlot<TEntity>[], TOIMEntitySlot<TEntity, TSourceKey>, Partial<TEntity>, TKey, TSourceStore>;
1163
+ constructor(options: TOIMSlotCollectionIndexServiceOptions<TKey, TEntity, TBucketSlot, TStore, TSlotContentService, TSourceKey, TSourceStore>);
1164
+ createIndexStoreSlot(sourceStoreSlot: TOIMStoreSlot<TSourceStore, TOIMEntitySlot<TEntity, TSourceKey>, Partial<TEntity>>): TOIMIndexStoreSlot<TStore, TBucketSlot, readonly TOIMEntitySlot<TEntity>[], TOIMEntitySlot<TEntity, TSourceKey>, Partial<TEntity>, TKey, TSourceStore, this>;
1053
1165
  disposeIndexStoreSlot(indexStoreSlot: TOIMIndexStoreSlot<TStore, TBucketSlot, readonly TOIMEntitySlot<TEntity>[], TOIMEntitySlot<TEntity, TSourceKey>, Partial<TEntity>, TKey, TSourceStore>): void;
1054
1166
  getSlotByKey(storeSlot: TOIMStoreSlot<TStore, TBucketSlot, readonly TOIMEntitySlot<TEntity>[]>, key: TKey): TBucketSlot;
1055
1167
  holdSlotByKey(storeSlot: TOIMStoreSlot<TStore, TBucketSlot, readonly TOIMEntitySlot<TEntity>[]>, key: TKey): TBucketSlot;
@@ -1078,7 +1190,7 @@ declare class OIMIndexService<TKey, TEntity extends object, TSlots, TSourceKey =
1078
1190
  private setIndexKeyForSlots;
1079
1191
  }
1080
1192
 
1081
- type TOIMIndexServiceStoreSlot<TKey, TEntity extends object, TSlots, TSourceKey, TSourceStore> = Parameters<OIMIndexService<TKey, TEntity, TSlots, TSourceKey, TSourceStore>['getBucketColumnByKey']>[0];
1193
+ type TOIMSlotCollectionIndexServiceStoreSlot<TKey extends NonNullable<unknown>, TEntity extends object, TSlots, TSourceKey extends NonNullable<unknown>, TSourceStore> = Parameters<OIMSlotCollectionIndexService<TKey, TEntity, TSlots, TSourceKey, TSourceStore>['getBucketColumnByKey']>[0];
1082
1194
 
1083
1195
  type TOIMSortableColumnName<TEntity extends object> = {
1084
1196
  [TColumn in keyof TEntity]-?: NonNullable<TEntity[TColumn]> extends string | number | bigint ? TColumn : never;
@@ -1089,8 +1201,8 @@ type TOIMSortColumn<TEntity extends object> = {
1089
1201
  direction: 'asc' | 'desc';
1090
1202
  };
1091
1203
 
1092
- type TOIMComputedServiceSortedOptions<TKey, TEntity extends object, TSlots, TSourceKey, TSourceStore, TComputedStore> = {
1093
- indexService: OIMIndexService<TKey, TEntity, TSlots, TSourceKey, TSourceStore>;
1204
+ type TOIMSortedComputedServiceOptions<TKey extends NonNullable<unknown>, TEntity extends object, TSlots, TSourceKey extends NonNullable<unknown>, TSourceStore, TComputedStore> = {
1205
+ indexService: OIMSlotCollectionIndexService<TKey, TEntity, TSlots, TSourceKey, TSourceStore>;
1094
1206
  computedSlotStoreService: IOIMSlotStoreService<TKey, TOIMComputedSlot<readonly TOIMEntitySlot<TEntity>[], TKey>, TComputedStore>;
1095
1207
  columnSlotStoreService: IOIMSlotStoreService<string, TOIMComputedColumnSlot>;
1096
1208
  sortColumns?: readonly TOIMSortColumn<TEntity>[] | undefined;
@@ -1099,49 +1211,45 @@ type TOIMComputedServiceSortedOptions<TKey, TEntity extends object, TSlots, TSou
1099
1211
  storeSlotListener: IOIMStoreSlotListener;
1100
1212
  };
1101
1213
 
1102
- declare class OIMComputedServiceSorted<TKey, TEntity extends object, TSlots, TSourceKey, TSourceStore, TComputedStore> {
1103
- readonly computedCollectionService: OIMSlotCollectionService<TKey, TOIMSortedComputedSlot<TEntity, TKey>, TComputedStore, OIMComputedValueService<TKey, readonly TOIMEntitySlot<TEntity>[]>, string, TOIMComputedColumnSlot, OIMColumnOwnerPullDriven>;
1104
- constructor(options: TOIMComputedServiceSortedOptions<TKey, TEntity, TSlots, TSourceKey, TSourceStore, TComputedStore>);
1105
- createSortedStoreSlot(indexStoreSlot: TOIMIndexServiceStoreSlot<TKey, TEntity, TSlots, TSourceKey, TSourceStore>): TOIMStoreSlot<TComputedStore, TOIMSortedComputedSlot<TEntity, TKey>>;
1214
+ declare class OIMSortedComputedService<TKey extends NonNullable<unknown>, TEntity extends object, TSlots, TSourceKey extends NonNullable<unknown>, TSourceStore, TComputedStore> {
1215
+ readonly computedCollectionService: OIMSlotCollectionService<TKey, TOIMSortedComputedSlot<TEntity, TKey>, TComputedStore, OIMSlotContentComputedService<readonly TOIMEntitySlot<TEntity>[], TOIMSortedComputedSlot<TEntity, TKey>>, string, TOIMComputedColumnSlot, OIMPullColumnSlotOwner>;
1216
+ constructor(options: TOIMSortedComputedServiceOptions<TKey, TEntity, TSlots, TSourceKey, TSourceStore, TComputedStore>);
1217
+ createSortedStoreSlot(indexStoreSlot: TOIMSlotCollectionIndexServiceStoreSlot<TKey, TEntity, TSlots, TSourceKey, TSourceStore>): TOIMStoreSlot<TComputedStore, TOIMSortedComputedSlot<TEntity, TKey>>;
1106
1218
  }
1107
1219
 
1108
- declare function createOIMComputedServiceSorted<TKey, TEntity extends object, TSlots, TSourceKey, TSourceStore, TComputedStore = TOIMDefaultSlotStore<TKey, TOIMComputedSlot<readonly TOIMEntitySlot<TEntity>[], TKey>>>(options: {
1109
- indexService: OIMIndexService<TKey, TEntity, TSlots, TSourceKey, TSourceStore>;
1220
+ type TOIMDefaultSlotStore<TKey, TSlot> = Map<TKey, TSlot>;
1221
+
1222
+ declare function createOIMSortedComputedService<TKey extends NonNullable<unknown>, TEntity extends object, TSlots, TSourceKey extends NonNullable<unknown>, TSourceStore, TComputedStore = TOIMDefaultSlotStore<TKey, TOIMComputedSlot<readonly TOIMEntitySlot<TEntity>[], TKey>>>(options: {
1223
+ indexService: OIMSlotCollectionIndexService<TKey, TEntity, TSlots, TSourceKey, TSourceStore>;
1110
1224
  sortColumns?: readonly TOIMSortColumn<TEntity>[] | undefined;
1111
1225
  comparator?: ((left: TEntity, right: TEntity) => number) | undefined;
1112
1226
  slotReleasePolicy?: IOIMSlotReleasePolicy | undefined;
1113
1227
  columnSlotStoreService?: IOIMSlotStoreService<string, TOIMComputedColumnSlot> | undefined;
1114
- } & ([TComputedStore] extends [Map<TKey, TOIMComputedSlot<readonly TOIMEntitySlot<TEntity>[], TKey>>] ? {
1115
1228
  computedSlotStoreService?: IOIMSlotStoreService<TKey, TOIMComputedSlot<readonly TOIMEntitySlot<TEntity>[], TKey>, TComputedStore> | undefined;
1116
- } : {
1117
- computedSlotStoreService: IOIMSlotStoreService<TKey, TOIMComputedSlot<readonly TOIMEntitySlot<TEntity>[], TKey>, TComputedStore>;
1118
- })): OIMComputedServiceSorted<TKey, TEntity, TSlots, TSourceKey, TSourceStore, TComputedStore>;
1229
+ }): OIMSortedComputedService<TKey, TEntity, TSlots, TSourceKey, TSourceStore, TComputedStore>;
1119
1230
 
1120
- type TOIMComputedServiceBucketMemoOptions<TKey, TBucketMemberSlot extends TOIMSlot, TSlots, TBucketStore, TComputedStore> = {
1121
- bucketCollectionService: OIMSlotCollectionService<TKey, TOIMBucketSlot<TSlots, TKey>, TBucketStore, OIMSlotContentBucketService<TBucketMemberSlot, TSlots>, string, TOIMColumnSlot, OIMColumnOwnerPushDriven, readonly TBucketMemberSlot[]>;
1231
+ type TOIMBucketMemoComputedServiceOptions<TKey extends NonNullable<unknown>, TBucketMemberSlot extends TOIMSlot, TSlots, TBucketStore, TComputedStore> = {
1232
+ bucketCollectionService: OIMSlotCollectionService<TKey, TOIMBucketSlot<TSlots, TKey>, TBucketStore, OIMSlotContentBucketService<TBucketMemberSlot, TSlots>, string, TOIMColumnSlot, OIMPushColumnSlotOwner, readonly TBucketMemberSlot[]>;
1122
1233
  computedSlotStoreService: IOIMSlotStoreService<TKey, TOIMComputedSlot<readonly TBucketMemberSlot[], TKey>, TComputedStore>;
1123
1234
  columnSlotStoreService: IOIMSlotStoreService<string, TOIMComputedColumnSlot>;
1124
1235
  slotReleasePolicy: IOIMSlotReleasePolicy;
1125
1236
  storeSlotListener: IOIMStoreSlotListener;
1126
1237
  };
1127
1238
 
1128
- type TOIMBucketMemoComputedSlot<TBucketMemberSlot extends TOIMSlot, TKey> = TOIMComputedSlot<readonly TBucketMemberSlot[], TKey>;
1239
+ type TOIMBucketMemoComputedSlot<TBucketMemberSlot extends TOIMSlot, TKey extends NonNullable<unknown>> = TOIMComputedSlot<readonly TBucketMemberSlot[], TKey>;
1129
1240
 
1130
- declare class OIMComputedServiceBucketMemo<TKey, TBucketMemberSlot extends TOIMSlot, TSlots, TBucketStore, TComputedStore> {
1131
- readonly computedCollectionService: OIMSlotCollectionService<TKey, TOIMBucketMemoComputedSlot<TBucketMemberSlot, TKey>, TComputedStore, OIMComputedValueService<TKey, readonly TBucketMemberSlot[]>, string, TOIMComputedColumnSlot, OIMColumnOwnerPullDriven>;
1132
- constructor(options: TOIMComputedServiceBucketMemoOptions<TKey, TBucketMemberSlot, TSlots, TBucketStore, TComputedStore>);
1241
+ declare class OIMBucketMemoComputedService<TKey extends NonNullable<unknown>, TBucketMemberSlot extends TOIMSlot, TSlots, TBucketStore, TComputedStore> {
1242
+ readonly computedCollectionService: OIMSlotCollectionService<TKey, TOIMBucketMemoComputedSlot<TBucketMemberSlot, TKey>, TComputedStore, OIMSlotContentComputedService<readonly TBucketMemberSlot[], TOIMBucketMemoComputedSlot<TBucketMemberSlot, TKey>>, string, TOIMComputedColumnSlot, OIMPullColumnSlotOwner>;
1243
+ constructor(options: TOIMBucketMemoComputedServiceOptions<TKey, TBucketMemberSlot, TSlots, TBucketStore, TComputedStore>);
1133
1244
  createBucketMemoStoreSlot(bucketStoreSlot: TOIMStoreSlot<TBucketStore, TOIMBucketSlot<TSlots, TKey>, readonly TBucketMemberSlot[]>): TOIMStoreSlot<TComputedStore, TOIMBucketMemoComputedSlot<TBucketMemberSlot, TKey>>;
1134
1245
  }
1135
1246
 
1136
- declare function createOIMComputedServiceBucketMemo<TKey, TBucketMemberSlot extends TOIMSlot, TSlots, TBucketStore, TComputedStore = TOIMDefaultSlotStore<TKey, TOIMComputedSlot<readonly TBucketMemberSlot[], TKey>>>(options: {
1137
- bucketCollectionService: OIMSlotCollectionService<TKey, TOIMBucketSlot<TSlots, TKey>, TBucketStore, OIMSlotContentBucketService<TBucketMemberSlot, TSlots>, string, TOIMColumnSlot, OIMColumnOwnerPushDriven, readonly TBucketMemberSlot[]>;
1247
+ declare function createOIMBucketMemoComputedService<TKey extends NonNullable<unknown>, TBucketMemberSlot extends TOIMSlot, TSlots, TBucketStore, TComputedStore = TOIMDefaultSlotStore<TKey, TOIMComputedSlot<readonly TBucketMemberSlot[], TKey>>>(options: {
1248
+ bucketCollectionService: OIMSlotCollectionService<TKey, TOIMBucketSlot<TSlots, TKey>, TBucketStore, OIMSlotContentBucketService<TBucketMemberSlot, TSlots>, string, TOIMColumnSlot, OIMPushColumnSlotOwner, readonly TBucketMemberSlot[]>;
1138
1249
  slotReleasePolicy?: IOIMSlotReleasePolicy | undefined;
1139
1250
  columnSlotStoreService?: IOIMSlotStoreService<string, TOIMComputedColumnSlot> | undefined;
1140
- } & ([TComputedStore] extends [Map<TKey, TOIMComputedSlot<readonly TBucketMemberSlot[], TKey>>] ? {
1141
1251
  computedSlotStoreService?: IOIMSlotStoreService<TKey, TOIMComputedSlot<readonly TBucketMemberSlot[], TKey>, TComputedStore> | undefined;
1142
- } : {
1143
- computedSlotStoreService: IOIMSlotStoreService<TKey, TOIMComputedSlot<readonly TBucketMemberSlot[], TKey>, TComputedStore>;
1144
- })): OIMComputedServiceBucketMemo<TKey, TBucketMemberSlot, TSlots, TBucketStore, TComputedStore>;
1252
+ }): OIMBucketMemoComputedService<TKey, TBucketMemberSlot, TSlots, TBucketStore, TComputedStore>;
1145
1253
 
1146
1254
  type TOIMBucketCommandsOptions = {
1147
1255
  maxCommandsPerSlot?: number | undefined;
@@ -1150,26 +1258,27 @@ type TOIMBucketCommandsOptions = {
1150
1258
  declare class OIMBucketCommands implements IOIMBucketCommands {
1151
1259
  private readonly maxCommandsPerSlot;
1152
1260
  constructor(options: TOIMBucketCommandsOptions);
1153
- recordInsert(bucketSlot: TOIMBucketSlot<unknown>, index: number, bucketMemberSlot: TOIMSlot, bucketMemberSlotCount: number): void;
1154
- recordRemove(bucketSlot: TOIMBucketSlot<unknown>, index: number, count: number, bucketMemberSlotCount: number): void;
1155
- recordMove(bucketSlot: TOIMBucketSlot<unknown>, from: number, to: number, bucketMemberSlotCount: number): void;
1156
- recordWholeList(bucketSlot: TOIMBucketSlot<unknown>): void;
1261
+ recordInsert(bucketSlot: TOIMBucketContentSlot<unknown>, index: number, bucketMemberSlot: TOIMSlot, bucketMemberSlotCount: number): void;
1262
+ recordRemove(bucketSlot: TOIMBucketContentSlot<unknown>, index: number, count: number, bucketMemberSlotCount: number): void;
1263
+ recordMove(bucketSlot: TOIMBucketContentSlot<unknown>, from: number, to: number, bucketMemberSlotCount: number): void;
1264
+ recordWholeList(bucketSlot: TOIMBucketContentSlot<unknown>): void;
1157
1265
  private recordCommand;
1158
1266
  }
1159
1267
 
1160
- declare class OIMIndexServiceSortedArrayDriven<TKey, TEntity extends object, TSourceKey = unknown, TSourceStore = unknown, TBucketSlot extends TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TOIMEntitySlot<TEntity>>, TKey> = TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TOIMEntitySlot<TEntity>>, TKey>, TStore = Map<TKey, TBucketSlot>> extends OIMIndexService<TKey, TEntity, TOIMBucketSlotsSortedArrayStore<TOIMEntitySlot<TEntity>>, TSourceKey, TSourceStore, OIMSlotContentBucketServiceSortedArrayDriven<TOIMEntitySlot<TEntity>>, TBucketSlot, TStore> {
1268
+ declare class OIMSlotCollectionSortedArrayIndexService<TKey extends NonNullable<unknown>, TEntity extends object, TSourceKey extends NonNullable<unknown> = NonNullable<unknown>, TSourceStore = unknown, TBucketSlot extends TOIMBucketSlot<TOIMBucketSlotsArrayStore<TOIMEntitySlot<TEntity>>, TKey> = TOIMBucketSlot<TOIMBucketSlotsArrayStore<TOIMEntitySlot<TEntity>>, TKey>, TStore = Map<TKey, TBucketSlot>> extends OIMSlotCollectionIndexService<TKey, TEntity, TOIMBucketSlotsArrayStore<TOIMEntitySlot<TEntity>>, TSourceKey, TSourceStore, OIMSlotContentSortedArrayBucketService<TOIMEntitySlot<TEntity>, TKey>, TBucketSlot, TStore> {
1161
1269
  private readonly sortColumnNames;
1162
- constructor(options: TOIMIndexServiceOptions<TKey, TEntity, TBucketSlot, TStore, OIMSlotContentBucketServiceSortedArrayDriven<TOIMEntitySlot<TEntity>>, TSourceKey, TSourceStore> & {
1270
+ constructor(options: TOIMSlotCollectionIndexServiceOptions<TKey, TEntity, TBucketSlot, TStore, OIMSlotContentSortedArrayBucketService<TOIMEntitySlot<TEntity>, TKey>, TSourceKey, TSourceStore> & {
1163
1271
  sortColumns: readonly TOIMSortColumn<TEntity>[];
1164
1272
  });
1165
- createIndexStoreSlot(sourceStoreSlot: TOIMStoreSlot<TSourceStore, TOIMEntitySlot<TEntity, TSourceKey>, Partial<TEntity>>): TOIMIndexStoreSlot<TStore, TBucketSlot, readonly TOIMEntitySlot<TEntity>[], TOIMEntitySlot<TEntity, TSourceKey>, Partial<TEntity>, TKey, TSourceStore>;
1273
+ createIndexStoreSlot(sourceStoreSlot: TOIMStoreSlot<TSourceStore, TOIMEntitySlot<TEntity, TSourceKey>, Partial<TEntity>>): TOIMIndexStoreSlot<TStore, TBucketSlot, readonly TOIMEntitySlot<TEntity>[], TOIMEntitySlot<TEntity, TSourceKey>, Partial<TEntity>, TKey, TSourceStore, this>;
1166
1274
  protected onBucketColumnsChanged(_indexStoreSlot: TOIMIndexStoreSlot<TStore, TBucketSlot, readonly TOIMEntitySlot<TEntity>[], TOIMEntitySlot<TEntity, TSourceKey>, Partial<TEntity>, TKey, TSourceStore>, bucketSlot: TBucketSlot, entitySlot: TOIMEntitySlot<TEntity, TSourceKey>, changedColumns: readonly string[] | undefined): void;
1167
1275
  private isSortColumnChanged;
1168
1276
  }
1169
1277
 
1170
- type TOIMIndexServiceFactoryOptions<TEntity extends object, TSourceKey, TSourceStore> = {
1278
+ type TOIMSlotCollectionIndexServiceFactoryOptions<TEntity extends object, TSourceKey extends NonNullable<unknown>, TSourceStore> = {
1171
1279
  entityService: Pick<OIMSlotCollectionService<TSourceKey, TOIMEntitySlot<TEntity, TSourceKey>, TSourceStore, unknown>, 'getSlots'>;
1172
1280
  slotReleasePolicy?: IOIMSlotReleasePolicy | undefined;
1281
+ slotSubscriptionListener?: IOIMSlotSubscriptionListener | undefined;
1173
1282
  columnSlotStoreService?: IOIMSlotStoreService<string, TOIMColumnSlot> | undefined;
1174
1283
  columnNames?: readonly string[] | undefined;
1175
1284
  };
@@ -1186,34 +1295,19 @@ type TOIMIndexKeyOptions<TKey, TEntity extends object, TColumns extends readonly
1186
1295
  columns: [TKey] extends [never] ? never : [TKey] extends [TOIMIndexKey<TEntity, TColumns>] ? TColumns : never;
1187
1296
  };
1188
1297
 
1189
- declare function createOIMIndexService<TEntity extends object, TSourceKey, const TColumns extends readonly TOIMEntityColumnName<TEntity>[] = readonly TOIMEntityColumnName<TEntity>[], TKey extends TOIMStoreKey = [TOIMIndexKey<TEntity, TColumns>] extends [TOIMStoreKey] ? Extract<TOIMIndexKey<TEntity, TColumns>, TOIMStoreKey> : never, TSourceStore = unknown, TSlots = TOIMBucketSlotsArrayStore<TOIMEntitySlot<TEntity>>, TSlotContentService extends OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots> = OIMSlotContentBucketServiceArrayDriven<TOIMEntitySlot<TEntity>> & OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>>(db: OIMDB, options: TOIMIndexServiceFactoryOptions<TEntity, TSourceKey, TSourceStore> & {
1190
- slotContentService?: (TSlotContentService & OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>) | undefined;
1298
+ declare function createOIMSlotCollectionIndexService<TEntity extends object, TSourceKey extends NonNullable<unknown>, const TColumns extends readonly TOIMEntityColumnName<TEntity>[] = readonly TOIMEntityColumnName<TEntity>[], TKey extends TOIMStoreKey = [TOIMIndexKey<TEntity, TColumns>] extends [TOIMStoreKey] ? Extract<TOIMIndexKey<TEntity, TColumns>, TOIMStoreKey> : never, TSourceStore = unknown, TSlots = TOIMBucketSlotsArrayStore<TOIMEntitySlot<TEntity>>, TSlotContentService extends OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots, TKey> = OIMSlotContentPositionalArrayBucketService<TOIMEntitySlot<TEntity>, TKey> & OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots, TKey>>(db: OIMDB, options: TOIMSlotCollectionIndexServiceFactoryOptions<TEntity, TSourceKey, TSourceStore> & {
1299
+ slotContentService?: (TSlotContentService & OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots, TKey>) | undefined;
1191
1300
  bucketSlotStoreService?: undefined;
1192
- } & TOIMIndexKeyOptions<TKey, TEntity, TColumns>): OIMIndexService<TKey, TEntity, TSlots, TSourceKey, TSourceStore, TSlotContentService, TOIMBucketSlot<TSlots, TKey>, Map<TKey, TOIMBucketSlot<TSlots, TKey>>>;
1193
- declare function createOIMIndexService<TEntity extends object, TSourceKey, const TColumns extends readonly TOIMEntityColumnName<TEntity>[] = readonly TOIMEntityColumnName<TEntity>[], TKey extends TOIMStoreKey | readonly TOIMStoreKey[] = TOIMStoreKey, TSourceStore = unknown, TSlots = TOIMBucketSlotsArrayStore<TOIMEntitySlot<TEntity>>, TSlotContentService extends OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots> = OIMSlotContentBucketServiceArrayDriven<TOIMEntitySlot<TEntity>> & OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>, TStore = Map<TKey, TOIMBucketSlot<TSlots, TKey>>>(db: OIMDB, options: TOIMIndexServiceFactoryOptions<TEntity, TSourceKey, TSourceStore> & {
1194
- slotContentService?: (TSlotContentService & OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>) | undefined;
1301
+ } & TOIMIndexKeyOptions<TKey, TEntity, TColumns>): OIMSlotCollectionIndexService<TKey, TEntity, TSlots, TSourceKey, TSourceStore, TSlotContentService, TOIMBucketSlot<TSlots, TKey>, Map<TKey, TOIMBucketSlot<TSlots, TKey>>>;
1302
+ declare function createOIMSlotCollectionIndexService<TEntity extends object, TSourceKey extends NonNullable<unknown>, const TColumns extends readonly TOIMEntityColumnName<TEntity>[] = readonly TOIMEntityColumnName<TEntity>[], TKey extends TOIMStoreKey | readonly TOIMStoreKey[] = TOIMStoreKey, TSourceStore = unknown, TSlots = TOIMBucketSlotsArrayStore<TOIMEntitySlot<TEntity>>, TSlotContentService extends OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots, TKey> = OIMSlotContentPositionalArrayBucketService<TOIMEntitySlot<TEntity>, TKey> & OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots, TKey>, TStore = Map<TKey, TOIMBucketSlot<TSlots, TKey>>>(db: OIMDB, options: TOIMSlotCollectionIndexServiceFactoryOptions<TEntity, TSourceKey, TSourceStore> & {
1303
+ slotContentService?: (TSlotContentService & OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots, TKey>) | undefined;
1195
1304
  bucketSlotStoreService: IOIMSlotStoreService<TKey, TOIMBucketSlot<TSlots, TKey>, TStore>;
1196
- } & TOIMIndexKeyOptions<TKey, TEntity, TColumns>): OIMIndexService<TKey, TEntity, TSlots, TSourceKey, TSourceStore, TSlotContentService, TOIMBucketSlot<TSlots, TKey>, TStore>;
1197
-
1198
- type TOIMCompositeKeyNode<TAtKey = unknown, TCompositeKeyPart = TOIMEntitySlot> = {
1199
- childNodes: Map<TCompositeKeyPart, TOIMCompositeKeyNode<TAtKey, TCompositeKeyPart>> | undefined;
1200
- atThisKey: TAtKey | undefined;
1201
- };
1202
-
1203
- type TOIMSlotStoreTree<TSlot, TCompositeKeyPart> = {
1204
- readonly root: TOIMCompositeKeyNode<TSlot, TCompositeKeyPart>;
1205
- readonly slots: Set<TSlot>;
1206
- };
1207
-
1208
- declare function createOIMIndexServiceByCompositeKey<TEntity extends object, TSourceKey, const TColumns extends readonly TOIMEntityColumnName<TEntity>[] = readonly TOIMEntityColumnName<TEntity>[], TKey extends readonly TOIMStoreKey[] = Extract<TOIMIndexKey<TEntity, TColumns>, readonly TOIMStoreKey[]>, TSourceStore = unknown, TSlots = TOIMBucketSlotsArrayStore<TOIMEntitySlot<TEntity>>, TSlotContentService extends OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots> = OIMSlotContentBucketServiceArrayDriven<TOIMEntitySlot<TEntity>> & OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>>(db: OIMDB, options: TOIMIndexServiceFactoryOptions<TEntity, TSourceKey, TSourceStore> & {
1209
- columns: [TKey] extends [never] ? never : TColumns;
1210
- slotContentService?: (TSlotContentService & OIMSlotContentBucketService<TOIMEntitySlot<TEntity>, TSlots>) | undefined;
1211
- }): OIMIndexService<TKey, TEntity, TSlots, TSourceKey, TSourceStore, TSlotContentService, TOIMBucketSlot<TSlots, TKey>, TOIMSlotStoreTree<TOIMBucketSlot<TSlots, TKey>, TOIMStoreKey>>;
1305
+ } & TOIMIndexKeyOptions<TKey, TEntity, TColumns>): OIMSlotCollectionIndexService<TKey, TEntity, TSlots, TSourceKey, TSourceStore, TSlotContentService, TOIMBucketSlot<TSlots, TKey>, TStore>;
1212
1306
 
1213
- declare function createOIMIndexServiceSortedArrayDriven<TEntity extends object, TSourceKey, const TColumns extends readonly TOIMEntityColumnName<TEntity>[] = readonly TOIMEntityColumnName<TEntity>[], TKey extends TOIMStoreKey = [TOIMIndexKey<TEntity, TColumns>] extends [TOIMStoreKey] ? Extract<TOIMIndexKey<TEntity, TColumns>, TOIMStoreKey> : never, TSourceStore = unknown, TStore = Map<TKey, TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TOIMEntitySlot<TEntity>>, TKey>>>(db: OIMDB, options: TOIMIndexServiceFactoryOptions<TEntity, TSourceKey, TSourceStore> & {
1307
+ declare function createOIMSlotCollectionSortedArrayIndexService<TEntity extends object, TSourceKey extends NonNullable<unknown>, const TColumns extends readonly TOIMEntityColumnName<TEntity>[] = readonly TOIMEntityColumnName<TEntity>[], TKey extends TOIMStoreKey = [TOIMIndexKey<TEntity, TColumns>] extends [TOIMStoreKey] ? Extract<TOIMIndexKey<TEntity, TColumns>, TOIMStoreKey> : never, TSourceStore = unknown, TStore = Map<TKey, TOIMBucketSlot<TOIMBucketSlotsArrayStore<TOIMEntitySlot<TEntity>>, TKey>>>(db: OIMDB, options: TOIMSlotCollectionIndexServiceFactoryOptions<TEntity, TSourceKey, TSourceStore> & {
1214
1308
  sortColumns: readonly TOIMSortColumn<TEntity>[];
1215
- bucketSlotStoreService?: IOIMSlotStoreService<TKey, TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TOIMEntitySlot<TEntity>>, TKey>, TStore> | undefined;
1216
- } & TOIMIndexKeyOptions<TKey, TEntity, TColumns>): OIMIndexServiceSortedArrayDriven<TKey, TEntity, TSourceKey, TSourceStore, TOIMBucketSlot<TOIMBucketSlotsSortedArrayStore<TOIMEntitySlot<TEntity>>, TKey>, TStore>;
1309
+ bucketSlotStoreService?: IOIMSlotStoreService<TKey, TOIMBucketSlot<TOIMBucketSlotsArrayStore<TOIMEntitySlot<TEntity>>, TKey>, TStore> | undefined;
1310
+ } & TOIMIndexKeyOptions<TKey, TEntity, TColumns>): OIMSlotCollectionSortedArrayIndexService<TKey, TEntity, TSourceKey, TSourceStore, TOIMBucketSlot<TOIMBucketSlotsArrayStore<TOIMEntitySlot<TEntity>>, TKey>, TStore>;
1217
1311
 
1218
1312
  type TOIMFactoryOptions<TClassOptions, TFilledByDb extends PropertyKey, TDefaulted extends PropertyKey> = Omit<TClassOptions, TFilledByDb | TDefaulted> & {
1219
1313
  [TName in TDefaulted & keyof TClassOptions]?: TClassOptions[TName] | undefined;
@@ -1229,28 +1323,28 @@ declare abstract class OIMIndexKeysService implements IOIMIndexKeysService {
1229
1323
  set<TIndexKey>(slot: TOIMIndexableSlot, position: number, indexKey: TIndexKey | undefined): void;
1230
1324
  }
1231
1325
 
1232
- declare class OIMIndexKeysServiceAppending extends OIMIndexKeysService {
1233
- static readonly INSTANCE: OIMIndexKeysServiceAppending;
1326
+ declare class OIMAppendingIndexKeysService extends OIMIndexKeysService {
1327
+ static readonly INSTANCE: OIMAppendingIndexKeysService;
1234
1328
  allocatePosition(positions: TOIMIndexKeysPositions): number;
1235
1329
  releasePosition(): void;
1236
1330
  }
1237
1331
 
1238
- declare class OIMIndexKeysServiceReclaiming extends OIMIndexKeysService {
1332
+ declare class OIMReclaimingIndexKeysService extends OIMIndexKeysService {
1239
1333
  allocatePosition(positions: TOIMIndexKeysPositions): number;
1240
1334
  releasePosition(positions: TOIMIndexKeysPositions, position: number, slots: Iterable<TOIMIndexableSlot>): void;
1241
1335
  }
1242
1336
 
1243
- type TOIMEntityInsertStrategy = <TEntity extends object>(slot: TOIMEntitySlot<TEntity>, entity: TEntity) => void;
1337
+ type TOIMEntityInserter = <TEntity extends object>(slot: TOIMEntityContentSlot<TEntity>, entity: TEntity) => void;
1244
1338
 
1245
- declare function oimPutEntityColumns(slot: TOIMEntitySlot, entity: object, sameValueGuard: TOIMSameValueGuard, changedColumnNames: string[] | undefined, targetOf: (entity: Record<string, unknown>) => Record<string, unknown>): Record<string, unknown> | undefined;
1339
+ declare function oimPutEntityColumns(slot: TOIMEntityContentSlot, entity: object, sameValueGuard: TOIMSameValueGuard, changedColumnNames: string[] | undefined, targetOf: (entity: Record<string, unknown>) => Record<string, unknown>): Record<string, unknown> | undefined;
1246
1340
 
1247
- declare function oimPatchEntityColumns(slot: TOIMEntitySlot, patch: object, sameValueGuard: TOIMSameValueGuard, changedColumnNames: string[] | undefined, targetOf: (entity: Record<string, unknown>) => Record<string, unknown>): Record<string, unknown> | undefined;
1341
+ declare function oimPatchEntityColumns(slot: TOIMEntityContentSlot, patch: object, sameValueGuard: TOIMSameValueGuard, changedColumnNames: string[] | undefined, targetOf: (entity: Record<string, unknown>) => Record<string, unknown>): Record<string, unknown> | undefined;
1248
1342
 
1249
- declare function oimPatchEntityColumn(slot: TOIMEntitySlot, columnName: string, value: unknown, sameValueGuard: TOIMSameValueGuard, changedColumnNames: string[] | undefined, targetOf: (entity: Record<string, unknown>) => Record<string, unknown>): Record<string, unknown> | undefined;
1343
+ declare function oimPatchEntityColumn(slot: TOIMEntityContentSlot, columnName: string, value: unknown, sameValueGuard: TOIMSameValueGuard, changedColumnNames: string[] | undefined, targetOf: (entity: Record<string, unknown>) => Record<string, unknown>): Record<string, unknown> | undefined;
1250
1344
 
1251
1345
  type TOIMEntityWriterOptions = {
1252
1346
  sameValueGuard?: TOIMSameValueGuard | undefined;
1253
- entityInsertStrategy?: TOIMEntityInsertStrategy | undefined;
1347
+ entityInserter?: TOIMEntityInserter | undefined;
1254
1348
  putEntityColumns?: typeof oimPutEntityColumns | undefined;
1255
1349
  patchEntityColumns?: typeof oimPatchEntityColumns | undefined;
1256
1350
  patchEntityColumn?: typeof oimPatchEntityColumn | undefined;
@@ -1260,11 +1354,11 @@ declare function createOIMEntityWriterInPlace(options?: TOIMEntityWriterOptions)
1260
1354
 
1261
1355
  declare function createOIMEntityWriterReplacing(options?: TOIMEntityWriterOptions): IOIMEntityWriter;
1262
1356
 
1263
- declare function oimInsertEntityWithoutCopy<TEntity extends object>(slot: TOIMEntitySlot<TEntity>, entity: TEntity): void;
1357
+ declare function oimInsertEntityWithoutCopy<TEntity extends object>(slot: TOIMEntityContentSlot<TEntity>, entity: TEntity): void;
1264
1358
 
1265
- declare function oimInsertEntityWithCopy<TEntity extends object>(slot: TOIMEntitySlot<TEntity>, entity: TEntity): void;
1359
+ declare function oimInsertEntityWithCopy<TEntity extends object>(slot: TOIMEntityContentSlot<TEntity>, entity: TEntity): void;
1266
1360
 
1267
- declare function oimInsertEntityWithSanitizedCopy<TEntity extends object>(slot: TOIMEntitySlot<TEntity>, entity: TEntity): void;
1361
+ declare function oimInsertEntityWithSanitizedCopy<TEntity extends object>(slot: TOIMEntityContentSlot<TEntity>, entity: TEntity): void;
1268
1362
 
1269
1363
  declare const oimPatchEntityColumnsGuarded: typeof oimPatchEntityColumns;
1270
1364
 
@@ -1272,62 +1366,45 @@ declare const oimPatchEntityColumnGuarded: typeof oimPatchEntityColumn;
1272
1366
 
1273
1367
  declare const oimPutEntityColumnsGuarded: typeof oimPutEntityColumns;
1274
1368
 
1275
- declare abstract class OIMReleaseSlotCollectorService extends OIMFlushSchedulerService<TOIMReleaseSlotCollectorSlot> {
1276
- abstract readonly getReleaseDueMs: (slot: TOIMSlot) => number;
1277
- protected abstract readonly setReleaseDueMs: (slot: TOIMSlot, releaseDueMs: number) => void;
1278
- abstract getReleaseSlotCollectorSlot(collectorSlot: TOIMCollectorSlot): TOIMReleaseSlotCollectorSlot;
1279
- getReleaseSlotCollectorSlotOf(slot: TOIMSlot): TOIMReleaseSlotCollectorSlot;
1280
- markSlotReleaseDue(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot, slot: TOIMSlot, keepMs: number): number;
1281
- scheduleSlotRelease(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot, slot: TOIMSlot, nowMs: number): void;
1282
- isSlotReleasable(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot, slot: TOIMSlot): boolean;
1283
- cancelSlotRelease(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot, slot: TOIMSlot): void;
1284
- scheduleNextRelease(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot): void;
1285
- protected cancelSchedule(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot): void;
1286
- flush(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot): void;
1287
- protected onSchedulerTimerFired(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot): void;
1288
- cancelAllSlotReleases(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot): void;
1289
- }
1290
-
1291
- declare function createOIMReleaseSlotCollectorSlot(options: TOIMCollectorSlotOptions): TOIMReleaseSlotCollectorSlot;
1292
-
1293
- declare class OIMReleaseSlotQueueService {
1294
- static readonly INSTANCE: OIMReleaseSlotQueueService;
1295
- scheduleSlotRelease(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot, releaseSlotCollectorService: OIMReleaseSlotCollectorService, slot: TOIMSlot, nowMs: number): void;
1296
- cancelSlotRelease(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot, slot: TOIMSlot): void;
1297
- getNextReleaseSliceNumber(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot): number | undefined;
1298
- cancelAllSlotReleases(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot): void;
1299
- isSlotReleaseScheduled(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot, slot: TOIMSlot): boolean;
1300
- releaseDueUpToSliceNumber(releaseSlotCollectorSlot: TOIMReleaseSlotCollectorSlot, releaseSlotCollectorService: OIMReleaseSlotCollectorService, upToSliceNumber: number): void;
1301
- private releaseSlice;
1302
- private removeFromSliceNumber;
1303
- private updateNextSliceNumber;
1304
- private invalidateNextSliceNumber;
1305
- private addToSliceNumber;
1306
- }
1307
-
1308
- declare class OIMReleaseSlotCollectorServiceAfterIdle extends OIMReleaseSlotCollectorService {
1309
- static readonly INSTANCE: OIMReleaseSlotCollectorServiceAfterIdle;
1310
- readonly getReleaseDueMs: (slot: TOIMSlot) => number;
1311
- protected readonly setReleaseDueMs: (slot: TOIMSlot, releaseDueMs: number) => void;
1312
- getReleaseSlotCollectorSlot(collectorSlot: TOIMCollectorSlot): TOIMReleaseSlotCollectorSlot;
1369
+ declare function oimMintAfterWriteSlotReleaseWheel(collectorSlot: TOIMCollectorSlot): OIMSlotReleaseWheel;
1370
+
1371
+ declare function oimMintAfterIdleSlotReleaseWheel(collectorSlot: TOIMCollectorSlot): OIMSlotReleaseWheel;
1372
+
1373
+ declare function oimMintAfterUnholdSlotReleaseWheel(collectorSlot: TOIMCollectorSlot): OIMSlotReleaseWheel;
1374
+
1375
+ interface IOIMSlotRefetchListener {
1376
+ onSlotsRefetchDue(slots: readonly TOIMSlot[]): void;
1313
1377
  }
1314
1378
 
1315
- declare class OIMReleaseSlotCollectorServiceAfterWrite extends OIMReleaseSlotCollectorService {
1316
- static readonly INSTANCE: OIMReleaseSlotCollectorServiceAfterWrite;
1317
- readonly getReleaseDueMs: (slot: TOIMSlot) => number;
1318
- protected readonly setReleaseDueMs: (slot: TOIMSlot, releaseDueMs: number) => void;
1319
- getReleaseSlotCollectorSlot(collectorSlot: TOIMCollectorSlot): TOIMReleaseSlotCollectorSlot;
1379
+ type TOIMSlotRefetchWheelOptions = Partial<TOIMSlotWheelOptions> & {
1380
+ slotRefetchListener: IOIMSlotRefetchListener;
1381
+ };
1382
+
1383
+ declare class OIMSlotRefetchWheel extends OIMSlotWheel {
1384
+ private readonly slotRefetchListener;
1385
+ private readonly refetchDueSlots;
1386
+ constructor(options: TOIMSlotRefetchWheelOptions);
1387
+ scheduleSlotRefetchAt(slot: TOIMSlot, atMs: number): void;
1388
+ protected getSweptSliceNumberAt(nowMs: number): number;
1389
+ protected onSlotDue(slot: TOIMSlot): void;
1390
+ protected onSweepFinished(): void;
1391
+ }
1392
+
1393
+ interface IOIMSlotReleaseDueFramePolicy {
1394
+ isSlotReleaseDueFrameOpen(): boolean;
1320
1395
  }
1321
1396
 
1322
- type TOIMSlotReleasePolicyAfterWriteOptions = {
1397
+ type TOIMSlotAfterWriteReleasePolicyOptions = {
1323
1398
  keepAfterWriteMs: number;
1399
+ slotReleaseDueFramePolicy?: IOIMSlotReleaseDueFramePolicy;
1324
1400
  };
1325
1401
 
1326
- declare class OIMSlotReleasePolicyAfterWrite implements IOIMSlotReleasePolicy {
1402
+ declare class OIMSlotAfterWriteReleasePolicy implements IOIMSlotReleasePolicy {
1327
1403
  readonly releasesWrittenSlots = true;
1328
1404
  readonly schedulesReleaseOnWrite = true;
1329
1405
  private readonly keepAfterWriteMs;
1330
- constructor(options: TOIMSlotReleasePolicyAfterWriteOptions);
1406
+ private readonly slotReleaseDueFramePolicy;
1407
+ constructor(options: TOIMSlotAfterWriteReleasePolicyOptions);
1331
1408
  onSlotWritten(slot: TOIMSlot): void;
1332
1409
  onSlotIdle(slot: TOIMSlot): boolean;
1333
1410
  onSlotUnheld(): void;
@@ -1336,15 +1413,28 @@ declare class OIMSlotReleasePolicyAfterWrite implements IOIMSlotReleasePolicy {
1336
1413
  cancelSlotRelease(slot: TOIMSlot): void;
1337
1414
  }
1338
1415
 
1339
- type TOIMSlotReleasePolicyAfterIdleOptions = {
1416
+ declare class OIMSlotReleaseAutoDueFramePolicy implements IOIMSlotReleaseDueFramePolicy {
1417
+ static readonly INSTANCE: OIMSlotReleaseAutoDueFramePolicy;
1418
+ isSlotReleaseDueFrameOpen(): boolean;
1419
+ }
1420
+
1421
+ declare class OIMSlotReleaseManualDueFramePolicy implements IOIMSlotReleaseDueFramePolicy {
1422
+ private slotReleaseDueFrameDepth;
1423
+ isSlotReleaseDueFrameOpen(): boolean;
1424
+ openSlotReleaseDueFrame(): void;
1425
+ closeSlotReleaseDueFrame(): void;
1426
+ writeInSlotReleaseDueFrame(write: () => void): void;
1427
+ }
1428
+
1429
+ type TOIMSlotAfterIdleReleasePolicyOptions = {
1340
1430
  keepAfterIdleMs: number;
1341
1431
  };
1342
1432
 
1343
- declare class OIMSlotReleasePolicyAfterIdle implements IOIMSlotReleasePolicy {
1433
+ declare class OIMSlotAfterIdleReleasePolicy implements IOIMSlotReleasePolicy {
1344
1434
  readonly releasesWrittenSlots = true;
1345
1435
  readonly schedulesReleaseOnWrite = true;
1346
1436
  private readonly keepAfterIdleMs;
1347
- constructor(options: TOIMSlotReleasePolicyAfterIdleOptions);
1437
+ constructor(options: TOIMSlotAfterIdleReleasePolicyOptions);
1348
1438
  onSlotWritten(): void;
1349
1439
  onSlotIdle(slot: TOIMSlot): boolean;
1350
1440
  onSlotUnheld(): void;
@@ -1353,8 +1443,8 @@ declare class OIMSlotReleasePolicyAfterIdle implements IOIMSlotReleasePolicy {
1353
1443
  cancelSlotRelease(slot: TOIMSlot): void;
1354
1444
  }
1355
1445
 
1356
- declare class OIMSlotReleasePolicyAtUnhold implements IOIMSlotReleasePolicy {
1357
- static readonly INSTANCE: OIMSlotReleasePolicyAtUnhold;
1446
+ declare class OIMSlotAtUnholdReleasePolicy implements IOIMSlotReleasePolicy {
1447
+ static readonly INSTANCE: OIMSlotAtUnholdReleasePolicy;
1358
1448
  readonly releasesWrittenSlots = true;
1359
1449
  readonly schedulesReleaseOnWrite = false;
1360
1450
  onSlotWritten(): void;
@@ -1365,8 +1455,8 @@ declare class OIMSlotReleasePolicyAtUnhold implements IOIMSlotReleasePolicy {
1365
1455
  cancelSlotRelease(): void;
1366
1456
  }
1367
1457
 
1368
- declare class OIMSlotReleasePolicyAtEmpty implements IOIMSlotReleasePolicy {
1369
- static readonly INSTANCE: OIMSlotReleasePolicyAtEmpty;
1458
+ declare class OIMSlotAtEmptyReleasePolicy implements IOIMSlotReleasePolicy {
1459
+ static readonly INSTANCE: OIMSlotAtEmptyReleasePolicy;
1370
1460
  readonly releasesWrittenSlots = false;
1371
1461
  readonly schedulesReleaseOnWrite = false;
1372
1462
  onSlotWritten(): void;
@@ -1377,8 +1467,8 @@ declare class OIMSlotReleasePolicyAtEmpty implements IOIMSlotReleasePolicy {
1377
1467
  cancelSlotRelease(): void;
1378
1468
  }
1379
1469
 
1380
- declare class OIMSlotReleasePolicyNever implements IOIMSlotReleasePolicy {
1381
- static readonly INSTANCE: OIMSlotReleasePolicyNever;
1470
+ declare class OIMSlotNeverReleasePolicy implements IOIMSlotReleasePolicy {
1471
+ static readonly INSTANCE: OIMSlotNeverReleasePolicy;
1382
1472
  readonly releasesWrittenSlots = false;
1383
1473
  readonly schedulesReleaseOnWrite = false;
1384
1474
  onSlotWritten(): void;
@@ -1389,15 +1479,15 @@ declare class OIMSlotReleasePolicyNever implements IOIMSlotReleasePolicy {
1389
1479
  cancelSlotRelease(): void;
1390
1480
  }
1391
1481
 
1392
- type TOIMSlotReleasePolicyAfterUnholdOptions = {
1482
+ type TOIMSlotAfterUnholdReleasePolicyOptions = {
1393
1483
  keepAfterUnholdMs: number;
1394
1484
  };
1395
1485
 
1396
- declare class OIMSlotReleasePolicyAfterUnhold implements IOIMSlotReleasePolicy {
1486
+ declare class OIMSlotAfterUnholdReleasePolicy implements IOIMSlotReleasePolicy {
1397
1487
  readonly releasesWrittenSlots = true;
1398
1488
  readonly schedulesReleaseOnWrite = false;
1399
1489
  private readonly keepAfterUnholdMs;
1400
- constructor(options: TOIMSlotReleasePolicyAfterUnholdOptions);
1490
+ constructor(options: TOIMSlotAfterUnholdReleasePolicyOptions);
1401
1491
  onSlotWritten(): void;
1402
1492
  onSlotIdle(): boolean;
1403
1493
  onSlotUnheld(slot: TOIMSlot): void;
@@ -1406,14 +1496,7 @@ declare class OIMSlotReleasePolicyAfterUnhold implements IOIMSlotReleasePolicy {
1406
1496
  cancelSlotRelease(slot: TOIMSlot): void;
1407
1497
  }
1408
1498
 
1409
- declare class OIMReleaseSlotCollectorServiceAfterUnhold extends OIMReleaseSlotCollectorService {
1410
- static readonly INSTANCE: OIMReleaseSlotCollectorServiceAfterUnhold;
1411
- readonly getReleaseDueMs: (slot: TOIMSlot) => number;
1412
- protected readonly setReleaseDueMs: (slot: TOIMSlot, releaseDueMs: number) => void;
1413
- getReleaseSlotCollectorSlot(collectorSlot: TOIMCollectorSlot): TOIMReleaseSlotCollectorSlot;
1414
- }
1415
-
1416
- declare class OIMSlotReleasePolicyEarliest implements IOIMSlotReleasePolicy {
1499
+ declare class OIMSlotEarliestReleasePolicy implements IOIMSlotReleasePolicy {
1417
1500
  readonly releasesWrittenSlots: boolean;
1418
1501
  readonly schedulesReleaseOnWrite: boolean;
1419
1502
  private readonly slotReleasePolicies;
@@ -1431,25 +1514,37 @@ declare const oimSliceOfMs: (ms: number) => number;
1431
1514
 
1432
1515
  declare const OIM_SLICE_LENGTH_MS = 1024;
1433
1516
 
1434
- declare class OIMSlotStoreServiceMapDriven<TSlot extends TOIMKeyedSlot<TKey>, TKey = TSlot extends TOIMKeyedSlot<infer TSlotKey> ? TSlotKey : TOIMStoreKey> implements IOIMSlotStoreService<TKey, TSlot, Map<TKey, TSlot>> {
1435
- static readonly INSTANCE: OIMSlotStoreServiceMapDriven<TOIMKeyedSlot<unknown>, unknown>;
1517
+ declare class OIMSlotMapStoreService<TSlot extends TOIMKeyedSlot<TKey>, TKey extends NonNullable<unknown> = TSlot extends TOIMKeyedSlot<infer TSlotKey> ? TSlotKey : TOIMStoreKey> implements IOIMSlotStoreService<TKey, TSlot, Map<TKey, TSlot>> {
1518
+ static readonly INSTANCE: OIMSlotMapStoreService<TOIMKeyedSlot, {}>;
1436
1519
  createStore(): Map<TKey, TSlot>;
1437
1520
  ownKey<TOwnedKey extends TKey>(key: TOwnedKey): TOwnedKey;
1438
1521
  isSameKey(key: TKey, otherKey: TKey): boolean;
1439
1522
  get(store: Map<TKey, TSlot>, key: TKey): TSlot | undefined;
1440
1523
  set(store: Map<TKey, TSlot>, key: TKey, slot: TSlot): void;
1441
1524
  remove(store: Map<TKey, TSlot>, key: TKey): void;
1525
+ fileSlot(store: Map<TKey, TSlot>, slot: TSlot): void;
1526
+ unfileSlot(store: Map<TKey, TSlot>, slot: TSlot): void;
1442
1527
  getSlots(store: Map<TKey, TSlot>): IterableIterator<TSlot>;
1443
1528
  getSlotCount(store: Map<TKey, TSlot>): number;
1444
1529
  }
1445
1530
 
1531
+ type TOIMCompositeKeyNode<TAtKey = unknown, TCompositeKeyPart = TOIMEntitySlot> = {
1532
+ childNodes: Map<TCompositeKeyPart, TOIMCompositeKeyNode<TAtKey, TCompositeKeyPart>> | undefined;
1533
+ atThisKey: TAtKey | undefined;
1534
+ };
1535
+
1446
1536
  interface IOIMKeyTreeWalk<TCompositeKeyPart> {
1447
1537
  mintNodeAt<TAtKey>(rootCompositeKeyNode: TOIMCompositeKeyNode<TAtKey, TCompositeKeyPart>, compositeKey: readonly TCompositeKeyPart[]): TOIMCompositeKeyNode<TAtKey, TCompositeKeyPart>;
1448
1538
  nodeAt<TAtKey>(rootCompositeKeyNode: TOIMCompositeKeyNode<TAtKey, TCompositeKeyPart>, compositeKey: readonly TCompositeKeyPart[]): TOIMCompositeKeyNode<TAtKey, TCompositeKeyPart> | undefined;
1449
1539
  deleteKey<TAtKey>(rootCompositeKeyNode: TOIMCompositeKeyNode<TAtKey, TCompositeKeyPart>, compositeKey: readonly TCompositeKeyPart[]): TAtKey | undefined;
1450
1540
  }
1451
1541
 
1452
- declare class OIMSlotStoreServiceTreeDriven<TCompositeKeyPart, TSlot extends TOIMKeyedSlot<readonly TCompositeKeyPart[]>> implements IOIMSlotStoreService<readonly TCompositeKeyPart[], TSlot, TOIMSlotStoreTree<TSlot, TCompositeKeyPart>> {
1542
+ type TOIMSlotStoreTree<TSlot, TCompositeKeyPart> = {
1543
+ readonly root: TOIMCompositeKeyNode<TSlot, TCompositeKeyPart>;
1544
+ readonly slots: Set<TSlot>;
1545
+ };
1546
+
1547
+ declare class OIMSlotTreeStoreService<TCompositeKeyPart, TSlot extends TOIMKeyedSlot<readonly TCompositeKeyPart[]>> implements IOIMSlotStoreService<readonly TCompositeKeyPart[], TSlot, TOIMSlotStoreTree<TSlot, TCompositeKeyPart>> {
1453
1548
  private readonly keyTreeWalk;
1454
1549
  constructor(keyTreeWalk: IOIMKeyTreeWalk<TCompositeKeyPart>);
1455
1550
  createStore(): TOIMSlotStoreTree<TSlot, TCompositeKeyPart>;
@@ -1458,6 +1553,8 @@ declare class OIMSlotStoreServiceTreeDriven<TCompositeKeyPart, TSlot extends TOI
1458
1553
  get(slotStoreTree: TOIMSlotStoreTree<TSlot, TCompositeKeyPart>, compositeKey: readonly TCompositeKeyPart[]): TSlot | undefined;
1459
1554
  set(slotStoreTree: TOIMSlotStoreTree<TSlot, TCompositeKeyPart>, compositeKey: readonly TCompositeKeyPart[], slot: TSlot): void;
1460
1555
  remove(slotStoreTree: TOIMSlotStoreTree<TSlot, TCompositeKeyPart>, compositeKey: readonly TCompositeKeyPart[]): void;
1556
+ fileSlot(slotStoreTree: TOIMSlotStoreTree<TSlot, TCompositeKeyPart>, slot: TSlot): void;
1557
+ unfileSlot(slotStoreTree: TOIMSlotStoreTree<TSlot, TCompositeKeyPart>, slot: TSlot): void;
1461
1558
  getSlots(slotStoreTree: TOIMSlotStoreTree<TSlot, TCompositeKeyPart>): IterableIterator<TSlot>;
1462
1559
  getSlotCount(slotStoreTree: TOIMSlotStoreTree<TSlot, TCompositeKeyPart>): number;
1463
1560
  }
@@ -1470,41 +1567,18 @@ declare abstract class OIMKeyTreeWalk<TCompositeKeyPart> implements IOIMKeyTreeW
1470
1567
  deleteKey<TAtKey>(rootCompositeKeyNode: TOIMCompositeKeyNode<TAtKey, TCompositeKeyPart>, compositeKey: readonly TCompositeKeyPart[]): TAtKey | undefined;
1471
1568
  }
1472
1569
 
1473
- declare class OIMKeyTreeWalkComposite extends OIMKeyTreeWalk<TOIMEntitySlot> {
1474
- static readonly INSTANCE: OIMKeyTreeWalkComposite;
1570
+ declare class OIMCompositeKeyTreeWalk extends OIMKeyTreeWalk<TOIMEntitySlot> {
1571
+ static readonly INSTANCE: OIMCompositeKeyTreeWalk;
1475
1572
  protected holdCompositeKeyPart(entitySlot: TOIMEntitySlot): void;
1476
1573
  protected unholdCompositeKeyPart(entitySlot: TOIMEntitySlot): void;
1477
1574
  }
1478
1575
 
1479
- declare class OIMKeyTreeWalkScalar extends OIMKeyTreeWalk<TOIMStoreKey> {
1480
- static readonly INSTANCE: OIMKeyTreeWalkScalar;
1576
+ declare class OIMScalarKeyTreeWalk extends OIMKeyTreeWalk<TOIMStoreKey> {
1577
+ static readonly INSTANCE: OIMScalarKeyTreeWalk;
1481
1578
  protected holdCompositeKeyPart(): void;
1482
1579
  protected unholdCompositeKeyPart(): void;
1483
1580
  }
1484
1581
 
1485
- type TOIMBucketSlotsArrayUniqueStore<TBucketMemberSlot extends TOIMSlot = TOIMSlot> = TOIMBucketSlotsArrayStore<TBucketMemberSlot> & {
1486
- uniqueBucketMemberSlots: Set<TBucketMemberSlot>;
1487
- };
1488
-
1489
- declare class OIMBucketArrayMembershipNonUnique<TBucketMemberSlot extends TOIMSlot = TOIMSlot> implements IOIMBucketArrayMembership<TBucketMemberSlot, TOIMBucketSlotsArrayStore<TBucketMemberSlot>> {
1490
- static readonly INSTANCE: OIMBucketArrayMembershipNonUnique<TOIMSlot>;
1491
- createStore(): TOIMBucketSlotsArrayStore<TBucketMemberSlot>;
1492
- addSlot(): boolean;
1493
- removeSlot(): boolean;
1494
- hasSlot(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): boolean;
1495
- clearSlots(): void;
1496
- containsTheSameSequence(bucketSlotsArrayStore: TOIMBucketSlotsArrayStore<TBucketMemberSlot>, bucketMemberSlots: readonly TBucketMemberSlot[]): boolean;
1497
- }
1498
-
1499
- declare class OIMBucketArrayMembershipUnique<TBucketMemberSlot extends TOIMSlot = TOIMSlot> implements IOIMBucketArrayMembership<TBucketMemberSlot, TOIMBucketSlotsArrayUniqueStore<TBucketMemberSlot>> {
1500
- createStore(): TOIMBucketSlotsArrayUniqueStore<TBucketMemberSlot>;
1501
- addSlot(bucketSlotsArrayUniqueStore: TOIMBucketSlotsArrayUniqueStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): boolean;
1502
- removeSlot(bucketSlotsArrayUniqueStore: TOIMBucketSlotsArrayUniqueStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): boolean;
1503
- hasSlot(bucketSlotsArrayUniqueStore: TOIMBucketSlotsArrayUniqueStore<TBucketMemberSlot>, bucketMemberSlot: TBucketMemberSlot): boolean;
1504
- clearSlots(bucketSlotsArrayUniqueStore: TOIMBucketSlotsArrayUniqueStore<TBucketMemberSlot>): void;
1505
- containsTheSameSequence(bucketSlotsArrayUniqueStore: TOIMBucketSlotsArrayUniqueStore<TBucketMemberSlot>, bucketMemberSlots: readonly TBucketMemberSlot[]): boolean;
1506
- }
1507
-
1508
1582
  declare const OIM_NOTHING_WAS_INSERTED = -1;
1509
1583
 
1510
1584
  declare const OIM_NOTHING_WAS_REMOVED = -1;
@@ -1515,4 +1589,4 @@ declare const OIM_REMOVED_WITHOUT_A_POSITION = -2;
1515
1589
 
1516
1590
  declare function oimOrderedListCommandsOfTransition(prev: readonly TOIMSlot[], next: readonly TOIMSlot[], maxCommandsPerSlot?: number): TOIMOrderedListCommand[];
1517
1591
 
1518
- export { type IOIMBucketArrayMembership, type IOIMBucketCommands, type IOIMChannelMap, type IOIMComputedValueService, type IOIMContentChangeListener, type IOIMEffectService, type IOIMEntityWriter, type IOIMErrorPolicy, type IOIMIndexKeysService, type IOIMKeyTreeWalk, type IOIMSlotContentFlushStrategy, type IOIMSlotContentStrategy, type IOIMSlotEmptiness, type IOIMSlotOwner, type IOIMSlotReleasePolicy, type IOIMSlotStamp, type IOIMSlotStoreService, type IOIMStoreSlotListener, type IOIMSubframeCloseListener, OIMBucketArrayMembershipNonUnique, OIMBucketArrayMembershipUnique, OIMBucketCommands, type OIMChannelQueue, OIMChannelService, OIMColumnOwner, OIMColumnOwnerPullDriven, type OIMColumnOwnerPushDriven, OIMComputedService, OIMComputedServiceBucketMemo, OIMComputedServiceSorted, OIMComputedValueService, OIMContentChangeListenerService, OIMDB, OIMDefaultValue, OIMDefaults, OIMEffectService, type OIMEffectSourceTracker, OIMErrorPolicyLogAndContinue, OIMErrorPolicyThrowAtOnce, OIMFlushSchedulerService, OIMIndexKeysService, OIMIndexKeysServiceAppending, OIMIndexKeysServiceReclaiming, OIMIndexService, OIMIndexServiceSortedArrayDriven, OIMKeyTreeWalk, OIMKeyTreeWalkComposite, OIMKeyTreeWalkScalar, OIMReleaseSlotCollectorService, OIMReleaseSlotCollectorServiceAfterIdle, OIMReleaseSlotCollectorServiceAfterUnhold, OIMReleaseSlotCollectorServiceAfterWrite, OIMReleaseSlotQueueService, OIMSingleSlotService, OIMSlotCollectionService, OIMSlotColumnService, OIMSlotContentBucketService, OIMSlotContentBucketServiceArrayBased, OIMSlotContentBucketServiceArrayDriven, OIMSlotContentBucketServiceSetDriven, OIMSlotContentBucketServiceSortedArrayDriven, OIMSlotContentEntityService, OIMSlotOwner, type OIMSlotOwnerService, OIMSlotReleasePolicyAfterIdle, OIMSlotReleasePolicyAfterUnhold, OIMSlotReleasePolicyAfterWrite, OIMSlotReleasePolicyAtEmpty, OIMSlotReleasePolicyAtUnhold, OIMSlotReleasePolicyEarliest, OIMSlotReleasePolicyNever, OIMSlotStoreServiceMapDriven, OIMSlotStoreServiceSingleSlotDriven, OIMSlotStoreServiceTreeDriven, OIMStoreSlotListenerNone, OIMUnusedSlotCollectorService, OIM_FROZEN_EMPTY_SLOTS, OIM_NOTHING_WAS_INSERTED, OIM_NOTHING_WAS_REMOVED, OIM_REMOVED_WITHOUT_A_POSITION, OIM_SLICE_LENGTH_MS, type TOIMBucketCollectionFactoryArguments, type TOIMBucketCommandsOptions, type TOIMBucketMemoComputedSlot, type TOIMBucketSlot, type TOIMBucketSlotOwnerService, type TOIMBucketSlotsArrayStore, type TOIMBucketSlotsArrayUniqueStore, type TOIMBucketSlotsSetStore, type TOIMBucketSlotsSortedArrayStore, type TOIMChannelClock, type TOIMChannelFrame, type TOIMChannelScheduler, type TOIMChannelSlot, type TOIMChannelSlotOptions, type TOIMCollectorSlot, type TOIMCollectorSlotOptions, type TOIMColumnGroup, type TOIMColumnOwnerOptions, type TOIMColumnReaders, type TOIMColumnSlot, type TOIMCompositeKeyNode, type TOIMComputedColumnSlot, type TOIMComputedServiceBucketMemoOptions, type TOIMComputedServiceOptions, type TOIMComputedServiceSortedOptions, type TOIMComputedSlot, type TOIMComputedSources, type TOIMComputedStoreSlot, type TOIMComputedValueServiceOptions, type TOIMDBOptions, type TOIMDefaultSlotStore, type TOIMDerivation, type TOIMDisposer, type TOIMEffect, type TOIMEffectBody, type TOIMEffectBodyWithSourceTracking, type TOIMEntityColumnName, type TOIMEntityColumnValue, type TOIMEntityInsertStrategy, type TOIMEntitySlot, type TOIMEntitySlotOwnerService, type TOIMEntityWriterOptions, type TOIMErrorPolicyLogAndContinueOptions, type TOIMFactoryOptions, type TOIMFlushSchedulerSlot, type TOIMIndexKey, type TOIMIndexKeyOptions, type TOIMIndexKeysPositions, type TOIMIndexServiceFactoryOptions, type TOIMIndexServiceOptions, type TOIMIndexServiceStoreSlot, type TOIMIndexStoreSlot, type TOIMIndexableSlot, type TOIMKeyedSlot, type TOIMOrderedListCommand, type TOIMReleaseSlotCollectorSlot, type TOIMSameValueGuard, type TOIMSingleSlotServiceOptions, type TOIMSingleSlotStore, type TOIMSingleSlotStoreSlot, type TOIMSlot, type TOIMSlotCollectionServiceOptions, type TOIMSlotContentBucketServiceOptions, type TOIMSlotContentBucketServiceSortedArrayDrivenOptions, type TOIMSlotContentEntityServiceFactoryOptions, type TOIMSlotContentEntityServiceOptions, type TOIMSlotEditable, type TOIMSlotOwnerServiceOptions, type TOIMSlotReleasePolicyAfterIdleOptions, type TOIMSlotReleasePolicyAfterUnholdOptions, type TOIMSlotReleasePolicyAfterWriteOptions, type TOIMSlotStoreTree, type TOIMSortColumn, type TOIMSortableColumnName, type TOIMSortedComputedSlot, type TOIMStoreKey, type TOIMStoreSlot, type TOIMTimer, type TOIMUnusedSlotCollectorSlot, createOIMBucketService, createOIMChannelSlot, createOIMCollectorSlot, createOIMComputedService, createOIMComputedServiceBucketMemo, createOIMComputedServiceSorted, createOIMEntityService, createOIMEntityWriterInPlace, createOIMEntityWriterReplacing, createOIMIndexService, createOIMIndexServiceByCompositeKey, createOIMIndexServiceSortedArrayDriven, createOIMReleaseSlotCollectorSlot, createOIMSingleBucketService, createOIMSingleEntityService, createOIMSingleSlotService, createOIMSlotCollectionService, createOIMSlotContentEntityService, createOIMUnusedSlotCollectorSlot, oimColumnsComparator, oimHoldSlots, oimInsertEntityWithCopy, oimInsertEntityWithSanitizedCopy, oimInsertEntityWithoutCopy, oimIsAnySlotChangedAfter, oimIsSlotEmpty, oimIsSlotReleased, oimOrderedListCommandsOfTransition, oimPatchEntityColumn, oimPatchEntityColumnGuarded, oimPatchEntityColumns, oimPatchEntityColumnsGuarded, oimPutEntityColumns, oimPutEntityColumnsGuarded, oimRefreshSourceComputeds, oimSameKeySequence, oimSameSlotSequence, oimSameValueZeroGuard, oimSliceOfMs, oimUnholdSlotsIfAlive };
1592
+ export { type IOIMBucketCommands, type IOIMBucketMemberSlotsArrayService, type IOIMChannelMap, type IOIMComputedValueService, type IOIMContentChangeListener, type IOIMEffectService, type IOIMEntityWriter, type IOIMErrorPolicy, type IOIMFlushSchedulerListener, type IOIMIndexKeysService, type IOIMKeyTreeWalk, type IOIMKeyedSlotCreator, type IOIMSingleSlotCreator, type IOIMSlotContentService, type IOIMSlotContentWriter, type IOIMSlotEmptinessPolicy, type IOIMSlotFilingService, type IOIMSlotOwner, type IOIMSlotRefetchListener, type IOIMSlotReleaseDueFramePolicy, type IOIMSlotReleasePolicy, type IOIMSlotStamp, type IOIMSlotStoreService, type IOIMSlotSubscriptionListener, type IOIMStoreSlotListener, OIMAppendingIndexKeysService, OIMBucketCommands, OIMBucketMemberSlotsArrayService, OIMBucketMemoComputedService, OIMBucketUniqueMemberSlotsArrayService, type OIMChannelQueue, OIMChannelService, OIMColumnSlotOwner, OIMColumnSlotService, OIMCompositeKeyTreeWalk, OIMComputedService, OIMComputedValueService, OIMContentChangeListenerService, OIMDB, OIMDefaultValue, OIMDefaults, OIMEffectService, type OIMEffectSourceTracker, OIMFlushSchedulerService, OIMIndexKeysService, OIMKeyTreeWalk, OIMLogAndContinueErrorPolicy, OIMNoSlotSubscriptionListener, OIMNoStoreSlotListener, OIMPullColumnSlotOwner, type OIMPushColumnSlotOwner, OIMReclaimingIndexKeysService, OIMScalarKeyTreeWalk, OIMSingleComputedService, OIMSingleSlotService, OIMSingleSlotStoreService, OIMSlotAfterIdleReleasePolicy, OIMSlotAfterUnholdReleasePolicy, OIMSlotAfterWriteReleasePolicy, OIMSlotAtEmptyReleasePolicy, OIMSlotAtUnholdReleasePolicy, OIMSlotCollectionIndexService, OIMSlotCollectionService, OIMSlotCollectionSortedArrayIndexService, OIMSlotContentArrayBucketService, OIMSlotContentBucketService, type OIMSlotContentComputedService, OIMSlotContentEntityService, OIMSlotContentPositionalArrayBucketService, OIMSlotContentSetBucketService, OIMSlotContentSortedArrayBucketService, OIMSlotEarliestReleasePolicy, OIMSlotMapStoreService, OIMSlotNeverReleasePolicy, OIMSlotOwner, type OIMSlotOwnerService, OIMSlotRefetchWheel, OIMSlotReleaseAutoDueFramePolicy, OIMSlotReleaseManualDueFramePolicy, OIMSlotReleaseWheel, OIMSlotTreeStoreService, OIMSlotWheel, OIMSortedComputedService, OIMThrowAtOnceErrorPolicy, OIMUnusedSlotCollectorService, OIMWritableSingleSlotService, OIMWritableSlotCollectionService, OIM_FROZEN_EMPTY_SLOTS, OIM_NOTHING_WAS_INSERTED, OIM_NOTHING_WAS_REMOVED, OIM_REMOVED_WITHOUT_A_POSITION, OIM_SLICE_LENGTH_MS, type TOIMBucketCommandsOptions, type TOIMBucketContentSlot, type TOIMBucketMemoComputedServiceOptions, type TOIMBucketMemoComputedSlot, type TOIMBucketSlot, type TOIMBucketSlotOwnerService, type TOIMBucketSlotsArrayStore, type TOIMBucketSlotsSetStore, type TOIMChannelClock, type TOIMChannelFrame, type TOIMChannelScheduler, type TOIMChannelSlot, type TOIMChannelSlotOptions, type TOIMCollectorSlot, type TOIMCollectorSlotOptions, type TOIMColumnGroup, type TOIMColumnReaders, type TOIMColumnSlot, type TOIMColumnSlotOwnerOptions, type TOIMCompositeKeyNode, type TOIMComputedColumnSlot, type TOIMComputedContentSlot, type TOIMComputedDerivationOptions, type TOIMComputedServiceOptions, type TOIMComputedSlot, type TOIMComputedSources, type TOIMComputedStoreSlot, type TOIMComputedValueServiceOptions, type TOIMDBOptions, type TOIMDefaultSlotStore, type TOIMDerivation, type TOIMDisposer, type TOIMEffect, type TOIMEffectBody, type TOIMEffectBodyWithSourceTracking, type TOIMEntityColumnName, type TOIMEntityColumnValue, type TOIMEntityContentSlot, type TOIMEntityInserter, type TOIMEntitySlot, type TOIMEntitySlotOwnerService, type TOIMEntityWriterOptions, type TOIMFactoryOptions, type TOIMFlushSchedulerSlot, type TOIMIndexKey, type TOIMIndexKeyOptions, type TOIMIndexKeysPositions, type TOIMIndexStoreSlot, type TOIMIndexableSlot, type TOIMKeyedSlot, type TOIMLogAndContinueErrorPolicyOptions, type TOIMOrderedListCommand, type TOIMSameValueGuard, type TOIMSingleSlotServiceOptions, type TOIMSingleSlotStore, type TOIMSingleSlotStoreSlot, type TOIMSlot, type TOIMSlotAfterIdleReleasePolicyOptions, type TOIMSlotAfterUnholdReleasePolicyOptions, type TOIMSlotAfterWriteReleasePolicyOptions, type TOIMSlotCollectionIndexServiceFactoryOptions, type TOIMSlotCollectionIndexServiceOptions, type TOIMSlotCollectionIndexServiceStoreSlot, type TOIMSlotCollectionServiceOptions, type TOIMSlotContentArrayBucketServiceOptions, type TOIMSlotContentBucketServiceOptions, type TOIMSlotContentComputedServiceOptions, type TOIMSlotContentEntityServiceOptions, type TOIMSlotContentServiceContent, type TOIMSlotContentServiceKey, type TOIMSlotContentServicePatch, type TOIMSlotContentServiceSingleSlot, type TOIMSlotContentServiceSlot, type TOIMSlotContentSortedArrayBucketServiceOptions, type TOIMSlotEditable, type TOIMSlotOwnerServiceOptions, type TOIMSlotRefetchWheelOptions, type TOIMSlotReleaseWheelOptions, type TOIMSlotStoreTree, type TOIMSlotWheelOptions, type TOIMSortColumn, type TOIMSortableColumnName, type TOIMSortedComputedServiceOptions, type TOIMSortedComputedSlot, type TOIMStoreKey, type TOIMStoreSlot, type TOIMTimer, type TOIMUnusedSlotCollectorSlot, createOIMBucketMemoComputedService, createOIMChannelSlot, createOIMCollectorSlot, createOIMComputedService, createOIMEntityWriterInPlace, createOIMEntityWriterReplacing, createOIMSingleComputedService, createOIMSingleSlotService, createOIMSlotCollectionIndexService, createOIMSlotCollectionService, createOIMSlotCollectionSortedArrayIndexService, createOIMSlotContentEntityService, createOIMSortedComputedService, createOIMUnusedSlotCollectorSlot, oimColumnsComparator, oimHoldSlots, oimInsertEntityWithCopy, oimInsertEntityWithSanitizedCopy, oimInsertEntityWithoutCopy, oimIsAnySlotChangedAfter, oimIsSlotEmpty, oimIsSlotReleased, oimMintAfterIdleSlotReleaseWheel, oimMintAfterUnholdSlotReleaseWheel, oimMintAfterWriteSlotReleaseWheel, oimOrderedListCommandsOfTransition, oimPatchEntityColumn, oimPatchEntityColumnGuarded, oimPatchEntityColumns, oimPatchEntityColumnsGuarded, oimPutEntityColumns, oimPutEntityColumnsGuarded, oimRefreshSourceComputeds, oimSameKeySequence, oimSameSlotSequence, oimSameValueZeroGuard, oimSliceOfMs, oimUnholdSlotsIfAlive };