import { aws_iam } from "aws-cdk-lib";
import { Construct } from "constructs";
import { FunctionDecl, VariableDecl } from "./declaration";
import { CallExpr, Expr, PropAccessExpr } from "./expression";
import { FunctionlessNode } from "./node";
import { Stmt } from "./statement";
export interface StateMachine<S extends States> {
    Version?: "1.0";
    Comment?: string;
    TimeoutSeconds?: number;
    StartAt: keyof S;
    States: S;
}
export interface States {
    [stateName: string]: State;
}
export declare const isState: (state: any) => state is State;
export declare type State = Choice | Fail | MapTask | ParallelTask | Pass | Succeed | Task | Wait;
export declare type TerminalState = Succeed | Fail | Extract<State, {
    End: true;
}>;
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-common-fields.html
 */
export interface CommonFields {
    /**
     * The name of the next state that is run when the current state finishes. Some state types, such as Choice, allow multiple transition states.
     */
    Next?: string;
    /**
     * Designates this state as a terminal state (ends the execution) if set to true. There can be any number of terminal states per state machine. Only one of Next or End can be used in a state. Some state types, such as Choice, don't support or use the End field.
     */
    End?: boolean;
    /**
     * Holds a human-readable description of the state.
     */
    Comment?: string;
    /**
     * A path that selects a portion of the state's input to be passed to the state's task for processing. If omitted, it has the value $ which designates the entire input. For more information, see Input and Output Processing).
     */
    InputPath?: string;
    /**
     * A path that selects a portion of the state's input to be passed to the state's output. If omitted, it has the value $ which designates the entire input. For more information, see Input and Output Processing.
     */
    OutputPath?: string;
}
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-succeed-state.html
 */
export interface Succeed extends Omit<CommonFields, "Next" | "End"> {
    Type: "Succeed";
}
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-fail-state.html
 */
export interface Fail extends Pick<CommonFields, "Comment"> {
    Type: "Fail";
    Error?: string;
    Cause?: string;
}
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-wait-state.html
 */
export interface Wait extends CommonFields {
    Type: "Wait";
    /**
     * A time, in seconds, to wait before beginning the state specified in the Next field.
     */
    Seconds?: number;
    /**
     * An absolute time to wait until beginning the state specified in the Next field.
     *
     * Timestamps must conform to the RFC3339 profile of ISO 8601, with the further restrictions that an uppercase T must separate the date and time portions, and an uppercase Z must denote that a numeric time zone offset is not present, for example, 2016-08-18T17:33:00Z.
     */
    Timestamp?: string;
    /**
     * A time, in seconds, to wait before beginning the state specified in the Next field, specified using a path from the state's input data.
     */
    SecondsPath?: string;
    /**
     * An absolute time to wait until beginning the state specified in the Next field, specified using a path from the state's input data.
     */
    TimestampPath?: string;
}
export declare type Parameters = null | boolean | number | string | Parameters[] | {
    [name: string]: Parameters;
};
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-pass-state.html
 */
export interface Pass extends CommonFields {
    Comment?: string;
    Type: "Pass";
    Result?: any;
    ResultPath?: string | null;
    Parameters?: Parameters;
}
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-task-state.html
 */
export interface CommonTaskFields extends CommonFields {
    Comment?: string;
    Parameters?: Parameters;
    ResultSelector?: string;
    ResultPath?: string | null;
    Retry?: Retry[];
    Catch?: Catch[];
}
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-task-state.html
 */
export interface Task extends CommonTaskFields {
    Type: "Task";
    Resource: string;
}
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-choice-state.html
 */
export interface Choice extends Omit<CommonFields, "End" | "Next"> {
    Type: "Choice";
    Choices: Branch[];
    Default?: string;
}
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-choice-state.html
 */
export interface Branch extends Condition {
    Next: string;
}
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-choice-state.html
 */
export interface Condition {
    Variable?: string;
    Not?: Condition;
    And?: Condition[];
    Or?: Condition[];
    BooleanEquals?: boolean;
    BooleanEqualsPath?: string;
    IsBoolean?: boolean;
    IsNull?: boolean;
    IsNumeric?: boolean;
    IsPresent?: boolean;
    IsString?: boolean;
    IsTimestamp?: boolean;
    NumericEquals?: number;
    NumericEqualsPath?: string;
    NumericGreaterThan?: number;
    NumericGreaterThanPath?: string;
    NumericGreaterThanEquals?: number;
    NumericGreaterThanEqualsPath?: string;
    NumericLessThan?: number;
    NumericLessThanPath?: string;
    NumericLessThanEquals?: number;
    NumericLessThanEqualsPath?: string;
    StringEquals?: string;
    StringEqualsPath?: string;
    StringGreaterThan?: string;
    StringGreaterThanPath?: string;
    StringGreaterThanEquals?: string;
    StringGreaterThanEqualsPath?: string;
    StringLessThan?: string;
    StringLessThanPath?: string;
    StringLessThanEquals?: string;
    StringLessThanEqualsPath?: string;
    StringMatches?: string;
    TimestampEquals?: string;
    TimestampEqualsPath?: string;
    TimestampGreaterThan?: string;
    TimestampGreaterThanPath?: string;
    TimestampGreaterThanEquals?: string;
    TimestampGreaterThanEqualsPath?: string;
    TimestampLessThan?: string;
    TimestampLessThanPath?: string;
    TimestampLessThanEquals?: string;
    TimestampLessThanEqualsPath?: string;
}
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html
 */
