@salespark/route-utils 1.0.5 → 1.0.7
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 +56 -9
- package/dist/index.d.ts +45 -22
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -42
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,10 +21,10 @@ Supports both **CommonJS** and **ESM** imports.
|
|
|
21
21
|
|
|
22
22
|
```ts
|
|
23
23
|
// ESM
|
|
24
|
-
import { wrapRoute, createResponder, makeRouteUtils, resolveRouteResponse } from "@salespark/route-utils";
|
|
24
|
+
import { wrapRoute, createResponder, makeRouteUtils, resolveRouteResponse, errorSanitizer } from "@salespark/route-utils";
|
|
25
25
|
|
|
26
26
|
// CommonJS
|
|
27
|
-
const { wrapRoute, createResponder, makeRouteUtils, resolveRouteResponse } = require("@salespark/route-utils");
|
|
27
|
+
const { wrapRoute, createResponder, makeRouteUtils, resolveRouteResponse, errorSanitizer } = require("@salespark/route-utils");
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
---
|
|
@@ -75,7 +75,7 @@ All route handlers must return an object with the following structure:
|
|
|
75
75
|
```ts
|
|
76
76
|
import { makeRouteUtils } from "@salespark/route-utils";
|
|
77
77
|
|
|
78
|
-
const { wrapRoute, createResponder, resolveRouteResponse } = makeRouteUtils({
|
|
78
|
+
const { wrapRoute, createResponder, resolveRouteResponse, errorSanitizer } = makeRouteUtils({
|
|
79
79
|
logger: console.error, // or rollbar.error, sentry.captureException, etc.
|
|
80
80
|
tagPrefix: "/routes/producers", // optional prefix for logs
|
|
81
81
|
});
|
|
@@ -91,6 +91,7 @@ const { wrapRoute, createResponder, resolveRouteResponse } = makeRouteUtils({
|
|
|
91
91
|
- `wrapRoute`
|
|
92
92
|
- `createResponder`
|
|
93
93
|
- `resolveRouteResponse`
|
|
94
|
+
- `errorSanitizer`
|
|
94
95
|
|
|
95
96
|
---
|
|
96
97
|
|
|
@@ -107,8 +108,8 @@ router.get(
|
|
|
107
108
|
const producerId = res.locals.auth.producer_id;
|
|
108
109
|
return ops.getProducerAchievements(producerId);
|
|
109
110
|
},
|
|
110
|
-
{ tag: "GET /achievements" }
|
|
111
|
-
)
|
|
111
|
+
{ tag: "GET /achievements" },
|
|
112
|
+
),
|
|
112
113
|
);
|
|
113
114
|
```
|
|
114
115
|
|
|
@@ -136,6 +137,52 @@ if (!resolveRouteResponse(res, response)) {
|
|
|
136
137
|
|
|
137
138
|
---
|
|
138
139
|
|
|
140
|
+
### `errorSanitizer`
|
|
141
|
+
|
|
142
|
+
Sanitizes error output to avoid leaking sensitive data. It tries `error.reason`, then `error.message`, then falls back to a safe default.
|
|
143
|
+
|
|
144
|
+
```ts
|
|
145
|
+
const { createResponder, errorSanitizer } = require("@salespark/route-utils");
|
|
146
|
+
|
|
147
|
+
router.post("/something-awesome", async (req, res) => {
|
|
148
|
+
try {
|
|
149
|
+
// ...working code here...
|
|
150
|
+
// Some code here that might throw an error
|
|
151
|
+
|
|
152
|
+
const respond = createResponder(res);
|
|
153
|
+
await respond(() => ops.yourAwesomeFunction(req.body));
|
|
154
|
+
|
|
155
|
+
// Error handling
|
|
156
|
+
} catch (error) {
|
|
157
|
+
res.status(500).send(errorSanitizer(error)).end();
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
router.post("/something-awesome", async (req, res) => {
|
|
162
|
+
try {
|
|
163
|
+
ops
|
|
164
|
+
.yourAwesomeFunction(req.body)
|
|
165
|
+
.then((response) => {
|
|
166
|
+
res.status(200).send(response).end();
|
|
167
|
+
})
|
|
168
|
+
.catch((err) => {
|
|
169
|
+
res.status(400).send(errorSanitizer(err)).end();
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// Error handling
|
|
173
|
+
} catch (error) {
|
|
174
|
+
res.status(500).send(errorSanitizer(error)).end();
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Options:
|
|
180
|
+
|
|
181
|
+
- `maxLength` (default: 500)
|
|
182
|
+
- `allowErrorMessage` (default: false) - When true, allows `error.message` for `Error` instances
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
139
186
|
## 🧪 Usage Examples
|
|
140
187
|
|
|
141
188
|
### Example 1: Silent Mode (default)
|
|
@@ -143,7 +190,7 @@ if (!resolveRouteResponse(res, response)) {
|
|
|
143
190
|
```ts
|
|
144
191
|
app.get(
|
|
145
192
|
"/ping",
|
|
146
|
-
wrapRoute(async () => ({ status: true, data: "pong" }))
|
|
193
|
+
wrapRoute(async () => ({ status: true, data: "pong" })),
|
|
147
194
|
);
|
|
148
195
|
```
|
|
149
196
|
|
|
@@ -176,7 +223,7 @@ app.post(
|
|
|
176
223
|
return { status: false, data: { error: "ValidationError", message: "Name required" }, http: 422 };
|
|
177
224
|
}
|
|
178
225
|
return { status: true, data: { id: 1, name: req.body.name }, http: 201 };
|
|
179
|
-
})
|
|
226
|
+
}),
|
|
180
227
|
);
|
|
181
228
|
```
|
|
182
229
|
|
|
@@ -233,5 +280,5 @@ MIT © [SalesPark](https://salespark.io)
|
|
|
233
280
|
|
|
234
281
|
---
|
|
235
282
|
|
|
236
|
-
_Document version:
|
|
237
|
-
_Last update:
|
|
283
|
+
_Document version: 5_
|
|
284
|
+
_Last update: 20-03-2026_
|
package/dist/index.d.ts
CHANGED
|
@@ -45,15 +45,28 @@ export interface ApiResponse<T = unknown, M = unknown> {
|
|
|
45
45
|
meta?: M;
|
|
46
46
|
}
|
|
47
47
|
/****************************************************************************************************************
|
|
48
|
-
* ##:
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
* @param
|
|
54
|
-
* @
|
|
55
|
-
*
|
|
56
|
-
*
|
|
48
|
+
* ##: Sanitize error response payload
|
|
49
|
+
* Builds a safe error object with optional exposure of Error.message when explicitly allowed.
|
|
50
|
+
* @param {unknown} error - Raw error input to sanitize for response output
|
|
51
|
+
* @param {object} options - Optional settings for sanitizer behavior
|
|
52
|
+
* @param {number} options.maxLength - Maximum length for the output error message
|
|
53
|
+
* @param {boolean} options.allowErrorMessage - Allow Error.message when error is an Error instance
|
|
54
|
+
* @returns {{ error: string }} - Sanitized error payload with a safe error message
|
|
55
|
+
* History:
|
|
56
|
+
* 18-03-2026: Created
|
|
57
|
+
****************************************************************************************************************/
|
|
58
|
+
export declare const errorSanitizer: (error: unknown, options?: {
|
|
59
|
+
maxLength?: number;
|
|
60
|
+
allowErrorMessage?: boolean;
|
|
61
|
+
}) => {
|
|
62
|
+
error: string;
|
|
63
|
+
};
|
|
64
|
+
/****************************************************************************************************************
|
|
65
|
+
* ##: Create route utility helpers with defaults
|
|
66
|
+
* Builds helper functions bound to a default logger and tag prefix for consistent route handling.
|
|
67
|
+
* @param {LoggerFn} logger - Optional logger for reporting unexpected shapes or errors
|
|
68
|
+
* @param {string} tagPrefix - Optional prefix appended to generated log tags
|
|
69
|
+
* @returns {object} - Helper bundle: wrapRoute, createResponder, resolveRouteResponse, errorSanitizer
|
|
57
70
|
* History:
|
|
58
71
|
* 16-08-2025: Created
|
|
59
72
|
****************************************************************************************************************/
|
|
@@ -70,21 +83,19 @@ export declare const makeRouteUtils: ({ logger, tagPrefix, }?: {
|
|
|
70
83
|
logger?: LoggerFn;
|
|
71
84
|
}) => (workFn: () => Promise<ApiResponse> | ApiResponse) => Promise<boolean>;
|
|
72
85
|
resolveRouteResponse: (res: ResLike, response: any) => boolean;
|
|
86
|
+
errorSanitizer: (error: unknown, options?: {
|
|
87
|
+
maxLength?: number;
|
|
88
|
+
allowErrorMessage?: boolean;
|
|
89
|
+
}) => {
|
|
90
|
+
error: string;
|
|
91
|
+
};
|
|
73
92
|
};
|
|
74
93
|
/****************************************************************************************************************
|
|
75
|
-
* ##:
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
*
|
|
79
|
-
*
|
|
80
|
-
* - Prevents double responses (`headersSent`)
|
|
81
|
-
* - Applies optional headers
|
|
82
|
-
* - Chooses HTTP status code (custom `http` if valid; else 200/204/400 defaults)
|
|
83
|
-
* - Serializes success/error shapes predictably
|
|
84
|
-
*
|
|
85
|
-
* @param res Express-like response object
|
|
86
|
-
* @param response Expected ApiResponse (must include boolean `status`)
|
|
87
|
-
* @returns true if a response was sent; false if `res` looked invalid (no send)
|
|
94
|
+
* ##: Resolve and send ApiResponse payloads
|
|
95
|
+
* Normalizes a route response, applies headers/status, and prevents double sends when headers are already sent.
|
|
96
|
+
* @param {ResLike} res - Express-like response object
|
|
97
|
+
* @param {ApiResponse} response - ApiResponse payload with a required boolean status
|
|
98
|
+
* @returns {boolean} - True if a response was sent; false when res is invalid
|
|
88
99
|
* History:
|
|
89
100
|
* 16-08-2025: Created
|
|
90
101
|
* 21-08-2025: Changed response method to directly use response.data
|
|
@@ -113,6 +124,12 @@ declare const _default: {
|
|
|
113
124
|
logger?: LoggerFn;
|
|
114
125
|
}) => (workFn: () => Promise<ApiResponse> | ApiResponse) => Promise<boolean>;
|
|
115
126
|
resolveRouteResponse: (res: ResLike, response: any) => boolean;
|
|
127
|
+
errorSanitizer: (error: unknown, options?: {
|
|
128
|
+
maxLength?: number;
|
|
129
|
+
allowErrorMessage?: boolean;
|
|
130
|
+
}) => {
|
|
131
|
+
error: string;
|
|
132
|
+
};
|
|
116
133
|
};
|
|
117
134
|
wrapRoute: (handler: (req: any, res: ResLike) => Promise<ApiResponse> | ApiResponse, options?: {
|
|
118
135
|
tag?: string;
|
|
@@ -122,6 +139,12 @@ declare const _default: {
|
|
|
122
139
|
tag?: string;
|
|
123
140
|
logger?: LoggerFn;
|
|
124
141
|
}) => (workFn: () => Promise<ApiResponse> | ApiResponse) => Promise<boolean>;
|
|
142
|
+
errorSanitizer: (error: unknown, options?: {
|
|
143
|
+
maxLength?: number;
|
|
144
|
+
allowErrorMessage?: boolean;
|
|
145
|
+
}) => {
|
|
146
|
+
error: string;
|
|
147
|
+
};
|
|
125
148
|
resolveRouteResponse: (res: ResLike, response: any) => boolean;
|
|
126
149
|
};
|
|
127
150
|
export default _default;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;kHAmBkH;AAElH,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAClC,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IAClC,IAAI,EAAE,CAAC,IAAI,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC;IAClC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO,EAAE,CAAC,GAAG,OAAO;IACnD,MAAM,EAAE,OAAO,CAAC;IAChB,IAAI,CAAC,EAAE,CAAC,CAAC;IACT,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,IAAI,CAAC,EAAE,CAAC,CAAC;CACV;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;kHAmBkH;AAElH,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,E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,MAGxH,KAAK,GAAG,EAAE,KAAK,OAAO,EAAE,QAAQ,GAAG;+BAmCrB,OAAO,YAAW;YAAE,GAAG,CAAC,EAAE,MAAM,CAAC;YAAC,MAAM,CAAC,EAAE,QAAQ,CAAA;SAAE,MAInE,QAAQ,MAAM,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW;oCAqCxB,OAAO,YAAY,GAAG,KAAG,OAAO;gCArHjE,OAAO,YACL;YACP,SAAS,CAAC,EAAE,MAAM,CAAC;YACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;SAC7B;;;;yBAkC2B,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW,YAAW;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,QAAQ,CAAA;KAAE,MAGxH,KAAK,GAAG,EAAE,KAAK,OAAO,EAAE,QAAQ,GAAG;2BAmCrB,OAAO,YAAW;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,QAAQ,CAAA;KAAE,MAInE,QAAQ,MAAM,OAAO,CAAC,WAAW,CAAC,GAAG,WAAW;4BAhFzD,OAAO,YACL;QACP,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,iBAAiB,CAAC,EAAE,OAAO,CAAC;KAC7B;;;gCAiHuC,OAAO,YAAY,GAAG,KAAG,OAAO;;AAyF1E,wBAME"}
|
package/dist/index.js
CHANGED
|
@@ -20,33 +20,83 @@
|
|
|
20
20
|
* 16-08-2025: Initial version
|
|
21
21
|
****************************************************************************************************************/
|
|
22
22
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.createResponder = exports.wrapRoute = exports.resolveRouteResponse = exports.makeRouteUtils = void 0;
|
|
23
|
+
exports.createResponder = exports.wrapRoute = exports.resolveRouteResponse = exports.makeRouteUtils = exports.errorSanitizer = void 0;
|
|
24
24
|
/** No-op logger (silent). Used when no logger function is provided. */
|
|
25
25
|
const noopLogger = () => { };
|
|
26
26
|
/****************************************************************************************************************
|
|
27
|
-
* ##:
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
* ##: Read error message for sanitizer
|
|
28
|
+
* Extracts a safe message from error input, preferring string reason or message.
|
|
29
|
+
* @param {unknown} error - Error input to inspect for safe message extraction
|
|
30
|
+
* @param {boolean} allowErrorMessage - Allow exposing Error.message when error is an Error instance
|
|
31
|
+
* @returns {string | undefined} - Safe message string or undefined when no safe message is available
|
|
32
|
+
* History:
|
|
33
|
+
* 18-03-2026: Created
|
|
34
|
+
****************************************************************************************************************/
|
|
35
|
+
const readErrorMessage = (error, allowErrorMessage) => {
|
|
36
|
+
if (error instanceof Error)
|
|
37
|
+
return allowErrorMessage ? error.message : undefined;
|
|
38
|
+
if (typeof error === "string")
|
|
39
|
+
return error;
|
|
40
|
+
if (typeof error === "number" || typeof error === "boolean")
|
|
41
|
+
return String(error);
|
|
42
|
+
if (error && typeof error === "object") {
|
|
43
|
+
const err = error;
|
|
44
|
+
const reason = err?.reason;
|
|
45
|
+
if (typeof reason === "string" && reason.trim())
|
|
46
|
+
return reason;
|
|
47
|
+
const message = err?.message;
|
|
48
|
+
if (typeof message === "string" && message.trim())
|
|
49
|
+
return message;
|
|
50
|
+
}
|
|
51
|
+
return undefined;
|
|
52
|
+
};
|
|
53
|
+
/****************************************************************************************************************
|
|
54
|
+
* ##: Normalize error message for output
|
|
55
|
+
* Removes newlines, trims whitespace, and caps the maximum length for safe responses.
|
|
56
|
+
* @param {string} message - Message to normalize for API output
|
|
57
|
+
* @param {number} maxLength - Maximum length before truncating the message
|
|
58
|
+
* @returns {string} - Normalized message safe for response payloads
|
|
59
|
+
* History:
|
|
60
|
+
* 18-03-2026: Created
|
|
61
|
+
****************************************************************************************************************/
|
|
62
|
+
const sanitizeMessage = (message, maxLength) => {
|
|
63
|
+
const cleaned = message.replace(/[\r\n]+/g, " ").trim();
|
|
64
|
+
return cleaned.length > maxLength ? `${cleaned.slice(0, maxLength)}...` : cleaned;
|
|
65
|
+
};
|
|
66
|
+
/****************************************************************************************************************
|
|
67
|
+
* ##: Sanitize error response payload
|
|
68
|
+
* Builds a safe error object with optional exposure of Error.message when explicitly allowed.
|
|
69
|
+
* @param {unknown} error - Raw error input to sanitize for response output
|
|
70
|
+
* @param {object} options - Optional settings for sanitizer behavior
|
|
71
|
+
* @param {number} options.maxLength - Maximum length for the output error message
|
|
72
|
+
* @param {boolean} options.allowErrorMessage - Allow Error.message when error is an Error instance
|
|
73
|
+
* @returns {{ error: string }} - Sanitized error payload with a safe error message
|
|
74
|
+
* History:
|
|
75
|
+
* 18-03-2026: Created
|
|
76
|
+
****************************************************************************************************************/
|
|
77
|
+
const errorSanitizer = (error, options = {}) => {
|
|
78
|
+
const allowErrorMessage = options.allowErrorMessage === true;
|
|
79
|
+
const maxLength = Number.isFinite(options.maxLength) && options.maxLength > 0 ? Math.floor(options.maxLength) : 500;
|
|
80
|
+
const message = readErrorMessage(error, allowErrorMessage);
|
|
81
|
+
return { error: message ? sanitizeMessage(message, maxLength) : "Unexpected error" };
|
|
82
|
+
};
|
|
83
|
+
exports.errorSanitizer = errorSanitizer;
|
|
84
|
+
/****************************************************************************************************************
|
|
85
|
+
* ##: Create route utility helpers with defaults
|
|
86
|
+
* Builds helper functions bound to a default logger and tag prefix for consistent route handling.
|
|
87
|
+
* @param {LoggerFn} logger - Optional logger for reporting unexpected shapes or errors
|
|
88
|
+
* @param {string} tagPrefix - Optional prefix appended to generated log tags
|
|
89
|
+
* @returns {object} - Helper bundle: wrapRoute, createResponder, resolveRouteResponse, errorSanitizer
|
|
36
90
|
* History:
|
|
37
91
|
* 16-08-2025: Created
|
|
38
92
|
****************************************************************************************************************/
|
|
39
93
|
const makeRouteUtils = ({ logger = noopLogger, tagPrefix = "", } = {}) => {
|
|
40
94
|
/****************************************************************************************************************
|
|
41
|
-
* ##:
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* @param handler Async route handler: (req, res) => ApiResponse | Promise<ApiResponse>
|
|
48
|
-
* @param options { tag?: string; logger?: LoggerFn }
|
|
49
|
-
* @returns (req, res, next) => Promise<void>
|
|
95
|
+
* ##: Wrap async route handlers
|
|
96
|
+
* Executes an async handler, normalizes its ApiResponse output, and logs unexpected failures when configured.
|
|
97
|
+
* @param {Function} handler - Async route handler: (req, res) => ApiResponse | Promise<ApiResponse>
|
|
98
|
+
* @param {object} options - Optional tag/logger overrides for this handler
|
|
99
|
+
* @returns {Function} - Express-style middleware (req, res, next) => Promise<void>
|
|
50
100
|
* History:
|
|
51
101
|
* 16-08-2025: Created
|
|
52
102
|
****************************************************************************************************************/
|
|
@@ -76,15 +126,11 @@ const makeRouteUtils = ({ logger = noopLogger, tagPrefix = "", } = {}) => {
|
|
|
76
126
|
};
|
|
77
127
|
};
|
|
78
128
|
/****************************************************************************************************************
|
|
79
|
-
* ##:
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* @param res Express-like response object
|
|
86
|
-
* @param options { tag?: string; logger?: LoggerFn }
|
|
87
|
-
* @returns (workFn) => Promise<true>
|
|
129
|
+
* ##: Create a responder helper for in-route use
|
|
130
|
+
* Runs a work function that returns an ApiResponse and sends a normalized response to the client.
|
|
131
|
+
* @param {ResLike} res - Express-like response object
|
|
132
|
+
* @param {object} options - Optional tag/logger overrides for this responder
|
|
133
|
+
* @returns {Function} - Work executor: (workFn) => Promise<true>
|
|
88
134
|
* History:
|
|
89
135
|
* 16-08-2025: Created
|
|
90
136
|
****************************************************************************************************************/
|
|
@@ -113,23 +159,15 @@ const makeRouteUtils = ({ logger = noopLogger, tagPrefix = "", } = {}) => {
|
|
|
113
159
|
}
|
|
114
160
|
};
|
|
115
161
|
};
|
|
116
|
-
return { wrapRoute, createResponder, resolveRouteResponse: exports.resolveRouteResponse };
|
|
162
|
+
return { wrapRoute, createResponder, resolveRouteResponse: exports.resolveRouteResponse, errorSanitizer: exports.errorSanitizer };
|
|
117
163
|
};
|
|
118
164
|
exports.makeRouteUtils = makeRouteUtils;
|
|
119
165
|
/****************************************************************************************************************
|
|
120
|
-
* ##:
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
* - Prevents double responses (`headersSent`)
|
|
126
|
-
* - Applies optional headers
|
|
127
|
-
* - Chooses HTTP status code (custom `http` if valid; else 200/204/400 defaults)
|
|
128
|
-
* - Serializes success/error shapes predictably
|
|
129
|
-
*
|
|
130
|
-
* @param res Express-like response object
|
|
131
|
-
* @param response Expected ApiResponse (must include boolean `status`)
|
|
132
|
-
* @returns true if a response was sent; false if `res` looked invalid (no send)
|
|
166
|
+
* ##: Resolve and send ApiResponse payloads
|
|
167
|
+
* Normalizes a route response, applies headers/status, and prevents double sends when headers are already sent.
|
|
168
|
+
* @param {ResLike} res - Express-like response object
|
|
169
|
+
* @param {ApiResponse} response - ApiResponse payload with a required boolean status
|
|
170
|
+
* @returns {boolean} - True if a response was sent; false when res is invalid
|
|
133
171
|
* History:
|
|
134
172
|
* 16-08-2025: Created
|
|
135
173
|
* 21-08-2025: Changed response method to directly use response.data
|
|
@@ -223,6 +261,7 @@ exports.default = {
|
|
|
223
261
|
makeRouteUtils: exports.makeRouteUtils,
|
|
224
262
|
wrapRoute: exports.wrapRoute,
|
|
225
263
|
createResponder: exports.createResponder,
|
|
264
|
+
errorSanitizer: exports.errorSanitizer,
|
|
226
265
|
resolveRouteResponse: exports.resolveRouteResponse,
|
|
227
266
|
};
|
|
228
267
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index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AAwB;AAC5C,QAAA,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;AAC7B,QAAA,eAAe,GAAG,MAAM,CAAC,eAAe,CAAC;AAEtD,mDAAmD;AACnD,kBAAe;IACb,cAAc,EAAd,sBAAc;IACd,SAAS,EAAT,iBAAS;IACT,eAAe,EAAf,uBAAe;IACf,cAAc,EAAd,sBAAc;IACd,oBAAoB,EAApB,4BAAoB;CACrB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salespark/route-utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.7",
|
|
4
4
|
"description": "Vendor-agnostic helpers for Express route handlers with normalized responses and optional logging.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"license": "MIT",
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "https://github.com/salespark
|
|
29
|
+
"url": "https://github.com/FBlade/salespark-route-utils.git"
|
|
30
30
|
},
|
|
31
31
|
"publishConfig": {
|
|
32
32
|
"access": "public"
|