@signaldb/core 1.5.3 → 1.5.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.cjs2.js +6 -5
- package/dist/index.cjs22.js +1 -1
- package/dist/index.cjs23.js +1 -1
- package/dist/index.cjs26.js +1 -1
- package/dist/index.cjs27.js +40 -27
- package/dist/index.cjs28.js +27 -7
- package/dist/index.cjs29.js +7 -40
- package/dist/index2.mjs +6 -5
- package/dist/index22.mjs +1 -1
- package/dist/index23.mjs +1 -1
- package/dist/index26.mjs +1 -1
- package/dist/index27.mjs +40 -27
- package/dist/index28.mjs +27 -7
- package/dist/index29.mjs +7 -40
- package/package.json +1 -1
package/dist/.vite/manifest.json
CHANGED
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
"src": "src/utils/isEqual.ts"
|
|
164
164
|
},
|
|
165
165
|
"src/utils/isFieldExpression.ts": {
|
|
166
|
-
"file": "index.
|
|
166
|
+
"file": "index.cjs27.js",
|
|
167
167
|
"name": "utils/isFieldExpression",
|
|
168
168
|
"src": "src/utils/isFieldExpression.ts"
|
|
169
169
|
},
|
|
@@ -200,7 +200,7 @@
|
|
|
200
200
|
"src": "src/utils/serializeValue.ts"
|
|
201
201
|
},
|
|
202
202
|
"src/utils/set.ts": {
|
|
203
|
-
"file": "index.
|
|
203
|
+
"file": "index.cjs28.js",
|
|
204
204
|
"name": "utils/set",
|
|
205
205
|
"src": "src/utils/set.ts"
|
|
206
206
|
},
|
|
@@ -213,7 +213,7 @@
|
|
|
213
213
|
]
|
|
214
214
|
},
|
|
215
215
|
"src/utils/uniqueBy.ts": {
|
|
216
|
-
"file": "index.
|
|
216
|
+
"file": "index.cjs29.js",
|
|
217
217
|
"name": "utils/uniqueBy",
|
|
218
218
|
"src": "src/utils/uniqueBy.ts"
|
|
219
219
|
}
|
package/dist/index.cjs2.js
CHANGED
|
@@ -347,18 +347,19 @@ const _Collection = class _Collection extends EventEmitter {
|
|
|
347
347
|
this.indicesOutdated = false;
|
|
348
348
|
}
|
|
349
349
|
getIndexInfo(selector) {
|
|
350
|
-
|
|
350
|
+
const isIdOnlySelector = selector != null && Object.keys(selector).length === 1 && "id" in selector;
|
|
351
|
+
if (selector == null) {
|
|
351
352
|
return {
|
|
352
|
-
matched:
|
|
353
|
-
positions: [
|
|
353
|
+
matched: false,
|
|
354
|
+
positions: [],
|
|
354
355
|
optimizedSelector: {}
|
|
355
356
|
};
|
|
356
357
|
}
|
|
357
|
-
if (
|
|
358
|
+
if (!isIdOnlySelector && this.indicesOutdated) {
|
|
358
359
|
return {
|
|
359
360
|
matched: false,
|
|
360
361
|
positions: [],
|
|
361
|
-
optimizedSelector:
|
|
362
|
+
optimizedSelector: selector
|
|
362
363
|
};
|
|
363
364
|
}
|
|
364
365
|
return getIndexInfo.default(this.indexProviders, selector);
|
package/dist/index.cjs22.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const get = require("./index.cjs25.js");
|
|
3
|
-
const set = require("./index.
|
|
3
|
+
const set = require("./index.cjs28.js");
|
|
4
4
|
function project(item, fields) {
|
|
5
5
|
const allFieldsDeactivated = Object.values(fields).every((value) => value === 0);
|
|
6
6
|
if (allFieldsDeactivated) {
|
package/dist/index.cjs23.js
CHANGED
|
@@ -3,7 +3,7 @@ var __defProp = Object.defineProperty;
|
|
|
3
3
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
4
4
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
5
5
|
const isEqual = require("./index.cjs9.js");
|
|
6
|
-
const uniqueBy = require("./index.
|
|
6
|
+
const uniqueBy = require("./index.cjs29.js");
|
|
7
7
|
class Observer {
|
|
8
8
|
/**
|
|
9
9
|
* Creates a new instance of the `Observer` class.
|
package/dist/index.cjs26.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const isFieldExpression = require("./index.
|
|
2
|
+
const isFieldExpression = require("./index.cjs27.js");
|
|
3
3
|
const serializeValue = require("./index.cjs16.js");
|
|
4
4
|
function getMatchingKeys(field, selector) {
|
|
5
5
|
const result = { include: null, exclude: null };
|
package/dist/index.cjs27.js
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
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
|
-
|
|
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;
|
|
28
41
|
}
|
|
29
|
-
module.exports =
|
|
42
|
+
module.exports = isFieldExpression;
|
package/dist/index.cjs28.js
CHANGED
|
@@ -1,9 +1,29 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
function
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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;
|
|
8
28
|
}
|
|
9
|
-
module.exports =
|
|
29
|
+
module.exports = set;
|
package/dist/index.cjs29.js
CHANGED
|
@@ -1,42 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
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 uniqueBy(array, fn) {
|
|
3
|
+
const set = /* @__PURE__ */ new Set();
|
|
4
|
+
return array.filter((element) => {
|
|
5
|
+
const value = typeof fn === "function" ? fn(element) : element[fn];
|
|
6
|
+
return !set.has(value) && set.add(value);
|
|
7
|
+
});
|
|
41
8
|
}
|
|
42
|
-
module.exports =
|
|
9
|
+
module.exports = uniqueBy;
|
package/dist/index2.mjs
CHANGED
|
@@ -346,18 +346,19 @@ const _Collection = class _Collection extends EventEmitter {
|
|
|
346
346
|
this.indicesOutdated = false;
|
|
347
347
|
}
|
|
348
348
|
getIndexInfo(selector) {
|
|
349
|
-
|
|
349
|
+
const isIdOnlySelector = selector != null && Object.keys(selector).length === 1 && "id" in selector;
|
|
350
|
+
if (selector == null) {
|
|
350
351
|
return {
|
|
351
|
-
matched:
|
|
352
|
-
positions: [
|
|
352
|
+
matched: false,
|
|
353
|
+
positions: [],
|
|
353
354
|
optimizedSelector: {}
|
|
354
355
|
};
|
|
355
356
|
}
|
|
356
|
-
if (
|
|
357
|
+
if (!isIdOnlySelector && this.indicesOutdated) {
|
|
357
358
|
return {
|
|
358
359
|
matched: false,
|
|
359
360
|
positions: [],
|
|
360
|
-
optimizedSelector:
|
|
361
|
+
optimizedSelector: selector
|
|
361
362
|
};
|
|
362
363
|
}
|
|
363
364
|
return getIndexInfo(this.indexProviders, selector);
|
package/dist/index22.mjs
CHANGED
package/dist/index23.mjs
CHANGED
|
@@ -2,7 +2,7 @@ var __defProp = Object.defineProperty;
|
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
4
|
import isEqual from "./index9.mjs";
|
|
5
|
-
import uniqueBy from "./
|
|
5
|
+
import uniqueBy from "./index29.mjs";
|
|
6
6
|
class Observer {
|
|
7
7
|
/**
|
|
8
8
|
* Creates a new instance of the `Observer` class.
|
package/dist/index26.mjs
CHANGED
package/dist/index27.mjs
CHANGED
|
@@ -1,30 +1,43 @@
|
|
|
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
|
-
|
|
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;
|
|
27
40
|
}
|
|
28
41
|
export {
|
|
29
|
-
|
|
42
|
+
isFieldExpression as default
|
|
30
43
|
};
|
package/dist/index28.mjs
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
|
-
function
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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;
|
|
7
27
|
}
|
|
8
28
|
export {
|
|
9
|
-
|
|
29
|
+
set as default
|
|
10
30
|
};
|
package/dist/index29.mjs
CHANGED
|
@@ -1,43 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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 uniqueBy(array, fn) {
|
|
2
|
+
const set = /* @__PURE__ */ new Set();
|
|
3
|
+
return array.filter((element) => {
|
|
4
|
+
const value = typeof fn === "function" ? fn(element) : element[fn];
|
|
5
|
+
return !set.has(value) && set.add(value);
|
|
6
|
+
});
|
|
40
7
|
}
|
|
41
8
|
export {
|
|
42
|
-
|
|
9
|
+
uniqueBy as default
|
|
43
10
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@signaldb/core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.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",
|