@xylabs/express 5.0.83 → 5.0.86

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