@sprucelabs/data-stores 26.4.6 → 26.4.8

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.
@@ -57,8 +57,12 @@ class NeDbDatabase extends AbstractMutexer_1.default {
57
57
  prepQuery(query) {
58
58
  return this.valuesToDocument(this.toMongoId(query));
59
59
  }
60
- valuesToDocument(values) {
61
- const withId = this.toMongoId(values);
60
+ valuesToDocument(values, firstPrimaryFieldName) {
61
+ const withId = typeof values.id === 'number' ? values : this.toMongoId(values);
62
+ if (firstPrimaryFieldName === 'id') {
63
+ withId._id = withId.id;
64
+ delete withId.id;
65
+ }
62
66
  const nullsToPlaceholder = this.handlePlaceholders(withId, NULL_PLACEHOLDER, (val) => val === null || typeof val === 'undefined' || val === NULL_PLACEHOLDER);
63
67
  const undefinedToPlaceholder = this.handlePlaceholders(nullsToPlaceholder, UNDEFINED_PLACEHOLDER, (val) => val === undefined || val === UNDEFINED_PLACEHOLDER);
64
68
  return undefinedToPlaceholder;
@@ -65,8 +65,12 @@ export default class NeDbDatabase extends AbstractMutexer {
65
65
  prepQuery(query) {
66
66
  return this.valuesToDocument(this.toMongoId(query));
67
67
  }
68
- valuesToDocument(values) {
69
- const withId = this.toMongoId(values);
68
+ valuesToDocument(values, firstPrimaryFieldName) {
69
+ const withId = typeof values.id === 'number' ? values : this.toMongoId(values);
70
+ if (firstPrimaryFieldName === 'id') {
71
+ withId._id = withId.id;
72
+ delete withId.id;
73
+ }
70
74
  const nullsToPlaceholder = this.handlePlaceholders(withId, NULL_PLACEHOLDER, (val) => val === null || typeof val === 'undefined' || val === NULL_PLACEHOLDER);
71
75
  const undefinedToPlaceholder = this.handlePlaceholders(nullsToPlaceholder, UNDEFINED_PLACEHOLDER, (val) => val === undefined || val === UNDEFINED_PLACEHOLDER);
72
76
  return undefinedToPlaceholder;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "26.4.6",
6
+ "version": "26.4.8",
7
7
  "files": [
8
8
  "build/**/*",
9
9
  "!build/__tests__",
@@ -70,24 +70,24 @@
70
70
  "dependencies": {
71
71
  "@sprucelabs/error": "^5.1.57",
72
72
  "@sprucelabs/globby": "^1.0.6",
73
- "@sprucelabs/schema": "^29.3.7",
74
- "@sprucelabs/spruce-skill-utils": "^30.1.58",
73
+ "@sprucelabs/schema": "^29.3.9",
74
+ "@sprucelabs/spruce-skill-utils": "^30.1.60",
75
75
  "just-clone": "^6.2.0",
76
76
  "lodash": "^4.17.21",
77
77
  "mongodb": "^6.3.0",
78
78
  "nedb": "^1.8.0"
79
79
  },
80
80
  "devDependencies": {
81
- "@sprucelabs/esm-postbuild": "^5.0.119",
82
- "@sprucelabs/jest-json-reporter": "^7.0.140",
81
+ "@sprucelabs/esm-postbuild": "^5.0.120",
82
+ "@sprucelabs/jest-json-reporter": "^7.0.141",
83
83
  "@sprucelabs/jest-sheets-reporter": "^3.0.26",
84
84
  "@sprucelabs/resolve-path-aliases": "^1.1.275",
85
85
  "@sprucelabs/semantic-release": "^4.0.8",
86
86
  "@sprucelabs/test": "^8.0.39",
87
- "@sprucelabs/test-utils": "^4.0.94",
87
+ "@sprucelabs/test-utils": "^4.0.95",
88
88
  "@types/lodash": "^4.14.202",
89
89
  "@types/nedb": "^1.8.16",
90
- "@types/node": "^20.10.6",
90
+ "@types/node": "^20.10.7",
91
91
  "chokidar-cli": "^3.0.0",
92
92
  "concurrently": "^8.2.2",
93
93
  "dotenv": "^16.3.1",