@signaldb/core 1.5.4 → 1.7.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/dist/.vite/manifest.json +29 -28
- package/dist/Collection/createIndex.d.ts +1 -1
- package/dist/Collection/index.d.ts +1 -0
- package/dist/index.cjs.js +14 -12
- package/dist/index.cjs10.js +27 -10
- package/dist/index.cjs11.js +10 -3
- package/dist/index.cjs12.js +3 -136
- package/dist/index.cjs13.js +131 -61
- package/dist/index.cjs14.js +72 -5
- package/dist/index.cjs15.js +8 -41
- package/dist/index.cjs16.js +25 -11
- package/dist/index.cjs17.js +143 -23
- package/dist/index.cjs18.js +5 -262
- package/dist/index.cjs19.js +36 -63
- package/dist/index.cjs2.js +210 -732
- package/dist/index.cjs20.js +13 -85
- package/dist/index.cjs21.js +24 -8
- package/dist/index.cjs22.js +67 -24
- package/dist/index.cjs23.js +72 -131
- package/dist/index.cjs24.js +16 -5
- package/dist/index.cjs25.js +22 -11
- package/dist/index.cjs26.js +7 -27
- package/dist/index.cjs27.js +5 -40
- package/dist/index.cjs28.js +26 -26
- package/dist/index.cjs29.js +40 -7
- package/dist/index.cjs3.js +757 -136
- package/dist/index.cjs4.js +165 -62
- package/dist/index.cjs5.js +67 -3
- package/dist/index.cjs6.js +2 -2
- package/dist/index.cjs7.js +2 -2
- package/dist/index.cjs8.js +2 -2
- package/dist/index.cjs9.js +3 -27
- package/dist/index.d.ts +1 -0
- package/dist/index.mjs +14 -12
- package/dist/index10.mjs +27 -10
- package/dist/index11.mjs +10 -3
- package/dist/index12.mjs +3 -136
- package/dist/index13.mjs +131 -60
- package/dist/index14.mjs +71 -5
- package/dist/index15.mjs +8 -40
- package/dist/index16.mjs +25 -11
- package/dist/index17.mjs +143 -23
- package/dist/index18.mjs +5 -261
- package/dist/index19.mjs +36 -63
- package/dist/index2.mjs +210 -733
- package/dist/index20.mjs +13 -84
- package/dist/index21.mjs +24 -8
- package/dist/index22.mjs +66 -24
- package/dist/index23.mjs +71 -131
- package/dist/index24.mjs +16 -5
- package/dist/index25.mjs +22 -11
- package/dist/index26.mjs +7 -27
- package/dist/index27.mjs +5 -40
- package/dist/index28.mjs +26 -26
- package/dist/index29.mjs +40 -7
- package/dist/index3.mjs +757 -136
- package/dist/index4.mjs +165 -61
- package/dist/index5.mjs +66 -3
- package/dist/index6.mjs +2 -2
- package/dist/index7.mjs +2 -2
- package/dist/index8.mjs +2 -2
- package/dist/index9.mjs +3 -27
- package/dist/types/IndexProvider.d.ts +2 -0
- package/dist/types/Modifier.d.ts +17 -10
- package/dist/types/Selector.d.ts +1 -7
- package/dist/utils/getMatchingKeys.d.ts +2 -2
- package/dist/utils/serializeValue.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.cjs19.js
CHANGED
|
@@ -1,70 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
optimizedSelector: { ...selector }
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
function getIndexInfo(indexProviders, selector) {
|
|
22
|
-
if (selector == null || Object.keys(selector).length <= 0) {
|
|
23
|
-
return { matched: false, positions: [], optimizedSelector: selector };
|
|
3
|
+
function clone(value) {
|
|
4
|
+
if (typeof value === "function")
|
|
5
|
+
throw new Error("Cloning functions is not supported");
|
|
6
|
+
if (value === null || typeof value !== "object")
|
|
7
|
+
return value;
|
|
8
|
+
if (value instanceof Date)
|
|
9
|
+
return new Date(value);
|
|
10
|
+
if (Array.isArray(value))
|
|
11
|
+
return value.map((item) => clone(item));
|
|
12
|
+
if (value instanceof Map) {
|
|
13
|
+
const result2 = /* @__PURE__ */ new Map();
|
|
14
|
+
value.forEach((currentValue, key) => {
|
|
15
|
+
result2.set(key, clone(currentValue));
|
|
16
|
+
});
|
|
17
|
+
return result2;
|
|
24
18
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
for (const sel of $and) {
|
|
32
|
-
const { matched: selMatched, positions: selPositions, optimizedSelector } = getIndexInfo(indexProviders, sel);
|
|
33
|
-
if (selMatched) {
|
|
34
|
-
positions = matched ? intersection(positions, selPositions) : selPositions;
|
|
35
|
-
matched = true;
|
|
36
|
-
if (Object.keys(optimizedSelector).length > 0) {
|
|
37
|
-
$andNew.push(optimizedSelector);
|
|
38
|
-
}
|
|
39
|
-
} else {
|
|
40
|
-
$andNew.push(sel);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if ($andNew.length > 0)
|
|
44
|
-
newSelector.$and = $andNew;
|
|
19
|
+
if (value instanceof Set) {
|
|
20
|
+
const result2 = /* @__PURE__ */ new Set();
|
|
21
|
+
value.forEach((currentValue) => {
|
|
22
|
+
result2.add(clone(currentValue));
|
|
23
|
+
});
|
|
24
|
+
return result2;
|
|
45
25
|
}
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
matched = true;
|
|
53
|
-
if (Object.keys(optimizedSelector).length > 0) {
|
|
54
|
-
$orNew.push(optimizedSelector);
|
|
55
|
-
}
|
|
56
|
-
} else {
|
|
57
|
-
$orNew.push(sel);
|
|
58
|
-
}
|
|
26
|
+
if (value instanceof RegExp)
|
|
27
|
+
return new RegExp(value);
|
|
28
|
+
const result = {};
|
|
29
|
+
for (const key in value) {
|
|
30
|
+
if (Object.hasOwnProperty.call(value, key)) {
|
|
31
|
+
result[key] = clone(value[key]);
|
|
59
32
|
}
|
|
60
|
-
if ($orNew.length > 0)
|
|
61
|
-
newSelector.$or = $orNew;
|
|
62
33
|
}
|
|
63
|
-
return
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
34
|
+
return result;
|
|
35
|
+
}
|
|
36
|
+
function deepClone(object) {
|
|
37
|
+
if (typeof structuredClone === "function")
|
|
38
|
+
return structuredClone(object);
|
|
39
|
+
/* istanbul ignore next -- @preserve */
|
|
40
|
+
return clone(object);
|
|
68
41
|
}
|
|
69
|
-
exports.
|
|
70
|
-
exports.
|
|
42
|
+
exports.clone = clone;
|
|
43
|
+
exports.default = deepClone;
|