@zudojs/api 1.1.0 → 1.1.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/README.md +5 -2
- package/dist/api/executor/executor.core.js +3 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -134,13 +134,16 @@ import { schema } from "@zudojs/schema";
|
|
|
134
134
|
|
|
135
135
|
const charge = defineOperation({
|
|
136
136
|
name: "payments.charge",
|
|
137
|
-
input: schema.object({
|
|
137
|
+
input: schema.object({
|
|
138
|
+
id: schema.string().uuid(),
|
|
139
|
+
amount: schema.number().min(1),
|
|
140
|
+
}),
|
|
138
141
|
output: schema.object({ ok: schema.boolean() }), // strips unknown keys
|
|
139
142
|
handler: async (input) => ({ ok: true }),
|
|
140
143
|
});
|
|
141
144
|
```
|
|
142
145
|
|
|
143
|
-
The executor validates the input before the handler runs and passes the schema's
|
|
146
|
+
The executor validates the input before the handler runs and passes the schema's _transformed_ value to the handler. Failures return an `APIValidationError` (422).
|
|
144
147
|
|
|
145
148
|
Schema issue messages routinely interpolate the value that failed, so by default the executor does **not** copy them into the client-facing error: each issue becomes `"<path>: invalid"` (e.g. `"user.email: invalid"`), naming where validation failed without echoing what was submitted. The list is capped at `MAX_VALIDATION_ISSUES` entries with a trailing `"… and N more issue(s) omitted."` marker.
|
|
146
149
|
|
|
@@ -166,7 +166,9 @@ export class APIExecutor {
|
|
|
166
166
|
*/
|
|
167
167
|
clientIssues(issues) {
|
|
168
168
|
const limit = this.maxValidationIssues;
|
|
169
|
-
const shown = issues
|
|
169
|
+
const shown = issues
|
|
170
|
+
.slice(0, limit)
|
|
171
|
+
.map((issue) => this.exposeValidationMessages
|
|
170
172
|
? truncate(issue.message, MAX_VALIDATION_ISSUE_LENGTH)
|
|
171
173
|
: `${formatIssuePath(issue)}: invalid`);
|
|
172
174
|
const omitted = issues.length - shown.length;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zudojs/api",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Application-facing API layer for Zudojs — operation definitions, execution context, interceptors, and transport-agnostic contracts.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -27,10 +27,10 @@
|
|
|
27
27
|
"node": ">=24.0.0"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@zudojs/errors": "1.
|
|
30
|
+
"@zudojs/errors": "1.2.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@zudojs/schema": "1.1.
|
|
33
|
+
"@zudojs/schema": "1.1.1",
|
|
34
34
|
"typescript": "7.0.2",
|
|
35
35
|
"vitest": "^4.1.11"
|
|
36
36
|
},
|