svelte-effect-runtime 3.4.11 → 4.0.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.
- package/.dist/chunks/{client-CsVu54pU.js → client-DcZUV4rR.js} +76 -50
- package/.dist/chunks/client-DcZUV4rR.js.map +1 -0
- package/.dist/chunks/{vite-WGlbSnso.js → compiler-BBPNyXmQ.js} +84 -110
- package/.dist/chunks/compiler-BBPNyXmQ.js.map +1 -0
- package/.dist/chunks/{dispatcher-pHH4JcFR.js → dispatcher-DOx8iC6r.js} +2 -2
- package/.dist/chunks/{dispatcher-pHH4JcFR.js.map → dispatcher-DOx8iC6r.js.map} +1 -1
- package/.dist/chunks/{dispatcher-LtvFKYUp.js → dispatcher-H-Ia0Os4.js} +3 -3
- package/.dist/chunks/{dispatcher-LtvFKYUp.js.map → dispatcher-H-Ia0Os4.js.map} +1 -1
- package/.dist/chunks/{errors-Dcf0MVbq.js → errors-IJjsUwrE.js} +21 -65
- package/.dist/chunks/errors-IJjsUwrE.js.map +1 -0
- package/.dist/chunks/live-BXAKre_4.js +104 -0
- package/.dist/chunks/live-BXAKre_4.js.map +1 -0
- package/.dist/chunks/{remote-client-Bj1pZXgq.js → remote-client-CVI4t66c.js} +2 -2
- package/.dist/chunks/remote-client-CVI4t66c.js.map +1 -0
- package/.dist/chunks/{runtime-ekkMQ-wL.js → runtime-GBQz32DZ.js} +3 -3
- package/.dist/chunks/{runtime-ekkMQ-wL.js.map → runtime-GBQz32DZ.js.map} +1 -1
- package/.dist/chunks/schema-D9pct6Y5.js +89 -0
- package/.dist/chunks/schema-D9pct6Y5.js.map +1 -0
- package/.dist/chunks/server-D1LcDnZE.js +213 -0
- package/.dist/chunks/server-D1LcDnZE.js.map +1 -0
- package/.dist/chunks/source-scan-C4PsggID.js +341 -0
- package/.dist/chunks/source-scan-C4PsggID.js.map +1 -0
- package/.dist/chunks/{transform-CtQDGS9c.js → transform-jNUr65K9.js} +237 -239
- package/.dist/chunks/transform-jNUr65K9.js.map +1 -0
- package/.dist/compiler/source-scan.d.ts +198 -0
- package/.dist/{vite.d.ts → compiler.d.ts} +1 -1
- package/.dist/{vite.js → compiler.js} +1 -1
- package/.dist/dispatcher.js +1 -1
- package/.dist/errors.d.ts +15 -45
- package/.dist/generators.d.ts +3 -1
- package/.dist/internal/generators.js +20 -3
- package/.dist/internal/generators.js.map +1 -0
- package/.dist/internal/remote-client.js +1 -1
- package/.dist/internal/remote-server.js +1 -1
- package/.dist/internal/schema.d.ts +67 -0
- package/.dist/live.d.ts +123 -0
- package/.dist/markup/event-attributes.d.ts +16 -7
- package/.dist/markup/promise.js +1 -1
- package/.dist/markup/run.js +1 -1
- package/.dist/markup/transform/constants.d.ts +1 -0
- package/.dist/markup/transform/types.d.ts +1 -0
- package/.dist/markup/transform.js +1 -1
- package/.dist/markup/value.js +1 -1
- package/.dist/mod.d.ts +6 -3
- package/.dist/mod.js +5 -4
- package/.dist/mod.js.map +1 -1
- package/.dist/remote/cause-codec.d.ts +53 -0
- package/.dist/remote/client/form-transport.d.ts +4 -1
- package/.dist/remote/client/form.d.ts +10 -1
- package/.dist/remote/client/index.d.ts +1 -1
- package/.dist/remote/client/query.d.ts +6 -16
- package/.dist/remote/client/types.d.ts +32 -13
- package/.dist/remote/client.d.ts +1 -1
- package/.dist/remote/client.js +1 -1
- package/.dist/remote/server.d.ts +2 -12
- package/.dist/remote/server.js +1 -178
- package/.dist/runtime/transform.js +81 -68
- package/.dist/runtime/transform.js.map +1 -1
- package/.dist/script-transform/imports.d.ts +2 -0
- package/.dist/script-transform/types.d.ts +8 -0
- package/.dist/server/effects.d.ts +7 -7
- package/.dist/server/handler.d.ts +37 -0
- package/.dist/server/index.d.ts +4 -1
- package/.dist/server/schema.d.ts +2 -26
- package/.dist/server/types.d.ts +44 -50
- package/.dist/server/wrappers.d.ts +2 -2
- package/.dist/server.d.ts +2 -2
- package/.dist/server.js +88 -97
- package/.dist/server.js.map +1 -1
- package/.dist/yieldable.d.ts +41 -0
- package/README.md +1 -1
- package/package.json +4 -4
- package/.dist/chunks/client-CsVu54pU.js.map +0 -1
- package/.dist/chunks/descriptors-cOe9uRJz.js +0 -36
- package/.dist/chunks/descriptors-cOe9uRJz.js.map +0 -1
- package/.dist/chunks/errors-Dcf0MVbq.js.map +0 -1
- package/.dist/chunks/event-attributes-gHzP2ycp.js +0 -39
- package/.dist/chunks/event-attributes-gHzP2ycp.js.map +0 -1
- package/.dist/chunks/remote-client-Bj1pZXgq.js.map +0 -1
- package/.dist/chunks/transform-CtQDGS9c.js.map +0 -1
- package/.dist/chunks/vite-WGlbSnso.js.map +0 -1
- package/.dist/remote/server.js.map +0 -1
- /package/.dist/{vite → compiler}/remote-client.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client-CsVu54pU.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/remote/client/utils.ts","../../../modules/svelte-effect-runtime/src/remote/client/failures.ts","../../../modules/svelte-effect-runtime/src/remote/client/responses.ts","../../../modules/svelte-effect-runtime/src/remote/client/effect.ts","../../../modules/svelte-effect-runtime/src/remote/client/command.ts","../../../modules/svelte-effect-runtime/src/remote/client/form-data.ts","../../../modules/svelte-effect-runtime/src/remote/client/form-transport.ts","../../../modules/svelte-effect-runtime/src/remote/client/form-enhance.ts","../../../modules/svelte-effect-runtime/src/remote/client/form.ts","../../../modules/svelte-effect-runtime/src/remote/client/query-result.ts","../../../modules/svelte-effect-runtime/src/remote/client/query.ts"],"sourcesContent":["export { copy_property_descriptors } from \"$/internal/descriptors.ts\";\nimport type { NativeMethod } from \"./types.ts\";\n\n/**\n * Checks whether a value has a callable method property.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @param key - Method key to look up.\n * @returns Whether the value has a function at `key`.\n */\nexport function has_method<K extends PropertyKey>(\n\tvalue: unknown,\n\tkey: K,\n): value is Record<K, NativeMethod> {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\ttypeof (value as Record<PropertyKey, unknown>)[key] === \"function\"\n\t);\n}\n","import {\n\tcreate_remote_http_error,\n\tcreate_remote_transport_error,\n\tis_serialized_remote_failure_envelope,\n} from \"$/remote/shared.ts\";\nimport type { RemoteFailure } from \"$/remote/shared.ts\";\nimport { RemoteErrorDecodeError } from \"$/errors.ts\";\nimport { Option, Schema } from \"effect\";\nimport { parse } from \"devalue\";\n\ntype JsonStringDecode =\n\t| {\n\t\t\treadonly _tag: \"JsonStringDecoded\";\n\t\t\treadonly value: unknown;\n\t }\n\t| {\n\t\t\treadonly _tag: \"JsonStringIgnored\";\n\t };\n\ntype EmbeddedRemoteFailureDecode =\n\t| {\n\t\t\treadonly _tag: \"EmbeddedRemoteFailureDecoded\";\n\t\t\treadonly value: unknown;\n\t }\n\t| {\n\t\t\treadonly _tag: \"EmbeddedRemoteFailureIgnored\";\n\t };\n\ntype SerializedRemoteFailureDecode<ErrorType> =\n\t| {\n\t\t\treadonly _tag: \"SerializedRemoteFailureDecoded\";\n\t\t\treadonly value: RemoteFailure<ErrorType>;\n\t }\n\t| {\n\t\t\treadonly _tag: \"SerializedRemoteFailureInvalid\";\n\t };\n\nconst RemoteErrorMessageEnvelopeSchema = Schema.Struct({\n\tmessage: Schema.String,\n});\n\nconst DecodedRemoteFailureSchema = Schema.Struct({\n\t_tag: Schema.String,\n});\n\nconst DecodeJsonString = Schema.decodeUnknownOption(Schema.UnknownFromJsonString);\nconst is_decoded_remote_failure_value = Schema.is(DecodedRemoteFailureSchema);\nconst is_remote_error_message_envelope = Schema.is(RemoteErrorMessageEnvelopeSchema);\n\n/**\n * Decodes a raw wire value into a remote failure when it uses the runtime\n * failure envelope.\n *\n * @example\n * ```ts\n * const failure = decode_remote_error(body);\n * ```\n *\n * @since 2.0.0\n * @param raw - Raw value received from the network or SvelteKit error body.\n * @param decode - Optional devalue decoder for custom error payloads.\n * @returns The decoded failure/value, or a transport error when decoding fails.\n */\nexport function decode_remote_error<ErrorType = never>(\n\traw: unknown,\n\tdecode?: (encoded: string) => unknown,\n): RemoteFailure<ErrorType> | unknown {\n\tconst embedded = decode_embedded_remote_failure(raw);\n\n\tif (embedded._tag === \"EmbeddedRemoteFailureDecoded\") {\n\t\treturn decode_remote_error<ErrorType>(embedded.value, decode);\n\t}\n\n\tif (is_serialized_remote_failure_envelope(raw)) {\n\t\tconst decoded = decode_serialized_remote_failure<ErrorType>(raw.encoded, decode);\n\n\t\tif (decoded._tag === \"SerializedRemoteFailureInvalid\") {\n\t\t\treturn create_remote_transport_error(new RemoteErrorDecodeError(raw), raw);\n\t\t}\n\n\t\treturn decoded.value;\n\t}\n\n\treturn raw;\n}\n\nfunction decode_embedded_remote_failure(raw: unknown): EmbeddedRemoteFailureDecode {\n\tif (typeof raw === \"string\") {\n\t\treturn decode_embedded_json_remote_failure(raw);\n\t}\n\n\tif (!is_remote_error_message_envelope(raw)) {\n\t\treturn { _tag: \"EmbeddedRemoteFailureIgnored\" };\n\t}\n\n\treturn decode_embedded_json_remote_failure(raw.message);\n}\n\nfunction decode_embedded_json_remote_failure(value: string): EmbeddedRemoteFailureDecode {\n\tconst decoded = decode_json_string(value);\n\n\tif (decoded._tag === \"JsonStringIgnored\") {\n\t\treturn { _tag: \"EmbeddedRemoteFailureIgnored\" };\n\t}\n\n\treturn {\n\t\t_tag: \"EmbeddedRemoteFailureDecoded\",\n\t\tvalue: decoded.value,\n\t};\n}\n\nfunction decode_json_string(value: string): JsonStringDecode {\n\tconst decoded = DecodeJsonString(value);\n\n\tif (!Option.isSome(decoded)) {\n\t\treturn { _tag: \"JsonStringIgnored\" };\n\t}\n\n\treturn {\n\t\t_tag: \"JsonStringDecoded\",\n\t\tvalue: decoded.value,\n\t};\n}\n\nfunction decode_serialized_remote_failure<ErrorType>(\n\tencoded: string,\n\tdecode: ((encoded: string) => unknown) | undefined,\n): SerializedRemoteFailureDecode<ErrorType> {\n\ttry {\n\t\tconst decoded = decode ? decode(encoded) : parse(encoded);\n\n\t\treturn {\n\t\t\t_tag: \"SerializedRemoteFailureDecoded\",\n\t\t\tvalue: decoded as RemoteFailure<ErrorType>,\n\t\t};\n\t} catch {\n\t\treturn { _tag: \"SerializedRemoteFailureInvalid\" };\n\t}\n}\n\n/**\n * Checks whether a decoded value is a tagged remote failure.\n *\n * @example\n * ```ts\n * if (is_decoded_remote_failure(value)) throw value;\n * ```\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value carries a `_tag` discriminator.\n */\nexport function is_decoded_remote_failure(value: unknown): value is RemoteFailure<never> {\n\treturn is_decoded_remote_failure_value(value);\n}\n\n/**\n * Normalizes native thrown values into the runtime's remote failure model.\n *\n * @example\n * ```ts\n * const failure = normalize_native_error(error);\n * ```\n *\n * @since 2.0.0\n * @param error - Unknown value thrown by a native remote helper.\n * @returns A typed remote failure.\n */\nexport function normalize_native_error<ErrorType = never>(\n\terror: unknown,\n): RemoteFailure<ErrorType> {\n\tconst body = get_error_body(error);\n\tconst decoded = decode_remote_error<ErrorType>(body);\n\tconst status = get_error_status(error);\n\n\tif (is_decoded_remote_failure(decoded)) {\n\t\treturn decoded;\n\t}\n\n\tif (status !== undefined) {\n\t\treturn create_remote_http_error(status, body, error);\n\t}\n\n\treturn create_remote_transport_error(error);\n}\n\nfunction get_error_status(error: unknown): number | undefined {\n\tif (typeof error !== \"object\" || error === null) {\n\t\treturn undefined;\n\t}\n\n\tconst status = (error as { status?: unknown }).status;\n\n\treturn typeof status === \"number\" ? status : undefined;\n}\n\nfunction get_error_body(error: unknown): unknown {\n\tif (typeof error !== \"object\" || error === null) {\n\t\treturn undefined;\n\t}\n\n\tif (\"body\" in error) {\n\t\treturn (error as { body?: unknown }).body;\n\t}\n\n\tif (\"data\" in error) {\n\t\treturn (error as { data?: unknown }).data;\n\t}\n\n\treturn undefined;\n}\n","import { create_remote_http_error } from \"$/remote/shared.ts\";\nimport type { RemoteFailure } from \"$/remote/shared.ts\";\n\nimport { decode_remote_error, is_decoded_remote_failure } from \"./failures.ts\";\n\n/**\n * Decodes a failed fetch response into the runtime failure model.\n *\n * @example\n * ```ts\n * const failure = await decode_response_failure(response);\n * ```\n *\n * @since 2.0.0\n * @param response - Failed fetch response returned by the remote endpoint.\n * @returns Remote failure represented by the response.\n */\nexport async function decode_response_failure<ErrorType = never>(\n\tresponse: Response,\n): Promise<RemoteFailure<ErrorType>> {\n\tconst body = await response.json().catch(() => undefined);\n\tconst decoded = decode_remote_error<ErrorType>(body);\n\n\tif (is_decoded_remote_failure(decoded)) {\n\t\treturn decoded;\n\t}\n\n\treturn create_remote_http_error(response.status, body);\n}\n\n/**\n * Decodes either a raw value or `Response` returned by a native remote helper.\n *\n * @example\n * ```ts\n * const output = await decode_response_or_value(result, decode_payload);\n * ```\n *\n * @since 2.0.0\n * @param value - Native result value or fetch response.\n * @param decode_payload - Function used to decode successful payloads.\n * @returns Decoded successful output.\n */\nexport async function decode_response_or_value<Output, ErrorType = never>(\n\tvalue: unknown,\n\tdecode_payload: (value: unknown) => unknown,\n): Promise<Output> {\n\tif (value instanceof Response) {\n\t\tif (!value.ok) {\n\t\t\tthrow await decode_response_failure<ErrorType>(value);\n\t\t}\n\n\t\tconst data = await decode_success_response_body(value);\n\n\t\treturn decode_payload(data) as Output;\n\t}\n\n\treturn decode_payload(value) as Output;\n}\n\nasync function decode_success_response_body(response: Response): Promise<unknown> {\n\tif (response.status === 204 || response.status === 205) {\n\t\treturn undefined;\n\t}\n\n\tconst text = await response.text();\n\n\tif (text.length === 0) {\n\t\treturn undefined;\n\t}\n\n\treturn JSON.parse(text);\n}\n","import type { RemoteFailure } from \"$/remote/shared.ts\";\nimport { isRedirect } from \"@sveltejs/kit\";\nimport { Effect } from \"effect\";\n\nimport { is_decoded_remote_failure, normalize_native_error } from \"./failures.ts\";\n\n/**\n * Wraps a promise-producing remote operation in an Effect with failure mapping.\n *\n * @example\n * ```ts\n * const program = make_effect_from_promise(() => native_remote(input));\n * ```\n *\n * @since 2.0.0\n * @param run - Promise-producing operation that invokes a native remote helper.\n * @returns Effect that maps thrown values into remote failures.\n */\nexport function MakeEffectFromPromise<Output, ErrorType = never>(\n\trun: () => Promise<Output>,\n): Effect.Effect<Output, RemoteFailure<ErrorType>> {\n\treturn Effect.tryPromise({\n\t\ttry: run,\n\t\tcatch: (error: unknown) => {\n\t\t\tif (isRedirect(error)) {\n\t\t\t\tthrow error;\n\t\t\t}\n\n\t\t\tif (is_decoded_remote_failure(error)) {\n\t\t\t\treturn error;\n\t\t\t}\n\n\t\t\treturn normalize_native_error<ErrorType>(error);\n\t\t},\n\t}) as Effect.Effect<Output, RemoteFailure<ErrorType>>;\n}\n\n/**\n * Compatibility alias for {@link MakeEffectFromPromise}.\n *\n * @example\n * ```ts\n * const program = make_effect_from_promise(() => native_remote(input));\n * ```\n *\n * @since 2.0.0\n * @param run - Promise-producing operation that invokes a native remote helper.\n * @returns Effect that maps thrown values into remote failures.\n * @internal\n */\nexport const make_effect_from_promise = MakeEffectFromPromise;\n","import { copy_property_descriptors, has_method } from \"./utils.ts\";\nimport { decode_response_or_value } from \"./responses.ts\";\nimport { InvalidCommandFactoryError } from \"$/errors.ts\";\nimport type { RemoteFailure } from \"$/remote/shared.ts\";\nimport type { NativeMethod, Pending } from \"./types.ts\";\nimport { MakeEffectFromPromise } from \"./effect.ts\";\nimport type { Effect } from \"effect\";\n\ntype EffectRemoteCommandAdapter<Input, Output, ErrorType = never> = ((\n\tinput: undefined extends Input ? Input | void : Input,\n) => Effect.Effect<Output, RemoteFailure<ErrorType>>) & {\n\treadonly pending: number;\n};\n\n/**\n * Creates a remote command adapter. The adapter preserves the native\n * pending getter and turns each invocation into an Effect.\n *\n * @since 2.0.0\n * @param native_factory - SvelteKit's native command function or a legacy\n * response factory used by tests.\n * @param decode_payload - Function to decode the response payload.\n * @param _base - Deprecated transport base retained for compatibility.\n * @param pending - Optional pending counter for legacy response factories.\n * @returns A function returning an Effect of the response.\n * @internal\n */\nexport function create_remote_command_adapter<Input, Output, ErrorType = never>(\n\tnative_factory: unknown,\n\tdecode_payload: (value: unknown) => unknown,\n\t_base = \"\",\n\tpending?: Pending,\n): EffectRemoteCommandAdapter<Input, Output, ErrorType> {\n\tconst invoke = has_method(native_factory, \"invoke\") ? native_factory.invoke : undefined;\n\n\tif (typeof native_factory !== \"function\" && !invoke) {\n\t\tthrow new InvalidCommandFactoryError();\n\t}\n\n\tconst count = pending ?? { value: 0 };\n\n\tconst adapter = (input: undefined extends Input ? Input | void : Input) =>\n\t\tMakeEffectFromPromise<Output, ErrorType>(async () => {\n\t\t\tcount.value += 1;\n\n\t\t\ttry {\n\t\t\t\tconst result = invoke\n\t\t\t\t\t? await invoke(input)\n\t\t\t\t\t: await (native_factory as NativeMethod)(input);\n\n\t\t\t\treturn await decode_response_or_value<Output, ErrorType>(result, decode_payload);\n\t\t\t} finally {\n\t\t\t\tcount.value -= 1;\n\t\t\t}\n\t\t});\n\n\tcopy_property_descriptors(native_factory, adapter);\n\n\tif (!Object.prototype.hasOwnProperty.call(adapter, \"pending\")) {\n\t\tObject.defineProperty(adapter, \"pending\", {\n\t\t\tget: () => count.value,\n\t\t});\n\t}\n\n\treturn adapter as EffectRemoteCommandAdapter<Input, Output, ErrorType>;\n}\n","/**\n * Encodes remote form input into SvelteKit-compatible form data.\n *\n * @since 2.0.0\n * @param input - Input value supplied to the remote form.\n * @returns FormData payload for the remote endpoint.\n */\nexport function to_form_data(input: unknown): FormData {\n\tconst form_data = new FormData();\n\n\tappend_form_value(form_data, \"\", input);\n\n\treturn form_data;\n}\n\nfunction append_form_value(form_data: FormData, path: string, value: unknown): void {\n\tif (value === undefined) {\n\t\treturn;\n\t}\n\n\tif (Array.isArray(value)) {\n\t\tfor (const item of value) {\n\t\t\tappend_form_value(form_data, `${path}[]`, item);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif (value instanceof Blob) {\n\t\tform_data.append(path, value);\n\n\t\treturn;\n\t}\n\n\tif (typeof value === \"object\" && value !== null) {\n\t\tfor (const [key, child] of Object.entries(value)) {\n\t\t\tconst child_path = path.length === 0 ? key : `${path}.${key}`;\n\n\t\t\tappend_form_value(form_data, child_path, child);\n\t\t}\n\n\t\treturn;\n\t}\n\n\tif (typeof value === \"number\") {\n\t\tform_data.append(`n:${path}`, String(value));\n\n\t\treturn;\n\t}\n\n\tif (typeof value === \"boolean\") {\n\t\tif (value) {\n\t\t\tform_data.append(`b:${path}`, \"on\");\n\t\t}\n\n\t\treturn;\n\t}\n\n\tform_data.append(path, value === null ? \"\" : String(value));\n}\n","import {\n\tcreate_remote_http_error,\n\tcreate_remote_transport_error,\n\tcreate_remote_validation_error,\n} from \"$/remote/shared.ts\";\nimport {\n\tInvalidRemoteFormResponseError,\n\tRemoteFormEndpointMissingError,\n\tUnsupportedRemoteFormResponseError,\n} from \"$/errors.ts\";\nimport type { FormIssue } from \"$/remote/shared.ts\";\nimport { Option, Schema } from \"effect\";\nimport { parse } from \"devalue\";\n\nimport { decode_remote_error, is_decoded_remote_failure } from \"./failures.ts\";\nimport { decode_response_failure } from \"./responses.ts\";\nimport { to_form_data } from \"./form-data.ts\";\nimport type { NativeFormRecord } from \"./types.ts\";\n\ntype RemoteFormResponseEnvelope =\n\t| {\n\t\t\treadonly _tag: \"RemoteFormErrorEnvelope\";\n\t\t\treadonly error?: unknown;\n\t\t\treadonly status?: number | undefined;\n\t }\n\t| {\n\t\t\treadonly _tag: \"RemoteFormResultEnvelope\";\n\t\t\treadonly data?: string | undefined;\n\t\t\treadonly result?: string | undefined;\n\t };\n\ntype RemoteFormDecodedPayload<Output> = {\n\treadonly issues?: readonly FormIssue[];\n\treadonly result?: Output;\n};\n\nconst FormIssuePathSegmentSchema = Schema.Union([Schema.String, Schema.Number]);\n\nconst FormIssueSchema = Schema.Struct({\n\tmessage: Schema.String,\n\tpath: Schema.Array(FormIssuePathSegmentSchema),\n});\n\nconst RemoteFormErrorEnvelopeSchema = Schema.Struct({\n\ttype: Schema.Literal(\"error\"),\n\terror: Schema.optional(Schema.Unknown),\n\tstatus: Schema.optional(Schema.Number),\n});\n\nconst RemoteFormResultEnvelopeSchema = Schema.Struct({\n\ttype: Schema.Literal(\"result\"),\n\tdata: Schema.optional(Schema.String),\n\tresult: Schema.optional(Schema.String),\n});\n\nconst RemoteFormResponseEnvelopeSchema = Schema.Union([\n\tRemoteFormErrorEnvelopeSchema,\n\tRemoteFormResultEnvelopeSchema,\n]);\n\nconst RemoteFormDecodedPayloadSchema = Schema.Struct({\n\tissues: Schema.optional(Schema.Array(FormIssueSchema)),\n\tresult: Schema.optional(Schema.Unknown),\n});\n\nconst DecodeRemoteFormResponseEnvelope = Schema.decodeUnknownOption(\n\tRemoteFormResponseEnvelopeSchema,\n);\nconst DecodeRemoteFormPayload = Schema.decodeUnknownOption(RemoteFormDecodedPayloadSchema);\n\n/**\n * Submits a native remote form through the SvelteKit remote endpoint.\n *\n * @since 2.0.0\n * @param form_obj - Native form object being adapted.\n * @param input - Form input value.\n * @param decode_payload - Function to decode successful payloads.\n * @param remote_base - Base URL for the remote endpoint.\n * @returns Decoded form output.\n */\nexport async function submit_remote_form<Output>(\n\tform_obj: NativeFormRecord,\n\tinput: unknown,\n\tdecode_payload: (value: unknown) => unknown,\n\tremote_base: string,\n): Promise<Output> {\n\tconst action_id = get_remote_action_id(form_obj);\n\n\tif (!action_id || remote_base.length === 0) {\n\t\tthrow create_remote_transport_error(new RemoteFormEndpointMissingError());\n\t}\n\n\tconst response = await fetch(to_remote_form_url(remote_base, action_id), {\n\t\tmethod: \"POST\",\n\t\tbody: to_form_data(input),\n\t});\n\n\tif (!response.ok) {\n\t\tthrow await decode_response_failure(response);\n\t}\n\n\tconst envelope = await response.json();\n\n\treturn decode_form_response<Output>(envelope, decode_payload);\n}\n\n/**\n * Extracts SvelteKit's remote action id from a native form action URL.\n *\n * @since 2.0.0\n * @param form_obj - Native form object being adapted.\n * @returns Remote action id when present.\n */\nexport function get_remote_action_id(form_obj: NativeFormRecord): string | undefined {\n\tconst action = form_obj.action;\n\n\tif (typeof action !== \"string\") {\n\t\treturn undefined;\n\t}\n\n\tconst fallback = \"http://localhost/\";\n\tconst href = typeof location === \"undefined\" ? fallback : location.href;\n\tconst url = new URL(action, href);\n\n\treturn url.searchParams.get(\"/remote\") ?? url.searchParams.get(\"remote\") ?? undefined;\n}\n\nfunction to_remote_form_url(remote_base: string, action_id: string): string {\n\tconst parts = action_id.split(\"/\");\n\tconst head = parts.slice(0, 2).join(\"/\");\n\tconst tail = parts.slice(2).join(\"/\");\n\tconst normalized_base = remote_base.replace(/\\/$/, \"\");\n\n\tif (tail.length === 0) {\n\t\treturn `${normalized_base}/${head}`;\n\t}\n\n\treturn `${normalized_base}/${head}/${encodeURIComponent(tail)}`;\n}\n\nfunction decode_form_response<Output>(\n\tenvelope: unknown,\n\tdecode_payload: (value: unknown) => unknown,\n): Output {\n\tconst response = decode_remote_form_response_envelope(envelope);\n\n\tif (!response) {\n\t\tthrow create_remote_transport_error(new InvalidRemoteFormResponseError(envelope), envelope);\n\t}\n\n\tif (response._tag === \"RemoteFormErrorEnvelope\") {\n\t\tconst decoded = decode_remote_error(response.error);\n\n\t\tif (is_decoded_remote_failure(decoded)) {\n\t\t\tthrow decoded;\n\t\t}\n\n\t\tthrow create_remote_http_error(response.status ?? 500, response.error);\n\t}\n\n\tconst result_text = response.result ?? response.data;\n\n\tif (result_text === undefined) {\n\t\tthrow create_remote_transport_error(\n\t\t\tnew UnsupportedRemoteFormResponseError(envelope),\n\t\t\tenvelope,\n\t\t);\n\t}\n\n\tconst parsed = parse(result_text);\n\tconst decoded = decode_remote_form_payload<Output>(decode_payload(parsed));\n\n\tif (!decoded) {\n\t\tthrow create_remote_transport_error(\n\t\t\tnew UnsupportedRemoteFormResponseError(envelope),\n\t\t\tenvelope,\n\t\t);\n\t}\n\n\tif (decoded.issues && decoded.issues.length > 0) {\n\t\tthrow create_remote_validation_error(decoded.issues, decoded, 400);\n\t}\n\n\treturn decoded.result as Output;\n}\n\nfunction decode_remote_form_response_envelope(\n\tenvelope: unknown,\n): RemoteFormResponseEnvelope | undefined {\n\tconst decoded = DecodeRemoteFormResponseEnvelope(envelope);\n\n\tif (!Option.isSome(decoded)) {\n\t\treturn undefined;\n\t}\n\n\tif (decoded.value.type === \"error\") {\n\t\treturn {\n\t\t\t_tag: \"RemoteFormErrorEnvelope\",\n\t\t\terror: decoded.value.error,\n\t\t\tstatus: decoded.value.status,\n\t\t};\n\t}\n\n\treturn {\n\t\t_tag: \"RemoteFormResultEnvelope\",\n\t\tdata: decoded.value.data,\n\t\tresult: decoded.value.result,\n\t};\n}\n\nfunction decode_remote_form_payload<Output>(\n\tpayload: unknown,\n): RemoteFormDecodedPayload<Output> | undefined {\n\tconst decoded = DecodeRemoteFormPayload(payload);\n\n\tif (!Option.isSome(decoded)) {\n\t\treturn undefined;\n\t}\n\n\treturn decoded.value as RemoteFormDecodedPayload<Output>;\n}\n","import { get_dispatcher } from \"$/dispatcher.ts\";\nimport { Effect } from \"effect\";\n\nimport { MakeEffectFromPromise } from \"./effect.ts\";\nimport { has_method } from \"./utils.ts\";\nimport type { EffectRemoteFormSubmit, NativeMethod } from \"./types.ts\";\n\n/**\n * Wraps a remote form enhance callback so Effect return values are run.\n *\n * @since 2.0.0\n * @param callback - Native enhance callback to wrap.\n * @returns Wrapped callback or undefined.\n */\nexport function wrap_enhance_callback<Output, ErrorType = never>(\n\tcallback: NativeMethod | undefined,\n): NativeMethod | undefined {\n\tif (!callback) {\n\t\treturn undefined;\n\t}\n\n\treturn (event: unknown) => {\n\t\tconst wrapped_event = wrap_submit_callback<Output, ErrorType>(event);\n\t\tconst result = callback(wrapped_event);\n\n\t\tif (Effect.isEffect(result)) {\n\t\t\treturn get_dispatcher().run(result);\n\t\t}\n\n\t\treturn result;\n\t};\n}\n\nfunction wrap_submit_callback<Output, ErrorType>(event: unknown): unknown {\n\tif (typeof event !== \"object\" || event === null || !has_method(event, \"submit\")) {\n\t\treturn event;\n\t}\n\n\tconst original_submit = event.submit;\n\tconst { submit: _submit, ...descriptors } = Object.getOwnPropertyDescriptors(event);\n\n\tvoid _submit;\n\n\treturn Object.defineProperties(\n\t\t{},\n\t\t{\n\t\t\t...descriptors,\n\t\t\tsubmit: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tenumerable: false,\n\t\t\t\tvalue: () => make_submit_effect<Output, ErrorType>(original_submit, event),\n\t\t\t},\n\t\t},\n\t);\n}\n\nfunction make_submit_effect<Output, ErrorType>(\n\toriginal_submit: NativeMethod,\n\tevent: unknown,\n): EffectRemoteFormSubmit<Output, ErrorType> {\n\tlet updates_args: unknown[] | undefined;\n\n\tconst SubmitEffect = MakeEffectFromPromise<Output | undefined, ErrorType>(\n\t\tasync (): Promise<Output | undefined> => {\n\t\t\tconst result = original_submit();\n\t\t\tconst value =\n\t\t\t\tupdates_args && has_method(result, \"updates\")\n\t\t\t\t\t? await Promise.resolve(result.updates(...updates_args))\n\t\t\t\t\t: await Promise.resolve(result);\n\n\t\t\tif (typeof value === \"boolean\") {\n\t\t\t\treturn read_submit_result<Output>(event);\n\t\t\t}\n\n\t\t\treturn value as Output;\n\t\t},\n\t) as EffectRemoteFormSubmit<Output, ErrorType>;\n\n\tObject.defineProperty(SubmitEffect, \"updates\", {\n\t\tconfigurable: true,\n\t\tenumerable: false,\n\t\tvalue: (...args: unknown[]) => {\n\t\t\tupdates_args ??= args;\n\n\t\t\treturn SubmitEffect;\n\t\t},\n\t});\n\n\treturn SubmitEffect;\n}\n\nfunction read_submit_result<Output>(event: unknown): Output | undefined {\n\tif (typeof event !== \"object\" || event === null || !(\"result\" in event)) {\n\t\treturn undefined;\n\t}\n\n\treturn Reflect.get(event, \"result\") as Output | undefined;\n}\n","import type { RemoteFormInput } from \"@sveltejs/kit\";\n\nimport { decode_response_or_value } from \"./responses.ts\";\nimport { MakeEffectFromPromise } from \"./effect.ts\";\nimport { get_remote_action_id, submit_remote_form } from \"./form-transport.ts\";\nimport { copy_property_descriptors, has_method } from \"./utils.ts\";\nimport { wrap_enhance_callback } from \"./form-enhance.ts\";\nimport type { EffectRemoteForm, NativeFormRecord, NativeMethod } from \"./types.ts\";\n\ntype RemoteInput<Input> = undefined extends Input ? Input | void : Input;\n\n/**\n * Creates a remote form adapter. The callable preserves SvelteKit's native\n * form descriptors while wrapping `validate`, `enhance`, and programmatic\n * submission in Effect-returning APIs.\n *\n * @example\n * ```ts\n * const createPost = create_remote_form_adapter(nativeForm, (value) => value);\n * yield* createPost.validate({ includeUntouched: true });\n * ```\n *\n * @since 2.0.0\n * @param native_factory - SvelteKit's native form object.\n * @param decode_payload - Function to decode the response payload.\n * @param remote_base - Base URL for SvelteKit's remote endpoint.\n * @returns A callable form function whose properties mirror the native form.\n * @internal\n */\nexport function create_remote_form_adapter<\n\tInput extends RemoteFormInput | void,\n\tOutput,\n\tErrorType = never,\n>(\n\tnative_factory: unknown,\n\tdecode_payload: (value: unknown) => unknown,\n\tremote_base = \"\",\n): EffectRemoteForm<Input, Output, ErrorType> {\n\tconst form_obj = native_factory as NativeFormRecord;\n\n\tconst submit_effect = (input?: RemoteInput<Input>) =>\n\t\tMakeEffectFromPromise<Output, ErrorType>(async () => {\n\t\t\tconst can_use_remote_endpoint =\n\t\t\t\tremote_base.length > 0 && get_remote_action_id(form_obj) !== undefined;\n\n\t\t\tif (has_method(form_obj, \"submit\") && !can_use_remote_endpoint) {\n\t\t\t\tconst result = await form_obj.submit(input);\n\n\t\t\t\treturn await decode_response_or_value<Output>(result, decode_payload);\n\t\t\t}\n\n\t\t\treturn await submit_remote_form<Output>(form_obj, input, decode_payload, remote_base);\n\t\t});\n\n\tconst callable = ((input?: RemoteInput<Input>) => submit_effect(input)) as EffectRemoteForm<\n\t\tInput,\n\t\tOutput,\n\t\tErrorType\n\t>;\n\n\tcopy_property_descriptors(\n\t\tform_obj,\n\t\tcallable,\n\t\tnew Set([\"submit\", \"validate\", \"enhance\", \"for\", \"preflight\"]),\n\t);\n\n\tObject.defineProperty(callable, \"submit\", {\n\t\tconfigurable: true,\n\t\tenumerable: false,\n\t\tvalue: submit_effect,\n\t});\n\n\tif (has_method(form_obj, \"validate\")) {\n\t\tObject.defineProperty(callable, \"validate\", {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: (options?: Record<string, unknown>) =>\n\t\t\t\tMakeEffectFromPromise<void, ErrorType>(async () => {\n\t\t\t\t\tawait form_obj.validate(options);\n\t\t\t\t}),\n\t\t});\n\t}\n\n\tif (has_method(form_obj, \"enhance\")) {\n\t\tObject.defineProperty(callable, \"enhance\", {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: (callback?: NativeMethod) =>\n\t\t\t\tform_obj.enhance(wrap_enhance_callback<Output, ErrorType>(callback)),\n\t\t});\n\t}\n\n\tif (has_method(form_obj, \"for\")) {\n\t\tObject.defineProperty(callable, \"for\", {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: (key: string | number | boolean) =>\n\t\t\t\tcreate_remote_form_adapter<Input, Output, ErrorType>(\n\t\t\t\t\tform_obj.for(key),\n\t\t\t\t\tdecode_payload,\n\t\t\t\t\tremote_base,\n\t\t\t\t),\n\t\t});\n\t}\n\n\tif (has_method(form_obj, \"preflight\")) {\n\t\tObject.defineProperty(callable, \"preflight\", {\n\t\t\tconfigurable: true,\n\t\t\tenumerable: false,\n\t\t\tvalue: (schema: unknown) => {\n\t\t\t\tform_obj.preflight(schema);\n\n\t\t\t\treturn callable;\n\t\t\t},\n\t\t});\n\t}\n\n\treturn callable;\n}\n","import { decode_response_or_value } from \"./responses.ts\";\nimport { has_method } from \"./utils.ts\";\n\n/**\n * Resolves native query results, including SvelteKit run handles.\n *\n * @example\n * ```ts\n * const output = await resolve_query_result(result, decode_payload);\n * ```\n *\n * @since 2.0.0\n * @param value - Native query result or query run handle.\n * @param decode_payload - Function used to decode successful payloads.\n * @returns Decoded query output.\n */\nexport async function resolve_query_result<Output>(\n\tvalue: unknown,\n\tdecode_payload: (value: unknown) => unknown,\n): Promise<Output> {\n\tif (has_method(value, \"then\")) {\n\t\tconst result = await Promise.resolve(value);\n\n\t\treturn decode_response_or_value(result, decode_payload);\n\t}\n\n\tif (has_method(value, \"run\")) {\n\t\tconst result = await value.run();\n\n\t\treturn decode_response_or_value(result, decode_payload);\n\t}\n\n\tconst result = await Promise.resolve(value);\n\n\treturn decode_response_or_value(result, decode_payload);\n}\n","import { InvalidLiveQueryFactoryError, InvalidQueryFactoryError } from \"$/errors.ts\";\nimport { copy_property_descriptors, has_method } from \"./utils.ts\";\nimport { normalize_native_error } from \"./failures.ts\";\nimport { resolve_query_result } from \"./query-result.ts\";\nimport { MakeEffectFromPromise } from \"./effect.ts\";\nimport type { EffectRemoteQueryUpdateBrand, NativeMethod } from \"./types.ts\";\nimport type { RemoteFailure } from \"$/remote/shared.ts\";\nimport { Effect } from \"effect\";\n\ntype RemoteInput<Input> = undefined extends Input ? Input | void : Input;\n\ntype DecodePayload<Output> = (value: unknown) => Output;\n\ntype NativeQueryFactory<Input> =\n\t| ((input: RemoteInput<Input>) => unknown)\n\t| {\n\t\t\treadonly load: (input: RemoteInput<Input>) => unknown;\n\t };\n\ntype RemoteResourceEffect<Output, ErrorType = never> = Effect.Effect<\n\tOutput,\n\tRemoteFailure<ErrorType>\n> & {\n\treadonly current: Output | undefined;\n\treadonly error: unknown;\n\treadonly loading: boolean;\n\treadonly ready: boolean;\n};\n\ntype RemoteResourceLike<Output, ErrorType = never> =\n\t| RemoteResourceEffect<Output, ErrorType>\n\t| RemoteLiveQueryResource<Output>;\n\ntype RemoteQueryEffect<Output, ErrorType = never> = RemoteResourceEffect<Output, ErrorType> & {\n\treadonly refresh: () => Effect.Effect<void, unknown, never>;\n\treadonly set: (value: Output) => void;\n\treadonly withOverride: (update: (current: Output) => Output) => unknown;\n};\n\ntype RemoteLiveQueryEffect<Output, ErrorType = never> = Effect.Effect<\n\tRemoteLiveQueryResource<Output>,\n\tRemoteFailure<ErrorType>\n>;\n\ntype RemoteLiveQueryResource<Output> = {\n\treadonly connected: boolean;\n\treadonly current: Output | undefined;\n\treadonly done: boolean;\n\treadonly error: unknown;\n\treadonly loading: boolean;\n\treadonly ready: boolean;\n\treadonly reconnect: () => Effect.Effect<void, unknown, never>;\n} & AsyncIterable<Output>;\n\ntype NativeRemoteResource<Output> = {\n\treadonly connected?: boolean;\n\treadonly current?: Output;\n\treadonly done?: boolean;\n\treadonly error?: unknown;\n\treadonly loading?: boolean;\n\treadonly ready?: boolean;\n\treadonly reconnect?: () => Promise<void>;\n\treadonly refresh?: () => Promise<void>;\n\treadonly set?: (value: Output) => void;\n\treadonly withOverride?: (update: (current: Output) => Output) => unknown;\n\treadonly [Symbol.asyncIterator]?: () => AsyncIterator<Output>;\n};\n\n/**\n * Creates a remote query adapter. The returned function takes input and\n * returns an `Effect` that executes SvelteKit's native query function.\n *\n * @example\n * ```ts\n * const getUser = create_remote_query_adapter(nativeQuery, (value) => value);\n * const user = yield* getUser({ id: 1 });\n * ```\n *\n * @since 2.0.0\n * @param native_factory - SvelteKit's native query function or a legacy\n * response factory used by tests.\n * @param decode_payload - Function to decode the response payload.\n * @param _base - Deprecated transport base retained for compatibility.\n * @returns A function returning an Effect of the response.\n * @internal\n */\nexport function create_remote_query_adapter<Input, Output, ErrorType = never>(\n\tnative_factory: NativeQueryFactory<Input>,\n\tdecode_payload: DecodePayload<Output>,\n\t_base?: string,\n): EffectRemoteQueryUpdateBrand &\n\t((input: RemoteInput<Input>) => RemoteQueryEffect<Output, ErrorType>);\nexport function create_remote_query_adapter<Input, Output, ErrorType = never>(\n\tnative_factory: NativeQueryFactory<Input>,\n\tdecode_payload: (value: unknown) => unknown,\n\t_base?: string,\n): EffectRemoteQueryUpdateBrand &\n\t((input: RemoteInput<Input>) => RemoteQueryEffect<Output, ErrorType>);\nexport function create_remote_query_adapter<Input, Output, ErrorType = never>(\n\tnative_factory: unknown,\n\tdecode_payload: DecodePayload<Output>,\n\t_base = \"\",\n): EffectRemoteQueryUpdateBrand &\n\t((input: RemoteInput<Input>) => RemoteQueryEffect<Output, ErrorType>) {\n\tconst load = has_method(native_factory, \"load\") ? native_factory.load : undefined;\n\tconst query =\n\t\ttypeof native_factory === \"function\" ? (native_factory as NativeMethod) : undefined;\n\n\tif (!query && !load) {\n\t\tthrow new InvalidQueryFactoryError();\n\t}\n\n\tconst wrapped = ((input: RemoteInput<Input>) => {\n\t\tif (!query) {\n\t\t\treturn MakeEffectFromPromise<Output, ErrorType>(async () => {\n\t\t\t\tconst result = await load?.(input);\n\n\t\t\t\treturn await resolve_query_result<Output>(result, decode_payload);\n\t\t\t}) as RemoteQueryEffect<Output, ErrorType>;\n\t\t}\n\n\t\tconst resource = query(input);\n\t\tconst QueryEffect = MakeEffectFromPromise<Output, ErrorType>(\n\t\t\tasync () => await resolve_query_result<Output>(resource, decode_payload),\n\t\t) as RemoteQueryEffect<Output, ErrorType>;\n\n\t\tattach_query_resource(resource, QueryEffect);\n\n\t\treturn QueryEffect;\n\t}) as EffectRemoteQueryUpdateBrand &\n\t\t((input: RemoteInput<Input>) => RemoteQueryEffect<Output, ErrorType>);\n\n\tcopy_property_descriptors(native_factory, wrapped);\n\n\treturn wrapped;\n}\n\n/**\n * Creates a remote live query adapter. The returned function takes input and\n * returns an `Effect` that resolves to a live query resource with stream state\n * and reconnect controls.\n *\n * @example\n * ```ts\n * const getTime = create_remote_live_query_adapter(nativeLive, (value) => value);\n * const time = yield* getTime();\n * const current = time.current;\n * ```\n *\n * @since 2.0.0\n * @param native_factory - SvelteKit's native live query function.\n * @param _decode_payload - Deprecated payload decoder retained for parity with\n * other remote adapters.\n * @param _base - Deprecated transport base retained for compatibility.\n * @returns A function returning an Effect-backed live query resource.\n * @internal\n */\nexport function create_remote_live_query_adapter<Input, Output, ErrorType = never>(\n\tnative_factory: unknown,\n\t_decode_payload: (value: unknown) => unknown,\n\t_base = \"\",\n): EffectRemoteQueryUpdateBrand &\n\t((input: RemoteInput<Input>) => RemoteLiveQueryEffect<Output, ErrorType>) {\n\tconst query =\n\t\ttypeof native_factory === \"function\" ? (native_factory as NativeMethod) : undefined;\n\n\tif (!query) {\n\t\tthrow new InvalidLiveQueryFactoryError();\n\t}\n\n\tconst wrapped = ((input: Input) =>\n\t\tEffect.try({\n\t\t\ttry: () => {\n\t\t\t\tconst resource = query(input);\n\n\t\t\t\treturn make_live_query_resource<Output>(resource);\n\t\t\t},\n\t\t\tcatch: normalize_native_error,\n\t\t}) as RemoteLiveQueryEffect<Output>) as EffectRemoteQueryUpdateBrand &\n\t\t((input: RemoteInput<Input>) => RemoteLiveQueryEffect<Output, ErrorType>);\n\n\tcopy_property_descriptors(native_factory, wrapped);\n\n\treturn wrapped;\n}\n\nfunction is_resource<Output>(resource: unknown): resource is NativeRemoteResource<Output> {\n\tconst resource_type = typeof resource;\n\n\treturn (resource_type === \"object\" && resource !== null) || resource_type === \"function\";\n}\n\nfunction attach_resource_getters<Output, ErrorType = never>(\n\tresource: unknown,\n\teffect: RemoteResourceLike<Output, ErrorType>,\n): void {\n\tconst methods = is_resource<Output>(resource) ? resource : undefined;\n\tconst keys = [\"current\", \"error\", \"loading\", \"ready\"] as const;\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tfor (const key of keys) {\n\t\tif (!(key in methods)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tObject.defineProperty(effect, key, {\n\t\t\tconfigurable: true,\n\t\t\tget: () => methods[key],\n\t\t});\n\t}\n}\n\nfunction attach_query_resource<Output, ErrorType = never>(\n\tresource: unknown,\n\teffect: RemoteQueryEffect<Output, ErrorType>,\n): void {\n\tconst methods = is_resource<Output>(resource) ? resource : undefined;\n\tconst refresh = methods?.refresh;\n\tconst set = methods?.set;\n\tconst with_override = methods?.withOverride;\n\n\tattach_resource_getters(resource, effect);\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tif (typeof refresh === \"function\") {\n\t\tObject.defineProperty(effect, \"refresh\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () => MakeEffectFromPromise(() => Promise.resolve(refresh.call(resource))),\n\t\t});\n\t}\n\n\tif (typeof set === \"function\") {\n\t\tObject.defineProperty(effect, \"set\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: (value: Output) => set.call(resource, value),\n\t\t});\n\t}\n\n\tif (typeof with_override === \"function\") {\n\t\tObject.defineProperty(effect, \"withOverride\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: (update: (current: Output) => Output) => with_override.call(resource, update),\n\t\t});\n\t}\n}\n\nfunction attach_live_query_resource<Output>(\n\tresource: unknown,\n\teffect: RemoteLiveQueryResource<Output>,\n): void {\n\tconst methods = is_resource<Output>(resource) ? resource : undefined;\n\tconst async_iterator = methods?.[Symbol.asyncIterator];\n\tconst reconnect = methods?.reconnect;\n\tconst keys = [\"connected\", \"done\"] as const;\n\n\tattach_resource_getters(resource, effect);\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tfor (const key of keys) {\n\t\tif (!(key in methods)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tObject.defineProperty(effect, key, {\n\t\t\tconfigurable: true,\n\t\t\tget: () => methods[key],\n\t\t});\n\t}\n\n\tif (typeof reconnect === \"function\") {\n\t\tObject.defineProperty(effect, \"reconnect\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () => MakeEffectFromPromise(() => Promise.resolve(reconnect.call(resource))),\n\t\t});\n\t}\n\n\tif (typeof async_iterator === \"function\") {\n\t\tObject.defineProperty(effect, Symbol.asyncIterator, {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () => async_iterator.call(resource),\n\t\t});\n\t}\n}\n\nfunction make_live_query_resource<Output>(resource: unknown): RemoteLiveQueryResource<Output> {\n\tconst live_resource = {} as RemoteLiveQueryResource<Output>;\n\n\tattach_live_query_resource(resource, live_resource);\n\n\treturn live_resource;\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAWA,SAAgB,WACf,OACA,KACmC;CACnC,OACC,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAAuC,SAAS;AAE1D;;;ACiB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AAM,gBAAgB,CAAC;CAEvB,2BAA2B,UAAU,aAAa;CAElD,OAAO;AACR"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
//#region src/internal/descriptors.ts
|
|
2
|
-
const default_excluded_descriptor_keys = /* @__PURE__ */ new Set([
|
|
3
|
-
"length",
|
|
4
|
-
"name",
|
|
5
|
-
"prototype"
|
|
6
|
-
]);
|
|
7
|
-
/**
|
|
8
|
-
* Copies own property descriptors from a native helper to a wrapper while
|
|
9
|
-
* skipping function metadata and any caller-specific keys.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```ts
|
|
13
|
-
* copy_property_descriptors(native_remote, wrapped_remote);
|
|
14
|
-
* ```
|
|
15
|
-
*
|
|
16
|
-
* @since 2.0.0
|
|
17
|
-
* @param source - Source object or function whose descriptors should be
|
|
18
|
-
* mirrored.
|
|
19
|
-
* @param target - Wrapper object or function that receives copied descriptors.
|
|
20
|
-
* @param exclude - Additional property keys that should not be copied.
|
|
21
|
-
* @returns Nothing.
|
|
22
|
-
*/
|
|
23
|
-
function copy_property_descriptors(source, target, exclude = default_excluded_descriptor_keys) {
|
|
24
|
-
if (typeof source !== "object" && typeof source !== "function") return;
|
|
25
|
-
if (source === null) return;
|
|
26
|
-
for (const key of Reflect.ownKeys(source)) {
|
|
27
|
-
if (default_excluded_descriptor_keys.has(key) || exclude.has(key)) continue;
|
|
28
|
-
const descriptor = Object.getOwnPropertyDescriptor(source, key);
|
|
29
|
-
if (!descriptor) continue;
|
|
30
|
-
Object.defineProperty(target, key, descriptor);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
//#endregion
|
|
34
|
-
export { copy_property_descriptors as t };
|
|
35
|
-
|
|
36
|
-
//# sourceMappingURL=descriptors-cOe9uRJz.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"descriptors-cOe9uRJz.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/internal/descriptors.ts"],"sourcesContent":["const default_excluded_descriptor_keys = new Set<PropertyKey>([\"length\", \"name\", \"prototype\"]);\n\n/**\n * Copies own property descriptors from a native helper to a wrapper while\n * skipping function metadata and any caller-specific keys.\n *\n * @example\n * ```ts\n * copy_property_descriptors(native_remote, wrapped_remote);\n * ```\n *\n * @since 2.0.0\n * @param source - Source object or function whose descriptors should be\n * mirrored.\n * @param target - Wrapper object or function that receives copied descriptors.\n * @param exclude - Additional property keys that should not be copied.\n * @returns Nothing.\n */\nexport function copy_property_descriptors(\n\tsource: unknown,\n\ttarget: object,\n\texclude: ReadonlySet<PropertyKey> = default_excluded_descriptor_keys,\n): void {\n\tif (typeof source !== \"object\" && typeof source !== \"function\") {\n\t\treturn;\n\t}\n\n\tif (source === null) {\n\t\treturn;\n\t}\n\n\tfor (const key of Reflect.ownKeys(source)) {\n\t\tif (default_excluded_descriptor_keys.has(key) || exclude.has(key)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst descriptor = Object.getOwnPropertyDescriptor(source, key);\n\n\t\tif (!descriptor) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tObject.defineProperty(target, key, descriptor);\n\t}\n}\n"],"mappings":";AAAA,MAAM,mDAAmC,IAAI,IAAiB;CAAC;CAAU;CAAQ;AAAW,CAAC;;;;;;;;;;;;;;;;;AAkB7F,SAAgB,0BACf,QACA,QACA,UAAoC,kCAC7B;CACP,IAAI,OAAO,WAAW,YAAY,OAAO,WAAW,YACnD;CAGD,IAAI,WAAW,MACd;CAGD,KAAK,MAAM,OAAO,QAAQ,QAAQ,MAAM,GAAG;EAC1C,IAAI,iCAAiC,IAAI,GAAG,KAAK,QAAQ,IAAI,GAAG,GAC/D;EAGD,MAAM,aAAa,OAAO,yBAAyB,QAAQ,GAAG;EAE9D,IAAI,CAAC,YACJ;EAGD,OAAO,eAAe,QAAQ,KAAK,UAAU;CAC9C;AACD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors-Dcf0MVbq.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/errors.ts"],"sourcesContent":["/**\n * Base class for runtime-authored errors. The class gives every local failure\n * a stable JavaScript error name while preserving the technical message that\n * reaches Vite, SvelteKit, and test output.\n *\n * @example\n * ```ts\n * throw new RuntimeError(\"Invariant violated.\");\n * ```\n *\n * @since 2.4.0\n * @param message - Technical diagnostic message describing the failed runtime\n * invariant.\n * @returns A runtime-authored Error instance.\n */\nexport class RuntimeError extends Error {\n\tconstructor(message: string) {\n\t\tsuper(message);\n\t\tthis.name = \"RuntimeError\";\n\t}\n}\n\n/**\n * Formats a runtime-owned error message with a stable screaming-case code.\n *\n * @example\n * ```ts\n * throw new Error(make_error_message(\"DISPATCHER_DISPOSED\", \"Dispatcher has been disposed\"));\n * ```\n *\n * @since 2.0.0\n * @param code - Stable screaming-case identifier for the error category.\n * @param message - Human-readable error message without the leading code.\n * @returns The complete error message prefixed with the stable code.\n */\nexport function make_error_message(code: string, message: string): string {\n\treturn `[${code}]: ${message}`;\n}\n\n/**\n * Base error class for all preprocessor errors emitted during script and\n * markup transformation. Carries the source filename so error messages can\n * reference the affected file.\n *\n * @example\n * ```ts\n * throw new PreprocessError(\"Component.svelte: invalid transform input.\", \"Component.svelte\");\n * ```\n *\n * @since 2.0.0\n * @param message - Technical diagnostic message for the transform failure.\n * @param filename - Source filename that triggered the transform failure.\n * @returns A preprocessor Error instance with source file context.\n */\nexport class PreprocessError extends RuntimeError {\n\t/**\n\t * The source filename that triggered this error.\n\t *\n\t * @since 2.0.0\n\t */\n\treadonly filename: string;\n\n\tconstructor(message: string, filename: string) {\n\t\tsuper(message);\n\t\tthis.name = \"PreprocessError\";\n\t\tthis.filename = filename;\n\t}\n}\n\n/**\n * Retained for compatibility when callers need a structured representation of\n * possible Vite plugin ordering conflicts.\n *\n * @example\n * ```ts\n * throw new VitePreTransformPluginConflictError([\"wuchale\"]);\n * ```\n *\n * @since 2.4.0\n * @param plugin_names - Names of Vite plugins that declare pre-transform\n * priority and may parse raw component files before SER lowers them.\n * @returns A runtime-authored Error describing the possible plugin ordering\n * conflict.\n */\nexport class VitePreTransformPluginConflictError extends RuntimeError {\n\t/**\n\t * Names of conflicting Vite plugins.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly plugin_names: readonly string[];\n\n\tconstructor(plugin_names: readonly string[]) {\n\t\tsuper(\n\t\t\t[\n\t\t\t\t`Svelte Effect Runtime noticed possible Vite plugin ordering conflicts.`,\n\t\t\t\t\"\",\n\t\t\t\t`These plugins run before normal Svelte component transforms:`,\n\t\t\t\t...plugin_names.map((plugin_name) => ` - ${plugin_name}`),\n\t\t\t\t\"\",\n\t\t\t\t`This is usually fine, but if you see Svelte parser errors around <script effect>`,\n\t\t\t\t`or yield* in components, one of those plugins may be reading component files before`,\n\t\t\t\t`SER has lowered its syntax.`,\n\t\t\t].join(\"\\n\"),\n\t\t);\n\t\tthis.name = \"VitePreTransformPluginConflictError\";\n\t\tthis.plugin_names = plugin_names;\n\t}\n}\n\n/**\n * Thrown when a statement mixes JavaScript `await` with Effect `yield*` work\n * that must be lowered into an `Effect.gen` program.\n *\n * @example\n * ```ts\n * throw new AwaitInEffectWorkError(\"Component.svelte\", \"const value = await load();\");\n * ```\n *\n * @since 2.0.0\n * @param filename - Source filename containing the unsupported statement.\n * @param statement_text - Full source text for the statement containing\n * mixed async work.\n * @returns A preprocessor Error instance with statement context.\n */\nexport class AwaitInEffectWorkError extends PreprocessError {\n\t/**\n\t * The full text of the problematic statement containing mixed async work.\n\t *\n\t * @since 2.0.0\n\t */\n\treadonly statement_text: string;\n\n\tconstructor(filename: string, statement_text: string) {\n\t\tsuper(\n\t\t\t[\n\t\t\t\tmake_error_message(\n\t\t\t\t\t\"AWAIT_IN_EFFECT_WORK\",\n\t\t\t\t\t`${filename}: await cannot be mixed with yield* in Effect work.`,\n\t\t\t\t),\n\t\t\t\t`Top-level await is supported as ordinary Svelte async rendering, but statements lowered into Effect.gen must use yield* for async Effect work.`,\n\t\t\t\t\"\",\n\t\t\t\t`Problematic statement:`,\n\t\t\t\tstatement_text,\n\t\t\t].join(\"\\n\"),\n\t\t\tfilename,\n\t\t);\n\t\tthis.name = \"AwaitInEffectWorkError\";\n\t\tthis.statement_text = statement_text;\n\t}\n}\n\n/**\n * Thrown when async Effect work appears inside a Svelte rune position that\n * must stay synchronous.\n *\n * @example\n * ```ts\n * throw new AsyncEffectInSyncRuneError(\"$derived\", \"$derived(yield* load())\", \"Component.svelte\");\n * ```\n *\n * @since 2.0.0\n * @param rune_name - Name of the Svelte rune containing the unsupported async\n * Effect work.\n * @param expression_text - Full source text for the rune expression.\n * @param filename - Source filename containing the unsupported rune.\n * @returns A preprocessor Error instance with rune source context.\n */\nexport class AsyncEffectInSyncRuneError extends PreprocessError {\n\t/**\n\t * The name of the rune that contained async Effect work.\n\t *\n\t * @since 2.0.0\n\t */\n\treadonly rune_name: string;\n\n\t/**\n\t * The full text of the expression that triggered the error.\n\t *\n\t * @since 2.0.0\n\t */\n\treadonly expression_text: string;\n\n\tconstructor(rune_name: string, expression_text: string, filename: string) {\n\t\tsuper(\n\t\t\t[\n\t\t\t\tmake_error_message(\n\t\t\t\t\t\"ASYNC_EFFECT_IN_SYNC_RUNE\",\n\t\t\t\t\t`${filename}: yield* cannot be used inside ${rune_name}().`,\n\t\t\t\t),\n\t\t\t\t`${rune_name}() must stay synchronous. Do not put async Effect work inside this rune.`,\n\t\t\t\t\"\",\n\t\t\t\t`Problematic expression:`,\n\t\t\t\texpression_text,\n\t\t\t].join(\"\\n\"),\n\t\t\tfilename,\n\t\t);\n\t\tthis.name = \"AsyncEffectInSyncRuneError\";\n\t\tthis.rune_name = rune_name;\n\t\tthis.expression_text = expression_text;\n\t}\n}\n\n/**\n * Thrown when async Effect work appears inside a non-generator callback nested\n * in a markup event handler.\n *\n * @example\n * ```ts\n * throw new AsyncEffectInEventCallbackError(\n * \"Component.svelte\",\n * \"Effect.try(() => yield* save())\",\n * );\n * ```\n *\n * @since 2.0.0\n * @param filename - Source filename containing the invalid event handler.\n * @param expression_text - Event handler expression that contains the nested\n * unsupported async Effect work.\n * @returns A preprocessor Error instance with event expression context.\n */\nexport class AsyncEffectInEventCallbackError extends PreprocessError {\n\t/**\n\t * The full text of the problematic event handler body.\n\t *\n\t * @since 2.0.0\n\t */\n\treadonly expression_text: string;\n\n\tconstructor(filename: string, expression_text: string) {\n\t\tsuper(\n\t\t\t[\n\t\t\t\tmake_error_message(\n\t\t\t\t\t\"ASYNC_EFFECT_IN_EVENT_CALLBACK\",\n\t\t\t\t\t`${filename}: yield* cannot be used inside a nested non-generator callback in a markup event handler.`,\n\t\t\t\t),\n\t\t\t\t`Move the yield* to the event handler body. Effect.try and Effect.sync callbacks are plain synchronous JavaScript; do not call Effect-returning functions inside them.`,\n\t\t\t\t\"\",\n\t\t\t\t`Run the remote Effect directly:`,\n\t\t\t\t` onclick={yield* UpvotePost(id)}`,\n\t\t\t\t\"\",\n\t\t\t\t`Recover from remote failures by composing the Effect value:`,\n\t\t\t\t` onclick={yield* UpvotePost(id).pipe(Effect.catch(() => Effect.void))}`,\n\t\t\t\t\"\",\n\t\t\t\t`Problematic expression:`,\n\t\t\t\texpression_text,\n\t\t\t].join(\"\\n\"),\n\t\t\tfilename,\n\t\t);\n\t\tthis.name = \"AsyncEffectInEventCallbackError\";\n\t\tthis.expression_text = expression_text;\n\t}\n}\n\n/**\n * Thrown when an event handler callback contains the old raw `yield*`\n * shorthand. Effectful event handlers must put `yield*` directly in the event\n * attribute so the callback boundary is generated by the markup runtime.\n *\n * @example\n * ```ts\n * throw new YieldStarInEventCallbackError(\"Component.svelte\", \"() => yield* save()\");\n * ```\n *\n * @since 2.0.0\n * @param filename - Svelte component filename used to identify where the\n * invalid event handler callback was found.\n * @param expression_text - Original event handler callback text that contained\n * `yield*` and should be rewritten as a direct event Effect expression.\n * @returns A preprocessor Error instance with event callback context.\n */\nexport class YieldStarInEventCallbackError extends PreprocessError {\n\t/**\n\t * The full text of the problematic event handler callback.\n\t *\n\t * @since 2.0.0\n\t */\n\treadonly expression_text: string;\n\n\tconstructor(filename: string, expression_text: string) {\n\t\tsuper(\n\t\t\t[\n\t\t\t\tmake_error_message(\n\t\t\t\t\t\"ASYNC_EFFECT_IN_EVENT_HANDLER_CALLBACK\",\n\t\t\t\t\t`${filename}: yield* in markup event handlers must be written directly as the event attribute value.`,\n\t\t\t\t),\n\t\t\t\t`SER generates the event callback for effectful event handlers; do not put yield* inside a JavaScript callback.`,\n\t\t\t\t\"\",\n\t\t\t\t`Use this form:`,\n\t\t\t\t` onclick={yield* UpvotePost(id)}`,\n\t\t\t\t\"\",\n\t\t\t\t`Instead of this form:`,\n\t\t\t\t` onclick={() => yield* UpvotePost(id)}`,\n\t\t\t\t\"\",\n\t\t\t\t`Problematic expression:`,\n\t\t\t\texpression_text,\n\t\t\t].join(\"\\n\"),\n\t\t\tfilename,\n\t\t);\n\t\tthis.name = \"YieldStarInEventCallbackError\";\n\t\tthis.expression_text = expression_text;\n\t}\n}\n\n/**\n * Thrown when async Effect work appears in a markup position SER cannot lower\n * safely.\n *\n * @example\n * ```ts\n * throw new UnsupportedMarkupEffectPositionError(\n * \"Component.svelte\",\n * \"value={yield* load()}\",\n * );\n * ```\n *\n * @since 2.4.2\n * @param filename - Source filename containing the unsupported markup.\n * @param expression_text - The unsupported markup expression text.\n * @returns A preprocessor Error instance with markup source context.\n */\nexport class UnsupportedMarkupEffectPositionError extends PreprocessError {\n\t/**\n\t * The unsupported markup expression text.\n\t *\n\t * @since 2.4.2\n\t */\n\treadonly expression_text: string;\n\n\tconstructor(filename: string, expression_text: string) {\n\t\tsuper(\n\t\t\t[\n\t\t\t\tmake_error_message(\n\t\t\t\t\t\"UNSUPPORTED_MARKUP_EFFECT_POSITION\",\n\t\t\t\t\t`${filename}: yield* cannot be used in this markup position.`,\n\t\t\t\t),\n\t\t\t\t`Move the Effect work into a supported expression tag, block expression, render expression, declaration tag, or event handler.`,\n\t\t\t\t\"\",\n\t\t\t\t`Problematic expression:`,\n\t\t\t\texpression_text,\n\t\t\t].join(\"\\n\"),\n\t\t\tfilename,\n\t\t);\n\t\tthis.name = \"UnsupportedMarkupEffectPositionError\";\n\t\tthis.expression_text = expression_text;\n\t}\n}\n\n/**\n * Thrown when the request-scoped SvelteKit event context is read outside a\n * remote handler.\n *\n * @example\n * ```ts\n * throw new RequestEventUnavailableError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing missing request context.\n */\nexport class RequestEventUnavailableError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"RequestEvent is only available while a SER remote handler is executing inside a request-scoped Effect context.\",\n\t\t);\n\t\tthis.name = \"RequestEventUnavailableError\";\n\t}\n}\n\n/**\n * Thrown when an unchecked Query declaration omits the handler.\n *\n * @example\n * ```ts\n * throw new UncheckedQueryHandlerMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the invalid Query overload usage.\n */\nexport class UncheckedQueryHandlerMissingError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Query('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot execute by itself.\",\n\t\t);\n\t\tthis.name = \"UncheckedQueryHandlerMissingError\";\n\t}\n}\n\n/**\n * Thrown when a batch Query declaration omits the batch handler.\n *\n * @example\n * ```ts\n * throw new BatchQueryHandlerMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the invalid batch Query overload usage.\n */\nexport class BatchQueryHandlerMissingError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Query.batch requires a concrete batch handler function; the batch helper cannot infer a handler from schema metadata alone.\",\n\t\t);\n\t\tthis.name = \"BatchQueryHandlerMissingError\";\n\t}\n}\n\n/**\n * Thrown when an unchecked live Query declaration omits the handler.\n *\n * @example\n * ```ts\n * throw new UncheckedLiveQueryHandlerMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the invalid live Query overload usage.\n */\nexport class UncheckedLiveQueryHandlerMissingError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Query.live('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot produce a live source.\",\n\t\t);\n\t\tthis.name = \"UncheckedLiveQueryHandlerMissingError\";\n\t}\n}\n\n/**\n * Thrown when an unchecked Command declaration omits the handler.\n *\n * @example\n * ```ts\n * throw new UncheckedCommandHandlerMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the invalid Command overload usage.\n */\nexport class UncheckedCommandHandlerMissingError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Command('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot execute a command.\",\n\t\t);\n\t\tthis.name = \"UncheckedCommandHandlerMissingError\";\n\t}\n}\n\n/**\n * Thrown when an unchecked Form declaration omits the handler.\n *\n * @example\n * ```ts\n * throw new UncheckedFormHandlerMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the invalid Form overload usage.\n */\nexport class UncheckedFormHandlerMissingError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Form('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot process form data.\",\n\t\t);\n\t\tthis.name = \"UncheckedFormHandlerMissingError\";\n\t}\n}\n\n/**\n * Thrown when an unchecked Prerender declaration omits the handler.\n *\n * @example\n * ```ts\n * throw new UncheckedPrerenderHandlerMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the invalid Prerender overload usage.\n */\nexport class UncheckedPrerenderHandlerMissingError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Prerender('unchecked', handler) requires a concrete handler function as the second argument; the unchecked schema sentinel cannot produce prerendered data.\",\n\t\t);\n\t\tthis.name = \"UncheckedPrerenderHandlerMissingError\";\n\t}\n}\n\n/**\n * Thrown when a live query handler resolves to a value that cannot be streamed.\n *\n * @example\n * ```ts\n * throw new InvalidLiveQueryReturnError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing the expected live query return protocol.\n */\nexport class InvalidLiveQueryReturnError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Query.live handler must return an Effect Stream, Iterable, or AsyncIterable; resolved values must expose a streaming protocol that SER can bridge to SvelteKit.\",\n\t\t);\n\t\tthis.name = \"InvalidLiveQueryReturnError\";\n\t}\n}\n\n/**\n * Thrown when a dispatcher operation is requested after disposal.\n *\n * @example\n * ```ts\n * throw new DispatcherDisposedError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing an invalid dispatcher lifecycle transition.\n */\nexport class DispatcherDisposedError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Dispatcher has been disposed; no new Effect fibers or promise bridges can be started after component teardown.\",\n\t\t);\n\t\tthis.name = \"DispatcherDisposedError\";\n\t}\n}\n\n/**\n * Thrown when an application attempts to configure a runtime after one has\n * already been initialized.\n *\n * @example\n * ```ts\n * throw new RuntimeAlreadyInitializedError(\"ClientRuntime\");\n * ```\n *\n * @since 3.4.0\n * @param runtime_name - Public runtime API that was initialized more than once.\n * @returns An Error describing the invalid runtime lifecycle transition.\n */\nexport class RuntimeAlreadyInitializedError extends RuntimeError {\n\tconstructor(runtime_name: string) {\n\t\tsuper(\n\t\t\tmake_error_message(\n\t\t\t\t\"RUNTIME_ALREADY_INITIALIZED\",\n\t\t\t\t`${runtime_name}.make(...) cannot be called because the runtime has already been initialized. Configure it once during application startup, before any Effect-backed component, remote handler, or generated runtime code runs.`,\n\t\t\t),\n\t\t);\n\t\tthis.name = \"RuntimeAlreadyInitializedError\";\n\t}\n}\n\n/**\n * Thrown when a generated or native remote query export is not callable.\n *\n * @example\n * ```ts\n * throw new InvalidQueryFactoryError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing an invalid query adapter input.\n */\nexport class InvalidQueryFactoryError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Invalid query factory: expected a function or an object exposing query/load methods from SvelteKit remote query generation.\",\n\t\t);\n\t\tthis.name = \"InvalidQueryFactoryError\";\n\t}\n}\n\n/**\n * Thrown when a generated or native remote live query export is not callable.\n *\n * @example\n * ```ts\n * throw new InvalidLiveQueryFactoryError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing an invalid live query adapter input.\n */\nexport class InvalidLiveQueryFactoryError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Invalid live query factory: expected a function or an object exposing a query method from SvelteKit remote live query generation.\",\n\t\t);\n\t\tthis.name = \"InvalidLiveQueryFactoryError\";\n\t}\n}\n\n/**\n * Thrown when a generated or native remote command export is not callable.\n *\n * @example\n * ```ts\n * throw new InvalidCommandFactoryError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing an invalid command adapter input.\n */\nexport class InvalidCommandFactoryError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Invalid command factory: expected a function or an object exposing an invoke method from SvelteKit remote command generation.\",\n\t\t);\n\t\tthis.name = \"InvalidCommandFactoryError\";\n\t}\n}\n\n/**\n * Thrown when the client-side form adapter cannot derive a remote endpoint.\n *\n * @example\n * ```ts\n * throw new RemoteFormEndpointMissingError();\n * ```\n *\n * @since 2.4.0\n * @returns An Error describing missing form transport metadata.\n */\nexport class RemoteFormEndpointMissingError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Form has no submit method or remote endpoint; the adapted SvelteKit form object does not expose an action id and no remote base URL was generated.\",\n\t\t);\n\t\tthis.name = \"RemoteFormEndpointMissingError\";\n\t}\n}\n\n/**\n * Thrown when a remote form response envelope is not an object with a response\n * type.\n *\n * @example\n * ```ts\n * throw new InvalidRemoteFormResponseError(envelope);\n * ```\n *\n * @since 2.4.0\n * @param envelope - Raw response envelope returned by the remote form endpoint.\n * @returns An Error describing malformed form response data.\n */\nexport class InvalidRemoteFormResponseError extends RuntimeError {\n\t/**\n\t * Raw response envelope returned by the remote form endpoint.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly envelope: unknown;\n\n\tconstructor(envelope?: unknown) {\n\t\tsuper(\n\t\t\t\"Invalid remote form response: expected an object envelope with a string type field returned by SvelteKit remote form transport.\",\n\t\t);\n\t\tthis.name = \"InvalidRemoteFormResponseError\";\n\t\tthis.envelope = envelope;\n\t}\n}\n\n/**\n * Thrown when a remote form response has a well-formed envelope but an\n * unsupported response type or payload slot.\n *\n * @example\n * ```ts\n * throw new UnsupportedRemoteFormResponseError(envelope);\n * ```\n *\n * @since 2.4.0\n * @param envelope - Raw response envelope returned by the remote form endpoint.\n * @returns An Error describing unsupported form response data.\n */\nexport class UnsupportedRemoteFormResponseError extends RuntimeError {\n\t/**\n\t * Raw response envelope returned by the remote form endpoint.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly envelope: unknown;\n\n\tconstructor(envelope?: unknown) {\n\t\tsuper(\n\t\t\t\"Unsupported remote form response: expected a result envelope with a devalue-encoded result or data string.\",\n\t\t);\n\t\tthis.name = \"UnsupportedRemoteFormResponseError\";\n\t\tthis.envelope = envelope;\n\t}\n}\n\n/**\n * Thrown when a serialized remote failure envelope cannot be decoded.\n *\n * @example\n * ```ts\n * throw new RemoteErrorDecodeError(raw);\n * ```\n *\n * @since 2.4.0\n * @param raw - Raw serialized remote failure payload that failed decoding.\n * @returns An Error describing a malformed remote failure payload.\n */\nexport class RemoteErrorDecodeError extends RuntimeError {\n\t/**\n\t * Raw serialized remote failure payload that failed decoding.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly raw: unknown;\n\n\tconstructor(raw?: unknown) {\n\t\tsuper(\n\t\t\t\"Failed to decode remote error payload: expected a devalue-encoded SER remote failure envelope compatible with the client decoder.\",\n\t\t);\n\t\tthis.name = \"RemoteErrorDecodeError\";\n\t\tthis.raw = raw;\n\t}\n}\n\n/**\n * Thrown when a root server-only helper is imported without Vite rewriting.\n *\n * @example\n * ```ts\n * throw new ServerOnlyImportError(\"Query\");\n * ```\n *\n * @since 2.4.0\n * @param export_name - Name of the server-only root export that was invoked.\n * @returns An Error describing a missing server rewrite.\n */\nexport class ServerOnlyImportError extends RuntimeError {\n\t/**\n\t * Name of the server-only root export that was invoked.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly export_name: string;\n\n\tconstructor(export_name: string) {\n\t\tsuper(\n\t\t\t`${export_name} is only available in SvelteKit server files. Ensure the SER Vite plugin is enabled so root imports are rewritten to svelte-effect-runtime/server before execution.`,\n\t\t);\n\t\tthis.name = \"ServerOnlyImportError\";\n\t\tthis.export_name = export_name;\n\t}\n}\n\n/**\n * Thrown when the publish-time `$app/server` shim executes outside SvelteKit.\n *\n * @example\n * ```ts\n * throw new SvelteKitServerExportUnavailableError(\"query\");\n * ```\n *\n * @since 2.4.0\n * @param export_name - Name of the `$app/server` export that was invoked.\n * @returns An Error describing an unavailable SvelteKit virtual module export.\n */\nexport class SvelteKitServerExportUnavailableError extends RuntimeError {\n\t/**\n\t * Name of the `$app/server` export that was invoked.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly export_name: string;\n\n\tconstructor(export_name: string) {\n\t\tsuper(\n\t\t\t`SvelteKit virtual $app/server export ${export_name} is only available inside a SvelteKit server module.`,\n\t\t);\n\t\tthis.name = \"SvelteKitServerExportUnavailableError\";\n\t\tthis.export_name = export_name;\n\t}\n}\n\n/**\n * Thrown when a SvelteKit remote helper reports that it was called outside the\n * route-scoped remote module context.\n *\n * @example\n * ```ts\n * throw new RemoteHelperContextError(\"Query\");\n * ```\n *\n * @since 2.4.0\n * @param helper_name - SER helper name that triggered the context failure.\n * @returns An Error describing the required `.remote.ts` placement.\n */\nexport class RemoteHelperContextError extends RuntimeError {\n\t/**\n\t * SER helper name that triggered the context failure.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly helper_name: string;\n\n\tconstructor(helper_name: string) {\n\t\tsuper(\n\t\t\tmake_error_message(\n\t\t\t\t\"REMOTE_HELPER_CONTEXT\",\n\t\t\t\t`${helper_name} was called outside a .remote.ts file. Ensure the file is named \\`*.remote.ts\\` and is located in a route directory so SvelteKit can bind remote helper context.`,\n\t\t\t),\n\t\t);\n\t\tthis.name = \"RemoteHelperContextError\";\n\t\tthis.helper_name = helper_name;\n\t}\n}\n\n/**\n * Thrown when a SvelteKit remote helper normalizes a non-Error thrown value.\n *\n * @example\n * ```ts\n * throw new RemoteHelperError(\"raw failure\");\n * ```\n *\n * @since 2.4.0\n * @param value - Non-Error value thrown while creating a remote helper.\n * @returns An Error preserving the remote helper failure value.\n */\nexport class RemoteHelperError extends RuntimeError {\n\t/**\n\t * Non-Error value that was normalized.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly value: unknown;\n\n\tconstructor(value: unknown) {\n\t\tsuper(make_error_message(\"REMOTE_HELPER_ERROR\", String(value)));\n\t\tthis.name = \"RemoteHelperError\";\n\t\tthis.value = value;\n\t}\n}\n\n/**\n * Thrown when a non-Error value must be normalized into an Error instance.\n *\n * @example\n * ```ts\n * throw new UnknownRuntimeError(\"raw failure\");\n * ```\n *\n * @since 2.4.0\n * @param value - Non-Error value that needs Error normalization.\n * @returns An Error preserving the string representation of an unknown value.\n */\nexport class UnknownRuntimeError extends RuntimeError {\n\t/**\n\t * Non-Error value that was normalized.\n\t *\n\t * @since 2.4.0\n\t */\n\treadonly value: unknown;\n\n\tconstructor(value: unknown) {\n\t\tsuper(String(value));\n\t\tthis.name = \"UnknownRuntimeError\";\n\t\tthis.value = value;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAeA,IAAa,eAAb,cAAkC,MAAM;CACvC,YAAY,SAAiB;EAC5B,MAAM,OAAO;EACb,KAAK,OAAO;CACb;AACD;;;;;;;;;;;;;;AAeA,SAAgB,mBAAmB,MAAc,SAAyB;CACzE,OAAO,IAAI,KAAK,KAAK;AACtB;;;;;;;;;;;;;;;;AAiBA,IAAa,kBAAb,cAAqC,aAAa;;;;;;CAMjD;CAEA,YAAY,SAAiB,UAAkB;EAC9C,MAAM,OAAO;EACb,KAAK,OAAO;EACZ,KAAK,WAAW;CACjB;AACD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AAa;;;;;;CAMvE;CAEA,YAAY,aAAqB;EAChC,MACC,wCAAwC,YAAY,qDACrD;EACA,KAAK,OAAO;EACZ,KAAK,cAAc;CACpB;AACD;;;;;;;;;;;;;;AAeA,IAAa,2BAAb,cAA8C,aAAa;;;;;;CAM1D;CAEA,YAAY,aAAqB;EAChC,MACC,mBACC,yBACA,GAAG,YAAY,iKAChB,CACD;EACA,KAAK,OAAO;EACZ,KAAK,cAAc;CACpB;AACD;;;;;;;;;;;;;AAcA,IAAa,oBAAb,cAAuC,aAAa;;;;;;CAMnD;CAEA,YAAY,OAAgB;EAC3B,MAAM,mBAAmB,uBAAuB,OAAO,KAAK,CAAC,CAAC;EAC9D,KAAK,OAAO;EACZ,KAAK,QAAQ;CACd;AACD;;;;;;;;;;;;;AAcA,IAAa,sBAAb,cAAyC,aAAa;;;;;;CAMrD;CAEA,YAAY,OAAgB;EAC3B,MAAM,OAAO,KAAK,CAAC;EACnB,KAAK,OAAO;EACZ,KAAK,QAAQ;CACd;AACD"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
//#region src/markup/event-attributes.ts
|
|
2
|
-
/**
|
|
3
|
-
* Checks whether a Svelte attribute name should be treated as an event handler
|
|
4
|
-
* boundary for markup effect lowering.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* is_event_attribute_name("onChange");
|
|
9
|
-
* ```
|
|
10
|
-
*
|
|
11
|
-
* @since 3.4.11
|
|
12
|
-
* @param name - Attribute name read from Svelte source or the parsed AST.
|
|
13
|
-
* @returns Whether the attribute is an event-like Svelte handler attribute.
|
|
14
|
-
*/
|
|
15
|
-
function is_event_attribute_name(name) {
|
|
16
|
-
return /^on(?::[A-Za-z_$][\w$-]*|[A-Za-z_$][\w$-]*)$/i.test(name);
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Normalizes an event-like attribute name to Svelte's lowercase DOM event
|
|
20
|
-
* spelling while keeping the legacy directive prefix intact.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```ts
|
|
24
|
-
* normalize_event_attribute_name("onChange");
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* @since 3.4.11
|
|
28
|
-
* @param name - Event-like attribute name read from Svelte source or the
|
|
29
|
-
* parsed AST.
|
|
30
|
-
* @returns Lowercase event attribute spelling for DOM-facing Svelte nodes.
|
|
31
|
-
*/
|
|
32
|
-
function normalize_event_attribute_name(name) {
|
|
33
|
-
if (name.startsWith("on:")) return `on:${name.slice(3).toLowerCase()}`;
|
|
34
|
-
return name.toLowerCase();
|
|
35
|
-
}
|
|
36
|
-
//#endregion
|
|
37
|
-
export { normalize_event_attribute_name as n, is_event_attribute_name as t };
|
|
38
|
-
|
|
39
|
-
//# sourceMappingURL=event-attributes-gHzP2ycp.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-attributes-gHzP2ycp.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/markup/event-attributes.ts"],"sourcesContent":["/**\n * Checks whether a Svelte attribute name should be treated as an event handler\n * boundary for markup effect lowering.\n *\n * @example\n * ```ts\n * is_event_attribute_name(\"onChange\");\n * ```\n *\n * @since 3.4.11\n * @param name - Attribute name read from Svelte source or the parsed AST.\n * @returns Whether the attribute is an event-like Svelte handler attribute.\n */\nexport function is_event_attribute_name(name: string): boolean {\n\treturn /^on(?::[A-Za-z_$][\\w$-]*|[A-Za-z_$][\\w$-]*)$/i.test(name);\n}\n\n/**\n * Normalizes an event-like attribute name to Svelte's lowercase DOM event\n * spelling while keeping the legacy directive prefix intact.\n *\n * @example\n * ```ts\n * normalize_event_attribute_name(\"onChange\");\n * ```\n *\n * @since 3.4.11\n * @param name - Event-like attribute name read from Svelte source or the\n * parsed AST.\n * @returns Lowercase event attribute spelling for DOM-facing Svelte nodes.\n */\nexport function normalize_event_attribute_name(name: string): string {\n\tif (name.startsWith(\"on:\")) {\n\t\treturn `on:${name.slice(3).toLowerCase()}`;\n\t}\n\n\treturn name.toLowerCase();\n}\n"],"mappings":";;;;;;;;;;;;;;AAaA,SAAgB,wBAAwB,MAAuB;CAC9D,OAAO,gDAAgD,KAAK,IAAI;AACjE;;;;;;;;;;;;;;;AAgBA,SAAgB,+BAA+B,MAAsB;CACpE,IAAI,KAAK,WAAW,KAAK,GACxB,OAAO,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,YAAY;CAGxC,OAAO,KAAK,YAAY;AACzB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote-client-Bj1pZXgq.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/vite/remote-client.ts"],"sourcesContent":["import type {\n\tExpression,\n\tImportDeclaration,\n\tSourceFile,\n\tStatement,\n\tVariableStatement,\n} from \"typescript\";\n\nimport MagicString from \"magic-string\";\nimport ts from \"typescript\";\n\ninterface RemoteClientRewriteOptions {\n\tdebug?: boolean;\n}\n\ntype RemoteClientExportType =\n\t| \"query_batch\"\n\t| \"query_live\"\n\t| \"query\"\n\t| \"command\"\n\t| \"form\"\n\t| \"prerender\";\n\ninterface RemoteNamespaceImport {\n\tname: string;\n\tstatement: ImportDeclaration;\n}\n\ninterface RemoteClientExport {\n\tname: string;\n\ttype: RemoteClientExportType;\n\tstatement: VariableStatement;\n\tnative_call: string;\n}\n\nconst remote_client_export_types = new Set<RemoteClientExportType>([\n\t\"query_batch\",\n\t\"query_live\",\n\t\"query\",\n\t\"command\",\n\t\"form\",\n\t\"prerender\",\n]);\n\n/**\n * Rewrites SvelteKit's generated client remote module into Effect-aware\n * wrappers while preserving the native remote factory calls.\n *\n * @example\n * ```ts\n * const rewritten = rewrite_remote_client_exports(\n * `export const get_post = __remote.query(\"hash/get_post\")`,\n * );\n * ```\n *\n * @since 2.0.0\n * @param code - Generated SvelteKit remote client module source to inspect and\n * rewrite.\n * @param options - Optional rewrite options forwarded from the SER Vite plugin.\n * @returns The rewritten module source, or the original source when no remote\n * exports are found.\n * @internal\n */\nexport function rewrite_remote_client_exports(\n\tcode: string,\n\toptions?: RemoteClientRewriteOptions,\n): string {\n\tconst source_file = ts.createSourceFile(\n\t\t\"sveltekit-remote-client.ts\",\n\t\tcode,\n\t\tts.ScriptTarget.Latest,\n\t\ttrue,\n\t\tts.ScriptKind.TS,\n\t);\n\tconst namespace_import = find_remote_namespace_import(source_file);\n\n\tif (!namespace_import) {\n\t\treturn code;\n\t}\n\n\tconst remote_exports = collect_remote_client_exports(source_file, code, namespace_import.name);\n\n\tif (remote_exports.length === 0) {\n\t\treturn code;\n\t}\n\n\tconst magic = new MagicString(code);\n\tconst imports = [\n\t\t`import { app_dir, base } from \"$app/paths/internal/client\";`,\n\t\t`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\";`,\n\t].join(\"\\n\");\n\tconst helpers = [\n\t\t`const __SER___remote_base = \\`\\${base}/\\${app_dir}/remote\\`;`,\n\t\t`function __SER___decode_payload(value) { return value; }`,\n\t].join(\"\\n\");\n\tconst debug_line = options?.debug ? `console.log(\"[ser] remote client wrappers loaded\");` : \"\";\n\tconst injected = [imports, helpers, debug_line].filter(Boolean).join(\"\\n\");\n\n\tmagic.appendRight(namespace_import.statement.end, `\\n${injected}`);\n\n\tfor (const remote_export of remote_exports) {\n\t\tmagic.overwrite(\n\t\t\tremote_export.statement.getStart(source_file),\n\t\t\tremote_export.statement.end,\n\t\t\tmake_remote_export(remote_export.name, remote_export.type, remote_export.native_call),\n\t\t);\n\t}\n\n\treturn magic.toString();\n}\n\nfunction make_remote_export(\n\tname: string,\n\tremote_type: RemoteClientExportType,\n\tnative_call: string,\n): string {\n\tif (remote_type === \"command\") {\n\t\treturn `export const ${name} = create_remote_command_adapter(${native_call}, __SER___decode_payload);`;\n\t}\n\n\tif (remote_type === \"form\") {\n\t\treturn `export const ${name} = create_remote_form_adapter(${native_call}, __SER___decode_payload, __SER___remote_base);`;\n\t}\n\n\tif (remote_type === \"query_live\") {\n\t\treturn `export const ${name} = create_remote_live_query_adapter(${native_call}, __SER___decode_payload);`;\n\t}\n\n\treturn `export const ${name} = create_remote_query_adapter(${native_call}, __SER___decode_payload);`;\n}\n\nfunction find_remote_namespace_import(source_file: SourceFile): RemoteNamespaceImport | undefined {\n\tfor (const statement of source_file.statements) {\n\t\tif (!ts.isImportDeclaration(statement)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst namespace_import = get_remote_namespace_import(statement);\n\n\t\tif (namespace_import) {\n\t\t\treturn namespace_import;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction get_remote_namespace_import(\n\tstatement: ImportDeclaration,\n): RemoteNamespaceImport | undefined {\n\tif (\n\t\t!ts.isStringLiteral(statement.moduleSpecifier) ||\n\t\tstatement.moduleSpecifier.text !== \"__sveltekit/remote\"\n\t) {\n\t\treturn undefined;\n\t}\n\n\tconst import_clause = statement.importClause;\n\tconst bindings = import_clause?.namedBindings;\n\n\tif (import_clause?.isTypeOnly || !bindings || !ts.isNamespaceImport(bindings)) {\n\t\treturn undefined;\n\t}\n\n\treturn {\n\t\tname: bindings.name.text,\n\t\tstatement,\n\t};\n}\n\nfunction collect_remote_client_exports(\n\tsource_file: SourceFile,\n\tcode: string,\n\tnamespace: string,\n): RemoteClientExport[] {\n\treturn source_file.statements.flatMap((statement) =>\n\t\tcollect_remote_client_export(source_file, code, namespace, statement),\n\t);\n}\n\nfunction collect_remote_client_export(\n\tsource_file: SourceFile,\n\tcode: string,\n\tnamespace: string,\n\tstatement: Statement,\n): RemoteClientExport[] {\n\tif (\n\t\t!ts.isVariableStatement(statement) ||\n\t\t!is_export_statement(statement) ||\n\t\t!is_const_declaration_list(statement.declarationList) ||\n\t\tstatement.declarationList.declarations.length !== 1\n\t) {\n\t\treturn [];\n\t}\n\n\tconst declaration = statement.declarationList.declarations[0];\n\tconst initializer = declaration.initializer;\n\n\tif (!ts.isIdentifier(declaration.name) || !initializer) {\n\t\treturn [];\n\t}\n\n\tconst remote_type = get_remote_client_export_type(initializer, namespace);\n\n\tif (!remote_type) {\n\t\treturn [];\n\t}\n\n\treturn [\n\t\t{\n\t\t\tname: declaration.name.text,\n\t\t\ttype: remote_type,\n\t\t\tstatement,\n\t\t\tnative_call: code.slice(initializer.getStart(source_file), initializer.end),\n\t\t},\n\t];\n}\n\nfunction get_remote_client_export_type(\n\tinitializer: Expression,\n\tnamespace: string,\n): RemoteClientExportType | undefined {\n\tif (!ts.isCallExpression(initializer)) {\n\t\treturn undefined;\n\t}\n\n\tconst expression = initializer.expression;\n\n\tif (!ts.isPropertyAccessExpression(expression)) {\n\t\treturn undefined;\n\t}\n\n\tif (!ts.isIdentifier(expression.expression) || expression.expression.text !== namespace) {\n\t\treturn undefined;\n\t}\n\n\tconst remote_type = expression.name.text;\n\n\tif (!is_remote_client_export_type(remote_type)) {\n\t\treturn undefined;\n\t}\n\n\treturn remote_type;\n}\n\nfunction is_remote_client_export_type(value: string): value is RemoteClientExportType {\n\treturn remote_client_export_types.has(value as RemoteClientExportType);\n}\n\nfunction is_export_statement(statement: Statement): boolean {\n\tconst modifiers = ts.canHaveModifiers(statement) ? ts.getModifiers(statement) : undefined;\n\n\treturn modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) ?? false;\n}\n\nfunction is_const_declaration_list(declaration_list: ts.VariableDeclarationList): boolean {\n\treturn (ts.getCombinedNodeFlags(declaration_list) & ts.NodeFlags.Const) !== 0;\n}\n"],"mappings":";;;AAmCA,MAAM,6CAA6B,IAAI,IAA4B;CAClE;CACA;CACA;CACA;CACA;CACA;AACD,CAAC;;;;;;;;;;;;;;;;;;;;AAqBD,SAAgB,8BACf,MACA,SACS;CACT,MAAM,cAAc,GAAG,iBACtB,8BACA,MACA,GAAG,aAAa,QAChB,MACA,GAAG,WAAW,EACf;CACA,MAAM,mBAAmB,6BAA6B,WAAW;CAEjE,IAAI,CAAC,kBACJ,OAAO;CAGR,MAAM,iBAAiB,8BA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