@ditojs/server 2.51.0 → 2.51.1
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 +2 -2
- package/src/app/Application.js +3 -0
- package/src/app/Validator.js +14 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ditojs/server",
|
|
3
|
-
"version": "2.51.
|
|
3
|
+
"version": "2.51.1",
|
|
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",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"objection": "^3.1.5",
|
|
91
91
|
"typescript": "^5.8.3"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "b9faeb3c676bb792da67a028fa7de3bbdbc85de4"
|
|
94
94
|
}
|
package/src/app/Application.js
CHANGED
|
@@ -788,6 +788,9 @@ export class Application extends Koa {
|
|
|
788
788
|
if (this.config.log.errors?.stack === false) {
|
|
789
789
|
delete copy.stack
|
|
790
790
|
delete copy.cause
|
|
791
|
+
} else {
|
|
792
|
+
// Explicitly copy the stack trace, as clone() might not copy it.
|
|
793
|
+
copy.stack = error.stack
|
|
791
794
|
}
|
|
792
795
|
// Use `util.inspect()` instead of Pino's internal error logging for better
|
|
793
796
|
// stack traces and logging of error data.
|
package/src/app/Validator.js
CHANGED
|
@@ -96,20 +96,18 @@ export class Validator extends objection.Validator {
|
|
|
96
96
|
getAjv(options = {}) {
|
|
97
97
|
// Cache Ajv instances by keys that represent their options. For improved
|
|
98
98
|
// matching, convert options to a version with all default values missing:
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
const cacheKey = formatJson(opts, false)
|
|
106
|
-
const { ajv } = (
|
|
107
|
-
this.ajvCache[cacheKey] ||
|
|
108
|
-
(this.ajvCache[cacheKey] = {
|
|
109
|
-
ajv: this.createAjv(opts),
|
|
110
|
-
options
|
|
111
|
-
})
|
|
99
|
+
const filteredOptions = Object.fromEntries(
|
|
100
|
+
Object.entries(options).filter(
|
|
101
|
+
([key, value]) => (
|
|
102
|
+
key in validatorOptions && value !== validatorOptions[key]
|
|
103
|
+
)
|
|
104
|
+
)
|
|
112
105
|
)
|
|
106
|
+
const cacheKey = formatJson(filteredOptions, false)
|
|
107
|
+
const { ajv } = (this.ajvCache[cacheKey] ??= {
|
|
108
|
+
ajv: this.createAjv(filteredOptions),
|
|
109
|
+
options: filteredOptions
|
|
110
|
+
})
|
|
113
111
|
return ajv
|
|
114
112
|
}
|
|
115
113
|
|
|
@@ -205,6 +203,9 @@ export class Validator extends objection.Validator {
|
|
|
205
203
|
})
|
|
206
204
|
if (async) {
|
|
207
205
|
schema.$async = true
|
|
206
|
+
for (const definition of Object.values(schema.definitions || {})) {
|
|
207
|
+
definition.$async = true
|
|
208
|
+
}
|
|
208
209
|
}
|
|
209
210
|
return schema
|
|
210
211
|
}
|