@futdevpro/nts-dynamo 1.15.250 → 1.15.251
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/build/_collections/progress-line.util.d.ts +154 -0
- package/build/_collections/progress-line.util.d.ts.map +1 -0
- package/build/_collections/progress-line.util.js +312 -0
- package/build/_collections/progress-line.util.js.map +1 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `DyNTS_Progress_Util` — a **single-line, in-place progress indicator** (progress line / bar) for
|
|
3
|
+
* long-running work: scans, imports, embeddings, migrations, batch processing.
|
|
4
|
+
*
|
|
5
|
+
* ---
|
|
6
|
+
* ## Why this exists — and why a `console.log` inside the loop is not enough
|
|
7
|
+
*
|
|
8
|
+
* A long run has only ever offered two bad options:
|
|
9
|
+
*
|
|
10
|
+
* 1. **Silence.** The operator cannot tell whether the process is alive or where it is. A run that
|
|
11
|
+
* takes minutes is indistinguishable from a hang.
|
|
12
|
+
* 2. **A flood of lines.** One log line every N items drowns the output and pushes the messages that
|
|
13
|
+
* actually matter (warnings, errors) off the screen.
|
|
14
|
+
*
|
|
15
|
+
* This util provides the third option: **one line that is rewritten in place**.
|
|
16
|
+
*
|
|
17
|
+
* ## The important part: it does NOT disturb other logging
|
|
18
|
+
*
|
|
19
|
+
* A naive `\r`-based progress line collides with every other write to the console: if anything else
|
|
20
|
+
* prints while the line is on screen, the half-drawn progress text is left stuck to the start or the
|
|
21
|
+
* end of that message and the output becomes unreadable.
|
|
22
|
+
*
|
|
23
|
+
* Therefore, while a progress line is **active**, this util **wraps
|
|
24
|
+
* `console.log` / `info` / `warn` / `error` / `debug`**: it **erases** the progress line before any
|
|
25
|
+
* foreign write and **redraws** it afterwards.
|
|
26
|
+
*
|
|
27
|
+
* The consequence is that calling code needs to know **nothing** about the progress line. Messages
|
|
28
|
+
* from the framework logger, from raw `console` calls, and from third-party libraries all appear
|
|
29
|
+
* intact, and the progress line stays pinned to the bottom of the output.
|
|
30
|
+
*
|
|
31
|
+
* ## Non-TTY output (redirected to a file or a pipe): `\r` would be harmful
|
|
32
|
+
*
|
|
33
|
+
* When the destination is not a terminal (a CI log, `2> app.log`, a nodemon pipe), `\r` and ANSI
|
|
34
|
+
* escapes produce **garbage**: the lines overwrite each other and the file stops being readable by
|
|
35
|
+
* humans or machines. In that case this util **never rewrites anything**. It emits **throttled,
|
|
36
|
+
* standalone lines** instead (every 5 seconds by default), so the log file stays readable while the
|
|
37
|
+
* progress is still visible.
|
|
38
|
+
*
|
|
39
|
+
* ## Where it writes — and where it never writes
|
|
40
|
+
*
|
|
41
|
+
* **Always to `stderr`, never to `stdout`.** Reason: for the CLI tools in this fleet the purity of
|
|
42
|
+
* `--json` output is an invariant (`… --json | jq`), so stdout may carry the result envelope only.
|
|
43
|
+
* Progress is diagnostics, which belongs on stderr.
|
|
44
|
+
*
|
|
45
|
+
* ## Turning it off
|
|
46
|
+
*
|
|
47
|
+
* `DYNTS_NO_PROGRESS=1` (disables it entirely) or `enabled: false` at the call site.
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* const progress: DyNTS_Progress_Handle = DyNTS_Progress_Util.start({ label: 'scan', total: files.length });
|
|
51
|
+
* for (const file of files) {
|
|
52
|
+
* progress.update({ note: file.name }); // no argument needed: it advances by one
|
|
53
|
+
* }
|
|
54
|
+
* progress.done({ summary: `${files.length} files` });
|
|
55
|
+
*/
|
|
56
|
+
/** Options for starting a progress line. */
|
|
57
|
+
export interface DyNTS_Progress_Options {
|
|
58
|
+
/** Name of the operation; rendered at the start of the line (for example `'scan: agent-memory'`). */
|
|
59
|
+
label: string;
|
|
60
|
+
/** Total number of steps, when known up front. Without it a spinner and a counter are shown. */
|
|
61
|
+
total?: number;
|
|
62
|
+
/** Destination stream. Defaults to `process.stderr`; stdout is refused (pipe purity). */
|
|
63
|
+
stream?: NodeJS.WriteStream;
|
|
64
|
+
/** Minimum delay between two redraws on a TTY, in ms. Default 80 — without it drawing burns CPU. */
|
|
65
|
+
throttleMs?: number;
|
|
66
|
+
/** Minimum delay between two plain lines in non-TTY mode, in ms. Default 5000. */
|
|
67
|
+
plainEveryMs?: number;
|
|
68
|
+
/** Width of the bar in characters; only used when `total` is known. Default 24. */
|
|
69
|
+
barWidth?: number;
|
|
70
|
+
/** Explicit on/off. When omitted, the stream's TTY flag and `DYNTS_NO_PROGRESS` decide. */
|
|
71
|
+
enabled?: boolean;
|
|
72
|
+
}
|
|
73
|
+
/** Controller for a started progress line. */
|
|
74
|
+
export interface DyNTS_Progress_Handle {
|
|
75
|
+
/** Whether the line updates in place (TTY). Callers may use this to decide about extra output. */
|
|
76
|
+
readonly interactive: boolean;
|
|
77
|
+
/** Reports progress. `current` may be omitted, in which case the counter advances by one. */
|
|
78
|
+
update(set?: {
|
|
79
|
+
current?: number;
|
|
80
|
+
total?: number;
|
|
81
|
+
note?: string;
|
|
82
|
+
}): void;
|
|
83
|
+
/** Closes the line as SUCCESSFUL, replacing it with a permanent line. Idempotent. */
|
|
84
|
+
done(set?: {
|
|
85
|
+
summary?: string;
|
|
86
|
+
}): void;
|
|
87
|
+
/** Closes the line as FAILED. Same as `done`, but the final line marks the failure. Idempotent. */
|
|
88
|
+
fail(set?: {
|
|
89
|
+
summary?: string;
|
|
90
|
+
}): void;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* `DyNTS_Progress_Util` — the public surface of the progress line, plus the **pure** formatting
|
|
94
|
+
* helpers, so the behaviour can be unit-tested without a terminal.
|
|
95
|
+
*/
|
|
96
|
+
export declare class DyNTS_Progress_Util {
|
|
97
|
+
/**
|
|
98
|
+
* Starts a new progress line.
|
|
99
|
+
*
|
|
100
|
+
* **At most one progress line can be active at a time**, because there is only one physical
|
|
101
|
+
* "bottom line" in a terminal; two lines overwriting each other would only produce confusion.
|
|
102
|
+
* If one is already active when `start` is called, that one is closed (`done()`) and the new
|
|
103
|
+
* line takes its place.
|
|
104
|
+
*/
|
|
105
|
+
static start(options: DyNTS_Progress_Options): DyNTS_Progress_Handle;
|
|
106
|
+
/**
|
|
107
|
+
* Decides whether an in-place line makes sense.
|
|
108
|
+
*
|
|
109
|
+
* Order of precedence: explicit `enabled`, then `DYNTS_NO_PROGRESS`, then the stream's TTY flag.
|
|
110
|
+
* `stdout` is never accepted, because machine-readable output goes there.
|
|
111
|
+
*/
|
|
112
|
+
static isInteractive(set?: {
|
|
113
|
+
stream?: NodeJS.WriteStream;
|
|
114
|
+
enabled?: boolean;
|
|
115
|
+
}): boolean;
|
|
116
|
+
/** Whether the next plain line is due in non-TTY mode. Pure, therefore testable. */
|
|
117
|
+
static shouldEmitPlain(set: {
|
|
118
|
+
nowMs: number;
|
|
119
|
+
lastEmitMs: number;
|
|
120
|
+
everyMs: number;
|
|
121
|
+
}): boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Renders the bar. `current` is always clamped to `[0, total]`, so a caller that miscounts
|
|
124
|
+
* cannot produce a broken (negative or overflowing) bar.
|
|
125
|
+
*/
|
|
126
|
+
static renderBar(set: {
|
|
127
|
+
current: number;
|
|
128
|
+
total: number;
|
|
129
|
+
width: number;
|
|
130
|
+
}): string;
|
|
131
|
+
/** Percentage, rounded to an integer and clamped to `[0, 100]`. */
|
|
132
|
+
static percent(set: {
|
|
133
|
+
current: number;
|
|
134
|
+
total: number;
|
|
135
|
+
}): number;
|
|
136
|
+
/** Elapsed time in a short, human-readable form; the line has to fit on one terminal row. */
|
|
137
|
+
static formatElapsed(ms: number): string;
|
|
138
|
+
/**
|
|
139
|
+
* Builds the full progress text.
|
|
140
|
+
*
|
|
141
|
+
* With a known `total`: bar, percentage and `current/total`. With an unknown `total`: spinner and
|
|
142
|
+
* counter only — a ratio is never invented for a number that was never provided.
|
|
143
|
+
*/
|
|
144
|
+
static formatLine(set: {
|
|
145
|
+
label: string;
|
|
146
|
+
current: number;
|
|
147
|
+
total?: number;
|
|
148
|
+
note?: string;
|
|
149
|
+
barWidth: number;
|
|
150
|
+
spinner: string;
|
|
151
|
+
elapsedMs: number;
|
|
152
|
+
}): string;
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=progress-line.util.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-line.util.d.ts","sourceRoot":"","sources":["../../src/_collections/progress-line.util.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH,4CAA4C;AAC5C,MAAM,WAAW,sBAAsB;IACnC,qGAAqG;IACrG,KAAK,EAAE,MAAM,CAAC;IACd,gGAAgG;IAChG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,MAAM,CAAC,EAAE,MAAM,CAAC,WAAW,CAAC;IAC5B,oGAAoG;IACpG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,kFAAkF;IAClF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2FAA2F;IAC3F,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,8CAA8C;AAC9C,MAAM,WAAW,qBAAqB;IAClC,kGAAkG;IAClG,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,6FAA6F;IAC7F,MAAM,CAAC,GAAG,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACxE,qFAAqF;IACrF,IAAI,CAAC,GAAG,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACvC,mGAAmG;IACnG,IAAI,CAAC,GAAG,CAAC,EA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icator** (progress line / bar) for
|
|
4
|
+
* long-running work: scans, imports, embeddings, migrations, batch processing.
|
|
5
|
+
*
|
|
6
|
+
* ---
|
|
7
|
+
* ## Why this exists — and why a `console.log` inside the loop is not enough
|
|
8
|
+
*
|
|
9
|
+
* A long run has only ever offered two bad options:
|
|
10
|
+
*
|
|
11
|
+
* 1. **Silence.** The operator cannot tell whether the process is alive or where it is. A run that
|
|
12
|
+
* takes minutes is indistinguishable from a hang.
|
|
13
|
+
* 2. **A flood of lines.** One log line every N items drowns the output and pushes the messages that
|
|
14
|
+
* actually matter (warnings, errors) off the screen.
|
|
15
|
+
*
|
|
16
|
+
* This util provides the third option: **one line that is rewritten in place**.
|
|
17
|
+
*
|
|
18
|
+
* ## The important part: it does NOT disturb other logging
|
|
19
|
+
*
|
|
20
|
+
* A naive `\r`-based progress line collides with every other write to the console: if anything else
|
|
21
|
+
* prints while the line is on screen, the half-drawn progress text is left stuck to the start or the
|
|
22
|
+
* end of that message and the output becomes unreadable.
|
|
23
|
+
*
|
|
24
|
+
* Therefore, while a progress line is **active**, this util **wraps
|
|
25
|
+
* `console.log` / `info` / `warn` / `error` / `debug`**: it **erases** the progress line before any
|
|
26
|
+
* foreign write and **redraws** it afterwards.
|
|
27
|
+
*
|
|
28
|
+
* The consequence is that calling code needs to know **nothing** about the progress line. Messages
|
|
29
|
+
* from the framework logger, from raw `console` calls, and from third-party libraries all appear
|
|
30
|
+
* intact, and the progress line stays pinned to the bottom of the output.
|
|
31
|
+
*
|
|
32
|
+
* ## Non-TTY output (redirected to a file or a pipe): `\r` would be harmful
|
|
33
|
+
*
|
|
34
|
+
* When the destination is not a terminal (a CI log, `2> app.log`, a nodemon pipe), `\r` and ANSI
|
|
35
|
+
* escapes produce **garbage**: the lines overwrite each other and the file stops being readable by
|
|
36
|
+
* humans or machines. In that case this util **never rewrites anything**. It emits **throttled,
|
|
37
|
+
* standalone lines** instead (every 5 seconds by default), so the log file stays readable while the
|
|
38
|
+
* progress is still visible.
|
|
39
|
+
*
|
|
40
|
+
* ## Where it writes — and where it never writes
|
|
41
|
+
*
|
|
42
|
+
* **Always to `stderr`, never to `stdout`.** Reason: for the CLI tools in this fleet the purity of
|
|
43
|
+
* `--json` output is an invariant (`… --json | jq`), so stdout may carry the result envelope only.
|
|
44
|
+
* Progress is diagnostics, which belongs on stderr.
|
|
45
|
+
*
|
|
46
|
+
* ## Turning it off
|
|
47
|
+
*
|
|
48
|
+
* `DYNTS_NO_PROGRESS=1` (disables it entirely) or `enabled: false` at the call site.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* const progress: DyNTS_Progress_Handle = DyNTS_Progress_Util.start({ label: 'scan', total: files.length });
|
|
52
|
+
* for (const file of files) {
|
|
53
|
+
* progress.update({ note: file.name }); // no argument needed: it advances by one
|
|
54
|
+
* }
|
|
55
|
+
* progress.done({ summary: `${files.length} files` });
|
|
56
|
+
*/
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
exports.DyNTS_Progress_Util = void 0;
|
|
59
|
+
/**
|
|
60
|
+
* Erase sequence: return to the start of the line, then clear the whole line (ANSI `EL 2`).
|
|
61
|
+
*
|
|
62
|
+
* The `\x1b` escape is written **explicitly** rather than as a raw ESC byte in the source: an
|
|
63
|
+
* invisible control character can be swallowed silently by an editor, an encoding change or a bulk
|
|
64
|
+
* search-and-replace, and the progress line would then print the literal text `[2K` instead of
|
|
65
|
+
* erasing anything.
|
|
66
|
+
*/
|
|
67
|
+
const CLEAR_LINE = '\r\x1b[2K';
|
|
68
|
+
/** Spinner frames, used when `total` is unknown, to show that the process is alive. */
|
|
69
|
+
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
70
|
+
/** The currently active progress line; at most one at a time (see `start`). */
|
|
71
|
+
let activeLine = undefined;
|
|
72
|
+
const CONSOLE_METHODS = ['log', 'info', 'warn', 'error', 'debug'];
|
|
73
|
+
let originalConsole = {};
|
|
74
|
+
/** Our own wrappers; restoration only happens while these are still the installed functions. */
|
|
75
|
+
let installedConsole = {};
|
|
76
|
+
/** Internal state of a running progress line. Not exported: callers receive the handle interface. */
|
|
77
|
+
class ProgressLine {
|
|
78
|
+
interactive;
|
|
79
|
+
stream;
|
|
80
|
+
label;
|
|
81
|
+
throttleMs;
|
|
82
|
+
plainEveryMs;
|
|
83
|
+
barWidth;
|
|
84
|
+
total;
|
|
85
|
+
current = 0;
|
|
86
|
+
note = '';
|
|
87
|
+
frame = 0;
|
|
88
|
+
lastDrawMs = 0;
|
|
89
|
+
lastPlainMs = 0;
|
|
90
|
+
drawn = false;
|
|
91
|
+
finished = false;
|
|
92
|
+
startedMs = Date.now();
|
|
93
|
+
constructor(options) {
|
|
94
|
+
this.stream = options.stream ?? process.stderr;
|
|
95
|
+
this.label = options.label;
|
|
96
|
+
this.total = options.total;
|
|
97
|
+
this.throttleMs = options.throttleMs ?? 80;
|
|
98
|
+
this.plainEveryMs = options.plainEveryMs ?? 5000;
|
|
99
|
+
this.barWidth = options.barWidth ?? 24;
|
|
100
|
+
this.interactive = DyNTS_Progress_Util.isInteractive({ stream: this.stream, enabled: options.enabled });
|
|
101
|
+
}
|
|
102
|
+
update(set) {
|
|
103
|
+
if (this.finished) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
this.current = set?.current ?? this.current + 1;
|
|
107
|
+
if (set?.total !== undefined) {
|
|
108
|
+
this.total = set.total;
|
|
109
|
+
}
|
|
110
|
+
if (set?.note !== undefined) {
|
|
111
|
+
this.note = set.note;
|
|
112
|
+
}
|
|
113
|
+
const now = Date.now();
|
|
114
|
+
if (this.interactive) {
|
|
115
|
+
if (now - this.lastDrawMs < this.throttleMs) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.lastDrawMs = now;
|
|
119
|
+
this.frame += 1;
|
|
120
|
+
this.draw();
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
// Non-TTY: never overwrite. Throttled standalone lines keep the log file readable.
|
|
124
|
+
if (DyNTS_Progress_Util.shouldEmitPlain({
|
|
125
|
+
nowMs: now, lastEmitMs: this.lastPlainMs, everyMs: this.plainEveryMs,
|
|
126
|
+
})) {
|
|
127
|
+
this.lastPlainMs = now;
|
|
128
|
+
this.stream.write(`${this.buildText()}\n`);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
done(set) {
|
|
132
|
+
this.finish({ summary: set?.summary, ok: true });
|
|
133
|
+
}
|
|
134
|
+
fail(set) {
|
|
135
|
+
this.finish({ summary: set?.summary, ok: false });
|
|
136
|
+
}
|
|
137
|
+
/** Erases the progress line; called by the console wrapper before every foreign write. */
|
|
138
|
+
clear() {
|
|
139
|
+
if (!this.interactive || !this.drawn) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
this.stream.write(CLEAR_LINE);
|
|
143
|
+
this.drawn = false;
|
|
144
|
+
}
|
|
145
|
+
/** Redraws the line after a foreign write, so it stays pinned to the bottom of the output. */
|
|
146
|
+
redraw() {
|
|
147
|
+
if (!this.interactive || this.finished) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
this.draw();
|
|
151
|
+
}
|
|
152
|
+
/** Current text of the progress line; the final line is built from the same text. */
|
|
153
|
+
buildText() {
|
|
154
|
+
return DyNTS_Progress_Util.formatLine({
|
|
155
|
+
label: this.label,
|
|
156
|
+
current: this.current,
|
|
157
|
+
total: this.total,
|
|
158
|
+
note: this.note,
|
|
159
|
+
barWidth: this.barWidth,
|
|
160
|
+
spinner: SPINNER_FRAMES[this.frame % SPINNER_FRAMES.length],
|
|
161
|
+
elapsedMs: Date.now() - this.startedMs,
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/** Draws on a TTY: erase, then rewrite without a newline, which is what keeps it on one line. */
|
|
165
|
+
draw() {
|
|
166
|
+
this.stream.write(`${CLEAR_LINE}${this.buildText()}`);
|
|
167
|
+
this.drawn = true;
|
|
168
|
+
}
|
|
169
|
+
/** Shared close path. The final line is always emitted, on TTY and non-TTY alike, exactly once. */
|
|
170
|
+
finish(set) {
|
|
171
|
+
if (this.finished) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
this.finished = true;
|
|
175
|
+
this.clear();
|
|
176
|
+
const mark = set.ok ? '✔' : '✖';
|
|
177
|
+
const tail = set.summary ? ` — ${set.summary}` : '';
|
|
178
|
+
this.stream.write(`${mark} ${this.buildText()}${tail}\n`);
|
|
179
|
+
if (activeLine === this) {
|
|
180
|
+
activeLine = undefined;
|
|
181
|
+
restoreConsole();
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
/** Installs the console wrappers; only while a progress line is active. */
|
|
186
|
+
function installConsole() {
|
|
187
|
+
if (Object.keys(originalConsole).length > 0) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
for (const method of CONSOLE_METHODS) {
|
|
191
|
+
// The ORIGINAL reference is stored, not a `.bind()` copy. A bound copy is functionally
|
|
192
|
+
// equivalent but has a different identity, so restoring it would not give the caller back
|
|
193
|
+
// the exact function it had, and repeated start/close cycles would stack bind layers.
|
|
194
|
+
const original = console[method];
|
|
195
|
+
originalConsole[method] = original;
|
|
196
|
+
const wrapper = (...args) => {
|
|
197
|
+
// The core behaviour: erase before the foreign message, redraw after it.
|
|
198
|
+
activeLine?.clear();
|
|
199
|
+
original.apply(console, args);
|
|
200
|
+
activeLine?.redraw();
|
|
201
|
+
};
|
|
202
|
+
installedConsole[method] = wrapper;
|
|
203
|
+
console[method] = wrapper;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Restores the console methods.
|
|
208
|
+
*
|
|
209
|
+
* Restoration happens only while **our** wrapper is still the installed function. If something else
|
|
210
|
+
* (a test harness, a file logger) installed its own wrapper on top of ours in the meantime, a blind
|
|
211
|
+
* restore would silently knock that wrapper out of place.
|
|
212
|
+
*/
|
|
213
|
+
function restoreConsole() {
|
|
214
|
+
for (const method of CONSOLE_METHODS) {
|
|
215
|
+
const current = console[method];
|
|
216
|
+
const original = originalConsole[method];
|
|
217
|
+
if (original && current === installedConsole[method]) {
|
|
218
|
+
console[method] = original;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
originalConsole = {};
|
|
222
|
+
installedConsole = {};
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* `DyNTS_Progress_Util` — the public surface of the progress line, plus the **pure** formatting
|
|
226
|
+
* helpers, so the behaviour can be unit-tested without a terminal.
|
|
227
|
+
*/
|
|
228
|
+
class DyNTS_Progress_Util {
|
|
229
|
+
/**
|
|
230
|
+
* Starts a new progress line.
|
|
231
|
+
*
|
|
232
|
+
* **At most one progress line can be active at a time**, because there is only one physical
|
|
233
|
+
* "bottom line" in a terminal; two lines overwriting each other would only produce confusion.
|
|
234
|
+
* If one is already active when `start` is called, that one is closed (`done()`) and the new
|
|
235
|
+
* line takes its place.
|
|
236
|
+
*/
|
|
237
|
+
static start(options) {
|
|
238
|
+
activeLine?.done();
|
|
239
|
+
const line = new ProgressLine(options);
|
|
240
|
+
activeLine = line;
|
|
241
|
+
if (line.interactive) {
|
|
242
|
+
installConsole();
|
|
243
|
+
}
|
|
244
|
+
return line;
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Decides whether an in-place line makes sense.
|
|
248
|
+
*
|
|
249
|
+
* Order of precedence: explicit `enabled`, then `DYNTS_NO_PROGRESS`, then the stream's TTY flag.
|
|
250
|
+
* `stdout` is never accepted, because machine-readable output goes there.
|
|
251
|
+
*/
|
|
252
|
+
static isInteractive(set) {
|
|
253
|
+
if (set?.enabled !== undefined) {
|
|
254
|
+
return set.enabled;
|
|
255
|
+
}
|
|
256
|
+
if (process.env.DYNTS_NO_PROGRESS) {
|
|
257
|
+
return false;
|
|
258
|
+
}
|
|
259
|
+
const stream = set?.stream ?? process.stderr;
|
|
260
|
+
if (stream === process.stdout) {
|
|
261
|
+
return false;
|
|
262
|
+
}
|
|
263
|
+
return Boolean(stream.isTTY);
|
|
264
|
+
}
|
|
265
|
+
/** Whether the next plain line is due in non-TTY mode. Pure, therefore testable. */
|
|
266
|
+
static shouldEmitPlain(set) {
|
|
267
|
+
return set.nowMs - set.lastEmitMs >= set.everyMs;
|
|
268
|
+
}
|
|
269
|
+
/**
|
|
270
|
+
* Renders the bar. `current` is always clamped to `[0, total]`, so a caller that miscounts
|
|
271
|
+
* cannot produce a broken (negative or overflowing) bar.
|
|
272
|
+
*/
|
|
273
|
+
static renderBar(set) {
|
|
274
|
+
if (set.total <= 0 || set.width <= 0) {
|
|
275
|
+
return '';
|
|
276
|
+
}
|
|
277
|
+
const ratio = Math.min(1, Math.max(0, set.current / set.total));
|
|
278
|
+
const filled = Math.round(ratio * set.width);
|
|
279
|
+
return `[${'█'.repeat(filled)}${'░'.repeat(set.width - filled)}]`;
|
|
280
|
+
}
|
|
281
|
+
/** Percentage, rounded to an integer and clamped to `[0, 100]`. */
|
|
282
|
+
static percent(set) {
|
|
283
|
+
if (set.total <= 0) {
|
|
284
|
+
return 0;
|
|
285
|
+
}
|
|
286
|
+
return Math.min(100, Math.max(0, Math.round((set.current / set.total) * 100)));
|
|
287
|
+
}
|
|
288
|
+
/** Elapsed time in a short, human-readable form; the line has to fit on one terminal row. */
|
|
289
|
+
static formatElapsed(ms) {
|
|
290
|
+
const totalSeconds = Math.max(0, Math.floor(ms / 1000));
|
|
291
|
+
const minutes = Math.floor(totalSeconds / 60);
|
|
292
|
+
const seconds = totalSeconds % 60;
|
|
293
|
+
return minutes > 0 ? `${minutes}m${String(seconds).padStart(2, '0')}s` : `${seconds}s`;
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Builds the full progress text.
|
|
297
|
+
*
|
|
298
|
+
* With a known `total`: bar, percentage and `current/total`. With an unknown `total`: spinner and
|
|
299
|
+
* counter only — a ratio is never invented for a number that was never provided.
|
|
300
|
+
*/
|
|
301
|
+
static formatLine(set) {
|
|
302
|
+
const head = set.total !== undefined && set.total > 0
|
|
303
|
+
? `${DyNTS_Progress_Util.renderBar({ current: set.current, total: set.total, width: set.barWidth })} `
|
|
304
|
+
+ `${String(DyNTS_Progress_Util.percent({ current: set.current, total: set.total })).padStart(3)}% `
|
|
305
|
+
+ `${set.current}/${set.total}`
|
|
306
|
+
: `${set.spinner} ${set.current}`;
|
|
307
|
+
const tail = set.note ? ` · ${set.note}` : '';
|
|
308
|
+
return `${set.label} ${head} · ${DyNTS_Progress_Util.formatElapsed(set.elapsedMs)}${tail}`;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
exports.DyNTS_Progress_Util = DyNTS_Progress_Util;
|
|
312
|
+
//# sourceMappingURL=progress-line.util.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-line.util.js","sourceRoot":"","sources":["../../src/_collections/progress-line.util.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;;;AAgCH;;;;;;;GAOG;AACH,MAAM,UAAU,GAAW,WAAW,CAAC;AAEvC,uFAAuF;AACvF,MAAM,cAAc,GAAa,CAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAE,CAAC;AAEtF,+EAA+E;AAC/E,IAAI,UAAU,GAA6B,SAAS,CAAC;AAIrD,MAAM,eAAe,GAAoB,CAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAE,CAAC;AAErF,IAAI,eAAe,GAA8C,EAAE,CAAC;AACpE,gGAAgG;AAChG,IAAI,gBAAgB,GAA8C,EAAE,CAAC;AAErE,qGAAqG;AACrG,MAAM,YAAY;IAEE,WAAW,CAAU;IACpB,MAAM,CAAqB;IAC3B,KAAK,CAAS;IACd,UAAU,CAA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G,CAAC;IAC3F,CAAC;IAED;;;;;OAKG;IACI,MAAM,CAAC,UAAU,CAAC,GAQxB;QACG,MAAM,IAAI,GAAW,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,KAAK,GAAG,CAAC;YACzD,CAAC,CAAC,GAAG,mBAAmB,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,CAAC,QAAQ,EAAE,CAAC,GAAG;kBAChG,GAAG,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;kBAClG,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,KAAK,EAAE;YACnC,CAAC,CAAC,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC;QACtC,MAAM,IAAI,GAAW,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAEtD,OAAO,GAAG,GAAG,CAAC,KAAK,IAAI,IAAI,MAAM,mBAAmB,CAAC,aAAa,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,CAAC;IAC/F,CAAC;CACJ;AA3FD,kDA2FC"}
|
package/build/index.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export * from './_models/interfaces/migration-entry.interface';
|
|
|
31
31
|
export * from './_models/interfaces/mongo-transaction-settings.interface';
|
|
32
32
|
export * from './_collections/security-headers.util';
|
|
33
33
|
export * from './_collections/app-version-header.util';
|
|
34
|
+
export * from './_collections/progress-line.util';
|
|
34
35
|
export * from './_collections/signed-url.util';
|
|
35
36
|
export * from './_collections/client-safe-error.util';
|
|
36
37
|
export * from './_collections/client-safe-error-response.interface';
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2BA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,qDAAqD,CAAC;AACpE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,0CAA0C,CAAC;AACzD,cAAc,8CAA8C,CAAC;AAC7D,cAAc,sCAAsC,CAAC;AAIrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAK7C,mEAAmE;AACnE,cAAc,yDAAyD,CAAC;AACxE,cAAc,uDAAuD,CAAC;AACtE,cAAc,qDAAqD,CAAC;AACpE,cAAc,wDAAwD,CAAC;AACvE,cAAc,gDAAgD,CAAC;AAC/D,cAAc,wDAAwD,CAAC;AACvE,cAAc,yDAAyD,CAAC;AACxE,cAAc,uDAAuD,CAAC;AACtE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,0DAA0D,CAAC;AACzE,cAAc,4DAA4D,CAAC;AAC3E,cAAc,2DAA2D,CAAC;AAC1E,cAAc,2DAA2D,CAAC;AAC1E,cAAc,iDAAiD,CAAC;AAChE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,gDAAgD,CAAC;AAC/D,cAAc,2DAA2D,CAAC;AAC1E,cAAc,sCAAsC,CAAC;AACrD,cAAc,wCAAwC,CAAC;AACvD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,qDAAqD,CAAC;AACpE,cAAc,+BAA+B,CAAC;AAC9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,2CAA2C,CAAC;AAC1D,cAAc,uCAAuC,CAAC;AACtD,cAAc,oCA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c,8BAA8B,CAAC;AAC7C,cAAc,+BAA+B,CAAC;AAE9C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oDAAoD,CAAC;AACnE,cAAc,iCAAiC,CAAC;AAChD,cAAc,uCAAuC,CAAC;AACtD,cAAc,oDAAoD,CAAC;AAEnE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,cAAc,oDAAoD,CAAC;AAGnE,cAAc,mCAAmC,CAAC;AAClD,cAAc,uCAAuC,CAAC;AACtD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,yCAAyC,CAAC;AACxD,cAAc,oCAAoC,CAAC;AAGnD,cAAc,+BAA+B,CAAC;AAG9C,cAAc,sCAAsC,CAAC;AACrD,cAAc,0CAA0C,CAAC;AAGzD,cAAc,mCAAmC,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -60,6 +60,7 @@ tslib_1.__exportStar(require("./_models/interfaces/migration-entry.interface"),
|
|
|
60
60
|
tslib_1.__exportStar(require("./_models/interfaces/mongo-transaction-settings.interface"), exports);
|
|
61
61
|
tslib_1.__exportStar(require("./_collections/security-headers.util"), exports);
|
|
62
62
|
tslib_1.__exportStar(require("./_collections/app-version-header.util"), exports);
|
|
63
|
+
tslib_1.__exportStar(require("./_collections/progress-line.util"), exports);
|
|
63
64
|
tslib_1.__exportStar(require("./_collections/signed-url.util"), exports);
|
|
64
65
|
tslib_1.__exportStar(require("./_collections/client-safe-error.util"), exports);
|
|
65
66
|
tslib_1.__exportStar(require("./_collections/client-safe-error-response.interface"), exports);
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;IAsBI;;;AAEJ,cAAc;AACd,sEAA4C;AAC5C,8EAAoD;AACpD,wFAA8D;AAC9D,8FAAoE;AACpE,sFAA4D;AAC5D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D,6EAAmD;AAEnD,kBAAkB;AAClB,wEAA8C;AAE9C,iBAAiB;AACjB,+EAAqD;AACrD,mFAAyD;AAEzD,kBAAkB;AAClB,4EAAkD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/nts-dynamo",
|
|
3
|
-
"version": "01.15.
|
|
3
|
+
"version": "01.15.251",
|
|
4
4
|
"description": "Dynamic NodeTS (NodeJS-Typescript), MongoDB Backend System Framework by Future Development Program Ltd.",
|
|
5
5
|
"DyBu_settings": {
|
|
6
6
|
"packageType": "server-package",
|