svelte-effect-runtime 3.3.1 → 3.4.0

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.
Files changed (62) hide show
  1. package/.dist/chunks/{client-BYhNKK1i.js → client-i7LwWCpT.js} +3 -3
  2. package/.dist/chunks/client-i7LwWCpT.js.map +1 -0
  3. package/.dist/chunks/descriptors-OS4VfJuW.js.map +1 -1
  4. package/.dist/chunks/{dispatcher-5WSjtyXR.js → dispatcher-BX6J0tQV.js} +3 -3
  5. package/.dist/chunks/dispatcher-BX6J0tQV.js.map +1 -0
  6. package/.dist/chunks/{dispatcher-BnitG7p3.js → dispatcher-D9PG87PW.js} +3 -2
  7. package/.dist/chunks/dispatcher-D9PG87PW.js.map +1 -0
  8. package/.dist/chunks/{errors-DppSJ83S.js → errors-Buz9cLGF.js} +55 -2
  9. package/.dist/chunks/errors-Buz9cLGF.js.map +1 -0
  10. package/.dist/chunks/{runtime-CPbQxe4W.js → runtime-L7xbXCiW.js} +4 -4
  11. package/.dist/chunks/runtime-L7xbXCiW.js.map +1 -0
  12. package/.dist/chunks/{transform-DHUCirwV.js → transform-B5T5TUcJ.js} +132 -43
  13. package/.dist/chunks/transform-B5T5TUcJ.js.map +1 -0
  14. package/.dist/chunks/vite-DiAwz7jc.js +465 -0
  15. package/.dist/chunks/vite-DiAwz7jc.js.map +1 -0
  16. package/.dist/detect.js.map +1 -1
  17. package/.dist/diagnostics.d.ts +21 -0
  18. package/.dist/dispatcher.js +1 -1
  19. package/.dist/errors.d.ts +39 -0
  20. package/.dist/internal/generators.js +2 -2
  21. package/.dist/internal/remote-client.js +1 -1
  22. package/.dist/markup/promise.js +1 -1
  23. package/.dist/markup/promise.js.map +1 -1
  24. package/.dist/markup/run.js +1 -1
  25. package/.dist/markup/run.js.map +1 -1
  26. package/.dist/markup/transform/emit.d.ts +2 -2
  27. package/.dist/markup/transform.js +1 -1
  28. package/.dist/markup/value.js +1 -1
  29. package/.dist/markup/value.js.map +1 -1
  30. package/.dist/mod.d.ts +1 -2
  31. package/.dist/mod.js +4 -5
  32. package/.dist/mod.js.map +1 -1
  33. package/.dist/remote/client.js +1 -1
  34. package/.dist/remote/server.js +1 -1
  35. package/.dist/remote/server.js.map +1 -1
  36. package/.dist/remote/shared.js.map +1 -1
  37. package/.dist/runtime/transform.js +45 -230
  38. package/.dist/runtime/transform.js.map +1 -1
  39. package/.dist/script-transform/index.d.ts +3 -3
  40. package/.dist/script-transform/runes.d.ts +0 -12
  41. package/.dist/script-transform/types.d.ts +1 -1
  42. package/.dist/server/index.d.ts +1 -0
  43. package/.dist/server/runtime.d.ts +13 -0
  44. package/.dist/server.js +2 -2
  45. package/.dist/server.js.map +1 -1
  46. package/.dist/vite.d.ts +3 -3
  47. package/.dist/vite.js +1 -172
  48. package/README.md +5 -5
  49. package/package.json +2 -7
  50. package/.dist/chunks/client-BYhNKK1i.js.map +0 -1
  51. package/.dist/chunks/dispatcher-5WSjtyXR.js.map +0 -1
  52. package/.dist/chunks/dispatcher-BnitG7p3.js.map +0 -1
  53. package/.dist/chunks/errors-DppSJ83S.js.map +0 -1
  54. package/.dist/chunks/grammars-i4CSRxWg.js +0 -181
  55. package/.dist/chunks/grammars-i4CSRxWg.js.map +0 -1
  56. package/.dist/chunks/runtime-CPbQxe4W.js.map +0 -1
  57. package/.dist/chunks/transform-DHUCirwV.js.map +0 -1
  58. package/.dist/grammars/textmate.d.ts +0 -105
  59. package/.dist/grammars/tree-sitter.d.ts +0 -22
  60. package/.dist/grammars.d.ts +0 -2
  61. package/.dist/grammars.js +0 -2
  62. package/.dist/vite.js.map +0 -1
