@oimdb/core 1.3.0 → 1.3.1

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.cjs CHANGED
@@ -118,10 +118,14 @@ var OIMEventEmitter = class {
118
118
  }
119
119
  on(event, handler) {
120
120
  const bucket = this.getOrCreateBucket(event);
121
- if (bucket.indexByHandler.has(handler)) return;
121
+ if (bucket.indexByHandler.has(handler))
122
+ return;
122
123
  const index = bucket.handlers.length;
123
124
  bucket.handlers.push(handler);
124
- bucket.indexByHandler.set(handler, index);
125
+ bucket.indexByHandler.set(
126
+ handler,
127
+ index
128
+ );
125
129
  }
126
130
  emit(event, payload) {
127
131
  const bucket = this.buckets[event];
@@ -1199,7 +1203,7 @@ var OIMReactiveIndexManualArrayBased = class extends OIMReactiveIndexArrayBased
1199
1203
  var OIMRICollection = class extends OIMReactiveCollection {
1200
1204
  constructor(queue, opts) {
1201
1205
  super(queue, opts.collectionOpts);
1202
- this.indexes = opts.indexes;
1206
+ this.indexes = opts.indexes || {};
1203
1207
  }
1204
1208
  };
1205
1209
 
package/dist/index.d.cts CHANGED
@@ -577,11 +577,12 @@ declare class OIMReactiveIndexManualArrayBased<TKey extends TOIMPk, TPk extends
577
577
  clear(key?: TKey): void;
578
578
  }
579
579
 
580
- declare class OIMRICollection<TEntity extends object, TPk extends TOIMPk, TIndexName extends string, TIndexKey extends TOIMPk, TReactiveIndex extends OIMReactiveIndexSetBased<TIndexKey, TPk, OIMIndexSetBased<TIndexKey, TPk>> | OIMReactiveIndexArrayBased<TIndexKey, TPk, OIMIndexArrayBased<TIndexKey, TPk>>, TReactiveIndexMap extends Record<TIndexName, TReactiveIndex> = Record<TIndexName, TReactiveIndex>> extends OIMReactiveCollection<TEntity, TPk> {
581
- readonly indexes?: TReactiveIndexMap;
580
+ type TOIMReactiveIndex<TIndexKey extends TOIMPk, TPk extends TOIMPk> = OIMReactiveIndexSetBased<TIndexKey, TPk, any> | OIMReactiveIndexArrayBased<TIndexKey, TPk, any>;
581
+ declare class OIMRICollection<TEntity extends object, TPk extends TOIMPk, TIndexName extends string = string, TIndexMap extends Record<TIndexName, TOIMReactiveIndex<any, TPk>> = Record<TIndexName, TOIMReactiveIndex<any, TPk>>> extends OIMReactiveCollection<TEntity, TPk> {
582
+ readonly indexes: TIndexMap;
582
583
  constructor(queue: OIMEventQueue, opts: {
583
584
  collectionOpts?: TOIMCollectionOptions<TEntity, TPk>;
584
- indexes?: TReactiveIndexMap;
585
+ indexes?: TIndexMap;
585
586
  });
586
587
  }
587
588
 
package/dist/index.d.ts CHANGED
@@ -577,11 +577,12 @@ declare class OIMReactiveIndexManualArrayBased<TKey extends TOIMPk, TPk extends
577
577
  clear(key?: TKey): void;
578
578
  }
579
579
 
580
- declare class OIMRICollection<TEntity extends object, TPk extends TOIMPk, TIndexName extends string, TIndexKey extends TOIMPk, TReactiveIndex extends OIMReactiveIndexSetBased<TIndexKey, TPk, OIMIndexSetBased<TIndexKey, TPk>> | OIMReactiveIndexArrayBased<TIndexKey, TPk, OIMIndexArrayBased<TIndexKey, TPk>>, TReactiveIndexMap extends Record<TIndexName, TReactiveIndex> = Record<TIndexName, TReactiveIndex>> extends OIMReactiveCollection<TEntity, TPk> {
581
- readonly indexes?: TReactiveIndexMap;
580
+ type TOIMReactiveIndex<TIndexKey extends TOIMPk, TPk extends TOIMPk> = OIMReactiveIndexSetBased<TIndexKey, TPk, any> | OIMReactiveIndexArrayBased<TIndexKey, TPk, any>;
581
+ declare class OIMRICollection<TEntity extends object, TPk extends TOIMPk, TIndexName extends string = string, TIndexMap extends Record<TIndexName, TOIMReactiveIndex<any, TPk>> = Record<TIndexName, TOIMReactiveIndex<any, TPk>>> extends OIMReactiveCollection<TEntity, TPk> {
582
+ readonly indexes: TIndexMap;
582
583
  constructor(queue: OIMEventQueue, opts: {
583
584
  collectionOpts?: TOIMCollectionOptions<TEntity, TPk>;
584
- indexes?: TReactiveIndexMap;
585
+ indexes?: TIndexMap;
585
586
  });
586
587
  }
587
588
 
package/dist/index.js CHANGED
@@ -53,10 +53,14 @@ var OIMEventEmitter = class {
53
53
  }
54
54
  on(event, handler) {
55
55
  const bucket = this.getOrCreateBucket(event);
56
- if (bucket.indexByHandler.has(handler)) return;
56
+ if (bucket.indexByHandler.has(handler))
57
+ return;
57
58
  const index = bucket.handlers.length;
58
59
  bucket.handlers.push(handler);
59
- bucket.indexByHandler.set(handler, index);
60
+ bucket.indexByHandler.set(
61
+ handler,
62
+ index
63
+ );
60
64
  }
61
65
  emit(event, payload) {
62
66
  const bucket = this.buckets[event];
@@ -1134,7 +1138,7 @@ var OIMReactiveIndexManualArrayBased = class extends OIMReactiveIndexArrayBased
1134
1138
  var OIMRICollection = class extends OIMReactiveCollection {
1135
1139
  constructor(queue, opts) {
1136
1140
  super(queue, opts.collectionOpts);
1137
- this.indexes = opts.indexes;
1141
+ this.indexes = opts.indexes || {};
1138
1142
  }
1139
1143
  };
1140
1144
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oimdb/core",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Core in-memory data library with type-safe indices, reactive subscriptions, and event processing",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",