import type { RemoteForm, RemoteFormInput, RemoteQueryUpdate } from "@sveltejs/kit"; import type { RemoteFailure } from "../shared.js"; import type { Effect, Schema, Stream } from "effect"; import type { RemoteLiveStream } from "../../live.js"; /** Runtime brand used to distinguish query-update callbacks. */ export declare const effect_remote_query_update: unique symbol; export type EffectRemoteQueryUpdateBrand = { readonly [effect_remote_query_update]: true; }; type EffectRemoteFormCallable = [ Input ] extends [void] ? () => Effect.Effect> : undefined extends Input ? (input?: Input) => Effect.Effect> : (input: Input) => Effect.Effect>; type NativeRemoteFormPreflightSchema = Parameters["preflight"]>[0]; type NativeRemoteFormValidateOptions = NonNullable["validate"]>[0]>; export type EffectRemoteFormPreflightSchema = NativeRemoteFormPreflightSchema | Schema.Codec; export type EffectRemoteFormValidateOptions = Omit, "all" | "includeUntouched" | "preflightOnly"> & { readonly all?: boolean; readonly includeUntouched?: boolean; readonly preflightOnly?: boolean; }; type EffectRemoteQueryUpdate = NativeRemoteQueryUpdate | EffectRemoteQueryUpdateFunction | EffectRemoteQueryUpdateResource | EffectRemoteLiveQueryUpdateFunction; type EffectRemoteCommandUpdate = { readonly pending: number; }; type EffectRemoteQueryUpdateInput = Update extends EffectRemoteCommandUpdate ? never : Update extends RemoteLiveStream ? Update : Update extends EffectRemoteQueryUpdate ? Update : never; type EffectRemoteQueryUpdates = Updates & { [Index in keyof Updates]: EffectRemoteQueryUpdateInput; }; type NativeRemoteQueryUpdate = RemoteQueryUpdate; type EffectRemoteQueryUpdateFunction = (input: never) => EffectRemoteQueryUpdateResource; type EffectRemoteLiveQueryUpdateFunction = (input: never) => Stream.Stream; type EffectRemoteQueryUpdateResource = EffectRemoteQueryUpdateBrand & Effect.Effect; export interface Pending { value: number; } export type NativeMethod = (...args: unknown[]) => unknown; export type NativeFormRecord = Record; export type EffectRemoteCommandCall = Effect.Effect> & { updates: (...updates: EffectRemoteQueryUpdates) => Effect.Effect>; }; export type EffectRemoteFormSubmit = Effect.Effect> & { updates: (...updates: EffectRemoteQueryUpdates) => Effect.Effect>; }; export type EffectRemoteFormEnhanceOptions = Omit["enhance"]>[0] extends (options: infer Options) => unknown ? Options : never, "submit"> & { submit: () => EffectRemoteFormSubmit; }; export type EffectRemoteForm = EffectRemoteFormCallable & Omit, "enhance" | "for" | "preflight" | "submit" | "validate"> & { enhance(callback?: (options: EffectRemoteFormEnhanceOptions) => void | Promise | Effect.Effect): ReturnType["enhance"]>; for(id: Parameters["for"]>[0]): EffectRemoteFormCallable & Omit, "for">; preflight(schema: EffectRemoteFormPreflightSchema): EffectRemoteForm; submit: EffectRemoteFormCallable; validate(options?: EffectRemoteFormValidateOptions): Effect.Effect>; }; export {};