@cifn/runner 0.0.1

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.
@@ -0,0 +1,37 @@
1
+ export interface LogEntry {
2
+ runId: string;
3
+ jobKey: string;
4
+ stepKey: string;
5
+ line: string;
6
+ timestamp: string;
7
+ }
8
+
9
+ export interface LogFnClient {
10
+ append(entry: LogEntry): void;
11
+ appendLines(runId: string, jobKey: string, stepKey: string, lines: string[]): void;
12
+ getLines(runId: string, jobKey: string): LogEntry[];
13
+ getAllLines(runId: string): LogEntry[];
14
+ }
15
+
16
+ export class MemoryLogFnClient implements LogFnClient {
17
+ private entries: LogEntry[] = [];
18
+
19
+ append(entry: LogEntry): void {
20
+ this.entries.push(entry);
21
+ }
22
+
23
+ appendLines(runId: string, jobKey: string, stepKey: string, lines: string[]): void {
24
+ const now = new Date().toISOString();
25
+ for (const line of lines) {
26
+ this.entries.push({ runId, jobKey, stepKey, line, timestamp: now });
27
+ }
28
+ }
29
+
30
+ getLines(runId: string, jobKey: string): LogEntry[] {
31
+ return this.entries.filter(e => e.runId === runId && e.jobKey === jobKey);
32
+ }
33
+
34
+ getAllLines(runId: string): LogEntry[] {
35
+ return this.entries.filter(e => e.runId === runId);
36
+ }
37
+ }
@@ -0,0 +1,12 @@
1
+ export function redactSecrets(lines: string[], secretValues: string[]): string[] {
2
+ if (secretValues.length === 0) return lines;
3
+ return lines.map(line => {
4
+ let result = line;
5
+ for (const secret of secretValues) {
6
+ if (secret.length > 0) {
7
+ result = result.split(secret).join('***');
8
+ }
9
+ }
10
+ return result;
11
+ });
12
+ }