@@ -68,7 +68,7 @@ export interface LoweredStatement {
68
68
  type_helpers?: string[];
69
69
  /** Whether the rewritten statement directly awaits a dispatcher promise. */
70
70
  uses_dispatcher_promise?: boolean;
71
- /** The rewritten statement text with yield* replaced by temp refs. */
71
+ /** The rewritten statement text with yield* lowered into runtime helpers. */
72
72
  rewritten_text: string;
73
73
  /** Effect bodies to emit in dependency-tracked runtime blocks. */
74
74
  effect_blocks: EffectBlock[];
@@ -1,5 +1,6 @@
1
1
  export { Command, Form, Prerender, Query } from "./factories.js";
2
2
  export { Error, Redirect } from "./control-flow.js";
3
3
  export { get_server_runtime_or_throw, RequestEvent, ServerRuntime, } from "./runtime.js";
4
+ export { RuntimeAlreadyInitializedError } from "../errors.js";
4
5
  export type { ErrorEffectFactory, ErrorStatus, ErrorStatusName, RedirectEffectFactory, RedirectStatus, RedirectStatusName, } from "./control-flow.js";
5
6
  export type { CommandFactory, EffectLike, EffectRemoteBatchHandler, EffectRemoteCommand, EffectRemoteForm, EffectRemoteFunction, EffectRemoteLiveQuery, EffectRemoteLiveQueryFunction, EffectRemoteLiveQueryResource, EffectRemoteLiveSource, EffectRemoteQuery, EffectRemoteQueryFunction, FormFactory, FormInvalid, PrerenderFactory, PrerenderOptions, QueryBatchFactory, QueryFactory, QueryLiveFactory, RemoteFormHandler, RemoteHandler, RemoteLiveHandler, SchemaEncodedInput, SchemaInput, ServerRuntimeFactory, StandardSchema, StandardSchemaInput, StandardSchemaOutput, } from "./types.js";
@@ -64,3 +64,16 @@ export declare function get_server_runtime_or_throw(): ManagedRuntime.ManagedRun
64
64
  * runtime when needed.
65
65
  */
66
66
  export declare function get_server_dispatcher(): InternalDispatcher;
67
+ /**
68
+ * Resets the internal server runtime singleton used by source-level tests.
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * reset_server_runtime();
73
+ * ```
74
+ *
75
+ * @since 3.4.0
76
+ * @returns Nothing.
77
+ * @internal
78
+ */
79
+ export declare function reset_server_runtime(): void;
package/.dist/server.js CHANGED
@@ -1,8 +1,8 @@
1
- import { C as UncheckedPrerenderHandlerMissingError, S as UncheckedLiveQueryHandlerMissingError, b as UncheckedCommandHandlerMissingError, c as InvalidLiveQueryReturnError, i as BatchQueryHandlerMissingError, w as UncheckedQueryHandlerMissingError, x as UncheckedFormHandlerMissingError } from "./chunks/errors-DppSJ83S.js";
1
+ import { C as UncheckedLiveQueryHandlerMissingError, S as UncheckedFormHandlerMissingError, T as UncheckedQueryHandlerMissingError, c as InvalidLiveQueryReturnError, i as BatchQueryHandlerMissingError, w as UncheckedPrerenderHandlerMissingError, x as UncheckedCommandHandlerMissingError } from "./chunks/errors-Buz9cLGF.js";
2
2
  import { create_form_error } from "./remote/shared.js";
3
3
  import { t as copy_property_descriptors } from "./chunks/descriptors-OS4VfJuW.js";
4
4
  import { normalize_remote_helper_error, run_remote_effect } from "./remote/server.js";
5
- import { i as get_server_runtime_or_throw, n as ServerRuntime, t as RequestEvent } from "./chunks/runtime-CPbQxe4W.js";
5
+ import { i as get_server_runtime_or_throw, n as ServerRuntime, t as RequestEvent } from "./chunks/runtime-L7xbXCiW.js";
6
6
  import { Effect, Schema, Stream } from "effect";
7
7
  import { error, invalid, redirect } from "@sveltejs/kit";
8
8
  import { command, form, getRequestEvent, prerender, query } from "$app/server";
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","names":["get_native_request_event","get_native_request_event","native_query","native_command","native_form","native_prerender"],"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 return 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 value: unknown,\n): value is RemoteHandler<unknown, unknown, unknown, unknown> {\n return 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 return (\n typeof value === \"object\" &&\n value !== null &&\n \"~standard\" in value\n );\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(\n value: unknown,\n): value is Schema.Schema<unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"ast\" in value &&\n \"make\" in value\n );\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 if (is_standard_schema(value) || !is_effect_schema(value)) {\n return value;\n }\n\n return 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 } 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> =\n | AsyncIterable<A>\n | AsyncIterator<A>\n | Iterable<A>\n | Iterator<A>;\n\ntype LiveHandlerResult<A> =\n | EffectLike<EffectRemoteLiveSource<A>, unknown, unknown>\n | 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 value: unknown,\n): value is Effect.gen.Return<A, unknown, unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { next?: unknown }).next === \"function\"\n );\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 to_effect<A, E, R>(\n value: EffectLike<A, E, R>,\n): Effect.Effect<A, E, R> {\n if (is_generator_result<A>(value)) {\n return Effect.gen(() => value) as Effect.Effect<A, E, R>;\n }\n\n return value;\n}\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>(\n value: unknown,\n): value is EffectRemoteLiveSource<A> {\n if (Stream.isStream(value)) {\n return true;\n }\n\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const source = value as {\n readonly next?: unknown;\n readonly [Symbol.asyncIterator]?: unknown;\n readonly [Symbol.iterator]?: unknown;\n };\n\n return (\n typeof source.next === \"function\" ||\n typeof source[Symbol.asyncIterator] === \"function\" ||\n typeof source[Symbol.iterator] === \"function\"\n );\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 value: LiveHandlerResult<A>,\n event: RequestEventShape,\n): Promise<ResolvedLiveSource<A>> {\n const runtime = get_server_runtime_or_throw();\n const effect = Effect.provideService(\n to_live_source_effect(value),\n RequestEvent,\n event,\n ) as Effect.Effect<ResolvedLiveSource<A>, unknown, unknown>;\n\n return run_remote_effect(\n effect,\n runtime,\n svelte_invalid,\n svelte_remote_error,\n );\n}\n\nfunction to_live_source_effect<A>(\n value: LiveHandlerResult<A>,\n): Effect.Effect<ResolvedLiveSource<A>, unknown, unknown> {\n if (Stream.isStream(value)) {\n return Stream.toAsyncIterableEffect(\n value as Stream.Stream<A, unknown, unknown>,\n ) as Effect.Effect<ResolvedLiveSource<A>, unknown, unknown>;\n }\n\n if (is_native_live_source<A>(value)) {\n return Effect.succeed(value);\n }\n\n if (!Effect.isEffect(value)) {\n return Effect.fail(new InvalidLiveQueryReturnError());\n }\n\n return Effect.flatMap(\n value as Effect.Effect<EffectRemoteLiveSource<A>, unknown, unknown>,\n to_live_source_effect,\n );\n}\n\nfunction is_native_live_source<A>(\n value: unknown,\n): value is ResolvedLiveSource<A> {\n return 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 value: EffectLike<A, unknown, unknown>,\n event: RequestEventShape,\n): Promise<A> {\n const runtime = get_server_runtime_or_throw();\n const effect = Effect.provideService(\n to_effect(value),\n RequestEvent,\n event,\n ) as Effect.Effect<A, unknown, unknown>;\n\n return run_remote_effect(\n effect,\n runtime,\n svelte_invalid,\n svelte_remote_error,\n );\n}\n\nconst svelte_invalid = (_status: number, body: unknown): never => {\n const issues = typeof body === \"object\" && body !== null &&\n Array.isArray((body as { issues?: unknown }).issues)\n ? (body as { issues: unknown[] }).issues\n : [String(body)];\n\n invalid(...(issues as never[]));\n};\n\nconst svelte_remote_error = (status: number, body: unknown): never => {\n svelte_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 path: readonly (string | number)[] = [],\n): FormInvalid<Input> {\n const invalid_at_path = (message: string) =>\n Effect.fail(\n create_form_error([{ message, path: [...path] } satisfies FormIssue]),\n );\n\n return new Proxy(invalid_at_path, {\n get(_target, property) {\n if (typeof property === \"symbol\") {\n return undefined;\n }\n\n return make_invalid_proxy([...path, property]);\n },\n }) 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 EffectLike,\n RemoteFormHandler,\n RemoteHandler,\n RemoteLiveHandler,\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 return 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 handler: RemoteHandler<unknown, unknown, unknown, unknown> | EffectLike,\n helper_name: string,\n): (input: unknown) => Promise<unknown> {\n return async (input: unknown) => {\n let event: RequestEvent;\n\n try {\n event = get_native_request_event() as unknown as RequestEvent;\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, helper_name);\n }\n\n return await run_inside_remote_effect_handler(() => {\n try {\n const result = is_handler(handler) ? handler(input) : handler;\n\n return run_handler_effect(result, event);\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, helper_name);\n }\n });\n };\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 handler: RemoteLiveHandler<Input, A, unknown, unknown>,\n helper_name: string,\n): (input: unknown) => Promise<unknown> {\n return async (input: unknown) => {\n let event: RequestEvent;\n\n try {\n event = get_native_request_event() as unknown as RequestEvent;\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, helper_name);\n }\n\n return await run_inside_remote_effect_handler(() => {\n try {\n const result = typeof handler === \"function\"\n ? handler(input as Input)\n : handler;\n\n return run_live_handler_source(result, event);\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, helper_name);\n }\n });\n };\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 handler: RemoteFormHandler<Input, A, unknown, unknown>,\n helper_name: string,\n): (data: unknown, issue: unknown) => Promise<unknown> {\n return async (data: unknown, issue: unknown) => {\n let event: RequestEvent;\n\n try {\n event = get_native_request_event() as unknown as RequestEvent;\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, helper_name);\n }\n\n return await run_inside_remote_effect_handler(() => {\n const invalid_proxy = make_invalid_proxy<Input>();\n\n try {\n const result = handler({\n data: data as Input,\n invalid: invalid_proxy,\n issue,\n });\n\n return run_handler_effect(result, event);\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, helper_name);\n }\n });\n };\n}\n\nasync function run_inside_remote_effect_handler<A>(\n run: () => Promise<A>,\n): Promise<A> {\n running_remote_effect_handlers += 1;\n\n try {\n return await run();\n } finally {\n running_remote_effect_handlers -= 1;\n }\n}\n","import {\n BatchQueryHandlerMissingError,\n UncheckedCommandHandlerMissingError,\n UncheckedFormHandlerMissingError,\n UncheckedLiveQueryHandlerMissingError,\n UncheckedPrerenderHandlerMissingError,\n UncheckedQueryHandlerMissingError,\n} from \"$/errors.ts\";\nimport { copy_property_descriptors } from \"$/internal/descriptors.ts\";\nimport { normalize_remote_helper_error } from \"$/remote/server.ts\";\nimport {\n command as native_command,\n form as native_form,\n getRequestEvent as get_native_request_event,\n prerender as native_prerender,\n query 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 is_running_remote_effect_handler,\n make_remote_form_wrapper,\n make_remote_live_wrapper,\n make_remote_wrapper,\n} from \"./wrappers.ts\";\nimport type {\n EffectLike,\n EffectRemoteBatchHandler,\n EffectRemoteCommand,\n EffectRemoteForm,\n EffectRemoteFunction,\n EffectRemoteLiveQuery,\n EffectRemoteLiveQueryFunction,\n EffectRemoteLiveQueryResource,\n EffectRemoteQuery,\n EffectRemoteQueryFunction,\n PrerenderOptions,\n QueryFactory,\n RemoteFormHandler,\n RemoteHandler,\n RemoteLiveHandler,\n SchemaEncodedInput,\n SchemaInput,\n StandardSchema,\n StandardSchemaInput,\n StandardSchemaOutput,\n} from \"./types.ts\";\n\ntype FormSchemaEncodedInput<S> = S extends Schema.Top\n ? FormRemoteInput<S[\"Encoded\"]>\n : never;\n\ntype FormRemoteInput<Input> = NormalizeFormEncoded<Input> extends\n RemoteFormInput ? NormalizeFormEncoded<Input>\n : never;\n\ntype FormStandardSchemaInput<S> = StandardSchemaInput<S> extends RemoteFormInput\n ? StandardSchemaInput<S>\n : RemoteFormInput;\n\ntype FormScalar = string | number | boolean | File;\n\ntype NormalizeFormEncoded<Value> = Value extends FormScalar ? Value\n : Value extends ReadonlyArray<infer Item> ? Array<NormalizeFormEncoded<Item>>\n : Value extends object ? NormalizeFormObject<Value>\n : Value;\n\ntype NormalizeFormObject<Value> = {\n readonly [Key in keyof Value]: Key extends OptionalFormKeys<Value>\n ? NormalizeFormEncoded<Exclude<Value[Key], undefined>>\n : NormalizeFormEncoded<Value[Key]>;\n};\n\ntype OptionalFormKeys<Value> = {\n [Key in keyof Value]-?: Record<PropertyKey, never> extends Pick<Value, Key>\n ? Key\n : never;\n}[keyof Value];\n\ntype NativeQueryLike<Input = unknown> = (input: Input) => unknown;\n\ntype EffectRemoteResource<Output, ErrorType = never> =\n | EffectRemoteLiveQueryResource<Output>\n | EffectRemoteQuery<Output, ErrorType>;\n\nfunction to_effect_query<Input, Output, ErrorType = never>(\n native: NativeQueryLike<Input>,\n): EffectRemoteQueryFunction<Input, Output, ErrorType> {\n const wrapped = ((input: Input) => {\n if (is_current_remote_request()) {\n return (native as (input: Input) => unknown)(input);\n }\n\n const resource = (native as (input: Input) => unknown)(input);\n const effect = Effect.tryPromise({\n try: () => Promise.resolve(resource),\n catch: (error: unknown) => error,\n }) as unknown as EffectRemoteQuery<Output, ErrorType>;\n\n attach_query_resource_methods(resource, effect);\n\n return effect;\n }) as unknown as EffectRemoteQueryFunction<Input, Output, ErrorType>;\n\n copy_property_descriptors(native, wrapped);\n\n return wrapped;\n}\n\nfunction is_current_remote_request(): boolean {\n if (is_running_remote_effect_handler()) {\n return false;\n }\n\n try {\n const event = get_native_request_event() as { isRemoteRequest?: boolean };\n\n return event.isRemoteRequest === true;\n } catch {\n return false;\n }\n}\n\nfunction to_effect_live_query<Input, Output, ErrorType = never>(\n native: NativeQueryLike<Input>,\n): EffectRemoteLiveQueryFunction<Input, Output, ErrorType> {\n const wrapped = ((input: Input) => {\n const effect = Effect.try({\n try: () => {\n const resource = (native as (input: Input) => unknown)(input);\n\n return make_live_resource<Output>(resource);\n },\n catch: (error: unknown) => error,\n }) as unknown as EffectRemoteLiveQuery<Output, ErrorType>;\n\n return effect;\n }) as unknown as EffectRemoteLiveQueryFunction<\n Input,\n Output,\n ErrorType\n >;\n\n copy_property_descriptors(native, wrapped);\n\n return wrapped;\n}\n\ntype NativeRemoteResource<Output> = {\n readonly current?: Output;\n readonly error?: unknown;\n readonly loading?: boolean;\n readonly ready?: boolean;\n};\n\ntype NativeQueryResource<Output> = NativeRemoteResource<Output> & {\n readonly refresh?: () => Promise<void>;\n readonly set?: (value: Output) => void;\n readonly withOverride?: (update: (current: Output) => Output) => unknown;\n};\n\ntype NativeLiveQueryResource<Output> =\n & NativeRemoteResource<Output>\n & Partial<AsyncIterable<Output>>\n & {\n readonly connected?: boolean;\n readonly done?: boolean;\n readonly reconnect?: () => Promise<void>;\n };\n\nfunction is_query_resource<Output>(\n resource: unknown,\n): resource is NativeQueryResource<Output> {\n const resource_type = typeof resource;\n\n return (\n (resource_type === \"object\" && resource !== null) ||\n resource_type === \"function\"\n );\n}\n\nfunction is_live_resource<Output>(\n resource: unknown,\n): resource is NativeLiveQueryResource<Output> {\n const resource_type = typeof resource;\n\n return (\n (resource_type === \"object\" && resource !== null) ||\n resource_type === \"function\"\n );\n}\n\nfunction attach_remote_resource_getters<Output, ErrorType = never>(\n resource: unknown,\n effect: EffectRemoteResource<Output, ErrorType>,\n): void {\n const methods = is_query_resource<Output>(resource) ? resource : undefined;\n const keys = [\"current\", \"error\", \"loading\", \"ready\"] as const;\n\n if (!methods) {\n return;\n }\n\n for (const key of keys) {\n if (!(key in methods)) {\n continue;\n }\n\n Object.defineProperty(effect, key, {\n configurable: true,\n get: () => methods[key],\n });\n }\n}\n\nfunction attach_query_resource_methods<Output, ErrorType = never>(\n resource: unknown,\n effect: EffectRemoteQuery<Output, ErrorType>,\n): void {\n const methods = is_query_resource<Output>(resource) ? resource : undefined;\n const refresh = methods?.refresh;\n const set = methods?.set;\n const with_override = methods?.withOverride;\n\n attach_remote_resource_getters(resource, effect);\n\n if (!methods) {\n return;\n }\n\n if (typeof refresh === \"function\") {\n Object.defineProperty(effect, \"refresh\", {\n configurable: true,\n value: () =>\n Effect.tryPromise({\n try: () => Promise.resolve(refresh.call(resource)),\n catch: (error: unknown) => error,\n }),\n });\n }\n\n if (typeof set === \"function\") {\n Object.defineProperty(effect, \"set\", {\n configurable: true,\n value: (value: Output) => set.call(resource, value),\n });\n }\n\n if (typeof with_override === \"function\") {\n Object.defineProperty(effect, \"withOverride\", {\n configurable: true,\n value: (update: (current: Output) => Output) =>\n with_override.call(resource, update),\n });\n }\n}\n\nfunction attach_live_resource_methods<Output>(\n resource: unknown,\n effect: EffectRemoteLiveQueryResource<Output>,\n): void {\n const methods = is_live_resource<Output>(resource) ? resource : undefined;\n const reconnect = methods?.reconnect;\n const async_iterator = methods?.[Symbol.asyncIterator];\n const keys = [\n \"connected\",\n \"current\",\n \"done\",\n \"error\",\n \"loading\",\n \"ready\",\n ] as const;\n\n if (!methods) {\n return;\n }\n\n for (const key of keys) {\n if (!(key in methods)) {\n continue;\n }\n\n Object.defineProperty(effect, key, {\n configurable: true,\n get: () => methods[key],\n });\n }\n\n if (typeof reconnect === \"function\") {\n Object.defineProperty(effect, \"reconnect\", {\n configurable: true,\n value: () =>\n Effect.tryPromise({\n try: () => Promise.resolve(reconnect.call(resource)),\n catch: (error: unknown) => error,\n }),\n });\n }\n\n if (typeof async_iterator === \"function\") {\n Object.defineProperty(effect, Symbol.asyncIterator, {\n configurable: true,\n value: () => async_iterator.call(resource),\n });\n }\n}\n\nfunction make_live_resource<Output>(\n resource: unknown,\n): EffectRemoteLiveQueryResource<Output> {\n const live_resource = {} as EffectRemoteLiveQueryResource<Output>;\n\n attach_live_resource_methods(resource, live_resource);\n\n return 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 validate_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 validate_or_handler: \"unchecked\",\n maybe_handler: RemoteHandler<Input, A, E, R>,\n): EffectRemoteQueryFunction<Input, A, E>;\nfunction QueryRoot<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryRoot<S extends StandardSchema, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryRoot(\n validate_or_handler: unknown,\n maybe_handler?: unknown,\n): unknown {\n try {\n if (maybe_handler) {\n return to_effect_query(native_query(\n normalize_validator(validate_or_handler) as never,\n make_remote_wrapper(maybe_handler as RemoteHandler, \"Query\") as never,\n ) as ReturnType<typeof native_query>);\n }\n\n if (is_unchecked(validate_or_handler)) {\n throw new UncheckedQueryHandlerMissingError();\n }\n\n return to_effect_query(native_query(\n make_remote_wrapper(\n validate_or_handler as RemoteHandler,\n \"Query\",\n ) as never,\n ) as ReturnType<typeof native_query>);\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, \"Query\");\n }\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 validate_or_handler: \"unchecked\",\n maybe_handler: EffectRemoteBatchHandler<Input, A, E, R>,\n): EffectRemoteQueryFunction<Input, A, E>;\nfunction QueryBatch<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: EffectRemoteBatchHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryBatch<S extends StandardSchema, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: EffectRemoteBatchHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryBatch(\n validate_or_handler: unknown,\n maybe_handler?: unknown,\n): unknown {\n try {\n if (!maybe_handler) {\n throw new BatchQueryHandlerMissingError();\n }\n\n return to_effect_query(native_query.batch(\n normalize_validator(validate_or_handler) as never,\n make_remote_wrapper(\n maybe_handler as RemoteHandler,\n \"Query.batch\",\n ) as never,\n ) as NativeQueryLike);\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, \"Query.batch\");\n }\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 validate_or_handler: RemoteLiveHandler<void, A, E, R>,\n): EffectRemoteLiveQueryFunction<void, A, E>;\nfunction QueryLive<Input, A, E = never, R = never>(\n validate_or_handler: \"unchecked\",\n maybe_handler: RemoteLiveHandler<Input, A, E, R>,\n): EffectRemoteLiveQueryFunction<Input, A, E>;\nfunction QueryLive<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteLiveHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteLiveQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryLive<S extends StandardSchema, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteLiveHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteLiveQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryLive(\n validate_or_handler: unknown,\n maybe_handler?: unknown,\n): unknown {\n try {\n if (maybe_handler) {\n return to_effect_live_query(native_query.live(\n normalize_validator(validate_or_handler) as never,\n make_remote_live_wrapper(\n maybe_handler as RemoteLiveHandler,\n \"Query.live\",\n ) as never,\n ) as NativeQueryLike);\n }\n\n if (is_unchecked(validate_or_handler)) {\n throw new UncheckedLiveQueryHandlerMissingError();\n }\n\n return to_effect_live_query(native_query.live(\n make_remote_live_wrapper(\n validate_or_handler as RemoteLiveHandler,\n \"Query.live\",\n ) as never,\n ) as NativeQueryLike);\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, \"Query.live\");\n }\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 batch: QueryBatch,\n live: QueryLive,\n});\n\n/**\n * Factory for a write-oriented remote command function.\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 command function.\n */\nexport function Command<A, E = never, R = never>(\n validate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n): EffectRemoteCommand<void, A, E>;\nexport function Command<Input, A, E = never, R = never>(\n validate_or_handler: \"unchecked\",\n maybe_handler: RemoteHandler<Input, A, E, R>,\n): EffectRemoteCommand<Input, A, E>;\nexport function Command<\n S extends Schema.Schema<unknown>,\n A,\n E = never,\n R = never,\n>(\n validate_or_handler: S,\n maybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteCommand<SchemaEncodedInput<S>, A, E>;\nexport function Command<S extends StandardSchema, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteCommand<StandardSchemaInput<S>, A, E>;\nexport function Command(\n validate_or_handler: unknown,\n maybe_handler?: unknown,\n): unknown {\n try {\n if (maybe_handler) {\n return native_command(\n normalize_validator(validate_or_handler) as never,\n make_remote_wrapper(maybe_handler as RemoteHandler, \"Command\") as never,\n );\n }\n\n if (is_unchecked(validate_or_handler)) {\n throw new UncheckedCommandHandlerMissingError();\n }\n\n return native_command(\n make_remote_wrapper(\n validate_or_handler as RemoteHandler,\n \"Command\",\n ) as never,\n ) as ReturnType<typeof native_command>;\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, \"Command\");\n }\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 validate_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 validate_or_handler: \"unchecked\",\n maybe_handler: RemoteFormHandler<Input, A, E, R>,\n): EffectRemoteForm<Input, A, E>;\nexport function Form<S extends Schema.Top, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_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 validate_or_handler: S,\n maybe_handler: RemoteFormHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteForm<FormStandardSchemaInput<S>, A, E>;\nexport function Form(\n validate_or_handler: unknown,\n maybe_handler?: unknown,\n): unknown {\n try {\n if (maybe_handler) {\n return native_form(\n normalize_validator(validate_or_handler) as never,\n make_remote_form_wrapper(\n maybe_handler as RemoteFormHandler,\n \"Form\",\n ) as never,\n );\n }\n\n if (is_unchecked(validate_or_handler)) {\n throw new UncheckedFormHandlerMissingError();\n }\n\n const inputless_handler: RemoteFormHandler<void, unknown> = (\n { data, invalid, issue },\n ) => {\n if (is_handler(validate_or_handler)) {\n return validate_or_handler({ data, invalid, issue });\n }\n\n return validate_or_handler as EffectLike;\n };\n\n return native_form(\n make_remote_form_wrapper(inputless_handler, \"Form\") as never,\n ) as unknown as ReturnType<typeof native_form>;\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, \"Form\");\n }\n}\n\n/**\n * Factory for a prerenderable remote function.\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\n * @param maybe_handler_or_options - Handler or prerender options.\n * @param maybe_options - Prerender options used with a validator.\n * @returns A SvelteKit prerender function.\n */\nexport function Prerender<A, E = never, R = never>(\n validate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n maybe_options?: PrerenderOptions,\n): EffectRemoteFunction<void, A, E>;\nexport function Prerender<Input, A, E = never, R = never>(\n validate_or_handler: \"unchecked\",\n maybe_handler: RemoteHandler<Input, A, E, R>,\n maybe_options?: PrerenderOptions,\n): EffectRemoteFunction<Input, A, E>;\nexport function Prerender<\n S extends Schema.Schema<unknown>,\n A,\n E = never,\n R = never,\n>(\n validate_or_handler: S,\n maybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n maybe_options?: PrerenderOptions,\n): EffectRemoteFunction<SchemaEncodedInput<S>, A, E>;\nexport function Prerender<S extends StandardSchema, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n maybe_options?: PrerenderOptions,\n): EffectRemoteFunction<StandardSchemaInput<S>, A, E>;\nexport function Prerender(\n validate_or_handler: unknown,\n maybe_handler_or_options?: unknown,\n maybe_options?: PrerenderOptions,\n): unknown {\n try {\n if (is_handler(maybe_handler_or_options)) {\n return native_prerender(\n normalize_validator(validate_or_handler) as never,\n make_remote_wrapper(maybe_handler_or_options, \"Prerender\") as never,\n maybe_options as never,\n );\n }\n\n if (is_unchecked(validate_or_handler)) {\n throw new UncheckedPrerenderHandlerMissingError();\n }\n\n return native_prerender(\n make_remote_wrapper(\n validate_or_handler as RemoteHandler,\n \"Prerender\",\n ) as never,\n maybe_handler_or_options as never,\n ) as ReturnType<typeof native_prerender>;\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, \"Prerender\");\n }\n}\n","import {\n error as svelte_error,\n redirect as svelte_redirect,\n} from \"@sveltejs/kit\";\nimport { Effect } from \"effect\";\n\nconst error_status_codes = {\n ProxyAuthenticationRequired: 407,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n NetworkAuthenticationRequired: 511,\n HttpVersionNotSupported: 505,\n UnprocessableContent: 422,\n UnprocessableEntity: 422,\n InternalServerError: 500,\n FailedDependency: 424,\n PreconditionRequired: 428,\n ServiceUnavailable: 503,\n MisdirectedRequest: 421,\n InsufficientStorage: 507,\n VariantAlsoNegotiates: 506,\n PreconditionFailed: 412,\n MethodNotAllowed: 405,\n GatewayTimeout: 504,\n PaymentRequired: 402,\n UpgradeRequired: 426,\n TooManyRequests: 429,\n LengthRequired: 411,\n NotAcceptable: 406,\n RequestTimeout: 408,\n ContentTooLarge: 413,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n BadRequest: 400,\n Unauthorized: 401,\n Forbidden: 403,\n NotFound: 404,\n Conflict: 409,\n Gone: 410,\n Locked: 423,\n TooEarly: 425,\n NotImplemented: 501,\n BadGateway: 502,\n LoopDetected: 508,\n NotExtended: 510,\n} as const;\n\nconst redirect_status_codes = {\n MovedPermanently: 301,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n MultipleChoices: 300,\n NotModified: 304,\n SwitchProxy: 306,\n SeeOther: 303,\n UseProxy: 305,\n Found: 302,\n} as const;\n\ntype SvelteErrorBody = Parameters<typeof svelte_error>[1];\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 * 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 * 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 /**\n * Creates an Effect that throws SvelteKit's HTTP error control-flow value.\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 * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\n (\n status: ErrorStatus,\n body?: SvelteErrorBody,\n ): 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 /**\n * Creates an Effect that throws SvelteKit's redirect control-flow value.\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\n * to SvelteKit's `redirect` helper.\n * @param location - Target URL forwarded unchanged to SvelteKit.\n * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\n (\n status: RedirectStatus,\n location: string | URL,\n ): 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 * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\nexport const Error: ErrorEffectFactory = (status, body) => {\n const resolved_status = resolve_error_status(status);\n\n return Effect.sync(() => {\n svelte_error(resolved_status, body);\n });\n};\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 * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\nexport const Redirect: RedirectEffectFactory = (status, location) => {\n const resolved_status = resolve_redirect_status(status);\n\n return Effect.sync(() => {\n svelte_redirect(resolved_status, location);\n });\n};\n\nfunction resolve_error_status(status: ErrorStatus): number {\n if (typeof status === \"number\") {\n return status;\n }\n\n return error_status_codes[status];\n}\n\nfunction resolve_redirect_status(status: RedirectStatus): number {\n if (typeof status === \"number\") {\n return status;\n }\n\n return redirect_status_codes[status];\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAWA,SAAgB,aAAa,OAAsC;CACjE,OAAO,UAAU;AACnB;;;;;;;;AASA,SAAgB,WACd,OAC4D;CAC5D,OAAO,OAAO,UAAU;AAC1B;;;;;;;;AASA,SAAgB,mBAAmB,OAAyC;CAC1E,OACE,OAAO,UAAU,YACjB,UAAU,QACV,eAAe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C,CAAC;AACH;;;;;;;;;;;;;;;;AAiBA,MAAa,YAAmC,QAAQ,aAAa;CACnE,MAAM,kBAAkB,wBAAwB,MAAM;CAEtD,OAAO,OAAO,WAAW;EACvB,SAAgB,iBAAiB,QAAQ;CAC3C,CAAC;AACH;AAEA,SAAS,qBAAqB,QAA6B;CACzD,IAAI,OAAO,WAAW,UACpB,OAAO;CAGT,OAAO,mBAAmB;AAC5B;AAEA,SAAS,wBAAwB,QAAgC;CAC/D,IAAI,OAAO,WAAW,UACpB,OAAO;CAGT,OAAO,sBAAsB;AAC/B"}
1
+ {"version":3,"file":"server.js","names":["get_native_request_event","get_native_request_event","native_query","native_command","native_form","native_prerender"],"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\";\r\n\r\nimport type { RemoteHandler, StandardSchema } from \"./types.ts\";\r\n\r\n/**\r\n * Checks whether a value is the string sentinel for unchecked remotes.\r\n *\r\n * @since 2.0.0\r\n * @param value - Value to inspect.\r\n * @returns Whether the value is `\"unchecked\"`.\r\n */\r\nexport function is_unchecked(value: unknown): value is \"unchecked\" {\r\n return value === \"unchecked\";\r\n}\r\n\r\n/**\r\n * Checks whether a value is a remote handler function.\r\n *\r\n * @since 2.0.0\r\n * @param value - Value to inspect.\r\n * @returns Whether the value is callable as a handler.\r\n */\r\nexport function is_handler(\r\n value: unknown,\r\n): value is RemoteHandler<unknown, unknown, unknown, unknown> {\r\n return typeof value === \"function\";\r\n}\r\n\r\n/**\r\n * Checks whether a value implements the Standard Schema contract.\r\n *\r\n * @since 2.0.0\r\n * @param value - Value to inspect.\r\n * @returns Whether the value is a Standard Schema.\r\n */\r\nexport function is_standard_schema(value: unknown): value is StandardSchema {\r\n return (\r\n typeof value === \"object\" &&\r\n value !== null &&\r\n \"~standard\" in value\r\n );\r\n}\r\n\r\n/**\r\n * Checks whether a value looks like an Effect Schema.\r\n *\r\n * @since 2.0.0\r\n * @param value - Value to inspect.\r\n * @returns Whether the value should be converted to Standard Schema.\r\n */\r\nexport function is_effect_schema(\r\n value: unknown,\r\n): value is Schema.Schema<unknown> {\r\n return (\r\n typeof value === \"object\" &&\r\n value !== null &&\r\n \"ast\" in value &&\r\n \"make\" in value\r\n );\r\n}\r\n\r\n/**\r\n * Converts Effect Schema inputs to Standard Schema for SvelteKit.\r\n *\r\n * @since 2.0.0\r\n * @param value - Schema or handler input.\r\n * @returns Original value or Standard Schema view of an Effect Schema.\r\n */\r\nexport function normalize_validator(value: unknown): unknown {\r\n if (is_standard_schema(value) || !is_effect_schema(value)) {\r\n return value;\r\n }\r\n\r\n return Schema.toStandardSchemaV1(value as never);\r\n}\r\n","import { run_remote_effect } from \"$/remote/server.ts\";\r\nimport { InvalidLiveQueryReturnError } from \"$/errors.ts\";\r\nimport { error as svelte_error, invalid } from \"@sveltejs/kit\";\r\nimport { Effect, Stream } from \"effect\";\r\n\r\nimport { get_server_runtime_or_throw, RequestEvent } from \"./runtime.ts\";\r\nimport type { RequestEvent as RequestEventShape } from \"./runtime.ts\";\r\nimport type { EffectLike, EffectRemoteLiveSource } from \"./types.ts\";\r\n\r\ntype ResolvedLiveSource<A> =\r\n | AsyncIterable<A>\r\n | AsyncIterator<A>\r\n | Iterable<A>\r\n | Iterator<A>;\r\n\r\ntype LiveHandlerResult<A> =\r\n | EffectLike<EffectRemoteLiveSource<A>, unknown, unknown>\r\n | EffectRemoteLiveSource<A>;\r\n\r\n/**\r\n * Checks whether a value is an Effect generator return object.\r\n *\r\n * @since 2.0.0\r\n * @param value - Value to inspect.\r\n * @returns Whether the value should be wrapped with `Effect.gen`.\r\n */\r\nexport function is_generator_result<A>(\r\n value: unknown,\r\n): value is Effect.gen.Return<A, unknown, unknown> {\r\n return (\r\n typeof value === \"object\" &&\r\n value !== null &&\r\n typeof (value as { next?: unknown }).next === \"function\"\r\n );\r\n}\r\n\r\n/**\r\n * Normalizes an Effect-like handler return value into an Effect.\r\n *\r\n * @since 2.0.0\r\n * @param value - Effect or generator return value.\r\n * @returns Normalized Effect.\r\n */\r\nexport function to_effect<A, E, R>(\r\n value: EffectLike<A, E, R>,\r\n): Effect.Effect<A, E, R> {\r\n if (is_generator_result<A>(value)) {\r\n return Effect.gen(() => value) as Effect.Effect<A, E, R>;\r\n }\r\n\r\n return value;\r\n}\r\n\r\n/**\r\n * Checks whether a value is a live query source SvelteKit can consume.\r\n *\r\n * @since 2.0.0\r\n * @param value - Value to inspect.\r\n * @returns Whether the value is an Effect Stream or native iterable source.\r\n */\r\nexport function is_live_source<A>(\r\n value: unknown,\r\n): value is EffectRemoteLiveSource<A> {\r\n if (Stream.isStream(value)) {\r\n return true;\r\n }\r\n\r\n if (typeof value !== \"object\" || value === null) {\r\n return false;\r\n }\r\n\r\n const source = value as {\r\n readonly next?: unknown;\r\n readonly [Symbol.asyncIterator]?: unknown;\r\n readonly [Symbol.iterator]?: unknown;\r\n };\r\n\r\n return (\r\n typeof source.next === \"function\" ||\r\n typeof source[Symbol.asyncIterator] === \"function\" ||\r\n typeof source[Symbol.iterator] === \"function\"\r\n );\r\n}\r\n\r\n/**\r\n * Runs and normalizes a live query handler result with request services\r\n * available to Effect Streams.\r\n *\r\n * @since 2.0.0\r\n * @param value - Live query source or Effect that resolves to one.\r\n * @param event - SvelteKit request event for this remote call.\r\n * @returns Promise resolving with a source SvelteKit can stream.\r\n */\r\nexport function run_live_handler_source<A>(\r\n value: LiveHandlerResult<A>,\r\n event: RequestEventShape,\r\n): Promise<ResolvedLiveSource<A>> {\r\n const runtime = get_server_runtime_or_throw();\r\n const effect = Effect.provideService(\r\n to_live_source_effect(value),\r\n RequestEvent,\r\n event,\r\n ) as Effect.Effect<ResolvedLiveSource<A>, unknown, unknown>;\r\n\r\n return run_remote_effect(\r\n effect,\r\n runtime,\r\n svelte_invalid,\r\n svelte_remote_error,\r\n );\r\n}\r\n\r\nfunction to_live_source_effect<A>(\r\n value: LiveHandlerResult<A>,\r\n): Effect.Effect<ResolvedLiveSource<A>, unknown, unknown> {\r\n if (Stream.isStream(value)) {\r\n return Stream.toAsyncIterableEffect(\r\n value as Stream.Stream<A, unknown, unknown>,\r\n ) as Effect.Effect<ResolvedLiveSource<A>, unknown, unknown>;\r\n }\r\n\r\n if (is_native_live_source<A>(value)) {\r\n return Effect.succeed(value);\r\n }\r\n\r\n if (!Effect.isEffect(value)) {\r\n return Effect.fail(new InvalidLiveQueryReturnError());\r\n }\r\n\r\n return Effect.flatMap(\r\n value as Effect.Effect<EffectRemoteLiveSource<A>, unknown, unknown>,\r\n to_live_source_effect,\r\n );\r\n}\r\n\r\nfunction is_native_live_source<A>(\r\n value: unknown,\r\n): value is ResolvedLiveSource<A> {\r\n return is_live_source<A>(value) && !Stream.isStream(value);\r\n}\r\n\r\n/**\r\n * Runs a remote handler Effect with the current request event provided.\r\n *\r\n * @since 2.0.0\r\n * @param value - Handler return value.\r\n * @param event - SvelteKit request event for this remote call.\r\n * @returns Promise resolving with the handler output.\r\n */\r\nexport function run_handler_effect<A>(\r\n value: EffectLike<A, unknown, unknown>,\r\n event: RequestEventShape,\r\n): Promise<A> {\r\n const runtime = get_server_runtime_or_throw();\r\n const effect = Effect.provideService(\r\n to_effect(value),\r\n RequestEvent,\r\n event,\r\n ) as Effect.Effect<A, unknown, unknown>;\r\n\r\n return run_remote_effect(\r\n effect,\r\n runtime,\r\n svelte_invalid,\r\n svelte_remote_error,\r\n );\r\n}\r\n\r\nconst svelte_invalid = (_status: number, body: unknown): never => {\r\n const issues = typeof body === \"object\" && body !== null &&\r\n Array.isArray((body as { issues?: unknown }).issues)\r\n ? (body as { issues: unknown[] }).issues\r\n : [String(body)];\r\n\r\n invalid(...(issues as never[]));\r\n};\r\n\r\nconst svelte_remote_error = (status: number, body: unknown): never => {\r\n svelte_error(status as never, body as never);\r\n};\r\n","import { create_form_error } from \"$/remote/shared.ts\";\r\nimport { Effect } from \"effect\";\r\nimport type { FormIssue } from \"$/remote/shared.ts\";\r\n\r\nimport type { FormInvalid } from \"./types.ts\";\r\n\r\n/**\r\n * Creates a path-aware proxy for remote form validation failures.\r\n *\r\n * @since 2.0.0\r\n * @param path - Current nested form path.\r\n * @returns Callable invalid proxy for this path.\r\n */\r\nexport function make_invalid_proxy<Input = unknown>(\r\n path: readonly (string | number)[] = [],\r\n): FormInvalid<Input> {\r\n const invalid_at_path = (message: string) =>\r\n Effect.fail(\r\n create_form_error([{ message, path: [...path] } satisfies FormIssue]),\r\n );\r\n\r\n return new Proxy(invalid_at_path, {\r\n get(_target, property) {\r\n if (typeof property === \"symbol\") {\r\n return undefined;\r\n }\r\n\r\n return make_invalid_proxy([...path, property]);\r\n },\r\n }) as FormInvalid<Input>;\r\n}\r\n","import { getRequestEvent as get_native_request_event } from \"$app/server\";\r\nimport { normalize_remote_helper_error } from \"$/remote/server.ts\";\r\n\r\nimport { run_handler_effect, run_live_handler_source } from \"./effects.ts\";\r\nimport { make_invalid_proxy } from \"./invalid.ts\";\r\nimport { is_handler } from \"./schema.ts\";\r\nimport type { RequestEvent } from \"./runtime.ts\";\r\nimport type {\r\n EffectLike,\r\n RemoteFormHandler,\r\n RemoteHandler,\r\n RemoteLiveHandler,\r\n} from \"./types.ts\";\r\n\r\nlet running_remote_effect_handlers = 0;\r\n\r\n/**\r\n * Reports whether SER is currently executing user remote handler code.\r\n *\r\n * @example\r\n * ```ts\r\n * if (is_running_remote_effect_handler()) {\r\n * return query();\r\n * }\r\n * ```\r\n *\r\n * @since 2.0.0\r\n * @returns Whether a remote handler wrapper is currently active.\r\n * @internal\r\n */\r\nexport function is_running_remote_effect_handler(): boolean {\r\n return running_remote_effect_handlers > 0;\r\n}\r\n\r\n/**\r\n * Builds the wrapper passed to native query, command, and prerender helpers.\r\n *\r\n * @since 2.0.0\r\n * @param handler - Effect handler or already-built Effect-like value.\r\n * @param helper_name - Remote helper name for error normalization.\r\n * @returns Native SvelteKit handler wrapper.\r\n */\r\nexport function make_remote_wrapper(\r\n handler: RemoteHandler<unknown, unknown, unknown, unknown> | EffectLike,\r\n helper_name: string,\r\n): (input: unknown) => Promise<unknown> {\r\n return async (input: unknown) => {\r\n let event: RequestEvent;\r\n\r\n try {\r\n event = get_native_request_event() as unknown as RequestEvent;\r\n } catch (error: unknown) {\r\n throw normalize_remote_helper_error(error, helper_name);\r\n }\r\n\r\n return await run_inside_remote_effect_handler(() => {\r\n try {\r\n const result = is_handler(handler) ? handler(input) : handler;\r\n\r\n return run_handler_effect(result, event);\r\n } catch (error: unknown) {\r\n throw normalize_remote_helper_error(error, helper_name);\r\n }\r\n });\r\n };\r\n}\r\n\r\n/**\r\n * Builds the wrapper passed to native live query helpers.\r\n *\r\n * @since 2.0.0\r\n * @param handler - Effect-aware live source handler.\r\n * @param helper_name - Remote helper name for error normalization.\r\n * @returns Native SvelteKit live query wrapper.\r\n */\r\nexport function make_remote_live_wrapper<Input, A>(\r\n handler: RemoteLiveHandler<Input, A, unknown, unknown>,\r\n helper_name: string,\r\n): (input: unknown) => Promise<unknown> {\r\n return async (input: unknown) => {\r\n let event: RequestEvent;\r\n\r\n try {\r\n event = get_native_request_event() as unknown as RequestEvent;\r\n } catch (error: unknown) {\r\n throw normalize_remote_helper_error(error, helper_name);\r\n }\r\n\r\n return await run_inside_remote_effect_handler(() => {\r\n try {\r\n const result = typeof handler === \"function\"\r\n ? handler(input as Input)\r\n : handler;\r\n\r\n return run_live_handler_source(result, event);\r\n } catch (error: unknown) {\r\n throw normalize_remote_helper_error(error, helper_name);\r\n }\r\n });\r\n };\r\n}\r\n\r\n/**\r\n * Builds the wrapper passed to native form helpers.\r\n *\r\n * @since 2.0.0\r\n * @param handler - Effect-aware form handler.\r\n * @param helper_name - Remote helper name for error normalization.\r\n * @returns Native SvelteKit form handler wrapper.\r\n */\r\nexport function make_remote_form_wrapper<Input, A>(\r\n handler: RemoteFormHandler<Input, A, unknown, unknown>,\r\n helper_name: string,\r\n): (data: unknown, issue: unknown) => Promise<unknown> {\r\n return async (data: unknown, issue: unknown) => {\r\n let event: RequestEvent;\r\n\r\n try {\r\n event = get_native_request_event() as unknown as RequestEvent;\r\n } catch (error: unknown) {\r\n throw normalize_remote_helper_error(error, helper_name);\r\n }\r\n\r\n return await run_inside_remote_effect_handler(() => {\r\n const invalid_proxy = make_invalid_proxy<Input>();\r\n\r\n try {\r\n const result = handler({\r\n data: data as Input,\r\n invalid: invalid_proxy,\r\n issue,\r\n });\r\n\r\n return run_handler_effect(result, event);\r\n } catch (error: unknown) {\r\n throw normalize_remote_helper_error(error, helper_name);\r\n }\r\n });\r\n };\r\n}\r\n\r\nasync function run_inside_remote_effect_handler<A>(\r\n run: () => Promise<A>,\r\n): Promise<A> {\r\n running_remote_effect_handlers += 1;\r\n\r\n try {\r\n return await run();\r\n } finally {\r\n running_remote_effect_handlers -= 1;\r\n }\r\n}\r\n","import {\r\n BatchQueryHandlerMissingError,\r\n UncheckedCommandHandlerMissingError,\r\n UncheckedFormHandlerMissingError,\r\n UncheckedLiveQueryHandlerMissingError,\r\n UncheckedPrerenderHandlerMissingError,\r\n UncheckedQueryHandlerMissingError,\r\n} from \"$/errors.ts\";\r\nimport { copy_property_descriptors } from \"$/internal/descriptors.ts\";\r\nimport { normalize_remote_helper_error } from \"$/remote/server.ts\";\r\nimport {\r\n command as native_command,\r\n form as native_form,\r\n getRequestEvent as get_native_request_event,\r\n prerender as native_prerender,\r\n query as native_query,\r\n} from \"$app/server\";\r\nimport type { RemoteFormInput } from \"@sveltejs/kit\";\r\nimport { Effect, type Schema } from \"effect\";\r\n\r\nimport { is_handler, is_unchecked, normalize_validator } from \"./schema.ts\";\r\nimport {\r\n is_running_remote_effect_handler,\r\n make_remote_form_wrapper,\r\n make_remote_live_wrapper,\r\n make_remote_wrapper,\r\n} from \"./wrappers.ts\";\r\nimport type {\r\n EffectLike,\r\n EffectRemoteBatchHandler,\r\n EffectRemoteCommand,\r\n EffectRemoteForm,\r\n EffectRemoteFunction,\r\n EffectRemoteLiveQuery,\r\n EffectRemoteLiveQueryFunction,\r\n EffectRemoteLiveQueryResource,\r\n EffectRemoteQuery,\r\n EffectRemoteQueryFunction,\r\n PrerenderOptions,\r\n QueryFactory,\r\n RemoteFormHandler,\r\n RemoteHandler,\r\n RemoteLiveHandler,\r\n SchemaEncodedInput,\r\n SchemaInput,\r\n StandardSchema,\r\n StandardSchemaInput,\r\n StandardSchemaOutput,\r\n} from \"./types.ts\";\r\n\r\ntype FormSchemaEncodedInput<S> = S extends Schema.Top\r\n ? FormRemoteInput<S[\"Encoded\"]>\r\n : never;\r\n\r\ntype FormRemoteInput<Input> = NormalizeFormEncoded<Input> extends\r\n RemoteFormInput ? NormalizeFormEncoded<Input>\r\n : never;\r\n\r\ntype FormStandardSchemaInput<S> = StandardSchemaInput<S> extends RemoteFormInput\r\n ? StandardSchemaInput<S>\r\n : RemoteFormInput;\r\n\r\ntype FormScalar = string | number | boolean | File;\r\n\r\ntype NormalizeFormEncoded<Value> = Value extends FormScalar ? Value\r\n : Value extends ReadonlyArray<infer Item> ? Array<NormalizeFormEncoded<Item>>\r\n : Value extends object ? NormalizeFormObject<Value>\r\n : Value;\r\n\r\ntype NormalizeFormObject<Value> = {\r\n readonly [Key in keyof Value]: Key extends OptionalFormKeys<Value>\r\n ? NormalizeFormEncoded<Exclude<Value[Key], undefined>>\r\n : NormalizeFormEncoded<Value[Key]>;\r\n};\r\n\r\ntype OptionalFormKeys<Value> = {\r\n [Key in keyof Value]-?: Record<PropertyKey, never> extends Pick<Value, Key>\r\n ? Key\r\n : never;\r\n}[keyof Value];\r\n\r\ntype NativeQueryLike<Input = unknown> = (input: Input) => unknown;\r\n\r\ntype EffectRemoteResource<Output, ErrorType = never> =\r\n | EffectRemoteLiveQueryResource<Output>\r\n | EffectRemoteQuery<Output, ErrorType>;\r\n\r\nfunction to_effect_query<Input, Output, ErrorType = never>(\r\n native: NativeQueryLike<Input>,\r\n): EffectRemoteQueryFunction<Input, Output, ErrorType> {\r\n const wrapped = ((input: Input) => {\r\n if (is_current_remote_request()) {\r\n return (native as (input: Input) => unknown)(input);\r\n }\r\n\r\n const resource = (native as (input: Input) => unknown)(input);\r\n const effect = Effect.tryPromise({\r\n try: () => Promise.resolve(resource),\r\n catch: (error: unknown) => error,\r\n }) as unknown as EffectRemoteQuery<Output, ErrorType>;\r\n\r\n attach_query_resource_methods(resource, effect);\r\n\r\n return effect;\r\n }) as unknown as EffectRemoteQueryFunction<Input, Output, ErrorType>;\r\n\r\n copy_property_descriptors(native, wrapped);\r\n\r\n return wrapped;\r\n}\r\n\r\nfunction is_current_remote_request(): boolean {\r\n if (is_running_remote_effect_handler()) {\r\n return false;\r\n }\r\n\r\n try {\r\n const event = get_native_request_event() as { isRemoteRequest?: boolean };\r\n\r\n return event.isRemoteRequest === true;\r\n } catch {\r\n return false;\r\n }\r\n}\r\n\r\nfunction to_effect_live_query<Input, Output, ErrorType = never>(\r\n native: NativeQueryLike<Input>,\r\n): EffectRemoteLiveQueryFunction<Input, Output, ErrorType> {\r\n const wrapped = ((input: Input) => {\r\n const effect = Effect.try({\r\n try: () => {\r\n const resource = (native as (input: Input) => unknown)(input);\r\n\r\n return make_live_resource<Output>(resource);\r\n },\r\n catch: (error: unknown) => error,\r\n }) as unknown as EffectRemoteLiveQuery<Output, ErrorType>;\r\n\r\n return effect;\r\n }) as unknown as EffectRemoteLiveQueryFunction<\r\n Input,\r\n Output,\r\n ErrorType\r\n >;\r\n\r\n copy_property_descriptors(native, wrapped);\r\n\r\n return wrapped;\r\n}\r\n\r\ntype NativeRemoteResource<Output> = {\r\n readonly current?: Output;\r\n readonly error?: unknown;\r\n readonly loading?: boolean;\r\n readonly ready?: boolean;\r\n};\r\n\r\ntype NativeQueryResource<Output> = NativeRemoteResource<Output> & {\r\n readonly refresh?: () => Promise<void>;\r\n readonly set?: (value: Output) => void;\r\n readonly withOverride?: (update: (current: Output) => Output) => unknown;\r\n};\r\n\r\ntype NativeLiveQueryResource<Output> =\r\n & NativeRemoteResource<Output>\r\n & Partial<AsyncIterable<Output>>\r\n & {\r\n readonly connected?: boolean;\r\n readonly done?: boolean;\r\n readonly reconnect?: () => Promise<void>;\r\n };\r\n\r\nfunction is_query_resource<Output>(\r\n resource: unknown,\r\n): resource is NativeQueryResource<Output> {\r\n const resource_type = typeof resource;\r\n\r\n return (\r\n (resource_type === \"object\" && resource !== null) ||\r\n resource_type === \"function\"\r\n );\r\n}\r\n\r\nfunction is_live_resource<Output>(\r\n resource: unknown,\r\n): resource is NativeLiveQueryResource<Output> {\r\n const resource_type = typeof resource;\r\n\r\n return (\r\n (resource_type === \"object\" && resource !== null) ||\r\n resource_type === \"function\"\r\n );\r\n}\r\n\r\nfunction attach_remote_resource_getters<Output, ErrorType = never>(\r\n resource: unknown,\r\n effect: EffectRemoteResource<Output, ErrorType>,\r\n): void {\r\n const methods = is_query_resource<Output>(resource) ? resource : undefined;\r\n const keys = [\"current\", \"error\", \"loading\", \"ready\"] as const;\r\n\r\n if (!methods) {\r\n return;\r\n }\r\n\r\n for (const key of keys) {\r\n if (!(key in methods)) {\r\n continue;\r\n }\r\n\r\n Object.defineProperty(effect, key, {\r\n configurable: true,\r\n get: () => methods[key],\r\n });\r\n }\r\n}\r\n\r\nfunction attach_query_resource_methods<Output, ErrorType = never>(\r\n resource: unknown,\r\n effect: EffectRemoteQuery<Output, ErrorType>,\r\n): void {\r\n const methods = is_query_resource<Output>(resource) ? resource : undefined;\r\n const refresh = methods?.refresh;\r\n const set = methods?.set;\r\n const with_override = methods?.withOverride;\r\n\r\n attach_remote_resource_getters(resource, effect);\r\n\r\n if (!methods) {\r\n return;\r\n }\r\n\r\n if (typeof refresh === \"function\") {\r\n Object.defineProperty(effect, \"refresh\", {\r\n configurable: true,\r\n value: () =>\r\n Effect.tryPromise({\r\n try: () => Promise.resolve(refresh.call(resource)),\r\n catch: (error: unknown) => error,\r\n }),\r\n });\r\n }\r\n\r\n if (typeof set === \"function\") {\r\n Object.defineProperty(effect, \"set\", {\r\n configurable: true,\r\n value: (value: Output) => set.call(resource, value),\r\n });\r\n }\r\n\r\n if (typeof with_override === \"function\") {\r\n Object.defineProperty(effect, \"withOverride\", {\r\n configurable: true,\r\n value: (update: (current: Output) => Output) =>\r\n with_override.call(resource, update),\r\n });\r\n }\r\n}\r\n\r\nfunction attach_live_resource_methods<Output>(\r\n resource: unknown,\r\n effect: EffectRemoteLiveQueryResource<Output>,\r\n): void {\r\n const methods = is_live_resource<Output>(resource) ? resource : undefined;\r\n const reconnect = methods?.reconnect;\r\n const async_iterator = methods?.[Symbol.asyncIterator];\r\n const keys = [\r\n \"connected\",\r\n \"current\",\r\n \"done\",\r\n \"error\",\r\n \"loading\",\r\n \"ready\",\r\n ] as const;\r\n\r\n if (!methods) {\r\n return;\r\n }\r\n\r\n for (const key of keys) {\r\n if (!(key in methods)) {\r\n continue;\r\n }\r\n\r\n Object.defineProperty(effect, key, {\r\n configurable: true,\r\n get: () => methods[key],\r\n });\r\n }\r\n\r\n if (typeof reconnect === \"function\") {\r\n Object.defineProperty(effect, \"reconnect\", {\r\n configurable: true,\r\n value: () =>\r\n Effect.tryPromise({\r\n try: () => Promise.resolve(reconnect.call(resource)),\r\n catch: (error: unknown) => error,\r\n }),\r\n });\r\n }\r\n\r\n if (typeof async_iterator === \"function\") {\r\n Object.defineProperty(effect, Symbol.asyncIterator, {\r\n configurable: true,\r\n value: () => async_iterator.call(resource),\r\n });\r\n }\r\n}\r\n\r\nfunction make_live_resource<Output>(\r\n resource: unknown,\r\n): EffectRemoteLiveQueryResource<Output> {\r\n const live_resource = {} as EffectRemoteLiveQueryResource<Output>;\r\n\r\n attach_live_resource_methods(resource, live_resource);\r\n\r\n return live_resource;\r\n}\r\n\r\n/**\r\n * Factory for a read-only remote query function.\r\n *\r\n * @example\r\n * ```ts\r\n * export const getUser = Query(Schema.Struct({ id: Schema.String }), (input) =>\r\n * Effect.succeed(input.id)\r\n * );\r\n * ```\r\n *\r\n * @since 2.0.0\r\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\r\n * @param maybe_handler - Handler used when a validator is supplied.\r\n * @returns A SvelteKit query function.\r\n */\r\nfunction QueryRoot<A, E = never, R = never>(\r\n validate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\r\n): EffectRemoteQueryFunction<void, A, E>;\r\nfunction QueryRoot<Input, A, E = never, R = never>(\r\n validate_or_handler: \"unchecked\",\r\n maybe_handler: RemoteHandler<Input, A, E, R>,\r\n): EffectRemoteQueryFunction<Input, A, E>;\r\nfunction QueryRoot<S extends Schema.Schema<unknown>, A, E = never, R = never>(\r\n validate_or_handler: S,\r\n maybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\r\n): EffectRemoteQueryFunction<SchemaEncodedInput<S>, A, E>;\r\nfunction QueryRoot<S extends StandardSchema, A, E = never, R = never>(\r\n validate_or_handler: S,\r\n maybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\r\n): EffectRemoteQueryFunction<StandardSchemaInput<S>, A, E>;\r\nfunction QueryRoot(\r\n validate_or_handler: unknown,\r\n maybe_handler?: unknown,\r\n): unknown {\r\n try {\r\n if (maybe_handler) {\r\n return to_effect_query(native_query(\r\n normalize_validator(validate_or_handler) as never,\r\n make_remote_wrapper(maybe_handler as RemoteHandler, \"Query\") as never,\r\n ) as ReturnType<typeof native_query>);\r\n }\r\n\r\n if (is_unchecked(validate_or_handler)) {\r\n throw new UncheckedQueryHandlerMissingError();\r\n }\r\n\r\n return to_effect_query(native_query(\r\n make_remote_wrapper(\r\n validate_or_handler as RemoteHandler,\r\n \"Query\",\r\n ) as never,\r\n ) as ReturnType<typeof native_query>);\r\n } catch (error: unknown) {\r\n throw normalize_remote_helper_error(error, \"Query\");\r\n }\r\n}\r\n\r\n/**\r\n * Factory for a batched read-only remote query function.\r\n *\r\n * @since 2.0.0\r\n * @param validate_or_handler - A schema or `\"unchecked\"` sentinel.\r\n * @param maybe_handler - Handler receiving validated inputs as one batch.\r\n * @returns A SvelteKit batch query function.\r\n */\r\nfunction QueryBatch<Input, A, E = never, R = never>(\r\n validate_or_handler: \"unchecked\",\r\n maybe_handler: EffectRemoteBatchHandler<Input, A, E, R>,\r\n): EffectRemoteQueryFunction<Input, A, E>;\r\nfunction QueryBatch<S extends Schema.Schema<unknown>, A, E = never, R = never>(\r\n validate_or_handler: S,\r\n maybe_handler: EffectRemoteBatchHandler<SchemaInput<S>, A, E, R>,\r\n): EffectRemoteQueryFunction<SchemaEncodedInput<S>, A, E>;\r\nfunction QueryBatch<S extends StandardSchema, A, E = never, R = never>(\r\n validate_or_handler: S,\r\n maybe_handler: EffectRemoteBatchHandler<StandardSchemaOutput<S>, A, E, R>,\r\n): EffectRemoteQueryFunction<StandardSchemaInput<S>, A, E>;\r\nfunction QueryBatch(\r\n validate_or_handler: unknown,\r\n maybe_handler?: unknown,\r\n): unknown {\r\n try {\r\n if (!maybe_handler) {\r\n throw new BatchQueryHandlerMissingError();\r\n }\r\n\r\n return to_effect_query(native_query.batch(\r\n normalize_validator(validate_or_handler) as never,\r\n make_remote_wrapper(\r\n maybe_handler as RemoteHandler,\r\n \"Query.batch\",\r\n ) as never,\r\n ) as NativeQueryLike);\r\n } catch (error: unknown) {\r\n throw normalize_remote_helper_error(error, \"Query.batch\");\r\n }\r\n}\r\n\r\n/**\r\n * Factory for a live remote query function.\r\n *\r\n * @since 2.0.0\r\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg live handler.\r\n * @param maybe_handler - Handler used when a validator is supplied.\r\n * @returns A SvelteKit live query function.\r\n */\r\nfunction QueryLive<A, E = never, R = never>(\r\n validate_or_handler: RemoteLiveHandler<void, A, E, R>,\r\n): EffectRemoteLiveQueryFunction<void, A, E>;\r\nfunction QueryLive<Input, A, E = never, R = never>(\r\n validate_or_handler: \"unchecked\",\r\n maybe_handler: RemoteLiveHandler<Input, A, E, R>,\r\n): EffectRemoteLiveQueryFunction<Input, A, E>;\r\nfunction QueryLive<S extends Schema.Schema<unknown>, A, E = never, R = never>(\r\n validate_or_handler: S,\r\n maybe_handler: RemoteLiveHandler<SchemaInput<S>, A, E, R>,\r\n): EffectRemoteLiveQueryFunction<SchemaEncodedInput<S>, A, E>;\r\nfunction QueryLive<S extends StandardSchema, A, E = never, R = never>(\r\n validate_or_handler: S,\r\n maybe_handler: RemoteLiveHandler<StandardSchemaOutput<S>, A, E, R>,\r\n): EffectRemoteLiveQueryFunction<StandardSchemaInput<S>, A, E>;\r\nfunction QueryLive(\r\n validate_or_handler: unknown,\r\n maybe_handler?: unknown,\r\n): unknown {\r\n try {\r\n if (maybe_handler) {\r\n return to_effect_live_query(native_query.live(\r\n normalize_validator(validate_or_handler) as never,\r\n make_remote_live_wrapper(\r\n maybe_handler as RemoteLiveHandler,\r\n \"Query.live\",\r\n ) as never,\r\n ) as NativeQueryLike);\r\n }\r\n\r\n if (is_unchecked(validate_or_handler)) {\r\n throw new UncheckedLiveQueryHandlerMissingError();\r\n }\r\n\r\n return to_effect_live_query(native_query.live(\r\n make_remote_live_wrapper(\r\n validate_or_handler as RemoteLiveHandler,\r\n \"Query.live\",\r\n ) as never,\r\n ) as NativeQueryLike);\r\n } catch (error: unknown) {\r\n throw normalize_remote_helper_error(error, \"Query.live\");\r\n }\r\n}\r\n\r\n/**\r\n * Factory for read-only remote query functions.\r\n *\r\n * @example\r\n * ```ts\r\n * export const getUser = Query(Schema.Struct({ id: Schema.String }), (input) =>\r\n * Effect.succeed(input.id)\r\n * );\r\n *\r\n * export const getUserBatch = Query.batch(Schema.String, (ids) =>\r\n * Effect.succeed((id) => ids.includes(id))\r\n * );\r\n * ```\r\n *\r\n * @since 2.0.0\r\n */\r\nexport const Query: QueryFactory = Object.assign(QueryRoot, {\r\n batch: QueryBatch,\r\n live: QueryLive,\r\n});\r\n\r\n/**\r\n * Factory for a write-oriented remote command function.\r\n *\r\n * @since 2.0.0\r\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\r\n * @param maybe_handler - Handler used when a validator is supplied.\r\n * @returns A SvelteKit command function.\r\n */\r\nexport function Command<A, E = never, R = never>(\r\n validate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\r\n): EffectRemoteCommand<void, A, E>;\r\nexport function Command<Input, A, E = never, R = never>(\r\n validate_or_handler: \"unchecked\",\r\n maybe_handler: RemoteHandler<Input, A, E, R>,\r\n): EffectRemoteCommand<Input, A, E>;\r\nexport function Command<\r\n S extends Schema.Schema<unknown>,\r\n A,\r\n E = never,\r\n R = never,\r\n>(\r\n validate_or_handler: S,\r\n maybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\r\n): EffectRemoteCommand<SchemaEncodedInput<S>, A, E>;\r\nexport function Command<S extends StandardSchema, A, E = never, R = never>(\r\n validate_or_handler: S,\r\n maybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\r\n): EffectRemoteCommand<StandardSchemaInput<S>, A, E>;\r\nexport function Command(\r\n validate_or_handler: unknown,\r\n maybe_handler?: unknown,\r\n): unknown {\r\n try {\r\n if (maybe_handler) {\r\n return native_command(\r\n normalize_validator(validate_or_handler) as never,\r\n make_remote_wrapper(maybe_handler as RemoteHandler, \"Command\") as never,\r\n );\r\n }\r\n\r\n if (is_unchecked(validate_or_handler)) {\r\n throw new UncheckedCommandHandlerMissingError();\r\n }\r\n\r\n return native_command(\r\n make_remote_wrapper(\r\n validate_or_handler as RemoteHandler,\r\n \"Command\",\r\n ) as never,\r\n ) as ReturnType<typeof native_command>;\r\n } catch (error: unknown) {\r\n throw normalize_remote_helper_error(error, \"Command\");\r\n }\r\n}\r\n\r\n/**\r\n * Factory for a remote form handler.\r\n *\r\n * @example\r\n * ```ts\r\n * export const SignIn = Form(signInSchema, ({ data, invalid }) =>\r\n * Effect.gen(function* () {\r\n * if (!data.email.includes(\"@\")) {\r\n * return yield* invalid.email(\"Use an email address.\");\r\n * }\r\n *\r\n * return { email: data.email };\r\n * })\r\n * );\r\n * ```\r\n *\r\n * @since 2.0.0\r\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\r\n * @param maybe_handler - Handler used when a validator is supplied.\r\n * @returns A SvelteKit form function.\r\n */\r\nexport function Form<A, E = never, R = never>(\r\n validate_or_handler: EffectLike<A, E, R> | RemoteFormHandler<void, A, E, R>,\r\n): EffectRemoteForm<void, A, E>;\r\nexport function Form<Input extends RemoteFormInput, A, E = never, R = never>(\r\n validate_or_handler: \"unchecked\",\r\n maybe_handler: RemoteFormHandler<Input, A, E, R>,\r\n): EffectRemoteForm<Input, A, E>;\r\nexport function Form<S extends Schema.Top, A, E = never, R = never>(\r\n validate_or_handler: S,\r\n maybe_handler: RemoteFormHandler<SchemaInput<S>, A, E, R>,\r\n): EffectRemoteForm<FormSchemaEncodedInput<S>, A, E>;\r\nexport function Form<S extends StandardSchema, A, E = never, R = never>(\r\n validate_or_handler: S,\r\n maybe_handler: RemoteFormHandler<StandardSchemaOutput<S>, A, E, R>,\r\n): EffectRemoteForm<FormStandardSchemaInput<S>, A, E>;\r\nexport function Form(\r\n validate_or_handler: unknown,\r\n maybe_handler?: unknown,\r\n): unknown {\r\n try {\r\n if (maybe_handler) {\r\n return native_form(\r\n normalize_validator(validate_or_handler) as never,\r\n make_remote_form_wrapper(\r\n maybe_handler as RemoteFormHandler,\r\n \"Form\",\r\n ) as never,\r\n );\r\n }\r\n\r\n if (is_unchecked(validate_or_handler)) {\r\n throw new UncheckedFormHandlerMissingError();\r\n }\r\n\r\n const inputless_handler: RemoteFormHandler<void, unknown> = (\r\n { data, invalid, issue },\r\n ) => {\r\n if (is_handler(validate_or_handler)) {\r\n return validate_or_handler({ data, invalid, issue });\r\n }\r\n\r\n return validate_or_handler as EffectLike;\r\n };\r\n\r\n return native_form(\r\n make_remote_form_wrapper(inputless_handler, \"Form\") as never,\r\n ) as unknown as ReturnType<typeof native_form>;\r\n } catch (error: unknown) {\r\n throw normalize_remote_helper_error(error, \"Form\");\r\n }\r\n}\r\n\r\n/**\r\n * Factory for a prerenderable remote function.\r\n *\r\n * @since 2.0.0\r\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\r\n * @param maybe_handler_or_options - Handler or prerender options.\r\n * @param maybe_options - Prerender options used with a validator.\r\n * @returns A SvelteKit prerender function.\r\n */\r\nexport function Prerender<A, E = never, R = never>(\r\n validate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\r\n maybe_options?: PrerenderOptions,\r\n): EffectRemoteFunction<void, A, E>;\r\nexport function Prerender<Input, A, E = never, R = never>(\r\n validate_or_handler: \"unchecked\",\r\n maybe_handler: RemoteHandler<Input, A, E, R>,\r\n maybe_options?: PrerenderOptions,\r\n): EffectRemoteFunction<Input, A, E>;\r\nexport function Prerender<\r\n S extends Schema.Schema<unknown>,\r\n A,\r\n E = never,\r\n R = never,\r\n>(\r\n validate_or_handler: S,\r\n maybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\r\n maybe_options?: PrerenderOptions,\r\n): EffectRemoteFunction<SchemaEncodedInput<S>, A, E>;\r\nexport function Prerender<S extends StandardSchema, A, E = never, R = never>(\r\n validate_or_handler: S,\r\n maybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\r\n maybe_options?: PrerenderOptions,\r\n): EffectRemoteFunction<StandardSchemaInput<S>, A, E>;\r\nexport function Prerender(\r\n validate_or_handler: unknown,\r\n maybe_handler_or_options?: unknown,\r\n maybe_options?: PrerenderOptions,\r\n): unknown {\r\n try {\r\n if (is_handler(maybe_handler_or_options)) {\r\n return native_prerender(\r\n normalize_validator(validate_or_handler) as never,\r\n make_remote_wrapper(maybe_handler_or_options, \"Prerender\") as never,\r\n maybe_options as never,\r\n );\r\n }\r\n\r\n if (is_unchecked(validate_or_handler)) {\r\n throw new UncheckedPrerenderHandlerMissingError();\r\n }\r\n\r\n return native_prerender(\r\n make_remote_wrapper(\r\n validate_or_handler as RemoteHandler,\r\n \"Prerender\",\r\n ) as never,\r\n maybe_handler_or_options as never,\r\n ) as ReturnType<typeof native_prerender>;\r\n } catch (error: unknown) {\r\n throw normalize_remote_helper_error(error, \"Prerender\");\r\n }\r\n}\r\n","import {\r\n error as svelte_error,\r\n redirect as svelte_redirect,\r\n} from \"@sveltejs/kit\";\r\nimport { Effect } from \"effect\";\r\n\r\nconst error_status_codes = {\r\n ProxyAuthenticationRequired: 407,\r\n RequestHeaderFieldsTooLarge: 431,\r\n UnavailableForLegalReasons: 451,\r\n NetworkAuthenticationRequired: 511,\r\n HttpVersionNotSupported: 505,\r\n UnprocessableContent: 422,\r\n UnprocessableEntity: 422,\r\n InternalServerError: 500,\r\n FailedDependency: 424,\r\n PreconditionRequired: 428,\r\n ServiceUnavailable: 503,\r\n MisdirectedRequest: 421,\r\n InsufficientStorage: 507,\r\n VariantAlsoNegotiates: 506,\r\n PreconditionFailed: 412,\r\n MethodNotAllowed: 405,\r\n GatewayTimeout: 504,\r\n PaymentRequired: 402,\r\n UpgradeRequired: 426,\r\n TooManyRequests: 429,\r\n LengthRequired: 411,\r\n NotAcceptable: 406,\r\n RequestTimeout: 408,\r\n ContentTooLarge: 413,\r\n PayloadTooLarge: 413,\r\n UriTooLong: 414,\r\n UnsupportedMediaType: 415,\r\n RangeNotSatisfiable: 416,\r\n ExpectationFailed: 417,\r\n ImATeapot: 418,\r\n BadRequest: 400,\r\n Unauthorized: 401,\r\n Forbidden: 403,\r\n NotFound: 404,\r\n Conflict: 409,\r\n Gone: 410,\r\n Locked: 423,\r\n TooEarly: 425,\r\n NotImplemented: 501,\r\n BadGateway: 502,\r\n LoopDetected: 508,\r\n NotExtended: 510,\r\n} as const;\r\n\r\nconst redirect_status_codes = {\r\n MovedPermanently: 301,\r\n TemporaryRedirect: 307,\r\n PermanentRedirect: 308,\r\n MultipleChoices: 300,\r\n NotModified: 304,\r\n SwitchProxy: 306,\r\n SeeOther: 303,\r\n UseProxy: 305,\r\n Found: 302,\r\n} as const;\r\n\r\ntype SvelteErrorBody = Parameters<typeof svelte_error>[1];\r\n\r\n/**\r\n * Named HTTP status accepted by the {@link Error} helper.\r\n *\r\n * @example\r\n * ```ts\r\n * const status: ErrorStatusName = \"NotFound\";\r\n * ```\r\n *\r\n * @since 2.3.0\r\n */\r\nexport type ErrorStatusName = keyof typeof error_status_codes;\r\n\r\n/**\r\n * Numeric or named HTTP status accepted by the {@link Error} helper.\r\n *\r\n * @example\r\n * ```ts\r\n * const status: ErrorStatus = \"InternalServerError\";\r\n * ```\r\n *\r\n * @since 2.3.0\r\n */\r\nexport type ErrorStatus = ErrorStatusName | number;\r\n\r\n/**\r\n * Named HTTP status accepted by the {@link Redirect} helper.\r\n *\r\n * @example\r\n * ```ts\r\n * const status: RedirectStatusName = \"TemporaryRedirect\";\r\n * ```\r\n *\r\n * @since 2.3.0\r\n */\r\nexport type RedirectStatusName = keyof typeof redirect_status_codes;\r\n\r\n/**\r\n * Numeric or named HTTP status accepted by the {@link Redirect} helper.\r\n *\r\n * @example\r\n * ```ts\r\n * const status: RedirectStatus = \"SeeOther\";\r\n * ```\r\n *\r\n * @since 2.3.0\r\n */\r\nexport type RedirectStatus = RedirectStatusName | number;\r\n\r\n/**\r\n * Callable shape for the exported {@link Error} helper.\r\n *\r\n * @example\r\n * ```ts\r\n * const fail_not_found: ErrorEffectFactory = Error;\r\n * ```\r\n *\r\n * @since 2.3.0\r\n */\r\nexport interface ErrorEffectFactory {\r\n /**\r\n * Creates an Effect that throws SvelteKit's HTTP error control-flow value.\r\n *\r\n * @example\r\n * ```ts\r\n * return yield* Error(\"NotFound\", \"Post not found\");\r\n * ```\r\n *\r\n * @since 2.3.0\r\n * @param status - Numeric HTTP status or PascalCase status name to pass to\r\n * SvelteKit's `error` helper.\r\n * @param body - Optional SvelteKit error body or message forwarded unchanged\r\n * to SvelteKit.\r\n * @returns An Effect that never succeeds because SvelteKit takes over request\r\n * control flow.\r\n */\r\n (\r\n status: ErrorStatus,\r\n body?: SvelteErrorBody,\r\n ): Effect.Effect<never, never, never>;\r\n}\r\n\r\n/**\r\n * Callable shape for the exported {@link Redirect} helper.\r\n *\r\n * @example\r\n * ```ts\r\n * const redirect_after_save: RedirectEffectFactory = Redirect;\r\n * ```\r\n *\r\n * @since 2.3.0\r\n */\r\nexport interface RedirectEffectFactory {\r\n /**\r\n * Creates an Effect that throws SvelteKit's redirect control-flow value.\r\n *\r\n * @example\r\n * ```ts\r\n * return yield* Redirect(\"SeeOther\", \"/posts\");\r\n * ```\r\n *\r\n * @since 2.3.0\r\n * @param status - Numeric redirect status or PascalCase status name to pass\r\n * to SvelteKit's `redirect` helper.\r\n * @param location - Target URL forwarded unchanged to SvelteKit.\r\n * @returns An Effect that never succeeds because SvelteKit takes over request\r\n * control flow.\r\n */\r\n (\r\n status: RedirectStatus,\r\n location: string | URL,\r\n ): Effect.Effect<never, never, never>;\r\n}\r\n\r\n/**\r\n * Creates an Effect that raises SvelteKit's HTTP error control flow.\r\n *\r\n * @example\r\n * ```ts\r\n * return yield* Error(\"NotFound\", \"Post not found\");\r\n * ```\r\n *\r\n * @since 2.3.0\r\n * @param status - Numeric HTTP status or PascalCase status name to pass to\r\n * SvelteKit's `error` helper.\r\n * @param body - Optional SvelteKit error body or message forwarded unchanged\r\n * to SvelteKit.\r\n * @returns An Effect that never succeeds because SvelteKit takes over request\r\n * control flow.\r\n */\r\nexport const Error: ErrorEffectFactory = (status, body) => {\r\n const resolved_status = resolve_error_status(status);\r\n\r\n return Effect.sync(() => {\r\n svelte_error(resolved_status, body);\r\n });\r\n};\r\n\r\n/**\r\n * Creates an Effect that raises SvelteKit's redirect control flow.\r\n *\r\n * @example\r\n * ```ts\r\n * return yield* Redirect(\"SeeOther\", \"/posts\");\r\n * ```\r\n *\r\n * @since 2.3.0\r\n * @param status - Numeric redirect status or PascalCase status name to pass to\r\n * SvelteKit's `redirect` helper.\r\n * @param location - Target URL forwarded unchanged to SvelteKit.\r\n * @returns An Effect that never succeeds because SvelteKit takes over request\r\n * control flow.\r\n */\r\nexport const Redirect: RedirectEffectFactory = (status, location) => {\r\n const resolved_status = resolve_redirect_status(status);\r\n\r\n return Effect.sync(() => {\r\n svelte_redirect(resolved_status, location);\r\n });\r\n};\r\n\r\nfunction resolve_error_status(status: ErrorStatus): number {\r\n if (typeof status === \"number\") {\r\n return status;\r\n }\r\n\r\n return error_status_codes[status];\r\n}\r\n\r\nfunction resolve_redirect_status(status: RedirectStatus): number {\r\n if (typeof status === \"number\") {\r\n return status;\r\n }\r\n\r\n return redirect_status_codes[status];\r\n}\r\n"],"mappings":";;;;;;;;;;;;;;;;AAWA,SAAgB,aAAa,OAAsC;CACjE,OAAO,UAAU;AACnB;;;;;;;;AASA,SAAgB,WACd,OAC4D;CAC5D,OAAO,OAAO,UAAU;AAC1B;;;;;;;;AASA,SAAgB,mBAAmB,OAAyC;CAC1E,OACE,OAAO,UAAU,YACjB,UAAU,QACV,eAAe;AAEnB;;;;;;;;AASA,SAAgB,iBACd,OACiC;CACjC,OACE,OAAO,UAAU,YACjB,UAAU,QACV,SAAS,SACT,UAAU;AAEd;;;;;;;;AASA,SAAgB,oBAAoB,OAAyB;CAC3D,IAAI,mBAAmB,KAAK,KAAK,CAAC,iBAAiB,KAAK,GACtD,OAAO;CAGT,OAAO,OAAO,mBAAmB,KAAc;AACjD;;;;;;;;;;AChDA,SAAgB,oBACd,OACiD;CACjD,OACE,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAA6B,SAAS;AAElD;;;;;;;;AASA,SAAgB,UACd,OACwB;CACxB,IAAI,oBAAuB,KAAK,GAC9B,OAAO,OAAO,UAAU,KAAK;CAG/B,OAAO;AACT;;;;;;;;AASA,SAAgB,eACd,OACoC;CACpC,IAAI,OAAO,SAAS,KAAK,GACvB,OAAO;CAGT,IAAI,OAAO,UAAU,YAAY,UAAU,MACzC,OAAO;CAGT,MAAM,SAAS;CAMf,OACE,OAAO,OAAO,SAAS,cACvB,OAAO,OAAO,OAAO,mB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iBAAiB;CACjB,iBAAiB;CACjB,gBAAgB;CAChB,eAAe;CACf,gBAAgB;CAChB,iBAAiB;CACjB,iBAAiB;CACjB,YAAY;CACZ,sBAAsB;CACtB,qBAAqB;CACrB,mBAAmB;CACnB,WAAW;CACX,YAAY;CACZ,cAAc;CACd,WAAW;CACX,UAAU;CACV,UAAU;CACV,MAAM;CACN,QAAQ;CACR,UAAU;CACV,gBAAgB;CAChB,YAAY;CACZ,cAAc;CACd,aAAa;AACf;AAEA,MAAM,wBAAwB;CAC5B,kBAAkB;CAClB,mBAAmB;CACnB,mBAAmB;CACnB,iBAAiB;CACjB,aAAa;CACb,aAAa;CACb,UAAU;CACV,UAAU;CACV,OAAO;AACT;;;;;;;;;;;;;;;;;AAqIA,MAAa,SAA6B,QAAQ,SAAS;CACzD,MAAM,kBAAkB,qBAAqB,MAAM;CAEnD,OAAO,OAAO,WAAW;EACvB,MAAa,iBAAiB,IAAI;CACpC,CAAC;AACH;;;;;;;;;;;;;;;;AAiBA,MAAa,YAAmC,QAAQ,aAAa;CACnE,MAAM,kBAAkB,wBAAwB,MAAM;CAEtD,OAAO,OAAO,WAAW;EACvB,SAAgB,iBAAiB,QAAQ;CAC3C,CAAC;AACH;AAEA,SAAS,qBAAqB,QAA6B;CACzD,IAAI,OAAO,WAAW,UACpB,OAAO;CAGT,OAAO,mBAAmB;AAC5B;AAEA,SAAS,wBAAwB,QAAgC;CAC/D,IAAI,OAAO,WAAW,UACpB,OAAO;CAGT,OAAO,sBAAsB;AAC/B"}
package/.dist/vite.d.ts CHANGED
@@ -9,9 +9,9 @@ export interface EffectOptions {
9
9
  debug?: boolean;
10
10
  }
