import type { CommandFactory, FormFactory, PrerenderFactory, QueryFactory, ServerRuntimeFactory } from "./server/types.js"; import type { ErrorEffectFactory, RedirectEffectFactory } from "./server/control-flow.js"; import type { RequestEvent as RequestEventShape } from "./server/runtime.js"; import type { Context, Layer, ManagedRuntime } from "effect"; export { DefineEnvVars } from "./environment.js"; export type { EnvironmentDefinition, EnvironmentSchema, EnvironmentSchemaOutput, EnvironmentVariable, EnvironmentVariables, } from "./environment.js"; /** * Public API surface for `svelte-effect-runtime`. * * Call {@link ClientRuntime.make} in `hooks.client.ts`, call * {@link ServerRuntime.make} in `hooks.server.ts`, and let the Vite plugin * route server-only helpers to the server entrypoint automatically. * * @module */ /** * Client-side runtime singleton. Call `ClientRuntime.make(layer?)` once * in `hooks.client.ts` to provide services to every component's effect * blocks. * * If never called, a default empty-layer runtime is created lazily on * the first `yield*` expression. * * @example * ```ts * import { ClientRuntime } from "svelte-effect-runtime"; * import { Db } from "./db.js"; * * ClientRuntime.make(Db.Live); * ``` * * @since 2.0.0 */ export declare class ClientRuntime { /** * Build and cache the client-side dispatcher runtime. * * @since 2.0.0 * @param layer - Optional Effect layer to provide to the runtime. */ static make(layer?: Layer.Layer): void; } /** * Server-side runtime singleton export. In SvelteKit server files the Vite * plugin rewrites root imports to `svelte-effect-runtime/server`, so this * name resolves to the real server implementation before it is evaluated. * * @example * ```ts * import { ServerRuntime } from "svelte-effect-runtime"; * * ServerRuntime.make(); * ``` * * @since 2.0.0 */ export declare const ServerRuntime: ServerRuntimeFactory; /** * Remote query factory export for `.remote.ts` files imported from the root * entrypoint. The Vite plugin rewrites it to the real server implementation. * * @example * ```ts * import { Query } from "svelte-effect-runtime"; * * export const GetPosts = Query(Effect.succeed([])); * ``` * * @since 2.0.0 */ export declare const Query: QueryFactory; /** * Remote command factory export for `.remote.ts` files imported from the root * entrypoint. The Vite plugin rewrites it to the real server implementation. * * @example * ```ts * import { Command } from "svelte-effect-runtime"; * * export const SavePost = Command(Schema.String, (id) => Effect.succeed(id)); * ``` * * @since 2.0.0 */ export declare const Command: CommandFactory; /** * SvelteKit HTTP error control-flow export for `.remote.ts` files imported * from the root entrypoint. The Vite plugin rewrites it to the real server * implementation. * * @example * ```ts * import { Error } from "svelte-effect-runtime"; * * return yield* Error("NotFound", "Post not found"); * ``` * * @since 2.3.0 */ export declare const Error: ErrorEffectFactory; /** * Remote form factory export for `.remote.ts` files imported from the root * entrypoint. The Vite plugin rewrites it to the real server implementation. * * @example * ```ts * import { Form } from "svelte-effect-runtime"; * * export const CreatePost = Form(PostInput, ({ data }) => Effect.succeed(data)); * ``` * * @since 2.0.0 */ export declare const Form: FormFactory; /** * Remote prerender factory export for `.remote.ts` files imported from the * root entrypoint. The Vite plugin rewrites it to the real server * implementation. * * @example * ```ts * import { Prerender } from "svelte-effect-runtime"; * * export const GetBuildInfo = Prerender(() => Effect.succeed("ready")); * ``` * * @since 2.0.0 */ export declare const Prerender: PrerenderFactory; export { Live } from "./live.js"; /** * SvelteKit redirect control-flow export for `.remote.ts` files imported from * the root entrypoint. The Vite plugin rewrites it to the real server * implementation. * * @example * ```ts * import { Redirect } from "svelte-effect-runtime"; * * return yield* Redirect("SeeOther", "/posts"); * ``` * * @since 2.3.0 */ export declare const Redirect: RedirectEffectFactory; /** * Current SvelteKit request event service export for `.remote.ts` files * imported from the root entrypoint. The Vite plugin rewrites it to the real * server implementation. * * @example * ```ts * import { RequestEvent } from "svelte-effect-runtime"; * * const event = yield* RequestEvent; * ``` * * @since 2.0.0 */ export declare const RequestEvent: Context.Reference; /** * Returns the active server runtime when imported from a server file. The Vite * plugin rewrites root imports to the real server implementation. * * @example * ```ts * import { get_server_runtime_or_throw } from "svelte-effect-runtime"; * * const runtime = get_server_runtime_or_throw(); * ``` * * @since 2.0.0 */ export declare const get_server_runtime_or_throw: () => ManagedRuntime.ManagedRuntime; export type { FormError, FormIssue, RemoteFailure, RemoteHttpError, RemoteTransportError, RemoteValidationError, } from "./remote/shared.js"; export { AsyncEffectInEventCallbackError, AsyncEffectInSyncRuneError, AwaitInEffectWorkError, BatchQueryHandlerMissingError, DispatcherDisposedError, EmptyStreamYieldError, ScopeDisposedError, InvalidCommandFactoryError, InvalidLiveQueryFactoryError, InvalidLiveQueryReturnError, InvalidPrerenderFactoryError, InvalidQueryFactoryError, InvalidRemoteFormResponseError, InvalidYieldableError, PreprocessError, RemoteErrorDecodeError, RemoteFormEndpointMissingError, RemoteHelperContextError, RemoteHelperError, RequestEventUnavailableError, RuntimeAlreadyInitializedError, RuntimeError, ServerOnlyImportError, SvelteKitServerExportUnavailableError, UncheckedCommandHandlerMissingError, UncheckedFormHandlerMissingError, UncheckedLiveQueryHandlerMissingError, UncheckedPrerenderHandlerMissingError, UncheckedQueryHandlerMissingError, UnsupportedMarkupEffectPositionError, UnsupportedRemoteFormResponseError, YieldStarInEventCallbackError, } from "./errors.js"; export { is_form_error, is_remote_http_error, is_remote_transport_error, is_remote_validation_error, } from "./remote/shared.js"; export { effect, type EffectOptions } from "./compiler.js"; export type { ErrorBody, ErrorEffectFactory, ErrorProperties, ErrorStatus, ErrorStatusName, RedirectEffectFactory, RedirectOptions, RedirectStatus, RedirectStatusName, } from "./server/control-flow.js"; export type { LiveFactory, LiveStatus, RemoteLiveStream } from "./live.js"; export type { CommandFactory, EffectLike, EffectRemoteBatchHandler, EffectRemoteCommand, EffectRemoteCommandCall, EffectRemoteForm, EffectRemoteFunction, EffectRemoteLiveQuery, EffectRemoteLiveQueryFunction, EffectRemotePrerender, EffectRemotePrerenderFunction, EffectRemoteQuery, EffectRemoteQueryFunction, FormFactory, FormInvalid, PrerenderFactory, PrerenderInputs, PrerenderOptions, QueryBatchFactory, QueryFactory, QueryLiveFactory, RemoteFormHandler, RemoteHandler, RemoteLiveHandler, RemoteLiveSource, SchemaEncodedInput, SchemaInput, ServerRuntimeFactory, StandardSchema, StandardSchemaInput, StandardSchemaOutput, } from "./server/types.js";