UNPKG

@redocly/respect-core

Version:
26 lines 1.17 kB
import { resolveInputValuesToSchema } from '../inputs/index.js'; import { getPublicSteps } from './set-public-steps.js'; export function getPublicWorkflows({ workflows, inputs, env = {}, }) { const publicWorkflows = {}; for (const workflow of workflows) { const workflowInputSchema = workflow.inputs; let resolvedInputs = {}; let resolvedDotEnvInputs = {}; if (workflowInputSchema) { resolvedInputs = resolveInputValuesToSchema(inputs, workflowInputSchema); } if (workflowInputSchema?.properties?.env) { resolvedDotEnvInputs = resolveInputValuesToSchema(env || {}, workflowInputSchema.properties.env); } const mergedInputs = Object.keys(resolvedDotEnvInputs).length > 0 ? { ...resolvedInputs, env: resolvedDotEnvInputs } : resolvedInputs; publicWorkflows[workflow.workflowId] = { steps: getPublicSteps(workflow.steps || []), inputs: workflowInputSchema ? mergedInputs : undefined, outputs: workflow.outputs, }; } return publicWorkflows; } //# sourceMappingURL=set-public-workflows.js.map