UNPKG

miniflare

Version:

Fun, full-featured, fully-local simulator for Cloudflare Workers

1,202 lines (1,006 loc) 439 kB
import type { Abortable } from 'node:events'; import type { AbortSignal as AbortSignal_2 } from '@cloudflare/workers-types/experimental'; import type { AssetConfig } from '@cloudflare/workers-shared'; import type { Blob as Blob_2 } from '@cloudflare/workers-types/experimental'; import { Blob as Blob_3 } from 'node:buffer'; import { BodyInit as BodyInit_2 } from 'undici'; import type { CacheStorage as CacheStorage_2 } from '@cloudflare/workers-types/experimental'; import { cspotcodeSourceMapSupport } from '@cspotcode/source-map-support'; import type { D1Database as D1Database_2 } from '@cloudflare/workers-types/experimental'; import type { DurableObjectNamespace as DurableObjectNamespace_2 } from '@cloudflare/workers-types/experimental'; import type { Fetcher as Fetcher_2 } from '@cloudflare/workers-types/experimental'; import type { File as File_2 } from '@cloudflare/workers-types/experimental'; import type { Flagship as Flagship_2 } from '@cloudflare/workers-types/experimental'; import { FormData as FormData_2 } from 'undici'; import { Headers as Headers_2 } from 'undici'; import type { Headers as Headers_3 } from '@cloudflare/workers-types/experimental'; import { HeadersInit as HeadersInit_2 } from 'undici'; import type * as http from 'node:http'; import type { default as http_2 } from 'node:http'; import type { ImagesBinding as ImagesBinding_2 } from '@cloudflare/workers-types/experimental'; import type { IncomingRequestCfProperties as IncomingRequestCfProperties_2 } from '@cloudflare/workers-types/experimental'; import type { KVNamespace as KVNamespace_2 } from '@cloudflare/workers-types/experimental'; import type { KVNamespaceListKey as KVNamespaceListKey_2 } from '@cloudflare/workers-types/experimental'; import NodeWebSocket from 'ws'; import { Plugin as Plugin_2 } from './shared'; import { Process } from '@puppeteer/browsers'; import type { Queue as Queue_2 } from '@cloudflare/workers-types/experimental'; import type { R2Bucket as R2Bucket_2 } from '@cloudflare/workers-types/experimental'; import type { ReadableStream as ReadableStream_2 } from '@cloudflare/workers-types/experimental'; import { ReadableStream as ReadableStream_3 } from 'node:stream/web'; import { ReferrerPolicy } from 'undici'; import { Request as Request_3 } from 'undici'; import type { Request as Request_4 } from '@cloudflare/workers-types/experimental'; import { RequestCache } from 'undici'; import { RequestCredentials } from 'undici'; import { RequestDestination } from 'undici'; import { RequestDuplex } from 'undici'; import type { RequestInfo as RequestInfo_3 } from 'undici'; import type { RequestInit as RequestInit_3 } from 'undici'; import type { RequestInit as RequestInit_4 } from '@cloudflare/workers-types/experimental'; import type { RequestInitCfProperties as RequestInitCfProperties_2 } from '@cloudflare/workers-types/experimental'; import { RequestMode } from 'undici'; import { RequestRedirect } from 'undici'; import { Response as Response_3 } from 'undici'; import type { Response as Response_4 } from '@cloudflare/workers-types/experimental'; import type { ResponseInit as ResponseInit_3 } from 'undici'; import { ResponseRedirectStatus } from 'undici'; import { ResponseType } from 'undici'; import type { RouterConfig } from '@cloudflare/workers-shared'; import type { ServiceWorkerGlobalScope as ServiceWorkerGlobalScope_2 } from '@cloudflare/workers-types/experimental'; import type { SqlStorage as SqlStorage_2 } from '@cloudflare/workers-types'; import type { SqlStorageValue as SqlStorageValue_2 } from '@cloudflare/workers-types'; import type { StreamBinding as StreamBinding_2 } from '@cloudflare/workers-types/experimental'; import type { Transform } from 'node:stream'; import * as undici from 'undici'; import { UnsafeBindingSchema } from '@cloudflare/config'; import { URL as URL_2 } from 'url'; import { z } from 'zod'; export declare class __MiniflareFunctionWrapper { constructor(fnWithProps: ((...args: unknown[]) => unknown) & { [key: string | symbol]: unknown; }); } export declare const AGENT_MEMORY_PLUGIN: Plugin; export declare const AGENT_MEMORY_PLUGIN_NAME = "agent-memory"; export declare const AI_PLUGIN: Plugin; export declare const AI_PLUGIN_NAME = "ai"; export declare const AI_SEARCH_PLUGIN: Plugin; export declare const AI_SEARCH_PLUGIN_NAME = "ai-search"; export declare const ANALYTICS_ENGINE_PLUGIN: Plugin; export declare const ANALYTICS_ENGINE_PLUGIN_NAME = "analytics-engine"; export declare type AnyHeaders = http_2.IncomingHttpHeaders | string[]; export declare const ARTIFACTS_PLUGIN: Plugin; export declare const ARTIFACTS_PLUGIN_NAME = "artifacts"; export declare type AssetReverseMap = { [pathHash: string]: { filePath: string; contentType: string | null; }; }; export declare const ASSETS_PLUGIN: Plugin; export declare type Awaitable<T> = T | Promise<T>; export declare function base64Decode(encoded: string): string; export declare function base64Encode(value: string): string; export { BodyInit_2 as BodyInit } export declare const BROWSER_RENDERING_PLUGIN: Plugin; export declare const BROWSER_RENDERING_PLUGIN_NAME = "browser-rendering"; /** * The Asset Manifest and Asset Reverse Map are used to map a request path to an asset. * 1. Hash path of request * 2. Use this path hash to find the manifest entry * 3. Get content hash from manifest entry * 4a. In prod, use content hash to get asset from KV * 4b. In dev, we fake out the KV store and use the file system instead. * Use content hash to get file path from asset reverse map. */ export declare const buildAssetManifest: (dir: string) => Promise<{ encodedAssetManifest: Uint8Array<ArrayBuffer>; assetsReverseMap: AssetReverseMap; }>; export declare function buildObjectEntryProps(id: string): { json: string; }; /** * Builds a client-reachable URL for a local server given host, port, and * secure flag. Handles IPv6 bracketing and wildcard-address normalization * so the resulting string is always a valid URL. */ export declare function buildPublicUrl(options: { hostname?: string; port: number; secure?: boolean; }): string; export declare function buildRemoteProxyProps(remoteProxyConnectionString: RemoteProxyConnectionString | undefined, binding: string): { json: string; }; export declare const CACHE_PLUGIN: Plugin; export declare const CACHE_PLUGIN_NAME = "cache"; export declare const CacheHeaders: { readonly NAMESPACE: "cf-cache-namespace"; readonly STATUS: "cf-cache-status"; }; declare class CloseEvent_2 extends Event { readonly code: number; readonly reason: string; readonly wasClean: boolean; constructor(type: "close", init?: { code?: number; reason?: string; wasClean?: boolean; }); } export { CloseEvent_2 as CloseEvent } export declare interface CompiledModuleRule { type: V4ModuleRuleType; include: ReturnType<typeof globsToRegExps>; } export declare function compileModuleRules(rules: V4ModuleRule[]): CompiledModuleRule[]; export declare interface Config { services?: Service_2[]; sockets?: Socket_2[]; v8Flags?: string[]; extensions?: Extension[]; autogates?: string[]; structuredLogging?: boolean; } export declare function convertV4MiniflareOptions(options: V4MiniflareOptions): MiniflareOptions; export declare const CORE_PLUGIN: Plugin; export declare const CORE_PLUGIN_NAME = "core"; export declare const CoreBindings: { readonly SERVICE_LOOPBACK: "MINIFLARE_LOOPBACK"; readonly SERVICE_USER_ROUTE_PREFIX: "MINIFLARE_USER_ROUTE_"; readonly SERVICE_USER_FALLBACK: "MINIFLARE_USER_FALLBACK"; readonly TEXT_CUSTOM_SERVICE: "MINIFLARE_CUSTOM_SERVICE"; readonly IMAGES_BINDING_SERVICE: "MINIFLARE_IMAGES_BINDING_SERVICE"; readonly IMAGES_FETCH_SERVICE: "MINIFLARE_IMAGES_FETCH_SERVICE"; readonly TEXT_UPSTREAM_URL: "MINIFLARE_UPSTREAM_URL"; readonly JSON_CF_BLOB: "CF_BLOB"; readonly JSON_ROUTES: "MINIFLARE_ROUTES"; readonly JSON_LOG_LEVEL: "MINIFLARE_LOG_LEVEL"; readonly DURABLE_OBJECT_NAMESPACE_PROXY: "MINIFLARE_PROXY"; readonly DATA_PROXY_SECRET: "MINIFLARE_PROXY_SECRET"; readonly DATA_PROXY_SHARED_SECRET: "MINIFLARE_PROXY_SHARED_SECRET"; readonly TRIGGER_HANDLERS: "TRIGGER_HANDLERS"; readonly LOG_REQUESTS: "LOG_REQUESTS"; readonly STRIP_DISABLE_PRETTY_ERROR: "STRIP_DISABLE_PRETTY_ERROR"; readonly SERVICE_LOCAL_EXPLORER: "MINIFLARE_LOCAL_EXPLORER"; readonly EXPLORER_DISK: "MINIFLARE_EXPLORER_DISK"; readonly JSON_LOCAL_EXPLORER_BINDING_MAP: "LOCAL_EXPLORER_BINDING_MAP"; readonly JSON_LOCAL_EXPLORER_WORKER_NAMES: "LOCAL_EXPLORER_WORKER_NAMES"; readonly JSON_EXPLORER_WORKER_OPTS: "MINIFLARE_EXPLORER_WORKER_OPTS"; readonly SERVICE_CACHE: "MINIFLARE_CACHE"; readonly SERVICE_DEV_CONTROL: "MINIFLARE_DEV_CONTROL"; readonly SERVICE_DEV_REGISTRY_PROXY: "MINIFLARE_DEV_REGISTRY_PROXY"; readonly JSON_TELEMETRY_CONFIG: "MINIFLARE_TELEMETRY_CONFIG"; readonly DEV_REGISTRY_DEBUG_PORT: "DEV_REGISTRY_DEBUG_PORT"; readonly SERVICE_STREAM: "MINIFLARE_STREAM"; readonly SERVICE_IMAGES_DELIVERY: "MINIFLARE_IMAGES_DELIVERY"; readonly SERVICE_R2_PUBLIC: "MINIFLARE_R2_PUBLIC"; readonly SERVICE_R2_S3: "MINIFLARE_R2_S3"; readonly SERVICE_OBSERVABILITY_COLLECTOR: "MINIFLARE_OBSERVABILITY_COLLECTOR"; }; export declare const CoreHeaders: { readonly CUSTOM_FETCH_SERVICE: "MF-Custom-Fetch-Service"; readonly CUSTOM_NODE_SERVICE: "MF-Custom-Node-Service"; readonly ORIGINAL_URL: "MF-Original-URL"; /** * Stores the original hostname when using the `upstream` option. * When requests are proxied to an upstream, the `Host` header is rewritten * to match the upstream. This header preserves the original hostname * so Workers can access it if needed. */ readonly ORIGINAL_HOSTNAME: "MF-Original-Hostname"; readonly PROXY_SHARED_SECRET: "MF-Proxy-Shared-Secret"; readonly DISABLE_PRETTY_ERROR: "MF-Disable-Pretty-Error"; readonly ERROR_STACK: "MF-Experimental-Error-Stack"; /** * The serialised error, URI-encoded. `workerd` drops response bodies for * `HEAD` requests, so the body alone cannot carry the error out of the user * Worker. Producers set this in addition to the body; consumers fall back to * it whenever the body is unavailable. */ readonly ERROR_STACK_PAYLOAD: "MF-Experimental-Error-Stack-Payload"; readonly ROUTE_OVERRIDE: "MF-Route-Override"; readonly CF_BLOB: "MF-CF-Blob"; /** Used by the Vite plugin to pass through the original `sec-fetch-mode` header */ readonly SEC_FETCH_MODE: "MF-Sec-Fetch-Mode"; readonly OP_SECRET: "MF-Op-Secret"; readonly OP: "MF-Op"; readonly OP_TARGET: "MF-Op-Target"; readonly OP_KEY: "MF-Op-Key"; readonly OP_SYNC: "MF-Op-Sync"; readonly OP_STRINGIFIED_SIZE: "MF-Op-Stringified-Size"; readonly OP_RESULT_TYPE: "MF-Op-Result-Type"; readonly OP_ORIGINAL_URL: "MF-Op-Original-URL"; }; /** * Reserved paths for internal Miniflare endpoints. * * Paths under `/cdn-cgi/local/` are reserved by Cloudflare's network * and won't conflict with user routes. Paths under `/__cf_local/` live * outside `/cdn-cgi/` so they remain reachable over tunnels. */ export declare const CorePaths: { /** Magic proxy used by getPlatformProxy */ readonly PLATFORM_PROXY: "/cdn-cgi/local/platform-proxy"; /** Trigger scheduled event handlers */ readonly SCHEDULED: "/cdn-cgi/local/scheduled"; /** Trigger email event handlers */ readonly EMAIL: "/cdn-cgi/local/email"; /** Local explorer UI and API */ readonly EXPLORER: "/cdn-cgi/local/explorer"; /** Stream video serving endpoint (outside /cdn-cgi/ for tunnel access) */ readonly STREAM_VIDEO: "/__cf_local/stream"; /** Local image delivery endpoint (outside /cdn-cgi/ for tunnel access) */ readonly IMAGE_DELIVERY: "/__cf_local/imagedelivery"; /** Public R2 bucket object serving endpoint */ readonly R2_PUBLIC: "/cdn-cgi/local/r2/public"; /** S3-compatible API endpoint for local R2 buckets */ readonly R2_S3: "/cdn-cgi/local/r2/s3"; }; export declare function coupleWebSocket(ws: NodeWebSocket, pair: WebSocket_2): Promise<void>; export declare function createHTTPReducers(impl: PlatformImpl<unknown>): ReducersRevivers; export declare function createHTTPRevivers<RS>(impl: PlatformImpl<RS>): ReducersRevivers; export declare const D1_PLUGIN: Plugin; export declare const D1_PLUGIN_NAME = "d1"; /** * Recovers the serialised error a Worker put in `ERROR_STACK_PAYLOAD`, for the * cases where the response body carrying it has been dropped (`HEAD` requests). * Returns `null` when the header is absent or malformed, so callers can fall * back rather than surfacing a decoding failure as the Worker's error. */ export declare function decodeErrorPayload(response: { headers: { get(name: string): string | null; }; }): string | null; export declare function decodeSitesKey(key: string): string; export declare class DeferredPromise<T> extends Promise<T> { readonly resolve: DeferredPromiseResolve<T>; readonly reject: DeferredPromiseReject; constructor(executor?: (resolve: (value: T | PromiseLike<T>) => void, reject: (reason?: any) => void) => void); } export declare type DeferredPromiseReject = (reason?: any) => void; export declare type DeferredPromiseResolve<T> = (value: T | PromiseLike<T>) => void; export declare function deserialiseRegExps(matcher: SerialisableMatcherRegExps): MatcherRegExps; export declare function deserialiseSiteRegExps(siteRegExps: SerialisableSiteMatcherRegExps): SiteMatcherRegExps; export declare type DevConfig = z.input<typeof DevConfigSchema>; export declare const DevConfigSchema: z.ZodObject<{ rootPath: z.ZodDefault<z.ZodString>; cacheAPI: z.ZodDefault<z.ZodBoolean>; outboundService: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"fetcher">; handler: z.ZodCustom<(request: Request_2, miniflare: Miniflare) => Awaitable<Response_2>, (request: Request_2, miniflare: Miniflare) => Awaitable<Response_2>>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"node-handler">; handler: z.ZodCustom<(req: http.IncomingMessage, res: http.ServerResponse, miniflare: Miniflare) => Awaitable<void>, (req: http.IncomingMessage, res: http.ServerResponse, miniflare: Miniflare) => Awaitable<void>>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"worker">; workerName: z.ZodString; exportName: z.ZodOptional<z.ZodString>; props: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; remote: z.ZodOptional<z.ZodBoolean>; }, z.core.$strict>], "type">>; remoteProxyConnectionString: z.ZodOptional<z.ZodCustom<RemoteProxyConnectionString, RemoteProxyConnectionString>>; unsafeInspectorProxy: z.ZodOptional<z.ZodBoolean>; unsafeDirectSockets: z.ZodOptional<z.ZodArray<z.ZodObject<{ host: z.ZodOptional<z.ZodString>; port: z.ZodOptional<z.ZodNumber>; serviceName: z.ZodOptional<z.ZodString>; entrypoint: z.ZodOptional<z.ZodString>; proxy: z.ZodOptional<z.ZodBoolean>; }, z.core.$strict>>>; unsafeOverrideFetchWorker: z.ZodOptional<z.ZodString>; unsafeEvalBinding: z.ZodOptional<z.ZodString>; useModuleFallbackService: z.ZodOptional<z.ZodBoolean>; unsafeRegisterWorker: z.ZodDefault<z.ZodBoolean>; hasAssetsAndIsVitest: z.ZodOptional<z.ZodBoolean>; unsafeEphemeralDurableObjects: z.ZodOptional<z.ZodBoolean>; stripCfConnectingIp: z.ZodDefault<z.ZodBoolean>; zone: z.ZodOptional<z.ZodString>; }, z.core.$strict>; export declare interface DiskDirectory { path?: string; writable?: boolean; allowDotfiles?: boolean; } export declare const DISPATCH_NAMESPACE_PLUGIN: Plugin; export declare const DISPATCH_NAMESPACE_PLUGIN_NAME = "dispatch-namespace"; export declare type DispatchFetch = (input: RequestInfo_2, init?: RequestInit_2<Partial<IncomingRequestCfProperties_2>>) => Promise<Response_2>; /** * Dispatcher created for each `dispatchFetch()` call. Ensures request origin * in Worker matches that passed to `dispatchFetch()`, not the address the * `workerd` server is listening on. Handles cases where `fetch()` redirects to * same origin and different external origins. */ export declare class DispatchFetchDispatcher extends undici.Dispatcher { private readonly globalDispatcher; private readonly runtimeDispatcher; private readonly actualRuntimeOrigin; private readonly userRuntimeOrigin; private readonly cfBlobJson?; /** * @param globalDispatcher Dispatcher to use for all non-runtime requests * (rejects unauthorised certificates) * @param runtimeDispatcher Dispatcher to use for runtime requests * (permits unauthorised certificates) * @param actualRuntimeOrigin Origin to send all runtime requests to * @param userRuntimeOrigin Origin to treat as runtime request * (initial URL passed by user to `dispatchFetch()`) * @param cfBlob `request.cf` blob override for runtime requests */ constructor(globalDispatcher: undici.Dispatcher, runtimeDispatcher: undici.Dispatcher, actualRuntimeOrigin: string, userRuntimeOrigin: string, cfBlob?: IncomingRequestCfProperties_2); addHeaders(headers: undici.Headers, path: string): void; dispatch(options: undici.Dispatcher.DispatchOptions, handler: undici.Dispatcher.DispatchHandler): boolean; close(): Promise<void>; close(callback: () => void): void; destroy(): Promise<void>; destroy(err: Error | null): Promise<void>; destroy(callback: () => void): void; destroy(err: Error | null, callback: () => void): void; get isMockActive(): boolean; } export declare type DOContainerOptions = z.infer<typeof DOContainerOptionsSchema>; export declare const DOContainerOptionsSchema: z.ZodObject<{ imageName: z.ZodString; }, z.core.$strip>; export declare const DURABLE_OBJECTS_PLUGIN: Plugin; export declare const DURABLE_OBJECTS_PLUGIN_NAME = "do"; export declare const DURABLE_OBJECTS_STORAGE_SERVICE_NAME = "do:storage"; export declare type DurableObjectClassNames = Map<string, Map<string, { enableSql?: boolean; unsafeUniqueKey?: UnsafeUniqueKey; unsafePreventEviction?: boolean; container?: DOContainerOptions; }>>; export declare type DurableObjectEvictionOptions = DurableObjectIdentifier & { webSockets?: "close" | "hibernate"; }; export declare type DurableObjectIdentifier = { name: string; id?: never; } | { id: string; name?: never; }; export declare type DurableObjectStorageHandle = { exec<Row extends Record<string, SqlStorageValue_2> = Record<string, SqlStorageValue_2>>(...args: Parameters<SqlStorage_2["exec"]>): Promise<Row[]>; }; export declare type DurableObjectStorageOptions = DurableObjectIdentifier; export declare const EMAIL_PLUGIN: Plugin; export declare const EMAIL_PLUGIN_NAME = "email"; /* Excluded from this release type: _enableControlEndpoints */ export declare function encodeSitesKey(key: string): string; declare class ErrorEvent_2 extends Event { readonly error: Error | null; constructor(type: "error", init?: { error?: Error; }); } export { ErrorEvent_2 as ErrorEvent } export declare interface Extension { modules?: Extension_Module[]; } export declare interface Extension_Module { name?: string; internal?: boolean; esModule?: string; } export declare type ExternalServer = { address?: string; } & ({ http: HttpOptions; } | { https: ExternalServer_Https; } | { tcp: ExternalServer_Tcp; }); export declare interface ExternalServer_Https { options?: HttpOptions; tlsOptions?: TlsOptions_2; certificateHost?: string; } export declare interface ExternalServer_Tcp { tlsOptions?: TlsOptions_2; certificateHost?: string; } export declare function extractObjectEntryId(propsJson: string | undefined): string | undefined; declare function fetch_2(input: RequestInfo_2, init?: RequestInit_2 | Request_2): Promise<Response_2>; export { fetch_2 as fetch } export declare const FLAGSHIP_PLUGIN: Plugin; export declare const FLAGSHIP_PLUGIN_NAME = "flagship"; /** * Format an error into a string, including the error cause if available. * * @example * ``` * Error: Something went wrong * at Object.<anonymous> (/path/to/file.js:10:15) * Caused by: Error: Another error * at Object.<anonymous> (/path/to/another-file.js:5:10) * ``` */ export declare function formatError(error: Error): string; export { FormData_2 as FormData } export declare function getAccessibleHosts(ipv4Only?: boolean): string[]; export declare function getAssetsBindingsNames(assetsKVBindingName?: string, assetsManifestBindingName?: string): { readonly ASSETS_KV_NAMESPACE: string; readonly ASSETS_MANIFEST: string; }; export declare function getCacheServiceName(workerIndex: number): string; /** * Get the default path for the dev registry. * This is used by both Wrangler and the Vite plugin to ensure they use the same path. */ export declare function getDefaultDevRegistryPath(): string; export declare function getDirectSocketName(workerIndex: number, entrypoint: string): string; export declare function getDurableObjectUniqueKey(className: string, workerName: string | undefined, unsafeUniqueKey: UnsafeUniqueKey | undefined): string | undefined; export declare function getEmailPathsToClean(resourceTmpPath: string | undefined, tmpPath: string): { sessionDir: string; parentDir: string; } | undefined; export declare function getEntrySocketHttpOptions(coreOpts: ParsedInstanceOptions): Promise<{ http: HttpOptions; } | { https: Socket_Https; }>; /** * Returns the entries of `config.env` whose binding `type` matches `type`, * typed as the matching binding variant. The record key is the binding name. */ export declare function getEnvBindingsOfType<T extends string>(config: ParsedMiniflareWorkerConfig, type: T): [name: string, binding: Extract<MiniflareBinding, { type: T; }>][]; /** * Returns the entries of `config.exports` whose `type` matches `type`. The * record key is the export name. */ export declare function getExportsOfType<T extends string>(config: ParsedMiniflareWorkerConfig, type: T): [name: string, exported: Extract<MiniflareExport, { type: T; }>][]; export declare function getFreshSourceMapSupport(): cspotcodeSourceMapSupport; export declare function getGlobalServices({ sharedOptions, allWorkerRoutes, fallbackWorkerName, tmpPath, log, proxyBindings, durableObjectClassNames, allWorkerOpts, }: GlobalServicesOptions): Service_2[]; /** * Normalizes a hostname for use in a client-reachable URL. * * - Maps wildcard/listen-all addresses to `127.0.0.1`. * - Brackets IPv6 addresses (e.g. `::1` -> `[::1]`, `fe80::1` -> `[fe80::1]`). * - Leaves hostnames and IPv4 addresses unchanged. */ export declare function getLocallyAccessibleHost(host: string): string; export declare function getMiniflareObjectBindings(): Worker_Binding[]; /** * Computes the Node.js compatibility mode we are running. * * The `nodejs_compat`/`nodejs_compat_v2` resolution itself is shared with the * rest of the tooling, in `resolveNodejsCompat()`. * * @param compatibilityDate The compatibility date * @param compatibilityFlags The compatibility flags * @returns the mode and flags to indicate specific configuration for validating. */ export declare function getNodeCompat(compatibilityDate: string | undefined, // Default to some arbitrary old date compatibilityFlags: string[]): { mode: NodeJSCompatMode; isNodejsCompatEnabled: boolean; isNodejsCompatV2Enabled: boolean; hasNodejsAlsFlag: boolean; hasNodejsCompatFlag: boolean; hasNoNodejsCompatFlag: boolean; hasNodejsCompatV2Flag: boolean; hasNoNodejsCompatV2Flag: boolean; hasExperimentalNodejsCompatV2Flag: boolean; }; export declare function getPersistPath(pluginName: string, tmpPath: string, resourcePersistencePath: string | undefined): string; export declare function getQueueServiceName(queueId: string): string; export declare function getR2PublicService(allWorkerOpts: ParsedWorkerOptions[]): Service_2 | undefined; export declare function getR2S3Service(allWorkerOpts: ParsedWorkerOptions[]): Service_2 | undefined; /** * Resolves the remote proxy connection string for a binding. A binding is * proxied remotely iff `binding.remote === true` _and_ * `dev.remoteProxyConnectionString` is set (mirroring wrangler's model). */ export declare function getRemoteProxyConnectionString(binding: { remote?: boolean; }, dev: ParsedDevConfig | undefined): RemoteProxyConnectionString | undefined; /** * Returns the entries of `config.triggers` whose `type` matches `type`. */ export declare function getTriggersOfType<T extends string>(config: ParsedMiniflareWorkerConfig, type: T): Extract<MiniflareTrigger, { type: T; }>[]; /** * Utility to get the name for a service implementing a user binding * * @param scope Scope of the service (this usually is the plugin name) * @param identifier Identifier to use for the service * @param remoteProxyConnectionString Optional remote proxy connection string (in case the service connects to a remote resource) * @returns the name for the service */ export declare function getUserBindingServiceName(scope: string, identifier: string, remoteProxyConnectionString?: RemoteProxyConnectionString): string; /** * Read the worker registry from the specified path. * * Skips stale workers that haven't sent a heartbeat in over 5 minutes, * and removes their files from disk. */ export declare function getWorkerRegistry(registryPath: string): WorkerRegistry; export declare interface GlobalServicesOptions { sharedOptions: ParsedInstanceOptions; allWorkerRoutes: Map<string, string[]>; fallbackWorkerName: string | undefined; tmpPath: string; log: Log; /** All user workerd-native bindings, used for Miniflare's magic proxy and the local explorer worker */ proxyBindings: Worker_Binding[]; /** Pass Durable Object configuration for the explorer worker (has more info than proxyBindings)*/ durableObjectClassNames: DurableObjectClassNames; /** All worker options for building per-worker resource bindings */ allWorkerOpts?: ParsedWorkerOptions[]; } export declare function globsToRegExps(globs?: string[], { endAnchor }?: { endAnchor?: boolean; }): MatcherRegExps; export declare const HEADER_QUEUE_NAME = "MF-Queue-Name"; export { Headers_2 as Headers } export { HeadersInit_2 as HeadersInit } export declare const HELLO_WORLD_PLUGIN: Plugin; export declare const HELLO_WORLD_PLUGIN_NAME = "hello-world"; export declare const HOST_CAPNP_CONNECT = "miniflare-unsafe-internal-capnp-connect"; export declare interface HttpOptions { style?: HttpOptions_Style; forwardedProtoHeader?: string; cfBlobHeader?: string; injectRequestHeaders?: HttpOptions_Header[]; injectResponseHeaders?: HttpOptions_Header[]; capnpConnectHost?: string; } export declare interface HttpOptions_Header { name?: string; value?: string; } export declare const HttpOptions_Style: { /** * Normal HTTP. The request line contains only the path, and the separate `Host` header * specifies the hostname. * */ readonly HOST: 0; /** * HTTP proxy protocol. The request line contains a full URL instead of a path. No `Host` * header is required. This is the protocol used by HTTP forward proxies. This allows you to * implement such a proxy as a Worker. * */ readonly PROXY: 1; }; export declare type HttpOptions_Style = (typeof HttpOptions_Style)[keyof typeof HttpOptions_Style]; export declare const HYPERDRIVE_PLUGIN: Plugin; export declare const HYPERDRIVE_PLUGIN_NAME = "hyperdrive"; export declare interface HyperdriveProxyConfig { name: string; targetHost: string; targetPort: string; scheme: string; sslmode: string; sslrootcert?: string; } /** * HyperdriveProxyController establishes TLS-enabled connections between workerd * and external Postgres/MySQL databases. Supports PostgreSQL sslmode options * ('require', 'prefer', 'disable', 'verify-full', 'verify-ca') by proxying * each Hyperdrive binding through a randomly assigned local port. */ export declare class HyperdriveProxyController { #private; log?: Log; /** * Creates a proxy server for a Hyperdrive binding. * * @param config - The configuration for the proxy server. * @returns A promise that resolves to the port number of the proxy server. */ createProxyServer(config: HyperdriveProxyConfig): Promise<number>; /** Disposes of the proxy servers when shutting down the worker.*/ dispose(): void; } export declare const HyperdriveSchema: z.ZodPipe<z.ZodUnion<readonly [z.ZodURL, z.ZodCustom<URL_2, URL_2>]>, z.ZodTransform<URL_2, string | URL_2>>; export declare const IMAGES_PLUGIN: Plugin; export declare const IMAGES_PLUGIN_NAME = "images"; export declare interface InclusiveRange { start: number; end: number; } /* Excluded from this release type: _initialiseInstanceRegistry */ export declare type InstanceOptions = z.input<typeof InstanceOptionsSchema>; export declare const InstanceOptionsSchema: z.ZodObject<{ host: z.ZodOptional<z.ZodString>; port: z.ZodOptional<z.ZodNumber>; https: z.ZodOptional<z.ZodBoolean>; httpsKey: z.ZodOptional<z.ZodString>; httpsCert: z.ZodOptional<z.ZodString>; inspectorPort: z.ZodOptional<z.ZodNumber>; inspectorHost: z.ZodOptional<z.ZodString>; verbose: z.ZodOptional<z.ZodBoolean>; log: z.ZodOptional<z.ZodCustom<Log, Log>>; handleStructuredLogs: z.ZodOptional<z.ZodCustom<(log: WorkerdStructuredLog) => void, (log: WorkerdStructuredLog) => void>>; handleUncaughtError: z.ZodOptional<z.ZodCustom<(error: Error) => void, (error: Error) => void>>; upstream: z.ZodOptional<z.ZodString>; cf: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>; logRequests: z.ZodDefault<z.ZodBoolean>; stripDisablePrettyError: z.ZodDefault<z.ZodBoolean>; resourcePersistencePath: z.ZodOptional<z.ZodString>; resourceTmpPath: z.ZodOptional<z.ZodString>; containerEngine: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{ localDocker: z.ZodObject<{ socketPath: z.ZodString; containerEgressInterceptorImage: z.ZodOptional<z.ZodString>; }, z.core.$strict>; }, z.core.$strict>]>>; telemetry: z.ZodDefault<z.ZodObject<{ enabled: z.ZodDefault<z.ZodBoolean>; deviceId: z.ZodOptional<z.ZodString>; }, z.core.$strict>>; publicUrl: z.ZodOptional<z.ZodURL>; unsafeDevRegistryPath: z.ZodOptional<z.ZodString>; unsafeHandleDevRegistryUpdate: z.ZodOptional<z.ZodCustom<(registry: WorkerRegistry) => void, (registry: WorkerRegistry) => void>>; unsafeHandleRuntimeRestart: z.ZodOptional<z.ZodCustom<() => Awaitable<void>, () => Awaitable<void>>>; unsafeProxySharedSecret: z.ZodOptional<z.ZodString>; unsafeModuleFallbackService: z.ZodOptional<z.ZodCustom<(request: Request_2, miniflare: Miniflare) => Awaitable<Response_2>, (request: Request_2, miniflare: Miniflare) => Awaitable<Response_2>>>; unsafeTriggerHandlers: z.ZodOptional<z.ZodBoolean>; unsafeRuntimeEnv: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; unsafeLocalExplorer: z.ZodOptional<z.ZodBoolean>; unsafeObservability: z.ZodOptional<z.ZodBoolean>; unsafeInspectDurableObjects: z.ZodOptional<z.ZodBoolean>; }, z.core.$strict>; /** * Used by the local explorer worker. * The method name injected into wrapped Durable Objects for SQLite introspection. */ export declare const INTROSPECT_SQLITE_METHOD = "__miniflare_introspectSqlite"; /* Excluded from this release type: _isCyclic */ export declare function isDurableObjectStub(targetName: string): targetName is "DurableObject" | "WorkerRpc"; export declare function isFetcherFetch(targetName: string, key: string): boolean; export declare const isFileNotFoundError: (e: unknown) => boolean; /** * See #createMediaProxy() comment for why this is special */ export declare function isImagesInput(targetName: string, key: string): boolean; export declare function isR2ObjectWriteHttpMetadata(targetName: string, key: string): boolean; export declare function isSitesRequest(request: { url: string; }): boolean; export declare type Json = Literal | { [key: string]: Json; } | Json[]; export declare interface JsonError { message?: string; name?: string; stack?: string; cause?: JsonError; } export declare const JsonSchema: z.ZodType<Json>; declare const kAccepted: unique symbol; declare const kCf: unique symbol; declare const kClose: unique symbol; declare const kClosedIncoming: unique symbol; declare const kClosedOutgoing: unique symbol; declare const kCoupled: unique symbol; export declare const kCurrentWorker: unique symbol; declare const kError: unique symbol; export declare type KeyTypes<T> = T extends Set<infer Keys> ? Keys : never; export declare const kInspectorSocket: unique symbol; export declare type KnownKeys<T> = { [K in keyof T as string extends K ? never : number extends K ? never : symbol extends K ? never : K]: T[K]; }; declare const kPair: unique symbol; declare const kSend: unique symbol; export declare const kUnsafeEphemeralUniqueKey: unique symbol; declare const kUnsafeEphemeralUniqueKey_2: unique symbol; export declare const KV_NAMESPACE_OBJECT_CLASS_NAME = "KVNamespaceObject"; export declare const KV_PLUGIN: Plugin; export declare const KV_PLUGIN_NAME = "kv"; export declare const KVHeaders: { readonly EXPIRATION: "CF-Expiration"; readonly METADATA: "CF-KV-Metadata"; }; export declare const KVLimits: { readonly MIN_CACHE_TTL_SECONDS: 30; readonly MIN_EXPIRATION_TTL_SECONDS: 60; readonly MAX_LIST_KEYS: 1000; readonly MAX_KEY_SIZE_BYTES: 512; readonly MAX_VALUE_SIZE_BYTES: number; readonly MAX_VALUE_SIZE_TEST_BYTES: 1024; readonly MAX_METADATA_SIZE_BYTES: 1024; readonly MAX_BULK_SIZE_BYTES: number; }; export declare const kVoid: unique symbol; export declare const KVParams: { readonly URL_ENCODED: "urlencoded"; readonly CACHE_TTL: "cache_ttl"; readonly EXPIRATION: "expiration"; readonly EXPIRATION_TTL: "expiration_ttl"; readonly LIST_LIMIT: "key_count_limit"; readonly LIST_PREFIX: "prefix"; readonly LIST_CURSOR: "cursor"; }; declare const kWebSocket: unique symbol; export declare function launchBrowser({ browserVersion, headful, log, tmpPath, }: { browserVersion: string; headful?: boolean; log: Log; tmpPath: string; }): Promise<{ sessionId: `${string}-${string}-${string}-${string}-${string}`; browserProcess: Process; startTime: number; wsEndpoint: string; }>; export declare type LegacyConfig = z.input<typeof LegacyConfigSchema>; export declare const LegacyConfigSchema: z.ZodObject<{ serviceWorkerScript: z.ZodOptional<z.ZodString>; serviceWorkerScriptPath: z.ZodOptional<z.ZodString>; wasmBindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>>>; textBlobBindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; dataBlobBindings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodCustom<Uint8Array<ArrayBuffer>, Uint8Array<ArrayBuffer>>]>>>; sitePath: z.ZodOptional<z.ZodString>; siteInclude: z.ZodOptional<z.ZodArray<z.ZodString>>; siteExclude: z.ZodOptional<z.ZodArray<z.ZodString>>; }, z.core.$strict>; export declare type LegacyWorkerOptions = KnownKeys<V4WorkerOptionsShape> & V4SourceOptions; export declare type Literal = z.infer<typeof LiteralSchema>; export declare const LiteralSchema: z.ZodUnion<readonly [z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodNull]>; /** * loadExternalPlugins will take a packageName, and attempt to load additional * external plugins to add to Miniflare's default ones */ export declare function loadExternalPlugins(packageName: string): Promise<Record<string, Plugin>>; export declare class Log { #private; readonly level: LogLevel; constructor(level?: LogLevel, opts?: LogOptions); protected log(message: string): void; static unstable_registerBeforeLogHook(callback: (() => void) | undefined): void; static unstable_registerAfterLogHook(callback: (() => void) | undefined): void; logWithLevel(level: LogLevel, message: string): void; logReady(message: string): void; error(message: Error): void; warn(message: string): void; info(message: string): void; debug(message: string): void; verbose(message: string): void; } export declare enum LogLevel { NONE = 0, ERROR = 1, WARN = 2, INFO = 3, DEBUG = 4, VERBOSE = 5 } export declare interface LogOptions { prefix?: string; suffix?: string; } export declare type ManifestEntry = { pathHash: Uint8Array; contentHash: Uint8Array; }; export declare interface MatcherRegExps { include: RegExp[]; exclude: RegExp[]; } export declare function matchRoutes(routes: WorkerRoute[], url: URL): string | null; export declare const MAX_BULK_GET_KEYS = 100; export declare function maybeApply<From, To>(f: (value: From) => To, maybeValue: From | undefined): To | undefined; export declare function maybeParseURL(url: string | undefined): URL | undefined; export declare const MEDIA_PLUGIN: Plugin; export declare const MEDIA_PLUGIN_NAME = "media"; /** * Merges all of `b`'s properties into `a`. Only merges 1 level deep, i.e. * `kvNamespaces` will be fully-merged, but `durableObject` object-designators * will be overwritten. */ export declare function mergeWorkerOptions(a: Partial<LegacyWorkerOptions>, b: Partial<LegacyWorkerOptions>): Partial<LegacyWorkerOptions>; declare class MessageEvent_2 extends Event { readonly data: string | ArrayBuffer | Uint8Array<ArrayBuffer>; constructor(type: "message", init: { data: string | ArrayBuffer | Uint8Array<ArrayBuffer>; }); } export { MessageEvent_2 as MessageEvent } export declare class Miniflare { #private; publicUrl?: string; constructor(opts: MiniflareOptions); get ready(): Promise<URL>; getCf(): Promise<Record<string, any>>; getInspectorURL(): Promise<URL>; unsafeGetDirectURL(workerName?: string, entrypoint?: string): Promise<URL>; setOptions(opts: MiniflareOptions): Promise<void>; dispatchFetch: DispatchFetch; /* Excluded from this release type: _getProxyClient */ getBindings<Env = Record<string, unknown>>(workerName?: string): Promise<Env>; getWorker(workerName?: string): Promise<ReplaceWorkersTypes<Fetcher_2>>; /** * Returns remote storage access for a Durable Object instance. * * Calling `exec()` runs SQL inside the target Durable Object and returns all * rows. It may start the object if it is not already active. */ unsafeGetDurableObjectStorage(scriptName: string, className: string, options: DurableObjectStorageOptions): Promise<DurableObjectStorageHandle>; getCaches(): Promise<ReplaceWorkersTypes<CacheStorage_2>>; /** * Purges all entries from the cache. * * This is useful during development when cached assets need to be cleared * without restarting the Miniflare instance. * * @param cacheName - Optional name of specific cache to purge. If not provided, * purges the default cache. * @returns A promise that resolves with the number of entries purged. */ purgeCache(cacheName?: string): Promise<number>; getD1Database(bindingName: string, workerName?: string): Promise<D1Database_2>; getDurableObjectNamespace(bindingName: string, workerName?: string): Promise<ReplaceWorkersTypes<DurableObjectNamespace_2>>; unsafeEvictDurableObject(scriptName: string, className: string, options: DurableObjectEvictionOptions): Promise<void>; listDurableObjectIds(classNameOrBindingName: string, workerName?: string): Promise<string[]>; getKVNamespace(bindingName: string, workerName?: string): Promise<ReplaceWorkersTypes<KVNamespace_2>>; getSecretsStoreSecretAPI(bindingName: string, workerName?: string): Promise<() => SecretsStoreSecretAdmin>; getSecretsStoreSecret(bindingName: string, workerName?: string): Promise<ReplaceWorkersTypes<KVNamespace_2>>; getQueueProducer<Body = unknown>(bindingName: string, workerName?: string): Promise<Queue_2<Body>>; getR2Bucket(bindingName: string, workerName?: string): Promise<ReplaceWorkersTypes<R2Bucket_2>>; getImagesBinding(bindingName: string, workerName?: string): Promise<ReplaceWorkersTypes<ImagesBinding_2>>; getHelloWorldBinding(bindingName: string, workerName?: string): Promise<{ get: () => Promise<{ value: string; ms?: number; }>; set: (value: string) => Promise<void>; }>; getFlagshipBinding(bindingName: string, workerName?: string): Promise<Flagship_2>; getStreamBinding(bindingName: string, workerName?: string): Promise<StreamBinding_2>; /* Excluded from this release type: _getInternalDurableObjectNamespace */ dispose(): Promise<void>; } /** A single parsed `config.env` binding (known, miniflare-extended, or unsafe). */ export declare type MiniflareBinding = z.output<typeof ParsedMiniflareKnownBindingSchema> | z.output<typeof UnsafeBindingSchema>; export declare class MiniflareCoreError extends MiniflareError<MiniflareCoreErrorCode> { } export declare type MiniflareCoreErrorCode = KeyTypes<typeof USER_ERROR_CODES> | KeyTypes<typeof SYSTEM_ERROR_CODES>; /** A parsed binding to workerd's builtin `disk` service. */ export declare type MiniflareDiskServiceBinding = Extract<MiniflareBinding, { type: "disk"; }>; /** * Extends live DO exports with miniflare-internal fields: * - `unsafeUniqueKey` — custom unique key for DO namespace identity * - `unsafePreventEviction` — prevents the DO from being evicted * - `container` — container config for container-attached DOs */ export declare const MiniflareDurableObjectExportSchema: z.ZodObject<{ type: z.ZodLiteral<"durable-object">; state: z.ZodOptional<z.ZodLiteral<"created">>; storage: z.ZodEnum<{ sqlite: "sqlite"; "legacy-kv": "legacy-kv"; }>; unsafeUniqueKey: z.ZodOptional<z.ZodCustom<UnsafeUniqueKey, UnsafeUniqueKey>>; unsafePreventEviction: z.ZodOptional<z.ZodBoolean>; container: z.ZodOptional<z.ZodCustom<{ imageName: string; }, { imageName: string; }>>; }, z.core.$strict>; export declare class MiniflareError<Code extends string = string> extends Error { readonly code: Code; readonly cause?: Error | undefined; constructor(code: Code, message?: string, cause?: Error | undefined); isUserError(): boolean; isSystemError(): boolean; } /** A single parsed `config.exports` entry. */ export declare type MiniflareExport = NonNullable<ParsedMiniflareWorkerConfig["exports"]>[string]; /** A parsed binding to workerd's builtin `external` service. */ export declare type MiniflareExternalServiceBinding = Extract<MiniflareBinding, { type: "external"; }>; /** A parsed function-backed `fetcher` service binding. */ export declare type MiniflareFetcherBinding = Extract<MiniflareBinding, { type: "fetcher"; }>; /** A parsed binding to workerd's builtin `network` service. */ export declare type MiniflareNetworkServiceBinding = Extract<MiniflareBinding, { type: "network"; }>; /** A parsed Node.js http-style `node-handler` service binding. */ export declare type MiniflareNodeHandlerBinding = Extract<MiniflareBinding, { type: "node-handler"; }>; export declare type MiniflareOptions = z.input<typeof MiniflareOptionsSchema>; export declare const MiniflareOptionsSchema: z.ZodObject<{ host: z.ZodOptional<z.ZodString>; port: z.ZodOptional<z.ZodNumber>; https: z.ZodOptional<z.ZodBoolean>; httpsKey: z.ZodOptional<z.ZodString>; httpsCert: z.ZodOptional<z.ZodString>; inspectorPort: z.ZodOptional<z.ZodNumber>; inspectorHost: z.ZodOptional<z.ZodString>; verbose: z.ZodOptional<z.ZodBoolean>; log: z.ZodOptional<z.ZodCustom<Log, Log>>; handleStructuredLogs: z.ZodOptional<z.ZodCustom<(log: WorkerdStructuredLog) => void, (log: WorkerdStructuredLog) => void>>; handleUncaughtError: z.ZodOptional<z.ZodCustom<(error: Error) => void, (error: Error) => void>>; upstream: z.ZodOptional<z.ZodString>; cf: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString, z.ZodRecord<z.ZodString, z.ZodAny>]>>; logRequests: z.ZodDefault<z.ZodBoolean>; stripDisablePrettyError: z.ZodDefault<z.ZodBoolean>; resourcePersistencePath: z.ZodOptional<z.ZodString>; resourceTmpPath: z.ZodOptional<z.ZodString>; containerEngine: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{ localDocker: z.ZodObject<{ socketPath: z.ZodString; containerEgressInterceptorImage: z.ZodOptional<z.ZodString>; }, z.core.$strict>; }, z.core.$strict>]>>; telemetry: z.ZodDefault<z.ZodObject<{ enabled: z.ZodDefault<z.ZodBoolean>; deviceId: z.ZodOptional<z.ZodString>; }, z.core.$strict>>; publicUrl: z.ZodOptional<z.ZodURL>; unsafeDevRegistryPath: z.ZodOptional<z.ZodString>; unsafeHandleDevRegistryUpdate: z.ZodOptional<z.ZodCustom<(registry: WorkerRegistry) => void, (registry: WorkerRegistry) => void>>; unsafeHandleRuntimeRestart: z.ZodOptional<z.ZodCustom<() => Awaitable<void>, () => Awaitable<void>>>; unsafeProxySharedSecret: z.ZodOptional<z.ZodString>; unsafeModuleFallbackService: z.ZodOptional<z.ZodCustom<(request: Request_2, miniflare: Miniflare) => Awaitable<Response_2>, (request: Request_2, miniflare: Miniflare) => Awaitable<Response_2>>>; unsafeTriggerHandlers: z.ZodOptional<z.ZodBoolean>; unsafeRuntimeEnv: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>; unsafeLocalExplorer: z.ZodOptional<z.ZodBoolean>; unsafeObservability: z.ZodOptional<z.ZodBoolean>; unsafeInspectDurableObjects: z.ZodOptional<z.ZodBoolean>; workers: z.ZodArray<z.ZodObject<{ config: z.ZodPipe<z.ZodObject<{ name: z.ZodString; type: z.ZodLiteral<"worker">; cache: z.ZodOptional<z.ZodObject<{ enabled: z.ZodBoolean; crossVersionCache: z.ZodOptional<z.ZodBoolean>; }, z.core.$strict>>; compatibilityDate: z.ZodString; compatibilityFlags: z.ZodOptional<z.ZodArray<z.ZodString>>; domains: z.ZodOptional<z.ZodArray<z.ZodString>>; triggers: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{ type: z.ZodLiteral<"email">; addresses: z.ZodArray<z.ZodString>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"fetch">; pattern: z.ZodString; zone: z.ZodOptional<z.ZodString>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"queue">; name: z.ZodString; deadLetterQueue: z.ZodOptional<z.ZodString>; maxBatchSize: z.ZodOptional<z.ZodNumber>; maxBatchTimeout: z.ZodOptional<z.ZodNumber>; maxConcurrency: z.ZodOptional<z.ZodNullable<z.ZodNumber>>; maxRetries: z.ZodOptional<z.ZodNumber>; retryDelay: z.ZodOptional<z.ZodNumber>; visibilityTimeoutMs: z.ZodOptional<z.ZodNumber>; }, z.core.$strict>, z.ZodObject<{ type: z.ZodLiteral<"scheduled">; schedule: z.ZodString; }, z.core.$strict>], "type">>>; placement: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{ mode: z.ZodEnum<{ off: "off"; smart: "smart"; }>; hint: z.ZodOptional<z.ZodString>; }, z.core.$strict>, z.ZodObject<{ mode: z.ZodOptional<z.ZodLiteral<"targeted">>; region: z.ZodString; }, z.core.$strict>, z.ZodObject<{ mode: z.ZodOptional<z.ZodLiteral<"targeted">>; host: z.ZodString; }, z.core.$strict>,