@thomasfosterau/effect-sveltekit 0.9.0 → 0.9.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/README.md +2 -2
- package/dist/Hooks.d.ts +0 -1
- package/dist/Hooks.js +1 -2
- package/dist/Navigation.d.ts +0 -1
- package/dist/Navigation.js +1 -2
- package/dist/Remote.d.ts +0 -1
- package/dist/Remote.js +1 -2
- package/dist/State.d.ts +0 -1
- package/dist/State.js +1 -2
- package/dist/_virtual/_rolldown/runtime.js +1 -2
- package/dist/adapter/assets.d.ts +0 -2
- package/dist/adapter/assets.js +1 -2
- package/dist/adapter/handler.d.ts +0 -2
- package/dist/adapter/handler.js +1 -2
- package/dist/adapter/index.d.ts +0 -2
- package/dist/adapter/index.js +1 -2
- package/dist/adapter/serve.d.ts +0 -2
- package/dist/adapter/serve.js +1 -2
- package/dist/api-client.d.ts +0 -2
- package/dist/api-client.js +1 -2
- package/dist/app-runtime.d.ts +0 -2
- package/dist/app-runtime.js +1 -2
- package/dist/client/Hooks.d.ts +0 -1
- package/dist/client/Hooks.js +1 -2
- package/dist/config.d.ts +0 -2
- package/dist/config.js +1 -2
- package/dist/errors.d.ts +0 -1
- package/dist/errors.js +1 -2
- package/dist/forms.d.ts +0 -1
- package/dist/forms.js +1 -2
- package/dist/internal/app-state.d.ts +0 -2
- package/dist/internal/app-state.js +3 -3
- package/dist/internal/app-state.js.map +1 -1
- package/dist/internal/auto.d.ts +0 -2
- package/dist/internal/auto.js +1 -2
- package/dist/internal/default-runtime.js +1 -2
- package/dist/internal/enhance.d.ts +0 -2
- package/dist/internal/enhance.js +1 -2
- package/dist/internal/error.d.ts +0 -2
- package/dist/internal/error.js +1 -2
- package/dist/internal/navigation-events.js +1 -2
- package/dist/internal/remote-run.d.ts +0 -2
- package/dist/internal/remote-run.js +1 -2
- package/dist/internal/remote-validators.js +1 -2
- package/dist/internal/route-params.d.ts +0 -2
- package/dist/internal/sse.js +1 -2
- package/dist/internal/stream-callback.js +17 -0
- package/dist/internal/stream-callback.js.map +1 -0
- package/dist/internal/watch.svelte.js +1 -2
- package/dist/kit.d.ts +0 -2
- package/dist/kit.js +1 -2
- package/dist/realtime.d.ts +0 -1
- package/dist/realtime.js +4 -4
- package/dist/realtime.js.map +1 -1
- package/dist/remote-functions.d.ts +0 -2
- package/dist/remote-functions.js +1 -2
- package/dist/remote-reactive.d.ts +0 -2
- package/dist/remote-reactive.js +1 -2
- package/dist/request-parse.d.ts +0 -2
- package/dist/request-parse.js +1 -2
- package/dist/request-runtime.d.ts +0 -2
- package/dist/request-runtime.js +1 -2
- package/dist/request-services.d.ts +0 -2
- package/dist/request-services.js +1 -2
- package/dist/response-headers.d.ts +0 -2
- package/dist/response-headers.js +1 -2
- package/dist/runtime.d.ts +0 -2
- package/dist/runtime.js +1 -2
- package/dist/server/Endpoint.d.ts +0 -1
- package/dist/server/Endpoint.js +1 -2
- package/dist/server/Hooks.d.ts +0 -1
- package/dist/server/Hooks.js +1 -2
- package/dist/server.d.ts +0 -2
- package/dist/server.js +1 -2
- package/dist/streamed-load.d.ts +0 -2
- package/dist/streamed-load.js +1 -2
- package/dist/testing.d.ts +0 -2
- package/dist/testing.js +1 -2
- package/dist/transport.d.ts +0 -2
- package/dist/transport.js +1 -2
- package/dist/universal.d.ts +0 -2
- package/dist/universal.js +1 -2
- package/dist/vite.d.ts +0 -2
- package/dist/vite.js +1 -2
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -18,9 +18,9 @@ pnpm add @thomasfosterau/effect-sveltekit effect svelte @sveltejs/kit
|
|
|
18
18
|
pnpm add @effect/platform-node
|
|
19
19
|
```
|
|
20
20
|
|
|
21
|
-
`effect` (
|
|
21
|
+
`effect` (`^4.0.0`) and `svelte` (`^5.40.0`) are required peers;
|
|
22
22
|
`@sveltejs/kit` (`^3.0.0`), `vite` (for `./vite`) and
|
|
23
|
-
`@effect/platform-node` (
|
|
23
|
+
`@effect/platform-node` (`^4.0.0`, for `./adapter`) are optional. The
|
|
24
24
|
HTTP modules that lived in `@effect/platform` in v3 are part of `effect` itself
|
|
25
25
|
in v4 (`effect/http`), so no other Effect package is needed. Keep a single copy
|
|
26
26
|
of `effect`, and keep `effect` and `@effect/platform-node` on the same
|
package/dist/Hooks.d.ts
CHANGED
|
@@ -27,6 +27,5 @@ export declare function reroute(fn: (event: {
|
|
|
27
27
|
url: URL;
|
|
28
28
|
fetch: typeof globalThis.fetch;
|
|
29
29
|
}) => Effect.Effect<string | void, unknown, HttpClient.HttpClient>): Reroute;
|
|
30
|
-
//#endregion
|
|
31
30
|
export { Hooks_d_exports, type MarkerTransporterOptions, type TransportEntry, markerTransporter, responseHeadersTransporter, transport, transporter };
|
|
32
31
|
//# sourceMappingURL=Hooks.d.ts.map
|
package/dist/Hooks.js
CHANGED
|
@@ -3,7 +3,7 @@ import { defaultUniversalRuntime } from "./internal/default-runtime.js";
|
|
|
3
3
|
import { markerTransporter, transport, transporter } from "./transport.js";
|
|
4
4
|
import { responseHeadersTransporter } from "./response-headers.js";
|
|
5
5
|
import "effect/Effect";
|
|
6
|
-
|
|
6
|
+
// src/Hooks.ts
|
|
7
7
|
var Hooks_exports = /* @__PURE__ */ __exportAll({
|
|
8
8
|
markerTransporter: () => markerTransporter,
|
|
9
9
|
reroute: () => reroute,
|
|
@@ -31,7 +31,6 @@ var Hooks_exports = /* @__PURE__ */ __exportAll({
|
|
|
31
31
|
function reroute(fn) {
|
|
32
32
|
return (event) => defaultUniversalRuntime().runPromise(event.fetch, fn(event));
|
|
33
33
|
}
|
|
34
|
-
//#endregion
|
|
35
34
|
export { Hooks_exports, markerTransporter, reroute, responseHeadersTransporter, transport, transporter };
|
|
36
35
|
|
|
37
36
|
//# sourceMappingURL=Hooks.js.map
|
package/dist/Navigation.d.ts
CHANGED
|
@@ -167,6 +167,5 @@ declare function afterNavigate$1(): Stream.Stream<AfterNavigate>;
|
|
|
167
167
|
* ```
|
|
168
168
|
*/
|
|
169
169
|
declare function onNavigate$1(fn: (navigation: OnNavigate) => Effect.Effect<(() => void) | void>, runEffect?: <X>(effect: Effect.Effect<X>) => Promise<X>): void;
|
|
170
|
-
//#endregion
|
|
171
170
|
export { Navigation_d_exports, afterNavigate$1 as afterNavigate, beforeNavigate$1 as beforeNavigate, goto$1 as goto, invalidate$1 as invalidate, invalidateAll$1 as invalidateAll, onNavigate$1 as onNavigate, preloadCode$1 as preloadCode, preloadData$1 as preloadData, refreshAll$1 as refreshAll };
|
|
172
171
|
//# sourceMappingURL=Navigation.d.ts.map
|
package/dist/Navigation.js
CHANGED
|
@@ -3,7 +3,7 @@ import { onNavigateWith, registeredStream } from "./internal/navigation-events.j
|
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
5
|
import { afterNavigate, beforeNavigate, goto, invalidate, invalidateAll, onNavigate, preloadCode, preloadData, refreshAll } from "$app/navigation";
|
|
6
|
-
|
|
6
|
+
// src/Navigation.ts
|
|
7
7
|
/**
|
|
8
8
|
* Effect wrappers for SvelteKit's client-side
|
|
9
9
|
* [`$app/navigation`](https://svelte.dev/docs/kit/$app-navigation) API.
|
|
@@ -235,7 +235,6 @@ function afterNavigate$1() {
|
|
|
235
235
|
function onNavigate$1(fn, runEffect = Effect.runPromise) {
|
|
236
236
|
onNavigateWith(onNavigate, fn, runEffect);
|
|
237
237
|
}
|
|
238
|
-
//#endregion
|
|
239
238
|
export { NavigationError, Navigation_exports, afterNavigate$1 as afterNavigate, beforeNavigate$1 as beforeNavigate, goto$1 as goto, invalidate$1 as invalidate, invalidateAll$1 as invalidateAll, onNavigate$1 as onNavigate, preloadCode$1 as preloadCode, preloadData$1 as preloadData, refreshAll$1 as refreshAll };
|
|
240
239
|
|
|
241
240
|
//# sourceMappingURL=Navigation.js.map
|
package/dist/Remote.d.ts
CHANGED
|
@@ -121,6 +121,5 @@ export declare function submitFormWithUpdates(submit: RemoteSubmit, ...queries:
|
|
|
121
121
|
* ```
|
|
122
122
|
*/
|
|
123
123
|
export declare function liveQueryStream<Output>(query: RemoteLiveQuery<Output>): Stream.Stream<Output, unknown>;
|
|
124
|
-
//#endregion
|
|
125
124
|
export { Remote_d_exports };
|
|
126
125
|
//# sourceMappingURL=Remote.d.ts.map
|
package/dist/Remote.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __exportAll } from "./_virtual/_rolldown/runtime.js";
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Stream from "effect/Stream";
|
|
4
|
-
|
|
4
|
+
// src/Remote.ts
|
|
5
5
|
var Remote_exports = /* @__PURE__ */ __exportAll({
|
|
6
6
|
callCommand: () => callCommand,
|
|
7
7
|
callCommandWithUpdates: () => callCommandWithUpdates,
|
|
@@ -88,7 +88,6 @@ function submitFormWithUpdates(submit, ...queries) {
|
|
|
88
88
|
function liveQueryStream(query) {
|
|
89
89
|
return Stream.fromAsyncIterable(query, (error) => error);
|
|
90
90
|
}
|
|
91
|
-
//#endregion
|
|
92
91
|
export { Remote_exports, callCommand, callCommandWithUpdates, callPrerender, callQuery, liveQueryStream, submitForm, submitFormWithUpdates };
|
|
93
92
|
|
|
94
93
|
//# sourceMappingURL=Remote.js.map
|
package/dist/State.d.ts
CHANGED
|
@@ -83,6 +83,5 @@ export declare class CurrentPage extends CurrentPage_base {
|
|
|
83
83
|
*/
|
|
84
84
|
static readonly layer: Layer.Layer<CurrentPage>;
|
|
85
85
|
}
|
|
86
|
-
//#endregion
|
|
87
86
|
export { type NavigatingSnapshot, type PageSnapshot, State_d_exports, UpdateCheckError, navigating$1 as navigating, page$1 as page, updated$1 as updated };
|
|
88
87
|
//# sourceMappingURL=State.d.ts.map
|
package/dist/State.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as Context from "effect/Context";
|
|
|
5
5
|
import * as Layer from "effect/Layer";
|
|
6
6
|
import { afterNavigate } from "$app/navigation";
|
|
7
7
|
import { navigating, page, updated } from "$app/state";
|
|
8
|
-
|
|
8
|
+
// src/State.ts
|
|
9
9
|
/**
|
|
10
10
|
* An Effect-side bridge for SvelteKit's
|
|
11
11
|
* [`$app/state`](https://svelte.dev/docs/kit/$app-state): `page`, `navigating`
|
|
@@ -149,7 +149,6 @@ var CurrentPage = class CurrentPage extends Context.Service()("@thomasfosterau/e
|
|
|
149
149
|
*/
|
|
150
150
|
static layer = Layer.succeed(CurrentPage, makeCurrentPage(() => page, watch));
|
|
151
151
|
};
|
|
152
|
-
//#endregion
|
|
153
152
|
export { CurrentPage, State_exports, UpdateCheckError, checkForUpdate, navigating$1 as navigating, page$1 as page, updated$1 as updated };
|
|
154
153
|
|
|
155
154
|
//# sourceMappingURL=State.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// \0rolldown/runtime.js
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __exportAll = (all, no_symbols) => {
|
|
4
4
|
let target = {};
|
|
@@ -9,5 +9,4 @@ var __exportAll = (all, no_symbols) => {
|
|
|
9
9
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
10
10
|
return target;
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { __exportAll };
|
package/dist/adapter/assets.d.ts
CHANGED
|
@@ -5,7 +5,6 @@ import * as Path from "effect/Path";
|
|
|
5
5
|
import * as HttpPlatform from "effect/http/HttpPlatform";
|
|
6
6
|
import * as Option from "effect/Option";
|
|
7
7
|
import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
8
|
-
//#region src/adapter/assets.d.ts
|
|
9
8
|
/**
|
|
10
9
|
* A source of static assets. `serveAsset` returns the response for an asset
|
|
11
10
|
* request, or `Option.none()` when the request is not an asset (so the SSR core
|
|
@@ -47,6 +46,5 @@ export declare const AssetSource: {
|
|
|
47
46
|
fetch: (request: Request) => Promise<Response> | Response;
|
|
48
47
|
}) => AssetSource;
|
|
49
48
|
};
|
|
50
|
-
//#endregion
|
|
51
49
|
export {};
|
|
52
50
|
//# sourceMappingURL=assets.d.ts.map
|
package/dist/adapter/assets.js
CHANGED
|
@@ -7,7 +7,7 @@ import "effect/http/HttpPlatform";
|
|
|
7
7
|
import * as Option from "effect/Option";
|
|
8
8
|
import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
9
9
|
import * as HashSet from "effect/HashSet";
|
|
10
|
-
|
|
10
|
+
// src/adapter/assets.ts
|
|
11
11
|
/**
|
|
12
12
|
* Pluggable asset serving for the Effect SvelteKit adapter.
|
|
13
13
|
*
|
|
@@ -102,7 +102,6 @@ const AssetSource = {
|
|
|
102
102
|
fileSystem,
|
|
103
103
|
cloudflareAssets
|
|
104
104
|
};
|
|
105
|
-
//#endregion
|
|
106
105
|
export { AssetFetchError, AssetSource, cloudflareAssets, fileSystem };
|
|
107
106
|
|
|
108
107
|
//# sourceMappingURL=assets.js.map
|
|
@@ -5,7 +5,6 @@ import { Server } from "@sveltejs/kit";
|
|
|
5
5
|
import * as Schema from "effect/Schema";
|
|
6
6
|
import * as HttpServerRequest from "effect/http/HttpServerRequest";
|
|
7
7
|
import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
8
|
-
//#region src/adapter/handler.d.ts
|
|
9
8
|
/**
|
|
10
9
|
* The services required by the SvelteKit HTTP application when serving assets
|
|
11
10
|
* from the file system (the Node default). All of them are provided by
|
|
@@ -144,6 +143,5 @@ export declare const makeHandlerWith: <RAssets = never>(options: SvelteKitNeutra
|
|
|
144
143
|
* ```
|
|
145
144
|
*/
|
|
146
145
|
export declare const toWebHandler: <RAssets, E>(app: Effect.Effect<SvelteKitHttpApp<RAssets>, never, never>, layer: Layer.Layer<RAssets, E>) => ((request: Request) => Promise<Response>);
|
|
147
|
-
//#endregion
|
|
148
146
|
export { AssetFetchError, AssetSource, type FileSystemAssetServices };
|
|
149
147
|
//# sourceMappingURL=handler.d.ts.map
|
package/dist/adapter/handler.js
CHANGED
|
@@ -13,7 +13,7 @@ import * as HttpMethod from "effect/http/HttpMethod";
|
|
|
13
13
|
import * as HttpServerRequest from "effect/http/HttpServerRequest";
|
|
14
14
|
import * as HttpServerResponse from "effect/http/HttpServerResponse";
|
|
15
15
|
import * as Config from "effect/Config";
|
|
16
|
-
|
|
16
|
+
// src/adapter/handler.ts
|
|
17
17
|
/** Runtime configuration, read from the environment (compatible with adapter-node). */
|
|
18
18
|
const handlerConfig = (prefix) => Config.all({
|
|
19
19
|
origin: Config.option(Config.String(`${prefix}ORIGIN`)),
|
|
@@ -206,7 +206,6 @@ const toWebHandler = (app, layer) => {
|
|
|
206
206
|
const build = () => built ??= Effect.runPromise(app).then((inner) => HttpEffect.toWebHandlerLayer(inner, layer).handler);
|
|
207
207
|
return async (request) => (await build())(request);
|
|
208
208
|
};
|
|
209
|
-
//#endregion
|
|
210
209
|
export { AssetFetchError, AssetSource, SvelteKitServerError, makeHandler, makeHandlerWith, toWebHandler };
|
|
211
210
|
|
|
212
211
|
//# sourceMappingURL=handler.js.map
|
package/dist/adapter/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Adapter } from "@sveltejs/kit";
|
|
2
|
-
//#region src/adapter/index.d.ts
|
|
3
2
|
/** Options for {@link effectAdapter}. */
|
|
4
3
|
export interface EffectAdapterOptions {
|
|
5
4
|
/**
|
|
@@ -39,6 +38,5 @@ export interface EffectAdapterOptions {
|
|
|
39
38
|
* Creates the Effect SvelteKit adapter.
|
|
40
39
|
*/
|
|
41
40
|
export declare function effectAdapter(options?: EffectAdapterOptions): Adapter;
|
|
42
|
-
//#endregion
|
|
43
41
|
export { effectAdapter as default };
|
|
44
42
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/adapter/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
-
|
|
2
|
+
// src/adapter/index.ts
|
|
3
3
|
/**
|
|
4
4
|
* Effect deployment adapter for SvelteKit.
|
|
5
5
|
*
|
|
@@ -141,7 +141,6 @@ function effectAdapter(options = {}) {
|
|
|
141
141
|
supports: { read: () => target !== "fetch" }
|
|
142
142
|
};
|
|
143
143
|
}
|
|
144
|
-
//#endregion
|
|
145
144
|
export { effectAdapter as default, effectAdapter };
|
|
146
145
|
|
|
147
146
|
//# sourceMappingURL=index.js.map
|
package/dist/adapter/serve.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { SvelteKitHttpApp } from "./handler.js";
|
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import * as Layer from "effect/Layer";
|
|
4
4
|
import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
|
|
5
|
-
//#region src/adapter/serve.d.ts
|
|
6
5
|
/** Options for {@link serve} and {@link layer}. */
|
|
7
6
|
export interface ServeOptions {
|
|
8
7
|
/** Prefix for the configuration environment variables (PORT, HOST, ...). */
|
|
@@ -42,6 +41,5 @@ type NodeHttpServerServices = Layer.Success<ReturnType<typeof NodeHttpServer.lay
|
|
|
42
41
|
* ```
|
|
43
42
|
*/
|
|
44
43
|
export declare const serve: (handler: Effect.Effect<SvelteKitHttpApp, never, NodeHttpServerServices>, options?: ServeOptions) => void;
|
|
45
|
-
//#endregion
|
|
46
44
|
export {};
|
|
47
45
|
//# sourceMappingURL=serve.d.ts.map
|
package/dist/adapter/serve.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as HttpMiddleware from "effect/http/HttpMiddleware";
|
|
|
6
6
|
import * as HttpServer from "effect/http/HttpServer";
|
|
7
7
|
import * as NodeHttpServer from "@effect/platform-node/NodeHttpServer";
|
|
8
8
|
import * as NodeRuntime from "@effect/platform-node/NodeRuntime";
|
|
9
|
-
|
|
9
|
+
// src/adapter/serve.ts
|
|
10
10
|
/**
|
|
11
11
|
* Production server entry for the Effect SvelteKit adapter.
|
|
12
12
|
*
|
|
@@ -53,7 +53,6 @@ const layer = (handler, options = {}) => {
|
|
|
53
53
|
const serve = (handler, options = {}) => {
|
|
54
54
|
NodeRuntime.runMain(Layer.launch(layer(handler, options)));
|
|
55
55
|
};
|
|
56
|
-
//#endregion
|
|
57
56
|
export { layer, serve };
|
|
58
57
|
|
|
59
58
|
//# sourceMappingURL=serve.js.map
|
package/dist/api-client.d.ts
CHANGED
|
@@ -3,7 +3,6 @@ import * as HttpClient from "effect/http/HttpClient";
|
|
|
3
3
|
import * as HttpApiClient from "effect/http-api/HttpApiClient";
|
|
4
4
|
import * as HttpApi from "effect/http-api/HttpApi";
|
|
5
5
|
import * as HttpApiGroup from "effect/http-api/HttpApiGroup";
|
|
6
|
-
//#region src/api-client.d.ts
|
|
7
6
|
/** Options for {@link apiClient}. */
|
|
8
7
|
export interface ApiClientOptions {
|
|
9
8
|
/**
|
|
@@ -26,5 +25,4 @@ export interface ApiClientOptions {
|
|
|
26
25
|
* requirement is any client middleware the API declares.
|
|
27
26
|
*/
|
|
28
27
|
export declare const apiClient: <ApiId extends string, Groups extends HttpApiGroup.Constraint>(api: HttpApi.HttpApi<ApiId, Groups>, options?: ApiClientOptions) => Effect.Effect<HttpApiClient.Client<Groups>, never, HttpApiGroup.MiddlewareClient<Groups>>;
|
|
29
|
-
//#endregion
|
|
30
28
|
//# sourceMappingURL=api-client.d.ts.map
|
package/dist/api-client.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as Effect from "effect/Effect";
|
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
3
|
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
4
4
|
import * as HttpApiClient from "effect/http-api/HttpApiClient";
|
|
5
|
-
|
|
5
|
+
// src/api-client.ts
|
|
6
6
|
/**
|
|
7
7
|
* A typed client for an Effect [`HttpApi`](https://effect.website) served by
|
|
8
8
|
* {@link Endpoint.fromApi}, closing the serve↔consume loop.
|
|
@@ -39,7 +39,6 @@ const apiClient = (api, options) => {
|
|
|
39
39
|
transformClient: options?.transformClient
|
|
40
40
|
}).pipe(Effect.provide(fetchLayer));
|
|
41
41
|
};
|
|
42
|
-
//#endregion
|
|
43
42
|
export { apiClient };
|
|
44
43
|
|
|
45
44
|
//# sourceMappingURL=api-client.js.map
|
package/dist/app-runtime.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ import * as HttpClient from "effect/http/HttpClient";
|
|
|
10
10
|
import { Action, Actions, Load, RequestEvent, ServerLoad } from "@sveltejs/kit";
|
|
11
11
|
import { Handle, HandleFetch, HandleServerError, ServerInit } from "@sveltejs/kit/hooks";
|
|
12
12
|
import * as Fiber from "effect/Fiber";
|
|
13
|
-
//#region src/app-runtime.d.ts
|
|
14
13
|
/**
|
|
15
14
|
* The services provided to every wrapped effect on the server, in addition to
|
|
16
15
|
* the application's own layer.
|
|
@@ -229,5 +228,4 @@ export interface UniversalRuntime<R = never, E = never> {
|
|
|
229
228
|
* ```
|
|
230
229
|
*/
|
|
231
230
|
export declare const makeUniversalRuntime: <R = never, E = never>(layer?: Layer.Layer<R, E>) => UniversalRuntime<R, E>;
|
|
232
|
-
//#endregion
|
|
233
231
|
//# sourceMappingURL=app-runtime.d.ts.map
|
package/dist/app-runtime.js
CHANGED
|
@@ -11,7 +11,7 @@ import * as Rec from "effect/Record";
|
|
|
11
11
|
import * as Result from "effect/Result";
|
|
12
12
|
import * as Scope from "effect/Scope";
|
|
13
13
|
import * as FetchHttpClient from "effect/http/FetchHttpClient";
|
|
14
|
-
|
|
14
|
+
// src/app-runtime.ts
|
|
15
15
|
/**
|
|
16
16
|
* Symbol under which a {@link ServerRuntime}'s `handle` stores the per-request
|
|
17
17
|
* {@link RequestRuntime} on `event.locals`. `Symbol.for` so the key is stable
|
|
@@ -182,7 +182,6 @@ const makeUniversalRuntime = (layer) => {
|
|
|
182
182
|
dispose: () => runtime.dispose()
|
|
183
183
|
};
|
|
184
184
|
};
|
|
185
|
-
//#endregion
|
|
186
185
|
export { makeServerRuntime, makeUniversalRuntime };
|
|
187
186
|
|
|
188
187
|
//# sourceMappingURL=app-runtime.js.map
|
package/dist/client/Hooks.d.ts
CHANGED
package/dist/client/Hooks.js
CHANGED
|
@@ -2,7 +2,7 @@ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
|
|
|
2
2
|
import { causeToThrowable } from "../internal/error.js";
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Exit from "effect/Exit";
|
|
5
|
-
|
|
5
|
+
// src/client/Hooks.ts
|
|
6
6
|
var Hooks_exports = /* @__PURE__ */ __exportAll({
|
|
7
7
|
handleError: () => handleError,
|
|
8
8
|
init: () => init
|
|
@@ -56,7 +56,6 @@ function handleError(fn) {
|
|
|
56
56
|
function init(effect) {
|
|
57
57
|
return () => runBareHook(effect);
|
|
58
58
|
}
|
|
59
|
-
//#endregion
|
|
60
59
|
export { Hooks_exports, handleError, init };
|
|
61
60
|
|
|
62
61
|
//# sourceMappingURL=Hooks.js.map
|
package/dist/config.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import * as Effect from "effect/Effect";
|
|
|
2
2
|
import * as Layer from "effect/Layer";
|
|
3
3
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
4
4
|
import * as Config from "effect/Config";
|
|
5
|
-
//#region src/config.d.ts
|
|
6
5
|
/**
|
|
7
6
|
* Creates a {@link ConfigProvider} backed by a SvelteKit env record (e.g. the
|
|
8
7
|
* `env` export of `$env/dynamic/private`, or `import.meta.env`-style objects).
|
|
@@ -45,5 +44,4 @@ export declare const sveltekitConfig: (env: Record<string, string | undefined>)
|
|
|
45
44
|
* ```
|
|
46
45
|
*/
|
|
47
46
|
export declare const readConfig: <A>(env: Record<string, string | undefined>, config: Config.Config<A>) => Effect.Effect<A, Config.ConfigError>;
|
|
48
|
-
//#endregion
|
|
49
47
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.js
CHANGED
|
@@ -2,7 +2,7 @@ import * as Effect from "effect/Effect";
|
|
|
2
2
|
import * as Predicate from "effect/Predicate";
|
|
3
3
|
import * as Rec from "effect/Record";
|
|
4
4
|
import * as ConfigProvider from "effect/ConfigProvider";
|
|
5
|
-
|
|
5
|
+
// src/config.ts
|
|
6
6
|
/** Drop `undefined` values so the record satisfies `ConfigProvider.fromEnv`. */
|
|
7
7
|
const definedEntries = (env) => Rec.filter(env, Predicate.isNotUndefined);
|
|
8
8
|
/**
|
|
@@ -47,7 +47,6 @@ const sveltekitConfig = (env) => ConfigProvider.layer(sveltekitConfigProvider(en
|
|
|
47
47
|
* ```
|
|
48
48
|
*/
|
|
49
49
|
const readConfig = (env, config) => Effect.provide(config, sveltekitConfig(env));
|
|
50
|
-
//#endregion
|
|
51
50
|
export { readConfig, sveltekitConfig, sveltekitConfigProvider };
|
|
52
51
|
|
|
53
52
|
//# sourceMappingURL=config.js.map
|
package/dist/errors.d.ts
CHANGED
|
@@ -81,6 +81,5 @@ export declare const rethrowSquashed: KitErrorTranslator;
|
|
|
81
81
|
* ```
|
|
82
82
|
*/
|
|
83
83
|
export declare const toSvelteKit: <E extends Tagged = Tagged>(catalogue: Catalogue<E>, options?: ToSvelteKitOptions) => KitErrorTranslator;
|
|
84
|
-
//#endregion
|
|
85
84
|
export { errors_d_exports };
|
|
86
85
|
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.js
CHANGED
|
@@ -4,7 +4,7 @@ import { SvelteKit } from "./kit.js";
|
|
|
4
4
|
import * as Predicate from "effect/Predicate";
|
|
5
5
|
import { redirect } from "@sveltejs/kit";
|
|
6
6
|
import * as Cause from "effect/Cause";
|
|
7
|
-
|
|
7
|
+
// src/errors.ts
|
|
8
8
|
/**
|
|
9
9
|
* A `translateError` built from a **tagged-error catalogue** instead of a
|
|
10
10
|
* hand-written switch.
|
|
@@ -129,7 +129,6 @@ const toSvelteKit = (catalogue, options = {}) => {
|
|
|
129
129
|
return fallback(cause);
|
|
130
130
|
};
|
|
131
131
|
};
|
|
132
|
-
//#endregion
|
|
133
132
|
export { errors_exports, rethrowSquashed, toSvelteKit };
|
|
134
133
|
|
|
135
134
|
//# sourceMappingURL=errors.js.map
|
package/dist/forms.d.ts
CHANGED
|
@@ -86,6 +86,5 @@ declare const applyAction$1: <Success extends Record<string, unknown> | undefine
|
|
|
86
86
|
* Effect. Wraps `$app/forms`' `deserialize`; a malformed body fails the effect.
|
|
87
87
|
*/
|
|
88
88
|
declare const deserialize$1: <Success extends Record<string, unknown> | undefined = Record<string, unknown>, Failure extends Record<string, unknown> | undefined = Record<string, unknown>>(result: string) => Effect.Effect<ActionResult<Success, Failure>, unknown>;
|
|
89
|
-
//#endregion
|
|
90
89
|
export { type EnhanceHandlers, type EnhanceOptions, type EnhanceOptionsArgs, type EnhanceRuntime, type ResultOptions, type SubmitInput, applyAction$1 as applyAction, deserialize$1 as deserialize, forms_d_exports };
|
|
91
90
|
//# sourceMappingURL=forms.d.ts.map
|
package/dist/forms.js
CHANGED
|
@@ -3,7 +3,7 @@ import { makeSubmitFunction } from "./internal/enhance.js";
|
|
|
3
3
|
import * as Effect from "effect/Effect";
|
|
4
4
|
import * as Schema from "effect/Schema";
|
|
5
5
|
import { applyAction, deserialize } from "$app/forms";
|
|
6
|
-
|
|
6
|
+
// src/forms.ts
|
|
7
7
|
/**
|
|
8
8
|
* Effect bridge for SvelteKit's native form actions
|
|
9
9
|
* ([`$app/forms`](https://svelte.dev/docs/kit/$app-forms)) — the `Forms`
|
|
@@ -124,7 +124,6 @@ const deserialize$1 = (result) => Effect.try({
|
|
|
124
124
|
try: () => deserialize(result),
|
|
125
125
|
catch: (error) => error
|
|
126
126
|
});
|
|
127
|
-
//#endregion
|
|
128
127
|
export { ApplyActionError, applyAction$1 as applyAction, deserialize$1 as deserialize, enhance, forms_exports };
|
|
129
128
|
|
|
130
129
|
//# sourceMappingURL=forms.js.map
|
|
@@ -3,7 +3,6 @@ import * as Stream from "effect/Stream";
|
|
|
3
3
|
import * as Schema from "effect/Schema";
|
|
4
4
|
import { NavigationTarget, NavigationType } from "$app/navigation";
|
|
5
5
|
import "effect/Option";
|
|
6
|
-
//#region src/internal/app-state.d.ts
|
|
7
6
|
/**
|
|
8
7
|
* The fields of SvelteKit's `page` we snapshot. Mirrors the shape of
|
|
9
8
|
* `@sveltejs/kit`'s `Page`, but as a plain readonly record rather than the live
|
|
@@ -70,6 +69,5 @@ export interface CurrentPageService<P extends ReadonlyPage = ReadonlyPage> {
|
|
|
70
69
|
/** The current page, then a fresh snapshot whenever any of its fields changes. */
|
|
71
70
|
readonly changes: Stream.Stream<PageSnapshot<P>>;
|
|
72
71
|
}
|
|
73
|
-
//#endregion
|
|
74
72
|
export {};
|
|
75
73
|
//# sourceMappingURL=app-state.d.ts.map
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { failQueueOnSetupError } from "./stream-callback.js";
|
|
1
2
|
import * as Effect from "effect/Effect";
|
|
2
3
|
import * as Stream from "effect/Stream";
|
|
3
4
|
import * as Schema from "effect/Schema";
|
|
4
5
|
import * as Queue from "effect/Queue";
|
|
5
6
|
import * as Option from "effect/Option";
|
|
6
|
-
|
|
7
|
+
// src/internal/app-state.ts
|
|
7
8
|
/**
|
|
8
9
|
* Builds a shallow snapshot of the `page` fields that matter. We copy the
|
|
9
10
|
* fields rather than forwarding the live `$app/state` proxy so downstream Effect
|
|
@@ -49,7 +50,7 @@ function pageSnapshotStream(registerAfterNavigate, readPage) {
|
|
|
49
50
|
function watchedStream(watch, read) {
|
|
50
51
|
return Stream.callback((queue) => Effect.acquireRelease(Effect.sync(() => watch(read, (value) => {
|
|
51
52
|
Queue.offerUnsafe(queue, value);
|
|
52
|
-
})), (dispose) => Effect.sync(dispose)));
|
|
53
|
+
})), (dispose) => Effect.sync(dispose)).pipe(failQueueOnSetupError(queue)));
|
|
53
54
|
}
|
|
54
55
|
/**
|
|
55
56
|
* Copies `navigating` into a plain {@link NavigatingSnapshot}, or `None` when
|
|
@@ -95,7 +96,6 @@ function makeCurrentPage(readPage, watch) {
|
|
|
95
96
|
changes: watchedStream(watch, read)
|
|
96
97
|
};
|
|
97
98
|
}
|
|
98
|
-
//#endregion
|
|
99
99
|
export { UpdateCheckError, checkForUpdateWith, makeCurrentPage, pageSnapshotStream, snapshotNavigating, snapshotPage, watchedStream };
|
|
100
100
|
|
|
101
101
|
//# sourceMappingURL=app-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-state.js","names":[],"sources":["../../src/internal/app-state.ts"],"sourcesContent":["/**\n * Pure, `$app/*`-free core for the `$app/state` bridge in `../State.ts`.\n *\n * The public helpers can't be unit-tested in plain Node because importing them\n * pulls in `$app/navigation` and `$app/state` (SvelteKit virtual modules that\n * only exist inside a build). The snapshotting, the \"emit now, then after each\n * navigation\" plumbing and the watch-to-`Stream` bridge live here instead,\n * parameterised over the navigation registrar, a {@link Watch} function and\n * read thunks, so they can be driven with stand-ins in tests while the public\n * wrappers stay thin pass-throughs. The only runes code is `watch.svelte.ts`.\n *\n * @internal\n */\n\nimport type { NavigationTarget, NavigationType } from \"$app/navigation\";\nimport * as Schema from \"effect/Schema\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport * as Queue from \"effect/Queue\";\nimport * as Stream from \"effect/Stream\";\n\n/**\n * The fields of SvelteKit's `page` we snapshot. Mirrors the shape of\n * `@sveltejs/kit`'s `Page`, but as a plain readonly record rather than the live\n * mutating proxy.\n */\nexport interface PageSnapshot<P extends ReadonlyPage = ReadonlyPage> {\n readonly url: P[\"url\"];\n readonly params: P[\"params\"];\n readonly route: P[\"route\"];\n readonly status: P[\"status\"];\n readonly error: P[\"error\"];\n readonly data: P[\"data\"];\n readonly state: P[\"state\"];\n readonly form: P[\"form\"];\n readonly shallow: P[\"shallow\"];\n}\n\n/**\n * The subset of `Page` fields the snapshot reads. Deliberately loose (the value\n * types are `unknown` / broad) so SvelteKit's `Page` — whose `params` / `data`\n * / `error` / `state` are app-specific — satisfies the constraint, while\n * `PageSnapshot<P>` recovers the precise field types from `P`.\n */\nexport interface ReadonlyPage {\n // SvelteKit 3 types `page.url` as an immutable `ReadonlyURL` (from\n // `$app/state`); everything but `searchParams` is enough here.\n readonly url: Readonly<Omit<URL, \"searchParams\">>;\n readonly params: Record<string, string | undefined>;\n readonly route: { readonly id: string | null };\n readonly status: number;\n readonly error: unknown;\n readonly data: App.PageData;\n readonly state: unknown;\n readonly form: unknown;\n // SvelteKit 3: the target of the current shallow navigation, or `null`.\n readonly shallow: unknown;\n}\n\n/**\n * Builds a shallow snapshot of the `page` fields that matter. We copy the\n * fields rather than forwarding the live `$app/state` proxy so downstream Effect\n * consumers see a stable value (the proxy mutates in place on every\n * navigation, which would make a captured reference unreliable). Nested values\n * (`url`, `data`, ...) are *not* deep-cloned: they're replaced wholesale on each\n * navigation, so a shallow copy is enough to distinguish snapshots.\n */\nexport function snapshotPage<P extends ReadonlyPage>(page: P): PageSnapshot<P> {\n return {\n url: page.url,\n params: page.params,\n route: page.route,\n status: page.status,\n error: page.error,\n data: page.data,\n state: page.state,\n form: page.form,\n shallow: page.shallow,\n };\n}\n\n/**\n * Emits a snapshot of `readPage()` immediately, then again every time\n * `registerAfterNavigate`'s callback fires (i.e. after each navigation). Backed\n * by an unbounded queue, exposed as a `Stream` — the same push bridge as the\n * navigation-event helpers.\n */\nexport function pageSnapshotStream<P extends ReadonlyPage>(\n registerAfterNavigate: (callback: () => void) => void,\n readPage: () => P,\n): Stream.Stream<PageSnapshot<P>> {\n const queue = Effect.runSync(Queue.unbounded<PageSnapshot<P>>());\n // Initial value: the current page, so consumers start from a known state.\n Queue.offerUnsafe(queue, snapshotPage(readPage()));\n // afterNavigate fires once on mount too, but emitting up front means a\n // late-subscribing consumer still sees the current page without waiting for a\n // navigation.\n registerAfterNavigate(() => {\n Queue.offerUnsafe(queue, snapshotPage(readPage()));\n });\n return Stream.fromQueue(queue);\n}\n\n// ─── Watching rune state ─────────────────────────────────────────────────────\n\n/**\n * Observes a reactive read: calls `onValue` with `read()` once, then again\n * whenever something `read` touched changes, until the returned disposer runs.\n * The real implementation is `watch` in `./watch.svelte.ts`.\n */\nexport type Watch = <A>(read: () => A, onValue: (value: A) => void) => () => void;\n\n/**\n * A `Stream` of `read()`: the current value, then a new one each time `watch`\n * reports a change. Cold and lazy — each run opens its own watcher and disposes\n * it when the stream ends or is interrupted. Never fails; a throwing `watch`\n * surfaces as a defect (the stream dies with what it threw, with no watcher\n * left to dispose).\n */\nexport function watchedStream<A>(watch: Watch, read: () => A): Stream.Stream<A> {\n return Stream.callback<A>((queue) =>\n Effect.acquireRelease(\n Effect.sync(() =>\n watch(read, (value) => {\n Queue.offerUnsafe(queue, value);\n }),\n ),\n (dispose) => Effect.sync(dispose),\n ),\n );\n}\n\n// ─── navigating ──────────────────────────────────────────────────────────────\n\n/**\n * A snapshot of an in-flight SvelteKit navigation, as `$app/state`'s\n * `navigating` exposes it. `delta` is the history step count for a `popstate`\n * navigation and `null` otherwise; `complete` resolves when the navigation\n * finishes and rejects if it fails or is aborted.\n */\nexport interface NavigatingSnapshot {\n readonly type: Exclude<NavigationType, \"enter\">;\n readonly from: NavigationTarget | null;\n readonly to: NavigationTarget | null;\n readonly willUnload: boolean;\n readonly delta: number | null;\n readonly complete: Promise<void>;\n}\n\n/**\n * The shape of `$app/state`'s `navigating`: every field is `null` while no\n * navigation is in flight.\n */\nexport interface ReadonlyNavigating {\n readonly type: NavigatingSnapshot[\"type\"] | null;\n readonly from: NavigationTarget | null;\n readonly to: NavigationTarget | null;\n readonly willUnload: boolean | null;\n readonly delta?: number | null | undefined;\n readonly complete: Promise<void> | null;\n}\n\n/**\n * Copies `navigating` into a plain {@link NavigatingSnapshot}, or `None` when\n * no navigation is in flight (`type` is `null`). Reads every field, so a\n * watcher tracks the whole object.\n */\nexport function snapshotNavigating(\n navigating: ReadonlyNavigating,\n): Option.Option<NavigatingSnapshot> {\n const { type, from, to, willUnload, delta, complete } = navigating;\n if (type === null || willUnload === null || complete === null) return Option.none();\n return Option.some({ type, from, to, willUnload, delta: delta ?? null, complete });\n}\n\n// ─── updated ─────────────────────────────────────────────────────────────────\n\n/**\n * `updated.check()` rejected. SvelteKit resolves `false` when the version\n * request fails, so this signals misuse (e.g. calling it during server\n * rendering, where there is no `window`) rather than a network error.\n */\nexport class UpdateCheckError extends Schema.TaggedError<UpdateCheckError>()(\"UpdateCheckError\", {\n /** What `updated.check()` rejected with, or threw. */\n cause: Schema.Defect(),\n}) {}\n\n/**\n * Runs `check` (SvelteKit's `updated.check`) as an Effect that succeeds with\n * whether a new version is available and fails with {@link UpdateCheckError}\n * if the promise rejects (or `check` throws).\n */\nexport function checkForUpdateWith(\n check: () => Promise<boolean>,\n): Effect.Effect<boolean, UpdateCheckError> {\n return Effect.tryPromise({\n try: () => check(),\n catch: (cause) => new UpdateCheckError({ cause }),\n });\n}\n\n// ─── CurrentPage ─────────────────────────────────────────────────────────────\n\n/** The service behind `State.CurrentPage`: a snapshot and a stream of page changes. */\nexport interface CurrentPageService<P extends ReadonlyPage = ReadonlyPage> {\n /** Snapshots the current page when run. */\n readonly get: Effect.Effect<PageSnapshot<P>>;\n /** The current page, then a fresh snapshot whenever any of its fields changes. */\n readonly changes: Stream.Stream<PageSnapshot<P>>;\n}\n\n/** Builds a {@link CurrentPageService} reading `readPage()` and watching it with `watch`. */\nexport function makeCurrentPage<P extends ReadonlyPage>(\n readPage: () => P,\n watch: Watch,\n): CurrentPageService<P> {\n const read = (): PageSnapshot<P> => snapshotPage(readPage());\n return { get: Effect.sync(read), changes: watchedStream(watch, read) };\n}\n"],"mappings":";;;;;;;;;;;;;;AAmEA,SAAgB,aAAqC,MAA0B;CAC7E,OAAO;EACL,KAAK,KAAK;EACV,QAAQ,KAAK;EACb,OAAO,KAAK;EACZ,QAAQ,KAAK;EACb,OAAO,KAAK;EACZ,MAAM,KAAK;EACX,OAAO,KAAK;EACZ,MAAM,KAAK;EACX,SAAS,KAAK;CAChB;AACF;;;;;;;AAQA,SAAgB,mBACd,uBACA,UACgC;CAChC,MAAM,QAAQ,OAAO,QAAQ,MAAM,UAA2B,CAAC;CAE/D,MAAM,YAAY,OAAO,aAAa,SAAS,CAAC,CAAC;CAIjD,4BAA4B;EAC1B,MAAM,YAAY,OAAO,aAAa,SAAS,CAAC,CAAC;CACnD,CAAC;CACD,OAAO,OAAO,UAAU,KAAK;AAC/B;;;;;;;;AAkBA,SAAgB,cAAiB,OAAc,MAAiC;CAC9E,OAAO,OAAO,UAAa,UACzB,OAAO,eACL,OAAO,WACL,MAAM,OAAO,UAAU;EACrB,MAAM,YAAY,OAAO,KAAK;CAChC,CAAC,CACH,IACC,YAAY,OAAO,KAAK,OAAO,CAClC,CACF;AACF;;;;;;AAqCA,SAAgB,mBACd,YACmC;CACnC,MAAM,EAAE,MAAM,MAAM,IAAI,YAAY,OAAO,aAAa;CACxD,IAAI,SAAS,QAAQ,eAAe,QAAQ,aAAa,MAAM,OAAO,OAAO,KAAK;CAClF,OAAO,OAAO,KAAK;EAAE;EAAM;EAAM;EAAI;EAAY,OAAO,SAAS;EAAM;CAAS,CAAC;AACnF;;;;;;AASA,IAAa,mBAAb,cAAsC,OAAO,YAA8B,CAAC,CAAC,oBAAoB;;AAE/F,OAAO,OAAO,OAAO,EACvB,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,SAAgB,mBACd,OAC0C;CAC1C,OAAO,OAAO,WAAW;EACvB,WAAW,MAAM;EACjB,QAAQ,UAAU,IAAI,iBAAiB,EAAE,MAAM,CAAC;CAClD,CAAC;AACH;;AAaA,SAAgB,gBACd,UACA,OACuB;CACvB,MAAM,aAA8B,aAAa,SAAS,CAAC;CAC3D,OAAO;EAAE,KAAK,OAAO,KAAK,IAAI;EAAG,SAAS,cAAc,OAAO,IAAI;CAAE;AACvE"}
|
|
1
|
+
{"version":3,"file":"app-state.js","names":[],"sources":["../../src/internal/app-state.ts"],"sourcesContent":["/**\n * Pure, `$app/*`-free core for the `$app/state` bridge in `../State.ts`.\n *\n * The public helpers can't be unit-tested in plain Node because importing them\n * pulls in `$app/navigation` and `$app/state` (SvelteKit virtual modules that\n * only exist inside a build). The snapshotting, the \"emit now, then after each\n * navigation\" plumbing and the watch-to-`Stream` bridge live here instead,\n * parameterised over the navigation registrar, a {@link Watch} function and\n * read thunks, so they can be driven with stand-ins in tests while the public\n * wrappers stay thin pass-throughs. The only runes code is `watch.svelte.ts`.\n *\n * @internal\n */\n\nimport type { NavigationTarget, NavigationType } from \"$app/navigation\";\nimport * as Schema from \"effect/Schema\";\nimport * as Effect from \"effect/Effect\";\nimport * as Option from \"effect/Option\";\nimport * as Queue from \"effect/Queue\";\nimport * as Stream from \"effect/Stream\";\nimport { failQueueOnSetupError } from \"./stream-callback.js\";\n\n/**\n * The fields of SvelteKit's `page` we snapshot. Mirrors the shape of\n * `@sveltejs/kit`'s `Page`, but as a plain readonly record rather than the live\n * mutating proxy.\n */\nexport interface PageSnapshot<P extends ReadonlyPage = ReadonlyPage> {\n readonly url: P[\"url\"];\n readonly params: P[\"params\"];\n readonly route: P[\"route\"];\n readonly status: P[\"status\"];\n readonly error: P[\"error\"];\n readonly data: P[\"data\"];\n readonly state: P[\"state\"];\n readonly form: P[\"form\"];\n readonly shallow: P[\"shallow\"];\n}\n\n/**\n * The subset of `Page` fields the snapshot reads. Deliberately loose (the value\n * types are `unknown` / broad) so SvelteKit's `Page` — whose `params` / `data`\n * / `error` / `state` are app-specific — satisfies the constraint, while\n * `PageSnapshot<P>` recovers the precise field types from `P`.\n */\nexport interface ReadonlyPage {\n // SvelteKit 3 types `page.url` as an immutable `ReadonlyURL` (from\n // `$app/state`); everything but `searchParams` is enough here.\n readonly url: Readonly<Omit<URL, \"searchParams\">>;\n readonly params: Record<string, string | undefined>;\n readonly route: { readonly id: string | null };\n readonly status: number;\n readonly error: unknown;\n readonly data: App.PageData;\n readonly state: unknown;\n readonly form: unknown;\n // SvelteKit 3: the target of the current shallow navigation, or `null`.\n readonly shallow: unknown;\n}\n\n/**\n * Builds a shallow snapshot of the `page` fields that matter. We copy the\n * fields rather than forwarding the live `$app/state` proxy so downstream Effect\n * consumers see a stable value (the proxy mutates in place on every\n * navigation, which would make a captured reference unreliable). Nested values\n * (`url`, `data`, ...) are *not* deep-cloned: they're replaced wholesale on each\n * navigation, so a shallow copy is enough to distinguish snapshots.\n */\nexport function snapshotPage<P extends ReadonlyPage>(page: P): PageSnapshot<P> {\n return {\n url: page.url,\n params: page.params,\n route: page.route,\n status: page.status,\n error: page.error,\n data: page.data,\n state: page.state,\n form: page.form,\n shallow: page.shallow,\n };\n}\n\n/**\n * Emits a snapshot of `readPage()` immediately, then again every time\n * `registerAfterNavigate`'s callback fires (i.e. after each navigation). Backed\n * by an unbounded queue, exposed as a `Stream` — the same push bridge as the\n * navigation-event helpers.\n */\nexport function pageSnapshotStream<P extends ReadonlyPage>(\n registerAfterNavigate: (callback: () => void) => void,\n readPage: () => P,\n): Stream.Stream<PageSnapshot<P>> {\n const queue = Effect.runSync(Queue.unbounded<PageSnapshot<P>>());\n // Initial value: the current page, so consumers start from a known state.\n Queue.offerUnsafe(queue, snapshotPage(readPage()));\n // afterNavigate fires once on mount too, but emitting up front means a\n // late-subscribing consumer still sees the current page without waiting for a\n // navigation.\n registerAfterNavigate(() => {\n Queue.offerUnsafe(queue, snapshotPage(readPage()));\n });\n return Stream.fromQueue(queue);\n}\n\n// ─── Watching rune state ─────────────────────────────────────────────────────\n\n/**\n * Observes a reactive read: calls `onValue` with `read()` once, then again\n * whenever something `read` touched changes, until the returned disposer runs.\n * The real implementation is `watch` in `./watch.svelte.ts`.\n */\nexport type Watch = <A>(read: () => A, onValue: (value: A) => void) => () => void;\n\n/**\n * A `Stream` of `read()`: the current value, then a new one each time `watch`\n * reports a change. Cold and lazy — each run opens its own watcher and disposes\n * it when the stream ends or is interrupted. Never fails; a throwing `watch`\n * surfaces as a defect (the stream dies with what it threw, with no watcher\n * left to dispose).\n */\nexport function watchedStream<A>(watch: Watch, read: () => A): Stream.Stream<A> {\n return Stream.callback<A>((queue) =>\n Effect.acquireRelease(\n Effect.sync(() =>\n watch(read, (value) => {\n Queue.offerUnsafe(queue, value);\n }),\n ),\n (dispose) => Effect.sync(dispose),\n ).pipe(failQueueOnSetupError(queue)),\n );\n}\n\n// ─── navigating ──────────────────────────────────────────────────────────────\n\n/**\n * A snapshot of an in-flight SvelteKit navigation, as `$app/state`'s\n * `navigating` exposes it. `delta` is the history step count for a `popstate`\n * navigation and `null` otherwise; `complete` resolves when the navigation\n * finishes and rejects if it fails or is aborted.\n */\nexport interface NavigatingSnapshot {\n readonly type: Exclude<NavigationType, \"enter\">;\n readonly from: NavigationTarget | null;\n readonly to: NavigationTarget | null;\n readonly willUnload: boolean;\n readonly delta: number | null;\n readonly complete: Promise<void>;\n}\n\n/**\n * The shape of `$app/state`'s `navigating`: every field is `null` while no\n * navigation is in flight.\n */\nexport interface ReadonlyNavigating {\n readonly type: NavigatingSnapshot[\"type\"] | null;\n readonly from: NavigationTarget | null;\n readonly to: NavigationTarget | null;\n readonly willUnload: boolean | null;\n readonly delta?: number | null | undefined;\n readonly complete: Promise<void> | null;\n}\n\n/**\n * Copies `navigating` into a plain {@link NavigatingSnapshot}, or `None` when\n * no navigation is in flight (`type` is `null`). Reads every field, so a\n * watcher tracks the whole object.\n */\nexport function snapshotNavigating(\n navigating: ReadonlyNavigating,\n): Option.Option<NavigatingSnapshot> {\n const { type, from, to, willUnload, delta, complete } = navigating;\n if (type === null || willUnload === null || complete === null) return Option.none();\n return Option.some({ type, from, to, willUnload, delta: delta ?? null, complete });\n}\n\n// ─── updated ─────────────────────────────────────────────────────────────────\n\n/**\n * `updated.check()` rejected. SvelteKit resolves `false` when the version\n * request fails, so this signals misuse (e.g. calling it during server\n * rendering, where there is no `window`) rather than a network error.\n */\nexport class UpdateCheckError extends Schema.TaggedError<UpdateCheckError>()(\"UpdateCheckError\", {\n /** What `updated.check()` rejected with, or threw. */\n cause: Schema.Defect(),\n}) {}\n\n/**\n * Runs `check` (SvelteKit's `updated.check`) as an Effect that succeeds with\n * whether a new version is available and fails with {@link UpdateCheckError}\n * if the promise rejects (or `check` throws).\n */\nexport function checkForUpdateWith(\n check: () => Promise<boolean>,\n): Effect.Effect<boolean, UpdateCheckError> {\n return Effect.tryPromise({\n try: () => check(),\n catch: (cause) => new UpdateCheckError({ cause }),\n });\n}\n\n// ─── CurrentPage ─────────────────────────────────────────────────────────────\n\n/** The service behind `State.CurrentPage`: a snapshot and a stream of page changes. */\nexport interface CurrentPageService<P extends ReadonlyPage = ReadonlyPage> {\n /** Snapshots the current page when run. */\n readonly get: Effect.Effect<PageSnapshot<P>>;\n /** The current page, then a fresh snapshot whenever any of its fields changes. */\n readonly changes: Stream.Stream<PageSnapshot<P>>;\n}\n\n/** Builds a {@link CurrentPageService} reading `readPage()` and watching it with `watch`. */\nexport function makeCurrentPage<P extends ReadonlyPage>(\n readPage: () => P,\n watch: Watch,\n): CurrentPageService<P> {\n const read = (): PageSnapshot<P> => snapshotPage(readPage());\n return { get: Effect.sync(read), changes: watchedStream(watch, read) };\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoEA,SAAgB,aAAqC,MAA0B;CAC7E,OAAO;EACL,KAAK,KAAK;EACV,QAAQ,KAAK;EACb,OAAO,KAAK;EACZ,QAAQ,KAAK;EACb,OAAO,KAAK;EACZ,MAAM,KAAK;EACX,OAAO,KAAK;EACZ,MAAM,KAAK;EACX,SAAS,KAAK;CAChB;AACF;;;;;;;AAQA,SAAgB,mBACd,uBACA,UACgC;CAChC,MAAM,QAAQ,OAAO,QAAQ,MAAM,UAA2B,CAAC;CAE/D,MAAM,YAAY,OAAO,aAAa,SAAS,CAAC,CAAC;CAIjD,4BAA4B;EAC1B,MAAM,YAAY,OAAO,aAAa,SAAS,CAAC,CAAC;CACnD,CAAC;CACD,OAAO,OAAO,UAAU,KAAK;AAC/B;;;;;;;;AAkBA,SAAgB,cAAiB,OAAc,MAAiC;CAC9E,OAAO,OAAO,UAAa,UACzB,OAAO,eACL,OAAO,WACL,MAAM,OAAO,UAAU;EACrB,MAAM,YAAY,OAAO,KAAK;CAChC,CAAC,CACH,IACC,YAAY,OAAO,KAAK,OAAO,CAClC,CAAC,CAAC,KAAK,sBAAsB,KAAK,CAAC,CACrC;AACF;;;;;;AAqCA,SAAgB,mBACd,YACmC;CACnC,MAAM,EAAE,MAAM,MAAM,IAAI,YAAY,OAAO,aAAa;CACxD,IAAI,SAAS,QAAQ,eAAe,QAAQ,aAAa,MAAM,OAAO,OAAO,KAAK;CAClF,OAAO,OAAO,KAAK;EAAE;EAAM;EAAM;EAAI;EAAY,OAAO,SAAS;EAAM;CAAS,CAAC;AACnF;;;;;;AASA,IAAa,mBAAb,cAAsC,OAAO,YAA8B,CAAC,CAAC,oBAAoB;;AAE/F,OAAO,OAAO,OAAO,EACvB,CAAC,CAAC,CAAC,CAAC;;;;;;AAOJ,SAAgB,mBACd,OAC0C;CAC1C,OAAO,OAAO,WAAW;EACvB,WAAW,MAAM;EACjB,QAAQ,UAAU,IAAI,iBAAiB,EAAE,MAAM,CAAC;CAClD,CAAC;AACH;;AAaA,SAAgB,gBACd,UACA,OACuB;CACvB,MAAM,aAA8B,aAAa,SAAS,CAAC;CAC3D,OAAO;EAAE,KAAK,OAAO,KAAK,IAAI;EAAG,SAAS,cAAc,OAAO,IAAI;CAAE;AACvE"}
|
package/dist/internal/auto.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { ServerRuntime, UniversalRuntime } from "../app-runtime.js";
|
|
|
2
2
|
import * as Effect from "effect/Effect";
|
|
3
3
|
import { Action, Actions, Load, RequestEvent, ServerLoad } from "@sveltejs/kit";
|
|
4
4
|
import { Handle, HandleClientError, HandleFetch, HandleServerError, Reroute } from "@sveltejs/kit/hooks";
|
|
5
|
-
//#region src/internal/auto.d.ts
|
|
6
5
|
type AnyEffect = Effect.Effect<unknown, unknown, never>;
|
|
7
6
|
/**
|
|
8
7
|
* The function form of a user export: called with the hook / load argument, it
|
|
@@ -74,6 +73,5 @@ export declare function wrapReroute<T extends undefined | AnyEffect | UserFn<Rer
|
|
|
74
73
|
* application runtime's services (if configured) are.
|
|
75
74
|
*/
|
|
76
75
|
export declare function wrapInit<T extends undefined | AnyEffect | UserThunk>(value: T, runtimeMod?: RuntimeModule): T extends undefined ? undefined : () => Promise<void>;
|
|
77
|
-
//#endregion
|
|
78
76
|
export {};
|
|
79
77
|
//# sourceMappingURL=auto.d.ts.map
|
package/dist/internal/auto.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as Exit from "effect/Exit";
|
|
|
5
5
|
import * as Predicate from "effect/Predicate";
|
|
6
6
|
import * as Rec from "effect/Record";
|
|
7
7
|
import * as Result from "effect/Result";
|
|
8
|
-
|
|
8
|
+
// src/internal/auto.ts
|
|
9
9
|
let defaultServerRuntime;
|
|
10
10
|
let defaultUniversalRuntime;
|
|
11
11
|
/** Extract the runtime from a runtime module, if any. */
|
|
@@ -165,7 +165,6 @@ function wrapInit(value, runtimeMod) {
|
|
|
165
165
|
};
|
|
166
166
|
return init;
|
|
167
167
|
}
|
|
168
|
-
//#endregion
|
|
169
168
|
export { wrapAction, wrapActions, wrapEndpoint, wrapHandle, wrapHandleError, wrapHandleFetch, wrapInit, wrapLoad, wrapReroute, wrapServerLoad };
|
|
170
169
|
|
|
171
170
|
//# sourceMappingURL=auto.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { makeServerRuntime, makeUniversalRuntime } from "../app-runtime.js";
|
|
2
|
-
|
|
2
|
+
// src/internal/default-runtime.ts
|
|
3
3
|
/**
|
|
4
4
|
* Lazily-created default runtimes (no application layer) backing the package's
|
|
5
5
|
* standalone helpers — the `serverLoad` / `action` / `load` wrappers and the
|
|
@@ -15,7 +15,6 @@ const defaultServerRuntime = () => serverRuntime ??= makeServerRuntime();
|
|
|
15
15
|
let universalRuntime;
|
|
16
16
|
/** The shared default universal runtime, created on first use. */
|
|
17
17
|
const defaultUniversalRuntime = () => universalRuntime ??= makeUniversalRuntime();
|
|
18
|
-
//#endregion
|
|
19
18
|
export { defaultServerRuntime, defaultUniversalRuntime };
|
|
20
19
|
|
|
21
20
|
//# sourceMappingURL=default-runtime.js.map
|
|
@@ -2,7 +2,6 @@ import * as Effect from "effect/Effect";
|
|
|
2
2
|
import * as Context from "effect/Context";
|
|
3
3
|
import * as ManagedRuntime from "effect/ManagedRuntime";
|
|
4
4
|
import { SubmitFunction } from "$app/forms";
|
|
5
|
-
//#region src/internal/enhance.d.ts
|
|
6
5
|
/** The input SvelteKit passes to a `SubmitFunction` before the request is sent. */
|
|
7
6
|
export type SubmitInput = Parameters<SubmitFunction>[0];
|
|
8
7
|
/** The result callback a `SubmitFunction` may return, run once the action responds. */
|
|
@@ -133,6 +132,5 @@ export interface OnErrorMustAccept<R, Errors> {
|
|
|
133
132
|
* that require different services even when the runtime provides them all.
|
|
134
133
|
*/
|
|
135
134
|
export type EnhanceHandlersBy<RSubmit, RResult, RError, ESubmit, EResult, E> = Pick<EnhanceHandlers<RSubmit, ESubmit, EResult, E>, "onSubmit"> & Pick<EnhanceHandlers<RResult, ESubmit, EResult, E>, "onResult"> & Pick<EnhanceHandlers<RError, ESubmit, EResult, E>, "onError">;
|
|
136
|
-
//#endregion
|
|
137
135
|
export {};
|
|
138
136
|
//# sourceMappingURL=enhance.d.ts.map
|
package/dist/internal/enhance.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Effect from "effect/Effect";
|
|
2
2
|
import * as Context from "effect/Context";
|
|
3
3
|
import "effect/ManagedRuntime";
|
|
4
|
-
|
|
4
|
+
// src/internal/enhance.ts
|
|
5
5
|
/** Run an `Effect<A, E, R>` on the given runtime (or the default when none). */
|
|
6
6
|
const runPromiseWith = (runtime) => (effect) => {
|
|
7
7
|
if (runtime === void 0) return Effect.runPromise(effect);
|
|
@@ -44,7 +44,6 @@ const makeSubmitFunction = (handlers, ...rest) => {
|
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
//#endregion
|
|
48
47
|
export { makeSubmitFunction };
|
|
49
48
|
|
|
50
49
|
//# sourceMappingURL=enhance.js.map
|
package/dist/internal/error.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import "@sveltejs/kit";
|
|
2
2
|
import "effect/Cause";
|
|
3
|
-
//#region src/internal/error.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* The body of a SvelteKit HTTP error: a message, or your app's `App.Error`
|
|
6
5
|
* (with `status` optional — the error's status wins over it), exactly the body
|
|
@@ -9,5 +8,4 @@ import "effect/Cause";
|
|
|
9
8
|
export type KitErrorBody = string | (Omit<App.Error, "status"> & {
|
|
10
9
|
readonly status?: number;
|
|
11
10
|
});
|
|
12
|
-
//#endregion
|
|
13
11
|
//# sourceMappingURL=error.d.ts.map
|