@zudojs/api 1.0.0 → 1.0.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 -1
- package/dist/api/executor/executor.core.js +5 -1
- package/package.json +8 -4
package/README.md
CHANGED
|
@@ -172,7 +172,11 @@ context.metadata; // read-only snapshot keyed by key name
|
|
|
172
172
|
|
|
173
173
|
## Errors
|
|
174
174
|
|
|
175
|
-
`normalizeAPIError(error, operationName?)` converts anything thrown into an `APIError`. Non-API errors become an `APIInternalError` with a generic message and the original on `cause
|
|
175
|
+
`normalizeAPIError(error, operationName?)` converts anything thrown into an `APIError`. Non-API errors become an `APIInternalError` with a generic message and the original on `cause`, so `result.error.message` never carries a driver or library message.
|
|
176
|
+
|
|
177
|
+
`cause` is there for logging, and `BaseError.toJSON()` (the logging form, also used by `JSON.stringify`) serializes it — message and stack included — regardless of `expose`. Do not hand `result.error` to `res.json()` as-is: pick the fields a client may see (`code`, `statusCode`, and `message` only when `expose` is true), or run it through `ErrorSerializer` from `@zudojs/errors`.
|
|
178
|
+
|
|
179
|
+
Handlers are expected to return a promise, but a hand-rolled operation whose handler returns synchronously is executed the same way.
|
|
176
180
|
|
|
177
181
|
## License
|
|
178
182
|
|
|
@@ -288,7 +288,11 @@ function withDeadline(promise, timeoutMs, operationName, signal) {
|
|
|
288
288
|
reject(new APITimeoutError(timeoutMs));
|
|
289
289
|
}, timeoutMs);
|
|
290
290
|
signal?.addEventListener("abort", onAbort, { once: true });
|
|
291
|
-
promise.then
|
|
291
|
+
// `Promise.resolve` rather than `promise.then`: a hand-rolled operation
|
|
292
|
+
// whose handler returns synchronously is a legal JavaScript caller, and
|
|
293
|
+
// calling `.then` on its plain value failed with "promise.then is not a
|
|
294
|
+
// function" reported as an internal error of the operation.
|
|
295
|
+
Promise.resolve(promise).then((value) => {
|
|
292
296
|
cleanup();
|
|
293
297
|
resolve(value);
|
|
294
298
|
}, (error) => {
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zudojs/api",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Application-facing API layer for Zudojs — operation definitions, execution context, interceptors, and transport-agnostic contracts.",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Oluwayemi Oyinlola",
|
|
8
|
+
"url": "https://github.com/oyinlola-tech"
|
|
9
|
+
},
|
|
6
10
|
"type": "module",
|
|
7
11
|
"main": "./dist/index.js",
|
|
8
12
|
"module": "./dist/index.js",
|
|
@@ -23,10 +27,10 @@
|
|
|
23
27
|
"node": ">=24.0.0"
|
|
24
28
|
},
|
|
25
29
|
"dependencies": {
|
|
26
|
-
"@zudojs/errors": "1.0.
|
|
27
|
-
"@zudojs/constants": "1.0.
|
|
30
|
+
"@zudojs/errors": "1.0.1",
|
|
31
|
+
"@zudojs/constants": "1.0.1",
|
|
28
32
|
"@zudojs/types": "1.0.0",
|
|
29
|
-
"@zudojs/schema": "1.0.
|
|
33
|
+
"@zudojs/schema": "1.0.1"
|
|
30
34
|
},
|
|
31
35
|
"devDependencies": {
|
|
32
36
|
"typescript": "7.0.2",
|