@timeax/form-palette 0.0.28 → 0.0.30
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 +416 -122
- package/dist/adapter-CvjXO9Gi.d.mts +253 -0
- package/dist/adapter-CvjXO9Gi.d.ts +253 -0
- package/dist/adapters.d.mts +5 -252
- package/dist/adapters.d.ts +5 -252
- package/dist/adapters.js +13 -2618
- package/dist/adapters.js.map +1 -1
- package/dist/adapters.mjs +11 -2620
- package/dist/adapters.mjs.map +1 -1
- package/dist/extra.d.mts +127 -0
- package/dist/extra.d.ts +127 -0
- package/dist/extra.js +26347 -0
- package/dist/extra.js.map +1 -0
- package/dist/extra.mjs +26303 -0
- package/dist/extra.mjs.map +1 -0
- package/dist/index.d.mts +11 -3792
- package/dist/index.d.ts +11 -3792
- package/dist/index.js +4584 -4073
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4508 -3998
- package/dist/index.mjs.map +1 -1
- package/dist/variant-BPDyK780.d.mts +4337 -0
- package/dist/variant-v0LBdshU.d.ts +4337 -0
- package/package.json +8 -2
package/dist/adapters.d.mts
CHANGED
|
@@ -1,254 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* HTTP methods supported by the core adapter layer.
|
|
6
|
-
*
|
|
7
|
-
* This matches the legacy Method union from the old types.ts.
|
|
8
|
-
*/
|
|
9
|
-
type Method = 'post' | 'get' | 'delete' | 'put' | 'patch';
|
|
10
|
-
/**
|
|
11
|
-
* Lifecycle callbacks used by adapters to report events back to the core.
|
|
12
|
-
*
|
|
13
|
-
* @template Ok Type of the "successful" response payload (e.g. AxiosResponse).
|
|
14
|
-
* @template Err Type of the "error" payload (e.g. AxiosError, unknown).
|
|
15
|
-
*/
|
|
16
|
-
interface AdapterCallbacks<Ok = unknown, Err = unknown> {
|
|
17
|
-
/**
|
|
18
|
-
* Called when the underlying request completes successfully.
|
|
19
|
-
* The adapter decides what "success" means (HTTP 2xx, no exception, etc.).
|
|
20
|
-
*/
|
|
21
|
-
onSuccess?(response: Ok): void;
|
|
22
|
-
/**
|
|
23
|
-
* Called when the underlying request fails.
|
|
24
|
-
* Adapters should pass the most informative error shape they have.
|
|
25
|
-
*/
|
|
26
|
-
onError?(error: Err, updateRef?: boolean): void;
|
|
27
|
-
/**
|
|
28
|
-
* Called at the end of the adapter lifecycle, whether success or error.
|
|
29
|
-
* Useful for clearing loading states, unlocking buttons, etc.
|
|
30
|
-
*/
|
|
31
|
-
onFinish?(): void;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Result interface returned by an adapter.
|
|
35
|
-
*
|
|
36
|
-
* Generic evolution of the legacy AdapterResult:
|
|
37
|
-
*
|
|
38
|
-
* type AdapterResult = {
|
|
39
|
-
* submit(options?: unknown): void;
|
|
40
|
-
* send<T = unknown>(): Promise<AxiosResponse<T>>;
|
|
41
|
-
* run(options?: unknown): void;
|
|
42
|
-
* };
|
|
43
|
-
*
|
|
44
|
-
* Differences:
|
|
45
|
-
* - The success payload is generic (Ok) instead of hard-coded to AxiosResponse.
|
|
46
|
-
* - send() always returns Promise<Ok>.
|
|
47
|
-
* - run() may return either void or Promise<Ok>, depending on adapter.
|
|
48
|
-
*
|
|
49
|
-
* @template Ok Type of the "successful" response payload.
|
|
50
|
-
*/
|
|
51
|
-
interface AdapterResult<Ok = unknown> {
|
|
52
|
-
/**
|
|
53
|
-
* Fire-and-forget trigger.
|
|
54
|
-
*
|
|
55
|
-
* Intended for flows where the caller does not care about the response
|
|
56
|
-
* object itself (e.g. SPA navigation).
|
|
57
|
-
*
|
|
58
|
-
* @param options Optional adapter-specific options.
|
|
59
|
-
*/
|
|
60
|
-
submit(options?: unknown): void;
|
|
61
|
-
/**
|
|
62
|
-
* Promise-based trigger.
|
|
63
|
-
*
|
|
64
|
-
* Intended for flows where the caller wants to await the response object.
|
|
65
|
-
* Adapters should reject the promise when an error occurs.
|
|
66
|
-
*
|
|
67
|
-
* @param options Optional adapter-specific options.
|
|
68
|
-
*/
|
|
69
|
-
send(options?: unknown): Promise<Ok>;
|
|
70
|
-
/**
|
|
71
|
-
* Convenience trigger.
|
|
72
|
-
*
|
|
73
|
-
* Adapters are free to implement this as:
|
|
74
|
-
* - submit(options) (returning void), or
|
|
75
|
-
* - send(options) (returning Promise<Ok>).
|
|
76
|
-
*
|
|
77
|
-
* Callers that need strict typing can prefer send();
|
|
78
|
-
* callers that just need "do the thing" can use run().
|
|
79
|
-
*
|
|
80
|
-
* @param options Optional adapter-specific options.
|
|
81
|
-
*/
|
|
82
|
-
run(options?: unknown): void | Promise<Ok>;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Configuration passed from the core runtime to a concrete adapter factory.
|
|
86
|
-
*
|
|
87
|
-
* @template Body Type of the outbound payload (form values + extra data).
|
|
88
|
-
* @template Ok Type of the "successful" response payload.
|
|
89
|
-
* @template Err Type of the "error" payload.
|
|
90
|
-
*/
|
|
91
|
-
interface AdapterConfig<Body = unknown, Ok = unknown, Err = unknown> {
|
|
92
|
-
/**
|
|
93
|
-
* Request body payload built by the core.
|
|
94
|
-
*
|
|
95
|
-
* Typically something like:
|
|
96
|
-
*
|
|
97
|
-
* { ...formValues, ...extra }
|
|
98
|
-
*/
|
|
99
|
-
data: Body;
|
|
100
|
-
errorBag?: string;
|
|
101
|
-
/**
|
|
102
|
-
* Lifecycle callbacks provided by the core.
|
|
103
|
-
*
|
|
104
|
-
* The adapter should invoke these at the appropriate times; it must not
|
|
105
|
-
* swallow errors without calling onError (when provided).
|
|
106
|
-
*/
|
|
107
|
-
callbacks?: AdapterCallbacks<Ok, Err>;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Factory function type for creating an adapter instance.
|
|
111
|
-
*
|
|
112
|
-
* Concrete implementations (Axios, Inertia, fetch, custom) can conform
|
|
113
|
-
* to this signature. The core runtime only knows about this type and does
|
|
114
|
-
* not depend on any adapter-specific details.
|
|
115
|
-
*
|
|
116
|
-
* @template Body Type of the outbound payload (form values + extra data).
|
|
117
|
-
* @template Ok Type of the "successful" response payload.
|
|
118
|
-
* @template Err Type of the "error" payload.
|
|
119
|
-
*/
|
|
120
|
-
type AdapterFactory<Body = unknown, Ok = unknown, Err = unknown> = (config: AdapterConfig<Body, Ok, Err>) => AdapterResult<Ok>;
|
|
121
|
-
/**
|
|
122
|
-
* Registry of adapter flavours.
|
|
123
|
-
*
|
|
124
|
-
* The library hard-codes a single built-in adapter flavour:
|
|
125
|
-
*
|
|
126
|
-
* - 'local' → host-handled, no transport semantics.
|
|
127
|
-
* .send() resolves to `{ data: Body }`.
|
|
128
|
-
*
|
|
129
|
-
* Hosts can extend this interface via module augmentation to add
|
|
130
|
-
* their own adapter flavours (e.g. 'axios', 'inertia', ...).
|
|
131
|
-
*/
|
|
132
|
-
interface Adapters {
|
|
133
|
-
local: {
|
|
134
|
-
/**
|
|
135
|
-
* Type of the value produced by adapter.send() for this adapter flavour.
|
|
136
|
-
*/
|
|
137
|
-
ok: {
|
|
138
|
-
data: unknown;
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Type of the error value passed into callbacks.onError for this adapter.
|
|
142
|
-
*/
|
|
143
|
-
err: unknown;
|
|
144
|
-
};
|
|
145
|
-
axios: {
|
|
146
|
-
/**
|
|
147
|
-
* What adapter.send() resolves with for Axios.
|
|
148
|
-
*/
|
|
149
|
-
ok: AxiosResponse<unknown>;
|
|
150
|
-
/**
|
|
151
|
-
* What callbacks.onError receives for Axios.
|
|
152
|
-
*
|
|
153
|
-
* We pass the *payload* (e.g. response.data), not the raw AxiosError,
|
|
154
|
-
* so Form Palette's autoErr branch can see `.errors`.
|
|
155
|
-
*/
|
|
156
|
-
err: unknown;
|
|
157
|
-
/**
|
|
158
|
-
* Extra public props exposed on CoreProps when adapter="axios".
|
|
159
|
-
*
|
|
160
|
-
* These are set on the Core shell and then used by createAxiosAdapter.
|
|
161
|
-
*/
|
|
162
|
-
props: {
|
|
163
|
-
/**
|
|
164
|
-
* Request URL for this form.
|
|
165
|
-
* Required when using the axios adapter.
|
|
166
|
-
*/
|
|
167
|
-
url: string;
|
|
168
|
-
/**
|
|
169
|
-
* HTTP method to use for this form.
|
|
170
|
-
* Optional: the adapter/Core can still default to "post".
|
|
171
|
-
*/
|
|
172
|
-
method?: Method;
|
|
173
|
-
/**
|
|
174
|
-
* Base Axios request config merged into every request.
|
|
175
|
-
*
|
|
176
|
-
* Useful for baseURL, headers, withCredentials, params,
|
|
177
|
-
* timeout, etc. Per-call overrides still go through the
|
|
178
|
-
* `options` parameter of submit/send/run.
|
|
179
|
-
*/
|
|
180
|
-
config?: AxiosRequestConfig<any>;
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
inertia: {
|
|
184
|
-
/**
|
|
185
|
-
* What adapter.send() resolves with for Inertia.
|
|
186
|
-
* This is the Page object passed to onSuccess.
|
|
187
|
-
*/
|
|
188
|
-
ok: Page<any>;
|
|
189
|
-
/**
|
|
190
|
-
* What callbacks.onError receives for Inertia.
|
|
191
|
-
*
|
|
192
|
-
* We shape this as `{ errors: ErrorBag }` so Form Palette's
|
|
193
|
-
* autoErr branch can see `.errors`.
|
|
194
|
-
*/
|
|
195
|
-
err: {
|
|
196
|
-
errors: Record<string, string | string[]>;
|
|
197
|
-
} | unknown;
|
|
198
|
-
/**
|
|
199
|
-
* Extra public props exposed on CoreProps when adapter="inertia".
|
|
200
|
-
*/
|
|
201
|
-
props: {
|
|
202
|
-
/**
|
|
203
|
-
* Target URL / route for the Inertia visit.
|
|
204
|
-
*/
|
|
205
|
-
url: string;
|
|
206
|
-
/**
|
|
207
|
-
* HTTP method to use for the visit.
|
|
208
|
-
*/
|
|
209
|
-
method?: Method;
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
type AdapterProps<K extends AdapterKey> = Adapters[K] extends {
|
|
214
|
-
props: infer P;
|
|
215
|
-
} ? P : {};
|
|
216
|
-
/**
|
|
217
|
-
* Union of all adapter keys known to the core.
|
|
218
|
-
*
|
|
219
|
-
* Hosts can extend this union by augmenting the Adapters interface.
|
|
220
|
-
*/
|
|
221
|
-
type AdapterKey = keyof Adapters;
|
|
222
|
-
/**
|
|
223
|
-
* Helper: given an adapter key K, get its "ok" payload type.
|
|
224
|
-
*/
|
|
225
|
-
type AdapterOk<K extends AdapterKey> = Adapters[K]['ok'];
|
|
226
|
-
/**
|
|
227
|
-
* Helper: given an adapter key K, get its "error" payload type.
|
|
228
|
-
*/
|
|
229
|
-
type AdapterError<K extends AdapterKey> = Adapters[K]['err'];
|
|
230
|
-
/**
|
|
231
|
-
* Helper: what CoreProps.onSubmitted receives for adapter K.
|
|
232
|
-
*
|
|
233
|
-
* For now, this is the same as AdapterOk<K>. If a host wants a different
|
|
234
|
-
* shape, they can wrap/transform in their own components.
|
|
235
|
-
*/
|
|
236
|
-
type AdapterSubmit<K extends AdapterKey> = AdapterOk<K>;
|
|
237
|
-
/**
|
|
238
|
-
* AdapterConfig specialised for a named adapter key K, using the
|
|
239
|
-
* registry's ok/err types for that key.
|
|
240
|
-
*
|
|
241
|
-
* @template K Adapter key.
|
|
242
|
-
* @template Body Outbound payload type.
|
|
243
|
-
*/
|
|
244
|
-
type NamedAdapterConfig<K extends AdapterKey, Body = unknown> = AdapterConfig<Body, AdapterOk<K>, AdapterError<K>> & AdapterProps<K>;
|
|
245
|
-
/**
|
|
246
|
-
* AdapterFactory specialised for a named adapter key K.
|
|
247
|
-
*
|
|
248
|
-
* @template K Adapter key.
|
|
249
|
-
* @template Body Outbound payload type.
|
|
250
|
-
*/
|
|
251
|
-
type NamedAdapterFactory<K extends AdapterKey, Body = unknown> = (config: NamedAdapterConfig<K, Body>) => AdapterResult<AdapterOk<K>>;
|
|
1
|
+
import { j as NamedAdapterFactory, A as AdapterKey } from './adapter-CvjXO9Gi.mjs';
|
|
2
|
+
export { a as AdapterCallbacks, c as AdapterConfig, h as AdapterError, d as AdapterFactory, g as AdapterOk, f as AdapterProps, b as AdapterResult, i as AdapterSubmit, e as Adapters, M as Method, N as NamedAdapterConfig } from './adapter-CvjXO9Gi.mjs';
|
|
3
|
+
import '@inertiajs/core';
|
|
4
|
+
import 'axios';
|
|
252
5
|
|
|
253
6
|
/**
|
|
254
7
|
* Built-in 'local' adapter.
|
|
@@ -316,4 +69,4 @@ declare function registerKnownAdapter(key: AdapterKey): Promise<void>;
|
|
|
316
69
|
**/
|
|
317
70
|
declare function registerAllAdapters(): void;
|
|
318
71
|
|
|
319
|
-
export {
|
|
72
|
+
export { AdapterKey, NamedAdapterFactory, createAxiosAdapter, createInertiaAdapter, getAdapter, hasAdapter, localAdapter, registerAdapter, registerAllAdapters, registerAxiosAdapter, registerInertiaAdapter, registerKnownAdapter };
|
package/dist/adapters.d.ts
CHANGED
|
@@ -1,254 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
* HTTP methods supported by the core adapter layer.
|
|
6
|
-
*
|
|
7
|
-
* This matches the legacy Method union from the old types.ts.
|
|
8
|
-
*/
|
|
9
|
-
type Method = 'post' | 'get' | 'delete' | 'put' | 'patch';
|
|
10
|
-
/**
|
|
11
|
-
* Lifecycle callbacks used by adapters to report events back to the core.
|
|
12
|
-
*
|
|
13
|
-
* @template Ok Type of the "successful" response payload (e.g. AxiosResponse).
|
|
14
|
-
* @template Err Type of the "error" payload (e.g. AxiosError, unknown).
|
|
15
|
-
*/
|
|
16
|
-
interface AdapterCallbacks<Ok = unknown, Err = unknown> {
|
|
17
|
-
/**
|
|
18
|
-
* Called when the underlying request completes successfully.
|
|
19
|
-
* The adapter decides what "success" means (HTTP 2xx, no exception, etc.).
|
|
20
|
-
*/
|
|
21
|
-
onSuccess?(response: Ok): void;
|
|
22
|
-
/**
|
|
23
|
-
* Called when the underlying request fails.
|
|
24
|
-
* Adapters should pass the most informative error shape they have.
|
|
25
|
-
*/
|
|
26
|
-
onError?(error: Err, updateRef?: boolean): void;
|
|
27
|
-
/**
|
|
28
|
-
* Called at the end of the adapter lifecycle, whether success or error.
|
|
29
|
-
* Useful for clearing loading states, unlocking buttons, etc.
|
|
30
|
-
*/
|
|
31
|
-
onFinish?(): void;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Result interface returned by an adapter.
|
|
35
|
-
*
|
|
36
|
-
* Generic evolution of the legacy AdapterResult:
|
|
37
|
-
*
|
|
38
|
-
* type AdapterResult = {
|
|
39
|
-
* submit(options?: unknown): void;
|
|
40
|
-
* send<T = unknown>(): Promise<AxiosResponse<T>>;
|
|
41
|
-
* run(options?: unknown): void;
|
|
42
|
-
* };
|
|
43
|
-
*
|
|
44
|
-
* Differences:
|
|
45
|
-
* - The success payload is generic (Ok) instead of hard-coded to AxiosResponse.
|
|
46
|
-
* - send() always returns Promise<Ok>.
|
|
47
|
-
* - run() may return either void or Promise<Ok>, depending on adapter.
|
|
48
|
-
*
|
|
49
|
-
* @template Ok Type of the "successful" response payload.
|
|
50
|
-
*/
|
|
51
|
-
interface AdapterResult<Ok = unknown> {
|
|
52
|
-
/**
|
|
53
|
-
* Fire-and-forget trigger.
|
|
54
|
-
*
|
|
55
|
-
* Intended for flows where the caller does not care about the response
|
|
56
|
-
* object itself (e.g. SPA navigation).
|
|
57
|
-
*
|
|
58
|
-
* @param options Optional adapter-specific options.
|
|
59
|
-
*/
|
|
60
|
-
submit(options?: unknown): void;
|
|
61
|
-
/**
|
|
62
|
-
* Promise-based trigger.
|
|
63
|
-
*
|
|
64
|
-
* Intended for flows where the caller wants to await the response object.
|
|
65
|
-
* Adapters should reject the promise when an error occurs.
|
|
66
|
-
*
|
|
67
|
-
* @param options Optional adapter-specific options.
|
|
68
|
-
*/
|
|
69
|
-
send(options?: unknown): Promise<Ok>;
|
|
70
|
-
/**
|
|
71
|
-
* Convenience trigger.
|
|
72
|
-
*
|
|
73
|
-
* Adapters are free to implement this as:
|
|
74
|
-
* - submit(options) (returning void), or
|
|
75
|
-
* - send(options) (returning Promise<Ok>).
|
|
76
|
-
*
|
|
77
|
-
* Callers that need strict typing can prefer send();
|
|
78
|
-
* callers that just need "do the thing" can use run().
|
|
79
|
-
*
|
|
80
|
-
* @param options Optional adapter-specific options.
|
|
81
|
-
*/
|
|
82
|
-
run(options?: unknown): void | Promise<Ok>;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Configuration passed from the core runtime to a concrete adapter factory.
|
|
86
|
-
*
|
|
87
|
-
* @template Body Type of the outbound payload (form values + extra data).
|
|
88
|
-
* @template Ok Type of the "successful" response payload.
|
|
89
|
-
* @template Err Type of the "error" payload.
|
|
90
|
-
*/
|
|
91
|
-
interface AdapterConfig<Body = unknown, Ok = unknown, Err = unknown> {
|
|
92
|
-
/**
|
|
93
|
-
* Request body payload built by the core.
|
|
94
|
-
*
|
|
95
|
-
* Typically something like:
|
|
96
|
-
*
|
|
97
|
-
* { ...formValues, ...extra }
|
|
98
|
-
*/
|
|
99
|
-
data: Body;
|
|
100
|
-
errorBag?: string;
|
|
101
|
-
/**
|
|
102
|
-
* Lifecycle callbacks provided by the core.
|
|
103
|
-
*
|
|
104
|
-
* The adapter should invoke these at the appropriate times; it must not
|
|
105
|
-
* swallow errors without calling onError (when provided).
|
|
106
|
-
*/
|
|
107
|
-
callbacks?: AdapterCallbacks<Ok, Err>;
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* Factory function type for creating an adapter instance.
|
|
111
|
-
*
|
|
112
|
-
* Concrete implementations (Axios, Inertia, fetch, custom) can conform
|
|
113
|
-
* to this signature. The core runtime only knows about this type and does
|
|
114
|
-
* not depend on any adapter-specific details.
|
|
115
|
-
*
|
|
116
|
-
* @template Body Type of the outbound payload (form values + extra data).
|
|
117
|
-
* @template Ok Type of the "successful" response payload.
|
|
118
|
-
* @template Err Type of the "error" payload.
|
|
119
|
-
*/
|
|
120
|
-
type AdapterFactory<Body = unknown, Ok = unknown, Err = unknown> = (config: AdapterConfig<Body, Ok, Err>) => AdapterResult<Ok>;
|
|
121
|
-
/**
|
|
122
|
-
* Registry of adapter flavours.
|
|
123
|
-
*
|
|
124
|
-
* The library hard-codes a single built-in adapter flavour:
|
|
125
|
-
*
|
|
126
|
-
* - 'local' → host-handled, no transport semantics.
|
|
127
|
-
* .send() resolves to `{ data: Body }`.
|
|
128
|
-
*
|
|
129
|
-
* Hosts can extend this interface via module augmentation to add
|
|
130
|
-
* their own adapter flavours (e.g. 'axios', 'inertia', ...).
|
|
131
|
-
*/
|
|
132
|
-
interface Adapters {
|
|
133
|
-
local: {
|
|
134
|
-
/**
|
|
135
|
-
* Type of the value produced by adapter.send() for this adapter flavour.
|
|
136
|
-
*/
|
|
137
|
-
ok: {
|
|
138
|
-
data: unknown;
|
|
139
|
-
};
|
|
140
|
-
/**
|
|
141
|
-
* Type of the error value passed into callbacks.onError for this adapter.
|
|
142
|
-
*/
|
|
143
|
-
err: unknown;
|
|
144
|
-
};
|
|
145
|
-
axios: {
|
|
146
|
-
/**
|
|
147
|
-
* What adapter.send() resolves with for Axios.
|
|
148
|
-
*/
|
|
149
|
-
ok: AxiosResponse<unknown>;
|
|
150
|
-
/**
|
|
151
|
-
* What callbacks.onError receives for Axios.
|
|
152
|
-
*
|
|
153
|
-
* We pass the *payload* (e.g. response.data), not the raw AxiosError,
|
|
154
|
-
* so Form Palette's autoErr branch can see `.errors`.
|
|
155
|
-
*/
|
|
156
|
-
err: unknown;
|
|
157
|
-
/**
|
|
158
|
-
* Extra public props exposed on CoreProps when adapter="axios".
|
|
159
|
-
*
|
|
160
|
-
* These are set on the Core shell and then used by createAxiosAdapter.
|
|
161
|
-
*/
|
|
162
|
-
props: {
|
|
163
|
-
/**
|
|
164
|
-
* Request URL for this form.
|
|
165
|
-
* Required when using the axios adapter.
|
|
166
|
-
*/
|
|
167
|
-
url: string;
|
|
168
|
-
/**
|
|
169
|
-
* HTTP method to use for this form.
|
|
170
|
-
* Optional: the adapter/Core can still default to "post".
|
|
171
|
-
*/
|
|
172
|
-
method?: Method;
|
|
173
|
-
/**
|
|
174
|
-
* Base Axios request config merged into every request.
|
|
175
|
-
*
|
|
176
|
-
* Useful for baseURL, headers, withCredentials, params,
|
|
177
|
-
* timeout, etc. Per-call overrides still go through the
|
|
178
|
-
* `options` parameter of submit/send/run.
|
|
179
|
-
*/
|
|
180
|
-
config?: AxiosRequestConfig<any>;
|
|
181
|
-
};
|
|
182
|
-
};
|
|
183
|
-
inertia: {
|
|
184
|
-
/**
|
|
185
|
-
* What adapter.send() resolves with for Inertia.
|
|
186
|
-
* This is the Page object passed to onSuccess.
|
|
187
|
-
*/
|
|
188
|
-
ok: Page<any>;
|
|
189
|
-
/**
|
|
190
|
-
* What callbacks.onError receives for Inertia.
|
|
191
|
-
*
|
|
192
|
-
* We shape this as `{ errors: ErrorBag }` so Form Palette's
|
|
193
|
-
* autoErr branch can see `.errors`.
|
|
194
|
-
*/
|
|
195
|
-
err: {
|
|
196
|
-
errors: Record<string, string | string[]>;
|
|
197
|
-
} | unknown;
|
|
198
|
-
/**
|
|
199
|
-
* Extra public props exposed on CoreProps when adapter="inertia".
|
|
200
|
-
*/
|
|
201
|
-
props: {
|
|
202
|
-
/**
|
|
203
|
-
* Target URL / route for the Inertia visit.
|
|
204
|
-
*/
|
|
205
|
-
url: string;
|
|
206
|
-
/**
|
|
207
|
-
* HTTP method to use for the visit.
|
|
208
|
-
*/
|
|
209
|
-
method?: Method;
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
type AdapterProps<K extends AdapterKey> = Adapters[K] extends {
|
|
214
|
-
props: infer P;
|
|
215
|
-
} ? P : {};
|
|
216
|
-
/**
|
|
217
|
-
* Union of all adapter keys known to the core.
|
|
218
|
-
*
|
|
219
|
-
* Hosts can extend this union by augmenting the Adapters interface.
|
|
220
|
-
*/
|
|
221
|
-
type AdapterKey = keyof Adapters;
|
|
222
|
-
/**
|
|
223
|
-
* Helper: given an adapter key K, get its "ok" payload type.
|
|
224
|
-
*/
|
|
225
|
-
type AdapterOk<K extends AdapterKey> = Adapters[K]['ok'];
|
|
226
|
-
/**
|
|
227
|
-
* Helper: given an adapter key K, get its "error" payload type.
|
|
228
|
-
*/
|
|
229
|
-
type AdapterError<K extends AdapterKey> = Adapters[K]['err'];
|
|
230
|
-
/**
|
|
231
|
-
* Helper: what CoreProps.onSubmitted receives for adapter K.
|
|
232
|
-
*
|
|
233
|
-
* For now, this is the same as AdapterOk<K>. If a host wants a different
|
|
234
|
-
* shape, they can wrap/transform in their own components.
|
|
235
|
-
*/
|
|
236
|
-
type AdapterSubmit<K extends AdapterKey> = AdapterOk<K>;
|
|
237
|
-
/**
|
|
238
|
-
* AdapterConfig specialised for a named adapter key K, using the
|
|
239
|
-
* registry's ok/err types for that key.
|
|
240
|
-
*
|
|
241
|
-
* @template K Adapter key.
|
|
242
|
-
* @template Body Outbound payload type.
|
|
243
|
-
*/
|
|
244
|
-
type NamedAdapterConfig<K extends AdapterKey, Body = unknown> = AdapterConfig<Body, AdapterOk<K>, AdapterError<K>> & AdapterProps<K>;
|
|
245
|
-
/**
|
|
246
|
-
* AdapterFactory specialised for a named adapter key K.
|
|
247
|
-
*
|
|
248
|
-
* @template K Adapter key.
|
|
249
|
-
* @template Body Outbound payload type.
|
|
250
|
-
*/
|
|
251
|
-
type NamedAdapterFactory<K extends AdapterKey, Body = unknown> = (config: NamedAdapterConfig<K, Body>) => AdapterResult<AdapterOk<K>>;
|
|
1
|
+
import { j as NamedAdapterFactory, A as AdapterKey } from './adapter-CvjXO9Gi.js';
|
|
2
|
+
export { a as AdapterCallbacks, c as AdapterConfig, h as AdapterError, d as AdapterFactory, g as AdapterOk, f as AdapterProps, b as AdapterResult, i as AdapterSubmit, e as Adapters, M as Method, N as NamedAdapterConfig } from './adapter-CvjXO9Gi.js';
|
|
3
|
+
import '@inertiajs/core';
|
|
4
|
+
import 'axios';
|
|
252
5
|
|
|
253
6
|
/**
|
|
254
7
|
* Built-in 'local' adapter.
|
|
@@ -316,4 +69,4 @@ declare function registerKnownAdapter(key: AdapterKey): Promise<void>;
|
|
|
316
69
|
**/
|
|
317
70
|
declare function registerAllAdapters(): void;
|
|
318
71
|
|
|
319
|
-
export {
|
|
72
|
+
export { AdapterKey, NamedAdapterFactory, createAxiosAdapter, createInertiaAdapter, getAdapter, hasAdapter, localAdapter, registerAdapter, registerAllAdapters, registerAxiosAdapter, registerInertiaAdapter, registerKnownAdapter };
|