@oimdb/core 3.9.0 → 3.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -155,7 +155,8 @@ users.updateEventEmitter.subscribeOnKey('user1', () => {
155
155
  console.log('User1 changed!');
156
156
  });
157
157
 
158
- // Subscribe to multiple keys
158
+ // Subscribe to multiple keys. The handler is coalesced: it fires at most ONCE
159
+ // per flush, no matter how many of the subscribed keys changed in that flush.
159
160
  users.updateEventEmitter.subscribeOnKeys(['user1', 'user2'], () => {
160
161
  console.log('Users changed!');
161
162
  });
@@ -1479,6 +1480,22 @@ new OIMDerivedCollectionIndexSetBased(queue, collection, {
1479
1480
  - `rebuildFromCollection(): void` - Rebuild all derived membership from current collection slots
1480
1481
  - all read/subscription methods from `OIMReactiveCollectionIndexManualSetBased`
1481
1482
 
1483
+ #### `OIMDerivedCollection<TSource, TDerived, TPk>`
1484
+ A reactive collection whose entities are derived one-to-one from a source collection (`derived[pk] = derive(source[pk], pk)`, keyed by the source pk), kept in sync automatically. It *is* a first-class `OIMReactiveCollection`, so it can be indexed, selected, and derived-from again (join → join); maintenance runs on the source's synchronous update channel, so chains stay consistent within a flush. Needs no compute runtime.
1485
+
1486
+ **Constructor:**
1487
+ ```typescript
1488
+ new OIMDerivedCollection(queue, source, (entity: TSource, pk: TPk) => TDerived, {
1489
+ compare?: (a: TDerived, b: TDerived) => boolean; // default Object.is; skip update when unchanged
1490
+ store?: OIMCollectionStore<TDerived, TPk>; // trie-driven for a composite source PK
1491
+ buildInitial?: boolean; // defaults to true
1492
+ })
1493
+ ```
1494
+
1495
+ **Methods:**
1496
+ - `rebuildFromSource(): void` - Re-derive all entities from the current source
1497
+ - all read/write/subscription methods from `OIMReactiveCollection`
1498
+
1482
1499
  #### `OIMReactiveIndexManualArrayBased<TKey, TPk>`
1483
1500
  Reactive Array-based index with manual slot writes and change notifications. Use this as a raw slot-first primitive; use `OIMReactiveCollectionIndexManualArrayBased` for PK-oriented writes.
1484
1501