@visulima/pail 4.0.0-alpha.12 → 4.0.0-alpha.14
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 +23 -0
- package/LICENSE.md +4 -1
- package/dist/error.js +5 -76
- package/dist/index.browser.js +19 -1499
- package/dist/index.server.js +31 -2804
- package/dist/middleware/elysia.d.ts +3 -3
- package/dist/middleware/elysia.js +1 -70
- package/dist/middleware/express.d.ts +3 -3
- package/dist/middleware/express.js +1 -29
- package/dist/middleware/fastify.d.ts +3 -3
- package/dist/middleware/fastify.js +1 -46
- package/dist/middleware/hono.d.ts +3 -3
- package/dist/middleware/hono.js +1 -33
- package/dist/middleware/next/handler.d.ts +5 -5
- package/dist/middleware/next/handler.js +1 -53
- package/dist/middleware/sveltekit.d.ts +3 -3
- package/dist/middleware/sveltekit.js +1 -43
- package/dist/object-tree.js +2 -89
- package/dist/packem_shared/AbstractJsonReporter-D_Pb6kpB.js +1 -0
- package/dist/packem_shared/AbstractJsonReporter-PVC4ONf2.js +1 -0
- package/dist/packem_shared/JsonReporter-BEEmb0W4.js +2 -0
- package/dist/packem_shared/JsonReporter-CE-lw7R0.js +1 -0
- package/dist/packem_shared/PrettyReporter-Br5njEEy.js +5 -0
- package/dist/packem_shared/PrettyReporter-N7FvHzl5.js +44 -0
- package/dist/packem_shared/{abstract-json-reporter.d-BAgznjyU.d.ts → abstract-json-reporter.d-Boj5w068.d.ts} +1 -1
- package/dist/packem_shared/abstract-pretty-reporter-Bag7lQKf.js +33 -0
- package/dist/packem_shared/constants-DKfCaSUR.js +1 -0
- package/dist/packem_shared/constants-ep2nsfdy.js +1 -0
- package/dist/packem_shared/{create-middleware-logger.d-DheMh8q4.d.ts → create-middleware-logger.d-CMQdVeVE.d.ts} +2 -2
- package/dist/packem_shared/createPailError-53jAfQ-T.js +5 -0
- package/dist/packem_shared/headers-S8WyX-2m.js +1 -0
- package/dist/packem_shared/index-Bzp4LnJ5.js +1 -0
- package/dist/packem_shared/pailMiddleware-CWOJRmJq.js +1 -0
- package/dist/packem_shared/storage-DHM1EP2P.js +1 -0
- package/dist/packem_shared/{types.d-BeLumqgD.d.ts → types.d-Ck_RSjLg.d.ts} +1 -1
- package/dist/packem_shared/useLogger-qyZrjy4D.js +1 -0
- package/dist/packem_shared/{wide-event.d-B-t8ZnhI.d.ts → wide-event.d-DA-6dTPc.d.ts} +1 -1
- package/dist/packem_shared/write-console-log-based-on-level-DfD64owL.js +1 -0
- package/dist/packem_shared/write-stream-Dd4_PTcm.js +1 -0
- package/dist/processor/caller/caller-processor.d.ts +1 -1
- package/dist/processor/caller/caller-processor.js +1 -59
- package/dist/processor/environment-processor.d.ts +1 -1
- package/dist/processor/environment-processor.js +1 -82
- package/dist/processor/message-formatter-processor.d.ts +1 -1
- package/dist/processor/message-formatter-processor.js +1 -715
- package/dist/processor/opentelemetry-processor.d.ts +1 -1
- package/dist/processor/opentelemetry-processor.js +1 -52
- package/dist/processor/redact-processor.d.ts +1 -1
- package/dist/processor/redact-processor.js +1 -31
- package/dist/processor/sampling-processor.d.ts +1 -1
- package/dist/processor/sampling-processor.js +1 -59
- package/dist/reporter/file/json-file-reporter.d.ts +2 -2
- package/dist/reporter/file/json-file-reporter.js +2 -136
- package/dist/reporter/http/abstract-http-reporter.d.ts +2 -2
- package/dist/reporter/http/abstract-http-reporter.js +2 -432
- package/dist/reporter/http/http-reporter.d.ts +2 -2
- package/dist/reporter/http/http-reporter.edge-light.js +2 -728
- package/dist/reporter/http/http-reporter.js +1 -13
- package/dist/reporter/json/index.browser.js +1 -2
- package/dist/reporter/json/index.d.ts +2 -2
- package/dist/reporter/json/index.js +1 -2
- package/dist/reporter/pretty/index.browser.js +1 -1
- package/dist/reporter/pretty/index.d.ts +1 -1
- package/dist/reporter/pretty/index.js +1 -1
- package/dist/reporter/simple/simple-reporter.server.js +8 -183
- package/dist/wide-event.d.ts +2 -2
- package/dist/wide-event.js +1 -284
- package/package.json +24 -24
- package/dist/packem_shared/AbstractJsonReporter-BO8Calb4.js +0 -284
- package/dist/packem_shared/AbstractJsonReporter-nOj0Ft1F.js +0 -284
- package/dist/packem_shared/JsonReporter-CCmj7oYL.js +0 -28
- package/dist/packem_shared/JsonReporter-Ck2PIAEw.js +0 -58
- package/dist/packem_shared/PrettyReporter-CIbrmjUV.js +0 -213
- package/dist/packem_shared/PrettyReporter-CNJEO9g7.js +0 -2723
- package/dist/packem_shared/abstract-pretty-reporter-CkqCt5hg.js +0 -2637
- package/dist/packem_shared/constants-B1RjD_ps.js +0 -99
- package/dist/packem_shared/constants-omsTHUWB.js +0 -119
- package/dist/packem_shared/createPailError-B_sgL0nF.js +0 -76
- package/dist/packem_shared/headers-BxHWM6KI.js +0 -127
- package/dist/packem_shared/index-6cG1Kp0t.js +0 -658
- package/dist/packem_shared/pailMiddleware-Ci88geIF.js +0 -24
- package/dist/packem_shared/storage-D0vqz8OX.js +0 -36
- package/dist/packem_shared/useLogger-D0rU3lcX.js +0 -33
- package/dist/packem_shared/write-console-log-based-on-level-ree2lDPw.js +0 -15
- package/dist/packem_shared/write-stream-MDqyXmc_.js +0 -6
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
const LOG_TYPES = {
|
|
2
|
-
alert: {
|
|
3
|
-
color: "red",
|
|
4
|
-
label: "alert",
|
|
5
|
-
logLevel: "alert"
|
|
6
|
-
},
|
|
7
|
-
await: {
|
|
8
|
-
color: "blue",
|
|
9
|
-
label: "awaiting",
|
|
10
|
-
logLevel: "informational"
|
|
11
|
-
},
|
|
12
|
-
complete: {
|
|
13
|
-
color: "cyan",
|
|
14
|
-
label: "complete",
|
|
15
|
-
logLevel: "informational"
|
|
16
|
-
},
|
|
17
|
-
critical: {
|
|
18
|
-
color: "redBright",
|
|
19
|
-
label: "critical",
|
|
20
|
-
logLevel: "critical"
|
|
21
|
-
},
|
|
22
|
-
debug: {
|
|
23
|
-
color: "gray",
|
|
24
|
-
label: "debug",
|
|
25
|
-
logLevel: "debug"
|
|
26
|
-
},
|
|
27
|
-
emergency: {
|
|
28
|
-
color: "redBright",
|
|
29
|
-
label: "emergency",
|
|
30
|
-
logLevel: "emergency"
|
|
31
|
-
},
|
|
32
|
-
error: {
|
|
33
|
-
color: "red",
|
|
34
|
-
label: "error",
|
|
35
|
-
logLevel: "error"
|
|
36
|
-
},
|
|
37
|
-
info: {
|
|
38
|
-
color: "blueBright",
|
|
39
|
-
label: "info",
|
|
40
|
-
logLevel: "informational"
|
|
41
|
-
},
|
|
42
|
-
log: {
|
|
43
|
-
label: "",
|
|
44
|
-
logLevel: "informational"
|
|
45
|
-
},
|
|
46
|
-
notice: {
|
|
47
|
-
color: "magentaBright",
|
|
48
|
-
label: "notice",
|
|
49
|
-
logLevel: "notice"
|
|
50
|
-
},
|
|
51
|
-
pending: {
|
|
52
|
-
color: "magenta",
|
|
53
|
-
label: "pending",
|
|
54
|
-
logLevel: "informational"
|
|
55
|
-
},
|
|
56
|
-
start: {
|
|
57
|
-
color: "greenBright",
|
|
58
|
-
label: "start",
|
|
59
|
-
logLevel: "informational"
|
|
60
|
-
},
|
|
61
|
-
stop: {
|
|
62
|
-
color: "red",
|
|
63
|
-
label: "stop",
|
|
64
|
-
logLevel: "informational"
|
|
65
|
-
},
|
|
66
|
-
success: {
|
|
67
|
-
color: "green",
|
|
68
|
-
label: "success",
|
|
69
|
-
logLevel: "informational"
|
|
70
|
-
},
|
|
71
|
-
trace: {
|
|
72
|
-
color: "cyanBright",
|
|
73
|
-
label: "trace",
|
|
74
|
-
logLevel: "trace"
|
|
75
|
-
},
|
|
76
|
-
wait: {
|
|
77
|
-
color: "blue",
|
|
78
|
-
label: "waiting",
|
|
79
|
-
logLevel: "informational"
|
|
80
|
-
},
|
|
81
|
-
warn: {
|
|
82
|
-
color: "yellow",
|
|
83
|
-
label: "warning",
|
|
84
|
-
logLevel: "warning"
|
|
85
|
-
},
|
|
86
|
-
warning: {
|
|
87
|
-
color: "yellow",
|
|
88
|
-
label: "warning",
|
|
89
|
-
logLevel: "warning"
|
|
90
|
-
},
|
|
91
|
-
watch: {
|
|
92
|
-
color: "yellowBright",
|
|
93
|
-
label: "watching",
|
|
94
|
-
logLevel: "informational"
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
const EMPTY_SYMBOL = /* @__PURE__ */ Symbol("EMPTY");
|
|
98
|
-
|
|
99
|
-
export { EMPTY_SYMBOL as E, LOG_TYPES as L };
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
const EXTENDED_RFC_5424_LOG_LEVELS = {
|
|
2
|
-
alert: 7,
|
|
3
|
-
// Action must be taken immediately. Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
|
|
4
|
-
critical: 6,
|
|
5
|
-
// Critical conditions. Example: Application component unavailable, unexpected exception.
|
|
6
|
-
debug: 1,
|
|
7
|
-
// Detailed debug information.
|
|
8
|
-
emergency: 8,
|
|
9
|
-
// Emergency: system is unusable.
|
|
10
|
-
error: 5,
|
|
11
|
-
// Runtime errors that do not require immediate action but should typically be logged and monitored.
|
|
12
|
-
informational: 2,
|
|
13
|
-
// Interesting events. Examples: User logs in, SQL logs.
|
|
14
|
-
notice: 3,
|
|
15
|
-
// Normal but significant events.
|
|
16
|
-
trace: 2,
|
|
17
|
-
// Trace information.
|
|
18
|
-
warning: 4
|
|
19
|
-
// Exceptional occurrences that are not errors. Examples: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
|
|
20
|
-
};
|
|
21
|
-
const LOG_TYPES = {
|
|
22
|
-
alert: {
|
|
23
|
-
color: "red",
|
|
24
|
-
label: "alert",
|
|
25
|
-
logLevel: "alert"
|
|
26
|
-
},
|
|
27
|
-
await: {
|
|
28
|
-
color: "blue",
|
|
29
|
-
label: "awaiting",
|
|
30
|
-
logLevel: "informational"
|
|
31
|
-
},
|
|
32
|
-
complete: {
|
|
33
|
-
color: "cyan",
|
|
34
|
-
label: "complete",
|
|
35
|
-
logLevel: "informational"
|
|
36
|
-
},
|
|
37
|
-
critical: {
|
|
38
|
-
color: "redBright",
|
|
39
|
-
label: "critical",
|
|
40
|
-
logLevel: "critical"
|
|
41
|
-
},
|
|
42
|
-
debug: {
|
|
43
|
-
color: "gray",
|
|
44
|
-
label: "debug",
|
|
45
|
-
logLevel: "debug"
|
|
46
|
-
},
|
|
47
|
-
emergency: {
|
|
48
|
-
color: "redBright",
|
|
49
|
-
label: "emergency",
|
|
50
|
-
logLevel: "emergency"
|
|
51
|
-
},
|
|
52
|
-
error: {
|
|
53
|
-
color: "red",
|
|
54
|
-
label: "error",
|
|
55
|
-
logLevel: "error"
|
|
56
|
-
},
|
|
57
|
-
info: {
|
|
58
|
-
color: "blueBright",
|
|
59
|
-
label: "info",
|
|
60
|
-
logLevel: "informational"
|
|
61
|
-
},
|
|
62
|
-
log: {
|
|
63
|
-
label: "",
|
|
64
|
-
logLevel: "informational"
|
|
65
|
-
},
|
|
66
|
-
notice: {
|
|
67
|
-
color: "magentaBright",
|
|
68
|
-
label: "notice",
|
|
69
|
-
logLevel: "notice"
|
|
70
|
-
},
|
|
71
|
-
pending: {
|
|
72
|
-
color: "magenta",
|
|
73
|
-
label: "pending",
|
|
74
|
-
logLevel: "informational"
|
|
75
|
-
},
|
|
76
|
-
start: {
|
|
77
|
-
color: "greenBright",
|
|
78
|
-
label: "start",
|
|
79
|
-
logLevel: "informational"
|
|
80
|
-
},
|
|
81
|
-
stop: {
|
|
82
|
-
color: "red",
|
|
83
|
-
label: "stop",
|
|
84
|
-
logLevel: "informational"
|
|
85
|
-
},
|
|
86
|
-
success: {
|
|
87
|
-
color: "green",
|
|
88
|
-
label: "success",
|
|
89
|
-
logLevel: "informational"
|
|
90
|
-
},
|
|
91
|
-
trace: {
|
|
92
|
-
color: "cyanBright",
|
|
93
|
-
label: "trace",
|
|
94
|
-
logLevel: "trace"
|
|
95
|
-
},
|
|
96
|
-
wait: {
|
|
97
|
-
color: "blue",
|
|
98
|
-
label: "waiting",
|
|
99
|
-
logLevel: "informational"
|
|
100
|
-
},
|
|
101
|
-
warn: {
|
|
102
|
-
color: "yellow",
|
|
103
|
-
label: "warning",
|
|
104
|
-
logLevel: "warning"
|
|
105
|
-
},
|
|
106
|
-
warning: {
|
|
107
|
-
color: "yellow",
|
|
108
|
-
label: "warning",
|
|
109
|
-
logLevel: "warning"
|
|
110
|
-
},
|
|
111
|
-
watch: {
|
|
112
|
-
color: "yellowBright",
|
|
113
|
-
label: "watching",
|
|
114
|
-
logLevel: "informational"
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
const EMPTY_SYMBOL = /* @__PURE__ */ Symbol("EMPTY");
|
|
118
|
-
|
|
119
|
-
export { EMPTY_SYMBOL as E, LOG_TYPES as L, EXTENDED_RFC_5424_LOG_LEVELS as a };
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
class PailError extends Error {
|
|
2
|
-
/** HTTP status code (defaults to 500) */
|
|
3
|
-
status;
|
|
4
|
-
/** Explanation of what caused the failure */
|
|
5
|
-
why;
|
|
6
|
-
/** Suggested resolution steps */
|
|
7
|
-
fix;
|
|
8
|
-
/** Link to relevant documentation */
|
|
9
|
-
link;
|
|
10
|
-
constructor(options) {
|
|
11
|
-
const resolvedOptions = typeof options === "string" ? { message: options } : options;
|
|
12
|
-
super(resolvedOptions.message, resolvedOptions.cause === void 0 ? void 0 : { cause: resolvedOptions.cause });
|
|
13
|
-
this.name = "PailError";
|
|
14
|
-
this.status = resolvedOptions.status ?? 500;
|
|
15
|
-
this.why = resolvedOptions.why;
|
|
16
|
-
this.fix = resolvedOptions.fix;
|
|
17
|
-
this.link = resolvedOptions.link;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Converts the error to a JSON-serializable object.
|
|
21
|
-
*
|
|
22
|
-
* Includes all self-documenting fields in the output for structured logging.
|
|
23
|
-
* @returns A plain object representation of the error
|
|
24
|
-
*/
|
|
25
|
-
toJSON() {
|
|
26
|
-
const json = {
|
|
27
|
-
message: this.message,
|
|
28
|
-
name: this.name,
|
|
29
|
-
status: this.status
|
|
30
|
-
};
|
|
31
|
-
if (this.why) {
|
|
32
|
-
json.why = this.why;
|
|
33
|
-
}
|
|
34
|
-
if (this.fix) {
|
|
35
|
-
json.fix = this.fix;
|
|
36
|
-
}
|
|
37
|
-
if (this.link) {
|
|
38
|
-
json.link = this.link;
|
|
39
|
-
}
|
|
40
|
-
if (this.stack) {
|
|
41
|
-
json.stack = this.stack;
|
|
42
|
-
}
|
|
43
|
-
if (this.cause !== void 0) {
|
|
44
|
-
json.cause = this.cause instanceof Error ? { message: this.cause.message, name: this.cause.name, stack: this.cause.stack } : this.cause;
|
|
45
|
-
}
|
|
46
|
-
return json;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Returns a formatted string representation including self-documenting fields.
|
|
50
|
-
* @returns Formatted error string with why/fix/link context
|
|
51
|
-
*/
|
|
52
|
-
toString() {
|
|
53
|
-
let output = `${this.name} [${String(this.status)}]: ${this.message}`;
|
|
54
|
-
if (this.why) {
|
|
55
|
-
output += `
|
|
56
|
-
Why: ${this.why}`;
|
|
57
|
-
}
|
|
58
|
-
if (this.fix) {
|
|
59
|
-
output += `
|
|
60
|
-
Fix: ${this.fix}`;
|
|
61
|
-
}
|
|
62
|
-
if (this.link) {
|
|
63
|
-
output += `
|
|
64
|
-
Link: ${this.link}`;
|
|
65
|
-
}
|
|
66
|
-
if (this.cause !== void 0) {
|
|
67
|
-
const causeMessage = this.cause instanceof Error ? this.cause.message : String(this.cause);
|
|
68
|
-
output += `
|
|
69
|
-
Cause: ${causeMessage}`;
|
|
70
|
-
}
|
|
71
|
-
return output;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
const createPailError = (options) => new PailError(options);
|
|
75
|
-
|
|
76
|
-
export { PailError, createPailError };
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { WideEvent } from '../wide-event.js';
|
|
2
|
-
|
|
3
|
-
const patternToRegex = (pattern) => {
|
|
4
|
-
let regex = "^";
|
|
5
|
-
let index = 0;
|
|
6
|
-
while (index < pattern.length) {
|
|
7
|
-
const char = pattern[index];
|
|
8
|
-
if (char === "*" && pattern[index + 1] === "*") {
|
|
9
|
-
index += 2;
|
|
10
|
-
if (pattern[index] === "/") {
|
|
11
|
-
index += 1;
|
|
12
|
-
}
|
|
13
|
-
if (index >= pattern.length && regex.endsWith("/")) {
|
|
14
|
-
regex = `${regex.slice(0, -1)}(/.*)?`;
|
|
15
|
-
} else if (index >= pattern.length) {
|
|
16
|
-
regex += ".*";
|
|
17
|
-
} else {
|
|
18
|
-
regex += "(.*/)?";
|
|
19
|
-
}
|
|
20
|
-
} else {
|
|
21
|
-
switch (char) {
|
|
22
|
-
case "*": {
|
|
23
|
-
regex += "[^/]*";
|
|
24
|
-
index += 1;
|
|
25
|
-
break;
|
|
26
|
-
}
|
|
27
|
-
case ".": {
|
|
28
|
-
regex += String.raw`\.`;
|
|
29
|
-
index += 1;
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
case "?": {
|
|
33
|
-
regex += "[^/]";
|
|
34
|
-
index += 1;
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
default: {
|
|
38
|
-
regex += char;
|
|
39
|
-
index += 1;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
regex += "$";
|
|
45
|
-
return new RegExp(regex);
|
|
46
|
-
};
|
|
47
|
-
const matchesPattern = (path, pattern) => patternToRegex(pattern).test(path);
|
|
48
|
-
const shouldLog = (path, include, exclude) => {
|
|
49
|
-
if (exclude?.some((pattern) => matchesPattern(path, pattern))) {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
if (!include?.length) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
return include.some((pattern) => matchesPattern(path, pattern));
|
|
56
|
-
};
|
|
57
|
-
const getServiceForPath = (path, routes) => {
|
|
58
|
-
if (!routes) {
|
|
59
|
-
return void 0;
|
|
60
|
-
}
|
|
61
|
-
const entries = Object.entries(routes);
|
|
62
|
-
for (let i = 0; i < entries.length; i += 1) {
|
|
63
|
-
const [pattern, config] = entries[i];
|
|
64
|
-
if (matchesPattern(path, pattern)) {
|
|
65
|
-
return config.service;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return void 0;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const createMiddlewareLogger = (options, request) => {
|
|
72
|
-
const { exclude, include, pail, routes, service } = options;
|
|
73
|
-
const { headers, method, path, requestId } = request;
|
|
74
|
-
if (!shouldLog(path, include, exclude)) {
|
|
75
|
-
const noopLogger = new WideEvent({ autoEmit: false, name: `${method} ${path}`, pail });
|
|
76
|
-
return {
|
|
77
|
-
finish: () => {
|
|
78
|
-
},
|
|
79
|
-
logger: noopLogger,
|
|
80
|
-
skipped: true
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
const routeService = getServiceForPath(path, routes) ?? service;
|
|
84
|
-
const logger = new WideEvent({
|
|
85
|
-
name: `${method} ${path}`,
|
|
86
|
-
pail,
|
|
87
|
-
service: routeService
|
|
88
|
-
});
|
|
89
|
-
logger.set({
|
|
90
|
-
method,
|
|
91
|
-
path,
|
|
92
|
-
requestId,
|
|
93
|
-
...headers ? { headers } : {}
|
|
94
|
-
});
|
|
95
|
-
const finish = (finishOptions) => {
|
|
96
|
-
logger.finish(finishOptions);
|
|
97
|
-
};
|
|
98
|
-
return {
|
|
99
|
-
finish,
|
|
100
|
-
logger,
|
|
101
|
-
skipped: false
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const SENSITIVE_HEADERS = /* @__PURE__ */ new Set(["authorization", "cookie", "proxy-authorization", "set-cookie", "x-api-key", "x-auth-token"]);
|
|
106
|
-
const extractSafeHeaders = (headers) => {
|
|
107
|
-
const safe = {};
|
|
108
|
-
headers.forEach((value, key) => {
|
|
109
|
-
if (!SENSITIVE_HEADERS.has(key.toLowerCase())) {
|
|
110
|
-
safe[key.toLowerCase()] = value;
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
return safe;
|
|
114
|
-
};
|
|
115
|
-
const extractSafeNodeHeaders = (headers) => {
|
|
116
|
-
const safe = {};
|
|
117
|
-
const entries = Object.entries(headers);
|
|
118
|
-
for (let i = 0; i < entries.length; i += 1) {
|
|
119
|
-
const [key, value] = entries[i];
|
|
120
|
-
if (!SENSITIVE_HEADERS.has(key.toLowerCase()) && value !== void 0) {
|
|
121
|
-
safe[key.toLowerCase()] = Array.isArray(value) ? value.join(", ") : value;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
return safe;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
export { extractSafeHeaders as a, createMiddlewareLogger as c, extractSafeNodeHeaders as e };
|