@teyik0/furin 0.2.0-alpha.2 → 0.2.0-alpha.3

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.
Files changed (132) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +33 -33
  3. package/dist/adapter/bun.d.ts +3 -0
  4. package/dist/adapter/static.d.ts +3 -0
  5. package/dist/build/client.d.ts +25 -0
  6. package/dist/build/compile-entry.d.ts +9 -0
  7. package/dist/build/compile-entry.ts +109 -0
  8. package/dist/build/entry-template.d.ts +38 -0
  9. package/dist/build/entry-template.ts +156 -0
  10. package/dist/build/hydrate.d.ts +24 -0
  11. package/dist/build/index.d.ts +8 -0
  12. package/dist/build/index.js +8106 -0
  13. package/dist/build/route-types.d.ts +23 -0
  14. package/dist/build/scan-server.d.ts +8 -0
  15. package/dist/build/server-routes-entry.d.ts +13 -0
  16. package/dist/build/server-routes-entry.ts +36 -0
  17. package/dist/build/shared.d.ts +12 -0
  18. package/dist/build/ssg-cache.d.ts +4 -0
  19. package/dist/build/types.d.ts +80 -0
  20. package/dist/cli/config.d.ts +9 -0
  21. package/dist/cli/index.d.ts +2 -0
  22. package/dist/cli/index.js +8097 -0
  23. package/dist/client/boundaries.d.ts +117 -0
  24. package/dist/client/default-screens.d.ts +17 -0
  25. package/dist/client/link.d.ts +22 -0
  26. package/dist/client/link.js +4244 -0
  27. package/dist/client/router/boundary-tree.d.ts +26 -0
  28. package/dist/client/router/context.d.ts +8 -0
  29. package/dist/client/router/history.d.ts +9 -0
  30. package/dist/client/router/index.d.ts +11 -0
  31. package/dist/client/router/link-utils.d.ts +53 -0
  32. package/dist/client/router/navigation.d.ts +10 -0
  33. package/dist/client/router/provider.d.ts +4 -0
  34. package/dist/client/router/search/index.d.ts +18 -0
  35. package/dist/client/router/search-store.d.ts +21 -0
  36. package/dist/client/router/spa-response.d.ts +58 -0
  37. package/dist/client/router/types.d.ts +292 -0
  38. package/dist/client/server-error.d.ts +12 -0
  39. package/dist/client/sync.d.ts +25 -0
  40. package/dist/client.d.ts +243 -0
  41. package/dist/client.js +140 -0
  42. package/dist/config.d.ts +57 -0
  43. package/dist/config.js +29 -0
  44. package/dist/env.d.ts +50 -0
  45. package/dist/furin.d.ts +77 -0
  46. package/dist/furin.js +8693 -0
  47. package/dist/plugin/index.d.ts +20 -0
  48. package/dist/plugin/index.js +1500 -0
  49. package/dist/plugin/transform-client.d.ts +10 -0
  50. package/dist/server/auto-invalidate/index.d.ts +4 -0
  51. package/dist/server/auto-invalidate/plugin.d.ts +38 -0
  52. package/dist/server/auto-invalidate/registry.d.ts +9 -0
  53. package/dist/server/auto-invalidate/runtime.d.ts +9 -0
  54. package/dist/server/auto-invalidate/types.d.ts +12 -0
  55. package/dist/server/cache/dev-loader.d.ts +28 -0
  56. package/dist/server/cache/index.d.ts +10 -0
  57. package/dist/server/cache/invalidation.d.ts +12 -0
  58. package/dist/server/cache/isr-ssg.d.ts +26 -0
  59. package/dist/server/cache/isr.d.ts +6 -0
  60. package/dist/server/cache/registry.d.ts +5 -0
  61. package/dist/server/cache/route-cache.d.ts +26 -0
  62. package/dist/server/cache/ssg.d.ts +5 -0
  63. package/dist/server/context-logger.d.ts +28 -0
  64. package/dist/server/dev-inspector.d.ts +89 -0
  65. package/dist/server/dev-page-plugin.d.ts +112 -0
  66. package/dist/server/internal.d.ts +35 -0
  67. package/dist/server/internal.js +17 -0
  68. package/dist/server/lang-detect.d.ts +5 -0
  69. package/dist/server/render/assemble.d.ts +49 -0
  70. package/dist/server/render/element.d.ts +24 -0
  71. package/dist/server/render/index.d.ts +7 -0
  72. package/dist/server/render/index.ts +22 -0
  73. package/dist/server/render/isr.d.ts +4 -0
  74. package/dist/server/render/loaders.d.ts +64 -0
  75. package/dist/server/render/not-found.d.ts +6 -0
  76. package/dist/server/render/shell.d.ts +39 -0
  77. package/dist/server/render/shell.ts +202 -0
  78. package/dist/server/render/ssg.d.ts +9 -0
  79. package/dist/server/render/ssr.d.ts +108 -0
  80. package/dist/server/render/template.d.ts +6 -0
  81. package/dist/server/router/discovery.d.ts +16 -0
  82. package/dist/server/router/hmr.d.ts +65 -0
  83. package/dist/server/router/index.d.ts +6 -0
  84. package/dist/server/router/index.js +27 -0
  85. package/dist/server/router/index.ts +28 -0
  86. package/dist/server/router/patterns.d.ts +40 -0
  87. package/dist/server/router/plugin.d.ts +21 -0
  88. package/dist/server/router/schemas.d.ts +59 -0
  89. package/dist/server/router/types.d.ts +60 -0
  90. package/dist/server/runtime-env.d.ts +3 -0
  91. package/dist/server/runtime-env.js +10 -0
  92. package/dist/server/sync/config.d.ts +6 -0
  93. package/dist/server/sync/index.d.ts +4 -0
  94. package/dist/server/sync/plugin.d.ts +369 -0
  95. package/dist/server/sync/stream.d.ts +47 -0
  96. package/dist/shared/await.d.ts +67 -0
  97. package/dist/shared/deferred-ndjson.d.ts +32 -0
  98. package/dist/shared/digest.d.ts +16 -0
  99. package/dist/shared/error.d.ts +37 -0
  100. package/dist/shared/not-found.d.ts +19 -0
  101. package/dist/shared/search-params.d.ts +17 -0
  102. package/dist/shared/utils/ast-walk.d.ts +18 -0
  103. package/dist/shared/utils/index.d.ts +13 -0
  104. package/package.json +5 -5
  105. package/src/adapter/README.md +13 -13
  106. package/src/build/client.ts +152 -152
  107. package/src/build/compile-entry.ts +109 -109
  108. package/src/build/entry-template.ts +156 -156
  109. package/src/build/hydrate.ts +340 -337
  110. package/src/build/index.ts +152 -152
  111. package/src/build/route-types.ts +145 -145
  112. package/src/build/scan-server.ts +95 -95
  113. package/src/build/server-routes-entry.ts +36 -36
  114. package/src/build/shared.ts +80 -79
  115. package/src/build/ssg-cache.ts +32 -32
  116. package/src/build/types.ts +89 -89
  117. package/src/client/router/link-utils.ts +184 -177
  118. package/src/client/router/provider.tsx +804 -759
  119. package/src/client/router/types.ts +276 -271
  120. package/src/client/sync.ts +98 -0
  121. package/src/client.ts +369 -355
  122. package/src/furin.ts +465 -444
  123. package/src/server/auto-invalidate/runtime.ts +134 -133
  124. package/src/server/dev-page-plugin.ts +454 -449
  125. package/src/server/render/assemble.ts +160 -133
  126. package/src/server/render/isr.ts +323 -317
  127. package/src/server/render/ssr.ts +585 -583
  128. package/src/server/router/plugin.ts +384 -384
  129. package/src/server/sync/config.ts +29 -0
  130. package/src/server/sync/index.ts +14 -0
  131. package/src/server/sync/plugin.ts +108 -0
  132. package/src/server/sync/stream.ts +144 -0
