mirror of
https://github.com/morluto/rea
synced 2026-10-28 06:46:47 -04:00
735c10059c
Move each error family out of domain/errors.ts into its own module (base, core, provider selection/adapter, browser observation, artifact, evidence, unknown registry, hopper, configuration) and relocate AnalysisErrorProjection to analysisErrorProjection. Migrate all 162 importers to the owning modules and delete errors.ts. No re-export shims; behavior is unchanged.
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
import type { ExecutionOptions } from "./AnalysisProvider.js";
|
|
import type { BrowserScenarioCapturePort } from "./BrowserScenarioCapturePort.js";
|
|
import { createBrowserScenarioEvidence } from "./BrowserScenarioEvidence.js";
|
|
import { AnalysisCapabilityUnavailableError } from "../domain/analysisErrorCore.js";
|
|
import { type AnalysisError } from "../domain/analysisErrorBase.js";
|
|
import type { Evidence } from "../domain/evidence.js";
|
|
import type { BrowserScenario } from "../domain/browserScenario.js";
|
|
import { err, type Result } from "../domain/result.js";
|
|
|
|
const OPERATION = "capture_browser_scenario" as const;
|
|
const PROVIDER_ID = "rea-playwright-browser-scenario";
|
|
|
|
/** Execute one controlled browser scenario using its explicit request scope. */
|
|
export const captureBrowserScenario = async (
|
|
provider: BrowserScenarioCapturePort | undefined,
|
|
scenario: BrowserScenario,
|
|
options: ExecutionOptions = {},
|
|
): Promise<Result<Evidence, AnalysisError>> => {
|
|
if (provider === undefined)
|
|
return err(
|
|
new AnalysisCapabilityUnavailableError(
|
|
PROVIDER_ID,
|
|
OPERATION,
|
|
"browser scenario provider is not configured",
|
|
),
|
|
);
|
|
const captured = await provider.captureScenario(scenario, options);
|
|
return captured.ok
|
|
? {
|
|
ok: true,
|
|
value: createBrowserScenarioEvidence(
|
|
scenario,
|
|
captured.value,
|
|
provider.identity(),
|
|
),
|
|
}
|
|
: captured;
|
|
};
|