@sveltejs/kit 3.0.0-next.20 → 3.0.0-next.21

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 (61) hide show
  1. package/package.json +7 -3
  2. package/src/cli.js +2 -2
  3. package/src/core/adapt/builder.js +14 -14
  4. package/src/core/adapt/index.js +16 -2
  5. package/src/core/config/index.js +33 -44
  6. package/src/core/config/options.js +66 -44
  7. package/src/core/env.js +3 -3
  8. package/src/core/postbuild/analyse.js +1 -1
  9. package/src/core/postbuild/prerender.js +48 -20
  10. package/src/core/sync/create_manifest_data/index.js +11 -11
  11. package/src/core/sync/sync.js +8 -8
  12. package/src/core/sync/write_app_types.js +2 -2
  13. package/src/core/sync/write_client_manifest.js +1 -1
  14. package/src/core/sync/write_server.js +14 -14
  15. package/src/core/sync/write_tsconfig/index.js +4 -4
  16. package/src/core/sync/write_types/index.js +10 -9
  17. package/src/exports/hooks/public.d.ts +2 -1
  18. package/src/exports/hooks/sequence.js +1 -1
  19. package/src/exports/index.js +0 -10
  20. package/src/exports/internal/server/event.js +1 -1
  21. package/src/exports/public.d.ts +2 -786
  22. package/src/exports/remote/index.js +11 -0
  23. package/src/exports/remote/public.d.ts +519 -0
  24. package/src/exports/vite/build/build_server.js +2 -2
  25. package/src/exports/vite/dev/index.js +30 -32
  26. package/src/exports/vite/index.js +98 -47
  27. package/src/exports/vite/preview/index.js +10 -10
  28. package/src/exports/vite/public.d.ts +588 -0
  29. package/src/exports/vite/utils.js +1 -1
  30. package/src/runtime/app/server/public.d.ts +168 -486
  31. package/src/runtime/app/server/remote/command.js +1 -1
  32. package/src/runtime/app/server/remote/form.js +1 -1
  33. package/src/runtime/app/server/remote/prerender.js +1 -1
  34. package/src/runtime/app/server/remote/query.js +2 -2
  35. package/src/runtime/app/server/remote/requested.js +1 -1
  36. package/src/runtime/app/server/remote/shared.js +1 -1
  37. package/src/runtime/client/remote-functions/command.svelte.js +1 -1
  38. package/src/runtime/client/remote-functions/form.svelte.js +1 -1
  39. package/src/runtime/client/remote-functions/prerender.svelte.js +1 -1
  40. package/src/runtime/client/remote-functions/query/index.js +1 -1
  41. package/src/runtime/client/remote-functions/query-batch.svelte.js +1 -1
  42. package/src/runtime/client/remote-functions/query-live/index.js +1 -1
  43. package/src/runtime/client/remote-functions/shared.svelte.js +1 -1
  44. package/src/runtime/server/cookie.js +2 -2
  45. package/src/runtime/server/data/index.js +1 -1
  46. package/src/runtime/server/endpoint.js +3 -3
  47. package/src/runtime/server/errors.js +2 -2
  48. package/src/runtime/server/fetch.js +1 -1
  49. package/src/runtime/server/page/actions.js +2 -1
  50. package/src/runtime/server/page/data_serializer.js +2 -2
  51. package/src/runtime/server/page/index.js +2 -1
  52. package/src/runtime/server/page/load_data.js +3 -3
  53. package/src/runtime/server/page/render.js +1 -1
  54. package/src/runtime/server/page/respond_with_error.js +1 -1
  55. package/src/runtime/server/remote-functions.js +3 -2
  56. package/src/runtime/server/respond.js +2 -2
  57. package/src/runtime/server/utils.js +1 -1
  58. package/src/types/internal.d.ts +7 -11
  59. package/src/version.js +1 -1
  60. package/types/index.d.ts +2368 -2341
  61. package/types/index.d.ts.map +67 -61
