@oimdb/core 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -8
- package/dist/index.cjs +6 -6
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/llms.txt +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @oimdb/core
|
|
2
2
|
|
|
3
|
-
Core in-memory data library providing reactive collections, intelligent indexing, and configurable event processing.
|
|
3
|
+
Core in-memory data library providing reactive collections, intelligent indexing, and configurable event processing.
|
|
4
|
+
|
|
5
|
+
📖 **[Full documentation](https://abaikov.github.io/oimdb/)**
|
|
4
6
|
|
|
5
7
|
## For AI Assistants
|
|
6
8
|
|
|
@@ -92,7 +94,7 @@ Use the `dx` factories when you want a concise entrypoint without changing the u
|
|
|
92
94
|
|
|
93
95
|
```typescript
|
|
94
96
|
import {
|
|
95
|
-
|
|
97
|
+
createOIMCollectionKit,
|
|
96
98
|
OIMEventQueue,
|
|
97
99
|
OIMEventQueueSchedulerFactory
|
|
98
100
|
} from '@oimdb/core';
|
|
@@ -106,7 +108,7 @@ type User = {
|
|
|
106
108
|
const queue = new OIMEventQueue({
|
|
107
109
|
scheduler: OIMEventQueueSchedulerFactory.createMicrotask()
|
|
108
110
|
});
|
|
109
|
-
const users =
|
|
111
|
+
const users = createOIMCollectionKit<User, string>(queue, {
|
|
110
112
|
selectPk: user => user.id,
|
|
111
113
|
});
|
|
112
114
|
|
|
@@ -189,7 +191,7 @@ OIMDB provides two types of indexes optimized for different use cases:
|
|
|
189
191
|
|
|
190
192
|
Indexes are slot-backed internally and expose PK projections through `getPksByKey` (`Set<TPk>` for SetBased, `TPk[]` for ArrayBased). Raw indexes can be used as standalone PK/slot structures. When an index belongs to a collection, prefer `OIMReactiveCollectionIndexManual*`; it binds the collection at construction time so PK writes resolve canonical collection slots without a later lifecycle setter.
|
|
191
193
|
|
|
192
|
-
For most app-level entity relations, start with `
|
|
194
|
+
For most app-level entity relations, start with `createOIMCollectionKit(...).indexFactory.derivedSetIndex(...)` or `.derivedArrayIndex(...)`. The manual indexes below are the advanced path for externally maintained memberships such as search results, permissions, or server-provided order.
|
|
193
195
|
|
|
194
196
|
#### SetBased Indexes (for incremental updates)
|
|
195
197
|
|
|
@@ -1156,7 +1158,7 @@ npm install @oimdb/react
|
|
|
1156
1158
|
Create your collections outside React, wire them up once, then use hooks inside components:
|
|
1157
1159
|
|
|
1158
1160
|
```typescript
|
|
1159
|
-
import {
|
|
1161
|
+
import { createOIMCollectionKit, OIMEventQueue } from '@oimdb/core';
|
|
1160
1162
|
import {
|
|
1161
1163
|
OIMCollectionsProvider,
|
|
1162
1164
|
useOIMCollectionsContext,
|
|
@@ -1167,7 +1169,7 @@ import {
|
|
|
1167
1169
|
// --- store.ts (created once, outside React) ---
|
|
1168
1170
|
const queue = new OIMEventQueue();
|
|
1169
1171
|
const { collection: users, indexFactory } =
|
|
1170
|
-
|
|
1172
|
+
createOIMCollectionKit<User, string>(queue, { selectPk: (u) => u.id });
|
|
1171
1173
|
const byTeam = indexFactory.derivedSetIndex((u) => [u.teamId]);
|
|
1172
1174
|
export const collections = { users };
|
|
1173
1175
|
export { byTeam };
|
|
@@ -1266,11 +1268,11 @@ unsubscribe();
|
|
|
1266
1268
|
#### `createOIMReactiveCollection<TEntity, TPk>(queue, opts?)`
|
|
1267
1269
|
Creates an `OIMReactiveCollection<TEntity, TPk>` with less constructor noise.
|
|
1268
1270
|
|
|
1269
|
-
#### `
|
|
1271
|
+
#### `createOIMCollectionKit<TEntity, TPk>(queue, opts?)`
|
|
1270
1272
|
Creates a small facade:
|
|
1271
1273
|
|
|
1272
1274
|
```typescript
|
|
1273
|
-
type
|
|
1275
|
+
type TOIMCollectionKit<TEntity, TPk> = {
|
|
1274
1276
|
queue: OIMEventQueue;
|
|
1275
1277
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
1276
1278
|
relations: OIMCollectionRelations<TEntity, TPk>;
|
package/dist/index.cjs
CHANGED
|
@@ -93,8 +93,8 @@ __export(index_exports, {
|
|
|
93
93
|
OIMReactiveIndexSetBased: () => OIMReactiveIndexSetBased,
|
|
94
94
|
OIMReactiveObject: () => OIMReactiveObject,
|
|
95
95
|
OIMSelector: () => OIMSelector,
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
createOIMCollectionIndexFactory: () => createOIMCollectionIndexFactory,
|
|
97
|
+
createOIMCollectionKit: () => createOIMCollectionKit
|
|
98
98
|
});
|
|
99
99
|
module.exports = __toCommonJS(index_exports);
|
|
100
100
|
|
|
@@ -2967,8 +2967,8 @@ var OIMCollectionSelectors = class {
|
|
|
2967
2967
|
}
|
|
2968
2968
|
};
|
|
2969
2969
|
|
|
2970
|
-
// src/dx/
|
|
2971
|
-
function
|
|
2970
|
+
// src/dx/OIMCollectionKit.ts
|
|
2971
|
+
function createOIMCollectionKit(queue, opts) {
|
|
2972
2972
|
const collection = new OIMReactiveCollection(queue, opts);
|
|
2973
2973
|
const indexFactory = new OIMCollectionIndexFactory(queue, collection);
|
|
2974
2974
|
const select = new OIMCollectionSelectors(queue, collection);
|
|
@@ -3796,6 +3796,6 @@ var OIMIndexPksByKeysArrayBasedSelector = class extends OIMSelector {
|
|
|
3796
3796
|
OIMReactiveIndexSetBased,
|
|
3797
3797
|
OIMReactiveObject,
|
|
3798
3798
|
OIMSelector,
|
|
3799
|
-
|
|
3800
|
-
|
|
3799
|
+
createOIMCollectionIndexFactory,
|
|
3800
|
+
createOIMCollectionKit
|
|
3801
3801
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1064,14 +1064,14 @@ declare class OIMCollectionSelectors<TEntity extends object, TPk extends TOIMPk>
|
|
|
1064
1064
|
}
|
|
1065
1065
|
|
|
1066
1066
|
type TOIMReactiveCollectionFactoryOptions<TEntity extends object, TPk extends TOIMPk> = TOIMCollectionOptions<TEntity, TPk>;
|
|
1067
|
-
type
|
|
1067
|
+
type TOIMCollectionKit<TEntity extends object, TPk extends TOIMPk> = {
|
|
1068
1068
|
queue: OIMEventQueue;
|
|
1069
1069
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
1070
1070
|
indexFactory: OIMCollectionIndexFactory<TEntity, TPk>;
|
|
1071
1071
|
select: OIMCollectionSelectors<TEntity, TPk>;
|
|
1072
1072
|
};
|
|
1073
1073
|
|
|
1074
|
-
declare function
|
|
1074
|
+
declare function createOIMCollectionKit<TEntity extends object, TPk extends TOIMPk>(queue: OIMEventQueue, opts?: TOIMReactiveCollectionFactoryOptions<TEntity, TPk>): TOIMCollectionKit<TEntity, TPk>;
|
|
1075
1075
|
|
|
1076
1076
|
type TOIMFieldKey<TEntity extends object> = keyof TEntity & string;
|
|
1077
1077
|
/**
|
|
@@ -1479,4 +1479,4 @@ declare class OIMEntitiesByIndexKeyArrayBasedSelector<TEntity extends object, TP
|
|
|
1479
1479
|
protected areEqual(prev: readonly (TEntity | undefined)[], next: readonly (TEntity | undefined)[]): boolean;
|
|
1480
1480
|
}
|
|
1481
1481
|
|
|
1482
|
-
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMComputedEventSource, type IOIMEffectDependency, type IOIMEventQueueSchedulerEvents, type IOIMIndexStore, OIMCollection, OIMCollectionByPkSelector, OIMCollectionByPksSelector, OIMCollectionChangedFields, OIMCollectionIndexFactory, OIMCollectionIndexManualOrderedArrayBased, OIMCollectionOrderedListCommandStream, OIMCollectionSelectors, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMComputeRuntime, OIMComputed, OIMDBSettings, OIMDerivedCollectionIndexArrayBased, OIMDerivedCollectionIndexSetBased, OIMEffect, OIMEffectDependencyComputed, OIMEffectDependencyKeyed, OIMEffectDependencyKeyedCollection, OIMEffectDependencyKeyedIndex, OIMEffectDependencyKeyedObject, OIMEntitiesByIndexKeyArrayBasedSelector, OIMEntitiesByIndexKeySetBasedSelector, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndex, OIMIndexArrayBased, OIMIndexComparatorFactory, OIMIndexManualArrayBased, OIMIndexManualOrderedArrayBased, OIMIndexManualSetBased, OIMIndexPksByKeyArrayBasedSelector, OIMIndexPksByKeySetBasedSelector, OIMIndexPksByKeysArrayBasedSelector, OIMIndexPksByKeysSetBasedSelector, OIMIndexSetBased, OIMIndexStoreArrayBased, OIMIndexStoreMapDrivenArrayBased, OIMIndexStoreMapDrivenSetBased, OIMIndexStoreSetBased, OIMMap2Keys, OIMObject, OIMObjectStore, OIMObjectStoreMapDriven, OIMObjectStoreRecordDriven, OIMObjectValueByKeySelector, OIMObjectValuesByKeysSelector, OIMOrderedListCommandStream, OIMPkSelectorFactory, OIMReactiveCollection, OIMReactiveCollectionIndexManualArrayBased, OIMReactiveCollectionIndexManualSetBased, OIMReactiveIndex, OIMReactiveIndexArrayBased, OIMReactiveIndexManualArrayBased, OIMReactiveIndexManualSetBased, OIMReactiveIndexSetBased, OIMReactiveObject, OIMSelector, type TOIMAnyEntitySlot, type
|
|
1482
|
+
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMComputedEventSource, type IOIMEffectDependency, type IOIMEventQueueSchedulerEvents, type IOIMIndexStore, OIMCollection, OIMCollectionByPkSelector, OIMCollectionByPksSelector, OIMCollectionChangedFields, OIMCollectionIndexFactory, OIMCollectionIndexManualOrderedArrayBased, OIMCollectionOrderedListCommandStream, OIMCollectionSelectors, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMComputeRuntime, OIMComputed, OIMDBSettings, OIMDerivedCollectionIndexArrayBased, OIMDerivedCollectionIndexSetBased, OIMEffect, OIMEffectDependencyComputed, OIMEffectDependencyKeyed, OIMEffectDependencyKeyedCollection, OIMEffectDependencyKeyedIndex, OIMEffectDependencyKeyedObject, OIMEntitiesByIndexKeyArrayBasedSelector, OIMEntitiesByIndexKeySetBasedSelector, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndex, OIMIndexArrayBased, OIMIndexComparatorFactory, OIMIndexManualArrayBased, OIMIndexManualOrderedArrayBased, OIMIndexManualSetBased, OIMIndexPksByKeyArrayBasedSelector, OIMIndexPksByKeySetBasedSelector, OIMIndexPksByKeysArrayBasedSelector, OIMIndexPksByKeysSetBasedSelector, OIMIndexSetBased, OIMIndexStoreArrayBased, OIMIndexStoreMapDrivenArrayBased, OIMIndexStoreMapDrivenSetBased, OIMIndexStoreSetBased, OIMMap2Keys, OIMObject, OIMObjectStore, OIMObjectStoreMapDriven, OIMObjectStoreRecordDriven, OIMObjectValueByKeySelector, OIMObjectValuesByKeysSelector, OIMOrderedListCommandStream, OIMPkSelectorFactory, OIMReactiveCollection, OIMReactiveCollectionIndexManualArrayBased, OIMReactiveCollectionIndexManualSetBased, OIMReactiveIndex, OIMReactiveIndexArrayBased, OIMReactiveIndexManualArrayBased, OIMReactiveIndexManualSetBased, OIMReactiveIndexSetBased, OIMReactiveObject, OIMSelector, type TOIMAnyEntitySlot, type TOIMCollectionEntitiesSelector, type TOIMCollectionEntitySelector, type TOIMCollectionIndexArrayBasedOptions, type TOIMCollectionIndexSetBasedOptions, type TOIMCollectionKit, type TOIMCollectionOptions, type TOIMCollectionOrderedIndexOptions, type TOIMCollectionOrderedListCommandStreamOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMComputedOptions, type TOIMComputedUpdatePayload, type TOIMDerivedCollectionIndexArrayBasedOptions, type TOIMDerivedCollectionIndexSetBasedOptions, type TOIMDerivedEntityComparator, type TOIMDerivedEntityOrderSelector, type TOIMDerivedEntityOrderValue, type TOIMDerivedIndexKeySelector, type TOIMEffectOptions, type TOIMEntitySlot, type TOIMEntitySlotResolver, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptionsArrayBased, type TOIMIndexOptionsSetBased, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMObjectOptions, type TOIMOrderedListCommand, type TOIMPk, type TOIMPkSelector, type TOIMReactiveCollectionFactoryOptions, type TOIMRelationsArrayIndexOptions, type TOIMRelationsDerivedArrayIndexOptions, type TOIMRelationsDerivedSetIndexOptions, type TOIMRelationsOrderedListOptions, type TOIMRelationsSetIndexOptions, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdatePayload, createOIMCollectionIndexFactory, createOIMCollectionKit };
|
package/dist/index.d.ts
CHANGED
|
@@ -1064,14 +1064,14 @@ declare class OIMCollectionSelectors<TEntity extends object, TPk extends TOIMPk>
|
|
|
1064
1064
|
}
|
|
1065
1065
|
|
|
1066
1066
|
type TOIMReactiveCollectionFactoryOptions<TEntity extends object, TPk extends TOIMPk> = TOIMCollectionOptions<TEntity, TPk>;
|
|
1067
|
-
type
|
|
1067
|
+
type TOIMCollectionKit<TEntity extends object, TPk extends TOIMPk> = {
|
|
1068
1068
|
queue: OIMEventQueue;
|
|
1069
1069
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
1070
1070
|
indexFactory: OIMCollectionIndexFactory<TEntity, TPk>;
|
|
1071
1071
|
select: OIMCollectionSelectors<TEntity, TPk>;
|
|
1072
1072
|
};
|
|
1073
1073
|
|
|
1074
|
-
declare function
|
|
1074
|
+
declare function createOIMCollectionKit<TEntity extends object, TPk extends TOIMPk>(queue: OIMEventQueue, opts?: TOIMReactiveCollectionFactoryOptions<TEntity, TPk>): TOIMCollectionKit<TEntity, TPk>;
|
|
1075
1075
|
|
|
1076
1076
|
type TOIMFieldKey<TEntity extends object> = keyof TEntity & string;
|
|
1077
1077
|
/**
|
|
@@ -1479,4 +1479,4 @@ declare class OIMEntitiesByIndexKeyArrayBasedSelector<TEntity extends object, TP
|
|
|
1479
1479
|
protected areEqual(prev: readonly (TEntity | undefined)[], next: readonly (TEntity | undefined)[]): boolean;
|
|
1480
1480
|
}
|
|
1481
1481
|
|
|
1482
|
-
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMComputedEventSource, type IOIMEffectDependency, type IOIMEventQueueSchedulerEvents, type IOIMIndexStore, OIMCollection, OIMCollectionByPkSelector, OIMCollectionByPksSelector, OIMCollectionChangedFields, OIMCollectionIndexFactory, OIMCollectionIndexManualOrderedArrayBased, OIMCollectionOrderedListCommandStream, OIMCollectionSelectors, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMComputeRuntime, OIMComputed, OIMDBSettings, OIMDerivedCollectionIndexArrayBased, OIMDerivedCollectionIndexSetBased, OIMEffect, OIMEffectDependencyComputed, OIMEffectDependencyKeyed, OIMEffectDependencyKeyedCollection, OIMEffectDependencyKeyedIndex, OIMEffectDependencyKeyedObject, OIMEntitiesByIndexKeyArrayBasedSelector, OIMEntitiesByIndexKeySetBasedSelector, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndex, OIMIndexArrayBased, OIMIndexComparatorFactory, OIMIndexManualArrayBased, OIMIndexManualOrderedArrayBased, OIMIndexManualSetBased, OIMIndexPksByKeyArrayBasedSelector, OIMIndexPksByKeySetBasedSelector, OIMIndexPksByKeysArrayBasedSelector, OIMIndexPksByKeysSetBasedSelector, OIMIndexSetBased, OIMIndexStoreArrayBased, OIMIndexStoreMapDrivenArrayBased, OIMIndexStoreMapDrivenSetBased, OIMIndexStoreSetBased, OIMMap2Keys, OIMObject, OIMObjectStore, OIMObjectStoreMapDriven, OIMObjectStoreRecordDriven, OIMObjectValueByKeySelector, OIMObjectValuesByKeysSelector, OIMOrderedListCommandStream, OIMPkSelectorFactory, OIMReactiveCollection, OIMReactiveCollectionIndexManualArrayBased, OIMReactiveCollectionIndexManualSetBased, OIMReactiveIndex, OIMReactiveIndexArrayBased, OIMReactiveIndexManualArrayBased, OIMReactiveIndexManualSetBased, OIMReactiveIndexSetBased, OIMReactiveObject, OIMSelector, type TOIMAnyEntitySlot, type
|
|
1482
|
+
export { EOIMCollectionEventType, EOIMComputedEventType, EOIMEventQueueEventType, EOIMEventQueueSchedulerEventType, EOIMIndexEventType, EOIMObjectEventType, type IOIMComputedEventSource, type IOIMEffectDependency, type IOIMEventQueueSchedulerEvents, type IOIMIndexStore, OIMCollection, OIMCollectionByPkSelector, OIMCollectionByPksSelector, OIMCollectionChangedFields, OIMCollectionIndexFactory, OIMCollectionIndexManualOrderedArrayBased, OIMCollectionOrderedListCommandStream, OIMCollectionSelectors, OIMCollectionStore, OIMCollectionStoreMapDriven, OIMComparatorFactory, OIMComputeRuntime, OIMComputed, OIMDBSettings, OIMDerivedCollectionIndexArrayBased, OIMDerivedCollectionIndexSetBased, OIMEffect, OIMEffectDependencyComputed, OIMEffectDependencyKeyed, OIMEffectDependencyKeyedCollection, OIMEffectDependencyKeyedIndex, OIMEffectDependencyKeyedObject, OIMEntitiesByIndexKeyArrayBasedSelector, OIMEntitiesByIndexKeySetBasedSelector, OIMEntityUpdaterFactory, OIMEventEmitter, OIMEventQueue, OIMEventQueueScheduler, OIMEventQueueSchedulerAnimationFrame, OIMEventQueueSchedulerFactory, OIMEventQueueSchedulerImmediate, OIMEventQueueSchedulerMicrotask, OIMEventQueueSchedulerTimeout, OIMIndex, OIMIndexArrayBased, OIMIndexComparatorFactory, OIMIndexManualArrayBased, OIMIndexManualOrderedArrayBased, OIMIndexManualSetBased, OIMIndexPksByKeyArrayBasedSelector, OIMIndexPksByKeySetBasedSelector, OIMIndexPksByKeysArrayBasedSelector, OIMIndexPksByKeysSetBasedSelector, OIMIndexSetBased, OIMIndexStoreArrayBased, OIMIndexStoreMapDrivenArrayBased, OIMIndexStoreMapDrivenSetBased, OIMIndexStoreSetBased, OIMMap2Keys, OIMObject, OIMObjectStore, OIMObjectStoreMapDriven, OIMObjectStoreRecordDriven, OIMObjectValueByKeySelector, OIMObjectValuesByKeysSelector, OIMOrderedListCommandStream, OIMPkSelectorFactory, OIMReactiveCollection, OIMReactiveCollectionIndexManualArrayBased, OIMReactiveCollectionIndexManualSetBased, OIMReactiveIndex, OIMReactiveIndexArrayBased, OIMReactiveIndexManualArrayBased, OIMReactiveIndexManualSetBased, OIMReactiveIndexSetBased, OIMReactiveObject, OIMSelector, type TOIMAnyEntitySlot, type TOIMCollectionEntitiesSelector, type TOIMCollectionEntitySelector, type TOIMCollectionIndexArrayBasedOptions, type TOIMCollectionIndexSetBasedOptions, type TOIMCollectionKit, type TOIMCollectionOptions, type TOIMCollectionOrderedIndexOptions, type TOIMCollectionOrderedListCommandStreamOptions, type TOIMCollectionUpdatePayload, type TOIMComparator, type TOIMComputedOptions, type TOIMComputedUpdatePayload, type TOIMDerivedCollectionIndexArrayBasedOptions, type TOIMDerivedCollectionIndexSetBasedOptions, type TOIMDerivedEntityComparator, type TOIMDerivedEntityOrderSelector, type TOIMDerivedEntityOrderValue, type TOIMDerivedIndexKeySelector, type TOIMEffectOptions, type TOIMEntitySlot, type TOIMEntitySlotResolver, type TOIMEntityUpdater, type TOIMEventHandler, type TOIMEventQueueOptions, type TOIMIndexComparator, type TOIMIndexKey, type TOIMIndexOptionsArrayBased, type TOIMIndexOptionsSetBased, type TOIMIndexPksUpdatePayload, type TOIMIndexUpdatePayload, type TOIMObjectOptions, type TOIMOrderedListCommand, type TOIMPk, type TOIMPkSelector, type TOIMReactiveCollectionFactoryOptions, type TOIMRelationsArrayIndexOptions, type TOIMRelationsDerivedArrayIndexOptions, type TOIMRelationsDerivedSetIndexOptions, type TOIMRelationsOrderedListOptions, type TOIMRelationsSetIndexOptions, type TOIMSchedulerOptions, type TOIMSchedulerType, type TOIMUpdatePayload, createOIMCollectionIndexFactory, createOIMCollectionKit };
|
package/dist/index.js
CHANGED
|
@@ -2867,8 +2867,8 @@ var OIMCollectionSelectors = class {
|
|
|
2867
2867
|
}
|
|
2868
2868
|
};
|
|
2869
2869
|
|
|
2870
|
-
// src/dx/
|
|
2871
|
-
function
|
|
2870
|
+
// src/dx/OIMCollectionKit.ts
|
|
2871
|
+
function createOIMCollectionKit(queue, opts) {
|
|
2872
2872
|
const collection = new OIMReactiveCollection(queue, opts);
|
|
2873
2873
|
const indexFactory = new OIMCollectionIndexFactory(queue, collection);
|
|
2874
2874
|
const select = new OIMCollectionSelectors(queue, collection);
|
|
@@ -3695,6 +3695,6 @@ export {
|
|
|
3695
3695
|
OIMReactiveIndexSetBased,
|
|
3696
3696
|
OIMReactiveObject,
|
|
3697
3697
|
OIMSelector,
|
|
3698
|
-
|
|
3699
|
-
|
|
3698
|
+
createOIMCollectionIndexFactory,
|
|
3699
|
+
createOIMCollectionKit
|
|
3700
3700
|
};
|
package/llms.txt
CHANGED
|
@@ -80,13 +80,13 @@ queue.flush(); // delivers subscription
|
|
|
80
80
|
|
|
81
81
|
### DX Layer — Collection Model
|
|
82
82
|
|
|
83
|
-
`
|
|
83
|
+
`createOIMCollectionKit` wires queue + collection + index factory + selectors together.
|
|
84
84
|
|
|
85
85
|
```ts
|
|
86
|
-
import {
|
|
86
|
+
import { createOIMCollectionKit } from '@oimdb/core';
|
|
87
87
|
|
|
88
88
|
const { collection, indexFactory, select } =
|
|
89
|
-
|
|
89
|
+
createOIMCollectionKit<User, string>(queue, { selectPk: (u) => u.id });
|
|
90
90
|
|
|
91
91
|
// Derived index: built automatically from entity data
|
|
92
92
|
const byRole = indexFactory.derivedSetIndex((u) => [u.role]);
|
|
@@ -181,7 +181,7 @@ import {
|
|
|
181
181
|
// store.ts — outside React
|
|
182
182
|
const queue = new OIMEventQueue();
|
|
183
183
|
const { collection: users, indexFactory } =
|
|
184
|
-
|
|
184
|
+
createOIMCollectionKit<User, string>(queue, { selectPk: (u) => u.id });
|
|
185
185
|
const byTeam = indexFactory.derivedSetIndex((u) => [u.teamId]);
|
|
186
186
|
export const collections = { users };
|
|
187
187
|
|
|
@@ -329,7 +329,7 @@ Variable names: drop the prefix, start lowercase. Context goes first: `prevColle
|
|
|
329
329
|
const queue = new OIMEventQueue({ scheduler: new OIMEventQueueSchedulerImmediate() });
|
|
330
330
|
|
|
331
331
|
const { collection: tasks, indexFactory, select } =
|
|
332
|
-
|
|
332
|
+
createOIMCollectionKit<Task, string>(queue, { selectPk: (t) => t.id });
|
|
333
333
|
|
|
334
334
|
const byStatus = indexFactory.derivedSetIndex((t) => [t.status]);
|
|
335
335
|
const byAssignee = indexFactory.derivedSetIndex((t) => [t.assigneeId]);
|