import { destroy } from "./destroy.js"; import { env } from "./env.js"; import { Scope } from "./scope.js"; import { secret } from "./secret.js"; import type { StateStoreType } from "./state.js"; /** * Type alias for semantic highlighting of `alchemy` as a type keyword */ export type alchemy = Alchemy; export declare const alchemy: Alchemy; /** * The Alchemy interface provides core functionality and is augmented by providers. * Supports both application scoping with secrets and template string interpolation. * * @example * // Create an application scope with stage and secret handling * const app = await alchemy("github:alchemy", { * stage: "prod", * phase: "up", * // Required for encrypting/decrypting secrets * password: process.env.SECRET_PASSPHRASE * }); * * // Create a resource with encrypted secrets * const resource = await Resource("my-resource", { * apiKey: alchemy.secret(process.env.API_KEY) * }); * * await app.finalize(); */ export interface Alchemy { run: typeof run; destroy: typeof destroy; /** * Get an environment variable and error if it's not set. */ env: typeof env; /** * Creates an encrypted secret that can be safely stored in state files. * Requires a password to be set either globally in the application options * or locally in the current scope. */ secret: typeof secret; /** * Creates a new application scope with the given name and options. * Used to create and manage resources with proper secret handling. * * @example * const app = await alchemy("my-app", { * stage: "prod", * // Required for encrypting/decrypting secrets * password: process.env.SECRET_PASSPHRASE * }); */ (appName: string, options?: Omit): Promise; /** * Template literal tag that supports file interpolation for documentation. * Automatically formats the content and appends file contents as code blocks. * * @example * // Generate documentation using file contents * await Document("api-docs", { * prompt: await alchemy` * Generate docs using the contents of: * ${alchemy.file("README.md")} * ${alchemy.file("./.cursorrules")} * * And here are the source files: * ${alchemy.files(files)} * ` * }); */ (template: TemplateStringsArray, ...values: any[]): Promise; } export interface AlchemyOptions { /** * The name of the application. */ appName?: string; /** * Determines whether the resources will be created/updated or deleted. * * @default "up" */ phase?: "up" | "destroy"; /** * Name to scope the resource state under (e.g. `.alchemy/{stage}/..`). * * @default - your POSIX username */ stage?: string; /** * If true, will not prune resources that were dropped from the root stack. * * @default true */ destroyOrphans?: boolean; /** * A custom state store to use instead of the default file system store. */ stateStore?: StateStoreType; /** * A custom scope to use as a parent. */ parent?: Scope; /** * If true, will not print any Create/Update/Delete messages. * * @default false */ quiet?: boolean; /** * A passphrase to use to encrypt/decrypt secrets. * Required if using alchemy.secret() in this scope. */ password?: string; } export interface ScopeOptions extends AlchemyOptions { enter: boolean; } export interface RunOptions extends AlchemyOptions { /** * @default false */ isResource?: boolean; } /** * Run a function in a new scope asynchronously. * Useful for isolating secret handling with a specific password. * * @example * // Run operations in a scope with its own password * await alchemy.run("secure-scope", { * password: process.env.SCOPE_PASSWORD * }, async () => { * // Secrets in this scope will use this password * const resource = await Resource("my-resource", { * apiKey: alchemy.secret(process.env.API_KEY) * }); * }); */ declare function run(...args: [id: string, fn: (this: Scope, scope: Scope) => Promise] | [ id: string, options: RunOptions, fn: (this: Scope, scope: Scope) => Promise ]): Promise; export {}; //# sourceMappingURL=alchemy.d.ts.map