svelte-effect-runtime 4.0.0 → 4.1.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-DbwVAMWm.js +530 -0
- package/.dist/chunks/client-DbwVAMWm.js.map +1 -0
- package/.dist/chunks/compiler-Dpyu4Owd.js +412 -0
- package/.dist/chunks/compiler-Dpyu4Owd.js.map +1 -0
- package/.dist/chunks/descriptors-q909VWyR.js +216 -0
- package/.dist/chunks/descriptors-q909VWyR.js.map +1 -0
- package/.dist/chunks/diagnostics-DLwwrBWb.js +359 -0
- package/.dist/chunks/diagnostics-DLwwrBWb.js.map +1 -0
- package/.dist/chunks/dispatcher-CTWINW5I.js +534 -0
- package/.dist/chunks/dispatcher-CTWINW5I.js.map +1 -0
- package/.dist/chunks/dispatcher-pZPzarul.js +23 -0
- package/.dist/chunks/dispatcher-pZPzarul.js.map +1 -0
- package/.dist/chunks/{errors-IJjsUwrE.js → errors-qhcbUH6o.js} +56 -44
- package/.dist/chunks/errors-qhcbUH6o.js.map +1 -0
- package/.dist/chunks/live-BW7xZKjb.js +146 -0
- package/.dist/chunks/live-BW7xZKjb.js.map +1 -0
- package/.dist/chunks/live-CHK0RrZu.js +10 -0
- package/.dist/chunks/live-CHK0RrZu.js.map +1 -0
- package/.dist/chunks/{remote-client-CVI4t66c.js → remote-client-mkQAfP1G.js} +29 -23
- package/.dist/chunks/remote-client-mkQAfP1G.js.map +1 -0
- package/.dist/chunks/{runtime-GBQz32DZ.js → runtime-CPosEhGl.js} +3 -27
- package/.dist/chunks/runtime-CPosEhGl.js.map +1 -0
- package/.dist/chunks/{server-D1LcDnZE.js → server-yQrNoiCR.js} +15 -84
- package/.dist/chunks/server-yQrNoiCR.js.map +1 -0
- package/.dist/chunks/source-scan-cSawCvsg.js +1059 -0
- package/.dist/chunks/source-scan-cSawCvsg.js.map +1 -0
- package/.dist/chunks/{transform-jNUr65K9.js → transform-D7TTlPpK.js} +245 -371
- package/.dist/chunks/transform-D7TTlPpK.js.map +1 -0
- package/.dist/compiler/markup-identifiers.d.ts +2 -0
- package/.dist/compiler/remote-client.d.ts +1 -19
- package/.dist/compiler/source-scan.d.ts +11 -108
- package/.dist/compiler/sveltekit-remote-bridge.d.ts +3 -0
- package/.dist/compiler.d.ts +6 -0
- package/.dist/compiler.js +1 -1
- package/.dist/detect.d.ts +0 -31
- package/.dist/detect.js +0 -39
- package/.dist/detect.js.map +1 -1
- package/.dist/diagnostics.d.ts +0 -16
- package/.dist/dispatcher/deps.d.ts +3 -14
- package/.dist/dispatcher/fibers.d.ts +5 -46
- package/.dist/dispatcher/index.d.ts +42 -135
- package/.dist/dispatcher/scope.d.ts +36 -0
- package/.dist/dispatcher/types.d.ts +0 -151
- package/.dist/dispatcher.d.ts +2 -1
- package/.dist/dispatcher.js +2 -2
- package/.dist/errors.d.ts +44 -42
- package/.dist/generated/dispatcher.d.ts +6 -51
- package/.dist/generators.d.ts +2 -12
- package/.dist/internal/descriptors.d.ts +0 -16
- package/.dist/internal/generators.js +14 -9
- package/.dist/internal/generators.js.map +1 -1
- package/.dist/internal/live.d.ts +9 -0
- package/.dist/internal/remote-client.js +2 -2
- package/.dist/internal/remote-server.js +2 -2
- package/.dist/internal/schema.d.ts +0 -54
- package/.dist/live.d.ts +9 -26
- package/.dist/markup/event-attributes.d.ts +0 -32
- package/.dist/markup/promise.d.ts +1 -23
- package/.dist/markup/promise.js +2 -18
- package/.dist/markup/promise.js.map +1 -1
- package/.dist/markup/run.d.ts +1 -10
- package/.dist/markup/run.js +2 -11
- package/.dist/markup/run.js.map +1 -1
- package/.dist/markup/transform/apply.d.ts +5 -4
- package/.dist/markup/transform/classify.d.ts +2 -11
- package/.dist/markup/transform/constants.d.ts +2 -1
- package/.dist/markup/transform/effect-bindings.d.ts +2 -26
- package/.dist/markup/transform/effect-callbacks.d.ts +0 -20
- package/.dist/markup/transform/emit.d.ts +2 -11
- package/.dist/markup/transform/expressions.d.ts +0 -35
- package/.dist/markup/transform/scan.d.ts +3 -22
- package/.dist/markup/transform/types.d.ts +15 -127
- package/.dist/markup/transform.js +1 -1
- package/.dist/markup/value.d.ts +1 -18
- package/.dist/markup/value.js +2 -19
- package/.dist/markup/value.js.map +1 -1
- package/.dist/mod.d.ts +3 -8
- package/.dist/mod.js +5 -5
- package/.dist/mod.js.map +1 -1
- package/.dist/remote/cause-codec.d.ts +3 -37
- package/.dist/remote/client/command.d.ts +3 -17
- package/.dist/remote/client/form-data.d.ts +0 -7
- package/.dist/remote/client/form-enhance.d.ts +0 -7
- package/.dist/remote/client/form-transport.d.ts +14 -20
- package/.dist/remote/client/form.d.ts +4 -24
- package/.dist/remote/client/index.d.ts +2 -1
- package/.dist/remote/client/prerender.d.ts +6 -0
- package/.dist/remote/client/query-result.d.ts +2 -14
- package/.dist/remote/client/query.d.ts +8 -48
- package/.dist/remote/client/responses.d.ts +3 -27
- package/.dist/remote/client/types.d.ts +16 -110
- package/.dist/remote/client/utils.d.ts +0 -8
- package/.dist/remote/client.d.ts +2 -2
- package/.dist/remote/client.js +2 -2
- package/.dist/remote/effect.d.ts +6 -0
- package/.dist/remote/failures.d.ts +4 -0
- package/.dist/remote/query-update.d.ts +2 -0
- package/.dist/remote/resource.d.ts +25 -0
- package/.dist/remote/server.d.ts +5 -50
- package/.dist/remote/server.js +2 -2
- package/.dist/remote/shared.d.ts +6 -145
- package/.dist/remote/shared.js +6 -127
- package/.dist/remote/shared.js.map +1 -1
- package/.dist/runtime/transform.js +26 -31
- package/.dist/runtime/transform.js.map +1 -1
- package/.dist/script-transform/ast.d.ts +0 -46
- package/.dist/script-transform/imports.d.ts +3 -39
- package/.dist/script-transform/index.d.ts +2 -0
- package/.dist/script-transform/lower.d.ts +0 -9
- package/.dist/script-transform/runes.d.ts +0 -10
- package/.dist/script-transform/runtime-block.d.ts +0 -17
- package/.dist/script-transform/source.d.ts +0 -24
- package/.dist/script-transform/types.d.ts +9 -126
- package/.dist/server/effects.d.ts +4 -53
- package/.dist/server/factories.d.ts +7 -7
- package/.dist/server/index.d.ts +1 -1
- package/.dist/server/invalid.d.ts +0 -7
- package/.dist/server/live-snapshot.d.ts +5 -0
- package/.dist/server/remote-handler-context.d.ts +5 -0
- package/.dist/server/runtime.d.ts +6 -24
- package/.dist/server/schema.d.ts +0 -14
- package/.dist/server/transport.d.ts +2 -0
- package/.dist/server/types.d.ts +49 -26
- package/.dist/server/wrappers.d.ts +3 -40
- package/.dist/server.d.ts +1 -1
- package/.dist/server.js +200 -215
- package/.dist/server.js.map +1 -1
- package/.dist/yieldable.d.ts +1 -35
- package/package.json +2 -2
- package/.dist/chunks/client-DcZUV4rR.js +0 -653
- package/.dist/chunks/client-DcZUV4rR.js.map +0 -1
- package/.dist/chunks/compiler-BBPNyXmQ.js +0 -460
- package/.dist/chunks/compiler-BBPNyXmQ.js.map +0 -1
- package/.dist/chunks/dispatcher-DOx8iC6r.js +0 -505
- package/.dist/chunks/dispatcher-DOx8iC6r.js.map +0 -1
- package/.dist/chunks/dispatcher-H-Ia0Os4.js +0 -47
- package/.dist/chunks/dispatcher-H-Ia0Os4.js.map +0 -1
- package/.dist/chunks/errors-IJjsUwrE.js.map +0 -1
- package/.dist/chunks/live-BXAKre_4.js +0 -104
- package/.dist/chunks/live-BXAKre_4.js.map +0 -1
- package/.dist/chunks/remote-client-CVI4t66c.js.map +0 -1
- package/.dist/chunks/runtime-GBQz32DZ.js.map +0 -1
- package/.dist/chunks/schema-D9pct6Y5.js +0 -89
- package/.dist/chunks/schema-D9pct6Y5.js.map +0 -1
- package/.dist/chunks/server-D1LcDnZE.js.map +0 -1
- package/.dist/chunks/source-scan-C4PsggID.js +0 -341
- package/.dist/chunks/source-scan-C4PsggID.js.map +0 -1
- package/.dist/chunks/transform-jNUr65K9.js.map +0 -1
- package/.dist/remote/client/effect.d.ts +0 -29
- package/.dist/remote/client/failures.d.ts +0 -42
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { n as get_dispatcher$1 } from "./dispatcher-DOx8iC6r.js";
|
|
2
|
-
import { r as get_server_dispatcher } from "./runtime-GBQz32DZ.js";
|
|
3
|
-
//#region src/generated/dispatcher.ts
|
|
4
|
-
/**
|
|
5
|
-
* Facade used by transform-generated component code to dispatch runtime
|
|
6
|
-
* events through the current client or server dispatcher.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* const value = Dispatcher.emit({
|
|
11
|
-
* type: Code.Markup.Value,
|
|
12
|
-
* id: "Component.svelte:1:2",
|
|
13
|
-
* deps: [],
|
|
14
|
-
* fallback: undefined,
|
|
15
|
-
* fn: function* () {
|
|
16
|
-
* return yield* Effect.succeed(1);
|
|
17
|
-
* },
|
|
18
|
-
* });
|
|
19
|
-
* ```
|
|
20
|
-
*
|
|
21
|
-
* @since 3.3.0
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
var Dispatcher = class {
|
|
25
|
-
static emit(event) {
|
|
26
|
-
return get_dispatcher().emit(event);
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
/**
|
|
30
|
-
* Returns the dispatcher appropriate for generated component code.
|
|
31
|
-
*
|
|
32
|
-
* @example
|
|
33
|
-
* ```ts
|
|
34
|
-
* const dispatcher = get_dispatcher();
|
|
35
|
-
* ```
|
|
36
|
-
*
|
|
37
|
-
* @since 3.0.1
|
|
38
|
-
* @returns The server dispatcher during SSR, otherwise the client dispatcher.
|
|
39
|
-
*/
|
|
40
|
-
function get_dispatcher() {
|
|
41
|
-
if (typeof document === "undefined") return get_server_dispatcher();
|
|
42
|
-
return get_dispatcher$1();
|
|
43
|
-
}
|
|
44
|
-
//#endregion
|
|
45
|
-
export { get_dispatcher as n, Dispatcher as t };
|
|
46
|
-
|
|
47
|
-
//# sourceMappingURL=dispatcher-H-Ia0Os4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dispatcher-H-Ia0Os4.js","names":["get_client_dispatcher"],"sources":["../../../modules/svelte-effect-runtime/src/generated/dispatcher.ts"],"sourcesContent":["import { get_dispatcher as get_client_dispatcher } from \"$/dispatcher.ts\";\nimport { get_server_dispatcher } from \"$/server/runtime.ts\";\nimport type {\n\tDispatcher as RuntimeDispatcher,\n\tDispatcherEvent,\n\tMarkupPromiseEvent,\n\tMarkupRunEvent,\n\tMarkupValueEvent,\n} from \"$/dispatcher.ts\";\n\nexport { Code } from \"$/dispatcher.ts\";\nexport type {\n\tDispatcherEvent,\n\tMarkupPromiseEvent,\n\tMarkupPromiseOptions,\n\tMarkupRunEvent,\n\tMarkupValueEvent,\n} from \"$/dispatcher.ts\";\n\n/**\n * Facade used by transform-generated component code to dispatch runtime\n * events through the current client or server dispatcher.\n *\n * @example\n * ```ts\n * const value = Dispatcher.emit({\n * type: Code.Markup.Value,\n * id: \"Component.svelte:1:2\",\n * deps: [],\n * fallback: undefined,\n * fn: function* () {\n * return yield* Effect.succeed(1);\n * },\n * });\n * ```\n *\n * @since 3.3.0\n * @internal\n */\nexport class Dispatcher {\n\t/**\n\t * Emits a transform-generated dispatcher event.\n\t *\n\t * @example\n\t * ```ts\n\t * const promise = Dispatcher.emit({\n\t * type: Code.Markup.Promise,\n\t * id: \"Component.svelte:1:2\",\n\t * deps: [],\n\t * fn: function* () {\n\t * return yield* Effect.succeed(1);\n\t * },\n\t * });\n\t * ```\n\t *\n\t * @since 3.3.0\n\t * @param event - Generated event describing the dispatcher operation to run.\n\t * @returns The result produced by the active dispatcher.\n\t */\n\tstatic emit<A, F>(event: MarkupValueEvent<A, F>): A | F;\n\tstatic emit<A>(event: MarkupPromiseEvent<A>): Promise<A>;\n\tstatic emit<A>(event: MarkupRunEvent<A>): Promise<A>;\n\tstatic emit<A, F>(event: DispatcherEvent<A, F>): A | F | Promise<A>;\n\tstatic emit<A, F>(event: DispatcherEvent<A, F>): A | F | Promise<A> {\n\t\treturn get_dispatcher().emit(event);\n\t}\n}\n\n/**\n * Returns the dispatcher appropriate for generated component code.\n *\n * @example\n * ```ts\n * const dispatcher = get_dispatcher();\n * ```\n *\n * @since 3.0.1\n * @returns The server dispatcher during SSR, otherwise the client dispatcher.\n */\nexport function get_dispatcher(): RuntimeDispatcher {\n\tif (typeof document === \"undefined\") {\n\t\treturn get_server_dispatcher();\n\t}\n\n\treturn get_client_dispatcher();\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuCA,IAAa,aAAb,MAAwB;CAwBvB,OAAO,KAAW,OAAkD;EACnE,OAAO,eAAe,CAAC,CAAC,KAAK,KAAK;CACnC;AACD;;;;;;;;;;;;AAaA,SAAgB,iBAAoC;CACnD,IAAI,OAAO,aAAa,aACvB,OAAO,sBAAsB;CAG9B,OAAOA,iBAAsB;AAC9B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors-IJjsUwrE.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 * 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. Wrap native iterables with Stream.fromIterable, Stream.fromAsyncIterable, or another Stream constructor before returning them.\",\n\t\t);\n\t\tthis.name = \"InvalidLiveQueryReturnError\";\n\t}\n}\n\n/**\n * Thrown when generated component code yields a Stream that completes before\n * producing a value.\n *\n * @example\n * ```ts\n * throw new EmptyStreamYieldError();\n * ```\n *\n * @since 3.4.8\n * @returns An Error describing an empty Stream in a value position.\n */\nexport class EmptyStreamYieldError extends RuntimeError {\n\tconstructor() {\n\t\tsuper(\n\t\t\t\"Cannot resolve yield* stream expression because the Stream completed without emitting a value.\",\n\t\t);\n\t\tthis.name = \"EmptyStreamYieldError\";\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"],"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;;;;;;;;;;;;;;;;AAiBA,IAAa,yBAAb,cAA4C,gBAAgB;;;;;;CAM3D;CAEA,YAAY,UAAkB,gBAAwB;EACrD,MACC;GACC,mBACC,wBACA,GAAG,SAAS,oDACb;GACA;GACA;GACA;GACA;EACD,CAAC,CAAC,KAAK,IAAI,GACX,QACD;EACA,KAAK,OAAO;EACZ,KAAK,iBAAiB;CACvB;AACD;;;;;;;;;;;;;;;;;AAkBA,IAAa,6BAAb,cAAgD,gBAAgB;;;;;;CAM/D;;;;;;CAOA;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1,104 +0,0 @@
|
|
|
1
|
-
import { c as InvalidLiveQueryFactoryError } from "./errors-IJjsUwrE.js";
|
|
2
|
-
import { Effect, Stream } from "effect";
|
|
3
|
-
//#region src/live.ts
|
|
4
|
-
/**
|
|
5
|
-
* Runtime marker attached to remote live streams created by SER.
|
|
6
|
-
*
|
|
7
|
-
* @since 3.4.8
|
|
8
|
-
*/
|
|
9
|
-
const REMOTE_LIVE_STREAM = Symbol.for("ser.remote-live-stream");
|
|
10
|
-
const LIVE_METADATA = Symbol.for("ser.remote-live-metadata");
|
|
11
|
-
const LIVE_OPERATOR = Symbol.for("ser.live-operator");
|
|
12
|
-
/**
|
|
13
|
-
* Builds a remote live stream from SvelteKit's native live resource.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```ts
|
|
17
|
-
* const stream = make_remote_live_stream(resource, normalize_native_error);
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* @since 3.4.8
|
|
21
|
-
* @param resource - Native SvelteKit live query resource.
|
|
22
|
-
* @param on_error - Error mapper used for stream and reconnect failures.
|
|
23
|
-
* @returns A remote live stream carrying hidden transport metadata.
|
|
24
|
-
* @internal
|
|
25
|
-
*/
|
|
26
|
-
function make_remote_live_stream(resource, on_error) {
|
|
27
|
-
const live_resource = as_native_live_resource(resource);
|
|
28
|
-
return attach_live_metadata(Stream.fromAsyncIterable(live_resource, on_error), {
|
|
29
|
-
resource: live_resource,
|
|
30
|
-
on_error
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Remote live transport helpers.
|
|
35
|
-
*
|
|
36
|
-
* @since 3.4.8
|
|
37
|
-
*/
|
|
38
|
-
const Live = {
|
|
39
|
-
status: Object.assign(function status(stream) {
|
|
40
|
-
const metadata = get_live_metadata(stream);
|
|
41
|
-
if (!metadata) return Stream.succeed({ _tag: "Idle" });
|
|
42
|
-
return Stream.succeed(read_live_status(metadata.resource)).pipe(Stream.concat(Stream.tick("250 millis").pipe(Stream.map(() => read_live_status(metadata.resource)))));
|
|
43
|
-
}, { [LIVE_OPERATOR]: true }),
|
|
44
|
-
reconnect: Object.assign(function reconnect(stream) {
|
|
45
|
-
const metadata = get_live_metadata(stream);
|
|
46
|
-
const reconnect = metadata?.resource.reconnect;
|
|
47
|
-
if (!metadata || typeof reconnect !== "function") return Effect.fail(new InvalidLiveQueryFactoryError());
|
|
48
|
-
return Effect.tryPromise({
|
|
49
|
-
try: () => Promise.resolve(reconnect.call(metadata.resource)),
|
|
50
|
-
catch: metadata.on_error
|
|
51
|
-
});
|
|
52
|
-
}, { [LIVE_OPERATOR]: true })
|
|
53
|
-
};
|
|
54
|
-
function as_native_live_resource(resource) {
|
|
55
|
-
if (!is_native_live_resource(resource)) throw new InvalidLiveQueryFactoryError();
|
|
56
|
-
return resource;
|
|
57
|
-
}
|
|
58
|
-
function is_native_live_resource(resource) {
|
|
59
|
-
const resource_type = typeof resource;
|
|
60
|
-
if (resource_type !== "object" && resource_type !== "function") return false;
|
|
61
|
-
if (resource === null) return false;
|
|
62
|
-
return typeof resource[Symbol.asyncIterator] === "function";
|
|
63
|
-
}
|
|
64
|
-
function attach_live_metadata(stream, metadata) {
|
|
65
|
-
const carrier = stream;
|
|
66
|
-
if (carrier[LIVE_METADATA]) return stream;
|
|
67
|
-
Object.defineProperty(carrier, LIVE_METADATA, {
|
|
68
|
-
configurable: true,
|
|
69
|
-
value: metadata
|
|
70
|
-
});
|
|
71
|
-
Object.defineProperty(carrier, REMOTE_LIVE_STREAM, {
|
|
72
|
-
configurable: true,
|
|
73
|
-
value: true
|
|
74
|
-
});
|
|
75
|
-
propagate_live_metadata_through_pipe(carrier, metadata);
|
|
76
|
-
return stream;
|
|
77
|
-
}
|
|
78
|
-
function propagate_live_metadata_through_pipe(stream, metadata) {
|
|
79
|
-
const pipe = stream.pipe.bind(stream);
|
|
80
|
-
Object.defineProperty(stream, "pipe", {
|
|
81
|
-
configurable: true,
|
|
82
|
-
value: (...args) => {
|
|
83
|
-
const result = pipe(...args);
|
|
84
|
-
if (Stream.isStream(result)) return attach_live_metadata(result, metadata);
|
|
85
|
-
return result;
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
function get_live_metadata(stream) {
|
|
90
|
-
return stream[LIVE_METADATA];
|
|
91
|
-
}
|
|
92
|
-
function read_live_status(resource) {
|
|
93
|
-
if (resource.error !== void 0) return {
|
|
94
|
-
_tag: "Failed",
|
|
95
|
-
cause: resource.error
|
|
96
|
-
};
|
|
97
|
-
if (resource.done === true) return { _tag: "Closed" };
|
|
98
|
-
if (resource.connected === true) return { _tag: "Open" };
|
|
99
|
-
return { _tag: "Connecting" };
|
|
100
|
-
}
|
|
101
|
-
//#endregion
|
|
102
|
-
export { make_remote_live_stream as n, Live as t };
|
|
103
|
-
|
|
104
|
-
//# sourceMappingURL=live-BXAKre_4.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"live-BXAKre_4.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/live.ts"],"sourcesContent":["import { Effect, Stream } from \"effect\";\n\nimport { InvalidLiveQueryFactoryError } from \"$/errors.ts\";\nimport type { RemoteFailure } from \"$/remote/shared.ts\";\n\n/**\n * Runtime marker attached to remote live streams created by SER.\n *\n * @since 3.4.8\n */\nexport const REMOTE_LIVE_STREAM: unique symbol = Symbol.for(\"ser.remote-live-stream\") as never;\n\nconst LIVE_METADATA: unique symbol = Symbol.for(\"ser.remote-live-metadata\") as never;\n\nconst LIVE_OPERATOR: unique symbol = Symbol.for(\"ser.live-operator\") as never;\n\ntype RemoteLivePipe<A, E> = {\n\t(): RemoteLiveStream<A, E>;\n\t(ab: LiveFactory[\"status\"]): Stream.Stream<LiveStatus, never, never>;\n\t(ab: LiveFactory[\"reconnect\"]): Effect.Effect<void, RemoteFailure<E>, never>;\n\t<B>(ab: LiveFactory[\"status\"], bc: (_: Stream.Stream<LiveStatus, never, never>) => B): B;\n\t<B>(\n\t\tab: LiveFactory[\"reconnect\"],\n\t\tbc: (_: Effect.Effect<void, RemoteFailure<E>, never>) => B,\n\t): B;\n\t<B, C>(\n\t\tab: LiveFactory[\"status\"],\n\t\tbc: (_: Stream.Stream<LiveStatus, never, never>) => B,\n\t\tcd: (_: B) => C,\n\t): C;\n\t<B, C>(\n\t\tab: LiveFactory[\"reconnect\"],\n\t\tbc: (_: Effect.Effect<void, RemoteFailure<E>, never>) => B,\n\t\tcd: (_: B) => C,\n\t): C;\n\t<B>(\n\t\tab: (\n\t\t\t_: Stream.Stream<A, RemoteFailure<E>, never>,\n\t\t) => Stream.Stream<B, RemoteFailure<E>, never>,\n\t): RemoteLiveStream<B, E>;\n\t<B>(ab: (_: Stream.Stream<A, RemoteFailure<E>, never>) => B): B;\n\t<B, C>(ab: (_: Stream.Stream<A, RemoteFailure<E>, never>) => B, bc: (_: B) => C): C;\n\t<B, C, D>(\n\t\tab: (_: Stream.Stream<A, RemoteFailure<E>, never>) => B,\n\t\tbc: (_: B) => C,\n\t\tcd: (_: C) => D,\n\t): D;\n};\n\n/**\n * Stream returned by `Query.live` remote functions.\n *\n * @example\n * ```ts\n * const Time = GetTime();\n * const Label = Time.pipe(Stream.map((time) => time.toISOString()));\n * ```\n *\n * @since 3.4.8\n */\nexport type RemoteLiveStream<A, E = never> = Omit<\n\tStream.Stream<A, RemoteFailure<E>, never>,\n\t\"pipe\"\n> & {\n\treadonly [REMOTE_LIVE_STREAM]: true;\n\treadonly pipe: RemoteLivePipe<A, E>;\n};\n\n/**\n * Transport state exposed separately from the data stream.\n *\n * @example\n * ```ts\n * const Status = GetTime().pipe(Live.status);\n * ```\n *\n * @since 3.4.8\n */\nexport type LiveStatus =\n\t| {\n\t\t\treadonly _tag: \"Idle\";\n\t }\n\t| {\n\t\t\treadonly _tag: \"Connecting\";\n\t }\n\t| {\n\t\t\treadonly _tag: \"Open\";\n\t }\n\t| {\n\t\t\treadonly _tag: \"Failed\";\n\t\t\treadonly cause: unknown;\n\t }\n\t| {\n\t\t\treadonly _tag: \"Closed\";\n\t };\n\n/**\n * Public live stream control helpers.\n *\n * @example\n * ```ts\n * yield* GetNotifications().pipe(Live.reconnect);\n * ```\n *\n * @since 3.4.8\n */\nexport interface LiveFactory {\n\treadonly status: {\n\t\treadonly [LIVE_OPERATOR]: true;\n\t\t/**\n\t\t * Creates a stream of transport status updates for a remote live stream.\n\t\t *\n\t\t * @example\n\t\t * ```ts\n\t\t * const Status = GetTime().pipe(Live.status);\n\t\t * ```\n\t\t *\n\t\t * @param stream - Remote live stream whose transport status should be read.\n\t\t * @returns A stream of transport status snapshots.\n\t\t */\n\t\t<A, E>(stream: RemoteLiveStream<A, E>): Stream.Stream<LiveStatus, never, never>;\n\t};\n\treadonly reconnect: {\n\t\treadonly [LIVE_OPERATOR]: true;\n\t\t/**\n\t\t * Reconnects the transport behind a remote live stream.\n\t\t *\n\t\t * @example\n\t\t * ```ts\n\t\t * yield* GetNotifications().pipe(Live.reconnect);\n\t\t * ```\n\t\t *\n\t\t * @param stream - Remote live stream whose transport should reconnect.\n\t\t * @returns An Effect that completes after the reconnect request is sent.\n\t\t */\n\t\t<A, E>(stream: RemoteLiveStream<A, E>): Effect.Effect<void, RemoteFailure<E>, never>;\n\t};\n}\n\ntype NativeLiveResource<A> = {\n\treadonly connected?: boolean;\n\treadonly current?: A;\n\treadonly done?: boolean;\n\treadonly error?: unknown;\n\treadonly loading?: boolean;\n\treadonly ready?: boolean;\n\treadonly reconnect?: () => Promise<void> | void;\n\treadonly [Symbol.asyncIterator]?: () => AsyncIterator<A>;\n};\n\ntype LiveMetadata<A = unknown, ErrorType = never> = {\n\treadonly resource: NativeLiveResource<A>;\n\treadonly on_error: (error: unknown) => RemoteFailure<ErrorType>;\n};\n\ntype LiveMetadataCarrier = {\n\treadonly [LIVE_METADATA]?: LiveMetadata<unknown, unknown>;\n};\n\ntype PipeableStream<A, E, R> = Stream.Stream<A, E, R> & {\n\treadonly pipe: (...args: readonly unknown[]) => unknown;\n};\n\n/**\n * Builds a remote live stream from SvelteKit's native live resource.\n *\n * @example\n * ```ts\n * const stream = make_remote_live_stream(resource, normalize_native_error);\n * ```\n *\n * @since 3.4.8\n * @param resource - Native SvelteKit live query resource.\n * @param on_error - Error mapper used for stream and reconnect failures.\n * @returns A remote live stream carrying hidden transport metadata.\n * @internal\n */\nexport function make_remote_live_stream<A, ErrorType = never>(\n\tresource: unknown,\n\ton_error: (error: unknown) => RemoteFailure<ErrorType>,\n): RemoteLiveStream<A, ErrorType> {\n\tconst live_resource = as_native_live_resource<A>(resource);\n\tconst stream = Stream.fromAsyncIterable(live_resource, on_error);\n\tconst metadata: LiveMetadata<A, ErrorType> = {\n\t\tresource: live_resource,\n\t\ton_error,\n\t};\n\n\treturn attach_live_metadata(stream, metadata) as RemoteLiveStream<A, ErrorType>;\n}\n\nconst live_status = Object.assign(\n\tfunction status<A, E>(stream: RemoteLiveStream<A, E>): Stream.Stream<LiveStatus, never, never> {\n\t\tconst metadata = get_live_metadata(stream);\n\n\t\tif (!metadata) {\n\t\t\treturn Stream.succeed({ _tag: \"Idle\" } as const);\n\t\t}\n\n\t\treturn Stream.succeed(read_live_status(metadata.resource)).pipe(\n\t\t\tStream.concat(\n\t\t\t\tStream.tick(\"250 millis\").pipe(\n\t\t\t\t\tStream.map(() => read_live_status(metadata.resource)),\n\t\t\t\t),\n\t\t\t),\n\t\t);\n\t},\n\t{ [LIVE_OPERATOR]: true as const },\n) satisfies LiveFactory[\"status\"];\n\nconst live_reconnect = Object.assign(\n\tfunction reconnect<A, E>(\n\t\tstream: RemoteLiveStream<A, E>,\n\t): Effect.Effect<void, RemoteFailure<E>, never> {\n\t\tconst metadata = get_live_metadata(stream);\n\t\tconst reconnect = metadata?.resource.reconnect;\n\n\t\tif (!metadata || typeof reconnect !== \"function\") {\n\t\t\treturn Effect.fail(new InvalidLiveQueryFactoryError()) as unknown as Effect.Effect<\n\t\t\t\tvoid,\n\t\t\t\tRemoteFailure<E>,\n\t\t\t\tnever\n\t\t\t>;\n\t\t}\n\n\t\treturn Effect.tryPromise({\n\t\t\ttry: () => Promise.resolve(reconnect.call(metadata.resource)),\n\t\t\tcatch: metadata.on_error,\n\t\t}) as Effect.Effect<void, RemoteFailure<E>, never>;\n\t},\n\t{ [LIVE_OPERATOR]: true as const },\n) satisfies LiveFactory[\"reconnect\"];\n\n/**\n * Remote live transport helpers.\n *\n * @since 3.4.8\n */\nexport const Live: LiveFactory = {\n\tstatus: live_status,\n\treconnect: live_reconnect,\n};\n\nfunction as_native_live_resource<A>(resource: unknown): NativeLiveResource<A> & AsyncIterable<A> {\n\tif (!is_native_live_resource<A>(resource)) {\n\t\tthrow new InvalidLiveQueryFactoryError();\n\t}\n\n\treturn resource;\n}\n\nfunction is_native_live_resource<A>(\n\tresource: unknown,\n): resource is NativeLiveResource<A> & AsyncIterable<A> {\n\tconst resource_type = typeof resource;\n\n\tif (resource_type !== \"object\" && resource_type !== \"function\") {\n\t\treturn false;\n\t}\n\n\tif (resource === null) {\n\t\treturn false;\n\t}\n\n\treturn typeof (resource as NativeLiveResource<A>)[Symbol.asyncIterator] === \"function\";\n}\n\nfunction attach_live_metadata<A, E, R>(\n\tstream: Stream.Stream<A, E, R>,\n\tmetadata: LiveMetadata<unknown, unknown>,\n): Stream.Stream<A, E, R> {\n\tconst carrier = stream as Stream.Stream<A, E, R> & LiveMetadataCarrier;\n\n\tif (carrier[LIVE_METADATA]) {\n\t\treturn stream;\n\t}\n\n\tObject.defineProperty(carrier, LIVE_METADATA, {\n\t\tconfigurable: true,\n\t\tvalue: metadata,\n\t});\n\n\tObject.defineProperty(carrier, REMOTE_LIVE_STREAM, {\n\t\tconfigurable: true,\n\t\tvalue: true,\n\t});\n\n\tpropagate_live_metadata_through_pipe(carrier as PipeableStream<A, E, R>, metadata);\n\n\treturn stream;\n}\n\nfunction propagate_live_metadata_through_pipe<A, E, R>(\n\tstream: PipeableStream<A, E, R>,\n\tmetadata: LiveMetadata<unknown, unknown>,\n): void {\n\tconst pipe = stream.pipe.bind(stream);\n\n\tObject.defineProperty(stream, \"pipe\", {\n\t\tconfigurable: true,\n\t\tvalue: (...args: readonly unknown[]) => {\n\t\t\tconst result = pipe(...args);\n\n\t\t\tif (Stream.isStream(result)) {\n\t\t\t\treturn attach_live_metadata(result, metadata);\n\t\t\t}\n\n\t\t\treturn result;\n\t\t},\n\t});\n}\n\nfunction get_live_metadata<A, E>(stream: RemoteLiveStream<A, E>): LiveMetadata<A, E> | undefined;\nfunction get_live_metadata(\n\tstream: Stream.Stream<unknown, unknown, unknown>,\n): LiveMetadata<unknown, unknown> | undefined;\nfunction get_live_metadata(\n\tstream: Stream.Stream<unknown, unknown, unknown>,\n): LiveMetadata<unknown, unknown> | undefined {\n\treturn (stream as LiveMetadataCarrier)[LIVE_METADATA];\n}\n\nfunction read_live_status(resource: NativeLiveResource<unknown>): LiveStatus {\n\tif (resource.error !== undefined) {\n\t\treturn {\n\t\t\t_tag: \"Failed\",\n\t\t\tcause: resource.error,\n\t\t};\n\t}\n\n\tif (resource.done === true) {\n\t\treturn { _tag: \"Closed\" };\n\t}\n\n\tif (resource.connected === true) {\n\t\treturn { _tag: \"Open\" };\n\t}\n\n\treturn { _tag: \"Connecting\" };\n}\n"],"mappings":";;;;;;;;AAUA,MAAa,qBAAoC,OAAO,IAAI,wBAAwB;AAEpF,MAAM,gBAA+B,OAAO,IAAI,0BAA0B;AAE1E,MAAM,gBAA+B,OAAO,IAAI,mBAAmB;;;;;;;;;;;;;;;AAmKnE,SAAgB,wBACf,UACA,UACiC;CACjC,MAAM,gBAAgB,wBAA2B,QAAQ;CAOzD,OAAO,qBANQ,OAAO,kBAAkB,eAAe,QAMtB,GAAG;EAJnC,UAAU;EACV;CAG0C,CAAC;AAC7C;;;;;;AAiDA,MAAa,OAAoB;CAChC,QAhDmB,OAAO,OAC1B,SAAS,OAAa,QAAyE;EAC9F,MAAM,WAAW,kBAAkB,MAAM;EAEzC,IAAI,CAAC,UACJ,OAAO,OAAO,QAAQ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,cAAc;EACd,QAAQ,GAAG,SAA6B;GACvC,MAAM,SAAS,KAAK,GAAG,IAAI;GAE3B,IAAI,OAAO,SAAS,MAAM,GACzB,OAAO,qBAAqB,QAAQ,QAAQ;GAG7C,OAAO;EACR;CACD,CAAC;AACF;AAMA,SAAS,kBACR,QAC6C;CAC7C,OAAQ,OAA+B;AACxC;AAEA,SAAS,iBAAiB,UAAmD;CAC5E,IAAI,SAAS,UAAU,KAAA,GACtB,OAAO;EACN,MAAM;EACN,OAAO,SAAS;CACjB;CAGD,IAAI,SAAS,SAAS,MACrB,OAAO,EAAE,MAAM,SAAS;CAGzB,IAAI,SAAS,cAAc,MAC1B,OAAO,EAAE,MAAM,OAAO;CAGvB,OAAO,EAAE,MAAM,aAAa;AAC7B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"remote-client-CVI4t66c.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/compiler/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,SAC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B,WAA+B;CAG3D,QAFkB,GAAG,iBAAiB,SAAS,IAAI,GAAG,aAAa,SAAS,IAAI,KAAA,EAAA,EAE9D,MAAM,aAAa,SAAS,SAAS,GAAG,WAAW,aAAa,KAAK;AACxF;AAEA,SAAS,0BAA0B,kBAAuD;CACzF,QAAQ,GAAG,qBAAqB,gBAAgB,IAAI,GAAG,UAAU,WAAW;AAC7E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-GBQz32DZ.js","names":["InternalDispatcher"],"sources":["../../../modules/svelte-effect-runtime/src/server/runtime.ts"],"sourcesContent":["import { RequestEventUnavailableError, RuntimeAlreadyInitializedError } from \"$/errors.ts\";\nimport type { ManagedRuntime as ManagedRuntimeType } from \"effect/ManagedRuntime\";\nimport type { RequestEvent as SvelteKitRequestEvent } from \"@sveltejs/kit\";\nimport { Dispatcher as InternalDispatcher } from \"$/dispatcher.ts\";\nimport { Context, Layer, ManagedRuntime } from \"effect\";\n\ntype ViteImportMeta = ImportMeta & {\n\treadonly env?: {\n\t\treadonly DEV?: boolean;\n\t\treadonly MODE?: string;\n\t\treadonly SSR?: boolean;\n\t};\n};\n\n/**\n * Subset of SvelteKit's `RequestEvent` that remote handlers typically access.\n *\n * @since 2.0.0\n */\nexport interface RequestEvent extends Pick<\n\tSvelteKitRequestEvent,\n\t\"cookies\" | \"getClientAddress\" | \"locals\" | \"params\" | \"platform\" | \"request\" | \"route\" | \"url\"\n> {}\n\n/**\n * SvelteKit's `RequestEvent` exposed as an Effect {@link Context.Tag}.\n *\n * @example\n * ```ts\n * const event = yield* RequestEvent;\n * ```\n *\n * @since 2.0.0\n */\nexport const RequestEvent: Context.Reference<RequestEvent> = Context.Reference<RequestEvent>(\n\t\"@ser/RequestEvent\",\n\t{\n\t\tdefaultValue: () => {\n\t\t\tthrow new RequestEventUnavailableError();\n\t\t},\n\t},\n);\n\n/**\n * Builder for the server-side Effect runtime.\n *\n * @example\n * ```ts\n * ServerRuntime.make(Db.Live);\n * ```\n *\n * @since 2.0.0\n */\nexport class ServerRuntime {\n\t/**\n\t * Build and cache the server-side `ManagedRuntime`.\n\t *\n\t * @since 2.0.0\n\t * @param layer - Optional Effect layer to provide to the runtime.\n\t * @returns The configured ManagedRuntime.\n\t */\n\tstatic make<R = never>(layer?: Layer.Layer<R>): ManagedRuntime.ManagedRuntime<R, never> {\n\t\tconst should_replace_dev_runtime =\n\t\t\tcurrent_server_runtime !== undefined && is_vite_dev_ssr();\n\n\t\t/**\n\t\t * Keep duplicate production initialization loud while allowing SvelteKit's\n\t\t * dev server to re-run hooks.server.ts after an HMR invalidation.\n\t\t */\n\t\tif (current_server_runtime && !should_replace_dev_runtime) {\n\t\t\tthrow new RuntimeAlreadyInitializedError(\"ServerRuntime\");\n\t\t}\n\n\t\tif (should_replace_dev_runtime) {\n\t\t\treset_server_runtime();\n\t\t}\n\n\t\tconst runtime = ManagedRuntime.make(layer ?? (Layer.empty as unknown as Layer.Layer<R>));\n\n\t\tcurrent_server_runtime = runtime as ManagedRuntime.ManagedRuntime<unknown, never>;\n\t\tcurrent_server_dispatcher = new InternalDispatcher(\n\t\t\truntime as unknown as ManagedRuntimeType<unknown, unknown>,\n\t\t);\n\n\t\treturn runtime;\n\t}\n}\n\nlet current_server_runtime: ManagedRuntime.ManagedRuntime<unknown, never> | undefined;\nlet current_server_dispatcher: InternalDispatcher | undefined;\n\n/**\n * Returns the active server runtime, creating a default one if needed.\n *\n * @example\n * ```ts\n * const runtime = get_server_runtime_or_throw();\n * ```\n *\n * @since 2.0.0\n * @returns The current ManagedRuntime instance.\n */\nexport function get_server_runtime_or_throw(): ManagedRuntime.ManagedRuntime<unknown, never> {\n\tif (!current_server_runtime) {\n\t\tcurrent_server_runtime = ManagedRuntime.make(Layer.empty) as ManagedRuntime.ManagedRuntime<\n\t\t\tunknown,\n\t\t\tnever\n\t\t>;\n\t}\n\n\treturn current_server_runtime;\n}\n\n/**\n * Returns a dispatcher backed by the active server runtime.\n *\n * @example\n * ```ts\n * const dispatcher = get_server_dispatcher();\n * ```\n *\n * @since 3.0.1\n * @returns The cached server dispatcher, creating one from the current server\n * runtime when needed.\n */\nexport function get_server_dispatcher(): InternalDispatcher {\n\tcurrent_server_dispatcher ??= new InternalDispatcher(\n\t\tget_server_runtime_or_throw() as unknown as ManagedRuntimeType<unknown, unknown>,\n\t);\n\n\treturn current_server_dispatcher;\n}\n\nfunction is_vite_dev_ssr(): boolean {\n\tconst env = (import.meta as ViteImportMeta).env;\n\n\treturn env?.DEV === true && env?.SSR === true && env.MODE !== \"test\";\n}\n\n/**\n * Resets the internal server runtime singleton used by source-level tests.\n *\n * @example\n * ```ts\n * reset_server_runtime();\n * ```\n *\n * @since 3.4.0\n * @returns Nothing.\n * @internal\n */\nexport function reset_server_runtime(): void {\n\tconst dispatcher = current_server_dispatcher;\n\tconst runtime = current_server_runtime;\n\n\tcurrent_server_dispatcher = undefined;\n\tcurrent_server_runtime = undefined;\n\n\tif (dispatcher) {\n\t\tdispatcher.dispose();\n\n\t\treturn;\n\t}\n\n\tvoid runtime?.dispose().catch((error: unknown) => {\n\t\tqueueMicrotask(() => {\n\t\t\tthrow error;\n\t\t});\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;AAkCA,MAAa,eAAgD,QAAQ,UACpE,qBACA,EACC,oBAAoB;CACnB,MAAM,IAAI,6BAA6B;AACxC,EACD,CACD;;;;;;;;;;;AAYA,IAAa,gBAAb,MAA2B;;;;;;;;CAQ1B,OAAO,KAAgB,OAAiE;EACvF,MAAM,6BACL,2BAA2B,KAAA,KAAa,gBAAgB;;;;;EAMzD,IAAI,0BAA0B,CAAC,4BAC9B,MAAM,IAAI,+BAA+B,eAAe;EAGzD,IAAI,4BACH,qBAAqB;EAGtB,MAAM,UAAU,eAAe,KAAK,SAAU,MAAM,KAAmC;EAEvF,yBAAyB;EACzB,4BAA4B,IAAIA,WAC/B,OACD;EAEA,OAAO;CACR;AACD;AAEA,IAAI;AACJ,IAAI;;;;;;;;;;;;AAaJ,SAAgB,8BAA6E;CAC5F,IAAI,CAAC,wBACJ,yBAAyB,eAAe,KAAK,MAAM,KAAK;CAMzD,OAAO;AACR;;;;;;;;;;;;;AAcA,SAAgB,wBAA4C;CAC3D,8BAA8B,IAAIA,WACjC,4BAA4B,CAC7B;CAEA,OAAO;AACR;AAEA,SAAS,kBAA2B;CACnC,MAAM,MAAO,OAAO,KAAwB;CAE5C,OAAO,KAAK,QAAQ,QAAQ,KAAK,QAAQ,QAAQ,IAAI,SAAS;AAC/D;;;;;;;;;;;;;AAcA,SAAgB,uBAA6B;CAC5C,MAAM,aAAa;CACnB,MAAM,UAAU;CAEhB,4BAA4B,KAAA;CAC5B,yBAAyB,KAAA;CAEzB,IAAI,YAAY;EACf,WAAW,QAAQ;EAEnB;CACD;CAEA,SAAc,QAAQ,CAAC,CAAC,OAAO,UAAmB;EACjD,qBAAqB;GACpB,MAAM;EACP,CAAC;CACF,CAAC;AACF"}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
import { Schema } from "effect";
|
|
2
|
-
//#region src/internal/descriptors.ts
|
|
3
|
-
const default_excluded_descriptor_keys = /* @__PURE__ */ new Set([
|
|
4
|
-
"length",
|
|
5
|
-
"name",
|
|
6
|
-
"prototype"
|
|
7
|
-
]);
|
|
8
|
-
/**
|
|
9
|
-
* Copies own property descriptors from a native helper to a wrapper while
|
|
10
|
-
* skipping function metadata and any caller-specific keys.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```ts
|
|
14
|
-
* copy_property_descriptors(native_remote, wrapped_remote);
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* @since 2.0.0
|
|
18
|
-
* @param source - Source object or function whose descriptors should be
|
|
19
|
-
* mirrored.
|
|
20
|
-
* @param target - Wrapper object or function that receives copied descriptors.
|
|
21
|
-
* @param exclude - Additional property keys that should not be copied.
|
|
22
|
-
* @returns Nothing.
|
|
23
|
-
*/
|
|
24
|
-
function copy_property_descriptors(source, target, exclude = default_excluded_descriptor_keys) {
|
|
25
|
-
if (typeof source !== "object" && typeof source !== "function") return;
|
|
26
|
-
if (source === null) return;
|
|
27
|
-
for (const key of Reflect.ownKeys(source)) {
|
|
28
|
-
if (default_excluded_descriptor_keys.has(key) || exclude.has(key)) continue;
|
|
29
|
-
const descriptor = Object.getOwnPropertyDescriptor(source, key);
|
|
30
|
-
if (!descriptor) continue;
|
|
31
|
-
Object.defineProperty(target, key, descriptor);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
//#endregion
|
|
35
|
-
//#region src/internal/schema.ts
|
|
36
|
-
/**
|
|
37
|
-
* Checks whether a value implements the Standard Schema contract.
|
|
38
|
-
*
|
|
39
|
-
* @example
|
|
40
|
-
* ```ts
|
|
41
|
-
* if (is_standard_schema(value)) {
|
|
42
|
-
* value["~standard"].validate(input);
|
|
43
|
-
* }
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* @since 2.0.0
|
|
47
|
-
* @param value - Value to inspect.
|
|
48
|
-
* @returns Whether the value is a Standard Schema.
|
|
49
|
-
*/
|
|
50
|
-
function is_standard_schema(value) {
|
|
51
|
-
return typeof value === "object" && value !== null && "~standard" in value;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Checks whether a value looks like an Effect Schema.
|
|
55
|
-
*
|
|
56
|
-
* @example
|
|
57
|
-
* ```ts
|
|
58
|
-
* if (is_effect_schema(value)) {
|
|
59
|
-
* Schema.toStandardSchemaV1(value);
|
|
60
|
-
* }
|
|
61
|
-
* ```
|
|
62
|
-
*
|
|
63
|
-
* @since 2.0.0
|
|
64
|
-
* @param value - Value to inspect.
|
|
65
|
-
* @returns Whether the value should be converted to Standard Schema.
|
|
66
|
-
*/
|
|
67
|
-
function is_effect_schema(value) {
|
|
68
|
-
return typeof value === "object" && value !== null && "ast" in value && "make" in value;
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* Converts Effect Schema inputs to Standard Schema for SvelteKit.
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```ts
|
|
75
|
-
* const validator = normalize_validator(Schema.Struct({ title: Schema.String }));
|
|
76
|
-
* ```
|
|
77
|
-
*
|
|
78
|
-
* @since 2.0.0
|
|
79
|
-
* @param value - Schema or handler input.
|
|
80
|
-
* @returns Original value or Standard Schema view of an Effect Schema.
|
|
81
|
-
*/
|
|
82
|
-
function normalize_validator(value) {
|
|
83
|
-
if (is_standard_schema(value) || !is_effect_schema(value)) return value;
|
|
84
|
-
return Schema.toStandardSchemaV1(value);
|
|
85
|
-
}
|
|
86
|
-
//#endregion
|
|
87
|
-
export { normalize_validator as n, copy_property_descriptors as r, is_standard_schema as t };
|
|
88
|
-
|
|
89
|
-
//# sourceMappingURL=schema-D9pct6Y5.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema-D9pct6Y5.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/internal/descriptors.ts","../../../modules/svelte-effect-runtime/src/internal/schema.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","import { Schema } from \"effect\";\n\n/**\n * Minimal Standard Schema shape accepted by SvelteKit remote helpers.\n *\n * @example\n * ```ts\n * const schema: StandardSchema = {\n * \"~standard\": {\n * validate: (input) => ({ value: input }),\n * },\n * };\n * ```\n *\n * @since 2.0.0\n */\nexport type StandardSchema = {\n\treadonly \"~standard\": {\n\t\treadonly types?: {\n\t\t\treadonly input: unknown;\n\t\t\treadonly output: unknown;\n\t\t};\n\t\treadonly validate: (input: unknown) => unknown;\n\t};\n};\n\n/**\n * Checks whether a value implements the Standard Schema contract.\n *\n * @example\n * ```ts\n * if (is_standard_schema(value)) {\n * value[\"~standard\"].validate(input);\n * }\n * ```\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is a Standard Schema.\n */\nexport function is_standard_schema(value: unknown): value is StandardSchema {\n\treturn typeof value === \"object\" && value !== null && \"~standard\" in value;\n}\n\n/**\n * Checks whether a value looks like an Effect Schema.\n *\n * @example\n * ```ts\n * if (is_effect_schema(value)) {\n * Schema.toStandardSchemaV1(value);\n * }\n * ```\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value should be converted to Standard Schema.\n */\nexport function is_effect_schema(value: unknown): value is Schema.Schema<unknown> {\n\treturn typeof value === \"object\" && value !== null && \"ast\" in value && \"make\" in value;\n}\n\n/**\n * Converts Effect Schema inputs to Standard Schema for SvelteKit.\n *\n * @example\n * ```ts\n * const validator = normalize_validator(Schema.Struct({ title: Schema.String }));\n * ```\n *\n * @since 2.0.0\n * @param value - Schema or handler input.\n * @returns Original value or Standard Schema view of an Effect Schema.\n */\nexport function normalize_validator(value: unknown): unknown {\n\tif (is_standard_schema(value) || !is_effect_schema(value)) {\n\t\treturn value;\n\t}\n\n\treturn Schema.toStandardSchemaV1(value as never);\n}\n"],"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;;;;;;;;;;;;;;;;;ACJA,SAAgB,mBAAmB,OAAyC;CAC3E,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,eAAe;AACtE;;;;;;;;;;;;;;;AAgBA,SAAgB,iBAAiB,OAAiD;CACjF,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,SAAS,SAAS,UAAU;AACnF;;;;;;;;;;;;;AAcA,SAAgB,oBAAoB,OAAyB;CAC5D,IAAI,mBAAmB,KAAK,KAAK,CAAC,iBAAiB,KAAK,GACvD,OAAO;CAGR,OAAO,OAAO,mBAAmB,KAAc;AAChD"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server-D1LcDnZE.js","names":[],"sources":["../../../modules/svelte-effect-runtime/src/remote/cause-codec.ts","../../../modules/svelte-effect-runtime/src/remote/server.ts"],"sourcesContent":["import type { FormIssue } from \"$/remote/shared.ts\";\nimport { isHttpError, isRedirect, isValidationError } from \"@sveltejs/kit\";\nimport { Cause } from \"effect\";\nimport { stringify } from \"devalue\";\n\n/**\n * Classified result of inspecting an Effect Cause at the remote server boundary.\n *\n * @example\n * ```ts\n * const resolution = classify_remote_cause(cause);\n * if (resolution._tag === \"RemoteFailure\") {\n * console.log(resolution.encoded);\n * }\n * ```\n *\n * @since 4.0.0\n */\nexport type RemoteCauseResolution =\n\t| {\n\t\t\treadonly _tag: \"SvelteKitControlFlow\";\n\t\t\treadonly value: unknown;\n\t }\n\t| {\n\t\t\treadonly _tag: \"InterruptOnly\";\n\t\t\treadonly cause: Cause.Cause<unknown>;\n\t }\n\t| {\n\t\t\treadonly _tag: \"FormInvalid\";\n\t\t\treadonly issues: readonly FormIssue[];\n\t }\n\t| {\n\t\t\treadonly _tag: \"RemoteFailure\";\n\t\t\treadonly encoded: string;\n\t };\n\n/**\n * Classifies a failed Effect Cause into the server action SER should take.\n *\n * @example\n * ```ts\n * const resolution = classify_remote_cause(Cause.fail({ _tag: \"DbError\" }));\n * ```\n *\n * @since 4.0.0\n * @param cause - Failed Effect Cause produced by a remote handler.\n * @returns A remote boundary decision preserving control flow, form errors,\n * interrupts, or encoded typed failures.\n * @internal\n */\nexport function classify_remote_cause(cause: Cause.Cause<unknown>): RemoteCauseResolution {\n\tconst control_flow = find_sveltekit_control_flow(cause);\n\n\tif (control_flow !== undefined) {\n\t\treturn {\n\t\t\t_tag: \"SvelteKitControlFlow\",\n\t\t\tvalue: control_flow,\n\t\t};\n\t}\n\n\tif (Cause.hasInterruptsOnly(cause)) {\n\t\treturn {\n\t\t\t_tag: \"InterruptOnly\",\n\t\t\tcause,\n\t\t};\n\t}\n\n\tconst form_error_issues = find_form_error_issues(cause);\n\n\tif (form_error_issues !== undefined) {\n\t\treturn {\n\t\t\t_tag: \"FormInvalid\",\n\t\t\tissues: form_error_issues,\n\t\t};\n\t}\n\n\treturn {\n\t\t_tag: \"RemoteFailure\",\n\t\tencoded: encode_remote_failure(cause),\n\t};\n}\n\n/**\n * Encodes an Effect Cause into a string that the client-side adapter can\n * decode back into a typed `RemoteFailure`.\n *\n * @since 2.0.0\n * @param cause - The Effect Cause from a failed execution.\n * @returns A devalue-encoded string representing the serialised failure.\n * @internal\n */\nexport function encode_remote_failure(cause: Cause.Cause<unknown>): string {\n\tfor (const reason of cause.reasons) {\n\t\tif (!Cause.isFailReason(reason)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst failure = to_public_remote_failure(reason.error);\n\t\tconst encoded = stringify_failure(failure);\n\n\t\tif (encoded !== undefined) {\n\t\t\treturn encoded;\n\t\t}\n\t}\n\n\treturn stringify_unknown_remote_failure();\n}\n\nfunction find_sveltekit_control_flow(cause: Cause.Cause<unknown>): unknown | undefined {\n\tfor (const reason of cause.reasons) {\n\t\tif (!Cause.isDieReason(reason)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (is_sveltekit_control_flow(reason.defect)) {\n\t\t\treturn reason.defect;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction find_form_error_issues(cause: Cause.Cause<unknown>): readonly FormIssue[] | undefined {\n\tfor (const reason of cause.reasons) {\n\t\tif (!Cause.isFailReason(reason)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst issues = get_form_error_issues(reason.error);\n\n\t\tif (issues !== undefined) {\n\t\t\treturn issues;\n\t\t}\n\t}\n\n\treturn undefined;\n}\n\nfunction get_form_error_issues(value: unknown): readonly FormIssue[] | undefined {\n\tif (!is_object_like(value) || (value as { readonly _tag?: unknown })._tag !== \"FormError\") {\n\t\treturn undefined;\n\t}\n\n\treturn (value as { readonly issues?: readonly FormIssue[] }).issues ?? [];\n}\n\nfunction is_sveltekit_control_flow(value: unknown): boolean {\n\treturn isRedirect(value) || isHttpError(value) || isValidationError(value);\n}\n\nfunction stringify_failure(value: unknown): string | undefined {\n\ttry {\n\t\treturn stringify(value);\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction to_public_remote_failure(value: unknown): unknown {\n\tif (!has_public_remote_failure_tag(value)) {\n\t\treturn create_unknown_remote_failure();\n\t}\n\n\tconst serializable_failure = to_serializable_public_failure(value);\n\n\treturn serializable_failure ?? create_unknown_remote_failure();\n}\n\nfunction to_serializable_public_failure(value: unknown, seen = new WeakSet<object>()): unknown {\n\tif (typeof value === \"function\" || typeof value === \"symbol\") {\n\t\treturn undefined;\n\t}\n\n\tif (!is_object_like(value)) {\n\t\treturn value;\n\t}\n\n\tif (stringify_failure(value) !== undefined) {\n\t\treturn value;\n\t}\n\n\tif (is_internal_object(value)) {\n\t\treturn undefined;\n\t}\n\n\tif (seen.has(value)) {\n\t\treturn undefined;\n\t}\n\n\tseen.add(value);\n\n\tconst serializable = Array.isArray(value)\n\t\t? value.map((item) => to_serializable_public_failure(item, seen))\n\t\t: to_plain_record(value, seen);\n\n\tseen.delete(value);\n\n\treturn serializable;\n}\n\nfunction to_plain_record(value: object, seen: WeakSet<object>): Record<string, unknown> {\n\tconst descriptors = Object.getOwnPropertyDescriptors(value);\n\tconst record: Record<string, unknown> = {};\n\n\tfor (const [key, descriptor] of Object.entries(descriptors)) {\n\t\tif (key === \"stack\" || !(\"value\" in descriptor)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\trecord[key] = to_serializable_public_failure(descriptor.value, seen);\n\t}\n\n\tif (value instanceof Error && !(\"message\" in record)) {\n\t\trecord.message = value.message;\n\t}\n\n\treturn record;\n}\n\nfunction is_object_like(value: unknown): value is object {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction has_public_remote_failure_tag(value: unknown): boolean {\n\treturn is_object_like(value) && typeof (value as { _tag?: unknown })._tag === \"string\";\n}\n\nfunction is_internal_object(value: object): boolean {\n\treturn (\n\t\t!Array.isArray(value) && !is_plain_record(value) && !has_public_remote_failure_tag(value)\n\t);\n}\n\nfunction is_plain_record(value: object): boolean {\n\tconst prototype = Object.getPrototypeOf(value);\n\n\treturn prototype === Object.prototype || prototype === null;\n}\n\nfunction create_unknown_remote_failure(): { readonly message: string } {\n\treturn { message: \"[UNKNOWN_REMOTE_FAILURE]: Unknown error\" };\n}\n\nfunction stringify_unknown_remote_failure(): string {\n\treturn stringify(create_unknown_remote_failure());\n}\n","import { create_serialized_remote_failure_envelope } from \"$/remote/shared.ts\";\nimport type { FormIssue } from \"$/remote/shared.ts\";\nimport { RemoteHelperContextError, RemoteHelperError } from \"$/errors.ts\";\nimport { classify_remote_cause } from \"$/remote/cause-codec.ts\";\nimport { Cause, Effect, Exit } from \"effect\";\n\ntype SvelteInvalid = (...issues: readonly (FormIssue | string)[]) => never;\n\ntype SvelteError = (status: number, body: unknown) => never;\n\nconst request_event_context_error_start =\n\t\"Can only read the current request event inside functions invoked during `handle`\";\n\nconst request_store_context_error = \"Could not get the request store.\";\n\nexport { encode_remote_failure } from \"$/remote/cause-codec.ts\";\n\n/**\n * Runs a user-supplied Effect program through a ManagedRuntime, maps its\n * exit into the shape expected by SvelteKit, and returns the result or\n * throws a SvelteKit-compatible error.\n *\n * @since 2.0.0\n * @param effect - The Effect program to execute.\n * @param runtime - The server-side ManagedRuntime.\n * @param invalid - SvelteKit's `invalid` helper (bound per-request).\n * @param error - SvelteKit's `error` helper.\n * @returns A Promise that resolves with the effect's success value.\n * @internal\n */\nexport async function run_remote_effect<A>(\n\teffect: Effect.Effect<A, unknown, unknown>,\n\truntime: {\n\t\trunPromise: (e: Effect.Effect<unknown, unknown, unknown>) => Promise<unknown>;\n\t},\n\tinvalid: SvelteInvalid,\n\terror: SvelteError,\n): Promise<A> {\n\tconst exit: Exit.Exit<A, unknown> = (await runtime.runPromise(\n\t\tEffect.exit(effect) as Effect.Effect<unknown, unknown, unknown>,\n\t)) as Exit.Exit<A, unknown>;\n\n\tif (Exit.isSuccess(exit)) {\n\t\treturn exit.value;\n\t}\n\n\thandle_failure(exit.cause, invalid, error);\n}\n\n/**\n * Applies a classified remote Cause decision to SvelteKit's server helpers.\n */\nfunction handle_failure(\n\tcause: Cause.Cause<unknown>,\n\tinvalid: SvelteInvalid,\n\terror: SvelteError,\n): never {\n\tconst resolution = classify_remote_cause(cause);\n\n\tswitch (resolution._tag) {\n\t\tcase \"SvelteKitControlFlow\": {\n\t\t\tthrow resolution.value;\n\t\t}\n\t\tcase \"InterruptOnly\": {\n\t\t\tthrow Cause.squash(resolution.cause);\n\t\t}\n\t\tcase \"FormInvalid\": {\n\t\t\tinvalid(...resolution.issues);\n\t\t}\n\t\tcase \"RemoteFailure\": {\n\t\t\tconst envelope = create_serialized_remote_failure_envelope(resolution.encoded);\n\n\t\t\terror(500, envelope);\n\t\t}\n\t}\n}\n\n/**\n * Throws a SvelteKit `invalid` response from a {@link FormError}, calling\n * through to the request-scoped `invalid` helper.\n *\n * @example\n * ```ts\n * throw_form_error(\n * [{ message: \"Name is required\", path: [\"name\"] }],\n * invalid,\n * );\n * ```\n *\n * @since 2.0.0\n * @param issues - The list of form validation issues.\n * @param invalid - SvelteKit's `invalid` helper bound to the current request.\n * @internal\n */\nexport function throw_form_error(issues: readonly FormIssue[], invalid: SvelteInvalid): never {\n\tinvalid(...issues);\n}\n\n/**\n * Remaps SvelteKit's unbranded request-context errors into clear, actionable\n * messages.\n *\n * @example\n * ```ts\n * try {\n * return native_query(handler);\n * } catch (err) {\n * throw normalize_remote_helper_error(err, \"Query\");\n * }\n * ```\n *\n * @since 2.0.0\n * @param err - The error thrown by SvelteKit's native functions.\n * @param helper_name - Name of the helper that triggered the error.\n * @returns A more descriptive error.\n * @internal\n */\nexport function normalize_remote_helper_error(err: unknown, helper_name: string): Error {\n\tif (is_sveltekit_remote_context_error(err)) {\n\t\treturn new RemoteHelperContextError(helper_name);\n\t}\n\n\treturn err instanceof Error ? err : new RemoteHelperError(err);\n}\n\nfunction is_sveltekit_remote_context_error(err: unknown): err is Error {\n\tif (!(err instanceof Error)) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\terr.message.startsWith(request_event_context_error_start) ||\n\t\terr.message === request_store_context_error\n\t);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAkDA,SAAgB,sBAAsB,OAAoD;CACzF,MAAM,eAAe,4BAA4B,KAAK;CAEtD,IAAI,iBAAiB,KAAA,GACpB,OAAO;EACN,MAAM;EACN,OAAO;CACR;CAGD,IAAI,MAAM,kBAAkB,KAAK,GAChC,OAAO;EACN,MAAM;EACN;CACD;CAGD,MAAM,o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