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