@ditojs/server 2.32.3 → 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,18 +96,15 @@ export default class ControllerAction {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
async callAction(ctx) {
|
|
99
|
-
const params = await this.validateParameters(ctx)
|
|
100
|
-
const { args, member } = await this.collectArguments(
|
|
101
|
-
ctx,
|
|
102
|
-
params
|
|
103
|
-
)
|
|
99
|
+
const { params, wrapped } = await this.validateParameters(ctx)
|
|
100
|
+
const { args, member } = await this.collectArguments(ctx, params)
|
|
104
101
|
let filteredQuery = null
|
|
105
102
|
Object.defineProperty(ctx, 'filteredQuery', {
|
|
106
103
|
get: () => {
|
|
107
104
|
filteredQuery ??=
|
|
108
|
-
params && this.paramsName === 'query'
|
|
105
|
+
params && !wrapped && this.paramsName === 'query'
|
|
109
106
|
? this.filterParameters(params)
|
|
110
|
-
:
|
|
107
|
+
: ctx.query
|
|
111
108
|
return filteredQuery
|
|
112
109
|
},
|
|
113
110
|
enumerable: false,
|
|
@@ -132,13 +129,13 @@ export default class ControllerAction {
|
|
|
132
129
|
|
|
133
130
|
async validateParameters(ctx) {
|
|
134
131
|
if (!this.parameters.validate) {
|
|
135
|
-
return null
|
|
132
|
+
return { params: null, wrapped: false }
|
|
136
133
|
}
|
|
137
|
-
// Since validation also performs coercion, create a shallow clone
|
|
138
|
-
// params so that this doesn't modify the data on `ctx`.Actually used
|
|
139
|
-
// 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.
|
|
140
137
|
// NOTE: The data can be either an object or an array.
|
|
141
|
-
const data =
|
|
138
|
+
const data = clone(this.getParams(ctx), { shallow: true })
|
|
142
139
|
let params = {}
|
|
143
140
|
const { dataName } = this.parameters
|
|
144
141
|
let unwrapRoot = false
|
|
@@ -206,7 +203,8 @@ export default class ControllerAction {
|
|
|
206
203
|
const getData = () => (unwrapRoot ? params[dataName] : params)
|
|
207
204
|
try {
|
|
208
205
|
await this.parameters.validate(params)
|
|
209
|
-
|
|
206
|
+
const data = getData()
|
|
207
|
+
return { params: data, wrapped: data !== params }
|
|
210
208
|
} catch (error) {
|
|
211
209
|
if (error.errors) {
|
|
212
210
|
errors.push(...error.errors)
|