export interface Retry {
    ErrorEquals: string[];
    IntervalSeconds?: number;
    MaxAttempts?: number;
    BackoffRate?: number;
}
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/concepts-error-handling.html
 */
export interface Catch {
    ErrorEquals: string[];
    ResultPath?: string | null;
    Next: string;
}
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-map-state.html
 */
export interface MapTask extends CommonTaskFields {
    Type: "Map";
    /**
     * The Iterator field’s value is an object that defines a state machine which will process each element of the array.
     */
    Iterator: StateMachine<States>;
    /**
     * The ItemsPath field’s value is a reference path identifying where in the effective input the array field is found. For more information, see ItemsPath.
     *
     * States within an Iterator field can only transition to each other, and no state outside the Iterator field can transition to a state within it.
     *
     * If any iteration fails, entire Map state fails, and all iterations are terminated.
     */
    ItemsPath?: string;
    /**
     * Specifies where (in the input) to place the output of the branches. The input is then filtered as specified by the OutputPath field (if present) before being used as the state's output. For more information, see Input and Output Processing.
     */
    ResultPath?: string | null;
    /**
     * The `MaxConcurrency` field’s value is an integer that provides an upper bound on how many invocations of the Iterator may run in parallel. For instance, a MaxConcurrency value of 10 will limit your Map state to 10 concurrent iterations running at one time.
     *
     * Concurrent iterations may be limited. When this occurs, some iterations will not begin until previous iterations have completed. The likelihood of this occurring increases when your input array has more than 40 items.
     *
     * The default value is 0, which places no quota on parallelism and iterations are invoked as concurrently as possible.
     *
     * A MaxConcurrency value of 1 invokes the Iterator once for each array element in the order of their appearance in the input, and will not start a new iteration until the previous has completed.
     */
    MaxConcurrency?: number;
}
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-parallel-state.html
 */
export interface ParallelTask extends CommonTaskFields {
    Type: "Parallel";
    Branches: StateMachine<States>[];
}
export declare const isParallelTaskState: (state: State) => state is ParallelTask;
export declare const isMapTaskState: (state: State) => state is MapTask;
export declare const isTaskState: (state: State) => state is Task;
export declare const isPassState: (state: State) => state is Pass;
export declare const isChoiceState: (state: State) => state is Choice;
export declare const isFailState: (state: State) => state is Fail;
export declare const isSucceedState: (state: State) => state is Succeed;
export declare const isWaitState: (state: State) => state is Wait;
export interface EvalExprContext {
    /**
     * returns a possibly mutated output variable as json path.
     *
     * If the output was a {@link ASLGraph.LiteralValue}, a new state will be added that turns the literal into a json path.
     * If the output was a {@link ASLGraph.JsonPath}, the output is returned.
     */
    normalizeOutputToJsonPath: () => ASLGraph.JsonPath;
    /**
     * Callback provided to inject additional states into the graph.
     * The state will be joined (@see ASLGraph.joinSubStates ) with the previous and next states in the order received.
     */
    addState: (state: ASLGraph.NodeState | ASLGraph.SubState) => void;
}
/**
 * Amazon States Language (ASL) Generator.
 */
