refactor: make workspace descriptors schema v3 only
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
type VectorTransport,
|
||||
type WorkspaceDescriptor,
|
||||
} from "./schema.js";
|
||||
import type { DeprecatedV2Descriptor } from "./deprecated-v2-descriptor.js";
|
||||
|
||||
export interface ResolvedEvidenceBinding {
|
||||
values: Record<string, string>;
|
||||
@@ -85,7 +86,7 @@ function requiredSuffixes(
|
||||
const required = REQUIRED_SUFFIXES[role][transport] ?? [];
|
||||
const diagnostic = role === "DWH"
|
||||
? workspace.diagnostics?.dwh_rest
|
||||
: workspace.diagnostics?.vector_rest?.metadata;
|
||||
: (workspace as unknown as DeprecatedV2Descriptor).diagnostics?.vector_rest?.metadata;
|
||||
return transport === "rest_api" && diagnostic?.auth === "none"
|
||||
? required.filter((suffix) => suffix !== "API_KEY_FILE")
|
||||
: required;
|
||||
@@ -107,14 +108,13 @@ export function resolveBinding(
|
||||
}
|
||||
|
||||
const contract = buildInstallationContract(descriptor);
|
||||
const legacy = descriptor as unknown as DeprecatedV2Descriptor;
|
||||
const variables = contract.variables.filter((variable) => variable.role === role);
|
||||
const transportVariable = variables.find((variable) => variable.suffix === "TRANSPORT");
|
||||
const supported = role === "DWH"
|
||||
? descriptor.dwh.supported_transports
|
||||
: role === "VECTOR"
|
||||
? ("supported_transports" in descriptor.semantic_index.vector_store
|
||||
? descriptor.semantic_index.vector_store.supported_transports
|
||||
: [])
|
||||
? legacy.semantic_index.vector_store.supported_transports
|
||||
: ["rest_api"] as const;
|
||||
const selectedValue = transportVariable ? env[transportVariable.name] : undefined;
|
||||
const selectedTransport = isTransport(selectedValue) ? selectedValue : supported[0];
|
||||
|
||||
Reference in New Issue
Block a user