logixia 1.12.6 → 1.13.0
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 +10 -4
- package/dist/.tsbuildinfo +1 -1
- package/dist/correlation.d.mts +7 -0
- package/dist/correlation.d.mts.map +1 -1
- package/dist/correlation.d.ts +7 -0
- package/dist/correlation.d.ts.map +1 -1
- package/dist/correlation.js +4 -4
- package/dist/correlation.js.map +1 -1
- package/dist/correlation.mjs +4 -4
- package/dist/correlation.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/{logitron-logger.module-zDKVd_o0.d.mts → logitron-logger.module-BdG1Jnpk.d.mts} +3 -3
- package/dist/{logitron-logger.module-zDKVd_o0.d.mts.map → logitron-logger.module-BdG1Jnpk.d.mts.map} +1 -1
- package/dist/{logitron-logger.module-CxT1F6Cm.d.ts → logitron-logger.module-CbXy2gfW.d.ts} +3 -3
- package/dist/{logitron-logger.module-CxT1F6Cm.d.ts.map → logitron-logger.module-CbXy2gfW.d.ts.map} +1 -1
- package/dist/nest.d.mts +1 -1
- package/dist/nest.d.ts +1 -1
- package/dist/transports.d.mts.map +1 -1
- package/dist/transports.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1316,22 +1316,28 @@ logixia ships this as a dedicated `logixia/correlation` sub-package. It uses the
|
|
|
1316
1316
|
```typescript
|
|
1317
1317
|
import { correlationMiddleware } from 'logixia/correlation';
|
|
1318
1318
|
|
|
1319
|
-
// Zero-config — reads X-Correlation-ID
|
|
1320
|
-
// Generates a UUID v4 if
|
|
1319
|
+
// Zero-config — reads X-Correlation-ID from the incoming request.
|
|
1320
|
+
// Generates a UUID v4 if the header is missing or invalid.
|
|
1321
1321
|
// Sets X-Correlation-ID on the response.
|
|
1322
1322
|
app.use(correlationMiddleware());
|
|
1323
1323
|
|
|
1324
1324
|
// Custom config:
|
|
1325
1325
|
app.use(
|
|
1326
1326
|
correlationMiddleware({
|
|
1327
|
-
header: 'X-Correlation-ID', // header to read / write. Default: '
|
|
1328
|
-
|
|
1327
|
+
header: 'X-Correlation-ID', // header to read / write (matched case-insensitively). Default: 'x-correlation-id'
|
|
1328
|
+
generate: () => crypto.randomUUID(), // used when no usable incoming ID. Default: crypto.randomUUID()
|
|
1329
1329
|
trustIncoming: true, // honour the header from the client. Default: true
|
|
1330
1330
|
setResponseHeader: true, // echo the ID back in the response. Default: true
|
|
1331
1331
|
})
|
|
1332
1332
|
);
|
|
1333
1333
|
```
|
|
1334
1334
|
|
|
1335
|
+
An incoming ID is only used if it is at most 128 characters long and contains only
|
|
1336
|
+
`A-Z`, `a-z`, `0-9`, `.`, `_`, `:` and `-`. Anything else (newlines, spaces, or base64-style
|
|
1337
|
+
`+`, `/`, `=`) is replaced with a freshly generated ID, so client-supplied text can't end up in
|
|
1338
|
+
every log line. Set `trustIncoming: false` to ignore the incoming header entirely and always
|
|
1339
|
+
generate a new ID. `correlationFastifyHook()` takes the same options.
|
|
1340
|
+
|
|
1335
1341
|
### Correlation Fastify hook
|
|
1336
1342
|
|
|
1337
1343
|
```typescript
|