@geekmidas/logger 10.0.0-alpha.99 → 10.0.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.
Files changed (72) hide show
  1. package/CHANGELOG.md +48 -0
  2. package/dist/console.cjs +25 -24
  3. package/dist/console.cjs.map +1 -1
  4. package/dist/console.d.cts +7 -4
  5. package/dist/console.d.cts.map +1 -1
  6. package/dist/console.d.mts +7 -4
  7. package/dist/console.d.mts.map +1 -1
  8. package/dist/console.mjs +25 -23
  9. package/dist/console.mjs.map +1 -1
  10. package/dist/index.cjs +3 -3
  11. package/dist/index.d.cts +2 -2
  12. package/dist/index.d.mts +2 -2
  13. package/dist/index.mjs +3 -2
  14. package/dist/pino.cjs +39 -67
  15. package/dist/pino.cjs.map +1 -1
  16. package/dist/pino.d.cts +12 -9
  17. package/dist/pino.d.cts.map +1 -1
  18. package/dist/pino.d.mts +12 -9
  19. package/dist/pino.d.mts.map +1 -1
  20. package/dist/pino.mjs +16 -66
  21. package/dist/pino.mjs.map +1 -1
  22. package/dist/redact-paths-CsK0_uz-.d.cts +19 -0
  23. package/dist/redact-paths-CsK0_uz-.d.cts.map +1 -0
  24. package/dist/redact-paths-D07eTMlH.d.mts +19 -0
  25. package/dist/redact-paths-D07eTMlH.d.mts.map +1 -0
  26. package/dist/redact-paths-D0m0DIuQ.cjs +73 -0
  27. package/dist/redact-paths-D0m0DIuQ.cjs.map +1 -0
  28. package/dist/redact-paths-DQoIXhkS.mjs +67 -0
  29. package/dist/redact-paths-DQoIXhkS.mjs.map +1 -0
  30. package/dist/redact-paths.cjs +2 -116
  31. package/dist/redact-paths.d.cts +2 -31
  32. package/dist/redact-paths.d.mts +2 -31
  33. package/dist/redact-paths.mjs +2 -113
  34. package/dist/types-BDdpcrpy.d.mts +166 -0
  35. package/dist/types-BDdpcrpy.d.mts.map +1 -0
  36. package/dist/types-Dk_k2-f_.d.cts +166 -0
  37. package/dist/types-Dk_k2-f_.d.cts.map +1 -0
  38. package/dist/types-ag_0Cvbg.cjs +38 -0
  39. package/dist/types-ag_0Cvbg.cjs.map +1 -0
  40. package/dist/types-yQ6XOihF.mjs +32 -0
  41. package/dist/types-yQ6XOihF.mjs.map +1 -0
  42. package/dist/types.cjs +2 -32
  43. package/dist/types.d.cts +2 -175
  44. package/dist/types.d.mts +2 -175
  45. package/dist/types.mjs +2 -31
  46. package/package.json +5 -35
  47. package/src/__tests__/console.spec.ts +661 -0
  48. package/src/__tests__/pino-redaction.integration.spec.ts +307 -0
  49. package/src/__tests__/pino.spec.ts +355 -0
  50. package/src/console.ts +165 -0
  51. package/src/index.ts +7 -0
  52. package/src/pino.ts +129 -0
  53. package/src/redact-paths.ts +71 -0
  54. package/src/types.ts +167 -0
  55. package/tsconfig.json +9 -0
  56. package/tsdown.config.ts +3 -0
  57. package/dist/otel.cjs +0 -113
  58. package/dist/otel.cjs.map +0 -1
  59. package/dist/otel.d.cts +0 -31
  60. package/dist/otel.d.cts.map +0 -1
  61. package/dist/otel.d.mts +0 -31
  62. package/dist/otel.d.mts.map +0 -1
  63. package/dist/otel.mjs +0 -110
  64. package/dist/otel.mjs.map +0 -1
  65. package/dist/redact-paths.cjs.map +0 -1
  66. package/dist/redact-paths.d.cts.map +0 -1
  67. package/dist/redact-paths.d.mts.map +0 -1
  68. package/dist/redact-paths.mjs.map +0 -1
  69. package/dist/types.cjs.map +0 -1
  70. package/dist/types.d.cts.map +0 -1
  71. package/dist/types.d.mts.map +0 -1
  72. package/dist/types.mjs.map +0 -1
package/dist/pino.d.cts CHANGED
@@ -1,7 +1,9 @@
1
- import { CreateLoggerOptions } from "./types.cjs";
2
- import { DEFAULT_REDACT_PATHS } from "./redact-paths.cjs";
3
- import { Logger } from "pino";
1
+ import { CreateLoggerOptions } from "./types-Dk_k2-f_.cjs";
2
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-CsK0_uz-.cjs";
3
+ import * as pino0 from "pino";
4
+
4
5
  //#region src/pino.d.ts
6
+
5
7
  /**
6
8
  * Creates a pino logger instance with optional redaction support.
7
9
  *
@@ -10,17 +12,18 @@ import { Logger } from "pino";
10
12
  *
11
13
  * @example
12
14
  * ```typescript
13
- * // Basic logger — sensitive paths are redacted by default
15
+ * // Basic logger
14
16
  * const logger = createLogger({ level: 'debug' });
15
17
  *
16
- * // Opt out of redaction
17
- * const rawLogger = createLogger({ redact: false });
18
+ * // With redaction enabled
19
+ * const secureLogger = createLogger({ redact: true });
18
20
  *
19
21
  * // Pretty printing in development
20
- * const devLogger = createLogger({ pretty: true });
22
+ * const devLogger = createLogger({ pretty: true, redact: true });
21
23
  * ```
22
24
  */
23
- export declare function createLogger(options?: CreateLoggerOptions): Logger<never, boolean>;
25
+ declare function createLogger(options?: CreateLoggerOptions): pino0.Logger<never, boolean>;
26
+ //# sourceMappingURL=pino.d.ts.map
24
27
  //#endregion
25
- export { DEFAULT_REDACT_PATHS };
28
+ export { DEFAULT_REDACT_PATHS, createLogger };
26
29
  //# sourceMappingURL=pino.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pino.d.cts","names":[],"sources":["../src/pino.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;wBA+GgB,aAAa,UAAS,sBAAwB"}
