@tradejs/cli 3.1.29-beta.262 → 3.1.29-beta.263
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/cli.js +864 -1424
- package/dist/lib/runtimeEvidenceArtifacts.js +3 -416
- package/dist/lib/runtimeEvidenceCompositionSnapshots.js +42 -211
- package/dist/lib/runtimeEvidenceCompositions.js +33 -310
- package/dist/lib/runtimeEvidenceDeployment.js +3 -315
- package/dist/lib/runtimeEvidenceProducer.js +3 -77
- package/dist/lib/runtimeEvidenceSync.js +32 -299
- package/dist/lib/runtimeFeedbackArtifacts.js +3 -545
- package/dist/lib/runtimeFeedbackNotification.js +7 -195
- package/dist/lib/runtimeFeedbackReplay.js +26 -525
- package/dist/lib/runtimeFeedbackSync.js +26 -219
- package/dist/lib/runtimeScorecard.js +5 -163
- package/dist/scripts/backtest.js +6 -1
- package/dist/scripts/mcpWorker.js +273 -0
- package/dist/scripts/replay.js +14 -250
- package/dist/scripts/replayRunner.js +14 -250
- package/dist/scripts/runtimeEvidence.js +47 -597
- package/dist/scripts/runtimeEvidenceSync.js +29 -296
- package/dist/scripts/runtimeFeedbackNotify.js +10 -188
- package/dist/scripts/runtimeFeedbackReplay.js +29 -528
- package/dist/scripts/runtimeFeedbackSync.js +28 -221
- package/dist/scripts/runtimeScorecard.js +88 -503
- package/dist/scripts/signals.js +55 -224
- package/dist/scripts/signalsDaemon.js +55 -224
- package/package.json +7 -7
|
@@ -17,6 +17,7 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
21
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
22
|
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
23
|
// file that has been converted to a CommonJS file using a Babel-
|
|
@@ -37,187 +38,17 @@ __export(runtimeEvidenceCompositionSnapshots_exports, {
|
|
|
37
38
|
verifyRuntimeEvidenceCompositionSnapshot: () => verifyRuntimeEvidenceCompositionSnapshot
|
|
38
39
|
});
|
|
39
40
|
module.exports = __toCommonJS(runtimeEvidenceCompositionSnapshots_exports);
|
|
40
|
-
var
|
|
41
|
-
var
|
|
42
|
-
var
|
|
41
|
+
var import_node_crypto = require("crypto");
|
|
42
|
+
var import_promises = __toESM(require("fs/promises"));
|
|
43
|
+
var import_node_path = __toESM(require("path"));
|
|
43
44
|
|
|
44
45
|
// src/lib/runtimeEvidenceDeployment.ts
|
|
45
|
-
var
|
|
46
|
-
|
|
47
|
-
var isNonEmptyString = (value) => typeof value === "string" && value.trim().length > 0;
|
|
48
|
-
var isPackageVersionMap = (value) => isRecord(value) && Object.keys(value).length > 0 && Object.entries(value).every(
|
|
49
|
-
([name, version]) => name.startsWith("@tradejs/") && isNonEmptyString(version)
|
|
50
|
-
);
|
|
51
|
-
var INTERVALS = /* @__PURE__ */ new Set([
|
|
52
|
-
"1",
|
|
53
|
-
"3",
|
|
54
|
-
"5",
|
|
55
|
-
"15",
|
|
56
|
-
"30",
|
|
57
|
-
"60",
|
|
58
|
-
"120",
|
|
59
|
-
"240",
|
|
60
|
-
"360",
|
|
61
|
-
"720",
|
|
62
|
-
"D",
|
|
63
|
-
"W",
|
|
64
|
-
"M"
|
|
65
|
-
]);
|
|
66
|
-
var UNIVERSES = /* @__PURE__ */ new Set(["crypto", "tradfi"]);
|
|
67
|
-
var isRuntimeStrategySelection = (value) => value === void 0 || isRecord(value) && Object.keys(value).length === 1 && Object.keys(value).every((key) => key === "tickers") && Array.isArray(value.tickers) && value.tickers.length > 0 && value.tickers.every((ticker) => isNonEmptyString(ticker));
|
|
68
|
-
var parseRuntimeEvidenceDeploymentSnapshot = (value) => {
|
|
69
|
-
if (!isRecord(value) || value.schemaVersion !== 2 || !isNonEmptyString(value.id) || !isNonEmptyString(value.deploymentCompositionId) || !/^dc1:[a-f0-9]{16}$/.test(value.deploymentCompositionId) || !isNonEmptyString(value.label) || !isNonEmptyString(value.connectorName) || !isNonEmptyString(value.provider) || !isNonEmptyString(value.accountId) || typeof value.enabled !== "boolean" || !Array.isArray(value.strategies)) {
|
|
70
|
-
throw new Error(
|
|
71
|
-
"Runtime evidence deployment snapshot is missing or invalid"
|
|
72
|
-
);
|
|
73
|
-
}
|
|
74
|
-
const strategies = value.strategies.map((candidate) => {
|
|
75
|
-
if (!isRecord(candidate) || !isNonEmptyString(candidate.strategyName) || !isNonEmptyString(candidate.strategyRevision) || !/^sr1:[a-f0-9]{16}$/.test(candidate.strategyRevision) || typeof candidate.enabled !== "boolean" || !["active", "entries_paused"].includes(String(candidate.controlState)) || !INTERVALS.has(String(candidate.interval)) || !UNIVERSES.has(String(candidate.universe)) || !isNonEmptyString(candidate.strategyPackage) || !isNonEmptyString(candidate.strategyPackageVersion) || !isPackageVersionMap(candidate.strategyDependencyVersions) || !isNonEmptyString(candidate.runtimePackageVersion) || !isRecord(candidate.strategyConfig) || !isRuntimeStrategySelection(candidate.selection)) {
|
|
76
|
-
throw new Error(
|
|
77
|
-
"Runtime evidence deployment strategy snapshot is invalid"
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
if (String(candidate.strategyConfig.INTERVAL) !== String(candidate.interval) || String(candidate.strategyConfig.UNIVERSE) !== String(candidate.universe)) {
|
|
81
|
-
throw new Error(
|
|
82
|
-
`Runtime evidence strategy config does not match its scope: ${candidate.strategyName}`
|
|
83
|
-
);
|
|
84
|
-
}
|
|
85
|
-
if (candidate.accountId != null && (!isNonEmptyString(candidate.accountId) || candidate.accountId !== value.accountId)) {
|
|
86
|
-
throw new Error(
|
|
87
|
-
`Runtime evidence strategy account does not match deployment: ${candidate.strategyName}`
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
return candidate;
|
|
91
|
-
});
|
|
92
|
-
const identities = /* @__PURE__ */ new Set();
|
|
93
|
-
for (const strategy of strategies) {
|
|
94
|
-
if (identities.has(strategy.strategyName)) {
|
|
95
|
-
throw new Error(
|
|
96
|
-
`Duplicate runtime evidence strategy: ${strategy.strategyName}`
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
identities.add(strategy.strategyName);
|
|
100
|
-
}
|
|
101
|
-
return {
|
|
102
|
-
...value,
|
|
103
|
-
strategies
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
var resolveRuntimeEvidenceDeploymentSnapshot = async ({
|
|
107
|
-
userName,
|
|
108
|
-
projectRoot,
|
|
109
|
-
deploymentId
|
|
110
|
-
}) => {
|
|
111
|
-
const [deployment, strategies] = await Promise.all([
|
|
112
|
-
(0, import_runtimeStrategies.getRuntimeDeployment)({ userName, projectRoot, deploymentId }),
|
|
113
|
-
(0, import_runtimeStrategies.loadResolvedRuntimeStrategies)({ userName, projectRoot, deploymentId })
|
|
114
|
-
]);
|
|
115
|
-
if (!deployment) {
|
|
116
|
-
throw new Error(`Runtime deployment not found: ${deploymentId}`);
|
|
117
|
-
}
|
|
118
|
-
return {
|
|
119
|
-
schemaVersion: 2,
|
|
120
|
-
id: deployment.id,
|
|
121
|
-
deploymentCompositionId: deployment.deploymentCompositionId,
|
|
122
|
-
label: deployment.label,
|
|
123
|
-
connectorName: deployment.connectorName,
|
|
124
|
-
provider: deployment.provider,
|
|
125
|
-
accountId: deployment.accountId,
|
|
126
|
-
enabled: deployment.enabled,
|
|
127
|
-
strategies: strategies.map(
|
|
128
|
-
({
|
|
129
|
-
strategyName,
|
|
130
|
-
strategyRevision,
|
|
131
|
-
enabled,
|
|
132
|
-
controlState,
|
|
133
|
-
interval,
|
|
134
|
-
universe,
|
|
135
|
-
accountId,
|
|
136
|
-
strategyPackage,
|
|
137
|
-
strategyPackageVersion,
|
|
138
|
-
strategyDependencyVersions,
|
|
139
|
-
runtimePackageVersion,
|
|
140
|
-
strategyConfig,
|
|
141
|
-
selection
|
|
142
|
-
}) => ({
|
|
143
|
-
strategyName,
|
|
144
|
-
strategyRevision,
|
|
145
|
-
enabled,
|
|
146
|
-
controlState,
|
|
147
|
-
interval,
|
|
148
|
-
universe,
|
|
149
|
-
...accountId ? { accountId } : {},
|
|
150
|
-
strategyPackage,
|
|
151
|
-
strategyPackageVersion,
|
|
152
|
-
strategyDependencyVersions,
|
|
153
|
-
runtimePackageVersion,
|
|
154
|
-
strategyConfig,
|
|
155
|
-
...selection ? { selection } : {}
|
|
156
|
-
})
|
|
157
|
-
),
|
|
158
|
-
...deployment.assetClasses ? { assetClasses: [...deployment.assetClasses] } : {},
|
|
159
|
-
...deployment.tickers ? { tickers: [...deployment.tickers] } : {}
|
|
160
|
-
};
|
|
161
|
-
};
|
|
46
|
+
var runtimeEvidenceDeployment_exports = {};
|
|
47
|
+
__reExport(runtimeEvidenceDeployment_exports, require("@tradejs/node/diagnostics"));
|
|
162
48
|
|
|
163
49
|
// src/lib/runtimeEvidenceProducer.ts
|
|
164
|
-
var
|
|
165
|
-
|
|
166
|
-
var import_node_path = __toESM(require("path"));
|
|
167
|
-
var isRecord2 = (value) => value != null && typeof value === "object" && !Array.isArray(value);
|
|
168
|
-
var sha256 = (value) => (0, import_node_crypto.createHash)("sha256").update(value).digest("hex");
|
|
169
|
-
var parseRuntimeEvidenceProducer = (value) => {
|
|
170
|
-
const producer = isRecord2(value) ? value : null;
|
|
171
|
-
const runtimePackageManifest = isRecord2(producer?.runtimePackageManifest) ? producer.runtimePackageManifest : null;
|
|
172
|
-
if (producer?.schemaVersion !== 1 || typeof producer.projectSha !== "string" || !/^[a-f0-9]{40}$/.test(producer.projectSha) || typeof producer.imageDigest !== "string" || !/^sha256:[a-f0-9]{64}$/.test(producer.imageDigest) || runtimePackageManifest?.file !== "runtime-package-manifest.json" || typeof runtimePackageManifest.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(runtimePackageManifest.sha256)) {
|
|
173
|
-
throw new Error("Runtime evidence producer image identity is invalid");
|
|
174
|
-
}
|
|
175
|
-
return producer;
|
|
176
|
-
};
|
|
177
|
-
var resolveRuntimeEvidenceProducer = async ({
|
|
178
|
-
projectRoot,
|
|
179
|
-
required
|
|
180
|
-
}) => {
|
|
181
|
-
const projectSha = String(process.env.TRADEJS_PROJECT_SHA ?? "").trim();
|
|
182
|
-
const imageDigest = String(
|
|
183
|
-
process.env.TRADEJS_PROJECT_IMAGE_DIGEST ?? ""
|
|
184
|
-
).trim();
|
|
185
|
-
if (!projectSha && !imageDigest && !required) {
|
|
186
|
-
return null;
|
|
187
|
-
}
|
|
188
|
-
if (!/^[a-f0-9]{40}$/.test(projectSha)) {
|
|
189
|
-
throw new Error(
|
|
190
|
-
"TRADEJS_PROJECT_SHA must be a full lowercase Git SHA before publishing runtime evidence"
|
|
191
|
-
);
|
|
192
|
-
}
|
|
193
|
-
if (!/^sha256:[a-f0-9]{64}$/.test(imageDigest)) {
|
|
194
|
-
throw new Error(
|
|
195
|
-
"TRADEJS_PROJECT_IMAGE_DIGEST must be an immutable sha256 digest before publishing runtime evidence"
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
const manifestPath = import_node_path.default.join(projectRoot, "runtime-package-manifest.json");
|
|
199
|
-
let manifest;
|
|
200
|
-
try {
|
|
201
|
-
manifest = await import_promises.default.readFile(manifestPath);
|
|
202
|
-
} catch (error) {
|
|
203
|
-
if (!required && error.code === "ENOENT") {
|
|
204
|
-
return null;
|
|
205
|
-
}
|
|
206
|
-
throw new Error(
|
|
207
|
-
`Runtime package manifest is required for runtime evidence: ${manifestPath}`,
|
|
208
|
-
{ cause: error }
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
return {
|
|
212
|
-
schemaVersion: 1,
|
|
213
|
-
projectSha,
|
|
214
|
-
imageDigest,
|
|
215
|
-
runtimePackageManifest: {
|
|
216
|
-
file: "runtime-package-manifest.json",
|
|
217
|
-
sha256: sha256(manifest)
|
|
218
|
-
}
|
|
219
|
-
};
|
|
220
|
-
};
|
|
50
|
+
var runtimeEvidenceProducer_exports = {};
|
|
51
|
+
__reExport(runtimeEvidenceProducer_exports, require("@tradejs/node/diagnostics"));
|
|
221
52
|
|
|
222
53
|
// src/lib/runtimeEvidenceCompositionSnapshots.ts
|
|
223
54
|
var SNAPSHOT_FILE = "snapshot.json";
|
|
@@ -237,8 +68,8 @@ var createRuntimeEvidenceCompositionSnapshotRecorder = ({
|
|
|
237
68
|
}
|
|
238
69
|
};
|
|
239
70
|
};
|
|
240
|
-
var
|
|
241
|
-
var
|
|
71
|
+
var isRecord = (value) => value != null && typeof value === "object" && !Array.isArray(value);
|
|
72
|
+
var sha256 = (value) => (0, import_node_crypto.createHash)("sha256").update(value).digest("hex");
|
|
242
73
|
var safeSegment = (value, label) => {
|
|
243
74
|
const normalized = value.trim();
|
|
244
75
|
if (!normalized || !/^[a-zA-Z0-9._:-]+$/.test(normalized)) {
|
|
@@ -251,8 +82,8 @@ var isExistingDestinationError = (error) => {
|
|
|
251
82
|
return code === "EEXIST" || code === "ENOTEMPTY";
|
|
252
83
|
};
|
|
253
84
|
var parseManifest = (value) => {
|
|
254
|
-
const manifest =
|
|
255
|
-
const payload =
|
|
85
|
+
const manifest = isRecord(value) ? value : null;
|
|
86
|
+
const payload = isRecord(manifest?.payload) ? manifest.payload : null;
|
|
256
87
|
if (manifest?.schemaVersion !== 1 || manifest.reportType !== "runtime-evidence-composition-snapshot" || typeof manifest.createdAt !== "number" || typeof manifest.userName !== "string" || typeof manifest.deploymentId !== "string" || typeof manifest.deploymentCompositionId !== "string" || payload?.file !== SNAPSHOT_FILE || typeof payload.sha256 !== "string" || !/^[a-f0-9]{64}$/.test(payload.sha256) || typeof payload.bytes !== "number") {
|
|
257
88
|
throw new Error("Invalid runtime evidence composition snapshot manifest");
|
|
258
89
|
}
|
|
@@ -260,28 +91,28 @@ var parseManifest = (value) => {
|
|
|
260
91
|
};
|
|
261
92
|
var verifyRuntimeEvidenceCompositionSnapshot = async (bundleDir) => {
|
|
262
93
|
const [manifestText, payload, completeText] = await Promise.all([
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
94
|
+
import_promises.default.readFile(import_node_path.default.join(bundleDir, MANIFEST_FILE), "utf8"),
|
|
95
|
+
import_promises.default.readFile(import_node_path.default.join(bundleDir, SNAPSHOT_FILE)),
|
|
96
|
+
import_promises.default.readFile(import_node_path.default.join(bundleDir, COMPLETE_FILE), "utf8")
|
|
266
97
|
]);
|
|
267
98
|
const manifest = parseManifest(JSON.parse(manifestText));
|
|
268
99
|
if (completeText.trim() !== manifest.deploymentCompositionId) {
|
|
269
100
|
throw new Error(`Invalid completion marker in ${bundleDir}`);
|
|
270
101
|
}
|
|
271
|
-
if (payload.byteLength !== manifest.payload.bytes ||
|
|
102
|
+
if (payload.byteLength !== manifest.payload.bytes || sha256(payload) !== manifest.payload.sha256) {
|
|
272
103
|
throw new Error(
|
|
273
104
|
`Runtime evidence snapshot checksum mismatch in ${bundleDir}`
|
|
274
105
|
);
|
|
275
106
|
}
|
|
276
107
|
const value = JSON.parse(payload.toString("utf8"));
|
|
277
|
-
const record =
|
|
108
|
+
const record = isRecord(value) ? value : null;
|
|
278
109
|
if (record?.schemaVersion !== 1 || record.reportType !== "runtime-evidence-composition-snapshot" || record.userName !== manifest.userName) {
|
|
279
110
|
throw new Error(
|
|
280
111
|
`Invalid runtime evidence snapshot payload in ${bundleDir}`
|
|
281
112
|
);
|
|
282
113
|
}
|
|
283
|
-
const deployment = parseRuntimeEvidenceDeploymentSnapshot(record.deployment);
|
|
284
|
-
const producer = parseRuntimeEvidenceProducer(record.producer);
|
|
114
|
+
const deployment = (0, runtimeEvidenceDeployment_exports.parseRuntimeEvidenceDeploymentSnapshot)(record.deployment);
|
|
115
|
+
const producer = (0, runtimeEvidenceProducer_exports.parseRuntimeEvidenceProducer)(record.producer);
|
|
285
116
|
if (deployment.id !== manifest.deploymentId || deployment.deploymentCompositionId !== manifest.deploymentCompositionId) {
|
|
286
117
|
throw new Error(
|
|
287
118
|
`Runtime evidence snapshot identity mismatch in ${bundleDir}`
|
|
@@ -321,43 +152,43 @@ var publishRuntimeEvidenceCompositionSnapshot = async ({
|
|
|
321
152
|
deploymentCompositionId: compositionId,
|
|
322
153
|
payload: {
|
|
323
154
|
file: SNAPSHOT_FILE,
|
|
324
|
-
sha256:
|
|
155
|
+
sha256: sha256(payload),
|
|
325
156
|
bytes: Buffer.byteLength(payload)
|
|
326
157
|
}
|
|
327
158
|
};
|
|
328
|
-
const snapshotsRoot =
|
|
329
|
-
const bundleDir =
|
|
330
|
-
const temporaryDir =
|
|
159
|
+
const snapshotsRoot = import_node_path.default.join(evidenceRoot, "snapshots", deploymentId);
|
|
160
|
+
const bundleDir = import_node_path.default.join(snapshotsRoot, compositionId);
|
|
161
|
+
const temporaryDir = import_node_path.default.join(
|
|
331
162
|
evidenceRoot,
|
|
332
163
|
"incoming",
|
|
333
|
-
`snapshot-${compositionId}.tmp-${(0,
|
|
164
|
+
`snapshot-${compositionId}.tmp-${(0, import_node_crypto.randomUUID)()}`
|
|
334
165
|
);
|
|
335
|
-
await
|
|
166
|
+
await import_promises.default.mkdir(temporaryDir, { recursive: true });
|
|
336
167
|
try {
|
|
337
168
|
await Promise.all([
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
169
|
+
import_promises.default.writeFile(import_node_path.default.join(temporaryDir, SNAPSHOT_FILE), payload, "utf8"),
|
|
170
|
+
import_promises.default.writeFile(
|
|
171
|
+
import_node_path.default.join(temporaryDir, MANIFEST_FILE),
|
|
341
172
|
`${JSON.stringify(manifest, null, 2)}
|
|
342
173
|
`,
|
|
343
174
|
"utf8"
|
|
344
175
|
)
|
|
345
176
|
]);
|
|
346
|
-
await
|
|
347
|
-
|
|
177
|
+
await import_promises.default.writeFile(
|
|
178
|
+
import_node_path.default.join(temporaryDir, COMPLETE_FILE),
|
|
348
179
|
`${compositionId}
|
|
349
180
|
`,
|
|
350
181
|
"utf8"
|
|
351
182
|
);
|
|
352
|
-
await
|
|
183
|
+
await import_promises.default.mkdir(snapshotsRoot, { recursive: true });
|
|
353
184
|
try {
|
|
354
|
-
await
|
|
185
|
+
await import_promises.default.rename(temporaryDir, bundleDir);
|
|
355
186
|
} catch (error) {
|
|
356
187
|
if (!isExistingDestinationError(error)) throw error;
|
|
357
|
-
await
|
|
188
|
+
await import_promises.default.rm(temporaryDir, { recursive: true, force: true });
|
|
358
189
|
}
|
|
359
190
|
} catch (error) {
|
|
360
|
-
await
|
|
191
|
+
await import_promises.default.rm(temporaryDir, { recursive: true, force: true });
|
|
361
192
|
throw error;
|
|
362
193
|
}
|
|
363
194
|
const verified = await verifyRuntimeEvidenceCompositionSnapshot(bundleDir);
|
|
@@ -375,12 +206,12 @@ var captureRuntimeEvidenceCompositionSnapshot = async ({
|
|
|
375
206
|
expectedCompositionId
|
|
376
207
|
}) => {
|
|
377
208
|
const [deployment, producer] = await Promise.all([
|
|
378
|
-
resolveRuntimeEvidenceDeploymentSnapshot({
|
|
209
|
+
(0, runtimeEvidenceDeployment_exports.resolveRuntimeEvidenceDeploymentSnapshot)({
|
|
379
210
|
userName,
|
|
380
211
|
projectRoot,
|
|
381
212
|
deploymentId
|
|
382
213
|
}),
|
|
383
|
-
resolveRuntimeEvidenceProducer({ projectRoot, required: true })
|
|
214
|
+
(0, runtimeEvidenceProducer_exports.resolveRuntimeEvidenceProducer)({ projectRoot, required: true })
|
|
384
215
|
]);
|
|
385
216
|
if (!producer) {
|
|
386
217
|
throw new Error("Runtime evidence producer identity is required");
|
|
@@ -391,31 +222,31 @@ var captureRuntimeEvidenceCompositionSnapshot = async ({
|
|
|
391
222
|
);
|
|
392
223
|
}
|
|
393
224
|
await publishRuntimeEvidenceCompositionSnapshot({
|
|
394
|
-
evidenceRoot:
|
|
225
|
+
evidenceRoot: import_node_path.default.join(projectRoot, "data", "runtime-evidence"),
|
|
395
226
|
userName,
|
|
396
227
|
deployment,
|
|
397
228
|
producer
|
|
398
229
|
});
|
|
399
230
|
};
|
|
400
231
|
var discoverRuntimeEvidenceCompositionSnapshots = async (evidenceRoot) => {
|
|
401
|
-
const rootDir =
|
|
232
|
+
const rootDir = import_node_path.default.join(evidenceRoot, "snapshots");
|
|
402
233
|
const bundleDirs = [];
|
|
403
234
|
let deployments;
|
|
404
235
|
try {
|
|
405
|
-
deployments = await
|
|
236
|
+
deployments = await import_promises.default.readdir(rootDir, { withFileTypes: true });
|
|
406
237
|
} catch (error) {
|
|
407
238
|
if (error.code === "ENOENT") return [];
|
|
408
239
|
throw error;
|
|
409
240
|
}
|
|
410
241
|
for (const deployment of deployments.filter((entry) => entry.isDirectory())) {
|
|
411
|
-
const deploymentDir =
|
|
412
|
-
const compositions = await
|
|
242
|
+
const deploymentDir = import_node_path.default.join(rootDir, deployment.name);
|
|
243
|
+
const compositions = await import_promises.default.readdir(deploymentDir, {
|
|
413
244
|
withFileTypes: true
|
|
414
245
|
});
|
|
415
246
|
bundleDirs.push(
|
|
416
247
|
...compositions.filter(
|
|
417
248
|
(entry) => entry.isDirectory() && !entry.name.startsWith(".") && !entry.name.includes(".tmp-")
|
|
418
|
-
).map((entry) =>
|
|
249
|
+
).map((entry) => import_node_path.default.join(deploymentDir, entry.name))
|
|
419
250
|
);
|
|
420
251
|
}
|
|
421
252
|
return Promise.all(
|