svelte-effect-runtime 1.6.1 → 2.0.0-beta.1
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-BeOE81fW.js +577 -0
- package/.dist/chunks/client-BeOE81fW.js.map +1 -0
- package/.dist/chunks/descriptors-CU2g4U_i.js +36 -0
- package/.dist/chunks/descriptors-CU2g4U_i.js.map +1 -0
- package/.dist/chunks/dispatcher-BSg2-ttN.js +339 -0
- package/.dist/chunks/dispatcher-BSg2-ttN.js.map +1 -0
- package/.dist/chunks/preprocess-BZyUYWY7.js +430 -0
- package/.dist/chunks/preprocess-BZyUYWY7.js.map +1 -0
- package/.dist/chunks/transform-BtlxgJrg.js +836 -0
- package/.dist/chunks/transform-BtlxgJrg.js.map +1 -0
- package/.dist/detect.d.ts +34 -0
- package/.dist/detect.js +56 -0
- package/.dist/detect.js.map +1 -0
- package/.dist/dispatcher/deps.d.ts +14 -0
- package/.dist/dispatcher/fibers.d.ts +52 -0
- package/.dist/dispatcher/index.d.ts +138 -0
- package/.dist/dispatcher/types.d.ts +63 -0
- package/.dist/dispatcher.d.ts +2 -0
- package/.dist/dispatcher.js +2 -0
- package/.dist/error.d.ts +77 -0
- package/.dist/generators.d.ts +16 -0
- package/.dist/internal/descriptors.d.ts +17 -0
- package/.dist/internal/generators.d.ts +6 -0
- package/.dist/internal/generators.js +5 -0
- package/.dist/internal/remote-client.d.ts +6 -0
- package/.dist/internal/remote-client.js +2 -0
- package/.dist/internal/remote-server.d.ts +6 -0
- package/.dist/internal/remote-server.js +2 -0
- package/.dist/markup/promise.d.ts +15 -0
- package/.dist/markup/promise.js +26 -0
- package/.dist/markup/promise.js.map +1 -0
- package/.dist/markup/run.d.ts +12 -0
- package/.dist/markup/run.js +21 -0
- package/.dist/markup/run.js.map +1 -0
- package/.dist/markup/transform/apply.d.ts +6 -0
- package/.dist/markup/transform/classify.d.ts +15 -0
- package/.dist/markup/transform/constants.d.ts +5 -0
- package/.dist/markup/transform/emit.d.ts +12 -0
- package/.dist/markup/transform/expressions.d.ts +39 -0
- package/.dist/markup/transform/index.d.ts +19 -0
- package/.dist/markup/transform/scan.d.ts +8 -0
- package/.dist/markup/transform/types.d.ts +64 -0
- package/.dist/markup/transform.d.ts +1 -0
- package/.dist/markup/transform.js +2 -0
- package/.dist/markup/value.d.ts +20 -0
- package/.dist/markup/value.js +32 -0
- package/.dist/markup/value.js.map +1 -0
- package/.dist/mod.d.ts +186 -0
- package/.dist/mod.js +190 -0
- package/.dist/mod.js.map +1 -0
- package/.dist/preprocess/ast.d.ts +51 -0
- package/.dist/preprocess/imports.d.ts +22 -0
- package/.dist/preprocess/index.d.ts +21 -0
- package/.dist/preprocess/lower.d.ts +12 -0
- package/.dist/preprocess/runtime-block.d.ts +8 -0
- package/.dist/preprocess/source.d.ts +29 -0
- package/.dist/preprocess/types.d.ts +70 -0
- package/.dist/preprocess.d.ts +2 -0
- package/.dist/preprocess.js +3 -0
- package/.dist/remote/client/command.d.ts +17 -0
- package/.dist/remote/client/effect.d.ts +15 -0
- package/.dist/remote/client/failures.d.ts +57 -0
- package/.dist/remote/client/form-data.d.ts +8 -0
- package/.dist/remote/client/form-enhance.d.ts +9 -0
- package/.dist/remote/client/form-transport.d.ts +20 -0
- package/.dist/remote/client/form.d.ts +21 -0
- package/.dist/remote/client/index.d.ts +4 -0
- package/.dist/remote/client/query-result.d.ts +14 -0
- package/.dist/remote/client/query.d.ts +57 -0
- package/.dist/remote/client/responses.d.ts +28 -0
- package/.dist/remote/client/types.d.ts +83 -0
- package/.dist/remote/client/utils.d.ts +11 -0
- package/.dist/remote/client.d.ts +2 -0
- package/.dist/remote/client.js +2 -0
- package/.dist/remote/server.d.ts +66 -0
- package/.dist/remote/server.js +104 -0
- package/.dist/remote/server.js.map +1 -0
- package/.dist/remote/shared.d.ts +202 -0
- package/.dist/remote/shared.js +161 -0
- package/.dist/remote/shared.js.map +1 -0
- package/.dist/runtime/preprocess.d.ts +38 -0
- package/.dist/runtime/preprocess.js +54 -0
- package/.dist/runtime/preprocess.js.map +1 -0
- package/.dist/server/effects.d.ts +49 -0
- package/.dist/server/factories.d.ts +97 -0
- package/.dist/server/index.d.ts +3 -0
- package/.dist/server/invalid.d.ts +9 -0
- package/.dist/server/runtime.d.ts +66 -0
- package/.dist/server/schema.d.ts +42 -0
- package/.dist/server/types.d.ts +271 -0
- package/.dist/server/wrappers.d.ts +45 -0
- package/.dist/server.d.ts +2 -0
- package/.dist/server.js +527 -0
- package/.dist/server.js.map +1 -0
- package/.dist/vite.d.ts +42 -0
- package/.dist/vite.js +118 -0
- package/.dist/vite.js.map +1 -0
- package/README.md +2 -0
- package/package.json +66 -101
- package/dist/chunks/client-vV6UAwoP.js +0 -199
- package/dist/chunks/client-vV6UAwoP.js.map +0 -1
- package/dist/chunks/effect-compat-BhW0YPIs.js +0 -103
- package/dist/chunks/effect-compat-BhW0YPIs.js.map +0 -1
- package/dist/chunks/effect-zCli5qgO.js +0 -51
- package/dist/chunks/effect-zCli5qgO.js.map +0 -1
- package/dist/chunks/magic-string.es-BnGH-5YR.js +0 -1013
- package/dist/chunks/magic-string.es-BnGH-5YR.js.map +0 -1
- package/dist/chunks/markup-D4zJP7U1.js +0 -13383
- package/dist/chunks/markup-D4zJP7U1.js.map +0 -1
- package/dist/chunks/preprocess-DIC5iR0_.js +0 -49
- package/dist/chunks/preprocess-DIC5iR0_.js.map +0 -1
- package/dist/chunks/server-Dea1CJuY.js +0 -704
- package/dist/chunks/server-Dea1CJuY.js.map +0 -1
- package/dist/chunks/v3-D0c0MKPf.js +0 -1
- package/dist/chunks/v4-MMhHmzIG.js +0 -1
- package/dist/chunks/vite-Bm2RdiT3.js +0 -152
- package/dist/chunks/vite-Bm2RdiT3.js.map +0 -1
- package/dist/client.d.ts +0 -1
- package/dist/client.js +0 -2
- package/dist/effect.d.ts +0 -1
- package/dist/effect.js +0 -2
- package/dist/internal/app-server-shim.d.ts +0 -8
- package/dist/internal/effect-compat.d.ts +0 -21
- package/dist/internal/markup.d.ts +0 -11
- package/dist/internal/markup.js +0 -2
- package/dist/internal/remote-client.d.ts +0 -36
- package/dist/internal/remote-client.js +0 -527
- package/dist/internal/remote-client.js.map +0 -1
- package/dist/internal/remote-shared.d.ts +0 -186
- package/dist/internal/remote-shared.js +0 -122
- package/dist/internal/remote-shared.js.map +0 -1
- package/dist/internal/transform.d.ts +0 -18
- package/dist/internal/transform.js +0 -418
- package/dist/internal/transform.js.map +0 -1
- package/dist/language-server.d.ts +0 -9
- package/dist/language-server.js +0 -4
- package/dist/mod.d.ts +0 -22
- package/dist/mod.js +0 -3
- package/dist/preprocess.d.ts +0 -29
- package/dist/preprocess.js +0 -20
- package/dist/preprocess.js.map +0 -1
- package/dist/root-node.d.ts +0 -1
- package/dist/root-node.js +0 -63
- package/dist/root-node.js.map +0 -1
- package/dist/server.d.ts +0 -81
- package/dist/server.js +0 -85
- package/dist/server.js.map +0 -1
- package/dist/v3/client.d.ts +0 -117
- package/dist/v3/effect.d.ts +0 -17
- package/dist/v3/mod.d.ts +0 -27
- package/dist/v3/preprocess.d.ts +0 -28
- package/dist/v3/root-node.d.ts +0 -59
- package/dist/v3/server.d.ts +0 -297
- package/dist/v3/vite.d.ts +0 -46
- package/dist/v4/client.d.ts +0 -2
- package/dist/v4/effect.d.ts +0 -24
- package/dist/v4/effect.js +0 -19
- package/dist/v4/effect.js.map +0 -1
- package/dist/v4/mod.d.ts +0 -27
- package/dist/v4/mod.js +0 -3
- package/dist/v4/preprocess.d.ts +0 -34
- package/dist/v4/preprocess.js +0 -32
- package/dist/v4/preprocess.js.map +0 -1
- package/dist/v4/root-node.d.ts +0 -59
- package/dist/v4/root-node.js +0 -4
- package/dist/v4/server.d.ts +0 -340
- package/dist/v4/server.js +0 -71
- package/dist/v4/server.js.map +0 -1
- package/dist/v4/vite.d.ts +0 -34
- package/dist/v4/vite.js +0 -31
- package/dist/v4/vite.js.map +0 -1
- package/dist/vite.d.ts +0 -31
- package/dist/vite.js +0 -24
- package/dist/vite.js.map +0 -1
package/dist/v4/server.d.ts
DELETED
|
@@ -1,340 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* v4 server-side entrypoint for `svelte-effect-runtime`.
|
|
3
|
-
*
|
|
4
|
-
* Provides Effect v4-flavoured remote-function helpers and the updated
|
|
5
|
-
* `ServerRuntime` builder whose `RuntimeOperator` signature accepts the
|
|
6
|
-
* v4-style `Layer.provide(...)` operator. Usually consumed indirectly: the
|
|
7
|
-
* Vite plugin rewrites `svelte-effect-runtime/v4` imports inside `.remote.ts`
|
|
8
|
-
* to resolve here at build time.
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* import { Query, ServerRuntime } from "svelte-effect-runtime/v4/_server";
|
|
13
|
-
* import { Effect, Layer, Schema } from "effect";
|
|
14
|
-
*
|
|
15
|
-
* ServerRuntime.make(Layer.provide(MyServiceLayer));
|
|
16
|
-
*
|
|
17
|
-
* export const hello = Query(Schema.String, (name) =>
|
|
18
|
-
* Effect.succeed(`hello ${name}`)
|
|
19
|
-
* );
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* @see https://ser.barekey.dev/content/reference/server-runtime
|
|
23
|
-
*
|
|
24
|
-
* @module
|
|
25
|
-
*/
|
|
26
|
-
import type { RemoteForm as SvelteKitRemoteForm, RemoteFormInput as SvelteKitRemoteFormInput } from "@sveltejs/kit";
|
|
27
|
-
import type { getRequestEvent as get_native_request_event } from "$app/server";
|
|
28
|
-
import type { Effect as Effect_type, Layer as Layer_type } from "effect";
|
|
29
|
-
import * as base_server from "../v3/server.js";
|
|
30
|
-
import type { FormError, RemoteFailure } from "../internal/remote-shared.js";
|
|
31
|
-
import { type EffectContextKey, type EffectSchemaLike } from "../internal/effect-compat.js";
|
|
32
|
-
/**
|
|
33
|
-
* Single entry in a {@link Transport} table. Describes how to encode a value
|
|
34
|
-
* to a wire payload and decode it back.
|
|
35
|
-
*
|
|
36
|
-
* @see https://ser.barekey.dev/content/reference/transport
|
|
37
|
-
*/
|
|
38
|
-
export interface Transporter<T = unknown, U = {
|
|
39
|
-
value: unknown;
|
|
40
|
-
}> {
|
|
41
|
-
/** Restore the original value from the wire payload. */
|
|
42
|
-
decode: (data: U) => T;
|
|
43
|
-
/**
|
|
44
|
-
* Encode the value to a wire payload, or return `false` when this transporter
|
|
45
|
-
* does not apply to the supplied value.
|
|
46
|
-
*/
|
|
47
|
-
encode: (value: T) => false | U;
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* Named collection of {@link Transporter}s used by devalue to round-trip
|
|
51
|
-
* custom types across the client/server boundary.
|
|
52
|
-
*
|
|
53
|
-
* @see https://ser.barekey.dev/content/reference/transport
|
|
54
|
-
*/
|
|
55
|
-
export type Transport = Record<string, Transporter>;
|
|
56
|
-
/** Alias for SvelteKit's native remote-form input shape. */
|
|
57
|
-
export type RemoteFormInput = SvelteKitRemoteFormInput;
|
|
58
|
-
/** SvelteKit's native `query` function signature, re-exported for typing. */
|
|
59
|
-
export type RemoteQueryFunction<Input, Output> = (arg: OptionalArgument<Input>) => Promise<Output>;
|
|
60
|
-
/** SvelteKit's native `command` shape, re-exported for typing. */
|
|
61
|
-
export type RemoteCommand<Input, Output> = ((arg: OptionalArgument<Input>) => Promise<Output> & {
|
|
62
|
-
updates(...updates: Array<unknown>): Promise<Output>;
|
|
63
|
-
}) & {
|
|
64
|
-
readonly pending: number;
|
|
65
|
-
};
|
|
66
|
-
/** SvelteKit's native `prerender` function signature, re-exported for typing. */
|
|
67
|
-
export type RemotePrerenderFunction<Input, Output> = (arg: OptionalArgument<Input>) => Promise<Output>;
|
|
68
|
-
/** SvelteKit's native `form` shape, re-exported for typing. */
|
|
69
|
-
export type RemoteForm<Input extends RemoteFormInput | void, Output> = SvelteKitRemoteForm<Input, Output>;
|
|
70
|
-
type OptionalArgument<Input> = undefined extends Input ? Input | void : Input;
|
|
71
|
-
type RuntimeOperator = (self: Layer_type.Layer<unknown, unknown, unknown>) => Layer_type.Layer<unknown, unknown, unknown>;
|
|
72
|
-
type RuntimeSeedLayer<Requirements> = Layer_type.Layer<Requirements, never, Requirements>;
|
|
73
|
-
type ProvidedBy<Op> = Op extends (self: RuntimeSeedLayer<infer Requirements>) => Layer_type.Layer<unknown, unknown, infer Incoming> ? Exclude<Requirements, Incoming> : never;
|
|
74
|
-
type ProvidedByAll<Ops extends ReadonlyArray<RuntimeOperator>> = Ops extends readonly [infer Head, ...infer Tail] ? ProvidedBy<Head> | ProvidedByAll<Extract<Tail, ReadonlyArray<RuntimeOperator>>> : never;
|
|
75
|
-
type ApplyOperator<Seed, Op> = Op extends (self: Seed) => infer Out ? Out : never;
|
|
76
|
-
type ApplyOperators<Seed, Ops extends ReadonlyArray<RuntimeOperator>> = Ops extends readonly [infer Head, ...infer Tail] ? ApplyOperators<ApplyOperator<Seed, Head>, Extract<Tail, ReadonlyArray<RuntimeOperator>>> : Seed;
|
|
77
|
-
type FinalRuntimeLayer<Ops extends ReadonlyArray<RuntimeOperator>> = ApplyOperators<RuntimeSeedLayer<ProvidedByAll<Ops>>, Ops> extends infer Out ? Out extends Layer_type.Layer<unknown, unknown, infer Incoming> ? [Incoming] extends [never] ? Out : never : never : never;
|
|
78
|
-
type SchemaInput<SchemaType extends EffectSchemaLike> = SchemaType extends {
|
|
79
|
-
readonly Encoded: infer Input;
|
|
80
|
-
} ? Input : never;
|
|
81
|
-
type SchemaOutput<SchemaType extends EffectSchemaLike> = SchemaType extends {
|
|
82
|
-
readonly Type: infer Output;
|
|
83
|
-
} ? Output : never;
|
|
84
|
-
type FieldHelpers<FormShape, SchemaType> = FormShape extends Record<string, unknown> ? {
|
|
85
|
-
[Key in keyof FormShape as Key extends string ? Key : never]: (message: string) => Effect_type.Effect<never, FormError<SchemaType>, never>;
|
|
86
|
-
} : Record<PropertyKey, never>;
|
|
87
|
-
/**
|
|
88
|
-
* Proxy passed into v4 `Form` handlers for reporting validation issues. Call
|
|
89
|
-
* `invalid.form(message)` for a top-level issue, or `invalid.<field>(message)`
|
|
90
|
-
* to attach the issue to a specific field.
|
|
91
|
-
*
|
|
92
|
-
* @see https://ser.barekey.dev/content/remote-functions/form
|
|
93
|
-
*/
|
|
94
|
-
export type Invalid<SchemaType = unknown> = {
|
|
95
|
-
/** Attach a top-level form issue with the supplied message. */
|
|
96
|
-
form: (message: string) => Effect_type.Effect<never, FormError<SchemaType>, never>;
|
|
97
|
-
} & FieldHelpers<SchemaType extends EffectSchemaLike ? SchemaOutput<SchemaType> : unknown, SchemaType>;
|
|
98
|
-
/**
|
|
99
|
-
* v4 shape of an Effect-returning remote `query`. Exposes the underlying
|
|
100
|
-
* SvelteKit function via `native`.
|
|
101
|
-
*
|
|
102
|
-
* @see https://ser.barekey.dev/content/remote-functions/query
|
|
103
|
-
*/
|
|
104
|
-
export type EffectQueryFunction<Input, Output, Error = never> = ((arg: OptionalArgument<Input>) => Effect_type.Effect<Output, RemoteFailure<Error>, never>) & {
|
|
105
|
-
/** Underlying SvelteKit `query` function, for fallback direct usage. */
|
|
106
|
-
native: RemoteQueryFunction<Input, Output>;
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* v4 shape of an Effect-returning remote `command`. Tracks in-flight
|
|
110
|
-
* submissions via `pending`.
|
|
111
|
-
*
|
|
112
|
-
* @see https://ser.barekey.dev/content/remote-functions/command
|
|
113
|
-
*/
|
|
114
|
-
export type EffectCommand<Input, Output, Error = never> = ((arg: OptionalArgument<Input>) => Effect_type.Effect<Output, RemoteFailure<Error>, never>) & {
|
|
115
|
-
/** Underlying SvelteKit `command` function, for fallback direct usage. */
|
|
116
|
-
native: RemoteCommand<Input, Output>;
|
|
117
|
-
/** Count of currently in-flight invocations of this command. */
|
|
118
|
-
readonly pending: number;
|
|
119
|
-
};
|
|
120
|
-
/**
|
|
121
|
-
* v4 shape of an Effect-returning remote `prerender` function.
|
|
122
|
-
*
|
|
123
|
-
* @see https://ser.barekey.dev/content/remote-functions/prerender
|
|
124
|
-
*/
|
|
125
|
-
export type EffectPrerenderFunction<Input, Output, Error = never> = ((arg: OptionalArgument<Input>) => Effect_type.Effect<Output, RemoteFailure<Error>, never>) & {
|
|
126
|
-
/** Underlying SvelteKit `prerender` function, for fallback direct usage. */
|
|
127
|
-
native: RemotePrerenderFunction<Input, Output>;
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* v4 shape of an Effect-returning remote `form`. Effect-aware overrides for
|
|
131
|
-
* the surfaces that SvelteKit exposes as Promises: `submit(data)`,
|
|
132
|
-
* `enhance(callback)`, `validate(options?)`, and `for(id)`.
|
|
133
|
-
*
|
|
134
|
-
* @see https://ser.barekey.dev/content/remote-functions/form
|
|
135
|
-
*/
|
|
136
|
-
export type EffectForm<Input extends RemoteFormInput | void, Output, Error = never> = Omit<RemoteForm<Input, Output>, "enhance" | "validate" | "for"> & {
|
|
137
|
-
/** Underlying SvelteKit `form` object, for fallback direct usage. */
|
|
138
|
-
native: RemoteForm<Input, Output>;
|
|
139
|
-
/** Submit the form programmatically and receive the result as an Effect. */
|
|
140
|
-
submit(data: OptionalArgument<Input>): Effect_type.Effect<Output, RemoteFailure<Error>, never>;
|
|
141
|
-
/**
|
|
142
|
-
* Effect-aware version of SvelteKit's `enhance`. The callback receives
|
|
143
|
-
* `submit` as a thunk returning an Effect, and may return an Effect
|
|
144
|
-
* (which the runtime will run for you) or `void`.
|
|
145
|
-
*/
|
|
146
|
-
enhance(callback: (args: {
|
|
147
|
-
readonly form: HTMLFormElement;
|
|
148
|
-
readonly data: Input;
|
|
149
|
-
readonly submit: () => Effect_type.Effect<void, RemoteFailure<Error>, never>;
|
|
150
|
-
}) => Effect_type.Effect<unknown, unknown, never> | void): {
|
|
151
|
-
method: "POST";
|
|
152
|
-
action: string;
|
|
153
|
-
[attachment: symbol]: (node: HTMLFormElement) => void;
|
|
154
|
-
};
|
|
155
|
-
/** Effect-returning version of SvelteKit's `validate`. */
|
|
156
|
-
validate(options?: {
|
|
157
|
-
readonly includeUntouched?: boolean;
|
|
158
|
-
readonly preflightOnly?: boolean;
|
|
159
|
-
}): Effect_type.Effect<void, RemoteFailure<Error>, never>;
|
|
160
|
-
/** Clone the form binding for a specific value - mirrors `RemoteForm.for`. */
|
|
161
|
-
for: RemoteForm<Input, Output>["for"] extends (...args: infer Args) => unknown ? (...args: Args) => EffectForm<Input, Output, Error> : never;
|
|
162
|
-
};
|
|
163
|
-
/**
|
|
164
|
-
* v4 type of the SvelteKit `RequestEvent` exposed through the
|
|
165
|
-
* {@link RequestEvent} Effect service.
|
|
166
|
-
*/
|
|
167
|
-
export type RequestEventService = ReturnType<typeof get_native_request_event>;
|
|
168
|
-
/**
|
|
169
|
-
* Builder shape returned by {@link ServerRuntime} in the v4 runtime. Accepts
|
|
170
|
-
* v4-style `Layer` operators and installs a singleton `ManagedRuntime`.
|
|
171
|
-
*
|
|
172
|
-
* @see https://ser.barekey.dev/content/reference/server-runtime
|
|
173
|
-
*/
|
|
174
|
-
export interface ServerRuntimeSeed {
|
|
175
|
-
/** Compose operators into a Layer without installing a runtime. */
|
|
176
|
-
pipe(): Layer_type.Layer<never>;
|
|
177
|
-
/** Compose operators into a Layer without installing a runtime. */
|
|
178
|
-
pipe<const Ops extends readonly [RuntimeOperator, ...Array<RuntimeOperator>]>(...ops: Ops): FinalRuntimeLayer<Ops>;
|
|
179
|
-
/** Build and install the singleton server runtime. */
|
|
180
|
-
make(): void;
|
|
181
|
-
/** Build and install the singleton server runtime. */
|
|
182
|
-
make<const Ops extends readonly [RuntimeOperator, ...Array<RuntimeOperator>]>(...ops: Ops): void;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Subset of `ManagedRuntime` surface used by generated v4 server wrappers.
|
|
186
|
-
*
|
|
187
|
-
* @internal Internal - do not use.
|
|
188
|
-
*/
|
|
189
|
-
export interface EffectManagedRuntime {
|
|
190
|
-
/** Execute an Effect and resolve with its raw `Exit`. */
|
|
191
|
-
runPromiseExit<A, E, R>(effect: Effect_type.Effect<A, E, R>): Promise<unknown>;
|
|
192
|
-
/** Tear down the runtime and release its root scope. */
|
|
193
|
-
dispose(): Promise<void>;
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Signature of `Query.batch` in the v4 runtime - kept loosely typed because
|
|
197
|
-
* the v4 server-side implementation delegates to the v3 batch factory.
|
|
198
|
-
*
|
|
199
|
-
* @see https://ser.barekey.dev/content/remote-functions/query
|
|
200
|
-
*/
|
|
201
|
-
export interface EffectQueryBatchFactory {
|
|
202
|
-
/** Build a batched query from validator + handler arguments. */
|
|
203
|
-
(...args: Array<unknown>): unknown;
|
|
204
|
-
}
|
|
205
|
-
/**
|
|
206
|
-
* v4 overload set for the {@link Query} factory. Mirrors
|
|
207
|
-
* {@link import("../v3/server.js").EffectQueryFactory} using v4 schema-like
|
|
208
|
-
* inference.
|
|
209
|
-
*
|
|
210
|
-
* @see https://ser.barekey.dev/content/remote-functions/query
|
|
211
|
-
*/
|
|
212
|
-
export interface EffectQueryFactory {
|
|
213
|
-
/** Define a void-input query. */
|
|
214
|
-
<Output, Error, Requirements>(fn: () => Effect_type.Effect<Output, Error, Requirements>): EffectQueryFunction<void, Output, Error>;
|
|
215
|
-
/** Define a query that bypasses schema validation. */
|
|
216
|
-
<Input, Output, Error, Requirements>(validate: "unchecked", fn: (arg: Input) => Effect_type.Effect<Output, Error, Requirements>): EffectQueryFunction<Input, Output, Error>;
|
|
217
|
-
/** Define a query whose input is validated by an Effect.Schema. */
|
|
218
|
-
<SchemaType extends EffectSchemaLike, Output, Error, Requirements>(validate: SchemaType, fn: (arg: SchemaOutput<SchemaType>) => Effect_type.Effect<Output, Error, Requirements>): EffectQueryFunction<SchemaInput<SchemaType>, Output, Error>;
|
|
219
|
-
/** Define a batched query - mirrors SvelteKit's `query.batch`. */
|
|
220
|
-
batch: EffectQueryBatchFactory;
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* v4 overload set for the {@link Command} factory.
|
|
224
|
-
*
|
|
225
|
-
* @see https://ser.barekey.dev/content/remote-functions/command
|
|
226
|
-
*/
|
|
227
|
-
export interface EffectCommandFactory {
|
|
228
|
-
/** Define a void-input command. */
|
|
229
|
-
<Output, Error, Requirements>(fn: () => Effect_type.Effect<Output, Error, Requirements>): EffectCommand<void, Output, Error>;
|
|
230
|
-
/** Define a command that bypasses schema validation. */
|
|
231
|
-
<Input, Output, Error, Requirements>(validate: "unchecked", fn: (arg: Input) => Effect_type.Effect<Output, Error, Requirements>): EffectCommand<Input, Output, Error>;
|
|
232
|
-
/** Define a command whose input is validated by an Effect.Schema. */
|
|
233
|
-
<SchemaType extends EffectSchemaLike, Output, Error, Requirements>(validate: SchemaType, fn: (arg: SchemaOutput<SchemaType>) => Effect_type.Effect<Output, Error, Requirements>): EffectCommand<SchemaInput<SchemaType>, Output, Error>;
|
|
234
|
-
}
|
|
235
|
-
type RemotePrerenderInputsGenerator<Input> = (event: RequestEventService) => AsyncIterable<Input> | Iterable<Input>;
|
|
236
|
-
/**
|
|
237
|
-
* v4 overload set for the {@link Form} factory.
|
|
238
|
-
*
|
|
239
|
-
* @see https://ser.barekey.dev/content/remote-functions/form
|
|
240
|
-
*/
|
|
241
|
-
export interface EffectFormFactory {
|
|
242
|
-
/** Define a form handler with no input data. */
|
|
243
|
-
<Output, Error, Requirements>(fn: () => Effect_type.Effect<Output, Error, Requirements>): EffectForm<void, Output, Error>;
|
|
244
|
-
/** Define a form handler that bypasses schema validation. */
|
|
245
|
-
<Input extends RemoteFormInput, Output, Error, Requirements>(validate: "unchecked", fn: (args: {
|
|
246
|
-
data: Input;
|
|
247
|
-
invalid: Invalid;
|
|
248
|
-
}) => Effect_type.Effect<Output, Error | FormError, Requirements>): EffectForm<Input, Output, Error>;
|
|
249
|
-
/** Define a form handler whose submitted data is validated by a schema. */
|
|
250
|
-
<SchemaType extends EffectSchemaLike, Output, Error, Requirements>(validate: SchemaType, fn: (args: {
|
|
251
|
-
data: SchemaOutput<SchemaType>;
|
|
252
|
-
invalid: Invalid<SchemaType>;
|
|
253
|
-
}) => Effect_type.Effect<Output, Error | FormError<SchemaType>, Requirements>): EffectForm<SchemaInput<SchemaType> & RemoteFormInput, Output, Error>;
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* v4 overload set for the {@link Prerender} factory. Supports the same three
|
|
257
|
-
* validation flavours as the other factories plus a SvelteKit `options` bag
|
|
258
|
-
* with `inputs` / `dynamic` flags.
|
|
259
|
-
*
|
|
260
|
-
* @see https://ser.barekey.dev/content/remote-functions/prerender
|
|
261
|
-
*/
|
|
262
|
-
export interface EffectPrerenderFactory {
|
|
263
|
-
<Output, Error, Requirements>(fn: () => Effect_type.Effect<Output, Error, Requirements>, options?: {
|
|
264
|
-
inputs?: RemotePrerenderInputsGenerator<void>;
|
|
265
|
-
dynamic?: boolean;
|
|
266
|
-
}): EffectPrerenderFunction<void, Output, Error>;
|
|
267
|
-
<Input, Output, Error, Requirements>(validate: "unchecked", fn: (arg: Input) => Effect_type.Effect<Output, Error, Requirements>, options?: {
|
|
268
|
-
inputs?: RemotePrerenderInputsGenerator<Input>;
|
|
269
|
-
dynamic?: boolean;
|
|
270
|
-
}): EffectPrerenderFunction<Input, Output, Error>;
|
|
271
|
-
<SchemaType extends EffectSchemaLike, Output, Error, Requirements>(validate: SchemaType, fn: (arg: SchemaOutput<SchemaType>) => Effect_type.Effect<Output, Error, Requirements>, options?: {
|
|
272
|
-
inputs?: RemotePrerenderInputsGenerator<SchemaInput<SchemaType>>;
|
|
273
|
-
dynamic?: boolean;
|
|
274
|
-
}): EffectPrerenderFunction<SchemaInput<SchemaType>, Output, Error>;
|
|
275
|
-
}
|
|
276
|
-
/**
|
|
277
|
-
* v4 flavour of {@link import("../v3/server.js").Query} - define a read-only
|
|
278
|
-
* remote function returning an Effect.
|
|
279
|
-
*
|
|
280
|
-
* @see https://ser.barekey.dev/content/remote-functions/query
|
|
281
|
-
*/
|
|
282
|
-
export declare const Query: EffectQueryFactory;
|
|
283
|
-
/**
|
|
284
|
-
* v4 flavour of {@link import("../v3/server.js").Command} - define a
|
|
285
|
-
* write-oriented remote function returning an Effect.
|
|
286
|
-
*
|
|
287
|
-
* @see https://ser.barekey.dev/content/remote-functions/command
|
|
288
|
-
*/
|
|
289
|
-
export declare const Command: EffectCommandFactory;
|
|
290
|
-
/**
|
|
291
|
-
* v4 flavour of {@link import("../v3/server.js").Form} - define a remote form
|
|
292
|
-
* handler that maps submitted data into an Effect program.
|
|
293
|
-
*
|
|
294
|
-
* @see https://ser.barekey.dev/content/remote-functions/form
|
|
295
|
-
*/
|
|
296
|
-
export declare const Form: EffectFormFactory;
|
|
297
|
-
/**
|
|
298
|
-
* v4 flavour of {@link import("../v3/server.js").Prerender} - define a
|
|
299
|
-
* prerenderable remote function backed by an Effect program.
|
|
300
|
-
*
|
|
301
|
-
* @see https://ser.barekey.dev/content/remote-functions/prerender
|
|
302
|
-
*/
|
|
303
|
-
export declare const Prerender: EffectPrerenderFactory;
|
|
304
|
-
/**
|
|
305
|
-
* v4 Effect `Context.Tag` for the current SvelteKit `RequestEvent`. Shaped
|
|
306
|
-
* like an `Effect` so handlers can `yield* RequestEvent` directly.
|
|
307
|
-
*
|
|
308
|
-
* @see https://ser.barekey.dev/content/runtimes/server
|
|
309
|
-
*/
|
|
310
|
-
export declare const RequestEvent: EffectContextKey<RequestEventService, RequestEventService> & Effect_type.Effect<RequestEventService, never, RequestEventService>;
|
|
311
|
-
/**
|
|
312
|
-
* v4 server-side runtime builder. Equivalent to the v3 builder but typed
|
|
313
|
-
* against the v4 `Layer` operator signature.
|
|
314
|
-
*
|
|
315
|
-
* @see https://ser.barekey.dev/content/reference/server-runtime
|
|
316
|
-
*/
|
|
317
|
-
export declare const ServerRuntime: ServerRuntimeSeed;
|
|
318
|
-
/**
|
|
319
|
-
* Build a devalue transport table from Effect schemas so remote payloads can
|
|
320
|
-
* round-trip custom data across the client/server boundary.
|
|
321
|
-
*
|
|
322
|
-
* @see https://ser.barekey.dev/content/reference/transport
|
|
323
|
-
*/
|
|
324
|
-
export declare const create_effect_transport: typeof base_server.create_effect_transport;
|
|
325
|
-
/**
|
|
326
|
-
* Resolve the active v4 server runtime, lazily creating a default empty
|
|
327
|
-
* runtime when none has been registered.
|
|
328
|
-
*
|
|
329
|
-
* @internal Internal - do not use.
|
|
330
|
-
* @see https://ser.barekey.dev/content/reference/server-runtime
|
|
331
|
-
*/
|
|
332
|
-
export declare const get_server_runtime_or_throw: () => EffectManagedRuntime;
|
|
333
|
-
/**
|
|
334
|
-
* Remap low-level request-store crashes into a clearer setup error when remote
|
|
335
|
-
* helpers are evaluated outside SvelteKit's remote-function runtime.
|
|
336
|
-
*
|
|
337
|
-
* @internal Internal - do not use.
|
|
338
|
-
*/
|
|
339
|
-
export declare const normalize_remote_helper_error: typeof base_server.normalize_remote_helper_error;
|
|
340
|
-
export {};
|
package/dist/v4/server.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { a as make_context_key } from "../chunks/effect-compat-BhW0YPIs.js";
|
|
2
|
-
import { c as get_server_runtime_or_throw$1, i as Query$1, l as normalize_remote_helper_error$1, n as Form$1, o as ServerRuntime$1, r as Prerender$1, s as create_effect_transport$1, t as Command$1 } from "../chunks/server-Dea1CJuY.js";
|
|
3
|
-
//#region v4/server.ts
|
|
4
|
-
/**
|
|
5
|
-
* v4 flavour of {@link import("$/v3/server.ts").Query} - define a read-only
|
|
6
|
-
* remote function returning an Effect.
|
|
7
|
-
*
|
|
8
|
-
* @see https://ser.barekey.dev/content/remote-functions/query
|
|
9
|
-
*/
|
|
10
|
-
const Query = Query$1;
|
|
11
|
-
/**
|
|
12
|
-
* v4 flavour of {@link import("$/v3/server.ts").Command} - define a
|
|
13
|
-
* write-oriented remote function returning an Effect.
|
|
14
|
-
*
|
|
15
|
-
* @see https://ser.barekey.dev/content/remote-functions/command
|
|
16
|
-
*/
|
|
17
|
-
const Command = Command$1;
|
|
18
|
-
/**
|
|
19
|
-
* v4 flavour of {@link import("$/v3/server.ts").Form} - define a remote form
|
|
20
|
-
* handler that maps submitted data into an Effect program.
|
|
21
|
-
*
|
|
22
|
-
* @see https://ser.barekey.dev/content/remote-functions/form
|
|
23
|
-
*/
|
|
24
|
-
const Form = Form$1;
|
|
25
|
-
/**
|
|
26
|
-
* v4 flavour of {@link import("$/v3/server.ts").Prerender} - define a
|
|
27
|
-
* prerenderable remote function backed by an Effect program.
|
|
28
|
-
*
|
|
29
|
-
* @see https://ser.barekey.dev/content/remote-functions/prerender
|
|
30
|
-
*/
|
|
31
|
-
const Prerender = Prerender$1;
|
|
32
|
-
/**
|
|
33
|
-
* v4 Effect `Context.Tag` for the current SvelteKit `RequestEvent`. Shaped
|
|
34
|
-
* like an `Effect` so handlers can `yield* RequestEvent` directly.
|
|
35
|
-
*
|
|
36
|
-
* @see https://ser.barekey.dev/content/runtimes/server
|
|
37
|
-
*/
|
|
38
|
-
const RequestEvent = make_context_key("svelte-effect-runtime/RequestEvent");
|
|
39
|
-
/**
|
|
40
|
-
* v4 server-side runtime builder. Equivalent to the v3 builder but typed
|
|
41
|
-
* against the v4 `Layer` operator signature.
|
|
42
|
-
*
|
|
43
|
-
* @see https://ser.barekey.dev/content/reference/server-runtime
|
|
44
|
-
*/
|
|
45
|
-
const ServerRuntime = ServerRuntime$1;
|
|
46
|
-
/**
|
|
47
|
-
* Build a devalue transport table from Effect schemas so remote payloads can
|
|
48
|
-
* round-trip custom data across the client/server boundary.
|
|
49
|
-
*
|
|
50
|
-
* @see https://ser.barekey.dev/content/reference/transport
|
|
51
|
-
*/
|
|
52
|
-
const create_effect_transport = create_effect_transport$1;
|
|
53
|
-
/**
|
|
54
|
-
* Resolve the active v4 server runtime, lazily creating a default empty
|
|
55
|
-
* runtime when none has been registered.
|
|
56
|
-
*
|
|
57
|
-
* @internal Internal - do not use.
|
|
58
|
-
* @see https://ser.barekey.dev/content/reference/server-runtime
|
|
59
|
-
*/
|
|
60
|
-
const get_server_runtime_or_throw = get_server_runtime_or_throw$1;
|
|
61
|
-
/**
|
|
62
|
-
* Remap low-level request-store crashes into a clearer setup error when remote
|
|
63
|
-
* helpers are evaluated outside SvelteKit's remote-function runtime.
|
|
64
|
-
*
|
|
65
|
-
* @internal Internal - do not use.
|
|
66
|
-
*/
|
|
67
|
-
const normalize_remote_helper_error = normalize_remote_helper_error$1;
|
|
68
|
-
//#endregion
|
|
69
|
-
export { Command, Form, Prerender, Query, RequestEvent, ServerRuntime, create_effect_transport, get_server_runtime_or_throw, normalize_remote_helper_error };
|
|
70
|
-
|
|
71
|
-
//# sourceMappingURL=server.js.map
|
package/dist/v4/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","names":["base_server.Query","base_server.Command","base_server.Form","base_server.Prerender","base_server.ServerRuntime","base_server.create_effect_transport","base_server.get_server_runtime_or_throw","base_server.normalize_remote_helper_error"],"sources":["../../../modules/svelte-effect-runtime/v4/server.ts"],"sourcesContent":["/**\n * v4 server-side entrypoint for `svelte-effect-runtime`.\n *\n * Provides Effect v4-flavoured remote-function helpers and the updated\n * `ServerRuntime` builder whose `RuntimeOperator` signature accepts the\n * v4-style `Layer.provide(...)` operator. Usually consumed indirectly: the\n * Vite plugin rewrites `svelte-effect-runtime/v4` imports inside `.remote.ts`\n * to resolve here at build time.\n *\n * @example\n * ```ts\n * import { Query, ServerRuntime } from \"svelte-effect-runtime/v4/_server\";\n * import { Effect, Layer, Schema } from \"effect\";\n *\n * ServerRuntime.make(Layer.provide(MyServiceLayer));\n *\n * export const hello = Query(Schema.String, (name) =>\n * Effect.succeed(`hello ${name}`)\n * );\n * ```\n *\n * @see https://ser.barekey.dev/content/reference/server-runtime\n *\n * @module\n */\nimport type {\n RemoteForm as SvelteKitRemoteForm,\n RemoteFormInput as SvelteKitRemoteFormInput,\n} from \"@sveltejs/kit\";\nimport type { getRequestEvent as get_native_request_event } from \"$app/server\";\nimport type { Effect as Effect_type, Layer as Layer_type } from \"effect\";\nimport * as base_server from \"$/v3/server.ts\";\nimport type { FormError, RemoteFailure } from \"$internal/remote-shared.ts\";\nimport {\n type EffectContextKey,\n type EffectSchemaLike,\n make_context_key,\n} from \"$internal/effect-compat.ts\";\n\n/**\n * Single entry in a {@link Transport} table. Describes how to encode a value\n * to a wire payload and decode it back.\n *\n * @see https://ser.barekey.dev/content/reference/transport\n */\nexport interface Transporter<T = unknown, U = { value: unknown }> {\n /** Restore the original value from the wire payload. */\n decode: (data: U) => T;\n /**\n * Encode the value to a wire payload, or return `false` when this transporter\n * does not apply to the supplied value.\n */\n encode: (value: T) => false | U;\n}\n\n/**\n * Named collection of {@link Transporter}s used by devalue to round-trip\n * custom types across the client/server boundary.\n *\n * @see https://ser.barekey.dev/content/reference/transport\n */\nexport type Transport = Record<string, Transporter>;\n\n/** Alias for SvelteKit's native remote-form input shape. */\nexport type RemoteFormInput = SvelteKitRemoteFormInput;\n\n/** SvelteKit's native `query` function signature, re-exported for typing. */\nexport type RemoteQueryFunction<Input, Output> = (\n arg: OptionalArgument<Input>,\n) => Promise<Output>;\n\n/** SvelteKit's native `command` shape, re-exported for typing. */\nexport type RemoteCommand<Input, Output> =\n & ((\n arg: OptionalArgument<Input>,\n ) => Promise<Output> & {\n updates(...updates: Array<unknown>): Promise<Output>;\n })\n & {\n readonly pending: number;\n };\n\n/** SvelteKit's native `prerender` function signature, re-exported for typing. */\nexport type RemotePrerenderFunction<Input, Output> = (\n arg: OptionalArgument<Input>,\n) => Promise<Output>;\n\n/** SvelteKit's native `form` shape, re-exported for typing. */\nexport type RemoteForm<Input extends RemoteFormInput | void, Output> =\n SvelteKitRemoteForm<Input, Output>;\n\ntype OptionalArgument<Input> = undefined extends Input ? Input | void : Input;\n\ntype RuntimeOperator = (\n self: Layer_type.Layer<unknown, unknown, unknown>,\n) => Layer_type.Layer<unknown, unknown, unknown>;\n\ntype RuntimeSeedLayer<Requirements> = Layer_type.Layer<\n Requirements,\n never,\n Requirements\n>;\n\ntype ProvidedBy<Op> = Op extends (\n self: RuntimeSeedLayer<infer Requirements>,\n) => Layer_type.Layer<unknown, unknown, infer Incoming>\n ? Exclude<Requirements, Incoming>\n : never;\n\ntype ProvidedByAll<Ops extends ReadonlyArray<RuntimeOperator>> = Ops extends\n readonly [infer Head, ...infer Tail] ?\n | ProvidedBy<Head>\n | ProvidedByAll<Extract<Tail, ReadonlyArray<RuntimeOperator>>>\n : never;\n\ntype ApplyOperator<Seed, Op> = Op extends (self: Seed) => infer Out ? Out\n : never;\n\ntype ApplyOperators<\n Seed,\n Ops extends ReadonlyArray<RuntimeOperator>,\n> = Ops extends readonly [infer Head, ...infer Tail] ? ApplyOperators<\n ApplyOperator<Seed, Head>,\n Extract<Tail, ReadonlyArray<RuntimeOperator>>\n >\n : Seed;\n\ntype FinalRuntimeLayer<Ops extends ReadonlyArray<RuntimeOperator>> =\n ApplyOperators<RuntimeSeedLayer<ProvidedByAll<Ops>>, Ops> extends infer Out\n ? Out extends Layer_type.Layer<unknown, unknown, infer Incoming>\n ? [Incoming] extends [never] ? Out\n : never\n : never\n : never;\n\ntype SchemaInput<SchemaType extends EffectSchemaLike> = SchemaType extends\n { readonly Encoded: infer Input } ? Input\n : never;\n\ntype SchemaOutput<SchemaType extends EffectSchemaLike> = SchemaType extends\n { readonly Type: infer Output } ? Output\n : never;\n\ntype FieldHelpers<FormShape, SchemaType> = FormShape extends\n Record<string, unknown> ? {\n [Key in keyof FormShape as Key extends string ? Key : never]: (\n message: string,\n ) => Effect_type.Effect<never, FormError<SchemaType>, never>;\n }\n : Record<PropertyKey, never>;\n\n/**\n * Proxy passed into v4 `Form` handlers for reporting validation issues. Call\n * `invalid.form(message)` for a top-level issue, or `invalid.<field>(message)`\n * to attach the issue to a specific field.\n *\n * @see https://ser.barekey.dev/content/remote-functions/form\n */\nexport type Invalid<SchemaType = unknown> =\n & {\n /** Attach a top-level form issue with the supplied message. */\n form: (\n message: string,\n ) => Effect_type.Effect<never, FormError<SchemaType>, never>;\n }\n & FieldHelpers<\n SchemaType extends EffectSchemaLike ? SchemaOutput<SchemaType> : unknown,\n SchemaType\n >;\n\n/**\n * v4 shape of an Effect-returning remote `query`. Exposes the underlying\n * SvelteKit function via `native`.\n *\n * @see https://ser.barekey.dev/content/remote-functions/query\n */\nexport type EffectQueryFunction<Input, Output, Error = never> =\n & ((\n arg: OptionalArgument<Input>,\n ) => Effect_type.Effect<\n Output,\n RemoteFailure<Error>,\n never\n >)\n & {\n /** Underlying SvelteKit `query` function, for fallback direct usage. */\n native: RemoteQueryFunction<Input, Output>;\n };\n\n/**\n * v4 shape of an Effect-returning remote `command`. Tracks in-flight\n * submissions via `pending`.\n *\n * @see https://ser.barekey.dev/content/remote-functions/command\n */\nexport type EffectCommand<Input, Output, Error = never> =\n & ((\n arg: OptionalArgument<Input>,\n ) => Effect_type.Effect<\n Output,\n RemoteFailure<Error>,\n never\n >)\n & {\n /** Underlying SvelteKit `command` function, for fallback direct usage. */\n native: RemoteCommand<Input, Output>;\n /** Count of currently in-flight invocations of this command. */\n readonly pending: number;\n };\n\n/**\n * v4 shape of an Effect-returning remote `prerender` function.\n *\n * @see https://ser.barekey.dev/content/remote-functions/prerender\n */\nexport type EffectPrerenderFunction<Input, Output, Error = never> =\n & ((\n arg: OptionalArgument<Input>,\n ) => Effect_type.Effect<\n Output,\n RemoteFailure<Error>,\n never\n >)\n & {\n /** Underlying SvelteKit `prerender` function, for fallback direct usage. */\n native: RemotePrerenderFunction<Input, Output>;\n };\n\n/**\n * v4 shape of an Effect-returning remote `form`. Effect-aware overrides for\n * the surfaces that SvelteKit exposes as Promises: `submit(data)`,\n * `enhance(callback)`, `validate(options?)`, and `for(id)`.\n *\n * @see https://ser.barekey.dev/content/remote-functions/form\n */\nexport type EffectForm<\n Input extends RemoteFormInput | void,\n Output,\n Error = never,\n> =\n & Omit<RemoteForm<Input, Output>, \"enhance\" | \"validate\" | \"for\">\n & {\n /** Underlying SvelteKit `form` object, for fallback direct usage. */\n native: RemoteForm<Input, Output>;\n /** Submit the form programmatically and receive the result as an Effect. */\n submit(\n data: OptionalArgument<Input>,\n ): Effect_type.Effect<\n Output,\n RemoteFailure<Error>,\n never\n >;\n /**\n * Effect-aware version of SvelteKit's `enhance`. The callback receives\n * `submit` as a thunk returning an Effect, and may return an Effect\n * (which the runtime will run for you) or `void`.\n */\n enhance(\n callback: (args: {\n readonly form: HTMLFormElement;\n readonly data: Input;\n readonly submit: () => Effect_type.Effect<\n void,\n RemoteFailure<Error>,\n never\n >;\n }) => Effect_type.Effect<unknown, unknown, never> | void,\n ): {\n method: \"POST\";\n action: string;\n [attachment: symbol]: (node: HTMLFormElement) => void;\n };\n /** Effect-returning version of SvelteKit's `validate`. */\n validate(options?: {\n readonly includeUntouched?: boolean;\n readonly preflightOnly?: boolean;\n }): Effect_type.Effect<void, RemoteFailure<Error>, never>;\n /** Clone the form binding for a specific value - mirrors `RemoteForm.for`. */\n for: RemoteForm<Input, Output>[\"for\"] extends\n (...args: infer Args) => unknown\n ? (...args: Args) => EffectForm<Input, Output, Error>\n : never;\n };\n\n/**\n * v4 type of the SvelteKit `RequestEvent` exposed through the\n * {@link RequestEvent} Effect service.\n */\nexport type RequestEventService = ReturnType<typeof get_native_request_event>;\n\n/**\n * Builder shape returned by {@link ServerRuntime} in the v4 runtime. Accepts\n * v4-style `Layer` operators and installs a singleton `ManagedRuntime`.\n *\n * @see https://ser.barekey.dev/content/reference/server-runtime\n */\nexport interface ServerRuntimeSeed {\n /** Compose operators into a Layer without installing a runtime. */\n pipe(): Layer_type.Layer<never>;\n /** Compose operators into a Layer without installing a runtime. */\n pipe<const Ops extends readonly [RuntimeOperator, ...Array<RuntimeOperator>]>(\n ...ops: Ops\n ): FinalRuntimeLayer<Ops>;\n /** Build and install the singleton server runtime. */\n make(): void;\n /** Build and install the singleton server runtime. */\n make<const Ops extends readonly [RuntimeOperator, ...Array<RuntimeOperator>]>(\n ...ops: Ops\n ): void;\n}\n\n/**\n * Subset of `ManagedRuntime` surface used by generated v4 server wrappers.\n *\n * @internal Internal - do not use.\n */\nexport interface EffectManagedRuntime {\n /** Execute an Effect and resolve with its raw `Exit`. */\n runPromiseExit<A, E, R>(\n effect: Effect_type.Effect<A, E, R>,\n ): Promise<unknown>;\n /** Tear down the runtime and release its root scope. */\n dispose(): Promise<void>;\n}\n\n/**\n * Signature of `Query.batch` in the v4 runtime - kept loosely typed because\n * the v4 server-side implementation delegates to the v3 batch factory.\n *\n * @see https://ser.barekey.dev/content/remote-functions/query\n */\nexport interface EffectQueryBatchFactory {\n /** Build a batched query from validator + handler arguments. */\n (...args: Array<unknown>): unknown;\n}\n\n/**\n * v4 overload set for the {@link Query} factory. Mirrors\n * {@link import(\"$/v3/server.ts\").EffectQueryFactory} using v4 schema-like\n * inference.\n *\n * @see https://ser.barekey.dev/content/remote-functions/query\n */\nexport interface EffectQueryFactory {\n /** Define a void-input query. */\n <Output, Error, Requirements>(\n fn: () => Effect_type.Effect<Output, Error, Requirements>,\n ): EffectQueryFunction<void, Output, Error>;\n /** Define a query that bypasses schema validation. */\n <Input, Output, Error, Requirements>(\n validate: \"unchecked\",\n fn: (arg: Input) => Effect_type.Effect<Output, Error, Requirements>,\n ): EffectQueryFunction<Input, Output, Error>;\n /** Define a query whose input is validated by an Effect.Schema. */\n <SchemaType extends EffectSchemaLike, Output, Error, Requirements>(\n validate: SchemaType,\n fn: (\n arg: SchemaOutput<SchemaType>,\n ) => Effect_type.Effect<Output, Error, Requirements>,\n ): EffectQueryFunction<SchemaInput<SchemaType>, Output, Error>;\n /** Define a batched query - mirrors SvelteKit's `query.batch`. */\n batch: EffectQueryBatchFactory;\n}\n\n/**\n * v4 overload set for the {@link Command} factory.\n *\n * @see https://ser.barekey.dev/content/remote-functions/command\n */\nexport interface EffectCommandFactory {\n /** Define a void-input command. */\n <Output, Error, Requirements>(\n fn: () => Effect_type.Effect<Output, Error, Requirements>,\n ): EffectCommand<void, Output, Error>;\n /** Define a command that bypasses schema validation. */\n <Input, Output, Error, Requirements>(\n validate: \"unchecked\",\n fn: (arg: Input) => Effect_type.Effect<Output, Error, Requirements>,\n ): EffectCommand<Input, Output, Error>;\n /** Define a command whose input is validated by an Effect.Schema. */\n <SchemaType extends EffectSchemaLike, Output, Error, Requirements>(\n validate: SchemaType,\n fn: (\n arg: SchemaOutput<SchemaType>,\n ) => Effect_type.Effect<Output, Error, Requirements>,\n ): EffectCommand<SchemaInput<SchemaType>, Output, Error>;\n}\n\ntype RemotePrerenderInputsGenerator<Input> = (\n event: RequestEventService,\n) => AsyncIterable<Input> | Iterable<Input>;\n\n/**\n * v4 overload set for the {@link Form} factory.\n *\n * @see https://ser.barekey.dev/content/remote-functions/form\n */\nexport interface EffectFormFactory {\n /** Define a form handler with no input data. */\n <Output, Error, Requirements>(\n fn: () => Effect_type.Effect<Output, Error, Requirements>,\n ): EffectForm<void, Output, Error>;\n /** Define a form handler that bypasses schema validation. */\n <Input extends RemoteFormInput, Output, Error, Requirements>(\n validate: \"unchecked\",\n fn: (\n args: {\n data: Input;\n invalid: Invalid;\n },\n ) => Effect_type.Effect<Output, Error | FormError, Requirements>,\n ): EffectForm<Input, Output, Error>;\n /** Define a form handler whose submitted data is validated by a schema. */\n <SchemaType extends EffectSchemaLike, Output, Error, Requirements>(\n validate: SchemaType,\n fn: (\n args: {\n data: SchemaOutput<SchemaType>;\n invalid: Invalid<SchemaType>;\n },\n ) => Effect_type.Effect<\n Output,\n Error | FormError<SchemaType>,\n Requirements\n >,\n ): EffectForm<SchemaInput<SchemaType> & RemoteFormInput, Output, Error>;\n}\n\n/**\n * v4 overload set for the {@link Prerender} factory. Supports the same three\n * validation flavours as the other factories plus a SvelteKit `options` bag\n * with `inputs` / `dynamic` flags.\n *\n * @see https://ser.barekey.dev/content/remote-functions/prerender\n */\nexport interface EffectPrerenderFactory {\n <Output, Error, Requirements>(\n fn: () => Effect_type.Effect<Output, Error, Requirements>,\n options?: {\n inputs?: RemotePrerenderInputsGenerator<void>;\n dynamic?: boolean;\n },\n ): EffectPrerenderFunction<void, Output, Error>;\n <Input, Output, Error, Requirements>(\n validate: \"unchecked\",\n fn: (arg: Input) => Effect_type.Effect<Output, Error, Requirements>,\n options?: {\n inputs?: RemotePrerenderInputsGenerator<Input>;\n dynamic?: boolean;\n },\n ): EffectPrerenderFunction<Input, Output, Error>;\n <SchemaType extends EffectSchemaLike, Output, Error, Requirements>(\n validate: SchemaType,\n fn: (\n arg: SchemaOutput<SchemaType>,\n ) => Effect_type.Effect<Output, Error, Requirements>,\n options?: {\n inputs?: RemotePrerenderInputsGenerator<SchemaInput<SchemaType>>;\n dynamic?: boolean;\n },\n ): EffectPrerenderFunction<SchemaInput<SchemaType>, Output, Error>;\n}\n\n/**\n * v4 flavour of {@link import(\"$/v3/server.ts\").Query} - define a read-only\n * remote function returning an Effect.\n *\n * @see https://ser.barekey.dev/content/remote-functions/query\n */\nexport const Query: EffectQueryFactory = base_server.Query;\n/**\n * v4 flavour of {@link import(\"$/v3/server.ts\").Command} - define a\n * write-oriented remote function returning an Effect.\n *\n * @see https://ser.barekey.dev/content/remote-functions/command\n */\nexport const Command: EffectCommandFactory = base_server.Command;\n/**\n * v4 flavour of {@link import(\"$/v3/server.ts\").Form} - define a remote form\n * handler that maps submitted data into an Effect program.\n *\n * @see https://ser.barekey.dev/content/remote-functions/form\n */\nexport const Form: EffectFormFactory = base_server.Form;\n/**\n * v4 flavour of {@link import(\"$/v3/server.ts\").Prerender} - define a\n * prerenderable remote function backed by an Effect program.\n *\n * @see https://ser.barekey.dev/content/remote-functions/prerender\n */\nexport const Prerender: EffectPrerenderFactory = base_server.Prerender;\n/**\n * v4 Effect `Context.Tag` for the current SvelteKit `RequestEvent`. Shaped\n * like an `Effect` so handlers can `yield* RequestEvent` directly.\n *\n * @see https://ser.barekey.dev/content/runtimes/server\n */\nexport const RequestEvent = make_context_key<\n RequestEventService,\n RequestEventService\n>(\n \"svelte-effect-runtime/RequestEvent\",\n) as\n & EffectContextKey<RequestEventService, RequestEventService>\n & Effect_type.Effect<RequestEventService, never, RequestEventService>;\n/**\n * v4 server-side runtime builder. Equivalent to the v3 builder but typed\n * against the v4 `Layer` operator signature.\n *\n * @see https://ser.barekey.dev/content/reference/server-runtime\n */\nexport const ServerRuntime: ServerRuntimeSeed = base_server.ServerRuntime;\n/**\n * Build a devalue transport table from Effect schemas so remote payloads can\n * round-trip custom data across the client/server boundary.\n *\n * @see https://ser.barekey.dev/content/reference/transport\n */\nexport const create_effect_transport:\n typeof base_server.create_effect_transport =\n base_server.create_effect_transport;\n/**\n * Resolve the active v4 server runtime, lazily creating a default empty\n * runtime when none has been registered.\n *\n * @internal Internal - do not use.\n * @see https://ser.barekey.dev/content/reference/server-runtime\n */\nexport const get_server_runtime_or_throw: () => EffectManagedRuntime =\n base_server.get_server_runtime_or_throw;\n/**\n * Remap low-level request-store crashes into a clearer setup error when remote\n * helpers are evaluated outside SvelteKit's remote-function runtime.\n *\n * @internal Internal - do not use.\n */\nexport const normalize_remote_helper_error =\n base_server.normalize_remote_helper_error;\n"],"mappings":";;;;;;;;;AAqdA,MAAa,QAA4BA;;;;;;;AAOzC,MAAa,UAAgCC;;;;;;;AAO7C,MAAa,OAA0BC;;;;;;;AAOvC,MAAa,YAAoCC;;;;;;;AAOjD,MAAa,eAAe,iBAI1B,qCACD;;;;;;;AASD,MAAa,gBAAmCC;;;;;;;AAOhD,MAAa,0BAETC;;;;;;;;AAQJ,MAAa,8BACXC;;;;;;;AAOF,MAAa,gCACXC"}
|
package/dist/v4/vite.d.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* v4-specific low-level Vite entrypoints for `svelte-effect-runtime`.
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```ts
|
|
6
|
-
* import { sveltekit_effect_runtime } from "svelte-effect-runtime/v4/vite";
|
|
7
|
-
*
|
|
8
|
-
* export default {
|
|
9
|
-
* plugins: [sveltekit_effect_runtime()],
|
|
10
|
-
* };
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* @module
|
|
14
|
-
*/
|
|
15
|
-
import type { Plugin } from "vite";
|
|
16
|
-
import { type SvelteEffectRuntimeOptions, type SveltekitEffectRuntimeOptions } from "../v3/vite.js";
|
|
17
|
-
export type { SvelteEffectRuntimeOptions, SveltekitEffectRuntimeOptions, } from "../v3/vite.js";
|
|
18
|
-
/**
|
|
19
|
-
* Low-level Vite plugin wrapper for non-SvelteKit builds targeting the v4
|
|
20
|
-
* runtime module id.
|
|
21
|
-
*
|
|
22
|
-
* @see https://ser.barekey.dev/content/reference/tooling
|
|
23
|
-
*/
|
|
24
|
-
export declare function svelte_effect_runtime(options?: SvelteEffectRuntimeOptions): Plugin[];
|
|
25
|
-
/**
|
|
26
|
-
* Low-level Vite plugin that swaps SvelteKit's generated remote client module
|
|
27
|
-
* for the Effect-aware adapters used by `effect()` when targeting the v4
|
|
28
|
-
* runtime entry.
|
|
29
|
-
*
|
|
30
|
-
* Prefer `effect()` unless you are assembling a custom Vite plugin stack.
|
|
31
|
-
*
|
|
32
|
-
* @see https://ser.barekey.dev/content/reference/tooling
|
|
33
|
-
*/
|
|
34
|
-
export declare function sveltekit_effect_runtime(options?: SveltekitEffectRuntimeOptions): Plugin;
|
package/dist/v4/vite.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { n as sveltekit_effect_runtime$1, t as svelte_effect_runtime$1 } from "../chunks/vite-Bm2RdiT3.js";
|
|
2
|
-
import { with_v4_effect_preprocess_options } from "./preprocess.js";
|
|
3
|
-
//#region v4/vite.ts
|
|
4
|
-
/**
|
|
5
|
-
* Low-level Vite plugin wrapper for non-SvelteKit builds targeting the v4
|
|
6
|
-
* runtime module id.
|
|
7
|
-
*
|
|
8
|
-
* @see https://ser.barekey.dev/content/reference/tooling
|
|
9
|
-
*/
|
|
10
|
-
function svelte_effect_runtime(options = {}) {
|
|
11
|
-
return svelte_effect_runtime$1({
|
|
12
|
-
...options,
|
|
13
|
-
effect: with_v4_effect_preprocess_options(options.effect)
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Low-level Vite plugin that swaps SvelteKit's generated remote client module
|
|
18
|
-
* for the Effect-aware adapters used by `effect()` when targeting the v4
|
|
19
|
-
* runtime entry.
|
|
20
|
-
*
|
|
21
|
-
* Prefer `effect()` unless you are assembling a custom Vite plugin stack.
|
|
22
|
-
*
|
|
23
|
-
* @see https://ser.barekey.dev/content/reference/tooling
|
|
24
|
-
*/
|
|
25
|
-
function sveltekit_effect_runtime(options = {}) {
|
|
26
|
-
return sveltekit_effect_runtime$1(options);
|
|
27
|
-
}
|
|
28
|
-
//#endregion
|
|
29
|
-
export { svelte_effect_runtime, sveltekit_effect_runtime };
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=vite.js.map
|
package/dist/v4/vite.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","names":["create_svelte_effect_runtime","create_sveltekit_effect_runtime"],"sources":["../../../modules/svelte-effect-runtime/v4/vite.ts"],"sourcesContent":["/**\n * v4-specific low-level Vite entrypoints for `svelte-effect-runtime`.\n *\n * @example\n * ```ts\n * import { sveltekit_effect_runtime } from \"svelte-effect-runtime/v4/vite\";\n *\n * export default {\n * plugins: [sveltekit_effect_runtime()],\n * };\n * ```\n *\n * @module\n */\nimport type { Plugin } from \"vite\";\nimport {\n svelte_effect_runtime as create_svelte_effect_runtime,\n type SvelteEffectRuntimeOptions,\n sveltekit_effect_runtime as create_sveltekit_effect_runtime,\n type SveltekitEffectRuntimeOptions,\n} from \"$/v3/vite.ts\";\nimport { with_v4_effect_preprocess_options } from \"$/v4/preprocess.ts\";\n\nexport type {\n SvelteEffectRuntimeOptions,\n SveltekitEffectRuntimeOptions,\n} from \"$/v3/vite.ts\";\n\n/**\n * Low-level Vite plugin wrapper for non-SvelteKit builds targeting the v4\n * runtime module id.\n *\n * @see https://ser.barekey.dev/content/reference/tooling\n */\nexport function svelte_effect_runtime(\n options: SvelteEffectRuntimeOptions = {},\n): Plugin[] {\n return create_svelte_effect_runtime({\n ...options,\n effect: with_v4_effect_preprocess_options(options.effect),\n });\n}\n\n/**\n * Low-level Vite plugin that swaps SvelteKit's generated remote client module\n * for the Effect-aware adapters used by `effect()` when targeting the v4\n * runtime entry.\n *\n * Prefer `effect()` unless you are assembling a custom Vite plugin stack.\n *\n * @see https://ser.barekey.dev/content/reference/tooling\n */\nexport function sveltekit_effect_runtime(\n options: SveltekitEffectRuntimeOptions = {},\n): Plugin {\n return create_sveltekit_effect_runtime(options);\n}\n"],"mappings":";;;;;;;;;AAkCA,SAAgB,sBACd,UAAsC,EAAE,EAC9B;AACV,QAAOA,wBAA6B;EAClC,GAAG;EACH,QAAQ,kCAAkC,QAAQ,OAAO;EAC1D,CAAC;;;;;;;;;;;AAYJ,SAAgB,yBACd,UAAyC,EAAE,EACnC;AACR,QAAOC,2BAAgC,QAAQ"}
|
package/dist/vite.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public Vite entrypoint wrappers for `svelte-effect-runtime`.
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* ```ts
|
|
6
|
-
* import { sveltekit_effect_runtime } from "svelte-effect-runtime/vite";
|
|
7
|
-
*
|
|
8
|
-
* export default {
|
|
9
|
-
* plugins: [sveltekit_effect_runtime()],
|
|
10
|
-
* };
|
|
11
|
-
* ```
|
|
12
|
-
*
|
|
13
|
-
* @module
|
|
14
|
-
*/
|
|
15
|
-
import type { Plugin } from "vite";
|
|
16
|
-
import { type SvelteEffectRuntimeOptions, type SveltekitEffectRuntimeOptions } from "./v3/vite.js";
|
|
17
|
-
export type { SvelteEffectRuntimeOptions, SveltekitEffectRuntimeOptions, } from "./v3/vite.js";
|
|
18
|
-
/**
|
|
19
|
-
* Compose the low-level Svelte preprocessor directly into a plain Vite +
|
|
20
|
-
* Svelte project.
|
|
21
|
-
*
|
|
22
|
-
* @see https://ser.barekey.dev/content/reference/tooling
|
|
23
|
-
*/
|
|
24
|
-
export declare function svelte_effect_runtime(options?: SvelteEffectRuntimeOptions): Plugin[];
|
|
25
|
-
/**
|
|
26
|
-
* Install the remote-function adapter that rewrites SvelteKit remote helpers
|
|
27
|
-
* to return `Effect` values.
|
|
28
|
-
*
|
|
29
|
-
* @see https://ser.barekey.dev/content/reference/tooling
|
|
30
|
-
*/
|
|
31
|
-
export declare function sveltekit_effect_runtime(options?: SveltekitEffectRuntimeOptions): Plugin;
|
package/dist/vite.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { n as sveltekit_effect_runtime$1, t as svelte_effect_runtime$1 } from "./chunks/vite-Bm2RdiT3.js";
|
|
2
|
-
//#region vite.ts
|
|
3
|
-
/**
|
|
4
|
-
* Compose the low-level Svelte preprocessor directly into a plain Vite +
|
|
5
|
-
* Svelte project.
|
|
6
|
-
*
|
|
7
|
-
* @see https://ser.barekey.dev/content/reference/tooling
|
|
8
|
-
*/
|
|
9
|
-
function svelte_effect_runtime(options) {
|
|
10
|
-
return svelte_effect_runtime$1(options);
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Install the remote-function adapter that rewrites SvelteKit remote helpers
|
|
14
|
-
* to return `Effect` values.
|
|
15
|
-
*
|
|
16
|
-
* @see https://ser.barekey.dev/content/reference/tooling
|
|
17
|
-
*/
|
|
18
|
-
function sveltekit_effect_runtime(options) {
|
|
19
|
-
return sveltekit_effect_runtime$1(options);
|
|
20
|
-
}
|
|
21
|
-
//#endregion
|
|
22
|
-
export { svelte_effect_runtime, sveltekit_effect_runtime };
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=vite.js.map
|
package/dist/vite.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vite.js","names":["create_svelte_effect_runtime","create_sveltekit_effect_runtime"],"sources":["../../modules/svelte-effect-runtime/vite.ts"],"sourcesContent":["/**\n * Public Vite entrypoint wrappers for `svelte-effect-runtime`.\n *\n * @example\n * ```ts\n * import { sveltekit_effect_runtime } from \"svelte-effect-runtime/vite\";\n *\n * export default {\n * plugins: [sveltekit_effect_runtime()],\n * };\n * ```\n *\n * @module\n */\nimport type { Plugin } from \"vite\";\nimport {\n svelte_effect_runtime as create_svelte_effect_runtime,\n type SvelteEffectRuntimeOptions,\n sveltekit_effect_runtime as create_sveltekit_effect_runtime,\n type SveltekitEffectRuntimeOptions,\n} from \"$/v3/vite.ts\";\n\nexport type {\n SvelteEffectRuntimeOptions,\n SveltekitEffectRuntimeOptions,\n} from \"$/v3/vite.ts\";\n\n/**\n * Compose the low-level Svelte preprocessor directly into a plain Vite +\n * Svelte project.\n *\n * @see https://ser.barekey.dev/content/reference/tooling\n */\nexport function svelte_effect_runtime(\n options?: SvelteEffectRuntimeOptions,\n): Plugin[] {\n return create_svelte_effect_runtime(options);\n}\n\n/**\n * Install the remote-function adapter that rewrites SvelteKit remote helpers\n * to return `Effect` values.\n *\n * @see https://ser.barekey.dev/content/reference/tooling\n */\nexport function sveltekit_effect_runtime(\n options?: SveltekitEffectRuntimeOptions,\n): Plugin {\n return create_sveltekit_effect_runtime(options);\n}\n"],"mappings":";;;;;;;;AAiCA,SAAgB,sBACd,SACU;AACV,QAAOA,wBAA6B,QAAQ;;;;;;;;AAS9C,SAAgB,yBACd,SACQ;AACR,QAAOC,2BAAgC,QAAQ"}
|