import type { Context } from "./context.ts"; import { DestroyStrategy } from "./destroy.ts"; import { type Scope } from "./scope.ts"; declare global { var ALCHEMY_PROVIDERS: Map>; var ALCHEMY_HANDLERS: Map; var ALCHEMY_DYNAMIC_RESOURCE_RESOLVERS: DynamicResourceResolver[]; } export declare const PROVIDERS: Map>; export type DynamicResourceResolver = (typeName: string) => Provider | undefined; /** * Register a function that will be called if a Resource Type cannot be found during deletion. */ export declare function registerDynamicResource(handler: DynamicResourceResolver): void; export declare function resolveDeletionHandler(typeName: string): Provider | undefined; export type ResourceID = string; export declare const ResourceID: unique symbol; export type ResourceFQN = string; export declare const ResourceFQN: unique symbol; export type ResourceKind = string; export declare const ResourceKind: unique symbol; export declare const ResourceScope: unique symbol; export declare const ResourceSeq: unique symbol; export interface ProviderOptions { /** * If true, the resource will be updated even if the inputs have not changed. */ alwaysUpdate: boolean; /** * The strategy to use when destroying the resource. * * @default "sequential" */ destroyStrategy?: DestroyStrategy; } export type ResourceProps = { [key: string]: any; }; export type ResourceAttributes = { [key: string]: any; }; export type Provider = F & IsClass & { type: Type; options: Partial | undefined; handler: F; }; export interface PendingResource extends Promise { [ResourceKind]: ResourceKind; [ResourceID]: ResourceID; [ResourceFQN]: ResourceFQN; [ResourceScope]: Scope; [ResourceSeq]: number; [DestroyStrategy]: DestroyStrategy; } export interface Resource { [ResourceKind]: Kind; [ResourceID]: ResourceID; [ResourceFQN]: ResourceFQN; [ResourceScope]: Scope; [ResourceSeq]: number; [DestroyStrategy]: DestroyStrategy; } type IsClass = { new (_: never): never; }; type ResourceLifecycleHandler = (this: Context, id: string, props: any) => Promise; type Handler any> = F | (((this: any, id: string, props?: {}) => never) & IsClass); export declare function Resource(type: Type, fn: F): Handler; export declare function Resource(type: Type, options: Partial, fn: F): Handler; export {}; //# sourceMappingURL=resource.d.ts.map