@signaldb/core 1.7.0 → 2.0.0-beta.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 +125 -82
- package/dist/AsyncDataAdapter.d.ts +64 -0
- package/dist/AutoFetchDataAdapter.d.ts +113 -0
- package/dist/Collection/Cursor.d.ts +9 -9
- package/dist/Collection/Observer.d.ts +3 -2
- package/dist/Collection/index.d.ts +52 -46
- package/dist/Collection/types.d.ts +4 -9
- package/dist/DataAdapter.d.ts +33 -0
- package/dist/DefaultDataAdapter.d.ts +32 -0
- package/dist/WorkerDataAdapter.d.ts +22 -0
- package/dist/WorkerDataAdapterHost.d.ts +59 -0
- package/dist/createIndex.d.ts +7 -0
- package/dist/createStorageAdapter.d.ts +9 -0
- package/dist/{Collection/getIndexInfo.d.ts → getIndexInfo.d.ts} +17 -19
- package/dist/index.cjs.js +21 -17
- package/dist/index.cjs10.js +15 -26
- package/dist/index.cjs11.js +13 -10
- package/dist/index.cjs12.js +337 -3
- package/dist/index.cjs13.js +384 -115
- package/dist/index.cjs14.js +183 -67
- package/dist/index.cjs15.js +339 -8
- package/dist/index.cjs16.js +563 -20
- package/dist/index.cjs17.js +16 -12
- package/dist/index.cjs18.js +24 -5
- package/dist/index.cjs2.js +27 -36
- package/dist/index.cjs20.js +102 -13
- package/dist/index.cjs21.js +124 -21
- package/dist/index.cjs22.js +5 -68
- package/dist/index.cjs23.js +22 -82
- package/dist/index.cjs24.js +5 -16
- package/dist/index.cjs25.js +8 -27
- package/dist/index.cjs26.js +27 -7
- package/dist/index.cjs27.js +3 -5
- package/dist/index.cjs28.js +5 -27
- package/dist/index.cjs29.js +27 -40
- package/dist/index.cjs3.js +242 -497
- package/dist/index.cjs30.js +42 -0
- package/dist/index.cjs31.js +9 -0
- package/dist/index.cjs4.js +3 -170
- package/dist/index.cjs5.js +3 -67
- package/dist/index.cjs6.js +27 -3
- package/dist/index.cjs7.js +10 -3
- package/dist/index.cjs8.js +3 -3
- package/dist/index.cjs9.js +131 -3
- package/dist/index.d.ts +10 -8
- package/dist/index.mjs +15 -11
- package/dist/index10.mjs +15 -26
- package/dist/index11.mjs +13 -10
- package/dist/index12.mjs +337 -3
- package/dist/index13.mjs +384 -115
- package/dist/index14.mjs +183 -66
- package/dist/index15.mjs +339 -8
- package/dist/index16.mjs +563 -20
- package/dist/index17.mjs +16 -12
- package/dist/index18.mjs +24 -5
- package/dist/index2.mjs +27 -36
- package/dist/index20.mjs +102 -13
- package/dist/index21.mjs +123 -21
- package/dist/index22.mjs +5 -67
- package/dist/index23.mjs +22 -81
- package/dist/index24.mjs +5 -16
- package/dist/index25.mjs +8 -27
- package/dist/index26.mjs +27 -7
- package/dist/index27.mjs +3 -5
- package/dist/index28.mjs +5 -27
- package/dist/index29.mjs +27 -40
- package/dist/index3.mjs +241 -497
- package/dist/index30.mjs +43 -0
- package/dist/index31.mjs +10 -0
- package/dist/index4.mjs +3 -170
- package/dist/index5.mjs +3 -66
- package/dist/index6.mjs +27 -3
- package/dist/index7.mjs +10 -3
- package/dist/index8.mjs +3 -3
- package/dist/index9.mjs +131 -3
- package/dist/types/IndexProvider.d.ts +12 -7
- package/dist/types/StorageAdapter.d.ts +20 -0
- package/dist/utils/objectId.d.ts +8 -0
- package/dist/utils/queryId.d.ts +9 -0
- package/package.json +2 -2
- package/dist/AutoFetchCollection.d.ts +0 -60
- package/dist/Collection/createIndex.d.ts +0 -15
- package/dist/ReplicatedCollection.d.ts +0 -60
- package/dist/createMemoryAdapter.d.ts +0 -7
- package/dist/persistence/combinePersistenceAdapters.d.ts +0 -32
- package/dist/persistence/createPersistenceAdapter.d.ts +0 -9
- package/dist/types/MemoryAdapter.d.ts +0 -15
- package/dist/types/PersistenceAdapter.d.ts +0 -20
package/dist/index.cjs26.js
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
const isFieldExpression = require("./index.cjs30.js");
|
|
3
|
+
const serializeValue = require("./index.cjs11.js");
|
|
4
|
+
function getMatchingKeys(field, selector) {
|
|
5
|
+
const result = { include: null, exclude: null };
|
|
6
|
+
const fieldSelector = selector[field];
|
|
7
|
+
if (fieldSelector instanceof RegExp)
|
|
8
|
+
return result;
|
|
9
|
+
if (fieldSelector == null)
|
|
10
|
+
return result;
|
|
11
|
+
if (isFieldExpression(fieldSelector)) {
|
|
12
|
+
if (fieldSelector.$ne != null) {
|
|
13
|
+
result.exclude = [serializeValue(fieldSelector.$ne)];
|
|
14
|
+
return result;
|
|
15
|
+
}
|
|
16
|
+
if (Array.isArray(fieldSelector.$in) && fieldSelector.$in.length > 0) {
|
|
17
|
+
result.include = fieldSelector.$in.map(serializeValue);
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
if (Array.isArray(fieldSelector.$nin) && fieldSelector.$nin.length > 0) {
|
|
21
|
+
result.exclude = fieldSelector.$nin.map(serializeValue);
|
|
22
|
+
return result;
|
|
23
|
+
}
|
|
24
|
+
return { include: null, exclude: null };
|
|
25
|
+
}
|
|
26
|
+
result.include = [serializeValue(fieldSelector)];
|
|
27
|
+
return result;
|
|
8
28
|
}
|
|
9
|
-
module.exports =
|
|
29
|
+
module.exports = getMatchingKeys;
|
package/dist/index.cjs27.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
return [];
|
|
5
|
-
return [...new Set(arrays.reduce((a, b) => a.filter((c) => b.includes(c))))];
|
|
2
|
+
function createIndexProvider(definition) {
|
|
3
|
+
return definition;
|
|
6
4
|
}
|
|
7
|
-
module.exports =
|
|
5
|
+
module.exports = createIndexProvider;
|
package/dist/index.cjs28.js
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const fieldSelector = selector[field];
|
|
7
|
-
if (fieldSelector instanceof RegExp)
|
|
8
|
-
return result;
|
|
9
|
-
if (fieldSelector == null)
|
|
10
|
-
return result;
|
|
11
|
-
if (isFieldExpression(fieldSelector)) {
|
|
12
|
-
if (fieldSelector.$ne != null) {
|
|
13
|
-
result.exclude = [serializeValue(fieldSelector.$ne)];
|
|
14
|
-
return result;
|
|
15
|
-
}
|
|
16
|
-
if (Array.isArray(fieldSelector.$in) && fieldSelector.$in.length > 0) {
|
|
17
|
-
result.include = fieldSelector.$in.map(serializeValue);
|
|
18
|
-
return result;
|
|
19
|
-
}
|
|
20
|
-
if (Array.isArray(fieldSelector.$nin) && fieldSelector.$nin.length > 0) {
|
|
21
|
-
result.exclude = fieldSelector.$nin.map(serializeValue);
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
return { include: null, exclude: null };
|
|
25
|
-
}
|
|
26
|
-
result.include = [serializeValue(fieldSelector)];
|
|
27
|
-
return result;
|
|
2
|
+
function intersection(...arrays) {
|
|
3
|
+
if (arrays.length === 0)
|
|
4
|
+
return [];
|
|
5
|
+
return [...new Set(arrays.reduce((a, b) => a.filter((c) => b.includes(c))))];
|
|
28
6
|
}
|
|
29
|
-
module.exports =
|
|
7
|
+
module.exports = intersection;
|
package/dist/index.cjs29.js
CHANGED
|
@@ -1,42 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"
|
|
7
|
-
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
function isFieldExpression(expression) {
|
|
29
|
-
if (typeof expression !== "object" || expression == null) {
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
const keys = Object.keys(expression);
|
|
33
|
-
if (keys.length === 0) {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
const hasInvalidKeys = keys.some((key) => !expressionKeys.has(key));
|
|
37
|
-
if (hasInvalidKeys)
|
|
38
|
-
return false;
|
|
39
|
-
const hasValidKeys = keys.every((key) => expressionKeys.has(key));
|
|
40
|
-
return hasValidKeys;
|
|
2
|
+
function set(object, path, value, deleteIfUndefined = false) {
|
|
3
|
+
if (object == null)
|
|
4
|
+
return object;
|
|
5
|
+
const segments = path.split(/[.[\]]/g);
|
|
6
|
+
if (segments[0] === "")
|
|
7
|
+
segments.shift();
|
|
8
|
+
if (segments.at(-1) === "")
|
|
9
|
+
segments.pop();
|
|
10
|
+
const apply = (node) => {
|
|
11
|
+
if (segments.length > 1) {
|
|
12
|
+
const key = segments.shift();
|
|
13
|
+
const nextIsNumber = !Number.isNaN(Number.parseInt(segments[0], 10));
|
|
14
|
+
if (node[key] === void 0) {
|
|
15
|
+
node[key] = nextIsNumber ? [] : {};
|
|
16
|
+
}
|
|
17
|
+
apply(node[key]);
|
|
18
|
+
} else {
|
|
19
|
+
if (deleteIfUndefined && value === void 0) {
|
|
20
|
+
delete node[segments[0]];
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
node[segments[0]] = value;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
apply(object);
|
|
27
|
+
return object;
|
|
41
28
|
}
|
|
42
|
-
module.exports =
|
|
29
|
+
module.exports = set;
|