@ditojs/server 2.79.0 → 2.81.0
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 +6 -6
- package/src/schema/relations.js +12 -2
- package/src/schema/schema.js +11 -9
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.81.0",
|
|
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",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"node >= 18"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@ditojs/admin": "^2.
|
|
30
|
-
"@ditojs/build": "^2.
|
|
31
|
-
"@ditojs/router": "^2.
|
|
32
|
-
"@ditojs/utils": "^2.
|
|
29
|
+
"@ditojs/admin": "^2.81.0",
|
|
30
|
+
"@ditojs/build": "^2.81.0",
|
|
31
|
+
"@ditojs/router": "^2.81.0",
|
|
32
|
+
"@ditojs/utils": "^2.81.0",
|
|
33
33
|
"@koa/cors": "^5.0.0",
|
|
34
34
|
"@koa/etag": "^5.0.2",
|
|
35
35
|
"@koa/multer": "^4.0.0",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"objection": "^3.1.5",
|
|
91
91
|
"typescript": "^5.9.3"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "13502bffe56e6c570a96092c692b9178789e3f62"
|
|
94
94
|
}
|
package/src/schema/relations.js
CHANGED
|
@@ -146,6 +146,7 @@ export function convertRelation(schema, models) {
|
|
|
146
146
|
let {
|
|
147
147
|
relation,
|
|
148
148
|
// Dito.js-style relation description:
|
|
149
|
+
modelClass,
|
|
149
150
|
from,
|
|
150
151
|
to,
|
|
151
152
|
through,
|
|
@@ -224,7 +225,7 @@ export function convertRelation(schema, models) {
|
|
|
224
225
|
const origModify = modify
|
|
225
226
|
modify = query => {
|
|
226
227
|
query.applyScope(
|
|
227
|
-
scope,
|
|
228
|
+
...asArray(scope),
|
|
228
229
|
// Pass `false` for `checkAllowedScopes`, to always allow scopes
|
|
229
230
|
// that are defined on relations to be applied.
|
|
230
231
|
false
|
|
@@ -234,9 +235,18 @@ export function convertRelation(schema, models) {
|
|
|
234
235
|
}
|
|
235
236
|
}
|
|
236
237
|
}
|
|
238
|
+
if (isString(modelClass)) {
|
|
239
|
+
const modelName = modelClass
|
|
240
|
+
modelClass = models[modelName]
|
|
241
|
+
if (!modelClass) {
|
|
242
|
+
throw new RelationError(
|
|
243
|
+
`Unknown model class: ${modelName}`
|
|
244
|
+
)
|
|
245
|
+
}
|
|
246
|
+
}
|
|
237
247
|
return {
|
|
238
248
|
relation: relationClass,
|
|
239
|
-
modelClass: to.modelClass,
|
|
249
|
+
modelClass: modelClass ?? to.modelClass,
|
|
240
250
|
join: {
|
|
241
251
|
from: from.toValue(),
|
|
242
252
|
to: to.toValue(),
|
package/src/schema/schema.js
CHANGED
|
@@ -146,15 +146,17 @@ export function convertSchema(
|
|
|
146
146
|
}
|
|
147
147
|
hasConvertedProperties = true
|
|
148
148
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
149
|
+
for (const key of ['additionalProperties', 'patternProperties']) {
|
|
150
|
+
if (isObject(schema[key])) {
|
|
151
|
+
// TODO: Don't we need to handle required here too?
|
|
152
|
+
const { properties } = convertProperties(
|
|
153
|
+
schema[key],
|
|
154
|
+
options,
|
|
155
|
+
entry
|
|
156
|
+
)
|
|
157
|
+
schema[key] = properties
|
|
158
|
+
hasConvertedProperties = true
|
|
159
|
+
}
|
|
158
160
|
}
|
|
159
161
|
if (
|
|
160
162
|
jsonType &&
|