@sebspark/openapi-express 1.1.2 → 1.1.4
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/dist/index.js +7 -10
- package/dist/index.mjs +7 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -46,10 +46,8 @@ var TypedRouter = (api, options = {}) => {
|
|
|
46
46
|
res.setHeader(name, value);
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
if (data)
|
|
50
|
-
|
|
51
|
-
else
|
|
52
|
-
res.end();
|
|
49
|
+
if (data) res.send(data);
|
|
50
|
+
else res.end();
|
|
53
51
|
} catch (error) {
|
|
54
52
|
next(error);
|
|
55
53
|
}
|
|
@@ -62,16 +60,15 @@ var TypedRouter = (api, options = {}) => {
|
|
|
62
60
|
router.use(errorHandler);
|
|
63
61
|
return router;
|
|
64
62
|
};
|
|
65
|
-
var errorHandler = (err, _req, res,
|
|
66
|
-
let error;
|
|
67
|
-
if (
|
|
68
|
-
|
|
69
|
-
} else {
|
|
70
|
-
const internal = err instanceof Error ? err : typeof err === "string" ? new Error(err) : void 0;
|
|
63
|
+
var errorHandler = (err, _req, res, next) => {
|
|
64
|
+
let error = err;
|
|
65
|
+
if (!error.message || !error.statusCode) {
|
|
66
|
+
const internal = err instanceof Error ? err : typeof err === "string" ? new Error(err) : new Error(JSON.stringify(err || ""));
|
|
71
67
|
error = (0, import_openapi_core.createHttpError)(500, void 0, internal);
|
|
72
68
|
}
|
|
73
69
|
const showStack = process.env.NODE_ENV !== "production";
|
|
74
70
|
res.status(error.statusCode).send(error.toJSON(showStack));
|
|
71
|
+
next(error);
|
|
75
72
|
};
|
|
76
73
|
// Annotate the CommonJS export names for ESM import in node:
|
|
77
74
|
0 && (module.exports = {
|
package/dist/index.mjs
CHANGED
|
@@ -25,10 +25,8 @@ var TypedRouter = (api, options = {}) => {
|
|
|
25
25
|
res.setHeader(name, value);
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
|
-
if (data)
|
|
29
|
-
|
|
30
|
-
else
|
|
31
|
-
res.end();
|
|
28
|
+
if (data) res.send(data);
|
|
29
|
+
else res.end();
|
|
32
30
|
} catch (error) {
|
|
33
31
|
next(error);
|
|
34
32
|
}
|
|
@@ -41,16 +39,15 @@ var TypedRouter = (api, options = {}) => {
|
|
|
41
39
|
router.use(errorHandler);
|
|
42
40
|
return router;
|
|
43
41
|
};
|
|
44
|
-
var errorHandler = (err, _req, res,
|
|
45
|
-
let error;
|
|
46
|
-
if (
|
|
47
|
-
|
|
48
|
-
} else {
|
|
49
|
-
const internal = err instanceof Error ? err : typeof err === "string" ? new Error(err) : void 0;
|
|
42
|
+
var errorHandler = (err, _req, res, next) => {
|
|
43
|
+
let error = err;
|
|
44
|
+
if (!error.message || !error.statusCode) {
|
|
45
|
+
const internal = err instanceof Error ? err : typeof err === "string" ? new Error(err) : new Error(JSON.stringify(err || ""));
|
|
50
46
|
error = createHttpError(500, void 0, internal);
|
|
51
47
|
}
|
|
52
48
|
const showStack = process.env.NODE_ENV !== "production";
|
|
53
49
|
res.status(error.statusCode).send(error.toJSON(showStack));
|
|
50
|
+
next(error);
|
|
54
51
|
};
|
|
55
52
|
export {
|
|
56
53
|
TypedRouter
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sebspark/openapi-express",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.4",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"build": "tsup-node src/index.ts --format esm,cjs --dts",
|
|
13
13
|
"dev": "tsc --watch --noEmit",
|
|
14
14
|
"lint": "biome check .",
|
|
15
|
-
"test": "vitest --passWithNoTests --coverage",
|
|
15
|
+
"test": "vitest run --passWithNoTests --coverage",
|
|
16
16
|
"typecheck": "vitest --typecheck.only --passWithNoTests"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|