@ditojs/server 2.32.4 → 2.32.5
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.32.
|
|
3
|
+
"version": "2.32.5",
|
|
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",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"typescript": "^5.6.2"
|
|
94
94
|
},
|
|
95
95
|
"types": "types",
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "71e24797ccf5259b588c3fdfc8674167cf75db98"
|
|
97
97
|
}
|
|
@@ -96,13 +96,13 @@ export default class ControllerAction {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
async callAction(ctx) {
|
|
99
|
-
const params = await this.validateParameters(ctx)
|
|
99
|
+
const { params, wrapped } = await this.validateParameters(ctx)
|
|
100
100
|
const { args, member } = await this.collectArguments(ctx, params)
|
|
101
101
|
let filteredQuery = null
|
|
102
102
|
Object.defineProperty(ctx, 'filteredQuery', {
|
|
103
103
|
get: () => {
|
|
104
104
|
filteredQuery ??=
|
|
105
|
-
params && this.paramsName === 'query'
|
|
105
|
+
params && !wrapped && this.paramsName === 'query'
|
|
106
106
|
? this.filterParameters(params)
|
|
107
107
|
: ctx.query
|
|
108
108
|
return filteredQuery
|
|
@@ -129,13 +129,13 @@ export default class ControllerAction {
|
|
|
129
129
|
|
|
130
130
|
async validateParameters(ctx) {
|
|
131
131
|
if (!this.parameters.validate) {
|
|
132
|
-
return null
|
|
132
|
+
return { params: null, wrapped: false }
|
|
133
133
|
}
|
|
134
|
-
// Since validation also performs coercion, create a shallow clone
|
|
135
|
-
// params so that this doesn't modify the data on `ctx`.Actually used
|
|
136
|
-
// themselves are deep cloned below.
|
|
134
|
+
// Since validation also performs coercion, create a shallow clone of the
|
|
135
|
+
// params so that this doesn't modify the data on `ctx`. Actually used
|
|
136
|
+
// values themselves are deep cloned below.
|
|
137
137
|
// NOTE: The data can be either an object or an array.
|
|
138
|
-
const data =
|
|
138
|
+
const data = clone(this.getParams(ctx), { shallow: true })
|
|
139
139
|
let params = {}
|
|
140
140
|
const { dataName } = this.parameters
|
|
141
141
|
let unwrapRoot = false
|
|
@@ -203,7 +203,8 @@ export default class ControllerAction {
|
|
|
203
203
|
const getData = () => (unwrapRoot ? params[dataName] : params)
|
|
204
204
|
try {
|
|
205
205
|
await this.parameters.validate(params)
|
|
206
|
-
|
|
206
|
+
const data = getData()
|
|
207
|
+
return { params: data, wrapped: data !== params }
|
|
207
208
|
} catch (error) {
|
|
208
209
|
if (error.errors) {
|
|
209
210
|
errors.push(...error.errors)
|