@ditojs/server 1.4.2 → 1.4.3
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/server",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.3",
|
|
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,9 +21,9 @@
|
|
|
21
21
|
"node >= 16"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@ditojs/admin": "^1.4.
|
|
25
|
-
"@ditojs/router": "^1.4.
|
|
26
|
-
"@ditojs/utils": "^1.4.
|
|
24
|
+
"@ditojs/admin": "^1.4.3",
|
|
25
|
+
"@ditojs/router": "^1.4.3",
|
|
26
|
+
"@ditojs/utils": "^1.4.3",
|
|
27
27
|
"@koa/cors": "^3.2.0",
|
|
28
28
|
"@koa/multer": "^3.0.0",
|
|
29
29
|
"@originjs/vite-plugin-commonjs": "^1.0.3",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"pg": "^8.7.3",
|
|
82
82
|
"sqlite3": "^5.0.2"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "f2a544aef8ab0a12c7019650cd86558f8365b007"
|
|
85
85
|
}
|
|
@@ -17,6 +17,10 @@ export function handleUser() {
|
|
|
17
17
|
const { user } = ctx.state
|
|
18
18
|
await user?.$emit('before:logout', options)
|
|
19
19
|
await logout.call(this) // No options in passport's logout()
|
|
20
|
+
// Clear the session after logout, apparently koa-passport doesn't take
|
|
21
|
+
// care of this itself:
|
|
22
|
+
// https://stackoverflow.com/questions/55818887/koa-passport-logout-is-not-clearing-session
|
|
23
|
+
ctx.session = null
|
|
20
24
|
await user?.$emit('after:logout', options)
|
|
21
25
|
}
|
|
22
26
|
|
|
@@ -216,24 +216,19 @@ export class QueryBuilder extends objection.QueryBuilder {
|
|
|
216
216
|
this._allowScopes = query._allowScopes ? { ...query._allowScopes } : null
|
|
217
217
|
this._ignoreScopes = { ...query._ignoreScopes }
|
|
218
218
|
}
|
|
219
|
+
const scopes = isChildQuery
|
|
220
|
+
// When copying scopes for child-queries, we also need to take the already
|
|
221
|
+
// applied scopes into account and copy those too.
|
|
222
|
+
? { ...query._appliedScopes, ...query._scopes }
|
|
223
|
+
: { ...query._scopes }
|
|
219
224
|
// If the target is a child query of a graph query, copy all scopes, graph
|
|
220
225
|
// and non-graph. If it is a child query of a related or eager query,
|
|
221
226
|
// copy only the graph scopes.
|
|
222
227
|
const copyAllScopes =
|
|
223
228
|
isSameModelClass && isChildQuery && query.has(/GraphAndFetch$/)
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
? { ...query._appliedScopes, ...query._scopes }
|
|
228
|
-
: query._scopes
|
|
229
|
-
this._scopes = this._filterScopes(scopes, (scope, graph) =>
|
|
230
|
-
copyAllScopes || graph)
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
_filterScopes(scopes, callback) {
|
|
234
|
-
return Object.fromEntries(Object.entries(scopes).filter(
|
|
235
|
-
([scope, graph]) => callback(scope, graph)
|
|
236
|
-
))
|
|
229
|
+
this._scopes = copyAllScopes
|
|
230
|
+
? scopes
|
|
231
|
+
: filterScopes(scopes, (scope, graph) => graph) // copy graph-scopes only.
|
|
237
232
|
}
|
|
238
233
|
|
|
239
234
|
_applyScope(scope, graph) {
|
|
@@ -797,6 +792,12 @@ for (const key of [
|
|
|
797
792
|
}
|
|
798
793
|
}
|
|
799
794
|
|
|
795
|
+
function filterScopes(scopes, callback) {
|
|
796
|
+
return Object.fromEntries(Object.entries(scopes).filter(
|
|
797
|
+
([scope, graph]) => callback(scope, graph)
|
|
798
|
+
))
|
|
799
|
+
}
|
|
800
|
+
|
|
800
801
|
// The default options for insertDitoGraph(), upsertDitoGraph(),
|
|
801
802
|
// updateDitoGraph() and patchDitoGraph()
|
|
802
803
|
const insertDitoGraphOptions = {
|