@oimdb/core 2.0.1 → 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 +7 -7
- 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
|
@@ -94,7 +94,7 @@ Use the `dx` factories when you want a concise entrypoint without changing the u
|
|
|
94
94
|
|
|
95
95
|
```typescript
|
|
96
96
|
import {
|
|
97
|
-
|
|
97
|
+
createOIMCollectionKit,
|
|
98
98
|
OIMEventQueue,
|
|
99
99
|
OIMEventQueueSchedulerFactory
|
|
100
100
|
} from '@oimdb/core';
|
|
@@ -108,7 +108,7 @@ type User = {
|
|
|
108
108
|
const queue = new OIMEventQueue({
|
|
109
109
|
scheduler: OIMEventQueueSchedulerFactory.createMicrotask()
|
|
110
110
|
});
|
|
111
|
-
const users =
|
|
111
|
+
const users = createOIMCollectionKit<User, string>(queue, {
|
|
112
112
|
selectPk: user => user.id,
|
|
113
113
|
});
|
|
114
114
|
|
|
@@ -191,7 +191,7 @@ OIMDB provides two types of indexes optimized for different use cases:
|
|
|
191
191
|
|
|
192
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.
|
|
193
193
|
|
|
194
|
-
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.
|
|
195
195
|
|
|
196
196
|
#### SetBased Indexes (for incremental updates)
|
|
197
197
|
|
|
@@ -1158,7 +1158,7 @@ npm install @oimdb/react
|
|
|
1158
1158
|
Create your collections outside React, wire them up once, then use hooks inside components:
|
|
1159
1159
|
|
|
1160
1160
|
```typescript
|
|
1161
|
-
import {
|
|
1161
|
+
import { createOIMCollectionKit, OIMEventQueue } from '@oimdb/core';
|
|
1162
1162
|
import {
|
|
1163
1163
|
OIMCollectionsProvider,
|
|
1164
1164
|
useOIMCollectionsContext,
|
|
@@ -1169,7 +1169,7 @@ import {
|
|
|
1169
1169
|
// --- store.ts (created once, outside React) ---
|
|
1170
1170
|
const queue = new OIMEventQueue();
|
|
1171
1171
|
const { collection: users, indexFactory } =
|
|
1172
|
-
|
|
1172
|
+
createOIMCollectionKit<User, string>(queue, { selectPk: (u) => u.id });
|
|
1173
1173
|
const byTeam = indexFactory.derivedSetIndex((u) => [u.teamId]);
|
|
1174
1174
|
export const collections = { users };
|
|
1175
1175
|
export { byTeam };
|
|
@@ -1268,11 +1268,11 @@ unsubscribe();
|
|
|
1268
1268
|
#### `createOIMReactiveCollection<TEntity, TPk>(queue, opts?)`
|
|
1269
1269
|
Creates an `OIMReactiveCollection<TEntity, TPk>` with less constructor noise.
|
|
1270
1270
|
|
|
1271
|
-
#### `
|
|
1271
|
+
#### `createOIMCollectionKit<TEntity, TPk>(queue, opts?)`
|
|
1272
1272
|
Creates a small facade:
|
|
1273
1273
|
|
|
1274
1274
|
```typescript
|
|
1275
|
-
type
|
|
1275
|
+
type TOIMCollectionKit<TEntity, TPk> = {
|
|
1276
1276
|
queue: OIMEventQueue;
|
|
1277
1277
|
collection: OIMReactiveCollection<TEntity, TPk>;
|
|
1278
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]);
|