export declare class ASL {
    readonly scope: Construct;
    readonly role: aws_iam.IRole;
    /**
     * A friendly name to identify the Functionless Context.
     */
    static readonly ContextName = "Amazon States Language";
    /**
     * Tag this instance with its Functionless Context ({@link this.ContextName})
     */
    readonly kind = "Amazon States Language";
    /**
     * The Amazon States Language (ASL) State Machine Definition synthesized fro the {@link decl}.
     */
    readonly definition: StateMachine<States>;
    /**
     * The {@link FunctionDecl} AST representation of the State Machine.
     */
    readonly decl: FunctionDecl;
    private readonly stateNamesCount;
    private readonly generatedNames;
    /**
     * A pointer to the state used to continue.
     *
     * For and While loops should implement this state.
     */
    private static readonly ContinueNext;
    /**
     * A pointer to the nearest break point.
     *
     * For and While loops should implement this state.
     */
    private static readonly BreakNext;
    /**
     * A pointer to the nearest catch state.
     */
    private static readonly CatchState;
    constructor(scope: Construct, role: aws_iam.IRole, decl: FunctionDecl);
    /**
     * Access Functionless context variables in the machine state like the input to the machine.
     *
     * The Functionless context is only added to the machine when needed.
     * Using this property anywhere in a machine will add the context Pass state to the start of the machine.
     */
    context: {
        null: string;
    };
    /**
     * Generates a valid, unique state name for the ASL machine.
     *
     * * Truncates the name to 75 characters
     * * If the name is already used, suffix with a unique number
     * * Cache both the truncated name and the suffixed name to prevent future collisions.
     */
    private createUniqueStateName;
    /**
     * Flattens a {@link ASLGraph.SubState} graph or {@link ASLGraph.NodeState} into a {@link States} collection.
     *
     * Provides a node naming strategy. (see `stmtName`).
     *
     * @param stmtName - The name to use to start the graph. When a SubState is given, the first state of the collection
     *                   with use the `stmtName`. All subsequent states either use the name of the `node` given or their local name
     *                   prefixed onto the parent name.
     *                   When a NodeState is given, the `stmtName` is used.
     */
    aslGraphToStates(state: ASLGraph.NodeState | ASLGraph.SubState, overrideStateName?: string): StateMachine<States>;
    /**
     * Evaluate a single {@link Stmt} into a collection of named states.
     */
    evalStmt(stmt: Stmt | VariableDecl): ASLGraph.SubState | ASLGraph.NodeState | undefined;
    /**
     * Recursively evaluate a single expression, building a single {@link ASLGraph.NodeResults} object.
     * All SubStates generated during evaluation will be merged into into a {@link ASLGraph.OutputSubState} along with the output
     * of the handler callback.
     *
     * @param expr - Expression to evaluate.
     * @param contextNode - Optional node to associate with the output state. This node may be used to name the resulting state.
     *                      Otherwise expr is used.
     * @param handler - A handler callback which received the {@link ASLGraph.Output} resolved from the expression.
     *                  This output will represent the constant or variable representing the output of the expression.
     *                  An `addState` callback is also provided to inject additional states into the graph.
     *                  The state will be joined (@see ASLGraph.joinSubStates ) with the previous and next states in the order received.
     */
    evalExpr<T extends ASLGraph.NodeResults>(expr: Expr, handler: (output: ASLGraph.Output, context: EvalExprContext) => T): T extends ASLGraph.OutputSubState ? ASLGraph.OutputSubState : ASLGraph.NodeResults;
    evalExpr<T extends ASLGraph.NodeResults>(expr: Expr, contextNode: FunctionlessNode, handler: (output: ASLGraph.Output, context: EvalExprContext) => T): T extends ASLGraph.OutputSubState ? ASLGraph.OutputSubState : ASLGraph.NodeResults;
    /**
     * Recursively evaluate a single expression, building a single {@link ASLGraph.NodeResults} object.
     * All SubStates generated during evaluation will be merged into into a {@link ASLGraph.SubState}.
     *
     * @param expr - Expression to evaluate.
     * @param handler - A handler callback which receives the {@link ASLGraph.Output} resolved from the expression.
     *                  This output will represent the constant or variable representing the output of the expression.
     */
    private evalExprToSubState;
    /**
     * evalExpr* functions provide a stateful closure that simplifies the evaluation
     * of an expression into {@link ASLGraph} states and {@link ASLGraph.Output}s.
     *
     * Unlike {@link eval} which requires manually joining of states, evalExpr* methods
     * maintain an array of that that we joined together at the end. They reduce control,
     * but reduce the work to generate valid ASLGraphs.
     */
    private evalExprBase;
    /**
     * Provides a contextual `evalExpr` and `evalCondition` functions to the handler provided.
     * Any SubStates generated using the provided functions will be joined into a single {@link ASLGraph.OutputSubState}
     * with the output of the handler.
     *
     * All SubStates generated during evaluation will be merged into into a {@link ASLGraph.OutputSubState} along with the output
     * of the handler callback.
     *
     * @param expr - Expression to evaluate.
     * @param contextNode - Optional node to associate with the output state. This node may be used to name the resulting state.
     *                      Otherwise expr is used.
     * @param handler - A handler callback which receives the contextual `evalExpr` function. The out of this handler will be
     *                  joined with any SubStates created from the `evalExpr` function.
     */
    evalContext<T extends ASLGraph.NodeResults>(contextNode: FunctionlessNode, handler: (evalExpr: (expr: Expr) => ASLGraph.Output, evalCondition: (expr: Expr) => Condition) => T): T extends ASLGraph.OutputSubState ? ASLGraph.OutputSubState : ASLGraph.NodeResults;
    /**
     * Internal method similar to {@link evalContext}.
     *
     * Unlike {@link evalContext}, this method does not return an output with the State or SubState.
     *
     * Used by the {@link evalStmt} cases which do not need an output (the output is determined by the stmt).
     *
     * @see evalContext for more details.
     */
    private evalContextToSubState;
    /**
     * Base logic shared by {@link evalContext} and {@link evalContextToSubState}.
     *
     * @see evalContext for more details.
     */
    private evalContextBase;
    /**
     * Evaluate an {@link Expr} to a single {@link State}.
     *
     * Method is private. External consumers should use use {@link evalContext} or {@link evalExpr}.
     *
     * @param expr the {@link Expr} to evaluate.
     * @param allowUndefined - when true, does not fail on undefined values. The resulting output literal may contain `value: undefined`.
     * @returns the {@link ASLGraph.Output} generated by an expression or an {@link ASLGraph.OutputSubState} with additional states and outputs.
     */
    private eval;
    /**
     * Returns an object containing Pass/Task parameters values to clone the current lexical scope into
     * another scope, like a Map state.
     *
     * ```ts
     * {
     *    'a.$': '$.a'
     * }
     * ```
     */
    cloneLexicalScopeParameters(node: FunctionlessNode): Record<string, string>;
    /**
     * @param element - when true (or field is a number) the output json path will prefer to use the square bracket format.
     *                  `$.obj[field]`. When false will prefer the dot format `$.obj.field`.
     */
    private accessConstant;
    /**
     * Helper that generates an {@link ASLGraph.OutputState} which returns null.
     */
    stateWithVoidOutput(state: State | ASLGraph.SubState): ASLGraph.OutputSubState | ASLGraph.OutputState;
    /**
     * Helper that generates an {@link ASLGraph.OutputState} which returns a value to a temporary location.
     *
     * Updates (immutably) a {@link ASLGraph.NodeState} to contain a new heap location result path.
     * The new heap location is returned an a {@link ASLGraph.JsonPath} output.
     */
    stateWithHeapOutput(state: Exclude<ASLGraph.NodeState, Choice | Fail | Succeed | Wait>, node?: FunctionlessNode): ASLGraph.NodeState & {
        output: ASLGraph.JsonPath;
    };
    conditionState(cond: Condition): ASLGraph.OutputSubState;
    /**
     * Mutable heap counter.
     */
    private heapCounter;
    /**
     * returns an in order unique memory location
     * TODO: make this contextual - https://github.com/functionless/functionless/issues/321
     */
    newHeapVariable(): string;
    /**
     * Find the transition edge from this {@link node} to the State which will handle
     * the error.
     *
     * @param node
     * @returns `undefined` if the error is terminal, otherwise a Next, ResultPath
     */
    throw(node: FunctionlessNode): {
        /**
         * Name of the state to transition to.
         */
        Next: string | undefined;
        /**
         * JSON Path to store the the error payload.
         */
        ResultPath: string | null;
    } | undefined;
    /**
     * Process a `array.slice()` expression and output the jsonPath or constant value.
     */
    private sliceToStateOutput;
    /**
     * Turns a call to `.join` on an array into a {@link ASLGraph.SubState}.
     *
     * If both the array and the separator argument are constant, just run .join and return the results.
     *
     * Otherwise, create a state machine that iterates over all elements of the array at runtime and creates a new
     * string with the separator between elements.
     */
    private joinToStateOutput;
    /**
     * Returns a object with the key formatted based on the contents of the value.
     * in ASL, object keys that reference json path values must have a suffix of ".$"
     * { "input.$": "$.value" }
     */
    toJsonAssignment(key: string, output: ASLGraph.Output): Record<string, any>;
    private filterToJsonPath;
    /**
     * We're indexing the array we're iterating over with the key. For this special case, we know that
     * the value points to `$$.Map.Item.Value`.
     *
     * In the below example:
     * 1. the value of `$$.Map.Item.Index` is stashed in `$.i` (as expected)
     * 2. the value of `$$.Map.Item.Value` is stashed in `$.0_i`. Special `0_` prefix is impossible
     *    to produce with TypeScript syntax and is therefore safe to use a prefix to store the hidden value.
     *
     * ```ts
     * for (const i in items) {
     *   const a = items[i]
     *   {
     *     Type: Pass
     *     ResultPath: $.a
     *     InputPath: "$.0_i"
     *   }
     * }
     * ```
     */
    private elementAccessExprToJsonPath;
    /**
     * Asserts that an {@link ASLGraph.Output} is a constant and is a number or string.
     *
     * Element access in StepFunctions must be constant because dynamic object is not supported.
     */
    private assertElementAccessConstant;
    /**
     * Transform an {@link Expr} into a ASL {@link Condition}.
     *
     * @returns a {@link Condition} and an optional {@link ASLGraph.SubState} or {@link ASLGraph.NodeState}.
     *          the states are returned when the condition needs annotation states to generate the conditional.
     */
    toCondition(expr: Expr): [Condition, ASLGraph.SubState | ASLGraph.NodeState | undefined];
}
export declare function isMapOrForEach(expr: CallExpr): expr is CallExpr & {
    expr: PropAccessExpr;
};
/**
 * ASL Graph is an intermediate API used to represent a nested and dynamic ASL State Machine Graph.
 *
 * Unlike ASL, the ASL graph supports nested nodes, can associate nodes to {@link FunctionlessNode}s, and contains a representation of the output of a state.
 *
 * ASL Graph is completely stateless.
 */
