@teyik0/furin 0.2.0-alpha.5 → 0.4.0-alpha.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 -3
- package/dist/adapter/bun.d.ts +1 -1
- package/dist/adapter/static.d.ts +1 -1
- package/dist/build/bun-build.d.ts +3 -0
- package/dist/build/client.d.ts +2 -2
- package/dist/build/entry-template.d.ts +6 -0
- package/dist/build/entry-template.ts +20 -3
- package/dist/build/hydrate.d.ts +1 -1
- package/dist/build/index.d.ts +1 -1
- package/dist/build/index.js +9363 -5827
- package/dist/build/production-instrumentation.d.ts +1 -0
- package/dist/build/route-types.d.ts +3 -23
- package/dist/build/shared.d.ts +1 -1
- package/dist/build/ssg-cache.d.ts +1 -1
- package/dist/build/types.d.ts +2 -1
- package/dist/cli/index.js +9467 -5870
- package/dist/client/boundaries.d.ts +6 -4
- package/dist/client/define-route.d.ts +35 -0
- package/dist/client/document.d.ts +26 -0
- package/dist/client/hmr.d.ts +10 -0
- package/dist/client/internal/runtime-types.d.ts +32 -0
- package/dist/client/link.d.ts +2 -1
- package/dist/client/link.js +1884 -1227
- package/dist/client/router/boundary-tree.d.ts +1 -1
- package/dist/client/router/index.d.ts +2 -2
- package/dist/client/router/link-utils.d.ts +14 -1
- package/dist/client/router/search/index.d.ts +3 -7
- package/dist/client/router/sync-catch-up.d.ts +4 -4
- package/dist/client/router/types.d.ts +34 -26
- package/dist/client-only.d.ts +1 -0
- package/dist/client-only.js +1 -0
- package/dist/client.d.ts +11 -169
- package/dist/client.js +197 -36
- package/dist/config.d.ts +8 -8
- package/dist/config.js +10 -10
- package/dist/define-route.d.ts +1355 -0
- package/dist/devtools/devtools-element.d.ts +1 -0
- package/dist/devtools/protocol.d.ts +119 -0
- package/dist/furin.d.ts +24 -39
- package/dist/furin.js +14432 -7929
- package/dist/isomorphic.d.ts +18 -0
- package/dist/plugin/binding-scope.d.ts +2 -0
- package/dist/plugin/dead-code-elimination.d.ts +3 -0
- package/dist/plugin/index.js +1708 -489
- package/dist/plugin/route-config-autofix.d.ts +31 -0
- package/dist/plugin/routes.d.ts +27 -0
- package/dist/plugin/transform-client.d.ts +0 -2
- package/dist/plugin/transform-isomorphic.d.ts +9 -0
- package/dist/routes.d.ts +6 -0
- package/dist/routes.js +1 -0
- package/dist/rsc/build/environment.d.ts +2 -0
- package/dist/rsc/build/index.d.ts +15 -0
- package/dist/rsc/client-codec.d.ts +1 -0
- package/dist/rsc/codec.d.ts +4 -0
- package/dist/rsc/flight-drain.d.ts +11 -0
- package/dist/rsc/render-error.d.ts +17 -0
- package/dist/rsc/server-codec.d.ts +2 -0
- package/dist/rsc/server-codec.js +24 -0
- package/dist/rsc/shared.d.ts +30 -0
- package/dist/rsc/symbols.d.ts +2 -0
- package/dist/rsc/transport-benchmark.d.ts +13 -0
- package/dist/rsc/version.d.ts +7 -0
- package/dist/rsc-client.d.ts +4 -0
- package/dist/rsc-client.js +166 -0
- package/dist/rsc-server.d.ts +11 -0
- package/dist/rsc.d.ts +11 -0
- package/dist/rsc.js +353 -0
- package/dist/server/cache/index.d.ts +2 -2
- package/dist/server/cache/invalidation.d.ts +2 -3
- package/dist/server/cache/isr-ssg.d.ts +5 -1
- package/dist/server/cache/isr.d.ts +9 -0
- package/dist/server/cache/route-cache.d.ts +10 -8
- package/dist/server/cache/store-view.d.ts +7 -7
- package/dist/server/dev-page-plugin.d.ts +11 -5
- package/dist/server/devtools/hub.d.ts +11 -0
- package/dist/server/devtools/instrumentation.d.ts +22 -0
- package/dist/server/devtools/instrumentation.production.d.ts +44 -0
- package/dist/server/devtools/plugin.d.ts +3 -0
- package/dist/server/devtools/request-context.d.ts +6 -0
- package/dist/server/internal.d.ts +5 -0
- package/dist/server/internal.js +3 -3
- package/dist/server/lang-detect.d.ts +1 -0
- package/dist/server/logger.d.ts +4 -0
- package/dist/server/render/assemble.d.ts +4 -9
- package/dist/server/render/document.d.ts +4 -0
- package/dist/server/render/element.d.ts +3 -2
- package/dist/server/render/index.d.ts +2 -2
- package/dist/server/render/index.ts +6 -3
- package/dist/server/render/isr.d.ts +1 -1
- package/dist/server/render/loaders.d.ts +9 -1
- package/dist/server/render/not-found.d.ts +2 -2
- package/dist/server/render/ppr-route.d.ts +8 -0
- package/dist/server/render/route-frame-transport.d.ts +2 -0
- package/dist/server/render/shell.ts +0 -1
- package/dist/server/render/ssg.d.ts +1 -1
- package/dist/server/render/ssr.d.ts +9 -9
- package/dist/server/render/template.d.ts +4 -0
- package/dist/server/router/defined-route.d.ts +24 -0
- package/dist/server/router/discovery.d.ts +1 -1
- package/dist/server/router/hmr.d.ts +17 -9
- package/dist/server/router/patterns.d.ts +7 -1
- package/dist/server/router/plugin.d.ts +8 -10
- package/dist/server/router/schema-merge.d.ts +3 -0
- package/dist/server/router/schemas.d.ts +14 -9
- package/dist/server/router/source-version.d.ts +2 -0
- package/dist/server/router/types.d.ts +2 -1
- package/dist/server/runtime-env.js +2 -2
- package/dist/server/sync/adapter.d.ts +45 -26
- package/dist/server/sync/config.d.ts +5 -9
- package/dist/server/sync/fingerprint.d.ts +2 -1
- package/dist/server/sync/index.d.ts +15 -4
- package/dist/server/sync/index.js +3023 -0
- package/dist/server/sync/notifier.d.ts +18 -0
- package/dist/server/sync/plugin.d.ts +53 -54
- package/dist/server/sync/postgres/index.d.ts +19 -0
- package/dist/server/sync/postgres/index.js +252 -0
- package/dist/server/sync/postgres/migrate.d.ts +2 -0
- package/dist/server/sync/postgres/migrate.js +17 -0
- package/dist/server/sync/postgres/migration.sql +66 -0
- package/dist/server/sync/redis/index.d.ts +30 -0
- package/dist/server/sync/redis/index.js +336 -0
- package/dist/server/sync/redis/scripts.d.ts +4 -0
- package/dist/server/sync/response.d.ts +10 -1
- package/dist/server/sync/runtime.d.ts +6 -0
- package/dist/server/sync/sqlite/index.d.ts +20 -0
- package/dist/server/sync/sqlite/index.js +250 -0
- package/dist/server/sync/stream.d.ts +12 -11
- package/dist/server-only.d.ts +1 -0
- package/dist/server-only.js +1 -0
- package/dist/shared/await.d.ts +6 -7
- package/dist/shared/elysia-contract.d.ts +41 -0
- package/dist/shared/parser.d.ts +2 -0
- package/dist/shared/route-frame.d.ts +49 -0
- package/dist/shared/route-map.d.ts +5 -0
- package/dist/shared/utils/index.d.ts +1 -3
- package/package.json +86 -41
- package/src/adapter/bun.ts +113 -36
- package/src/adapter/package.ts +23 -15
- package/src/adapter/static.ts +97 -50
- package/src/build/bun-build.ts +11 -0
- package/src/build/client.ts +41 -26
- package/src/build/entry-template.ts +20 -3
- package/src/build/hydrate.ts +128 -33
- package/src/build/index.ts +14 -2
- package/src/build/production-instrumentation.ts +14 -0
- package/src/build/route-types.ts +20 -116
- package/src/build/scan-server.ts +3 -2
- package/src/build/shared.ts +1 -1
- package/src/build/ssg-cache.ts +4 -2
- package/src/build/types.ts +2 -1
- package/src/cli/config.ts +3 -3
- package/src/cli/index.ts +58 -27
- package/src/client/boundaries.tsx +51 -19
- package/src/client/default-screens.tsx +4 -4
- package/src/client/define-route.ts +48 -0
- package/src/client/document.tsx +165 -0
- package/src/client/hmr.ts +40 -0
- package/src/client/internal/runtime-types.ts +33 -0
- package/src/client/link.tsx +51 -38
- package/src/client/router/boundary-tree.tsx +2 -2
- package/src/client/router/context.ts +13 -9
- package/src/client/router/index.ts +4 -0
- package/src/client/router/link-utils.ts +92 -3
- package/src/client/router/navigation.ts +9 -15
- package/src/client/router/provider.tsx +98 -53
- package/src/client/router/search/index.ts +9 -19
- package/src/client/router/search-store.ts +5 -1
- package/src/client/router/spa-response.ts +3 -4
- package/src/client/router/sync-catch-up.ts +9 -8
- package/src/client/router/types.ts +52 -26
- package/src/client/sync.ts +3 -2
- package/src/client-only.ts +1 -0
- package/src/client.ts +28 -283
- package/src/config.ts +10 -10
- package/src/define-route.ts +959 -0
- package/src/devtools/devtools-element.js +885 -0
- package/src/devtools/protocol.ts +139 -0
- package/src/furin.ts +475 -136
- package/src/isomorphic.ts +66 -0
- package/src/plugin/binding-scope.ts +158 -0
- package/src/plugin/dead-code-elimination.ts +202 -0
- package/src/plugin/index.ts +14 -18
- package/src/plugin/route-config-autofix.ts +1140 -0
- package/src/plugin/routes.ts +891 -0
- package/src/plugin/transform-client.ts +160 -330
- package/src/plugin/transform-isomorphic.ts +464 -0
- package/src/routes.ts +6 -0
- package/src/rsc/build/environment.ts +30 -0
- package/src/rsc/build/index.ts +94 -0
- package/src/rsc/client-codec.ts +11 -0
- package/src/rsc/codec.ts +85 -0
- package/src/rsc/flight-drain.ts +68 -0
- package/src/rsc/react-server-dom-webpack.d.ts +23 -0
- package/src/rsc/render-error.ts +120 -0
- package/src/rsc/server-codec.ts +25 -0
- package/src/rsc/shared.tsx +113 -0
- package/src/rsc/symbols.ts +2 -0
- package/src/rsc/transport-benchmark.ts +73 -0
- package/src/rsc/version.ts +57 -0
- package/src/rsc-client.ts +12 -0
- package/src/rsc-server.tsx +91 -0
- package/src/rsc.tsx +75 -0
- package/src/server/auto-invalidate/registry.ts +2 -2
- package/src/server/auto-invalidate/runtime.ts +32 -6
- package/src/server/cache/dev-loader.ts +70 -10
- package/src/server/cache/index.ts +7 -3
- package/src/server/cache/invalidation.ts +33 -15
- package/src/server/cache/isr-ssg.ts +12 -3
- package/src/server/cache/isr.ts +84 -9
- package/src/server/cache/route-cache.ts +49 -36
- package/src/server/cache/store-view.ts +7 -7
- package/src/server/context-logger.ts +7 -7
- package/src/server/dev-page-plugin.ts +38 -17
- package/src/server/devtools/hub.ts +64 -0
- package/src/server/devtools/instrumentation.production.ts +80 -0
- package/src/server/devtools/instrumentation.ts +72 -0
- package/src/server/devtools/plugin.ts +269 -0
- package/src/server/devtools/request-context.ts +76 -0
- package/src/server/instance.ts +4 -4
- package/src/server/internal.ts +5 -0
- package/src/server/lang-detect.ts +14 -10
- package/src/server/logger.ts +21 -0
- package/src/server/render/assemble.ts +58 -36
- package/src/server/render/document.tsx +25 -0
- package/src/server/render/element.tsx +24 -9
- package/src/server/render/index.ts +6 -3
- package/src/server/render/isr.ts +182 -117
- package/src/server/render/loaders.ts +289 -50
- package/src/server/render/not-found.ts +57 -38
- package/src/server/render/ppr-route.ts +146 -0
- package/src/server/render/route-frame-transport.ts +62 -0
- package/src/server/render/shell.ts +0 -1
- package/src/server/render/ssg.ts +7 -6
- package/src/server/render/ssr.ts +412 -166
- package/src/server/render/template.ts +93 -2
- package/src/server/router/defined-route.ts +110 -0
- package/src/server/router/discovery.ts +165 -48
- package/src/server/router/hmr.ts +126 -53
- package/src/server/router/patterns.ts +56 -27
- package/src/server/router/plugin.ts +210 -200
- package/src/server/router/schema-merge.ts +42 -0
- package/src/server/router/schemas.ts +61 -76
- package/src/server/router/source-version.ts +16 -0
- package/src/server/router/types.ts +3 -1
- package/src/server/sync/adapter.ts +44 -28
- package/src/server/sync/config.ts +9 -27
- package/src/server/sync/fingerprint.ts +8 -3
- package/src/server/sync/index.ts +37 -13
- package/src/server/sync/notifier.ts +109 -0
- package/src/server/sync/plugin.ts +184 -89
- package/src/server/sync/postgres/index.ts +301 -0
- package/src/server/sync/postgres/migrate.ts +16 -0
- package/src/server/sync/postgres/migration.sql +66 -0
- package/src/server/sync/redis/index.ts +342 -0
- package/src/server/sync/redis/scripts.ts +74 -0
- package/src/server/sync/response.ts +145 -16
- package/src/server/sync/runtime.ts +27 -0
- package/src/server/sync/sql.d.ts +4 -0
- package/src/server/sync/sqlite/index.ts +337 -0
- package/src/server/sync/sqlite/migration.sql +70 -0
- package/src/server/sync/stream.ts +137 -81
- package/src/server-only.ts +1 -0
- package/src/shared/await.tsx +10 -11
- package/src/shared/deferred-ndjson.ts +34 -6
- package/src/shared/digest.ts +2 -2
- package/src/shared/elysia-contract.ts +63 -0
- package/src/shared/parser.ts +5 -0
- package/src/shared/route-frame.ts +429 -0
- package/src/shared/route-map.ts +37 -0
- package/src/shared/search-params.ts +7 -7
- package/src/shared/utils/index.ts +6 -22
- package/dist/build/server-routes-entry.d.ts +0 -13
- package/dist/build/server-routes-entry.ts +0 -30
- package/dist/server/dev-inspector.d.ts +0 -89
- package/dist/server/router/index.d.ts +0 -6
- package/dist/server/router/index.js +0 -27
- package/dist/server/router/index.ts +0 -28
- package/dist/server/sync/memory-adapter.d.ts +0 -17
- package/src/build/server-routes-entry.ts +0 -30
- package/src/server/dev-inspector.ts +0 -60
- package/src/server/router/index.ts +0 -28
- package/src/server/sync/memory-adapter.ts +0 -196
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type DocumentAssets } from "../../client/document.tsx";
|
|
3
|
+
import type { HeadOptions } from "../../client.ts";
|
|
4
|
+
export declare function withDocumentState(element: ReactNode, assets: DocumentAssets, head: HeadOptions | undefined, data: object | undefined): ReactNode;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
import type { RuntimeRoute } from "../../client.ts";
|
|
2
|
+
import type { RuntimeRoute } from "../../client/internal/runtime-types.ts";
|
|
3
3
|
import type { ErrorComponent } from "../../shared/error.ts";
|
|
4
4
|
import type { FurinNotFoundError, NotFoundComponent } from "../../shared/not-found.ts";
|
|
5
|
-
import type { ResolvedRoute } from "../router/
|
|
5
|
+
import type { ResolvedRoute } from "../router/types.ts";
|
|
6
6
|
export declare function buildElement(route: ResolvedRoute, data: Record<string, unknown>, rootLayout: RuntimeRoute): ReactNode;
|
|
7
|
+
export declare function wrapRootLayout(element: ReactNode, data: Record<string, unknown>, rootLayout: RuntimeRoute): ReactNode;
|
|
7
8
|
export declare function buildNotFoundElement(component: NotFoundComponent | undefined, error: FurinNotFoundError): ReactNode;
|
|
8
9
|
/**
|
|
9
10
|
* Builds the error element rendered when a loader (or the SSR shell) fails.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { type LoaderContext, streamToString } from "./assemble.ts";
|
|
2
2
|
export { buildElement, buildErrorElement } from "./element.tsx";
|
|
3
3
|
export { handleISR } from "./isr.ts";
|
|
4
|
-
export { type LoaderResult, runLoaders, serializeDeferredRejection } from "./loaders.ts";
|
|
4
|
+
export { hasRequestLoader, type LoaderResult, runLoaders, serializeDeferredRejection, } from "./loaders.ts";
|
|
5
5
|
export { renderRootNotFound } from "./not-found.ts";
|
|
6
6
|
export { prerenderSSG, warmSSGCache } from "./ssg.ts";
|
|
7
|
-
export { assertDeferredModeAllowed, type PreparedRender, prepareRender, type RenderResult, renderForPath, renderSSR, renderToHTML,
|
|
7
|
+
export { assertDeferredModeAllowed, type PreparedRender, prepareRender, type RenderResult, renderForPath, renderSSR, renderToHTML, serializeLoaderDataNdjson, withSSRRouterContext, } from "./ssr.ts";
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
export { type LoaderContext, streamToString } from "./assemble.ts";
|
|
4
4
|
export { buildElement, buildErrorElement } from "./element.tsx";
|
|
5
5
|
export { handleISR } from "./isr.ts";
|
|
6
|
-
export {
|
|
6
|
+
export {
|
|
7
|
+
hasRequestLoader,
|
|
8
|
+
type LoaderResult,
|
|
9
|
+
runLoaders,
|
|
10
|
+
serializeDeferredRejection,
|
|
11
|
+
} from "./loaders.ts";
|
|
7
12
|
export { renderRootNotFound } from "./not-found.ts";
|
|
8
13
|
|
|
9
14
|
export { prerenderSSG, warmSSGCache } from "./ssg.ts";
|
|
@@ -15,8 +20,6 @@ export {
|
|
|
15
20
|
renderForPath,
|
|
16
21
|
renderSSR,
|
|
17
22
|
renderToHTML,
|
|
18
|
-
renderToStream,
|
|
19
23
|
serializeLoaderDataNdjson,
|
|
20
|
-
splitBeforeBodyClose,
|
|
21
24
|
withSSRRouterContext,
|
|
22
25
|
} from "./ssr.ts";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Context } from "elysia";
|
|
2
2
|
import type { SearchRouteMetadata } from "../../shared/search-params.ts";
|
|
3
|
-
import type { ResolvedRoute, RootLayout } from "../router/
|
|
3
|
+
import type { ResolvedRoute, RootLayout } from "../router/types.ts";
|
|
4
4
|
export declare function handleISR(route: ResolvedRoute, ctx: Context, root: RootLayout, buildId: string | undefined, searchRoutes?: SearchRouteMetadata[]): Promise<string | Response | undefined>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context } from "elysia";
|
|
2
2
|
import { type FurinNotFoundError } from "../../shared/not-found.ts";
|
|
3
|
-
import type { ResolvedRoute } from "../router/
|
|
3
|
+
import type { ResolvedRoute } from "../router/types.ts";
|
|
4
4
|
export type LoaderResult = {
|
|
5
5
|
type: "data";
|
|
6
6
|
/**
|
|
@@ -43,6 +43,12 @@ export type LoaderResult = {
|
|
|
43
43
|
message: string;
|
|
44
44
|
headers: Record<string, string>;
|
|
45
45
|
};
|
|
46
|
+
export declare function runRequestLoaderData(route: ResolvedRoute, ctx: Context): Promise<object> | undefined;
|
|
47
|
+
export declare function withRequestLoaderData(route: ResolvedRoute, ctx: Context, publicResult: Extract<LoaderResult, {
|
|
48
|
+
type: "data";
|
|
49
|
+
}>): Extract<LoaderResult, {
|
|
50
|
+
type: "data";
|
|
51
|
+
}>;
|
|
46
52
|
/**
|
|
47
53
|
* Normalises an error thrown inside a deferred Promise into a value that is
|
|
48
54
|
* safe to send through `toCrossJSON` and that preserves the original semantics
|
|
@@ -62,3 +68,5 @@ export type LoaderResult = {
|
|
|
62
68
|
*/
|
|
63
69
|
export declare function serializeDeferredRejection(err: unknown): Promise<unknown>;
|
|
64
70
|
export declare function runLoaders(route: ResolvedRoute, ctx: Context): Promise<LoaderResult>;
|
|
71
|
+
export declare function runPublicLoaders(route: ResolvedRoute, ctx: Context): Promise<LoaderResult>;
|
|
72
|
+
export declare function hasRequestLoader(route: ResolvedRoute): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RootLayout } from "../router/
|
|
1
|
+
import type { RootLayout } from "../router/types.ts";
|
|
2
2
|
/**
|
|
3
3
|
* Renders the root-level not-found component into a complete 404 HTML Response.
|
|
4
4
|
* Used by the Elysia `.onError` catch-all when no route matches the request URL.
|
|
5
5
|
*/
|
|
6
|
-
export declare function renderRootNotFound(root: RootLayout, request: Request | undefined): Promise<Response>;
|
|
6
|
+
export declare function renderRootNotFound(root: RootLayout, request: Request | undefined, listenerOrigin?: string): Promise<Response>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Context } from "elysia";
|
|
2
|
+
import type { SearchRouteMetadata } from "../../shared/search-params.ts";
|
|
3
|
+
import { type RevalidateType } from "../cache/route-cache.ts";
|
|
4
|
+
import { type FurinInstance } from "../instance.ts";
|
|
5
|
+
import type { ResolvedRoute, RootLayout } from "../router/types.ts";
|
|
6
|
+
export declare function renderPprRoute(route: ResolvedRoute, ctx: Context, root: RootLayout, _buildId: string, searchRoutes: SearchRouteMetadata[] | undefined): Promise<Response>;
|
|
7
|
+
export declare function clearPprRouteCache(instance?: FurinInstance): void;
|
|
8
|
+
export declare function invalidatePprRoute(path: string, type: RevalidateType): boolean;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare function serializeDeferredRouteFrame(key: string, promise: Promise<unknown>, idPrefix: string): Promise<string>;
|
|
2
|
+
export declare function createDeferredRouteFrameStream(syncData: Record<string, unknown>, deferredPromises: Record<string, Promise<unknown>>): ReadableStream<Uint8Array>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { SearchRouteMetadata } from "../../shared/search-params.ts";
|
|
2
2
|
import type { SsgCacheEntry } from "../cache/isr-ssg.ts";
|
|
3
|
-
import type { ResolvedRoute, RootLayout } from "../router/
|
|
3
|
+
import type { ResolvedRoute, RootLayout } from "../router/types.ts";
|
|
4
4
|
export declare function prerenderSSG(route: ResolvedRoute, params: Record<string, string>, root: RootLayout, origin: string, basePath?: string, searchRoutes?: SearchRouteMetadata[]): Promise<SsgCacheEntry | Response>;
|
|
5
5
|
/**
|
|
6
6
|
* Pre-renders all SSG routes that declare `staticParams` and populates the
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { Context } from "elysia";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
3
|
import { renderToReadableStream } from "react-dom/server";
|
|
4
|
-
import { type
|
|
4
|
+
import { type DocumentAssets } from "../../client/document.tsx";
|
|
5
|
+
import type { RouterContextValue } from "../../client/router/types.ts";
|
|
6
|
+
import type { HeadOptions } from "../../client.ts";
|
|
5
7
|
import type { SearchRouteMetadata } from "../../shared/search-params.ts";
|
|
6
|
-
import type { ResolvedRoute, RootLayout } from "../router/
|
|
8
|
+
import type { ResolvedRoute, RootLayout } from "../router/types.ts";
|
|
7
9
|
import { buildErrorElement } from "./element.tsx";
|
|
8
10
|
import { type LoaderResult } from "./loaders.ts";
|
|
9
11
|
export type { LoaderContext } from "./assemble.ts";
|
|
@@ -21,6 +23,7 @@ export interface RenderResult {
|
|
|
21
23
|
status: number;
|
|
22
24
|
}
|
|
23
25
|
export interface PreparedRender {
|
|
26
|
+
assets: DocumentAssets;
|
|
24
27
|
/**
|
|
25
28
|
* All props passed to the React component tree. For deferred renders this
|
|
26
29
|
* includes the Promise objects (for `<Await resolve={promise}>`) alongside
|
|
@@ -36,7 +39,7 @@ export interface PreparedRender {
|
|
|
36
39
|
element: ReactNode;
|
|
37
40
|
/** Set when the prepared element is an error UI. */
|
|
38
41
|
errorDigest?: string;
|
|
39
|
-
headData:
|
|
42
|
+
headData: HeadOptions | undefined;
|
|
40
43
|
headers: Record<string, string>;
|
|
41
44
|
loader_ms: number;
|
|
42
45
|
/**
|
|
@@ -55,7 +58,6 @@ export interface PreparedRender {
|
|
|
55
58
|
* excludes the Promise fields (those are streamed separately).
|
|
56
59
|
*/
|
|
57
60
|
syncData: Record<string, unknown>;
|
|
58
|
-
template: string;
|
|
59
61
|
}
|
|
60
62
|
export declare function withSSRRouterContext(element: ReactNode, contextValue: RouterContextValue): ReactNode;
|
|
61
63
|
interface ShellFallbackResult {
|
|
@@ -79,7 +81,7 @@ interface ShellFallbackResult {
|
|
|
79
81
|
* to a string) — both start from this same React stream and only diverge in how
|
|
80
82
|
* they consume it and which fields they log.
|
|
81
83
|
*/
|
|
82
|
-
export declare function renderElementWithShellFallback(element: ReactNode, errorComponent: Parameters<typeof buildErrorElement>[0], ssrContext: RouterContextValue): Promise<ShellFallbackResult>;
|
|
84
|
+
export declare function renderElementWithShellFallback(element: ReactNode, errorComponent: Parameters<typeof buildErrorElement>[0], ssrContext: RouterContextValue, wrapFallbackDocument: (element: ReactNode, digest: string) => ReactNode): Promise<ShellFallbackResult>;
|
|
83
85
|
/**
|
|
84
86
|
* defer() streams data progressively — it only makes sense in SSR. In SSG/ISR
|
|
85
87
|
* the HTML is pre-rendered and cached, so the deferred fields would be absent
|
|
@@ -89,20 +91,18 @@ export declare function renderElementWithShellFallback(element: ReactNode, error
|
|
|
89
91
|
export declare function assertDeferredModeAllowed(route: ResolvedRoute, deferredPromises: Record<string, Promise<unknown>> | undefined): void;
|
|
90
92
|
/**
|
|
91
93
|
* Shared pipeline steps used by both `renderToHTML` (buffered) and `renderSSR`
|
|
92
|
-
* (streaming). Runs loaders, builds props, head
|
|
94
|
+
* (streaming). Runs loaders, builds props, head data, resolves assets,
|
|
93
95
|
* and creates the React element.
|
|
94
96
|
*
|
|
95
97
|
* Returns the redirect Response directly when a loader redirects, so callers
|
|
96
98
|
* never need try/catch for redirect handling.
|
|
97
99
|
*/
|
|
98
100
|
export declare function prepareRender(route: ResolvedRoute, ctx: Context, root: RootLayout, basePath: string | undefined, throwOnFailure: boolean, precomputedLoaderResult: LoaderResult | undefined, searchRoutes?: SearchRouteMetadata[]): Promise<PreparedRender | Response>;
|
|
99
|
-
export declare function renderForPath(route: ResolvedRoute, params: Record<string, string>, root: RootLayout, origin: string, mode: "ssg" | "isr", basePath?: string, searchRoutes?: SearchRouteMetadata[]): Promise<RenderResult | Response>;
|
|
101
|
+
export declare function renderForPath(route: ResolvedRoute, params: Record<string, string>, root: RootLayout, origin: string, mode: "ssg" | "isr", basePath?: string, searchRoutes?: SearchRouteMetadata[], search?: string): Promise<RenderResult | Response>;
|
|
100
102
|
/**
|
|
101
103
|
* Serialises a loader's `syncData` + `deferredPromises` into the same one-line
|
|
102
104
|
* NDJSON shape the live `/_furin/data` endpoint emits.
|
|
103
105
|
*/
|
|
104
106
|
export declare function serializeLoaderDataNdjson(syncData: Record<string, unknown>, deferredPromises: Record<string, Promise<unknown>> | undefined): Promise<string>;
|
|
105
107
|
export declare function renderToHTML(route: ResolvedRoute, ctx: Context, root: RootLayout, searchRoutes?: SearchRouteMetadata[]): Promise<RenderResult>;
|
|
106
|
-
export declare function renderToStream(route: ResolvedRoute, ctx: Context, root: RootLayout): Promise<ReadableStream | Response>;
|
|
107
108
|
export declare function renderSSR(route: ResolvedRoute, ctx: Context, root: RootLayout, precomputedLoaderResult: LoaderResult | undefined, searchRoutes?: SearchRouteMetadata[]): Promise<Response>;
|
|
108
|
-
export declare function splitBeforeBodyClose(bodyPost: string): [string, string];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
+
import type { DocumentAssets } from "../../client/document.tsx";
|
|
1
2
|
import { type FurinInstance } from "../instance.ts";
|
|
3
|
+
export declare function documentAssetsFromTemplate(template: string): DocumentAssets;
|
|
2
4
|
export declare function getDevTemplate(origin: string): Promise<string>;
|
|
5
|
+
export declare function getDevDocumentAssets(origin: string): Promise<DocumentAssets>;
|
|
3
6
|
export declare function setProductionTemplatePath(path: string | null, instance?: FurinInstance): void;
|
|
4
7
|
export declare function setProductionTemplateContent(content: string, instance?: FurinInstance): void;
|
|
8
|
+
export declare function getProductionDocumentAssets(): DocumentAssets | null;
|
|
5
9
|
export declare function getProductionTemplate(): string | null;
|
|
6
10
|
/** @internal test-only — resets all template state */
|
|
7
11
|
export declare function __resetTemplateState(): void;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RuntimePage, RuntimeRoute } from "../../client/internal/runtime-types.ts";
|
|
2
|
+
import type { HeadOptions, RenderingMode } from "../../client.ts";
|
|
3
|
+
interface DefinedRouteTerminal {
|
|
4
|
+
__type: "FURIN_ROUTE";
|
|
5
|
+
component: (...args: never[]) => React.ReactNode;
|
|
6
|
+
elysia: object;
|
|
7
|
+
head?: (...args: never[]) => HeadOptions;
|
|
8
|
+
layout?: (...args: never[]) => React.ReactNode;
|
|
9
|
+
loader?: (...args: never[]) => unknown;
|
|
10
|
+
mode?: RenderingMode;
|
|
11
|
+
page?: (...args: never[]) => React.ReactNode;
|
|
12
|
+
requestLoader?: (...args: never[]) => unknown;
|
|
13
|
+
revalidate?: number;
|
|
14
|
+
schemas?: {
|
|
15
|
+
params?: unknown;
|
|
16
|
+
query?: unknown;
|
|
17
|
+
};
|
|
18
|
+
staticParams?: () => Promise<readonly unknown[]> | readonly unknown[];
|
|
19
|
+
tags?: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
export declare function isDefinedRouteTerminal(value: unknown): value is DefinedRouteTerminal;
|
|
22
|
+
export declare function adaptDefinedLayout(route: DefinedRouteTerminal, parent: RuntimeRoute | undefined, sourcePath?: string): RuntimeRoute;
|
|
23
|
+
export declare function adaptDefinedPage(route: DefinedRouteTerminal, parent: RuntimeRoute): RuntimePage;
|
|
24
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuntimePage, RuntimeRoute } from "../../client.ts";
|
|
1
|
+
import type { RuntimePage, RuntimeRoute } from "../../client/internal/runtime-types.ts";
|
|
2
2
|
import { type CompileContext } from "../internal.ts";
|
|
3
3
|
import type { ResolvedRoute, RootLayout } from "./types.ts";
|
|
4
4
|
export declare function isModuleNotFoundError(err: unknown): boolean;
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import type { Context } from "elysia";
|
|
2
|
-
import type { RuntimePage, RuntimeRoute } from "../../client.ts";
|
|
2
|
+
import type { RuntimePage, RuntimeRoute } from "../../client/internal/runtime-types.ts";
|
|
3
3
|
import type { SearchRouteMetadata } from "../../shared/search-params.ts";
|
|
4
4
|
import { type CompileContext } from "../internal.ts";
|
|
5
5
|
import type { ResolvedRoute, RootLayout } from "./types.ts";
|
|
6
6
|
type RouteModuleImport = (specifier: string) => Promise<Record<string, unknown>>;
|
|
7
|
-
export declare function importFreshRouteModuleCandidate(layoutPath: string, timestamp: number, resolveImport: RouteModuleImport, ctx: CompileContext | null): Promise<Record<string, unknown> | undefined>;
|
|
8
7
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* Reuses one virtual ESM module per source version. A timestamp generated on
|
|
9
|
+
* every request leaks module-registry entries because Bun cannot release old
|
|
10
|
+
* module identities; the source stamp preserves HMR freshness without
|
|
11
|
+
* request-proportional growth. Promise caching also deduplicates concurrent
|
|
12
|
+
* requests for the same edited version.
|
|
13
|
+
*/
|
|
14
|
+
export declare function importStampedRouteModule(path: string, resolveImport: RouteModuleImport): Promise<Record<string, unknown>>;
|
|
15
|
+
export declare function invalidateStampedRouteModules(): void;
|
|
16
|
+
export declare function importFreshRouteModuleCandidate(layoutPath: string, resolveImport: RouteModuleImport, ctx: CompileContext | null): Promise<Record<string, unknown> | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Re-imports edited intermediate layout _route.tsx files with a versioned
|
|
19
|
+
* module identity, then patches the layout/loader references on the existing
|
|
20
|
+
* route-chain objects.
|
|
13
21
|
*
|
|
14
22
|
* The optional `importFn` parameter exists only for unit testing. In production
|
|
15
23
|
* it defaults to the real `import()`.
|
|
@@ -20,8 +28,8 @@ export declare function refreshLayoutChain(chain: RuntimeRoute[], pagePath: stri
|
|
|
20
28
|
* `mode` reflects the CURRENT contents of the page module — not the value
|
|
21
29
|
* captured at scan time.
|
|
22
30
|
*
|
|
23
|
-
* In dev, `handleDevRequest`
|
|
24
|
-
*
|
|
31
|
+
* In dev, `handleDevRequest` resolves the current versioned page module on
|
|
32
|
+
* every request. Without this
|
|
25
33
|
* function the spread `{ ...route, page, chain }` would carry over the stale
|
|
26
34
|
* `route.mode` resolved at startup, so toggling `revalidate` or removing a
|
|
27
35
|
* loader in source would not retake effect until a server restart.
|
|
@@ -31,7 +39,7 @@ export declare function refreshLayoutChain(chain: RuntimeRoute[], pagePath: stri
|
|
|
31
39
|
* `notFound`) are scan-time invariants in dev and are preserved as-is.
|
|
32
40
|
*/
|
|
33
41
|
export declare function rebuildDevRoute(base: ResolvedRoute, page: RuntimePage, chain: RuntimeRoute[]): ResolvedRoute;
|
|
34
|
-
/** @internal Handles a request in dev mode
|
|
42
|
+
/** @internal Handles a request in dev mode using the current source-version modules. */
|
|
35
43
|
export declare function handleDevRequest(route: ResolvedRoute, ctx: Context, root: RootLayout, searchRoutes?: SearchRouteMetadata[]): Promise<unknown>;
|
|
36
44
|
/**
|
|
37
45
|
* @internal Dev "Live ISR" — caches loader output, not assembled HTML. On a
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import type { RuntimePage, RuntimeRoute } from "../../client.ts";
|
|
1
|
+
import type { RuntimePage, RuntimeRoute } from "../../client/internal/runtime-types.ts";
|
|
2
2
|
export declare function collectIntermediateLayoutDirs(pagePath: string, rootPath: string): string[];
|
|
3
3
|
export declare function resolveMode(page: RuntimePage, routeChain: RuntimeRoute[]): "ssr" | "ssg" | "isr";
|
|
4
|
+
export interface DynamicRouteSegment {
|
|
5
|
+
catchAll: boolean;
|
|
6
|
+
name: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function parseDynamicRouteSegment(segment: string, sourcePath: string | undefined): DynamicRouteSegment | undefined;
|
|
9
|
+
export declare function routeSegmentToPattern(segment: string): string;
|
|
4
10
|
export declare function filePathToPattern(path: string): string;
|
|
5
11
|
export declare function escapeRegExpChar(ch: string): string;
|
|
6
12
|
/**
|
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import { type AnyElysia } from "elysia";
|
|
1
|
+
import { type AnyElysia, type Context } from "elysia";
|
|
2
2
|
import type { SearchRouteMetadata } from "../../shared/search-params.ts";
|
|
3
|
-
import type { ResolvedRoute, RootLayout } from "./types.ts";
|
|
3
|
+
import type { ResolvedRoute, ResolvedRoutesSource, RootLayout } from "./types.ts";
|
|
4
4
|
export declare function createRoutePlugin(route: ResolvedRoute, root: RootLayout, buildId?: string, searchRoutes?: SearchRouteMetadata[]): AnyElysia;
|
|
5
|
+
export declare function renderResolvedRoute(route: ResolvedRoute, ctx: Context, root: RootLayout, buildId: string, searchRoutes: SearchRouteMetadata[] | undefined): unknown;
|
|
5
6
|
/**
|
|
6
7
|
* Elysia plugin that handles `GET /_furin/data?path=<logicalHref>`.
|
|
7
8
|
*
|
|
8
|
-
* Returns
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* serialising, so the client receives all data resolved in one round-trip.
|
|
13
|
-
* SPA navigation calls this endpoint via `parseDeferredNdjson` in
|
|
14
|
-
* `router-provider.tsx`.
|
|
9
|
+
* Returns route-frame loader data for successful routes. Deferred routes stream
|
|
10
|
+
* the initial sync frame first, then append one frame batch per settled Promise.
|
|
11
|
+
* SPA navigation calls this endpoint via `parseDeferredNdjson`, which supports
|
|
12
|
+
* both route frames and legacy NDJSON sentinels.
|
|
15
13
|
*
|
|
16
14
|
* Special fields emitted alongside data:
|
|
17
15
|
* - `__furinStatus: 404` — when the loader called `notFound()`
|
|
18
16
|
* - `__furinNotFound` — not-found payload
|
|
19
17
|
* - `__furinRedirect` — logical path after a server-side redirect
|
|
20
18
|
*/
|
|
21
|
-
export declare function createDataEndpoint(
|
|
19
|
+
export declare function createDataEndpoint(routesSource: ResolvedRoutesSource): AnyElysia;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
1
|
+
import type { RuntimeRoute } from "../../client/internal/runtime-types.ts";
|
|
2
|
+
import { type FurinSchema } from "../../shared/elysia-contract.ts";
|
|
3
3
|
import { type SearchParamsInput, type SearchRouteMetadata } from "../../shared/search-params.ts";
|
|
4
4
|
interface UnknownObject {
|
|
5
5
|
[key: string]: unknown;
|
|
@@ -28,6 +28,13 @@ export type ParseRouteQueryResult = {
|
|
|
28
28
|
errors: unknown;
|
|
29
29
|
ok: false;
|
|
30
30
|
};
|
|
31
|
+
export type ParseRouteParamsResult = {
|
|
32
|
+
ok: true;
|
|
33
|
+
params: UnknownObject;
|
|
34
|
+
} | {
|
|
35
|
+
errors: unknown;
|
|
36
|
+
ok: false;
|
|
37
|
+
};
|
|
31
38
|
/**
|
|
32
39
|
* Parses and validates a logical route URL's search string for the synthetic
|
|
33
40
|
* `/_furin/data` request path. This keeps SPA navigations aligned with the
|
|
@@ -35,17 +42,15 @@ export type ParseRouteQueryResult = {
|
|
|
35
42
|
*
|
|
36
43
|
* @internal Exported for unit testing.
|
|
37
44
|
*/
|
|
38
|
-
export declare function parseRouteQuery(url: URL, schema:
|
|
45
|
+
export declare function parseRouteQuery(url: URL, schema: FurinSchema | undefined): Promise<ParseRouteQueryResult>;
|
|
39
46
|
/**
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
* merged with the same leaf-wins semantics so they are not silently dropped.
|
|
44
|
-
* Returns undefined when no entry in the chain defines the key.
|
|
47
|
+
* Validates and coerces path params for the synthetic `/_furin/data` request
|
|
48
|
+
* path. This mirrors the composed Elysia route schema so SPA loaders receive
|
|
49
|
+
* the same values as full SSR loaders.
|
|
45
50
|
*
|
|
46
51
|
* @internal Exported for unit testing.
|
|
47
52
|
*/
|
|
48
|
-
export declare function
|
|
53
|
+
export declare function parseRouteParams(params: UnknownObject, schema: FurinSchema | undefined): Promise<ParseRouteParamsResult>;
|
|
49
54
|
export declare function createSearchRouteMetadata(routes: Array<{
|
|
50
55
|
pattern: string;
|
|
51
56
|
routeChain: RuntimeRoute[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RuntimePage, RuntimeRoute } from "../../client.ts";
|
|
1
|
+
import type { RuntimePage, RuntimeRoute } from "../../client/internal/runtime-types.ts";
|
|
2
2
|
import type { ErrorComponent } from "../../shared/error.ts";
|
|
3
3
|
import type { NotFoundComponent } from "../../shared/not-found.ts";
|
|
4
4
|
/**
|
|
@@ -50,6 +50,7 @@ export interface ResolvedRoute {
|
|
|
50
50
|
ssgHtml?: string;
|
|
51
51
|
tags?: string[];
|
|
52
52
|
}
|
|
53
|
+
export type ResolvedRoutesSource = ResolvedRoute[] | (() => ResolvedRoute[]);
|
|
53
54
|
export interface RootLayout {
|
|
54
55
|
error?: ErrorComponent;
|
|
55
56
|
errorPath?: string;
|
|
@@ -8,40 +8,48 @@ export interface BeginMutationInput {
|
|
|
8
8
|
key: string;
|
|
9
9
|
principal: string;
|
|
10
10
|
}
|
|
11
|
+
export interface MutationLease {
|
|
12
|
+
id: string;
|
|
13
|
+
key: string;
|
|
14
|
+
leaseMs: number;
|
|
15
|
+
principal: string;
|
|
16
|
+
}
|
|
11
17
|
export type BeginMutationResult = {
|
|
12
18
|
kind: "execute";
|
|
13
|
-
|
|
19
|
+
lease: MutationLease;
|
|
14
20
|
} | {
|
|
15
21
|
kind: "replay";
|
|
16
22
|
response: StoredResponse;
|
|
17
23
|
} | {
|
|
18
24
|
kind: "conflict";
|
|
19
25
|
reason: "in-progress" | "payload-mismatch";
|
|
26
|
+
};
|
|
27
|
+
export type SyncInvalidation = {
|
|
28
|
+
kind: "path";
|
|
29
|
+
path: string;
|
|
30
|
+
type: "layout" | "page";
|
|
20
31
|
} | {
|
|
21
|
-
kind: "
|
|
32
|
+
kind: "tags";
|
|
33
|
+
tags: readonly string[];
|
|
22
34
|
};
|
|
23
|
-
export interface
|
|
24
|
-
|
|
35
|
+
export interface CompleteMutationInput {
|
|
36
|
+
invalidations: readonly SyncInvalidation[];
|
|
37
|
+
lease: MutationLease;
|
|
25
38
|
response: StoredResponse;
|
|
26
39
|
}
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
export type CompleteMutationResult = {
|
|
41
|
+
cursor: string | undefined;
|
|
42
|
+
kind: "committed";
|
|
43
|
+
} | {
|
|
44
|
+
kind: "lost";
|
|
45
|
+
};
|
|
30
46
|
export interface SyncChange {
|
|
31
47
|
cursor: string;
|
|
32
|
-
invalidations: readonly
|
|
33
|
-
}
|
|
34
|
-
export interface AppendChangesInput {
|
|
35
|
-
invalidations: readonly string[];
|
|
36
|
-
path: string;
|
|
37
|
-
}
|
|
38
|
-
export interface AppendChangesResult {
|
|
39
|
-
change: SyncChange;
|
|
48
|
+
invalidations: readonly SyncInvalidation[];
|
|
40
49
|
}
|
|
41
50
|
export interface ReadChangesInput {
|
|
42
51
|
after: string | undefined;
|
|
43
52
|
limit: number;
|
|
44
|
-
path: string;
|
|
45
53
|
}
|
|
46
54
|
export interface ChangePage {
|
|
47
55
|
changes: readonly SyncChange[];
|
|
@@ -49,14 +57,25 @@ export interface ChangePage {
|
|
|
49
57
|
hasMore: boolean;
|
|
50
58
|
reset: boolean;
|
|
51
59
|
}
|
|
52
|
-
export type SyncChangeListener = (change: SyncChange) => void;
|
|
53
|
-
type MaybePromise<T> = Promise<T> | T;
|
|
54
60
|
export interface SyncAdapter {
|
|
55
|
-
abortMutation(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
readChanges(input: ReadChangesInput)
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
abortMutation: (lease: MutationLease) => Promise<void>;
|
|
62
|
+
beginMutation: (input: BeginMutationInput) => Promise<BeginMutationResult>;
|
|
63
|
+
completeMutation: (input: CompleteMutationInput) => Promise<CompleteMutationResult>;
|
|
64
|
+
currentCursor: () => Promise<string>;
|
|
65
|
+
readChanges: (input: ReadChangesInput) => Promise<ChangePage>;
|
|
66
|
+
renewMutation: (lease: MutationLease) => Promise<"lost" | "renewed">;
|
|
67
|
+
readonly scope: "distributed" | "host-local" | "process-local";
|
|
68
|
+
}
|
|
69
|
+
export interface SyncSubscription {
|
|
70
|
+
unsubscribe: () => Promise<void>;
|
|
71
|
+
}
|
|
72
|
+
export interface SyncNotifier {
|
|
73
|
+
publish: (cursor: string) => Promise<void>;
|
|
74
|
+
subscribe: (listener: (cursor: string) => void) => Promise<SyncSubscription>;
|
|
75
|
+
}
|
|
76
|
+
export interface SyncRuntimeOptions {
|
|
77
|
+
adapter: SyncAdapter;
|
|
78
|
+
notifier?: SyncNotifier;
|
|
79
|
+
principal: (context: Context) => Promise<string> | string;
|
|
80
|
+
}
|
|
81
|
+
import type { Context } from "elysia";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import type { SyncRuntimeOptions } from "./adapter.ts";
|
|
2
|
+
export interface FurinSyncOptions extends SyncRuntimeOptions {
|
|
2
3
|
streamPath?: string;
|
|
3
|
-
}
|
|
4
|
+
}
|
|
5
|
+
export type FurinSyncOption = FurinSyncOptions | false;
|
|
4
6
|
export declare function resolveSyncStreamPath(sync: FurinSyncOption | undefined): string | undefined;
|
|
5
7
|
/**
|
|
6
8
|
* Logical (unprefixed) sync stream path for the current request — injected
|
|
@@ -8,10 +10,4 @@ export declare function resolveSyncStreamPath(sync: FurinSyncOption | undefined)
|
|
|
8
10
|
*/
|
|
9
11
|
export declare function getSyncStreamPath(): string | undefined;
|
|
10
12
|
export declare function runWithSyncStreamPath<T>(path: string | undefined, fn: () => T): T;
|
|
11
|
-
|
|
12
|
-
* Physical adapter channels a sync publication must reach. An explicit
|
|
13
|
-
* override wins (historical single-channel behaviour); otherwise every
|
|
14
|
-
* sync-enabled instance gets notified — a mutation on a shared API must wake
|
|
15
|
-
* the SSE clients of every mounted app.
|
|
16
|
-
*/
|
|
17
|
-
export declare function syncPublishChannels(): string[];
|
|
13
|
+
export declare function syncRuntimeOptions(sync: FurinSyncOptions): SyncRuntimeOptions;
|
|
@@ -2,5 +2,6 @@ interface FingerprintInput {
|
|
|
2
2
|
body: unknown;
|
|
3
3
|
request: Request;
|
|
4
4
|
}
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function sha256Hex(source: string): string;
|
|
6
|
+
export declare function createMutationFingerprint(input: FingerprintInput): string;
|
|
6
7
|
export {};
|
|
@@ -1,4 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { getSyncStreamPath as getSyncStreamPathImplementation, resolveSyncStreamPath as resolveSyncStreamPathImplementation, runWithSyncStreamPath as runWithSyncStreamPathImplementation } from "./config.ts";
|
|
2
|
+
import { PollingSyncNotifier as PollingSyncNotifierImplementation } from "./notifier.ts";
|
|
3
|
+
import { furinSync as furinSyncImplementation } from "./plugin.ts";
|
|
4
|
+
import { createSyncStreamPlugin as createSyncStreamPluginImplementation } from "./stream.ts";
|
|
5
|
+
export declare const createSyncStreamPlugin: typeof createSyncStreamPluginImplementation;
|
|
6
|
+
export declare const furinSync: typeof furinSyncImplementation;
|
|
7
|
+
export declare const getSyncStreamPath: typeof getSyncStreamPathImplementation;
|
|
8
|
+
export declare const PollingSyncNotifier: typeof PollingSyncNotifierImplementation;
|
|
9
|
+
export declare const resolveSyncStreamPath: typeof resolveSyncStreamPathImplementation;
|
|
10
|
+
export declare const runWithSyncStreamPath: typeof runWithSyncStreamPathImplementation;
|
|
11
|
+
export type PollingSyncNotifier = PollingSyncNotifierImplementation;
|
|
12
|
+
export type { BeginMutationInput, BeginMutationResult, ChangePage, CompleteMutationInput, CompleteMutationResult, MutationLease, ReadChangesInput, StoredResponse, SyncAdapter, SyncChange, SyncInvalidation, SyncNotifier, SyncRuntimeOptions, SyncSubscription, } from "./adapter.ts";
|
|
13
|
+
export type { FurinSyncOption, FurinSyncOptions } from "./config.ts";
|
|
14
|
+
export type { SyncInput, SyncRouteOption } from "./plugin.ts";
|
|
15
|
+
export type { SyncChangePage } from "./stream.ts";
|