@bluelibs/runner 4.5.0-alpha → 4.5.0-alpha.2
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/dist/index.cjs +4265 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.mts +1734 -0
- package/dist/index.d.ts +1696 -45
- package/dist/index.mjs +4233 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +11 -14
- package/dist/context.d.ts +0 -29
- package/dist/context.js +0 -52
- package/dist/context.js.map +0 -1
- package/dist/define.d.ts +0 -9
- package/dist/define.js +0 -32
- package/dist/define.js.map +0 -1
- package/dist/definers/defineEvent.d.ts +0 -2
- package/dist/definers/defineEvent.js +0 -23
- package/dist/definers/defineEvent.js.map +0 -1
- package/dist/definers/defineHook.d.ts +0 -6
- package/dist/definers/defineHook.js +0 -24
- package/dist/definers/defineHook.js.map +0 -1
- package/dist/definers/defineOverride.d.ts +0 -14
- package/dist/definers/defineOverride.js +0 -13
- package/dist/definers/defineOverride.js.map +0 -1
- package/dist/definers/defineResource.d.ts +0 -2
- package/dist/definers/defineResource.js +0 -69
- package/dist/definers/defineResource.js.map +0 -1
- package/dist/definers/defineResourceMiddleware.d.ts +0 -2
- package/dist/definers/defineResourceMiddleware.js +0 -42
- package/dist/definers/defineResourceMiddleware.js.map +0 -1
- package/dist/definers/defineTag.d.ts +0 -12
- package/dist/definers/defineTag.js +0 -107
- package/dist/definers/defineTag.js.map +0 -1
- package/dist/definers/defineTask.d.ts +0 -15
- package/dist/definers/defineTask.js +0 -42
- package/dist/definers/defineTask.js.map +0 -1
- package/dist/definers/defineTaskMiddleware.d.ts +0 -2
- package/dist/definers/defineTaskMiddleware.js +0 -42
- package/dist/definers/defineTaskMiddleware.js.map +0 -1
- package/dist/definers/tools.d.ts +0 -45
- package/dist/definers/tools.js +0 -75
- package/dist/definers/tools.js.map +0 -1
- package/dist/defs.d.ts +0 -29
- package/dist/defs.js +0 -45
- package/dist/defs.js.map +0 -1
- package/dist/errors.d.ts +0 -96
- package/dist/errors.js +0 -178
- package/dist/errors.js.map +0 -1
- package/dist/globals/globalEvents.d.ts +0 -17
- package/dist/globals/globalEvents.js +0 -33
- package/dist/globals/globalEvents.js.map +0 -1
- package/dist/globals/globalMiddleware.d.ts +0 -31
- package/dist/globals/globalMiddleware.js +0 -25
- package/dist/globals/globalMiddleware.js.map +0 -1
- package/dist/globals/globalResources.d.ts +0 -30
- package/dist/globals/globalResources.js +0 -55
- package/dist/globals/globalResources.js.map +0 -1
- package/dist/globals/globalTags.d.ts +0 -9
- package/dist/globals/globalTags.js +0 -23
- package/dist/globals/globalTags.js.map +0 -1
- package/dist/globals/middleware/cache.middleware.d.ts +0 -27
- package/dist/globals/middleware/cache.middleware.js +0 -73
- package/dist/globals/middleware/cache.middleware.js.map +0 -1
- package/dist/globals/middleware/requireContext.middleware.d.ts +0 -6
- package/dist/globals/middleware/requireContext.middleware.js +0 -16
- package/dist/globals/middleware/requireContext.middleware.js.map +0 -1
- package/dist/globals/middleware/retry.middleware.d.ts +0 -21
- package/dist/globals/middleware/retry.middleware.js +0 -61
- package/dist/globals/middleware/retry.middleware.js.map +0 -1
- package/dist/globals/middleware/timeout.middleware.d.ts +0 -9
- package/dist/globals/middleware/timeout.middleware.js +0 -61
- package/dist/globals/middleware/timeout.middleware.js.map +0 -1
- package/dist/globals/resources/debug/debug.resource.d.ts +0 -7
- package/dist/globals/resources/debug/debug.resource.js +0 -29
- package/dist/globals/resources/debug/debug.resource.js.map +0 -1
- package/dist/globals/resources/debug/debug.tag.d.ts +0 -2
- package/dist/globals/resources/debug/debug.tag.js +0 -12
- package/dist/globals/resources/debug/debug.tag.js.map +0 -1
- package/dist/globals/resources/debug/debugConfig.resource.d.ts +0 -22
- package/dist/globals/resources/debug/debugConfig.resource.js +0 -20
- package/dist/globals/resources/debug/debugConfig.resource.js.map +0 -1
- package/dist/globals/resources/debug/executionTracker.middleware.d.ts +0 -50
- package/dist/globals/resources/debug/executionTracker.middleware.js +0 -78
- package/dist/globals/resources/debug/executionTracker.middleware.js.map +0 -1
- package/dist/globals/resources/debug/globalEvent.hook.d.ts +0 -27
- package/dist/globals/resources/debug/globalEvent.hook.js +0 -38
- package/dist/globals/resources/debug/globalEvent.hook.js.map +0 -1
- package/dist/globals/resources/debug/hook.hook.d.ts +0 -30
- package/dist/globals/resources/debug/hook.hook.js +0 -48
- package/dist/globals/resources/debug/hook.hook.js.map +0 -1
- package/dist/globals/resources/debug/index.d.ts +0 -6
- package/dist/globals/resources/debug/index.js +0 -23
- package/dist/globals/resources/debug/index.js.map +0 -1
- package/dist/globals/resources/debug/middleware.hook.d.ts +0 -30
- package/dist/globals/resources/debug/middleware.hook.js +0 -75
- package/dist/globals/resources/debug/middleware.hook.js.map +0 -1
- package/dist/globals/resources/debug/types.d.ts +0 -25
- package/dist/globals/resources/debug/types.js +0 -65
- package/dist/globals/resources/debug/types.js.map +0 -1
- package/dist/globals/resources/debug/utils.d.ts +0 -2
- package/dist/globals/resources/debug/utils.js +0 -13
- package/dist/globals/resources/debug/utils.js.map +0 -1
- package/dist/globals/resources/queue.resource.d.ts +0 -10
- package/dist/globals/resources/queue.resource.js +0 -31
- package/dist/globals/resources/queue.resource.js.map +0 -1
- package/dist/globals/types.d.ts +0 -1
- package/dist/globals/types.js +0 -18
- package/dist/globals/types.js.map +0 -1
- package/dist/index.js +0 -48
- package/dist/index.js.map +0 -1
- package/dist/models/DependencyProcessor.d.ts +0 -48
- package/dist/models/DependencyProcessor.js +0 -276
- package/dist/models/DependencyProcessor.js.map +0 -1
- package/dist/models/EventManager.d.ts +0 -153
- package/dist/models/EventManager.js +0 -421
- package/dist/models/EventManager.js.map +0 -1
- package/dist/models/LogPrinter.d.ts +0 -55
- package/dist/models/LogPrinter.js +0 -202
- package/dist/models/LogPrinter.js.map +0 -1
- package/dist/models/Logger.d.ts +0 -85
- package/dist/models/Logger.js +0 -194
- package/dist/models/Logger.js.map +0 -1
- package/dist/models/MiddlewareManager.d.ts +0 -86
- package/dist/models/MiddlewareManager.js +0 -391
- package/dist/models/MiddlewareManager.js.map +0 -1
- package/dist/models/OverrideManager.d.ts +0 -13
- package/dist/models/OverrideManager.js +0 -84
- package/dist/models/OverrideManager.js.map +0 -1
- package/dist/models/Queue.d.ts +0 -25
- package/dist/models/Queue.js +0 -56
- package/dist/models/Queue.js.map +0 -1
- package/dist/models/ResourceInitializer.d.ts +0 -20
- package/dist/models/ResourceInitializer.js +0 -34
- package/dist/models/ResourceInitializer.js.map +0 -1
- package/dist/models/RunResult.d.ts +0 -35
- package/dist/models/RunResult.js +0 -62
- package/dist/models/RunResult.js.map +0 -1
- package/dist/models/Semaphore.d.ts +0 -61
- package/dist/models/Semaphore.js +0 -164
- package/dist/models/Semaphore.js.map +0 -1
- package/dist/models/Store.d.ts +0 -56
- package/dist/models/Store.js +0 -209
- package/dist/models/Store.js.map +0 -1
- package/dist/models/StoreRegistry.d.ts +0 -43
- package/dist/models/StoreRegistry.js +0 -375
- package/dist/models/StoreRegistry.js.map +0 -1
- package/dist/models/StoreValidator.d.ts +0 -8
- package/dist/models/StoreValidator.js +0 -73
- package/dist/models/StoreValidator.js.map +0 -1
- package/dist/models/TaskRunner.d.ts +0 -27
- package/dist/models/TaskRunner.js +0 -53
- package/dist/models/TaskRunner.js.map +0 -1
- package/dist/models/UnhandledError.d.ts +0 -11
- package/dist/models/UnhandledError.js +0 -32
- package/dist/models/UnhandledError.js.map +0 -1
- package/dist/models/index.d.ts +0 -11
- package/dist/models/index.js +0 -28
- package/dist/models/index.js.map +0 -1
- package/dist/models/utils/findCircularDependencies.d.ts +0 -16
- package/dist/models/utils/findCircularDependencies.js +0 -45
- package/dist/models/utils/findCircularDependencies.js.map +0 -1
- package/dist/models/utils/safeStringify.d.ts +0 -3
- package/dist/models/utils/safeStringify.js +0 -45
- package/dist/models/utils/safeStringify.js.map +0 -1
- package/dist/platform/browser.d.ts +0 -15
- package/dist/platform/browser.js +0 -98
- package/dist/platform/browser.js.map +0 -1
- package/dist/platform/index.d.ts +0 -8
- package/dist/platform/index.js +0 -47
- package/dist/platform/index.js.map +0 -1
- package/dist/platform/node.d.ts +0 -11
- package/dist/platform/node.js +0 -45
- package/dist/platform/node.js.map +0 -1
- package/dist/platform/types.d.ts +0 -28
- package/dist/platform/types.js +0 -19
- package/dist/platform/types.js.map +0 -1
- package/dist/platform/universal.d.ts +0 -16
- package/dist/platform/universal.js +0 -57
- package/dist/platform/universal.js.map +0 -1
- package/dist/processHooks.d.ts +0 -2
- package/dist/processHooks.js +0 -79
- package/dist/processHooks.js.map +0 -1
- package/dist/run.d.ts +0 -14
- package/dist/run.js +0 -126
- package/dist/run.js.map +0 -1
- package/dist/testing.d.ts +0 -25
- package/dist/testing.js +0 -42
- package/dist/testing.js.map +0 -1
- package/dist/tools/getCallerFile.d.ts +0 -1
- package/dist/tools/getCallerFile.js +0 -30
- package/dist/tools/getCallerFile.js.map +0 -1
- package/dist/types/contracts.d.ts +0 -55
- package/dist/types/contracts.js +0 -4
- package/dist/types/contracts.js.map +0 -1
- package/dist/types/event.d.ts +0 -74
- package/dist/types/event.js +0 -17
- package/dist/types/event.js.map +0 -1
- package/dist/types/hook.d.ts +0 -23
- package/dist/types/hook.js +0 -4
- package/dist/types/hook.js.map +0 -1
- package/dist/types/meta.d.ts +0 -18
- package/dist/types/meta.js +0 -7
- package/dist/types/meta.js.map +0 -1
- package/dist/types/resource.d.ts +0 -84
- package/dist/types/resource.js +0 -4
- package/dist/types/resource.js.map +0 -1
- package/dist/types/resourceMiddleware.d.ts +0 -47
- package/dist/types/resourceMiddleware.js +0 -4
- package/dist/types/resourceMiddleware.js.map +0 -1
- package/dist/types/runner.d.ts +0 -55
- package/dist/types/runner.js +0 -3
- package/dist/types/runner.js.map +0 -1
- package/dist/types/storeTypes.d.ts +0 -40
- package/dist/types/storeTypes.js +0 -3
- package/dist/types/storeTypes.js.map +0 -1
- package/dist/types/symbols.d.ts +0 -30
- package/dist/types/symbols.js +0 -40
- package/dist/types/symbols.js.map +0 -1
- package/dist/types/tag.d.ts +0 -46
- package/dist/types/tag.js +0 -4
- package/dist/types/tag.js.map +0 -1
- package/dist/types/task.d.ts +0 -44
- package/dist/types/task.js +0 -4
- package/dist/types/task.js.map +0 -1
- package/dist/types/taskMiddleware.d.ts +0 -48
- package/dist/types/taskMiddleware.js +0 -4
- package/dist/types/taskMiddleware.js.map +0 -1
- package/dist/types/utilities.d.ts +0 -110
- package/dist/types/utilities.js +0 -19
- package/dist/types/utilities.js.map +0 -1
|
@@ -1,202 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LogPrinter = void 0;
|
|
4
|
-
const safeStringify_1 = require("./utils/safeStringify");
|
|
5
|
-
// eslint-disable-next-line no-control-regex
|
|
6
|
-
const ansiRegex = /[][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
7
|
-
function stripAnsi(str) {
|
|
8
|
-
return str.replace(ansiRegex, "");
|
|
9
|
-
}
|
|
10
|
-
const COLORS = {
|
|
11
|
-
trace: "\x1b[90m",
|
|
12
|
-
debug: "\x1b[36m",
|
|
13
|
-
info: "\x1b[32m",
|
|
14
|
-
warn: "\x1b[33m",
|
|
15
|
-
error: "\x1b[31m",
|
|
16
|
-
critical: "\x1b[35m",
|
|
17
|
-
reset: "\x1b[0m",
|
|
18
|
-
bold: "\x1b[1m",
|
|
19
|
-
dim: "\x1b[2m",
|
|
20
|
-
blue: "\x1b[34m",
|
|
21
|
-
cyan: "\x1b[36m",
|
|
22
|
-
gray: "\x1b[90m",
|
|
23
|
-
};
|
|
24
|
-
const ICONS = {
|
|
25
|
-
trace: "○",
|
|
26
|
-
debug: "◆",
|
|
27
|
-
info: "●",
|
|
28
|
-
warn: "▲",
|
|
29
|
-
error: "✕",
|
|
30
|
-
critical: "█",
|
|
31
|
-
};
|
|
32
|
-
class LogPrinter {
|
|
33
|
-
constructor(options) {
|
|
34
|
-
this.strategy = options.strategy;
|
|
35
|
-
if (options.strategy === "plain") {
|
|
36
|
-
this.colors = LogPrinter.NO_COLORS;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
const base = options.useColors || options.colorTheme ? COLORS : LogPrinter.NO_COLORS;
|
|
40
|
-
this.colors = { ...base, ...(options.colorTheme || {}) };
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
print(log) {
|
|
44
|
-
if (this.strategy === "json") {
|
|
45
|
-
LogPrinter.writers.log((0, safeStringify_1.safeStringify)(this.normalizeForJson(log)));
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (this.strategy === "json_pretty") {
|
|
49
|
-
LogPrinter.writers.log((0, safeStringify_1.safeStringify)(this.normalizeForJson(log), 2));
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
// Pretty, multi-line output
|
|
53
|
-
const { level, source, message, timestamp, error, data, context } = log;
|
|
54
|
-
const timePart = this.formatTime(timestamp);
|
|
55
|
-
const levelPart = this.formatLevel(level);
|
|
56
|
-
const sourcePart = this.formatSource(source);
|
|
57
|
-
const headerLine = [timePart, levelPart, sourcePart]
|
|
58
|
-
.filter(Boolean)
|
|
59
|
-
.join(" ");
|
|
60
|
-
const messageString = this.formatMessage(message);
|
|
61
|
-
const messageLines = messageString.split("\n");
|
|
62
|
-
const output = [headerLine];
|
|
63
|
-
const timePartLength = stripAnsi(timePart).length;
|
|
64
|
-
const levelPartLength = stripAnsi(levelPart).length;
|
|
65
|
-
// Indentation is length of time + space + level + space
|
|
66
|
-
const indentation = " ".repeat(timePartLength + 1 + levelPartLength + 1);
|
|
67
|
-
if (message) {
|
|
68
|
-
output.push(...messageLines.map((line) => `${indentation}${line}`));
|
|
69
|
-
}
|
|
70
|
-
const errorLines = this.formatError(error);
|
|
71
|
-
const dataLines = this.formatData(data);
|
|
72
|
-
const contextLines = this.formatContext(context);
|
|
73
|
-
const detailsExist = errorLines.length > 0 || dataLines.length > 0 || contextLines.length > 0;
|
|
74
|
-
if (detailsExist) {
|
|
75
|
-
output.push(""); // Add a space before details
|
|
76
|
-
}
|
|
77
|
-
output.push(...errorLines, ...dataLines, ...contextLines);
|
|
78
|
-
if (detailsExist) {
|
|
79
|
-
output.push(""); // Add a space after for readability
|
|
80
|
-
}
|
|
81
|
-
const writer = this.pickWriter(level);
|
|
82
|
-
output.forEach((line) => writer(line));
|
|
83
|
-
// New line for readability especially in console
|
|
84
|
-
writer("");
|
|
85
|
-
}
|
|
86
|
-
pickWriter(level) {
|
|
87
|
-
const toError = level === "warn" || level === "error" || level === "critical";
|
|
88
|
-
if (toError && typeof LogPrinter.writers.error === "function") {
|
|
89
|
-
return (msg) => LogPrinter.writers.error(msg);
|
|
90
|
-
}
|
|
91
|
-
return (msg) => LogPrinter.writers.log(msg);
|
|
92
|
-
}
|
|
93
|
-
formatTime(timestamp) {
|
|
94
|
-
const time = timestamp.toISOString().slice(11, 19);
|
|
95
|
-
const ms = timestamp.getMilliseconds().toString().padStart(3, "0");
|
|
96
|
-
return `${this.colors.gray}${time}.${ms}${this.colors.reset}`;
|
|
97
|
-
}
|
|
98
|
-
formatLevel(level) {
|
|
99
|
-
const color = this.colors[level] || this.colors.info;
|
|
100
|
-
const icon = ICONS[level] || "●";
|
|
101
|
-
const label = level.toUpperCase().padEnd(7);
|
|
102
|
-
return `${color}${icon} ${this.colors.bold}${label}${this.colors.reset}`;
|
|
103
|
-
}
|
|
104
|
-
formatSource(source) {
|
|
105
|
-
if (!source)
|
|
106
|
-
return "";
|
|
107
|
-
return `${this.colors.cyan}${source}${this.colors.reset}`;
|
|
108
|
-
}
|
|
109
|
-
formatMessage(message) {
|
|
110
|
-
if (typeof message === "object" && message !== null) {
|
|
111
|
-
return (0, safeStringify_1.safeStringify)(message, 2);
|
|
112
|
-
}
|
|
113
|
-
return String(message);
|
|
114
|
-
}
|
|
115
|
-
formatError(error, indentation = " ") {
|
|
116
|
-
if (!error)
|
|
117
|
-
return [];
|
|
118
|
-
const lines = [];
|
|
119
|
-
lines.push(`${indentation}${this.colors.gray}╰─${this.colors.reset} ${this.colors.error}Error: ${error.name}: ${error.message}${this.colors.reset}`);
|
|
120
|
-
if (error.stack) {
|
|
121
|
-
const frames = error.stack.split("\n").slice(1); // slice(1) to skip the error message line
|
|
122
|
-
frames.forEach((frame) => {
|
|
123
|
-
const cleaned = frame.trim().replace(/^at /, "");
|
|
124
|
-
lines.push(`${indentation} ${this.colors.gray}↳${this.colors.reset} ${this.colors.dim}${cleaned}${this.colors.reset}`);
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
return lines;
|
|
128
|
-
}
|
|
129
|
-
formatData(data, indentation = " ") {
|
|
130
|
-
if (!data || Object.keys(data).length === 0)
|
|
131
|
-
return [];
|
|
132
|
-
const lines = [];
|
|
133
|
-
const formatted = (0, safeStringify_1.safeStringify)(data, 2, { maxDepth: 3 }).split("\n");
|
|
134
|
-
lines.push(`${indentation}${this.colors.gray}╰─${this.colors.reset} ${this.colors.cyan}Data:${this.colors.reset}`);
|
|
135
|
-
formatted.forEach((line) => {
|
|
136
|
-
// Keep data lines non-padded to save horizontal space
|
|
137
|
-
lines.push(`${indentation}${this.colors.dim}${line}${this.colors.reset}`);
|
|
138
|
-
});
|
|
139
|
-
return lines;
|
|
140
|
-
}
|
|
141
|
-
formatContext(context, indentation = " ") {
|
|
142
|
-
if (!context)
|
|
143
|
-
return [];
|
|
144
|
-
const filtered = { ...context };
|
|
145
|
-
delete filtered.source;
|
|
146
|
-
if (Object.keys(filtered).length === 0)
|
|
147
|
-
return [];
|
|
148
|
-
const lines = [];
|
|
149
|
-
const formatted = (0, safeStringify_1.safeStringify)(filtered, 2, { maxDepth: 3 }).split("\n");
|
|
150
|
-
lines.push(`${indentation}${this.colors.gray}╰─${this.colors.reset} ${this.colors.blue}Context:${this.colors.reset}`);
|
|
151
|
-
formatted.forEach((line) => {
|
|
152
|
-
// Keep context lines non-padded to save horizontal space
|
|
153
|
-
lines.push(`${indentation}${this.colors.dim}${line}${this.colors.reset}`);
|
|
154
|
-
});
|
|
155
|
-
return lines;
|
|
156
|
-
}
|
|
157
|
-
normalizeForJson(log) {
|
|
158
|
-
const normalized = { ...log };
|
|
159
|
-
if (typeof log.message === "object") {
|
|
160
|
-
const text = (0, safeStringify_1.safeStringify)(log.message);
|
|
161
|
-
try {
|
|
162
|
-
normalized.message = JSON.parse(text);
|
|
163
|
-
}
|
|
164
|
-
catch {
|
|
165
|
-
normalized.message = text;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
return normalized;
|
|
169
|
-
}
|
|
170
|
-
static setWriters(writers) {
|
|
171
|
-
LogPrinter.writers = { ...LogPrinter.writers, ...writers };
|
|
172
|
-
}
|
|
173
|
-
static resetWriters() {
|
|
174
|
-
// eslint-disable-next-line no-console
|
|
175
|
-
LogPrinter.writers = {
|
|
176
|
-
log: (msg) => console.log(msg),
|
|
177
|
-
error: (msg) => console.error?.(msg),
|
|
178
|
-
};
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
exports.LogPrinter = LogPrinter;
|
|
182
|
-
LogPrinter.NO_COLORS = {
|
|
183
|
-
trace: "",
|
|
184
|
-
debug: "",
|
|
185
|
-
info: "",
|
|
186
|
-
warn: "",
|
|
187
|
-
error: "",
|
|
188
|
-
critical: "",
|
|
189
|
-
reset: "",
|
|
190
|
-
bold: "",
|
|
191
|
-
dim: "",
|
|
192
|
-
blue: "",
|
|
193
|
-
cyan: "",
|
|
194
|
-
gray: "",
|
|
195
|
-
};
|
|
196
|
-
LogPrinter.writers = {
|
|
197
|
-
// eslint-disable-next-line no-console
|
|
198
|
-
log: (msg) => console.log(msg),
|
|
199
|
-
// eslint-disable-next-line no-console
|
|
200
|
-
error: (msg) => console.error?.(msg),
|
|
201
|
-
};
|
|
202
|
-
//# sourceMappingURL=LogPrinter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LogPrinter.js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AAC,OAAO,GAAG;YACnB,GAAG,EAAE,CAAC,GAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;YACnC,KAAK,EAAE,CAAC,GAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC;SAC1C,CAAC;IACJ,CAAC;;AAzNH,gCA0NC;AAtCgB,oBAAS,GAAe;IACrC,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,EAAE;IACZ,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,EAAE;IACR,GAAG,EAAE,EAAE;IACP,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;CACA,CAAC;AAEI,kBAAO,GAGlB;IACF,sCAAsC;IACtC,GAAG,EAAE,CAAC,GAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IACnC,sCAAsC;IACtC,KAAK,EAAE,CAAC,GAAQ,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC;CAC1C,CAAC"}
|
package/dist/models/Logger.d.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { LogPrinter, PrintStrategy as PrinterStrategy } from "./LogPrinter";
|
|
2
|
-
export type LogLevels = "trace" | "debug" | "info" | "warn" | "error" | "critical";
|
|
3
|
-
export interface ILogInfo {
|
|
4
|
-
source?: string;
|
|
5
|
-
error?: unknown | Error;
|
|
6
|
-
data?: Record<string, any>;
|
|
7
|
-
context?: Record<string, any>;
|
|
8
|
-
[key: string]: any;
|
|
9
|
-
}
|
|
10
|
-
export interface ILog {
|
|
11
|
-
level: LogLevels;
|
|
12
|
-
source?: string;
|
|
13
|
-
message: any;
|
|
14
|
-
timestamp: Date;
|
|
15
|
-
error?: {
|
|
16
|
-
name: string;
|
|
17
|
-
message: string;
|
|
18
|
-
stack?: string;
|
|
19
|
-
};
|
|
20
|
-
data?: Record<string, any>;
|
|
21
|
-
context?: Record<string, any>;
|
|
22
|
-
}
|
|
23
|
-
export type PrintStrategy = PrinterStrategy;
|
|
24
|
-
export declare class Logger {
|
|
25
|
-
private printThreshold;
|
|
26
|
-
private printStrategy;
|
|
27
|
-
private bufferLogs;
|
|
28
|
-
private buffer;
|
|
29
|
-
private boundContext;
|
|
30
|
-
private isLocked;
|
|
31
|
-
private useColors;
|
|
32
|
-
private printer;
|
|
33
|
-
private source?;
|
|
34
|
-
private rootLogger?;
|
|
35
|
-
localListeners: Array<(log: ILog) => void | Promise<void>>;
|
|
36
|
-
static Severity: {
|
|
37
|
-
trace: number;
|
|
38
|
-
debug: number;
|
|
39
|
-
info: number;
|
|
40
|
-
warn: number;
|
|
41
|
-
error: number;
|
|
42
|
-
critical: number;
|
|
43
|
-
};
|
|
44
|
-
constructor(options: {
|
|
45
|
-
printThreshold: null | LogLevels;
|
|
46
|
-
printStrategy: PrintStrategy;
|
|
47
|
-
bufferLogs: boolean;
|
|
48
|
-
useColors?: boolean;
|
|
49
|
-
}, boundContext?: Record<string, any>, source?: string, printer?: LogPrinter);
|
|
50
|
-
private detectColorSupport;
|
|
51
|
-
/**
|
|
52
|
-
* Creates a new logger instance with additional bound context
|
|
53
|
-
*/
|
|
54
|
-
with({ source, additionalContext: context, }: {
|
|
55
|
-
source?: string;
|
|
56
|
-
additionalContext?: Record<string, any>;
|
|
57
|
-
}): Logger;
|
|
58
|
-
/**
|
|
59
|
-
* Core logging method with structured LogInfo
|
|
60
|
-
*/
|
|
61
|
-
log(level: LogLevels, message: any, logInfo?: ILogInfo): Promise<void>;
|
|
62
|
-
private extractErrorInfo;
|
|
63
|
-
info(message: any, logInfo?: ILogInfo): Promise<void>;
|
|
64
|
-
error(message: any, logInfo?: ILogInfo): Promise<void>;
|
|
65
|
-
warn(message: any, logInfo?: ILogInfo): Promise<void>;
|
|
66
|
-
debug(message: any, logInfo?: ILogInfo): Promise<void>;
|
|
67
|
-
trace(message: any, logInfo?: ILogInfo): Promise<void>;
|
|
68
|
-
critical(message: any, logInfo?: ILogInfo): Promise<void>;
|
|
69
|
-
/**
|
|
70
|
-
* Direct print for tests and advanced scenarios. Delegates to LogPrinter.
|
|
71
|
-
*/
|
|
72
|
-
print(log: ILog): void;
|
|
73
|
-
/**
|
|
74
|
-
* @param listener - A listener that will be triggered for every log.
|
|
75
|
-
*/
|
|
76
|
-
onLog(listener: (log: ILog) => any): void;
|
|
77
|
-
/**
|
|
78
|
-
* Marks the logger as ready.
|
|
79
|
-
* This is used to trigger the local listeners and print the buffered logs (if they exists)
|
|
80
|
-
* @returns A promise that resolves when the logger is ready.
|
|
81
|
-
*/
|
|
82
|
-
lock(): Promise<void>;
|
|
83
|
-
private canPrint;
|
|
84
|
-
private triggerLogListeners;
|
|
85
|
-
}
|
package/dist/models/Logger.js
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Logger = void 0;
|
|
4
|
-
const LogPrinter_1 = require("./LogPrinter");
|
|
5
|
-
class Logger {
|
|
6
|
-
constructor(options, boundContext = {}, source, printer) {
|
|
7
|
-
this.printThreshold = "info";
|
|
8
|
-
this.printStrategy = "pretty";
|
|
9
|
-
this.bufferLogs = false;
|
|
10
|
-
this.buffer = [];
|
|
11
|
-
this.boundContext = {};
|
|
12
|
-
this.isLocked = false;
|
|
13
|
-
this.useColors = true;
|
|
14
|
-
// Observable why not?
|
|
15
|
-
this.localListeners = [];
|
|
16
|
-
this.boundContext = { ...boundContext };
|
|
17
|
-
this.printThreshold = options.printThreshold;
|
|
18
|
-
this.printStrategy = options.printStrategy;
|
|
19
|
-
this.bufferLogs = options.bufferLogs;
|
|
20
|
-
this.useColors =
|
|
21
|
-
typeof options.useColors === "boolean"
|
|
22
|
-
? options.useColors
|
|
23
|
-
: this.detectColorSupport();
|
|
24
|
-
this.source = source;
|
|
25
|
-
this.printer = printer
|
|
26
|
-
? printer
|
|
27
|
-
: new LogPrinter_1.LogPrinter({
|
|
28
|
-
strategy: this.printStrategy,
|
|
29
|
-
useColors: this.useColors,
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
detectColorSupport() {
|
|
33
|
-
// Respect NO_COLOR convention
|
|
34
|
-
// eslint-disable-next-line no-undef
|
|
35
|
-
const noColor = typeof process !== "undefined" && !!process.env.NO_COLOR;
|
|
36
|
-
if (noColor)
|
|
37
|
-
return false;
|
|
38
|
-
// eslint-disable-next-line no-undef
|
|
39
|
-
const isTty = typeof process !== "undefined" &&
|
|
40
|
-
!!process.stdout &&
|
|
41
|
-
!!process.stdout.isTTY;
|
|
42
|
-
return isTty;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Creates a new logger instance with additional bound context
|
|
46
|
-
*/
|
|
47
|
-
with({ source, additionalContext: context, }) {
|
|
48
|
-
const child = new Logger({
|
|
49
|
-
printThreshold: this.printThreshold,
|
|
50
|
-
printStrategy: this.printStrategy,
|
|
51
|
-
bufferLogs: this.bufferLogs,
|
|
52
|
-
useColors: this.useColors,
|
|
53
|
-
}, { ...this.boundContext, ...context }, source, this.printer);
|
|
54
|
-
// Ensure child logger delegates buffering, listeners and printing to root
|
|
55
|
-
child.rootLogger = this.rootLogger ?? this;
|
|
56
|
-
return child;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Core logging method with structured LogInfo
|
|
60
|
-
*/
|
|
61
|
-
async log(level, message, logInfo = {}) {
|
|
62
|
-
const { source, error, data, ...context } = logInfo;
|
|
63
|
-
const log = {
|
|
64
|
-
level,
|
|
65
|
-
message,
|
|
66
|
-
source: source || this.source,
|
|
67
|
-
timestamp: new Date(),
|
|
68
|
-
error: error ? this.extractErrorInfo(error) : undefined,
|
|
69
|
-
data: data || undefined,
|
|
70
|
-
context: { ...this.boundContext, ...context },
|
|
71
|
-
};
|
|
72
|
-
const root = this.rootLogger ?? this;
|
|
73
|
-
if (root.bufferLogs) {
|
|
74
|
-
root.buffer.push(log);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
await root.triggerLogListeners(log);
|
|
78
|
-
if (root.canPrint(level)) {
|
|
79
|
-
root.printer.print(log);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
extractErrorInfo(error) {
|
|
83
|
-
if (error instanceof Error) {
|
|
84
|
-
return {
|
|
85
|
-
name: error.name,
|
|
86
|
-
message: error.message,
|
|
87
|
-
stack: error.stack,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
name: "UnknownError",
|
|
92
|
-
message: String(error),
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
async info(message, logInfo) {
|
|
96
|
-
await this.log("info", message, logInfo);
|
|
97
|
-
}
|
|
98
|
-
async error(message, logInfo) {
|
|
99
|
-
await this.log("error", message, logInfo);
|
|
100
|
-
}
|
|
101
|
-
async warn(message, logInfo) {
|
|
102
|
-
await this.log("warn", message, logInfo);
|
|
103
|
-
}
|
|
104
|
-
async debug(message, logInfo) {
|
|
105
|
-
await this.log("debug", message, logInfo);
|
|
106
|
-
}
|
|
107
|
-
async trace(message, logInfo) {
|
|
108
|
-
await this.log("trace", message, logInfo);
|
|
109
|
-
}
|
|
110
|
-
async critical(message, logInfo) {
|
|
111
|
-
await this.log("critical", message, logInfo);
|
|
112
|
-
}
|
|
113
|
-
/**
|
|
114
|
-
* Direct print for tests and advanced scenarios. Delegates to LogPrinter.
|
|
115
|
-
*/
|
|
116
|
-
print(log) {
|
|
117
|
-
this.printer.print(log);
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* @param listener - A listener that will be triggered for every log.
|
|
121
|
-
*/
|
|
122
|
-
onLog(listener) {
|
|
123
|
-
if (this.rootLogger && this.rootLogger !== this) {
|
|
124
|
-
this.rootLogger.onLog(listener);
|
|
125
|
-
}
|
|
126
|
-
else {
|
|
127
|
-
this.localListeners.push(listener);
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
/**
|
|
131
|
-
* Marks the logger as ready.
|
|
132
|
-
* This is used to trigger the local listeners and print the buffered logs (if they exists)
|
|
133
|
-
* @returns A promise that resolves when the logger is ready.
|
|
134
|
-
*/
|
|
135
|
-
async lock() {
|
|
136
|
-
const root = this.rootLogger ?? this;
|
|
137
|
-
if (root.isLocked) {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
if (root.bufferLogs) {
|
|
141
|
-
for (const log of root.buffer) {
|
|
142
|
-
await root.triggerLogListeners(log);
|
|
143
|
-
}
|
|
144
|
-
for (const log of root.buffer) {
|
|
145
|
-
if (root.canPrint(log.level)) {
|
|
146
|
-
root.printer.print(log);
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
root.bufferLogs = false;
|
|
151
|
-
root.buffer = [];
|
|
152
|
-
root.isLocked = true;
|
|
153
|
-
}
|
|
154
|
-
canPrint(level) {
|
|
155
|
-
if (this.printThreshold === null) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
return (this.printThreshold &&
|
|
159
|
-
Logger.Severity[level] >= Logger.Severity[this.printThreshold]);
|
|
160
|
-
}
|
|
161
|
-
async triggerLogListeners(log) {
|
|
162
|
-
if (this.rootLogger && this.rootLogger !== this) {
|
|
163
|
-
await this.rootLogger.triggerLogListeners(log);
|
|
164
|
-
}
|
|
165
|
-
for (const listener of this.localListeners) {
|
|
166
|
-
try {
|
|
167
|
-
await listener(log);
|
|
168
|
-
}
|
|
169
|
-
catch (error) {
|
|
170
|
-
this.print({
|
|
171
|
-
level: "error",
|
|
172
|
-
message: "Error in log listener",
|
|
173
|
-
timestamp: new Date(),
|
|
174
|
-
error: {
|
|
175
|
-
name: "ListenerError",
|
|
176
|
-
message: error instanceof Error ? error.message : String(error),
|
|
177
|
-
},
|
|
178
|
-
});
|
|
179
|
-
// We're not breaking the app due to logListener errors.
|
|
180
|
-
continue;
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
exports.Logger = Logger;
|
|
186
|
-
Logger.Severity = {
|
|
187
|
-
trace: 0,
|
|
188
|
-
debug: 1,
|
|
189
|
-
info: 2,
|
|
190
|
-
warn: 3,
|
|
191
|
-
error: 4,
|
|
192
|
-
critical: 5,
|
|
193
|
-
};
|
|
194
|
-
//# sourceMappingURL=Logger.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.js","sourceRoot":"","sources":["../../src/models/Logger.ts"],"names":[],"mappings":";;;AAEA,6CAA4E;AAkC5E,MAAa,MAAM;IAwBjB,YACE,OAKC,EACD,eAAoC,EAAE,EACtC,MAAe,EACf,OAAoB;QAhCd,mBAAc,GAAqB,MAAM,CAAC;QAC1C,kBAAa,GAAkB,QAAQ,CAAC;QACxC,eAAU,GAAY,KAAK,CAAC;QAC5B,WAAM,GAAW,EAAE,CAAC;QACpB,iBAAY,GAAwB,EAAE,CAAC;QACvC,aAAQ,GAAY,KAAK,CAAC;QAC1B,cAAS,GAAY,IAAI,CAAC;QAKlC,sBAAsB;QACf,mBAAc,GAA+C,EAAE,CAAC;QAsBrE,IAAI,CAAC,YAAY,GAAG,EAAE,GAAG,YAAY,EAAE,CAAC;QACxC,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,aAAa,CAAC;QAC3C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,SAAS;YACZ,OAAO,OAAO,CAAC,SAAS,KAAK,SAAS;gBACpC,CAAC,CAAC,OAAO,CAAC,SAAS;gBACnB,CAAC,CAAC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAEhC,IAAI,CAAC,MAAM,GAAG,MAAM,CAA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AE,OAAO;oBACd,OAAO,EAAE,uBAAuB;oBAChC,SAAS,EAAE,IAAI,IAAI,EAAE;oBACrB,KAAK,EAAE;wBACL,IAAI,EAAE,eAAe;wBACrB,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;qBAChE;iBACF,CAAC,CAAC;gBACH,wDAAwD;gBACxD,SAAS;YACX,CAAC;QACH,CAAC;IACH,CAAC;;AAvPH,wBAwPC;AAzOe,eAAQ,GAAG;IACvB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;CACZ,AAPqB,CAOpB"}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import { DependencyMapType, ITask, IResource, ITaskMiddleware } from "../defs";
|
|
2
|
-
import { EventManager } from "./EventManager";
|
|
3
|
-
import { Store } from "./Store";
|
|
4
|
-
import { Logger } from "./Logger";
|
|
5
|
-
import { ITaskMiddlewareExecutionInput } from "../types/taskMiddleware";
|
|
6
|
-
import { IResourceMiddlewareExecutionInput, IResourceMiddleware } from "../types/resourceMiddleware";
|
|
7
|
-
/**
|
|
8
|
-
* Interceptor for task middleware execution
|
|
9
|
-
*/
|
|
10
|
-
export type TaskMiddlewareInterceptor = (next: (input: ITaskMiddlewareExecutionInput<any>) => Promise<any>, input: ITaskMiddlewareExecutionInput<any>) => Promise<any>;
|
|
11
|
-
/**
|
|
12
|
-
* Interceptor for resource middleware execution
|
|
13
|
-
*/
|
|
14
|
-
export type ResourceMiddlewareInterceptor = (next: (input: IResourceMiddlewareExecutionInput<any>) => Promise<any>, input: IResourceMiddlewareExecutionInput<any>) => Promise<any>;
|
|
15
|
-
/**
|
|
16
|
-
* Centralizes middleware composition and execution for both tasks and resources.
|
|
17
|
-
* Keeps observability emissions and unhandled error routing consistent.
|
|
18
|
-
*/
|
|
19
|
-
export declare class MiddlewareManager {
|
|
20
|
-
#private;
|
|
21
|
-
protected readonly store: Store;
|
|
22
|
-
protected readonly eventManager: EventManager;
|
|
23
|
-
protected readonly logger: Logger;
|
|
24
|
-
private taskMiddlewareInterceptors;
|
|
25
|
-
private resourceMiddlewareInterceptors;
|
|
26
|
-
private perMiddlewareInterceptors;
|
|
27
|
-
private perResourceMiddlewareInterceptors;
|
|
28
|
-
constructor(store: Store, eventManager: EventManager, logger: Logger);
|
|
29
|
-
/**
|
|
30
|
-
* Gets the current lock status of the MiddlewareManager
|
|
31
|
-
*/
|
|
32
|
-
get isLocked(): boolean;
|
|
33
|
-
/**
|
|
34
|
-
* Locks the MiddlewareManager, preventing any further modifications to interceptors
|
|
35
|
-
*/
|
|
36
|
-
lock(): void;
|
|
37
|
-
/**
|
|
38
|
-
* Throws an error if the MiddlewareManager is locked
|
|
39
|
-
*/
|
|
40
|
-
private checkLock;
|
|
41
|
-
/**
|
|
42
|
-
* Adds an interceptor for task or resource middleware execution
|
|
43
|
-
* Interceptors are executed in the order they are added, with the ability to
|
|
44
|
-
* modify, log, or prevent middleware execution
|
|
45
|
-
*
|
|
46
|
-
* @param kind - The type of middleware to intercept ("task" or "resource")
|
|
47
|
-
* @param interceptor - The interceptor function to add
|
|
48
|
-
*/
|
|
49
|
-
intercept(kind: "task" | "resource", interceptor: TaskMiddlewareInterceptor | ResourceMiddlewareInterceptor): void;
|
|
50
|
-
/**
|
|
51
|
-
* Adds an interceptor for a specific middleware instance with better type safety
|
|
52
|
-
* This method automatically determines the type and provides type-safe access
|
|
53
|
-
*
|
|
54
|
-
* @param middleware - The middleware instance to intercept
|
|
55
|
-
* @param interceptor - The interceptor function with proper typing
|
|
56
|
-
*/
|
|
57
|
-
interceptMiddleware(middleware: ITaskMiddleware<any, any, any, any> | IResourceMiddleware<any, any, any, any>, interceptor: TaskMiddlewareInterceptor | ResourceMiddlewareInterceptor): void;
|
|
58
|
-
/**
|
|
59
|
-
* Wrap a middleware with its specific interceptors in onion style
|
|
60
|
-
*/
|
|
61
|
-
private wrapMiddlewareWithInterceptors;
|
|
62
|
-
/**
|
|
63
|
-
* Wrap a resource middleware with its specific interceptors in onion style
|
|
64
|
-
*/
|
|
65
|
-
private wrapResourceMiddlewareWithInterceptors;
|
|
66
|
-
/**
|
|
67
|
-
* Compose a runner for a task with its local interceptors and applicable middlewares.
|
|
68
|
-
* Returns a function that accepts the task input and resolves to the task output.
|
|
69
|
-
*/
|
|
70
|
-
composeTaskRunner<TInput, TOutput extends Promise<any>, TDeps extends DependencyMapType>(task: ITask<TInput, TOutput, TDeps>): (input: any) => Promise<TOutput | (TOutput extends Promise<infer U> ? U : never)>;
|
|
71
|
-
/**
|
|
72
|
-
* Run a resource init wrapped with its applicable middlewares.
|
|
73
|
-
*/
|
|
74
|
-
runResourceInit<C, V extends Promise<any>, D extends DependencyMapType, TContext>(resource: IResource<C, V, D, TContext>, config: C, dependencies: any, context: TContext): Promise<V | undefined>;
|
|
75
|
-
private getApplicableTaskMiddlewares;
|
|
76
|
-
private getApplicableResourceMiddlewares;
|
|
77
|
-
/**
|
|
78
|
-
* @param task
|
|
79
|
-
* @returns
|
|
80
|
-
*/
|
|
81
|
-
getEverywhereMiddlewareForTasks(task: ITask<any, any, any, any>): ITaskMiddleware[];
|
|
82
|
-
/**
|
|
83
|
-
* Returns all global middleware for resource, which do not depend on the target resource.
|
|
84
|
-
*/
|
|
85
|
-
getEverywhereMiddlewareForResources(target: IResource<any, any, any, any>): IResourceMiddleware[];
|
|
86
|
-
}
|