svelte-effect-runtime 3.4.5 → 3.4.7
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-5cizmHtc.js → client-CsVu54pU.js} +119 -56
- package/.dist/chunks/client-CsVu54pU.js.map +1 -0
- package/.dist/chunks/{descriptors-OS4VfJuW.js → descriptors-cOe9uRJz.js} +2 -2
- package/.dist/chunks/descriptors-cOe9uRJz.js.map +1 -0
- package/.dist/chunks/{dispatcher-C38yhZRs.js → dispatcher-LtvFKYUp.js} +3 -3
- package/.dist/chunks/dispatcher-LtvFKYUp.js.map +1 -0
- package/.dist/chunks/{dispatcher-DuBLHNa6.js → dispatcher-pHH4JcFR.js} +12 -11
- package/.dist/chunks/dispatcher-pHH4JcFR.js.map +1 -0
- package/.dist/chunks/{errors-0PaWf7Bq.js → errors-Dcf0MVbq.js} +3 -3
- package/.dist/chunks/errors-Dcf0MVbq.js.map +1 -0
- package/.dist/chunks/remote-client-Bj1pZXgq.js +108 -0
- package/.dist/chunks/remote-client-Bj1pZXgq.js.map +1 -0
- package/.dist/chunks/{runtime-C51Dv3K6.js → runtime-ekkMQ-wL.js} +4 -4
- package/.dist/chunks/runtime-ekkMQ-wL.js.map +1 -0
- package/.dist/chunks/{transform-Cdsx7ygD.js → transform-CEK6Ccll.js} +246 -172
- package/.dist/chunks/transform-CEK6Ccll.js.map +1 -0
- package/.dist/chunks/{vite-DR3-WaqQ.js → vite-Dm3bXmR3.js} +54 -46
- package/.dist/chunks/vite-Dm3bXmR3.js.map +1 -0
- package/.dist/detect.js.map +1 -1
- package/.dist/dispatcher.d.ts +1 -1
- package/.dist/dispatcher.js +1 -1
- package/.dist/errors.d.ts +1 -1
- package/.dist/internal/generators.js +2 -2
- package/.dist/internal/remote-client.js +1 -1
- package/.dist/markup/promise.js +1 -1
- package/.dist/markup/promise.js.map +1 -1
- package/.dist/markup/run.js +3 -3
- package/.dist/markup/run.js.map +1 -1
- package/.dist/markup/transform/index.d.ts +8 -0
- package/.dist/markup/transform/scan.d.ts +20 -0
- package/.dist/markup/transform/types.d.ts +136 -2
- package/.dist/markup/transform.js +1 -1
- package/.dist/markup/value.js +1 -1
- package/.dist/markup/value.js.map +1 -1
- package/.dist/mod.js +3 -3
- package/.dist/mod.js.map +1 -1
- package/.dist/remote/client/command.d.ts +1 -1
- package/.dist/remote/client/effect.d.ts +15 -1
- package/.dist/remote/client/index.d.ts +1 -1
- package/.dist/remote/client/types.d.ts +3 -1
- package/.dist/remote/client.js +1 -1
- package/.dist/remote/server.js +27 -9
- package/.dist/remote/server.js.map +1 -1
- package/.dist/remote/shared.d.ts +126 -0
- package/.dist/remote/shared.js +117 -5
- package/.dist/remote/shared.js.map +1 -1
- package/.dist/runtime/transform.js +3 -3
- package/.dist/runtime/transform.js.map +1 -1
- package/.dist/script-transform/types.d.ts +95 -0
- package/.dist/server/effects.d.ts +15 -1
- package/.dist/server/factories.d.ts +128 -9
- package/.dist/server/index.d.ts +1 -1
- package/.dist/server/runtime.d.ts +1 -1
- package/.dist/server/types.d.ts +128 -7
- package/.dist/server.js +28 -13
- package/.dist/server.js.map +1 -1
- package/.dist/vite/remote-client.d.ts +24 -0
- package/.dist/vite.d.ts +8 -3
- package/.dist/vite.js +1 -1
- package/LICENSE +29 -0
- package/package.json +21 -21
- package/.dist/chunks/client-5cizmHtc.js.map +0 -1
- package/.dist/chunks/descriptors-OS4VfJuW.js.map +0 -1
- package/.dist/chunks/dispatcher-C38yhZRs.js.map +0 -1
- package/.dist/chunks/dispatcher-DuBLHNa6.js.map +0 -1
- package/.dist/chunks/errors-0PaWf7Bq.js.map +0 -1
- package/.dist/chunks/runtime-C51Dv3K6.js.map +0 -1
- package/.dist/chunks/transform-Cdsx7ygD.js.map +0 -1
- package/.dist/chunks/vite-DR3-WaqQ.js.map +0 -1
package/.dist/server/types.d.ts
CHANGED
|
@@ -5,18 +5,35 @@ import type { Effect, Layer, ManagedRuntime, Schema, Stream } from "effect";
|
|
|
5
5
|
/**
|
|
6
6
|
* Effect-like values accepted by remote helper wrappers.
|
|
7
7
|
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const value: EffectLike<number> = Effect.succeed(1);
|
|
11
|
+
* ```
|
|
12
|
+
*
|
|
8
13
|
* @since 2.0.0
|
|
9
14
|
*/
|
|
10
15
|
export type EffectLike<A = unknown, E = unknown, R = unknown> = Effect.Effect<A, E, R> | Effect.gen.Return<A, E, R>;
|
|
11
16
|
/**
|
|
12
17
|
* Handler shape accepted by query, command, and prerender helpers.
|
|
13
18
|
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const handler: RemoteHandler<{ id: string }, string> = ({ id }) =>
|
|
22
|
+
* Effect.succeed(id);
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
14
25
|
* @since 2.0.0
|
|
15
26
|
*/
|
|
16
27
|
export type RemoteHandler<Input = unknown, A = unknown, E = unknown, R = unknown> = (input: Input) => EffectLike<A, E, R>;
|
|
17
28
|
/**
|
|
18
29
|
* Handler or source shape accepted by live query helpers.
|
|
19
30
|
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const handler: RemoteLiveHandler<void, number> = () =>
|
|
34
|
+
* Stream.make(1, 2, 3);
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
20
37
|
* @since 2.0.0
|
|
21
38
|
*/
|
|
22
39
|
export type RemoteLiveHandler<Input = unknown, A = unknown, E = unknown, R = unknown> = EffectLike<EffectRemoteLiveSource<A>, E, R> | EffectRemoteLiveSource<A> | ((input: Input) => EffectLike<EffectRemoteLiveSource<A>, E, R> | EffectRemoteLiveSource<A>);
|
|
@@ -25,12 +42,25 @@ export type RemoteLiveHandler<Input = unknown, A = unknown, E = unknown, R = unk
|
|
|
25
42
|
* validated inputs collected by SvelteKit and returns an Effect-producing
|
|
26
43
|
* resolver for each requested input.
|
|
27
44
|
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const handler: EffectRemoteBatchHandler<string, boolean> = (ids) =>
|
|
48
|
+
* Effect.succeed((id) => ids.includes(id));
|
|
49
|
+
* ```
|
|
50
|
+
*
|
|
28
51
|
* @since 2.0.0
|
|
29
52
|
*/
|
|
30
53
|
export type EffectRemoteBatchHandler<Input = unknown, A = unknown, E = unknown, R = unknown> = (inputs: readonly Input[]) => EffectLike<(input: Input, index: number) => A, E, R>;
|
|
31
54
|
/**
|
|
32
55
|
* Handler shape accepted by the form helper.
|
|
33
56
|
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
59
|
+
* const handler: RemoteFormHandler<{ email: string }, { ok: true }> = (
|
|
60
|
+
* { data },
|
|
61
|
+
* ) => Effect.succeed({ ok: data.email.length > 0 });
|
|
62
|
+
* ```
|
|
63
|
+
*
|
|
34
64
|
* @since 2.0.0
|
|
35
65
|
*/
|
|
36
66
|
export type RemoteFormHandler<Input = unknown, A = unknown, E = unknown, R = unknown> = (input: {
|
|
@@ -41,6 +71,13 @@ export type RemoteFormHandler<Input = unknown, A = unknown, E = unknown, R = unk
|
|
|
41
71
|
/**
|
|
42
72
|
* Proxy callable used to create typed form validation failures.
|
|
43
73
|
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```ts
|
|
76
|
+
* const fail: Effect.Effect<never, unknown> = invalid.email(
|
|
77
|
+
* "Use an email address.",
|
|
78
|
+
* );
|
|
79
|
+
* ```
|
|
80
|
+
*
|
|
44
81
|
* @since 2.0.0
|
|
45
82
|
*/
|
|
46
83
|
export type FormInvalid<Input = unknown> = FormInvalidFunctionChildren & FormInvalidChildren<Input> & {
|
|
@@ -61,10 +98,18 @@ type FormInvalidChildren<Input> = IsUnknown<Input> extends true ? {
|
|
|
61
98
|
} : NonNullable<Input> extends object ? {
|
|
62
99
|
readonly [Key in keyof NonNullable<Input>]-?: FormInvalid<NonNullable<Input>[Key]>;
|
|
63
100
|
} : Record<never, never>;
|
|
64
|
-
type IsUnknown<Value> = unknown extends Value ? [Value] extends [unknown] ? true : false : false;
|
|
101
|
+
type IsUnknown<Value> = unknown extends Value ? ([Value] extends [unknown] ? true : false) : false;
|
|
65
102
|
/**
|
|
66
103
|
* Options accepted by the prerender helper.
|
|
67
104
|
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```ts
|
|
107
|
+
* const options: PrerenderOptions = {
|
|
108
|
+
* inputs: () => ["first-post", "second-post"],
|
|
109
|
+
* dynamic: true,
|
|
110
|
+
* };
|
|
111
|
+
* ```
|
|
112
|
+
*
|
|
68
113
|
* @since 2.0.0
|
|
69
114
|
*/
|
|
70
115
|
export type PrerenderOptions = {
|
|
@@ -74,6 +119,15 @@ export type PrerenderOptions = {
|
|
|
74
119
|
/**
|
|
75
120
|
* Minimal Standard Schema shape accepted by SvelteKit remote helpers.
|
|
76
121
|
*
|
|
122
|
+
* @example
|
|
123
|
+
* ```ts
|
|
124
|
+
* const schema: StandardSchema = {
|
|
125
|
+
* "~standard": {
|
|
126
|
+
* validate: (input) => ({ value: input }),
|
|
127
|
+
* },
|
|
128
|
+
* };
|
|
129
|
+
* ```
|
|
130
|
+
*
|
|
77
131
|
* @since 2.0.0
|
|
78
132
|
*/
|
|
79
133
|
export type StandardSchema = {
|
|
@@ -88,18 +142,33 @@ export type StandardSchema = {
|
|
|
88
142
|
/**
|
|
89
143
|
* Extracts the input type from an Effect Schema.
|
|
90
144
|
*
|
|
145
|
+
* @example
|
|
146
|
+
* ```ts
|
|
147
|
+
* type Input = SchemaInput<typeof Schema.String>;
|
|
148
|
+
* ```
|
|
149
|
+
*
|
|
91
150
|
* @since 2.0.0
|
|
92
151
|
*/
|
|
93
152
|
export type SchemaInput<S> = S extends Schema.Top ? Schema.Schema.Type<S> : unknown;
|
|
94
153
|
/**
|
|
95
154
|
* Extracts the encoded caller input type from an Effect Schema.
|
|
96
155
|
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```ts
|
|
158
|
+
* type Input = SchemaEncodedInput<typeof Schema.String>;
|
|
159
|
+
* ```
|
|
160
|
+
*
|
|
97
161
|
* @since 2.4.2
|
|
98
162
|
*/
|
|
99
163
|
export type SchemaEncodedInput<S> = S extends Schema.Top ? S["Encoded"] : unknown;
|
|
100
164
|
/**
|
|
101
165
|
* Extracts the encoded input type from a Standard Schema.
|
|
102
166
|
*
|
|
167
|
+
* @example
|
|
168
|
+
* ```ts
|
|
169
|
+
* type Input = StandardSchemaInput<typeof schema>;
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
103
172
|
* @since 3.0.0
|
|
104
173
|
*/
|
|
105
174
|
export type StandardSchemaInput<S> = S extends {
|
|
@@ -112,6 +181,11 @@ export type StandardSchemaInput<S> = S extends {
|
|
|
112
181
|
/**
|
|
113
182
|
* Extracts the decoded handler input type from a Standard Schema.
|
|
114
183
|
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* type Output = StandardSchemaOutput<typeof schema>;
|
|
187
|
+
* ```
|
|
188
|
+
*
|
|
115
189
|
* @since 3.0.0
|
|
116
190
|
*/
|
|
117
191
|
export type StandardSchemaOutput<S> = S extends {
|
|
@@ -124,14 +198,32 @@ export type StandardSchemaOutput<S> = S extends {
|
|
|
124
198
|
/**
|
|
125
199
|
* Root and server export shape for building the server-side runtime.
|
|
126
200
|
*
|
|
201
|
+
* @example
|
|
202
|
+
* ```ts
|
|
203
|
+
* const runtime = ServerRuntime.make();
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
127
206
|
* @since 2.0.0
|
|
128
207
|
*/
|
|
129
208
|
export interface ServerRuntimeFactory {
|
|
209
|
+
/**
|
|
210
|
+
* Builds and caches the server-side Effect runtime.
|
|
211
|
+
*
|
|
212
|
+
* @param layer - Optional Effect layer to provide to remote handlers.
|
|
213
|
+
* @returns The managed runtime used by server-side SER helpers.
|
|
214
|
+
*/
|
|
130
215
|
make<R = never>(layer?: Layer.Layer<R>): ManagedRuntime.ManagedRuntime<R, never>;
|
|
131
216
|
}
|
|
132
217
|
/**
|
|
133
218
|
* Root and server export shape for query helpers.
|
|
134
219
|
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```ts
|
|
222
|
+
* export const GetUser = Query(Schema.Struct({ id: Schema.String }), ({ id }) =>
|
|
223
|
+
* Effect.succeed({ id })
|
|
224
|
+
* );
|
|
225
|
+
* ```
|
|
226
|
+
*
|
|
135
227
|
* @since 2.0.0
|
|
136
228
|
*/
|
|
137
229
|
export interface QueryFactory {
|
|
@@ -145,6 +237,13 @@ export interface QueryFactory {
|
|
|
145
237
|
/**
|
|
146
238
|
* Root and server export shape for batched query helpers.
|
|
147
239
|
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```ts
|
|
242
|
+
* export const HasUser = Query.batch(Schema.String, (ids) =>
|
|
243
|
+
* Effect.succeed((id) => ids.includes(id))
|
|
244
|
+
* );
|
|
245
|
+
* ```
|
|
246
|
+
*
|
|
148
247
|
* @since 2.0.0
|
|
149
248
|
*/
|
|
150
249
|
export interface QueryBatchFactory {
|
|
@@ -155,6 +254,11 @@ export interface QueryBatchFactory {
|
|
|
155
254
|
/**
|
|
156
255
|
* Root and server export shape for live query helpers.
|
|
157
256
|
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```ts
|
|
259
|
+
* export const Clock = Query.live(() => Stream.repeatValue(new Date()));
|
|
260
|
+
* ```
|
|
261
|
+
*
|
|
158
262
|
* @since 2.0.0
|
|
159
263
|
*/
|
|
160
264
|
export interface QueryLiveFactory {
|
|
@@ -166,6 +270,14 @@ export interface QueryLiveFactory {
|
|
|
166
270
|
/**
|
|
167
271
|
* Root and server export shape for command helpers.
|
|
168
272
|
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```ts
|
|
275
|
+
* export const SaveUser = Command(
|
|
276
|
+
* Schema.Struct({ id: Schema.String }),
|
|
277
|
+
* ({ id }) => Effect.succeed({ id, saved: true }),
|
|
278
|
+
* );
|
|
279
|
+
* ```
|
|
280
|
+
*
|
|
169
281
|
* @since 2.0.0
|
|
170
282
|
*/
|
|
171
283
|
export interface CommandFactory {
|
|
@@ -177,6 +289,14 @@ export interface CommandFactory {
|
|
|
177
289
|
/**
|
|
178
290
|
* Root and server export shape for form helpers.
|
|
179
291
|
*
|
|
292
|
+
* @example
|
|
293
|
+
* ```ts
|
|
294
|
+
* export const SignIn = Form(
|
|
295
|
+
* Schema.Struct({ email: Schema.String }),
|
|
296
|
+
* ({ data }) => Effect.succeed({ ok: data.email.length > 0 }),
|
|
297
|
+
* );
|
|
298
|
+
* ```
|
|
299
|
+
*
|
|
180
300
|
* @since 2.0.0
|
|
181
301
|
*/
|
|
182
302
|
export interface FormFactory {
|
|
@@ -188,6 +308,11 @@ export interface FormFactory {
|
|
|
188
308
|
/**
|
|
189
309
|
* Root and server export shape for prerender helpers.
|
|
190
310
|
*
|
|
311
|
+
* @example
|
|
312
|
+
* ```ts
|
|
313
|
+
* export const GetBuildInfo = Prerender(() => Effect.succeed("ready"));
|
|
314
|
+
* ```
|
|
315
|
+
*
|
|
191
316
|
* @since 2.0.0
|
|
192
317
|
*/
|
|
193
318
|
export interface PrerenderFactory {
|
|
@@ -254,9 +379,7 @@ export type EffectRemoteQuery<A, E = never> = Effect.Effect<A, RemoteFailure<E>,
|
|
|
254
379
|
*
|
|
255
380
|
* @since 2.0.0
|
|
256
381
|
*/
|
|
257
|
-
export type EffectRemoteQueryFunction<Input, A, E = never> = [Input] extends [
|
|
258
|
-
void
|
|
259
|
-
] ? () => EffectRemoteQuery<A, E> : undefined extends Input ? (input?: Input) => EffectRemoteQuery<A, E> : (input: Input) => EffectRemoteQuery<A, E>;
|
|
382
|
+
export type EffectRemoteQueryFunction<Input, A, E = never> = [Input] extends [void] ? () => EffectRemoteQuery<A, E> : undefined extends Input ? (input?: Input) => EffectRemoteQuery<A, E> : (input: Input) => EffectRemoteQuery<A, E>;
|
|
260
383
|
/**
|
|
261
384
|
* Live query resource with SvelteKit live stream state and reconnect controls
|
|
262
385
|
* preserved.
|
|
@@ -305,9 +428,7 @@ export type EffectRemoteLiveQuery<A, E = never> = Effect.Effect<EffectRemoteLive
|
|
|
305
428
|
*
|
|
306
429
|
* @since 2.2.0
|
|
307
430
|
*/
|
|
308
|
-
export type EffectRemoteLiveQueryFunction<Input, A, E = never> = [Input] extends [
|
|
309
|
-
void
|
|
310
|
-
] ? () => EffectRemoteLiveQuery<A, E> : undefined extends Input ? (input?: Input) => EffectRemoteLiveQuery<A, E> : (input: Input) => EffectRemoteLiveQuery<A, E>;
|
|
431
|
+
export type EffectRemoteLiveQueryFunction<Input, A, E = never> = [Input] extends [void] ? () => EffectRemoteLiveQuery<A, E> : undefined extends Input ? (input?: Input) => EffectRemoteLiveQuery<A, E> : (input: Input) => EffectRemoteLiveQuery<A, E>;
|
|
311
432
|
/**
|
|
312
433
|
* Effect-returning command type with SvelteKit's pending counter preserved.
|
|
313
434
|
*
|
package/.dist/server.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { C as UncheckedLiveQueryHandlerMissingError, S as UncheckedFormHandlerMissingError, T as UncheckedQueryHandlerMissingError, c as InvalidLiveQueryReturnError, i as BatchQueryHandlerMissingError, w as UncheckedPrerenderHandlerMissingError, x as UncheckedCommandHandlerMissingError } from "./chunks/errors-
|
|
1
|
+
import { C as UncheckedLiveQueryHandlerMissingError, S as UncheckedFormHandlerMissingError, T as UncheckedQueryHandlerMissingError, c as InvalidLiveQueryReturnError, i as BatchQueryHandlerMissingError, w as UncheckedPrerenderHandlerMissingError, x as UncheckedCommandHandlerMissingError } from "./chunks/errors-Dcf0MVbq.js";
|
|
2
2
|
import { create_form_error } from "./remote/shared.js";
|
|
3
|
-
import { t as copy_property_descriptors } from "./chunks/descriptors-
|
|
3
|
+
import { t as copy_property_descriptors } from "./chunks/descriptors-cOe9uRJz.js";
|
|
4
4
|
import { normalize_remote_helper_error, run_remote_effect } from "./remote/server.js";
|
|
5
|
-
import { i as get_server_runtime_or_throw, n as ServerRuntime, t as RequestEvent } from "./chunks/runtime-
|
|
5
|
+
import { i as get_server_runtime_or_throw, n as ServerRuntime, t as RequestEvent } from "./chunks/runtime-ekkMQ-wL.js";
|
|
6
6
|
import { Effect, Schema, Stream } from "effect";
|
|
7
7
|
import { error, invalid, redirect } from "@sveltejs/kit";
|
|
8
8
|
import { command, form, getRequestEvent, prerender, query } from "$app/server";
|
|
@@ -77,7 +77,7 @@ function is_generator_result(value) {
|
|
|
77
77
|
* @param value - Effect or generator return value.
|
|
78
78
|
* @returns Normalized Effect.
|
|
79
79
|
*/
|
|
80
|
-
function
|
|
80
|
+
function ToEffect(value) {
|
|
81
81
|
if (is_generator_result(value)) return Effect.gen(() => value);
|
|
82
82
|
return value;
|
|
83
83
|
}
|
|
@@ -105,13 +105,13 @@ function is_live_source(value) {
|
|
|
105
105
|
*/
|
|
106
106
|
function run_live_handler_source(value, event) {
|
|
107
107
|
const runtime = get_server_runtime_or_throw();
|
|
108
|
-
return run_remote_effect(Effect.provideService(
|
|
108
|
+
return run_remote_effect(Effect.provideService(ToLiveSourceEffect(value), RequestEvent, event), runtime, invalid, svelte_remote_error);
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function ToLiveSourceEffect(value) {
|
|
111
111
|
if (Stream.isStream(value)) return Stream.toAsyncIterableEffect(value);
|
|
112
112
|
if (is_native_live_source(value)) return Effect.succeed(value);
|
|
113
113
|
if (!Effect.isEffect(value)) return Effect.fail(new InvalidLiveQueryReturnError());
|
|
114
|
-
return Effect.flatMap(value,
|
|
114
|
+
return Effect.flatMap(value, ToLiveSourceEffect);
|
|
115
115
|
}
|
|
116
116
|
function is_native_live_source(value) {
|
|
117
117
|
return is_live_source(value) && !Stream.isStream(value);
|
|
@@ -126,7 +126,7 @@ function is_native_live_source(value) {
|
|
|
126
126
|
*/
|
|
127
127
|
function run_handler_effect(value, event) {
|
|
128
128
|
const runtime = get_server_runtime_or_throw();
|
|
129
|
-
return run_remote_effect(Effect.provideService(
|
|
129
|
+
return run_remote_effect(Effect.provideService(ToEffect(value), RequestEvent, event), runtime, invalid, svelte_remote_error);
|
|
130
130
|
}
|
|
131
131
|
const svelte_remote_error = (status, body) => {
|
|
132
132
|
error(status, body);
|
|
@@ -260,6 +260,8 @@ async function run_inside_remote_effect_handler(run) {
|
|
|
260
260
|
}
|
|
261
261
|
//#endregion
|
|
262
262
|
//#region src/server/factories.ts
|
|
263
|
+
const request_event_context_error_start = "Can only read the current request event inside functions invoked during `handle`";
|
|
264
|
+
const request_store_context_error = "Could not get the request store.";
|
|
263
265
|
function to_effect_query(native) {
|
|
264
266
|
const wrapped = ((input) => {
|
|
265
267
|
if (is_current_remote_request()) return native(input);
|
|
@@ -276,12 +278,25 @@ function to_effect_query(native) {
|
|
|
276
278
|
}
|
|
277
279
|
function is_current_remote_request() {
|
|
278
280
|
if (is_running_remote_effect_handler()) return false;
|
|
281
|
+
const detection = detect_current_remote_request();
|
|
282
|
+
if (detection._tag === "NoCurrentRemoteRequest") return false;
|
|
283
|
+
return detection.event.isRemoteRequest === true;
|
|
284
|
+
}
|
|
285
|
+
function detect_current_remote_request() {
|
|
279
286
|
try {
|
|
280
|
-
return
|
|
281
|
-
|
|
282
|
-
|
|
287
|
+
return {
|
|
288
|
+
_tag: "CurrentRemoteRequest",
|
|
289
|
+
event: getRequestEvent()
|
|
290
|
+
};
|
|
291
|
+
} catch (error) {
|
|
292
|
+
if (is_request_event_context_error(error)) return { _tag: "NoCurrentRemoteRequest" };
|
|
293
|
+
throw error;
|
|
283
294
|
}
|
|
284
295
|
}
|
|
296
|
+
function is_request_event_context_error(error) {
|
|
297
|
+
if (!(error instanceof Error)) return false;
|
|
298
|
+
return error.message.startsWith(request_event_context_error_start) || error.message === request_store_context_error;
|
|
299
|
+
}
|
|
285
300
|
function to_effect_live_query(native) {
|
|
286
301
|
const wrapped = ((input) => {
|
|
287
302
|
return Effect.try({
|
|
@@ -535,7 +550,7 @@ const redirect_status_codes = {
|
|
|
535
550
|
* @returns An Effect that never succeeds because SvelteKit takes over request
|
|
536
551
|
* control flow.
|
|
537
552
|
*/
|
|
538
|
-
const Error = ((status, body, properties) => {
|
|
553
|
+
const Error$1 = ((status, body, properties) => {
|
|
539
554
|
const resolved_status = resolve_error_status(status);
|
|
540
555
|
const error$1 = error;
|
|
541
556
|
return Effect.sync(() => {
|
|
@@ -574,6 +589,6 @@ function resolve_redirect_status(status) {
|
|
|
574
589
|
return redirect_status_codes[status];
|
|
575
590
|
}
|
|
576
591
|
//#endregion
|
|
577
|
-
export { Command, Error, Form, Prerender, Query, Redirect, RequestEvent, ServerRuntime, get_server_runtime_or_throw };
|
|
592
|
+
export { Command, Error$1 as Error, Form, Prerender, Query, Redirect, RequestEvent, ServerRuntime, get_server_runtime_or_throw };
|
|
578
593
|
|
|
579
594
|
//# sourceMappingURL=server.js.map
|
package/.dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":["svelte_invalid","get_native_request_event","get_native_request_event","native_query","native_command","native_form","native_prerender","error","svelte_error","redirect","svelte_redirect"],"sources":["../../modules/svelte-effect-runtime/src/server/schema.ts","../../modules/svelte-effect-runtime/src/server/effects.ts","../../modules/svelte-effect-runtime/src/server/invalid.ts","../../modules/svelte-effect-runtime/src/server/wrappers.ts","../../modules/svelte-effect-runtime/src/server/factories.ts","../../modules/svelte-effect-runtime/src/server/control-flow.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport type { RemoteHandler, StandardSchema } from \"./types.ts\";\n\n/**\n * Checks whether a value is the string sentinel for unchecked remotes.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is `\"unchecked\"`.\n */\nexport function is_unchecked(value: unknown): value is \"unchecked\" {\n return value === \"unchecked\";\n}\n\n/**\n * Checks whether a value is a remote handler function.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is callable as a handler.\n */\nexport function is_handler(\n value: unknown,\n): value is RemoteHandler<unknown, unknown, unknown, unknown> {\n return typeof value === \"function\";\n}\n\n/**\n * Checks whether a value implements the Standard Schema contract.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is a Standard Schema.\n */\nexport function is_standard_schema(value: unknown): value is StandardSchema {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"~standard\" in value\n );\n}\n\n/**\n * Checks whether a value looks like an Effect Schema.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value should be converted to Standard Schema.\n */\nexport function is_effect_schema(\n value: unknown,\n): value is Schema.Schema<unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n \"ast\" in value &&\n \"make\" in value\n );\n}\n\n/**\n * Converts Effect Schema inputs to Standard Schema for SvelteKit.\n *\n * @since 2.0.0\n * @param value - Schema or handler input.\n * @returns Original value or Standard Schema view of an Effect Schema.\n */\nexport function normalize_validator(value: unknown): unknown {\n if (is_standard_schema(value) || !is_effect_schema(value)) {\n return value;\n }\n\n return Schema.toStandardSchemaV1(value as never);\n}\n","import { run_remote_effect } from \"$/remote/server.ts\";\nimport { InvalidLiveQueryReturnError } from \"$/errors.ts\";\nimport {\n error as svelte_error,\n invalid as svelte_invalid,\n} from \"@sveltejs/kit\";\nimport { Effect, Stream } from \"effect\";\n\nimport { get_server_runtime_or_throw, RequestEvent } from \"./runtime.ts\";\nimport type { RequestEvent as RequestEventShape } from \"./runtime.ts\";\nimport type { EffectLike, EffectRemoteLiveSource } from \"./types.ts\";\n\ntype ResolvedLiveSource<A> =\n | AsyncIterable<A>\n | AsyncIterator<A>\n | Iterable<A>\n | Iterator<A>;\n\ntype LiveHandlerResult<A> =\n | EffectLike<EffectRemoteLiveSource<A>, unknown, unknown>\n | EffectRemoteLiveSource<A>;\n\n/**\n * Checks whether a value is an Effect generator return object.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value should be wrapped with `Effect.gen`.\n */\nexport function is_generator_result<A>(\n value: unknown,\n): value is Effect.gen.Return<A, unknown, unknown> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n typeof (value as { next?: unknown }).next === \"function\"\n );\n}\n\n/**\n * Normalizes an Effect-like handler return value into an Effect.\n *\n * @since 2.0.0\n * @param value - Effect or generator return value.\n * @returns Normalized Effect.\n */\nexport function to_effect<A, E, R>(\n value: EffectLike<A, E, R>,\n): Effect.Effect<A, E, R> {\n if (is_generator_result<A>(value)) {\n return Effect.gen(() => value) as Effect.Effect<A, E, R>;\n }\n\n return value;\n}\n\n/**\n * Checks whether a value is a live query source SvelteKit can consume.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is an Effect Stream or native iterable source.\n */\nexport function is_live_source<A>(\n value: unknown,\n): value is EffectRemoteLiveSource<A> {\n if (Stream.isStream(value)) {\n return true;\n }\n\n if (typeof value !== \"object\" || value === null) {\n return false;\n }\n\n const source = value as {\n readonly next?: unknown;\n readonly [Symbol.asyncIterator]?: unknown;\n readonly [Symbol.iterator]?: unknown;\n };\n\n return (\n typeof source.next === \"function\" ||\n typeof source[Symbol.asyncIterator] === \"function\" ||\n typeof source[Symbol.iterator] === \"function\"\n );\n}\n\n/**\n * Runs and normalizes a live query handler result with request services\n * available to Effect Streams.\n *\n * @since 2.0.0\n * @param value - Live query source or Effect that resolves to one.\n * @param event - SvelteKit request event for this remote call.\n * @returns Promise resolving with a source SvelteKit can stream.\n */\nexport function run_live_handler_source<A>(\n value: LiveHandlerResult<A>,\n event: RequestEventShape,\n): Promise<ResolvedLiveSource<A>> {\n const runtime = get_server_runtime_or_throw();\n const effect = Effect.provideService(\n to_live_source_effect(value),\n RequestEvent,\n event,\n ) as Effect.Effect<ResolvedLiveSource<A>, unknown, unknown>;\n\n return run_remote_effect(\n effect,\n runtime,\n svelte_invalid,\n svelte_remote_error,\n );\n}\n\nfunction to_live_source_effect<A>(\n value: LiveHandlerResult<A>,\n): Effect.Effect<ResolvedLiveSource<A>, unknown, unknown> {\n if (Stream.isStream(value)) {\n return Stream.toAsyncIterableEffect(\n value as Stream.Stream<A, unknown, unknown>,\n ) as Effect.Effect<ResolvedLiveSource<A>, unknown, unknown>;\n }\n\n if (is_native_live_source<A>(value)) {\n return Effect.succeed(value);\n }\n\n if (!Effect.isEffect(value)) {\n return Effect.fail(new InvalidLiveQueryReturnError());\n }\n\n return Effect.flatMap(\n value as Effect.Effect<EffectRemoteLiveSource<A>, unknown, unknown>,\n to_live_source_effect,\n );\n}\n\nfunction is_native_live_source<A>(\n value: unknown,\n): value is ResolvedLiveSource<A> {\n return is_live_source<A>(value) && !Stream.isStream(value);\n}\n\n/**\n * Runs a remote handler Effect with the current request event provided.\n *\n * @since 2.0.0\n * @param value - Handler return value.\n * @param event - SvelteKit request event for this remote call.\n * @returns Promise resolving with the handler output.\n */\nexport function run_handler_effect<A>(\n value: EffectLike<A, unknown, unknown>,\n event: RequestEventShape,\n): Promise<A> {\n const runtime = get_server_runtime_or_throw();\n const effect = Effect.provideService(\n to_effect(value),\n RequestEvent,\n event,\n ) as Effect.Effect<A, unknown, unknown>;\n\n return run_remote_effect(\n effect,\n runtime,\n svelte_invalid,\n svelte_remote_error,\n );\n}\n\nconst svelte_remote_error = (status: number, body: unknown): never => {\n svelte_error(status as never, body as never);\n};\n","import { create_form_error } from \"$/remote/shared.ts\";\nimport { Effect } from \"effect\";\nimport type { FormIssue } from \"$/remote/shared.ts\";\n\nimport type { FormInvalid } from \"./types.ts\";\n\n/**\n * Creates a path-aware proxy for remote form validation failures.\n *\n * @since 2.0.0\n * @param path - Current nested form path.\n * @returns Callable invalid proxy for this path.\n */\nexport function make_invalid_proxy<Input = unknown>(\n path: readonly (string | number)[] = [],\n): FormInvalid<Input> {\n const invalid_at_path = (message: string) =>\n Effect.fail(\n create_form_error([{ message, path: [...path] } satisfies FormIssue]),\n );\n\n return new Proxy(invalid_at_path, {\n get(_target, property) {\n if (typeof property === \"symbol\") {\n return undefined;\n }\n\n return make_invalid_proxy([...path, property]);\n },\n }) as FormInvalid<Input>;\n}\n","import { getRequestEvent as get_native_request_event } from \"$app/server\";\nimport { normalize_remote_helper_error } from \"$/remote/server.ts\";\n\nimport { run_handler_effect, run_live_handler_source } from \"./effects.ts\";\nimport { make_invalid_proxy } from \"./invalid.ts\";\nimport { is_handler } from \"./schema.ts\";\nimport type { RequestEvent } from \"./runtime.ts\";\nimport type {\n EffectLike,\n RemoteFormHandler,\n RemoteHandler,\n RemoteLiveHandler,\n} from \"./types.ts\";\n\nlet running_remote_effect_handlers = 0;\n\n/**\n * Reports whether SER is currently executing user remote handler code.\n *\n * @example\n * ```ts\n * if (is_running_remote_effect_handler()) {\n * return query();\n * }\n * ```\n *\n * @since 2.0.0\n * @returns Whether a remote handler wrapper is currently active.\n * @internal\n */\nexport function is_running_remote_effect_handler(): boolean {\n return running_remote_effect_handlers > 0;\n}\n\n/**\n * Builds the wrapper passed to native query, command, and prerender helpers.\n *\n * @since 2.0.0\n * @param handler - Effect handler or already-built Effect-like value.\n * @param helper_name - Remote helper name for error normalization.\n * @returns Native SvelteKit handler wrapper.\n */\nexport function make_remote_wrapper(\n handler: RemoteHandler<unknown, unknown, unknown, unknown> | EffectLike,\n helper_name: string,\n): (input: unknown) => Promise<unknown> {\n return async (input: unknown) => {\n let event: RequestEvent;\n\n try {\n event = get_native_request_event() as unknown as RequestEvent;\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, helper_name);\n }\n\n return await run_inside_remote_effect_handler(() => {\n try {\n const result = is_handler(handler) ? handler(input) : handler;\n\n return run_handler_effect(result, event);\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, helper_name);\n }\n });\n };\n}\n\n/**\n * Builds the wrapper passed to native live query helpers.\n *\n * @since 2.0.0\n * @param handler - Effect-aware live source handler.\n * @param helper_name - Remote helper name for error normalization.\n * @returns Native SvelteKit live query wrapper.\n */\nexport function make_remote_live_wrapper<Input, A>(\n handler: RemoteLiveHandler<Input, A, unknown, unknown>,\n helper_name: string,\n): (input: unknown) => Promise<unknown> {\n return async (input: unknown) => {\n let event: RequestEvent;\n\n try {\n event = get_native_request_event() as unknown as RequestEvent;\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, helper_name);\n }\n\n return await run_inside_remote_effect_handler(() => {\n try {\n const result = typeof handler === \"function\"\n ? handler(input as Input)\n : handler;\n\n return run_live_handler_source(result, event);\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, helper_name);\n }\n });\n };\n}\n\n/**\n * Builds the wrapper passed to native form helpers.\n *\n * @since 2.0.0\n * @param handler - Effect-aware form handler.\n * @param helper_name - Remote helper name for error normalization.\n * @returns Native SvelteKit form handler wrapper.\n */\nexport function make_remote_form_wrapper<Input, A>(\n handler: RemoteFormHandler<Input, A, unknown, unknown>,\n helper_name: string,\n): (data: unknown, issue: unknown) => Promise<unknown> {\n return async (data: unknown, issue: unknown) => {\n let event: RequestEvent;\n\n try {\n event = get_native_request_event() as unknown as RequestEvent;\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, helper_name);\n }\n\n return await run_inside_remote_effect_handler(() => {\n const invalid_proxy = make_invalid_proxy<Input>();\n\n try {\n const result = handler({\n data: data as Input,\n invalid: invalid_proxy,\n issue,\n });\n\n return run_handler_effect(result, event);\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, helper_name);\n }\n });\n };\n}\n\nasync function run_inside_remote_effect_handler<A>(\n run: () => Promise<A>,\n): Promise<A> {\n running_remote_effect_handlers += 1;\n\n try {\n return await run();\n } finally {\n running_remote_effect_handlers -= 1;\n }\n}\n","import {\n BatchQueryHandlerMissingError,\n UncheckedCommandHandlerMissingError,\n UncheckedFormHandlerMissingError,\n UncheckedLiveQueryHandlerMissingError,\n UncheckedPrerenderHandlerMissingError,\n UncheckedQueryHandlerMissingError,\n} from \"$/errors.ts\";\nimport { copy_property_descriptors } from \"$/internal/descriptors.ts\";\nimport { normalize_remote_helper_error } from \"$/remote/server.ts\";\nimport {\n command as native_command,\n form as native_form,\n getRequestEvent as get_native_request_event,\n prerender as native_prerender,\n query as native_query,\n} from \"$app/server\";\nimport type { RemoteFormInput } from \"@sveltejs/kit\";\nimport { Effect, type Schema } from \"effect\";\n\nimport { is_handler, is_unchecked, normalize_validator } from \"./schema.ts\";\nimport {\n is_running_remote_effect_handler,\n make_remote_form_wrapper,\n make_remote_live_wrapper,\n make_remote_wrapper,\n} from \"./wrappers.ts\";\nimport type {\n EffectLike,\n EffectRemoteBatchHandler,\n EffectRemoteCommand,\n EffectRemoteForm,\n EffectRemoteFunction,\n EffectRemoteLiveQuery,\n EffectRemoteLiveQueryFunction,\n EffectRemoteLiveQueryResource,\n EffectRemoteQuery,\n EffectRemoteQueryFunction,\n PrerenderOptions,\n QueryFactory,\n RemoteFormHandler,\n RemoteHandler,\n RemoteLiveHandler,\n SchemaEncodedInput,\n SchemaInput,\n StandardSchema,\n StandardSchemaInput,\n StandardSchemaOutput,\n} from \"./types.ts\";\n\ntype FormSchemaEncodedInput<S> = S extends Schema.Top\n ? FormRemoteInput<S[\"Encoded\"]>\n : never;\n\ntype FormRemoteInput<Input> = NormalizeFormEncoded<Input> extends\n RemoteFormInput ? NormalizeFormEncoded<Input>\n : never;\n\ntype FormStandardSchemaInput<S> = StandardSchemaInput<S> extends RemoteFormInput\n ? StandardSchemaInput<S>\n : RemoteFormInput;\n\ntype FormScalar = string | number | boolean | File;\n\ntype NormalizeFormEncoded<Value> = Value extends FormScalar ? Value\n : Value extends ReadonlyArray<infer Item> ? Array<NormalizeFormEncoded<Item>>\n : Value extends object ? NormalizeFormObject<Value>\n : Value;\n\ntype NormalizeFormObject<Value> = {\n readonly [Key in keyof Value]: Key extends OptionalFormKeys<Value>\n ? NormalizeFormEncoded<Exclude<Value[Key], undefined>>\n : NormalizeFormEncoded<Value[Key]>;\n};\n\ntype OptionalFormKeys<Value> = {\n [Key in keyof Value]-?: Record<PropertyKey, never> extends Pick<Value, Key>\n ? Key\n : never;\n}[keyof Value];\n\ntype NativeQueryLike<Input = unknown> = (input: Input) => unknown;\n\ntype EffectRemoteResource<Output, ErrorType = never> =\n | EffectRemoteLiveQueryResource<Output>\n | EffectRemoteQuery<Output, ErrorType>;\n\nfunction to_effect_query<Input, Output, ErrorType = never>(\n native: NativeQueryLike<Input>,\n): EffectRemoteQueryFunction<Input, Output, ErrorType> {\n const wrapped = ((input: Input) => {\n if (is_current_remote_request()) {\n return (native as (input: Input) => unknown)(input);\n }\n\n const resource = (native as (input: Input) => unknown)(input);\n const effect = Effect.tryPromise({\n try: () => Promise.resolve(resource),\n catch: (error: unknown) => error,\n }) as unknown as EffectRemoteQuery<Output, ErrorType>;\n\n attach_query_resource_methods(resource, effect);\n\n return effect;\n }) as unknown as EffectRemoteQueryFunction<Input, Output, ErrorType>;\n\n copy_property_descriptors(native, wrapped);\n\n return wrapped;\n}\n\nfunction is_current_remote_request(): boolean {\n if (is_running_remote_effect_handler()) {\n return false;\n }\n\n try {\n const event = get_native_request_event() as { isRemoteRequest?: boolean };\n\n return event.isRemoteRequest === true;\n } catch {\n return false;\n }\n}\n\nfunction to_effect_live_query<Input, Output, ErrorType = never>(\n native: NativeQueryLike<Input>,\n): EffectRemoteLiveQueryFunction<Input, Output, ErrorType> {\n const wrapped = ((input: Input) => {\n const effect = Effect.try({\n try: () => {\n const resource = (native as (input: Input) => unknown)(input);\n\n return make_live_resource<Output>(resource);\n },\n catch: (error: unknown) => error,\n }) as unknown as EffectRemoteLiveQuery<Output, ErrorType>;\n\n return effect;\n }) as unknown as EffectRemoteLiveQueryFunction<\n Input,\n Output,\n ErrorType\n >;\n\n copy_property_descriptors(native, wrapped);\n\n return wrapped;\n}\n\ntype NativeRemoteResource<Output> = {\n readonly current?: Output;\n readonly error?: unknown;\n readonly loading?: boolean;\n readonly ready?: boolean;\n};\n\ntype NativeQueryResource<Output> = NativeRemoteResource<Output> & {\n readonly refresh?: () => Promise<void>;\n readonly set?: (value: Output) => void;\n readonly withOverride?: (update: (current: Output) => Output) => unknown;\n};\n\ntype NativeLiveQueryResource<Output> =\n & NativeRemoteResource<Output>\n & Partial<AsyncIterable<Output>>\n & {\n readonly connected?: boolean;\n readonly done?: boolean;\n readonly reconnect?: () => Promise<void>;\n };\n\nfunction is_query_resource<Output>(\n resource: unknown,\n): resource is NativeQueryResource<Output> {\n const resource_type = typeof resource;\n\n return (\n (resource_type === \"object\" && resource !== null) ||\n resource_type === \"function\"\n );\n}\n\nfunction is_live_resource<Output>(\n resource: unknown,\n): resource is NativeLiveQueryResource<Output> {\n const resource_type = typeof resource;\n\n return (\n (resource_type === \"object\" && resource !== null) ||\n resource_type === \"function\"\n );\n}\n\nfunction attach_remote_resource_getters<Output, ErrorType = never>(\n resource: unknown,\n effect: EffectRemoteResource<Output, ErrorType>,\n): void {\n const methods = is_query_resource<Output>(resource) ? resource : undefined;\n const keys = [\"current\", \"error\", \"loading\", \"ready\"] as const;\n\n if (!methods) {\n return;\n }\n\n for (const key of keys) {\n if (!(key in methods)) {\n continue;\n }\n\n Object.defineProperty(effect, key, {\n configurable: true,\n get: () => methods[key],\n });\n }\n}\n\nfunction attach_query_resource_methods<Output, ErrorType = never>(\n resource: unknown,\n effect: EffectRemoteQuery<Output, ErrorType>,\n): void {\n const methods = is_query_resource<Output>(resource) ? resource : undefined;\n const refresh = methods?.refresh;\n const set = methods?.set;\n const with_override = methods?.withOverride;\n\n attach_remote_resource_getters(resource, effect);\n\n if (!methods) {\n return;\n }\n\n if (typeof refresh === \"function\") {\n Object.defineProperty(effect, \"refresh\", {\n configurable: true,\n value: () =>\n Effect.tryPromise({\n try: () => Promise.resolve(refresh.call(resource)),\n catch: (error: unknown) => error,\n }),\n });\n }\n\n if (typeof set === \"function\") {\n Object.defineProperty(effect, \"set\", {\n configurable: true,\n value: (value: Output) => set.call(resource, value),\n });\n }\n\n if (typeof with_override === \"function\") {\n Object.defineProperty(effect, \"withOverride\", {\n configurable: true,\n value: (update: (current: Output) => Output) =>\n with_override.call(resource, update),\n });\n }\n}\n\nfunction attach_live_resource_methods<Output>(\n resource: unknown,\n effect: EffectRemoteLiveQueryResource<Output>,\n): void {\n const methods = is_live_resource<Output>(resource) ? resource : undefined;\n const reconnect = methods?.reconnect;\n const async_iterator = methods?.[Symbol.asyncIterator];\n const keys = [\n \"connected\",\n \"current\",\n \"done\",\n \"error\",\n \"loading\",\n \"ready\",\n ] as const;\n\n if (!methods) {\n return;\n }\n\n for (const key of keys) {\n if (!(key in methods)) {\n continue;\n }\n\n Object.defineProperty(effect, key, {\n configurable: true,\n get: () => methods[key],\n });\n }\n\n if (typeof reconnect === \"function\") {\n Object.defineProperty(effect, \"reconnect\", {\n configurable: true,\n value: () =>\n Effect.tryPromise({\n try: () => Promise.resolve(reconnect.call(resource)),\n catch: (error: unknown) => error,\n }),\n });\n }\n\n if (typeof async_iterator === \"function\") {\n Object.defineProperty(effect, Symbol.asyncIterator, {\n configurable: true,\n value: () => async_iterator.call(resource),\n });\n }\n}\n\nfunction make_live_resource<Output>(\n resource: unknown,\n): EffectRemoteLiveQueryResource<Output> {\n const live_resource = {} as EffectRemoteLiveQueryResource<Output>;\n\n attach_live_resource_methods(resource, live_resource);\n\n return live_resource;\n}\n\n/**\n * Factory for a read-only remote query function.\n *\n * @example\n * ```ts\n * export const getUser = Query(Schema.Struct({ id: Schema.String }), (input) =>\n * Effect.succeed(input.id)\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit query function.\n */\nfunction QueryRoot<A, E = never, R = never>(\n validate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n): EffectRemoteQueryFunction<void, A, E>;\nfunction QueryRoot<Input, A, E = never, R = never>(\n validate_or_handler: \"unchecked\",\n maybe_handler: RemoteHandler<Input, A, E, R>,\n): EffectRemoteQueryFunction<Input, A, E>;\nfunction QueryRoot<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryRoot<S extends StandardSchema, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryRoot(\n validate_or_handler: unknown,\n maybe_handler?: unknown,\n): unknown {\n try {\n if (maybe_handler) {\n return to_effect_query(native_query(\n normalize_validator(validate_or_handler) as never,\n make_remote_wrapper(maybe_handler as RemoteHandler, \"Query\") as never,\n ) as ReturnType<typeof native_query>);\n }\n\n if (is_unchecked(validate_or_handler)) {\n throw new UncheckedQueryHandlerMissingError();\n }\n\n return to_effect_query(native_query(\n make_remote_wrapper(\n validate_or_handler as RemoteHandler,\n \"Query\",\n ) as never,\n ) as ReturnType<typeof native_query>);\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, \"Query\");\n }\n}\n\n/**\n * Factory for a batched read-only remote query function.\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema or `\"unchecked\"` sentinel.\n * @param maybe_handler - Handler receiving validated inputs as one batch.\n * @returns A SvelteKit batch query function.\n */\nfunction QueryBatch<Input, A, E = never, R = never>(\n validate_or_handler: \"unchecked\",\n maybe_handler: EffectRemoteBatchHandler<Input, A, E, R>,\n): EffectRemoteQueryFunction<Input, A, E>;\nfunction QueryBatch<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: EffectRemoteBatchHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryBatch<S extends StandardSchema, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: EffectRemoteBatchHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryBatch(\n validate_or_handler: unknown,\n maybe_handler?: unknown,\n): unknown {\n try {\n if (!maybe_handler) {\n throw new BatchQueryHandlerMissingError();\n }\n\n return to_effect_query(native_query.batch(\n normalize_validator(validate_or_handler) as never,\n make_remote_wrapper(\n maybe_handler as RemoteHandler,\n \"Query.batch\",\n ) as never,\n ) as NativeQueryLike);\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, \"Query.batch\");\n }\n}\n\n/**\n * Factory for a live remote query function.\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg live handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit live query function.\n */\nfunction QueryLive<A, E = never, R = never>(\n validate_or_handler: RemoteLiveHandler<void, A, E, R>,\n): EffectRemoteLiveQueryFunction<void, A, E>;\nfunction QueryLive<Input, A, E = never, R = never>(\n validate_or_handler: \"unchecked\",\n maybe_handler: RemoteLiveHandler<Input, A, E, R>,\n): EffectRemoteLiveQueryFunction<Input, A, E>;\nfunction QueryLive<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteLiveHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteLiveQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryLive<S extends StandardSchema, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteLiveHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteLiveQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryLive(\n validate_or_handler: unknown,\n maybe_handler?: unknown,\n): unknown {\n try {\n if (maybe_handler) {\n return to_effect_live_query(native_query.live(\n normalize_validator(validate_or_handler) as never,\n make_remote_live_wrapper(\n maybe_handler as RemoteLiveHandler,\n \"Query.live\",\n ) as never,\n ) as NativeQueryLike);\n }\n\n if (is_unchecked(validate_or_handler)) {\n throw new UncheckedLiveQueryHandlerMissingError();\n }\n\n return to_effect_live_query(native_query.live(\n make_remote_live_wrapper(\n validate_or_handler as RemoteLiveHandler,\n \"Query.live\",\n ) as never,\n ) as NativeQueryLike);\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, \"Query.live\");\n }\n}\n\n/**\n * Factory for read-only remote query functions.\n *\n * @example\n * ```ts\n * export const getUser = Query(Schema.Struct({ id: Schema.String }), (input) =>\n * Effect.succeed(input.id)\n * );\n *\n * export const getUserBatch = Query.batch(Schema.String, (ids) =>\n * Effect.succeed((id) => ids.includes(id))\n * );\n * ```\n *\n * @since 2.0.0\n */\nexport const Query: QueryFactory = Object.assign(QueryRoot, {\n batch: QueryBatch,\n live: QueryLive,\n});\n\n/**\n * Factory for a write-oriented remote command function.\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit command function.\n */\nexport function Command<A, E = never, R = never>(\n validate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n): EffectRemoteCommand<void, A, E>;\nexport function Command<Input, A, E = never, R = never>(\n validate_or_handler: \"unchecked\",\n maybe_handler: RemoteHandler<Input, A, E, R>,\n): EffectRemoteCommand<Input, A, E>;\nexport function Command<\n S extends Schema.Schema<unknown>,\n A,\n E = never,\n R = never,\n>(\n validate_or_handler: S,\n maybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteCommand<SchemaEncodedInput<S>, A, E>;\nexport function Command<S extends StandardSchema, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteCommand<StandardSchemaInput<S>, A, E>;\nexport function Command(\n validate_or_handler: unknown,\n maybe_handler?: unknown,\n): unknown {\n try {\n if (maybe_handler) {\n return native_command(\n normalize_validator(validate_or_handler) as never,\n make_remote_wrapper(maybe_handler as RemoteHandler, \"Command\") as never,\n );\n }\n\n if (is_unchecked(validate_or_handler)) {\n throw new UncheckedCommandHandlerMissingError();\n }\n\n return native_command(\n make_remote_wrapper(\n validate_or_handler as RemoteHandler,\n \"Command\",\n ) as never,\n ) as ReturnType<typeof native_command>;\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, \"Command\");\n }\n}\n\n/**\n * Factory for a remote form handler.\n *\n * @example\n * ```ts\n * export const SignIn = Form(signInSchema, ({ data, invalid }) =>\n * Effect.gen(function* () {\n * if (!data.email.includes(\"@\")) {\n * return yield* invalid.email(\"Use an email address.\");\n * }\n *\n * return { email: data.email };\n * })\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit form function.\n */\nexport function Form<A, E = never, R = never>(\n validate_or_handler: EffectLike<A, E, R> | RemoteFormHandler<void, A, E, R>,\n): EffectRemoteForm<void, A, E>;\nexport function Form<Input extends RemoteFormInput, A, E = never, R = never>(\n validate_or_handler: \"unchecked\",\n maybe_handler: RemoteFormHandler<Input, A, E, R>,\n): EffectRemoteForm<Input, A, E>;\nexport function Form<S extends Schema.Top, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteFormHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteForm<FormSchemaEncodedInput<S>, A, E>;\nexport function Form<S extends StandardSchema, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteFormHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteForm<FormStandardSchemaInput<S>, A, E>;\nexport function Form(\n validate_or_handler: unknown,\n maybe_handler?: unknown,\n): unknown {\n try {\n if (maybe_handler) {\n return native_form(\n normalize_validator(validate_or_handler) as never,\n make_remote_form_wrapper(\n maybe_handler as RemoteFormHandler,\n \"Form\",\n ) as never,\n );\n }\n\n if (is_unchecked(validate_or_handler)) {\n throw new UncheckedFormHandlerMissingError();\n }\n\n const inputless_handler: RemoteFormHandler<void, unknown> = (\n { data, invalid, issue },\n ) => {\n if (is_handler(validate_or_handler)) {\n return validate_or_handler({ data, invalid, issue });\n }\n\n return validate_or_handler as EffectLike;\n };\n\n return native_form(\n make_remote_form_wrapper(inputless_handler, \"Form\") as never,\n ) as unknown as ReturnType<typeof native_form>;\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, \"Form\");\n }\n}\n\n/**\n * Factory for a prerenderable remote function.\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\n * @param maybe_handler_or_options - Handler or prerender options.\n * @param maybe_options - Prerender options used with a validator.\n * @returns A SvelteKit prerender function.\n */\nexport function Prerender<A, E = never, R = never>(\n validate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n maybe_options?: PrerenderOptions,\n): EffectRemoteFunction<void, A, E>;\nexport function Prerender<Input, A, E = never, R = never>(\n validate_or_handler: \"unchecked\",\n maybe_handler: RemoteHandler<Input, A, E, R>,\n maybe_options?: PrerenderOptions,\n): EffectRemoteFunction<Input, A, E>;\nexport function Prerender<\n S extends Schema.Schema<unknown>,\n A,\n E = never,\n R = never,\n>(\n validate_or_handler: S,\n maybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n maybe_options?: PrerenderOptions,\n): EffectRemoteFunction<SchemaEncodedInput<S>, A, E>;\nexport function Prerender<S extends StandardSchema, A, E = never, R = never>(\n validate_or_handler: S,\n maybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n maybe_options?: PrerenderOptions,\n): EffectRemoteFunction<StandardSchemaInput<S>, A, E>;\nexport function Prerender(\n validate_or_handler: unknown,\n maybe_handler_or_options?: unknown,\n maybe_options?: PrerenderOptions,\n): unknown {\n try {\n if (is_handler(maybe_handler_or_options)) {\n return native_prerender(\n normalize_validator(validate_or_handler) as never,\n make_remote_wrapper(maybe_handler_or_options, \"Prerender\") as never,\n maybe_options as never,\n );\n }\n\n if (is_unchecked(validate_or_handler)) {\n throw new UncheckedPrerenderHandlerMissingError();\n }\n\n return native_prerender(\n make_remote_wrapper(\n validate_or_handler as RemoteHandler,\n \"Prerender\",\n ) as never,\n maybe_handler_or_options as never,\n ) as ReturnType<typeof native_prerender>;\n } catch (error: unknown) {\n throw normalize_remote_helper_error(error, \"Prerender\");\n }\n}\n","import {\n error as svelte_error,\n redirect as svelte_redirect,\n} from \"@sveltejs/kit\";\nimport { Effect } from \"effect\";\n\nconst error_status_codes = {\n ProxyAuthenticationRequired: 407,\n RequestHeaderFieldsTooLarge: 431,\n UnavailableForLegalReasons: 451,\n NetworkAuthenticationRequired: 511,\n HttpVersionNotSupported: 505,\n UnprocessableContent: 422,\n UnprocessableEntity: 422,\n InternalServerError: 500,\n FailedDependency: 424,\n PreconditionRequired: 428,\n ServiceUnavailable: 503,\n MisdirectedRequest: 421,\n InsufficientStorage: 507,\n VariantAlsoNegotiates: 506,\n PreconditionFailed: 412,\n MethodNotAllowed: 405,\n GatewayTimeout: 504,\n PaymentRequired: 402,\n UpgradeRequired: 426,\n TooManyRequests: 429,\n LengthRequired: 411,\n NotAcceptable: 406,\n RequestTimeout: 408,\n ContentTooLarge: 413,\n PayloadTooLarge: 413,\n UriTooLong: 414,\n UnsupportedMediaType: 415,\n RangeNotSatisfiable: 416,\n ExpectationFailed: 417,\n ImATeapot: 418,\n BadRequest: 400,\n Unauthorized: 401,\n Forbidden: 403,\n NotFound: 404,\n Conflict: 409,\n Gone: 410,\n Locked: 423,\n TooEarly: 425,\n NotImplemented: 501,\n BadGateway: 502,\n LoopDetected: 508,\n NotExtended: 510,\n} as const;\n\nconst redirect_status_codes = {\n MovedPermanently: 301,\n TemporaryRedirect: 307,\n PermanentRedirect: 308,\n MultipleChoices: 300,\n NotModified: 304,\n SwitchProxy: 306,\n SeeOther: 303,\n UseProxy: 305,\n Found: 302,\n} as const;\n\ntype AppErrorStatus = App.Error extends { readonly status?: infer Status }\n ? Status\n : number;\n\n/**\n * Compatibility shim while SER supports both SvelteKit 2 and 3. The wrappers\n * call the SvelteKit 3 control-flow shapes, while SvelteKit 2 ignores extra\n * runtime arguments. Drop these broad call signatures when Kit 2 support is\n * removed.\n */\ntype SvelteError = (\n status: number,\n body?: ErrorBody,\n properties?: ErrorProperties,\n) => never;\n\ntype SvelteRedirect = (\n status: number,\n location: string | URL,\n options?: RedirectOptions,\n) => never;\n\n/**\n * Named HTTP status accepted by the {@link Error} helper.\n *\n * @example\n * ```ts\n * const status: ErrorStatusName = \"NotFound\";\n * ```\n *\n * @since 2.3.0\n */\nexport type ErrorStatusName = keyof typeof error_status_codes;\n\n/**\n * Numeric or named HTTP status accepted by the {@link Error} helper.\n *\n * @example\n * ```ts\n * const status: ErrorStatus = \"InternalServerError\";\n * ```\n *\n * @since 2.3.0\n */\nexport type ErrorStatus = ErrorStatusName | number;\n\n/**\n * Error body accepted by the {@link Error} helper.\n *\n * @example\n * ```ts\n * const body: ErrorBody = { message: \"Post not found\" };\n * ```\n *\n * @since 3.4.3\n */\nexport type ErrorBody =\n | (Omit<App.Error, \"status\"> & { readonly status?: AppErrorStatus })\n | string\n | undefined;\n\n/**\n * Extra SvelteKit app error properties accepted by the {@link Error} helper\n * when using the SvelteKit 3 string-body overload.\n *\n * @example\n * ```ts\n * const properties: ErrorProperties = { code: \"POST_NOT_FOUND\" };\n * ```\n *\n * @since 3.4.3\n */\nexport type ErrorProperties = Omit<App.Error, \"status\" | \"message\">;\n\n/**\n * Named HTTP status accepted by the {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const status: RedirectStatusName = \"TemporaryRedirect\";\n * ```\n *\n * @since 2.3.0\n */\nexport type RedirectStatusName = keyof typeof redirect_status_codes;\n\n/**\n * Numeric or named HTTP status accepted by the {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const status: RedirectStatus = \"SeeOther\";\n * ```\n *\n * @since 2.3.0\n */\nexport type RedirectStatus = RedirectStatusName | number;\n\n/**\n * Options accepted by the {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const options: RedirectOptions = { external: true };\n * ```\n *\n * @since 3.4.3\n */\nexport type RedirectOptions = {\n readonly external?: boolean | string[];\n};\n\n/**\n * Callable shape for the exported {@link Error} helper.\n *\n * @example\n * ```ts\n * const fail_not_found: ErrorEffectFactory = Error;\n * ```\n *\n * @since 2.3.0\n */\nexport interface ErrorEffectFactory {\n /**\n * Creates an Effect that throws SvelteKit's HTTP error control-flow value.\n *\n * @example\n * ```ts\n * return yield* Error(\"NotFound\", \"Post not found\");\n * ```\n *\n * @since 2.3.0\n * @param status - Numeric HTTP status or PascalCase status name to pass to\n * SvelteKit's `error` helper.\n * @param body - Optional SvelteKit error body or message forwarded unchanged\n * to SvelteKit.\n * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\n (\n status: ErrorStatus,\n body?: ErrorBody,\n ): Effect.Effect<never, never, never>;\n\n /**\n * Creates an Effect that throws SvelteKit's HTTP error control-flow value\n * using the SvelteKit 3 string-body overload with extra properties.\n *\n * @example\n * ```ts\n * return yield* Error(\"NotFound\", \"Post not found\", {\n * code: \"POST_NOT_FOUND\",\n * });\n * ```\n *\n * @since 3.4.3\n * @param status - Numeric HTTP status or PascalCase status name to pass to\n * SvelteKit's `error` helper.\n * @param body - Error message forwarded to SvelteKit.\n * @param properties - Additional app error properties forwarded to\n * SvelteKit.\n * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\n (\n status: ErrorStatus,\n body: string,\n properties: ErrorProperties,\n ): Effect.Effect<never, never, never>;\n}\n\n/**\n * Callable shape for the exported {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const redirect_after_save: RedirectEffectFactory = Redirect;\n * ```\n *\n * @since 2.3.0\n */\nexport interface RedirectEffectFactory {\n /**\n * Creates an Effect that throws SvelteKit's redirect control-flow value.\n *\n * @example\n * ```ts\n * return yield* Redirect(\"SeeOther\", \"/posts\");\n * ```\n *\n * @since 2.3.0\n * @param status - Numeric redirect status or PascalCase status name to pass\n * to SvelteKit's `redirect` helper.\n * @param location - Target URL forwarded unchanged to SvelteKit.\n * @param options - Optional SvelteKit redirect options. In SvelteKit 3, pass\n * `{ external: true }` or an allowlist to redirect to external URLs.\n * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\n (\n status: RedirectStatus,\n location: string | URL,\n options?: RedirectOptions,\n ): Effect.Effect<never, never, never>;\n}\n\n/**\n * Creates an Effect that raises SvelteKit's HTTP error control flow.\n *\n * @example\n * ```ts\n * return yield* Error(\"NotFound\", \"Post not found\");\n * ```\n *\n * @since 2.3.0\n * @param status - Numeric HTTP status or PascalCase status name to pass to\n * SvelteKit's `error` helper.\n * @param body - Optional SvelteKit error body or message forwarded unchanged\n * to SvelteKit.\n * @param properties - Optional SvelteKit 3 app error properties forwarded when\n * using a string error message.\n * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\nexport const Error: ErrorEffectFactory = ((\n status: ErrorStatus,\n body?: ErrorBody,\n properties?: ErrorProperties,\n) => {\n const resolved_status = resolve_error_status(status);\n const error = svelte_error as SvelteError;\n\n return Effect.sync((): never => {\n if (properties === undefined) {\n return error(resolved_status, body);\n }\n\n return error(resolved_status, body, properties);\n });\n}) as ErrorEffectFactory;\n\n/**\n * Creates an Effect that raises SvelteKit's redirect control flow.\n *\n * @example\n * ```ts\n * return yield* Redirect(\"SeeOther\", \"/posts\");\n * ```\n *\n * @since 2.3.0\n * @param status - Numeric redirect status or PascalCase status name to pass to\n * SvelteKit's `redirect` helper.\n * @param location - Target URL forwarded unchanged to SvelteKit.\n * @param options - Optional SvelteKit redirect options. In SvelteKit 3, pass\n * `{ external: true }` or an allowlist to redirect to external URLs.\n * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\nexport const Redirect: RedirectEffectFactory = ((\n status: RedirectStatus,\n location: string | URL,\n options?: RedirectOptions,\n) => {\n const resolved_status = resolve_redirect_status(status);\n const redirect = svelte_redirect as SvelteRedirect;\n\n return Effect.sync((): never => redirect(resolved_status, location, options));\n}) as RedirectEffectFactory;\n\nfunction resolve_error_status(status: ErrorStatus): number {\n if (typeof status === \"number\") {\n return status;\n }\n\n return error_status_codes[status];\n}\n\nfunction resolve_redirect_status(status: RedirectStatus): number {\n if (typeof status === \"number\") {\n return status;\n }\n\n return redirect_status_codes[status];\n}\n"],"mappings":";;;;;;;;;;;;;;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CAEd,OAAO,OAAO,WAAkB;EAC9B,IAAI,eAAe,KAAA,GACjB,OAAOD,QAAM,iBAAiB,IAAI;EAGpC,OAAOA,QAAM,iBAAiB,MAAM,UAAU;CAChD,CAAC;AACH;;;;;;;;;;;;;;;;;;AAmBA,MAAa,aACX,QACA,UACA,YACG;CACH,MAAM,kBAAkB,wBAAwB,MAAM;CACtD,MAAME,aAAWC;CAEjB,OAAO,OAAO,WAAkBD,WAAS,iBAAiB,UAAU,OAAO,CAAC;AAC9E;AAEA,SAAS,qBAAqB,QAA6B;CACzD,IAAI,OAAO,WAAW,UACpB,OAAO;CAGT,OAAO,mBAAmB;AAC5B;AAEA,SAAS,wBAAwB,QAAgC;CAC/D,IAAI,OAAO,WAAW,UACpB,OAAO;CAGT,OAAO,sBAAsB;AAC/B"}
|
|
1
|
+
{"version":3,"file":"server.js","names":["svelte_invalid","get_native_request_event","get_native_request_event","native_query","native_command","native_form","native_prerender","Error","error","svelte_error","redirect","svelte_redirect"],"sources":["../../modules/svelte-effect-runtime/src/server/schema.ts","../../modules/svelte-effect-runtime/src/server/effects.ts","../../modules/svelte-effect-runtime/src/server/invalid.ts","../../modules/svelte-effect-runtime/src/server/wrappers.ts","../../modules/svelte-effect-runtime/src/server/factories.ts","../../modules/svelte-effect-runtime/src/server/control-flow.ts"],"sourcesContent":["import { Schema } from \"effect\";\n\nimport type { RemoteHandler, StandardSchema } from \"./types.ts\";\n\n/**\n * Checks whether a value is the string sentinel for unchecked remotes.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is `\"unchecked\"`.\n */\nexport function is_unchecked(value: unknown): value is \"unchecked\" {\n\treturn value === \"unchecked\";\n}\n\n/**\n * Checks whether a value is a remote handler function.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is callable as a handler.\n */\nexport function is_handler(\n\tvalue: unknown,\n): value is RemoteHandler<unknown, unknown, unknown, unknown> {\n\treturn typeof value === \"function\";\n}\n\n/**\n * Checks whether a value implements the Standard Schema contract.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is a Standard Schema.\n */\nexport function is_standard_schema(value: unknown): value is StandardSchema {\n\treturn typeof value === \"object\" && value !== null && \"~standard\" in value;\n}\n\n/**\n * Checks whether a value looks like an Effect Schema.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value should be converted to Standard Schema.\n */\nexport function is_effect_schema(value: unknown): value is Schema.Schema<unknown> {\n\treturn typeof value === \"object\" && value !== null && \"ast\" in value && \"make\" in value;\n}\n\n/**\n * Converts Effect Schema inputs to Standard Schema for SvelteKit.\n *\n * @since 2.0.0\n * @param value - Schema or handler input.\n * @returns Original value or Standard Schema view of an Effect Schema.\n */\nexport function normalize_validator(value: unknown): unknown {\n\tif (is_standard_schema(value) || !is_effect_schema(value)) {\n\t\treturn value;\n\t}\n\n\treturn Schema.toStandardSchemaV1(value as never);\n}\n","import { run_remote_effect } from \"$/remote/server.ts\";\nimport { InvalidLiveQueryReturnError } from \"$/errors.ts\";\nimport { error as svelte_error, invalid as svelte_invalid } from \"@sveltejs/kit\";\nimport { Effect, Stream } from \"effect\";\n\nimport { get_server_runtime_or_throw, RequestEvent } from \"./runtime.ts\";\nimport type { RequestEvent as RequestEventShape } from \"./runtime.ts\";\nimport type { EffectLike, EffectRemoteLiveSource } from \"./types.ts\";\n\ntype ResolvedLiveSource<A> = AsyncIterable<A> | AsyncIterator<A> | Iterable<A> | Iterator<A>;\n\ntype LiveHandlerResult<A> =\n\t| EffectLike<EffectRemoteLiveSource<A>, unknown, unknown>\n\t| EffectRemoteLiveSource<A>;\n\n/**\n * Checks whether a value is an Effect generator return object.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value should be wrapped with `Effect.gen`.\n */\nexport function is_generator_result<A>(\n\tvalue: unknown,\n): value is Effect.gen.Return<A, unknown, unknown> {\n\treturn (\n\t\ttypeof value === \"object\" &&\n\t\tvalue !== null &&\n\t\ttypeof (value as { next?: unknown }).next === \"function\"\n\t);\n}\n\n/**\n * Normalizes an Effect-like handler return value into an Effect.\n *\n * @since 2.0.0\n * @param value - Effect or generator return value.\n * @returns Normalized Effect.\n */\nexport function ToEffect<A, E, R>(value: EffectLike<A, E, R>): Effect.Effect<A, E, R> {\n\tif (is_generator_result<A>(value)) {\n\t\treturn Effect.gen(() => value) as Effect.Effect<A, E, R>;\n\t}\n\n\treturn value;\n}\n\n/**\n * Compatibility alias for {@link ToEffect}.\n *\n * @example\n * ```ts\n * const program = to_effect(Effect.succeed(1));\n * ```\n *\n * @since 2.0.0\n * @param value - Effect or generator return value.\n * @returns Normalized Effect.\n * @internal\n */\nexport const to_effect = ToEffect;\n\n/**\n * Checks whether a value is a live query source SvelteKit can consume.\n *\n * @since 2.0.0\n * @param value - Value to inspect.\n * @returns Whether the value is an Effect Stream or native iterable source.\n */\nexport function is_live_source<A>(value: unknown): value is EffectRemoteLiveSource<A> {\n\tif (Stream.isStream(value)) {\n\t\treturn true;\n\t}\n\n\tif (typeof value !== \"object\" || value === null) {\n\t\treturn false;\n\t}\n\n\tconst source = value as {\n\t\treadonly next?: unknown;\n\t\treadonly [Symbol.asyncIterator]?: unknown;\n\t\treadonly [Symbol.iterator]?: unknown;\n\t};\n\n\treturn (\n\t\ttypeof source.next === \"function\" ||\n\t\ttypeof source[Symbol.asyncIterator] === \"function\" ||\n\t\ttypeof source[Symbol.iterator] === \"function\"\n\t);\n}\n\n/**\n * Runs and normalizes a live query handler result with request services\n * available to Effect Streams.\n *\n * @since 2.0.0\n * @param value - Live query source or Effect that resolves to one.\n * @param event - SvelteKit request event for this remote call.\n * @returns Promise resolving with a source SvelteKit can stream.\n */\nexport function run_live_handler_source<A>(\n\tvalue: LiveHandlerResult<A>,\n\tevent: RequestEventShape,\n): Promise<ResolvedLiveSource<A>> {\n\tconst runtime = get_server_runtime_or_throw();\n\tconst EffectWithRequestEvent = Effect.provideService(\n\t\tToLiveSourceEffect(value),\n\t\tRequestEvent,\n\t\tevent,\n\t) as Effect.Effect<ResolvedLiveSource<A>, unknown, unknown>;\n\n\treturn run_remote_effect(EffectWithRequestEvent, runtime, svelte_invalid, svelte_remote_error);\n}\n\nfunction ToLiveSourceEffect<A>(\n\tvalue: LiveHandlerResult<A>,\n): Effect.Effect<ResolvedLiveSource<A>, unknown, unknown> {\n\tif (Stream.isStream(value)) {\n\t\treturn Stream.toAsyncIterableEffect(\n\t\t\tvalue as Stream.Stream<A, unknown, unknown>,\n\t\t) as Effect.Effect<ResolvedLiveSource<A>, unknown, unknown>;\n\t}\n\n\tif (is_native_live_source<A>(value)) {\n\t\treturn Effect.succeed(value);\n\t}\n\n\tif (!Effect.isEffect(value)) {\n\t\treturn Effect.fail(new InvalidLiveQueryReturnError());\n\t}\n\n\treturn Effect.flatMap(\n\t\tvalue as Effect.Effect<EffectRemoteLiveSource<A>, unknown, unknown>,\n\t\tToLiveSourceEffect,\n\t);\n}\n\nfunction is_native_live_source<A>(value: unknown): value is ResolvedLiveSource<A> {\n\treturn is_live_source<A>(value) && !Stream.isStream(value);\n}\n\n/**\n * Runs a remote handler Effect with the current request event provided.\n *\n * @since 2.0.0\n * @param value - Handler return value.\n * @param event - SvelteKit request event for this remote call.\n * @returns Promise resolving with the handler output.\n */\nexport function run_handler_effect<A>(\n\tvalue: EffectLike<A, unknown, unknown>,\n\tevent: RequestEventShape,\n): Promise<A> {\n\tconst runtime = get_server_runtime_or_throw();\n\tconst EffectWithRequestEvent = Effect.provideService(\n\t\tToEffect(value),\n\t\tRequestEvent,\n\t\tevent,\n\t) as Effect.Effect<A, unknown, unknown>;\n\n\treturn run_remote_effect(EffectWithRequestEvent, runtime, svelte_invalid, svelte_remote_error);\n}\n\nconst svelte_remote_error = (status: number, body: unknown): never => {\n\tsvelte_error(status as never, body as never);\n};\n","import { create_form_error } from \"$/remote/shared.ts\";\nimport { Effect } from \"effect\";\nimport type { FormIssue } from \"$/remote/shared.ts\";\n\nimport type { FormInvalid } from \"./types.ts\";\n\n/**\n * Creates a path-aware proxy for remote form validation failures.\n *\n * @since 2.0.0\n * @param path - Current nested form path.\n * @returns Callable invalid proxy for this path.\n */\nexport function make_invalid_proxy<Input = unknown>(\n\tpath: readonly (string | number)[] = [],\n): FormInvalid<Input> {\n\tconst invalid_at_path = (message: string) =>\n\t\tEffect.fail(create_form_error([{ message, path: [...path] } satisfies FormIssue]));\n\n\treturn new Proxy(invalid_at_path, {\n\t\tget(_target, property) {\n\t\t\tif (typeof property === \"symbol\") {\n\t\t\t\treturn undefined;\n\t\t\t}\n\n\t\t\treturn make_invalid_proxy([...path, property]);\n\t\t},\n\t}) as FormInvalid<Input>;\n}\n","import { getRequestEvent as get_native_request_event } from \"$app/server\";\nimport { normalize_remote_helper_error } from \"$/remote/server.ts\";\n\nimport { run_handler_effect, run_live_handler_source } from \"./effects.ts\";\nimport { make_invalid_proxy } from \"./invalid.ts\";\nimport { is_handler } from \"./schema.ts\";\nimport type { RequestEvent } from \"./runtime.ts\";\nimport type { EffectLike, RemoteFormHandler, RemoteHandler, RemoteLiveHandler } from \"./types.ts\";\n\nlet running_remote_effect_handlers = 0;\n\n/**\n * Reports whether SER is currently executing user remote handler code.\n *\n * @example\n * ```ts\n * if (is_running_remote_effect_handler()) {\n * return query();\n * }\n * ```\n *\n * @since 2.0.0\n * @returns Whether a remote handler wrapper is currently active.\n * @internal\n */\nexport function is_running_remote_effect_handler(): boolean {\n\treturn running_remote_effect_handlers > 0;\n}\n\n/**\n * Builds the wrapper passed to native query, command, and prerender helpers.\n *\n * @since 2.0.0\n * @param handler - Effect handler or already-built Effect-like value.\n * @param helper_name - Remote helper name for error normalization.\n * @returns Native SvelteKit handler wrapper.\n */\nexport function make_remote_wrapper(\n\thandler: RemoteHandler<unknown, unknown, unknown, unknown> | EffectLike,\n\thelper_name: string,\n): (input: unknown) => Promise<unknown> {\n\treturn async (input: unknown) => {\n\t\tlet event: RequestEvent;\n\n\t\ttry {\n\t\t\tevent = get_native_request_event() as unknown as RequestEvent;\n\t\t} catch (error: unknown) {\n\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t}\n\n\t\treturn await run_inside_remote_effect_handler(() => {\n\t\t\ttry {\n\t\t\t\tconst result = is_handler(handler) ? handler(input) : handler;\n\n\t\t\t\treturn run_handler_effect(result, event);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Builds the wrapper passed to native live query helpers.\n *\n * @since 2.0.0\n * @param handler - Effect-aware live source handler.\n * @param helper_name - Remote helper name for error normalization.\n * @returns Native SvelteKit live query wrapper.\n */\nexport function make_remote_live_wrapper<Input, A>(\n\thandler: RemoteLiveHandler<Input, A, unknown, unknown>,\n\thelper_name: string,\n): (input: unknown) => Promise<unknown> {\n\treturn async (input: unknown) => {\n\t\tlet event: RequestEvent;\n\n\t\ttry {\n\t\t\tevent = get_native_request_event() as unknown as RequestEvent;\n\t\t} catch (error: unknown) {\n\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t}\n\n\t\treturn await run_inside_remote_effect_handler(() => {\n\t\t\ttry {\n\t\t\t\tconst result = typeof handler === \"function\" ? handler(input as Input) : handler;\n\n\t\t\t\treturn run_live_handler_source(result, event);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t\t}\n\t\t});\n\t};\n}\n\n/**\n * Builds the wrapper passed to native form helpers.\n *\n * @since 2.0.0\n * @param handler - Effect-aware form handler.\n * @param helper_name - Remote helper name for error normalization.\n * @returns Native SvelteKit form handler wrapper.\n */\nexport function make_remote_form_wrapper<Input, A>(\n\thandler: RemoteFormHandler<Input, A, unknown, unknown>,\n\thelper_name: string,\n): (data: unknown, issue: unknown) => Promise<unknown> {\n\treturn async (data: unknown, issue: unknown) => {\n\t\tlet event: RequestEvent;\n\n\t\ttry {\n\t\t\tevent = get_native_request_event() as unknown as RequestEvent;\n\t\t} catch (error: unknown) {\n\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t}\n\n\t\treturn await run_inside_remote_effect_handler(() => {\n\t\t\tconst invalid_proxy = make_invalid_proxy<Input>();\n\n\t\t\ttry {\n\t\t\t\tconst result = handler({\n\t\t\t\t\tdata: data as Input,\n\t\t\t\t\tinvalid: invalid_proxy,\n\t\t\t\t\tissue,\n\t\t\t\t});\n\n\t\t\t\treturn run_handler_effect(result, event);\n\t\t\t} catch (error: unknown) {\n\t\t\t\tthrow normalize_remote_helper_error(error, helper_name);\n\t\t\t}\n\t\t});\n\t};\n}\n\nasync function run_inside_remote_effect_handler<A>(run: () => Promise<A>): Promise<A> {\n\trunning_remote_effect_handlers += 1;\n\n\ttry {\n\t\treturn await run();\n\t} finally {\n\t\trunning_remote_effect_handlers -= 1;\n\t}\n}\n","import {\n\tBatchQueryHandlerMissingError,\n\tUncheckedCommandHandlerMissingError,\n\tUncheckedFormHandlerMissingError,\n\tUncheckedLiveQueryHandlerMissingError,\n\tUncheckedPrerenderHandlerMissingError,\n\tUncheckedQueryHandlerMissingError,\n} from \"$/errors.ts\";\nimport { copy_property_descriptors } from \"$/internal/descriptors.ts\";\nimport { normalize_remote_helper_error } from \"$/remote/server.ts\";\nimport {\n\tcommand as native_command,\n\tform as native_form,\n\tgetRequestEvent as get_native_request_event,\n\tprerender as native_prerender,\n\tquery as native_query,\n} from \"$app/server\";\nimport type { RemoteFormInput } from \"@sveltejs/kit\";\nimport { Effect, type Schema } from \"effect\";\n\nimport { is_handler, is_unchecked, normalize_validator } from \"./schema.ts\";\nimport {\n\tis_running_remote_effect_handler,\n\tmake_remote_form_wrapper,\n\tmake_remote_live_wrapper,\n\tmake_remote_wrapper,\n} from \"./wrappers.ts\";\nimport type {\n\tEffectLike,\n\tEffectRemoteBatchHandler,\n\tEffectRemoteCommand,\n\tEffectRemoteForm,\n\tEffectRemoteFunction,\n\tEffectRemoteLiveQuery,\n\tEffectRemoteLiveQueryFunction,\n\tEffectRemoteLiveQueryResource,\n\tEffectRemoteQuery,\n\tEffectRemoteQueryFunction,\n\tPrerenderOptions,\n\tQueryFactory,\n\tRemoteFormHandler,\n\tRemoteHandler,\n\tRemoteLiveHandler,\n\tSchemaEncodedInput,\n\tSchemaInput,\n\tStandardSchema,\n\tStandardSchemaInput,\n\tStandardSchemaOutput,\n} from \"./types.ts\";\n\ntype FormSchemaEncodedInput<S> = S extends Schema.Top ? FormRemoteInput<S[\"Encoded\"]> : never;\n\ntype FormRemoteInput<Input> =\n\tNormalizeFormEncoded<Input> extends RemoteFormInput ? NormalizeFormEncoded<Input> : never;\n\ntype FormStandardSchemaInput<S> =\n\tStandardSchemaInput<S> extends RemoteFormInput ? StandardSchemaInput<S> : RemoteFormInput;\n\ntype FormScalar = string | number | boolean | File;\n\ntype NormalizeFormEncoded<Value> = Value extends FormScalar\n\t? Value\n\t: Value extends ReadonlyArray<infer Item>\n\t\t? Array<NormalizeFormEncoded<Item>>\n\t\t: Value extends object\n\t\t\t? NormalizeFormObject<Value>\n\t\t\t: Value;\n\ntype NormalizeFormObject<Value> = {\n\treadonly [Key in keyof Value]: Key extends OptionalFormKeys<Value>\n\t\t? NormalizeFormEncoded<Exclude<Value[Key], undefined>>\n\t\t: NormalizeFormEncoded<Value[Key]>;\n};\n\ntype OptionalFormKeys<Value> = {\n\t[Key in keyof Value]-?: Record<PropertyKey, never> extends Pick<Value, Key> ? Key : never;\n}[keyof Value];\n\ntype NativeQueryLike<Input = unknown> = (input: Input) => unknown;\n\ntype EffectRemoteResource<Output, ErrorType = never> =\n\t| EffectRemoteLiveQueryResource<Output>\n\t| EffectRemoteQuery<Output, ErrorType>;\n\ntype CurrentRemoteRequestDetection =\n\t| {\n\t\t\treadonly _tag: \"CurrentRemoteRequest\";\n\t\t\treadonly event: {\n\t\t\t\treadonly isRemoteRequest?: boolean;\n\t\t\t};\n\t }\n\t| {\n\t\t\treadonly _tag: \"NoCurrentRemoteRequest\";\n\t };\n\nconst request_event_context_error_start =\n\t\"Can only read the current request event inside functions invoked during `handle`\";\n\nconst request_store_context_error = \"Could not get the request store.\";\n\nfunction to_effect_query<Input, Output, ErrorType = never>(\n\tnative: NativeQueryLike<Input>,\n): EffectRemoteQueryFunction<Input, Output, ErrorType> {\n\tconst wrapped = ((input: Input) => {\n\t\tif (is_current_remote_request()) {\n\t\t\treturn (native as (input: Input) => unknown)(input);\n\t\t}\n\n\t\tconst resource = (native as (input: Input) => unknown)(input);\n\t\tconst effect = Effect.tryPromise({\n\t\t\ttry: () => Promise.resolve(resource),\n\t\t\tcatch: (error: unknown) => error,\n\t\t}) as unknown as EffectRemoteQuery<Output, ErrorType>;\n\n\t\tattach_query_resource_methods(resource, effect);\n\n\t\treturn effect;\n\t}) as unknown as EffectRemoteQueryFunction<Input, Output, ErrorType>;\n\n\tcopy_property_descriptors(native, wrapped);\n\n\treturn wrapped;\n}\n\nfunction is_current_remote_request(): boolean {\n\tif (is_running_remote_effect_handler()) {\n\t\treturn false;\n\t}\n\n\tconst detection = detect_current_remote_request();\n\n\tif (detection._tag === \"NoCurrentRemoteRequest\") {\n\t\treturn false;\n\t}\n\n\treturn detection.event.isRemoteRequest === true;\n}\n\nfunction detect_current_remote_request(): CurrentRemoteRequestDetection {\n\ttry {\n\t\tconst event = get_native_request_event() as { isRemoteRequest?: boolean };\n\n\t\treturn {\n\t\t\t_tag: \"CurrentRemoteRequest\",\n\t\t\tevent,\n\t\t};\n\t} catch (error: unknown) {\n\t\tif (is_request_event_context_error(error)) {\n\t\t\treturn { _tag: \"NoCurrentRemoteRequest\" };\n\t\t}\n\n\t\tthrow error;\n\t}\n}\n\nfunction is_request_event_context_error(error: unknown): error is Error {\n\tif (!(error instanceof Error)) {\n\t\treturn false;\n\t}\n\n\treturn (\n\t\terror.message.startsWith(request_event_context_error_start) ||\n\t\terror.message === request_store_context_error\n\t);\n}\n\nfunction to_effect_live_query<Input, Output, ErrorType = never>(\n\tnative: NativeQueryLike<Input>,\n): EffectRemoteLiveQueryFunction<Input, Output, ErrorType> {\n\tconst wrapped = ((input: Input) => {\n\t\tconst effect = Effect.try({\n\t\t\ttry: () => {\n\t\t\t\tconst resource = (native as (input: Input) => unknown)(input);\n\n\t\t\t\treturn make_live_resource<Output>(resource);\n\t\t\t},\n\t\t\tcatch: (error: unknown) => error,\n\t\t}) as unknown as EffectRemoteLiveQuery<Output, ErrorType>;\n\n\t\treturn effect;\n\t}) as unknown as EffectRemoteLiveQueryFunction<Input, Output, ErrorType>;\n\n\tcopy_property_descriptors(native, wrapped);\n\n\treturn wrapped;\n}\n\ntype NativeRemoteResource<Output> = {\n\treadonly current?: Output;\n\treadonly error?: unknown;\n\treadonly loading?: boolean;\n\treadonly ready?: boolean;\n};\n\ntype NativeQueryResource<Output> = NativeRemoteResource<Output> & {\n\treadonly refresh?: () => Promise<void>;\n\treadonly set?: (value: Output) => void;\n\treadonly withOverride?: (update: (current: Output) => Output) => unknown;\n};\n\ntype NativeLiveQueryResource<Output> = NativeRemoteResource<Output> &\n\tPartial<AsyncIterable<Output>> & {\n\t\treadonly connected?: boolean;\n\t\treadonly done?: boolean;\n\t\treadonly reconnect?: () => Promise<void>;\n\t};\n\nfunction is_query_resource<Output>(resource: unknown): resource is NativeQueryResource<Output> {\n\tconst resource_type = typeof resource;\n\n\treturn (resource_type === \"object\" && resource !== null) || resource_type === \"function\";\n}\n\nfunction is_live_resource<Output>(resource: unknown): resource is NativeLiveQueryResource<Output> {\n\tconst resource_type = typeof resource;\n\n\treturn (resource_type === \"object\" && resource !== null) || resource_type === \"function\";\n}\n\nfunction attach_remote_resource_getters<Output, ErrorType = never>(\n\tresource: unknown,\n\teffect: EffectRemoteResource<Output, ErrorType>,\n): void {\n\tconst methods = is_query_resource<Output>(resource) ? resource : undefined;\n\tconst keys = [\"current\", \"error\", \"loading\", \"ready\"] as const;\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tfor (const key of keys) {\n\t\tif (!(key in methods)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tObject.defineProperty(effect, key, {\n\t\t\tconfigurable: true,\n\t\t\tget: () => methods[key],\n\t\t});\n\t}\n}\n\nfunction attach_query_resource_methods<Output, ErrorType = never>(\n\tresource: unknown,\n\teffect: EffectRemoteQuery<Output, ErrorType>,\n): void {\n\tconst methods = is_query_resource<Output>(resource) ? resource : undefined;\n\tconst refresh = methods?.refresh;\n\tconst set = methods?.set;\n\tconst with_override = methods?.withOverride;\n\n\tattach_remote_resource_getters(resource, effect);\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tif (typeof refresh === \"function\") {\n\t\tObject.defineProperty(effect, \"refresh\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () =>\n\t\t\t\tEffect.tryPromise({\n\t\t\t\t\ttry: () => Promise.resolve(refresh.call(resource)),\n\t\t\t\t\tcatch: (error: unknown) => error,\n\t\t\t\t}),\n\t\t});\n\t}\n\n\tif (typeof set === \"function\") {\n\t\tObject.defineProperty(effect, \"set\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: (value: Output) => set.call(resource, value),\n\t\t});\n\t}\n\n\tif (typeof with_override === \"function\") {\n\t\tObject.defineProperty(effect, \"withOverride\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: (update: (current: Output) => Output) => with_override.call(resource, update),\n\t\t});\n\t}\n}\n\nfunction attach_live_resource_methods<Output>(\n\tresource: unknown,\n\teffect: EffectRemoteLiveQueryResource<Output>,\n): void {\n\tconst methods = is_live_resource<Output>(resource) ? resource : undefined;\n\tconst reconnect = methods?.reconnect;\n\tconst async_iterator = methods?.[Symbol.asyncIterator];\n\tconst keys = [\"connected\", \"current\", \"done\", \"error\", \"loading\", \"ready\"] as const;\n\n\tif (!methods) {\n\t\treturn;\n\t}\n\n\tfor (const key of keys) {\n\t\tif (!(key in methods)) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tObject.defineProperty(effect, key, {\n\t\t\tconfigurable: true,\n\t\t\tget: () => methods[key],\n\t\t});\n\t}\n\n\tif (typeof reconnect === \"function\") {\n\t\tObject.defineProperty(effect, \"reconnect\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () =>\n\t\t\t\tEffect.tryPromise({\n\t\t\t\t\ttry: () => Promise.resolve(reconnect.call(resource)),\n\t\t\t\t\tcatch: (error: unknown) => error,\n\t\t\t\t}),\n\t\t});\n\t}\n\n\tif (typeof async_iterator === \"function\") {\n\t\tObject.defineProperty(effect, Symbol.asyncIterator, {\n\t\t\tconfigurable: true,\n\t\t\tvalue: () => async_iterator.call(resource),\n\t\t});\n\t}\n}\n\nfunction make_live_resource<Output>(resource: unknown): EffectRemoteLiveQueryResource<Output> {\n\tconst live_resource = {} as EffectRemoteLiveQueryResource<Output>;\n\n\tattach_live_resource_methods(resource, live_resource);\n\n\treturn live_resource;\n}\n\n/**\n * Factory for a read-only remote query function.\n *\n * @example\n * ```ts\n * export const getUser = Query(Schema.Struct({ id: Schema.String }), (input) =>\n * Effect.succeed(input.id)\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit query function.\n */\nfunction QueryRoot<A, E = never, R = never>(\n\tvalidate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n): EffectRemoteQueryFunction<void, A, E>;\nfunction QueryRoot<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteHandler<Input, A, E, R>,\n): EffectRemoteQueryFunction<Input, A, E>;\nfunction QueryRoot<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryRoot<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryRoot(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (maybe_handler) {\n\t\t\treturn to_effect_query(\n\t\t\t\tnative_query(\n\t\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\t\tmake_remote_wrapper(maybe_handler as RemoteHandler, \"Query\") as never,\n\t\t\t\t) as ReturnType<typeof native_query>,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedQueryHandlerMissingError();\n\t\t}\n\n\t\treturn to_effect_query(\n\t\t\tnative_query(\n\t\t\t\tmake_remote_wrapper(validate_or_handler as RemoteHandler, \"Query\") as never,\n\t\t\t) as ReturnType<typeof native_query>,\n\t\t);\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Query\");\n\t}\n}\n\n/**\n * Factory for a batched read-only remote query function.\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema or `\"unchecked\"` sentinel.\n * @param maybe_handler - Handler receiving validated inputs as one batch.\n * @returns A SvelteKit batch query function.\n */\nfunction QueryBatch<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: EffectRemoteBatchHandler<Input, A, E, R>,\n): EffectRemoteQueryFunction<Input, A, E>;\nfunction QueryBatch<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: EffectRemoteBatchHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryBatch<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: EffectRemoteBatchHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryBatch(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (!maybe_handler) {\n\t\t\tthrow new BatchQueryHandlerMissingError();\n\t\t}\n\n\t\treturn to_effect_query(\n\t\t\tnative_query.batch(\n\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\tmake_remote_wrapper(maybe_handler as RemoteHandler, \"Query.batch\") as never,\n\t\t\t) as NativeQueryLike,\n\t\t);\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Query.batch\");\n\t}\n}\n\n/**\n * Factory for a live remote query function.\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg live handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit live query function.\n */\nfunction QueryLive<A, E = never, R = never>(\n\tvalidate_or_handler: RemoteLiveHandler<void, A, E, R>,\n): EffectRemoteLiveQueryFunction<void, A, E>;\nfunction QueryLive<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteLiveHandler<Input, A, E, R>,\n): EffectRemoteLiveQueryFunction<Input, A, E>;\nfunction QueryLive<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteLiveHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteLiveQueryFunction<SchemaEncodedInput<S>, A, E>;\nfunction QueryLive<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteLiveHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteLiveQueryFunction<StandardSchemaInput<S>, A, E>;\nfunction QueryLive(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (maybe_handler) {\n\t\t\treturn to_effect_live_query(\n\t\t\t\tnative_query.live(\n\t\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\t\tmake_remote_live_wrapper(\n\t\t\t\t\t\tmaybe_handler as RemoteLiveHandler,\n\t\t\t\t\t\t\"Query.live\",\n\t\t\t\t\t) as never,\n\t\t\t\t) as NativeQueryLike,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedLiveQueryHandlerMissingError();\n\t\t}\n\n\t\treturn to_effect_live_query(\n\t\t\tnative_query.live(\n\t\t\t\tmake_remote_live_wrapper(\n\t\t\t\t\tvalidate_or_handler as RemoteLiveHandler,\n\t\t\t\t\t\"Query.live\",\n\t\t\t\t) as never,\n\t\t\t) as NativeQueryLike,\n\t\t);\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Query.live\");\n\t}\n}\n\n/**\n * Factory for read-only remote query functions.\n *\n * @example\n * ```ts\n * export const getUser = Query(Schema.Struct({ id: Schema.String }), (input) =>\n * Effect.succeed(input.id)\n * );\n *\n * export const getUserBatch = Query.batch(Schema.String, (ids) =>\n * Effect.succeed((id) => ids.includes(id))\n * );\n * ```\n *\n * @since 2.0.0\n */\nexport const Query: QueryFactory = Object.assign(QueryRoot, {\n\tbatch: QueryBatch,\n\tlive: QueryLive,\n});\n\n/**\n * Creates a write-oriented remote command from a no-argument Effect handler.\n *\n * @example\n * ```ts\n * export const RebuildCache = Command(() => Effect.succeed(\"done\"));\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - Effect value or no-argument handler to run on\n * the server when the command is invoked.\n * @returns A command function that yields an Effect when called.\n */\nexport function Command<A, E = never, R = never>(\n\tvalidate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n): EffectRemoteCommand<void, A, E>;\n\n/**\n * Creates a write-oriented remote command with unchecked input.\n *\n * @example\n * ```ts\n * export const SaveDraft = Command(\"unchecked\", (input: { id: string }) =>\n * Effect.succeed(input.id)\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - `\"unchecked\"` sentinel that skips runtime input\n * validation.\n * @param maybe_handler - Handler that receives the caller-provided input.\n * @returns A command function that yields an Effect when called with input.\n */\nexport function Command<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteHandler<Input, A, E, R>,\n): EffectRemoteCommand<Input, A, E>;\n\n/**\n * Creates a write-oriented remote command validated with an Effect Schema.\n *\n * @example\n * ```ts\n * export const SaveUser = Command(Schema.Struct({ id: Schema.String }), ({ id }) =>\n * Effect.succeed({ id, saved: true })\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - Effect Schema used to decode and validate\n * caller input before the handler runs.\n * @param maybe_handler - Handler that receives the decoded schema output.\n * @returns A command function whose caller input is the schema encoded type.\n */\nexport function Command<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteCommand<SchemaEncodedInput<S>, A, E>;\n\n/**\n * Creates a write-oriented remote command validated with a Standard Schema.\n *\n * @example\n * ```ts\n * export const Toggle = Command(standard_schema, (input) =>\n * Effect.succeed(input.enabled)\n * );\n * ```\n *\n * @since 3.0.0\n * @param validate_or_handler - Standard Schema used to validate caller input\n * before the handler runs.\n * @param maybe_handler - Handler that receives the decoded schema output.\n * @returns A command function whose caller input is the schema input type.\n */\nexport function Command<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteCommand<StandardSchemaInput<S>, A, E>;\nexport function Command(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (maybe_handler) {\n\t\t\treturn native_command(\n\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\tmake_remote_wrapper(maybe_handler as RemoteHandler, \"Command\") as never,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedCommandHandlerMissingError();\n\t\t}\n\n\t\treturn native_command(\n\t\t\tmake_remote_wrapper(validate_or_handler as RemoteHandler, \"Command\") as never,\n\t\t) as ReturnType<typeof native_command>;\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Command\");\n\t}\n}\n\n/**\n * Factory for a remote form handler.\n *\n * @example\n * ```ts\n * export const SignIn = Form(signInSchema, ({ data, invalid }) =>\n * Effect.gen(function* () {\n * if (!data.email.includes(\"@\")) {\n * return yield* invalid.email(\"Use an email address.\");\n * }\n *\n * return { email: data.email };\n * })\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - A schema, `\"unchecked\"`, or no-arg handler.\n * @param maybe_handler - Handler used when a validator is supplied.\n * @returns A SvelteKit form function.\n */\nexport function Form<A, E = never, R = never>(\n\tvalidate_or_handler: EffectLike<A, E, R> | RemoteFormHandler<void, A, E, R>,\n): EffectRemoteForm<void, A, E>;\nexport function Form<Input extends RemoteFormInput, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteFormHandler<Input, A, E, R>,\n): EffectRemoteForm<Input, A, E>;\nexport function Form<S extends Schema.Top, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteFormHandler<SchemaInput<S>, A, E, R>,\n): EffectRemoteForm<FormSchemaEncodedInput<S>, A, E>;\nexport function Form<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteFormHandler<StandardSchemaOutput<S>, A, E, R>,\n): EffectRemoteForm<FormStandardSchemaInput<S>, A, E>;\nexport function Form(validate_or_handler: unknown, maybe_handler?: unknown): unknown {\n\ttry {\n\t\tif (maybe_handler) {\n\t\t\treturn native_form(\n\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\tmake_remote_form_wrapper(maybe_handler as RemoteFormHandler, \"Form\") as never,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedFormHandlerMissingError();\n\t\t}\n\n\t\tconst inputless_handler: RemoteFormHandler<void, unknown> = ({ data, invalid, issue }) => {\n\t\t\tif (is_handler(validate_or_handler)) {\n\t\t\t\treturn validate_or_handler({ data, invalid, issue });\n\t\t\t}\n\n\t\t\treturn validate_or_handler as EffectLike;\n\t\t};\n\n\t\treturn native_form(\n\t\t\tmake_remote_form_wrapper(inputless_handler, \"Form\") as never,\n\t\t) as unknown as ReturnType<typeof native_form>;\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Form\");\n\t}\n}\n\n/**\n * Creates a prerenderable remote function from a no-argument Effect handler.\n *\n * @example\n * ```ts\n * export const GetBuildInfo = Prerender(() => Effect.succeed(\"ready\"));\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - Effect value or no-argument handler to run at\n * prerender time.\n * @param maybe_options - Optional prerender inputs and dynamic fallback\n * configuration.\n * @returns A prerender function that yields an Effect when called.\n */\nexport function Prerender<A, E = never, R = never>(\n\tvalidate_or_handler: EffectLike<A, E, R> | RemoteHandler<void, A, E, R>,\n\tmaybe_options?: PrerenderOptions,\n): EffectRemoteFunction<void, A, E>;\n\n/**\n * Creates a prerenderable remote function with unchecked input.\n *\n * @example\n * ```ts\n * export const GetPost = Prerender(\n * \"unchecked\",\n * (slug: string) => Effect.succeed({ slug }),\n * { inputs: () => [\"intro\"] },\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - `\"unchecked\"` sentinel that skips runtime input\n * validation.\n * @param maybe_handler - Handler that receives the caller-provided input.\n * @param maybe_options - Optional prerender inputs and dynamic fallback\n * configuration.\n * @returns A prerender function that yields an Effect when called with input.\n */\nexport function Prerender<Input, A, E = never, R = never>(\n\tvalidate_or_handler: \"unchecked\",\n\tmaybe_handler: RemoteHandler<Input, A, E, R>,\n\tmaybe_options?: PrerenderOptions,\n): EffectRemoteFunction<Input, A, E>;\n\n/**\n * Creates a prerenderable remote function validated with an Effect Schema.\n *\n * @example\n * ```ts\n * export const GetPost = Prerender(\n * Schema.String,\n * (slug) => Effect.succeed({ slug }),\n * { inputs: () => [\"intro\"] },\n * );\n * ```\n *\n * @since 2.0.0\n * @param validate_or_handler - Effect Schema used to decode and validate\n * caller input before the handler runs.\n * @param maybe_handler - Handler that receives the decoded schema output.\n * @param maybe_options - Optional prerender inputs and dynamic fallback\n * configuration.\n * @returns A prerender function whose caller input is the schema encoded type.\n */\nexport function Prerender<S extends Schema.Schema<unknown>, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<SchemaInput<S>, A, E, R>,\n\tmaybe_options?: PrerenderOptions,\n): EffectRemoteFunction<SchemaEncodedInput<S>, A, E>;\n\n/**\n * Creates a prerenderable remote function validated with a Standard Schema.\n *\n * @example\n * ```ts\n * export const GetPost = Prerender(\n * standard_schema,\n * (post) => Effect.succeed(post.slug),\n * { dynamic: true },\n * );\n * ```\n *\n * @since 3.0.0\n * @param validate_or_handler - Standard Schema used to validate caller input\n * before the handler runs.\n * @param maybe_handler - Handler that receives the decoded schema output.\n * @param maybe_options - Optional prerender inputs and dynamic fallback\n * configuration.\n * @returns A prerender function whose caller input is the schema input type.\n */\nexport function Prerender<S extends StandardSchema, A, E = never, R = never>(\n\tvalidate_or_handler: S,\n\tmaybe_handler: RemoteHandler<StandardSchemaOutput<S>, A, E, R>,\n\tmaybe_options?: PrerenderOptions,\n): EffectRemoteFunction<StandardSchemaInput<S>, A, E>;\nexport function Prerender(\n\tvalidate_or_handler: unknown,\n\tmaybe_handler_or_options?: unknown,\n\tmaybe_options?: PrerenderOptions,\n): unknown {\n\ttry {\n\t\tif (is_handler(maybe_handler_or_options)) {\n\t\t\treturn native_prerender(\n\t\t\t\tnormalize_validator(validate_or_handler) as never,\n\t\t\t\tmake_remote_wrapper(maybe_handler_or_options, \"Prerender\") as never,\n\t\t\t\tmaybe_options as never,\n\t\t\t);\n\t\t}\n\n\t\tif (is_unchecked(validate_or_handler)) {\n\t\t\tthrow new UncheckedPrerenderHandlerMissingError();\n\t\t}\n\n\t\treturn native_prerender(\n\t\t\tmake_remote_wrapper(validate_or_handler as RemoteHandler, \"Prerender\") as never,\n\t\t\tmaybe_handler_or_options as never,\n\t\t) as ReturnType<typeof native_prerender>;\n\t} catch (error: unknown) {\n\t\tthrow normalize_remote_helper_error(error, \"Prerender\");\n\t}\n}\n","import { error as svelte_error, redirect as svelte_redirect } from \"@sveltejs/kit\";\nimport { Effect } from \"effect\";\n\nconst error_status_codes = {\n\tProxyAuthenticationRequired: 407,\n\tRequestHeaderFieldsTooLarge: 431,\n\tUnavailableForLegalReasons: 451,\n\tNetworkAuthenticationRequired: 511,\n\tHttpVersionNotSupported: 505,\n\tUnprocessableContent: 422,\n\tUnprocessableEntity: 422,\n\tInternalServerError: 500,\n\tFailedDependency: 424,\n\tPreconditionRequired: 428,\n\tServiceUnavailable: 503,\n\tMisdirectedRequest: 421,\n\tInsufficientStorage: 507,\n\tVariantAlsoNegotiates: 506,\n\tPreconditionFailed: 412,\n\tMethodNotAllowed: 405,\n\tGatewayTimeout: 504,\n\tPaymentRequired: 402,\n\tUpgradeRequired: 426,\n\tTooManyRequests: 429,\n\tLengthRequired: 411,\n\tNotAcceptable: 406,\n\tRequestTimeout: 408,\n\tContentTooLarge: 413,\n\tPayloadTooLarge: 413,\n\tUriTooLong: 414,\n\tUnsupportedMediaType: 415,\n\tRangeNotSatisfiable: 416,\n\tExpectationFailed: 417,\n\tImATeapot: 418,\n\tBadRequest: 400,\n\tUnauthorized: 401,\n\tForbidden: 403,\n\tNotFound: 404,\n\tConflict: 409,\n\tGone: 410,\n\tLocked: 423,\n\tTooEarly: 425,\n\tNotImplemented: 501,\n\tBadGateway: 502,\n\tLoopDetected: 508,\n\tNotExtended: 510,\n} as const;\n\nconst redirect_status_codes = {\n\tMovedPermanently: 301,\n\tTemporaryRedirect: 307,\n\tPermanentRedirect: 308,\n\tMultipleChoices: 300,\n\tNotModified: 304,\n\tSwitchProxy: 306,\n\tSeeOther: 303,\n\tUseProxy: 305,\n\tFound: 302,\n} as const;\n\ntype AppErrorStatus = App.Error extends { readonly status?: infer Status } ? Status : number;\n\n/**\n * Compatibility shim while SER supports both SvelteKit 2 and 3. The wrappers\n * call the SvelteKit 3 control-flow shapes, while SvelteKit 2 ignores extra\n * runtime arguments. Drop these broad call signatures when Kit 2 support is\n * removed.\n */\ntype SvelteError = (status: number, body?: ErrorBody, properties?: ErrorProperties) => never;\n\ntype SvelteRedirect = (status: number, location: string | URL, options?: RedirectOptions) => never;\n\n/**\n * Named HTTP status accepted by the {@link Error} helper.\n *\n * @example\n * ```ts\n * const status: ErrorStatusName = \"NotFound\";\n * ```\n *\n * @since 2.3.0\n */\nexport type ErrorStatusName = keyof typeof error_status_codes;\n\n/**\n * Numeric or named HTTP status accepted by the {@link Error} helper.\n *\n * @example\n * ```ts\n * const status: ErrorStatus = \"InternalServerError\";\n * ```\n *\n * @since 2.3.0\n */\nexport type ErrorStatus = ErrorStatusName | number;\n\n/**\n * Error body accepted by the {@link Error} helper.\n *\n * @example\n * ```ts\n * const body: ErrorBody = { message: \"Post not found\" };\n * ```\n *\n * @since 3.4.3\n */\nexport type ErrorBody =\n\t| (Omit<App.Error, \"status\"> & { readonly status?: AppErrorStatus })\n\t| string\n\t| undefined;\n\n/**\n * Extra SvelteKit app error properties accepted by the {@link Error} helper\n * when using the SvelteKit 3 string-body overload.\n *\n * @example\n * ```ts\n * const properties: ErrorProperties = { code: \"POST_NOT_FOUND\" };\n * ```\n *\n * @since 3.4.3\n */\nexport type ErrorProperties = Omit<App.Error, \"status\" | \"message\">;\n\n/**\n * Named HTTP status accepted by the {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const status: RedirectStatusName = \"TemporaryRedirect\";\n * ```\n *\n * @since 2.3.0\n */\nexport type RedirectStatusName = keyof typeof redirect_status_codes;\n\n/**\n * Numeric or named HTTP status accepted by the {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const status: RedirectStatus = \"SeeOther\";\n * ```\n *\n * @since 2.3.0\n */\nexport type RedirectStatus = RedirectStatusName | number;\n\n/**\n * Options accepted by the {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const options: RedirectOptions = { external: true };\n * ```\n *\n * @since 3.4.3\n */\nexport type RedirectOptions = {\n\treadonly external?: boolean | string[];\n};\n\n/**\n * Callable shape for the exported {@link Error} helper.\n *\n * @example\n * ```ts\n * const fail_not_found: ErrorEffectFactory = Error;\n * ```\n *\n * @since 2.3.0\n */\nexport interface ErrorEffectFactory {\n\t/**\n\t * Creates an Effect that throws SvelteKit's HTTP error control-flow value.\n\t *\n\t * @example\n\t * ```ts\n\t * return yield* Error(\"NotFound\", \"Post not found\");\n\t * ```\n\t *\n\t * @since 2.3.0\n\t * @param status - Numeric HTTP status or PascalCase status name to pass to\n\t * SvelteKit's `error` helper.\n\t * @param body - Optional SvelteKit error body or message forwarded unchanged\n\t * to SvelteKit.\n\t * @returns An Effect that never succeeds because SvelteKit takes over request\n\t * control flow.\n\t */\n\t(status: ErrorStatus, body?: ErrorBody): Effect.Effect<never, never, never>;\n\n\t/**\n\t * Creates an Effect that throws SvelteKit's HTTP error control-flow value\n\t * using the SvelteKit 3 string-body overload with extra properties.\n\t *\n\t * @example\n\t * ```ts\n\t * return yield* Error(\"NotFound\", \"Post not found\", {\n\t * code: \"POST_NOT_FOUND\",\n\t * });\n\t * ```\n\t *\n\t * @since 3.4.3\n\t * @param status - Numeric HTTP status or PascalCase status name to pass to\n\t * SvelteKit's `error` helper.\n\t * @param body - Error message forwarded to SvelteKit.\n\t * @param properties - Additional app error properties forwarded to\n\t * SvelteKit.\n\t * @returns An Effect that never succeeds because SvelteKit takes over request\n\t * control flow.\n\t */\n\t(\n\t\tstatus: ErrorStatus,\n\t\tbody: string,\n\t\tproperties: ErrorProperties,\n\t): Effect.Effect<never, never, never>;\n}\n\n/**\n * Callable shape for the exported {@link Redirect} helper.\n *\n * @example\n * ```ts\n * const redirect_after_save: RedirectEffectFactory = Redirect;\n * ```\n *\n * @since 2.3.0\n */\nexport interface RedirectEffectFactory {\n\t/**\n\t * Creates an Effect that throws SvelteKit's redirect control-flow value.\n\t *\n\t * @example\n\t * ```ts\n\t * return yield* Redirect(\"SeeOther\", \"/posts\");\n\t * ```\n\t *\n\t * @since 2.3.0\n\t * @param status - Numeric redirect status or PascalCase status name to pass\n\t * to SvelteKit's `redirect` helper.\n\t * @param location - Target URL forwarded unchanged to SvelteKit.\n\t * @param options - Optional SvelteKit redirect options. In SvelteKit 3, pass\n\t * `{ external: true }` or an allowlist to redirect to external URLs.\n\t * @returns An Effect that never succeeds because SvelteKit takes over request\n\t * control flow.\n\t */\n\t(\n\t\tstatus: RedirectStatus,\n\t\tlocation: string | URL,\n\t\toptions?: RedirectOptions,\n\t): Effect.Effect<never, never, never>;\n}\n\n/**\n * Creates an Effect that raises SvelteKit's HTTP error control flow.\n *\n * @example\n * ```ts\n * return yield* Error(\"NotFound\", \"Post not found\");\n * ```\n *\n * @since 2.3.0\n * @param status - Numeric HTTP status or PascalCase status name to pass to\n * SvelteKit's `error` helper.\n * @param body - Optional SvelteKit error body or message forwarded unchanged\n * to SvelteKit.\n * @param properties - Optional SvelteKit 3 app error properties forwarded when\n * using a string error message.\n * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\nexport const Error: ErrorEffectFactory = ((\n\tstatus: ErrorStatus,\n\tbody?: ErrorBody,\n\tproperties?: ErrorProperties,\n) => {\n\tconst resolved_status = resolve_error_status(status);\n\tconst error = svelte_error as SvelteError;\n\n\treturn Effect.sync((): never => {\n\t\tif (properties === undefined) {\n\t\t\treturn error(resolved_status, body);\n\t\t}\n\n\t\treturn error(resolved_status, body, properties);\n\t});\n}) as ErrorEffectFactory;\n\n/**\n * Creates an Effect that raises SvelteKit's redirect control flow.\n *\n * @example\n * ```ts\n * return yield* Redirect(\"SeeOther\", \"/posts\");\n * ```\n *\n * @since 2.3.0\n * @param status - Numeric redirect status or PascalCase status name to pass to\n * SvelteKit's `redirect` helper.\n * @param location - Target URL forwarded unchanged to SvelteKit.\n * @param options - Optional SvelteKit redirect options. In SvelteKit 3, pass\n * `{ external: true }` or an allowlist to redirect to external URLs.\n * @returns An Effect that never succeeds because SvelteKit takes over request\n * control flow.\n */\nexport const Redirect: RedirectEffectFactory = ((\n\tstatus: RedirectStatus,\n\tlocation: string | URL,\n\toptions?: RedirectOptions,\n) => {\n\tconst resolved_status = resolve_redirect_status(status);\n\tconst redirect = svelte_redirect as SvelteRedirect;\n\n\treturn Effect.sync((): never => redirect(resolved_status, location, options));\n}) as RedirectEffectFactory;\n\nfunction resolve_error_status(status: ErrorStatus): number {\n\tif (typeof status === \"number\") {\n\t\treturn status;\n\t}\n\n\treturn error_status_codes[status];\n}\n\nfunction resolve_redirect_status(status: RedirectStatus): number {\n\tif (typeof status === \"number\") {\n\t\treturn status;\n\t}\n\n\treturn redirect_status_codes[status];\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAWA,SAAgB,aAAa,OAAsC;CAClE,OAAO,UAAU;AAClB;;;;;;;;AASA,SAAgB,WACf,OAC6D;CAC7D,OAAO,OAAO,UAAU;AACzB;;;;;;;;AASA,SAAgB,mBAAmB,OAAyC;CAC3E,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,eAAe;AACtE;;;;;;;;AASA,SAAgB,iBAAiB,OAAiD;CACjF,OAAO,OAAO,UAAU,YAAY,UAAU,QAAQ,SAAS,SAAS,UAAU;AACnF;;;;;;;;AASA,SAAgB,oBAAoB,OAAyB;CAC5D,IAAI,mBAAmB,KAAK,KAAK,CAAC,iBAAiB,KAAK,GACvD,OAAO;CAGR,OAAO,OAAO,mBAAmB,KAAc;AAChD;;;;;;;;;;ACzCA,SAAgB,oBACf,OACkD;CAClD,OACC,OAAO,UAAU,YACjB,UAAU,QACV,OAAQ,MAA6B,SAAS;AAEhD;;;;;;;;AASA,SAAgB,SAAkB,OAAoD;CACrF,IAAI,oBAAuB,KAAK,GAC/B,OAAO,OAAO,UAAU,KAAK;CAG9B,OAAO;AACR;;;;;;;;AAwBA,SAAgB,eAAkB,OAAoD;CACrF,IAAI,OAAO,SAAS,KAAK,GACxB,OAAO;CAGR,IAAI,OAAO,UAAU,YAAY,UAAU,MAC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