svelte-effect-runtime 3.4.7 → 3.4.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.dist/chunks/{client-CsVu54pU.js → client-D_DE2cFa.js} +11 -42
- package/.dist/chunks/{client-CsVu54pU.js.map → client-D_DE2cFa.js.map} +1 -1
- package/.dist/chunks/{dispatcher-pHH4JcFR.js → dispatcher-BdvO4AAS.js} +2 -2
- package/.dist/chunks/{dispatcher-pHH4JcFR.js.map → dispatcher-BdvO4AAS.js.map} +1 -1
- package/.dist/chunks/{dispatcher-LtvFKYUp.js → dispatcher-NpL5xhWF.js} +3 -3
- package/.dist/chunks/{dispatcher-LtvFKYUp.js.map → dispatcher-NpL5xhWF.js.map} +1 -1
- package/.dist/chunks/{errors-Dcf0MVbq.js → errors-Bl3NVEez.js} +21 -3
- package/.dist/chunks/{errors-Dcf0MVbq.js.map → errors-Bl3NVEez.js.map} +1 -1
- package/.dist/chunks/live-DEmS7qpO.js +103 -0
- package/.dist/chunks/live-DEmS7qpO.js.map +1 -0
- package/.dist/chunks/{runtime-ekkMQ-wL.js → runtime-BNNW2GDT.js} +3 -3
- package/.dist/chunks/{runtime-ekkMQ-wL.js.map → runtime-BNNW2GDT.js.map} +1 -1
- package/.dist/chunks/{transform-CEK6Ccll.js → transform-C2fCVPL_.js} +172 -105
- package/.dist/chunks/transform-C2fCVPL_.js.map +1 -0
- package/.dist/dispatcher.js +1 -1
- package/.dist/errors.d.ts +15 -0
- package/.dist/generators.d.ts +3 -1
- package/.dist/internal/generators.js +20 -3
- package/.dist/internal/generators.js.map +1 -0
- package/.dist/internal/remote-client.js +1 -1
- package/.dist/live.d.ts +100 -0
- package/.dist/markup/promise.js +1 -1
- package/.dist/markup/run.js +1 -1
- package/.dist/markup/transform/constants.d.ts +1 -0
- package/.dist/markup/transform/types.d.ts +1 -0
- package/.dist/markup/transform.js +1 -1
- package/.dist/markup/value.js +1 -1
- package/.dist/mod.d.ts +5 -2
- package/.dist/mod.js +4 -3
- package/.dist/mod.js.map +1 -1
- package/.dist/remote/client/query.d.ts +6 -16
- package/.dist/remote/client/types.d.ts +2 -11
- package/.dist/remote/client.js +1 -1
- package/.dist/remote/server.js +1 -1
- package/.dist/runtime/transform.js +57 -26
- package/.dist/runtime/transform.js.map +1 -1
- package/.dist/script-transform/imports.d.ts +2 -0
- package/.dist/script-transform/types.d.ts +8 -0
- package/.dist/server/effects.d.ts +7 -7
- package/.dist/server/index.d.ts +3 -1
- package/.dist/server/types.d.ts +25 -50
- package/.dist/server/wrappers.d.ts +2 -2
- package/.dist/server.d.ts +2 -2
- package/.dist/server.js +40 -65
- package/.dist/server.js.map +1 -1
- package/.dist/yieldable.d.ts +41 -0
- package/package.json +1 -1
- package/.dist/chunks/transform-CEK6Ccll.js.map +0 -1
package/.dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":["svelte_invalid","get_native_request_event","get_native_request_event","native_query","native_command","native_form","native_prerender","Error","error","svelte_error","redirect","svelte_redirect"],"sources":["../../modules/svelte-effect-runtime/src/server/schema.ts","../../modules/svelte-effect-runtime/src/server/effects.ts","../../modules/svelte-effect-runtime/src/server/invalid.ts","../../modules/svelte-effect-runtime/src/server/wrappers.ts","../../modules/svelte-effect-runtime/src/server/factories.ts","../../modules/svelte-effect-runtime/src/server/control-flow.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport type { RemoteHandler, StandardSchema } from \"./types.ts\";\n\n/**\n * Checks whether a value is the string sentinel for unchecked remotes.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is `\"unchecked\"`.\n */\nexport function is_unchecked(value: unknown): value is \"unchecked\" {\n\treturn value === \"unchecked\";\n}\n\n/**\n * Checks whether a value is a remote handler function.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is callable as a handler.\n */\nexport function is_handler(\n\tvalue: unknown,\n): value is RemoteHandler<unknown, unknown, unknown, unknown> {\n\treturn typeof value === \"function\";\n}\n\n/**\n * Checks whether a value implements the Standard Schema contract.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is a Standard Schema.\n */\nexport function is_standard_schema(value: unknown): value is StandardSchema {\n\treturn typeof value === \"object\" && value !== null && \"~standard\" in value;\n}\n\n/**\n * Checks whether a value looks like an Effect Schema.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value should be converted to Standard Schema.\n */\nexport function is_effect_schema(value: unknown): value is Schema.Schema<unknown> {\n\treturn typeof value === \"object\" && value !== null && \"ast\" in value && \"make\" in value;\n}\n\n/**\n * Converts Effect Schema inputs to Standard Schema for SvelteKit.\n *\n * @since 2.0.0\n * @param value - Schema or handler input.\n * @returns Original value or Standard Schema view of an Effect Schema.\n */\nexport function normalize_validator(value: unknown): unknown {\n\tif (is_standard_schema(value) || !is_effect_schema(value)) {\n\t\treturn value;\n\t}\n\n\treturn Schema.toStandardSchemaV1(value as never);\n}\n","import { run_remote_effect } from \"$/remote/server.ts\";\nimport { InvalidLiveQueryReturnError } from \"$/errors.ts\";\nimport { error as svelte_error, invalid as svelte_invalid } from \"@sveltejs/kit\";\nimport { Effect, Stream } from \"effect\";\n\nimport { get_server_runtime_or_throw, RequestEvent } from \"./runtime.ts\";\nimport type { RequestEvent as RequestEventShape } from \"./runtime.ts\";\nimport type { EffectLike, EffectRemoteLiveSource } from \"./types.ts\";\n\ntype ResolvedLiveSource<A> = AsyncIterable<A> | AsyncIterator<A> | Iterable<A> | Iterator<A>;\n\ntype LiveHandlerResult<A> =\n\t| EffectLike<EffectRemoteLiveSource<A>, unknown, unknown>\n\t| EffectRemoteLiveSource<A>;\n\n/**\n * Checks whether a value is an Effect generator return object.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value should be wrapped with `Effect.gen`.\n */\nexport function is_generator_result<A>(\n\tvalue: unknown,\n): value is Effect.gen.Return<A, unknown, unknown> {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\ttypeof (value as { next?: unknown }).next === \"function\"\n\t);\n}\n\n/**\n * Normalizes an Effect-like handler return value into an Effect.\n *\n * @since 2.0.0\n * @param value - Effect or generator return value.\n * @returns Normalized Effect.\n */\nexport function ToEffect<A, E, R>(value: EffectLike<A, E, R>): Effect.Effect<A, E, R> {\n\tif (is_generator_result<A>(value)) {\n\t\treturn Effect.gen(() => value) as Effect.Effect<A, E, R>;\n\t}\n\n\treturn value;\n}\n\n/**\n * Compatibility alias for {@link ToEffect}.\n *\n * @example\n * ```ts\n * const program = to_effect(Effect.succeed(1));\n * ```\n *\n * @since 2.0.0\n * @param value - Effect or generator return value.\n * @returns Normalized Effect.\n * @internal\n */\nexport const to_effect = ToEffect;\n\n/**\n * Checks whether a value is a live query source SvelteKit can consume.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is an Effect Stream or native iterable source.\n */\nexport function is_live_source<A>(value: unknown): value is EffectRemoteLiveSource<A> {\n\tif (Stream.isStream(value)) {\n\t\treturn true;\n\t}\n\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\n\tconst source = value as {\n\t\treadonly next?: unknown;\n\t\treadonly [Symbol.asyncIterator]?: unknown;\n\t\treadonly [Symbol.iterator]?: unknown;\n\t};\n\n\treturn (\n\t\ttypeof source.next === \"function\" ||\n\t\ttypeof source[Symbol.asyncIterator] === \"function\" ||\n\t\ttypeof source[Symbol.iterator] === \"function\"\n\t);\n}\n\n/**\n * Runs and normalizes a live query handler result with request services\n * available to Effect Streams.\n *\n * @since 2.0.0\n * @param value - Live query source or Effect that resolves to one.\n * @param event - SvelteKit request event for this remote call.\n * @returns Promise resolving with a source SvelteKit can stream.\n */\nexport function run_live_handler_source<A>(\n\tvalue: LiveHandlerResult<A>,\n\tevent: RequestEventShape,\n): Promise<ResolvedLiveSource<A>> {\n\tconst runtime = get_server_runtime_or_throw();\n\tconst EffectWithRequestEvent = Effect.provideService(\n\t\tToLiveSourceEffect(value),\n\t\tRequestEvent,\n\t\tevent,\n\t) as Effect.Effect<ResolvedLiveSource<A>, unknown, unknown>;\n\n\treturn run_remote_effect(EffectWithRequestEvent, runtime, svelte_invalid, svelte_remote_error);\n}\n\nfunction ToLiveSourceEffect<A>(\n\tvalue: LiveHandlerResult<A>,\n): Effect.Effect<ResolvedLiveSource<A>, unknown, unknown> {\n\tif (Stream.isStream(value)) {\n\t\treturn Stream.toAsyncIterableEffect(\n\t\t\tvalue as Stream.Stream<A, unknown, unknown>,\n\t\t) as Effect.Effect<ResolvedLiveSource<A>, unknown, unknown>;\n\t}\n\n\tif (is_native_live_source<A>(value)) {\n\t\treturn Effect.succeed(value);\n\t}\n\n\tif (!Effect.isEffect(value)) {\n\t\treturn Effect.fail(new InvalidLiveQueryReturnError());\n\t}\n\n\treturn Effect.flatMap(\n\t\tvalue as Effect.Effect<EffectRemoteLiveSource<A>, unknown, unknown>,\n\t\tToLiveSourceEffect,\n\t);\n}\n\nfunction is_native_live_source<A>(value: unknown): value is ResolvedLiveSource<A> {\n\treturn is_live_source<A>(value) && !Stream.isStream(value);\n}\n\n/**\n * Runs a remote handler Effect with the current request event provided.\n *\n * @since 2.0.0\n * @param value - Handler return value.\n * @param event - SvelteKit request event for this remote call.\n * @returns Promise resolving with the handler output.\n */\nexport function run_handler_effect<A>(\n\tvalue: EffectLike<A, unknown, unknown>,\n\tevent: RequestEventShape,\n): Promise<A> {\n\tconst runtime = get_server_runtime_or_throw();\n\tconst EffectWithRequestEvent = Effect.provideService(\n\t\tToEffect(value),\n\t\tRequestEvent,\n\t\tevent,\n\t) as Effect.Effect<A, unknown, unknown>;\n\n\treturn run_remote_effect(EffectWithRequestEvent, runtime, svelte_invalid, svelte_remote_error);\n}\n\nconst svelte_remote_error = (status: number, body: unknown): never => {\n\tsvelte_error(status as never, body as never);\n};\n","import { create_form_error } from \"$/remote/shared.ts\";\nimport { Effect } from \"effect\";\nimport type { FormIssue } from \"$/remote/shared.ts\";\n\nimport type { FormInvalid } from \"./types.ts\";\n\n/**\n * Creates a path-aware proxy for remote form validation failures.\n *\n * @since 2.0.0\n * @param path - Current nested form path.\n * @returns Callable invalid proxy for this path.\n */\nexport function make_invalid_proxy<Input = unknown>(\n\tpath: readonly (string | number)[] = [],\n): FormInvalid<Input> {\n\tconst invalid_at_path = (message: string) =>\n\t\tEffect.fail(create_form_error([{ message, path: [...path] } satisfies FormIssue]));\n\n\treturn new Proxy(invalid_at_path, {\n\t\tget(_target, property) {\n\t\t\tif (typeof property === \"symbol\") {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn make_invalid_proxy([...path, property]);\n\t\t},\n\t}) as FormInvalid<Input>;\n}\n","import { getRequestEvent as get_native_request_event } from \"$app/server\";\nimport { normalize_remote_helper_error } from \"$/remote/server.ts\";\n\nimport { run_handler_effect, run_live_handler_source } from \"./effects.ts\";\nimport { make_invalid_proxy } from \"./invalid.ts\";\nimport { is_handler } from \"./schema.ts\";\nimport type { RequestEvent } from \"./runtime.ts\";\nimport type { EffectLike, RemoteFormHandler, RemoteHandler, RemoteLiveHandler } from \"./types.ts\";\n\nlet running_remote_effect_handlers = 0;\n\n/**\n * Reports whether SER is currently executing user remote handler code.\n *\n * @example\n * ```ts\n * if (is_running_remote_effect_handler()) {\n * return query();\n * }\n * ```\n *\n * @since 2.0.0\n * @returns Whether a remote handler wrapper is currently active.\n * @internal\n */\nexport function is_running_remote_effect_handler(): boolean {\n\treturn running_remote_effect_handlers > 0;\n}\n\n/**\n * Builds the wrapper passed to native query, command, and prerender helpers.\n *\n * @since 2.0.0\n * @param handler - Effect handler or already-built Effect-like value.\n * @param helper_name - Remote helper name for error normalization.\n * @returns Native SvelteKit handler wrapper.\n */\nexport function make_remote_wrapper(\n\thandler: RemoteHandler<unknown, unknown, unknown, unknown> | EffectLike,\n\thelper_name: string,\n): (input: unknown) => Promise<unknown> {\n\treturn async (input: unknown) => {\n\t\tlet event: RequestEvent;\n\n\t\ttry {\n\t\t\tevent = get_native_request_event() as unknown as RequestEvent;\n\t\t} catch (error: unknown) {\n\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t}\n\n\t\treturn await run_inside_remote_effect_handler(() => {\n\t\t\ttry {\n\t\t\t\tconst result = is_handler(handler) ? handler(input) : handler;\n\n\t\t\t\treturn run_handler_effect(result, event);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Builds the wrapper passed to native live query helpers.\n *\n * @since 2.0.0\n * @param handler - Effect-aware live source handler.\n * @param helper_name - Remote helper name for error normalization.\n * @returns Native SvelteKit live query wrapper.\n */\nexport function make_remote_live_wrapper<Input, A>(\n\thandler: RemoteLiveHandler<Input, A, unknown, unknown>,\n\thelper_name: string,\n): (input: unknown) => Promise<unknown> {\n\treturn async (input: unknown) => {\n\t\tlet event: RequestEvent;\n\n\t\ttry {\n\t\t\tevent = get_native_request_event() as unknown as RequestEvent;\n\t\t} catch (error: unknown) {\n\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t}\n\n\t\treturn await run_inside_remote_effect_handler(() => {\n\t\t\ttry {\n\t\t\t\tconst result = typeof handler === \"function\" ? handler(input as Input) : handler;\n\n\t\t\t\treturn run_live_handler_source(result, event);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Builds the wrapper passed to native form helpers.\n *\n * @since 2.0.0\n * @param handler - Effect-aware form handler.\n * @param helper_name - Remote helper name for error normalization.\n * @returns Native SvelteKit form handler wrapper.\n */\nexport function make_remote_form_wrapper<Input, A>(\n\thandler: RemoteFormHandler<Input, A, unknown, unknown>,\n\thelper_name: string,\n): (data: unknown, issue: unknown) => Promise<unknown> {\n\treturn async (data: unknown, issue: unknown) => {\n\t\tlet event: RequestEvent;\n\n\t\ttry {\n\t\t\tevent = get_native_request_event() as unknown as RequestEvent;\n\t\t} catch (error: unknown) {\n\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t}\n\n\t\treturn await run_inside_remote_effect_handler(() => {\n\t\t\tconst invalid_proxy = make_invalid_proxy<Input>();\n\n\t\t\ttry {\n\t\t\t\tconst result = handler({\n\t\t\t\t\tdata: data as Input,\n\t\t\t\t\tinvalid: invalid_proxy,\n\t\t\t\t\tissue,\n\t\t\t\t});\n\n\t\t\t\treturn run_handler_effect(result, event);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t\t}\n\t\t});\n\t};\n}\n\nasync function run_inside_remote_effect_handler<A>(run: () => Promise<A>): Promise<A> {\n\trunning_remote_effect_handlers += 1;\n\n\ttry {\n\t\treturn await run();\n\t} finally {\n\t\trunning_remote_effect_handlers -= 1;\n\t}\n}\n","import {\n\tBatchQueryHandlerMissingError,\n\tUncheckedCommandHandlerMissingError,\n\tUncheckedFormHandlerMissingError,\n\tUncheckedLiveQueryHandlerMissingError,\n\tUncheckedPrerenderHandlerMissingError,\n\tUncheckedQueryHandlerMissingError,\n} from \"$/errors.ts\";\nimport { copy_property_descriptors } from \"$/internal/descriptors.ts\";\nimport { normalize_remote_helper_error } from \"$/remote/server.ts\";\nimport {\n\tcommand as native_command,\n\tform as native_form,\n\tgetRequestEvent as get_native_request_event,\n\tprerender as native_prerender,\n\tquery as native_query,\n} from \"$app/server\";\nimport type { RemoteFormInput } from \"@sveltejs/kit\";\nimport { Effect, type Schema } from \"effect\";\n\nimport { is_handler, is_unchecked, normalize_validator } from \"./schema.ts\";\nimport {\n\tis_running_remote_effect_handler,\n\tmake_remote_form_wrapper,\n\tmake_remote_live_wrapper,\n\tmake_remote_wrapper,\n} from \"./wrappers.ts\";\nimport type {\n\tEffectLike,\n\tEffectRemoteBatchHandler,\n\tEffectRemoteCommand,\n\tEffectRemoteForm,\n\tEffectRemoteFunction,\n\tEffectRemoteLiveQuery,\n\tEffectRemoteLiveQueryFunction,\n\tEffectRemoteLiveQueryResource,\n\tEffectRemoteQuery,\n\tEffectRemoteQueryFunction,\n\tPrerenderOptions,\n\tQueryFactory,\n\tRemoteFormHandler,\n\tRemoteHandler,\n\tRemoteLiveHandler,\n\tSchemaEncodedInput,\n\tSchemaInput,\n\tStandardSchema,\n\tStandardSchemaInput,\n\tStandardSchemaOutput,\n} from \"./types.ts\";\n\ntype FormSchemaEncodedInput<S> = S extends Schema.Top ? FormRemoteInput<S[\"Encoded\"]> : never;\n\ntype FormRemoteInput<Input> =\n\tNormalizeFormEncoded<Input> extends RemoteFormInput ? NormalizeFormEncoded<Input> : never;\n\ntype FormStandardSchemaInput<S> =\n\tStandardSchemaInput<S> extends RemoteFormInput ? StandardSchemaInput<S> : RemoteFormInput;\n\ntype FormScalar = string | number | boolean | File;\n\ntype NormalizeFormEncoded<Value> = Value extends FormScalar\n\t? Value\n\t: Value extends ReadonlyArray<infer Item>\n\t\t? Array<NormalizeFormEncoded<Item>>\n\t\t: Value extends object\n\t\t\t? NormalizeFormObject<Value>\n\t\t\t: Value;\n\ntype NormalizeFormObject<Value> = {\n\treadonly [Key in keyof Value]: Key extends OptionalFormKeys<Value>\n\t\t? NormalizeFormEncoded<Exclude<Value[Key], undefined>>\n\t\t: NormalizeFormEncoded<Value[Key]>;\n};\n\ntype OptionalFormKeys<Value> = {\n\t[Key in keyof Value]-?: Record<PropertyKey, never> extends Pick<Value, Key> ? Key : never;\n}[keyof Value];\n\ntype NativeQueryLike<Input = unknown> = (input: Input) => unknown;\n\ntype EffectRemoteResource<Output, ErrorType = never> =\n\t| EffectRemoteLiveQueryResource<Output>\n\t| EffectRemoteQuery<Output, ErrorType>;\n\ntype CurrentRemoteRequestDetection =\n\t| {\n\t\t\treadonly _tag: \"CurrentRemoteRequest\";\n\t\t\treadonly event: {\n\t\t\t\treadonly isRemoteRequest?: boolean;\n\t\t\t};\n\t }\n\t| {\n\t\t\treadonly _tag: \"NoCurrentRemoteRequest\";\n\t };\n\nconst request_event_context_error_start =\n\t\"Can only read the current request event inside functions invoked during `handle`\";\n\nconst request_store_context_error = \"Could not get the request store.\";\n\nfunction to_effect_query<Input, Output, ErrorType = never>(\n\tnative: NativeQueryLike<Input>,\n): EffectRemoteQueryFunction<Input, Output, ErrorType> {\n\tconst wrapped = ((input: Input) => {\n\t\tif (is_current_remote_request()) {\n\t\t\treturn (native as (input: Input) => unknown)(input);\n\t\t}\n\n\t\tconst resource = (native as (input: Input) => unknown)(input);\n\t\tconst effect = Effect.tryPromise({\n\t\t\ttry: () => Promise.resolve(resource),\n\t\t\tcatch: (error: unknown) => error,\n\t\t}) as unknown as EffectRemoteQuery<Output, ErrorType>;\n\n\t\tattach_query_resource_methods(resource, effect);\n\n\t\treturn effect;\n\t}) as unknown as EffectRemoteQueryFunction<Input, Output, ErrorType>;\n\n\tcopy_property_descriptors(native, wrapped);\n\n\treturn wrapped;\n}\n\nfunction is_current_remote_request(): boolean {\n\tif (is_running_remote_effect_handler()) {\n\t\treturn false;\n\t}\n\n\tconst detection = detect_current_remote_request();\n\n\tif (detection._tag === \"NoCurrentRemoteRequest\") {\n\t\treturn false;\n\t}\n\n\treturn detection.event.isRemoteRequest === true;\n}\n\nfunction detect_current_remote_request(): CurrentRemoteRequestDetection {\n\ttry {\n\t\tconst event = get_native_request_event() as { isRemoteRequest?: boolean };\n\n\t\treturn {\n\t\t\t_tag: \"CurrentRemoteRequest\",\n\t\t\tevent,\n\t\t};\n\t} catch (error: unknown) {\n\t\tif (is_request_event_context_error(error)) {\n\t\t\treturn { _tag: \"NoCurrentRemoteRequest\" };\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\nfunction is_request_event_context_error(error: unknown): error is Error {\n\tif (!(error instanceof Error)) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\terror.message.startsWith(request_event_context_error_start) ||\n\t\terror.message === request_store_context_error\n\t);\n}\n\nfunction to_effect_live_query<Input, Output, ErrorType = never>(\n\tnative: NativeQueryLike<Input>,\n): EffectRemoteLiveQueryFunction<Input, Output, ErrorType> {\n\tconst wrapped = ((input: Input) => {\n\t\tconst effect = Effect.try({\n\t\t\ttry: () => {\n\t\t\t\tconst resource = (native as (input: Input) => unknown)(input);\n\n\t\t\t\treturn make_live_resource<Output>(resource);\n\t\t\t},\n\t\t\tcatch: (error: unknown) => error,\n\t\t}) as unknown as EffectRemoteLiveQuery<Output, ErrorType>;\n\n\t\treturn effect;\n\t}) as unknown as EffectRemoteLiveQueryFunction<Input, Output, ErrorType>;\n\n\tcopy_property_descriptors(native, wrapped);\n\n\treturn wrapped;\n}\n\ntype NativeRemoteResource<Output> = {\n\treadonly current?: Output;\n\treadonly error?: unknown;\n\treadonly loading?: boolean;\n\treadonly ready?: boolean;\n};\n\ntype NativeQueryResource<Output> = NativeRemoteResource<Output> & {\n\treadonly refresh?: () => Promise<void>;\n\treadonly set?: (value: Output) => void;\n\treadonly withOverride?: (update: (current: Output) => Output) => unknown;\n};\n\ntype NativeLiveQueryResource<Output> = NativeRemoteResource<Output> &\n\tPartial<AsyncIterable<Output>> & {\n\t\treadonly connected?: boolean;\n\t\treadonly done?: boolean;\n\t\treadonly reconnect?: () => Promise<void>;\n\t};\n\nfunction is_query_resource<Output>(resource: unknown): resource is NativeQueryResource<Output> {\n\tconst resource_type = typeof resource;\n\n\treturn (resource_type === \"object\" && resource !== null) || resource_type === \"function\";\n}\n\nfunction is_live_resource<Output>(resource: unknown): resource is NativeLiveQueryResource<Output> {\n\tconst resource_type = typeof resource;\n\n\treturn (resource_type === \"object\" && resource !== null) || resource_type === \"function\";\n}\n\nfunction attach_remote_resource_getters<Output, ErrorType = never>(\n\tresource: unknown,\n\teffect: EffectRemoteResource<Output, ErrorType>,\n): void {\n\tconst methods = is_query_resource<Output>(resource) ? resource : undefined;\n\tconst keys = [\"current\", \"error\", \"loading\", \"ready\"] as const;\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tfor (const key of keys) {\n\t\tif (!(key in methods)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tObject.defineProperty(effect, key, {\n\t\t\tconfigurable: true,\n\t\t\tget: () => methods[key],\n\t\t});\n\t}\n}\n\nfunction attach_query_resource_methods<Output, ErrorType = never>(\n\tresource: unknown,\n\teffect: EffectRemoteQuery<Output, ErrorType>,\n): void {\n\tconst methods = is_query_resource<Output>(resource) ? resource : undefined;\n\tconst refresh = methods?.refresh;\n\tconst set = methods?.set;\n\tconst with_override = methods?.withOverride;\n\n\tattach_remote_resource_getters(resource, effect);\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tif (typeof refresh === \"function\") {\n\t\tObject.defineProperty(effect, \"refresh\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () =>\n\t\t\t\tEffect.tryPromise({\n\t\t\t\t\ttry: () => Promise.resolve(refresh.call(resource)),\n\t\t\t\t\tcatch: (error: unknown) => error,\n\t\t\t\t}),\n\t\t});\n\t}\n\n\tif (typeof set === \"function\") {\n\t\tObject.defineProperty(effect, \"set\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: (value: Output) => set.call(resource, value),\n\t\t});\n\t}\n\n\tif (typeof with_override === \"function\") {\n\t\tObject.defineProperty(effect, \"withOverride\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: (update: (current: Output) => Output) => with_override.call(resource, update),\n\t\t});\n\t}\n}\n\nfunction attach_live_resource_methods<Output>(\n\tresource: unknown,\n\teffect: EffectRemoteLiveQueryResource<Output>,\n): void {\n\tconst methods = is_live_resource<Output>(resource) ? resource : undefined;\n\tconst reconnect = methods?.reconnect;\n\tconst async_iterator = methods?.[Symbol.asyncIterator];\n\tconst keys = [\"connected\", \"current\", \"done\", \"error\", \"loading\", \"ready\"] as const;\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tfor (const key of keys) {\n\t\tif (!(key in methods)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tObject.defineProperty(effect, key, {\n\t\t\tconfigurable: true,\n\t\t\tget: () => methods[key],\n\t\t});\n\t}\n\n\tif (typeof reconnect === \"function\") {\n\t\tObject.defineProperty(effect, \"reconnect\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () =>\n\t\t\t\tEffect.tryPromise({\n\t\t\t\t\ttry: () => Promise.resolve(reconnect.call(resource)),\n\t\t\t\t\tcatch: (error: unknown) => error,\n\t\t\t\t}),\n\t\t});\n\t}\n\n\tif (typeof async_iterator === \"function\") {\n\t\tObject.defineProperty(effect, Symbol.asyncIterator, {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () => async_iterator.call(resource),\n\t\t});\n\t}\n}\n\nfunction make_live_resource<Output>(resource: unknown): EffectRemoteLiveQueryResource<Output> {\n\tconst live_resource = {} as EffectRemoteLiveQueryResource<Output>;\n\n\tattach_live_resource_methods(resource, live_resource);\n\n\treturn live_resource;\n}\n\n/**\n * Factory for a read-only remote query function.\n *\n * @example\n * ```ts\n * export const getUser = Query(Schema.Struct({ id: Schema.String }), (input) =>\n * Effect.succeed(input.id)\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit query function.\n */\nfunction QueryRoot<A, E = never, R = never>(\n\tvalidate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n): EffectRemoteQueryFunction<void, A, E>;\nfunction QueryRoot<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteHandler<Input, A, E, R>,\n): EffectRemoteQueryFunction<Input, A, E>;\nfunction QueryRoot<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryRoot<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryRoot(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (maybe_handler) {\n\t\t\treturn to_effect_query(\n\t\t\t\tnative_query(\n\t\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\t\tmake_remote_wrapper(maybe_handler as RemoteHandler, \"Query\") as never,\n\t\t\t\t) as ReturnType<typeof native_query>,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedQueryHandlerMissingError();\n\t\t}\n\n\t\treturn to_effect_query(\n\t\t\tnative_query(\n\t\t\t\tmake_remote_wrapper(validate_or_handler as RemoteHandler, \"Query\") as never,\n\t\t\t) as ReturnType<typeof native_query>,\n\t\t);\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Query\");\n\t}\n}\n\n/**\n * Factory for a batched read-only remote query function.\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema or `\"unchecked\"` sentinel.\n * @param maybe_handler - Handler receiving validated inputs as one batch.\n * @returns A SvelteKit batch query function.\n */\nfunction QueryBatch<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: EffectRemoteBatchHandler<Input, A, E, R>,\n): EffectRemoteQueryFunction<Input, A, E>;\nfunction QueryBatch<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: EffectRemoteBatchHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryBatch<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: EffectRemoteBatchHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryBatch(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (!maybe_handler) {\n\t\t\tthrow new BatchQueryHandlerMissingError();\n\t\t}\n\n\t\treturn to_effect_query(\n\t\t\tnative_query.batch(\n\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\tmake_remote_wrapper(maybe_handler as RemoteHandler, \"Query.batch\") as never,\n\t\t\t) as NativeQueryLike,\n\t\t);\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Query.batch\");\n\t}\n}\n\n/**\n * Factory for a live remote query function.\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg live handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit live query function.\n */\nfunction QueryLive<A, E = never, R = never>(\n\tvalidate_or_handler: RemoteLiveHandler<void, A, E, R>,\n): EffectRemoteLiveQueryFunction<void, A, E>;\nfunction QueryLive<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteLiveHandler<Input, A, E, R>,\n): EffectRemoteLiveQueryFunction<Input, A, E>;\nfunction QueryLive<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteLiveHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteLiveQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryLive<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteLiveHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteLiveQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryLive(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (maybe_handler) {\n\t\t\treturn to_effect_live_query(\n\t\t\t\tnative_query.live(\n\t\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\t\tmake_remote_live_wrapper(\n\t\t\t\t\t\tmaybe_handler as RemoteLiveHandler,\n\t\t\t\t\t\t\"Query.live\",\n\t\t\t\t\t) as never,\n\t\t\t\t) as NativeQueryLike,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedLiveQueryHandlerMissingError();\n\t\t}\n\n\t\treturn to_effect_live_query(\n\t\t\tnative_query.live(\n\t\t\t\tmake_remote_live_wrapper(\n\t\t\t\t\tvalidate_or_handler as RemoteLiveHandler,\n\t\t\t\t\t\"Query.live\",\n\t\t\t\t) as never,\n\t\t\t) as NativeQueryLike,\n\t\t);\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Query.live\");\n\t}\n}\n\n/**\n * Factory for read-only remote query functions.\n *\n * @example\n * ```ts\n * export const getUser = Query(Schema.Struct({ id: Schema.String }), (input) =>\n * Effect.succeed(input.id)\n * );\n *\n * export const getUserBatch = Query.batch(Schema.String, (ids) =>\n * Effect.succeed((id) => ids.includes(id))\n * );\n * ```\n *\n * @since 2.0.0\n */\nexport const Query: QueryFactory = Object.assign(QueryRoot, {\n\tbatch: QueryBatch,\n\tlive: QueryLive,\n});\n\n/**\n * Creates a write-oriented remote command from a no-argument Effect handler.\n *\n * @example\n * ```ts\n * export const RebuildCache = Command(() => Effect.succeed(\"done\"));\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - Effect value or no-argument handler to run on\n * the server when the command is invoked.\n * @returns A command function that yields an Effect when called.\n */\nexport function Command<A, E = never, R = never>(\n\tvalidate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n): EffectRemoteCommand<void, A, E>;\n\n/**\n * Creates a write-oriented remote command with unchecked input.\n *\n * @example\n * ```ts\n * export const SaveDraft = Command(\"unchecked\", (input: { id: string }) =>\n * Effect.succeed(input.id)\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - `\"unchecked\"` sentinel that skips runtime input\n * validation.\n * @param maybe_handler - Handler that receives the caller-provided input.\n * @returns A command function that yields an Effect when called with input.\n */\nexport function Command<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteHandler<Input, A, E, R>,\n): EffectRemoteCommand<Input, A, E>;\n\n/**\n * Creates a write-oriented remote command validated with an Effect Schema.\n *\n * @example\n * ```ts\n * export const SaveUser = Command(Schema.Struct({ id: Schema.String }), ({ id }) =>\n * Effect.succeed({ id, saved: true })\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - Effect Schema used to decode and validate\n * caller input before the handler runs.\n * @param maybe_handler - Handler that receives the decoded schema output.\n * @returns A command function whose caller input is the schema encoded type.\n */\nexport function Command<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteCommand<SchemaEncodedInput<S>, A, E>;\n\n/**\n * Creates a write-oriented remote command validated with a Standard Schema.\n *\n * @example\n * ```ts\n * export const Toggle = Command(standard_schema, (input) =>\n * Effect.succeed(input.enabled)\n * );\n * ```\n *\n * @since 3.0.0\n * @param validate_or_handler - Standard Schema used to validate caller input\n * before the handler runs.\n * @param maybe_handler - Handler that receives the decoded schema output.\n * @returns A command function whose caller input is the schema input type.\n */\nexport function Command<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteCommand<StandardSchemaInput<S>, A, E>;\nexport function Command(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (maybe_handler) {\n\t\t\treturn native_command(\n\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\tmake_remote_wrapper(maybe_handler as RemoteHandler, \"Command\") as never,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedCommandHandlerMissingError();\n\t\t}\n\n\t\treturn native_command(\n\t\t\tmake_remote_wrapper(validate_or_handler as RemoteHandler, \"Command\") as never,\n\t\t) as ReturnType<typeof native_command>;\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Command\");\n\t}\n}\n\n/**\n * Factory for a remote form handler.\n *\n * @example\n * ```ts\n * export const SignIn = Form(signInSchema, ({ data, invalid }) =>\n * Effect.gen(function* () {\n * if (!data.email.includes(\"@\")) {\n * return yield* invalid.email(\"Use an email address.\");\n * }\n *\n * return { email: data.email };\n * })\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit form function.\n */\nexport function Form<A, E = never, R = never>(\n\tvalidate_or_handler: EffectLike<A, E, R> | RemoteFormHandler<void, A, E, R>,\n): EffectRemoteForm<void, A, E>;\nexport function Form<Input extends RemoteFormInput, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteFormHandler<Input, A, E, R>,\n): EffectRemoteForm<Input, A, E>;\nexport function Form<S extends Schema.Top, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteFormHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteForm<FormSchemaEncodedInput<S>, A, E>;\nexport function Form<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteFormHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteForm<FormStandardSchemaInput<S>, A, E>;\nexport function Form(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (maybe_handler) {\n\t\t\treturn native_form(\n\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\tmake_remote_form_wrapper(maybe_handler as RemoteFormHandler, \"Form\") as never,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedFormHandlerMissingError();\n\t\t}\n\n\t\tconst inputless_handler: RemoteFormHandler<void, unknown> = ({ data, invalid, issue }) => {\n\t\t\tif (is_handler(validate_or_handler)) {\n\t\t\t\treturn validate_or_handler({ data, invalid, issue });\n\t\t\t}\n\n\t\t\treturn validate_or_handler as EffectLike;\n\t\t};\n\n\t\treturn native_form(\n\t\t\tmake_remote_form_wrapper(inputless_handler, \"Form\") as never,\n\t\t) as unknown as ReturnType<typeof native_form>;\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Form\");\n\t}\n}\n\n/**\n * Creates a prerenderable remote function from a no-argument Effect handler.\n *\n * @example\n * ```ts\n * export const GetBuildInfo = Prerender(() => Effect.succeed(\"ready\"));\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - Effect value or no-argument handler to run at\n * prerender time.\n * @param maybe_options - Optional prerender inputs and dynamic fallback\n * configuration.\n * @returns A prerender function that yields an Effect when called.\n */\nexport function Prerender<A, E = never, R = never>(\n\tvalidate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n\tmaybe_options?: PrerenderOptions,\n): EffectRemoteFunction<void, A, E>;\n\n/**\n * Creates a prerenderable remote function with unchecked input.\n *\n * @example\n * ```ts\n * export const GetPost = Prerender(\n * \"unchecked\",\n * (slug: string) => Effect.succeed({ slug }),\n * { inputs: () => [\"intro\"] },\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - `\"unchecked\"` sentinel that skips runtime input\n * validation.\n * @param maybe_handler - Handler that receives the caller-provided input.\n * @param maybe_options - Optional prerender inputs and dynamic fallback\n * configuration.\n * @returns A prerender function that yields an Effect when called with input.\n */\nexport function Prerender<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteHandler<Input, A, E, R>,\n\tmaybe_options?: PrerenderOptions,\n): EffectRemoteFunction<Input, A, E>;\n\n/**\n * Creates a prerenderable remote function validated with an Effect Schema.\n *\n * @example\n * ```ts\n * export const GetPost = Prerender(\n * Schema.String,\n * (slug) => Effect.succeed({ slug }),\n * { inputs: () => [\"intro\"] },\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - Effect Schema used to decode and validate\n * caller input before the handler runs.\n * @param maybe_handler - Handler that receives the decoded schema output.\n * @param maybe_options - Optional prerender inputs and dynamic fallback\n * configuration.\n * @returns A prerender function whose caller input is the schema encoded type.\n */\nexport function Prerender<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n\tmaybe_options?: PrerenderOptions,\n): EffectRemoteFunction<SchemaEncodedInput<S>, A, E>;\n\n/**\n * Creates a prerenderable remote function validated with a Standard Schema.\n *\n * @example\n * ```ts\n * export const GetPost = Prerender(\n * standard_schema,\n * (post) => Effect.succeed(post.slug),\n * { dynamic: true },\n * );\n * ```\n *\n * @since 3.0.0\n * @param validate_or_handler - Standard Schema used to validate caller input\n * before the handler runs.\n * @param maybe_handler - Handler that receives the decoded schema output.\n * @param maybe_options - Optional prerender inputs and dynamic fallback\n * configuration.\n * @returns A prerender function whose caller input is the schema input type.\n */\nexport function Prerender<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n\tmaybe_options?: PrerenderOptions,\n): EffectRemoteFunction<StandardSchemaInput<S>, A, E>;\nexport function Prerender(\n\tvalidate_or_handler: unknown,\n\tmaybe_handler_or_options?: unknown,\n\tmaybe_options?: PrerenderOptions,\n): unknown {\n\ttry {\n\t\tif (is_handler(maybe_handler_or_options)) {\n\t\t\treturn native_prerender(\n\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\tmake_remote_wrapper(maybe_handler_or_options, \"Prerender\") as never,\n\t\t\t\tmaybe_options as never,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedPrerenderHandlerMissingError();\n\t\t}\n\n\t\treturn native_prerender(\n\t\t\tmake_remote_wrapper(validate_or_handler as RemoteHandler, \"Prerender\") as never,\n\t\t\tmaybe_handler_or_options as never,\n\t\t) as ReturnType<typeof native_prerender>;\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Prerender\");\n\t}\n}\n","import { error as svelte_error, redirect as svelte_redirect } from \"@sveltejs/kit\";\nimport { Effect } from \"effect\";\n\nconst error_status_codes = {\n\tProxyAuthenticationRequired: 407,\n\tRequestHeaderFieldsTooLarge: 431,\n\tUnavailableForLegalReasons: 451,\n\tNetworkAuthenticationRequired: 511,\n\tHttpVersionNotSupported: 505,\n\tUnprocessableContent: 422,\n\tUnprocessableEntity: 422,\n\tInternalServerError: 500,\n\tFailedDependency: 424,\n\tPreconditionRequired: 428,\n\tServiceUnavailable: 503,\n\tMisdirectedRequest: 421,\n\tInsufficientStorage: 507,\n\tVariantAlsoNegotiates: 506,\n\tPreconditionFailed: 412,\n\tMethodNotAllowed: 405,\n\tGatewayTimeout: 504,\n\tPaymentRequired: 402,\n\tUpgradeRequired: 426,\n\tTooManyRequests: 429,\n\tLengthRequired: 411,\n\tNotAcceptable: 406,\n\tRequestTimeout: 408,\n\tContentTooLarge: 413,\n\tPayloadTooLarge: 413,\n\tUriTooLong: 414,\n\tUnsupportedMediaType: 415,\n\tRangeNotSatisfiable: 416,\n\tExpectationFailed: 417,\n\tImATeapot: 418,\n\tBadRequest: 400,\n\tUnauthorized: 401,\n\tForbidden: 403,\n\tNotFound: 404,\n\tConflict: 409,\n\tGone: 410,\n\tLocked: 423,\n\tTooEarly: 425,\n\tNotImplemented: 501,\n\tBadGateway: 502,\n\tLoopDetected: 508,\n\tNotExtended: 510,\n} as const;\n\nconst redirect_status_codes = {\n\tMovedPermanently: 301,\n\tTemporaryRedirect: 307,\n\tPermanentRedirect: 308,\n\tMultipleChoices: 300,\n\tNotModified: 304,\n\tSwitchProxy: 306,\n\tSeeOther: 303,\n\tUseProxy: 305,\n\tFound: 302,\n} as const;\n\ntype AppErrorStatus = App.Error extends { readonly status?: infer Status } ? Status : number;\n\n/**\n * Compatibility shim while SER supports both SvelteKit 2 and 3. The wrappers\n * call the SvelteKit 3 control-flow shapes, while SvelteKit 2 ignores extra\n * runtime arguments. Drop these broad call signatures when Kit 2 support is\n * removed.\n */\ntype SvelteError = (status: number, body?: ErrorBody, properties?: ErrorProperties) => never;\n\ntype SvelteRedirect = (status: number, location: string | URL, options?: RedirectOptions) => never;\n\n/**\n * Named HTTP status accepted by the {@link Error} helper.\n *\n * @example\n * ```ts\n * const status: ErrorStatusName = \"NotFound\";\n * ```\n *\n * @since 2.3.0\n */\nexport type ErrorStatusName = keyof typeof error_status_codes;\n\n/**\n * Numeric or named HTTP status accepted by the {@link Error} helper.\n *\n * @example\n * ```ts\n * const status: ErrorStatus = \"InternalServerError\";\n * ```\n *\n * @since 2.3.0\n */\nexport type ErrorStatus = ErrorStatusName | number;\n\n/**\n * Error body accepted by the {@link Error} helper.\n *\n * @example\n * ```ts\n * const body: ErrorBody = { message: \"Post not found\" };\n * ```\n *\n * @since 3.4.3\n */\nexport type ErrorBody =\n\t| (Omit<App.Error, \"status\"> & { readonly status?: AppErrorStatus })\n\t| string\n\t| undefined;\n\n/**\n * Extra SvelteKit app error properties accepted by the {@link Error} helper\n * when using the SvelteKit 3 string-body overload.\n *\n * @example\n * ```ts\n * const properties: ErrorProperties = { code: \"POST_NOT_FOUND\" };\n * ```\n *\n * @since 3.4.3\n */\nexport type ErrorProperties = Omit<App.Error, \"status\" | \"message\">;\n\n/**\n * Named HTTP status accepted by the {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const status: RedirectStatusName = \"TemporaryRedirect\";\n * ```\n *\n * @since 2.3.0\n */\nexport type RedirectStatusName = keyof typeof redirect_status_codes;\n\n/**\n * Numeric or named HTTP status accepted by the {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const status: RedirectStatus = \"SeeOther\";\n * ```\n *\n * @since 2.3.0\n */\nexport type RedirectStatus = RedirectStatusName | number;\n\n/**\n * Options accepted by the {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const options: RedirectOptions = { external: true };\n * ```\n *\n * @since 3.4.3\n */\nexport type RedirectOptions = {\n\treadonly external?: boolean | string[];\n};\n\n/**\n * Callable shape for the exported {@link Error} helper.\n *\n * @example\n * ```ts\n * const fail_not_found: ErrorEffectFactory = Error;\n * ```\n *\n * @since 2.3.0\n */\nexport interface ErrorEffectFactory {\n\t/**\n\t * Creates an Effect that throws SvelteKit's HTTP error control-flow value.\n\t *\n\t * @example\n\t * ```ts\n\t * return yield* Error(\"NotFound\", \"Post not found\");\n\t * ```\n\t *\n\t * @since 2.3.0\n\t * @param status - Numeric HTTP status or PascalCase status name to pass to\n\t * SvelteKit's `error` helper.\n\t * @param body - Optional SvelteKit error body or message forwarded unchanged\n\t * to SvelteKit.\n\t * @returns An Effect that never succeeds because SvelteKit takes over request\n\t * control flow.\n\t */\n\t(status: ErrorStatus, body?: ErrorBody): Effect.Effect<never, never, never>;\n\n\t/**\n\t * Creates an Effect that throws SvelteKit's HTTP error control-flow value\n\t * using the SvelteKit 3 string-body overload with extra properties.\n\t *\n\t * @example\n\t * ```ts\n\t * return yield* Error(\"NotFound\", \"Post not found\", {\n\t * code: \"POST_NOT_FOUND\",\n\t * });\n\t * ```\n\t *\n\t * @since 3.4.3\n\t * @param status - Numeric HTTP status or PascalCase status name to pass to\n\t * SvelteKit's `error` helper.\n\t * @param body - Error message forwarded to SvelteKit.\n\t * @param properties - Additional app error properties forwarded to\n\t * SvelteKit.\n\t * @returns An Effect that never succeeds because SvelteKit takes over request\n\t * control flow.\n\t */\n\t(\n\t\tstatus: ErrorStatus,\n\t\tbody: string,\n\t\tproperties: ErrorProperties,\n\t): Effect.Effect<never, never, never>;\n}\n\n/**\n * Callable shape for the exported {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const redirect_after_save: RedirectEffectFactory = Redirect;\n * ```\n *\n * @since 2.3.0\n */\nexport interface RedirectEffectFactory {\n\t/**\n\t * Creates an Effect that throws SvelteKit's redirect control-flow value.\n\t *\n\t * @example\n\t * ```ts\n\t * return yield* Redirect(\"SeeOther\", \"/posts\");\n\t * ```\n\t *\n\t * @since 2.3.0\n\t * @param status - Numeric redirect status or PascalCase status name to pass\n\t * to SvelteKit's `redirect` helper.\n\t * @param location - Target URL forwarded unchanged to SvelteKit.\n\t * @param options - Optional SvelteKit redirect options. In SvelteKit 3, pass\n\t * `{ external: true }` or an allowlist to redirect to external URLs.\n\t * @returns An Effect that never succeeds because SvelteKit takes over request\n\t * control flow.\n\t */\n\t(\n\t\tstatus: RedirectStatus,\n\t\tlocation: string | URL,\n\t\toptions?: RedirectOptions,\n\t): Effect.Effect<never, never, never>;\n}\n\n/**\n * Creates an Effect that raises SvelteKit's HTTP error control flow.\n *\n * @example\n * ```ts\n * return yield* Error(\"NotFound\", \"Post not found\");\n * ```\n *\n * @since 2.3.0\n * @param status - Numeric HTTP status or PascalCase status name to pass to\n * SvelteKit's `error` helper.\n * @param body - Optional SvelteKit error body or message forwarded unchanged\n * to SvelteKit.\n * @param properties - Optional SvelteKit 3 app error properties forwarded when\n * using a string error message.\n * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\nexport const Error: ErrorEffectFactory = ((\n\tstatus: ErrorStatus,\n\tbody?: ErrorBody,\n\tproperties?: ErrorProperties,\n) => {\n\tconst resolved_status = resolve_error_status(status);\n\tconst error = svelte_error as SvelteError;\n\n\treturn Effect.sync((): never => {\n\t\tif (properties === undefined) {\n\t\t\treturn error(resolved_status, body);\n\t\t}\n\n\t\treturn error(resolved_status, body, properties);\n\t});\n}) as ErrorEffectFactory;\n\n/**\n * Creates an Effect that raises SvelteKit's redirect control flow.\n *\n * @example\n * ```ts\n * return yield* Redirect(\"SeeOther\", \"/posts\");\n * ```\n *\n * @since 2.3.0\n * @param status - Numeric redirect status or PascalCase status name to pass to\n * SvelteKit's `redirect` helper.\n * @param location - Target URL forwarded unchanged to SvelteKit.\n * @param options - Optional SvelteKit redirect options. In SvelteKit 3, pass\n * `{ external: true }` or an allowlist to redirect to external URLs.\n * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\nexport const Redirect: RedirectEffectFactory = ((\n\tstatus: RedirectStatus,\n\tlocation: string | URL,\n\toptions?: RedirectOptions,\n) => {\n\tconst resolved_status = resolve_redirect_status(status);\n\tconst redirect = svelte_redirect as SvelteRedirect;\n\n\treturn Effect.sync((): never => redirect(resolved_status, location, options));\n}) as RedirectEffectFactory;\n\nfunction resolve_error_status(status: ErrorStatus): number {\n\tif (typeof status === \"number\") {\n\t\treturn status;\n\t}\n\n\treturn error_status_codes[status];\n}\n\nfunction resolve_redirect_status(status: RedirectStatus): number {\n\tif (typeof status === \"number\") {\n\t\treturn status;\n\t}\n\n\treturn redirect_status_codes[status];\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAWA,SAAgB,aAAa,OAAsC;CAClE,OAAO,UAAU;AAClB;;;;;;;;AASA,SAAgB,WACf,OAC6D;CAC7D,OAAO,OAAO,UAAU;AACzB;;;;;;;;AASA,SAAgB,mBAAmB,OAAyC;CAC3E,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,eAAe;AACtE;;;;;;;;AASA,SAAgB,iBAAiB,OAAiD;CACjF,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,SAAS,SAAS,UAAU;AACnF;;;;;;;;AASA,SAAgB,oBAAoB,OAAyB;CAC5D,IAAI,mBAAmB,KAAK,KAAK,CAAC,iBAAiB,KAAK,GACvD,OAAO;CAGR,OAAO,OAAO,mBAAmB,KAAc;AAChD;;;;;;;;;;ACzCA,SAAgB,oBACf,OACkD;CAClD,OACC,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAA6B,SAAS;AAEhD;;;;;;;;AASA,SAAgB,SAAkB,OAAoD;CACrF,IAAI,oBAAuB,KAAK,GAC/B,OAAO,OAAO,UAAU,KAAK;CAG9B,OAAO;AACR;;;;;;;;AAwBA,SAAgB,eAAkB,OAAoD;CACrF,IAAI,OAAO,SAAS,KAA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CACtD,MAAME,aAAWC;CAEjB,OAAO,OAAO,WAAkBD,WAAS,iBAAiB,UAAU,OAAO,CAAC;AAC7E;AAEA,SAAS,qBAAqB,QAA6B;CAC1D,IAAI,OAAO,WAAW,UACrB,OAAO;CAGR,OAAO,mBAAmB;AAC3B;AAEA,SAAS,wBAAwB,QAAgC;CAChE,IAAI,OAAO,WAAW,UACrB,OAAO;CAGR,OAAO,sBAAsB;AAC9B"}
|
|
1
|
+
{"version":3,"file":"server.js","names":["svelte_invalid","error","get_native_request_event","get_native_request_event","native_query","native_command","native_form","native_prerender","Error","error","svelte_error","redirect","svelte_redirect"],"sources":["../../modules/svelte-effect-runtime/src/server/schema.ts","../../modules/svelte-effect-runtime/src/server/effects.ts","../../modules/svelte-effect-runtime/src/server/invalid.ts","../../modules/svelte-effect-runtime/src/server/wrappers.ts","../../modules/svelte-effect-runtime/src/server/factories.ts","../../modules/svelte-effect-runtime/src/server/control-flow.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport type { RemoteHandler, StandardSchema } from \"./types.ts\";\n\n/**\n * Checks whether a value is the string sentinel for unchecked remotes.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is `\"unchecked\"`.\n */\nexport function is_unchecked(value: unknown): value is \"unchecked\" {\n\treturn value === \"unchecked\";\n}\n\n/**\n * Checks whether a value is a remote handler function.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is callable as a handler.\n */\nexport function is_handler(\n\tvalue: unknown,\n): value is RemoteHandler<unknown, unknown, unknown, unknown> {\n\treturn typeof value === \"function\";\n}\n\n/**\n * Checks whether a value implements the Standard Schema contract.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is a Standard Schema.\n */\nexport function is_standard_schema(value: unknown): value is StandardSchema {\n\treturn typeof value === \"object\" && value !== null && \"~standard\" in value;\n}\n\n/**\n * Checks whether a value looks like an Effect Schema.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value should be converted to Standard Schema.\n */\nexport function is_effect_schema(value: unknown): value is Schema.Schema<unknown> {\n\treturn typeof value === \"object\" && value !== null && \"ast\" in value && \"make\" in value;\n}\n\n/**\n * Converts Effect Schema inputs to Standard Schema for SvelteKit.\n *\n * @since 2.0.0\n * @param value - Schema or handler input.\n * @returns Original value or Standard Schema view of an Effect Schema.\n */\nexport function normalize_validator(value: unknown): unknown {\n\tif (is_standard_schema(value) || !is_effect_schema(value)) {\n\t\treturn value;\n\t}\n\n\treturn Schema.toStandardSchemaV1(value as never);\n}\n","import { encode_remote_failure, run_remote_effect } from \"$/remote/server.ts\";\nimport { InvalidLiveQueryReturnError } from \"$/errors.ts\";\nimport { create_serialized_remote_failure_envelope } from \"$/remote/shared.ts\";\nimport { error as svelte_error, invalid as svelte_invalid } from \"@sveltejs/kit\";\nimport { Cause, Effect, Stream } from \"effect\";\n\nimport { get_server_runtime_or_throw, RequestEvent } from \"./runtime.ts\";\nimport type { RequestEvent as RequestEventShape } from \"./runtime.ts\";\nimport type { EffectLike } from \"./types.ts\";\n\ntype ResolvedLiveSource<A> = AsyncIterable<A>;\n\ntype LiveHandlerResult<A> = Stream.Stream<A, unknown, unknown>;\n\n/**\n * Checks whether a value is an Effect generator return object.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value should be wrapped with `Effect.gen`.\n */\nexport function is_generator_result<A>(\n\tvalue: unknown,\n): value is Effect.gen.Return<A, unknown, unknown> {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\ttypeof (value as { next?: unknown }).next === \"function\"\n\t);\n}\n\n/**\n * Normalizes an Effect-like handler return value into an Effect.\n *\n * @since 2.0.0\n * @param value - Effect or generator return value.\n * @returns Normalized Effect.\n */\nexport function ToEffect<A, E, R>(value: EffectLike<A, E, R>): Effect.Effect<A, E, R> {\n\tif (is_generator_result<A>(value)) {\n\t\treturn Effect.gen(() => value) as Effect.Effect<A, E, R>;\n\t}\n\n\treturn value;\n}\n\n/**\n * Compatibility alias for {@link ToEffect}.\n *\n * @example\n * ```ts\n * const program = to_effect(Effect.succeed(1));\n * ```\n *\n * @since 2.0.0\n * @param value - Effect or generator return value.\n * @returns Normalized Effect.\n * @internal\n */\nexport const to_effect = ToEffect;\n\n/**\n * Checks whether a value is an Effect Stream live source.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is an Effect Stream.\n */\nexport function is_live_source<A>(value: unknown): value is Stream.Stream<A, unknown, unknown> {\n\treturn Stream.isStream(value);\n}\n\n/**\n * Runs and normalizes a live query handler result with request services\n * available to Effect Streams.\n *\n * @since 2.0.0\n * @param value - Live query source or Effect that resolves to one.\n * @param event - SvelteKit request event for this remote call.\n * @returns Promise resolving with a source SvelteKit can stream.\n */\nexport function run_live_handler_source<A>(\n\tvalue: LiveHandlerResult<A>,\n\tevent: RequestEventShape,\n): Promise<ResolvedLiveSource<A>> {\n\tif (!is_live_source(value)) {\n\t\tthrow new InvalidLiveQueryReturnError();\n\t}\n\n\tconst runtime = get_server_runtime_or_throw();\n\tconst EffectWithRequestEvent = Effect.provideService(\n\t\tToLiveSourceEffect(value),\n\t\tRequestEvent,\n\t\tevent,\n\t) as Effect.Effect<ResolvedLiveSource<A>, unknown, unknown>;\n\n\treturn run_remote_effect(EffectWithRequestEvent, runtime, svelte_invalid, svelte_remote_error);\n}\n\nfunction ToLiveSourceEffect<A>(\n\tvalue: LiveHandlerResult<A>,\n): Effect.Effect<ResolvedLiveSource<A>, unknown, unknown> {\n\treturn Stream.toAsyncIterableEffect(value as Stream.Stream<A, unknown, unknown>).pipe(\n\t\tEffect.map(wrap_live_source_errors),\n\t) as Effect.Effect<ResolvedLiveSource<A>, unknown, unknown>;\n}\n\nfunction wrap_live_source_errors<A>(source: AsyncIterable<A>): AsyncIterable<A> {\n\treturn {\n\t\t[Symbol.asyncIterator]() {\n\t\t\tconst iterator = source[Symbol.asyncIterator]();\n\n\t\t\treturn {\n\t\t\t\tasync next() {\n\t\t\t\t\ttry {\n\t\t\t\t\t\treturn await iterator.next();\n\t\t\t\t\t} catch (error: unknown) {\n\t\t\t\t\t\tthrow_live_source_error(error);\n\t\t\t\t\t}\n\t\t\t\t},\n\n\t\t\t\tasync return(value?: unknown) {\n\t\t\t\t\tif (iterator.return) {\n\t\t\t\t\t\treturn await iterator.return(value);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdone: true,\n\t\t\t\t\t\tvalue: undefined as A,\n\t\t\t\t\t};\n\t\t\t\t},\n\n\t\t\t\tasync throw(error?: unknown) {\n\t\t\t\t\tif (iterator.throw) {\n\t\t\t\t\t\treturn await iterator.throw(error);\n\t\t\t\t\t}\n\n\t\t\t\t\tthrow_live_source_error(error);\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n\nfunction throw_live_source_error(error: unknown): never {\n\tconst encoded = encode_remote_failure(Cause.fail(error));\n\tconst envelope = create_serialized_remote_failure_envelope(encoded);\n\n\tsvelte_error(500, envelope as never);\n}\n\n/**\n * Runs a remote handler Effect with the current request event provided.\n *\n * @since 2.0.0\n * @param value - Handler return value.\n * @param event - SvelteKit request event for this remote call.\n * @returns Promise resolving with the handler output.\n */\nexport function run_handler_effect<A>(\n\tvalue: EffectLike<A, unknown, unknown>,\n\tevent: RequestEventShape,\n): Promise<A> {\n\tconst runtime = get_server_runtime_or_throw();\n\tconst EffectWithRequestEvent = Effect.provideService(\n\t\tToEffect(value),\n\t\tRequestEvent,\n\t\tevent,\n\t) as Effect.Effect<A, unknown, unknown>;\n\n\treturn run_remote_effect(EffectWithRequestEvent, runtime, svelte_invalid, svelte_remote_error);\n}\n\nconst svelte_remote_error = (status: number, body: unknown): never => {\n\tsvelte_error(status as never, body as never);\n};\n","import { create_form_error } from \"$/remote/shared.ts\";\nimport { Effect } from \"effect\";\nimport type { FormIssue } from \"$/remote/shared.ts\";\n\nimport type { FormInvalid } from \"./types.ts\";\n\n/**\n * Creates a path-aware proxy for remote form validation failures.\n *\n * @since 2.0.0\n * @param path - Current nested form path.\n * @returns Callable invalid proxy for this path.\n */\nexport function make_invalid_proxy<Input = unknown>(\n\tpath: readonly (string | number)[] = [],\n): FormInvalid<Input> {\n\tconst invalid_at_path = (message: string) =>\n\t\tEffect.fail(create_form_error([{ message, path: [...path] } satisfies FormIssue]));\n\n\treturn new Proxy(invalid_at_path, {\n\t\tget(_target, property) {\n\t\t\tif (typeof property === \"symbol\") {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn make_invalid_proxy([...path, property]);\n\t\t},\n\t}) as FormInvalid<Input>;\n}\n","import { getRequestEvent as get_native_request_event } from \"$app/server\";\nimport { normalize_remote_helper_error } from \"$/remote/server.ts\";\n\nimport { run_handler_effect, run_live_handler_source } from \"./effects.ts\";\nimport { make_invalid_proxy } from \"./invalid.ts\";\nimport { is_handler } from \"./schema.ts\";\nimport type { RequestEvent } from \"./runtime.ts\";\nimport type {\n\tEffectLike,\n\tRemoteFormHandler,\n\tRemoteHandler,\n\tRemoteLiveHandler,\n\tRemoteLiveSource,\n} from \"./types.ts\";\n\nlet running_remote_effect_handlers = 0;\n\n/**\n * Reports whether SER is currently executing user remote handler code.\n *\n * @example\n * ```ts\n * if (is_running_remote_effect_handler()) {\n * return query();\n * }\n * ```\n *\n * @since 2.0.0\n * @returns Whether a remote handler wrapper is currently active.\n * @internal\n */\nexport function is_running_remote_effect_handler(): boolean {\n\treturn running_remote_effect_handlers > 0;\n}\n\n/**\n * Builds the wrapper passed to native query, command, and prerender helpers.\n *\n * @since 2.0.0\n * @param handler - Effect handler or already-built Effect-like value.\n * @param helper_name - Remote helper name for error normalization.\n * @returns Native SvelteKit handler wrapper.\n */\nexport function make_remote_wrapper(\n\thandler: RemoteHandler<unknown, unknown, unknown, unknown> | EffectLike,\n\thelper_name: string,\n): (input: unknown) => Promise<unknown> {\n\treturn async (input: unknown) => {\n\t\tlet event: RequestEvent;\n\n\t\ttry {\n\t\t\tevent = get_native_request_event() as unknown as RequestEvent;\n\t\t} catch (error: unknown) {\n\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t}\n\n\t\treturn await run_inside_remote_effect_handler(() => {\n\t\t\ttry {\n\t\t\t\tconst result = is_handler(handler) ? handler(input) : handler;\n\n\t\t\t\treturn run_handler_effect(result, event);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Builds the wrapper passed to native live query helpers.\n *\n * @since 2.0.0\n * @param handler - Effect-aware live source handler.\n * @param helper_name - Remote helper name for error normalization.\n * @returns Native SvelteKit live query wrapper.\n */\nexport function make_remote_live_wrapper<Input, A>(\n\thandler: RemoteLiveSource<A, unknown, unknown> | RemoteLiveHandler<Input, A, unknown, unknown>,\n\thelper_name: string,\n): (input: unknown) => Promise<unknown> {\n\treturn async (input: unknown) => {\n\t\tlet event: RequestEvent;\n\n\t\ttry {\n\t\t\tevent = get_native_request_event() as unknown as RequestEvent;\n\t\t} catch (error: unknown) {\n\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t}\n\n\t\treturn await run_inside_remote_effect_handler(() => {\n\t\t\ttry {\n\t\t\t\tconst result = typeof handler === \"function\" ? handler(input as Input) : handler;\n\n\t\t\t\treturn run_live_handler_source(result, event);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Builds the wrapper passed to native form helpers.\n *\n * @since 2.0.0\n * @param handler - Effect-aware form handler.\n * @param helper_name - Remote helper name for error normalization.\n * @returns Native SvelteKit form handler wrapper.\n */\nexport function make_remote_form_wrapper<Input, A>(\n\thandler: RemoteFormHandler<Input, A, unknown, unknown>,\n\thelper_name: string,\n): (data: unknown, issue: unknown) => Promise<unknown> {\n\treturn async (data: unknown, issue: unknown) => {\n\t\tlet event: RequestEvent;\n\n\t\ttry {\n\t\t\tevent = get_native_request_event() as unknown as RequestEvent;\n\t\t} catch (error: unknown) {\n\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t}\n\n\t\treturn await run_inside_remote_effect_handler(() => {\n\t\t\tconst invalid_proxy = make_invalid_proxy<Input>();\n\n\t\t\ttry {\n\t\t\t\tconst result = handler({\n\t\t\t\t\tdata: data as Input,\n\t\t\t\t\tinvalid: invalid_proxy,\n\t\t\t\t\tissue,\n\t\t\t\t});\n\n\t\t\t\treturn run_handler_effect(result, event);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t\t}\n\t\t});\n\t};\n}\n\nasync function run_inside_remote_effect_handler<A>(run: () => Promise<A>): Promise<A> {\n\trunning_remote_effect_handlers += 1;\n\n\ttry {\n\t\treturn await run();\n\t} finally {\n\t\trunning_remote_effect_handlers -= 1;\n\t}\n}\n","import {\n\tBatchQueryHandlerMissingError,\n\tUncheckedCommandHandlerMissingError,\n\tUncheckedFormHandlerMissingError,\n\tUncheckedLiveQueryHandlerMissingError,\n\tUncheckedPrerenderHandlerMissingError,\n\tUncheckedQueryHandlerMissingError,\n} from \"$/errors.ts\";\nimport { copy_property_descriptors } from \"$/internal/descriptors.ts\";\nimport { normalize_remote_helper_error } from \"$/remote/server.ts\";\nimport {\n\tcommand as native_command,\n\tform as native_form,\n\tgetRequestEvent as get_native_request_event,\n\tprerender as native_prerender,\n\tquery as native_query,\n} from \"$app/server\";\nimport type { RemoteFormInput } from \"@sveltejs/kit\";\nimport { make_remote_live_stream } from \"$/live.ts\";\nimport { create_remote_transport_error } from \"$/remote/shared.ts\";\nimport { Effect, type Schema } from \"effect\";\n\nimport { is_handler, is_unchecked, normalize_validator } from \"./schema.ts\";\nimport {\n\tis_running_remote_effect_handler,\n\tmake_remote_form_wrapper,\n\tmake_remote_live_wrapper,\n\tmake_remote_wrapper,\n} from \"./wrappers.ts\";\nimport type {\n\tEffectLike,\n\tEffectRemoteBatchHandler,\n\tEffectRemoteCommand,\n\tEffectRemoteForm,\n\tEffectRemoteFunction,\n\tEffectRemoteLiveQuery,\n\tEffectRemoteLiveQueryFunction,\n\tEffectRemoteQuery,\n\tEffectRemoteQueryFunction,\n\tPrerenderOptions,\n\tQueryFactory,\n\tRemoteFormHandler,\n\tRemoteHandler,\n\tRemoteLiveHandler,\n\tRemoteLiveSource,\n\tSchemaEncodedInput,\n\tSchemaInput,\n\tStandardSchema,\n\tStandardSchemaInput,\n\tStandardSchemaOutput,\n} from \"./types.ts\";\n\ntype FormSchemaEncodedInput<S> = S extends Schema.Top ? FormRemoteInput<S[\"Encoded\"]> : never;\n\ntype FormRemoteInput<Input> =\n\tNormalizeFormEncoded<Input> extends RemoteFormInput ? NormalizeFormEncoded<Input> : never;\n\ntype FormStandardSchemaInput<S> =\n\tStandardSchemaInput<S> extends RemoteFormInput ? StandardSchemaInput<S> : RemoteFormInput;\n\ntype FormScalar = string | number | boolean | File;\n\ntype NormalizeFormEncoded<Value> = Value extends FormScalar\n\t? Value\n\t: Value extends ReadonlyArray<infer Item>\n\t\t? Array<NormalizeFormEncoded<Item>>\n\t\t: Value extends object\n\t\t\t? NormalizeFormObject<Value>\n\t\t\t: Value;\n\ntype NormalizeFormObject<Value> = {\n\treadonly [Key in keyof Value]: Key extends OptionalFormKeys<Value>\n\t\t? NormalizeFormEncoded<Exclude<Value[Key], undefined>>\n\t\t: NormalizeFormEncoded<Value[Key]>;\n};\n\ntype OptionalFormKeys<Value> = {\n\t[Key in keyof Value]-?: Record<PropertyKey, never> extends Pick<Value, Key> ? Key : never;\n}[keyof Value];\n\ntype NativeQueryLike<Input = unknown> = (input: Input) => unknown;\n\ntype EffectRemoteResource<Output, ErrorType = never> = EffectRemoteQuery<Output, ErrorType>;\n\ntype CurrentRemoteRequestDetection =\n\t| {\n\t\t\treadonly _tag: \"CurrentRemoteRequest\";\n\t\t\treadonly event: {\n\t\t\t\treadonly isRemoteRequest?: boolean;\n\t\t\t};\n\t }\n\t| {\n\t\t\treadonly _tag: \"NoCurrentRemoteRequest\";\n\t };\n\nconst request_event_context_error_start =\n\t\"Can only read the current request event inside functions invoked during `handle`\";\n\nconst request_store_context_error = \"Could not get the request store.\";\n\nfunction to_effect_query<Input, Output, ErrorType = never>(\n\tnative: NativeQueryLike<Input>,\n): EffectRemoteQueryFunction<Input, Output, ErrorType> {\n\tconst wrapped = ((input: Input) => {\n\t\tif (is_current_remote_request()) {\n\t\t\treturn (native as (input: Input) => unknown)(input);\n\t\t}\n\n\t\tconst resource = (native as (input: Input) => unknown)(input);\n\t\tconst effect = Effect.tryPromise({\n\t\t\ttry: () => Promise.resolve(resource),\n\t\t\tcatch: (error: unknown) => error,\n\t\t}) as unknown as EffectRemoteQuery<Output, ErrorType>;\n\n\t\tattach_query_resource_methods(resource, effect);\n\n\t\treturn effect;\n\t}) as unknown as EffectRemoteQueryFunction<Input, Output, ErrorType>;\n\n\tcopy_property_descriptors(native, wrapped);\n\n\treturn wrapped;\n}\n\nfunction is_current_remote_request(): boolean {\n\tif (is_running_remote_effect_handler()) {\n\t\treturn false;\n\t}\n\n\tconst detection = detect_current_remote_request();\n\n\tif (detection._tag === \"NoCurrentRemoteRequest\") {\n\t\treturn false;\n\t}\n\n\treturn detection.event.isRemoteRequest === true;\n}\n\nfunction detect_current_remote_request(): CurrentRemoteRequestDetection {\n\ttry {\n\t\tconst event = get_native_request_event() as { isRemoteRequest?: boolean };\n\n\t\treturn {\n\t\t\t_tag: \"CurrentRemoteRequest\",\n\t\t\tevent,\n\t\t};\n\t} catch (error: unknown) {\n\t\tif (is_request_event_context_error(error)) {\n\t\t\treturn { _tag: \"NoCurrentRemoteRequest\" };\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\nfunction is_request_event_context_error(error: unknown): error is Error {\n\tif (!(error instanceof Error)) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\terror.message.startsWith(request_event_context_error_start) ||\n\t\terror.message === request_store_context_error\n\t);\n}\n\nfunction to_effect_live_query<Input, Output, ErrorType = never>(\n\tnative: NativeQueryLike<Input>,\n): EffectRemoteLiveQueryFunction<Input, Output, ErrorType> {\n\tconst wrapped = ((input: Input) => {\n\t\tconst resource = (native as (input: Input) => unknown)(input);\n\n\t\treturn make_remote_live_stream<Output, ErrorType>(\n\t\t\tresource,\n\t\t\tcreate_remote_transport_error,\n\t\t) as EffectRemoteLiveQuery<Output, ErrorType>;\n\t}) as unknown as EffectRemoteLiveQueryFunction<Input, Output, ErrorType>;\n\n\tcopy_property_descriptors(native, wrapped);\n\n\treturn wrapped;\n}\n\ntype NativeRemoteResource<Output> = {\n\treadonly current?: Output;\n\treadonly error?: unknown;\n\treadonly loading?: boolean;\n\treadonly ready?: boolean;\n};\n\ntype NativeQueryResource<Output> = NativeRemoteResource<Output> & {\n\treadonly refresh?: () => Promise<void>;\n\treadonly set?: (value: Output) => void;\n\treadonly withOverride?: (update: (current: Output) => Output) => unknown;\n};\n\nfunction is_query_resource<Output>(resource: unknown): resource is NativeQueryResource<Output> {\n\tconst resource_type = typeof resource;\n\n\treturn (resource_type === \"object\" && resource !== null) || resource_type === \"function\";\n}\n\nfunction attach_remote_resource_getters<Output, ErrorType = never>(\n\tresource: unknown,\n\teffect: EffectRemoteResource<Output, ErrorType>,\n): void {\n\tconst methods = is_query_resource<Output>(resource) ? resource : undefined;\n\tconst keys = [\"current\", \"error\", \"loading\", \"ready\"] as const;\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tfor (const key of keys) {\n\t\tif (!(key in methods)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tObject.defineProperty(effect, key, {\n\t\t\tconfigurable: true,\n\t\t\tget: () => methods[key],\n\t\t});\n\t}\n}\n\nfunction attach_query_resource_methods<Output, ErrorType = never>(\n\tresource: unknown,\n\teffect: EffectRemoteQuery<Output, ErrorType>,\n): void {\n\tconst methods = is_query_resource<Output>(resource) ? resource : undefined;\n\tconst refresh = methods?.refresh;\n\tconst set = methods?.set;\n\tconst with_override = methods?.withOverride;\n\n\tattach_remote_resource_getters(resource, effect);\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tif (typeof refresh === \"function\") {\n\t\tObject.defineProperty(effect, \"refresh\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () =>\n\t\t\t\tEffect.tryPromise({\n\t\t\t\t\ttry: () => Promise.resolve(refresh.call(resource)),\n\t\t\t\t\tcatch: (error: unknown) => error,\n\t\t\t\t}),\n\t\t});\n\t}\n\n\tif (typeof set === \"function\") {\n\t\tObject.defineProperty(effect, \"set\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: (value: Output) => set.call(resource, value),\n\t\t});\n\t}\n\n\tif (typeof with_override === \"function\") {\n\t\tObject.defineProperty(effect, \"withOverride\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: (update: (current: Output) => Output) => with_override.call(resource, update),\n\t\t});\n\t}\n}\n\n/**\n * Factory for a read-only remote query function.\n *\n * @example\n * ```ts\n * export const getUser = Query(Schema.Struct({ id: Schema.String }), (input) =>\n * Effect.succeed(input.id)\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit query function.\n */\nfunction QueryRoot<A, E = never, R = never>(\n\tvalidate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n): EffectRemoteQueryFunction<void, A, E>;\nfunction QueryRoot<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteHandler<Input, A, E, R>,\n): EffectRemoteQueryFunction<Input, A, E>;\nfunction QueryRoot<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryRoot<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryRoot(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (maybe_handler) {\n\t\t\treturn to_effect_query(\n\t\t\t\tnative_query(\n\t\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\t\tmake_remote_wrapper(maybe_handler as RemoteHandler, \"Query\") as never,\n\t\t\t\t) as ReturnType<typeof native_query>,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedQueryHandlerMissingError();\n\t\t}\n\n\t\treturn to_effect_query(\n\t\t\tnative_query(\n\t\t\t\tmake_remote_wrapper(validate_or_handler as RemoteHandler, \"Query\") as never,\n\t\t\t) as ReturnType<typeof native_query>,\n\t\t);\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Query\");\n\t}\n}\n\n/**\n * Factory for a batched read-only remote query function.\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema or `\"unchecked\"` sentinel.\n * @param maybe_handler - Handler receiving validated inputs as one batch.\n * @returns A SvelteKit batch query function.\n */\nfunction QueryBatch<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: EffectRemoteBatchHandler<Input, A, E, R>,\n): EffectRemoteQueryFunction<Input, A, E>;\nfunction QueryBatch<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: EffectRemoteBatchHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryBatch<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: EffectRemoteBatchHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryBatch(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (!maybe_handler) {\n\t\t\tthrow new BatchQueryHandlerMissingError();\n\t\t}\n\n\t\treturn to_effect_query(\n\t\t\tnative_query.batch(\n\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\tmake_remote_wrapper(maybe_handler as RemoteHandler, \"Query.batch\") as never,\n\t\t\t) as NativeQueryLike,\n\t\t);\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Query.batch\");\n\t}\n}\n\n/**\n * Factory for a live remote query function.\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg live handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit live query function.\n */\nfunction QueryLive<A, E = never, R = never>(\n\tvalidate_or_handler: RemoteLiveSource<A, E, R> | RemoteLiveHandler<void, A, E, R>,\n): EffectRemoteLiveQueryFunction<void, A, E>;\nfunction QueryLive<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteLiveHandler<Input, A, E, R>,\n): EffectRemoteLiveQueryFunction<Input, A, E>;\nfunction QueryLive<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteLiveHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteLiveQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryLive<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteLiveHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteLiveQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryLive(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (maybe_handler) {\n\t\t\treturn to_effect_live_query(\n\t\t\t\tnative_query.live(\n\t\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\t\tmake_remote_live_wrapper(\n\t\t\t\t\t\tmaybe_handler as RemoteLiveHandler,\n\t\t\t\t\t\t\"Query.live\",\n\t\t\t\t\t) as never,\n\t\t\t\t) as NativeQueryLike,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedLiveQueryHandlerMissingError();\n\t\t}\n\n\t\treturn to_effect_live_query(\n\t\t\tnative_query.live(\n\t\t\t\tmake_remote_live_wrapper(\n\t\t\t\t\tvalidate_or_handler as RemoteLiveHandler,\n\t\t\t\t\t\"Query.live\",\n\t\t\t\t) as never,\n\t\t\t) as NativeQueryLike,\n\t\t);\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Query.live\");\n\t}\n}\n\n/**\n * Factory for read-only remote query functions.\n *\n * @example\n * ```ts\n * export const getUser = Query(Schema.Struct({ id: Schema.String }), (input) =>\n * Effect.succeed(input.id)\n * );\n *\n * export const getUserBatch = Query.batch(Schema.String, (ids) =>\n * Effect.succeed((id) => ids.includes(id))\n * );\n * ```\n *\n * @since 2.0.0\n */\nexport const Query: QueryFactory = Object.assign(QueryRoot, {\n\tbatch: QueryBatch,\n\tlive: QueryLive,\n});\n\n/**\n * Creates a write-oriented remote command from a no-argument Effect handler.\n *\n * @example\n * ```ts\n * export const RebuildCache = Command(() => Effect.succeed(\"done\"));\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - Effect value or no-argument handler to run on\n * the server when the command is invoked.\n * @returns A command function that yields an Effect when called.\n */\nexport function Command<A, E = never, R = never>(\n\tvalidate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n): EffectRemoteCommand<void, A, E>;\n\n/**\n * Creates a write-oriented remote command with unchecked input.\n *\n * @example\n * ```ts\n * export const SaveDraft = Command(\"unchecked\", (input: { id: string }) =>\n * Effect.succeed(input.id)\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - `\"unchecked\"` sentinel that skips runtime input\n * validation.\n * @param maybe_handler - Handler that receives the caller-provided input.\n * @returns A command function that yields an Effect when called with input.\n */\nexport function Command<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteHandler<Input, A, E, R>,\n): EffectRemoteCommand<Input, A, E>;\n\n/**\n * Creates a write-oriented remote command validated with an Effect Schema.\n *\n * @example\n * ```ts\n * export const SaveUser = Command(Schema.Struct({ id: Schema.String }), ({ id }) =>\n * Effect.succeed({ id, saved: true })\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - Effect Schema used to decode and validate\n * caller input before the handler runs.\n * @param maybe_handler - Handler that receives the decoded schema output.\n * @returns A command function whose caller input is the schema encoded type.\n */\nexport function Command<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteCommand<SchemaEncodedInput<S>, A, E>;\n\n/**\n * Creates a write-oriented remote command validated with a Standard Schema.\n *\n * @example\n * ```ts\n * export const Toggle = Command(standard_schema, (input) =>\n * Effect.succeed(input.enabled)\n * );\n * ```\n *\n * @since 3.0.0\n * @param validate_or_handler - Standard Schema used to validate caller input\n * before the handler runs.\n * @param maybe_handler - Handler that receives the decoded schema output.\n * @returns A command function whose caller input is the schema input type.\n */\nexport function Command<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteCommand<StandardSchemaInput<S>, A, E>;\nexport function Command(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (maybe_handler) {\n\t\t\treturn native_command(\n\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\tmake_remote_wrapper(maybe_handler as RemoteHandler, \"Command\") as never,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedCommandHandlerMissingError();\n\t\t}\n\n\t\treturn native_command(\n\t\t\tmake_remote_wrapper(validate_or_handler as RemoteHandler, \"Command\") as never,\n\t\t) as ReturnType<typeof native_command>;\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Command\");\n\t}\n}\n\n/**\n * Factory for a remote form handler.\n *\n * @example\n * ```ts\n * export const SignIn = Form(signInSchema, ({ data, invalid }) =>\n * Effect.gen(function* () {\n * if (!data.email.includes(\"@\")) {\n * return yield* invalid.email(\"Use an email address.\");\n * }\n *\n * return { email: data.email };\n * })\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit form function.\n */\nexport function Form<A, E = never, R = never>(\n\tvalidate_or_handler: EffectLike<A, E, R> | RemoteFormHandler<void, A, E, R>,\n): EffectRemoteForm<void, A, E>;\nexport function Form<Input extends RemoteFormInput, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteFormHandler<Input, A, E, R>,\n): EffectRemoteForm<Input, A, E>;\nexport function Form<S extends Schema.Top, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteFormHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteForm<FormSchemaEncodedInput<S>, A, E>;\nexport function Form<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteFormHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteForm<FormStandardSchemaInput<S>, A, E>;\nexport function Form(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (maybe_handler) {\n\t\t\treturn native_form(\n\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\tmake_remote_form_wrapper(maybe_handler as RemoteFormHandler, \"Form\") as never,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedFormHandlerMissingError();\n\t\t}\n\n\t\tconst inputless_handler: RemoteFormHandler<void, unknown> = ({ data, invalid, issue }) => {\n\t\t\tif (is_handler(validate_or_handler)) {\n\t\t\t\treturn validate_or_handler({ data, invalid, issue });\n\t\t\t}\n\n\t\t\treturn validate_or_handler as EffectLike;\n\t\t};\n\n\t\treturn native_form(\n\t\t\tmake_remote_form_wrapper(inputless_handler, \"Form\") as never,\n\t\t) as unknown as ReturnType<typeof native_form>;\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Form\");\n\t}\n}\n\n/**\n * Creates a prerenderable remote function from a no-argument Effect handler.\n *\n * @example\n * ```ts\n * export const GetBuildInfo = Prerender(() => Effect.succeed(\"ready\"));\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - Effect value or no-argument handler to run at\n * prerender time.\n * @param maybe_options - Optional prerender inputs and dynamic fallback\n * configuration.\n * @returns A prerender function that yields an Effect when called.\n */\nexport function Prerender<A, E = never, R = never>(\n\tvalidate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n\tmaybe_options?: PrerenderOptions,\n): EffectRemoteFunction<void, A, E>;\n\n/**\n * Creates a prerenderable remote function with unchecked input.\n *\n * @example\n * ```ts\n * export const GetPost = Prerender(\n * \"unchecked\",\n * (slug: string) => Effect.succeed({ slug }),\n * { inputs: () => [\"intro\"] },\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - `\"unchecked\"` sentinel that skips runtime input\n * validation.\n * @param maybe_handler - Handler that receives the caller-provided input.\n * @param maybe_options - Optional prerender inputs and dynamic fallback\n * configuration.\n * @returns A prerender function that yields an Effect when called with input.\n */\nexport function Prerender<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteHandler<Input, A, E, R>,\n\tmaybe_options?: PrerenderOptions,\n): EffectRemoteFunction<Input, A, E>;\n\n/**\n * Creates a prerenderable remote function validated with an Effect Schema.\n *\n * @example\n * ```ts\n * export const GetPost = Prerender(\n * Schema.String,\n * (slug) => Effect.succeed({ slug }),\n * { inputs: () => [\"intro\"] },\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - Effect Schema used to decode and validate\n * caller input before the handler runs.\n * @param maybe_handler - Handler that receives the decoded schema output.\n * @param maybe_options - Optional prerender inputs and dynamic fallback\n * configuration.\n * @returns A prerender function whose caller input is the schema encoded type.\n */\nexport function Prerender<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n\tmaybe_options?: PrerenderOptions,\n): EffectRemoteFunction<SchemaEncodedInput<S>, A, E>;\n\n/**\n * Creates a prerenderable remote function validated with a Standard Schema.\n *\n * @example\n * ```ts\n * export const GetPost = Prerender(\n * standard_schema,\n * (post) => Effect.succeed(post.slug),\n * { dynamic: true },\n * );\n * ```\n *\n * @since 3.0.0\n * @param validate_or_handler - Standard Schema used to validate caller input\n * before the handler runs.\n * @param maybe_handler - Handler that receives the decoded schema output.\n * @param maybe_options - Optional prerender inputs and dynamic fallback\n * configuration.\n * @returns A prerender function whose caller input is the schema input type.\n */\nexport function Prerender<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n\tmaybe_options?: PrerenderOptions,\n): EffectRemoteFunction<StandardSchemaInput<S>, A, E>;\nexport function Prerender(\n\tvalidate_or_handler: unknown,\n\tmaybe_handler_or_options?: unknown,\n\tmaybe_options?: PrerenderOptions,\n): unknown {\n\ttry {\n\t\tif (is_handler(maybe_handler_or_options)) {\n\t\t\treturn native_prerender(\n\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\tmake_remote_wrapper(maybe_handler_or_options, \"Prerender\") as never,\n\t\t\t\tmaybe_options as never,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedPrerenderHandlerMissingError();\n\t\t}\n\n\t\treturn native_prerender(\n\t\t\tmake_remote_wrapper(validate_or_handler as RemoteHandler, \"Prerender\") as never,\n\t\t\tmaybe_handler_or_options as never,\n\t\t) as ReturnType<typeof native_prerender>;\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Prerender\");\n\t}\n}\n","import { error as svelte_error, redirect as svelte_redirect } from \"@sveltejs/kit\";\nimport { Effect } from \"effect\";\n\nconst error_status_codes = {\n\tProxyAuthenticationRequired: 407,\n\tRequestHeaderFieldsTooLarge: 431,\n\tUnavailableForLegalReasons: 451,\n\tNetworkAuthenticationRequired: 511,\n\tHttpVersionNotSupported: 505,\n\tUnprocessableContent: 422,\n\tUnprocessableEntity: 422,\n\tInternalServerError: 500,\n\tFailedDependency: 424,\n\tPreconditionRequired: 428,\n\tServiceUnavailable: 503,\n\tMisdirectedRequest: 421,\n\tInsufficientStorage: 507,\n\tVariantAlsoNegotiates: 506,\n\tPreconditionFailed: 412,\n\tMethodNotAllowed: 405,\n\tGatewayTimeout: 504,\n\tPaymentRequired: 402,\n\tUpgradeRequired: 426,\n\tTooManyRequests: 429,\n\tLengthRequired: 411,\n\tNotAcceptable: 406,\n\tRequestTimeout: 408,\n\tContentTooLarge: 413,\n\tPayloadTooLarge: 413,\n\tUriTooLong: 414,\n\tUnsupportedMediaType: 415,\n\tRangeNotSatisfiable: 416,\n\tExpectationFailed: 417,\n\tImATeapot: 418,\n\tBadRequest: 400,\n\tUnauthorized: 401,\n\tForbidden: 403,\n\tNotFound: 404,\n\tConflict: 409,\n\tGone: 410,\n\tLocked: 423,\n\tTooEarly: 425,\n\tNotImplemented: 501,\n\tBadGateway: 502,\n\tLoopDetected: 508,\n\tNotExtended: 510,\n} as const;\n\nconst redirect_status_codes = {\n\tMovedPermanently: 301,\n\tTemporaryRedirect: 307,\n\tPermanentRedirect: 308,\n\tMultipleChoices: 300,\n\tNotModified: 304,\n\tSwitchProxy: 306,\n\tSeeOther: 303,\n\tUseProxy: 305,\n\tFound: 302,\n} as const;\n\ntype AppErrorStatus = App.Error extends { readonly status?: infer Status } ? Status : number;\n\n/**\n * Compatibility shim while SER supports both SvelteKit 2 and 3. The wrappers\n * call the SvelteKit 3 control-flow shapes, while SvelteKit 2 ignores extra\n * runtime arguments. Drop these broad call signatures when Kit 2 support is\n * removed.\n */\ntype SvelteError = (status: number, body?: ErrorBody, properties?: ErrorProperties) => never;\n\ntype SvelteRedirect = (status: number, location: string | URL, options?: RedirectOptions) => never;\n\n/**\n * Named HTTP status accepted by the {@link Error} helper.\n *\n * @example\n * ```ts\n * const status: ErrorStatusName = \"NotFound\";\n * ```\n *\n * @since 2.3.0\n */\nexport type ErrorStatusName = keyof typeof error_status_codes;\n\n/**\n * Numeric or named HTTP status accepted by the {@link Error} helper.\n *\n * @example\n * ```ts\n * const status: ErrorStatus = \"InternalServerError\";\n * ```\n *\n * @since 2.3.0\n */\nexport type ErrorStatus = ErrorStatusName | number;\n\n/**\n * Error body accepted by the {@link Error} helper.\n *\n * @example\n * ```ts\n * const body: ErrorBody = { message: \"Post not found\" };\n * ```\n *\n * @since 3.4.3\n */\nexport type ErrorBody =\n\t| (Omit<App.Error, \"status\"> & { readonly status?: AppErrorStatus })\n\t| string\n\t| undefined;\n\n/**\n * Extra SvelteKit app error properties accepted by the {@link Error} helper\n * when using the SvelteKit 3 string-body overload.\n *\n * @example\n * ```ts\n * const properties: ErrorProperties = { code: \"POST_NOT_FOUND\" };\n * ```\n *\n * @since 3.4.3\n */\nexport type ErrorProperties = Omit<App.Error, \"status\" | \"message\">;\n\n/**\n * Named HTTP status accepted by the {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const status: RedirectStatusName = \"TemporaryRedirect\";\n * ```\n *\n * @since 2.3.0\n */\nexport type RedirectStatusName = keyof typeof redirect_status_codes;\n\n/**\n * Numeric or named HTTP status accepted by the {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const status: RedirectStatus = \"SeeOther\";\n * ```\n *\n * @since 2.3.0\n */\nexport type RedirectStatus = RedirectStatusName | number;\n\n/**\n * Options accepted by the {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const options: RedirectOptions = { external: true };\n * ```\n *\n * @since 3.4.3\n */\nexport type RedirectOptions = {\n\treadonly external?: boolean | string[];\n};\n\n/**\n * Callable shape for the exported {@link Error} helper.\n *\n * @example\n * ```ts\n * const fail_not_found: ErrorEffectFactory = Error;\n * ```\n *\n * @since 2.3.0\n */\nexport interface ErrorEffectFactory {\n\t/**\n\t * Creates an Effect that throws SvelteKit's HTTP error control-flow value.\n\t *\n\t * @example\n\t * ```ts\n\t * return yield* Error(\"NotFound\", \"Post not found\");\n\t * ```\n\t *\n\t * @since 2.3.0\n\t * @param status - Numeric HTTP status or PascalCase status name to pass to\n\t * SvelteKit's `error` helper.\n\t * @param body - Optional SvelteKit error body or message forwarded unchanged\n\t * to SvelteKit.\n\t * @returns An Effect that never succeeds because SvelteKit takes over request\n\t * control flow.\n\t */\n\t(status: ErrorStatus, body?: ErrorBody): Effect.Effect<never, never, never>;\n\n\t/**\n\t * Creates an Effect that throws SvelteKit's HTTP error control-flow value\n\t * using the SvelteKit 3 string-body overload with extra properties.\n\t *\n\t * @example\n\t * ```ts\n\t * return yield* Error(\"NotFound\", \"Post not found\", {\n\t * code: \"POST_NOT_FOUND\",\n\t * });\n\t * ```\n\t *\n\t * @since 3.4.3\n\t * @param status - Numeric HTTP status or PascalCase status name to pass to\n\t * SvelteKit's `error` helper.\n\t * @param body - Error message forwarded to SvelteKit.\n\t * @param properties - Additional app error properties forwarded to\n\t * SvelteKit.\n\t * @returns An Effect that never succeeds because SvelteKit takes over request\n\t * control flow.\n\t */\n\t(\n\t\tstatus: ErrorStatus,\n\t\tbody: string,\n\t\tproperties: ErrorProperties,\n\t): Effect.Effect<never, never, never>;\n}\n\n/**\n * Callable shape for the exported {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const redirect_after_save: RedirectEffectFactory = Redirect;\n * ```\n *\n * @since 2.3.0\n */\nexport interface RedirectEffectFactory {\n\t/**\n\t * Creates an Effect that throws SvelteKit's redirect control-flow value.\n\t *\n\t * @example\n\t * ```ts\n\t * return yield* Redirect(\"SeeOther\", \"/posts\");\n\t * ```\n\t *\n\t * @since 2.3.0\n\t * @param status - Numeric redirect status or PascalCase status name to pass\n\t * to SvelteKit's `redirect` helper.\n\t * @param location - Target URL forwarded unchanged to SvelteKit.\n\t * @param options - Optional SvelteKit redirect options. In SvelteKit 3, pass\n\t * `{ external: true }` or an allowlist to redirect to external URLs.\n\t * @returns An Effect that never succeeds because SvelteKit takes over request\n\t * control flow.\n\t */\n\t(\n\t\tstatus: RedirectStatus,\n\t\tlocation: string | URL,\n\t\toptions?: RedirectOptions,\n\t): Effect.Effect<never, never, never>;\n}\n\n/**\n * Creates an Effect that raises SvelteKit's HTTP error control flow.\n *\n * @example\n * ```ts\n * return yield* Error(\"NotFound\", \"Post not found\");\n * ```\n *\n * @since 2.3.0\n * @param status - Numeric HTTP status or PascalCase status name to pass to\n * SvelteKit's `error` helper.\n * @param body - Optional SvelteKit error body or message forwarded unchanged\n * to SvelteKit.\n * @param properties - Optional SvelteKit 3 app error properties forwarded when\n * using a string error message.\n * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\nexport const Error: ErrorEffectFactory = ((\n\tstatus: ErrorStatus,\n\tbody?: ErrorBody,\n\tproperties?: ErrorProperties,\n) => {\n\tconst resolved_status = resolve_error_status(status);\n\tconst error = svelte_error as SvelteError;\n\n\treturn Effect.sync((): never => {\n\t\tif (properties === undefined) {\n\t\t\treturn error(resolved_status, body);\n\t\t}\n\n\t\treturn error(resolved_status, body, properties);\n\t});\n}) as ErrorEffectFactory;\n\n/**\n * Creates an Effect that raises SvelteKit's redirect control flow.\n *\n * @example\n * ```ts\n * return yield* Redirect(\"SeeOther\", \"/posts\");\n * ```\n *\n * @since 2.3.0\n * @param status - Numeric redirect status or PascalCase status name to pass to\n * SvelteKit's `redirect` helper.\n * @param location - Target URL forwarded unchanged to SvelteKit.\n * @param options - Optional SvelteKit redirect options. In SvelteKit 3, pass\n * `{ external: true }` or an allowlist to redirect to external URLs.\n * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\nexport const Redirect: RedirectEffectFactory = ((\n\tstatus: RedirectStatus,\n\tlocation: string | URL,\n\toptions?: RedirectOptions,\n) => {\n\tconst resolved_status = resolve_redirect_status(status);\n\tconst redirect = svelte_redirect as SvelteRedirect;\n\n\treturn Effect.sync((): never => redirect(resolved_status, location, options));\n}) as RedirectEffectFactory;\n\nfunction resolve_error_status(status: ErrorStatus): number {\n\tif (typeof status === \"number\") {\n\t\treturn status;\n\t}\n\n\treturn error_status_codes[status];\n}\n\nfunction resolve_redirect_status(status: RedirectStatus): number {\n\tif (typeof status === \"number\") {\n\t\treturn status;\n\t}\n\n\treturn redirect_status_codes[status];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAWA,SAAgB,aAAa,OAAsC;CAClE,OAAO,UAAU;AAClB;;;;;;;;AASA,SAAgB,WACf,OAC6D;CAC7D,OAAO,OAAO,UAAU;AACzB;;;;;;;;AASA,SAAgB,mBAAmB,OAAyC;CAC3E,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,eAAe;AACtE;;;;;;;;AASA,SAAgB,iBAAiB,OAAiD;CACjF,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,SAAS,SAAS,UAAU;AACnF;;;;;;;;AASA,SAAgB,oBAAoB,OAAyB;CAC5D,IAAI,mBAAmB,KAAK,KAAK,CAAC,iBAAiB,KAAK,GACvD,OAAO;CAGR,OAAO,OAAO,mBAAmB,KAAc;AAChD;;;;;;;;;;AC1CA,SAAgB,oBACf,OACkD;CAClD,OACC,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAA6B,SAAS;AAEhD;;;;;;;;AASA,SAAgB,SAAkB,OAAoD;CACrF,IAAI,oBAAuB,KAAK,GAC/B,OAAO,OAAO,UAAU,KAAK;CAG9B,OAAO;AACR;;;;;;;;AAwBA,SAAgB,eAAkB,OAA6D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UAAU;CACV,gBAAgB;CAChB,YAAY;CACZ,cAAc;CACd,aAAa;AACd;AAEA,MAAM,wBAAwB;CAC7B,kBAAkB;CAClB,mBAAmB;CACnB,mBAAmB;CACnB,iBAAiB;CACjB,aAAa;CACb,aAAa;CACb,UAAU;CACV,UAAU;CACV,OAAO;AACR;;;;;;;;;;;;;;;;;;;AAqNA,MAAaC,YACZ,QACA,MACA,eACI;CACJ,MAAM,kBAAkB,qBAAqB,MAAM;CACnD,MAAMC,UAAQC;CAEd,OAAO,OAAO,WAAkB;EAC/B,IAAI,eAAe,KAAA,GAClB,OAAOD,QAAM,iBAAiB,IAAI;EAGnC,OAAOA,QAAM,iBAAiB,MAAM,UAAU;CAC/C,CAAC;AACF;;;;;;;;;;;;;;;;;;AAmBA,MAAa,aACZ,QACA,UACA,YACI;CACJ,MAAM,kBAAkB,wBAAwB,MAAM;CACtD,MAAME,aAAWC;CAEjB,OAAO,OAAO,WAAkBD,WAAS,iBAAiB,UAAU,OAAO,CAAC;AAC7E;AAEA,SAAS,qBAAqB,QAA6B;CAC1D,IAAI,OAAO,WAAW,UACrB,OAAO;CAGR,OAAO,mBAAmB;AAC3B;AAEA,SAAS,wBAAwB,QAAgC;CAChE,IAAI,OAAO,WAAW,UACrB,OAAO;CAGR,OAAO,sBAAsB;AAC9B"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { EmptyStreamYieldError } from "./errors.js";
|
|
2
|
+
import { Effect, Stream } from "effect";
|
|
3
|
+
/**
|
|
4
|
+
* Values generated `yield*` positions can normalize into an Effect.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const value: Yieldable<number> = Stream.make(1);
|
|
9
|
+
* ```
|
|
10
|
+
*
|
|
11
|
+
* @since 3.4.8
|
|
12
|
+
*/
|
|
13
|
+
export type Yieldable<A = unknown, E = unknown, R = unknown> = Effect.Effect<A, E, R> | Effect.gen.Return<A, E, R> | Stream.Stream<A, E, R>;
|
|
14
|
+
/**
|
|
15
|
+
* Success type produced when generated code yields an Effect or a Stream.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```ts
|
|
19
|
+
* type User = YieldSuccess<ReturnType<typeof loadUser>>;
|
|
20
|
+
* ```
|
|
21
|
+
*
|
|
22
|
+
* @since 3.4.8
|
|
23
|
+
*/
|
|
24
|
+
export type YieldSuccess<Value> = Value extends Stream.Stream<infer A, unknown, unknown> ? A : Value extends Effect.Effect<infer A, unknown, unknown> ? A : Value extends Effect.gen.Return<infer A, unknown, unknown> ? A : never;
|
|
25
|
+
/**
|
|
26
|
+
* Normalizes generated `yield*` operands into Effects.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const first = yield* ToEffect(Stream.make("ready"));
|
|
31
|
+
* ```
|
|
32
|
+
*
|
|
33
|
+
* @since 3.4.8
|
|
34
|
+
* @param value - Effect, generator return object, or Stream emitted from a
|
|
35
|
+
* lowered component `yield*` expression.
|
|
36
|
+
* @returns An Effect that resolves with the original Effect success value or
|
|
37
|
+
* the first Stream emission.
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export declare function ToEffect<A, E, R>(value: Effect.Effect<A, E, R> | Effect.gen.Return<A, E, R>): Effect.Effect<A, E, R>;
|
|
41
|
+
export declare function ToEffect<A, E, R>(value: Stream.Stream<A, E, R>): Effect.Effect<A, E | EmptyStreamYieldError, R>;
|