11
11
  /**
12
- * Vite plugin for SvelteKit. The pre plugin rewrites server-side imports
13
- * to the server entrypoint; the post plugin wraps SvelteKit's generated
14
- * client remote exports in Effect-returning adapters.
12
+ * Vite plugin for SvelteKit. The server import plugin rewrites server-side
13
+ * imports to the server entrypoint; the remote client plugin wraps SvelteKit's
14
+ * generated client remote exports in Effect-returning adapters.
15
15
  *
16
16
  * @example
17
17
  * ```ts
package/.dist/vite.js CHANGED
@@ -1,173 +1,2 @@
1
- //#region src/vite.ts
2
- /**
3
- * Vite plugin for SvelteKit. The pre plugin rewrites server-side imports
4
- * to the server entrypoint; the post plugin wraps SvelteKit's generated
5
- * client remote exports in Effect-returning adapters.
6
- *
7
- * @example
8
- * ```ts
9
- * import { effect } from "svelte-effect-runtime";
10
- * import { sveltekit } from "@sveltejs/kit/vite";
11
- *
12
- * export default defineConfig({ plugins: [effect(), sveltekit()] });
13
- * ```
14
- *
15
- * @since 2.0.0
16
- * @param options - Optional configuration.
17
- * @returns Vite plugins that integrate the runtime with SvelteKit.
18
- */
19
- function effect(options) {
20
- return [
21
- make_reserved_helper_guard_plugin(),
22
- make_svelte_transform_plugin(),
23
- make_server_rewrite_plugin(),
24
- make_remote_client_wrapper_plugin(options)
25
- ];
26
- }
27
- function make_reserved_helper_guard_plugin() {
28
- return {
29
- name: "svelte-effect-runtime:reserved-helper-guard",
30
- enforce: "pre",
31
- transform(code, id) {
32
- if (!is_svelte_component_module(id) || !has_ser_syntax(code)) return;
33
- const reserved_names = find_reserved_helper_names(code);
34
- if (reserved_names.length === 0) return;
35
- this.warn(make_reserved_helper_warning(reserved_names));
36
- }
37
- };
38
- }
39
- function make_svelte_transform_plugin() {
40
- return {
41
- name: "svelte-effect-runtime:svelte-transform",
42
- async transform(code, id, options) {
43
- if (!is_svelte_component_module(id)) return;
44
- const { transform_svelte_effect } = await import("./runtime/transform.js");
45
- const result = transform_svelte_effect(code, id, { target: options?.ssr ? "server" : "client" });
46
- if (result.code === code) return;
47
- return {
48
- code: result.code,
49
- map: null
50
- };
51
- }
52
- };
53
- }
54
- function make_server_rewrite_plugin() {
55
- return {
56
- name: "svelte-effect-runtime:server-imports",
57
- enforce: "pre",
58
- config() {
59
- return { optimizeDeps: { exclude: ["svelte-effect-runtime"] } };
60
- },
61
- transform(code, id) {
62
- if (!is_server_runtime_module(id)) return;
63
- const rewritten = code.replace(/from\s+["']svelte-effect-runtime["']/g, `from "svelte-effect-runtime/server"`).replace(/from\s+["']svelte-effect-runtime\/internal\/generators["']/g, `from "svelte-effect-runtime/server"`);
64
- if (rewritten === code) return;
65
- return {
66
- code: rewritten,
67
- map: null
68
- };
69
- }
70
- };
71
- }
72
- function make_remote_client_wrapper_plugin(options) {
73
- return {
74
- name: "svelte-effect-runtime:remote-client",
75
- enforce: "post",
76
- config() {
77
- return { ssr: { noExternal: ["svelte-effect-runtime"] } };
78
- },
79
- configResolved(config) {
80
- const no_external = config.ssr.noExternal;
81
- const runtime_package = "svelte-effect-runtime";
82
- if (no_external === true) return;
83
- if (Array.isArray(no_external)) {
84
- if (!no_external.some((entry) => entry === runtime_package)) no_external.push(runtime_package);
85
- return;
86
- }
87
- config.ssr.noExternal = [no_external, runtime_package].filter((value) => value !== void 0);
88
- },
89
- transform(code, id) {
90
- if (!is_remote_module(id) || !code.includes("__sveltekit/remote")) return;
91
- const rewritten = rewrite_remote_client_exports(code, options);
92
- if (rewritten === code) return;
93
- return {
94
- code: rewritten,
95
- map: null
96
- };
97
- }
98
- };
99
- }
100
- function is_server_runtime_module(id) {
101
- return id.endsWith(".server.ts") || id.endsWith(".remote.ts") || id.includes("hooks.server.");
102
- }
103
- function is_remote_module(id) {
104
- return /\.(remote|remote\.[cm]?)\.[jt]s(?:\?.*)?$/.test(id) || id.includes(".remote.");
105
- }
106
- function is_svelte_component_module(id) {
107
- const [filename, query = ""] = id.split("?", 2);
108
- if (!filename.endsWith(".svelte")) return false;
109
- if (query.length === 0) return true;
110
- const params = new URLSearchParams(query);
111
- const allowed_params = ["t", "v"];
112
- return [...params.keys()].every((key) => allowed_params.includes(key));
113
- }
114
- function has_ser_syntax(code) {
115
- return /\byield\s*\*/.test(code) || /<script\b[^>]*\beffect(?:[\s=>]|$)/.test(code);
116
- }
117
- function find_reserved_helper_names(code) {
118
- const script_segments = [...code.matchAll(/<script\b[^>]*>([\s\S]*?)<\/script\s*>/gi)].map((match) => match[1] ?? "");
119
- const markup_segments = [...code.matchAll(/\{[^{}]*(?:Dispatcher|Code)[^{}]*\}/g)].map((match) => match[0]);
120
- const search_segments = [...script_segments, ...markup_segments];
121
- return ["Dispatcher", "Code"].filter((name) => search_segments.some((segment) => new RegExp(`\\b${name}\\b`).test(segment)));
122
- }
123
- function make_reserved_helper_warning(names) {
124
- const quoted_names = names.map((name) => `\`${name}\``);
125
- const subject = quoted_names.length === 1 ? quoted_names[0] : `${quoted_names.slice(0, -1).join(", ")} and ${quoted_names[quoted_names.length - 1]}`;
126
- return [`[svelte-effect-runtime] ${subject} ${names.length === 1 ? "is" : "are"} reserved for generated markup helpers.`, `Rename or alias local bindings that use ${subject} before using SER syntax in this component.`].join(" ");
127
- }
128
- /**
129
- * Rewrites SvelteKit's generated client remote module from:
130
- *
131
- * `export const get_post = __remote.query("hash/get_post")`
132
- *
133
- * into an Effect-aware wrapper around the same native function.
134
- *
135
- * @since 2.0.0
136
- * @param code - The generated client remote module code.
137
- * @param options - Optional plugin options.
138
- * @returns The rewritten module code.
139
- * @internal
140
- */
141
- function rewrite_remote_client_exports(code, options) {
142
- const import_match = code.match(/import\s+\*\s+as\s+([A-Za-z_$][\w$]*)\s+from\s+["']__sveltekit\/remote["'];?/);
143
- if (!import_match) return code;
144
- const namespace = import_match[1];
145
- const export_pattern = new RegExp(`export\\s+const\\s+([A-Za-z_$][\\w$]*)\\s*=\\s*${namespace}\\.(query_batch|query_live|query|command|form|prerender)\\((["'][^"']+["'])\\);?`, "g");
146
- let replaced_any = false;
147
- const body = code.replace(export_pattern, (_match, name, type, id_literal) => {
148
- replaced_any = true;
149
- return make_remote_export(name, type, id_literal, namespace);
150
- });
151
- if (!replaced_any) return code;
152
- const imports = [`import { app_dir, base } from "$app/paths/internal/client";`, `import { create_remote_query_adapter, create_remote_live_query_adapter, create_remote_command_adapter, create_remote_form_adapter } from "svelte-effect-runtime/internal/remote-client";`].join("\n");
153
- const helpers = [`const __SER___remote_base = \`\${base}/\${app_dir}/remote\`;`, `function __SER___decode_payload(value) { return value; }`].join("\n");
154
- const debug_line = options?.debug ? `console.log("[ser] remote client wrappers loaded");` : "";
155
- const injected = [
156
- import_match[0],
157
- imports,
158
- helpers,
159
- debug_line
160
- ].filter(Boolean).join("\n");
161
- return body.replace(import_match[0], injected);
162
- }
163
- function make_remote_export(name, type, id_literal, namespace) {
164
- const native_call = `${namespace}.${type}(${id_literal})`;
165
- if (type === "command") return `export const ${name} = create_remote_command_adapter(${native_call}, __SER___decode_payload);`;
166
- if (type === "form") return `export const ${name} = create_remote_form_adapter(${native_call}, __SER___decode_payload, __SER___remote_base);`;
167
- if (type === "query_live") return `export const ${name} = create_remote_live_query_adapter(${native_call}, __SER___decode_payload);`;
168
- return `export const ${name} = create_remote_query_adapter(${native_call}, __SER___decode_payload);`;
169
- }
170
- //#endregion
1
+ import { n as rewrite_remote_client_exports, t as effect } from "./chunks/vite-DiAwz7jc.js";
171
2
  export { effect, rewrite_remote_client_exports };
172
-
173
- //# sourceMappingURL=vite.js.map
package/README.md CHANGED
@@ -1,5 +1,5 @@
1
- # svelte-effect-runtime
2
-
3
- Core module that houses the Vite plugin to enable effectful execution.
4
-
5
- Visit the [docs](https://ser.barekey.dev) for more information.
1
+ # svelte-effect-runtime
2
+
3
+ Core module that houses the Vite plugin to enable effectful execution.
4
+
5
+ Visit the [docs](https://ser.barekey.dev) for more information.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "svelte-effect-runtime",
3
- "version": "3.3.1",
3
+ "version": "3.4.0",
4
4
  "description": "Core module that houses the Vite plugin to enable effectful execution.",
5
5
  "license": "BSD-3-Clause",
6
6
  "type": "module",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "repository": {
11
11
  "type": "git",
12
- "url": "https://github.com/usebarekey/svelte-effect-runtime.git"
12
+ "url": "git+https://github.com/usebarekey/svelte-effect-runtime.git"
13
13
  },
14
14
  "publishConfig": {
15
15
  "access": "public"
@@ -23,11 +23,6 @@
23
23
  "types": "./.dist/mod.d.ts",
24
24
  "default": "./.dist/mod.js"
25
25
  },
26
- "./grammars": {
27
- "types": "./.dist/grammars.d.ts",
28
- "import": "./.dist/grammars.js",
29
- "default": "./.dist/grammars.js"
30
- },
31
26
  "./server": {
32
27
  "types": "./.dist/server.d.ts",
33
28
  "default": "./.dist/server.js"