1
+ {"version":3,"file":"pino.d.cts","names":[],"sources":["../src/pino.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAqGA;;;;AAA8D;;;;;;;;;;;iBAA9C,YAAA,WAAsB,sBAAwB,KAAA,CAAA"}
package/dist/pino.d.mts CHANGED
@@ -1,7 +1,9 @@
1
- import { CreateLoggerOptions } from "./types.mjs";
2
- import { DEFAULT_REDACT_PATHS } from "./redact-paths.mjs";
3
- import { Logger } from "pino";
1
+ import { CreateLoggerOptions } from "./types-BDdpcrpy.mjs";
2
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-D07eTMlH.mjs";
3
+ import * as pino0 from "pino";
4
+
4
5
  //#region src/pino.d.ts
6
+
5
7
  /**
6
8
  * Creates a pino logger instance with optional redaction support.
7
9
  *
@@ -10,17 +12,18 @@ import { Logger } from "pino";
10
12
  *
11
13
  * @example
12
14
  * ```typescript
13
- * // Basic logger — sensitive paths are redacted by default
15
+ * // Basic logger
14
16
  * const logger = createLogger({ level: 'debug' });
15
17
  *
16
- * // Opt out of redaction
17
- * const rawLogger = createLogger({ redact: false });
18
+ * // With redaction enabled
19
+ * const secureLogger = createLogger({ redact: true });
18
20
  *
19
21
  * // Pretty printing in development
20
- * const devLogger = createLogger({ pretty: true });
22
+ * const devLogger = createLogger({ pretty: true, redact: true });
21
23
  * ```
22
24
  */
23
- export declare function createLogger(options?: CreateLoggerOptions): Logger<never, boolean>;
25
+ declare function createLogger(options?: CreateLoggerOptions): pino0.Logger<never, boolean>;
26
+ //# sourceMappingURL=pino.d.ts.map
24
27
  //#endregion
25
- export { DEFAULT_REDACT_PATHS };
28
+ export { DEFAULT_REDACT_PATHS, createLogger };
26
29
  //# sourceMappingURL=pino.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pino.d.mts","names":[],"sources":["../src/pino.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;wBA+GgB,aAAa,UAAS,sBAAwB"}
1
+ {"version":3,"file":"pino.d.mts","names":[],"sources":["../src/pino.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAqGA;;;;AAA8D;;;;;;;;;;;iBAA9C,YAAA,WAAsB,sBAAwB,KAAA,CAAA"}
package/dist/pino.mjs CHANGED
@@ -1,53 +1,21 @@
1
- import { otelStreamWrite } from "./otel.mjs";
2
- import { DEFAULT_REDACT_PATHS, redactUrlCredentials, redactUrlCredentialsIn } from "./redact-paths.mjs";
3
- import { pino, stdSerializers } from "pino";
1
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-DQoIXhkS.mjs";
2
+ import { pino } from "pino";
3
+
4
4
  //#region src/pino.ts
5
5
  /**
6
- * Pino logger with built-in redaction support for sensitive data.
7
- *
8
- * Redaction is on by default: a logger that was never told about passwords
9
- * and tokens still masks them. `redact: false` is the explicit opt-out.
10
- *
11
- * @example
12
- * ```typescript
13
- * import { createLogger, DEFAULT_REDACT_PATHS } from '@geekmidas/logger/pino';
14
- *
15
- * // Redaction with sensible defaults — the same as `redact: true`
16
- * const logger = createLogger();
17
- *
18
- * // Sensitive data is automatically masked
19
- * logger.info({ password: 'secret123', user: 'john' }, 'Login');
20
- * // Output: { password: '[Redacted]', user: 'john' } Login
21
- *
22
- * // Add custom paths (merged with defaults)
23
- * const logger2 = createLogger({ redact: ['user.ssn'] });
24
- *
25
- * // Override defaults for full control
26
- * const logger3 = createLogger({
27
- * redact: {
28
- * paths: ['onlyThis'],
29
- * resolution: 'override',
30
- * }
31
- * });
32
- * ```
33
- *
34
- * @module
35
- */
36
- /**
37
6
  * Resolves redaction configuration from options.
38
- * Returns undefined only when redaction is turned off with `false`; leaving it
39
- * unset is the same as `true`, so sensitive paths are masked unless someone
40
- * decides they should not be.
7
+ * Returns undefined if redaction is disabled, or a pino-compatible redact config.
41
8
  *
42
9
  * By default (resolution: 'merge'), custom paths are merged with DEFAULT_REDACT_PATHS.
43
10
  * With resolution: 'override', only the custom paths are used.
44
11
  */
45
12
  function resolveRedactConfig(redact) {
46
- if (redact === false) return;
47
- if (redact === void 0 || redact === true) return DEFAULT_REDACT_PATHS;
13
+ if (redact === void 0 || redact === false) return void 0;
14
+ if (redact === true) return DEFAULT_REDACT_PATHS;
48
15
  if (Array.isArray(redact)) return [...DEFAULT_REDACT_PATHS, ...redact];
49
16
  const { resolution = "merge", paths, censor, remove } = redact;
50
- const config = { paths: resolution === "override" ? paths : [...DEFAULT_REDACT_PATHS, ...paths] };
17
+ const resolvedPaths = resolution === "override" ? paths : [...DEFAULT_REDACT_PATHS, ...paths];
18
+ const config = { paths: resolvedPaths };
51
19
  if (censor !== void 0) config.censor = censor;
52
20
  if (remove !== void 0) config.remove = remove;
53
21
  return config;
@@ -60,45 +28,28 @@ function resolveRedactConfig(redact) {
60
28
  *
61
29
  * @example
62
30
  * ```typescript
63
- * // Basic logger — sensitive paths are redacted by default
31
+ * // Basic logger
64
32
  * const logger = createLogger({ level: 'debug' });
65
33
  *
66
- * // Opt out of redaction
67
- * const rawLogger = createLogger({ redact: false });
34
+ * // With redaction enabled
35
+ * const secureLogger = createLogger({ redact: true });
68
36
  *
69
37
  * // Pretty printing in development
70
- * const devLogger = createLogger({ pretty: true });
38
+ * const devLogger = createLogger({ pretty: true, redact: true });
71
39
  * ```
72
40
  */
73
41
  function createLogger(options = {}) {
74
- const pretty = options?.pretty && process.env.NODE_ENV !== "production";
42
+ const pretty = options?.pretty && process.NODE_ENV !== "production";
75
43
  const baseOptions = pretty ? { transport: {
76
44
  target: "pino-pretty",
77
45
  options: { colorize: true }
78
46
  } } : {};
79
47
  const redact = resolveRedactConfig(options.redact);
80
- const serializeError = (value) => {
81
- const serialized = stdSerializers.err(value);
82
- if (!redact || serialized === value) return serialized;
83
- return redactUrlCredentialsIn({ ...serialized });
84
- };
85
- const pinoOptions = {
48
+ return pino({
86
49
  ...baseOptions,
87
50
  ...options.level && { level: options.level },
88
51
  ...redact && { redact },
89
- serializers: {
90
- err: serializeError,
91
- error: serializeError
92
- },
93
- hooks: {
94
- ...redact && { logMethod(args, method) {
95
- const redacted = args.map((arg) => typeof arg === "string" ? redactUrlCredentials(arg) : arg);
96
- return method.apply(this, redacted);
97
- } },
98
- streamWrite: otelStreamWrite
99
- },
100
52
  formatters: {
101
- ...redact && { log: (object) => redactUrlCredentialsIn(object) },
102
53
  bindings() {
103
54
  return { nodeVersion: process.version };
104
55
  },
@@ -106,10 +57,9 @@ function createLogger(options = {}) {
106
57
  return { level: label.toUpperCase() };
107
58
  }
108
59
  }
109
- };
110
- return options.destination && !pretty ? pino(pinoOptions, options.destination) : pino(pinoOptions);
60
+ });
111
61
  }
62
+
112
63
  //#endregion
113
64
  export { DEFAULT_REDACT_PATHS, createLogger };
114
-
115
65
  //# sourceMappingURL=pino.mjs.map
package/dist/pino.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"pino.mjs","names":[],"sources":["../src/pino.ts"],"sourcesContent":["/**\n * Pino logger with built-in redaction support for sensitive data.\n *\n * Redaction is on by default: a logger that was never told about passwords\n * and tokens still masks them. `redact: false` is the explicit opt-out.\n *\n * @example\n * ```typescript\n * import { createLogger, DEFAULT_REDACT_PATHS } from '@geekmidas/logger/pino';\n *\n * // Redaction with sensible defaults — the same as `redact: true`\n * const logger = createLogger();\n *\n * // Sensitive data is automatically masked\n * logger.info({ password: 'secret123', user: 'john' }, 'Login');\n * // Output: { password: '[Redacted]', user: 'john' } Login\n *\n * // Add custom paths (merged with defaults)\n * const logger2 = createLogger({ redact: ['user.ssn'] });\n *\n * // Override defaults for full control\n * const logger3 = createLogger({\n * redact: {\n * paths: ['onlyThis'],\n * resolution: 'override',\n * }\n * });\n * ```\n *\n * @module\n */\nimport { type LogFn, type Logger, pino, stdSerializers } from 'pino';\nimport { otelStreamWrite } from './otel';\nimport {\n\tDEFAULT_REDACT_PATHS,\n\tredactUrlCredentials,\n\tredactUrlCredentialsIn,\n} from './redact-paths';\nimport type { CreateLoggerOptions, RedactOptions } from './types';\n\n// Re-export for backwards compatibility\nexport { DEFAULT_REDACT_PATHS } from './redact-paths';\n\n/**\n * Type for the resolved pino redact config (without our custom resolution field).\n */\ntype PinoRedactConfig =\n\t| string[]\n\t| {\n\t\t\tpaths: string[];\n\t\t\tcensor?: string | ((value: unknown, path: string[]) => unknown);\n\t\t\tremove?: boolean;\n\t };\n\n/**\n * Resolves redaction configuration from options.\n * Returns undefined only when redaction is turned off with `false`; leaving it\n * unset is the same as `true`, so sensitive paths are masked unless someone\n * decides they should not be.\n *\n * By default (resolution: 'merge'), custom paths are merged with DEFAULT_REDACT_PATHS.\n * With resolution: 'override', only the custom paths are used.\n */\nfunction resolveRedactConfig(\n\tredact: boolean | RedactOptions | undefined,\n): PinoRedactConfig | undefined {\n\tif (redact === false) {\n\t\treturn undefined;\n\t}\n\n\tif (redact === undefined || redact === true) {\n\t\treturn DEFAULT_REDACT_PATHS;\n\t}\n\n\t// Array syntax - merge with defaults\n\tif (Array.isArray(redact)) {\n\t\treturn [...DEFAULT_REDACT_PATHS, ...redact];\n\t}\n\n\t// Object syntax - check resolution mode\n\tconst { resolution = 'merge', paths, censor, remove } = redact;\n\n\tconst resolvedPaths =\n\t\tresolution === 'override' ? paths : [...DEFAULT_REDACT_PATHS, ...paths];\n\n\t// Return clean pino config without our resolution field\n\tconst config: PinoRedactConfig = { paths: resolvedPaths };\n\tif (censor !== undefined) config.censor = censor;\n\tif (remove !== undefined) config.remove = remove;\n\n\treturn config;\n}\n\n/**\n * Creates a pino logger instance with optional redaction support.\n *\n * @param options - Logger configuration options\n * @returns A configured pino logger instance\n *\n * @example\n * ```typescript\n * // Basic logger — sensitive paths are redacted by default\n * const logger = createLogger({ level: 'debug' });\n *\n * // Opt out of redaction\n * const rawLogger = createLogger({ redact: false });\n *\n * // Pretty printing in development\n * const devLogger = createLogger({ pretty: true });\n * ```\n */\nexport function createLogger(options: CreateLoggerOptions = {}) {\n\t// Pretty printing spawns a transport worker and writes for humans; in\n\t// production the output is for a log pipeline, so `pretty` is ignored there.\n\tconst pretty = options?.pretty && process.env.NODE_ENV !== 'production';\n\tconst baseOptions = pretty\n\t\t? {\n\t\t\t\ttransport: {\n\t\t\t\t\ttarget: 'pino-pretty',\n\t\t\t\t\toptions: { colorize: true },\n\t\t\t\t},\n\t\t\t}\n\t\t: {};\n\n\tconst redact = resolveRedactConfig(options.redact);\n\n\t// An Error is serialized only under a key pino has a serializer for — `err`\n\t// by default — and anything else is JSON.stringify'd, which an Error survives\n\t// as `{}`: no message, no stack. `logger.error({ error }, …)` is how most\n\t// code writes it, so `error` gets the same serializer as `err`.\n\t//\n\t// The serialized copy is a plain object, so URL credentials in the message\n\t// or the stack are masked like any other field; path redaction runs after\n\t// serializers, so `err.message` and `error.stack` are paths it can reach.\n\tconst serializeError = (value: unknown) => {\n\t\tconst serialized = stdSerializers.err(value as Error);\n\t\tif (!redact || serialized === value) return serialized;\n\t\treturn redactUrlCredentialsIn({ ...serialized });\n\t};\n\n\tconst pinoOptions = {\n\t\t...baseOptions,\n\t\t...(options.level && { level: options.level }),\n\t\t...(redact && { redact }),\n\t\tserializers: { err: serializeError, error: serializeError },\n\t\thooks: {\n\t\t\t// Redaction also masks the credentials of any URL, in any field or\n\t\t\t// in the message: `s3://KEY:SECRET@uploads` is logged with its\n\t\t\t// secret under a name no path list can predict.\n\t\t\t...(redact && {\n\t\t\t\tlogMethod(this: Logger, args: Parameters<LogFn>, method: LogFn) {\n\t\t\t\t\tconst redacted = args.map((arg) =>\n\t\t\t\t\t\ttypeof arg === 'string' ? redactUrlCredentials(arg) : arg,\n\t\t\t\t\t) as Parameters<LogFn>;\n\t\t\t\t\treturn method.apply(this, redacted);\n\t\t\t\t},\n\t\t\t}),\n\t\t\t// Each line, once redacted and serialized, also goes to\n\t\t\t// OpenTelemetry when a LoggerProvider is registered. On the calling\n\t\t\t// thread, before any transport, so the active span is the caller's.\n\t\t\tstreamWrite: otelStreamWrite,\n\t\t},\n\t\tformatters: {\n\t\t\t...(redact && {\n\t\t\t\tlog: (object: Record<string, unknown>) =>\n\t\t\t\t\tredactUrlCredentialsIn(object),\n\t\t\t}),\n\t\t\tbindings() {\n\t\t\t\treturn { nodeVersion: process.version };\n\t\t\t},\n\t\t\tlevel: (label: string) => {\n\t\t\t\treturn { level: label.toUpperCase() };\n\t\t\t},\n\t\t},\n\t};\n\n\t// A transport writes on its own worker, so a destination only applies when\n\t// the logger is not pretty-printing.\n\treturn options.destination && !pretty\n\t\t? pino(pinoOptions, options.destination)\n\t\t: pino(pinoOptions);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,SAAS,oBACR,QAC+B;CAC/B,IAAI,WAAW,OACd;CAGD,IAAI,WAAW,KAAA,KAAa,WAAW,MACtC,OAAO;CAIR,IAAI,MAAM,QAAQ,MAAM,GACvB,OAAO,CAAC,GAAG,sBAAsB,GAAG,MAAM;CAI3C,MAAM,EAAE,aAAa,SAAS,OAAO,QAAQ,WAAW;CAMxD,MAAM,SAA2B,EAAE,OAHlC,eAAe,aAAa,QAAQ,CAAC,GAAG,sBAAsB,GAAG,KAAK,EAGf;CACxD,IAAI,WAAW,KAAA,GAAW,OAAO,SAAS;CAC1C,IAAI,WAAW,KAAA,GAAW,OAAO,SAAS;CAE1C,OAAO;AACR;;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,aAAa,UAA+B,CAAC,GAAG;CAG/D,MAAM,SAAS,SAAS,UAAU,QAAQ,IAAI,aAAa;CAC3D,MAAM,cAAc,SACjB,EACA,WAAW;EACV,QAAQ;EACR,SAAS,EAAE,UAAU,KAAK;CAC3B,EACD,IACC,CAAC;CAEJ,MAAM,SAAS,oBAAoB,QAAQ,MAAM;CAUjD,MAAM,kBAAkB,UAAmB;EAC1C,MAAM,aAAa,eAAe,IAAI,KAAc;EACpD,IAAI,CAAC,UAAU,eAAe,OAAO,OAAO;EAC5C,OAAO,uBAAuB,EAAE,GAAG,WAAW,CAAC;CAChD;CAEA,MAAM,cAAc;EACnB,GAAG;EACH,GAAI,QAAQ,SAAS,EAAE,OAAO,QAAQ,MAAM;EAC5C,GAAI,UAAU,EAAE,OAAO;EACvB,aAAa;GAAE,KAAK;GAAgB,OAAO;EAAe;EAC1D,OAAO;GAIN,GAAI,UAAU,EACb,UAAwB,MAAyB,QAAe;IAC/D,MAAM,WAAW,KAAK,KAAK,QAC1B,OAAO,QAAQ,WAAW,qBAAqB,GAAG,IAAI,GACvD;IACA,OAAO,OAAO,MAAM,MAAM,QAAQ;GACnC,EACD;GAIA,aAAa;EACd;EACA,YAAY;GACX,GAAI,UAAU,EACb,MAAM,WACL,uBAAuB,MAAM,EAC/B;GACA,WAAW;IACV,OAAO,EAAE,aAAa,QAAQ,QAAQ;GACvC;GACA,QAAQ,UAAkB;IACzB,OAAO,EAAE,OAAO,MAAM,YAAY,EAAE;GACrC;EACD;CACD;CAIA,OAAO,QAAQ,eAAe,CAAC,SAC5B,KAAK,aAAa,QAAQ,WAAW,IACrC,KAAK,WAAW;AACpB"}
1
+ {"version":3,"file":"pino.mjs","names":["redact: boolean | RedactOptions | undefined","config: PinoRedactConfig","options: CreateLoggerOptions"],"sources":["../src/pino.ts"],"sourcesContent":["/**\n * Pino logger with built-in redaction support for sensitive data.\n *\n * @example\n * ```typescript\n * import { createLogger, DEFAULT_REDACT_PATHS } from '@geekmidas/logger/pino';\n *\n * // Enable redaction with sensible defaults\n * const logger = createLogger({ redact: true });\n *\n * // Sensitive data is automatically masked\n * logger.info({ password: 'secret123', user: 'john' }, 'Login');\n * // Output: { password: '[Redacted]', user: 'john' } Login\n *\n * // Add custom paths (merged with defaults)\n * const logger2 = createLogger({ redact: ['user.ssn'] });\n *\n * // Override defaults for full control\n * const logger3 = createLogger({\n * redact: {\n * paths: ['onlyThis'],\n * resolution: 'override',\n * }\n * });\n * ```\n *\n * @module\n */\nimport { pino } from 'pino';\nimport { DEFAULT_REDACT_PATHS } from './redact-paths';\nimport type { CreateLoggerOptions, RedactOptions } from './types';\n\n// Re-export for backwards compatibility\nexport { DEFAULT_REDACT_PATHS } from './redact-paths';\n\n/**\n * Type for the resolved pino redact config (without our custom resolution field).\n */\ntype PinoRedactConfig =\n\t| string[]\n\t| {\n\t\t\tpaths: string[];\n\t\t\tcensor?: string | ((value: unknown, path: string[]) => unknown);\n\t\t\tremove?: boolean;\n\t };\n\n/**\n * Resolves redaction configuration from options.\n * Returns undefined if redaction is disabled, or a pino-compatible redact config.\n *\n * By default (resolution: 'merge'), custom paths are merged with DEFAULT_REDACT_PATHS.\n * With resolution: 'override', only the custom paths are used.\n */\nfunction resolveRedactConfig(\n\tredact: boolean | RedactOptions | undefined,\n): PinoRedactConfig | undefined {\n\tif (redact === undefined || redact === false) {\n\t\treturn undefined;\n\t}\n\n\tif (redact === true) {\n\t\treturn DEFAULT_REDACT_PATHS;\n\t}\n\n\t// Array syntax - merge with defaults\n\tif (Array.isArray(redact)) {\n\t\treturn [...DEFAULT_REDACT_PATHS, ...redact];\n\t}\n\n\t// Object syntax - check resolution mode\n\tconst { resolution = 'merge', paths, censor, remove } = redact;\n\n\tconst resolvedPaths =\n\t\tresolution === 'override' ? paths : [...DEFAULT_REDACT_PATHS, ...paths];\n\n\t// Return clean pino config without our resolution field\n\tconst config: PinoRedactConfig = { paths: resolvedPaths };\n\tif (censor !== undefined) config.censor = censor;\n\tif (remove !== undefined) config.remove = remove;\n\n\treturn config;\n}\n\n/**\n * Creates a pino logger instance with optional redaction support.\n *\n * @param options - Logger configuration options\n * @returns A configured pino logger instance\n *\n * @example\n * ```typescript\n * // Basic logger\n * const logger = createLogger({ level: 'debug' });\n *\n * // With redaction enabled\n * const secureLogger = createLogger({ redact: true });\n *\n * // Pretty printing in development\n * const devLogger = createLogger({ pretty: true, redact: true });\n * ```\n */\nexport function createLogger(options: CreateLoggerOptions = {}) {\n\t// @ts-expect-error\n\tconst pretty = options?.pretty && process.NODE_ENV !== 'production';\n\tconst baseOptions = pretty\n\t\t? {\n\t\t\t\ttransport: {\n\t\t\t\t\ttarget: 'pino-pretty',\n\t\t\t\t\toptions: { colorize: true },\n\t\t\t\t},\n\t\t\t}\n\t\t: {};\n\n\tconst redact = resolveRedactConfig(options.redact);\n\n\treturn pino({\n\t\t...baseOptions,\n\t\t...(options.level && { level: options.level }),\n\t\t...(redact && { redact }),\n\t\tformatters: {\n\t\t\tbindings() {\n\t\t\t\treturn { nodeVersion: process.version };\n\t\t\t},\n\t\t\tlevel: (label) => {\n\t\t\t\treturn { level: label.toUpperCase() };\n\t\t\t},\n\t\t},\n\t});\n}\n"],"mappings":";;;;;;;;;;;AAqDA,SAAS,oBACRA,QAC+B;AAC/B,KAAI,qBAAwB,WAAW,MACtC;AAGD,KAAI,WAAW,KACd,QAAO;AAIR,KAAI,MAAM,QAAQ,OAAO,CACxB,QAAO,CAAC,GAAG,sBAAsB,GAAG,MAAO;CAI5C,MAAM,EAAE,aAAa,SAAS,OAAO,QAAQ,QAAQ,GAAG;CAExD,MAAM,gBACL,eAAe,aAAa,QAAQ,CAAC,GAAG,sBAAsB,GAAG,KAAM;CAGxE,MAAMC,SAA2B,EAAE,OAAO,cAAe;AACzD,KAAI,kBAAsB,QAAO,SAAS;AAC1C,KAAI,kBAAsB,QAAO,SAAS;AAE1C,QAAO;AACP;;;;;;;;;;;;;;;;;;;AAoBD,SAAgB,aAAaC,UAA+B,CAAE,GAAE;CAE/D,MAAM,SAAS,SAAS,UAAU,QAAQ,aAAa;CACvD,MAAM,cAAc,SACjB,EACA,WAAW;EACV,QAAQ;EACR,SAAS,EAAE,UAAU,KAAM;CAC3B,EACD,IACA,CAAE;CAEL,MAAM,SAAS,oBAAoB,QAAQ,OAAO;AAElD,QAAO,KAAK;EACX,GAAG;EACH,GAAI,QAAQ,SAAS,EAAE,OAAO,QAAQ,MAAO;EAC7C,GAAI,UAAU,EAAE,OAAQ;EACxB,YAAY;GACX,WAAW;AACV,WAAO,EAAE,aAAa,QAAQ,QAAS;GACvC;GACD,OAAO,CAAC,UAAU;AACjB,WAAO,EAAE,OAAO,MAAM,aAAa,CAAE;GACrC;EACD;CACD,EAAC;AACF"}
@@ -0,0 +1,19 @@
1
+ //#region src/redact-paths.d.ts
2
+ /**
3
+ * Default sensitive field paths for redaction.
4
+ *
5
+ * These paths are automatically used when `redact: true` is set,
6
+ * and merged with custom paths unless `resolution: 'override'` is specified.
7
+ *
8
+ * Includes:
9
+ * - Authentication: password, token, apiKey, authorization, credentials
10
+ * - Headers: authorization, cookie, x-api-key, x-auth-token
11
+ * - Personal data: ssn, creditCard, cvv, pin
12
+ * - Secrets: secret, connectionString, databaseUrl
13
+ * - Wildcards: *.password, *.secret, *.token (catches nested fields)
14
+ */
15
+ declare const DEFAULT_REDACT_PATHS: string[];
16
+ //# sourceMappingURL=redact-paths.d.ts.map
17
+ //#endregion
18
+ export { DEFAULT_REDACT_PATHS };
19
+ //# sourceMappingURL=redact-paths-CsK0_uz-.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact-paths-CsK0_uz-.d.cts","names":[],"sources":["../src/redact-paths.ts"],"sourcesContent":[],"mappings":";;AAaA;;;;;;;;;;;;cAAa"}
@@ -0,0 +1,19 @@
1
+ //#region src/redact-paths.d.ts
2
+ /**
3
+ * Default sensitive field paths for redaction.
4
+ *
5
+ * These paths are automatically used when `redact: true` is set,
6
+ * and merged with custom paths unless `resolution: 'override'` is specified.
7
+ *
8
+ * Includes:
9
+ * - Authentication: password, token, apiKey, authorization, credentials
10
+ * - Headers: authorization, cookie, x-api-key, x-auth-token
11
+ * - Personal data: ssn, creditCard, cvv, pin
12
+ * - Secrets: secret, connectionString, databaseUrl
13
+ * - Wildcards: *.password, *.secret, *.token (catches nested fields)
14
+ */
15
+ declare const DEFAULT_REDACT_PATHS: string[];
16
+ //# sourceMappingURL=redact-paths.d.ts.map
17
+ //#endregion
18
+ export { DEFAULT_REDACT_PATHS };
19
+ //# sourceMappingURL=redact-paths-D07eTMlH.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact-paths-D07eTMlH.d.mts","names":[],"sources":["../src/redact-paths.ts"],"sourcesContent":[],"mappings":";;AAaA;;;;;;;;;;;;cAAa"}
@@ -0,0 +1,73 @@
1
+
2
+ //#region src/redact-paths.ts
3
+ /**
4
+ * Default sensitive field paths for redaction.
5
+ *
6
+ * These paths are automatically used when `redact: true` is set,
7
+ * and merged with custom paths unless `resolution: 'override'` is specified.
8
+ *
9
+ * Includes:
10
+ * - Authentication: password, token, apiKey, authorization, credentials
11
+ * - Headers: authorization, cookie, x-api-key, x-auth-token
12
+ * - Personal data: ssn, creditCard, cvv, pin
13
+ * - Secrets: secret, connectionString, databaseUrl
14
+ * - Wildcards: *.password, *.secret, *.token (catches nested fields)
15
+ */
16
+ const DEFAULT_REDACT_PATHS = [
17
+ "password",
18
+ "pass",
19
+ "passwd",
20
+ "secret",
21
+ "token",
22
+ "accessToken",
23
+ "refreshToken",
24
+ "idToken",
25
+ "apiKey",
26
+ "api_key",
27
+ "apikey",
28
+ "auth",
29
+ "authorization",
30
+ "credential",
31
+ "credentials",
32
+ "*.password",
33
+ "*.secret",
34
+ "*.token",
35
+ "*.apiKey",
36
+ "*.api_key",
37
+ "*.authorization",
38
+ "*.accessToken",
39
+ "*.refreshToken",
40
+ "headers.authorization",
41
+ "headers.Authorization",
42
+ "headers[\"authorization\"]",
43
+ "headers[\"Authorization\"]",
44
+ "headers.cookie",
45
+ "headers.Cookie",
46
+ "headers[\"x-api-key\"]",
47
+ "headers[\"X-Api-Key\"]",
48
+ "headers[\"x-auth-token\"]",
49
+ "headers[\"X-Auth-Token\"]",
50
+ "ssn",
51
+ "socialSecurityNumber",
52
+ "social_security_number",
53
+ "creditCard",
54
+ "credit_card",
55
+ "cardNumber",
56
+ "card_number",
57
+ "cvv",
58
+ "cvc",
59
+ "pin",
60
+ "connectionString",
61
+ "connection_string",
62
+ "databaseUrl",
63
+ "database_url"
64
+ ];
65
+
66
+ //#endregion
67
+ Object.defineProperty(exports, 'DEFAULT_REDACT_PATHS', {
68
+ enumerable: true,
69
+ get: function () {
70
+ return DEFAULT_REDACT_PATHS;
71
+ }
72
+ });
73
+ //# sourceMappingURL=redact-paths-D0m0DIuQ.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact-paths-D0m0DIuQ.cjs","names":["DEFAULT_REDACT_PATHS: string[]"],"sources":["../src/redact-paths.ts"],"sourcesContent":["/**\n * Default sensitive field paths for redaction.\n *\n * These paths are automatically used when `redact: true` is set,\n * and merged with custom paths unless `resolution: 'override'` is specified.\n *\n * Includes:\n * - Authentication: password, token, apiKey, authorization, credentials\n * - Headers: authorization, cookie, x-api-key, x-auth-token\n * - Personal data: ssn, creditCard, cvv, pin\n * - Secrets: secret, connectionString, databaseUrl\n * - Wildcards: *.password, *.secret, *.token (catches nested fields)\n */\nexport const DEFAULT_REDACT_PATHS: string[] = [\n\t// Authentication & authorization\n\t'password',\n\t'pass',\n\t'passwd',\n\t'secret',\n\t'token',\n\t'accessToken',\n\t'refreshToken',\n\t'idToken',\n\t'apiKey',\n\t'api_key',\n\t'apikey',\n\t'auth',\n\t'authorization',\n\t'credential',\n\t'credentials',\n\n\t// Common nested patterns (headers, body, etc.)\n\t'*.password',\n\t'*.secret',\n\t'*.token',\n\t'*.apiKey',\n\t'*.api_key',\n\t'*.authorization',\n\t'*.accessToken',\n\t'*.refreshToken',\n\n\t// HTTP headers (case variations)\n\t'headers.authorization',\n\t'headers.Authorization',\n\t'headers[\"authorization\"]',\n\t'headers[\"Authorization\"]',\n\t'headers.cookie',\n\t'headers.Cookie',\n\t'headers[\"x-api-key\"]',\n\t'headers[\"X-Api-Key\"]',\n\t'headers[\"x-auth-token\"]',\n\t'headers[\"X-Auth-Token\"]',\n\n\t// Common sensitive data fields\n\t'ssn',\n\t'socialSecurityNumber',\n\t'social_security_number',\n\t'creditCard',\n\t'credit_card',\n\t'cardNumber',\n\t'card_number',\n\t'cvv',\n\t'cvc',\n\t'pin',\n\n\t// Database & connection strings\n\t'connectionString',\n\t'connection_string',\n\t'databaseUrl',\n\t'database_url',\n];\n"],"mappings":";;;;;;;;;;;;;;;AAaA,MAAaA,uBAAiC;CAE7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;AACA"}
@@ -0,0 +1,67 @@
1
+ //#region src/redact-paths.ts
2
+ /**
3
+ * Default sensitive field paths for redaction.
4
+ *
5
+ * These paths are automatically used when `redact: true` is set,
6
+ * and merged with custom paths unless `resolution: 'override'` is specified.
7
+ *
8
+ * Includes:
9
+ * - Authentication: password, token, apiKey, authorization, credentials
10
+ * - Headers: authorization, cookie, x-api-key, x-auth-token
11
+ * - Personal data: ssn, creditCard, cvv, pin
12
+ * - Secrets: secret, connectionString, databaseUrl
13
+ * - Wildcards: *.password, *.secret, *.token (catches nested fields)
14
+ */
15
+ const DEFAULT_REDACT_PATHS = [
16
+ "password",
17
+ "pass",
18
+ "passwd",
19
+ "secret",
20
+ "token",
21
+ "accessToken",
22
+ "refreshToken",
23
+ "idToken",
24
+ "apiKey",
25
+ "api_key",
26
+ "apikey",
27
+ "auth",
28
+ "authorization",
29
+ "credential",
30
+ "credentials",
31
+ "*.password",
32
+ "*.secret",
33
+ "*.token",
34
+ "*.apiKey",
35
+ "*.api_key",
36
+ "*.authorization",
37
+ "*.accessToken",
38
+ "*.refreshToken",
39
+ "headers.authorization",
40
+ "headers.Authorization",
41
+ "headers[\"authorization\"]",
42
+ "headers[\"Authorization\"]",
43
+ "headers.cookie",
44
+ "headers.Cookie",
45
+ "headers[\"x-api-key\"]",
46
+ "headers[\"X-Api-Key\"]",
47
+ "headers[\"x-auth-token\"]",
48
+ "headers[\"X-Auth-Token\"]",
49
+ "ssn",
50
+ "socialSecurityNumber",
51
+ "social_security_number",
52
+ "creditCard",
53
+ "credit_card",
54
+ "cardNumber",
55
+ "card_number",
56
+ "cvv",
57
+ "cvc",
58
+ "pin",
59
+ "connectionString",
60
+ "connection_string",
61
+ "databaseUrl",
62
+ "database_url"
63
+ ];
64
+
65
+ //#endregion
66
+ export { DEFAULT_REDACT_PATHS };
67
+ //# sourceMappingURL=redact-paths-DQoIXhkS.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"redact-paths-DQoIXhkS.mjs","names":["DEFAULT_REDACT_PATHS: string[]"],"sources":["../src/redact-paths.ts"],"sourcesContent":["/**\n * Default sensitive field paths for redaction.\n *\n * These paths are automatically used when `redact: true` is set,\n * and merged with custom paths unless `resolution: 'override'` is specified.\n *\n * Includes:\n * - Authentication: password, token, apiKey, authorization, credentials\n * - Headers: authorization, cookie, x-api-key, x-auth-token\n * - Personal data: ssn, creditCard, cvv, pin\n * - Secrets: secret, connectionString, databaseUrl\n * - Wildcards: *.password, *.secret, *.token (catches nested fields)\n */\nexport const DEFAULT_REDACT_PATHS: string[] = [\n\t// Authentication & authorization\n\t'password',\n\t'pass',\n\t'passwd',\n\t'secret',\n\t'token',\n\t'accessToken',\n\t'refreshToken',\n\t'idToken',\n\t'apiKey',\n\t'api_key',\n\t'apikey',\n\t'auth',\n\t'authorization',\n\t'credential',\n\t'credentials',\n\n\t// Common nested patterns (headers, body, etc.)\n\t'*.password',\n\t'*.secret',\n\t'*.token',\n\t'*.apiKey',\n\t'*.api_key',\n\t'*.authorization',\n\t'*.accessToken',\n\t'*.refreshToken',\n\n\t// HTTP headers (case variations)\n\t'headers.authorization',\n\t'headers.Authorization',\n\t'headers[\"authorization\"]',\n\t'headers[\"Authorization\"]',\n\t'headers.cookie',\n\t'headers.Cookie',\n\t'headers[\"x-api-key\"]',\n\t'headers[\"X-Api-Key\"]',\n\t'headers[\"x-auth-token\"]',\n\t'headers[\"X-Auth-Token\"]',\n\n\t// Common sensitive data fields\n\t'ssn',\n\t'socialSecurityNumber',\n\t'social_security_number',\n\t'creditCard',\n\t'credit_card',\n\t'cardNumber',\n\t'card_number',\n\t'cvv',\n\t'cvc',\n\t'pin',\n\n\t// Database & connection strings\n\t'connectionString',\n\t'connection_string',\n\t'databaseUrl',\n\t'database_url',\n];\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAaA,uBAAiC;CAE7C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA;CACA;CACA;CACA;AACA"}
@@ -1,117 +1,3 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/redact-paths.ts
3
- /**
4
- * Default sensitive field paths for redaction.
5
- *
6
- * These paths are automatically used when `redact: true` is set,
7
- * and merged with custom paths unless `resolution: 'override'` is specified.
8
- *
9
- * Includes:
10
- * - Authentication: password, token, apiKey, authorization, credentials
11
- * - Headers: authorization, cookie, x-api-key, x-auth-token
12
- * - Personal data: ssn, creditCard, cvv, pin
13
- * - Secrets: secret, connectionString, databaseUrl
14
- * - Wildcards: *.password, *.secret, *.token (catches nested fields)
15
- */
16
- const DEFAULT_REDACT_PATHS = [
17
- "password",
18
- "pass",
19
- "passwd",
20
- "secret",
21
- "token",
22
- "accessToken",
23
- "refreshToken",
24
- "idToken",
25
- "apiKey",
26
- "api_key",
27
- "apikey",
28
- "auth",
29
- "authorization",
30
- "credential",
31
- "credentials",
32
- "*.password",
33
- "*.secret",
34
- "*.token",
35
- "*.apiKey",
36
- "*.api_key",
37
- "*.authorization",
38
- "*.accessToken",
39
- "*.refreshToken",
40
- "headers.authorization",
41
- "headers.Authorization",
42
- "headers[\"authorization\"]",
43
- "headers[\"Authorization\"]",
44
- "headers.cookie",
45
- "headers.Cookie",
46
- "headers[\"x-api-key\"]",
47
- "headers[\"X-Api-Key\"]",
48
- "headers[\"x-auth-token\"]",
49
- "headers[\"X-Auth-Token\"]",
50
- "ssn",
51
- "socialSecurityNumber",
52
- "social_security_number",
53
- "creditCard",
54
- "credit_card",
55
- "cardNumber",
56
- "card_number",
57
- "cvv",
58
- "cvc",
59
- "pin",
60
- "connectionString",
61
- "connection_string",
62
- "databaseUrl",
63
- "database_url"
64
- ];
65
- /**
66
- * `scheme://user:password@` — the userinfo of a URL that carries a secret.
67
- * A user with no password (`ssh://git@host`) names nobody's secret and is left
68
- * alone.
69
- */
70
- const URL_CREDENTIALS = /\b([a-z][a-z0-9+.-]*:\/\/)[^\s/?#@:]*:[^\s/?#@]*@/gi;
71
- /**
72
- * Replace the credentials of every URL in `text` with `REDACTED`, so
73
- * `s3://KEY:SECRET@uploads` is logged as `s3://REDACTED@uploads`.
74
- *
75
- * Path redaction cannot catch these: a URL turns up under any field name —
76
- * `url`, `origin`, `endpoint` — or inside a message, and blanking every such
77
- * field would hide the half of it that is useful.
78
- */
79
- function redactUrlCredentials(text) {
80
- return text.replace(URL_CREDENTIALS, "$1REDACTED@");
81
- }
82
- /** Deep enough for a log object; past it, values are logged as they are. */
83
- const MAX_DEPTH = 6;
84
- /**
85
- * A copy of `value` with {@link redactUrlCredentials} applied to every string
86
- * in it. Objects and arrays without such a string are returned as they were.
87
- */
88
- function redactUrlCredentialsIn(value, depth = 0) {
89
- if (typeof value === "string") return redactUrlCredentials(value);
90
- if (depth >= MAX_DEPTH || value === null || typeof value !== "object") return value;
91
- if (Array.isArray(value)) {
92
- let changed = false;
93
- const next = value.map((item) => {
94
- const redacted = redactUrlCredentialsIn(item, depth + 1);
95
- if (redacted !== item) changed = true;
96
- return redacted;
97
- });
98
- return changed ? next : value;
99
- }
100
- const proto = Object.getPrototypeOf(value);
101
- if (proto !== Object.prototype && proto !== null) return value;
102
- let next;
103
- for (const [key, item] of Object.entries(value)) {
104
- const redacted = redactUrlCredentialsIn(item, depth + 1);
105
- if (redacted !== item) {
106
- next ??= { ...value };
107
- next[key] = redacted;
108
- }
109
- }
110
- return next ?? value;
111
- }
112
- //#endregion
113
- exports.DEFAULT_REDACT_PATHS = DEFAULT_REDACT_PATHS;
114
- exports.redactUrlCredentials = redactUrlCredentials;
115
- exports.redactUrlCredentialsIn = redactUrlCredentialsIn;
1
+ const require_redact_paths = require('./redact-paths-D0m0DIuQ.cjs');
116
2
 
117
- //# sourceMappingURL=redact-paths.cjs.map
3
+ exports.DEFAULT_REDACT_PATHS = require_redact_paths.DEFAULT_REDACT_PATHS;
@@ -1,31 +1,2 @@
1
- //#region src/redact-paths.d.ts
2
- /**
3
- * Default sensitive field paths for redaction.
4
- *
5
- * These paths are automatically used when `redact: true` is set,
6
- * and merged with custom paths unless `resolution: 'override'` is specified.
7
- *
8
- * Includes:
9
- * - Authentication: password, token, apiKey, authorization, credentials
10
- * - Headers: authorization, cookie, x-api-key, x-auth-token
11
- * - Personal data: ssn, creditCard, cvv, pin
12
- * - Secrets: secret, connectionString, databaseUrl
13
- * - Wildcards: *.password, *.secret, *.token (catches nested fields)
14
- */
15
- export declare const DEFAULT_REDACT_PATHS: string[];
16
- /**
17
- * Replace the credentials of every URL in `text` with `REDACTED`, so
18
- * `s3://KEY:SECRET@uploads` is logged as `s3://REDACTED@uploads`.
19
- *
20
- * Path redaction cannot catch these: a URL turns up under any field name —
21
- * `url`, `origin`, `endpoint` — or inside a message, and blanking every such
22
- * field would hide the half of it that is useful.
23
- */
24
- export declare function redactUrlCredentials(text: string): string;
25
- /**
26
- * A copy of `value` with {@link redactUrlCredentials} applied to every string
27
- * in it. Objects and arrays without such a string are returned as they were.
28
- */
29
- export declare function redactUrlCredentialsIn<T>(value: T, depth?: number): T;
30
- //#endregion
31
- //# sourceMappingURL=redact-paths.d.cts.map
1
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-CsK0_uz-.cjs";
2
+ export { DEFAULT_REDACT_PATHS };
@@ -1,31 +1,2 @@
1
- //#region src/redact-paths.d.ts
2
- /**
3
- * Default sensitive field paths for redaction.
4
- *
5
- * These paths are automatically used when `redact: true` is set,
6
- * and merged with custom paths unless `resolution: 'override'` is specified.
7
- *
8
- * Includes:
9
- * - Authentication: password, token, apiKey, authorization, credentials
10
- * - Headers: authorization, cookie, x-api-key, x-auth-token
11
- * - Personal data: ssn, creditCard, cvv, pin
12
- * - Secrets: secret, connectionString, databaseUrl
13
- * - Wildcards: *.password, *.secret, *.token (catches nested fields)
14
- */
15
- export declare const DEFAULT_REDACT_PATHS: string[];
16
- /**
17
- * Replace the credentials of every URL in `text` with `REDACTED`, so
18
- * `s3://KEY:SECRET@uploads` is logged as `s3://REDACTED@uploads`.
19
- *
20
- * Path redaction cannot catch these: a URL turns up under any field name —
21
- * `url`, `origin`, `endpoint` — or inside a message, and blanking every such
22
- * field would hide the half of it that is useful.
23
- */
24
- export declare function redactUrlCredentials(text: string): string;
25
- /**
26
- * A copy of `value` with {@link redactUrlCredentials} applied to every string
27
- * in it. Objects and arrays without such a string are returned as they were.
28
- */
29
- export declare function redactUrlCredentialsIn<T>(value: T, depth?: number): T;
30
- //#endregion
31
- //# sourceMappingURL=redact-paths.d.mts.map
1
+ import { DEFAULT_REDACT_PATHS } from "./redact-paths-D07eTMlH.mjs";
2
+ export { DEFAULT_REDACT_PATHS };