@c9up/spectrum 0.1.18 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -6
- package/dist/Logger.d.ts +6 -2
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +190 -72
- package/dist/Logger.js.map +1 -1
- package/dist/LoggerManager.d.ts +5 -0
- package/dist/LoggerManager.d.ts.map +1 -1
- package/dist/LoggerManager.js +10 -3
- package/dist/LoggerManager.js.map +1 -1
- package/dist/RustLogBridge.d.ts +27 -2
- package/dist/RustLogBridge.d.ts.map +1 -1
- package/dist/RustLogBridge.js +45 -31
- package/dist/RustLogBridge.js.map +1 -1
- package/dist/SpectrumProvider.d.ts +6 -2
- package/dist/SpectrumProvider.d.ts.map +1 -1
- package/dist/SpectrumProvider.js +13 -11
- package/dist/SpectrumProvider.js.map +1 -1
- package/dist/channels/ConsoleChannel.d.ts +8 -1
- package/dist/channels/ConsoleChannel.d.ts.map +1 -1
- package/dist/channels/ConsoleChannel.js +18 -14
- package/dist/channels/ConsoleChannel.js.map +1 -1
- package/dist/channels/FileChannel.d.ts +32 -9
- package/dist/channels/FileChannel.d.ts.map +1 -1
- package/dist/channels/FileChannel.js +264 -202
- package/dist/channels/FileChannel.js.map +1 -1
- package/dist/errors.d.ts +9 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/jsonLine.d.ts +49 -0
- package/dist/jsonLine.d.ts.map +1 -0
- package/dist/jsonLine.js +164 -0
- package/dist/jsonLine.js.map +1 -0
- package/dist/redact.d.ts +16 -3
- package/dist/redact.d.ts.map +1 -1
- package/dist/redact.js +121 -10
- package/dist/redact.js.map +1 -1
- package/dist/sanitize.d.ts +11 -5
- package/dist/sanitize.d.ts.map +1 -1
- package/dist/sanitize.js +36 -12
- package/dist/sanitize.js.map +1 -1
- package/dist/services/main.d.ts.map +1 -1
- package/dist/services/main.js +12 -1
- package/dist/services/main.js.map +1 -1
- package/dist/stdSerializers.d.ts +47 -0
- package/dist/stdSerializers.d.ts.map +1 -0
- package/dist/stdSerializers.js +128 -0
- package/dist/stdSerializers.js.map +1 -0
- package/dist/stringify.d.ts +33 -0
- package/dist/stringify.d.ts.map +1 -0
- package/dist/stringify.js +148 -0
- package/dist/stringify.js.map +1 -0
- package/dist/targets.d.ts +29 -7
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +130 -31
- package/dist/targets.js.map +1 -1
- package/dist/testing/FakeLogger.js +20 -5
- package/dist/testing/FakeLogger.js.map +1 -1
- package/dist/types.d.ts +71 -3
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +18 -2
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
- package/src/Logger.ts +254 -79
- package/src/LoggerManager.ts +10 -3
- package/src/RustLogBridge.ts +59 -30
- package/src/SpectrumProvider.ts +26 -17
- package/src/channels/ConsoleChannel.ts +30 -14
- package/src/channels/FileChannel.ts +319 -220
- package/src/errors.ts +13 -0
- package/src/index.ts +17 -3
- package/src/jsonLine.ts +222 -0
- package/src/redact.ts +133 -9
- package/src/sanitize.ts +36 -12
- package/src/services/main.ts +13 -1
- package/src/stdSerializers.ts +146 -0
- package/src/stringify.ts +175 -0
- package/src/targets.ts +193 -42
- package/src/testing/FakeLogger.ts +23 -5
- package/src/types.ts +97 -4
- package/stubs/config/logger.stub +1 -1
package/dist/index.js
CHANGED
|
@@ -4,14 +4,16 @@
|
|
|
4
4
|
* @implements FR54, FR55, FR56, FR57, FR58
|
|
5
5
|
*/
|
|
6
6
|
import "./augmentations.js";
|
|
7
|
-
export { ConsoleChannel } from "./channels/ConsoleChannel.js";
|
|
7
|
+
export { ConsoleChannel, } from "./channels/ConsoleChannel.js";
|
|
8
8
|
export { FileChannel } from "./channels/FileChannel.js";
|
|
9
9
|
export { defineConfig } from "./config.js";
|
|
10
10
|
export { configure } from "./configure.js";
|
|
11
|
+
export { SpectrumError } from "./errors.js";
|
|
11
12
|
export { clearLogListeners, onLog } from "./events.js";
|
|
12
13
|
export { Logger } from "./Logger.js";
|
|
13
14
|
export { LoggerManager } from "./LoggerManager.js";
|
|
14
|
-
export { createRustLogBridge, parseRustLog } from "./RustLogBridge.js";
|
|
15
|
+
export { createRustLogBridge, parseRustLog, } from "./RustLogBridge.js";
|
|
16
|
+
export { stdSerializers, stdTimeFunctions } from "./stdSerializers.js";
|
|
15
17
|
export { channelsFromTargets, Targets, targets } from "./targets.js";
|
|
16
18
|
export { isLogLevelWithSilent, logEntryExtras, logLevel, } from "./types.js";
|
|
17
19
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,oBAAoB,CAAC;AAE5B,OAAO,EACN,cAAc,GAEd,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,WAAW,EAA0B,MAAM,2BAA2B,CAAC;AAChF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,iBAAiB,EAAoB,KAAK,EAAE,MAAM,aAAa,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAiB,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACN,mBAAmB,EACnB,YAAY,GAEZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAMvE,OAAO,EAAE,mBAAmB,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAEN,oBAAoB,EAUpB,cAAc,EACd,QAAQ,GAER,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JSON line a structured channel writes: pino's shape.
|
|
3
|
+
*
|
|
4
|
+
* {"level":30,"time":1731000000000,"pid":4242,"hostname":"web-1","module":"app","userId":7,"msg":"signed in"}
|
|
5
|
+
*
|
|
6
|
+
* Numeric `level`, epoch-millisecond `time`, `pid` and `hostname` from `base`,
|
|
7
|
+
* bindings and merged fields at the root, the message under `msg` — what a
|
|
8
|
+
* dashboard, an alert rule or `pino-pretty` reads from a pino line. The keys
|
|
9
|
+
* and the time format follow the logger's `messageKey`, `timestamp`, `base`
|
|
10
|
+
* and `formatters` options, as they do upstream.
|
|
11
|
+
*/
|
|
12
|
+
import { type StringifyLimits } from "./stringify.js";
|
|
13
|
+
import type { LogEntry, LogLevel } from "./types.js";
|
|
14
|
+
/**
|
|
15
|
+
* How `time` is written: `'epoch'` (ms, the default), `'iso'`, `'unix'`
|
|
16
|
+
* (seconds), `false` to leave it out, or a function returning the raw
|
|
17
|
+
* fragment to append (`,"time":…`), as upstream's time functions do.
|
|
18
|
+
*/
|
|
19
|
+
export type TimestampOption = "epoch" | "iso" | "unix" | boolean | (() => string);
|
|
20
|
+
export interface LineFormatters {
|
|
21
|
+
/** The level's part of the line. Default `{ level: <number> }`. */
|
|
22
|
+
level?: (label: LogLevel, number: number) => Record<string, unknown>;
|
|
23
|
+
/** Reshape the merged fields (bindings and merging object) before writing. */
|
|
24
|
+
log?: (object: Record<string, unknown>) => Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
export interface JsonLineOptions {
|
|
27
|
+
messageKey: string;
|
|
28
|
+
timestamp: TimestampOption;
|
|
29
|
+
/** Fields written on every line; `null` for none. */
|
|
30
|
+
base: Record<string, unknown> | null;
|
|
31
|
+
formatters: LineFormatters;
|
|
32
|
+
limits: StringifyLimits;
|
|
33
|
+
}
|
|
34
|
+
export declare const DEFAULT_LINE_OPTIONS: JsonLineOptions;
|
|
35
|
+
/** @internal Attach a logger's line options to an entry it is about to write. */
|
|
36
|
+
export declare function attachLineOptions(entry: object, options: JsonLineOptions): void;
|
|
37
|
+
/** The line options for this entry: its logger's, else the defaults. */
|
|
38
|
+
export declare function lineOptionsFor(entry: object): JsonLineOptions;
|
|
39
|
+
/** Check the line options a config declares, filling in the defaults. */
|
|
40
|
+
export declare function resolveLineOptions(config: {
|
|
41
|
+
messageKey?: string;
|
|
42
|
+
timestamp?: TimestampOption;
|
|
43
|
+
base?: Record<string, unknown> | null;
|
|
44
|
+
formatters?: LineFormatters;
|
|
45
|
+
limits: StringifyLimits;
|
|
46
|
+
}): JsonLineOptions;
|
|
47
|
+
/** One JSON line (no trailing newline) for an entry. */
|
|
48
|
+
export declare function jsonLine(entry: LogEntry): string;
|
|
49
|
+
//# sourceMappingURL=jsonLine.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLine.d.ts","sourceRoot":"","sources":["../src/jsonLine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAEN,KAAK,eAAe,EAEpB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGrD;;;;GAIG;AACH,MAAM,MAAM,eAAe,GACxB,OAAO,GACP,KAAK,GACL,MAAM,GACN,OAAO,GACP,CAAC,MAAM,MAAM,CAAC,CAAC;AAElB,MAAM,WAAW,cAAc;IAC9B,mEAAmE;IACnE,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrE,8EAA8E;IAC9E,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnE;AAED,MAAM,WAAW,eAAe;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,eAAe,CAAC;IAC3B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACrC,UAAU,EAAE,cAAc,CAAC;IAC3B,MAAM,EAAE,eAAe,CAAC;CACxB;AAOD,eAAO,MAAM,oBAAoB,EAAE,eAMlC,CAAC;AASF,iFAAiF;AACjF,wBAAgB,iBAAiB,CAChC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,eAAe,GACtB,IAAI,CAEN;AAED,wEAAwE;AACxE,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,eAAe,CAE7D;AAUD,yEAAyE;AACzE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IAC1C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IACtC,UAAU,CAAC,EAAE,cAAc,CAAC;IAC5B,MAAM,EAAE,eAAe,CAAC;CACxB,GAAG,eAAe,CA0ClB;AA+CD,wDAAwD;AACxD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,CAiChD"}
|
package/dist/jsonLine.js
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The JSON line a structured channel writes: pino's shape.
|
|
3
|
+
*
|
|
4
|
+
* {"level":30,"time":1731000000000,"pid":4242,"hostname":"web-1","module":"app","userId":7,"msg":"signed in"}
|
|
5
|
+
*
|
|
6
|
+
* Numeric `level`, epoch-millisecond `time`, `pid` and `hostname` from `base`,
|
|
7
|
+
* bindings and merged fields at the root, the message under `msg` — what a
|
|
8
|
+
* dashboard, an alert rule or `pino-pretty` reads from a pino line. The keys
|
|
9
|
+
* and the time format follow the logger's `messageKey`, `timestamp`, `base`
|
|
10
|
+
* and `formatters` options, as they do upstream.
|
|
11
|
+
*/
|
|
12
|
+
import { hostname } from "node:os";
|
|
13
|
+
import { SpectrumError } from "./errors.js";
|
|
14
|
+
import { DEFAULT_STRINGIFY_LIMITS, stringifyRecord, } from "./stringify.js";
|
|
15
|
+
import { LOG_LEVEL_ORDER, logEntryExtras } from "./types.js";
|
|
16
|
+
const DEFAULT_BASE = {
|
|
17
|
+
pid: process.pid,
|
|
18
|
+
hostname: hostname(),
|
|
19
|
+
};
|
|
20
|
+
export const DEFAULT_LINE_OPTIONS = {
|
|
21
|
+
messageKey: "msg",
|
|
22
|
+
timestamp: "epoch",
|
|
23
|
+
base: DEFAULT_BASE,
|
|
24
|
+
formatters: {},
|
|
25
|
+
limits: DEFAULT_STRINGIFY_LIMITS,
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The options a logger configured for its entries. Channels are built
|
|
29
|
+
* independently of the logger writing to them, so the options travel with the
|
|
30
|
+
* entry; weak, so a written entry leaves nothing behind.
|
|
31
|
+
*/
|
|
32
|
+
const entryOptions = new WeakMap();
|
|
33
|
+
/** @internal Attach a logger's line options to an entry it is about to write. */
|
|
34
|
+
export function attachLineOptions(entry, options) {
|
|
35
|
+
entryOptions.set(entry, options);
|
|
36
|
+
}
|
|
37
|
+
/** The line options for this entry: its logger's, else the defaults. */
|
|
38
|
+
export function lineOptionsFor(entry) {
|
|
39
|
+
return entryOptions.get(entry) ?? DEFAULT_LINE_OPTIONS;
|
|
40
|
+
}
|
|
41
|
+
function invalid(detail) {
|
|
42
|
+
return new SpectrumError("E_SPECTRUM_INVALID_LINE_OPTIONS", detail);
|
|
43
|
+
}
|
|
44
|
+
function isRecord(value) {
|
|
45
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
46
|
+
}
|
|
47
|
+
/** Check the line options a config declares, filling in the defaults. */
|
|
48
|
+
export function resolveLineOptions(config) {
|
|
49
|
+
const { messageKey, timestamp, base, formatters } = config;
|
|
50
|
+
if (messageKey !== undefined &&
|
|
51
|
+
(typeof messageKey !== "string" || messageKey === "")) {
|
|
52
|
+
throw invalid("messageKey must be a non-empty string");
|
|
53
|
+
}
|
|
54
|
+
if (timestamp !== undefined &&
|
|
55
|
+
typeof timestamp !== "boolean" &&
|
|
56
|
+
typeof timestamp !== "function" &&
|
|
57
|
+
timestamp !== "epoch" &&
|
|
58
|
+
timestamp !== "iso" &&
|
|
59
|
+
timestamp !== "unix") {
|
|
60
|
+
throw invalid(`timestamp must be 'epoch', 'iso', 'unix', a boolean or a function, got ${String(timestamp)}`);
|
|
61
|
+
}
|
|
62
|
+
if (base !== undefined && base !== null && !isRecord(base)) {
|
|
63
|
+
throw invalid("base must be an object or null");
|
|
64
|
+
}
|
|
65
|
+
// Checked at run time too: a JavaScript config is not held to the types.
|
|
66
|
+
if (formatters !== undefined && !isRecord(formatters)) {
|
|
67
|
+
throw invalid("formatters must be an object");
|
|
68
|
+
}
|
|
69
|
+
const level = formatters?.level;
|
|
70
|
+
const log = formatters?.log;
|
|
71
|
+
if (level !== undefined && typeof level !== "function") {
|
|
72
|
+
throw invalid("formatters.level must be a function");
|
|
73
|
+
}
|
|
74
|
+
if (log !== undefined && typeof log !== "function") {
|
|
75
|
+
throw invalid("formatters.log must be a function");
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
messageKey: messageKey ?? DEFAULT_LINE_OPTIONS.messageKey,
|
|
79
|
+
timestamp: timestamp ?? DEFAULT_LINE_OPTIONS.timestamp,
|
|
80
|
+
base: base === undefined ? DEFAULT_BASE : base,
|
|
81
|
+
formatters: guardFormatters(formatters ?? {}),
|
|
82
|
+
limits: config.limits,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Formatters whose output is checked: one returning something other than an
|
|
87
|
+
* object would otherwise break the line it formats.
|
|
88
|
+
*/
|
|
89
|
+
function guardFormatters(formatters) {
|
|
90
|
+
const { level, log } = formatters;
|
|
91
|
+
return {
|
|
92
|
+
...(level !== undefined
|
|
93
|
+
? {
|
|
94
|
+
level: (label, number) => {
|
|
95
|
+
const out = level(label, number);
|
|
96
|
+
return isRecord(out) ? out : { level: number };
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
: {}),
|
|
100
|
+
...(log !== undefined
|
|
101
|
+
? {
|
|
102
|
+
log: (object) => {
|
|
103
|
+
const out = log(object);
|
|
104
|
+
return isRecord(out) ? out : object;
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
: {}),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
/** The `,"time":…` fragment, or "" when time is not written. */
|
|
111
|
+
function timeFragment(option, iso) {
|
|
112
|
+
if (option === false)
|
|
113
|
+
return "";
|
|
114
|
+
if (typeof option === "function")
|
|
115
|
+
return String(option());
|
|
116
|
+
const ms = Date.parse(iso);
|
|
117
|
+
// A hand-built entry may carry a timestamp that is no date: written as
|
|
118
|
+
// given rather than as `NaN`, which is not JSON and would break the line.
|
|
119
|
+
if (option === "iso" || !Number.isFinite(ms)) {
|
|
120
|
+
return `,"time":${JSON.stringify(iso)}`;
|
|
121
|
+
}
|
|
122
|
+
if (option === "unix")
|
|
123
|
+
return `,"time":${Math.round(ms / 1000)}`;
|
|
124
|
+
return `,"time":${ms}`;
|
|
125
|
+
}
|
|
126
|
+
/** `{…}` → `…`, so parts can be joined into one object. */
|
|
127
|
+
function inner(json) {
|
|
128
|
+
return json.slice(1, -1);
|
|
129
|
+
}
|
|
130
|
+
/** One JSON line (no trailing newline) for an entry. */
|
|
131
|
+
export function jsonLine(entry) {
|
|
132
|
+
const options = lineOptionsFor(entry);
|
|
133
|
+
const number = LOG_LEVEL_ORDER[entry.level];
|
|
134
|
+
const levelPart = options.formatters.level
|
|
135
|
+
? options.formatters.level(entry.level, number)
|
|
136
|
+
: { level: number };
|
|
137
|
+
let fields = {
|
|
138
|
+
...(options.base ?? {}),
|
|
139
|
+
module: entry.module,
|
|
140
|
+
correlationId: entry.correlationId,
|
|
141
|
+
data: entry.data,
|
|
142
|
+
...logEntryExtras(entry),
|
|
143
|
+
};
|
|
144
|
+
if (options.formatters.log)
|
|
145
|
+
fields = options.formatters.log(fields);
|
|
146
|
+
// A merged field named like the level, the time or the message would be
|
|
147
|
+
// read as the line's own (JSON.parse keeps the last duplicate), so a
|
|
148
|
+
// merging object could forge them. They are written once, by the logger.
|
|
149
|
+
const levelKeys = new Set(Object.keys(levelPart));
|
|
150
|
+
const rest = {};
|
|
151
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
152
|
+
if (levelKeys.has(key) || key === "time" || key === options.messageKey)
|
|
153
|
+
continue;
|
|
154
|
+
rest[key] = value;
|
|
155
|
+
}
|
|
156
|
+
rest[options.messageKey] = entry.message;
|
|
157
|
+
const parts = [
|
|
158
|
+
inner(stringifyRecord(levelPart, options.limits)),
|
|
159
|
+
timeFragment(options.timestamp, entry.timestamp).replace(/^,/, ""),
|
|
160
|
+
inner(stringifyRecord(rest, options.limits)),
|
|
161
|
+
].filter((part) => part !== "");
|
|
162
|
+
return `{${parts.join(",")}}`;
|
|
163
|
+
}
|
|
164
|
+
//# sourceMappingURL=jsonLine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonLine.js","sourceRoot":"","sources":["../src/jsonLine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EACN,wBAAwB,EAExB,eAAe,GACf,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,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AAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnD,IAAI,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,OAAO,CAAC,UAAU;YACrE,SAAS;QACV,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;IACnB,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC;IAEzC,MAAM,KAAK,GAAG;QACb,KAAK,CAAC,eAAe,CAAC,SAAS,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACjD,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;QAClE,KAAK,CAAC,eAAe,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;KAC5C,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IAChC,OAAO,IAAI,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAC/B,CAAC"}
|
package/dist/redact.d.ts
CHANGED
|
@@ -8,6 +8,11 @@
|
|
|
8
8
|
* silently does nothing. The config says the password is censored, and the
|
|
9
9
|
* password is written out in full.
|
|
10
10
|
*/
|
|
11
|
+
/**
|
|
12
|
+
* The paths of a `redact` option, checked: an array of strings, or an object
|
|
13
|
+
* whose `paths` is one.
|
|
14
|
+
*/
|
|
15
|
+
export declare function redactPathsOf(redact: unknown): string[][];
|
|
11
16
|
/**
|
|
12
17
|
* Split a redaction path into the keys it names.
|
|
13
18
|
*
|
|
@@ -16,8 +21,16 @@
|
|
|
16
21
|
*/
|
|
17
22
|
export declare function parseRedactPath(path: string): string[];
|
|
18
23
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
24
|
+
* What a matched value becomes: the censor's answer for the value and the
|
|
25
|
+
* concrete path it was found at (wildcards resolved), as upstream calls a
|
|
26
|
+
* censor function — or nothing at all, with `remove`.
|
|
27
|
+
*/
|
|
28
|
+
export interface RedactAction {
|
|
29
|
+
censor: (value: unknown, path: string[]) => unknown;
|
|
30
|
+
remove: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Replace everything `tokens` selects, without touching the input.
|
|
21
34
|
*
|
|
22
35
|
* Copy-on-write, and the copy is only made once something actually matched —
|
|
23
36
|
* so an entry with no redacted field is passed through by reference, which is
|
|
@@ -25,5 +38,5 @@ export declare function parseRedactPath(path: string): string[];
|
|
|
25
38
|
* honest: a path that names nothing leaves the object exactly as it was
|
|
26
39
|
* instead of inventing the key it was looking for.
|
|
27
40
|
*/
|
|
28
|
-
export declare function redactPath(node: unknown, tokens: readonly string[],
|
|
41
|
+
export declare function redactPath(node: unknown, tokens: readonly string[], action: RedactAction, depth?: number, trail?: readonly string[]): unknown;
|
|
29
42
|
//# sourceMappingURL=redact.d.ts.map
|
package/dist/redact.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;
|
|
1
|
+
{"version":3,"file":"redact.d.ts","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA0CH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,EAAE,CAezD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAQtD;AAED;;;;GAIG;AACH,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC;IACpD,MAAM,EAAE,OAAO,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CACzB,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,SAAS,MAAM,EAAE,EACzB,MAAM,EAAE,YAAY,EACpB,KAAK,SAAI,EACT,KAAK,GAAE,SAAS,MAAM,EAAO,GAC3B,OAAO,CA2BT"}
|
package/dist/redact.js
CHANGED
|
@@ -8,11 +8,68 @@
|
|
|
8
8
|
* silently does nothing. The config says the password is censored, and the
|
|
9
9
|
* password is written out in full.
|
|
10
10
|
*/
|
|
11
|
+
import { SpectrumError } from "./errors.js";
|
|
11
12
|
/**
|
|
12
13
|
* fast-redact's own tokenizer: a run of characters that is not `.`, `[` or
|
|
13
14
|
* `]`, or anything between a pair of brackets.
|
|
14
15
|
*/
|
|
15
16
|
const PATH_TOKEN = /[^.[\]]+|\[(?:.)*?\]/g;
|
|
17
|
+
function invalidPath(detail) {
|
|
18
|
+
return new SpectrumError("E_SPECTRUM_INVALID_REDACT_PATH", detail);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Refuse a path the tokenizer would read as something else.
|
|
22
|
+
*
|
|
23
|
+
* `password,token` used to parse as one key with a comma in it, match nothing,
|
|
24
|
+
* and write both fields in clear under a config that reads as censoring them.
|
|
25
|
+
* These are upstream's rules (empty, `..`, `,`, unbalanced brackets), checked
|
|
26
|
+
* when the logger is built so a typo fails at boot instead of in production.
|
|
27
|
+
*/
|
|
28
|
+
function validateRedactPath(path) {
|
|
29
|
+
if (path === "" || path.includes("..") || path.includes(",")) {
|
|
30
|
+
throw invalidPath(`Invalid redaction path (${path})`);
|
|
31
|
+
}
|
|
32
|
+
let depth = 0;
|
|
33
|
+
let quote = "";
|
|
34
|
+
for (const char of path) {
|
|
35
|
+
if ((char === '"' || char === "'") && depth > 0) {
|
|
36
|
+
if (quote === "")
|
|
37
|
+
quote = char;
|
|
38
|
+
else if (char === quote)
|
|
39
|
+
quote = "";
|
|
40
|
+
}
|
|
41
|
+
else if (char === "[" && quote === "") {
|
|
42
|
+
depth += 1;
|
|
43
|
+
}
|
|
44
|
+
else if (char === "]" && quote === "") {
|
|
45
|
+
depth -= 1;
|
|
46
|
+
if (depth < 0)
|
|
47
|
+
throw invalidPath(`Invalid redaction path (${path})`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (depth !== 0)
|
|
51
|
+
throw invalidPath(`Invalid redaction path (${path})`);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The paths of a `redact` option, checked: an array of strings, or an object
|
|
55
|
+
* whose `paths` is one.
|
|
56
|
+
*/
|
|
57
|
+
export function redactPathsOf(redact) {
|
|
58
|
+
if (redact === undefined)
|
|
59
|
+
return [];
|
|
60
|
+
const paths = typeof redact === "object" && redact !== null && "paths" in redact
|
|
61
|
+
? redact.paths
|
|
62
|
+
: redact;
|
|
63
|
+
if (!Array.isArray(paths)) {
|
|
64
|
+
throw invalidPath("redact must contain an array of strings");
|
|
65
|
+
}
|
|
66
|
+
return paths.map((path) => {
|
|
67
|
+
if (typeof path !== "string") {
|
|
68
|
+
throw invalidPath("Redaction paths must be (non-empty) strings");
|
|
69
|
+
}
|
|
70
|
+
return parseRedactPath(path);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
16
73
|
/**
|
|
17
74
|
* Split a redaction path into the keys it names.
|
|
18
75
|
*
|
|
@@ -20,6 +77,7 @@ const PATH_TOKEN = /[^.[\]]+|\[(?:.)*?\]/g;
|
|
|
20
77
|
* notation, not part of the name.
|
|
21
78
|
*/
|
|
22
79
|
export function parseRedactPath(path) {
|
|
80
|
+
validateRedactPath(path);
|
|
23
81
|
const tokens = path.match(PATH_TOKEN);
|
|
24
82
|
if (!tokens)
|
|
25
83
|
return [];
|
|
@@ -29,8 +87,7 @@ export function parseRedactPath(path) {
|
|
|
29
87
|
});
|
|
30
88
|
}
|
|
31
89
|
/**
|
|
32
|
-
* Replace everything `tokens` selects
|
|
33
|
-
* input.
|
|
90
|
+
* Replace everything `tokens` selects, without touching the input.
|
|
34
91
|
*
|
|
35
92
|
* Copy-on-write, and the copy is only made once something actually matched —
|
|
36
93
|
* so an entry with no redacted field is passed through by reference, which is
|
|
@@ -38,7 +95,7 @@ export function parseRedactPath(path) {
|
|
|
38
95
|
* honest: a path that names nothing leaves the object exactly as it was
|
|
39
96
|
* instead of inventing the key it was looking for.
|
|
40
97
|
*/
|
|
41
|
-
export function redactPath(node, tokens,
|
|
98
|
+
export function redactPath(node, tokens, action, depth = 0, trail = []) {
|
|
42
99
|
const segment = tokens[depth];
|
|
43
100
|
if (segment === undefined || node === null || typeof node !== "object") {
|
|
44
101
|
return node;
|
|
@@ -50,17 +107,31 @@ export function redactPath(node, tokens, censor, depth = 0) {
|
|
|
50
107
|
let copy = null;
|
|
51
108
|
for (const key of keys) {
|
|
52
109
|
const current = readKey(node, key);
|
|
110
|
+
const path = [...trail, key];
|
|
111
|
+
if (isLast && action.remove) {
|
|
112
|
+
copy ??= Array.isArray(node) ? [...node] : copyObject(node);
|
|
113
|
+
removeKey(copy, key);
|
|
114
|
+
continue;
|
|
115
|
+
}
|
|
53
116
|
const next = isLast
|
|
54
|
-
? censor
|
|
55
|
-
: redactPath(current, tokens,
|
|
117
|
+
? action.censor(current, path)
|
|
118
|
+
: redactPath(current, tokens, action, depth + 1, path);
|
|
56
119
|
if (next === current)
|
|
57
120
|
continue;
|
|
58
|
-
|
|
59
|
-
copy = Array.isArray(node) ? [...node] : { ...node };
|
|
121
|
+
copy ??= Array.isArray(node) ? [...node] : copyObject(node);
|
|
60
122
|
writeKey(copy, key, next);
|
|
61
123
|
}
|
|
62
124
|
return copy ?? node;
|
|
63
125
|
}
|
|
126
|
+
function removeKey(node, key) {
|
|
127
|
+
if (Array.isArray(node)) {
|
|
128
|
+
const index = Number(key);
|
|
129
|
+
if (Number.isInteger(index))
|
|
130
|
+
node[index] = undefined;
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
Reflect.deleteProperty(node, key);
|
|
134
|
+
}
|
|
64
135
|
/**
|
|
65
136
|
* The own keys a path segment selects.
|
|
66
137
|
*
|
|
@@ -74,9 +145,44 @@ function selectKeys(node, segment) {
|
|
|
74
145
|
return Object.keys(node);
|
|
75
146
|
return Object.hasOwn(node, segment) ? [segment] : [];
|
|
76
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* A shallow copy that is still what the original was.
|
|
150
|
+
*
|
|
151
|
+
* A spread made a plain object: the class prototype went, and its `toJSON`
|
|
152
|
+
* with it, so a model whose serialization hides its password hash wrote every
|
|
153
|
+
* field the moment a redaction path matched inside it. Keeping the prototype
|
|
154
|
+
* is what upstream's redactor does. Values are defined, not assigned, so a
|
|
155
|
+
* setter on the prototype is not run against the copy.
|
|
156
|
+
*/
|
|
157
|
+
function copyObject(node) {
|
|
158
|
+
const copy = {};
|
|
159
|
+
Reflect.setPrototypeOf(copy, Reflect.getPrototypeOf(node));
|
|
160
|
+
for (const key of Object.keys(node)) {
|
|
161
|
+
Object.defineProperty(copy, key, {
|
|
162
|
+
value: readKey(node, key),
|
|
163
|
+
enumerable: true,
|
|
164
|
+
writable: true,
|
|
165
|
+
configurable: true,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
return copy;
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* An own key's value, getter included.
|
|
172
|
+
*
|
|
173
|
+
* Reading the descriptor's `value` answered `undefined` for an accessor, so
|
|
174
|
+
* the walk stopped there while the line, written later, ran the getter and
|
|
175
|
+
* printed the secret behind it in clear. Upstream reads `source[key]`; so does
|
|
176
|
+
* this. A getter that throws cannot be written either, and is not allowed to
|
|
177
|
+
* take the line down with it.
|
|
178
|
+
*/
|
|
77
179
|
function readKey(node, key) {
|
|
78
|
-
|
|
79
|
-
|
|
180
|
+
try {
|
|
181
|
+
return Reflect.get(node, key);
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
return "[unreadable]";
|
|
185
|
+
}
|
|
80
186
|
}
|
|
81
187
|
function writeKey(node, key, value) {
|
|
82
188
|
if (Array.isArray(node)) {
|
|
@@ -85,6 +191,11 @@ function writeKey(node, key, value) {
|
|
|
85
191
|
node[index] = value;
|
|
86
192
|
return;
|
|
87
193
|
}
|
|
88
|
-
node
|
|
194
|
+
Object.defineProperty(node, key, {
|
|
195
|
+
value,
|
|
196
|
+
enumerable: true,
|
|
197
|
+
writable: true,
|
|
198
|
+
configurable: true,
|
|
199
|
+
});
|
|
89
200
|
}
|
|
90
201
|
//# sourceMappingURL=redact.js.map
|
package/dist/redact.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;GAGG;AACH,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAE3C;;;;;GAKG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC3C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,CAAC;IACvB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QACjE,OAAO,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"redact.js","sourceRoot":"","sources":["../src/redact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C;;;GAGG;AACH,MAAM,UAAU,GAAG,uBAAuB,CAAC;AAE3C,SAAS,WAAW,CAAC,MAAc;IAClC,OAAO,IAAI,aAAa,CAAC,gCAAgC,EAAE,MAAM,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AI,CAAC;QACJ,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,cAAc,CAAC;IACvB,CAAC;AACF,CAAC;AAED,SAAS,QAAQ,CAChB,IAAyC,EACzC,GAAW,EACX,KAAc;IAEd,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC1B,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC;YAAE,IAAI,CAAC,KAAK,CAAC,GAAG,KAAK,CAAC;QACjD,OAAO;IACR,CAAC;IACD,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE;QAChC,KAAK;QACL,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,YAAY,EAAE,IAAI;KAClB,CAAC,CAAC;AACJ,CAAC"}
|
package/dist/sanitize.d.ts
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Escape
|
|
3
|
-
* attacker-controlled value (a channel name, a message, an error string
|
|
4
|
-
*
|
|
5
|
-
* `ConsoleChannel` and `Logger`'s
|
|
6
|
-
* the same protection.
|
|
2
|
+
* Escape what a terminal or a log viewer would act on, so an
|
|
3
|
+
* attacker-controlled value (a channel name, a message, an error string, a
|
|
4
|
+
* correlation id from a request header) can neither inject extra log lines
|
|
5
|
+
* nor drive the terminal. Shared by `ConsoleChannel` and `Logger`'s
|
|
6
|
+
* channel-failure fallback so both paths get the same protection.
|
|
7
|
+
*
|
|
8
|
+
* Covered: every C0 control but TAB (CR/LF forge lines, BS overwrites what
|
|
9
|
+
* was printed, ESC starts a sequence), DEL, every C1 control (U+009B and
|
|
10
|
+
* U+009D are CSI and OSC on terminals that honour 8-bit controls, so
|
|
11
|
+
* `\u009b2J` clears the screen), and U+2028/U+2029, which viewers treat as
|
|
12
|
+
* line breaks.
|
|
7
13
|
*/
|
|
8
14
|
export declare function sanitizeLogValue(str: string): string;
|
|
9
15
|
//# sourceMappingURL=sanitize.d.ts.map
|
package/dist/sanitize.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sanitize.d.ts","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAUpD"}
|
package/dist/sanitize.js
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Escape
|
|
3
|
-
* attacker-controlled value (a channel name, a message, an error string
|
|
4
|
-
*
|
|
5
|
-
* `ConsoleChannel` and `Logger`'s
|
|
6
|
-
* the same protection.
|
|
2
|
+
* Escape what a terminal or a log viewer would act on, so an
|
|
3
|
+
* attacker-controlled value (a channel name, a message, an error string, a
|
|
4
|
+
* correlation id from a request header) can neither inject extra log lines
|
|
5
|
+
* nor drive the terminal. Shared by `ConsoleChannel` and `Logger`'s
|
|
6
|
+
* channel-failure fallback so both paths get the same protection.
|
|
7
|
+
*
|
|
8
|
+
* Covered: every C0 control but TAB (CR/LF forge lines, BS overwrites what
|
|
9
|
+
* was printed, ESC starts a sequence), DEL, every C1 control (U+009B and
|
|
10
|
+
* U+009D are CSI and OSC on terminals that honour 8-bit controls, so
|
|
11
|
+
* `\u009b2J` clears the screen), and U+2028/U+2029, which viewers treat as
|
|
12
|
+
* line breaks.
|
|
7
13
|
*/
|
|
8
14
|
export function sanitizeLogValue(str) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.
|
|
15
|
+
let out = "";
|
|
16
|
+
let from = 0;
|
|
17
|
+
for (let i = 0; i < str.length; i++) {
|
|
18
|
+
const code = str.charCodeAt(i);
|
|
19
|
+
if (!isUnsafe(code))
|
|
20
|
+
continue;
|
|
21
|
+
out += str.slice(from, i) + escapeCode(code);
|
|
22
|
+
from = i + 1;
|
|
23
|
+
}
|
|
24
|
+
return from === 0 ? str : out + str.slice(from);
|
|
25
|
+
}
|
|
26
|
+
function isUnsafe(code) {
|
|
27
|
+
return ((code < 0x20 && code !== 0x09) ||
|
|
28
|
+
(code >= 0x7f && code <= 0x9f) ||
|
|
29
|
+
code === 0x2028 ||
|
|
30
|
+
code === 0x2029);
|
|
31
|
+
}
|
|
32
|
+
function escapeCode(code) {
|
|
33
|
+
if (code === 0x0d)
|
|
34
|
+
return "\\r";
|
|
35
|
+
if (code === 0x0a)
|
|
36
|
+
return "\\n";
|
|
37
|
+
if (code === 0x1b)
|
|
38
|
+
return "[ESC]";
|
|
39
|
+
return `\\u${code.toString(16).padStart(4, "0")}`;
|
|
16
40
|
}
|
|
17
41
|
//# sourceMappingURL=sanitize.js.map
|
package/dist/sanitize.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sanitize.js","sourceRoot":"","sources":["../src/sanitize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC3C,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;QAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,SAAS;QAC9B,GAAG,IAAI,GAAG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Root":"","sources":["../../src/services/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,iEAAiE;AACjE,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED,8DAA8D;AAC9D,wBAAgB,SAAS,IAAI,MAAM,GAAG,SAAS,CAE9C;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,IAAI,IAAI,CAElC;AAKD,QAAA,MAAM,MAAM,EAAE,MAoBZ,CAAC;AAEH,eAAe,MAAM,CAAC"}
|
package/dist/services/main.js
CHANGED
|
@@ -28,8 +28,19 @@ export function getLogger() {
|
|
|
28
28
|
export function clearLogger() {
|
|
29
29
|
instance = undefined;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
/** What the proxy stands on: nothing of its own, every read is trapped. */
|
|
32
|
+
const target = Object.create(null);
|
|
33
|
+
const logger = new Proxy(target, {
|
|
32
34
|
get(_target, prop) {
|
|
35
|
+
// A module loader inspects what it imports before anyone uses it: it reads
|
|
36
|
+
// `then` to decide whether the namespace is thenable, and various symbols
|
|
37
|
+
// for interop and formatting. Throwing on those turns a plain
|
|
38
|
+
// `import { setLogger } from '.../services/main'` into a crash at import
|
|
39
|
+
// time, far from any real use. They are not logger members, so answer
|
|
40
|
+
// undefined and let a genuine access be the one that reports.
|
|
41
|
+
if (typeof prop === "symbol" || prop === "then") {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
33
44
|
if (!instance) {
|
|
34
45
|
throw new Error("[spectrum] Logger singleton accessed before SpectrumProvider.boot() ran. " +
|
|
35
46
|
"Check that `@c9up/spectrum/provider` is listed in your reamrc.ts providers.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sourceRoot":"","sources":["../../src/services/main.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,IAAI,QAA4B,CAAC;AAEjC,iEAAi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