import { ElementAccessExpr, Expr, ParameterDecl, PropAccessExpr, Stmt, VariableStmt } from "@functionless/ast"; /** * Returns a string array representing the property access starting from a named identity. * * Does not return the identity name given. * * (event) => { * event.prop1.prop2 * } * * Given the PropertyAccessExpr for "prop2", this function will return ["prop1", "prop2"]; */ export declare const getReferencePath: (expression: Expr) => ReferencePath | undefined; export declare const getPropertyAccessKeyFlatten: (expr: PropAccessExpr | ElementAccessExpr, scope: EventScope) => string | number; /** * Normalize retrieving the name of a property between a element access and property access expression. */ export declare const getPropertyAccessKey: (expr: PropAccessExpr | ElementAccessExpr) => string | number; export interface ReferencePath { identity: string; reference: (string | number)[]; } export declare const isReferencePath: (x: any) => x is ReferencePath; export interface EventScope { [key: string]: Expr | undefined; } /** * Attempts to remove references by flattening constant references and replaces local variables with properties. * Updates expressions in place to avoid new AST types. * * const val = "sam" * return val + " is cool" * * Becomes return "sam" + "is cool" * * const obj = { val: "hi" } * return obj.val + " there" * * Becomes return "hi" + " there" * * Also does some optimization like turning templated strings of all constants into a string constant. */ export declare const flattenExpression: (expr: Expr, scope: EventScope) => Expr; export declare const flattenStatementsScope: (stmts: VariableStmt[]) => Record; export declare type EventReference = ReferencePath & { reference: [string] | ["detail", ...string[]]; }; export declare function assertValidEventReference(eventReference?: ReferencePath, eventName?: ParameterDecl, utilsName?: ParameterDecl): asserts eventReference is EventReference; export declare const flattenReturnEvent: (stmts: Stmt[]) => Expr; export declare const deploymentOnlyModule = true; //# sourceMappingURL=utils.d.ts.map