@naturalcycles/db-lib
Advanced tools
Comparing version 9.9.0 to 9.9.1
@@ -497,8 +497,11 @@ "use strict"; | ||
if (opt.skipDBRead) { | ||
const bmBefore = (0, js_lib_1._deepCopy)(bm); | ||
Object.assign(bm, patch); | ||
if ((0, js_lib_1._deepJsonEquals)(bm, bmBefore)) { | ||
const patched = { | ||
...bm, | ||
...patch, | ||
}; | ||
if ((0, js_lib_1._deepJsonEquals)(bm, patched)) { | ||
// Skipping the save operation, as data is the same | ||
return bm; | ||
} | ||
Object.assign(bm, patch); | ||
} | ||
@@ -508,9 +511,12 @@ else { | ||
if (loaded) { | ||
Object.assign(loaded, patch); | ||
if ((0, js_lib_1._deepJsonEquals)(loaded, bm)) { | ||
const loadedWithPatch = { | ||
...loaded, | ||
...patch, | ||
}; | ||
// Make `bm` exactly the same as `loadedWithPatch` | ||
(0, js_lib_1._objectAssignExact)(bm, loadedWithPatch); | ||
if ((0, js_lib_1._deepJsonEquals)(loaded, loadedWithPatch)) { | ||
// Skipping the save operation, as data is the same | ||
return bm; | ||
} | ||
// Make `bm` exactly the same as `loaded` | ||
(0, js_lib_1._objectAssignExact)(bm, loaded); | ||
} | ||
@@ -517,0 +523,0 @@ else { |
@@ -43,3 +43,3 @@ { | ||
}, | ||
"version": "9.9.0", | ||
"version": "9.9.1", | ||
"description": "Lowest Common Denominator API to supported Databases", | ||
@@ -46,0 +46,0 @@ "keywords": [ |
@@ -672,8 +672,12 @@ import { Transform } from 'node:stream' | ||
if (opt.skipDBRead) { | ||
const bmBefore = _deepCopy(bm) | ||
Object.assign(bm, patch) | ||
if (_deepJsonEquals(bm, bmBefore)) { | ||
const patched: BM = { | ||
...bm, | ||
...patch, | ||
} | ||
if (_deepJsonEquals(bm, patched)) { | ||
// Skipping the save operation, as data is the same | ||
return bm | ||
} | ||
Object.assign(bm, patch) | ||
} else { | ||
@@ -683,11 +687,14 @@ const loaded = await this.getById(bm.id, opt) | ||
if (loaded) { | ||
Object.assign(loaded, patch) | ||
const loadedWithPatch: BM = { | ||
...loaded, | ||
...patch, | ||
} | ||
if (_deepJsonEquals(loaded, bm)) { | ||
// Make `bm` exactly the same as `loadedWithPatch` | ||
_objectAssignExact(bm, loadedWithPatch) | ||
if (_deepJsonEquals(loaded, loadedWithPatch)) { | ||
// Skipping the save operation, as data is the same | ||
return bm | ||
} | ||
// Make `bm` exactly the same as `loaded` | ||
_objectAssignExact(bm, loaded) | ||
} else { | ||
@@ -694,0 +701,0 @@ Object.assign(bm, patch) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
417849
10981