import { aws_iam } from "aws-cdk-lib";
import { Construct } from "constructs";
import { FunctionLike, ParameterDecl, 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 function 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 declare type CommonFields = {
    /**
     * 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;
} & ({
    /**
     * 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;
    End?: never;
} | {
    /**
     * 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: true;
    Next?: never;
});
/**
 * @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 declare type Wait = 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 declare type Pass = 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 declare type CommonTaskFields = CommonFields & {
    Comment?: string;
    Parameters?: Parameters;
    ResultSelector?: Parameters;
    ResultPath?: string | null;
    Retry?: Retry[];
    Catch?: Catch[];
};
/**
 * @see https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-task-state.html
 */
export declare type Task = 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 declare type MapTask = 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 declare type ParallelTask = CommonTaskFields & {
    Type: "Parallel";
    Branches: StateMachine<States>[];
};
export declare function isParallelTaskState(state: State): state is ParallelTask;
export declare function isMapTaskState(state: State): state is MapTask;
export declare function isTaskState(state: State): state is Task;
export declare function isPassState(state: State): state is Pass;
export declare function isChoiceState(state: State): state is Choice;
export declare function isFailState(state: State): state is Fail;
export declare function isSucceedState(state: State): state is Succeed;
export declare function isWaitState(state: State): state is Wait;
/**
 * Handler used by {@link ASL.evalExpr}* functions.
 *
 * @param output - the {@link ASLGraph.Output} generated by the output by the expression.
 * @param context - some helper functions specific to the evaluation context.
 * @returns a state with output or output to be merged into the other states generated during evaluation.
 */
declare type EvalExprHandler<Output extends ASLGraph.Output = ASLGraph.Output> = (output: Output, context: EvalExprContext) => ASLGraph.NodeResults;
export interface EvalExprContext {
    /**
     * 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;
}
/**
 * Handler used by {@link ASL.evalContext} functions.
 *
 * @param context - some helper functions specific to the evaluation context.
 * @returns a state with output or output to be merged into the other states generated during evaluation.
 */
declare type EvalContextHandler = (context: EvalContextContext) => ASLGraph.NodeResults;
export interface EvalContextContext {
    /**
     * 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;
    /**
     * Evaluates a single expression and returns the {@link ASLGraph.Output}.
     *
     * Any generated states will be merged in with the output.
     *
     * This method is the same as {@link ASL.evalExpr}, but it adds any generated states to the current {@link ASL.evalContext}.
     */
    evalExpr: (expr: Expr, allowUndefined?: boolean) => ASLGraph.Output;
    /**
     * Evaluates a single expression and returns the {@link ASLGraph.Output}.
     *
     * Any generated states will be merged in with the output.
     *
     * * If the output was a {@link ASLGraph.LiteralValue}, a new state will be added that turns the literal into a {@link ASL.JsonPath}.
     * * If the output was a {@link ASLGraph.ConditionOutput}, a new {@link Choice} state will turn the conditional into a boolean
     *
     * This method is the same as {@link ASL.evalExprToJsonPath}, but it adds any generated states to the current {@link ASL.evalContext}.
     */
    evalExprToJsonPath: (expr: Expr, allowUndefined?: boolean) => ASLGraph.JsonPath;
    /**
     * Evaluates a single expression and returns the {@link ASLGraph.JsonPath} or {@link ASLGraph.LiteralValue}.
     *
     * Any generated states will be merged in with the output.
     *
     * If the output was a {@link ASLGraph.ConditionOutput}, a new {@link Choice} state will turn the conditional into a boolean
     * and return a {@link ASLGraph.JsonPath}.
     *
     * This method is the same as {@link ASL.evalExprToJsonPathOrLiteral}, but it adds any generated states to the current {@link ASL.evalContext}.
     */
    evalExprToJsonPathOrLiteral: (expr: Expr, allowUndefined?: boolean) => ASLGraph.JsonPath | ASLGraph.LiteralValue;
}
/**
 * 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 FunctionLike} AST representation of the State Machine.
     */
    readonly decl: FunctionLike;
    private readonly stateNamesGenerator;
    private readonly variableNamesGenerator;
    private readonly variableNamesMap;
    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: FunctionLike);
    /**
     * 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;
    };
    /**
     * Returns a unique name for a declaration.
     *
     * The first time we see a declaration, the name will be the same as the identifier name.
     *
     * All future unique declarations with the same name will see an incremented number suffixed to the identifier.
     *
     * ```ts
     * const a;
     * const a; // a__1
     * const a; // a__2
     * for(let a in []) // a__3
     * ```
     */
    private getDeclarationName;
    /**
     * Returns the unique variable name which has been registered for this identifier.
     *
     * Expects an {@link Identifier} which has a discoverable declaration.
     *
     * @see getDeclarationName
     */
    private getIdentifierName;
    /**
     * 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.
     *
     * @param returnPass partial Pass state which will be given the return value as input using {@link ASLGraph.passWithInput}.
     *                   provide the rest to determine the behavior of the returnStmt.
     */
    evalStmt(stmt: Stmt, returnPass: Omit<Pass, "Type" | "InputPath" | "Parameters" | "Result"> & CommonFields): ASLGraph.SubState | ASLGraph.NodeState | undefined;
    /**
     * Recursively evaluate a single expression, building a single {@link ASLGraph.NodeResults} object.
     *
     * Any states generated from the original expression or contextual helper functions in {@link handler}
     * will be merged into a single {@link ASLGraph.NodeResults} object at the end.
     *
     * @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.
     *                  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(expr: Expr, handler: EvalExprHandler): ASLGraph.NodeResults;
    /**
     * Recursively evaluate a single expression, building a single {@link ASLGraph.NodeResults} object.
     *
     * Any states generated from the original expression or contextual helper functions in {@link handler}
     * will be merged into a single {@link ASLGraph.NodeResults} object at the end.
     *
     * @param expr - Expression to evaluate.
     * @param contextNode - 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 {@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(expr: Expr, contextNode: FunctionlessNode, handler: EvalExprHandler): ASLGraph.NodeResults;
    /**
     * Recursively evaluate a single expression, building a single {@link ASLGraph.NodeResults} object.
     *
     * Any states generated from the original expression or contextual helper functions in {@link handler}
     * will be merged into a single {@link ASLGraph.NodeResults} object at the end.
     *
     * If the {@link ASLGraph.Output} of the expression is not a {@link ASLGraph.JsonPath}, it will be normalized into one.
     *
     * * 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.
     * * If the output was a {@link ASLGraph.ConditionOutput}, a new {@link Choice} state will turn the conditional into a boolean
     *   and return a {@link ASLGraph.JsonPath}.
     *
     * @param expr - Expression to evaluate.
     * @param handler - A handler callback which receives the {@link ASLGraph.JsonPath} 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.
     */
    evalExprToJsonPath(expr: Expr, handler: EvalExprHandler<ASLGraph.JsonPath>): ASLGraph.NodeResults;
    /**
     * Recursively evaluate a single expression, building a single {@link ASLGraph.NodeResults} object.
     *
     * Any states generated from the original expression or contextual helper functions in {@link handler}
     * will be merged into a single {@link ASLGraph.NodeResults} object at the end.
     *
     * If the {@link ASLGraph.Output} of the expression is not a {@link ASLGraph.JsonPath}, it will be normalized into one.
     *
     * * 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.
     * * If the output was a {@link ASLGraph.ConditionOutput}, a new {@link Choice} state will turn the conditional into a boolean
     *   and return a {@link ASLGraph.JsonPath}.
     *
     * @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 {@link ASLGraph.JsonPath} 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.
     */
    evalExprToJsonPath(expr: Expr, contextNode: FunctionlessNode, handler: EvalExprHandler<ASLGraph.JsonPath>): ASLGraph.NodeResults;
    /**
     * Recursively evaluate a single expression, building a single {@link ASLGraph.NodeResults} object.
     *
     * Any states generated from the original expression or contextual helper functions in {@link handler}
     * will be merged into a single {@link ASLGraph.NodeResults} object at the end.
     *
     * If the {@link ASLGraph.Output} of the expression is not a {@link ASLGraph.JsonPath} or {@link ASLGraph.LiteralValue}, it will be normalized into one.
     *
     * * If the output is a {@link ASLGraph.LiteralValue}, the output is returned as is.
     * * If the output was a {@link ASLGraph.JsonPath}, the output is returned as is.
     * * If the output was a {@link ASLGraph.ConditionOutput}, a new {@link Choice} state will turn the conditional into a boolean
     *   and return a {@link ASLGraph.JsonPath}.
     *
     * @param expr - Expression to evaluate.
     * @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.
     */
    evalExprToJsonPathOrLiteral(expr: Expr, handler: EvalExprHandler<ASLGraph.JsonPath | ASLGraph.LiteralValue>): ASLGraph.NodeResults;
    /**
     * Recursively evaluate a single expression, building a single {@link ASLGraph.NodeResults} object.
     *
     * Any states generated from the original expression or contextual helper functions in {@link handler}
     * will be merged into a single {@link ASLGraph.NodeResults} object at the end.
     *
     * If the {@link ASLGraph.Output} of the expression is not a {@link ASLGraph.JsonPath} or {@link ASLGraph.LiteralValue}, it will be normalized into one.
     *
     * * If the output is a {@link ASLGraph.LiteralValue}, the output is returned as is.
     * * If the output was a {@link ASLGraph.JsonPath}, the output is returned as is.
     * * If the output was a {@link ASLGraph.ConditionOutput}, a new {@link Choice} state will turn the conditional into a boolean
     *   and return a {@link ASLGraph.JsonPath}.
     *
     * @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.
     */
    evalExprToJsonPathOrLiteral(expr: Expr, contextNode: FunctionlessNode, handler: EvalExprHandler<ASLGraph.JsonPath | ASLGraph.LiteralValue>): ASLGraph.NodeResults;
    /**
     * Recursively evaluate a single expression, building a single {@link ASLGraph.NodeResults} object.
     * All SubStates generated during evaluation will be merged 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;
    /**
     * Returns the states required to normalize any {@link ASLGraph.Output} into a {@link ASLGraph.JsonPath}.
     *
     * * 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.
     * * If the output was a {@link ASLGraph.ConditionOutput}, a new {@link Choice} state will turn the conditional into a boolean
     *   and return a {@link ASLGraph.JsonPath}.
     */
    private normalizeOutputToJsonPath;
    /**
     * returns the states required to normalize a {@link ASLGraph.Output} into a {@link ASLGraph.JsonPath} or {@link ASLGraph.LiteralValue}.
     *
     * * If the output is a {@link ASLGraph.LiteralValue}, the output is returned as is.
     * * If the output was a {@link ASLGraph.JsonPath}, the output is returned as is.
     * * If the output was a {@link ASLGraph.ConditionOutput}, a new {@link Choice} state will turn the conditional into a boolean
     *   and return a {@link ASLGraph.JsonPath}.
     */
    private normalizeOutputToJsonPathOrLiteralValue;
    /**
     * 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 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(contextNode: FunctionlessNode, handler: EvalContextHandler): 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>;
    /**
     * 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;
    };
    /**
     * When the condition is true, executes the true states and assigns the left output to a temp variable.
     * When the condition is false, executes the true states and assigns the right out to a temp variable.
     *
     * @param trueState - states to execute when the condition is true. Default: returns true
     * @param falseState - states to execute when the condition is false. Default: returns false
     *
     * @returns a {@link ASLGraph.OutputSubState} that executes true when the value is true and false when the value is false.
     */
    conditionState(node: FunctionlessNode | undefined, cond: Condition, trueState?: ASLGraph.NodeResults, falseState?: ASLGraph.NodeResults, outputJsonPath?: string): ASLGraph.OutputSubState & {
        output: ASLGraph.JsonPath;
    };
    /**
     * Mutable heap counter.
     */
    private heapCounter;
    /**
     * returns an in order unique memory location in the form `$.heap[id]`
     * TODO: make this contextual - https://github.com/functionless/functionless/issues/321
     */
    newHeapVariable(): string;
    /**
     * returns an in order unique memory location in the form `heap[id]`
     * TODO: make this contextual - https://github.com/functionless/functionless/issues/321
     */
    newHeapVariableName(): 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;
        /**
         * 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;
    private filterToStateOutput;
    /**
     * Attempt to compile filter to JSONPath. If possible, this is the most efficient way to filter.
     *
     * When not possible, undefined is returned.
     */
    private filterToJsonPath;
    /**
     * filter an array using ASLGraph. Should support any logic that returns a boolean already supported by Functionless Step Functions.
     *
     * Note: If possible, try to use {@link filterToJsonPath} as it introduces no new state transitions.
     */
    private filterToASLGraph;
    private mapToStateOutput;
    private forEachToStateOutput;
    /**
     * Generic, plugable helper for array methods likes map, forEach, and filter.
     *
     * Expects a function in the form arr.(item, index, array) => {};
     *
     * `workingSpace` - a state location used by the array method machine. We'll write over this location with the result after.
     *
     * 1. init - initializes a working copy of the array, used to tail the array in the `workingSpace` (workingSpace.arr)
     *    1. [optional] - user provided parameter values to initialize the `workingSpace`
     * 2. check - check if the tailed array (`workingSpace.arr`) has more items.
     *    1. If yes, go to next, else go to `end` state.
     * 3. assignParameters - setup the current item, index, and array parameters, including handling any binding. Only if the parameter is defined by the program.
     * 4. body - execute the body of the function, with any return values going to the `iterationResultJsonPath`
     * 5. handle result - optional - optionally handle the result and customize the tail operation. Often the tail and handle logic can be joined together into one state.
     * 6. tail - if tail was not bypassed in the handle result step, update the `workingSpace.arr` to the tail of the array `workingSpace.arr[1:]`.
     * 7. check - return to the check state
     * 8. end - once the array is empty, execute the end state provided by the caller. Generally writing the result to the `workingSpace` location.
     */
    private iterateArrayMethod;
    /**
     * 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 getElementAccessConstant;
    /**
     * In some cases, variable can be batch declared as state parameters.
     * This method is an alternative to {@link evalDecl} which can evaluate multiple {@link ParameterDecl}s
     * with initial values into a parameter object and any state to be run after (which setup any bound variables.)
     *
     * Parameter with identifier names become State Parameter keys
     *
     * `(input) => {}`
     * ->
     * ```ts
     * {
     *    Type: "Pass", // or Task, Name, etc
     *    Parameters: {
     *       "input.$": jsonPath
     *    }
     * }
     * ```
     *
     * `({ value }) => {}`
     * ->
     * ```ts
     * {
     *    Type: "Pass",
     *    InputPath: jsonPath,
     *    ResultPath: "$.value"
     * }
     * ```
     *
     * A Parameter object will be more efficient as multiple values can be bound in a single State rather than multiple passes.
     *
     * However:
     * 1. a State Parameter object can only override the entire state, it cannot update or add a subset of all variable names.
     * 2. a State Parameter object only supports json path computation. Complex situations like invoking an {@link Integration} or
     *    default value support for binding patterns would not be supported.
     *
     * @returns a tuple of
     *          1. a {@link Parameters} object intended to be used in the Parameters or ResultSelector of a state.
     *             Contains the initialized parameter names. Could be empty.
     *          2. a state or sub-state used to generate the bound names. May be undefined.
     */
    evalParameterDeclForStateParameter(node: FunctionlessNode, ...parameters: [
        parameter: ParameterDecl | undefined,
        valuePath: ASLGraph.JsonPath
    ][]): [
        Record<string, Parameters>,
        ASLGraph.NodeState | ASLGraph.SubState | undefined
    ];
    evalDecl(decl: VariableDecl | ParameterDecl, initialValue?: ASLGraph.Output): ASLGraph.SubState | ASLGraph.NodeState | undefined;
    /**
     * Generic handler for any type of assignment with either an identifier or a binding pattern (deconstruction).
     *
     * Nested BindPatterns are handled recursively.
     *
     * const x = 1;
     * =>
     * const x = 1;
     *
     * const { x } = y;
     * =>
     * const x = y.x;
     *
     * const { x } = { x: 1 };
     * =>
     * const x = 1;
     *
     * const { x = 1 } = y;
     * =>
     * const x = y.x === undefined ? 1 : y.x;
     *
     * const { x = 1 } = {};
     * =>
     * const x = 1;
     *
     * const { x: { z } } = y;
     * =>
     * const z = y.x.z;
     *
     * const { x, ...rest } = y;
     * =>
     * INVALID - rest is unsupported in objects because ASL doesn't support object manipulation (ex: delete) or field enumeration (ex: keySet).
     *
     * const [x] = arr;
     * =>
     * const x = arr[0];
     *
     * const [,x] = arr;
     * =>
     * const x = arr[1];
     *
     * const [x,...rest] = arr;
     * =>
     * const x = arr[0];
     * const rest = arr.slice(1);
     */
    private evalAssignment;
    /**
     * Assigns an {@link ASLGraph.Output} to a jsonPath variable.
     *
     * If the {@link value} is a {@link ASLGraph.ConditionOutput}, states are added to turn
     * the condition into a boolean value.
     */
    private assignValue;
    /**
     * Given an output value (json path, literal, or condition) and an expression to compute a default value,
     * return a possibly updated output value which will contain the default value if the initial value is undefined.
     *
     * `return value === undefined ? defaultValue : value;`
     */
    private applyDefaultValue;
    /**
     * Zip an array with it's index.
     *
     * In ASL, it is not possible to do arithmetic or get the length of an array, but
     * the map state does give us the index.
     *
     * @param formatIndex allows the optional formatting of the index number, for example, turning it into a string.
     * @returns a partial map state that results in an array of { index: number, item: arrayElement[index] }.
     */
    private zipArray;
}
export declare function isForEach(expr: CallExpr): expr is CallExpr & {
    expr: PropAccessExpr;
};
export declare function isMap(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;
    function isSubState(state: ASLGraph.NodeState | ASLGraph.SubState | ASLGraph.NodeResults): state is ASLGraph.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<S extends State = State> = S & {
        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;
    };
    function isOutputStateOrSubState(state: any): state is ASLGraph.OutputSubState | ASLGraph.OutputState;
    /**
     * 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;
    }
    interface ConditionOutput {
        condition: Condition;
    }
    type Output = ASLGraph.LiteralValue | ASLGraph.JsonPath | ASLGraph.ConditionOutput;
    function isLiteralValue(state: any): state is ASLGraph.LiteralValue;
    function isJsonPath(state: any): state is ASLGraph.JsonPath;
    function isConditionOutput(state: any): state is ASLGraph.ConditionOutput;
    const isAslGraphOutput: (a: any) => a is LiteralValue | JsonPath | ConditionOutput;
    /**
     * 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.
     */
    function 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.
     */
    function updateDeferredNextStates<T extends State | ASLGraph.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.
     */
    function updateAslStateOutput(state: ASLGraph.NodeResults, newOutput: ASLGraph.Output): LiteralValue | JsonPath | ConditionOutput | {
        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;
        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;
        /**
         * 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;
        End?: undefined;
        Parameters?: Parameters | undefined;
        ResultSelector?: Parameters | undefined;
        ResultPath?: string | null | undefined;
        Retry?: Retry[] | undefined;
        Catch?: Catch[] | undefined;
        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;
        /**
         * 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;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        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;
        /**
         * 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: true;
        Next?: undefined;
        Parameters?: Parameters | undefined;
        ResultSelector?: Parameters | undefined;
        ResultPath?: string | null | undefined;
        Retry?: Retry[] | undefined;
        Catch?: Catch[] | undefined;
        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;
        /**
         * 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;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        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;
        /**
         * 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;
        End?: undefined;
        Parameters?: Parameters | undefined;
        ResultSelector?: Parameters | undefined;
        ResultPath?: string | null | undefined;
        Retry?: Retry[] | undefined;
        Catch?: Catch[] | undefined;
        Type: "Parallel";
        Branches: StateMachine<States>[];
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        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;
        /**
         * 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: true;
        Next?: undefined;
        Parameters?: Parameters | undefined;
        ResultSelector?: Parameters | undefined;
        ResultPath?: string | null | undefined;
        Retry?: Retry[] | undefined;
        Catch?: Catch[] | undefined;
        Type: "Parallel";
        Branches: StateMachine<States>[];
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        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;
        /**
         * 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;
        End?: undefined;
        Type: "Pass";
        Result?: any;
        ResultPath?: string | null | undefined;
        Parameters?: Parameters | undefined;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        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;
        /**
         * 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: true;
        Next?: undefined;
        Type: "Pass";
        Result?: any;
        ResultPath?: string | null | undefined;
        Parameters?: Parameters | undefined;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        Type: "Succeed";
        Comment?: string | undefined;
        InputPath?: string | undefined;
        OutputPath?: string | undefined;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        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;
        /**
         * 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;
        End?: undefined;
        Parameters?: Parameters | undefined;
        ResultSelector?: Parameters | undefined;
        ResultPath?: string | null | undefined;
        Retry?: Retry[] | undefined;
        Catch?: Catch[] | undefined;
        Type: "Task";
        Resource: string;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        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;
        /**
         * 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: true;
        Next?: undefined;
        Parameters?: Parameters | undefined;
        ResultSelector?: Parameters | undefined;
        ResultPath?: string | null | undefined;
        Retry?: Retry[] | undefined;
        Catch?: Catch[] | undefined;
        Type: "Task";
        Resource: string;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        /**
         * 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;
        /**
         * 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;
        End?: undefined;
        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;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        /**
         * 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;
        /**
         * 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: true;
        Next?: undefined;
        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;
        node?: FunctionlessNode | undefined;
    } | {
        output: Output;
        startState: string;
        node?: FunctionlessNode | undefined;
        states: {
            [stateName: string]: NodeState<State> | SubState;
        };
    };
    /**
     * 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.
     */
    function 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).
     */
    function getAslStateOutput(state: ASLGraph.NodeResults): ASLGraph.Output;
    /**
     * Applies an {@link ASLGraph.Output} to a partial {@link Pass}.
     *
     * {@link ASLGraph.ConditionOutput} must be first turned into a {@link ASLGraph.JsonPath}.
     */
    function passWithInput(pass: Omit<NodeState<Pass>, "Parameters" | "InputPath" | "Result"> & CommonFields, value: Exclude<ASLGraph.Output, ASLGraph.ConditionOutput>): Pass;
    /**
     * Applies an {@link ASLGraph.Output} to a partial {@link Task}
     *
     * {@link ASLGraph.ConditionOutput} must be first turned into a {@link ASLGraph.JsonPath}.
     */
    function taskWithInput(task: Omit<Task, "Parameters" | "InputPath"> & CommonFields, value: Exclude<ASLGraph.Output, ASLGraph.ConditionOutput>): Task;
    /**
     * Compare any two {@link ASLGraph.Output} values.
     */
    function compareOutputs(leftOutput: ASLGraph.Output, rightOutput: ASLGraph.Output, operator: ASL.ValueComparisonOperators): Condition;
    function compare(left: ASLGraph.JsonPath | ASLGraph.ConditionOutput, right: ASLGraph.Output, operator: ASL.ValueComparisonOperators | "!=" | "!=="): Condition;
    function stringCompare(left: ASLGraph.JsonPath, right: ASLGraph.Output, operator: ASL.ValueComparisonOperators): Condition | undefined;
    function numberCompare(left: ASLGraph.JsonPath, right: ASLGraph.Output, operator: ASL.ValueComparisonOperators): Condition | undefined;
    function booleanCompare(left: ASLGraph.JsonPath | ASLGraph.ConditionOutput, right: ASLGraph.Output, operator: ASL.ValueComparisonOperators): Condition | undefined;
    function nullCompare(left: ASLGraph.JsonPath, right: ASLGraph.Output, operator: ASL.ValueComparisonOperators): Condition | undefined;
    /**
     * 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" }
     */
    function jsonAssignment(key: string, output: Exclude<ASLGraph.Output, ASLGraph.ConditionOutput>): Record<string, any>;
    function isTruthyOutput(v: ASLGraph.Output): Condition;
    function elementIn(element: string | number, targetJsonPath: ASLGraph.JsonPath): Condition;
    /**
     * @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`.
     */
    function accessConstant(value: ASLGraph.Output, field: string | number, element: boolean): ASLGraph.JsonPath | ASLGraph.LiteralValue;
}
export declare namespace ASL {
    function isTruthy(v: string): Condition;
    function and(...cond: (Condition | undefined)[]): Condition;
    function or(...cond: (Condition | undefined)[]): Condition;
    function not(cond: Condition): Condition;
    function isPresent(Variable: string): Condition;
    function isNull(Variable: string): Condition;
    function isNotNull(Variable: string): Condition;
    function isBoolean(Variable: string): Condition;
    function isString(Variable: string): Condition;
    function isNumeric(Variable: string): Condition;
    function isPresentAndNotNull(Variable: string): Condition;
    function stringEqualsPath(Variable: string, path: string): Condition;
    function stringEquals(Variable: string, string: string): Condition;
    function numericEqualsPath(Variable: string, path: string): Condition;
    function numericEquals(Variable: string, number: number): Condition;
    function booleanEqualsPath(Variable: string, path: string): Condition;
    function booleanEquals(Variable: string, value: boolean): Condition;
    /**
     * Supported comparison operators.
     *
     * Note: !== and != can be achieved by using {@link ASL.not}.
     */
    type ValueComparisonOperators = "===" | "==" | ">" | ">=" | "<=" | "<" | "!=" | "!==";
    const VALUE_COMPARISONS: Record<ValueComparisonOperators, Record<"string" | "boolean" | "number", keyof Condition | undefined>>;
    function compareValueOfType(Variable: string, operation: keyof typeof VALUE_COMPARISONS, value: string | number | boolean): Condition;
    function comparePathOfType(Variable: string, operation: keyof typeof VALUE_COMPARISONS, path: string, type: "string" | "number" | "boolean"): Condition;
    function falseCondition(): Condition;
    function trueCondition(): Condition;
}
export declare const deploymentOnlyModule = true;
export {};
//# sourceMappingURL=asl.d.ts.map