@bymax-one/nest-logger 1.4.25 → 1.4.27
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/CHANGELOG.md +83 -1
- package/README.md +5 -4
- package/dist/server/index.cjs +248 -84
- package/dist/server/index.mjs +248 -84
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,86 @@ heading here.
|
|
|
12
12
|
|
|
13
13
|
## [Unreleased]
|
|
14
14
|
|
|
15
|
+
## [1.4.27] - 2026-11-21
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- An option the host supplies that throws when it is read (a getter, a Proxy trap) now ends `forRoot` and
|
|
20
|
+
`forRootAsync` with `[BymaxLoggerModule] options could not be read`, and the error the host threw is its
|
|
21
|
+
`cause`. Before, the host's own error left the module. The refusals of the options themselves (`[BymaxLoggerModule] options.<path> ...`) are
|
|
22
|
+
unchanged. Each redaction option (`redactPaths`, `redactCensor`, `redactStrategy`,
|
|
23
|
+
`shouldDisableDefaultRedact`) is read by name, so it takes effect whether it is a property, a
|
|
24
|
+
non-enumerable getter, a get-only Proxy or a class getter.
|
|
25
|
+
- The message of an object that is no `Error`, below the top level of a log record, is hidden in the
|
|
26
|
+
header of its `stack` as it is in its `message` field, whatever the case or the look of the two keys (`Message`, `STACK`).
|
|
27
|
+
- A `name` that holds an object, an array or a function is hidden with the message (it may carry
|
|
28
|
+
anything), in the stack header and under `error.type`; a number name is kept.
|
|
29
|
+
- The derived keys (`exception.type`, `exception.message`, `exception.stacktrace`, `error.type`, ...) are
|
|
30
|
+
owned as they look in a viewer: a spelling that differs only in case, in white space or zero-width
|
|
31
|
+
characters, or in fullwidth forms is owned too. `errorType`, `exception_type`, `exceptionType` and
|
|
32
|
+
`event.name` are other keys and are kept.
|
|
33
|
+
|
|
34
|
+
### Known limits
|
|
35
|
+
|
|
36
|
+
- An object whose `toJSON` returns a `message` that is not text and a `stack` that carries a secret which
|
|
37
|
+
is not the message text has no text to match: the stack header is written as the object gave it. Put
|
|
38
|
+
such a secret under a name in `redactPaths`, or keep it out of the `stack`.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- The benchmark of the object message states its margin: the floor is 0.20 and the measurement ranges
|
|
43
|
+
from 0.38 to 0.47 with the load of the host.
|
|
44
|
+
- `pnpm check:property-path` also refuses a variable, a concatenation or a template with a
|
|
45
|
+
substitution as the argument of `toHaveProperty`, and a call with a space before the paren; a key is
|
|
46
|
+
written as an array, `toHaveProperty([key])`.
|
|
47
|
+
|
|
48
|
+
## [1.4.26] - 2026-11-21
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
|
|
52
|
+
- **An `Error` whose `name` is not text is read as an error.** A number, an array or an object in
|
|
53
|
+
`name` made the error pass for an unknown value: the line's `msg` was `String(error)`, with the
|
|
54
|
+
message in it, and `err` was not written, so a `message` named in `redactPaths` hid nothing. The
|
|
55
|
+
error is read as one, its name is `Error`, and its message is hidden like any other.
|
|
56
|
+
- **The name of an `Error` under a key of your own is censored like the name of `err`.** With
|
|
57
|
+
`redactStrategy: 'names'`, `{ error: new Error(x) }` wrote `error.name` and `error.type` as they
|
|
58
|
+
were while the message and the stack were hidden. A name that is text now passes the censor of the
|
|
59
|
+
message there too, and a name that reads as a name stays.
|
|
60
|
+
- **The message in the `stack` of an object message is hidden.** `logger.warn({ message, stack })`,
|
|
61
|
+
where the object is no error to the library, wrote its `stack` as given, so a `message` named in
|
|
62
|
+
`redactPaths` stayed in the stack. The header of the stack, everything before the first frame, is
|
|
63
|
+
now censored as the first line of `err.stack` is, every time the message appears in it and across
|
|
64
|
+
the lines of a message that has several; the frames below it are the stack's own text and are not
|
|
65
|
+
read for values.
|
|
66
|
+
- **More spellings of a key the logger writes are dropped.** Combining marks (an accent on the `e` of `traceId`), control
|
|
67
|
+
characters (NUL), the dotless `ı`, the small-capital letters (`ᴛʀᴀᴄᴇ_ɪᴅ`) and the Greek epsilon are
|
|
68
|
+
read through. The keys the logger derives from an error on an entry, `exception.type`,
|
|
69
|
+
`exception.message`, `exception.stacktrace` and `error.type`, are owned, by their own spelling: a
|
|
70
|
+
field of yours called `exceptionType` is still yours, and so is `event.name` on a call that has no
|
|
71
|
+
log key.
|
|
72
|
+
- **A lone surrogate in a log message or a stack is escaped** (`\ud800`), as the control characters
|
|
73
|
+
are, so it cannot reach a terminal as a replacement character that hides what came after it.
|
|
74
|
+
- **The stack of an error is read once** for `exception.stacktrace`, where a getter of the caller's
|
|
75
|
+
was read twice.
|
|
76
|
+
|
|
77
|
+
- **The message in the `toJSON` result of an `err` is hidden in its stack header under `redactStrategy: 'names'`.**
|
|
78
|
+
When the value under `err` returned an error-shaped object from its `toJSON` (a `name`, a `message`
|
|
79
|
+
and a `stack` that opens with it), the walk followed the `toJSON` and replaced the `message` before
|
|
80
|
+
the serializer of `err` ran, so the first line of `err.stack` and of `exception.stacktrace` kept the
|
|
81
|
+
text that `message` hid. The `message` of any object under `err`, when it is text, is now left to the
|
|
82
|
+
serializer, as that of an error-shaped object is; a list under `err` and a `message` that is not text
|
|
83
|
+
keep the names. The frames of a stack are
|
|
84
|
+
the stack's own text and are not read for values.
|
|
85
|
+
|
|
86
|
+
### Added
|
|
87
|
+
|
|
88
|
+
- The benchmark gates the cost of an object message: it must keep 0.20 of the throughput of a string
|
|
89
|
+
line on the shipped configuration (measured 0.46 to 0.47 on a quiet host and 0.38 to 0.42 on a loaded one, on 1.4.24 and 1.4.25). A change that makes
|
|
90
|
+
the object form cost more than 5 times a line fails the job.
|
|
91
|
+
- A check (`pnpm check:property-path`, part of `pnpm lint`) fails on a `toHaveProperty` call that takes a
|
|
92
|
+
string with a dot: Jest reads it as a nested path, so a negative assertion on a key such as
|
|
93
|
+
`exception.stacktrace` could never fail. The key form is `toHaveProperty(['exception.stacktrace'])`.
|
|
94
|
+
|
|
15
95
|
## [1.4.25] - 2026-11-20
|
|
16
96
|
|
|
17
97
|
### Fixed
|
|
@@ -3312,7 +3392,9 @@ published `dist/` is identical — no runtime behaviour changes for consumers.
|
|
|
3312
3392
|
- Professional CI suite: `ci.yml`, `bench.yml`, `codeql.yml`, `scorecard.yml`,
|
|
3313
3393
|
`release.yml`, Dependabot, and issue templates
|
|
3314
3394
|
|
|
3315
|
-
[Unreleased]: https://github.com/bymaxone/nest-logger/compare/v1.4.
|
|
3395
|
+
[Unreleased]: https://github.com/bymaxone/nest-logger/compare/v1.4.27...HEAD
|
|
3396
|
+
[1.4.27]: https://github.com/bymaxone/nest-logger/compare/v1.4.26...v1.4.27
|
|
3397
|
+
[1.4.26]: https://github.com/bymaxone/nest-logger/compare/v1.4.25...v1.4.26
|
|
3316
3398
|
[1.4.25]: https://github.com/bymaxone/nest-logger/compare/v1.4.24...v1.4.25
|
|
3317
3399
|
[1.4.24]: https://github.com/bymaxone/nest-logger/compare/v1.4.23...v1.4.24
|
|
3318
3400
|
[1.4.23]: https://github.com/bymaxone/nest-logger/compare/v1.4.22...v1.4.23
|
package/README.md
CHANGED
|
@@ -578,7 +578,7 @@ An error's own enumerable properties (`code`, `statusCode`, domain fields) trave
|
|
|
578
578
|
- `'all'` (the default in 1.x) writes every own field as above.
|
|
579
579
|
- `'safe'` (recommended) writes only `code`, `errno`, `syscall`, `signal`, `status`, `statusCode`, `address`, `port`, `hostname` and the PostgreSQL `constraint`, `table`, `column`, `schema` and `routine`, plus the names in `errorOwnFieldNames` (matched exactly), at every depth. `path` is not on the list; add it if a path is not data to you. Under `'safe'` an `Error` is written from its own fields and its `toJSON` is not called (an HTTP client's `toJSON` may carry the request); any other `toJSON` is called once, as `JSON.stringify` would, and its result is censored. A serializer then receives a plain error-like object instead of an `Error` instance.
|
|
580
580
|
|
|
581
|
-
The `name` of an error is written as `type` (and as `exception.type` and `error.type`) and opens its stack. A name that is identifier-shaped and at most 64 characters (`TypeError`, `pg.DatabaseError`, `E_TIMEOUT`) is kept; any other passes the censor of the `message` of an entry, so a name that is text is hidden when `message` is. A value written as a short identifier in a name is not found by its shape: put it in a field whose name `redactPaths` covers. A name longer than 16,384 characters is cut to that length, and the first line of `err.stack` keeps those 16,384 characters as written, so such a name is not hidden there.
|
|
581
|
+
The `name` of an error is written as `type` (and as `exception.type` and `error.type`) and opens its stack. A name that is identifier-shaped and at most 64 characters (`TypeError`, `pg.DatabaseError`, `E_TIMEOUT`) is kept; any other passes the censor of the `message` of an entry, so a name that is text is hidden when `message` is, in `name` and in `type` of an `Error` held under a key of your own as well. An `Error` whose `name` is not text is read as an `Error` named `Error`. A value written as a short identifier in a name is not found by its shape: put it in a field whose name `redactPaths` covers. A name longer than 16,384 characters is cut to that length, and the first line of `err.stack` keeps those 16,384 characters as written, so such a name is not hidden there.
|
|
582
582
|
|
|
583
583
|
```typescript
|
|
584
584
|
BymaxLoggerModule.forRoot({
|
|
@@ -1053,7 +1053,7 @@ Implements NestJS `LoggerService`. All methods are available via `@InjectLogger(
|
|
|
1053
1053
|
| `warnStructured` | `(logKey, msg, userId?, meta?)` | Structured warn log — takes a **message string** |
|
|
1054
1054
|
| `errorStructured` | `(logKey, error, userId?, meta?)` | Structured error log — takes an **`Error`**, serialized to `err` |
|
|
1055
1055
|
|
|
1056
|
-
`meta` carries arbitrary fields, except that `logKey`, `userId` and `context` belong to the payload (read from the authenticated ALS scope, so a metadata bag cannot forge them), `level`, `time`, `msg`, `service`, `service.*`, `deployment` and `deployment.*` are written by the logger itself and are dropped from `meta`, and `__proto__`, `constructor` and `prototype` are dropped, since they name a prototype chain rather than a field. A key the logger writes from the request context or from the active span (`requestId`, `tenantId`, the trace fields) keeps the logger's value when the payload carries the same key, for `meta`, an object message and the raw Pino logger alike, except `userId`, which a call names as an argument and which wins over the one of the request context; a key the logger does not write, such as a `requestId` outside a request, keeps the payload's own value. A key that only spells one of these keys, or an owned key, is dropped like the key itself (`Level`, `log_key`, `trace_id` for `traceId`, `request.id` for `requestId`): names are compared with the case, the separators `_`, `.` and `-`, white space and the characters that print as nothing folded, the compatibility forms Unicode defines read as the letter they stand for, and a short list of Cyrillic and Greek letters drawn like a Latin one read as it (`trace id`, `trace\u200bId`, `RequestId`, `rеquestId`), and `service_name`, `service-version` and the other spellings of the dotted resource keys are the keys themselves (a key such as `service_tier`, which spells none of them, is yours), so a backend that normalises names cannot read the payload's copy as the logger's field. A lookalike letter that is not on the list is kept: the list is not every lookalike Unicode has. The raw Pino logger from `getRawLogger()` bypasses the owned-key guards of `meta` and of an object message, so a payload can still repeat `level`, `service` or `userId` there; the request and trace keys still win, and redaction still applies.
|
|
1056
|
+
`meta` carries arbitrary fields, except that `logKey`, `userId` and `context` belong to the payload (read from the authenticated ALS scope, so a metadata bag cannot forge them), `level`, `time`, `msg`, `service`, `service.*`, `deployment` and `deployment.*` are written by the logger itself and are dropped from `meta`, as are `exception.type`, `exception.message`, `exception.stacktrace` and `error.type`, which the logger derives from an error and which are matched by their own spelling, whatever the case, and not folded further (`exceptionType` is a field of yours, and so is `event.name` on a call that has no log key), and `__proto__`, `constructor` and `prototype` are dropped, since they name a prototype chain rather than a field. A key the logger writes from the request context or from the active span (`requestId`, `tenantId`, the trace fields) keeps the logger's value when the payload carries the same key, for `meta`, an object message and the raw Pino logger alike, except `userId`, which a call names as an argument and which wins over the one of the request context; a key the logger does not write, such as a `requestId` outside a request, keeps the payload's own value. A key that only spells one of these keys, or an owned key, is dropped like the key itself (`Level`, `log_key`, `trace_id` for `traceId`, `request.id` for `requestId`): names are compared with the case, the separators `_`, `.` and `-`, white space, control characters, combining marks and the characters that print as nothing folded, the compatibility forms Unicode defines read as the letter they stand for, and a short list of Cyrillic and Greek letters, the dotless `ı` and the small capitals drawn like a Latin one read as it (`trace id`, `trace\u200bId`, `RequestId`, `rеquestId`), and `service_name`, `service-version` and the other spellings of the dotted resource keys are the keys themselves (a key such as `service_tier`, which spells none of them, is yours), so a backend that normalises names cannot read the payload's copy as the logger's field. A lookalike letter that is not on the list is kept: the list is not every lookalike Unicode has. The raw Pino logger from `getRawLogger()` bypasses the owned-key guards of `meta` and of an object message, so a payload can still repeat `level`, `service` or `userId` there; the request and trace keys still win, and redaction still applies.
|
|
1057
1057
|
|
|
1058
1058
|
**NestJS `LoggerService` bridge** — the variadic contract NestJS calls, so `app.useLogger()` works. These take a message, not a log key.
|
|
1059
1059
|
|
|
@@ -1066,7 +1066,7 @@ Implements NestJS `LoggerService`. All methods are available via `@InjectLogger(
|
|
|
1066
1066
|
| `fatal` | `(message, ...optionalParams)` | → Pino `fatal` |
|
|
1067
1067
|
| `error` | `(message \| Error, stack?, context?)` | An `Error` routes to the serialized `err` path |
|
|
1068
1068
|
|
|
1069
|
-
**An object as the message.** A plain object (an object literal or a parsed JSON object) passed as the message of `log`, `warn`, `error`, `debug`, `verbose` or `fatal` is written as the fields of the entry, through the same redaction and `maxStringLength` pipeline as any other field, so `this.logger.warn({ event: 'QUEUE_DRAINED', jobs: 7, password })` gives an entry with `event`, `jobs` and a censored `password`. The entry text (`msg`) is its `message` string, else its `event` string, else empty; a `message` that is the text is not repeated as a field. `logKey`, `userId`, `context`, `level`, `time`, `msg`, `service`, `service.*`, `deployment` and `deployment.*` in the object are dropped, as they are from `meta`. The text is censored under the names of the field it came from (`event` or `message`), also with `redactStrategy: 'paths'`, and cut at `maxStringLength` like that field, within the 16 KiB cap that bounds every log message. A serializer keyed `event` or `message` shapes the field and not `msg`; redaction by name is what covers the text. An `Error`, and an object shaped like one (a string `name` and a string `message`), keep their own error-only path (the text of the entry is the `message`, censored under the name `message` as `err.message` is, and the same text is censored where it opens `err.stack`, the stack of each cause and `exception.stacktrace`, and in `exception.message`; like every log message it is capped at 16 KiB and not cut at `maxStringLength`), and a value that is not plain (a class instance, an array) is still written as its string form. Redaction works on field names and never reads the content of a string, so a text a caller passes as a string, such as ``logger.warn(`card ${number}`)``, is written as it is.
|
|
1069
|
+
**An object as the message.** A plain object (an object literal or a parsed JSON object) passed as the message of `log`, `warn`, `error`, `debug`, `verbose` or `fatal` is written as the fields of the entry, through the same redaction and `maxStringLength` pipeline as any other field, so `this.logger.warn({ event: 'QUEUE_DRAINED', jobs: 7, password })` gives an entry with `event`, `jobs` and a censored `password`. The entry text (`msg`) is its `message` string, else its `event` string, else empty; a `message` that is the text is not repeated as a field. `logKey`, `userId`, `context`, `level`, `time`, `msg`, `service`, `service.*`, `deployment` and `deployment.*` in the object are dropped, as they are from `meta`. The text is censored under the names of the field it came from (`event` or `message`), also with `redactStrategy: 'paths'`, and cut at `maxStringLength` like that field, within the 16 KiB cap that bounds every log message. A serializer keyed `event` or `message` shapes the field and not `msg`; redaction by name is what covers the text. An `Error`, and an object shaped like one (a string `name` and a string `message`), keep their own error-only path (the text of the entry is the `message`, censored under the name `message` as `err.message` is, and the same text is censored where it opens `err.stack`, the stack of each cause and `exception.stacktrace`, and in `exception.message`; like every log message it is capped at 16 KiB and not cut at `maxStringLength`), and a value that is not plain (a class instance, an array) is still written as its string form. An object that is no error to the library but carries a `message` and a `stack` that are text has the message hidden in the header of that `stack`, everything before its first frame, wherever the options hide `message`; the frames are the stack's own text, and this holds for such an object below the top level of the record as well. A `name` that is an object, an array or a function is hidden with the message, as it may carry anything, and a number `name` is kept. The keys the library owns (`exception.type`, `exception.message`, `exception.stacktrace`, `error.type`) are matched as they look in a viewer: the same key in another case, with white space or zero-width characters inside it, or in fullwidth letters is dropped too, while `errorType`, `exception_type`, `exceptionType` and `event.name` are other keys and are kept. An object whose `toJSON` returns a `message` that is not text and a `stack` carrying a secret that is not the message text leaves nothing to match, so name such a secret in `redactPaths`. Redaction works on field names and never reads the content of a string, so a text a caller passes as a string, such as ``logger.warn(`card ${number}`)``, is written as it is.
|
|
1070
1070
|
|
|
1071
1071
|
**Helpers**
|
|
1072
1072
|
|
|
@@ -1240,6 +1240,7 @@ Two kinds of failure, and they surface differently. A **thrown `Error`** carries
|
|
|
1240
1240
|
| Message starts with | Thrown from | When | Action |
|
|
1241
1241
|
| -------------------------------------------------------- | ------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------- |
|
|
1242
1242
|
| `[BymaxLoggerModule] options.` | `forRoot` / `forRootAsync`, at module setup | any option fails validation: a missing `service`, a `level` outside the set, a bad type | Fix the option the message names; it prints the path and what it received |
|
|
1243
|
+
| `[BymaxLoggerModule] options could not be read` | `forRoot` / `forRootAsync`, at module setup | an option the host supplies threw when it was read (a getter or a Proxy trap) | Fix the option; the error the host threw is the `cause` |
|
|
1243
1244
|
| `[BymaxLoggerModule] useNestLogger(app) called but` | `BymaxLoggerModule.useNestLogger` | the module was never imported into the application | Import `BymaxLoggerModule` before calling it |
|
|
1244
1245
|
| `[BymaxLoggerModule] applyAccessLog(app) called but` | `applyAccessLog` | the module was never imported into the application | Import `BymaxLoggerModule` before calling it |
|
|
1245
1246
|
| `[BymaxLoggerModule] useRequestContext(app) called but` | `useRequestContext` | the module was never imported into the application | Import `BymaxLoggerModule` before calling it |
|
|
@@ -1288,7 +1289,7 @@ Measured by this repository's own benchmark (`pnpm bench`, see [bench/README.md]
|
|
|
1288
1289
|
- The legacy `redactStrategy: 'paths'` is about seventy times slower in the same bench run, and its cost grows with the number of default paths.
|
|
1289
1290
|
- One call through the shipped configuration, for an entry of four fields (the median of five runs of 200,000 calls, three runs on one machine under Node 24 that was not idle): a string line about 1.2 µs, a structured call with `meta` about 3.9 µs, and an object message between 3.3 and 3.8 µs. That is about 2.8 to 3.1 times the string line, and the same work as `meta`: an object message is a structured call, so the cost is the fields and not the form. The ratio depends on how cheap the string line is on the machine, so compare your own runs of both. Comparing the names of a payload with the keys the logger owns and writes adds a small cost to each structured call and each object message.
|
|
1290
1291
|
|
|
1291
|
-
Absolute figures depend on the machine; the benchmark gates the
|
|
1292
|
+
Absolute figures depend on the machine; the benchmark gates the ratios so a regression fails CI: the shipped path must keep 0.20 of the bare wrapper, and an object message must keep 0.20 of the throughput of a string line.
|
|
1292
1293
|
|
|
1293
1294
|
---
|
|
1294
1295
|
|
package/dist/server/index.cjs
CHANGED
|
@@ -186,6 +186,23 @@ function applyDefaults(given) {
|
|
|
186
186
|
return Object.freeze(merged);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
// src/server/config/options-refusal.util.ts
|
|
190
|
+
var refusals = /* @__PURE__ */ new WeakSet();
|
|
191
|
+
var UNREADABLE = "[BymaxLoggerModule] options could not be read";
|
|
192
|
+
function refuse(message) {
|
|
193
|
+
const error = new Error(message);
|
|
194
|
+
refusals.add(error);
|
|
195
|
+
throw error;
|
|
196
|
+
}
|
|
197
|
+
function guardOptions(read) {
|
|
198
|
+
try {
|
|
199
|
+
return read();
|
|
200
|
+
} catch (error) {
|
|
201
|
+
if (typeof error === "object" && error !== null && refusals.delete(error)) throw error;
|
|
202
|
+
throw new Error(UNREADABLE, { cause: error });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
189
206
|
// src/server/constants/log-levels.constants.ts
|
|
190
207
|
var PINO_LEVEL_NUMBERS = Object.freeze({
|
|
191
208
|
fatal: 60,
|
|
@@ -214,7 +231,7 @@ var LOG_LEVEL_PRIORITY = Object.freeze([
|
|
|
214
231
|
// src/server/config/validate-options.ts
|
|
215
232
|
function reject(path, rule, got, wasGiven = got !== void 0) {
|
|
216
233
|
const received = wasGiven ? `. Received ${describeValue(got)}` : "";
|
|
217
|
-
|
|
234
|
+
refuse(`[BymaxLoggerModule] options.${path} ${rule}${received}`);
|
|
218
235
|
}
|
|
219
236
|
function describeValue(value) {
|
|
220
237
|
switch (typeof value) {
|
|
@@ -312,7 +329,7 @@ function validateLifecycle(options) {
|
|
|
312
329
|
function validateCore(options) {
|
|
313
330
|
const service = options.service;
|
|
314
331
|
if (service === void 0) {
|
|
315
|
-
|
|
332
|
+
refuse("[BymaxLoggerModule] options.service is required");
|
|
316
333
|
}
|
|
317
334
|
if (!isRecord2(service)) reject("service", "must be an object", service);
|
|
318
335
|
for (const field of ["name", "version"]) {
|
|
@@ -394,12 +411,12 @@ function validateErrorFields(options) {
|
|
|
394
411
|
}
|
|
395
412
|
});
|
|
396
413
|
}
|
|
397
|
-
var
|
|
414
|
+
var UNREADABLE2 = /* @__PURE__ */ Symbol("unreadable");
|
|
398
415
|
function readMember(destination, key) {
|
|
399
416
|
try {
|
|
400
417
|
return Reflect.get(destination, key);
|
|
401
418
|
} catch {
|
|
402
|
-
return
|
|
419
|
+
return UNREADABLE2;
|
|
403
420
|
}
|
|
404
421
|
}
|
|
405
422
|
function validateDestination(entry, index) {
|
|
@@ -408,16 +425,16 @@ function validateDestination(entry, index) {
|
|
|
408
425
|
reject(path, "must be an object implementing ILogDestination", entry, true);
|
|
409
426
|
}
|
|
410
427
|
const write = readMember(entry, "write");
|
|
411
|
-
if (write !==
|
|
428
|
+
if (write !== UNREADABLE2 && typeof write !== "function") {
|
|
412
429
|
reject(path, "must have a write(payload) method");
|
|
413
430
|
}
|
|
414
431
|
const name = readMember(entry, "name");
|
|
415
|
-
if (name !==
|
|
432
|
+
if (name !== UNREADABLE2 && !isNonEmptyString(name)) {
|
|
416
433
|
reject(path, "must have a non-empty string name", name);
|
|
417
434
|
}
|
|
418
435
|
for (const hook of ["onInit", "onShutdown", "onRegistryReady"]) {
|
|
419
436
|
const value = readMember(entry, hook);
|
|
420
|
-
if (value !==
|
|
437
|
+
if (value !== UNREADABLE2 && value !== void 0 && typeof value !== "function") {
|
|
421
438
|
reject(`${path}.${hook}`, "must be a function", value);
|
|
422
439
|
}
|
|
423
440
|
}
|
|
@@ -584,8 +601,8 @@ function createEntryTextFinisher(redact, limit, onCut) {
|
|
|
584
601
|
|
|
585
602
|
// src/server/utils/escape-log-text.util.ts
|
|
586
603
|
var LINE_TERMINATORS = /* @__PURE__ */ new Set(["\r", "\n", "\x85", "\u2028", "\u2029"]);
|
|
587
|
-
var UNSAFE_IN_SINGLE_LINE = /[\u0000-\u0008\u000A-\u001F\u007F-\u009F\u2028\u2029]/
|
|
588
|
-
var UNSAFE_IN_MULTILINE = /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u2028\u2029]/
|
|
604
|
+
var UNSAFE_IN_SINGLE_LINE = /[\u0000-\u0008\u000A-\u001F\u007F-\u009F\u2028\u2029\p{Cs}]/gu;
|
|
605
|
+
var UNSAFE_IN_MULTILINE = /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u2028\u2029\p{Cs}]/gu;
|
|
589
606
|
function toEscapeSequence(char) {
|
|
590
607
|
return `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}`;
|
|
591
608
|
}
|
|
@@ -603,34 +620,94 @@ function escapeControlCharacters(text) {
|
|
|
603
620
|
}
|
|
604
621
|
|
|
605
622
|
// src/server/utils/fold-key.util.ts
|
|
606
|
-
var IGNORED = /[\s._\p{Cf}-]/gu;
|
|
607
|
-
var DOT_ABOVE = /\u0307/g;
|
|
623
|
+
var IGNORED = /[\s._\p{Cc}\p{Cf}\p{M}-]/gu;
|
|
608
624
|
var PLAIN = /^[\x21-\x7e]*$/;
|
|
609
625
|
var LOOKALIKES = new Map(
|
|
610
626
|
Object.entries({
|
|
611
|
-
a: "\u0430\u03B1",
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
627
|
+
a: "\u0430\u03B1\u1D00",
|
|
628
|
+
b: "\u0299",
|
|
629
|
+
c: "\u0441\u03F2\u1D04",
|
|
630
|
+
d: "\u0501\u1D05",
|
|
631
|
+
e: "\u0435\u03B5\u03F5\u1D07",
|
|
632
|
+
f: "\uA730",
|
|
633
|
+
g: "\u0262",
|
|
634
|
+
h: "\u029C",
|
|
635
|
+
i: "\u0456\u03B9\u0131\u026A",
|
|
636
|
+
j: "\u0458\u1D0A",
|
|
637
|
+
k: "\u1D0B",
|
|
638
|
+
l: "\u029F",
|
|
639
|
+
m: "\u1D0D",
|
|
640
|
+
n: "\u0274",
|
|
641
|
+
o: "\u043E\u03BF\u1D0F",
|
|
642
|
+
p: "\u0440\u03C1\u1D18",
|
|
619
643
|
q: "\u051B",
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
644
|
+
r: "\u0280",
|
|
645
|
+
s: "\u0455\uA731",
|
|
646
|
+
t: "\u1D1B",
|
|
647
|
+
u: "\u1D1C",
|
|
648
|
+
v: "\u03BD\u1D20",
|
|
649
|
+
w: "\u051D\u1D21",
|
|
623
650
|
x: "\u0445",
|
|
624
|
-
y: "\u0443"
|
|
651
|
+
y: "\u0443\u028F",
|
|
652
|
+
z: "\u1D22"
|
|
625
653
|
}).flatMap(([latin, letters]) => [...letters].map((letter) => [letter, latin]))
|
|
626
654
|
);
|
|
627
655
|
function foldKey(key) {
|
|
628
656
|
if (PLAIN.test(key)) return key.replace(IGNORED, "").toLowerCase();
|
|
629
|
-
let folded = key.normalize("
|
|
657
|
+
let folded = key.normalize("NFKD").toLowerCase().replace(IGNORED, "");
|
|
630
658
|
for (const [letter, latin] of LOOKALIKES) folded = folded.replaceAll(letter, latin);
|
|
631
659
|
return folded;
|
|
632
660
|
}
|
|
633
661
|
|
|
662
|
+
// src/server/utils/hide-message-in-stack.util.ts
|
|
663
|
+
var FRAME_LINE = /\n[ \t]+at /g;
|
|
664
|
+
function failureTable(message) {
|
|
665
|
+
const table = new Int32Array(message.length);
|
|
666
|
+
for (let i = 1, matched = 0; i < message.length; i += 1) {
|
|
667
|
+
while (matched > 0 && message[i] !== message[matched]) matched = table[matched - 1];
|
|
668
|
+
if (message[i] === message[matched]) matched += 1;
|
|
669
|
+
table[i] = matched;
|
|
670
|
+
}
|
|
671
|
+
return table;
|
|
672
|
+
}
|
|
673
|
+
function occurrences(stack, message) {
|
|
674
|
+
const table = failureTable(message);
|
|
675
|
+
const spans = [];
|
|
676
|
+
for (let i = 0, matched = 0; i < stack.length; i += 1) {
|
|
677
|
+
while (matched > 0 && stack[i] !== message[matched]) matched = table[matched - 1];
|
|
678
|
+
if (stack[i] === message[matched]) matched += 1;
|
|
679
|
+
if (matched === message.length) {
|
|
680
|
+
const start = i + 1 - message.length;
|
|
681
|
+
const last = spans[spans.length - 1];
|
|
682
|
+
if (last !== void 0 && start < last[1]) last[1] = i + 1;
|
|
683
|
+
else spans.push([start, i + 1]);
|
|
684
|
+
}
|
|
685
|
+
}
|
|
686
|
+
return spans;
|
|
687
|
+
}
|
|
688
|
+
function headerEnd(stack, spans) {
|
|
689
|
+
let next = 0;
|
|
690
|
+
for (const line of stack.matchAll(FRAME_LINE)) {
|
|
691
|
+
while (next < spans.length && spans[next][1] <= line.index) next += 1;
|
|
692
|
+
const span = spans[next];
|
|
693
|
+
if (span === void 0 || line.index < span[0]) return line.index;
|
|
694
|
+
}
|
|
695
|
+
return stack.length;
|
|
696
|
+
}
|
|
697
|
+
function hideMessageInStack(stack, message, replacement) {
|
|
698
|
+
if (message === "") return stack;
|
|
699
|
+
if (message.length > stack.length) return stack;
|
|
700
|
+
const spans = occurrences(stack, message);
|
|
701
|
+
const end = headerEnd(stack, spans);
|
|
702
|
+
let result = "";
|
|
703
|
+
let from = 0;
|
|
704
|
+
for (const [start, stop] of spans.filter(([, stop2]) => stop2 <= end)) {
|
|
705
|
+
result += stack.slice(from, start) + replacement;
|
|
706
|
+
from = stop;
|
|
707
|
+
}
|
|
708
|
+
return result + stack.slice(from);
|
|
709
|
+
}
|
|
710
|
+
|
|
634
711
|
// src/server/utils/is-plain-record.util.ts
|
|
635
712
|
function isPlainRecord(node) {
|
|
636
713
|
try {
|
|
@@ -738,11 +815,21 @@ function readsAsError(value) {
|
|
|
738
815
|
return false;
|
|
739
816
|
}
|
|
740
817
|
const candidate = value;
|
|
741
|
-
return typeof candidate.
|
|
818
|
+
return typeof candidate.message === "string" && (isError(value) || typeof candidate.name === "string");
|
|
742
819
|
}
|
|
743
|
-
function readScrubbedStack(value, name, message, result, walk2) {
|
|
820
|
+
function readScrubbedStack(value, name, message, textName, result, walk2) {
|
|
744
821
|
const stack = readOptional(() => value.stack, result);
|
|
745
|
-
|
|
822
|
+
if (stack === void 0) return void 0;
|
|
823
|
+
const header = headerCensor(name, message, walk2.censorMessage);
|
|
824
|
+
return scrubStack(textName ? stack : withNamedHeader(stack, message), header);
|
|
825
|
+
}
|
|
826
|
+
var FRAME_LINE2 = /\n[ \t]+at /;
|
|
827
|
+
function withNamedHeader(stack, message) {
|
|
828
|
+
const found = message === "" ? -1 : stack.indexOf(message);
|
|
829
|
+
if (found !== -1) return `Error: ${stack.slice(found)}`;
|
|
830
|
+
const end = stack.search(FRAME_LINE2);
|
|
831
|
+
const frames = end === -1 ? "" : stack.slice(end);
|
|
832
|
+
return `Error${message === "" ? "" : `: ${message}`}${frames}`;
|
|
746
833
|
}
|
|
747
834
|
function toSanitizedError(value, seen, depth2, walk2) {
|
|
748
835
|
try {
|
|
@@ -750,13 +837,13 @@ function toSanitizedError(value, seen, depth2, walk2) {
|
|
|
750
837
|
return { name: "UnknownError", message: cutText(String(value)) };
|
|
751
838
|
}
|
|
752
839
|
seen.add(value);
|
|
753
|
-
const message = value
|
|
754
|
-
const name = cutText(
|
|
840
|
+
const { message, name: rawName } = value;
|
|
841
|
+
const name = cutText(typeof rawName === "string" ? rawName : "Error");
|
|
755
842
|
const result = {
|
|
756
843
|
name: censorName(name, walk2.censorMessage),
|
|
757
844
|
message: cutText(message)
|
|
758
845
|
};
|
|
759
|
-
const stack = readScrubbedStack(value, name, message, result, walk2);
|
|
846
|
+
const stack = readScrubbedStack(value, name, message, typeof rawName === "string", result, walk2);
|
|
760
847
|
if (stack !== void 0) result.stack = stack;
|
|
761
848
|
const isAtDepthLimit = depth2 >= walk2.maxDepth;
|
|
762
849
|
const cause = readOptional(() => value.cause, result);
|
|
@@ -904,9 +991,16 @@ var RESOURCE_KEYS = [
|
|
|
904
991
|
var OWNED_KEY_SPELLINGS = new Set(
|
|
905
992
|
[...OWNED_PAYLOAD_KEYS, ...ENTRY_STRUCTURE_KEYS, ...RESOURCE_KEYS].map(foldKey)
|
|
906
993
|
);
|
|
994
|
+
var DERIVED_KEYS = /* @__PURE__ */ new Set([
|
|
995
|
+
"exception.type",
|
|
996
|
+
"exception.message",
|
|
997
|
+
"exception.stacktrace",
|
|
998
|
+
"error.type"
|
|
999
|
+
]);
|
|
1000
|
+
var lookAlike = (key) => key.normalize("NFKC").replace(/[\p{Cf}\p{Zs}]/gu, "").toLowerCase();
|
|
907
1001
|
var isOwnedKey = (key) => {
|
|
908
1002
|
const lower = key.toLowerCase();
|
|
909
|
-
return OWNED_KEY_SPELLINGS.has(foldKey(key)) || lower.startsWith("service.") || lower.startsWith("deployment.");
|
|
1003
|
+
return OWNED_KEY_SPELLINGS.has(foldKey(key)) || DERIVED_KEYS.has(lookAlike(key)) || lower.startsWith("service.") || lower.startsWith("deployment.");
|
|
910
1004
|
};
|
|
911
1005
|
function withoutOwnedKeys(metadata, omit) {
|
|
912
1006
|
if (metadata === void 0) {
|
|
@@ -944,6 +1038,13 @@ function objectMessageText(fields) {
|
|
|
944
1038
|
}
|
|
945
1039
|
return void 0;
|
|
946
1040
|
}
|
|
1041
|
+
function hideStackMessage(payload, text, censor) {
|
|
1042
|
+
const stack = Reflect.get(payload, "stack");
|
|
1043
|
+
if (text?.key !== "message" || typeof stack !== "string") return;
|
|
1044
|
+
const censored = censor(text.text);
|
|
1045
|
+
if (censored === text.text) return;
|
|
1046
|
+
Reflect.set(payload, "stack", hideMessageInStack(stack, text.text, censored));
|
|
1047
|
+
}
|
|
947
1048
|
function readObjectMessage(message) {
|
|
948
1049
|
const fields = isPlainRecord(message) && !isErrorLike(message) ? message : void 0;
|
|
949
1050
|
const text = fields === void 0 ? void 0 : objectMessageText(fields);
|
|
@@ -1026,6 +1127,7 @@ exports.PinoLoggerService = class PinoLoggerService {
|
|
|
1026
1127
|
const stack = typeof optionalParams[0] === "string" ? optionalParams[0] : void 0;
|
|
1027
1128
|
const context = typeof optionalParams[1] === "string" ? optionalParams[1] : this.context;
|
|
1028
1129
|
const { fields, text, payload } = readObjectMessage(message);
|
|
1130
|
+
hideStackMessage(payload, text, (message2) => this.censorText({ key: "message", text: message2 }));
|
|
1029
1131
|
assignIfDefined(payload, "context", context);
|
|
1030
1132
|
assignIfDefined(payload, "stack", stack === void 0 ? stack : cutText(stack));
|
|
1031
1133
|
assignIfDefined(payload, "err", findErrorParam(optionalParams));
|
|
@@ -1228,6 +1330,7 @@ exports.PinoLoggerService = class PinoLoggerService {
|
|
|
1228
1330
|
}
|
|
1229
1331
|
emitNestStyle(level, message, optionalParams) {
|
|
1230
1332
|
const { fields, text, payload } = readObjectMessage(message);
|
|
1333
|
+
hideStackMessage(payload, text, (message2) => this.censorText({ key: "message", text: message2 }));
|
|
1231
1334
|
assignIfDefined(payload, "context", this.resolveContext(optionalParams));
|
|
1232
1335
|
const leading = isErrorLike(message) ? message : void 0;
|
|
1233
1336
|
assignIfDefined(payload, "err", leading ?? findErrorParam(optionalParams));
|
|
@@ -2658,32 +2761,6 @@ function censorRawHeaders(raw, sensitive, censor) {
|
|
|
2658
2761
|
});
|
|
2659
2762
|
}
|
|
2660
2763
|
|
|
2661
|
-
// src/server/utils/redact-error-clone.util.ts
|
|
2662
|
-
function shadowHook(target) {
|
|
2663
|
-
Reflect.defineProperty(target, "toJSON", { value: void 0, configurable: true });
|
|
2664
|
-
}
|
|
2665
|
-
function withoutEnumerableKeys(clone) {
|
|
2666
|
-
for (const key of Object.keys(clone)) Reflect.deleteProperty(clone, key);
|
|
2667
|
-
}
|
|
2668
|
-
function discardWrite() {
|
|
2669
|
-
}
|
|
2670
|
-
function cloneError(error) {
|
|
2671
|
-
const descriptors = Object.getOwnPropertyDescriptors(error);
|
|
2672
|
-
for (const descriptor of Object.values(descriptors)) {
|
|
2673
|
-
descriptor.configurable = true;
|
|
2674
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
2675
|
-
else descriptor.set ??= discardWrite;
|
|
2676
|
-
}
|
|
2677
|
-
const clone = Object.create(Object.getPrototypeOf(error), descriptors);
|
|
2678
|
-
const { stack } = error;
|
|
2679
|
-
if (typeof stack === "string") {
|
|
2680
|
-
Reflect.defineProperty(clone, "stack", { value: stack, enumerable: false, writable: true });
|
|
2681
|
-
}
|
|
2682
|
-
withoutEnumerableKeys(clone);
|
|
2683
|
-
shadowHook(clone);
|
|
2684
|
-
return clone;
|
|
2685
|
-
}
|
|
2686
|
-
|
|
2687
2764
|
// src/server/utils/redact-error-parts.util.ts
|
|
2688
2765
|
function defineOwn(target, key, value) {
|
|
2689
2766
|
Reflect.defineProperty(target, key, { value, enumerable: true, writable: true });
|
|
@@ -2736,6 +2813,10 @@ function walkChainPart(value, level, host, depth2) {
|
|
|
2736
2813
|
function cutOrWalk(value, level, host, depth2) {
|
|
2737
2814
|
return typeof value === "string" ? cutText(value) : walkChainPart(value, level, host, depth2);
|
|
2738
2815
|
}
|
|
2816
|
+
function writeName(value, level, host, depth2) {
|
|
2817
|
+
const censored = host.censorName(typeof value === "string" ? cutText(value) : value);
|
|
2818
|
+
return censored === value ? cutOrWalk(value, level, host, depth2) : censored;
|
|
2819
|
+
}
|
|
2739
2820
|
function addErrorParts(copy, error, ownKeys, host, depth2) {
|
|
2740
2821
|
const taken = new Set(ownKeys);
|
|
2741
2822
|
const level = linkDepths.get(error) ?? 0;
|
|
@@ -2755,7 +2836,7 @@ function addErrorParts(copy, error, ownKeys, host, depth2) {
|
|
|
2755
2836
|
host.nameKey,
|
|
2756
2837
|
[host.nameKey, "name"],
|
|
2757
2838
|
() => error.name,
|
|
2758
|
-
(name) =>
|
|
2839
|
+
(name) => writeName(name, level, host, depth2)
|
|
2759
2840
|
);
|
|
2760
2841
|
add(
|
|
2761
2842
|
"message",
|
|
@@ -2774,6 +2855,78 @@ function addErrorParts(copy, error, ownKeys, host, depth2) {
|
|
|
2774
2855
|
if (incomplete && !taken.has(INCOMPLETE_KEY)) defineOwn(copy, INCOMPLETE_KEY, true);
|
|
2775
2856
|
}
|
|
2776
2857
|
|
|
2858
|
+
// src/server/utils/error-text-exemption.util.ts
|
|
2859
|
+
var ERROR_TEXT_KEYS = /* @__PURE__ */ new Set(["message"]);
|
|
2860
|
+
function leavesErrorText(rules, key, value, honorToJson) {
|
|
2861
|
+
return rules.errorTextToSerializer && !honorToJson && key === "err" && !Array.isArray(value);
|
|
2862
|
+
}
|
|
2863
|
+
function rulesBelow(rules, key, value, honorToJson) {
|
|
2864
|
+
if (leavesErrorText(rules, key, value, honorToJson)) {
|
|
2865
|
+
return { ...rules, exemptKeys: ERROR_TEXT_KEYS };
|
|
2866
|
+
}
|
|
2867
|
+
return rules.exemptKeys === void 0 && rules.headerKept !== true ? rules : { ...rules, exemptKeys: void 0, headerKept: void 0 };
|
|
2868
|
+
}
|
|
2869
|
+
function isCensored(rules, key, value) {
|
|
2870
|
+
const lower = key.toLowerCase();
|
|
2871
|
+
return rules.sensitive.has(lower) && !(typeof value === "string" && rules.exemptKeys?.has(lower));
|
|
2872
|
+
}
|
|
2873
|
+
function messageCensor(rules) {
|
|
2874
|
+
return (text) => rules.sensitive.has("message") ? rules.censor : text;
|
|
2875
|
+
}
|
|
2876
|
+
function headerMessage(rules, source, keys, isError2) {
|
|
2877
|
+
if (isError2 || !rules.sensitive.has("message") || rules.exemptKeys?.has("message") === true)
|
|
2878
|
+
return void 0;
|
|
2879
|
+
if (rules.headerKept === true) return void 0;
|
|
2880
|
+
const key = keys.find((candidate) => foldKey(candidate) === "message");
|
|
2881
|
+
if (key === void 0 || !keys.some((candidate) => foldKey(candidate) === "stack")) {
|
|
2882
|
+
return void 0;
|
|
2883
|
+
}
|
|
2884
|
+
const text = Reflect.get(source, key);
|
|
2885
|
+
return typeof text === "string" ? { key, text } : void 0;
|
|
2886
|
+
}
|
|
2887
|
+
function readField(source, key, header) {
|
|
2888
|
+
return header !== void 0 && key === header.key ? header.text : Reflect.get(source, key);
|
|
2889
|
+
}
|
|
2890
|
+
function censorAnyName(rules, name) {
|
|
2891
|
+
if (typeof name === "string") return censorName(name, messageCensor(rules));
|
|
2892
|
+
const holder = typeof name === "object" && name !== null || typeof name === "function";
|
|
2893
|
+
return holder && rules.sensitive.has("message") ? rules.censor : name;
|
|
2894
|
+
}
|
|
2895
|
+
function errorTextField(rules, key, value, isError2, header) {
|
|
2896
|
+
if (header !== void 0 && foldKey(key) === "stack" && typeof value === "string") {
|
|
2897
|
+
return hideMessageInStack(value, header.text, rules.censor);
|
|
2898
|
+
}
|
|
2899
|
+
if (!isError2 || !ERROR_TEXT_FIELDS.has(key)) return value;
|
|
2900
|
+
const cut = cutIfText(value);
|
|
2901
|
+
return key === "name" ? censorAnyName(rules, cut) : cut;
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
// src/server/utils/redact-error-clone.util.ts
|
|
2905
|
+
function shadowHook(target) {
|
|
2906
|
+
Reflect.defineProperty(target, "toJSON", { value: void 0, configurable: true });
|
|
2907
|
+
}
|
|
2908
|
+
function withoutEnumerableKeys(clone) {
|
|
2909
|
+
for (const key of Object.keys(clone)) Reflect.deleteProperty(clone, key);
|
|
2910
|
+
}
|
|
2911
|
+
function discardWrite() {
|
|
2912
|
+
}
|
|
2913
|
+
function cloneError(error) {
|
|
2914
|
+
const descriptors = Object.getOwnPropertyDescriptors(error);
|
|
2915
|
+
for (const descriptor of Object.values(descriptors)) {
|
|
2916
|
+
descriptor.configurable = true;
|
|
2917
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
2918
|
+
else descriptor.set ??= discardWrite;
|
|
2919
|
+
}
|
|
2920
|
+
const clone = Object.create(Object.getPrototypeOf(error), descriptors);
|
|
2921
|
+
const { stack } = error;
|
|
2922
|
+
if (typeof stack === "string") {
|
|
2923
|
+
Reflect.defineProperty(clone, "stack", { value: stack, enumerable: false, writable: true });
|
|
2924
|
+
}
|
|
2925
|
+
withoutEnumerableKeys(clone);
|
|
2926
|
+
shadowHook(clone);
|
|
2927
|
+
return clone;
|
|
2928
|
+
}
|
|
2929
|
+
|
|
2777
2930
|
// src/server/utils/redact-by-name.util.ts
|
|
2778
2931
|
var RAW_HEADER_KEYS = /* @__PURE__ */ new Set(["rawheaders", "rawtrailers"]);
|
|
2779
2932
|
function censorHeaderArray(key, walked, rules) {
|
|
@@ -2804,6 +2957,14 @@ function resolveToJson(value, viaGet = false) {
|
|
|
2804
2957
|
volatile: accessor || proxied
|
|
2805
2958
|
};
|
|
2806
2959
|
}
|
|
2960
|
+
function rulesInside(rules, names, visits) {
|
|
2961
|
+
return names === void 0 ? void 0 : { ...rules, sensitive: names, visits, insideErrors: void 0 };
|
|
2962
|
+
}
|
|
2963
|
+
var errorOutputs = /* @__PURE__ */ new WeakSet();
|
|
2964
|
+
function markErrorOutput(output) {
|
|
2965
|
+
if (typeof output === "object" && output !== null) errorOutputs.add(output);
|
|
2966
|
+
return output;
|
|
2967
|
+
}
|
|
2807
2968
|
function walkArray(value, rules, depth2, ancestors, inSerialized) {
|
|
2808
2969
|
const length = value.length;
|
|
2809
2970
|
const copy = [];
|
|
@@ -2890,13 +3051,13 @@ function walkToJsonOutput(value, toJson, rules, depth2, ancestors, inSerialized)
|
|
|
2890
3051
|
function walkProperties(value, rules, depth2, ancestors, honorToJson, inSerialized) {
|
|
2891
3052
|
const source = value;
|
|
2892
3053
|
const keys = Object.keys(source);
|
|
2893
|
-
const
|
|
2894
|
-
const asData = isError(value) && (safe || rules.errorsAsData && !inSerialized);
|
|
3054
|
+
const asData = isError(value) && (rules.ownFields.safe || rules.errorsAsData && !inSerialized);
|
|
2895
3055
|
const copy = startCopy(value, asData);
|
|
2896
|
-
const scrubbed = isError(value) && (safe || !inSerialized);
|
|
3056
|
+
const scrubbed = isError(value) && (rules.ownFields.safe || !inSerialized);
|
|
2897
3057
|
const omitted = /* @__PURE__ */ new Set();
|
|
3058
|
+
const header = headerMessage(rules, source, keys, isError(value));
|
|
2898
3059
|
for (const key of keys) {
|
|
2899
|
-
const read =
|
|
3060
|
+
const read = readField(source, key, header);
|
|
2900
3061
|
const current = scrubbed ? ownFieldForLog(source, key, read, rules.ownFields) : read;
|
|
2901
3062
|
const hook = honorToJson && key === "toJSON" && typeof current === "function";
|
|
2902
3063
|
if (current === OMIT_OWN_FIELD || hook) {
|
|
@@ -2907,10 +3068,10 @@ function walkProperties(value, rules, depth2, ancestors, honorToJson, inSerializ
|
|
|
2907
3068
|
defineOwn(
|
|
2908
3069
|
copy,
|
|
2909
3070
|
key,
|
|
2910
|
-
rules
|
|
3071
|
+
isCensored(rules, key, current) ? rules.censor : censorHeaderArray(
|
|
2911
3072
|
key,
|
|
2912
3073
|
walk(
|
|
2913
|
-
|
|
3074
|
+
errorTextField(rules, key, current, scrubbed, header),
|
|
2914
3075
|
rulesBelow(rules, key, current, honorToJson),
|
|
2915
3076
|
depth2 + 1,
|
|
2916
3077
|
ancestors,
|
|
@@ -2927,16 +3088,6 @@ function walkProperties(value, rules, depth2, ancestors, honorToJson, inSerializ
|
|
|
2927
3088
|
}
|
|
2928
3089
|
return copy;
|
|
2929
3090
|
}
|
|
2930
|
-
function leavesErrorText(rules, key, value, honorToJson) {
|
|
2931
|
-
return rules.errorTextToSerializer && !honorToJson && key === "err" && !isError(value) && isErrorLike(value);
|
|
2932
|
-
}
|
|
2933
|
-
function rulesBelow(rules, key, value, honorToJson) {
|
|
2934
|
-
if (leavesErrorText(rules, key, value, honorToJson)) {
|
|
2935
|
-
return { ...rules, exemptKeys: ERROR_TEXT_KEYS };
|
|
2936
|
-
}
|
|
2937
|
-
return rules.exemptKeys === void 0 ? rules : { ...rules, exemptKeys: void 0 };
|
|
2938
|
-
}
|
|
2939
|
-
var ERROR_TEXT_KEYS = /* @__PURE__ */ new Set(["message"]);
|
|
2940
3091
|
function without(keys, omitted) {
|
|
2941
3092
|
return keys.filter((key) => !omitted.has(key));
|
|
2942
3093
|
}
|
|
@@ -2951,6 +3102,7 @@ function errorPartsHost(rules, ancestors, inSerialized) {
|
|
|
2951
3102
|
// What a serializer receives names the error `name`, as the error-like shape it reads does;
|
|
2952
3103
|
// everything else keeps the `type` the written entries use.
|
|
2953
3104
|
nameKey: inSerialized ? "name" : "type",
|
|
3105
|
+
censorName: (name) => censorAnyName(rules, name),
|
|
2954
3106
|
walk: (value, depth2) => walk(value, rules, depth2, ancestors, true, inSerialized),
|
|
2955
3107
|
// Under 'safe' the cap does not read a list's `toJSON`: a list over the cap becomes a fresh array
|
|
2956
3108
|
// and is never read for it, and a list within the cap is read once, by the walk.
|
|
@@ -2974,8 +3126,9 @@ function createNameRedactor(fieldNames, censor, serializedKeys, maxVisits = REDA
|
|
|
2974
3126
|
const visits = { count: 0 };
|
|
2975
3127
|
const call = {
|
|
2976
3128
|
...rules,
|
|
3129
|
+
headerKept: typeof value === "object" && value !== null && errorOutputs.has(value),
|
|
2977
3130
|
visits,
|
|
2978
|
-
insideErrors:
|
|
3131
|
+
insideErrors: rulesInside(rules, insideNames, visits)
|
|
2979
3132
|
};
|
|
2980
3133
|
return walk(value, call, 0, /* @__PURE__ */ new Set(), !isRecordRoot);
|
|
2981
3134
|
} catch {
|
|
@@ -3126,8 +3279,9 @@ function deriveExceptionFields(record, maxBytes, onCut, censorMessage, redactSta
|
|
|
3126
3279
|
if (header !== void 0) {
|
|
3127
3280
|
record["exception.message"] = bounded(cutText(header.censored));
|
|
3128
3281
|
}
|
|
3129
|
-
|
|
3130
|
-
|
|
3282
|
+
const stack = candidate?.stack;
|
|
3283
|
+
if (typeof candidate?.name === "string" && typeof message === "string" && typeof stack === "string") {
|
|
3284
|
+
record["exception.stacktrace"] = bounded(redactStack(scrubStack(stack, header)));
|
|
3131
3285
|
}
|
|
3132
3286
|
}
|
|
3133
3287
|
function withSemconvException(record, format, maxBytes = Number.POSITIVE_INFINITY, onCut, censorMessage = (text) => text, redactStack = (stack) => stack) {
|
|
@@ -3345,7 +3499,7 @@ function buildSerializers(options, redactSerialized, ownFields, onTruncate) {
|
|
|
3345
3499
|
() => onTruncate("max_entry_size")
|
|
3346
3500
|
);
|
|
3347
3501
|
return {
|
|
3348
|
-
err: bound((error) => serializeErrorValue(error, ownFields, censorMessage)),
|
|
3502
|
+
err: bound((error) => markErrorOutput(serializeErrorValue(error, ownFields, censorMessage))),
|
|
3349
3503
|
...Object.fromEntries(
|
|
3350
3504
|
Object.entries(options.serializers).map(
|
|
3351
3505
|
([key, serializer]) => [key, bound(serializer)]
|
|
@@ -4250,8 +4404,10 @@ exports.BymaxLoggerModule = class BymaxLoggerModule extends BymaxLoggerModuleBas
|
|
|
4250
4404
|
* BymaxLoggerModule.forRoot({ service: { name: 'api', version: '1.0.0' } })
|
|
4251
4405
|
*/
|
|
4252
4406
|
static forRoot(options) {
|
|
4253
|
-
|
|
4254
|
-
|
|
4407
|
+
const resolved = guardOptions(() => {
|
|
4408
|
+
validateOptions(options);
|
|
4409
|
+
return applyDefaults(options);
|
|
4410
|
+
});
|
|
4255
4411
|
const providers = [
|
|
4256
4412
|
{ provide: LOGGER_OPTIONS_TOKEN, useValue: resolved },
|
|
4257
4413
|
...buildCommonProviders()
|
|
@@ -4262,7 +4418,10 @@ exports.BymaxLoggerModule = class BymaxLoggerModule extends BymaxLoggerModuleBas
|
|
|
4262
4418
|
providers.push({ provide: core.APP_FILTER, useClass: exports.HttpExceptionFilter });
|
|
4263
4419
|
}
|
|
4264
4420
|
}
|
|
4265
|
-
return augmentLoggerModule(
|
|
4421
|
+
return augmentLoggerModule(
|
|
4422
|
+
guardOptions(() => super.forRoot(options)),
|
|
4423
|
+
providers
|
|
4424
|
+
);
|
|
4266
4425
|
}
|
|
4267
4426
|
/**
|
|
4268
4427
|
* Asynchronous registration. Options are resolved lazily via the consumer's
|
|
@@ -4292,8 +4451,10 @@ exports.BymaxLoggerModule = class BymaxLoggerModule extends BymaxLoggerModuleBas
|
|
|
4292
4451
|
{
|
|
4293
4452
|
provide: LOGGER_OPTIONS_TOKEN,
|
|
4294
4453
|
useFactory: (raw) => {
|
|
4295
|
-
|
|
4296
|
-
|
|
4454
|
+
return guardOptions(() => {
|
|
4455
|
+
validateOptions(raw);
|
|
4456
|
+
return applyDefaults(raw);
|
|
4457
|
+
});
|
|
4297
4458
|
},
|
|
4298
4459
|
inject: [BUILDER_OPTIONS_TOKEN]
|
|
4299
4460
|
},
|
|
@@ -4302,7 +4463,10 @@ exports.BymaxLoggerModule = class BymaxLoggerModule extends BymaxLoggerModuleBas
|
|
|
4302
4463
|
// gated at runtime against the async-resolved `http.isEnabled`.
|
|
4303
4464
|
asyncHttpInterceptorProvider()
|
|
4304
4465
|
];
|
|
4305
|
-
return augmentLoggerModule(
|
|
4466
|
+
return augmentLoggerModule(
|
|
4467
|
+
guardOptions(() => super.forRootAsync(options)),
|
|
4468
|
+
providers
|
|
4469
|
+
);
|
|
4306
4470
|
}
|
|
4307
4471
|
/**
|
|
4308
4472
|
* Replace NestJS's internal logger with this library's `PinoLoggerService` and
|
package/dist/server/index.mjs
CHANGED
|
@@ -183,6 +183,23 @@ function applyDefaults(given) {
|
|
|
183
183
|
return Object.freeze(merged);
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
+
// src/server/config/options-refusal.util.ts
|
|
187
|
+
var refusals = /* @__PURE__ */ new WeakSet();
|
|
188
|
+
var UNREADABLE = "[BymaxLoggerModule] options could not be read";
|
|
189
|
+
function refuse(message) {
|
|
190
|
+
const error = new Error(message);
|
|
191
|
+
refusals.add(error);
|
|
192
|
+
throw error;
|
|
193
|
+
}
|
|
194
|
+
function guardOptions(read) {
|
|
195
|
+
try {
|
|
196
|
+
return read();
|
|
197
|
+
} catch (error) {
|
|
198
|
+
if (typeof error === "object" && error !== null && refusals.delete(error)) throw error;
|
|
199
|
+
throw new Error(UNREADABLE, { cause: error });
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
186
203
|
// src/server/constants/log-levels.constants.ts
|
|
187
204
|
var PINO_LEVEL_NUMBERS = Object.freeze({
|
|
188
205
|
fatal: 60,
|
|
@@ -211,7 +228,7 @@ var LOG_LEVEL_PRIORITY = Object.freeze([
|
|
|
211
228
|
// src/server/config/validate-options.ts
|
|
212
229
|
function reject(path2, rule, got, wasGiven = got !== void 0) {
|
|
213
230
|
const received = wasGiven ? `. Received ${describeValue(got)}` : "";
|
|
214
|
-
|
|
231
|
+
refuse(`[BymaxLoggerModule] options.${path2} ${rule}${received}`);
|
|
215
232
|
}
|
|
216
233
|
function describeValue(value) {
|
|
217
234
|
switch (typeof value) {
|
|
@@ -309,7 +326,7 @@ function validateLifecycle(options) {
|
|
|
309
326
|
function validateCore(options) {
|
|
310
327
|
const service = options.service;
|
|
311
328
|
if (service === void 0) {
|
|
312
|
-
|
|
329
|
+
refuse("[BymaxLoggerModule] options.service is required");
|
|
313
330
|
}
|
|
314
331
|
if (!isRecord2(service)) reject("service", "must be an object", service);
|
|
315
332
|
for (const field of ["name", "version"]) {
|
|
@@ -391,12 +408,12 @@ function validateErrorFields(options) {
|
|
|
391
408
|
}
|
|
392
409
|
});
|
|
393
410
|
}
|
|
394
|
-
var
|
|
411
|
+
var UNREADABLE2 = /* @__PURE__ */ Symbol("unreadable");
|
|
395
412
|
function readMember(destination, key) {
|
|
396
413
|
try {
|
|
397
414
|
return Reflect.get(destination, key);
|
|
398
415
|
} catch {
|
|
399
|
-
return
|
|
416
|
+
return UNREADABLE2;
|
|
400
417
|
}
|
|
401
418
|
}
|
|
402
419
|
function validateDestination(entry, index) {
|
|
@@ -405,16 +422,16 @@ function validateDestination(entry, index) {
|
|
|
405
422
|
reject(path2, "must be an object implementing ILogDestination", entry, true);
|
|
406
423
|
}
|
|
407
424
|
const write = readMember(entry, "write");
|
|
408
|
-
if (write !==
|
|
425
|
+
if (write !== UNREADABLE2 && typeof write !== "function") {
|
|
409
426
|
reject(path2, "must have a write(payload) method");
|
|
410
427
|
}
|
|
411
428
|
const name = readMember(entry, "name");
|
|
412
|
-
if (name !==
|
|
429
|
+
if (name !== UNREADABLE2 && !isNonEmptyString(name)) {
|
|
413
430
|
reject(path2, "must have a non-empty string name", name);
|
|
414
431
|
}
|
|
415
432
|
for (const hook of ["onInit", "onShutdown", "onRegistryReady"]) {
|
|
416
433
|
const value = readMember(entry, hook);
|
|
417
|
-
if (value !==
|
|
434
|
+
if (value !== UNREADABLE2 && value !== void 0 && typeof value !== "function") {
|
|
418
435
|
reject(`${path2}.${hook}`, "must be a function", value);
|
|
419
436
|
}
|
|
420
437
|
}
|
|
@@ -581,8 +598,8 @@ function createEntryTextFinisher(redact, limit, onCut) {
|
|
|
581
598
|
|
|
582
599
|
// src/server/utils/escape-log-text.util.ts
|
|
583
600
|
var LINE_TERMINATORS = /* @__PURE__ */ new Set(["\r", "\n", "\x85", "\u2028", "\u2029"]);
|
|
584
|
-
var UNSAFE_IN_SINGLE_LINE = /[\u0000-\u0008\u000A-\u001F\u007F-\u009F\u2028\u2029]/
|
|
585
|
-
var UNSAFE_IN_MULTILINE = /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u2028\u2029]/
|
|
601
|
+
var UNSAFE_IN_SINGLE_LINE = /[\u0000-\u0008\u000A-\u001F\u007F-\u009F\u2028\u2029\p{Cs}]/gu;
|
|
602
|
+
var UNSAFE_IN_MULTILINE = /[\u0000-\u0008\u000B-\u001F\u007F-\u009F\u2028\u2029\p{Cs}]/gu;
|
|
586
603
|
function toEscapeSequence(char) {
|
|
587
604
|
return `\\u${char.charCodeAt(0).toString(16).padStart(4, "0")}`;
|
|
588
605
|
}
|
|
@@ -600,34 +617,94 @@ function escapeControlCharacters(text) {
|
|
|
600
617
|
}
|
|
601
618
|
|
|
602
619
|
// src/server/utils/fold-key.util.ts
|
|
603
|
-
var IGNORED = /[\s._\p{Cf}-]/gu;
|
|
604
|
-
var DOT_ABOVE = /\u0307/g;
|
|
620
|
+
var IGNORED = /[\s._\p{Cc}\p{Cf}\p{M}-]/gu;
|
|
605
621
|
var PLAIN = /^[\x21-\x7e]*$/;
|
|
606
622
|
var LOOKALIKES = new Map(
|
|
607
623
|
Object.entries({
|
|
608
|
-
a: "\u0430\u03B1",
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
624
|
+
a: "\u0430\u03B1\u1D00",
|
|
625
|
+
b: "\u0299",
|
|
626
|
+
c: "\u0441\u03F2\u1D04",
|
|
627
|
+
d: "\u0501\u1D05",
|
|
628
|
+
e: "\u0435\u03B5\u03F5\u1D07",
|
|
629
|
+
f: "\uA730",
|
|
630
|
+
g: "\u0262",
|
|
631
|
+
h: "\u029C",
|
|
632
|
+
i: "\u0456\u03B9\u0131\u026A",
|
|
633
|
+
j: "\u0458\u1D0A",
|
|
634
|
+
k: "\u1D0B",
|
|
635
|
+
l: "\u029F",
|
|
636
|
+
m: "\u1D0D",
|
|
637
|
+
n: "\u0274",
|
|
638
|
+
o: "\u043E\u03BF\u1D0F",
|
|
639
|
+
p: "\u0440\u03C1\u1D18",
|
|
616
640
|
q: "\u051B",
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
641
|
+
r: "\u0280",
|
|
642
|
+
s: "\u0455\uA731",
|
|
643
|
+
t: "\u1D1B",
|
|
644
|
+
u: "\u1D1C",
|
|
645
|
+
v: "\u03BD\u1D20",
|
|
646
|
+
w: "\u051D\u1D21",
|
|
620
647
|
x: "\u0445",
|
|
621
|
-
y: "\u0443"
|
|
648
|
+
y: "\u0443\u028F",
|
|
649
|
+
z: "\u1D22"
|
|
622
650
|
}).flatMap(([latin, letters]) => [...letters].map((letter) => [letter, latin]))
|
|
623
651
|
);
|
|
624
652
|
function foldKey(key) {
|
|
625
653
|
if (PLAIN.test(key)) return key.replace(IGNORED, "").toLowerCase();
|
|
626
|
-
let folded = key.normalize("
|
|
654
|
+
let folded = key.normalize("NFKD").toLowerCase().replace(IGNORED, "");
|
|
627
655
|
for (const [letter, latin] of LOOKALIKES) folded = folded.replaceAll(letter, latin);
|
|
628
656
|
return folded;
|
|
629
657
|
}
|
|
630
658
|
|
|
659
|
+
// src/server/utils/hide-message-in-stack.util.ts
|
|
660
|
+
var FRAME_LINE = /\n[ \t]+at /g;
|
|
661
|
+
function failureTable(message) {
|
|
662
|
+
const table = new Int32Array(message.length);
|
|
663
|
+
for (let i = 1, matched = 0; i < message.length; i += 1) {
|
|
664
|
+
while (matched > 0 && message[i] !== message[matched]) matched = table[matched - 1];
|
|
665
|
+
if (message[i] === message[matched]) matched += 1;
|
|
666
|
+
table[i] = matched;
|
|
667
|
+
}
|
|
668
|
+
return table;
|
|
669
|
+
}
|
|
670
|
+
function occurrences(stack, message) {
|
|
671
|
+
const table = failureTable(message);
|
|
672
|
+
const spans = [];
|
|
673
|
+
for (let i = 0, matched = 0; i < stack.length; i += 1) {
|
|
674
|
+
while (matched > 0 && stack[i] !== message[matched]) matched = table[matched - 1];
|
|
675
|
+
if (stack[i] === message[matched]) matched += 1;
|
|
676
|
+
if (matched === message.length) {
|
|
677
|
+
const start = i + 1 - message.length;
|
|
678
|
+
const last = spans[spans.length - 1];
|
|
679
|
+
if (last !== void 0 && start < last[1]) last[1] = i + 1;
|
|
680
|
+
else spans.push([start, i + 1]);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
return spans;
|
|
684
|
+
}
|
|
685
|
+
function headerEnd(stack, spans) {
|
|
686
|
+
let next = 0;
|
|
687
|
+
for (const line of stack.matchAll(FRAME_LINE)) {
|
|
688
|
+
while (next < spans.length && spans[next][1] <= line.index) next += 1;
|
|
689
|
+
const span = spans[next];
|
|
690
|
+
if (span === void 0 || line.index < span[0]) return line.index;
|
|
691
|
+
}
|
|
692
|
+
return stack.length;
|
|
693
|
+
}
|
|
694
|
+
function hideMessageInStack(stack, message, replacement) {
|
|
695
|
+
if (message === "") return stack;
|
|
696
|
+
if (message.length > stack.length) return stack;
|
|
697
|
+
const spans = occurrences(stack, message);
|
|
698
|
+
const end = headerEnd(stack, spans);
|
|
699
|
+
let result = "";
|
|
700
|
+
let from = 0;
|
|
701
|
+
for (const [start, stop] of spans.filter(([, stop2]) => stop2 <= end)) {
|
|
702
|
+
result += stack.slice(from, start) + replacement;
|
|
703
|
+
from = stop;
|
|
704
|
+
}
|
|
705
|
+
return result + stack.slice(from);
|
|
706
|
+
}
|
|
707
|
+
|
|
631
708
|
// src/server/utils/is-plain-record.util.ts
|
|
632
709
|
function isPlainRecord(node) {
|
|
633
710
|
try {
|
|
@@ -735,11 +812,21 @@ function readsAsError(value) {
|
|
|
735
812
|
return false;
|
|
736
813
|
}
|
|
737
814
|
const candidate = value;
|
|
738
|
-
return typeof candidate.
|
|
815
|
+
return typeof candidate.message === "string" && (isError(value) || typeof candidate.name === "string");
|
|
739
816
|
}
|
|
740
|
-
function readScrubbedStack(value, name, message, result, walk2) {
|
|
817
|
+
function readScrubbedStack(value, name, message, textName, result, walk2) {
|
|
741
818
|
const stack = readOptional(() => value.stack, result);
|
|
742
|
-
|
|
819
|
+
if (stack === void 0) return void 0;
|
|
820
|
+
const header = headerCensor(name, message, walk2.censorMessage);
|
|
821
|
+
return scrubStack(textName ? stack : withNamedHeader(stack, message), header);
|
|
822
|
+
}
|
|
823
|
+
var FRAME_LINE2 = /\n[ \t]+at /;
|
|
824
|
+
function withNamedHeader(stack, message) {
|
|
825
|
+
const found = message === "" ? -1 : stack.indexOf(message);
|
|
826
|
+
if (found !== -1) return `Error: ${stack.slice(found)}`;
|
|
827
|
+
const end = stack.search(FRAME_LINE2);
|
|
828
|
+
const frames = end === -1 ? "" : stack.slice(end);
|
|
829
|
+
return `Error${message === "" ? "" : `: ${message}`}${frames}`;
|
|
743
830
|
}
|
|
744
831
|
function toSanitizedError(value, seen, depth2, walk2) {
|
|
745
832
|
try {
|
|
@@ -747,13 +834,13 @@ function toSanitizedError(value, seen, depth2, walk2) {
|
|
|
747
834
|
return { name: "UnknownError", message: cutText(String(value)) };
|
|
748
835
|
}
|
|
749
836
|
seen.add(value);
|
|
750
|
-
const message = value
|
|
751
|
-
const name = cutText(
|
|
837
|
+
const { message, name: rawName } = value;
|
|
838
|
+
const name = cutText(typeof rawName === "string" ? rawName : "Error");
|
|
752
839
|
const result = {
|
|
753
840
|
name: censorName(name, walk2.censorMessage),
|
|
754
841
|
message: cutText(message)
|
|
755
842
|
};
|
|
756
|
-
const stack = readScrubbedStack(value, name, message, result, walk2);
|
|
843
|
+
const stack = readScrubbedStack(value, name, message, typeof rawName === "string", result, walk2);
|
|
757
844
|
if (stack !== void 0) result.stack = stack;
|
|
758
845
|
const isAtDepthLimit = depth2 >= walk2.maxDepth;
|
|
759
846
|
const cause = readOptional(() => value.cause, result);
|
|
@@ -901,9 +988,16 @@ var RESOURCE_KEYS = [
|
|
|
901
988
|
var OWNED_KEY_SPELLINGS = new Set(
|
|
902
989
|
[...OWNED_PAYLOAD_KEYS, ...ENTRY_STRUCTURE_KEYS, ...RESOURCE_KEYS].map(foldKey)
|
|
903
990
|
);
|
|
991
|
+
var DERIVED_KEYS = /* @__PURE__ */ new Set([
|
|
992
|
+
"exception.type",
|
|
993
|
+
"exception.message",
|
|
994
|
+
"exception.stacktrace",
|
|
995
|
+
"error.type"
|
|
996
|
+
]);
|
|
997
|
+
var lookAlike = (key) => key.normalize("NFKC").replace(/[\p{Cf}\p{Zs}]/gu, "").toLowerCase();
|
|
904
998
|
var isOwnedKey = (key) => {
|
|
905
999
|
const lower = key.toLowerCase();
|
|
906
|
-
return OWNED_KEY_SPELLINGS.has(foldKey(key)) || lower.startsWith("service.") || lower.startsWith("deployment.");
|
|
1000
|
+
return OWNED_KEY_SPELLINGS.has(foldKey(key)) || DERIVED_KEYS.has(lookAlike(key)) || lower.startsWith("service.") || lower.startsWith("deployment.");
|
|
907
1001
|
};
|
|
908
1002
|
function withoutOwnedKeys(metadata, omit) {
|
|
909
1003
|
if (metadata === void 0) {
|
|
@@ -941,6 +1035,13 @@ function objectMessageText(fields) {
|
|
|
941
1035
|
}
|
|
942
1036
|
return void 0;
|
|
943
1037
|
}
|
|
1038
|
+
function hideStackMessage(payload, text, censor) {
|
|
1039
|
+
const stack = Reflect.get(payload, "stack");
|
|
1040
|
+
if (text?.key !== "message" || typeof stack !== "string") return;
|
|
1041
|
+
const censored = censor(text.text);
|
|
1042
|
+
if (censored === text.text) return;
|
|
1043
|
+
Reflect.set(payload, "stack", hideMessageInStack(stack, text.text, censored));
|
|
1044
|
+
}
|
|
944
1045
|
function readObjectMessage(message) {
|
|
945
1046
|
const fields = isPlainRecord(message) && !isErrorLike(message) ? message : void 0;
|
|
946
1047
|
const text = fields === void 0 ? void 0 : objectMessageText(fields);
|
|
@@ -1023,6 +1124,7 @@ var PinoLoggerService = class {
|
|
|
1023
1124
|
const stack = typeof optionalParams[0] === "string" ? optionalParams[0] : void 0;
|
|
1024
1125
|
const context = typeof optionalParams[1] === "string" ? optionalParams[1] : this.context;
|
|
1025
1126
|
const { fields, text, payload } = readObjectMessage(message);
|
|
1127
|
+
hideStackMessage(payload, text, (message2) => this.censorText({ key: "message", text: message2 }));
|
|
1026
1128
|
assignIfDefined(payload, "context", context);
|
|
1027
1129
|
assignIfDefined(payload, "stack", stack === void 0 ? stack : cutText(stack));
|
|
1028
1130
|
assignIfDefined(payload, "err", findErrorParam(optionalParams));
|
|
@@ -1225,6 +1327,7 @@ var PinoLoggerService = class {
|
|
|
1225
1327
|
}
|
|
1226
1328
|
emitNestStyle(level, message, optionalParams) {
|
|
1227
1329
|
const { fields, text, payload } = readObjectMessage(message);
|
|
1330
|
+
hideStackMessage(payload, text, (message2) => this.censorText({ key: "message", text: message2 }));
|
|
1228
1331
|
assignIfDefined(payload, "context", this.resolveContext(optionalParams));
|
|
1229
1332
|
const leading = isErrorLike(message) ? message : void 0;
|
|
1230
1333
|
assignIfDefined(payload, "err", leading ?? findErrorParam(optionalParams));
|
|
@@ -2655,32 +2758,6 @@ function censorRawHeaders(raw, sensitive, censor) {
|
|
|
2655
2758
|
});
|
|
2656
2759
|
}
|
|
2657
2760
|
|
|
2658
|
-
// src/server/utils/redact-error-clone.util.ts
|
|
2659
|
-
function shadowHook(target) {
|
|
2660
|
-
Reflect.defineProperty(target, "toJSON", { value: void 0, configurable: true });
|
|
2661
|
-
}
|
|
2662
|
-
function withoutEnumerableKeys(clone) {
|
|
2663
|
-
for (const key of Object.keys(clone)) Reflect.deleteProperty(clone, key);
|
|
2664
|
-
}
|
|
2665
|
-
function discardWrite() {
|
|
2666
|
-
}
|
|
2667
|
-
function cloneError(error) {
|
|
2668
|
-
const descriptors = Object.getOwnPropertyDescriptors(error);
|
|
2669
|
-
for (const descriptor of Object.values(descriptors)) {
|
|
2670
|
-
descriptor.configurable = true;
|
|
2671
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
2672
|
-
else descriptor.set ??= discardWrite;
|
|
2673
|
-
}
|
|
2674
|
-
const clone = Object.create(Object.getPrototypeOf(error), descriptors);
|
|
2675
|
-
const { stack } = error;
|
|
2676
|
-
if (typeof stack === "string") {
|
|
2677
|
-
Reflect.defineProperty(clone, "stack", { value: stack, enumerable: false, writable: true });
|
|
2678
|
-
}
|
|
2679
|
-
withoutEnumerableKeys(clone);
|
|
2680
|
-
shadowHook(clone);
|
|
2681
|
-
return clone;
|
|
2682
|
-
}
|
|
2683
|
-
|
|
2684
2761
|
// src/server/utils/redact-error-parts.util.ts
|
|
2685
2762
|
function defineOwn(target, key, value) {
|
|
2686
2763
|
Reflect.defineProperty(target, key, { value, enumerable: true, writable: true });
|
|
@@ -2733,6 +2810,10 @@ function walkChainPart(value, level, host, depth2) {
|
|
|
2733
2810
|
function cutOrWalk(value, level, host, depth2) {
|
|
2734
2811
|
return typeof value === "string" ? cutText(value) : walkChainPart(value, level, host, depth2);
|
|
2735
2812
|
}
|
|
2813
|
+
function writeName(value, level, host, depth2) {
|
|
2814
|
+
const censored = host.censorName(typeof value === "string" ? cutText(value) : value);
|
|
2815
|
+
return censored === value ? cutOrWalk(value, level, host, depth2) : censored;
|
|
2816
|
+
}
|
|
2736
2817
|
function addErrorParts(copy, error, ownKeys, host, depth2) {
|
|
2737
2818
|
const taken = new Set(ownKeys);
|
|
2738
2819
|
const level = linkDepths.get(error) ?? 0;
|
|
@@ -2752,7 +2833,7 @@ function addErrorParts(copy, error, ownKeys, host, depth2) {
|
|
|
2752
2833
|
host.nameKey,
|
|
2753
2834
|
[host.nameKey, "name"],
|
|
2754
2835
|
() => error.name,
|
|
2755
|
-
(name) =>
|
|
2836
|
+
(name) => writeName(name, level, host, depth2)
|
|
2756
2837
|
);
|
|
2757
2838
|
add(
|
|
2758
2839
|
"message",
|
|
@@ -2771,6 +2852,78 @@ function addErrorParts(copy, error, ownKeys, host, depth2) {
|
|
|
2771
2852
|
if (incomplete && !taken.has(INCOMPLETE_KEY)) defineOwn(copy, INCOMPLETE_KEY, true);
|
|
2772
2853
|
}
|
|
2773
2854
|
|
|
2855
|
+
// src/server/utils/error-text-exemption.util.ts
|
|
2856
|
+
var ERROR_TEXT_KEYS = /* @__PURE__ */ new Set(["message"]);
|
|
2857
|
+
function leavesErrorText(rules, key, value, honorToJson) {
|
|
2858
|
+
return rules.errorTextToSerializer && !honorToJson && key === "err" && !Array.isArray(value);
|
|
2859
|
+
}
|
|
2860
|
+
function rulesBelow(rules, key, value, honorToJson) {
|
|
2861
|
+
if (leavesErrorText(rules, key, value, honorToJson)) {
|
|
2862
|
+
return { ...rules, exemptKeys: ERROR_TEXT_KEYS };
|
|
2863
|
+
}
|
|
2864
|
+
return rules.exemptKeys === void 0 && rules.headerKept !== true ? rules : { ...rules, exemptKeys: void 0, headerKept: void 0 };
|
|
2865
|
+
}
|
|
2866
|
+
function isCensored(rules, key, value) {
|
|
2867
|
+
const lower = key.toLowerCase();
|
|
2868
|
+
return rules.sensitive.has(lower) && !(typeof value === "string" && rules.exemptKeys?.has(lower));
|
|
2869
|
+
}
|
|
2870
|
+
function messageCensor(rules) {
|
|
2871
|
+
return (text) => rules.sensitive.has("message") ? rules.censor : text;
|
|
2872
|
+
}
|
|
2873
|
+
function headerMessage(rules, source, keys, isError2) {
|
|
2874
|
+
if (isError2 || !rules.sensitive.has("message") || rules.exemptKeys?.has("message") === true)
|
|
2875
|
+
return void 0;
|
|
2876
|
+
if (rules.headerKept === true) return void 0;
|
|
2877
|
+
const key = keys.find((candidate) => foldKey(candidate) === "message");
|
|
2878
|
+
if (key === void 0 || !keys.some((candidate) => foldKey(candidate) === "stack")) {
|
|
2879
|
+
return void 0;
|
|
2880
|
+
}
|
|
2881
|
+
const text = Reflect.get(source, key);
|
|
2882
|
+
return typeof text === "string" ? { key, text } : void 0;
|
|
2883
|
+
}
|
|
2884
|
+
function readField(source, key, header) {
|
|
2885
|
+
return header !== void 0 && key === header.key ? header.text : Reflect.get(source, key);
|
|
2886
|
+
}
|
|
2887
|
+
function censorAnyName(rules, name) {
|
|
2888
|
+
if (typeof name === "string") return censorName(name, messageCensor(rules));
|
|
2889
|
+
const holder = typeof name === "object" && name !== null || typeof name === "function";
|
|
2890
|
+
return holder && rules.sensitive.has("message") ? rules.censor : name;
|
|
2891
|
+
}
|
|
2892
|
+
function errorTextField(rules, key, value, isError2, header) {
|
|
2893
|
+
if (header !== void 0 && foldKey(key) === "stack" && typeof value === "string") {
|
|
2894
|
+
return hideMessageInStack(value, header.text, rules.censor);
|
|
2895
|
+
}
|
|
2896
|
+
if (!isError2 || !ERROR_TEXT_FIELDS.has(key)) return value;
|
|
2897
|
+
const cut = cutIfText(value);
|
|
2898
|
+
return key === "name" ? censorAnyName(rules, cut) : cut;
|
|
2899
|
+
}
|
|
2900
|
+
|
|
2901
|
+
// src/server/utils/redact-error-clone.util.ts
|
|
2902
|
+
function shadowHook(target) {
|
|
2903
|
+
Reflect.defineProperty(target, "toJSON", { value: void 0, configurable: true });
|
|
2904
|
+
}
|
|
2905
|
+
function withoutEnumerableKeys(clone) {
|
|
2906
|
+
for (const key of Object.keys(clone)) Reflect.deleteProperty(clone, key);
|
|
2907
|
+
}
|
|
2908
|
+
function discardWrite() {
|
|
2909
|
+
}
|
|
2910
|
+
function cloneError(error) {
|
|
2911
|
+
const descriptors = Object.getOwnPropertyDescriptors(error);
|
|
2912
|
+
for (const descriptor of Object.values(descriptors)) {
|
|
2913
|
+
descriptor.configurable = true;
|
|
2914
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
2915
|
+
else descriptor.set ??= discardWrite;
|
|
2916
|
+
}
|
|
2917
|
+
const clone = Object.create(Object.getPrototypeOf(error), descriptors);
|
|
2918
|
+
const { stack } = error;
|
|
2919
|
+
if (typeof stack === "string") {
|
|
2920
|
+
Reflect.defineProperty(clone, "stack", { value: stack, enumerable: false, writable: true });
|
|
2921
|
+
}
|
|
2922
|
+
withoutEnumerableKeys(clone);
|
|
2923
|
+
shadowHook(clone);
|
|
2924
|
+
return clone;
|
|
2925
|
+
}
|
|
2926
|
+
|
|
2774
2927
|
// src/server/utils/redact-by-name.util.ts
|
|
2775
2928
|
var RAW_HEADER_KEYS = /* @__PURE__ */ new Set(["rawheaders", "rawtrailers"]);
|
|
2776
2929
|
function censorHeaderArray(key, walked, rules) {
|
|
@@ -2801,6 +2954,14 @@ function resolveToJson(value, viaGet = false) {
|
|
|
2801
2954
|
volatile: accessor || proxied
|
|
2802
2955
|
};
|
|
2803
2956
|
}
|
|
2957
|
+
function rulesInside(rules, names, visits) {
|
|
2958
|
+
return names === void 0 ? void 0 : { ...rules, sensitive: names, visits, insideErrors: void 0 };
|
|
2959
|
+
}
|
|
2960
|
+
var errorOutputs = /* @__PURE__ */ new WeakSet();
|
|
2961
|
+
function markErrorOutput(output) {
|
|
2962
|
+
if (typeof output === "object" && output !== null) errorOutputs.add(output);
|
|
2963
|
+
return output;
|
|
2964
|
+
}
|
|
2804
2965
|
function walkArray(value, rules, depth2, ancestors, inSerialized) {
|
|
2805
2966
|
const length = value.length;
|
|
2806
2967
|
const copy = [];
|
|
@@ -2887,13 +3048,13 @@ function walkToJsonOutput(value, toJson, rules, depth2, ancestors, inSerialized)
|
|
|
2887
3048
|
function walkProperties(value, rules, depth2, ancestors, honorToJson, inSerialized) {
|
|
2888
3049
|
const source = value;
|
|
2889
3050
|
const keys = Object.keys(source);
|
|
2890
|
-
const
|
|
2891
|
-
const asData = isError(value) && (safe || rules.errorsAsData && !inSerialized);
|
|
3051
|
+
const asData = isError(value) && (rules.ownFields.safe || rules.errorsAsData && !inSerialized);
|
|
2892
3052
|
const copy = startCopy(value, asData);
|
|
2893
|
-
const scrubbed = isError(value) && (safe || !inSerialized);
|
|
3053
|
+
const scrubbed = isError(value) && (rules.ownFields.safe || !inSerialized);
|
|
2894
3054
|
const omitted = /* @__PURE__ */ new Set();
|
|
3055
|
+
const header = headerMessage(rules, source, keys, isError(value));
|
|
2895
3056
|
for (const key of keys) {
|
|
2896
|
-
const read =
|
|
3057
|
+
const read = readField(source, key, header);
|
|
2897
3058
|
const current = scrubbed ? ownFieldForLog(source, key, read, rules.ownFields) : read;
|
|
2898
3059
|
const hook = honorToJson && key === "toJSON" && typeof current === "function";
|
|
2899
3060
|
if (current === OMIT_OWN_FIELD || hook) {
|
|
@@ -2904,10 +3065,10 @@ function walkProperties(value, rules, depth2, ancestors, honorToJson, inSerializ
|
|
|
2904
3065
|
defineOwn(
|
|
2905
3066
|
copy,
|
|
2906
3067
|
key,
|
|
2907
|
-
rules
|
|
3068
|
+
isCensored(rules, key, current) ? rules.censor : censorHeaderArray(
|
|
2908
3069
|
key,
|
|
2909
3070
|
walk(
|
|
2910
|
-
|
|
3071
|
+
errorTextField(rules, key, current, scrubbed, header),
|
|
2911
3072
|
rulesBelow(rules, key, current, honorToJson),
|
|
2912
3073
|
depth2 + 1,
|
|
2913
3074
|
ancestors,
|
|
@@ -2924,16 +3085,6 @@ function walkProperties(value, rules, depth2, ancestors, honorToJson, inSerializ
|
|
|
2924
3085
|
}
|
|
2925
3086
|
return copy;
|
|
2926
3087
|
}
|
|
2927
|
-
function leavesErrorText(rules, key, value, honorToJson) {
|
|
2928
|
-
return rules.errorTextToSerializer && !honorToJson && key === "err" && !isError(value) && isErrorLike(value);
|
|
2929
|
-
}
|
|
2930
|
-
function rulesBelow(rules, key, value, honorToJson) {
|
|
2931
|
-
if (leavesErrorText(rules, key, value, honorToJson)) {
|
|
2932
|
-
return { ...rules, exemptKeys: ERROR_TEXT_KEYS };
|
|
2933
|
-
}
|
|
2934
|
-
return rules.exemptKeys === void 0 ? rules : { ...rules, exemptKeys: void 0 };
|
|
2935
|
-
}
|
|
2936
|
-
var ERROR_TEXT_KEYS = /* @__PURE__ */ new Set(["message"]);
|
|
2937
3088
|
function without(keys, omitted) {
|
|
2938
3089
|
return keys.filter((key) => !omitted.has(key));
|
|
2939
3090
|
}
|
|
@@ -2948,6 +3099,7 @@ function errorPartsHost(rules, ancestors, inSerialized) {
|
|
|
2948
3099
|
// What a serializer receives names the error `name`, as the error-like shape it reads does;
|
|
2949
3100
|
// everything else keeps the `type` the written entries use.
|
|
2950
3101
|
nameKey: inSerialized ? "name" : "type",
|
|
3102
|
+
censorName: (name) => censorAnyName(rules, name),
|
|
2951
3103
|
walk: (value, depth2) => walk(value, rules, depth2, ancestors, true, inSerialized),
|
|
2952
3104
|
// Under 'safe' the cap does not read a list's `toJSON`: a list over the cap becomes a fresh array
|
|
2953
3105
|
// and is never read for it, and a list within the cap is read once, by the walk.
|
|
@@ -2971,8 +3123,9 @@ function createNameRedactor(fieldNames, censor, serializedKeys, maxVisits = REDA
|
|
|
2971
3123
|
const visits = { count: 0 };
|
|
2972
3124
|
const call = {
|
|
2973
3125
|
...rules,
|
|
3126
|
+
headerKept: typeof value === "object" && value !== null && errorOutputs.has(value),
|
|
2974
3127
|
visits,
|
|
2975
|
-
insideErrors:
|
|
3128
|
+
insideErrors: rulesInside(rules, insideNames, visits)
|
|
2976
3129
|
};
|
|
2977
3130
|
return walk(value, call, 0, /* @__PURE__ */ new Set(), !isRecordRoot);
|
|
2978
3131
|
} catch {
|
|
@@ -3123,8 +3276,9 @@ function deriveExceptionFields(record, maxBytes, onCut, censorMessage, redactSta
|
|
|
3123
3276
|
if (header !== void 0) {
|
|
3124
3277
|
record["exception.message"] = bounded(cutText(header.censored));
|
|
3125
3278
|
}
|
|
3126
|
-
|
|
3127
|
-
|
|
3279
|
+
const stack = candidate?.stack;
|
|
3280
|
+
if (typeof candidate?.name === "string" && typeof message === "string" && typeof stack === "string") {
|
|
3281
|
+
record["exception.stacktrace"] = bounded(redactStack(scrubStack(stack, header)));
|
|
3128
3282
|
}
|
|
3129
3283
|
}
|
|
3130
3284
|
function withSemconvException(record, format, maxBytes = Number.POSITIVE_INFINITY, onCut, censorMessage = (text) => text, redactStack = (stack) => stack) {
|
|
@@ -3342,7 +3496,7 @@ function buildSerializers(options, redactSerialized, ownFields, onTruncate) {
|
|
|
3342
3496
|
() => onTruncate("max_entry_size")
|
|
3343
3497
|
);
|
|
3344
3498
|
return {
|
|
3345
|
-
err: bound((error) => serializeErrorValue(error, ownFields, censorMessage)),
|
|
3499
|
+
err: bound((error) => markErrorOutput(serializeErrorValue(error, ownFields, censorMessage))),
|
|
3346
3500
|
...Object.fromEntries(
|
|
3347
3501
|
Object.entries(options.serializers).map(
|
|
3348
3502
|
([key, serializer]) => [key, bound(serializer)]
|
|
@@ -4247,8 +4401,10 @@ var BymaxLoggerModule = class extends BymaxLoggerModuleBase {
|
|
|
4247
4401
|
* BymaxLoggerModule.forRoot({ service: { name: 'api', version: '1.0.0' } })
|
|
4248
4402
|
*/
|
|
4249
4403
|
static forRoot(options) {
|
|
4250
|
-
|
|
4251
|
-
|
|
4404
|
+
const resolved = guardOptions(() => {
|
|
4405
|
+
validateOptions(options);
|
|
4406
|
+
return applyDefaults(options);
|
|
4407
|
+
});
|
|
4252
4408
|
const providers = [
|
|
4253
4409
|
{ provide: LOGGER_OPTIONS_TOKEN, useValue: resolved },
|
|
4254
4410
|
...buildCommonProviders()
|
|
@@ -4259,7 +4415,10 @@ var BymaxLoggerModule = class extends BymaxLoggerModuleBase {
|
|
|
4259
4415
|
providers.push({ provide: APP_FILTER, useClass: HttpExceptionFilter });
|
|
4260
4416
|
}
|
|
4261
4417
|
}
|
|
4262
|
-
return augmentLoggerModule(
|
|
4418
|
+
return augmentLoggerModule(
|
|
4419
|
+
guardOptions(() => super.forRoot(options)),
|
|
4420
|
+
providers
|
|
4421
|
+
);
|
|
4263
4422
|
}
|
|
4264
4423
|
/**
|
|
4265
4424
|
* Asynchronous registration. Options are resolved lazily via the consumer's
|
|
@@ -4289,8 +4448,10 @@ var BymaxLoggerModule = class extends BymaxLoggerModuleBase {
|
|
|
4289
4448
|
{
|
|
4290
4449
|
provide: LOGGER_OPTIONS_TOKEN,
|
|
4291
4450
|
useFactory: (raw) => {
|
|
4292
|
-
|
|
4293
|
-
|
|
4451
|
+
return guardOptions(() => {
|
|
4452
|
+
validateOptions(raw);
|
|
4453
|
+
return applyDefaults(raw);
|
|
4454
|
+
});
|
|
4294
4455
|
},
|
|
4295
4456
|
inject: [BUILDER_OPTIONS_TOKEN]
|
|
4296
4457
|
},
|
|
@@ -4299,7 +4460,10 @@ var BymaxLoggerModule = class extends BymaxLoggerModuleBase {
|
|
|
4299
4460
|
// gated at runtime against the async-resolved `http.isEnabled`.
|
|
4300
4461
|
asyncHttpInterceptorProvider()
|
|
4301
4462
|
];
|
|
4302
|
-
return augmentLoggerModule(
|
|
4463
|
+
return augmentLoggerModule(
|
|
4464
|
+
guardOptions(() => super.forRootAsync(options)),
|
|
4465
|
+
providers
|
|
4466
|
+
);
|
|
4303
4467
|
}
|
|
4304
4468
|
/**
|
|
4305
4469
|
* Replace NestJS's internal logger with this library's `PinoLoggerService` and
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bymax-one/nest-logger",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.27",
|
|
4
4
|
"description": "Structured JSON logging for NestJS based on Pino 10, with optional OpenTelemetry correlation.",
|
|
5
5
|
"author": "Bymax One <support@bymax.one>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -77,10 +77,11 @@
|
|
|
77
77
|
"check:file-length": "node scripts/check-file-length.mjs",
|
|
78
78
|
"check:function-length": "node scripts/check-function-length.mjs",
|
|
79
79
|
"check:spec-headers": "node scripts/check-spec-headers.mjs",
|
|
80
|
+
"check:property-path": "node scripts/check-have-property-path.mjs",
|
|
80
81
|
"check:suppressions": "node scripts/check-suppressions-baseline.mjs",
|
|
81
82
|
"clean": "rm -rf dist coverage",
|
|
82
83
|
"check:socket-gate": "node scripts/check-socket-gate.mjs",
|
|
83
|
-
"lint": "eslint src scripts test bench '*.config.ts' '*.config.mjs' '*.config.cjs' && pnpm check:socket-gate && pnpm check:spec-headers && node --test scripts/check-spec-headers.test.mjs && node --test scripts/check-suppressions-baseline.test.mjs",
|
|
84
|
+
"lint": "eslint src scripts test bench '*.config.ts' '*.config.mjs' '*.config.cjs' && pnpm check:socket-gate && pnpm check:spec-headers && node --test scripts/check-spec-headers.test.mjs && node --test scripts/check-suppressions-baseline.test.mjs && pnpm check:property-path && node --test scripts/check-have-property-path.test.mjs",
|
|
84
85
|
"lint:fix": "eslint src scripts test bench '*.config.ts' '*.config.mjs' '*.config.cjs' --fix",
|
|
85
86
|
"mutation": "stryker run",
|
|
86
87
|
"mutation:full": "node -e \"require('node:fs').rmSync('reports/stryker-incremental.json',{force:true,recursive:true})\" && stryker run",
|