@code-pushup/utils 0.108.2 → 0.110.0
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/package.json +2 -2
- package/src/index.d.ts +1 -0
- package/src/index.js +1 -0
- package/src/index.js.map +1 -1
- package/src/lib/performance-observer.d.ts +3 -3
- package/src/lib/performance-observer.js +1 -1
- package/src/lib/performance-observer.js.map +1 -1
- package/src/lib/profiler/constants.d.ts +5 -0
- package/src/lib/profiler/constants.js +5 -0
- package/src/lib/profiler/constants.js.map +1 -1
- package/src/lib/profiler/profiler.d.ts +6 -0
- package/src/lib/profiler/profiler.js +10 -0
- package/src/lib/profiler/profiler.js.map +1 -1
- package/src/lib/{trace-file-utils.d.ts → profiler/trace-file-utils.d.ts} +52 -2
- package/src/lib/{trace-file-utils.js → profiler/trace-file-utils.js} +120 -9
- package/src/lib/profiler/trace-file-utils.js.map +1 -0
- package/src/lib/{trace-file.type.d.ts → profiler/trace-file.type.d.ts} +6 -2
- package/src/lib/profiler/trace-file.type.js.map +1 -0
- package/src/lib/profiler/wal-json-trace.d.ts +25 -0
- package/src/lib/profiler/wal-json-trace.js +77 -0
- package/src/lib/profiler/wal-json-trace.js.map +1 -0
- package/src/lib/reports/formatting.d.ts +6 -1
- package/src/lib/reports/formatting.js +15 -1
- package/src/lib/reports/formatting.js.map +1 -1
- package/src/lib/reports/generate-md-report.js +13 -8
- package/src/lib/reports/generate-md-report.js.map +1 -1
- package/src/lib/reports/type-guards.d.ts +9 -0
- package/src/lib/reports/type-guards.js +17 -0
- package/src/lib/reports/type-guards.js.map +1 -0
- package/src/lib/reports/utils.js +14 -3
- package/src/lib/reports/utils.js.map +1 -1
- package/src/lib/wal.d.ts +236 -0
- package/src/lib/wal.js +411 -0
- package/src/lib/wal.js.map +1 -0
- package/src/lib/sink-source.type.d.ts +0 -43
- package/src/lib/sink-source.type.js +0 -2
- package/src/lib/sink-source.type.js.map +0 -1
- package/src/lib/trace-file-utils.js.map +0 -1
- package/src/lib/trace-file.type.js.map +0 -1
- /package/src/lib/{trace-file.type.js → profiler/trace-file.type.js} +0 -0
package/src/lib/wal.js
ADDED
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
/* eslint-disable max-lines */
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import process from 'node:process';
|
|
5
|
+
import { threadId } from 'node:worker_threads';
|
|
6
|
+
export const createTolerantCodec = (codec) => {
|
|
7
|
+
const { encode, decode } = codec;
|
|
8
|
+
return {
|
|
9
|
+
encode: v => v && typeof v === 'object' && '__invalid' in v
|
|
10
|
+
? v.raw
|
|
11
|
+
: encode(v),
|
|
12
|
+
decode: d => {
|
|
13
|
+
try {
|
|
14
|
+
return decode(d);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return { __invalid: true, raw: d };
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export function filterValidRecords(records) {
|
|
23
|
+
return records
|
|
24
|
+
.filter((r) => !(typeof r === 'object' && r != null && '__invalid' in r))
|
|
25
|
+
.map(r => r);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Pure helper function to recover records from WAL file content.
|
|
29
|
+
* @param content - Raw file content as string
|
|
30
|
+
* @param decode - function for decoding records
|
|
31
|
+
* @returns Recovery result with records, errors, and partial tail
|
|
32
|
+
*/
|
|
33
|
+
export function recoverFromContent(content, decode) {
|
|
34
|
+
const lines = content.split('\n');
|
|
35
|
+
const clean = content.endsWith('\n');
|
|
36
|
+
const out = lines.slice(0, -1).reduce((a, l, i) => {
|
|
37
|
+
if (!l) {
|
|
38
|
+
return a;
|
|
39
|
+
}
|
|
40
|
+
try {
|
|
41
|
+
return {
|
|
42
|
+
...a,
|
|
43
|
+
records: [...a.records, decode(l)],
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
catch (error) {
|
|
47
|
+
return {
|
|
48
|
+
...a,
|
|
49
|
+
errors: [
|
|
50
|
+
...a.errors,
|
|
51
|
+
{ lineNo: i + 1, line: l, error: error },
|
|
52
|
+
],
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}, { records: [], errors: [] });
|
|
56
|
+
const tail = lines.at(-1);
|
|
57
|
+
return {
|
|
58
|
+
...out,
|
|
59
|
+
partialTail: clean || !tail ? null : tail,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Write-Ahead Log implementation for crash-safe append-only logging.
|
|
64
|
+
* Provides atomic operations for writing, recovering, and repacking log entries.
|
|
65
|
+
*/
|
|
66
|
+
export class WriteAheadLogFile {
|
|
67
|
+
#fd = null;
|
|
68
|
+
#file;
|
|
69
|
+
#decode;
|
|
70
|
+
#encode;
|
|
71
|
+
#lastRecoveryState = null;
|
|
72
|
+
/**
|
|
73
|
+
* Create a new WAL file instance.
|
|
74
|
+
* @param options - Configuration options
|
|
75
|
+
*/
|
|
76
|
+
constructor(options) {
|
|
77
|
+
this.#file = options.file;
|
|
78
|
+
const c = createTolerantCodec(options.codec);
|
|
79
|
+
this.#decode = c.decode;
|
|
80
|
+
this.#encode = c.encode;
|
|
81
|
+
}
|
|
82
|
+
/** Get the file path for this WAL */
|
|
83
|
+
getPath = () => this.#file;
|
|
84
|
+
/** Open the WAL file for writing (creates directories if needed) */
|
|
85
|
+
open = () => {
|
|
86
|
+
if (this.#fd) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
ensureDirectoryExistsSync(path.dirname(this.#file));
|
|
90
|
+
this.#fd = fs.openSync(this.#file, 'a');
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* Append a record to the WAL.
|
|
94
|
+
* @param v - Record to append
|
|
95
|
+
* @throws Error if WAL cannot be opened
|
|
96
|
+
*/
|
|
97
|
+
append = (v) => {
|
|
98
|
+
if (!this.#fd) {
|
|
99
|
+
throw new Error('WAL not opened');
|
|
100
|
+
}
|
|
101
|
+
fs.writeSync(this.#fd, `${this.#encode(v)}\n`);
|
|
102
|
+
};
|
|
103
|
+
/** Close the WAL file */
|
|
104
|
+
close = () => {
|
|
105
|
+
if (this.#fd) {
|
|
106
|
+
fs.closeSync(this.#fd);
|
|
107
|
+
}
|
|
108
|
+
this.#fd = null;
|
|
109
|
+
};
|
|
110
|
+
isClosed = () => this.#fd == null;
|
|
111
|
+
/**
|
|
112
|
+
* Recover all records from the WAL file.
|
|
113
|
+
* Handles partial writes and decode errors gracefully.
|
|
114
|
+
* Updates the recovery state (accessible via {@link getStats}).
|
|
115
|
+
* @returns Recovery result with records, errors, and partial tail
|
|
116
|
+
*/
|
|
117
|
+
recover() {
|
|
118
|
+
if (!fs.existsSync(this.#file)) {
|
|
119
|
+
this.#lastRecoveryState = { records: [], errors: [], partialTail: null };
|
|
120
|
+
return this.#lastRecoveryState;
|
|
121
|
+
}
|
|
122
|
+
const txt = fs.readFileSync(this.#file, 'utf8');
|
|
123
|
+
this.#lastRecoveryState = recoverFromContent(txt, this.#decode);
|
|
124
|
+
return this.#lastRecoveryState;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Repack the WAL by recovering all valid records and rewriting cleanly.
|
|
128
|
+
* Removes corrupted entries and ensures clean formatting.
|
|
129
|
+
* Updates the recovery state (accessible via {@link getStats}).
|
|
130
|
+
* @param out - Output path (defaults to current file)
|
|
131
|
+
*/
|
|
132
|
+
repack(out = this.#file) {
|
|
133
|
+
this.close();
|
|
134
|
+
const r = this.recover();
|
|
135
|
+
if (r.errors.length > 0) {
|
|
136
|
+
// eslint-disable-next-line no-console
|
|
137
|
+
console.log('WAL repack encountered decode errors');
|
|
138
|
+
}
|
|
139
|
+
// Check if any records are invalid entries (from tolerant codec)
|
|
140
|
+
const hasInvalidEntries = r.records.some(rec => typeof rec === 'object' && rec != null && '__invalid' in rec);
|
|
141
|
+
if (hasInvalidEntries) {
|
|
142
|
+
// eslint-disable-next-line no-console
|
|
143
|
+
console.log('Found invalid entries during WAL repack');
|
|
144
|
+
}
|
|
145
|
+
const recordsToWrite = hasInvalidEntries
|
|
146
|
+
? r.records
|
|
147
|
+
: filterValidRecords(r.records);
|
|
148
|
+
ensureDirectoryExistsSync(path.dirname(out));
|
|
149
|
+
fs.writeFileSync(out, `${recordsToWrite.map(this.#encode).join('\n')}\n`);
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Get comprehensive statistics about the WAL file state.
|
|
153
|
+
* Includes file information, open/close status, and last recovery state.
|
|
154
|
+
* @returns Statistics object with file info and last recovery state
|
|
155
|
+
*/
|
|
156
|
+
getStats() {
|
|
157
|
+
const fileExists = fs.existsSync(this.#file);
|
|
158
|
+
return {
|
|
159
|
+
filePath: this.#file,
|
|
160
|
+
isClosed: this.#fd == null,
|
|
161
|
+
fileExists,
|
|
162
|
+
fileSize: fileExists ? fs.statSync(this.#file).size : 0,
|
|
163
|
+
lastRecovery: this.#lastRecoveryState,
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
export const stringCodec = () => ({
|
|
168
|
+
encode: v => (typeof v === 'string' ? v : JSON.stringify(v)),
|
|
169
|
+
decode: v => {
|
|
170
|
+
try {
|
|
171
|
+
return JSON.parse(v);
|
|
172
|
+
}
|
|
173
|
+
catch {
|
|
174
|
+
return v;
|
|
175
|
+
}
|
|
176
|
+
},
|
|
177
|
+
});
|
|
178
|
+
/**
|
|
179
|
+
* Parses a partial WalFormat configuration and returns a complete WalFormat object.
|
|
180
|
+
* All fallback values are targeting string types.
|
|
181
|
+
* - baseName defaults to 'wal'
|
|
182
|
+
* - walExtension defaults to '.log'
|
|
183
|
+
* - finalExtension defaults to '.log'
|
|
184
|
+
* - codec defaults to stringCodec<T>()
|
|
185
|
+
* - finalizer defaults to encoding each record using codec.encode() and joining with newlines.
|
|
186
|
+
* For object types, this properly JSON-stringifies them (not [object Object]).
|
|
187
|
+
* InvalidEntry records use their raw string value directly.
|
|
188
|
+
* @param format - Partial WalFormat configuration
|
|
189
|
+
* @returns Parsed WalFormat with defaults filled in
|
|
190
|
+
*/
|
|
191
|
+
export function parseWalFormat(format) {
|
|
192
|
+
const { baseName = 'wal', walExtension = '.log', finalExtension = walExtension, codec = stringCodec(), } = format;
|
|
193
|
+
const finalizer = format.finalizer ??
|
|
194
|
+
((records) => {
|
|
195
|
+
// Encode each record using the codec before joining.
|
|
196
|
+
// For object types, codec.encode() will JSON-stringify them properly.
|
|
197
|
+
// InvalidEntry records use their raw string value directly.
|
|
198
|
+
const encoded = records.map(record => typeof record === 'object' && record != null && '__invalid' in record
|
|
199
|
+
? record.raw
|
|
200
|
+
: codec.encode(record));
|
|
201
|
+
return `${encoded.join('\n')}\n`;
|
|
202
|
+
});
|
|
203
|
+
return {
|
|
204
|
+
baseName,
|
|
205
|
+
walExtension,
|
|
206
|
+
finalExtension,
|
|
207
|
+
codec,
|
|
208
|
+
finalizer,
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Determines if this process is the leader WAL process using the origin PID heuristic.
|
|
213
|
+
*
|
|
214
|
+
* The leader is the process that first enabled profiling (the one that set CP_PROFILER_ORIGIN_PID).
|
|
215
|
+
* All descendant processes inherit the environment but have different PIDs.
|
|
216
|
+
*
|
|
217
|
+
* @returns true if this is the leader WAL process, false otherwise
|
|
218
|
+
*/
|
|
219
|
+
export function isLeaderWal(envVarName, profilerID) {
|
|
220
|
+
return process.env[envVarName] === profilerID;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* Initialize the origin PID environment variable if not already set.
|
|
224
|
+
* This must be done as early as possible before any user code runs.
|
|
225
|
+
* Sets envVarName to the current process ID if not already defined.
|
|
226
|
+
*/
|
|
227
|
+
export function setLeaderWal(envVarName, profilerID) {
|
|
228
|
+
if (!process.env[envVarName]) {
|
|
229
|
+
// eslint-disable-next-line functional/immutable-data
|
|
230
|
+
process.env[envVarName] = profilerID;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
// eslint-disable-next-line functional/no-let
|
|
234
|
+
let shardCount = 0;
|
|
235
|
+
/**
|
|
236
|
+
* Generates a human-readable shard ID.
|
|
237
|
+
* This ID is unique per process/thread/shard combination and used in the file name.
|
|
238
|
+
* Format: readable-timestamp.pid.threadId.shardCount
|
|
239
|
+
* Example: "20240101-120000-000.12345.1.1"
|
|
240
|
+
* Becomes file: trace.20240101-120000-000.12345.1.1.log
|
|
241
|
+
*/
|
|
242
|
+
export function getShardId() {
|
|
243
|
+
const timestamp = Math.round(performance.timeOrigin + performance.now());
|
|
244
|
+
const readableTimestamp = sortableReadableDateString(`${timestamp}`);
|
|
245
|
+
return `${readableTimestamp}.${process.pid}.${threadId}.${++shardCount}`;
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Generates a human-readable sharded group ID.
|
|
249
|
+
* This ID is a globally unique, sortable, human-readable date string per run.
|
|
250
|
+
* Used directly as the folder name to group shards.
|
|
251
|
+
* Format: yyyymmdd-hhmmss-ms
|
|
252
|
+
* Example: "20240101-120000-000"
|
|
253
|
+
*/
|
|
254
|
+
export function getShardedGroupId() {
|
|
255
|
+
return sortableReadableDateString(`${Math.round(performance.timeOrigin + performance.now())}`);
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Regex patterns for validating WAL ID formats
|
|
259
|
+
*/
|
|
260
|
+
export const WAL_ID_PATTERNS = {
|
|
261
|
+
/** Readable date format: yyyymmdd-hhmmss-ms */
|
|
262
|
+
READABLE_DATE: /^\d{8}-\d{6}-\d{3}$/,
|
|
263
|
+
/** Group ID format: yyyymmdd-hhmmss-ms */
|
|
264
|
+
GROUP_ID: /^\d{8}-\d{6}-\d{3}$/,
|
|
265
|
+
/** Shard ID format: readable-date.pid.threadId.count */
|
|
266
|
+
SHARD_ID: /^\d{8}-\d{6}-\d{3}(?:\.\d+){3}$/,
|
|
267
|
+
};
|
|
268
|
+
export function sortableReadableDateString(timestampMs) {
|
|
269
|
+
const timestamp = Number.parseInt(timestampMs, 10);
|
|
270
|
+
const date = new Date(timestamp);
|
|
271
|
+
const MILLISECONDS_PER_SECOND = 1000;
|
|
272
|
+
const yyyy = date.getFullYear();
|
|
273
|
+
const mm = String(date.getMonth() + 1).padStart(2, '0');
|
|
274
|
+
const dd = String(date.getDate()).padStart(2, '0');
|
|
275
|
+
const hh = String(date.getHours()).padStart(2, '0');
|
|
276
|
+
const min = String(date.getMinutes()).padStart(2, '0');
|
|
277
|
+
const ss = String(date.getSeconds()).padStart(2, '0');
|
|
278
|
+
// eslint-disable-next-line @typescript-eslint/no-magic-numbers
|
|
279
|
+
const ms = String(timestamp % MILLISECONDS_PER_SECOND).padStart(3, '0');
|
|
280
|
+
return `${yyyy}${mm}${dd}-${hh}${min}${ss}-${ms}`;
|
|
281
|
+
}
|
|
282
|
+
/**
|
|
283
|
+
* Ensures a directory exists, creating it recursively if necessary using sync methods.
|
|
284
|
+
* @param dirPath - The directory path to ensure exists
|
|
285
|
+
*/
|
|
286
|
+
function ensureDirectoryExistsSync(dirPath) {
|
|
287
|
+
if (!fs.existsSync(dirPath)) {
|
|
288
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Generates a path to a shard file using human-readable IDs.
|
|
293
|
+
* Both groupId and shardId are already in readable date format.
|
|
294
|
+
*
|
|
295
|
+
* Example with groupId "20240101-120000-000" and shardId "20240101-120000-000.12345.1.1":
|
|
296
|
+
* Full path: /base/20240101-120000-000/trace.20240101-120000-000.12345.1.1.log
|
|
297
|
+
*
|
|
298
|
+
* @param opt.dir - The directory to store the shard file
|
|
299
|
+
* @param opt.format - The WalFormat to use for the shard file
|
|
300
|
+
* @param opt.groupId - The human-readable group ID (yyyymmdd-hhmmss-ms format)
|
|
301
|
+
* @param opt.shardId - The human-readable shard ID (readable-timestamp.pid.threadId.count format)
|
|
302
|
+
* @returns The path to the shard file
|
|
303
|
+
*/
|
|
304
|
+
export function getShardedPath(opt) {
|
|
305
|
+
const { dir = '', format, groupId, shardId } = opt;
|
|
306
|
+
const { baseName, walExtension } = format;
|
|
307
|
+
return path.join(dir, groupId, `${baseName}.${shardId}${walExtension}`);
|
|
308
|
+
}
|
|
309
|
+
export function getShardedFinalPath(opt) {
|
|
310
|
+
const { dir = '', format, groupId } = opt;
|
|
311
|
+
const { baseName, finalExtension } = format;
|
|
312
|
+
return path.join(dir, groupId, `${baseName}.${groupId}${finalExtension}`);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Sharded Write-Ahead Log manager for coordinating multiple WAL shards.
|
|
316
|
+
* Handles distributed logging across multiple processes/files with atomic finalization.
|
|
317
|
+
*/
|
|
318
|
+
export class ShardedWal {
|
|
319
|
+
groupId = getShardedGroupId();
|
|
320
|
+
#format;
|
|
321
|
+
#dir = process.cwd();
|
|
322
|
+
/**
|
|
323
|
+
* Create a sharded WAL manager.
|
|
324
|
+
*/
|
|
325
|
+
constructor(opt) {
|
|
326
|
+
const { dir, format, groupId } = opt;
|
|
327
|
+
this.groupId = groupId ?? getShardedGroupId();
|
|
328
|
+
if (dir) {
|
|
329
|
+
this.#dir = dir;
|
|
330
|
+
}
|
|
331
|
+
this.#format = parseWalFormat(format);
|
|
332
|
+
}
|
|
333
|
+
shard(shardId = getShardId()) {
|
|
334
|
+
return new WriteAheadLogFile({
|
|
335
|
+
file: getShardedPath({
|
|
336
|
+
dir: this.#dir,
|
|
337
|
+
format: this.#format,
|
|
338
|
+
groupId: this.groupId,
|
|
339
|
+
shardId,
|
|
340
|
+
}),
|
|
341
|
+
codec: this.#format.codec,
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
/** Get all shard file paths matching this WAL's base name */
|
|
345
|
+
shardFiles() {
|
|
346
|
+
if (!fs.existsSync(this.#dir)) {
|
|
347
|
+
return [];
|
|
348
|
+
}
|
|
349
|
+
const groupIdDir = path.dirname(getShardedFinalPath({
|
|
350
|
+
dir: this.#dir,
|
|
351
|
+
format: this.#format,
|
|
352
|
+
groupId: this.groupId,
|
|
353
|
+
}));
|
|
354
|
+
// create dir if not existing
|
|
355
|
+
ensureDirectoryExistsSync(groupIdDir);
|
|
356
|
+
return fs
|
|
357
|
+
.readdirSync(groupIdDir)
|
|
358
|
+
.filter(entry => entry.endsWith(this.#format.walExtension))
|
|
359
|
+
.filter(entry => entry.startsWith(`${this.#format.baseName}`))
|
|
360
|
+
.map(entry => path.join(groupIdDir, entry));
|
|
361
|
+
}
|
|
362
|
+
/**
|
|
363
|
+
* Finalize all shards by merging them into a single output file.
|
|
364
|
+
* Recovers all records from all shards, validates no errors, and writes merged result.
|
|
365
|
+
* @throws Error if any shard contains decode errors
|
|
366
|
+
*/
|
|
367
|
+
finalize(opt) {
|
|
368
|
+
const fileRecoveries = this.shardFiles().map(f => ({
|
|
369
|
+
file: f,
|
|
370
|
+
recovery: new WriteAheadLogFile({
|
|
371
|
+
file: f,
|
|
372
|
+
codec: this.#format.codec,
|
|
373
|
+
}).recover(),
|
|
374
|
+
}));
|
|
375
|
+
const records = fileRecoveries.flatMap(({ recovery }) => recovery.records);
|
|
376
|
+
// Check if any records are invalid entries (from tolerant codec)
|
|
377
|
+
const hasInvalidEntries = records.some(r => typeof r === 'object' && r != null && '__invalid' in r);
|
|
378
|
+
const recordsToFinalize = hasInvalidEntries
|
|
379
|
+
? records
|
|
380
|
+
: filterValidRecords(records);
|
|
381
|
+
const out = getShardedFinalPath({
|
|
382
|
+
dir: this.#dir,
|
|
383
|
+
format: this.#format,
|
|
384
|
+
groupId: this.groupId,
|
|
385
|
+
});
|
|
386
|
+
ensureDirectoryExistsSync(path.dirname(out));
|
|
387
|
+
fs.writeFileSync(out, this.#format.finalizer(recordsToFinalize, opt));
|
|
388
|
+
}
|
|
389
|
+
cleanup() {
|
|
390
|
+
this.shardFiles().forEach(f => {
|
|
391
|
+
// Remove the shard file
|
|
392
|
+
fs.unlinkSync(f);
|
|
393
|
+
// Remove the parent directory (shard group directory)
|
|
394
|
+
const shardDir = path.dirname(f);
|
|
395
|
+
try {
|
|
396
|
+
fs.rmdirSync(shardDir);
|
|
397
|
+
}
|
|
398
|
+
catch {
|
|
399
|
+
// Directory might not be empty or already removed, ignore
|
|
400
|
+
}
|
|
401
|
+
});
|
|
402
|
+
// Also try to remove the root directory if it becomes empty
|
|
403
|
+
try {
|
|
404
|
+
fs.rmdirSync(this.#dir);
|
|
405
|
+
}
|
|
406
|
+
catch {
|
|
407
|
+
// Directory might not be empty or already removed, ignore
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
//# sourceMappingURL=wal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wal.js","sourceRoot":"","sources":["../../../src/lib/wal.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAoD/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAgB,KAGlD,EAAiC,EAAE;IAClC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IAEjC,OAAO;QACL,MAAM,EAAE,CAAC,CAAC,EAAE,CACV,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ,IAAI,WAAW,IAAI,CAAC;YAC5C,CAAC,CAAE,CAAqB,CAAC,GAAG;YAC5B,CAAC,CAAC,MAAM,CAAC,CAAM,CAAC;QACpB,MAAM,EAAE,CAAC,CAAC,EAAE;YACV,IAAI,CAAC;gBACH,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC;YACnB,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC;YACrC,CAAC;QACH,CAAC;KACF,CAAC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
|
|
7
|
-
export type Sink<I, O> = {
|
|
8
|
-
open: () => void;
|
|
9
|
-
write: (input: I) => void;
|
|
10
|
-
close: () => void;
|
|
11
|
-
isClosed: () => boolean;
|
|
12
|
-
} & Encoder<I, O>;
|
|
13
|
-
export type Buffered = {
|
|
14
|
-
flush: () => void;
|
|
15
|
-
};
|
|
16
|
-
export type BufferedSink<I, O> = Sink<I, O> & Buffered;
|
|
17
|
-
export type Source<I, O = unknown> = {
|
|
18
|
-
read?: () => O;
|
|
19
|
-
decode?: (input: I) => O;
|
|
20
|
-
};
|
|
21
|
-
export type Observer = {
|
|
22
|
-
subscribe: () => void;
|
|
23
|
-
unsubscribe: () => void;
|
|
24
|
-
isSubscribed: () => boolean;
|
|
25
|
-
};
|
|
26
|
-
export type Recoverable = {
|
|
27
|
-
recover: () => RecoverResult;
|
|
28
|
-
repack: () => void;
|
|
29
|
-
finalize: () => void;
|
|
30
|
-
};
|
|
31
|
-
export type RecoverResult<T = unknown> = {
|
|
32
|
-
records: T[];
|
|
33
|
-
errors: {
|
|
34
|
-
lineNo: number;
|
|
35
|
-
line: string;
|
|
36
|
-
error: Error;
|
|
37
|
-
}[];
|
|
38
|
-
partialTail: string | null;
|
|
39
|
-
};
|
|
40
|
-
export type RecoverOptions = {
|
|
41
|
-
keepInvalid?: boolean;
|
|
42
|
-
};
|
|
43
|
-
export type Output<I, O> = {} & BufferedSink<I, O>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sink-source.type.js","sourceRoot":"","sources":["../../../src/lib/sink-source.type.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trace-file-utils.js","sourceRoot":"","sources":["../../../src/lib/trace-file-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAk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