@@ -0,0 +1,59 @@
1
+ import type { AnySchema } from "elysia/types";
2
+ import type { RuntimeRoute } from "../../client.ts";
3
+ import { type SearchParamsInput, type SearchRouteMetadata } from "../../shared/search-params.ts";
4
+ interface UnknownObject {
5
+ [key: string]: unknown;
6
+ }
7
+ /**
8
+ * Parses the `?path=` argument of `/_furin/data`, rejecting absolute /
9
+ * protocol-relative inputs that would let a caller smuggle a foreign origin
10
+ * into the synthetic loader request.
11
+ *
12
+ * Returns `{ url, pathname }` on success, or `undefined` when the input is
13
+ * unsafe (the caller should reply 400). `new URL(rawPath, base)` ignores the
14
+ * base when `rawPath` is itself absolute, so without these prefix and origin
15
+ * checks a value like `https://evil.com/foo` would propagate to
16
+ * `syntheticRequest.url`.
17
+ *
18
+ * @internal Exported for unit testing.
19
+ */
20
+ export declare function parseDataEndpointPath(rawPath: string): {
21
+ url: URL;
22
+ pathname: string;
23
+ } | undefined;
24
+ export type ParseRouteQueryResult = {
25
+ ok: true;
26
+ query: SearchParamsInput;
27
+ } | {
28
+ errors: unknown;
29
+ ok: false;
30
+ };
31
+ /**
32
+ * Parses and validates a logical route URL's search string for the synthetic
33
+ * `/_furin/data` request path. This keeps SPA navigations aligned with the
34
+ * Elysia guard used by the full SSR route.
35
+ *
36
+ * @internal Exported for unit testing.
37
+ */
38
+ export declare function parseRouteQuery(url: URL, schema: AnySchema | undefined): Promise<ParseRouteQueryResult>;
39
+ /**
40
+ * Merges TObject schemas from all routeChain entries for a given key.
41
+ * Properties are spread left-to-right (leaf wins on key conflict).
42
+ * Object-level options (additionalProperties, $id, description, …) are also
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.
45
+ *
46
+ * @internal Exported for unit testing.
47
+ */
48
+ export declare function mergeRouteSchemas(routeChain: RuntimeRoute[], key: "params" | "query"): AnySchema | undefined;
49
+ export declare function createSearchRouteMetadata(routes: Array<{
50
+ pattern: string;
51
+ routeChain: RuntimeRoute[];
52
+ }>): SearchRouteMetadata[];
53
+ /**
54
+ * Applies top-level `default` values from a TypeBox TObject schema to a
55
+ * values record. Used in the `/_furin/data` endpoint so loaders see the same
56
+ * defaulted query objects that the SSR path produces via Elysia's guard.
57
+ */
58
+ export declare function applySchemaDefaults(schema: UnknownObject | undefined, values: UnknownObject): UnknownObject;
59
+ export {};
@@ -0,0 +1,60 @@
1
+ import type { RuntimePage, RuntimeRoute } from "../../client.ts";
2
+ import type { ErrorComponent } from "../../shared/error.ts";
3
+ import type { NotFoundComponent } from "../../shared/not-found.ts";
4
+ /**
5
+ * A single directory-scoped boundary declaration.
6
+ *
7
+ * Each entry represents ONE directory on the path from `pagesDir` to the page
8
+ * file. `error` / `notFound` hold the components defined IN THAT DIRECTORY
9
+ * only — never inherited from a parent. This 1:1 tie between directory and
10
+ * entry is what lets the render layer insert React error boundaries at the
11
+ * exact nesting level where the user authored them (Next.js app-router model).
12
+ */
13
+ export interface SegmentBoundary {
14
+ /** 0 = `pagesDir`; increments with each nested subdirectory. */
15
+ depth: number;
16
+ error?: ErrorComponent;
17
+ /**
18
+ * Absolute path to the `error.tsx` module, when present. Carried alongside
19
+ * the component so the client hydrate entry can emit a static `import`
20
+ * statement for each unique convention file — a component reference alone
21
+ * can't survive the server→client boundary.
22
+ */
23
+ errorPath?: string;
24
+ notFound?: NotFoundComponent;
25
+ /** Absolute path to the `not-found.tsx` module, when present. */
26
+ notFoundPath?: string;
27
+ /** Absolute directory path. */
28
+ path: string;
29
+ }
30
+ export interface ResolvedRoute {
31
+ error?: ErrorComponent;
32
+ isrCache?: {
33
+ html: string;
34
+ generatedAt: number;
35
+ revalidate: number;
36
+ };
37
+ mode: "ssr" | "ssg" | "isr";
38
+ notFound?: NotFoundComponent;
39
+ page: RuntimePage;
40
+ path: string;
41
+ pattern: string;
42
+ routeChain: RuntimeRoute[];
43
+ /**
44
+ * Per-directory boundary chain, ordered shallow → deep. Only directories
45
+ * that DECLARE at least one of `error.tsx` / `not-found.tsx` are included;
46
+ * directories without conventions are skipped. Empty when no conventions
47
+ * exist anywhere in the path.
48
+ */
49
+ segmentBoundaries: SegmentBoundary[];
50
+ ssgHtml?: string;
51
+ tags?: string[];
52
+ }
53
+ export interface RootLayout {
54
+ error?: ErrorComponent;
55
+ errorPath?: string;
56
+ notFound?: NotFoundComponent;
57
+ notFoundPath?: string;
58
+ path: string;
59
+ route: RuntimeRoute;
60
+ }
@@ -0,0 +1,3 @@
1
+ export declare let IS_DEV: boolean;
2
+ /** @internal test-only — overrides IS_DEV via live binding */
3
+ export declare function __setDevMode(val: boolean): void;
@@ -0,0 +1,10 @@
1
+ // @bun
2
+ // src/server/runtime-env.ts
3
+ var IS_DEV = true;
4
+ function __setDevMode(val) {
5
+ IS_DEV = val;
6
+ }
7
+ export {
8
+ __setDevMode,
9
+ IS_DEV
10
+ };
@@ -0,0 +1,6 @@
1
+ export type FurinSyncOption = boolean | {
2
+ streamPath?: string;
3
+ };
4
+ export declare function resolveSyncStreamPath(sync: FurinSyncOption | undefined): string | undefined;
5
+ export declare function getSyncStreamPath(): string | undefined;
6
+ export declare function runWithSyncStreamPath<T>(path: string | undefined, fn: () => T): T;
@@ -0,0 +1,4 @@
1
+ export type { FurinSyncOption } from "./config.ts";
2
+ export { getSyncStreamPath, resolveSyncStreamPath, runWithSyncStreamPath, } from "./config.ts";
3
+ export { furinSync, type SyncInput } from "./plugin.ts";
4
+ export { __resetSyncState, createSyncStreamPlugin, publishSyncInvalidation, type SyncInvalidationEvent, } from "./stream.ts";
@@ -0,0 +1,369 @@
1
+ import { type AfterHandler, Elysia } from "elysia";
2
+ import type { InvalidationInput } from "../auto-invalidate/types.ts";
3
+ export type SyncInput = InvalidationInput | {
4
+ invalidate: InvalidationInput;
5
+ };
6
+ type AnyHandlerContext = Parameters<AfterHandler>[0];
7
+ export declare function furinSync(): Elysia<"", {
8
+ decorator: {};
9
+ store: {};
10
+ derive: {};
11
+ resolve: {};
12
+ }, {
13
+ typebox: {};
14
+ error: {};
15
+ }, {
16
+ schema: {};
17
+ standaloneSchema: {};
18
+ macro: Partial<{
19
+ readonly sync: SyncInput;
20
+ }>;
21
+ macroFn: {
22
+ readonly sync: (input: SyncInput) => {
23
+ readonly beforeHandle: (ctx: {
24
+ body: unknown;
25
+ query: Record<string, string>;
26
+ params: {};
27
+ headers: Record<string, string | undefined>;
28
+ cookie: Record<string, import("elysia").Cookie<unknown>>;
29
+ server: import("elysia/universal/server").Server | null;
30
+ redirect: import("elysia").redirect;
31
+ set: {
32
+ headers: import("elysia").HTTPHeaders;
33
+ status?: number | keyof import("elysia").StatusMap;
34
+ redirect?: string;
35
+ cookie?: Record<string, import("elysia/cookies").ElysiaCookie>;
36
+ };
37
+ path: string;
38
+ route: string;
39
+ request: Request;
40
+ store: {};
41
+ status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 301 | 302 | 303 | 307 | 308 | 200 | 300 | 404 | 500 | 304 | 400 | 422 | 100 | 428 | 409 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 401 | 402 | 403 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 423 | 424 | 425 | 426 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
42
+ readonly 100: "Continue";
43
+ readonly 101: "Switching Protocols";
44
+ readonly 102: "Processing";
45
+ readonly 103: "Early Hints";
46
+ readonly 200: "OK";
47
+ readonly 201: "Created";
48
+ readonly 202: "Accepted";
49
+ readonly 203: "Non-Authoritative Information";
50
+ readonly 204: "No Content";
51
+ readonly 205: "Reset Content";
52
+ readonly 206: "Partial Content";
53
+ readonly 207: "Multi-Status";
54
+ readonly 208: "Already Reported";
55
+ readonly 300: "Multiple Choices";
56
+ readonly 301: "Moved Permanently";
57
+ readonly 302: "Found";
58
+ readonly 303: "See Other";
59
+ readonly 304: "Not Modified";
60
+ readonly 307: "Temporary Redirect";
61
+ readonly 308: "Permanent Redirect";
62
+ readonly 400: "Bad Request";
63
+ readonly 401: "Unauthorized";
64
+ readonly 402: "Payment Required";
65
+ readonly 403: "Forbidden";
66
+ readonly 404: "Not Found";
67
+ readonly 405: "Method Not Allowed";
68
+ readonly 406: "Not Acceptable";
69
+ readonly 407: "Proxy Authentication Required";
70
+ readonly 408: "Request Timeout";
71
+ readonly 409: "Conflict";
72
+ readonly 410: "Gone";
73
+ readonly 411: "Length Required";
74
+ readonly 412: "Precondition Failed";
75
+ readonly 413: "Payload Too Large";
76
+ readonly 414: "URI Too Long";
77
+ readonly 415: "Unsupported Media Type";
78
+ readonly 416: "Range Not Satisfiable";
79
+ readonly 417: "Expectation Failed";
80
+ readonly 418: "I'm a teapot";
81
+ readonly 420: "Enhance Your Calm";
82
+ readonly 421: "Misdirected Request";
83
+ readonly 422: "Unprocessable Content";
84
+ readonly 423: "Locked";
85
+ readonly 424: "Failed Dependency";
86
+ readonly 425: "Too Early";
87
+ readonly 426: "Upgrade Required";
88
+ readonly 428: "Precondition Required";
89
+ readonly 429: "Too Many Requests";
90
+ readonly 431: "Request Header Fields Too Large";
91
+ readonly 451: "Unavailable For Legal Reasons";
92
+ readonly 500: "Internal Server Error";
93
+ readonly 501: "Not Implemented";
94
+ readonly 502: "Bad Gateway";
95
+ readonly 503: "Service Unavailable";
96
+ readonly 504: "Gateway Timeout";
97
+ readonly 505: "HTTP Version Not Supported";
98
+ readonly 506: "Variant Also Negotiates";
99
+ readonly 507: "Insufficient Storage";
100
+ readonly 508: "Loop Detected";
101
+ readonly 510: "Not Extended";
102
+ readonly 511: "Network Authentication Required";
103
+ }[Code] : Code>(code: Code, response?: T) => import("elysia").ElysiaCustomStatusResponse<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
104
+ readonly Continue: 100;
105
+ readonly "Switching Protocols": 101;
106
+ readonly Processing: 102;
107
+ readonly "Early Hints": 103;
108
+ readonly OK: 200;
109
+ readonly Created: 201;
110
+ readonly Accepted: 202;
111
+ readonly "Non-Authoritative Information": 203;
112
+ readonly "No Content": 204;
113
+ readonly "Reset Content": 205;
114
+ readonly "Partial Content": 206;
115
+ readonly "Multi-Status": 207;
116
+ readonly "Already Reported": 208;
117
+ readonly "Multiple Choices": 300;
118
+ readonly "Moved Permanently": 301;
119
+ readonly Found: 302;
120
+ readonly "See Other": 303;
121
+ readonly "Not Modified": 304;
122
+ readonly "Temporary Redirect": 307;
123
+ readonly "Permanent Redirect": 308;
124
+ readonly "Bad Request": 400;
125
+ readonly Unauthorized: 401;
126
+ readonly "Payment Required": 402;
127
+ readonly Forbidden: 403;
128
+ readonly "Not Found": 404;
129
+ readonly "Method Not Allowed": 405;
130
+ readonly "Not Acceptable": 406;
131
+ readonly "Proxy Authentication Required": 407;
132
+ readonly "Request Timeout": 408;
133
+ readonly Conflict: 409;
134
+ readonly Gone: 410;
135
+ readonly "Length Required": 411;
136
+ readonly "Precondition Failed": 412;
137
+ readonly "Payload Too Large": 413;
138
+ readonly "URI Too Long": 414;
139
+ readonly "Unsupported Media Type": 415;
140
+ readonly "Range Not Satisfiable": 416;
141
+ readonly "Expectation Failed": 417;
142
+ readonly "I'm a teapot": 418;
143
+ readonly "Enhance Your Calm": 420;
144
+ readonly "Misdirected Request": 421;
145
+ readonly "Unprocessable Content": 422;
146
+ readonly Locked: 423;
147
+ readonly "Failed Dependency": 424;
148
+ readonly "Too Early": 425;
149
+ readonly "Upgrade Required": 426;
150
+ readonly "Precondition Required": 428;
151
+ readonly "Too Many Requests": 429;
152
+ readonly "Request Header Fields Too Large": 431;
153
+ readonly "Unavailable For Legal Reasons": 451;
154
+ readonly "Internal Server Error": 500;
155
+ readonly "Not Implemented": 501;
156
+ readonly "Bad Gateway": 502;
157
+ readonly "Service Unavailable": 503;
158
+ readonly "Gateway Timeout": 504;
159
+ readonly "HTTP Version Not Supported": 505;
160
+ readonly "Variant Also Negotiates": 506;
161
+ readonly "Insufficient Storage": 507;
162
+ readonly "Loop Detected": 508;
163
+ readonly "Not Extended": 510;
164
+ readonly "Network Authentication Required": 511;
165
+ }[Code] : Code>;
166
+ }) => Response | undefined;
167
+ readonly afterHandle: (ctx: AnyHandlerContext) => void;
168
+ readonly error: ({ request }: {
169
+ body: unknown;
170
+ query: Record<string, string | undefined>;
171
+ params: {};
172
+ headers: Record<string, string | undefined>;
173
+ cookie: Record<string, import("elysia").Cookie<string | undefined>>;
174
+ server: import("elysia/universal/server").Server | null;
175
+ redirect: import("elysia").redirect;
176
+ set: {
177
+ headers: import("elysia").HTTPHeaders;
178
+ status?: number | keyof import("elysia").StatusMap;
179
+ redirect?: string;
180
+ cookie?: Record<string, import("elysia/cookies").ElysiaCookie>;
181
+ };
182
+ status: <const Code extends number | keyof import("elysia").StatusMap, const T = Code extends 301 | 302 | 303 | 307 | 308 | 200 | 300 | 404 | 500 | 304 | 400 | 422 | 100 | 428 | 409 | 101 | 102 | 103 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 401 | 402 | 403 | 405 | 406 | 407 | 408 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 420 | 421 | 423 | 424 | 425 | 426 | 429 | 431 | 451 | 501 | 502 | 503 | 504 | 505 | 506 | 507 | 508 | 510 | 511 ? {
183
+ readonly 100: "Continue";
184
+ readonly 101: "Switching Protocols";
185
+ readonly 102: "Processing";
186
+ readonly 103: "Early Hints";
187
+ readonly 200: "OK";
188
+ readonly 201: "Created";
189
+ readonly 202: "Accepted";
190
+ readonly 203: "Non-Authoritative Information";
191
+ readonly 204: "No Content";
192
+ readonly 205: "Reset Content";
193
+ readonly 206: "Partial Content";
194
+ readonly 207: "Multi-Status";
195
+ readonly 208: "Already Reported";
196
+ readonly 300: "Multiple Choices";
197
+ readonly 301: "Moved Permanently";
198
+ readonly 302: "Found";
199
+ readonly 303: "See Other";
200
+ readonly 304: "Not Modified";
201
+ readonly 307: "Temporary Redirect";
202
+ readonly 308: "Permanent Redirect";
203
+ readonly 400: "Bad Request";
204
+ readonly 401: "Unauthorized";
205
+ readonly 402: "Payment Required";
206
+ readonly 403: "Forbidden";
207
+ readonly 404: "Not Found";
208
+ readonly 405: "Method Not Allowed";
209
+ readonly 406: "Not Acceptable";
210
+ readonly 407: "Proxy Authentication Required";
211
+ readonly 408: "Request Timeout";
212
+ readonly 409: "Conflict";
213
+ readonly 410: "Gone";
214
+ readonly 411: "Length Required";
215
+ readonly 412: "Precondition Failed";
216
+ readonly 413: "Payload Too Large";
217
+ readonly 414: "URI Too Long";
218
+ readonly 415: "Unsupported Media Type";
219
+ readonly 416: "Range Not Satisfiable";
220
+ readonly 417: "Expectation Failed";
221
+ readonly 418: "I'm a teapot";
222
+ readonly 420: "Enhance Your Calm";
223
+ readonly 421: "Misdirected Request";
224
+ readonly 422: "Unprocessable Content";
225
+ readonly 423: "Locked";
226
+ readonly 424: "Failed Dependency";
227
+ readonly 425: "Too Early";
228
+ readonly 426: "Upgrade Required";
229
+ readonly 428: "Precondition Required";
230
+ readonly 429: "Too Many Requests";
231
+ readonly 431: "Request Header Fields Too Large";
232
+ readonly 451: "Unavailable For Legal Reasons";
233
+ readonly 500: "Internal Server Error";
234
+ readonly 501: "Not Implemented";
235
+ readonly 502: "Bad Gateway";
236
+ readonly 503: "Service Unavailable";
237
+ readonly 504: "Gateway Timeout";
238
+ readonly 505: "HTTP Version Not Supported";
239
+ readonly 506: "Variant Also Negotiates";
240
+ readonly 507: "Insufficient Storage";
241
+ readonly 508: "Loop Detected";
242
+ readonly 510: "Not Extended";
243
+ readonly 511: "Network Authentication Required";
244
+ }[Code] : Code>(code: Code, response?: T) => import("elysia").ElysiaCustomStatusResponse<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Bad Request" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
245
+ readonly Continue: 100;
246
+ readonly "Switching Protocols": 101;
247
+ readonly Processing: 102;
248
+ readonly "Early Hints": 103;
249
+ readonly OK: 200;
250
+ readonly Created: 201;
251
+ readonly Accepted: 202;
252
+ readonly "Non-Authoritative Information": 203;
253
+ readonly "No Content": 204;
254
+ readonly "Reset Content": 205;
255
+ readonly "Partial Content": 206;
256
+ readonly "Multi-Status": 207;
257
+ readonly "Already Reported": 208;
258
+ readonly "Multiple Choices": 300;
259
+ readonly "Moved Permanently": 301;
260
+ readonly Found: 302;
261
+ readonly "See Other": 303;
262
+ readonly "Not Modified": 304;
263
+ readonly "Temporary Redirect": 307;
264
+ readonly "Permanent Redirect": 308;
265
+ readonly "Bad Request": 400;
266
+ readonly Unauthorized: 401;
267
+ readonly "Payment Required": 402;
268
+ readonly Forbidden: 403;
269
+ readonly "Not Found": 404;
270
+ readonly "Method Not Allowed": 405;
271
+ readonly "Not Acceptable": 406;
272
+ readonly "Proxy Authentication Required": 407;
273
+ readonly "Request Timeout": 408;
274
+ readonly Conflict: 409;
275
+ readonly Gone: 410;
276
+ readonly "Length Required": 411;
277
+ readonly "Precondition Failed": 412;
278
+ readonly "Payload Too Large": 413;
279
+ readonly "URI Too Long": 414;
280
+ readonly "Unsupported Media Type": 415;
281
+ readonly "Range Not Satisfiable": 416;
282
+ readonly "Expectation Failed": 417;
283
+ readonly "I'm a teapot": 418;
284
+ readonly "Enhance Your Calm": 420;
285
+ readonly "Misdirected Request": 421;
286
+ readonly "Unprocessable Content": 422;
287
+ readonly Locked: 423;
288
+ readonly "Failed Dependency": 424;
289
+ readonly "Too Early": 425;
290
+ readonly "Upgrade Required": 426;
291
+ readonly "Precondition Required": 428;
292
+ readonly "Too Many Requests": 429;
293
+ readonly "Request Header Fields Too Large": 431;
294
+ readonly "Unavailable For Legal Reasons": 451;
295
+ readonly "Internal Server Error": 500;
296
+ readonly "Not Implemented": 501;
297
+ readonly "Bad Gateway": 502;
298
+ readonly "Service Unavailable": 503;
299
+ readonly "Gateway Timeout": 504;
300
+ readonly "HTTP Version Not Supported": 505;
301
+ readonly "Variant Also Negotiates": 506;
302
+ readonly "Insufficient Storage": 507;
303
+ readonly "Loop Detected": 508;
304
+ readonly "Not Extended": 510;
305
+ readonly "Network Authentication Required": 511;
306
+ }[Code] : Code>;
307
+ path: string;
308
+ route: string;
309
+ request: Request;
310
+ store: {};
311
+ } & ({
312
+ request: Request;
313
+ code: "UNKNOWN";
314
+ error: Readonly<Error>;
315
+ set: import("elysia").Context["set"];
316
+ } | {
317
+ request: Request;
318
+ code: "VALIDATION";
319
+ error: Readonly<import("elysia").ValidationError>;
320
+ set: import("elysia").Context["set"];
321
+ } | {
322
+ request: Request;
323
+ code: "NOT_FOUND";
324
+ error: Readonly<import("elysia").NotFoundError>;
325
+ set: import("elysia").Context["set"];
326
+ } | {
327
+ request: Request;
328
+ code: "PARSE";
329
+ error: Readonly<import("elysia").ParseError>;
330
+ set: import("elysia").Context["set"];
331
+ } | {
332
+ request: Request;
333
+ code: "INTERNAL_SERVER_ERROR";
334
+ error: Readonly<import("elysia").InternalServerError>;
335
+ set: import("elysia").Context["set"];
336
+ } | {
337
+ request: Request;
338
+ code: "INVALID_COOKIE_SIGNATURE";
339
+ error: Readonly<import("elysia").InvalidCookieSignature>;
340
+ set: import("elysia").Context["set"];
341
+ } | {
342
+ request: Request;
343
+ code: "INVALID_FILE_TYPE";
344
+ error: Readonly<import("elysia").InvalidFileType>;
345
+ set: import("elysia").Context["set"];
346
+ } | {
347
+ request: Request;
348
+ code: number;
349
+ error: Readonly<import("elysia").ElysiaCustomStatusResponse<number>>;
350
+ set: import("elysia").Context["set"];
351
+ })) => void;
352
+ };
353
+ };
354
+ parser: {};
355
+ response: {};
356
+ }, {}, {
357
+ derive: {};
358
+ resolve: {};
359
+ schema: {};
360
+ standaloneSchema: {};
361
+ response: {};
362
+ }, {
363
+ derive: {};
364
+ resolve: {};
365
+ schema: {};
366
+ standaloneSchema: {};
367
+ response: {};
368
+ }>;
369
+ export {};
@@ -0,0 +1,47 @@
1
+ import { Elysia } from "elysia";
2
+ export interface SyncInvalidationEvent {
3
+ invalidations: readonly string[];
4
+ }
5
+ export declare function publishSyncInvalidation(invalidations: readonly string[]): void;
6
+ export declare function createSyncStreamPlugin(path?: string): Elysia<"", {
7
+ decorator: {};
8
+ store: {};
9
+ derive: {};
10
+ resolve: {};
11
+ }, {
12
+ typebox: {};
13
+ error: {};
14
+ }, {
15
+ schema: {};
16
+ standaloneSchema: {};
17
+ macro: {};
18
+ macroFn: {};
19
+ parser: {};
20
+ response: {};
21
+ }, {
22
+ [x: string]: {
23
+ get: {
24
+ body: unknown;
25
+ params: {};
26
+ query: unknown;
27
+ headers: unknown;
28
+ response: {
29
+ 200: Response;
30
+ };
31
+ };
32
+ };
33
+ }, {
34
+ derive: {};
35
+ resolve: {};
36
+ schema: {};
37
+ standaloneSchema: {};
38
+ response: {};
39
+ }, {
40
+ derive: {};
41
+ resolve: {};
42
+ schema: {};
43
+ standaloneSchema: {};
44
+ response: {};
45
+ }>;
46
+ /** @internal — resets process-local stream subscribers between tests. */
47
+ export declare function __resetSyncState(): void;
@@ -0,0 +1,67 @@
1
+ import { type ReactNode } from "react";
2
+ /**
3
+ * Context used to pass the caught error from `AsyncErrorBoundary` down to
4
+ * `errorElement` children so they can read it via `useAsyncError()`.
5
+ */
6
+ export declare const AsyncErrorContext: import("react").Context<unknown>;
7
+ /**
8
+ * Inside an `<Await errorElement={...}>`, returns the error that caused the
9
+ * deferred Promise to reject. Throws outside of an error-boundary subtree.
10
+ */
11
+ export declare function useAsyncError(): unknown;
12
+ /**
13
+ * Inside a resolved `<Await>`, returns the resolved value via React 19's
14
+ * `use()`. Can be used as an alternative to the render-prop children API.
15
+ *
16
+ * Must be used inside a component that is rendered as children of `<Await>`.
17
+ */
18
+ export declare function useAsyncValue<T>(): T;
19
+ export interface AwaitProps<T> {
20
+ /**
21
+ * Render-prop children: called with the resolved value once the Promise
22
+ * settles. The returned `ReactNode` is rendered inside a Suspense boundary.
23
+ *
24
+ * Marked optional here so `createElement(Await, props, renderFn)` is
25
+ * accepted by TypeScript — the 3rd argument to `createElement` becomes
26
+ * `children` at runtime and is always required for correct behaviour.
27
+ */
28
+ children?: (value: T) => ReactNode;
29
+ /**
30
+ * Rendered when the Promise rejects. Inside this subtree, `useAsyncError()`
31
+ * returns the rejection reason. When omitted the error propagates up to the
32
+ * next React error boundary.
33
+ */
34
+ errorElement?: ReactNode;
35
+ /**
36
+ * The deferred Promise to await. Passed as a prop so React's `use()` can
37
+ * suspend the boundary until it resolves. This is the same Promise object
38
+ * that the loader returned inside `defer()`.
39
+ */
40
+ resolve: Promise<T>;
41
+ }
42
+ /**
43
+ * Deferred-data boundary component. Uses React 19's `use()` to suspend the
44
+ * render until `resolve` settles, then calls the render-prop `children` with
45
+ * the resolved value.
46
+ *
47
+ * Wrap with `<Suspense fallback={…}>` to show a loading indicator while the
48
+ * Promise is pending.
49
+ *
50
+ * @example
51
+ * ```tsx
52
+ * export default route.page({
53
+ * loader: () => defer({ board: "x", stats: fetchStats() }),
54
+ * component: ({ board, stats }) => (
55
+ * <div>
56
+ * <h1>{board}</h1>
57
+ * <Suspense fallback={<Spinner />}>
58
+ * <Await resolve={stats}>
59
+ * {(s) => <StatsBar stats={s} />}
60
+ * </Await>
61
+ * </Suspense>
62
+ * </div>
63
+ * ),
64
+ * });
65
+ * ```
66
+ */
67
+ export declare function Await<T>({ resolve, errorElement, children }: AwaitProps<T>): ReactNode;