vasuzex 2.3.10 → 2.3.12
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/framework/Database/Model.js +12 -4
- package/package.json +6 -7
- package/test-results.txt +0 -6880
|
@@ -859,14 +859,22 @@ export class Model extends GuruORMModel {
|
|
|
859
859
|
if (this.timestamps && this.updatedAt) {
|
|
860
860
|
if (!Object.prototype.hasOwnProperty.call(this, '_cachedUpdateFn')) {
|
|
861
861
|
const modelClass = this;
|
|
862
|
-
// query.update
|
|
863
|
-
//
|
|
864
|
-
|
|
862
|
+
// IMPORTANT: Do NOT capture `query.update` here. `query` is a Proxy, and
|
|
863
|
+
// accessing `.update` on a Proxy returns a new wrapper closure that hardcodes
|
|
864
|
+
// the specific builder instance (`target`) from that call. Caching that wrapper
|
|
865
|
+
// means all subsequent `.update()` calls would execute against the ORIGINAL
|
|
866
|
+
// builder's QueryBuilder (from the first call), ignoring the current query's
|
|
867
|
+
// WHERE clauses (e.g. the per-record `WHERE id = ?` clause would be lost).
|
|
868
|
+
//
|
|
869
|
+
// Instead, use `this.query.update(data)` directly. When _cachedUpdateFn is
|
|
870
|
+
// invoked, `this` is the current EloquentBuilder instance (set by the Proxy's
|
|
871
|
+
// get trap via `value.apply(target, args)`), so `this.query` is the correct
|
|
872
|
+
// underlying QueryBuilder with all accumulated WHERE clauses.
|
|
865
873
|
this._cachedUpdateFn = async function timestampedUpdate(data) {
|
|
866
874
|
if (data[modelClass.updatedAt] === undefined) {
|
|
867
875
|
data[modelClass.updatedAt] = new Date();
|
|
868
876
|
}
|
|
869
|
-
return
|
|
877
|
+
return this.query.update(data);
|
|
870
878
|
};
|
|
871
879
|
}
|
|
872
880
|
query.update = this._cachedUpdateFn;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vasuzex",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.12",
|
|
4
4
|
"description": "Laravel-inspired framework for Node.js monorepos - V2 with optimized dependencies",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./framework/index.js",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"express-rate-limit": "^8.2.1",
|
|
109
109
|
"firebase-admin": "^13.6.0",
|
|
110
110
|
"fs-extra": "^11.3.2",
|
|
111
|
-
"guruorm": "^2.1.
|
|
111
|
+
"guruorm": "^2.1.24",
|
|
112
112
|
"helmet": "^8.1.0",
|
|
113
113
|
"inquirer": "^9.3.8",
|
|
114
114
|
"ip2location-nodejs": "^9.7.0",
|
|
@@ -160,17 +160,16 @@
|
|
|
160
160
|
"overrides": {
|
|
161
161
|
"express": "^5.2.1",
|
|
162
162
|
"react": "^18.2.0",
|
|
163
|
-
"vue": "^3.4.0"
|
|
164
|
-
"guruorm": "link:../GuruORM"
|
|
163
|
+
"vue": "^3.4.0"
|
|
165
164
|
}
|
|
166
165
|
},
|
|
167
166
|
"repository": {
|
|
168
167
|
"type": "git",
|
|
169
|
-
"url": "git+https://github.com/rishicool/vasuzex.git"
|
|
168
|
+
"url": "git+https://github.com/rishicool/vasuzex-v2.git"
|
|
170
169
|
},
|
|
171
170
|
"bugs": {
|
|
172
|
-
"url": "https://github.com/rishicool/vasuzex/issues"
|
|
171
|
+
"url": "https://github.com/rishicool/vasuzex-v2/issues"
|
|
173
172
|
},
|
|
174
|
-
"homepage": "https://github.com/rishicool/vasuzex#readme",
|
|
173
|
+
"homepage": "https://github.com/rishicool/vasuzex-v2#readme",
|
|
175
174
|
"packageManager": "pnpm@10.0.0"
|
|
176
175
|
}
|