@ditojs/server 2.63.0 → 2.65.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/server",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.65.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.65.0",
|
|
30
|
+
"@ditojs/build": "^2.65.0",
|
|
31
|
+
"@ditojs/router": "^2.65.0",
|
|
32
|
+
"@ditojs/utils": "^2.65.0",
|
|
33
33
|
"@koa/cors": "^5.0.0",
|
|
34
34
|
"@koa/etag": "^5.0.1",
|
|
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": "abd7830b97293838345f904105a3847cdbd34f52"
|
|
94
94
|
}
|
package/src/models/Model.js
CHANGED
|
@@ -340,7 +340,7 @@ export class Model extends objection.Model {
|
|
|
340
340
|
properties: this.getIdPropertyArray().reduce(
|
|
341
341
|
(idProperties, idProperty) => {
|
|
342
342
|
idProperties[idProperty] = {
|
|
343
|
-
type: this.
|
|
343
|
+
type: this.getProperty(idProperty).type
|
|
344
344
|
}
|
|
345
345
|
return idProperties
|
|
346
346
|
},
|
|
@@ -467,25 +467,26 @@ export class Model extends objection.Model {
|
|
|
467
467
|
)
|
|
468
468
|
}
|
|
469
469
|
|
|
470
|
-
static
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
for (let [name, property] of Object.entries(properties)) {
|
|
475
|
-
// Expand $refs so we can even find properties that uses definitions:
|
|
470
|
+
static getProperty(name) {
|
|
471
|
+
let property = this.definition.properties[name]
|
|
472
|
+
// Expand $refs so we can even find properties that uses definitions:
|
|
473
|
+
if (property?.$ref) {
|
|
476
474
|
const { $ref, ...schema } = property
|
|
477
|
-
const definition =
|
|
475
|
+
const definition = this.jsonSchema.definitions?.[$ref]
|
|
478
476
|
if (definition) {
|
|
479
477
|
property = {
|
|
480
478
|
...schema,
|
|
481
479
|
...definition
|
|
482
480
|
}
|
|
483
481
|
}
|
|
484
|
-
if (filter(property)) {
|
|
485
|
-
attributes.push(name)
|
|
486
|
-
}
|
|
487
482
|
}
|
|
488
|
-
return
|
|
483
|
+
return property ?? null
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
static getAttributes(filter) {
|
|
487
|
+
return Object.keys(this.definition.properties).filter(name =>
|
|
488
|
+
filter(this.getProperty(name))
|
|
489
|
+
)
|
|
489
490
|
}
|
|
490
491
|
|
|
491
492
|
static _getCached(identifier, calculate, empty = {}) {
|
|
@@ -707,7 +708,7 @@ export class Model extends objection.Model {
|
|
|
707
708
|
}
|
|
708
709
|
|
|
709
710
|
const [firstToken, ...otherTokens] = parsedDataPath
|
|
710
|
-
const property = this.
|
|
711
|
+
const property = this.getProperty(firstToken)
|
|
711
712
|
if (property) {
|
|
712
713
|
return getResult({ property })
|
|
713
714
|
} else if (firstToken === '*' || firstToken === '**') {
|
|
@@ -1058,7 +1059,7 @@ export class Model extends objection.Model {
|
|
|
1058
1059
|
// Select only the properties that are present in the data,
|
|
1059
1060
|
// and which aren't the result of computed properties.
|
|
1060
1061
|
Object.keys(inputItems[0]).filter(key => {
|
|
1061
|
-
const property = this.
|
|
1062
|
+
const property = this.getProperty(key)
|
|
1062
1063
|
return property && !property.computed
|
|
1063
1064
|
})
|
|
1064
1065
|
)
|