import type { Resource, ResourceFQN, ResourceID, ResourceKind, ResourceProps } from "./resource.js"; import type { Scope } from "./scope.js"; import type { State } from "./state.js"; export type Context = CreateContext | UpdateContext | DeleteContext; export interface CreateContext extends BaseContext { phase: "create"; output?: undefined; props?: undefined; } export interface UpdateContext extends BaseContext { phase: "update"; output: Out; props: Props; } export interface DeleteContext extends BaseContext { phase: "delete"; output: Out; props: Props; } export interface BaseContext { quiet: boolean; stage: string; id: ResourceID; fqn: ResourceFQN; scope: Scope; get(key: string): Promise; set(key: string, value: T): Promise; delete(key: string): Promise; /** * Indicate that this resource is being replaced. * This will cause the resource to be deleted at the end of the stack's CREATE phase. */ replace(): void; /** * Terminate the resource lifecycle handler and destroy the resource. * * This is the final operation performed during a delete operation. * * It is so that the resource lifecycle handler can "return never" instead of * "return undefined" so that `await MyResource()` always returns a value. */ destroy(): never; /** * Create the Resource envelope (with Alchemy + User properties) */ create(props: Omit): Out; /** * Create the Resource envelope (with Alchemy + User properties) */ (id: string, props: Omit): Out; (props: Omit): Out; } export declare function context({ scope, phase, kind, id, fqn, seq, state, replace, }: { scope: Scope; phase: "create" | "update" | "delete"; kind: ResourceKind; id: ResourceID; fqn: ResourceFQN; seq: number; props: Props; state: State; replace: () => void; }): Context; //# sourceMappingURL=context.d.ts.map