import type { z } from 'zod'; export type AdapterConfigResult = { _tag: 'Ok'; config: TConfig; } | { _tag: 'Err'; issues: string[]; }; export type BroadcastFn = (config: T, version: string) => Promise; export type SubscribeFn = (config: T, onMessage: (msg: { version: string; }) => void) => () => void; /** * A realtime provider for `updateStrategy`. It lives in nuxt.config, so every * field must survive Nuxt's deep clone of the config: plain data and functions, * never class instances. */ export interface SkewAdapter = Record> { name: string; config: TConfig; /** Validate `config` at build time. */ parseConfig: (config: unknown) => AdapterConfigResult; /** The part of `config` that ships to the browser. Never include secrets. */ toPublicConfig: (config: TConfig) => TPublicConfig; /** * Module the client bundles: an absolute path, an alias such as `~/`, or a * package specifier. It must export `subscribe` (see `defineWebSubscribe`). */ web: string; /** Packages the build requires before it bundles `web`. */ dependencies: string[]; /** Runs on the build machine after a production build, with the new build id. */ broadcast: BroadcastFn; } export type SkewAdapterFactory = Record> = (config: TConfig) => SkewAdapter; export interface DefineAdapterOptions> { name: string; schema: z.ZodType; toPublicConfig: (config: TConfig) => TPublicConfig; web: string; dependencies?: string[]; broadcast: BroadcastFn; } export declare function defineAdapter>(options: DefineAdapterOptions): SkewAdapterFactory; export declare const defineNodeBroadcast: (broadcast: BroadcastFn) => BroadcastFn; export declare const defineWebSubscribe: (subscribe: SubscribeFn) => SubscribeFn;