@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 +7 -3
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +7 -3
- package/package.json +1 -1
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))
|
|
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(
|
|
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
|
-
|
|
581
|
-
|
|
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?:
|
|
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
|
-
|
|
581
|
-
|
|
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?:
|
|
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))
|
|
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(
|
|
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
|
|