@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/index26.mjs
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import isFieldExpression from "./index30.mjs";
|
|
2
|
+
import serializeValue from "./index11.mjs";
|
|
3
|
+
function getMatchingKeys(field, selector) {
|
|
4
|
+
const result = { include: null, exclude: null };
|
|
5
|
+
const fieldSelector = selector[field];
|
|
6
|
+
if (fieldSelector instanceof RegExp)
|
|
7
|
+
return result;
|
|
8
|
+
if (fieldSelector == null)
|
|
9
|
+
return result;
|
|
10
|
+
if (isFieldExpression(fieldSelector)) {
|
|
11
|
+
if (fieldSelector.$ne != null) {
|
|
12
|
+
result.exclude = [serializeValue(fieldSelector.$ne)];
|
|
13
|
+
return result;
|
|
14
|
+
}
|
|
15
|
+
if (Array.isArray(fieldSelector.$in) && fieldSelector.$in.length > 0) {
|
|
16
|
+
result.include = fieldSelector.$in.map(serializeValue);
|
|
17
|
+
return result;
|
|
18
|
+
}
|
|
19
|
+
if (Array.isArray(fieldSelector.$nin) && fieldSelector.$nin.length > 0) {
|
|
20
|
+
result.exclude = fieldSelector.$nin.map(serializeValue);
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
return { include: null, exclude: null };
|
|
24
|
+
}
|
|
25
|
+
result.include = [serializeValue(fieldSelector)];
|
|
26
|
+
return result;
|
|
7
27
|
}
|
|
8
28
|
export {
|
|
9
|
-
|
|
29
|
+
getMatchingKeys as default
|
|
10
30
|
};
|
package/dist/index27.mjs
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
return [];
|
|
4
|
-
return [...new Set(arrays.reduce((a, b) => a.filter((c) => b.includes(c))))];
|
|
1
|
+
function createIndexProvider(definition) {
|
|
2
|
+
return definition;
|
|
5
3
|
}
|
|
6
4
|
export {
|
|
7
|
-
|
|
5
|
+
createIndexProvider as default
|
|
8
6
|
};
|
package/dist/index28.mjs
CHANGED
|
@@ -1,30 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const fieldSelector = selector[field];
|
|
6
|
-
if (fieldSelector instanceof RegExp)
|
|
7
|
-
return result;
|
|
8
|
-
if (fieldSelector == null)
|
|
9
|
-
return result;
|
|
10
|
-
if (isFieldExpression(fieldSelector)) {
|
|
11
|
-
if (fieldSelector.$ne != null) {
|
|
12
|
-
result.exclude = [serializeValue(fieldSelector.$ne)];
|
|
13
|
-
return result;
|
|
14
|
-
}
|
|
15
|
-
if (Array.isArray(fieldSelector.$in) && fieldSelector.$in.length > 0) {
|
|
16
|
-
result.include = fieldSelector.$in.map(serializeValue);
|
|
17
|
-
return result;
|
|
18
|
-
}
|
|
19
|
-
if (Array.isArray(fieldSelector.$nin) && fieldSelector.$nin.length > 0) {
|
|
20
|
-
result.exclude = fieldSelector.$nin.map(serializeValue);
|
|
21
|
-
return result;
|
|
22
|
-
}
|
|
23
|
-
return { include: null, exclude: null };
|
|
24
|
-
}
|
|
25
|
-
result.include = [serializeValue(fieldSelector)];
|
|
26
|
-
return result;
|
|
1
|
+
function intersection(...arrays) {
|
|
2
|
+
if (arrays.length === 0)
|
|
3
|
+
return [];
|
|
4
|
+
return [...new Set(arrays.reduce((a, b) => a.filter((c) => b.includes(c))))];
|
|
27
5
|
}
|
|
28
6
|
export {
|
|
29
|
-
|
|
7
|
+
intersection as default
|
|
30
8
|
};
|
package/dist/index29.mjs
CHANGED
|
@@ -1,43 +1,30 @@
|
|
|
1
|
-
|
|
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
|
-
function isFieldExpression(expression) {
|
|
28
|
-
if (typeof expression !== "object" || expression == null) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
const keys = Object.keys(expression);
|
|
32
|
-
if (keys.length === 0) {
|
|
33
|
-
return false;
|
|
34
|
-
}
|
|
35
|
-
const hasInvalidKeys = keys.some((key) => !expressionKeys.has(key));
|
|
36
|
-
if (hasInvalidKeys)
|
|
37
|
-
return false;
|
|
38
|
-
const hasValidKeys = keys.every((key) => expressionKeys.has(key));
|
|
39
|
-
return hasValidKeys;
|
|
1
|
+
function set(object, path, value, deleteIfUndefined = false) {
|
|
2
|
+
if (object == null)
|
|
3
|
+
return object;
|
|
4
|
+
const segments = path.split(/[.[\]]/g);
|
|
5
|
+
if (segments[0] === "")
|
|
6
|
+
segments.shift();
|
|
7
|
+
if (segments.at(-1) === "")
|
|
8
|
+
segments.pop();
|
|
9
|
+
const apply = (node) => {
|
|
10
|
+
if (segments.length > 1) {
|
|
11
|
+
const key = segments.shift();
|
|
12
|
+
const nextIsNumber = !Number.isNaN(Number.parseInt(segments[0], 10));
|
|
13
|
+
if (node[key] === void 0) {
|
|
14
|
+
node[key] = nextIsNumber ? [] : {};
|
|
15
|
+
}
|
|
16
|
+
apply(node[key]);
|
|
17
|
+
} else {
|
|
18
|
+
if (deleteIfUndefined && value === void 0) {
|
|
19
|
+
delete node[segments[0]];
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
node[segments[0]] = value;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
apply(object);
|
|
26
|
+
return object;
|
|
40
27
|
}
|
|
41
28
|
export {
|
|
42
|
-
|
|
29
|
+
set as default
|
|
43
30
|
};
|