@futdevpro/nts-dynamo 1.15.251 → 1.15.254
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/LICENSE +21 -21
- package/README.md +789 -789
- package/build/_collections/progress-handle.interface.d.ts +20 -0
- package/build/_collections/progress-handle.interface.d.ts.map +1 -0
- package/build/_collections/progress-handle.interface.js +3 -0
- package/build/_collections/progress-handle.interface.js.map +1 -0
- package/build/_collections/progress-line.util.d.ts +5 -92
- package/build/_collections/progress-line.util.d.ts.map +1 -1
- package/build/_collections/progress-line.util.js +93 -26
- package/build/_collections/progress-line.util.js.map +1 -1
- package/build/_collections/progress-options.interface.d.ts +21 -0
- package/build/_collections/progress-options.interface.d.ts.map +1 -0
- package/build/_collections/progress-options.interface.js +3 -0
- package/build/_collections/progress-options.interface.js.map +1 -0
- package/build/_modules/privacy-lifecycle/_enums/privacy-rights-notification-state.type-enum.d.ts +15 -0
- package/build/_modules/privacy-lifecycle/_enums/privacy-rights-notification-state.type-enum.d.ts.map +1 -0
- package/build/_modules/privacy-lifecycle/_enums/privacy-rights-notification-state.type-enum.js +20 -0
- package/build/_modules/privacy-lifecycle/_enums/privacy-rights-notification-state.type-enum.js.map +1 -0
- package/build/_modules/privacy-lifecycle/_models/privacy-rights-notification.interface.d.ts +63 -0
- package/build/_modules/privacy-lifecycle/_models/privacy-rights-notification.interface.d.ts.map +1 -0
- package/build/_modules/privacy-lifecycle/_models/privacy-rights-notification.interface.js +3 -0
- package/build/_modules/privacy-lifecycle/_models/privacy-rights-notification.interface.js.map +1 -0
- package/build/_modules/privacy-lifecycle/index.d.ts +3 -0
- package/build/_modules/privacy-lifecycle/index.d.ts.map +1 -1
- package/build/_modules/privacy-lifecycle/index.js +6 -1
- package/build/_modules/privacy-lifecycle/index.js.map +1 -1
- package/build/_modules/privacy-lifecycle/privacy-rights-notification.mongo-store.d.ts +72 -0
- package/build/_modules/privacy-lifecycle/privacy-rights-notification.mongo-store.d.ts.map +1 -0
- package/build/_modules/privacy-lifecycle/privacy-rights-notification.mongo-store.js +681 -0
- package/build/_modules/privacy-lifecycle/privacy-rights-notification.mongo-store.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Controller for a started progress line. */
|
|
2
|
+
export interface DyNTS_Progress_Handle {
|
|
3
|
+
/** Whether the line updates in place (TTY). Callers may use this to decide about extra output. */
|
|
4
|
+
readonly isInteractive: boolean;
|
|
5
|
+
/** Reports progress. `current` may be omitted, in which case the counter advances by one. */
|
|
6
|
+
update(set?: {
|
|
7
|
+
current?: number;
|
|
8
|
+
total?: number;
|
|
9
|
+
note?: string;
|
|
10
|
+
}): void;
|
|
11
|
+
/** Closes the line as SUCCESSFUL, replacing it with a permanent line. Idempotent. */
|
|
12
|
+
done(set?: {
|
|
13
|
+
summary?: string;
|
|
14
|
+
}): void;
|
|
15
|
+
/** Closes the line as FAILED. Same as `done`, but the final line marks the failure. Idempotent. */
|
|
16
|
+
fail(set?: {
|
|
17
|
+
summary?: string;
|
|
18
|
+
}): void;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=progress-handle.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-handle.interface.d.ts","sourceRoot":"","sources":["../../src/_collections/progress-handle.interface.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,MAAM,WAAW,qBAAqB;IACpC,kGAAkG;IAClG,QAAQ,CAAC,aAAa,EAAE,OAAO,CAAC;IAChC,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,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACxC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-handle.interface.js","sourceRoot":"","sources":["../../src/_collections/progress-handle.interface.ts"],"names":[],"mappings":""}
|
|
@@ -1,94 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
}
|
|
1
|
+
import { DyNTS_Progress_Handle } from './progress-handle.interface';
|
|
2
|
+
import { DyNTS_Progress_Options } from './progress-options.interface';
|
|
3
|
+
type ProgressStream = NonNullable<DyNTS_Progress_Options['stream']>;
|
|
92
4
|
/**
|
|
93
5
|
* `DyNTS_Progress_Util` — the public surface of the progress line, plus the **pure** formatting
|
|
94
6
|
* helpers, so the behaviour can be unit-tested without a terminal.
|
|
@@ -110,7 +22,7 @@ export declare class DyNTS_Progress_Util {
|
|
|
110
22
|
* `stdout` is never accepted, because machine-readable output goes there.
|
|
111
23
|
*/
|
|
112
24
|
static isInteractive(set?: {
|
|
113
|
-
stream?:
|
|
25
|
+
stream?: ProgressStream;
|
|
114
26
|
enabled?: boolean;
|
|
115
27
|
}): boolean;
|
|
116
28
|
/** Whether the next plain line is due in non-TTY mode. Pure, therefore testable. */
|
|
@@ -151,4 +63,5 @@ export declare class DyNTS_Progress_Util {
|
|
|
151
63
|
elapsedMs: number;
|
|
152
64
|
}): string;
|
|
153
65
|
}
|
|
66
|
+
export {};
|
|
154
67
|
//# sourceMappingURL=progress-line.util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-line.util.d.ts","sourceRoot":"","sources":["../../src/_collections/progress-line.util.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"progress-line.util.d.ts","sourceRoot":"","sources":["../../src/_collections/progress-line.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAEtE,KAAK,cAAc,GAAG,WAAW,CAAC,sBAAsB,CAAC,QAAQ,CAAC,CAAC,CAAC;AAqUpE;;;GAGG;AACH,qBAAa,mBAAmB;IAC9B;;;;;;;OAOG;WACW,KAAK,CAAC,OAAO,EAAE,sBAAsB,GAAG,qBAAqB;IAa3E;;;;;OAKG;WACW,aAAa,CAAC,GAAG,CAAC,EAAE;QAChC,MAAM,CAAC,EAAE,cAAc,CAAC;QACxB,OAAO,CAAC,EAAE,OAAO,CAAC;KACnB,GAAG,OAAO;IAiBX,oFAAoF;WACtE,eAAe,CAAC,GAAG,EAAE;QACjC,KAAK,EAAE,MAAM,CAAC;QACd,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO;IAIX;;;OAGG;WACW,SAAS,CAAC,GAAG,EAAE;QAC3B,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,EAAE,MAAM,CAAC;QACd,KAAK,EAAE,MAAM,CAAC;KACf,GAAG,MAAM;IAUV,mEAAmE;WACrD,OAAO,CAAC,GAAG,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,MAAM;IAWtE,6FAA6F;WAC/E,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM;IAU/C;;;;;OAKG;WACW,UAAU,CAAC,GAAG,EAAE;QAC5B,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;KACnB,GAAG,MAAM;CAWX"}
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyNTS_Progress_Util = void 0;
|
|
4
|
+
var ConsoleMethod;
|
|
5
|
+
(function (ConsoleMethod) {
|
|
6
|
+
ConsoleMethod["log"] = "log";
|
|
7
|
+
ConsoleMethod["info"] = "info";
|
|
8
|
+
ConsoleMethod["warn"] = "warn";
|
|
9
|
+
ConsoleMethod["error"] = "error";
|
|
10
|
+
ConsoleMethod["debug"] = "debug";
|
|
11
|
+
})(ConsoleMethod || (ConsoleMethod = {}));
|
|
2
12
|
/**
|
|
3
13
|
* `DyNTS_Progress_Util` — a **single-line, in-place progress indicator** (progress line / bar) for
|
|
4
14
|
* long-running work: scans, imports, embeddings, migrations, batch processing.
|
|
@@ -54,8 +64,6 @@
|
|
|
54
64
|
* }
|
|
55
65
|
* progress.done({ summary: `${files.length} files` });
|
|
56
66
|
*/
|
|
57
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
-
exports.DyNTS_Progress_Util = void 0;
|
|
59
67
|
/**
|
|
60
68
|
* Erase sequence: return to the start of the line, then clear the whole line (ANSI `EL 2`).
|
|
61
69
|
*
|
|
@@ -66,16 +74,28 @@ exports.DyNTS_Progress_Util = void 0;
|
|
|
66
74
|
*/
|
|
67
75
|
const CLEAR_LINE = '\r\x1b[2K';
|
|
68
76
|
/** Spinner frames, used when `total` is unknown, to show that the process is alive. */
|
|
69
|
-
const SPINNER_FRAMES = [
|
|
77
|
+
const SPINNER_FRAMES = [
|
|
78
|
+
'⠋',
|
|
79
|
+
'⠙',
|
|
80
|
+
'⠹',
|
|
81
|
+
'⠸',
|
|
82
|
+
'⠼',
|
|
83
|
+
'⠴',
|
|
84
|
+
'⠦',
|
|
85
|
+
'⠧',
|
|
86
|
+
'⠇',
|
|
87
|
+
'⠏',
|
|
88
|
+
];
|
|
70
89
|
/** The currently active progress line; at most one at a time (see `start`). */
|
|
71
90
|
let activeLine = undefined;
|
|
72
|
-
|
|
91
|
+
/** Console methods that are wrapped while a progress line is active. */
|
|
92
|
+
const CONSOLE_METHODS = Object.values(ConsoleMethod);
|
|
73
93
|
let originalConsole = {};
|
|
74
94
|
/** Our own wrappers; restoration only happens while these are still the installed functions. */
|
|
75
95
|
let installedConsole = {};
|
|
76
96
|
/** Internal state of a running progress line. Not exported: callers receive the handle interface. */
|
|
77
97
|
class ProgressLine {
|
|
78
|
-
|
|
98
|
+
isInteractive;
|
|
79
99
|
stream;
|
|
80
100
|
label;
|
|
81
101
|
throttleMs;
|
|
@@ -87,9 +107,10 @@ class ProgressLine {
|
|
|
87
107
|
frame = 0;
|
|
88
108
|
lastDrawMs = 0;
|
|
89
109
|
lastPlainMs = 0;
|
|
90
|
-
|
|
91
|
-
|
|
110
|
+
isDrawn = false;
|
|
111
|
+
isFinished = false;
|
|
92
112
|
startedMs = Date.now();
|
|
113
|
+
/** Creates one progress line using already bounded caller options. */
|
|
93
114
|
constructor(options) {
|
|
94
115
|
this.stream = options.stream ?? process.stderr;
|
|
95
116
|
this.label = options.label;
|
|
@@ -97,10 +118,14 @@ class ProgressLine {
|
|
|
97
118
|
this.throttleMs = options.throttleMs ?? 80;
|
|
98
119
|
this.plainEveryMs = options.plainEveryMs ?? 5000;
|
|
99
120
|
this.barWidth = options.barWidth ?? 24;
|
|
100
|
-
this.
|
|
121
|
+
this.isInteractive = DyNTS_Progress_Util.isInteractive({
|
|
122
|
+
stream: this.stream,
|
|
123
|
+
enabled: options.enabled,
|
|
124
|
+
});
|
|
101
125
|
}
|
|
126
|
+
/** Advances or replaces the current progress counters and optional note. */
|
|
102
127
|
update(set) {
|
|
103
|
-
if (this.
|
|
128
|
+
if (this.isFinished) {
|
|
104
129
|
return;
|
|
105
130
|
}
|
|
106
131
|
this.current = set?.current ?? this.current + 1;
|
|
@@ -111,7 +136,7 @@ class ProgressLine {
|
|
|
111
136
|
this.note = set.note;
|
|
112
137
|
}
|
|
113
138
|
const now = Date.now();
|
|
114
|
-
if (this.
|
|
139
|
+
if (this.isInteractive) {
|
|
115
140
|
if (now - this.lastDrawMs < this.throttleMs) {
|
|
116
141
|
return;
|
|
117
142
|
}
|
|
@@ -122,29 +147,33 @@ class ProgressLine {
|
|
|
122
147
|
}
|
|
123
148
|
// Non-TTY: never overwrite. Throttled standalone lines keep the log file readable.
|
|
124
149
|
if (DyNTS_Progress_Util.shouldEmitPlain({
|
|
125
|
-
nowMs: now,
|
|
150
|
+
nowMs: now,
|
|
151
|
+
lastEmitMs: this.lastPlainMs,
|
|
152
|
+
everyMs: this.plainEveryMs,
|
|
126
153
|
})) {
|
|
127
154
|
this.lastPlainMs = now;
|
|
128
155
|
this.stream.write(`${this.buildText()}\n`);
|
|
129
156
|
}
|
|
130
157
|
}
|
|
158
|
+
/** Finalizes the line once with a success marker. */
|
|
131
159
|
done(set) {
|
|
132
160
|
this.finish({ summary: set?.summary, ok: true });
|
|
133
161
|
}
|
|
162
|
+
/** Finalizes the line once with a failure marker. */
|
|
134
163
|
fail(set) {
|
|
135
164
|
this.finish({ summary: set?.summary, ok: false });
|
|
136
165
|
}
|
|
137
166
|
/** Erases the progress line; called by the console wrapper before every foreign write. */
|
|
138
167
|
clear() {
|
|
139
|
-
if (!this.
|
|
168
|
+
if (!this.isInteractive || !this.isDrawn) {
|
|
140
169
|
return;
|
|
141
170
|
}
|
|
142
171
|
this.stream.write(CLEAR_LINE);
|
|
143
|
-
this.
|
|
172
|
+
this.isDrawn = false;
|
|
144
173
|
}
|
|
145
174
|
/** Redraws the line after a foreign write, so it stays pinned to the bottom of the output. */
|
|
146
175
|
redraw() {
|
|
147
|
-
if (!this.
|
|
176
|
+
if (!this.isInteractive || this.isFinished) {
|
|
148
177
|
return;
|
|
149
178
|
}
|
|
150
179
|
this.draw();
|
|
@@ -164,14 +193,14 @@ class ProgressLine {
|
|
|
164
193
|
/** Draws on a TTY: erase, then rewrite without a newline, which is what keeps it on one line. */
|
|
165
194
|
draw() {
|
|
166
195
|
this.stream.write(`${CLEAR_LINE}${this.buildText()}`);
|
|
167
|
-
this.
|
|
196
|
+
this.isDrawn = true;
|
|
168
197
|
}
|
|
169
198
|
/** Shared close path. The final line is always emitted, on TTY and non-TTY alike, exactly once. */
|
|
170
199
|
finish(set) {
|
|
171
|
-
if (this.
|
|
200
|
+
if (this.isFinished) {
|
|
172
201
|
return;
|
|
173
202
|
}
|
|
174
|
-
this.
|
|
203
|
+
this.isFinished = true;
|
|
175
204
|
this.clear();
|
|
176
205
|
const mark = set.ok ? '✔' : '✖';
|
|
177
206
|
const tail = set.summary ? ` — ${set.summary}` : '';
|
|
@@ -191,8 +220,9 @@ function installConsole() {
|
|
|
191
220
|
// The ORIGINAL reference is stored, not a `.bind()` copy. A bound copy is functionally
|
|
192
221
|
// equivalent but has a different identity, so restoring it would not give the caller back
|
|
193
222
|
// the exact function it had, and repeated start/close cycles would stack bind layers.
|
|
194
|
-
const original =
|
|
223
|
+
const original = getConsoleMethod(method);
|
|
195
224
|
originalConsole[method] = original;
|
|
225
|
+
/** Preserves foreign console output by temporarily removing and then redrawing the progress line. */
|
|
196
226
|
const wrapper = (...args) => {
|
|
197
227
|
// The core behaviour: erase before the foreign message, redraw after it.
|
|
198
228
|
activeLine?.clear();
|
|
@@ -200,7 +230,7 @@ function installConsole() {
|
|
|
200
230
|
activeLine?.redraw();
|
|
201
231
|
};
|
|
202
232
|
installedConsole[method] = wrapper;
|
|
203
|
-
|
|
233
|
+
setConsoleMethod(method, wrapper);
|
|
204
234
|
}
|
|
205
235
|
}
|
|
206
236
|
/**
|
|
@@ -212,15 +242,50 @@ function installConsole() {
|
|
|
212
242
|
*/
|
|
213
243
|
function restoreConsole() {
|
|
214
244
|
for (const method of CONSOLE_METHODS) {
|
|
215
|
-
const current =
|
|
245
|
+
const current = getConsoleMethod(method);
|
|
216
246
|
const original = originalConsole[method];
|
|
217
247
|
if (original && current === installedConsole[method]) {
|
|
218
|
-
|
|
248
|
+
setConsoleMethod(method, original);
|
|
219
249
|
}
|
|
220
250
|
}
|
|
221
251
|
originalConsole = {};
|
|
222
252
|
installedConsole = {};
|
|
223
253
|
}
|
|
254
|
+
/** Returns a console method through an exhaustive, cast-free mapping. */
|
|
255
|
+
function getConsoleMethod(method) {
|
|
256
|
+
switch (method) {
|
|
257
|
+
case ConsoleMethod.log:
|
|
258
|
+
return console.log;
|
|
259
|
+
case ConsoleMethod.info:
|
|
260
|
+
return console.info;
|
|
261
|
+
case ConsoleMethod.warn:
|
|
262
|
+
return console.warn;
|
|
263
|
+
case ConsoleMethod.error:
|
|
264
|
+
return console.error;
|
|
265
|
+
case ConsoleMethod.debug:
|
|
266
|
+
return console.debug;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
/** Replaces exactly one known console method without an index-signature cast. */
|
|
270
|
+
function setConsoleMethod(method, fn) {
|
|
271
|
+
switch (method) {
|
|
272
|
+
case ConsoleMethod.log:
|
|
273
|
+
console.log = fn;
|
|
274
|
+
break;
|
|
275
|
+
case ConsoleMethod.info:
|
|
276
|
+
console.info = fn;
|
|
277
|
+
break;
|
|
278
|
+
case ConsoleMethod.warn:
|
|
279
|
+
console.warn = fn;
|
|
280
|
+
break;
|
|
281
|
+
case ConsoleMethod.error:
|
|
282
|
+
console.error = fn;
|
|
283
|
+
break;
|
|
284
|
+
case ConsoleMethod.debug:
|
|
285
|
+
console.debug = fn;
|
|
286
|
+
break;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
224
289
|
/**
|
|
225
290
|
* `DyNTS_Progress_Util` — the public surface of the progress line, plus the **pure** formatting
|
|
226
291
|
* helpers, so the behaviour can be unit-tested without a terminal.
|
|
@@ -238,7 +303,7 @@ class DyNTS_Progress_Util {
|
|
|
238
303
|
activeLine?.done();
|
|
239
304
|
const line = new ProgressLine(options);
|
|
240
305
|
activeLine = line;
|
|
241
|
-
if (line.
|
|
306
|
+
if (line.isInteractive) {
|
|
242
307
|
installConsole();
|
|
243
308
|
}
|
|
244
309
|
return line;
|
|
@@ -290,7 +355,9 @@ class DyNTS_Progress_Util {
|
|
|
290
355
|
const totalSeconds = Math.max(0, Math.floor(ms / 1000));
|
|
291
356
|
const minutes = Math.floor(totalSeconds / 60);
|
|
292
357
|
const seconds = totalSeconds % 60;
|
|
293
|
-
return minutes > 0
|
|
358
|
+
return minutes > 0
|
|
359
|
+
? `${minutes}m${String(seconds).padStart(2, '0')}s`
|
|
360
|
+
: `${seconds}s`;
|
|
294
361
|
}
|
|
295
362
|
/**
|
|
296
363
|
* Builds the full progress text.
|
|
@@ -300,9 +367,9 @@ class DyNTS_Progress_Util {
|
|
|
300
367
|
*/
|
|
301
368
|
static formatLine(set) {
|
|
302
369
|
const head = set.total !== undefined && set.total > 0
|
|
303
|
-
? `${DyNTS_Progress_Util.renderBar({ current: set.current, total: set.total, width: set.barWidth })} `
|
|
304
|
-
|
|
305
|
-
|
|
370
|
+
? `${DyNTS_Progress_Util.renderBar({ current: set.current, total: set.total, width: set.barWidth })} ` +
|
|
371
|
+
`${String(DyNTS_Progress_Util.percent({ current: set.current, total: set.total })).padStart(3)}% ` +
|
|
372
|
+
`${set.current}/${set.total}`
|
|
306
373
|
: `${set.spinner} ${set.current}`;
|
|
307
374
|
const tail = set.note ? ` · ${set.note}` : '';
|
|
308
375
|
return `${set.label} ${head} · ${DyNTS_Progress_Util.formatElapsed(set.elapsedMs)}${tail}`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-line.util.js","sourceRoot":"","sources":["../../src/_collections/progress-line.util.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"progress-line.util.js","sourceRoot":"","sources":["../../src/_collections/progress-line.util.ts"],"names":[],"mappings":";;;AAIA,IAAK,aAMJ;AAND,WAAK,aAAa;IAChB,4BAAW,CAAA;IACX,8BAAa,CAAA;IACb,8BAAa,CAAA;IACb,gCAAe,CAAA;IACf,gCAAe,CAAA;AACjB,CAAC,EANI,aAAa,KAAb,aAAa,QAMjB;AAGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsDG;AAEH;;;;;;;GAOG;AACH,MAAM,UAAU,GAAW,WAAW,CAAC;AAEvC,uFAAuF;AACvF,MAAM,cAAc,GAAa;IAC/B,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;IACH,GAAG;CACJ,CAAC;AAEF,+EAA+E;AAC/E,IAAI,UAAU,GAA6B,SAAS,CAAC;AAErD,wEAAwE;AACxE,MAAM,eAAe,GAAoB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AACtE,IAAI,eAAe,GAA8C,EAAE,CAAC;AACpE,gGAAgG;AAChG,IAAI,gBAAgB,GAA8C,EAAE,CAAC;AAErE,qGAAqG;AACrG,MAAM,YAAY;IACA,aAAa,CAAU;IACtB,MAAM,CAAiB;IACvB,KAAK,CAAS;IACd,UAAU,CAAS;IACnB,YAAY,CAAS;IACrB,QAAQ,CAAS;IAE1B,KAAK,CAAqB;IAC1B,OAAO,GAAW,CAAC,CAAC;IACpB,IAAI,GAAW,EAAE,CAAC;IAClB,KAAK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CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI;gBAClG,GAAG,GAAG,CAAC,OAAO,IAAI,GAAG,CAAC,KAAK,EAAE;YAC/B,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;IAC7F,CAAC;CACF;AA3HD,kDA2HC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Options for starting a progress line. */
|
|
2
|
+
export interface DyNTS_Progress_Options {
|
|
3
|
+
/** Name of the operation; rendered at the start of the line (for example `'scan: agent-memory'`). */
|
|
4
|
+
label: string;
|
|
5
|
+
/** Total number of steps, when known up front. Without it a spinner and a counter are shown. */
|
|
6
|
+
total?: number;
|
|
7
|
+
/** Destination stream. Defaults to `process.stderr`; stdout is refused (pipe purity). */
|
|
8
|
+
stream?: {
|
|
9
|
+
readonly isTTY?: boolean;
|
|
10
|
+
write(chunk: string): boolean;
|
|
11
|
+
};
|
|
12
|
+
/** Minimum delay between two redraws on a TTY, in ms. Default 80 — without it drawing burns CPU. */
|
|
13
|
+
throttleMs?: number;
|
|
14
|
+
/** Minimum delay between two plain lines in non-TTY mode, in ms. Default 5000. */
|
|
15
|
+
plainEveryMs?: number;
|
|
16
|
+
/** Width of the bar in characters; only used when `total` is known. Default 24. */
|
|
17
|
+
barWidth?: number;
|
|
18
|
+
/** Explicit on/off. When omitted, the stream's TTY flag and `DYNTS_NO_PROGRESS` decide. */
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=progress-options.interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-options.interface.d.ts","sourceRoot":"","sources":["../../src/_collections/progress-options.interface.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,MAAM,WAAW,sBAAsB;IACrC,qGAAqG;IACrG,KAAK,EAAE,MAAM,CAAC;IACd,gGAAgG;IAChG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,yFAAyF;IACzF,MAAM,CAAC,EAAE;QAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,CAAC;IACrE,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;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progress-options.interface.js","sourceRoot":"","sources":["../../src/_collections/progress-options.interface.ts"],"names":[],"mappings":""}
|
package/build/_modules/privacy-lifecycle/_enums/privacy-rights-notification-state.type-enum.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/** Durable notification states; ambiguous SMTP delivery is terminal until an operator resolves it. */
|
|
2
|
+
export declare enum DyNTS_PrivacyRightsNotificationState_Type {
|
|
3
|
+
pending = "pending",
|
|
4
|
+
dispatching = "dispatching",
|
|
5
|
+
submitted = "submitted",
|
|
6
|
+
rejected = "rejected",
|
|
7
|
+
manualReview = "manual-review"
|
|
8
|
+
}
|
|
9
|
+
/** Persisted submission channel, including the explicit not-yet-submitted state. */
|
|
10
|
+
export declare enum DyNTS_PrivacyRightsNotificationChannel_Type {
|
|
11
|
+
none = "none",
|
|
12
|
+
smtp = "smtp",
|
|
13
|
+
testSink = "test-sink"
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=privacy-rights-notification-state.type-enum.d.ts.map
|
package/build/_modules/privacy-lifecycle/_enums/privacy-rights-notification-state.type-enum.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privacy-rights-notification-state.type-enum.d.ts","sourceRoot":"","sources":["../../../../src/_modules/privacy-lifecycle/_enums/privacy-rights-notification-state.type-enum.ts"],"names":[],"mappings":"AAAA,sGAAsG;AACtG,oBAAY,yCAAyC;IACnD,OAAO,YAAY;IACnB,WAAW,gBAAgB;IAC3B,SAAS,cAAc;IACvB,QAAQ,aAAa;IACrB,YAAY,kBAAkB;CAC/B;AAED,oFAAoF;AACpF,oBAAY,2CAA2C;IACrD,IAAI,SAAS;IACb,IAAI,SAAS;IACb,QAAQ,cAAc;CACvB"}
|
package/build/_modules/privacy-lifecycle/_enums/privacy-rights-notification-state.type-enum.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DyNTS_PrivacyRightsNotificationChannel_Type = exports.DyNTS_PrivacyRightsNotificationState_Type = void 0;
|
|
4
|
+
/** Durable notification states; ambiguous SMTP delivery is terminal until an operator resolves it. */
|
|
5
|
+
var DyNTS_PrivacyRightsNotificationState_Type;
|
|
6
|
+
(function (DyNTS_PrivacyRightsNotificationState_Type) {
|
|
7
|
+
DyNTS_PrivacyRightsNotificationState_Type["pending"] = "pending";
|
|
8
|
+
DyNTS_PrivacyRightsNotificationState_Type["dispatching"] = "dispatching";
|
|
9
|
+
DyNTS_PrivacyRightsNotificationState_Type["submitted"] = "submitted";
|
|
10
|
+
DyNTS_PrivacyRightsNotificationState_Type["rejected"] = "rejected";
|
|
11
|
+
DyNTS_PrivacyRightsNotificationState_Type["manualReview"] = "manual-review";
|
|
12
|
+
})(DyNTS_PrivacyRightsNotificationState_Type || (exports.DyNTS_PrivacyRightsNotificationState_Type = DyNTS_PrivacyRightsNotificationState_Type = {}));
|
|
13
|
+
/** Persisted submission channel, including the explicit not-yet-submitted state. */
|
|
14
|
+
var DyNTS_PrivacyRightsNotificationChannel_Type;
|
|
15
|
+
(function (DyNTS_PrivacyRightsNotificationChannel_Type) {
|
|
16
|
+
DyNTS_PrivacyRightsNotificationChannel_Type["none"] = "none";
|
|
17
|
+
DyNTS_PrivacyRightsNotificationChannel_Type["smtp"] = "smtp";
|
|
18
|
+
DyNTS_PrivacyRightsNotificationChannel_Type["testSink"] = "test-sink";
|
|
19
|
+
})(DyNTS_PrivacyRightsNotificationChannel_Type || (exports.DyNTS_PrivacyRightsNotificationChannel_Type = DyNTS_PrivacyRightsNotificationChannel_Type = {}));
|
|
20
|
+
//# sourceMappingURL=privacy-rights-notification-state.type-enum.js.map
|
package/build/_modules/privacy-lifecycle/_enums/privacy-rights-notification-state.type-enum.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privacy-rights-notification-state.type-enum.js","sourceRoot":"","sources":["../../../../src/_modules/privacy-lifecycle/_enums/privacy-rights-notification-state.type-enum.ts"],"names":[],"mappings":";;;AAAA,sGAAsG;AACtG,IAAY,yCAMX;AAND,WAAY,yCAAyC;IACnD,gEAAmB,CAAA;IACnB,wEAA2B,CAAA;IAC3B,oEAAuB,CAAA;IACvB,kEAAqB,CAAA;IACrB,2EAA8B,CAAA;AAChC,CAAC,EANW,yCAAyC,yDAAzC,yCAAyC,QAMpD;AAED,oFAAoF;AACpF,IAAY,2CAIX;AAJD,WAAY,2CAA2C;IACrD,4DAAa,CAAA;IACb,4DAAa,CAAA;IACb,qEAAsB,CAAA;AACxB,CAAC,EAJW,2CAA2C,2DAA3C,2CAA2C,QAItD"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { ClientSession, Connection } from 'mongoose';
|
|
2
|
+
import { DyNTS_EmailSubmissionOutcome_Enum } from '../../../_enums/email-submission-outcome.enum';
|
|
3
|
+
import { DyNTS_EmailSubmissionReceipt_Interface } from '../../../_models/interfaces/email-submission-receipt.interface';
|
|
4
|
+
import { DyNTS_PrivacyRightsNotificationChannel_Type, DyNTS_PrivacyRightsNotificationState_Type } from '../_enums/privacy-rights-notification-state.type-enum';
|
|
5
|
+
import { DyNTS_PrivacyRightsAuthority_Interface } from './privacy-rights-custody.interface';
|
|
6
|
+
import { DyNTS_PrivacyRightsExecutionReceipt_Interface } from './privacy-rights-execution.interface';
|
|
7
|
+
/** Content-free durable notification projection. Recipient, subject and body are deliberately absent. */
|
|
8
|
+
export interface DyNTS_PrivacyRightsNotificationView_Interface extends DyNTS_PrivacyRightsAuthority_Interface {
|
|
9
|
+
readonly contractVersion: 'dynts-privacy-rights-notification/1';
|
|
10
|
+
readonly executionReference: string;
|
|
11
|
+
readonly executionCompletedAt: string;
|
|
12
|
+
readonly templateCode: string;
|
|
13
|
+
readonly state: DyNTS_PrivacyRightsNotificationState_Type;
|
|
14
|
+
readonly attemptCount: number;
|
|
15
|
+
readonly channel: DyNTS_PrivacyRightsNotificationChannel_Type;
|
|
16
|
+
readonly outcome: '' | DyNTS_EmailSubmissionOutcome_Enum;
|
|
17
|
+
readonly submissionReference: string;
|
|
18
|
+
readonly acceptedCount: number;
|
|
19
|
+
readonly rejectedCount: number;
|
|
20
|
+
readonly pendingCount: number;
|
|
21
|
+
readonly completedAt: string;
|
|
22
|
+
readonly created: boolean;
|
|
23
|
+
}
|
|
24
|
+
/** Internal strict-schema record. The raw claim token and all message content are forbidden. */
|
|
25
|
+
export interface DyNTS_PrivacyRightsNotificationRecord_Interface extends Omit<DyNTS_PrivacyRightsNotificationView_Interface, 'created'> {
|
|
26
|
+
_id: string;
|
|
27
|
+
readonly revision: number;
|
|
28
|
+
readonly claimTokenHash: string;
|
|
29
|
+
readonly claimedAt: string;
|
|
30
|
+
readonly claimExpiresAt: string;
|
|
31
|
+
}
|
|
32
|
+
/** A claim token is returned only to the worker that won the durable dispatch fence. */
|
|
33
|
+
export interface DyNTS_PrivacyRightsNotificationClaimResult_Interface {
|
|
34
|
+
readonly contractVersion: 'dynts-privacy-rights-notification-claim/1';
|
|
35
|
+
readonly claimed: boolean;
|
|
36
|
+
readonly claimToken: string;
|
|
37
|
+
readonly notification: DyNTS_PrivacyRightsNotificationView_Interface;
|
|
38
|
+
}
|
|
39
|
+
/** Terminal completion input from the existing content-free email submission boundary. */
|
|
40
|
+
export interface DyNTS_PrivacyRightsNotificationCompletion_Interface extends DyNTS_PrivacyRightsAuthority_Interface {
|
|
41
|
+
readonly contractVersion: 'dynts-privacy-rights-notification-completion/1';
|
|
42
|
+
readonly claimToken: string;
|
|
43
|
+
readonly submission: DyNTS_EmailSubmissionReceipt_Interface;
|
|
44
|
+
}
|
|
45
|
+
/** Marks an attempted submission as unknown without retaining the transport error. */
|
|
46
|
+
export interface DyNTS_PrivacyRightsNotificationIndeterminate_Interface extends DyNTS_PrivacyRightsAuthority_Interface {
|
|
47
|
+
readonly contractVersion: 'dynts-privacy-rights-notification-indeterminate/1';
|
|
48
|
+
readonly claimToken: string;
|
|
49
|
+
}
|
|
50
|
+
/** Shared durable outbox settings. Product code chooses a closed set of server-owned template codes. */
|
|
51
|
+
export interface DyNTS_PrivacyRightsNotificationSettings_Interface {
|
|
52
|
+
readonly connection: Connection;
|
|
53
|
+
readonly maxOperationTimeMs: number;
|
|
54
|
+
readonly claimTimeMs: number;
|
|
55
|
+
readonly templateCodes: readonly string[];
|
|
56
|
+
}
|
|
57
|
+
/** Transactional schedule input intentionally carries the already validated execution receipt. */
|
|
58
|
+
export interface DyNTS_PrivacyRightsNotificationSchedule_Interface {
|
|
59
|
+
readonly execution: DyNTS_PrivacyRightsExecutionReceipt_Interface;
|
|
60
|
+
readonly templateCode: string;
|
|
61
|
+
readonly session: ClientSession;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=privacy-rights-notification.interface.d.ts.map
|
package/build/_modules/privacy-lifecycle/_models/privacy-rights-notification.interface.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privacy-rights-notification.interface.d.ts","sourceRoot":"","sources":["../../../../src/_modules/privacy-lifecycle/_models/privacy-rights-notification.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAErD,OAAO,EAAE,iCAAiC,EAAE,MAAM,+CAA+C,CAAC;AAClG,OAAO,EAAE,sCAAsC,EAAE,MAAM,gEAAgE,CAAC;AACxH,OAAO,EACL,2CAA2C,EAC3C,yCAAyC,EAC1C,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAAE,sCAAsC,EAAE,MAAM,oCAAoC,CAAC;AAC5F,OAAO,EAAE,6CAA6C,EAAE,MAAM,sCAAsC,CAAC;AAErG,yGAAyG;AACzG,MAAM,WAAW,6CAA8C,SAAQ,sCAAsC;IAC3G,QAAQ,CAAC,eAAe,EAAE,qCAAqC,CAAC;IAChE,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;IACpC,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,yCAAyC,CAAC;IAC1D,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,2CAA2C,CAAC;IAC9D,QAAQ,CAAC,OAAO,EAAE,EAAE,GAAG,iCAAiC,CAAC;IACzD,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;IACrC,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM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AAS,EAAE,6CAA6C,CAAC;IAClE,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;CACjC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privacy-rights-notification.interface.js","sourceRoot":"","sources":["../../../../src/_modules/privacy-lifecycle/_models/privacy-rights-notification.interface.ts"],"names":[],"mappings":""}
|