@@ -0,0 +1,11 @@
1
+ import { ValidationError } from '../internal/shared.js';
2
+
3
+ /**
4
+ * Checks whether this is a validation error thrown by [`invalid`](https://svelte.dev/docs/kit/@sveltejs-kit#invalid).
5
+ * @param {unknown} e The object to check.
6
+ * @return {e is import('@sveltejs/kit/remote').ValidationError}
7
+ * @since 2.47.3
8
+ */
9
+ export function isValidationError(e) {
10
+ return e instanceof ValidationError;
11
+ }
@@ -0,0 +1,519 @@
1
+ import { StandardSchemaV1 } from '@standard-schema/spec';
2
+ import { DeepPartial, IsAny, MaybePromise } from 'types';
3
+
4
+ export * from './index.js';
5
+
6
+ // If T is unknown or has an index signature, the types below will recurse indefinitely and create giant unions that TS can't handle
7
+ type WillRecurseIndefinitely<T> = unknown extends T ? true : string extends keyof T ? true : false;
8
+
9
+ // Input type mappings for form fields
10
+ type InputTypeMap = {
11
+ text: string;
12
+ email: string;
13
+ password: string;
14
+ url: string;
15
+ tel: string;
16
+ search: string;
17
+ number: number;
18
+ range: number;
19
+ date: string;
20
+ 'datetime-local': string;
21
+ time: string;
22
+ month: string;
23
+ week: string;
24
+ color: string;
25
+ checkbox: boolean | string[];
26
+ radio: string;
27
+ file: File;
28
+ hidden: string | number | boolean;
29
+ submit: string | number | boolean;
30
+ button: string;
31
+ reset: string;
32
+ image: string;
33
+ select: string;
34
+ 'select multiple': string[];
35
+ 'file multiple': File[];
36
+ };
37
+
38
+ // Valid input types for a given value type
39
+ export type RemoteFormFieldType<T> = {
40
+ [K in keyof InputTypeMap]: T extends InputTypeMap[K] ? K : never;
41
+ }[keyof InputTypeMap];
42
+
43
+ // Input element properties based on type
44
+ type InputElementProps<T extends keyof InputTypeMap> = T extends 'checkbox' | 'radio'
45
+ ? {
46
+ name: string;
47
+ type: T;
48
+ value?: string;
49
+ 'aria-invalid': boolean | 'false' | 'true' | undefined;
50
+ get checked(): boolean;
51
+ set checked(value: boolean);
52
+ readonly defaultChecked?: boolean;
53
+ }
54
+ : T extends 'file'
55
+ ? {
56
+ name: string;
57
+ type: 'file';
58
+ 'aria-invalid': boolean | 'false' | 'true' | undefined;
59
+ get files(): FileList | null;
60
+ set files(v: FileList | null);
61
+ }
62
+ : T extends 'select'
63
+ ? {
64
+ name: string;
65
+ 'aria-invalid': boolean | 'false' | 'true' | undefined;
66
+ get value(): string;
67
+ set value(v: string);
68
+ }
69
+ : T extends 'select multiple'
70
+ ? {
71
+ name: string;
72
+ multiple: true;
73
+ 'aria-invalid': boolean | 'false' | 'true' | undefined;
74
+ get value(): string[];
75
+ set value(v: string[]);
76
+ }
77
+ : T extends 'text'
78
+ ? {
79
+ name: string;
80
+ 'aria-invalid': boolean | 'false' | 'true' | undefined;
81
+ get value(): string | number;
82
+ set value(v: string | number);
83
+ readonly defaultValue?: string | number;
84
+ }
85
+ : {
86
+ name: string;
87
+ type: T;
88
+ 'aria-invalid': boolean | 'false' | 'true' | undefined;
89
+ get value(): string | number;
90
+ set value(v: string | number);
91
+ readonly defaultValue?: string | number;
92
+ };
93
+
94
+ type RemoteFormFieldMethods<T> = {
95
+ /** The values that will be submitted */
96
+ value(): DeepPartial<T>;
97
+ /** Set the values that will be submitted */
98
+ set(input: DeepPartial<T>): DeepPartial<T>;
99
+ /** Whether the field or any nested field has been interacted with since the form was mounted */
100
+ touched(): boolean;
101
+ /** Whether the field or any nested field has been edited since the form was mounted */
102
+ dirty(): boolean;
103
+ /** Validation issues, if any */
104
+ issues(): RemoteFormIssue[] | undefined;
105
+ };
106
+
107
+ // These two types use "T extends unknown ? .. : .." to distribute over unions.
108
+ // Example: if "type T = A | b" then "keyof T" only contains keys that both A and B have, with "KeysOfUnion<T>" we get the keys of both A and B
109
+ type KeysOfUnion<T> = T extends unknown ? keyof T : never;
110
+ type ValueOfUnionKey<T, K extends PropertyKey> = T extends unknown
111
+ ? K extends keyof T
112
+ ? T[K]
113
+ : never
114
+ : never;
115
+
116
+ export type RemoteFormFieldValue = string | string[] | number | boolean | File | File[];
117
+
118
+ type AsArgs<Type extends keyof InputTypeMap, Value> = Type extends 'checkbox'
119
+ ? Value extends string[]
120
+ ? [type: Type, value: Value[number] | (string & {})]
121
+ : Value extends boolean
122
+ ? [type: Type] | [type: Type, value: boolean]
123
+ : [type: Type] | [type: Type, value: Value | (string & {})]
124
+ : Type extends 'submit' | 'hidden'
125
+ ? Value extends string
126
+ ? [type: Type, value: Value | (string & {})]
127
+ : [type: Type, value: Value]
128
+ : Type extends 'radio'
129
+ ? [type: Type, value: Value | (string & {})]
130
+ : Type extends 'file' | 'file multiple'
131
+ ? [type: Type]
132
+ : [type: Type] | [type: Type, value: Value | undefined];
133
+
134
+ /**
135
+ * Form field accessor type that provides name(), value(), and issues() methods
136
+ */
137
+ export type RemoteFormField<Value extends RemoteFormFieldValue> = RemoteFormFieldMethods<Value> & {
138
+ /**
139
+ * Returns an object that can be spread onto an input element with the correct type attribute,
140
+ * aria-invalid attribute if the field is invalid, and appropriate value/checked property getters/setters.
141
+ * @example
142
+ * ```svelte
143
+ * <input {...myForm.fields.myString.as('text')} />
144
+ * <input {...myForm.fields.myNumber.as('number')} />
145
+ * <input {...myForm.fields.myBoolean.as('checkbox')} />
146
+ * ```
147
+ */
148
+ as<T extends RemoteFormFieldType<Value>>(...args: AsArgs<T, Value>): InputElementProps<T>;
149
+ };
150
+
151
+ type RemoteFormFieldContainer<Value> = RemoteFormFieldMethods<Value> & {
152
+ /** Validation issues belonging to this or any of the fields that belong to it, if any */
153
+ allIssues(): RemoteFormIssue[] | undefined;
154
+ };
155
+
156
+ type UnknownField<Value> = RemoteFormFieldMethods<Value> & {
157
+ /** Validation issues belonging to this or any of the fields that belong to it, if any */
158
+ allIssues(): RemoteFormIssue[] | undefined;
159
+ /**
160
+ * Returns an object that can be spread onto an input element with the correct type attribute,
161
+ * aria-invalid attribute if the field is invalid, and appropriate value/checked property getters/setters.
162
+ * @example
163
+ * ```svelte
164
+ * <input {...myForm.fields.myString.as('text')} />
165
+ * <input {...myForm.fields.myNumber.as('number')} />
166
+ * <input {...myForm.fields.myBoolean.as('checkbox')} />
167
+ * ```
168
+ */
169
+ as<T extends RemoteFormFieldType<Value>>(...args: AsArgs<T, Value>): InputElementProps<T>;
170
+ } & {
171
+ [key: string | number]: UnknownField<any>;
172
+ };
173
+
174
+ type RemoteFormFieldsRoot<Input extends RemoteFormInput | void> =
175
+ IsAny<Input> extends true
176
+ ? RecursiveFormFields
177
+ : Input extends void
178
+ ? {
179
+ /** Validation issues, if any */
180
+ issues(): RemoteFormIssue[] | undefined;
181
+ /** Validation issues belonging to this or any of the fields that belong to it, if any */
182
+ allIssues(): RemoteFormIssue[] | undefined;
183
+ }
184
+ : RemoteFormFields<Input>;
185
+
186
+ /**
187
+ * Recursive type to build form fields structure with proxy access
188
+ */
189
+ export type RemoteFormFields<T> =
190
+ WillRecurseIndefinitely<T> extends true
191
+ ? RecursiveFormFields
192
+ : NonNullable<T> extends string | number | boolean | File
193
+ ? RemoteFormField<NonNullable<T>>
194
+ : // [NonNullable<T>] is used to prevent distributing over union while still allowing
195
+ // nullable wrappers (e.g. `string[] | undefined` from a schema with `.default([])`)
196
+ // to be treated as arrays; only the last condition should distribute over unions
197
+ [NonNullable<T>] extends [string[] | File[]]
198
+ ? RemoteFormField<NonNullable<T>> & {
199
+ [K in number]: RemoteFormField<NonNullable<T>[number]>;
200
+ }
201
+ : [NonNullable<T>] extends [Array<infer U>]
202
+ ? RemoteFormFieldContainer<NonNullable<T>> & {
203
+ [K in number]: RemoteFormFields<U>;
204
+ }
205
+ : RemoteFormFieldContainer<T> & {
206
+ [K in KeysOfUnion<T>]-?: RemoteFormFields<ValueOfUnionKey<T, K>>;
207
+ };
208
+
209
+ // By breaking this out into its own type, we avoid the TS recursion depth limit
210
+ type RecursiveFormFields = RemoteFormFieldContainer<any> & {
211
+ [key: string | number]: UnknownField<any>;
212
+ };
213
+
214
+ type MaybeArray<T> = T | T[];
215
+
216
+ export interface RemoteFormInput {
217
+ [key: string]: MaybeArray<string | number | boolean | File | RemoteFormInput> | undefined;
218
+ }
219
+
220
+ export interface RemoteFormIssue {
221
+ message: string;
222
+ path: Array<string | number>;
223
+ }
224
+
225
+ // If the schema specifies `id` as a string or number, ensure that `for(...)`
226
+ // only accepts that type. Otherwise, accept `string | number`
227
+ type ExtractId<Input> = Input extends { id: infer Id }
228
+ ? Id extends string | number
229
+ ? Id
230
+ : string | number
231
+ : string | number;
232
+
233
+ /**
234
+ * A function and proxy object used to imperatively create validation errors in form handlers.
235
+ *
236
+ * Access properties to create field-specific issues: `issue.fieldName('message')`.
237
+ * The type structure mirrors the input data structure for type-safe field access.
238
+ * Call `invalid(issue.foo(...), issue.nested.bar(...))` to throw a validation error.
239
+ */
240
+ export type InvalidField<T> =
241
+ WillRecurseIndefinitely<T> extends true
242
+ ? Record<string | number, any>
243
+ : NonNullable<T> extends string | number | boolean | File
244
+ ? (message: string) => StandardSchemaV1.Issue
245
+ : NonNullable<T> extends Array<infer U>
246
+ ? {
247
+ [K in number]: InvalidField<U>;
248
+ } & ((message: string) => StandardSchemaV1.Issue)
249
+ : NonNullable<T> extends RemoteFormInput
250
+ ? {
251
+ [K in keyof T]-?: InvalidField<T[K]>;
252
+ } & ((message: string) => StandardSchemaV1.Issue)
253
+ : Record<string, never>;
254
+
255
+ /**
256
+ * A validation error thrown by `invalid`.
257
+ */
258
+ export interface ValidationError {
259
+ /** The validation issues */
260
+ issues: StandardSchemaV1.Issue[];
261
+ }
262
+
263
+ /**
264
+ * The form instance as received inside an `enhance` callback. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.
265
+ */
266
+ export type RemoteFormEnhanceInstance<
267
+ Input extends RemoteFormInput | void = RemoteFormInput | void,
268
+ Output = any
269
+ > = Omit<RemoteForm<Input, Output>, 'enhance' | 'element'> & {
270
+ readonly element: HTMLFormElement;
271
+ };
272
+
273
+ /**
274
+ * The callback passed to a remote form's `enhance` method. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.
275
+ */
276
+ export type RemoteFormEnhanceCallback<
277
+ Input extends RemoteFormInput | void = RemoteFormInput | void,
278
+ Output = any
279
+ > = (form: RemoteFormEnhanceInstance<Input, Output>) => MaybePromise<void>;
280
+
281
+ /**
282
+ * The type of a remote `form` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#form) for full documentation.
283
+ */
284
+ export type RemoteForm<Input extends RemoteFormInput | void, Output> = {
285
+ /** Attachment that sets up an event handler that intercepts the form submission on the client to prevent a full page reload */
286
+ [attachment: symbol]: (node: HTMLFormElement) => void;
287
+ method: 'POST';
288
+ /** The URL to send the form to. */
289
+ action: string;
290
+ /** The `<form>` element this instance is currently attached to, if any. */
291
+ get element(): HTMLFormElement | null;
292
+ /** Submit the currently attached form programmatically. */
293
+ submit(): Promise<boolean> & {
294
+ updates: (...updates: RemoteQueryUpdate[]) => Promise<boolean>;
295
+ };
296
+ /** Use the `enhance` method to influence what happens when the form is submitted. */
297
+ enhance(callback: RemoteFormEnhanceCallback<Input, Output>): {
298
+ method: 'POST';
299
+ action: string;
300
+ [attachment: symbol]: (node: HTMLFormElement) => void;
301
+ };
302
+ /**
303
+ * Create an instance of the form for the given `id`.
304
+ * The `id` is stringified and used for deduplication to potentially reuse existing instances.
305
+ * Useful when you have multiple forms that use the same remote form action, for example in a loop.
306
+ * ```svelte
307
+ * {#each todos as todo}
308
+ * {const todoForm = updateTodo.for(todo.id)}
309
+ * <form {...todoForm}>
310
+ * {#if todoForm.result?.invalid}<p>Invalid data</p>{/if}
311
+ * ...
312
+ * </form>
313
+ * {/each}
314
+ * ```
315
+ */
316
+ for(id: ExtractId<Input>): Omit<RemoteForm<Input, Output>, 'for'>;
317
+ /** Preflight checks */
318
+ preflight(schema: StandardSchemaV1<Input, any>): RemoteForm<Input, Output>;
319
+ /** Validate the form contents programmatically */
320
+ validate(options?: {
321
+ /**
322
+ * Set this to `true` to also show validation issues of fields that haven't yet been
323
+ * edited and blurred. This option is ignored for forms that have previously been
324
+ * submitted, in which case all fields are always subject to validation
325
+ * (unless the form is reset, at which point it is treated as pristine)
326
+ */
327
+ all?: boolean;
328
+ /** Set this to `true` to only run the `preflight` validation. */
329
+ preflightOnly?: boolean;
330
+ }): Promise<void>;
331
+ /** The result of the form submission */
332
+ get result(): Output | undefined;
333
+ /** The number of pending submissions */
334
+ get pending(): number;
335
+ /** True if the form has been submitted at least once, and hasn't been reset since */
336
+ get submitted(): boolean;
337
+ /** Access form fields using object notation */
338
+ fields: RemoteFormFieldsRoot<Input>;
339
+ };
340
+
341
+ /**
342
+ * The type of a remote `command` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#command) for full documentation.
343
+ */
344
+ export type RemoteCommand<Input, Output> = {
345
+ (arg: undefined extends Input ? Input | void : Input): Promise<Output> & {
346
+ updates(...updates: RemoteQueryUpdate[]): Promise<Output>;
347
+ };
348
+ /** The number of pending command executions */
349
+ get pending(): number;
350
+ };
351
+
352
+ export type RemoteQueryUpdate =
353
+ | RemoteQuery<any>
354
+ | RemoteLiveQuery<any>
355
+ | RemoteQueryFunction<any, any>
356
+ | RemoteLiveQueryFunction<any, any>
357
+ | RemoteQueryOverride;
358
+
359
+ export type RemoteResource<T> = Promise<T> & {
360
+ /** The error in case the query fails. */
361
+ get error(): App.Error | undefined;
362
+ /** `true` before the first result is available and during refreshes */
363
+ get loading(): boolean;
364
+ } & (
365
+ | {
366
+ /** The current value of the query. Undefined until `ready` is `true` */
367
+ get current(): undefined;
368
+ ready: false;
369
+ }
370
+ | {
371
+ /** The current value of the query. Undefined until `ready` is `true` */
372
+ get current(): T;
373
+ ready: true;
374
+ }
375
+ );
376
+
377
+ export type RemoteQuery<T> = RemoteResource<T> & {
378
+ /**
379
+ * On the client, this function will update the value of the query without re-fetching it.
380
+ *
381
+ * On the server, this can be called in the context of a `command` or `form` and the specified data will accompany the action response back to the client.
382
+ * This prevents SvelteKit needing to refresh all queries on the page in a second server round-trip.
383
+ */
384
+ set(value: T): void;
385
+ /**
386
+ * On the client, this function will re-fetch the query from the server.
387
+ *
388
+ * 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.
389
+ * This prevents SvelteKit needing to refresh all queries on the page in a second server round-trip.
390
+ */
391
+ refresh(): Promise<void>;
392
+ /**
393
+ * Temporarily override a query's value during a [single-flight mutation](https://svelte.dev/docs/kit/remote-functions#Single-flight-mutations) to provide optimistic updates.
394
+ *
395
+ * ```svelte
396
+ * <script>
397
+ * import { getTodos, addTodo } from './todos.remote.js';
398
+ * const todos = getTodos();
399
+ * </script>
400
+ *
401
+ * <form {...addTodo.enhance(async (form) => {
402
+ * await form.submit().updates(
403
+ * todos.withOverride((todos) => [...todos, { text: form.fields.text.value() }])
404
+ * );
405
+ * })}>
406
+ * <input type="text" name="text" />
407
+ * <button type="submit">Add Todo</button>
408
+ * </form>
409
+ * ```
410
+ */
411
+ withOverride(update: (current: T) => T): RemoteQueryOverride;
412
+ };
413
+
414
+ export type RemoteLiveQuery<T> = RemoteResource<T> &
415
+ AsyncIterable<T> & {
416
+ /** `true` if the live stream is currently connected. */
417
+ readonly connected: boolean;
418
+ /** `true` once the current live stream iterator is done. */
419
+ readonly done: boolean;
420
+ /** Reconnects the live stream immediately. */
421
+ reconnect(): Promise<void>;
422
+ };
423
+
424
+ export type RemoteQueryOverride = () => void;
425
+
426
+ /**
427
+ * The type of a remote `prerender` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#prerender) for full documentation.
428
+ */
429
+ export type RemotePrerenderFunction<Input, Output> = (
430
+ arg: undefined extends Input ? Input | void : Input
431
+ ) => RemoteResource<Output>;
432
+
433
+ /**
434
+ * The return value of a remote `query` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query) for full documentation.
435
+ *
436
+ * The optional `Validated` generic parameter represents the argument type *after* the
437
+ * query's schema has validated and (optionally) transformed it — this is the type the
438
+ * query's implementation function receives on the server, and the type yielded by
439
+ * [`requested`](https://svelte.dev/docs/kit/$app-server#requested). For queries declared
440
+ * with [Standard Schema](https://standardschema.dev/) it differs from `Input` when the
441
+ * schema contains a transform (e.g. `v.pipe(v.number(), v.transform(String))` has
442
+ * `Input = number` but `Validated = string`). For `'unchecked'` validators and queries
443
+ * without arguments it defaults to `Input`.
444
+ */
445
+ export type RemoteQueryFunction<Input, Output, _Validated = Input> = (
446
+ arg: undefined extends Input ? Input | void : Input
447
+ ) => RemoteQuery<Output>;
448
+
449
+ /**
450
+ * The type of a remote `query.live` function. See [Remote functions](https://svelte.dev/docs/kit/remote-functions#query.live) for full documentation.
451
+ *
452
+ * The optional `Validated` generic parameter represents the argument type *after* the
453
+ * query's schema has validated and (optionally) transformed it, and matches the type
454
+ * yielded by [`requested`](https://svelte.dev/docs/kit/$app-server#requested).
455
+ */
456
+ export type RemoteLiveQueryFunction<Input, Output, _Validated = Input> = (
457
+ arg: undefined extends Input ? Input | void : Input
458
+ ) => RemoteLiveQuery<Output>;
459
+
460
+ /**
461
+ * A single entry yielded by [`requested`](https://svelte.dev/docs/kit/$app-server#requested)
462
+ * when called with a regular `query`. `arg` is the validated argument (the input *after*
463
+ * the query's schema validated and transformed it, if applicable); `query` is a
464
+ * `RemoteQuery` bound to the client's original cache key, so `refresh()` / `set()` will
465
+ * update the correct client entry.
466
+ */
467
+ export type RequestedEntry<Validated, Output> = {
468
+ arg: Validated;
469
+ query: RemoteQuery<Output>;
470
+ };
471
+
472
+ /**
473
+ * A single entry yielded by [`requested`](https://svelte.dev/docs/kit/$app-server#requested)
474
+ * when called with a `query.live`. `arg` is the validated argument; `query` is a
475
+ * `RemoteLiveQuery` bound to the client's original cache key, so `reconnect()` targets
476
+ * the correct client subscription.
477
+ */
478
+ export type LiveRequestedEntry<Validated, Output> = {
479
+ arg: Validated;
480
+ query: RemoteLiveQuery<Output>;
481
+ };
482
+
483
+ export type QueryRequestedResult<Validated, Output> = Iterable<RequestedEntry<Validated, Output>> &
484
+ AsyncIterable<RequestedEntry<Validated, Output>> & {
485
+ /**
486
+ * Call `refresh` on all queries selected by this `requested` invocation.
487
+ * This is identical to:
488
+ * ```ts
489
+ * import { requested } from '$app/server';
490
+ *
491
+ * for await (const { query } of requested(getPost, ...)) {
492
+ * void query.refresh();
493
+ * }
494
+ * ```
495
+ */
496
+ refreshAll: () => Promise<void>;
497
+ };
498
+
499
+ export type LiveQueryRequestedResult<Validated, Output> = Iterable<
500
+ LiveRequestedEntry<Validated, Output>
501
+ > &
502
+ AsyncIterable<LiveRequestedEntry<Validated, Output>> & {
503
+ /**
504
+ * Call `reconnect` on all live queries selected by this `requested` invocation.
505
+ * This is identical to:
506
+ * ```ts
507
+ * import { requested } from '$app/server';
508
+ *
509
+ * for await (const { query } of requested(liveQuery, ...)) {
510
+ * void query.reconnect();
511
+ * }
512
+ * ```
513
+ */
514
+ reconnectAll: () => Promise<void>;
515
+ };
516
+
517
+ export type RequestedResult<Validated, Output> =
518
+ | QueryRequestedResult<Validated, Output>
519
+ | LiveQueryRequestedResult<Validated, Output>;
@@ -1,4 +1,4 @@
1
- /** @import { AssetDependencies, ManifestData, ValidatedKitConfig } from 'types' */
1
+ /** @import { AssetDependencies, ManifestData, ValidatedConfig } from 'types' */
2
2
  /** @import { Manifest, Rolldown } from 'vite' */
3
3
  import fs from 'node:fs';
4
4
  import {
@@ -16,7 +16,7 @@ import { escape_for_interpolation } from '../../../utils/escape.js';
16
16
 
17
17
  /**
18
18
  * @param {string} out
19
- * @param {ValidatedKitConfig} kit
19
+ * @param {ValidatedConfig} kit
20
20
  * @param {ManifestData} manifest_data
21
21
  * @param {Manifest} server_manifest
22
22
  * @param {Manifest | null} client_manifest