@xylabs/express 5.0.95 → 5.0.96

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 CHANGED
@@ -1,125 +1,52 @@
1
1
  # @xylabs/express
2
2
 
3
- [![logo][]](https://xylabs.com)
3
+ [![npm][npm-badge]][npm-link]
4
+ [![license][license-badge]][license-link]
4
5
 
5
- [![main-build][]][main-build-link]
6
- [![npm-badge][]][npm-link]
7
- [![npm-downloads-badge][]][npm-link]
8
- [![jsdelivr-badge][]][jsdelivr-link]
9
- [![npm-license-badge][]](LICENSE)
10
- [![codacy-badge][]][codacy-link]
11
- [![codeclimate-badge][]][codeclimate-link]
12
- [![snyk-badge][]][snyk-link]
13
- [![socket-badge][]][socket-link]
6
+ > SDK for base code for Api repos that use express and deploy on AWS ECS
14
7
 
8
+ ## Install
15
9
 
16
- SDK for base code for Api repos that use express and deploy on AWS ECS
10
+ Using npm:
17
11
 
12
+ ```sh
13
+ npm install {{name}}
14
+ ```
15
+
16
+ Using yarn:
17
+
18
+ ```sh
19
+ yarn add {{name}}
20
+ ```
21
+
22
+ Using pnpm:
23
+
24
+ ```sh
25
+ pnpm add {{name}}
26
+ ```
27
+
28
+ Using bun:
18
29
 
30
+ ```sh
31
+ bun add {{name}}
32
+ ```
33
+
34
+
35
+ ## License
36
+
37
+ See the [LICENSE](LICENSE) file for license rights and limitations (LGPL-3.0-only).
19
38
 
20
39
  ## Reference
21
40
 
22
- **@xylabs/express**
23
-
24
- ***
25
-
26
- ## Classes
27
-
28
- | Class | Description |
29
- | ------ | ------ |
30
- | [WrappedWinstonLogger](#classes/WrappedWinstonLogger) | Wrap Winston logger methods to adapt to familiar console logging methods |
31
- | [Counters](#classes/Counters) | Static counter registry for tracking named numeric metrics. |
32
- | [Profiler](#classes/Profiler) | Measures and records the execution duration of async operations by name. |
33
-
34
- ## Interfaces
35
-
36
- | Interface | Description |
37
- | ------ | ------ |
38
- | [RouteDefinition](#interfaces/RouteDefinition) | Defines an Express route with its HTTP method, path, and handler(s). |
39
- | [Empty](#interfaces/Empty) | Empty object type used as a default for request/response body generics. |
40
- | [LoggerOptions](#interfaces/LoggerOptions) | Configuration options for creating a logger instance. |
41
- | [ExpressError](#interfaces/ExpressError) | An Error with an optional HTTP status code for Express error handling. |
42
- | [Source](#interfaces/Source) | An object containing references to the source of the error |
43
- | [ApiError](#interfaces/ApiError) | - |
44
- | [HrefWithMeta](#interfaces/HrefWithMeta) | A link with an href and associated metadata. |
45
- | [IRelationshipSelfLink](#interfaces/IRelationshipSelfLink) | A relationship link pointing to the relationship itself. |
46
- | [IRelationshipRelatedLink](#interfaces/IRelationshipRelatedLink) | A relationship link pointing to a related resource. |
47
- | [IRelationshipLinks](#interfaces/IRelationshipLinks) | Contains the links for a JSON:API relationship. |
48
- | [IRelationshipData](#interfaces/IRelationshipData) | Contains the resource linkage data for a JSON:API relationship. |
49
- | [ApiResourceIdentifierObject](#interfaces/ApiResourceIdentifierObject) | Within a given API, each resource object's type and id pair MUST identify a single, unique resource. (The set of URIs controlled by a server, or multiple servers acting as one, constitute an API.) |
50
- | [ApiResourceObject](#interfaces/ApiResourceObject) | A JSON:API resource object with optional attributes, links, meta, and relationships. |
51
- | [JsonApi](#interfaces/JsonApi) | JSON:API version and metadata descriptor. |
52
- | [ApiResponseBase](#interfaces/ApiResponseBase) | Base interface for all JSON:API responses, including optional links and metadata. |
53
- | [ApiDataResponse](#interfaces/ApiDataResponse) | A successful JSON:API response containing primary data and optional included resources. |
54
- | [ApiErrorResponse](#interfaces/ApiErrorResponse) | A JSON:API error response containing one or more error objects. |
55
-
56
- ## Type Aliases
57
-
58
- | Type Alias | Description |
59
- | ------ | ------ |
60
- | [HttpMethod](#type-aliases/HttpMethod) | Supported HTTP methods for route definitions. |
61
- | [NoReqParams](#type-aliases/NoReqParams) | Default type for request route parameters. |
62
- | [NoResBody](#type-aliases/NoResBody) | Default type for response body when none is specified. |
63
- | [NoReqBody](#type-aliases/NoReqBody) | Default type for request body when none is specified. |
64
- | [NoReqQuery](#type-aliases/NoReqQuery) | Default type for request query parameters. |
65
- | [NoLocals](#type-aliases/NoLocals) | Default type for response locals. |
66
- | [LoggerMeta](#type-aliases/LoggerMeta) | Metadata key-value pairs attached to log entries. |
67
- | [LoggerVerbosity](#type-aliases/LoggerVerbosity) | Application-level log verbosity levels. |
68
- | [~~LogFunction~~](#type-aliases/LogFunction) | - |
69
- | [~~Logger~~](#type-aliases/Logger) | - |
70
- | [ParseFunc](#type-aliases/ParseFunc) | A function that parses a string value into the target type. |
71
- | [ApiLink](#type-aliases/ApiLink) | A JSON:API link, either a simple URL string or an object with href and metadata. |
72
- | [ApiLinks](#type-aliases/ApiLinks) | A collection of named JSON:API links. |
73
- | [ResourceLinkage](#type-aliases/ResourceLinkage) | Resource linkage in a compound document allows a client to link together all of the included resource objects without having to GET any URLs via links. Resource linkage MUST be represented as one of the following: • null for empty to-one relationships. • an empty array ([]) for empty to-many relationships. • a single resource identifier object for non-empty to-one relationships. • an array of resource identifier objects for non-empty to-many relationships. |
74
- | [RelationshipMeta](#type-aliases/RelationshipMeta) | Non-standard metadata associated with a JSON:API relationship. |
75
- | [Relationship](#type-aliases/Relationship) | The value of the relationships key MUST be an object (a "relationships object"). Members of the relationships object ("relationships") represent references from the resource object in which it’s defined to other resource objects. Relationships may be to-one or to-many. |
76
- | [ApiResponse](#type-aliases/ApiResponse) | A JSON:API response, either a data response or an error response. |
77
-
78
- ## Variables
79
-
80
- | Variable | Description |
81
- | ------ | ------ |
82
- | [notImplemented](#variables/notImplemented) | Express request handler that responds with a 501 Not Implemented error. |
83
- | [EmptyParamsZod](#variables/EmptyParamsZod) | Empty Zod schema for requests with no parameters. |
84
- | [EmptyQueryParamsZod](#variables/EmptyQueryParamsZod) | Empty Zod schema for requests with no query parameters. |
85
- | [ValidateRequestDefaults](#variables/ValidateRequestDefaults) | Default validation schemas for request handler validator. |
86
- | [DefaultJsonBodyParserOptionsLimit](#variables/DefaultJsonBodyParserOptionsLimit) | The default maximum request body size for the JSON Body Parser |
87
- | [DefaultJsonBodyParserOptionsTypes](#variables/DefaultJsonBodyParserOptionsTypes) | The default MIME types for the JSON Body Parser |
88
- | [DefaultJsonBodyParserOptions](#variables/DefaultJsonBodyParserOptions) | The default options for the JSON Body Parser |
89
- | [jsonBodyParser](#variables/jsonBodyParser) | A JSON Body Parser middleware handler initialized with the default options |
90
- | [standardResponses](#variables/standardResponses) | Connect middleware to enable the transform of all responses to match the standard response format (compatible with JSON API) |
91
-
92
- ## Functions
93
-
94
- | Function | Description |
95
- | ------ | ------ |
96
- | [addRouteDefinitions](#functions/addRouteDefinitions) | Registers an array of route definitions on an Express application. |
97
- | [asyncHandler](#functions/asyncHandler) | Wraps an async Express request handler to forward rejected promises to the error handler. |
98
- | [errorToJsonHandler](#functions/errorToJsonHandler) | Express error handler that logs the error and sends a JSON response with the error message and status code. |
99
- | [getHttpHeader](#functions/getHttpHeader) | Since there can be multiple of certain HTTP headers or to prevent ugliness if someone did send us multiple instances of a header we only expect one of, this method grabs the 1st/only one of the desired header |
100
- | [getDefaultLogger](#functions/getDefaultLogger) | Returns the singleton default logger instance, creating one if it does not exist. |
101
- | [getLogger](#functions/getLogger) | Returns a cached Winston-backed logger at the specified verbosity level. |
102
- | [compactObject](#functions/compactObject) | Returns a shallow copy of the object with all null and undefined values removed. |
103
- | [~~tryParse~~](#functions/tryParse) | - |
104
- | [requestHandlerValidator](#functions/requestHandlerValidator) | Factory for Express middleware that validates request and response objects using Zod schemas. |
105
- | [enableCaseSensitiveRouting](#functions/enableCaseSensitiveRouting) | Enable case sensitivity. When enabled, "/Foo" and "/foo" are different routes. When disabled, "/Foo" and "/foo" are treated the same. |
106
- | [disableCaseSensitiveRouting](#functions/disableCaseSensitiveRouting) | Disable case sensitivity. When enabled, "/Foo" and "/foo" are different routes. When disabled, "/Foo" and "/foo" are treated the same. |
107
- | [enableExpressDefaultPoweredByHeader](#functions/enableExpressDefaultPoweredByHeader) | By default Express appends the `X-Powered-By: Express` header to all responses. Calling this method enables that behavior. |
108
- | [disableExpressDefaultPoweredByHeader](#functions/disableExpressDefaultPoweredByHeader) | By default Express appends the `X-Powered-By: Express` header to all responses. Calling this method disables that behavior. |
109
- | [customPoweredByHeader](#functions/customPoweredByHeader) | Express middleware that sets the X-Powered-By header to 'XYO'. |
110
- | [getJsonBodyParserOptions](#functions/getJsonBodyParserOptions) | Gets the default JSON Body Parser options merged with the supplied options with the supplied options taking precedence |
111
- | [getJsonBodyParser](#functions/getJsonBodyParser) | Get a JSON Body Parser connect middleware handler |
112
- | [useRequestCounters](#functions/useRequestCounters) | Registers middleware that increments per-path request counters and exposes a /stats endpoint. |
113
- | [responseProfiler](#functions/responseProfiler) | Connect middleware to enable profiling of response lifecycle timing. To effectively profile the response timing, this middleware needs to be called first when initializing your Express App |
114
- | [getResponseMetadata](#functions/getResponseMetadata) | Extracts response metadata from res.locals, computing profile duration if profiling was started. |
115
- | [standardErrors](#functions/standardErrors) | Express error handler that logs the error and sends a JSON:API-compliant error response. |
116
- | [setRawResponseFormat](#functions/setRawResponseFormat) | Flags the response to forgo the standard response envelope and return the raw response body to the client |
117
- | [clearRawResponseFormat](#functions/clearRawResponseFormat) | Clears any flags on the response, allowing the response to use the default standard response envelope |
118
- | [isRawResponseFormatSet](#functions/isRawResponseFormatSet) | Checks if there are any flags on the response that would cause it to forgo the standard response envelope and return the raw response body to the client |
119
-
120
- ### classes
121
-
122
- ### <a id="Counters"></a>Counters
41
+ ### packages
42
+
43
+ ### express
44
+
45
+ ### .temp-typedoc
46
+
47
+ ### classes
48
+
49
+ ### <a id="Counters"></a>Counters
123
50
 
124
51
  [**@xylabs/express**](#../README)
125
52
 
@@ -141,24 +68,29 @@ new Counters(): Counters;
141
68
 
142
69
  ## Properties
143
70
 
144
- | Property | Modifier | Type | Default value |
145
- | ------ | ------ | ------ | ------ |
146
- | <a id="counters"></a> `counters` | `static` | `Record`\<`string`, `number`\> | `{}` |
71
+ ### counters
72
+
73
+ ```ts
74
+ static counters: Record<string, number> = {};
75
+ ```
147
76
 
148
77
  ## Methods
149
78
 
150
79
  ### inc()
151
80
 
152
81
  ```ts
153
- static inc(name: string, count?: number): void;
82
+ static inc(name, count?): void;
154
83
  ```
155
84
 
156
85
  ### Parameters
157
86
 
158
- | Parameter | Type | Default value |
159
- | ------ | ------ | ------ |
160
- | `name` | `string` | `undefined` |
161
- | `count` | `number` | `1` |
87
+ #### name
88
+
89
+ `string`
90
+
91
+ #### count?
92
+
93
+ `number` = `1`
162
94
 
163
95
  ### Returns
164
96
 
@@ -169,15 +101,18 @@ static inc(name: string, count?: number): void;
169
101
  ### max()
170
102
 
171
103
  ```ts
172
- static max(name: string, count: number): void;
104
+ static max(name, count): void;
173
105
  ```
174
106
 
175
107
  ### Parameters
176
108
 
177
- | Parameter | Type |
178
- | ------ | ------ |
179
- | `name` | `string` |
180
- | `count` | `number` |
109
+ #### name
110
+
111
+ `string`
112
+
113
+ #### count
114
+
115
+ `number`
181
116
 
182
117
  ### Returns
183
118
 
@@ -188,21 +123,24 @@ static max(name: string, count: number): void;
188
123
  ### min()
189
124
 
190
125
  ```ts
191
- static min(name: string, count: number): void;
126
+ static min(name, count): void;
192
127
  ```
193
128
 
194
129
  ### Parameters
195
130
 
196
- | Parameter | Type |
197
- | ------ | ------ |
198
- | `name` | `string` |
199
- | `count` | `number` |
131
+ #### name
132
+
133
+ `string`
134
+
135
+ #### count
136
+
137
+ `number`
200
138
 
201
139
  ### Returns
202
140
 
203
141
  `void`
204
142
 
205
- ### <a id="Profiler"></a>Profiler
143
+ ### <a id="Profiler"></a>Profiler
206
144
 
207
145
  [**@xylabs/express**](#../README)
208
146
 
@@ -224,36 +162,41 @@ new Profiler(): Profiler;
224
162
 
225
163
  ## Properties
226
164
 
227
- | Property | Type | Default value |
228
- | ------ | ------ | ------ |
229
- | <a id="stats"></a> `stats` | `Record`\<`string`, `number`\> | `{}` |
165
+ ### stats
166
+
167
+ ```ts
168
+ stats: Record<string, number> = {};
169
+ ```
230
170
 
231
171
  ## Methods
232
172
 
233
173
  ### profile()
234
174
 
235
175
  ```ts
236
- profile<T>(name: string, promise: Promise<T>): Promise<T>;
176
+ profile<T>(name, promise): Promise<T>;
237
177
  ```
238
178
 
239
179
  ### Type Parameters
240
180
 
241
- | Type Parameter |
242
- | ------ |
243
- | `T` |
181
+ #### T
182
+
183
+ `T`
244
184
 
245
185
  ### Parameters
246
186
 
247
- | Parameter | Type |
248
- | ------ | ------ |
249
- | `name` | `string` |
250
- | `promise` | `Promise`\<`T`\> |
187
+ #### name
188
+
189
+ `string`
190
+
191
+ #### promise
192
+
193
+ `Promise`\<`T`\>
251
194
 
252
195
  ### Returns
253
196
 
254
197
  `Promise`\<`T`\>
255
198
 
256
- ### <a id="WrappedWinstonLogger"></a>WrappedWinstonLogger
199
+ ### <a id="WrappedWinstonLogger"></a>WrappedWinstonLogger
257
200
 
258
201
  [**@xylabs/express**](#../README)
259
202
 
@@ -271,14 +214,14 @@ console logging methods
271
214
  ### Constructor
272
215
 
273
216
  ```ts
274
- new WrappedWinstonLogger(winston: Logger): WrappedWinstonLogger;
217
+ new WrappedWinstonLogger(winston): WrappedWinstonLogger;
275
218
  ```
276
219
 
277
220
  ### Parameters
278
221
 
279
- | Parameter | Type |
280
- | ------ | ------ |
281
- | `winston` | `Logger` |
222
+ #### winston
223
+
224
+ `Logger`
282
225
 
283
226
  ### Returns
284
227
 
@@ -286,100 +229,184 @@ new WrappedWinstonLogger(winston: Logger): WrappedWinstonLogger;
286
229
 
287
230
  ## Properties
288
231
 
289
- | Property | Modifier | Type |
290
- | ------ | ------ | ------ |
291
- | <a id="winston"></a> `winston` | `readonly` | `Logger` |
292
- | <a id="debug"></a> `debug` | `public` | `LogFunction` |
293
- | <a id="error"></a> `error` | `public` | `LogFunction` |
294
- | <a id="info"></a> `info` | `public` | `LogFunction` |
295
- | <a id="log"></a> `log` | `public` | `LogFunction` |
296
- | <a id="trace"></a> `trace` | `public` | `LogFunction` |
297
- | <a id="warn"></a> `warn` | `public` | `LogFunction` |
232
+ ### winston
233
+
234
+ ```ts
235
+ protected readonly winston: Logger;
236
+ ```
237
+
238
+ ***
239
+
240
+ ### debug
241
+
242
+ ```ts
243
+ debug: LogFunction;
244
+ ```
245
+
246
+ ### Implementation of
247
+
248
+ ```ts
249
+ Logger.debug
250
+ ```
251
+
252
+ ***
253
+
254
+ ### error
255
+
256
+ ```ts
257
+ error: LogFunction;
258
+ ```
259
+
260
+ ### Implementation of
261
+
262
+ ```ts
263
+ Logger.error
264
+ ```
265
+
266
+ ***
267
+
268
+ ### info
269
+
270
+ ```ts
271
+ info: LogFunction;
272
+ ```
273
+
274
+ ### Implementation of
275
+
276
+ ```ts
277
+ Logger.info
278
+ ```
279
+
280
+ ***
281
+
282
+ ### log
283
+
284
+ ```ts
285
+ log: LogFunction;
286
+ ```
287
+
288
+ ### Implementation of
289
+
290
+ ```ts
291
+ Logger.log
292
+ ```
293
+
294
+ ***
295
+
296
+ ### trace
297
+
298
+ ```ts
299
+ trace: LogFunction;
300
+ ```
301
+
302
+ ### Implementation of
303
+
304
+ ```ts
305
+ Logger.trace
306
+ ```
307
+
308
+ ***
309
+
310
+ ### warn
311
+
312
+ ```ts
313
+ warn: LogFunction;
314
+ ```
315
+
316
+ ### Implementation of
317
+
318
+ ```ts
319
+ Logger.warn
320
+ ```
298
321
 
299
- ### functions
322
+ ### functions
300
323
 
301
- ### <a id="addRouteDefinitions"></a>addRouteDefinitions
324
+ ### <a id="addRouteDefinitions"></a>addRouteDefinitions
302
325
 
303
326
  [**@xylabs/express**](#../README)
304
327
 
305
328
  ***
306
329
 
307
330
  ```ts
308
- function addRouteDefinitions(app: Express, routeDefinitions: RouteDefinition<RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>>[]): void;
331
+ function addRouteDefinitions(app, routeDefinitions): void;
309
332
  ```
310
333
 
311
334
  Registers an array of route definitions on an Express application.
312
335
 
313
336
  ## Parameters
314
337
 
315
- | Parameter | Type | Description |
316
- | ------ | ------ | ------ |
317
- | `app` | `Express` | The Express application to register routes on. |
318
- | `routeDefinitions` | [`RouteDefinition`](#../interfaces/RouteDefinition)\<`RequestHandler`\<`ParamsDictionary`, `any`, `any`, `ParsedQs`, `Record`\<`string`, `any`\>\>\>[] | The route definitions to register. |
338
+ ### app
339
+
340
+ `Express`
341
+
342
+ The Express application to register routes on.
343
+
344
+ ### routeDefinitions
345
+
346
+ [`RouteDefinition`](#../interfaces/RouteDefinition)\<`RequestHandler`\<`ParamsDictionary`, `any`, `any`, `ParsedQs`, `Record`\<`string`, `any`\>\>\>[]
347
+
348
+ The route definitions to register.
319
349
 
320
350
  ## Returns
321
351
 
322
352
  `void`
323
353
 
324
- ### <a id="asyncHandler"></a>asyncHandler
354
+ ### <a id="asyncHandler"></a>asyncHandler
325
355
 
326
356
  [**@xylabs/express**](#../README)
327
357
 
328
358
  ***
329
359
 
330
360
  ```ts
331
- function asyncHandler<P, ResBody, ReqBody, ReqQuery, Locals>(fn: RequestHandler<P, ResBody, ReqBody, ReqQuery, Locals>): (req: Request<P, ResBody, ReqBody, ReqQuery, Locals>, res: Response<ResBody, Locals>, next: NextFunction) => Promise<unknown>;
361
+ function asyncHandler<P, ResBody, ReqBody, ReqQuery, Locals>(fn): (req, res, next) => Promise<unknown>;
332
362
  ```
333
363
 
334
364
  Wraps an async Express request handler to forward rejected promises to the error handler.
335
365
 
336
366
  ## Type Parameters
337
367
 
338
- | Type Parameter | Default type |
339
- | ------ | ------ |
340
- | `P` | `ParamsDictionary` |
341
- | `ResBody` | [`Empty`](#../interfaces/Empty) |
342
- | `ReqBody` | [`Empty`](#../interfaces/Empty) |
343
- | `ReqQuery` | `ParsedQs` |
344
- | `Locals` *extends* [`NoLocals`](#../type-aliases/NoLocals) | [`NoLocals`](#../type-aliases/NoLocals) |
368
+ ### P
345
369
 
346
- ## Parameters
370
+ `P` = `ParamsDictionary`
347
371
 
348
- | Parameter | Type | Description |
349
- | ------ | ------ | ------ |
350
- | `fn` | `RequestHandler`\<`P`, `ResBody`, `ReqBody`, `ReqQuery`, `Locals`\> | The async request handler to wrap. |
372
+ ### ResBody
351
373
 
352
- ## Returns
374
+ `ResBody` = [`Empty`](#../interfaces/Empty)
353
375
 
354
- A request handler that catches async errors and passes them to next().
376
+ ### ReqBody
355
377
 
356
- ```ts
357
- (
358
- req: Request<P, ResBody, ReqBody, ReqQuery, Locals>,
359
- res: Response<ResBody, Locals>,
360
- next: NextFunction): Promise<unknown>;
361
- ```
378
+ `ReqBody` = [`Empty`](#../interfaces/Empty)
362
379
 
363
- ### Parameters
380
+ ### ReqQuery
364
381
 
365
- | Parameter | Type |
366
- | ------ | ------ |
367
- | `req` | `Request`\<`P`, `ResBody`, `ReqBody`, `ReqQuery`, `Locals`\> |
368
- | `res` | `Response`\<`ResBody`, `Locals`\> |
369
- | `next` | `NextFunction` |
382
+ `ReqQuery` = `ParsedQs`
370
383
 
371
- ### Returns
384
+ ### Locals
385
+
386
+ `Locals` *extends* [`NoLocals`](#../type-aliases/NoLocals) = [`NoLocals`](#../type-aliases/NoLocals)
387
+
388
+ ## Parameters
389
+
390
+ ### fn
391
+
392
+ `RequestHandler`\<`P`, `ResBody`, `ReqBody`, `ReqQuery`, `Locals`\>
393
+
394
+ The async request handler to wrap.
395
+
396
+ ## Returns
397
+
398
+ A request handler that catches async errors and passes them to next().
372
399
 
373
- `Promise`\<`unknown`\>
400
+ (`req`, `res`, `next`) => `Promise`\<`unknown`\>
374
401
 
375
- ### <a id="clearRawResponseFormat"></a>clearRawResponseFormat
402
+ ### <a id="clearRawResponseFormat"></a>clearRawResponseFormat
376
403
 
377
404
  [**@xylabs/express**](#../README)
378
405
 
379
406
  ***
380
407
 
381
408
  ```ts
382
- function clearRawResponseFormat(res: Response): void;
409
+ function clearRawResponseFormat(res): void;
383
410
  ```
384
411
 
385
412
  Clears any flags on the response, allowing the response to
@@ -387,37 +414,41 @@ use the default standard response envelope
387
414
 
388
415
  ## Parameters
389
416
 
390
- | Parameter | Type | Description |
391
- | ------ | ------ | ------ |
392
- | `res` | `Response` | The response to set to the standard response format |
417
+ ### res
418
+
419
+ `Response`
420
+
421
+ The response to set to the standard response format
393
422
 
394
423
  ## Returns
395
424
 
396
425
  `void`
397
426
 
398
- ### <a id="compactObject"></a>compactObject
427
+ ### <a id="compactObject"></a>compactObject
399
428
 
400
429
  [**@xylabs/express**](#../README)
401
430
 
402
431
  ***
403
432
 
404
433
  ```ts
405
- function compactObject<T>(obj: T): T;
434
+ function compactObject<T>(obj): T;
406
435
  ```
407
436
 
408
437
  Returns a shallow copy of the object with all null and undefined values removed.
409
438
 
410
439
  ## Type Parameters
411
440
 
412
- | Type Parameter |
413
- | ------ |
414
- | `T` *extends* `Record`\<`string`, `unknown`\> |
441
+ ### T
442
+
443
+ `T` *extends* `Record`\<`string`, `unknown`\>
415
444
 
416
445
  ## Parameters
417
446
 
418
- | Parameter | Type | Description |
419
- | ------ | ------ | ------ |
420
- | `obj` | `T` | The object to compact. |
447
+ ### obj
448
+
449
+ `T`
450
+
451
+ The object to compact.
421
452
 
422
453
  ## Returns
423
454
 
@@ -425,7 +456,7 @@ Returns a shallow copy of the object with all null and undefined values removed.
425
456
 
426
457
  A new object with only defined, non-null properties.
427
458
 
428
- ### <a id="customPoweredByHeader"></a>customPoweredByHeader
459
+ ### <a id="customPoweredByHeader"></a>customPoweredByHeader
429
460
 
430
461
  [**@xylabs/express**](#../README)
431
462
 
@@ -433,33 +464,39 @@ A new object with only defined, non-null properties.
433
464
 
434
465
  ```ts
435
466
  function customPoweredByHeader(
436
- req: Request,
437
- res: Response,
438
- next: NextFunction): void;
467
+ req,
468
+ res,
469
+ next): void;
439
470
  ```
440
471
 
441
472
  Express middleware that sets the X-Powered-By header to 'XYO'.
442
473
 
443
474
  ## Parameters
444
475
 
445
- | Parameter | Type |
446
- | ------ | ------ |
447
- | `req` | `Request` |
448
- | `res` | `Response` |
449
- | `next` | `NextFunction` |
476
+ ### req
477
+
478
+ `Request`
479
+
480
+ ### res
481
+
482
+ `Response`
483
+
484
+ ### next
485
+
486
+ `NextFunction`
450
487
 
451
488
  ## Returns
452
489
 
453
490
  `void`
454
491
 
455
- ### <a id="disableCaseSensitiveRouting"></a>disableCaseSensitiveRouting
492
+ ### <a id="disableCaseSensitiveRouting"></a>disableCaseSensitiveRouting
456
493
 
457
494
  [**@xylabs/express**](#../README)
458
495
 
459
496
  ***
460
497
 
461
498
  ```ts
462
- function disableCaseSensitiveRouting(app: Express): void;
499
+ function disableCaseSensitiveRouting(app): void;
463
500
  ```
464
501
 
465
502
  Disable case sensitivity. When enabled, "/Foo" and "/foo" are different
@@ -467,22 +504,24 @@ routes. When disabled, "/Foo" and "/foo" are treated the same.
467
504
 
468
505
  ## Parameters
469
506
 
470
- | Parameter | Type | Description |
471
- | ------ | ------ | ------ |
472
- | `app` | `Express` | The Express app to disable the header on. |
507
+ ### app
508
+
509
+ `Express`
510
+
511
+ The Express app to disable the header on.
473
512
 
474
513
  ## Returns
475
514
 
476
515
  `void`
477
516
 
478
- ### <a id="disableExpressDefaultPoweredByHeader"></a>disableExpressDefaultPoweredByHeader
517
+ ### <a id="disableExpressDefaultPoweredByHeader"></a>disableExpressDefaultPoweredByHeader
479
518
 
480
519
  [**@xylabs/express**](#../README)
481
520
 
482
521
  ***
483
522
 
484
523
  ```ts
485
- function disableExpressDefaultPoweredByHeader(app: Express): void;
524
+ function disableExpressDefaultPoweredByHeader(app): void;
486
525
  ```
487
526
 
488
527
  By default Express appends the `X-Powered-By: Express` header to
@@ -490,22 +529,24 @@ all responses. Calling this method disables that behavior.
490
529
 
491
530
  ## Parameters
492
531
 
493
- | Parameter | Type | Description |
494
- | ------ | ------ | ------ |
495
- | `app` | `Express` | The Express app to disable the header on. |
532
+ ### app
533
+
534
+ `Express`
535
+
536
+ The Express app to disable the header on.
496
537
 
497
538
  ## Returns
498
539
 
499
540
  `void`
500
541
 
501
- ### <a id="enableCaseSensitiveRouting"></a>enableCaseSensitiveRouting
542
+ ### <a id="enableCaseSensitiveRouting"></a>enableCaseSensitiveRouting
502
543
 
503
544
  [**@xylabs/express**](#../README)
504
545
 
505
546
  ***
506
547
 
507
548
  ```ts
508
- function enableCaseSensitiveRouting(app: Express): void;
549
+ function enableCaseSensitiveRouting(app): void;
509
550
  ```
510
551
 
511
552
  Enable case sensitivity. When enabled, "/Foo" and "/foo" are different
@@ -513,22 +554,24 @@ routes. When disabled, "/Foo" and "/foo" are treated the same.
513
554
 
514
555
  ## Parameters
515
556
 
516
- | Parameter | Type | Description |
517
- | ------ | ------ | ------ |
518
- | `app` | `Express` | The Express app to disable the header on. |
557
+ ### app
558
+
559
+ `Express`
560
+
561
+ The Express app to disable the header on.
519
562
 
520
563
  ## Returns
521
564
 
522
565
  `void`
523
566
 
524
- ### <a id="enableExpressDefaultPoweredByHeader"></a>enableExpressDefaultPoweredByHeader
567
+ ### <a id="enableExpressDefaultPoweredByHeader"></a>enableExpressDefaultPoweredByHeader
525
568
 
526
569
  [**@xylabs/express**](#../README)
527
570
 
528
571
  ***
529
572
 
530
573
  ```ts
531
- function enableExpressDefaultPoweredByHeader(app: Express): void;
574
+ function enableExpressDefaultPoweredByHeader(app): void;
532
575
  ```
533
576
 
534
577
  By default Express appends the `X-Powered-By: Express` header to
@@ -536,15 +579,17 @@ all responses. Calling this method enables that behavior.
536
579
 
537
580
  ## Parameters
538
581
 
539
- | Parameter | Type | Description |
540
- | ------ | ------ | ------ |
541
- | `app` | `Express` | The Express app to disable the header on. |
582
+ ### app
583
+
584
+ `Express`
585
+
586
+ The Express app to disable the header on.
542
587
 
543
588
  ## Returns
544
589
 
545
590
  `void`
546
591
 
547
- ### <a id="errorToJsonHandler"></a>errorToJsonHandler
592
+ ### <a id="errorToJsonHandler"></a>errorToJsonHandler
548
593
 
549
594
  [**@xylabs/express**](#../README)
550
595
 
@@ -552,28 +597,45 @@ all responses. Calling this method enables that behavior.
552
597
 
553
598
  ```ts
554
599
  function errorToJsonHandler(
555
- error: ExpressError,
556
- req: Request,
557
- res: Response,
558
- next: NextFunction): void;
600
+ error,
601
+ req,
602
+ res,
603
+ next): void;
559
604
  ```
560
605
 
561
606
  Express error handler that logs the error and sends a JSON response with the error message and status code.
562
607
 
563
608
  ## Parameters
564
609
 
565
- | Parameter | Type | Description |
566
- | ------ | ------ | ------ |
567
- | `error` | [`ExpressError`](#../interfaces/ExpressError) | The Express error to handle. |
568
- | `req` | `Request` | The incoming request. |
569
- | `res` | `Response` | The outgoing response. |
570
- | `next` | `NextFunction` | The next middleware function. |
610
+ ### error
611
+
612
+ [`ExpressError`](#../interfaces/ExpressError)
613
+
614
+ The Express error to handle.
615
+
616
+ ### req
617
+
618
+ `Request`
619
+
620
+ The incoming request.
621
+
622
+ ### res
623
+
624
+ `Response`
625
+
626
+ The outgoing response.
627
+
628
+ ### next
629
+
630
+ `NextFunction`
631
+
632
+ The next middleware function.
571
633
 
572
634
  ## Returns
573
635
 
574
636
  `void`
575
637
 
576
- ### <a id="getDefaultLogger"></a>getDefaultLogger
638
+ ### <a id="getDefaultLogger"></a>getDefaultLogger
577
639
 
578
640
  [**@xylabs/express**](#../README)
579
641
 
@@ -591,14 +653,14 @@ Returns the singleton default logger instance, creating one if it does not exist
591
653
 
592
654
  The default logger.
593
655
 
594
- ### <a id="getHttpHeader"></a>getHttpHeader
656
+ ### <a id="getHttpHeader"></a>getHttpHeader
595
657
 
596
658
  [**@xylabs/express**](#../README)
597
659
 
598
660
  ***
599
661
 
600
662
  ```ts
601
- function getHttpHeader(header: string, req: Request): string | undefined;
663
+ function getHttpHeader(header, req): string | undefined;
602
664
  ```
603
665
 
604
666
  Since there can be multiple of certain HTTP headers or
@@ -608,10 +670,17 @@ method grabs the 1st/only one of the desired header
608
670
 
609
671
  ## Parameters
610
672
 
611
- | Parameter | Type | Description |
612
- | ------ | ------ | ------ |
613
- | `header` | `string` | The header to find |
614
- | `req` | `Request` | The received HTTP request (with headers) |
673
+ ### header
674
+
675
+ `string`
676
+
677
+ The header to find
678
+
679
+ ### req
680
+
681
+ `Request`
682
+
683
+ The received HTTP request (with headers)
615
684
 
616
685
  ## Returns
617
686
 
@@ -619,23 +688,25 @@ method grabs the 1st/only one of the desired header
619
688
 
620
689
  The first or only occurrence of the specified HTTP header
621
690
 
622
- ### <a id="getJsonBodyParser"></a>getJsonBodyParser
691
+ ### <a id="getJsonBodyParser"></a>getJsonBodyParser
623
692
 
624
693
  [**@xylabs/express**](#../README)
625
694
 
626
695
  ***
627
696
 
628
697
  ```ts
629
- function getJsonBodyParser(options?: OptionsJson): NextHandleFunction;
698
+ function getJsonBodyParser(options?): NextHandleFunction;
630
699
  ```
631
700
 
632
701
  Get a JSON Body Parser connect middleware handler
633
702
 
634
703
  ## Parameters
635
704
 
636
- | Parameter | Type | Default value | Description |
637
- | ------ | ------ | ------ | ------ |
638
- | `options` | `OptionsJson` | `DefaultJsonBodyParserOptions` | The options for the JSON Body Parser |
705
+ ### options?
706
+
707
+ `OptionsJson` = `DefaultJsonBodyParserOptions`
708
+
709
+ The options for the JSON Body Parser
639
710
 
640
711
  ## Returns
641
712
 
@@ -643,14 +714,14 @@ Get a JSON Body Parser connect middleware handler
643
714
 
644
715
  A middleware function that parses JSON bodies
645
716
 
646
- ### <a id="getJsonBodyParserOptions"></a>getJsonBodyParserOptions
717
+ ### <a id="getJsonBodyParserOptions"></a>getJsonBodyParserOptions
647
718
 
648
719
  [**@xylabs/express**](#../README)
649
720
 
650
721
  ***
651
722
 
652
723
  ```ts
653
- function getJsonBodyParserOptions(options?: Partial<OptionsJson>): OptionsJson;
724
+ function getJsonBodyParserOptions(options?): OptionsJson;
654
725
  ```
655
726
 
656
727
  Gets the default JSON Body Parser options merged with the supplied options
@@ -658,9 +729,11 @@ with the supplied options taking precedence
658
729
 
659
730
  ## Parameters
660
731
 
661
- | Parameter | Type | Description |
662
- | ------ | ------ | ------ |
663
- | `options?` | `Partial`\<`OptionsJson`\> | The options to override the default JSON Body Parser options with |
732
+ ### options?
733
+
734
+ `Partial`\<`OptionsJson`\>
735
+
736
+ The options to override the default JSON Body Parser options with
664
737
 
665
738
  ## Returns
666
739
 
@@ -669,23 +742,25 @@ with the supplied options taking precedence
669
742
  The combined JSON Body Parser options with the supplied values taking
670
743
  precedence over the default
671
744
 
672
- ### <a id="getLogger"></a>getLogger
745
+ ### <a id="getLogger"></a>getLogger
673
746
 
674
747
  [**@xylabs/express**](#../README)
675
748
 
676
749
  ***
677
750
 
678
751
  ```ts
679
- function getLogger(minVerbosity?: LoggerVerbosity): Logger;
752
+ function getLogger(minVerbosity?): Logger;
680
753
  ```
681
754
 
682
755
  Returns a cached Winston-backed logger at the specified verbosity level.
683
756
 
684
757
  ## Parameters
685
758
 
686
- | Parameter | Type | Default value | Description |
687
- | ------ | ------ | ------ | ------ |
688
- | `minVerbosity` | [`LoggerVerbosity`](#../type-aliases/LoggerVerbosity) | `'info'` | The minimum log level to output. Defaults to 'info'. |
759
+ ### minVerbosity?
760
+
761
+ [`LoggerVerbosity`](#../type-aliases/LoggerVerbosity) = `'info'`
762
+
763
+ The minimum log level to output. Defaults to 'info'.
689
764
 
690
765
  ## Returns
691
766
 
@@ -693,23 +768,25 @@ Returns a cached Winston-backed logger at the specified verbosity level.
693
768
 
694
769
  A logger instance configured for the given verbosity.
695
770
 
696
- ### <a id="getResponseMetadata"></a>getResponseMetadata
771
+ ### <a id="getResponseMetadata"></a>getResponseMetadata
697
772
 
698
773
  [**@xylabs/express**](#../README)
699
774
 
700
775
  ***
701
776
 
702
777
  ```ts
703
- function getResponseMetadata(res: Response): Record<string, unknown>;
778
+ function getResponseMetadata(res): Record<string, unknown>;
704
779
  ```
705
780
 
706
781
  Extracts response metadata from res.locals, computing profile duration if profiling was started.
707
782
 
708
783
  ## Parameters
709
784
 
710
- | Parameter | Type | Description |
711
- | ------ | ------ | ------ |
712
- | `res` | `Response` | The Express response to extract metadata from. |
785
+ ### res
786
+
787
+ `Response`
788
+
789
+ The Express response to extract metadata from.
713
790
 
714
791
  ## Returns
715
792
 
@@ -717,14 +794,14 @@ Extracts response metadata from res.locals, computing profile duration if profil
717
794
 
718
795
  The metadata record including any profiling information.
719
796
 
720
- ### <a id="isRawResponseFormatSet"></a>isRawResponseFormatSet
797
+ ### <a id="isRawResponseFormatSet"></a>isRawResponseFormatSet
721
798
 
722
799
  [**@xylabs/express**](#../README)
723
800
 
724
801
  ***
725
802
 
726
803
  ```ts
727
- function isRawResponseFormatSet(res: Response): boolean;
804
+ function isRawResponseFormatSet(res): boolean;
728
805
  ```
729
806
 
730
807
  Checks if there are any flags on the response that would cause it
@@ -733,9 +810,9 @@ body to the client
733
810
 
734
811
  ## Parameters
735
812
 
736
- | Parameter | Type | Description |
737
- | ------ | ------ | ------ |
738
- | `res` | `Response` | - |
813
+ ### res
814
+
815
+ `Response`
739
816
 
740
817
  ## Returns
741
818
 
@@ -743,57 +820,64 @@ body to the client
743
820
 
744
821
  True if there are any flags on the response, false otherwise
745
822
 
746
- ### <a id="requestHandlerValidator"></a>requestHandlerValidator
823
+ ### <a id="requestHandlerValidator"></a>requestHandlerValidator
747
824
 
748
825
  [**@xylabs/express**](#../README)
749
826
 
750
827
  ***
751
828
 
752
829
  ```ts
753
- function requestHandlerValidator<TParams, TQuery, TBody, TResponse>(schemas?: Partial<{
754
- body: TBody;
755
- params: TParams;
756
- query: TQuery;
757
- response: TResponse;
758
- }>): (handler: (req: Request<output<TParams>, output<TResponse>, output<TBody>, output<TQuery>>, res: Response<output<TResponse>>, next: NextFunction) => unknown) => RequestHandler;
830
+ function requestHandlerValidator<TParams, TQuery, TBody, TResponse>(schemas?): (handler) => RequestHandler;
759
831
  ```
760
832
 
761
833
  Factory for Express middleware that validates request and response objects using Zod schemas.
762
834
 
763
835
  ## Type Parameters
764
836
 
765
- | Type Parameter | Default type |
766
- | ------ | ------ |
767
- | `TParams` *extends* \| `ZodObject`\<\{ \}, `$catchall`\<`ZodUnion`\<readonly \[`ZodString`, `ZodArray`\<`ZodString`\>\]\>\>\> \| `ZodType`\<`Record`\<`string`, `string`\>, `unknown`, `$ZodTypeInternals`\<`Record`\<`string`, `string`\>, `unknown`\>\> | `ZodObject`\<\{ \}, `$catchall`\<`ZodUnion`\<readonly \[`ZodString`, `ZodArray`\<`ZodString`\>\]\>\>\> |
768
- | `TQuery` *extends* \| `ZodObject`\<\{ \}, `$catchall`\<`ZodUnion`\<readonly \[`ZodString`, `ZodArray`\<`ZodString`\>\]\>\>\> \| `ZodType`\<`Record`\<`string`, `string` \| `string`[]\>, `unknown`, `$ZodTypeInternals`\<`Record`\<`string`, `string` \| `string`[]\>, `unknown`\>\> | `ZodObject`\<\{ \}, `$catchall`\<`ZodUnion`\<readonly \[`ZodString`, `ZodArray`\<`ZodString`\>\]\>\>\> |
769
- | `TBody` *extends* `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\> | `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\> |
770
- | `TResponse` *extends* `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\> | `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\> |
837
+ ### TParams
771
838
 
772
- ## Parameters
839
+ `TParams` *extends*
840
+ \| `ZodObject`\<\{
841
+ \}, `$catchall`\<`ZodUnion`\<readonly \[`ZodString`, `ZodArray`\<`ZodString`\>\]\>\>\>
842
+ \| `ZodType`\<`Record`\<`string`, `string`\>, `unknown`, `$ZodTypeInternals`\<`Record`\<`string`, `string`\>, `unknown`\>\> = `ZodObject`\<\{
843
+ \}, `$catchall`\<`ZodUnion`\<readonly \[`ZodString`, `ZodArray`\<`ZodString`\>\]\>\>\>
773
844
 
774
- | Parameter | Type | Description |
775
- | ------ | ------ | ------ |
776
- | `schemas?` | `Partial`\<\{ `body`: `TBody`; `params`: `TParams`; `query`: `TQuery`; `response`: `TResponse`; \}\> | The Zod schemas to use for validation. |
845
+ ### TQuery
777
846
 
778
- ## Returns
847
+ `TQuery` *extends*
848
+ \| `ZodObject`\<\{
849
+ \}, `$catchall`\<`ZodUnion`\<readonly \[`ZodString`, `ZodArray`\<`ZodString`\>\]\>\>\>
850
+ \| `ZodType`\<`Record`\<`string`, `string` \| `string`[]\>, `unknown`, `$ZodTypeInternals`\<`Record`\<`string`, `string` \| `string`[]\>, `unknown`\>\> = `ZodObject`\<\{
851
+ \}, `$catchall`\<`ZodUnion`\<readonly \[`ZodString`, `ZodArray`\<`ZodString`\>\]\>\>\>
779
852
 
780
- A middleware function for validating requests and responses.
853
+ ### TBody
781
854
 
782
- ```ts
783
- (handler: (req: Request<output<TParams>, output<TResponse>, output<TBody>, output<TQuery>>, res: Response<output<TResponse>>, next: NextFunction) => unknown): RequestHandler;
784
- ```
855
+ `TBody` *extends* `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\> = `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\>
785
856
 
786
- ### Parameters
857
+ ### TResponse
787
858
 
788
- | Parameter | Type |
789
- | ------ | ------ |
790
- | `handler` | (`req`: `Request`\<`output`\<`TParams`\>, `output`\<`TResponse`\>, `output`\<`TBody`\>, `output`\<`TQuery`\>\>, `res`: `Response`\<`output`\<`TResponse`\>\>, `next`: `NextFunction`) => `unknown` |
859
+ `TResponse` *extends* `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\> = `ZodType`\<`unknown`, `unknown`, `$ZodTypeInternals`\<`unknown`, `unknown`\>\>
791
860
 
792
- ### Returns
861
+ ## Parameters
793
862
 
794
- `RequestHandler`
863
+ ### schemas?
795
864
 
796
- ### <a id="responseProfiler"></a>responseProfiler
865
+ `Partial`\<\{
866
+ `body`: `TBody`;
867
+ `params`: `TParams`;
868
+ `query`: `TQuery`;
869
+ `response`: `TResponse`;
870
+ \}\>
871
+
872
+ The Zod schemas to use for validation.
873
+
874
+ ## Returns
875
+
876
+ A middleware function for validating requests and responses.
877
+
878
+ (`handler`) => `RequestHandler`
879
+
880
+ ### <a id="responseProfiler"></a>responseProfiler
797
881
 
798
882
  [**@xylabs/express**](#../README)
799
883
 
@@ -801,9 +885,9 @@ A middleware function for validating requests and responses.
801
885
 
802
886
  ```ts
803
887
  function responseProfiler(
804
- _req: Request,
805
- res: Response,
806
- next: NextFunction): void;
888
+ _req,
889
+ res,
890
+ next): void;
807
891
  ```
808
892
 
809
893
  Connect middleware to enable profiling of response lifecycle timing. To effectively profile
@@ -812,11 +896,23 @@ App
812
896
 
813
897
  ## Parameters
814
898
 
815
- | Parameter | Type | Description |
816
- | ------ | ------ | ------ |
817
- | `_req` | `Request` | The request |
818
- | `res` | `Response` | The response |
819
- | `next` | `NextFunction` | The next function |
899
+ ### \_req
900
+
901
+ `Request`
902
+
903
+ The request
904
+
905
+ ### res
906
+
907
+ `Response`
908
+
909
+ The response
910
+
911
+ ### next
912
+
913
+ `NextFunction`
914
+
915
+ The next function
820
916
 
821
917
  ## Returns
822
918
 
@@ -830,14 +926,14 @@ app.use(responseProfiler)
830
926
  // other initialization ...
831
927
  ```
832
928
 
833
- ### <a id="setRawResponseFormat"></a>setRawResponseFormat
929
+ ### <a id="setRawResponseFormat"></a>setRawResponseFormat
834
930
 
835
931
  [**@xylabs/express**](#../README)
836
932
 
837
933
  ***
838
934
 
839
935
  ```ts
840
- function setRawResponseFormat(res: Response): void;
936
+ function setRawResponseFormat(res): void;
841
937
  ```
842
938
 
843
939
  Flags the response to forgo the standard response envelope
@@ -845,15 +941,17 @@ and return the raw response body to the client
845
941
 
846
942
  ## Parameters
847
943
 
848
- | Parameter | Type | Description |
849
- | ------ | ------ | ------ |
850
- | `res` | `Response` | The response to disable the standard response format on |
944
+ ### res
945
+
946
+ `Response`
947
+
948
+ The response to disable the standard response format on
851
949
 
852
950
  ## Returns
853
951
 
854
952
  `void`
855
953
 
856
- ### <a id="standardErrors"></a>standardErrors
954
+ ### <a id="standardErrors"></a>standardErrors
857
955
 
858
956
  [**@xylabs/express**](#../README)
859
957
 
@@ -861,88 +959,105 @@ and return the raw response body to the client
861
959
 
862
960
  ```ts
863
961
  function standardErrors(
864
- err: ExpressError | undefined,
865
- req: Request,
866
- res: Response,
867
- next: NextFunction): void;
962
+ err,
963
+ req,
964
+ res,
965
+ next): void;
868
966
  ```
869
967
 
870
968
  Express error handler that logs the error and sends a JSON:API-compliant error response.
871
969
 
872
970
  ## Parameters
873
971
 
874
- | Parameter | Type | Description |
875
- | ------ | ------ | ------ |
876
- | `err` | [`ExpressError`](#../interfaces/ExpressError) \| `undefined` | The error to handle, or undefined if no error. |
877
- | `req` | `Request` | The incoming request. |
878
- | `res` | `Response` | The outgoing response. |
879
- | `next` | `NextFunction` | The next middleware function. |
972
+ ### err
973
+
974
+ [`ExpressError`](#../interfaces/ExpressError) \| `undefined`
975
+
976
+ The error to handle, or undefined if no error.
977
+
978
+ ### req
979
+
980
+ `Request`
981
+
982
+ The incoming request.
983
+
984
+ ### res
985
+
986
+ `Response`
987
+
988
+ The outgoing response.
989
+
990
+ ### next
991
+
992
+ `NextFunction`
993
+
994
+ The next middleware function.
880
995
 
881
996
  ## Returns
882
997
 
883
998
  `void`
884
999
 
885
- ### <a id="tryParse"></a>tryParse
1000
+ ### <a id="tryParse"></a>tryParse
886
1001
 
887
1002
  [**@xylabs/express**](#../README)
888
1003
 
889
1004
  ***
890
1005
 
891
1006
  ```ts
892
- function tryParse<T>(func: ParseFunc<T>, value?: string):
893
- | T & {
894
- }
895
- | undefined;
1007
+ function tryParse<T>(func, value?): T & object | undefined;
896
1008
  ```
897
1009
 
898
1010
  ## Type Parameters
899
1011
 
900
- | Type Parameter | Default type |
901
- | ------ | ------ |
902
- | `T` | `number` |
1012
+ ### T
1013
+
1014
+ `T` = `number`
903
1015
 
904
1016
  ## Parameters
905
1017
 
906
- | Parameter | Type |
907
- | ------ | ------ |
908
- | `func` | [`ParseFunc`](#../type-aliases/ParseFunc)\<`T`\> |
909
- | `value?` | `string` |
1018
+ ### func
1019
+
1020
+ [`ParseFunc`](#../type-aliases/ParseFunc)\<`T`\>
1021
+
1022
+ ### value?
1023
+
1024
+ `string`
910
1025
 
911
1026
  ## Returns
912
1027
 
913
- \| `T` & \{
914
- \}
915
- \| `undefined`
1028
+ `T` & `object` \| `undefined`
916
1029
 
917
1030
  ## Deprecated
918
1031
 
919
1032
  use zod instead
920
1033
 
921
- ### <a id="useRequestCounters"></a>useRequestCounters
1034
+ ### <a id="useRequestCounters"></a>useRequestCounters
922
1035
 
923
1036
  [**@xylabs/express**](#../README)
924
1037
 
925
1038
  ***
926
1039
 
927
1040
  ```ts
928
- function useRequestCounters(app: Application): void;
1041
+ function useRequestCounters(app): void;
929
1042
  ```
930
1043
 
931
1044
  Registers middleware that increments per-path request counters and exposes a /stats endpoint.
932
1045
 
933
1046
  ## Parameters
934
1047
 
935
- | Parameter | Type | Description |
936
- | ------ | ------ | ------ |
937
- | `app` | `Application` | The Express application to attach counters to. |
1048
+ ### app
1049
+
1050
+ `Application`
1051
+
1052
+ The Express application to attach counters to.
938
1053
 
939
1054
  ## Returns
940
1055
 
941
1056
  `void`
942
1057
 
943
- ### interfaces
1058
+ ### interfaces
944
1059
 
945
- ### <a id="ApiDataResponse"></a>ApiDataResponse
1060
+ ### <a id="ApiDataResponse"></a>ApiDataResponse
946
1061
 
947
1062
  [**@xylabs/express**](#../README)
948
1063
 
@@ -956,21 +1071,63 @@ A successful JSON:API response containing primary data and optional included res
956
1071
 
957
1072
  ## Type Parameters
958
1073
 
959
- | Type Parameter |
960
- | ------ |
961
- | `T` *extends* [`ApiResourceIdentifierObject`](#ApiResourceIdentifierObject) |
1074
+ ### T
1075
+
1076
+ `T` *extends* [`ApiResourceIdentifierObject`](#ApiResourceIdentifierObject)
962
1077
 
963
1078
  ## Properties
964
1079
 
965
- | Property | Type | Inherited from |
966
- | ------ | ------ | ------ |
967
- | <a id="jsonapi"></a> `jsonapi?` | [`JsonApi`](#JsonApi) | [`ApiResponseBase`](#ApiResponseBase).[`jsonapi`](ApiResponseBase.md#jsonapi) |
968
- | <a id="links"></a> `links?` | [`ApiLinks`](#../type-aliases/ApiLinks) | [`ApiResponseBase`](#ApiResponseBase).[`links`](ApiResponseBase.md#links) |
969
- | <a id="meta"></a> `meta?` | `Record`\<`string`, `unknown`\> | [`ApiResponseBase`](#ApiResponseBase).[`meta`](ApiResponseBase.md#meta) |
970
- | <a id="data"></a> `data` | `T` | - |
971
- | <a id="included"></a> `included?` | [`ApiResourceObject`](#ApiResourceObject)[] | - |
1080
+ ### jsonapi?
1081
+
1082
+ ```ts
1083
+ optional jsonapi?: JsonApi;
1084
+ ```
1085
+
1086
+ ### Inherited from
1087
+
1088
+ [`ApiResponseBase`](#ApiResponseBase).[`jsonapi`](ApiResponseBase.md#jsonapi)
972
1089
 
973
- ### <a id="ApiError"></a>ApiError
1090
+ ***
1091
+
1092
+ ### links?
1093
+
1094
+ ```ts
1095
+ optional links?: ApiLinks;
1096
+ ```
1097
+
1098
+ ### Inherited from
1099
+
1100
+ [`ApiResponseBase`](#ApiResponseBase).[`links`](ApiResponseBase.md#links)
1101
+
1102
+ ***
1103
+
1104
+ ### meta?
1105
+
1106
+ ```ts
1107
+ optional meta?: Record<string, unknown>;
1108
+ ```
1109
+
1110
+ ### Inherited from
1111
+
1112
+ [`ApiResponseBase`](#ApiResponseBase).[`meta`](ApiResponseBase.md#meta)
1113
+
1114
+ ***
1115
+
1116
+ ### data
1117
+
1118
+ ```ts
1119
+ data: T;
1120
+ ```
1121
+
1122
+ ***
1123
+
1124
+ ### included?
1125
+
1126
+ ```ts
1127
+ optional included?: ApiResourceObject[];
1128
+ ```
1129
+
1130
+ ### <a id="ApiError"></a>ApiError
974
1131
 
975
1132
  [**@xylabs/express**](#../README)
976
1133
 
@@ -978,18 +1135,86 @@ A successful JSON:API response containing primary data and optional included res
978
1135
 
979
1136
  ## Properties
980
1137
 
981
- | Property | Type | Description |
982
- | ------ | ------ | ------ |
983
- | <a id="code"></a> `code?` | `string` | An application-specific error code, expressed as a string value. |
984
- | <a id="detail"></a> `detail?` | `string` | A human-readable explanation specific to this occurrence of the problem. Like title, this field's value can be localized. |
985
- | <a id="id"></a> `id?` | `string` | A unique identifier for this particular occurrence of the problem. |
986
- | <a id="links"></a> `links?` | [`ApiLinks`](#../type-aliases/ApiLinks) | A links object containing the following members: about: a link that leads to further details about this particular occurrence of the problem |
987
- | <a id="meta"></a> `meta?` | `Record`\<`string`, `unknown`\> | A meta object containing non-standard meta-information about the error. |
988
- | <a id="source"></a> `source?` | [`Source`](#Source) | An object containing references to the source of the error, optionally including any of the following members: |
989
- | <a id="status"></a> `status?` | `string` | The HTTP status code applicable to this problem, expressed as a string value. |
990
- | <a id="title"></a> `title?` | `string` | A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization. |
1138
+ ### code?
1139
+
1140
+ ```ts
1141
+ optional code?: string;
1142
+ ```
991
1143
 
992
- ### <a id="ApiErrorResponse"></a>ApiErrorResponse
1144
+ An application-specific error code, expressed as a string value.
1145
+
1146
+ ***
1147
+
1148
+ ### detail?
1149
+
1150
+ ```ts
1151
+ optional detail?: string;
1152
+ ```
1153
+
1154
+ A human-readable explanation specific to this occurrence of the problem. Like title, this field's value can be localized.
1155
+
1156
+ ***
1157
+
1158
+ ### id?
1159
+
1160
+ ```ts
1161
+ optional id?: string;
1162
+ ```
1163
+
1164
+ A unique identifier for this particular occurrence of the problem.
1165
+
1166
+ ***
1167
+
1168
+ ### links?
1169
+
1170
+ ```ts
1171
+ optional links?: ApiLinks;
1172
+ ```
1173
+
1174
+ A links object containing the following members:
1175
+ about: a link that leads to further details about this particular occurrence of the problem
1176
+
1177
+ ***
1178
+
1179
+ ### meta?
1180
+
1181
+ ```ts
1182
+ optional meta?: Record<string, unknown>;
1183
+ ```
1184
+
1185
+ A meta object containing non-standard meta-information about the error.
1186
+
1187
+ ***
1188
+
1189
+ ### source?
1190
+
1191
+ ```ts
1192
+ optional source?: Source;
1193
+ ```
1194
+
1195
+ An object containing references to the source of the error, optionally including any of the following members:
1196
+
1197
+ ***
1198
+
1199
+ ### status?
1200
+
1201
+ ```ts
1202
+ optional status?: string;
1203
+ ```
1204
+
1205
+ The HTTP status code applicable to this problem, expressed as a string value.
1206
+
1207
+ ***
1208
+
1209
+ ### title?
1210
+
1211
+ ```ts
1212
+ optional title?: string;
1213
+ ```
1214
+
1215
+ A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization.
1216
+
1217
+ ### <a id="ApiErrorResponse"></a>ApiErrorResponse
993
1218
 
994
1219
  [**@xylabs/express**](#../README)
995
1220
 
@@ -1003,14 +1228,49 @@ A JSON:API error response containing one or more error objects.
1003
1228
 
1004
1229
  ## Properties
1005
1230
 
1006
- | Property | Type | Inherited from |
1007
- | ------ | ------ | ------ |
1008
- | <a id="jsonapi"></a> `jsonapi?` | [`JsonApi`](#JsonApi) | [`ApiResponseBase`](#ApiResponseBase).[`jsonapi`](ApiResponseBase.md#jsonapi) |
1009
- | <a id="links"></a> `links?` | [`ApiLinks`](#../type-aliases/ApiLinks) | [`ApiResponseBase`](#ApiResponseBase).[`links`](ApiResponseBase.md#links) |
1010
- | <a id="meta"></a> `meta?` | `Record`\<`string`, `unknown`\> | [`ApiResponseBase`](#ApiResponseBase).[`meta`](ApiResponseBase.md#meta) |
1011
- | <a id="errors"></a> `errors` | [`ApiError`](#ApiError)[] | - |
1231
+ ### jsonapi?
1232
+
1233
+ ```ts
1234
+ optional jsonapi?: JsonApi;
1235
+ ```
1236
+
1237
+ ### Inherited from
1238
+
1239
+ [`ApiResponseBase`](#ApiResponseBase).[`jsonapi`](ApiResponseBase.md#jsonapi)
1240
+
1241
+ ***
1242
+
1243
+ ### links?
1244
+
1245
+ ```ts
1246
+ optional links?: ApiLinks;
1247
+ ```
1248
+
1249
+ ### Inherited from
1012
1250
 
1013
- ### <a id="ApiResourceIdentifierObject"></a>ApiResourceIdentifierObject
1251
+ [`ApiResponseBase`](#ApiResponseBase).[`links`](ApiResponseBase.md#links)
1252
+
1253
+ ***
1254
+
1255
+ ### meta?
1256
+
1257
+ ```ts
1258
+ optional meta?: Record<string, unknown>;
1259
+ ```
1260
+
1261
+ ### Inherited from
1262
+
1263
+ [`ApiResponseBase`](#ApiResponseBase).[`meta`](ApiResponseBase.md#meta)
1264
+
1265
+ ***
1266
+
1267
+ ### errors
1268
+
1269
+ ```ts
1270
+ errors: ApiError[];
1271
+ ```
1272
+
1273
+ ### <a id="ApiResourceIdentifierObject"></a>ApiResourceIdentifierObject
1014
1274
 
1015
1275
  [**@xylabs/express**](#../README)
1016
1276
 
@@ -1025,12 +1285,26 @@ Within a given API, each resource object's type and id pair MUST identify a sing
1025
1285
 
1026
1286
  ## Properties
1027
1287
 
1028
- | Property | Type | Description |
1029
- | ------ | ------ | ------ |
1030
- | <a id="id"></a> `id` | `string` | The id member is not required when the resource object originates at the client and represents a new resource to be created on the server. |
1031
- | <a id="type"></a> `type` | `string` | The type member is used to describe resource objects that share common attributes and relationships. The values of type members MUST adhere to the same constraints as member names. |
1288
+ ### id
1032
1289
 
1033
- ### <a id="ApiResourceObject"></a>ApiResourceObject
1290
+ ```ts
1291
+ id: string;
1292
+ ```
1293
+
1294
+ The id member is not required when the resource object originates at the client and represents a new resource to be created on the server.
1295
+
1296
+ ***
1297
+
1298
+ ### type
1299
+
1300
+ ```ts
1301
+ type: string;
1302
+ ```
1303
+
1304
+ The type member is used to describe resource objects that share common attributes and relationships.
1305
+ The values of type members MUST adhere to the same constraints as member names.
1306
+
1307
+ ### <a id="ApiResourceObject"></a>ApiResourceObject
1034
1308
 
1035
1309
  [**@xylabs/express**](#../README)
1036
1310
 
@@ -1044,16 +1318,74 @@ A JSON:API resource object with optional attributes, links, meta, and relationsh
1044
1318
 
1045
1319
  ## Properties
1046
1320
 
1047
- | Property | Type | Description | Inherited from |
1048
- | ------ | ------ | ------ | ------ |
1049
- | <a id="id"></a> `id` | `string` | The id member is not required when the resource object originates at the client and represents a new resource to be created on the server. | [`ApiResourceIdentifierObject`](#ApiResourceIdentifierObject).[`id`](ApiResourceIdentifierObject.md#id) |
1050
- | <a id="type"></a> `type` | `string` | The type member is used to describe resource objects that share common attributes and relationships. The values of type members MUST adhere to the same constraints as member names. | [`ApiResourceIdentifierObject`](#ApiResourceIdentifierObject).[`type`](ApiResourceIdentifierObject.md#type) |
1051
- | <a id="attributes"></a> `attributes?` | `Record`\<`string`, `unknown`\> | An attributes object representing some of the resource's data. | - |
1052
- | <a id="links"></a> `links?` | [`ApiLinks`](#../type-aliases/ApiLinks) | A links object containing links related to the resource. | - |
1053
- | <a id="meta"></a> `meta?` | `Record`\<`string`, `unknown`\> | A meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship. | - |
1054
- | <a id="relationships"></a> `relationships?` | `Record`\<`string`, [`Relationship`](#../type-aliases/Relationship)\> | A relationships object describing relationships between the resource and other JSON:API resources. | - |
1321
+ ### id
1322
+
1323
+ ```ts
1324
+ id: string;
1325
+ ```
1326
+
1327
+ The id member is not required when the resource object originates at the client and represents a new resource to be created on the server.
1328
+
1329
+ ### Inherited from
1055
1330
 
1056
- ### <a id="ApiResponseBase"></a>ApiResponseBase
1331
+ [`ApiResourceIdentifierObject`](#ApiResourceIdentifierObject).[`id`](ApiResourceIdentifierObject.md#id)
1332
+
1333
+ ***
1334
+
1335
+ ### type
1336
+
1337
+ ```ts
1338
+ type: string;
1339
+ ```
1340
+
1341
+ The type member is used to describe resource objects that share common attributes and relationships.
1342
+ The values of type members MUST adhere to the same constraints as member names.
1343
+
1344
+ ### Inherited from
1345
+
1346
+ [`ApiResourceIdentifierObject`](#ApiResourceIdentifierObject).[`type`](ApiResourceIdentifierObject.md#type)
1347
+
1348
+ ***
1349
+
1350
+ ### attributes?
1351
+
1352
+ ```ts
1353
+ optional attributes?: Record<string, unknown>;
1354
+ ```
1355
+
1356
+ An attributes object representing some of the resource's data.
1357
+
1358
+ ***
1359
+
1360
+ ### links?
1361
+
1362
+ ```ts
1363
+ optional links?: ApiLinks;
1364
+ ```
1365
+
1366
+ A links object containing links related to the resource.
1367
+
1368
+ ***
1369
+
1370
+ ### meta?
1371
+
1372
+ ```ts
1373
+ optional meta?: Record<string, unknown>;
1374
+ ```
1375
+
1376
+ A meta object containing non-standard meta-information about a resource that can not be represented as an attribute or relationship.
1377
+
1378
+ ***
1379
+
1380
+ ### relationships?
1381
+
1382
+ ```ts
1383
+ optional relationships?: Record<string, Relationship>;
1384
+ ```
1385
+
1386
+ A relationships object describing relationships between the resource and other JSON:API resources.
1387
+
1388
+ ### <a id="ApiResponseBase"></a>ApiResponseBase
1057
1389
 
1058
1390
  [**@xylabs/express**](#../README)
1059
1391
 
@@ -1068,13 +1400,29 @@ Base interface for all JSON:API responses, including optional links and metadata
1068
1400
 
1069
1401
  ## Properties
1070
1402
 
1071
- | Property | Type |
1072
- | ------ | ------ |
1073
- | <a id="jsonapi"></a> `jsonapi?` | [`JsonApi`](#JsonApi) |
1074
- | <a id="links"></a> `links?` | [`ApiLinks`](#../type-aliases/ApiLinks) |
1075
- | <a id="meta"></a> `meta?` | `Record`\<`string`, `unknown`\> |
1403
+ ### jsonapi?
1404
+
1405
+ ```ts
1406
+ optional jsonapi?: JsonApi;
1407
+ ```
1408
+
1409
+ ***
1076
1410
 
1077
- ### <a id="Empty"></a>Empty
1411
+ ### links?
1412
+
1413
+ ```ts
1414
+ optional links?: ApiLinks;
1415
+ ```
1416
+
1417
+ ***
1418
+
1419
+ ### meta?
1420
+
1421
+ ```ts
1422
+ optional meta?: Record<string, unknown>;
1423
+ ```
1424
+
1425
+ ### <a id="Empty"></a>Empty
1078
1426
 
1079
1427
  [**@xylabs/express**](#../README)
1080
1428
 
@@ -1082,7 +1430,7 @@ Base interface for all JSON:API responses, including optional links and metadata
1082
1430
 
1083
1431
  Empty object type used as a default for request/response body generics.
1084
1432
 
1085
- ### <a id="ExpressError"></a>ExpressError
1433
+ ### <a id="ExpressError"></a>ExpressError
1086
1434
 
1087
1435
  [**@xylabs/express**](#../README)
1088
1436
 
@@ -1096,11 +1444,13 @@ An Error with an optional HTTP status code for Express error handling.
1096
1444
 
1097
1445
  ## Properties
1098
1446
 
1099
- | Property | Type |
1100
- | ------ | ------ |
1101
- | <a id="statuscode"></a> `statusCode?` | `number` |
1447
+ ### statusCode?
1102
1448
 
1103
- ### <a id="HrefWithMeta"></a>HrefWithMeta
1449
+ ```ts
1450
+ optional statusCode?: number;
1451
+ ```
1452
+
1453
+ ### <a id="HrefWithMeta"></a>HrefWithMeta
1104
1454
 
1105
1455
  [**@xylabs/express**](#../README)
1106
1456
 
@@ -1110,12 +1460,21 @@ A link with an href and associated metadata.
1110
1460
 
1111
1461
  ## Properties
1112
1462
 
1113
- | Property | Type |
1114
- | ------ | ------ |
1115
- | <a id="href"></a> `href` | `string` |
1116
- | <a id="meta"></a> `meta` | `Record`\<`string`, `unknown`\> |
1463
+ ### href
1464
+
1465
+ ```ts
1466
+ href: string;
1467
+ ```
1468
+
1469
+ ***
1470
+
1471
+ ### meta
1117
1472
 
1118
- ### <a id="IRelationshipData"></a>IRelationshipData
1473
+ ```ts
1474
+ meta: Record<string, unknown>;
1475
+ ```
1476
+
1477
+ ### <a id="IRelationshipData"></a>IRelationshipData
1119
1478
 
1120
1479
  [**@xylabs/express**](#../README)
1121
1480
 
@@ -1125,11 +1484,13 @@ Contains the resource linkage data for a JSON:API relationship.
1125
1484
 
1126
1485
  ## Properties
1127
1486
 
1128
- | Property | Type |
1129
- | ------ | ------ |
1130
- | <a id="data"></a> `data` | [`ResourceLinkage`](#../type-aliases/ResourceLinkage) |
1487
+ ### data
1488
+
1489
+ ```ts
1490
+ data: ResourceLinkage;
1491
+ ```
1131
1492
 
1132
- ### <a id="IRelationshipLinks"></a>IRelationshipLinks
1493
+ ### <a id="IRelationshipLinks"></a>IRelationshipLinks
1133
1494
 
1134
1495
  [**@xylabs/express**](#../README)
1135
1496
 
@@ -1139,11 +1500,15 @@ Contains the links for a JSON:API relationship.
1139
1500
 
1140
1501
  ## Properties
1141
1502
 
1142
- | Property | Type |
1143
- | ------ | ------ |
1144
- | <a id="links"></a> `links` | \| [`IRelationshipSelfLink`](#IRelationshipSelfLink) \| [`IRelationshipRelatedLink`](#IRelationshipRelatedLink) |
1503
+ ### links
1504
+
1505
+ ```ts
1506
+ links:
1507
+ | IRelationshipSelfLink
1508
+ | IRelationshipRelatedLink;
1509
+ ```
1145
1510
 
1146
- ### <a id="IRelationshipRelatedLink"></a>IRelationshipRelatedLink
1511
+ ### <a id="IRelationshipRelatedLink"></a>IRelationshipRelatedLink
1147
1512
 
1148
1513
  [**@xylabs/express**](#../README)
1149
1514
 
@@ -1153,11 +1518,15 @@ A relationship link pointing to a related resource.
1153
1518
 
1154
1519
  ## Properties
1155
1520
 
1156
- | Property | Type | Description |
1157
- | ------ | ------ | ------ |
1158
- | <a id="related"></a> `related` | `string` | A related resource link |
1521
+ ### related
1522
+
1523
+ ```ts
1524
+ related: string;
1525
+ ```
1526
+
1527
+ A related resource link
1159
1528
 
1160
- ### <a id="IRelationshipSelfLink"></a>IRelationshipSelfLink
1529
+ ### <a id="IRelationshipSelfLink"></a>IRelationshipSelfLink
1161
1530
 
1162
1531
  [**@xylabs/express**](#../README)
1163
1532
 
@@ -1167,11 +1536,17 @@ A relationship link pointing to the relationship itself.
1167
1536
 
1168
1537
  ## Properties
1169
1538
 
1170
- | Property | Type | Description |
1171
- | ------ | ------ | ------ |
1172
- | <a id="self"></a> `self` | `string` | A link for the relationship itself (a "relationship link"). This link allows the client to directly manipulate the relationship. For example, removing an author through an article’s relationship URL would disconnect the person from the article without deleting the people resource itself. When fetched successfully, this link returns the linkage for the related resources as its primary data. |
1539
+ ### self
1540
+
1541
+ ```ts
1542
+ self: string;
1543
+ ```
1173
1544
 
1174
- ### <a id="JsonApi"></a>JsonApi
1545
+ A link for the relationship itself (a "relationship link"). This link allows the client to directly manipulate the relationship.
1546
+ For example, removing an author through an article’s relationship URL would disconnect the person from the article without
1547
+ deleting the people resource itself. When fetched successfully, this link returns the linkage for the related resources as its primary data.
1548
+
1549
+ ### <a id="JsonApi"></a>JsonApi
1175
1550
 
1176
1551
  [**@xylabs/express**](#../README)
1177
1552
 
@@ -1181,12 +1556,21 @@ JSON:API version and metadata descriptor.
1181
1556
 
1182
1557
  ## Properties
1183
1558
 
1184
- | Property | Type |
1185
- | ------ | ------ |
1186
- | <a id="meta"></a> `meta?` | `Record`\<`string`, `unknown`\> |
1187
- | <a id="version"></a> `version?` | `"1.0"` \| `"1.1"` |
1559
+ ### meta?
1560
+
1561
+ ```ts
1562
+ optional meta?: Record<string, unknown>;
1563
+ ```
1564
+
1565
+ ***
1188
1566
 
1189
- ### <a id="LoggerOptions"></a>LoggerOptions
1567
+ ### version?
1568
+
1569
+ ```ts
1570
+ optional version?: "1.0" | "1.1";
1571
+ ```
1572
+
1573
+ ### <a id="LoggerOptions"></a>LoggerOptions
1190
1574
 
1191
1575
  [**@xylabs/express**](#../README)
1192
1576
 
@@ -1196,12 +1580,21 @@ Configuration options for creating a logger instance.
1196
1580
 
1197
1581
  ## Properties
1198
1582
 
1199
- | Property | Type |
1200
- | ------ | ------ |
1201
- | <a id="defaultmeta"></a> `defaultMeta?` | [`LoggerMeta`](#../type-aliases/LoggerMeta) |
1202
- | <a id="level"></a> `level?` | [`LoggerVerbosity`](#../type-aliases/LoggerVerbosity) |
1583
+ ### defaultMeta?
1584
+
1585
+ ```ts
1586
+ optional defaultMeta?: LoggerMeta;
1587
+ ```
1588
+
1589
+ ***
1203
1590
 
1204
- ### <a id="RouteDefinition"></a>RouteDefinition
1591
+ ### level?
1592
+
1593
+ ```ts
1594
+ optional level?: LoggerVerbosity;
1595
+ ```
1596
+
1597
+ ### <a id="RouteDefinition"></a>RouteDefinition
1205
1598
 
1206
1599
  [**@xylabs/express**](#../README)
1207
1600
 
@@ -1211,19 +1604,35 @@ Defines an Express route with its HTTP method, path, and handler(s).
1211
1604
 
1212
1605
  ## Type Parameters
1213
1606
 
1214
- | Type Parameter | Default type |
1215
- | ------ | ------ |
1216
- | `H` *extends* `RequestHandler` | `RequestHandler` |
1607
+ ### H
1608
+
1609
+ `H` *extends* `RequestHandler` = `RequestHandler`
1217
1610
 
1218
1611
  ## Properties
1219
1612
 
1220
- | Property | Type |
1221
- | ------ | ------ |
1222
- | <a id="handlers"></a> `handlers` | `H` \| `H`[] |
1223
- | <a id="method"></a> `method` | [`HttpMethod`](#../type-aliases/HttpMethod) |
1224
- | <a id="path"></a> `path` | `string` \| `RegExp` |
1613
+ ### handlers
1614
+
1615
+ ```ts
1616
+ handlers: H | H[];
1617
+ ```
1618
+
1619
+ ***
1620
+
1621
+ ### method
1622
+
1623
+ ```ts
1624
+ method: HttpMethod;
1625
+ ```
1626
+
1627
+ ***
1225
1628
 
1226
- ### <a id="Source"></a>Source
1629
+ ### path
1630
+
1631
+ ```ts
1632
+ path: string | RegExp;
1633
+ ```
1634
+
1635
+ ### <a id="Source"></a>Source
1227
1636
 
1228
1637
  [**@xylabs/express**](#../README)
1229
1638
 
@@ -1233,14 +1642,28 @@ An object containing references to the source of the error
1233
1642
 
1234
1643
  ## Properties
1235
1644
 
1236
- | Property | Type | Description |
1237
- | ------ | ------ | ------ |
1238
- | <a id="parameter"></a> `parameter?` | `string` | A string indicating which URI query parameter caused the error. |
1239
- | <a id="pointer"></a> `pointer?` | `string` | A JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute]. |
1645
+ ### parameter?
1646
+
1647
+ ```ts
1648
+ optional parameter?: string;
1649
+ ```
1650
+
1651
+ A string indicating which URI query parameter caused the error.
1652
+
1653
+ ***
1654
+
1655
+ ### pointer?
1656
+
1657
+ ```ts
1658
+ optional pointer?: string;
1659
+ ```
1660
+
1661
+ A JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object,
1662
+ or "/data/attributes/title" for a specific attribute].
1240
1663
 
1241
- ### type-aliases
1664
+ ### type-aliases
1242
1665
 
1243
- ### <a id="ApiLink"></a>ApiLink
1666
+ ### <a id="ApiLink"></a>ApiLink
1244
1667
 
1245
1668
  [**@xylabs/express**](#../README)
1246
1669
 
@@ -1252,7 +1675,7 @@ type ApiLink = string | HrefWithMeta;
1252
1675
 
1253
1676
  A JSON:API link, either a simple URL string or an object with href and metadata.
1254
1677
 
1255
- ### <a id="ApiLinks"></a>ApiLinks
1678
+ ### <a id="ApiLinks"></a>ApiLinks
1256
1679
 
1257
1680
  [**@xylabs/express**](#../README)
1258
1681
 
@@ -1264,7 +1687,7 @@ type ApiLinks = Record<string, ApiLink>;
1264
1687
 
1265
1688
  A collection of named JSON:API links.
1266
1689
 
1267
- ### <a id="ApiResponse"></a>ApiResponse
1690
+ ### <a id="ApiResponse"></a>ApiResponse
1268
1691
 
1269
1692
  [**@xylabs/express**](#../README)
1270
1693
 
@@ -1280,11 +1703,11 @@ A JSON:API response, either a data response or an error response.
1280
1703
 
1281
1704
  ## Type Parameters
1282
1705
 
1283
- | Type Parameter |
1284
- | ------ |
1285
- | `T` *extends* [`ApiResourceIdentifierObject`](#../interfaces/ApiResourceIdentifierObject) |
1706
+ ### T
1286
1707
 
1287
- ### <a id="HttpMethod"></a>HttpMethod
1708
+ `T` *extends* [`ApiResourceIdentifierObject`](#../interfaces/ApiResourceIdentifierObject)
1709
+
1710
+ ### <a id="HttpMethod"></a>HttpMethod
1288
1711
 
1289
1712
  [**@xylabs/express**](#../README)
1290
1713
 
@@ -1296,7 +1719,7 @@ type HttpMethod = "get" | "post" | "put" | "patch" | "delete" | "options" | "hea
1296
1719
 
1297
1720
  Supported HTTP methods for route definitions.
1298
1721
 
1299
- ### <a id="LogFunction"></a>LogFunction
1722
+ ### <a id="LogFunction"></a>LogFunction
1300
1723
 
1301
1724
  [**@xylabs/express**](#../README)
1302
1725
 
@@ -1310,7 +1733,7 @@ type LogFunction = XyLabsLogFunction;
1310
1733
 
1311
1734
  use from @xylabs/logger instead
1312
1735
 
1313
- ### <a id="Logger"></a>Logger
1736
+ ### <a id="Logger"></a>Logger
1314
1737
 
1315
1738
  [**@xylabs/express**](#../README)
1316
1739
 
@@ -1324,7 +1747,7 @@ type Logger = XyLabsLogger;
1324
1747
 
1325
1748
  use from @xylabs/logger instead
1326
1749
 
1327
- ### <a id="LoggerMeta"></a>LoggerMeta
1750
+ ### <a id="LoggerMeta"></a>LoggerMeta
1328
1751
 
1329
1752
  [**@xylabs/express**](#../README)
1330
1753
 
@@ -1336,7 +1759,7 @@ type LoggerMeta = Record<string, string | number>;
1336
1759
 
1337
1760
  Metadata key-value pairs attached to log entries.
1338
1761
 
1339
- ### <a id="LoggerVerbosity"></a>LoggerVerbosity
1762
+ ### <a id="LoggerVerbosity"></a>LoggerVerbosity
1340
1763
 
1341
1764
  [**@xylabs/express**](#../README)
1342
1765
 
@@ -1348,7 +1771,7 @@ type LoggerVerbosity = "error" | "warn" | "info" | "debug" | "all";
1348
1771
 
1349
1772
  Application-level log verbosity levels.
1350
1773
 
1351
- ### <a id="NoLocals"></a>NoLocals
1774
+ ### <a id="NoLocals"></a>NoLocals
1352
1775
 
1353
1776
  [**@xylabs/express**](#../README)
1354
1777
 
@@ -1360,7 +1783,7 @@ type NoLocals = Record<string, any>;
1360
1783
 
1361
1784
  Default type for response locals.
1362
1785
 
1363
- ### <a id="NoReqBody"></a>NoReqBody
1786
+ ### <a id="NoReqBody"></a>NoReqBody
1364
1787
 
1365
1788
  [**@xylabs/express**](#../README)
1366
1789
 
@@ -1372,7 +1795,7 @@ type NoReqBody = Empty;
1372
1795
 
1373
1796
  Default type for request body when none is specified.
1374
1797
 
1375
- ### <a id="NoReqParams"></a>NoReqParams
1798
+ ### <a id="NoReqParams"></a>NoReqParams
1376
1799
 
1377
1800
  [**@xylabs/express**](#../README)
1378
1801
 
@@ -1384,7 +1807,7 @@ type NoReqParams = ParamsDictionary;
1384
1807
 
1385
1808
  Default type for request route parameters.
1386
1809
 
1387
- ### <a id="NoReqQuery"></a>NoReqQuery
1810
+ ### <a id="NoReqQuery"></a>NoReqQuery
1388
1811
 
1389
1812
  [**@xylabs/express**](#../README)
1390
1813
 
@@ -1396,7 +1819,7 @@ type NoReqQuery = Query;
1396
1819
 
1397
1820
  Default type for request query parameters.
1398
1821
 
1399
- ### <a id="NoResBody"></a>NoResBody
1822
+ ### <a id="NoResBody"></a>NoResBody
1400
1823
 
1401
1824
  [**@xylabs/express**](#../README)
1402
1825
 
@@ -1408,35 +1831,35 @@ type NoResBody = Empty;
1408
1831
 
1409
1832
  Default type for response body when none is specified.
1410
1833
 
1411
- ### <a id="ParseFunc"></a>ParseFunc
1834
+ ### <a id="ParseFunc"></a>ParseFunc
1412
1835
 
1413
1836
  [**@xylabs/express**](#../README)
1414
1837
 
1415
1838
  ***
1416
1839
 
1417
1840
  ```ts
1418
- type ParseFunc<T> = (value: string) => T;
1841
+ type ParseFunc<T> = (value) => T;
1419
1842
  ```
1420
1843
 
1421
1844
  A function that parses a string value into the target type.
1422
1845
 
1423
1846
  ## Type Parameters
1424
1847
 
1425
- | Type Parameter | Default type |
1426
- | ------ | ------ |
1427
- | `T` | `number` |
1848
+ ### T
1849
+
1850
+ `T` = `number`
1428
1851
 
1429
1852
  ## Parameters
1430
1853
 
1431
- | Parameter | Type |
1432
- | ------ | ------ |
1433
- | `value` | `string` |
1854
+ ### value
1855
+
1856
+ `string`
1434
1857
 
1435
1858
  ## Returns
1436
1859
 
1437
1860
  `T`
1438
1861
 
1439
- ### <a id="Relationship"></a>Relationship
1862
+ ### <a id="Relationship"></a>Relationship
1440
1863
 
1441
1864
  [**@xylabs/express**](#../README)
1442
1865
 
@@ -1453,7 +1876,7 @@ The value of the relationships key MUST be an object (a "relationships object").
1453
1876
  represent references from the resource object in which it’s defined to other resource objects.
1454
1877
  Relationships may be to-one or to-many.
1455
1878
 
1456
- ### <a id="RelationshipMeta"></a>RelationshipMeta
1879
+ ### <a id="RelationshipMeta"></a>RelationshipMeta
1457
1880
 
1458
1881
  [**@xylabs/express**](#../README)
1459
1882
 
@@ -1465,7 +1888,7 @@ type RelationshipMeta = Record<string, unknown>;
1465
1888
 
1466
1889
  Non-standard metadata associated with a JSON:API relationship.
1467
1890
 
1468
- ### <a id="ResourceLinkage"></a>ResourceLinkage
1891
+ ### <a id="ResourceLinkage"></a>ResourceLinkage
1469
1892
 
1470
1893
  [**@xylabs/express**](#../README)
1471
1894
 
@@ -1486,9 +1909,9 @@ Resource linkage MUST be represented as one of the following:
1486
1909
  • a single resource identifier object for non-empty to-one relationships.
1487
1910
  • an array of resource identifier objects for non-empty to-many relationships.
1488
1911
 
1489
- ### variables
1912
+ ### variables
1490
1913
 
1491
- ### <a id="DefaultJsonBodyParserOptions"></a>DefaultJsonBodyParserOptions
1914
+ ### <a id="DefaultJsonBodyParserOptions"></a>DefaultJsonBodyParserOptions
1492
1915
 
1493
1916
  [**@xylabs/express**](#../README)
1494
1917
 
@@ -1500,7 +1923,7 @@ const DefaultJsonBodyParserOptions: OptionsJson;
1500
1923
 
1501
1924
  The default options for the JSON Body Parser
1502
1925
 
1503
- ### <a id="DefaultJsonBodyParserOptionsLimit"></a>DefaultJsonBodyParserOptionsLimit
1926
+ ### <a id="DefaultJsonBodyParserOptionsLimit"></a>DefaultJsonBodyParserOptionsLimit
1504
1927
 
1505
1928
  [**@xylabs/express**](#../README)
1506
1929
 
@@ -1512,7 +1935,7 @@ const DefaultJsonBodyParserOptionsLimit: "100kb" = '100kb';
1512
1935
 
1513
1936
  The default maximum request body size for the JSON Body Parser
1514
1937
 
1515
- ### <a id="DefaultJsonBodyParserOptionsTypes"></a>DefaultJsonBodyParserOptionsTypes
1938
+ ### <a id="DefaultJsonBodyParserOptionsTypes"></a>DefaultJsonBodyParserOptionsTypes
1516
1939
 
1517
1940
  [**@xylabs/express**](#../README)
1518
1941
 
@@ -1524,7 +1947,7 @@ const DefaultJsonBodyParserOptionsTypes: string[];
1524
1947
 
1525
1948
  The default MIME types for the JSON Body Parser
1526
1949
 
1527
- ### <a id="EmptyParamsZod"></a>EmptyParamsZod
1950
+ ### <a id="EmptyParamsZod"></a>EmptyParamsZod
1528
1951
 
1529
1952
  [**@xylabs/express**](#../README)
1530
1953
 
@@ -1537,7 +1960,7 @@ const EmptyParamsZod: ZodObject<{
1537
1960
 
1538
1961
  Empty Zod schema for requests with no parameters.
1539
1962
 
1540
- ### <a id="EmptyQueryParamsZod"></a>EmptyQueryParamsZod
1963
+ ### <a id="EmptyQueryParamsZod"></a>EmptyQueryParamsZod
1541
1964
 
1542
1965
  [**@xylabs/express**](#../README)
1543
1966
 
@@ -1550,35 +1973,47 @@ const EmptyQueryParamsZod: ZodObject<{
1550
1973
 
1551
1974
  Empty Zod schema for requests with no query parameters.
1552
1975
 
1553
- ### <a id="ValidateRequestDefaults"></a>ValidateRequestDefaults
1976
+ ### <a id="ValidateRequestDefaults"></a>ValidateRequestDefaults
1554
1977
 
1555
1978
  [**@xylabs/express**](#../README)
1556
1979
 
1557
1980
  ***
1558
1981
 
1559
1982
  ```ts
1560
- const ValidateRequestDefaults: {
1561
- params: ZodObject<{
1562
- }, $catchall<ZodString>>;
1563
- query: ZodObject<{
1564
- }, $catchall<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>>;
1565
- body: ZodOptional<ZodJSONSchema>;
1566
- response: ZodOptional<ZodJSONSchema>;
1567
- };
1983
+ const ValidateRequestDefaults: object;
1568
1984
  ```
1569
1985
 
1570
1986
  Default validation schemas for request handler validator.
1571
1987
 
1572
1988
  ## Type Declaration
1573
1989
 
1574
- | Name | Type | Default value |
1575
- | ------ | ------ | ------ |
1576
- | <a id="property-params"></a> `params` | `ZodObject`\<\{ \}, `$catchall`\<`ZodString`\>\> | `EmptyParamsZod` |
1577
- | <a id="property-query"></a> `query` | `ZodObject`\<\{ \}, `$catchall`\<`ZodUnion`\<readonly \[`ZodString`, `ZodArray`\<`ZodString`\>\]\>\>\> | `EmptyQueryParamsZod` |
1578
- | <a id="property-body"></a> `body` | `ZodOptional`\<`ZodJSONSchema`\> | - |
1579
- | <a id="property-response"></a> `response` | `ZodOptional`\<`ZodJSONSchema`\> | - |
1990
+ ### params
1991
+
1992
+ ```ts
1993
+ params: ZodObject<{
1994
+ }, $catchall<ZodString>> = EmptyParamsZod;
1995
+ ```
1996
+
1997
+ ### query
1998
+
1999
+ ```ts
2000
+ query: ZodObject<{
2001
+ }, $catchall<ZodUnion<readonly [ZodString, ZodArray<ZodString>]>>> = EmptyQueryParamsZod;
2002
+ ```
2003
+
2004
+ ### body
2005
+
2006
+ ```ts
2007
+ body: ZodOptional<ZodJSONSchema>;
2008
+ ```
2009
+
2010
+ ### response
1580
2011
 
1581
- ### <a id="jsonBodyParser"></a>jsonBodyParser
2012
+ ```ts
2013
+ response: ZodOptional<ZodJSONSchema>;
2014
+ ```
2015
+
2016
+ ### <a id="jsonBodyParser"></a>jsonBodyParser
1582
2017
 
1583
2018
  [**@xylabs/express**](#../README)
1584
2019
 
@@ -1590,7 +2025,7 @@ const jsonBodyParser: NextHandleFunction;
1590
2025
 
1591
2026
  A JSON Body Parser middleware handler initialized with the default options
1592
2027
 
1593
- ### <a id="notImplemented"></a>notImplemented
2028
+ ### <a id="notImplemented"></a>notImplemented
1594
2029
 
1595
2030
  [**@xylabs/express**](#../README)
1596
2031
 
@@ -1602,7 +2037,7 @@ const notImplemented: RequestHandler;
1602
2037
 
1603
2038
  Express request handler that responds with a 501 Not Implemented error.
1604
2039
 
1605
- ### <a id="standardResponses"></a>standardResponses
2040
+ ### <a id="standardResponses"></a>standardResponses
1606
2041
 
1607
2042
  [**@xylabs/express**](#../README)
1608
2043
 
@@ -1616,41 +2051,7 @@ Connect middleware to enable the transform of all responses to match
1616
2051
  the standard response format (compatible with JSON API)
1617
2052
 
1618
2053
 
1619
- Part of [sdk-js](https://www.npmjs.com/package/@xyo-network/sdk-js)
1620
-
1621
- ## Maintainers
1622
-
1623
- - [Arie Trouw](https://github.com/arietrouw) ([arietrouw.com](https://arietrouw.com))
1624
- - [Matt Jones](https://github.com/jonesmac)
1625
- - [Joel Carter](https://github.com/JoelBCarter)
1626
- - [Jordan Trouw](https://github.com/jordantrouw)
1627
-
1628
- ## License
1629
-
1630
- > See the [LICENSE](LICENSE) file for license details
1631
-
1632
- ## Credits
1633
-
1634
- [Made with 🔥 and ❄️ by XYLabs](https://xylabs.com)
1635
-
1636
- [logo]: https://cdn.xy.company/img/brand/XYPersistentCompany_Logo_Icon_Colored.svg
1637
-
1638
- [main-build]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml/badge.svg
1639
- [main-build-link]: https://github.com/xylabs/sdk-js/actions/workflows/build.yml
1640
2054
  [npm-badge]: https://img.shields.io/npm/v/@xylabs/express.svg
1641
2055
  [npm-link]: https://www.npmjs.com/package/@xylabs/express
1642
- [codacy-badge]: https://app.codacy.com/project/badge/Grade/c8e15e14f37741c18cfb47ac7245c698
1643
- [codacy-link]: https://www.codacy.com/gh/xylabs/sdk-js/dashboard?utm_source=github.com&utm_medium=referral&utm_content=xylabs/sdk-js&utm_campaign=Badge_Grade
1644
- [codeclimate-badge]: https://api.codeclimate.com/v1/badges/c5eb068f806f0b047ea7/maintainability
1645
- [codeclimate-link]: https://codeclimate.com/github/xylabs/sdk-js/maintainability
1646
- [snyk-badge]: https://snyk.io/test/github/xylabs/sdk-js/badge.svg?targetFile=package.json
1647
- [snyk-link]: https://snyk.io/test/github/xylabs/sdk-js?targetFile=package.json
1648
-
1649
- [npm-downloads-badge]: https://img.shields.io/npm/dw/@xylabs/express
1650
- [npm-license-badge]: https://img.shields.io/npm/l/@xylabs/express
1651
-
1652
- [jsdelivr-badge]: https://data.jsdelivr.com/v1/package/npm/@xylabs/express/badge
1653
- [jsdelivr-link]: https://www.jsdelivr.com/package/npm/@xylabs/express
1654
-
1655
- [socket-badge]: https://socket.dev/api/badge/npm/package/@xylabs/express
1656
- [socket-link]: https://socket.dev/npm/package/@xylabs/express
2056
+ [license-badge]: https://img.shields.io/npm/l/@xylabs/express.svg
2057
+ [license-link]: https://github.com/xylabs/sdk-js/blob/main/LICENSE