@ditojs/server 1.4.1 → 1.4.2
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/package.json +3 -3
- package/src/query/QueryBuilder.js +10 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/server",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Dito.js Server – Dito.js is a declarative and modern web framework, based on Objection.js, Koa.js and Vue.js",
|
|
6
6
|
"repository": "https://github.com/ditojs/dito/tree/master/packages/server",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"node >= 16"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@ditojs/admin": "^1.4.
|
|
24
|
+
"@ditojs/admin": "^1.4.2",
|
|
25
25
|
"@ditojs/router": "^1.4.1",
|
|
26
26
|
"@ditojs/utils": "^1.4.1",
|
|
27
27
|
"@koa/cors": "^3.2.0",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"pg": "^8.7.3",
|
|
82
82
|
"sqlite3": "^5.0.2"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "1790e50f979322b47a53421e9facddb86f6eff86"
|
|
85
85
|
}
|
|
@@ -221,7 +221,12 @@ export class QueryBuilder extends objection.QueryBuilder {
|
|
|
221
221
|
// copy only the graph scopes.
|
|
222
222
|
const copyAllScopes =
|
|
223
223
|
isSameModelClass && isChildQuery && query.has(/GraphAndFetch$/)
|
|
224
|
-
|
|
224
|
+
// When copying scopes for child-queries, we also need to take the already
|
|
225
|
+
// applied scopes into account and copy those too.
|
|
226
|
+
const scopes = isChildQuery
|
|
227
|
+
? { ...query._appliedScopes, ...query._scopes }
|
|
228
|
+
: query._scopes
|
|
229
|
+
this._scopes = this._filterScopes(scopes, (scope, graph) =>
|
|
225
230
|
copyAllScopes || graph)
|
|
226
231
|
}
|
|
227
232
|
|
|
@@ -235,13 +240,15 @@ export class QueryBuilder extends objection.QueryBuilder {
|
|
|
235
240
|
if (!this._ignoreScopes[SYMBOL_ALL] && !this._ignoreScopes[scope]) {
|
|
236
241
|
// Prevent multiple application of scopes. This can easily occur
|
|
237
242
|
// with the nesting and eager-application of graph-scopes, see below.
|
|
238
|
-
|
|
243
|
+
// NOTE: The boolean values indicate the `graph` settings, not whether the
|
|
244
|
+
// scopes were applied or not.
|
|
245
|
+
if (!(scope in this._appliedScopes)) {
|
|
239
246
|
// Only apply graph-scopes that are actually defined on the model:
|
|
240
247
|
const func = this.modelClass().getScope(scope)
|
|
241
248
|
if (func) {
|
|
242
249
|
func.call(this, this)
|
|
243
250
|
}
|
|
244
|
-
this._appliedScopes[scope] =
|
|
251
|
+
this._appliedScopes[scope] = graph
|
|
245
252
|
}
|
|
246
253
|
if (graph) {
|
|
247
254
|
// Also bake the scope into any graph expression that may have been
|