mirror of
https://github.com/morluto/rea.git
synced 2026-10-12 02:19:24 +00:00
Require the caller artifact resource scope when reading JavaScript artifacts. Transfer failed nested ASAR cleanup to that scope so later work retries the same owner before admission. Preserve traversal failures and attempt every remaining iterator during unwind. Validation: reconstruction, integrity, content identity, cancellation and nested-reader cleanup boundary checks. BREAKING CHANGE: readJavaScriptArtifactFiles now requires ArtifactResourceScope as its third argument; the optional abort signal is fourth.
35 lines
1.6 KiB
TypeScript
35 lines
1.6 KiB
TypeScript
import { withArtifactResourceScope } from "../fixtures/artifactInventory.js";
|
|
import type { ExecutionOptions } from "../../src/application/AnalysisProvider.js";
|
|
import { analyzeJavaScriptApplication as analyzeOwned } from "../../src/application/javascript/JavaScriptApplicationService.js";
|
|
import { reconstructJavaScriptArtifact as reconstructOwned } from "../../src/application/javascript/JavaScriptArtifactReconstruction.js";
|
|
import type { ProgressReporter } from "../../src/application/ProgressReporter.js";
|
|
import { readJavaScriptArtifactFiles as readOwned } from "../../src/artifacts/javascript/JavaScriptArtifactFiles.js";
|
|
import type { ArtifactReader } from "../../src/artifacts/ArtifactReader.js";
|
|
import type { ArtifactInventorySnapshot } from "../../src/domain/artifactInventorySnapshot.js";
|
|
|
|
/** Read a fixture's nested containers with an awaited cleanup owner. */
|
|
export const readJavaScriptArtifactFiles = (
|
|
reader: ArtifactReader,
|
|
snapshot: ArtifactInventorySnapshot,
|
|
signal?: AbortSignal,
|
|
) =>
|
|
withArtifactResourceScope((scope) =>
|
|
readOwned(reader, snapshot, scope, signal),
|
|
);
|
|
|
|
/** Run a JavaScript analysis with an awaited, test-owned artifact scope. */
|
|
export const analyzeJavaScriptApplication = (
|
|
input: unknown,
|
|
options: ExecutionOptions = {},
|
|
) => withArtifactResourceScope((scope) => analyzeOwned(input, scope, options));
|
|
|
|
/** Reconstruct a fixture with an awaited, test-owned artifact scope. */
|
|
export const reconstructJavaScriptArtifact = (
|
|
rawInput: unknown,
|
|
signal?: AbortSignal,
|
|
progress?: ProgressReporter,
|
|
) =>
|
|
withArtifactResourceScope((scope) =>
|
|
reconstructOwned(rawInput, scope, signal, progress),
|
|
);
|