nicot 1.2.6 → 1.2.7
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/index.cjs +2 -25
- package/dist/index.cjs.map +3 -3
- package/dist/index.mjs +1 -24
- package/dist/index.mjs.map +3 -3
- package/package.json +3 -2
- package/dist/src/utility/observe-diff.d.ts +0 -6
package/dist/index.cjs
CHANGED
|
@@ -1473,30 +1473,7 @@ async function getPaginatedResult(qb, entityClass, entityAliasName, take, cursor
|
|
|
1473
1473
|
|
|
1474
1474
|
// src/crud-base.ts
|
|
1475
1475
|
var import_p_queue = __toESM(require("p-queue"));
|
|
1476
|
-
|
|
1477
|
-
// src/utility/observe-diff.ts
|
|
1478
|
-
var observeDiff = (obj, cb) => {
|
|
1479
|
-
return new Proxy(obj, {
|
|
1480
|
-
set(target, key, value) {
|
|
1481
|
-
const oldValue = target[key];
|
|
1482
|
-
const type = Object.prototype.hasOwnProperty.call(target, key) ? "update" : "add";
|
|
1483
|
-
target[key] = value;
|
|
1484
|
-
cb({ type, key, oldValue, newValue: value });
|
|
1485
|
-
return true;
|
|
1486
|
-
},
|
|
1487
|
-
deleteProperty(target, key) {
|
|
1488
|
-
if (Object.prototype.hasOwnProperty.call(target, key)) {
|
|
1489
|
-
const oldValue = target[key];
|
|
1490
|
-
delete target[key];
|
|
1491
|
-
cb({ type: "delete", key, oldValue, newValue: void 0 });
|
|
1492
|
-
return true;
|
|
1493
|
-
}
|
|
1494
|
-
return false;
|
|
1495
|
-
}
|
|
1496
|
-
});
|
|
1497
|
-
};
|
|
1498
|
-
|
|
1499
|
-
// src/crud-base.ts
|
|
1476
|
+
var import_nfkit = require("nfkit");
|
|
1500
1477
|
var Relation = (name, options = {}) => {
|
|
1501
1478
|
return { name, inner: false, ...options };
|
|
1502
1479
|
};
|
|
@@ -2137,7 +2114,7 @@ var CrudBase = class {
|
|
|
2137
2114
|
}
|
|
2138
2115
|
const initial = { ...ent };
|
|
2139
2116
|
let changes = {};
|
|
2140
|
-
const entProxy = observeDiff(ent, (change) => {
|
|
2117
|
+
const entProxy = (0, import_nfkit.observeDiff)(ent, (change) => {
|
|
2141
2118
|
if (change.type === "delete") {
|
|
2142
2119
|
if (initial[change.key] === null) {
|
|
2143
2120
|
delete changes[change.key];
|