@sveltejs/kit 2.26.1 → 2.27.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 +1 -1
- package/package.json +3 -2
- package/src/core/adapt/builder.js +6 -1
- package/src/core/config/options.js +4 -0
- package/src/core/generate_manifest/index.js +4 -1
- package/src/core/postbuild/analyse.js +25 -1
- package/src/core/postbuild/fallback.js +2 -1
- package/src/core/postbuild/prerender.js +41 -10
- package/src/core/sync/create_manifest_data/index.js +35 -1
- package/src/core/sync/write_server.js +4 -2
- package/src/exports/index.js +1 -1
- package/src/exports/internal/index.js +3 -1
- package/src/exports/internal/remote-functions.js +21 -0
- package/src/exports/public.d.ts +162 -2
- package/src/exports/vite/build/build_remote.js +129 -0
- package/src/exports/vite/dev/index.js +7 -0
- package/src/exports/vite/index.js +123 -8
- package/src/exports/vite/preview/index.js +3 -1
- package/src/runtime/app/navigation.js +1 -0
- package/src/runtime/app/server/index.js +2 -0
- package/src/runtime/app/server/remote/command.js +91 -0
- package/src/runtime/app/server/remote/form.js +124 -0
- package/src/runtime/app/server/remote/index.js +4 -0
- package/src/runtime/app/server/remote/prerender.js +163 -0
- package/src/runtime/app/server/remote/query.js +115 -0
- package/src/runtime/app/server/remote/shared.js +153 -0
- package/src/runtime/client/client.js +107 -39
- package/src/runtime/client/fetcher.js +1 -1
- package/src/runtime/client/remote-functions/command.js +71 -0
- package/src/runtime/client/remote-functions/form.svelte.js +312 -0
- package/src/runtime/client/remote-functions/index.js +4 -0
- package/src/runtime/client/remote-functions/prerender.svelte.js +166 -0
- package/src/runtime/client/remote-functions/query.svelte.js +219 -0
- package/src/runtime/client/remote-functions/shared.svelte.js +143 -0
- package/src/runtime/client/types.d.ts +2 -0
- package/src/runtime/server/data/index.js +6 -4
- package/src/runtime/server/event-state.js +41 -0
- package/src/runtime/server/index.js +12 -3
- package/src/runtime/server/page/actions.js +1 -1
- package/src/runtime/server/page/index.js +10 -3
- package/src/runtime/server/page/load_data.js +18 -12
- package/src/runtime/server/page/render.js +33 -7
- package/src/runtime/server/page/serialize_data.js +1 -1
- package/src/runtime/server/remote.js +237 -0
- package/src/runtime/server/respond.js +57 -36
- package/src/runtime/shared.js +61 -0
- package/src/types/global-private.d.ts +2 -0
- package/src/types/internal.d.ts +52 -5
- package/src/types/synthetic/$env+static+private.md +1 -1
- package/src/utils/routing.js +2 -2
- package/src/version.js +1 -1
- package/types/index.d.ts +271 -8
- package/types/index.d.ts.map +14 -1
- /package/src/{runtime → utils}/hash.js +0 -0
package/types/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
declare module '@sveltejs/kit' {
|
|
5
5
|
import type { SvelteConfig } from '@sveltejs/vite-plugin-svelte';
|
|
6
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
6
7
|
import type { RouteId as AppRouteId, LayoutParams as AppLayoutParams, ResolvedPathname } from '$app/types';
|
|
7
8
|
/**
|
|
8
9
|
* [Adapters](https://svelte.dev/docs/kit/adapters) are responsible for taking the production build and turning it into something that can be deployed to a platform of your choosing.
|
|
@@ -55,7 +56,7 @@ declare module '@sveltejs/kit' {
|
|
|
55
56
|
|
|
56
57
|
const uniqueSymbol: unique symbol;
|
|
57
58
|
|
|
58
|
-
export interface ActionFailure<T
|
|
59
|
+
export interface ActionFailure<T = undefined> {
|
|
59
60
|
status: number;
|
|
60
61
|
data: T;
|
|
61
62
|
[uniqueSymbol]: true; // necessary or else UnpackValidationError could wrongly unpack objects with the same shape as ActionFailure
|
|
@@ -384,6 +385,16 @@ declare module '@sveltejs/kit' {
|
|
|
384
385
|
*/
|
|
385
386
|
privatePrefix?: string;
|
|
386
387
|
};
|
|
388
|
+
/**
|
|
389
|
+
* Experimental features which are exempt from semantic versioning. These features may be changed or removed at any time.
|
|
390
|
+
*/
|
|
391
|
+
experimental?: {
|
|
392
|
+
/**
|
|
393
|
+
* Whether to enable the experimental remote functions feature. This feature is not yet stable and may be changed or removed at any time.
|
|
394
|
+
* @default false
|
|
395
|
+
*/
|
|
396
|
+
remoteFunctions?: boolean;
|
|
397
|
+
};
|
|
387
398
|
/**
|
|
388
399
|
* Where to find various files within your project.
|
|
389
400
|
*/
|
|
@@ -751,6 +762,14 @@ declare module '@sveltejs/kit' {
|
|
|
751
762
|
message: string;
|
|
752
763
|
}) => MaybePromise<void | App.Error>;
|
|
753
764
|
|
|
765
|
+
/**
|
|
766
|
+
* The [`handleValidationError`](https://svelte.dev/docs/kit/hooks#Server-hooks-handleValidationError) hook runs when the argument to a remote function fails validation.
|
|
767
|
+
*
|
|
768
|
+
* It will be called with the validation issues and the event, and must return an object shape that matches `App.Error`.
|
|
769
|
+
*/
|
|
770
|
+
export type HandleValidationError<Issue extends StandardSchemaV1.Issue = StandardSchemaV1.Issue> =
|
|
771
|
+
(input: { issues: Issue[]; event: RequestEvent }) => MaybePromise<App.Error>;
|
|
772
|
+
|
|
754
773
|
/**
|
|
755
774
|
* The client-side [`handleError`](https://svelte.dev/docs/kit/hooks#Shared-hooks-handleError) hook runs when an unexpected error is thrown while navigating.
|
|
756
775
|
*
|
|
@@ -1225,6 +1244,11 @@ declare module '@sveltejs/kit' {
|
|
|
1225
1244
|
* `true` for `+server.js` calls coming from SvelteKit without the overhead of actually making an HTTP request. This happens when you make same-origin `fetch` requests on the server.
|
|
1226
1245
|
*/
|
|
1227
1246
|
isSubRequest: boolean;
|
|
1247
|
+
/**
|
|
1248
|
+
* `true` if the request comes from the client via a remote function. The `url` property will be stripped of the internal information
|
|
1249
|
+
* related to the data request in this case. Use this property instead if the distinction is important to you.
|
|
1250
|
+
*/
|
|
1251
|
+
isRemoteRequest: boolean;
|
|
1228
1252
|
}
|
|
1229
1253
|
|
|
1230
1254
|
/**
|
|
@@ -1299,6 +1323,8 @@ declare module '@sveltejs/kit' {
|
|
|
1299
1323
|
_: {
|
|
1300
1324
|
client: NonNullable<BuildData['client']>;
|
|
1301
1325
|
nodes: SSRNodeLoader[];
|
|
1326
|
+
/** hashed filename -> import to that file */
|
|
1327
|
+
remotes: Record<string, () => Promise<any>>;
|
|
1302
1328
|
routes: SSRRoute[];
|
|
1303
1329
|
prerendered_routes: Set<string>;
|
|
1304
1330
|
matchers: () => Promise<Record<string, ParamMatcher>>;
|
|
@@ -1475,6 +1501,140 @@ declare module '@sveltejs/kit' {
|
|
|
1475
1501
|
capture: () => T;
|
|
1476
1502
|
restore: (snapshot: T) => void;
|
|
1477
1503
|
}
|
|
1504
|
+
|
|
1505
|
+
/**
|
|
1506
|
+
* The return value of a remote `form` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.
|
|
1507
|
+
*/
|
|
1508
|
+
export type RemoteForm<Result> = {
|
|
1509
|
+
method: 'POST';
|
|
1510
|
+
/** The URL to send the form to. */
|
|
1511
|
+
action: string;
|
|
1512
|
+
/** Event handler that intercepts the form submission on the client to prevent a full page reload */
|
|
1513
|
+
onsubmit: (event: SubmitEvent) => void;
|
|
1514
|
+
/** Use the `enhance` method to influence what happens when the form is submitted. */
|
|
1515
|
+
enhance(
|
|
1516
|
+
callback: (opts: {
|
|
1517
|
+
form: HTMLFormElement;
|
|
1518
|
+
data: FormData;
|
|
1519
|
+
submit: () => Promise<void> & {
|
|
1520
|
+
updates: (...queries: Array<RemoteQuery<any> | RemoteQueryOverride>) => Promise<void>;
|
|
1521
|
+
};
|
|
1522
|
+
}) => void
|
|
1523
|
+
): {
|
|
1524
|
+
method: 'POST';
|
|
1525
|
+
action: string;
|
|
1526
|
+
onsubmit: (event: SubmitEvent) => void;
|
|
1527
|
+
};
|
|
1528
|
+
/**
|
|
1529
|
+
* Create an instance of the form for the given key.
|
|
1530
|
+
* The key is stringified and used for deduplication to potentially reuse existing instances.
|
|
1531
|
+
* Useful when you have multiple forms that use the same remote form action, for example in a loop.
|
|
1532
|
+
* ```svelte
|
|
1533
|
+
* {#each todos as todo}
|
|
1534
|
+
* {@const todoForm = updateTodo.for(todo.id)}
|
|
1535
|
+
* <form {...todoForm}>
|
|
1536
|
+
* {#if todoForm.result?.invalid}<p>Invalid data</p>{/if}
|
|
1537
|
+
* ...
|
|
1538
|
+
* </form>
|
|
1539
|
+
* {/each}
|
|
1540
|
+
* ```
|
|
1541
|
+
*/
|
|
1542
|
+
for(key: string | number | boolean): Omit<RemoteForm<Result>, 'for'>;
|
|
1543
|
+
/** The result of the form submission */
|
|
1544
|
+
get result(): Result | undefined;
|
|
1545
|
+
/** Spread this onto a `<button>` or `<input type="submit">` */
|
|
1546
|
+
buttonProps: {
|
|
1547
|
+
type: 'submit';
|
|
1548
|
+
formmethod: 'POST';
|
|
1549
|
+
formaction: string;
|
|
1550
|
+
onclick: (event: Event) => void;
|
|
1551
|
+
/** Use the `enhance` method to influence what happens when the form is submitted. */
|
|
1552
|
+
enhance(
|
|
1553
|
+
callback: (opts: {
|
|
1554
|
+
form: HTMLFormElement;
|
|
1555
|
+
data: FormData;
|
|
1556
|
+
submit: () => Promise<void> & {
|
|
1557
|
+
updates: (...queries: Array<RemoteQuery<any> | RemoteQueryOverride>) => Promise<void>;
|
|
1558
|
+
};
|
|
1559
|
+
}) => void
|
|
1560
|
+
): {
|
|
1561
|
+
type: 'submit';
|
|
1562
|
+
formmethod: 'POST';
|
|
1563
|
+
formaction: string;
|
|
1564
|
+
onclick: (event: Event) => void;
|
|
1565
|
+
};
|
|
1566
|
+
};
|
|
1567
|
+
};
|
|
1568
|
+
|
|
1569
|
+
/**
|
|
1570
|
+
* The return value of a remote `command` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation.
|
|
1571
|
+
*/
|
|
1572
|
+
export type RemoteCommand<Input, Output> = (arg: Input) => Promise<Awaited<Output>> & {
|
|
1573
|
+
updates(...queries: Array<RemoteQuery<any> | RemoteQueryOverride>): Promise<Awaited<Output>>;
|
|
1574
|
+
};
|
|
1575
|
+
|
|
1576
|
+
export type RemoteResource<T> = Promise<Awaited<T>> & {
|
|
1577
|
+
/** The error in case the query fails. Most often this is a [`HttpError`](https://svelte.dev/docs/kit/@sveltejs-kit#HttpError) but it isn't guaranteed to be. */
|
|
1578
|
+
get error(): any;
|
|
1579
|
+
/** `true` before the first result is available and during refreshes */
|
|
1580
|
+
get loading(): boolean;
|
|
1581
|
+
} & (
|
|
1582
|
+
| {
|
|
1583
|
+
/** The current value of the query. Undefined until `ready` is `true` */
|
|
1584
|
+
get current(): undefined;
|
|
1585
|
+
ready: false;
|
|
1586
|
+
}
|
|
1587
|
+
| {
|
|
1588
|
+
/** The current value of the query. Undefined until `ready` is `true` */
|
|
1589
|
+
get current(): Awaited<T>;
|
|
1590
|
+
ready: true;
|
|
1591
|
+
}
|
|
1592
|
+
);
|
|
1593
|
+
|
|
1594
|
+
export type RemoteQuery<T> = RemoteResource<T> & {
|
|
1595
|
+
/**
|
|
1596
|
+
* On the client, this function will re-fetch the query from the server.
|
|
1597
|
+
*
|
|
1598
|
+
* On the server, this can be called in the context of a `command` or `form` and the refreshed data will accompany the action response back to the client.
|
|
1599
|
+
* This prevents SvelteKit needing to refresh all queries on the page in a second server round-trip.
|
|
1600
|
+
*/
|
|
1601
|
+
refresh(): Promise<void>;
|
|
1602
|
+
/**
|
|
1603
|
+
* Temporarily override the value of a query. This is used with the `updates` method of a [command](https://svelte.dev/docs/kit/remote-functions#command-Single-flight-mutations) or [enhanced form submission](https://svelte.dev/docs/kit/remote-functions#form-enhance) to provide optimistic updates.
|
|
1604
|
+
*
|
|
1605
|
+
* ```svelte
|
|
1606
|
+
* <script>
|
|
1607
|
+
* import { getTodos, addTodo } from './todos.remote.js';
|
|
1608
|
+
* const todos = getTodos();
|
|
1609
|
+
* </script>
|
|
1610
|
+
*
|
|
1611
|
+
* <form {...addTodo.enhance(async ({ data, submit }) => {
|
|
1612
|
+
* await submit().updates(
|
|
1613
|
+
* todos.withOverride((todos) => [...todos, { text: data.get('text') }])
|
|
1614
|
+
* );
|
|
1615
|
+
* }}>
|
|
1616
|
+
* <input type="text" name="text" />
|
|
1617
|
+
* <button type="submit">Add Todo</button>
|
|
1618
|
+
* </form>
|
|
1619
|
+
* ```
|
|
1620
|
+
*/
|
|
1621
|
+
withOverride(update: (current: Awaited<T>) => Awaited<T>): RemoteQueryOverride;
|
|
1622
|
+
};
|
|
1623
|
+
|
|
1624
|
+
export interface RemoteQueryOverride {
|
|
1625
|
+
_key: string;
|
|
1626
|
+
release(): void;
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
/**
|
|
1630
|
+
* The return value of a remote `prerender` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation.
|
|
1631
|
+
*/
|
|
1632
|
+
export type RemotePrerenderFunction<Input, Output> = (arg: Input) => RemoteResource<Output>;
|
|
1633
|
+
|
|
1634
|
+
/**
|
|
1635
|
+
* The return value of a remote `query` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation.
|
|
1636
|
+
*/
|
|
1637
|
+
export type RemoteQueryFunction<Input, Output> = (arg: Input) => RemoteQuery<Output>;
|
|
1478
1638
|
interface AdapterEntry {
|
|
1479
1639
|
/**
|
|
1480
1640
|
* A string that uniquely identifies an HTTP service (e.g. serverless function) and is used for deduplication.
|
|
@@ -1733,7 +1893,7 @@ declare module '@sveltejs/kit' {
|
|
|
1733
1893
|
*/
|
|
1734
1894
|
css?: Array<string[] | undefined>;
|
|
1735
1895
|
/**
|
|
1736
|
-
* Contains the client route manifest in a form suitable for the server which is used for server
|
|
1896
|
+
* Contains the client route manifest in a form suitable for the server which is used for server-side route resolution.
|
|
1737
1897
|
* Notably, it contains all routes, regardless of whether they are prerendered or not (those are missing in the optimized server route manifest).
|
|
1738
1898
|
* Only set in case of `router.resolution === 'server'`.
|
|
1739
1899
|
*/
|
|
@@ -1759,6 +1919,10 @@ declare module '@sveltejs/kit' {
|
|
|
1759
1919
|
universal: string | null;
|
|
1760
1920
|
};
|
|
1761
1921
|
nodes: PageNode[];
|
|
1922
|
+
remotes: Array<{
|
|
1923
|
+
file: string;
|
|
1924
|
+
hash: string;
|
|
1925
|
+
}>;
|
|
1762
1926
|
routes: RouteData[];
|
|
1763
1927
|
matchers: Record<string, string>;
|
|
1764
1928
|
}
|
|
@@ -1956,7 +2120,7 @@ declare module '@sveltejs/kit' {
|
|
|
1956
2120
|
* Checks whether this is an error thrown by {@link error}.
|
|
1957
2121
|
* @param status The status to filter for.
|
|
1958
2122
|
* */
|
|
1959
|
-
export function isHttpError<T extends number>(e: unknown, status?: T
|
|
2123
|
+
export function isHttpError<T extends number>(e: unknown, status?: T): e is (HttpError_1 & {
|
|
1960
2124
|
status: T extends undefined ? never : T;
|
|
1961
2125
|
});
|
|
1962
2126
|
/**
|
|
@@ -1986,13 +2150,13 @@ declare module '@sveltejs/kit' {
|
|
|
1986
2150
|
* @param data The value that will be serialized as JSON.
|
|
1987
2151
|
* @param init Options such as `status` and `headers` that will be added to the response. `Content-Type: application/json` and `Content-Length` headers will be added automatically.
|
|
1988
2152
|
*/
|
|
1989
|
-
export function json(data: any, init?: ResponseInit
|
|
2153
|
+
export function json(data: any, init?: ResponseInit): Response;
|
|
1990
2154
|
/**
|
|
1991
2155
|
* Create a `Response` object from the supplied body.
|
|
1992
2156
|
* @param body The value that will be used as-is.
|
|
1993
2157
|
* @param init Options such as `status` and `headers` that will be added to the response. A `Content-Length` header will be added automatically.
|
|
1994
2158
|
*/
|
|
1995
|
-
export function text(body: string, init?: ResponseInit
|
|
2159
|
+
export function text(body: string, init?: ResponseInit): Response;
|
|
1996
2160
|
/**
|
|
1997
2161
|
* Create an `ActionFailure` object. Call when form submission fails.
|
|
1998
2162
|
* @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
|
|
@@ -2003,7 +2167,7 @@ declare module '@sveltejs/kit' {
|
|
|
2003
2167
|
* @param status The [HTTP status code](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status#client_error_responses). Must be in the range 400-599.
|
|
2004
2168
|
* @param data Data associated with the failure (e.g. validation errors)
|
|
2005
2169
|
* */
|
|
2006
|
-
export function fail<T
|
|
2170
|
+
export function fail<T = undefined>(status: number, data: T): ActionFailure<T>;
|
|
2007
2171
|
/**
|
|
2008
2172
|
* Checks whether this is an action failure thrown by {@link fail}.
|
|
2009
2173
|
* @param e The object to check.
|
|
@@ -2291,7 +2455,7 @@ declare module '$app/navigation' {
|
|
|
2291
2455
|
invalidateAll?: boolean | undefined;
|
|
2292
2456
|
invalidate?: (string | URL | ((url: URL) => boolean))[] | undefined;
|
|
2293
2457
|
state?: App.PageState | undefined;
|
|
2294
|
-
}
|
|
2458
|
+
}): Promise<void>;
|
|
2295
2459
|
/**
|
|
2296
2460
|
* Causes any `load` functions belonging to the currently active page to re-run if they depend on the `url` in question, via `fetch` or `depends`. Returns a `Promise` that resolves when the page is subsequently updated.
|
|
2297
2461
|
*
|
|
@@ -2314,6 +2478,13 @@ declare module '$app/navigation' {
|
|
|
2314
2478
|
* Causes all `load` functions belonging to the currently active page to re-run. Returns a `Promise` that resolves when the page is subsequently updated.
|
|
2315
2479
|
* */
|
|
2316
2480
|
export function invalidateAll(): Promise<void>;
|
|
2481
|
+
/**
|
|
2482
|
+
* Causes all currently active remote functions to refresh, and all `load` functions belonging to the currently active page to re-run (unless disabled via the option argument).
|
|
2483
|
+
* Returns a `Promise` that resolves when the page is subsequently updated.
|
|
2484
|
+
* */
|
|
2485
|
+
export function refreshAll({ includeLoadFunctions }?: {
|
|
2486
|
+
includeLoadFunctions?: boolean;
|
|
2487
|
+
}): Promise<void>;
|
|
2317
2488
|
/**
|
|
2318
2489
|
* Programmatically preloads the given page, which means
|
|
2319
2490
|
* 1. ensuring that the code for the page is loaded, and
|
|
@@ -2436,7 +2607,8 @@ declare module '$app/paths' {
|
|
|
2436
2607
|
declare module '$app/server' {
|
|
2437
2608
|
// @ts-ignore
|
|
2438
2609
|
import { LayoutParams as AppLayoutParams, RouteId as AppRouteId } from '$app/types'
|
|
2439
|
-
import type { RequestEvent } from '@sveltejs/kit';
|
|
2610
|
+
import type { RequestEvent, RemoteCommand, RemoteForm, RemotePrerenderFunction, RemoteQueryFunction } from '@sveltejs/kit';
|
|
2611
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2440
2612
|
/**
|
|
2441
2613
|
* Read the contents of an imported asset from the filesystem
|
|
2442
2614
|
* @example
|
|
@@ -2457,6 +2629,97 @@ declare module '$app/server' {
|
|
|
2457
2629
|
* @since 2.20.0
|
|
2458
2630
|
*/
|
|
2459
2631
|
export function getRequestEvent(): RequestEvent<AppLayoutParams<"/">, any>;
|
|
2632
|
+
/**
|
|
2633
|
+
* Creates a remote command. When called from the browser, the function will be invoked on the server via a `fetch` call.
|
|
2634
|
+
*
|
|
2635
|
+
* See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation.
|
|
2636
|
+
*
|
|
2637
|
+
* @since 2.27
|
|
2638
|
+
*/
|
|
2639
|
+
export function command<Output>(fn: () => Output): RemoteCommand<void, Output>;
|
|
2640
|
+
/**
|
|
2641
|
+
* Creates a remote command. When called from the browser, the function will be invoked on the server via a `fetch` call.
|
|
2642
|
+
*
|
|
2643
|
+
* See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation.
|
|
2644
|
+
*
|
|
2645
|
+
* @since 2.27
|
|
2646
|
+
*/
|
|
2647
|
+
export function command<Input, Output>(validate: "unchecked", fn: (arg: Input) => Output): RemoteCommand<Input, Output>;
|
|
2648
|
+
/**
|
|
2649
|
+
* Creates a remote command. When called from the browser, the function will be invoked on the server via a `fetch` call.
|
|
2650
|
+
*
|
|
2651
|
+
* See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation.
|
|
2652
|
+
*
|
|
2653
|
+
* @since 2.27
|
|
2654
|
+
*/
|
|
2655
|
+
export function command<Schema extends StandardSchemaV1, Output>(validate: Schema, fn: (arg: StandardSchemaV1.InferOutput<Schema>) => Output): RemoteCommand<StandardSchemaV1.InferInput<Schema>, Output>;
|
|
2656
|
+
/**
|
|
2657
|
+
* Creates a form object that can be spread onto a `<form>` element.
|
|
2658
|
+
*
|
|
2659
|
+
* See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.
|
|
2660
|
+
*
|
|
2661
|
+
* @since 2.27
|
|
2662
|
+
*/
|
|
2663
|
+
export function form<T>(fn: (data: FormData) => MaybePromise<T>): RemoteForm<T>;
|
|
2664
|
+
/**
|
|
2665
|
+
* Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call.
|
|
2666
|
+
*
|
|
2667
|
+
* See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation.
|
|
2668
|
+
*
|
|
2669
|
+
* @since 2.27
|
|
2670
|
+
*/
|
|
2671
|
+
export function prerender<Output>(fn: () => MaybePromise<Output>, options?: {
|
|
2672
|
+
inputs?: RemotePrerenderInputsGenerator<void>;
|
|
2673
|
+
dynamic?: boolean;
|
|
2674
|
+
} | undefined): RemotePrerenderFunction<void, Output>;
|
|
2675
|
+
/**
|
|
2676
|
+
* Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call.
|
|
2677
|
+
*
|
|
2678
|
+
* See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation.
|
|
2679
|
+
*
|
|
2680
|
+
* @since 2.27
|
|
2681
|
+
*/
|
|
2682
|
+
export function prerender<Input, Output>(validate: "unchecked", fn: (arg: Input) => MaybePromise<Output>, options?: {
|
|
2683
|
+
inputs?: RemotePrerenderInputsGenerator<Input>;
|
|
2684
|
+
dynamic?: boolean;
|
|
2685
|
+
} | undefined): RemotePrerenderFunction<Input, Output>;
|
|
2686
|
+
/**
|
|
2687
|
+
* Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call.
|
|
2688
|
+
*
|
|
2689
|
+
* See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation.
|
|
2690
|
+
*
|
|
2691
|
+
* @since 2.27
|
|
2692
|
+
*/
|
|
2693
|
+
export function prerender<Schema extends StandardSchemaV1, Output>(schema: Schema, fn: (arg: StandardSchemaV1.InferOutput<Schema>) => MaybePromise<Output>, options?: {
|
|
2694
|
+
inputs?: RemotePrerenderInputsGenerator<StandardSchemaV1.InferInput<Schema>>;
|
|
2695
|
+
dynamic?: boolean;
|
|
2696
|
+
} | undefined): RemotePrerenderFunction<StandardSchemaV1.InferInput<Schema>, Output>;
|
|
2697
|
+
/**
|
|
2698
|
+
* Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call.
|
|
2699
|
+
*
|
|
2700
|
+
* See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation.
|
|
2701
|
+
*
|
|
2702
|
+
* @since 2.27
|
|
2703
|
+
*/
|
|
2704
|
+
export function query<Output>(fn: () => MaybePromise<Output>): RemoteQueryFunction<void, Output>;
|
|
2705
|
+
/**
|
|
2706
|
+
* Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call.
|
|
2707
|
+
*
|
|
2708
|
+
* See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation.
|
|
2709
|
+
*
|
|
2710
|
+
* @since 2.27
|
|
2711
|
+
*/
|
|
2712
|
+
export function query<Input, Output>(validate: "unchecked", fn: (arg: Input) => MaybePromise<Output>): RemoteQueryFunction<Input, Output>;
|
|
2713
|
+
/**
|
|
2714
|
+
* Creates a remote query. When called from the browser, the function will be invoked on the server via a `fetch` call.
|
|
2715
|
+
*
|
|
2716
|
+
* See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation.
|
|
2717
|
+
*
|
|
2718
|
+
* @since 2.27
|
|
2719
|
+
*/
|
|
2720
|
+
export function query<Schema extends StandardSchemaV1, Output>(schema: Schema, fn: (arg: StandardSchemaV1.InferOutput<Schema>) => MaybePromise<Output>): RemoteQueryFunction<StandardSchemaV1.InferInput<Schema>, Output>;
|
|
2721
|
+
type RemotePrerenderInputsGenerator<Input = any> = () => MaybePromise<Input[]>;
|
|
2722
|
+
type MaybePromise<T> = T | Promise<T>;
|
|
2460
2723
|
|
|
2461
2724
|
export {};
|
|
2462
2725
|
}
|
package/types/index.d.ts.map
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
"KitConfig",
|
|
17
17
|
"Handle",
|
|
18
18
|
"HandleServerError",
|
|
19
|
+
"HandleValidationError",
|
|
19
20
|
"HandleClientError",
|
|
20
21
|
"HandleFetch",
|
|
21
22
|
"ServerInit",
|
|
@@ -50,6 +51,13 @@
|
|
|
50
51
|
"Redirect",
|
|
51
52
|
"SubmitFunction",
|
|
52
53
|
"Snapshot",
|
|
54
|
+
"RemoteForm",
|
|
55
|
+
"RemoteCommand",
|
|
56
|
+
"RemoteResource",
|
|
57
|
+
"RemoteQuery",
|
|
58
|
+
"RemoteQueryOverride",
|
|
59
|
+
"RemotePrerenderFunction",
|
|
60
|
+
"RemoteQueryFunction",
|
|
53
61
|
"AdapterEntry",
|
|
54
62
|
"Csp",
|
|
55
63
|
"CspDirectives",
|
|
@@ -115,6 +123,7 @@
|
|
|
115
123
|
"goto",
|
|
116
124
|
"invalidate",
|
|
117
125
|
"invalidateAll",
|
|
126
|
+
"refreshAll",
|
|
118
127
|
"preloadData",
|
|
119
128
|
"preloadCode",
|
|
120
129
|
"pushState",
|
|
@@ -127,6 +136,8 @@
|
|
|
127
136
|
"resolveRoute",
|
|
128
137
|
"read",
|
|
129
138
|
"getRequestEvent",
|
|
139
|
+
"form",
|
|
140
|
+
"RemotePrerenderInputsGenerator",
|
|
130
141
|
"page",
|
|
131
142
|
"navigating",
|
|
132
143
|
"updated",
|
|
@@ -149,6 +160,7 @@
|
|
|
149
160
|
"../src/runtime/app/paths/types.d.ts",
|
|
150
161
|
"../src/runtime/app/server/index.js",
|
|
151
162
|
"../src/runtime/app/server/event.js",
|
|
163
|
+
"../src/runtime/app/server/remote/form.js",
|
|
152
164
|
"../src/runtime/app/state/index.js",
|
|
153
165
|
"../src/runtime/app/stores.js"
|
|
154
166
|
],
|
|
@@ -170,8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