import { CompositeFunctionCatalog, HookAnchorId, ShellStep, Step } from '@expo/eas-build-job'; import { BuildFunction } from './BuildFunction'; import { BuildFunctionGroup } from './BuildFunctionGroup'; import { BuildStep } from './BuildStep'; import { BuildStepGlobalContext } from './BuildStepContext'; import { CompositeFunctionExpander } from './CompositeFunctionExpander'; /** * One entry per AUTHORED hook step — the unit the user wrote. The wrapper * earns its place twice. (1) A function-group call vanishes at expansion, so * the entry is the authored `if:`'s only home, evaluated once for the whole * group; `run:` and single-function entries keep the `if:` on the step itself * — the condition never exists in two places. Entry conditions see the global * context only; a group call's `with:` inputs are not visible to them. * (2) An entry whose explicit `if:` passed behaves like a single step whose * `if:` passed: its no-`if:` steps run past earlier entries' failures, while * within-entry failures still skip later siblings. `after` entries get the * same within-entry gate even without an explicit `if:`. * * Composite calls are also one entry, but their call-site `if:` lives on the * expansion scope (not `ifCondition`), matching main-workflow composites. A * passing call `if:` therefore does not grant the before-side `!entryFailed` * shield; there, no-`if:` children follow the plain in-sequence default. On * the after side every entry is gated by `!entryFailed`, so composite * children fail fast within their entry like everything else. */ export interface HookEntry { steps: BuildStep[]; ifCondition?: string; } /** * The hook entries attached to one anchor step occurrence. Carries the anchor * id because a stamped anchor is not reverse-derivable from a `BuildStep`. */ export interface AnchorHooks { anchor: HookAnchorId; before: HookEntry[]; after: HookEntry[]; } /** * Constructs hook entries from authored hook steps: ONE authored step → ONE * entry, anchor discovery disabled (a hook step invoking an anchored function * or a function group never becomes an anchor itself — no nesting). Validates * step shapes and function existence; the aggregate (cross-key) validation is * `validateHookStepsAsync`. * * Promise-returning by contract (like `validateHookStepsAsync`) even though * the body is synchronous: this API is pre-published for the native hook * runner (phase 3, not yet landed), and widening sync → async later would * break its callers. */ export declare function constructHookEntriesAsync(ctx: BuildStepGlobalContext, steps: Step[], { externalFunctions, externalFunctionGroups, compositeFunctionCatalog, }: { externalFunctions?: BuildFunction[]; externalFunctionGroups?: BuildFunctionGroup[]; /** When omitted, composite `uses:` fail as missing from an empty catalog. */ compositeFunctionCatalog?: CompositeFunctionCatalog; }): Promise; /** * Aggregate validation over an execution-ordered view of steps (unique ids, * output references, runtime-platform allowance). The parser runs it over * `job steps + hooks` (through `BuildWorkflowValidator`). */ export declare function validateHookStepsAsync(ctx: BuildStepGlobalContext, orderedView: readonly BuildStep[]): Promise; /** Package-internal: the parser path — steps already validated, function maps already built. */ export declare function constructHookEntriesFromValidatedSteps(ctx: BuildStepGlobalContext, validatedSteps: Step[], compositeFunctionExpander: CompositeFunctionExpander): HookEntry[]; /** Package-internal: shared shell-step construction (job steps and hook steps). */ export declare function createBuildStepFromShellStep(ctx: BuildStepGlobalContext, step: ShellStep): BuildStep; /** Package-internal. */ export declare function validateAllStepFunctionsExist(steps: Step[], { externalFunctionIds, externalFunctionGroupIds, }: { externalFunctionIds: string[]; externalFunctionGroupIds: string[]; }): void;