@sveltejs/kit 2.45.0 → 2.46.0
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/package.json +1 -1
- package/src/exports/public.d.ts +44 -1
- package/src/exports/vite/index.js +28 -2
- package/src/runtime/app/server/remote/form.js +147 -30
- package/src/runtime/client/remote-functions/form.svelte.js +7 -0
- package/src/version.js +1 -1
- package/types/index.d.ts +47 -4
- package/types/index.d.ts.map +3 -1
package/package.json
CHANGED
package/src/exports/public.d.ts
CHANGED
|
@@ -1925,7 +1925,7 @@ type RemoteFormFields<T> =
|
|
|
1925
1925
|
: RemoteFormFieldContainer<T> & { [K in keyof T]-?: RemoteFormFields<T[K]> };
|
|
1926
1926
|
|
|
1927
1927
|
// By breaking this out into its own type, we avoid the TS recursion depth limit
|
|
1928
|
-
type RecursiveFormFields = RemoteFormField<any> & { [key: string]: RecursiveFormFields };
|
|
1928
|
+
type RecursiveFormFields = RemoteFormField<any> & { [key: string | number]: RecursiveFormFields };
|
|
1929
1929
|
|
|
1930
1930
|
type MaybeArray<T> = T | T[];
|
|
1931
1931
|
|
|
@@ -1945,6 +1945,49 @@ type ExtractId<Input> = Input extends { id: infer Id }
|
|
|
1945
1945
|
: string | number
|
|
1946
1946
|
: string | number;
|
|
1947
1947
|
|
|
1948
|
+
/**
|
|
1949
|
+
* Recursively maps an input type to a structure where each field can create a validation issue.
|
|
1950
|
+
* This mirrors the runtime behavior of the `invalid` proxy passed to form handlers.
|
|
1951
|
+
*/
|
|
1952
|
+
type InvalidField<T> =
|
|
1953
|
+
WillRecurseIndefinitely<T> extends true
|
|
1954
|
+
? Record<string | number, any>
|
|
1955
|
+
: NonNullable<T> extends string | number | boolean | File
|
|
1956
|
+
? (message: string) => StandardSchemaV1.Issue
|
|
1957
|
+
: NonNullable<T> extends Array<infer U>
|
|
1958
|
+
? {
|
|
1959
|
+
[K in number]: InvalidField<U>;
|
|
1960
|
+
} & ((message: string) => StandardSchemaV1.Issue)
|
|
1961
|
+
: NonNullable<T> extends RemoteFormInput
|
|
1962
|
+
? {
|
|
1963
|
+
[K in keyof T]-?: InvalidField<T[K]>;
|
|
1964
|
+
} & ((message: string) => StandardSchemaV1.Issue)
|
|
1965
|
+
: Record<string, never>;
|
|
1966
|
+
|
|
1967
|
+
/**
|
|
1968
|
+
* A function and proxy object used to imperatively create validation errors in form handlers.
|
|
1969
|
+
*
|
|
1970
|
+
* Call `invalid(issue1, issue2, ...issueN)` to throw a validation error.
|
|
1971
|
+
* If an issue is a `string`, it applies to the form as a whole (and will show up in `fields.allIssues()`)
|
|
1972
|
+
* Access properties to create field-specific issues: `invalid.fieldName('message')`.
|
|
1973
|
+
* The type structure mirrors the input data structure for type-safe field access.
|
|
1974
|
+
*
|
|
1975
|
+
* @example
|
|
1976
|
+
* ```ts
|
|
1977
|
+
* invalid('Username or password is invalid');
|
|
1978
|
+
* ```
|
|
1979
|
+
*
|
|
1980
|
+
* @example
|
|
1981
|
+
* ```ts
|
|
1982
|
+
* invalid(
|
|
1983
|
+
* invalid.username('Username is taken'),
|
|
1984
|
+
* invalid.items[0].qty('Insufficient stock')
|
|
1985
|
+
* );
|
|
1986
|
+
* ```
|
|
1987
|
+
*/
|
|
1988
|
+
export type Invalid<Input = any> = ((...issues: Array<string | StandardSchemaV1.Issue>) => never) &
|
|
1989
|
+
InvalidField<Input>;
|
|
1990
|
+
|
|
1948
1991
|
/**
|
|
1949
1992
|
* The return value of a remote `form` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.
|
|
1950
1993
|
*/
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
import { import_peer } from '../../utils/import.js';
|
|
42
42
|
import { compact } from '../../utils/array.js';
|
|
43
43
|
import { should_ignore } from './static_analysis/utils.js';
|
|
44
|
+
import { rollupVersion } from 'vite';
|
|
44
45
|
|
|
45
46
|
const cwd = process.cwd();
|
|
46
47
|
|
|
@@ -675,6 +676,15 @@ async function kit({ svelte_config }) {
|
|
|
675
676
|
// Set up manualChunks to isolate *.remote.ts files
|
|
676
677
|
const { manualChunks } = config.build.rollupOptions.output;
|
|
677
678
|
|
|
679
|
+
const [major, minor] = rollupVersion.split('.').map(Number);
|
|
680
|
+
const is_outdated_rollup = major === 4 && minor < 52;
|
|
681
|
+
if (is_outdated_rollup) {
|
|
682
|
+
console.warn(
|
|
683
|
+
'Rollup >=4.52.0 is recommended when using SvelteKit remote functions as it fixes some bugs related to code-splitting. Current version: ' +
|
|
684
|
+
rollupVersion
|
|
685
|
+
);
|
|
686
|
+
}
|
|
687
|
+
|
|
678
688
|
config.build.rollupOptions.output = {
|
|
679
689
|
...config.build.rollupOptions.output,
|
|
680
690
|
manualChunks(id, meta) {
|
|
@@ -685,8 +695,19 @@ async function kit({ svelte_config }) {
|
|
|
685
695
|
return `remote-${hash(relative)}`;
|
|
686
696
|
}
|
|
687
697
|
|
|
688
|
-
|
|
689
|
-
|
|
698
|
+
// With onlyExplicitManualChunks Rollup will keep any manual chunk's dependencies out of that chunk.
|
|
699
|
+
// This option only exists on more recent Rollup versions; use this as a fallback for older versions.
|
|
700
|
+
if (is_outdated_rollup) {
|
|
701
|
+
// Prevent core runtime and env from ending up in a remote chunk, which could break because of initialization order
|
|
702
|
+
if (id === `${runtime_directory}/app/server/index.js`) {
|
|
703
|
+
return 'app-server';
|
|
704
|
+
}
|
|
705
|
+
if (id === `${runtime_directory}/shared-server.js`) {
|
|
706
|
+
return 'app-shared-server';
|
|
707
|
+
}
|
|
708
|
+
if (imported_by_remotes.has(id)) {
|
|
709
|
+
return `chunk-${uid++}`;
|
|
710
|
+
}
|
|
690
711
|
}
|
|
691
712
|
|
|
692
713
|
// If there was an existing manualChunks function, call it
|
|
@@ -707,6 +728,11 @@ async function kit({ svelte_config }) {
|
|
|
707
728
|
}
|
|
708
729
|
}
|
|
709
730
|
};
|
|
731
|
+
|
|
732
|
+
if (!is_outdated_rollup) {
|
|
733
|
+
// @ts-expect-error only exists in more recent Rollup versions https://rollupjs.org/configuration-options/#output-onlyexplicitmanualchunks
|
|
734
|
+
config.build.rollupOptions.onlyExplicitManualChunks = true;
|
|
735
|
+
}
|
|
710
736
|
},
|
|
711
737
|
|
|
712
738
|
configureServer(_dev_server) {
|
|
@@ -20,7 +20,7 @@ import { get_cache, run_remote_function } from './shared.js';
|
|
|
20
20
|
*
|
|
21
21
|
* @template Output
|
|
22
22
|
* @overload
|
|
23
|
-
* @param {() => MaybePromise<Output>} fn
|
|
23
|
+
* @param {(invalid: import('@sveltejs/kit').Invalid<void>) => MaybePromise<Output>} fn
|
|
24
24
|
* @returns {RemoteForm<void, Output>}
|
|
25
25
|
* @since 2.27
|
|
26
26
|
*/
|
|
@@ -33,7 +33,7 @@ import { get_cache, run_remote_function } from './shared.js';
|
|
|
33
33
|
* @template Output
|
|
34
34
|
* @overload
|
|
35
35
|
* @param {'unchecked'} validate
|
|
36
|
-
* @param {(data: Input) => MaybePromise<Output>} fn
|
|
36
|
+
* @param {(data: Input, invalid: import('@sveltejs/kit').Invalid<Input>) => MaybePromise<Output>} fn
|
|
37
37
|
* @returns {RemoteForm<Input, Output>}
|
|
38
38
|
* @since 2.27
|
|
39
39
|
*/
|
|
@@ -46,7 +46,7 @@ import { get_cache, run_remote_function } from './shared.js';
|
|
|
46
46
|
* @template Output
|
|
47
47
|
* @overload
|
|
48
48
|
* @param {Schema} validate
|
|
49
|
-
* @param {(data: StandardSchemaV1.InferOutput<Schema
|
|
49
|
+
* @param {(data: StandardSchemaV1.InferOutput<Schema>, invalid: import('@sveltejs/kit').Invalid<StandardSchemaV1.InferOutput<Schema>>) => MaybePromise<Output>} fn
|
|
50
50
|
* @returns {RemoteForm<StandardSchemaV1.InferInput<Schema>, Output>}
|
|
51
51
|
* @since 2.27
|
|
52
52
|
*/
|
|
@@ -54,18 +54,19 @@ import { get_cache, run_remote_function } from './shared.js';
|
|
|
54
54
|
* @template {RemoteFormInput} Input
|
|
55
55
|
* @template Output
|
|
56
56
|
* @param {any} validate_or_fn
|
|
57
|
-
* @param {(
|
|
57
|
+
* @param {(data_or_invalid: any, invalid?: any) => MaybePromise<Output>} [maybe_fn]
|
|
58
58
|
* @returns {RemoteForm<Input, Output>}
|
|
59
59
|
* @since 2.27
|
|
60
60
|
*/
|
|
61
61
|
/*@__NO_SIDE_EFFECTS__*/
|
|
62
62
|
// @ts-ignore we don't want to prefix `fn` with an underscore, as that will be user-visible
|
|
63
63
|
export function form(validate_or_fn, maybe_fn) {
|
|
64
|
-
/** @type {
|
|
64
|
+
/** @type {any} */
|
|
65
65
|
const fn = maybe_fn ?? validate_or_fn;
|
|
66
66
|
|
|
67
67
|
/** @type {StandardSchemaV1 | null} */
|
|
68
|
-
const schema =
|
|
68
|
+
const schema =
|
|
69
|
+
!maybe_fn || validate_or_fn === 'unchecked' ? null : /** @type {any} */ (validate_or_fn);
|
|
69
70
|
|
|
70
71
|
/**
|
|
71
72
|
* @param {string | number | boolean} [key]
|
|
@@ -152,29 +153,7 @@ export function form(validate_or_fn, maybe_fn) {
|
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
if (validated?.issues !== undefined) {
|
|
155
|
-
output.issues
|
|
156
|
-
|
|
157
|
-
// if it was a progressively-enhanced submission, we don't need
|
|
158
|
-
// to return the input — it's already there
|
|
159
|
-
if (!event.isRemoteRequest) {
|
|
160
|
-
output.input = {};
|
|
161
|
-
|
|
162
|
-
for (let key of form_data.keys()) {
|
|
163
|
-
// redact sensitive fields
|
|
164
|
-
if (/^[.\]]?_/.test(key)) continue;
|
|
165
|
-
|
|
166
|
-
const is_array = key.endsWith('[]');
|
|
167
|
-
const values = form_data.getAll(key).filter((value) => typeof value === 'string');
|
|
168
|
-
|
|
169
|
-
if (is_array) key = key.slice(0, -2);
|
|
170
|
-
|
|
171
|
-
output.input = set_nested_value(
|
|
172
|
-
/** @type {Record<string, any>} */ (output.input),
|
|
173
|
-
key,
|
|
174
|
-
is_array ? values : values[0]
|
|
175
|
-
);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
156
|
+
handle_issues(output, validated.issues, event.isRemoteRequest, form_data);
|
|
178
157
|
} else {
|
|
179
158
|
if (validated !== undefined) {
|
|
180
159
|
data = validated.value;
|
|
@@ -182,7 +161,24 @@ export function form(validate_or_fn, maybe_fn) {
|
|
|
182
161
|
|
|
183
162
|
state.refreshes ??= {};
|
|
184
163
|
|
|
185
|
-
|
|
164
|
+
const invalid = create_invalid();
|
|
165
|
+
|
|
166
|
+
try {
|
|
167
|
+
output.result = await run_remote_function(
|
|
168
|
+
event,
|
|
169
|
+
state,
|
|
170
|
+
true,
|
|
171
|
+
data,
|
|
172
|
+
(d) => d,
|
|
173
|
+
(data) => (!maybe_fn ? fn(invalid) : fn(data, invalid))
|
|
174
|
+
);
|
|
175
|
+
} catch (e) {
|
|
176
|
+
if (e instanceof ValidationError) {
|
|
177
|
+
handle_issues(output, e.issues, event.isRemoteRequest, form_data);
|
|
178
|
+
} else {
|
|
179
|
+
throw e;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
186
182
|
}
|
|
187
183
|
|
|
188
184
|
// We don't need to care about args or deduplicating calls, because uneval results are only relevant in full page reloads
|
|
@@ -290,3 +286,124 @@ export function form(validate_or_fn, maybe_fn) {
|
|
|
290
286
|
|
|
291
287
|
return create_instance();
|
|
292
288
|
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* @param {{ issues?: Record<string, any>, input?: Record<string, any>, result: any }} output
|
|
292
|
+
* @param {readonly StandardSchemaV1.Issue[]} issues
|
|
293
|
+
* @param {boolean} is_remote_request
|
|
294
|
+
* @param {FormData} form_data
|
|
295
|
+
*/
|
|
296
|
+
function handle_issues(output, issues, is_remote_request, form_data) {
|
|
297
|
+
output.issues = flatten_issues(issues);
|
|
298
|
+
|
|
299
|
+
// if it was a progressively-enhanced submission, we don't need
|
|
300
|
+
// to return the input — it's already there
|
|
301
|
+
if (!is_remote_request) {
|
|
302
|
+
output.input = {};
|
|
303
|
+
|
|
304
|
+
for (let key of form_data.keys()) {
|
|
305
|
+
// redact sensitive fields
|
|
306
|
+
if (/^[.\]]?_/.test(key)) continue;
|
|
307
|
+
|
|
308
|
+
const is_array = key.endsWith('[]');
|
|
309
|
+
const values = form_data.getAll(key).filter((value) => typeof value === 'string');
|
|
310
|
+
|
|
311
|
+
if (is_array) key = key.slice(0, -2);
|
|
312
|
+
|
|
313
|
+
output.input = set_nested_value(
|
|
314
|
+
/** @type {Record<string, any>} */ (output.input),
|
|
315
|
+
key,
|
|
316
|
+
is_array ? values : values[0]
|
|
317
|
+
);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Creates an invalid function that can be used to imperatively mark form fields as invalid
|
|
324
|
+
* @returns {import('@sveltejs/kit').Invalid}
|
|
325
|
+
*/
|
|
326
|
+
function create_invalid() {
|
|
327
|
+
/**
|
|
328
|
+
* @param {...(string | StandardSchemaV1.Issue)} issues
|
|
329
|
+
* @returns {never}
|
|
330
|
+
*/
|
|
331
|
+
function invalid(...issues) {
|
|
332
|
+
throw new ValidationError(
|
|
333
|
+
issues.map((issue) => {
|
|
334
|
+
if (typeof issue === 'string') {
|
|
335
|
+
return {
|
|
336
|
+
path: [],
|
|
337
|
+
message: issue
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
return issue;
|
|
342
|
+
})
|
|
343
|
+
);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
return /** @type {import('@sveltejs/kit').Invalid} */ (
|
|
347
|
+
new Proxy(invalid, {
|
|
348
|
+
get(target, prop) {
|
|
349
|
+
if (typeof prop === 'symbol') return /** @type {any} */ (target)[prop];
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* @param {string} message
|
|
353
|
+
* @param {(string | number)[]} path
|
|
354
|
+
* @returns {StandardSchemaV1.Issue}
|
|
355
|
+
*/
|
|
356
|
+
const create_issue = (message, path = []) => ({
|
|
357
|
+
message,
|
|
358
|
+
path
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
return create_issue_proxy(prop, create_issue, []);
|
|
362
|
+
}
|
|
363
|
+
})
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Error thrown when form validation fails imperatively
|
|
369
|
+
*/
|
|
370
|
+
class ValidationError extends Error {
|
|
371
|
+
/**
|
|
372
|
+
* @param {StandardSchemaV1.Issue[]} issues
|
|
373
|
+
*/
|
|
374
|
+
constructor(issues) {
|
|
375
|
+
super('Validation failed');
|
|
376
|
+
this.name = 'ValidationError';
|
|
377
|
+
this.issues = issues;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Creates a proxy that builds up a path and returns a function to create an issue
|
|
383
|
+
* @param {string | number} key
|
|
384
|
+
* @param {(message: string, path: (string | number)[]) => StandardSchemaV1.Issue} create_issue
|
|
385
|
+
* @param {(string | number)[]} path
|
|
386
|
+
*/
|
|
387
|
+
function create_issue_proxy(key, create_issue, path) {
|
|
388
|
+
const new_path = [...path, key];
|
|
389
|
+
|
|
390
|
+
/**
|
|
391
|
+
* @param {string} message
|
|
392
|
+
* @returns {StandardSchemaV1.Issue}
|
|
393
|
+
*/
|
|
394
|
+
const issue_func = (message) => create_issue(message, new_path);
|
|
395
|
+
|
|
396
|
+
return new Proxy(issue_func, {
|
|
397
|
+
get(target, prop) {
|
|
398
|
+
if (typeof prop === 'symbol') return /** @type {any} */ (target)[prop];
|
|
399
|
+
|
|
400
|
+
// Handle array access like invalid.items[0]
|
|
401
|
+
if (/^\d+$/.test(prop)) {
|
|
402
|
+
return create_issue_proxy(parseInt(prop, 10), create_issue, new_path);
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
// Handle property access like invalid.field.nested
|
|
406
|
+
return create_issue_proxy(prop, create_issue, new_path);
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}
|
|
@@ -512,6 +512,9 @@ export function form(id) {
|
|
|
512
512
|
|
|
513
513
|
const id = ++validate_id;
|
|
514
514
|
|
|
515
|
+
// wait a tick in case the user is calling validate() right after set() which takes time to propagate
|
|
516
|
+
await tick();
|
|
517
|
+
|
|
515
518
|
const form_data = new FormData(element, submitter);
|
|
516
519
|
|
|
517
520
|
/** @type {readonly StandardSchemaV1.Issue[]} */
|
|
@@ -519,6 +522,10 @@ export function form(id) {
|
|
|
519
522
|
|
|
520
523
|
const validated = await preflight_schema?.['~standard'].validate(convert(form_data));
|
|
521
524
|
|
|
525
|
+
if (validate_id !== id) {
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
|
|
522
529
|
if (validated?.issues) {
|
|
523
530
|
array = validated.issues;
|
|
524
531
|
} else {
|
package/src/version.js
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1901,7 +1901,7 @@ declare module '@sveltejs/kit' {
|
|
|
1901
1901
|
: RemoteFormFieldContainer<T> & { [K in keyof T]-?: RemoteFormFields<T[K]> };
|
|
1902
1902
|
|
|
1903
1903
|
// By breaking this out into its own type, we avoid the TS recursion depth limit
|
|
1904
|
-
type RecursiveFormFields = RemoteFormField<any> & { [key: string]: RecursiveFormFields };
|
|
1904
|
+
type RecursiveFormFields = RemoteFormField<any> & { [key: string | number]: RecursiveFormFields };
|
|
1905
1905
|
|
|
1906
1906
|
type MaybeArray<T> = T | T[];
|
|
1907
1907
|
|
|
@@ -1921,6 +1921,49 @@ declare module '@sveltejs/kit' {
|
|
|
1921
1921
|
: string | number
|
|
1922
1922
|
: string | number;
|
|
1923
1923
|
|
|
1924
|
+
/**
|
|
1925
|
+
* Recursively maps an input type to a structure where each field can create a validation issue.
|
|
1926
|
+
* This mirrors the runtime behavior of the `invalid` proxy passed to form handlers.
|
|
1927
|
+
*/
|
|
1928
|
+
type InvalidField<T> =
|
|
1929
|
+
WillRecurseIndefinitely<T> extends true
|
|
1930
|
+
? Record<string | number, any>
|
|
1931
|
+
: NonNullable<T> extends string | number | boolean | File
|
|
1932
|
+
? (message: string) => StandardSchemaV1.Issue
|
|
1933
|
+
: NonNullable<T> extends Array<infer U>
|
|
1934
|
+
? {
|
|
1935
|
+
[K in number]: InvalidField<U>;
|
|
1936
|
+
} & ((message: string) => StandardSchemaV1.Issue)
|
|
1937
|
+
: NonNullable<T> extends RemoteFormInput
|
|
1938
|
+
? {
|
|
1939
|
+
[K in keyof T]-?: InvalidField<T[K]>;
|
|
1940
|
+
} & ((message: string) => StandardSchemaV1.Issue)
|
|
1941
|
+
: Record<string, never>;
|
|
1942
|
+
|
|
1943
|
+
/**
|
|
1944
|
+
* A function and proxy object used to imperatively create validation errors in form handlers.
|
|
1945
|
+
*
|
|
1946
|
+
* Call `invalid(issue1, issue2, ...issueN)` to throw a validation error.
|
|
1947
|
+
* If an issue is a `string`, it applies to the form as a whole (and will show up in `fields.allIssues()`)
|
|
1948
|
+
* Access properties to create field-specific issues: `invalid.fieldName('message')`.
|
|
1949
|
+
* The type structure mirrors the input data structure for type-safe field access.
|
|
1950
|
+
*
|
|
1951
|
+
* @example
|
|
1952
|
+
* ```ts
|
|
1953
|
+
* invalid('Username or password is invalid');
|
|
1954
|
+
* ```
|
|
1955
|
+
*
|
|
1956
|
+
* @example
|
|
1957
|
+
* ```ts
|
|
1958
|
+
* invalid(
|
|
1959
|
+
* invalid.username('Username is taken'),
|
|
1960
|
+
* invalid.items[0].qty('Insufficient stock')
|
|
1961
|
+
* );
|
|
1962
|
+
* ```
|
|
1963
|
+
*/
|
|
1964
|
+
export type Invalid<Input = any> = ((...issues: Array<string | StandardSchemaV1.Issue>) => never) &
|
|
1965
|
+
InvalidField<Input>;
|
|
1966
|
+
|
|
1924
1967
|
/**
|
|
1925
1968
|
* The return value of a remote `form` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.
|
|
1926
1969
|
*/
|
|
@@ -3108,7 +3151,7 @@ declare module '$app/server' {
|
|
|
3108
3151
|
*
|
|
3109
3152
|
* @since 2.27
|
|
3110
3153
|
*/
|
|
3111
|
-
export function form<Output>(fn: () => MaybePromise<Output>): RemoteForm<void, Output>;
|
|
3154
|
+
export function form<Output>(fn: (invalid: import("@sveltejs/kit").Invalid<void>) => MaybePromise<Output>): RemoteForm<void, Output>;
|
|
3112
3155
|
/**
|
|
3113
3156
|
* Creates a form object that can be spread onto a `<form>` element.
|
|
3114
3157
|
*
|
|
@@ -3116,7 +3159,7 @@ declare module '$app/server' {
|
|
|
3116
3159
|
*
|
|
3117
3160
|
* @since 2.27
|
|
3118
3161
|
*/
|
|
3119
|
-
export function form<Input extends RemoteFormInput, Output>(validate: "unchecked", fn: (data: Input) => MaybePromise<Output>): RemoteForm<Input, Output>;
|
|
3162
|
+
export function form<Input extends RemoteFormInput, Output>(validate: "unchecked", fn: (data: Input, invalid: import("@sveltejs/kit").Invalid<Input>) => MaybePromise<Output>): RemoteForm<Input, Output>;
|
|
3120
3163
|
/**
|
|
3121
3164
|
* Creates a form object that can be spread onto a `<form>` element.
|
|
3122
3165
|
*
|
|
@@ -3124,7 +3167,7 @@ declare module '$app/server' {
|
|
|
3124
3167
|
*
|
|
3125
3168
|
* @since 2.27
|
|
3126
3169
|
*/
|
|
3127
|
-
export function form<Schema extends StandardSchemaV1<RemoteFormInput, Record<string, any>>, Output>(validate: Schema, fn: (data: StandardSchemaV1.InferOutput<Schema
|
|
3170
|
+
export function form<Schema extends StandardSchemaV1<RemoteFormInput, Record<string, any>>, Output>(validate: Schema, fn: (data: StandardSchemaV1.InferOutput<Schema>, invalid: import("@sveltejs/kit").Invalid<StandardSchemaV1.InferOutput<Schema>>) => MaybePromise<Output>): RemoteForm<StandardSchemaV1.InferInput<Schema>, Output>;
|
|
3128
3171
|
/**
|
|
3129
3172
|
* Creates a remote prerender function. When called from the browser, the function will be invoked on the server via a `fetch` call.
|
|
3130
3173
|
*
|
package/types/index.d.ts.map
CHANGED
|
@@ -72,6 +72,8 @@
|
|
|
72
72
|
"RemoteFormInput",
|
|
73
73
|
"Rem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