mirror of
https://github.com/morluto/rea.git
synced 2026-11-09 08:17:02 +00:00
refactor(web): reuse shared provider input admission
This commit is contained in:
1 parent
fab78501c7
commit
6362ac6b72
3 files changed
+35
-62
No files matched your search
@@ -10,7 +10,6 @@ import {
|
||||
} from "../domain/analysisErrorCore.js";
|
||||
import { createEvidence, type Evidence } from "../domain/evidence.js";
|
||||
import { jsonObjectSchema } from "../domain/jsonValue.js";
|
||||
import { analysisInputErrorFromIssues } from "../domain/inputIssueProjection.js";
|
||||
import { err, ok, type Result } from "../domain/result.js";
|
||||
import {
|
||||
collectWebModuleImports,
|
||||
@@ -37,7 +36,10 @@ import type {
|
||||
WebModuleResolutionPort,
|
||||
} from "./WebModulePorts.js";
|
||||
|
||||
import { completeProviderEvidence } from "./ProviderOperationExecution.js";
|
||||
import {
|
||||
completeProviderEvidence,
|
||||
parseProviderOperationInput,
|
||||
} from "./ProviderOperationExecution.js";
|
||||
|
||||
const OPERATION = "trace_web_module_imports";
|
||||
const artifactsSchema = selectedWebScriptArtifactsSchema.extend({
|
||||
@@ -81,18 +83,14 @@ export class WebModuleTraceService {
|
||||
rawInput: unknown,
|
||||
options?: ExecutionOptions,
|
||||
): Promise<Result<Evidence, AnalysisError>> {
|
||||
if (options?.signal?.aborted)
|
||||
return err(
|
||||
new AnalysisCancelledError(OPERATION, { cause: options.signal.reason }),
|
||||
);
|
||||
const parsed = webModuleTraceInputSchema.safeParse(rawInput);
|
||||
if (!parsed.success)
|
||||
return err(
|
||||
analysisInputErrorFromIssues(OPERATION, parsed.error.issues, rawInput, {
|
||||
cause: parsed.error,
|
||||
}),
|
||||
);
|
||||
const input = parsed.data;
|
||||
const parsed = parseProviderOperationInput(
|
||||
OPERATION,
|
||||
rawInput,
|
||||
webModuleTraceInputSchema,
|
||||
options?.signal,
|
||||
);
|
||||
if (!parsed.ok) return parsed;
|
||||
const input = parsed.value;
|
||||
for (const [path, value] of [
|
||||
["importer_url", input.importer_url],
|
||||
["import_map.base_url", input.import_map?.base_url],
|
||||
|
||||
Reference in new issue
Block a user