@signaldb/core 2.0.0-beta.3 → 2.0.0-beta.4
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 +3 -3
- package/dist/index.cjs13.js +4 -7
- package/dist/index.cjs21.js +1 -1
- package/dist/index.cjs22.js +1 -1
- package/dist/index.cjs26.js +1 -1
- package/dist/index.cjs30.js +3 -5
- package/dist/index.cjs31.js +5 -40
- package/dist/index.cjs33.js +40 -3
- package/dist/index13.mjs +4 -7
- package/dist/index21.mjs +1 -1
- package/dist/index22.mjs +1 -1
- package/dist/index26.mjs +1 -1
- package/dist/index30.mjs +3 -5
- package/dist/index31.mjs +5 -40
- package/dist/index33.mjs +40 -3
- package/package.json +1 -1
package/dist/.vite/manifest.json
CHANGED
|
@@ -120,7 +120,7 @@
|
|
|
120
120
|
]
|
|
121
121
|
},
|
|
122
122
|
"src/createIndexProvider.ts": {
|
|
123
|
-
"file": "index.
|
|
123
|
+
"file": "index.cjs30.js",
|
|
124
124
|
"name": "createIndexProvider",
|
|
125
125
|
"src": "src/createIndexProvider.ts"
|
|
126
126
|
},
|
|
@@ -205,7 +205,7 @@
|
|
|
205
205
|
]
|
|
206
206
|
},
|
|
207
207
|
"src/utils/intersection.ts": {
|
|
208
|
-
"file": "index.
|
|
208
|
+
"file": "index.cjs31.js",
|
|
209
209
|
"name": "utils/intersection",
|
|
210
210
|
"src": "src/utils/intersection.ts"
|
|
211
211
|
},
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
"src": "src/utils/isEqual.ts"
|
|
216
216
|
},
|
|
217
217
|
"src/utils/isFieldExpression.ts": {
|
|
218
|
-
"file": "index.
|
|
218
|
+
"file": "index.cjs33.js",
|
|
219
219
|
"name": "utils/isFieldExpression",
|
|
220
220
|
"src": "src/utils/isFieldExpression.ts"
|
|
221
221
|
},
|
package/dist/index.cjs13.js
CHANGED
|
@@ -122,10 +122,7 @@ class AsyncDataAdapter {
|
|
|
122
122
|
onQueryStateChange,
|
|
123
123
|
executeQuery: async (selector, options) => {
|
|
124
124
|
await ready;
|
|
125
|
-
|
|
126
|
-
const result = getQueryResult(selector, options);
|
|
127
|
-
unregisterQuery(selector, options);
|
|
128
|
-
return result;
|
|
125
|
+
return this.executeQuery(collection.name, selector, options);
|
|
129
126
|
},
|
|
130
127
|
dispose: async () => {
|
|
131
128
|
this.storageAdapters.delete(collection.name);
|
|
@@ -345,7 +342,7 @@ class AsyncDataAdapter {
|
|
|
345
342
|
return [];
|
|
346
343
|
const modified = modify(deepClone.default(item), rest);
|
|
347
344
|
if (item.id !== modified.id) {
|
|
348
|
-
const existing = await
|
|
345
|
+
const existing = await storage.readIds([modified.id]);
|
|
349
346
|
if (existing.length > 0)
|
|
350
347
|
throw new Error(`Item with id ${String(modified.id)} already exists`);
|
|
351
348
|
}
|
|
@@ -364,7 +361,7 @@ class AsyncDataAdapter {
|
|
|
364
361
|
const changed = await Promise.all(items.map(async (item) => {
|
|
365
362
|
const modified = modify(deepClone.default(item), rest);
|
|
366
363
|
if (item.id !== modified.id) {
|
|
367
|
-
const existing = await
|
|
364
|
+
const existing = await storage.readIds([modified.id]);
|
|
368
365
|
if (existing.length > 0)
|
|
369
366
|
throw new Error(`Item with id ${String(modified.id)} already exists`);
|
|
370
367
|
}
|
|
@@ -384,7 +381,7 @@ class AsyncDataAdapter {
|
|
|
384
381
|
return [];
|
|
385
382
|
const modified = { ...replacement, id: replacement.id ?? item.id };
|
|
386
383
|
if (item.id !== modified.id) {
|
|
387
|
-
const existing = await
|
|
384
|
+
const existing = await storage.readIds([modified.id]);
|
|
388
385
|
if (existing.length > 0)
|
|
389
386
|
throw new Error(`Item with id ${String(modified.id)} already exists`);
|
|
390
387
|
}
|
package/dist/index.cjs21.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const createIndexProvider = require("./index.
|
|
2
|
+
const createIndexProvider = require("./index.cjs30.js");
|
|
3
3
|
const get = require("./index.cjs10.js");
|
|
4
4
|
const getMatchingKeys = require("./index.cjs26.js");
|
|
5
5
|
const serializeValue = require("./index.cjs11.js");
|
package/dist/index.cjs22.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
|
-
const intersection = require("./index.
|
|
3
|
+
const intersection = require("./index.cjs31.js");
|
|
4
4
|
function getMergedIndexInfo(queryFunctions, selector) {
|
|
5
5
|
return queryFunctions.reduce((memoOrPromise, queryFunction) => {
|
|
6
6
|
const resultOrPromise = queryFunction(selector);
|
package/dist/index.cjs26.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const isFieldExpression = require("./index.
|
|
2
|
+
const isFieldExpression = require("./index.cjs33.js");
|
|
3
3
|
const serializeValue = require("./index.cjs11.js");
|
|
4
4
|
function getMatchingKeys(field, selector) {
|
|
5
5
|
const result = { include: null, exclude: null };
|
package/dist/index.cjs30.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.cjs31.js
CHANGED
|
@@ -1,42 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
"$lt",
|
|
7
|
-
"$lte",
|
|
8
|
-
"$in",
|
|
9
|
-
"$nin",
|
|
10
|
-
"$ne",
|
|
11
|
-
"$exists",
|
|
12
|
-
"$not",
|
|
13
|
-
"$expr",
|
|
14
|
-
"$jsonSchema",
|
|
15
|
-
"$mod",
|
|
16
|
-
"$regex",
|
|
17
|
-
"$options",
|
|
18
|
-
"$text",
|
|
19
|
-
"$where",
|
|
20
|
-
"$all",
|
|
21
|
-
"$elemMatch",
|
|
22
|
-
"$size",
|
|
23
|
-
"$bitsAllClear",
|
|
24
|
-
"$bitsAllSet",
|
|
25
|
-
"$bitsAnyClear",
|
|
26
|
-
"$bitsAnySet"
|
|
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 intersection(...arrays) {
|
|
3
|
+
if (arrays.length === 0)
|
|
4
|
+
return [];
|
|
5
|
+
return [...new Set(arrays.reduce((a, b) => a.filter((c) => b.includes(c))))];
|
|
41
6
|
}
|
|
42
|
-
module.exports =
|
|
7
|
+
module.exports = intersection;
|
package/dist/index.cjs33.js
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
const expressionKeys = /* @__PURE__ */ new Set([
|
|
3
|
+
"$eq",
|
|
4
|
+
"$gt",
|
|
5
|
+
"$gte",
|
|
6
|
+
"$lt",
|
|
7
|
+
"$lte",
|
|
8
|
+
"$in",
|
|
9
|
+
"$nin",
|
|
10
|
+
"$ne",
|
|
11
|
+
"$exists",
|
|
12
|
+
"$not",
|
|
13
|
+
"$expr",
|
|
14
|
+
"$jsonSchema",
|
|
15
|
+
"$mod",
|
|
16
|
+
"$regex",
|
|
17
|
+
"$options",
|
|
18
|
+
"$text",
|
|
19
|
+
"$where",
|
|
20
|
+
"$all",
|
|
21
|
+
"$elemMatch",
|
|
22
|
+
"$size",
|
|
23
|
+
"$bitsAllClear",
|
|
24
|
+
"$bitsAllSet",
|
|
25
|
+
"$bitsAnyClear",
|
|
26
|
+
"$bitsAnySet"
|
|
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;
|
|
4
41
|
}
|
|
5
|
-
module.exports =
|
|
42
|
+
module.exports = isFieldExpression;
|
package/dist/index13.mjs
CHANGED
|
@@ -121,10 +121,7 @@ class AsyncDataAdapter {
|
|
|
121
121
|
onQueryStateChange,
|
|
122
122
|
executeQuery: async (selector, options) => {
|
|
123
123
|
await ready;
|
|
124
|
-
|
|
125
|
-
const result = getQueryResult(selector, options);
|
|
126
|
-
unregisterQuery(selector, options);
|
|
127
|
-
return result;
|
|
124
|
+
return this.executeQuery(collection.name, selector, options);
|
|
128
125
|
},
|
|
129
126
|
dispose: async () => {
|
|
130
127
|
this.storageAdapters.delete(collection.name);
|
|
@@ -344,7 +341,7 @@ class AsyncDataAdapter {
|
|
|
344
341
|
return [];
|
|
345
342
|
const modified = modify(deepClone(item), rest);
|
|
346
343
|
if (item.id !== modified.id) {
|
|
347
|
-
const existing = await
|
|
344
|
+
const existing = await storage.readIds([modified.id]);
|
|
348
345
|
if (existing.length > 0)
|
|
349
346
|
throw new Error(`Item with id ${String(modified.id)} already exists`);
|
|
350
347
|
}
|
|
@@ -363,7 +360,7 @@ class AsyncDataAdapter {
|
|
|
363
360
|
const changed = await Promise.all(items.map(async (item) => {
|
|
364
361
|
const modified = modify(deepClone(item), rest);
|
|
365
362
|
if (item.id !== modified.id) {
|
|
366
|
-
const existing = await
|
|
363
|
+
const existing = await storage.readIds([modified.id]);
|
|
367
364
|
if (existing.length > 0)
|
|
368
365
|
throw new Error(`Item with id ${String(modified.id)} already exists`);
|
|
369
366
|
}
|
|
@@ -383,7 +380,7 @@ class AsyncDataAdapter {
|
|
|
383
380
|
return [];
|
|
384
381
|
const modified = { ...replacement, id: replacement.id ?? item.id };
|
|
385
382
|
if (item.id !== modified.id) {
|
|
386
|
-
const existing = await
|
|
383
|
+
const existing = await storage.readIds([modified.id]);
|
|
387
384
|
if (existing.length > 0)
|
|
388
385
|
throw new Error(`Item with id ${String(modified.id)} already exists`);
|
|
389
386
|
}
|
package/dist/index21.mjs
CHANGED
package/dist/index22.mjs
CHANGED
package/dist/index26.mjs
CHANGED
package/dist/index30.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/index31.mjs
CHANGED
|
@@ -1,43 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
"$lt",
|
|
6
|
-
"$lte",
|
|
7
|
-
"$in",
|
|
8
|
-
"$nin",
|
|
9
|
-
"$ne",
|
|
10
|
-
"$exists",
|
|
11
|
-
"$not",
|
|
12
|
-
"$expr",
|
|
13
|
-
"$jsonSchema",
|
|
14
|
-
"$mod",
|
|
15
|
-
"$regex",
|
|
16
|
-
"$options",
|
|
17
|
-
"$text",
|
|
18
|
-
"$where",
|
|
19
|
-
"$all",
|
|
20
|
-
"$elemMatch",
|
|
21
|
-
"$size",
|
|
22
|
-
"$bitsAllClear",
|
|
23
|
-
"$bitsAllSet",
|
|
24
|
-
"$bitsAnyClear",
|
|
25
|
-
"$bitsAnySet"
|
|
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 intersection(...arrays) {
|
|
2
|
+
if (arrays.length === 0)
|
|
3
|
+
return [];
|
|
4
|
+
return [...new Set(arrays.reduce((a, b) => a.filter((c) => b.includes(c))))];
|
|
40
5
|
}
|
|
41
6
|
export {
|
|
42
|
-
|
|
7
|
+
intersection as default
|
|
43
8
|
};
|
package/dist/index33.mjs
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
const expressionKeys = /* @__PURE__ */ new Set([
|
|
2
|
+
"$eq",
|
|
3
|
+
"$gt",
|
|
4
|
+
"$gte",
|
|
5
|
+
"$lt",
|
|
6
|
+
"$lte",
|
|
7
|
+
"$in",
|
|
8
|
+
"$nin",
|
|
9
|
+
"$ne",
|
|
10
|
+
"$exists",
|
|
11
|
+
"$not",
|
|
12
|
+
"$expr",
|
|
13
|
+
"$jsonSchema",
|
|
14
|
+
"$mod",
|
|
15
|
+
"$regex",
|
|
16
|
+
"$options",
|
|
17
|
+
"$text",
|
|
18
|
+
"$where",
|
|
19
|
+
"$all",
|
|
20
|
+
"$elemMatch",
|
|
21
|
+
"$size",
|
|
22
|
+
"$bitsAllClear",
|
|
23
|
+
"$bitsAllSet",
|
|
24
|
+
"$bitsAnyClear",
|
|
25
|
+
"$bitsAnySet"
|
|
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;
|
|
3
40
|
}
|
|
4
41
|
export {
|
|
5
|
-
|
|
42
|
+
isFieldExpression as default
|
|
6
43
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signaldb/core",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.4",
|
|
4
4
|
"description": "SignalDB is a client-side database that provides a simple MongoDB-like interface to the data with first-class typescript support to achieve an optimistic UI. Data persistence can be achieved by using storage providers that store the data through a JSON interface to places such as localStorage.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "rimraf dist && vite build",
|