export declare namespace ASLGraph {
    /**
     * Used by integrations as a placeholder for the "Next" property of a task.
     *
     * When task.Next is ASLGraph.DeferNext, Functionless will replace the Next with the appropriate value.
     * It may also add End or ResultPath based on the scenario.
     */
    const DeferNext: string;
    const isSubState: (state: ASLGraph.NodeState | ASLGraph.SubState | ASLGraph.NodeResults) => state is SubState;
    /**
     * A Sub-State is a collection of possible return values.
     * A start state is the first state in the result. It will take on the name of the parent statement node.
     * States are zero to many named states or sub-stages that will take on the name of the parent statement node.
     */
    interface SubState {
        startState: string;
        node?: FunctionlessNode;
        states?: {
            [stateName: string]: ASLGraph.NodeState | ASLGraph.SubState;
        };
    }
    const isStateOrSubState: (a: any) => a is State | SubState;
    /**
     * An {@link ASLGraph} interface which adds an optional {@link FunctionlessNode} to a state.
     *
     * The node is used to name the state.
     */
    type NodeState = State & {
        node?: FunctionlessNode;
    };
    /**
     * The possible outputs of evaluating an {@link Expr}.
     *
     * State - A state with an {@link ASLGraph.Output} and optional {@link FunctionlessNode}
     * SubStates - A sub-state graph with an {@link ASLGraph.Output} and optional {@link FunctionlessNode}
     * JsonPath - a JSON Path Variable Reference, the consumer should use where json path is valid, ignore, or fail.
     * Value - a Value of type number, string, boolean, object, or null. Consumers should use where values can be used or turn into JsonPath using a {@link Pass} state.
     */
    type NodeResults = ASLGraph.OutputState | ASLGraph.OutputSubState | ASLGraph.Output;
    /**
     * A compound state is a state node that may contain a simple Constant or Variable output instead of
     * built states or sub-states.
     *
     * Compound states are designed to be incorporated into existing states or turned into
     * states before they are returned up.
     *
     * Compound states cannot be nested in sub-states.
     */
    interface OutputSubState extends ASLGraph.SubState {
        output: ASLGraph.Output;
    }
    /**
     * An {@link ASLGraph} interface which adds an {@link ASLGraph.Output} a state.
     *
     * The node is used to name the state.
     */
    type OutputState = NodeState & {
        output: ASLGraph.Output;
    };
    const isOutputStateOrSubState: (state: any) => state is OutputState | OutputSubState;
    /**
     * A literal value of type string, number, boolean, object, or null.
     *
     * If this is an Object, the object may contain nested JsonPaths as denoted by `containsJsonPath`.
     */
    interface LiteralValue {
        /**
         * Whether there is json path in the constant.
         *
         * Helps determine where this constant can go for validation and
         * when false use Result in a Pass State instead of Parameters
         */
        containsJsonPath: boolean;
        value: string | number | null | boolean | Record<string, any> | any[];
    }
    /**
     * A json path based state values reference.
     */
    interface JsonPath {
        jsonPath: string;
    }
    type Output = ASLGraph.LiteralValue | ASLGraph.JsonPath;
    const isLiteralValue: (state: any) => state is LiteralValue;
    const isJsonPath: (state: any) => state is JsonPath;
    /**
     * Wires together an array of {@link State} or {@link ASLGraph.SubState} nodes in the order given.
     * Any state which is missing Next/End will be given a Next value of the next state with the final state
     * either being left as is.
     */
    const joinSubStates: (node: FunctionlessNode, ...subStates: (ASLGraph.NodeState | ASLGraph.SubState | ASLGraph.NodeResults | undefined)[]) => ASLGraph.SubState | ASLGraph.NodeState | undefined;
    /**
     * Used to lazily provide the next step to a provided state or nested set of states.
     *
     * Recursively traverse sub-states down to regular states, replacing any
     * nodes with `Next: ASLGraph.DeferNext` or `Next: undefined` with the given props.
     *
     * Note: States without `Next` are ignored and {@link Map} states replace Default and `Choices[].Next` instead.
     */
    const updateDeferredNextStates: <T extends State | SubState>(props: {
        End?: true;
        Next?: string;
    }, state: T) => T;
    /**
     * Helper which can update a Asl state to a new output.
     * Sometimes the output can be updated in places like when accessing a constant or variable.
     *
     * If the state is a compound state, only the output needs to change, not the states it contains.
     *
     * ```ts
     * const obj = { a: { b: 1 } };
     * return obj.a.b;
     * ```
     *
     * output of obj.a
     * { startState: ..., states: {...}, output: { jsonPath: "$.obj.a" } }
     *
     * output of obj.a.b
     * { startState: ..., states: {...}, output: { jsonPath: "$.obj.a.b" } }
     *
     * Only the jsonPath has been mutated because no one used use intermediate output.
     */
    const updateAslStateOutput: (state: ASLGraph.NodeResults, newOutput: ASLGraph.Output) => JsonPath | LiteralValue | {
        output: Output;
        Type: "Choice";
        Choices: Branch[];
        Default?: string | undefined;
        Comment?: string | undefined;
        InputPath?: string | undefined;
        OutputPath?: string | undefined;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        Type: "Fail";
        Error?: string | undefined;
        Cause?: string | undefined;
        Comment?: string | undefined;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        Type: "Map";
        /**
         * The Iterator field’s value is an object that defines a state machine which will process each element of the array.
         */
        Iterator: StateMachine<States>;
        /**
         * The ItemsPath field’s value is a reference path identifying where in the effective input the array field is found. For more information, see ItemsPath.
         *
         * States within an Iterator field can only transition to each other, and no state outside the Iterator field can transition to a state within it.
         *
         * If any iteration fails, entire Map state fails, and all iterations are terminated.
         */
        ItemsPath?: string | undefined;
        /**
         * Specifies where (in the input) to place the output of the branches. The input is then filtered as specified by the OutputPath field (if present) before being used as the state's output. For more information, see Input and Output Processing.
         */
        ResultPath?: string | null | undefined;
        /**
         * The `MaxConcurrency` field’s value is an integer that provides an upper bound on how many invocations of the Iterator may run in parallel. For instance, a MaxConcurrency value of 10 will limit your Map state to 10 concurrent iterations running at one time.
         *
         * Concurrent iterations may be limited. When this occurs, some iterations will not begin until previous iterations have completed. The likelihood of this occurring increases when your input array has more than 40 items.
         *
         * The default value is 0, which places no quota on parallelism and iterations are invoked as concurrently as possible.
         *
         * A MaxConcurrency value of 1 invokes the Iterator once for each array element in the order of their appearance in the input, and will not start a new iteration until the previous has completed.
         */
        MaxConcurrency?: number | undefined;
        Comment?: string | undefined;
        Parameters?: Parameters | undefined;
        ResultSelector?: string | undefined;
        Retry?: Retry[] | undefined;
        Catch?: Catch[] | undefined;
        /**
         * The name of the next state that is run when the current state finishes. Some state types, such as Choice, allow multiple transition states.
         */
        Next?: string | undefined;
        /**
         * Designates this state as a terminal state (ends the execution) if set to true. There can be any number of terminal states per state machine. Only one of Next or End can be used in a state. Some state types, such as Choice, don't support or use the End field.
         */
        End?: boolean | undefined;
        /**
         * A path that selects a portion of the state's input to be passed to the state's task for processing. If omitted, it has the value $ which designates the entire input. For more information, see Input and Output Processing).
         */
        InputPath?: string | undefined;
        /**
         * A path that selects a portion of the state's input to be passed to the state's output. If omitted, it has the value $ which designates the entire input. For more information, see Input and Output Processing.
         */
        OutputPath?: string | undefined;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        Type: "Parallel";
        Branches: StateMachine<States>[];
        Comment?: string | undefined;
        Parameters?: Parameters | undefined;
        ResultSelector?: string | undefined;
        ResultPath?: string | null | undefined;
        Retry?: Retry[] | undefined;
        Catch?: Catch[] | undefined;
        /**
         * The name of the next state that is run when the current state finishes. Some state types, such as Choice, allow multiple transition states.
         */
        Next?: string | undefined;
        /**
         * Designates this state as a terminal state (ends the execution) if set to true. There can be any number of terminal states per state machine. Only one of Next or End can be used in a state. Some state types, such as Choice, don't support or use the End field.
         */
        End?: boolean | undefined;
        /**
         * A path that selects a portion of the state's input to be passed to the state's task for processing. If omitted, it has the value $ which designates the entire input. For more information, see Input and Output Processing).
         */
        InputPath?: string | undefined;
        /**
         * A path that selects a portion of the state's input to be passed to the state's output. If omitted, it has the value $ which designates the entire input. For more information, see Input and Output Processing.
         */
        OutputPath?: string | undefined;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        Comment?: string | undefined;
        Type: "Pass";
        Result?: any;
        ResultPath?: string | null | undefined;
        Parameters?: Parameters | undefined;
        /**
         * The name of the next state that is run when the current state finishes. Some state types, such as Choice, allow multiple transition states.
         */
        Next?: string | undefined;
        /**
         * Designates this state as a terminal state (ends the execution) if set to true. There can be any number of terminal states per state machine. Only one of Next or End can be used in a state. Some state types, such as Choice, don't support or use the End field.
         */
        End?: boolean | undefined;
        /**
         * A path that selects a portion of the state's input to be passed to the state's task for processing. If omitted, it has the value $ which designates the entire input. For more information, see Input and Output Processing).
         */
        InputPath?: string | undefined;
        /**
         * A path that selects a portion of the state's input to be passed to the state's output. If omitted, it has the value $ which designates the entire input. For more information, see Input and Output Processing.
         */
        OutputPath?: string | undefined;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        Type: "Succeed";
        Comment?: string | undefined;
        InputPath?: string | undefined;
        OutputPath?: string | undefined;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        Type: "Task";
        Resource: string;
        Comment?: string | undefined;
        Parameters?: Parameters | undefined;
        ResultSelector?: string | undefined;
        ResultPath?: string | null | undefined;
        Retry?: Retry[] | undefined;
        Catch?: Catch[] | undefined;
        /**
         * The name of the next state that is run when the current state finishes. Some state types, such as Choice, allow multiple transition states.
         */
        Next?: string | undefined;
        /**
         * Designates this state as a terminal state (ends the execution) if set to true. There can be any number of terminal states per state machine. Only one of Next or End can be used in a state. Some state types, such as Choice, don't support or use the End field.
         */
        End?: boolean | undefined;
        /**
         * A path that selects a portion of the state's input to be passed to the state's task for processing. If omitted, it has the value $ which designates the entire input. For more information, see Input and Output Processing).
         */
        InputPath?: string | undefined;
        /**
         * A path that selects a portion of the state's input to be passed to the state's output. If omitted, it has the value $ which designates the entire input. For more information, see Input and Output Processing.
         */
        OutputPath?: string | undefined;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        Type: "Wait";
        /**
         * A time, in seconds, to wait before beginning the state specified in the Next field.
         */
        Seconds?: number | undefined;
        /**
         * An absolute time to wait until beginning the state specified in the Next field.
         *
         * Timestamps must conform to the RFC3339 profile of ISO 8601, with the further restrictions that an uppercase T must separate the date and time portions, and an uppercase Z must denote that a numeric time zone offset is not present, for example, 2016-08-18T17:33:00Z.
         */
        Timestamp?: string | undefined;
        /**
         * A time, in seconds, to wait before beginning the state specified in the Next field, specified using a path from the state's input data.
         */
        SecondsPath?: string | undefined;
        /**
         * An absolute time to wait until beginning the state specified in the Next field, specified using a path from the state's input data.
         */
        TimestampPath?: string | undefined;
        /**
         * The name of the next state that is run when the current state finishes. Some state types, such as Choice, allow multiple transition states.
         */
        Next?: string | undefined;
        /**
         * Designates this state as a terminal state (ends the execution) if set to true. There can be any number of terminal states per state machine. Only one of Next or End can be used in a state. Some state types, such as Choice, don't support or use the End field.
         */
        End?: boolean | undefined;
        /**
         * Holds a human-readable description of the state.
         */
        Comment?: string | undefined;
        /**
         * A path that selects a portion of the state's input to be passed to the state's task for processing. If omitted, it has the value $ which designates the entire input. For more information, see Input and Output Processing).
         */
        InputPath?: string | undefined;
        /**
         * A path that selects a portion of the state's input to be passed to the state's output. If omitted, it has the value $ which designates the entire input. For more information, see Input and Output Processing.
         */
        OutputPath?: string | undefined;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        startState: string;
        node?: FunctionlessNode | undefined;
        states?: {
            [stateName: string]: NodeState | SubState;
        } | undefined;
    };
    /**
     * Transforms an {@link ASLGraph.AslState} or {@link ASLGraph.SubState} into a ASL {@link States} collection of flat states.
     *
     * Uses the parent name as a starting point. All state nodes of sub-states will be given the name of their parent.
     *
     * Sub-States with local or relative state references will be rewritten to the updated parent state name.
     *
     * Removes unreachable states from the graph. Unreachable states will cause step functions to fail.
     *
     * sub state
     * ```ts
     * {
     *    startState: "default",
     *    states: {
     *      default: { Next: 'b' },
     *      b: { Next: 'c' },
     *      c: { Next: 'externalState' }
     *    }
     * }
     * ```
     *
     * Parent state name: parentState
     *
     * rewrite
     * ```ts
     * {
     *    parentState: { Next: 'b__parentState' },
     *    b__parentState: { Next: 'c__parentState' },
     *    c__parentState: { Next: 'externalState' }
     * }
     * ```
     *
     * Local State Names
     *
     * In the below example, default, b, and c are all local state names.
     *
     * ```ts
     * {
     *    startState: "default",
     *    states: {
     *      default: { Next: 'b' },
     *      b: { Next: 'c' },
     *      c: { Next: 'externalState' }
     *    }
     * }
     * ```
     *
     * Relative state names
     *
     * Path structures can be used to denote relative paths. ex: `../stateName`.
     *
     * ```ts
     * {
     *    startState: "default",
     *    states: {
     *      default: { Next: 'b' },
     *      b: {
     *         startState: "start",
     *         states: {
     *            start: {
     *               Next: "../c"
     *            }
     *         }
     *      },
     *      c: { Next: 'externalState' }
     *    }
     * }
     * ```
     *
     * In the above example, b/start's next state is c in it's parent state.
     *
     * Currently referencing child states (ex: `./b/start`) is not supported.
     *
     * All state names not found in local or parent sub-states will be assumed to be top level state names and will not be re-written.
     */
    const toStates: (startState: string, states: ASLGraph.NodeState | ASLGraph.SubState | ASLGraph.OutputState | ASLGraph.OutputSubState, getStateNames: (parentName: string, states: ASLGraph.SubState) => Record<string, string>) => States;
    /**
     * Normalized an ASL state to just the output (constant or variable).
     */
    const getAslStateOutput: (state: ASLGraph.NodeResults) => ASLGraph.Output;
    /**
     * Applies an {@link ASLGraph.Output} to a partial {@link Pass}
     */
    const passWithInput: (pass: Omit<Pass, "Parameters" | "InputPath" | "Result">, value: ASLGraph.Output) => Pass;
    /**
     * Applies an {@link ASLGraph.Output} to a partial {@link Task}
     */
    const taskWithInput: (task: Omit<Task, "Parameters" | "InputPath">, value: ASLGraph.Output) => Task;
}
export declare namespace ASL {
    const isTruthy: (v: string) => Condition;
    const and: (...cond: (Condition | undefined)[]) => Condition;
    const or: (...cond: (Condition | undefined)[]) => Condition;
    const not: (cond: Condition) => Condition;
    const isPresent: (Variable: string) => Condition;
    const isNull: (Variable: string) => Condition;
    const isNotNull: (Variable: string) => Condition;
    const isBoolean: (Variable: string) => Condition;
    const isString: (Variable: string) => Condition;
    const isNumeric: (Variable: string) => Condition;
    const stringEqualsPath: (Variable: string, path: string) => Condition;
    const stringEquals: (Variable: string, string: string) => Condition;
    const numericEqualsPath: (Variable: string, path: string) => Condition;
    const numericEquals: (Variable: string, number: number) => Condition;
    const booleanEqualsPath: (Variable: string, path: string) => Condition;
    const booleanEquals: (Variable: string, value: boolean) => Condition;
    const VALUE_COMPARISONS: Record<"==" | ">" | ">=" | "<=" | "<", Record<"string" | "boolean" | "number", keyof Condition | undefined>>;
    const compareValueOfType: (Variable: string, operation: keyof typeof VALUE_COMPARISONS, value: string | number | boolean) => Condition;
    const comparePathOfType: (Variable: string, operation: keyof typeof VALUE_COMPARISONS, path: string, type: "string" | "number" | "boolean") => Condition;
    const compare: (left: ASLGraph.JsonPath, right: ASLGraph.Output, operator: keyof typeof VALUE_COMPARISONS | "!=") => Condition;
    const stringCompare: (left: ASLGraph.JsonPath, right: ASLGraph.Output, operator: "==" | ">" | "<" | "<=" | ">=") => Condition | undefined;
    const numberCompare: (left: ASLGraph.JsonPath, right: ASLGraph.Output, operator: "==" | ">" | "<" | "<=" | ">=") => Condition | undefined;
    const booleanCompare: (left: ASLGraph.JsonPath, right: ASLGraph.Output, operator: "==" | ">" | "<" | "<=" | ">=") => Condition | undefined;
    const nullCompare: (left: ASLGraph.JsonPath, right: ASLGraph.Output, operator: "==" | ">" | "<" | "<=" | ">=") => Condition | undefined;
    const falseCondition: () => Condition;
    const trueCondition: () => Condition;
}
export declare const deploymentOnlyModule = true;
//# sourceMappingURL=asl.d.ts.map