@signaldb/core 1.5.2 → 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.
@@ -175,7 +175,10 @@
175
175
  "src/utils/modify.ts": {
176
176
  "file": "index.cjs10.js",
177
177
  "name": "utils/modify",
178
- "src": "src/utils/modify.ts"
178
+ "src": "src/utils/modify.ts",
179
+ "imports": [
180
+ "src/utils/deepClone.ts"
181
+ ]
179
182
  },
180
183
  "src/utils/project.ts": {
181
184
  "file": "index.cjs22.js",
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  const mingo = require("mingo");
3
+ const deepClone = require("./index.cjs15.js");
3
4
  function modify(item, modifier) {
4
5
  const hasOperators = Object.keys(modifier).some((key) => key.startsWith("$"));
5
6
  if (!hasOperators)
6
7
  return modifier;
7
- const clonedItem = { ...item };
8
+ const clonedItem = deepClone.default(item);
8
9
  mingo.update(clonedItem, modifier);
9
10
  return clonedItem;
10
11
  }
@@ -347,18 +347,19 @@ const _Collection = class _Collection extends EventEmitter {
347
347
  this.indicesOutdated = false;
348
348
  }
349
349
  getIndexInfo(selector) {
350
- if (selector != null && Object.keys(selector).length === 1 && "id" in selector && typeof selector.id !== "object") {
350
+ const isIdOnlySelector = selector != null && Object.keys(selector).length === 1 && "id" in selector;
351
+ if (selector == null) {
351
352
  return {
352
- matched: true,
353
- positions: [...this.idIndex.get(serializeValue(selector.id)) || []],
353
+ matched: false,
354
+ positions: [],
354
355
  optimizedSelector: {}
355
356
  };
356
357
  }
357
- if (selector == null || this.indicesOutdated) {
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/index10.mjs CHANGED
@@ -1,9 +1,10 @@
1
1
  import { update } from "mingo";
2
+ import deepClone from "./index15.mjs";
2
3
  function modify(item, modifier) {
3
4
  const hasOperators = Object.keys(modifier).some((key) => key.startsWith("$"));
4
5
  if (!hasOperators)
5
6
  return modifier;
6
- const clonedItem = { ...item };
7
+ const clonedItem = deepClone(item);
7
8
  update(clonedItem, modifier);
8
9
  return clonedItem;
9
10
  }
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
- if (selector != null && Object.keys(selector).length === 1 && "id" in selector && typeof selector.id !== "object") {
349
+ const isIdOnlySelector = selector != null && Object.keys(selector).length === 1 && "id" in selector;
350
+ if (selector == null) {
350
351
  return {
351
- matched: true,
352
- positions: [...this.idIndex.get(serializeValue(selector.id)) || []],
352
+ matched: false,
353
+ positions: [],
353
354
  optimizedSelector: {}
354
355
  };
355
356
  }
356
- if (selector == null || this.indicesOutdated) {
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@signaldb/core",
3
- "version": "1.5.2",
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",