@optionfactory/fml 9.0.0-rc3 → 9.0.0-rc30
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 +16 -88
- package/dist/client-errors.iife.js +40 -49
- package/dist/client-errors.iife.js.map +1 -1
- package/dist/client-errors.iife.min.js +1 -1
- package/dist/client-errors.iife.min.js.map +1 -1
- package/dist/custom-elements.json +483 -50
- package/dist/fml.css +25 -20
- package/dist/fml.css.map +1 -1
- package/dist/fml.iife.js +5688 -2542
- package/dist/fml.iife.js.map +1 -1
- package/dist/fml.iife.min.js +1 -1
- package/dist/fml.iife.min.js.map +1 -1
- package/dist/ftl.d.mts +398 -227
- package/dist/ftl.iife.js +682 -1016
- package/dist/ftl.iife.js.map +1 -1
- package/dist/ftl.iife.min.js +1 -1
- package/dist/ftl.iife.min.js.map +1 -1
- package/dist/ftl.min.mjs +1 -1
- package/dist/ftl.min.mjs.map +1 -1
- package/dist/ftl.mjs +682 -1016
- package/dist/ftl.mjs.map +1 -1
- package/dist/ful.css +25 -20
- package/dist/ful.css.map +1 -1
- package/dist/ful.d.mts +3043 -546
- package/dist/ful.iife.js +4875 -1387
- package/dist/ful.iife.js.map +1 -1
- package/dist/ful.iife.min.js +1 -1
- package/dist/ful.iife.min.js.map +1 -1
- package/dist/ful.min.mjs +1 -1
- package/dist/ful.min.mjs.map +1 -1
- package/dist/ful.mjs +4873 -1389
- package/dist/ful.mjs.map +1 -1
- package/dist/httpc.d.mts +143 -123
- package/dist/httpc.iife.js +163 -175
- package/dist/httpc.iife.js.map +1 -1
- package/dist/httpc.iife.min.js +1 -1
- package/dist/httpc.iife.min.js.map +1 -1
- package/dist/httpc.min.mjs +1 -1
- package/dist/httpc.min.mjs.map +1 -1
- package/dist/httpc.mjs +163 -175
- package/dist/httpc.mjs.map +1 -1
- package/dist/vscode.html-custom-data.json +234 -38
- package/dist/web-types.json +489 -50
- package/package.json +2 -2
package/dist/httpc.d.mts
CHANGED
|
@@ -5,6 +5,9 @@ export type Problem = {
|
|
|
5
5
|
details: any | null;
|
|
6
6
|
};
|
|
7
7
|
/**
|
|
8
|
+
* One problem of a failure: its `type` (a code such as `FIELD_ERROR` or
|
|
9
|
+
* `GENERIC_PROBLEM`), the `context` naming the field it belongs to or null, the
|
|
10
|
+
* human `reason`, and optional `details`.
|
|
8
11
|
* @typedef {{ type: string; context: string?; reason: string; details: any?; }} Problem
|
|
9
12
|
*/
|
|
10
13
|
/**
|
|
@@ -15,12 +18,11 @@ export type Problem = {
|
|
|
15
18
|
declare class Failure extends Error {
|
|
16
19
|
problems: Problem[];
|
|
17
20
|
/**
|
|
18
|
-
*
|
|
19
21
|
* @param {string} message
|
|
20
22
|
* @param {Problem[]} problems
|
|
21
|
-
* @param {*} cause
|
|
23
|
+
* @param {*} [cause]
|
|
22
24
|
*/
|
|
23
|
-
constructor(message: string, problems: Problem[], cause
|
|
25
|
+
constructor(message: string, problems: Problem[], cause?: any);
|
|
24
26
|
/**
|
|
25
27
|
* Returns a copy whose problems' contexts have the prefix removed, so a
|
|
26
28
|
* caller can rethrow namespaced problems as its own.
|
|
@@ -29,21 +31,12 @@ declare class Failure extends Error {
|
|
|
29
31
|
*/
|
|
30
32
|
dropping(prefix: string): Failure;
|
|
31
33
|
/**
|
|
34
|
+
* Copies of the problems, each context losing the prefix where it starts with it.
|
|
32
35
|
* @param {Problem[]} problems
|
|
33
36
|
* @param {string} prefix
|
|
34
37
|
* @returns {Problem[]}
|
|
35
38
|
*/
|
|
36
39
|
static dropProblemsContext(problems: Problem[], prefix: string): Problem[];
|
|
37
|
-
/**
|
|
38
|
-
* The one reading of a failure: its problems' reasons, one per line, or
|
|
39
|
-
* the fallback when the value carries none. An empty problems array
|
|
40
|
-
* carries nothing: the failure's own message reads instead.
|
|
41
|
-
*
|
|
42
|
-
* @param {any} cause
|
|
43
|
-
* @param {string|null} [fallback]
|
|
44
|
-
* @returns {string}
|
|
45
|
-
*/
|
|
46
|
-
static problemsText(cause: any, fallback?: string | null): string;
|
|
47
40
|
}
|
|
48
41
|
/**
|
|
49
42
|
* Base64 encoding and decoding over ArrayBuffers, in the STANDARD and URL_SAFE
|
|
@@ -52,6 +45,10 @@ declare class Failure extends Error {
|
|
|
52
45
|
* of corrupting silently.
|
|
53
46
|
*/
|
|
54
47
|
declare class Base64 {
|
|
48
|
+
/** The RFC 4648 alphabet, with `+` and `/`. */
|
|
49
|
+
static STANDARD: string;
|
|
50
|
+
/** The RFC 4648 url and filename safe alphabet, with `-` and `_`. */
|
|
51
|
+
static URL_SAFE: string;
|
|
55
52
|
/**
|
|
56
53
|
* @param {ArrayBuffer} arrayBuffer
|
|
57
54
|
* @param {string} [dialect] one of Base64.STANDARD or Base64.URL_SAFE, URL_SAFE by default
|
|
@@ -59,43 +56,46 @@ declare class Base64 {
|
|
|
59
56
|
*/
|
|
60
57
|
static encode(arrayBuffer: ArrayBuffer, dialect?: string): string;
|
|
61
58
|
/**
|
|
62
|
-
* @param {string} str
|
|
59
|
+
* @param {string} str padded or unpadded
|
|
63
60
|
* @param {string} [dialect] one of Base64.STANDARD or Base64.URL_SAFE, URL_SAFE by default
|
|
64
61
|
* @returns {ArrayBuffer}
|
|
62
|
+
* @throws on padding anywhere but the tail or longer than two, on an
|
|
63
|
+
* impossible length, and on a character outside the dialect
|
|
65
64
|
*/
|
|
66
65
|
static decode(str: string, dialect?: string): ArrayBuffer;
|
|
67
66
|
}
|
|
68
|
-
declare namespace Base64 {
|
|
69
|
-
var STANDARD: string;
|
|
70
|
-
var URL_SAFE: string;
|
|
71
|
-
}
|
|
72
67
|
/**
|
|
73
68
|
* Hex encoding and decoding over byte sequences, lowercase by default.
|
|
74
69
|
*/
|
|
75
70
|
declare class Hex {
|
|
76
71
|
/**
|
|
77
|
-
* @param {string} hex
|
|
72
|
+
* @param {string} hex either case
|
|
78
73
|
* @returns {Uint8Array}
|
|
74
|
+
* @throws on an odd length or a character that is not a hex digit
|
|
79
75
|
*/
|
|
80
76
|
static decode(hex: string): Uint8Array;
|
|
81
77
|
/**
|
|
82
|
-
* @param {Iterable<number
|
|
83
|
-
*
|
|
84
|
-
* @
|
|
78
|
+
* @param {Iterable<number>|ArrayBuffer|ArrayBufferView} bytes octets, or
|
|
79
|
+
* a buffer or view read as its bytes
|
|
80
|
+
* @param {boolean} [upper] uppercase digits instead of lowercase
|
|
81
|
+
* @returns {string} two digits per byte
|
|
85
82
|
*/
|
|
86
|
-
static encode(bytes: Iterable<number
|
|
83
|
+
static encode(bytes: Iterable<number> | ArrayBuffer | ArrayBufferView, upper?: boolean): string;
|
|
87
84
|
}
|
|
88
85
|
/** A parsed `Content-Type`: the type and subtype without the parameters, so a comparison is not defeated by a charset. */
|
|
89
86
|
declare class MediaType {
|
|
90
87
|
#private;
|
|
91
88
|
constructor(type: any, subtype: any);
|
|
89
|
+
/** @returns {string} `type/subtype`, lowercase */
|
|
92
90
|
get normalized(): string;
|
|
93
|
-
|
|
94
|
-
get
|
|
91
|
+
/** @returns {string} */
|
|
92
|
+
get type(): string;
|
|
93
|
+
/** @returns {string} */
|
|
94
|
+
get subtype(): string;
|
|
95
95
|
/**
|
|
96
96
|
* Parses a Content-Type header value into its type/subtype pair, dropping any parameter.
|
|
97
97
|
* @param {string|null|undefined} v
|
|
98
|
-
* @returns
|
|
98
|
+
* @returns {MediaType} `unknown/unknown` for a missing or malformed value
|
|
99
99
|
*/
|
|
100
100
|
static parse(v: string | null | undefined): MediaType;
|
|
101
101
|
}
|
|
@@ -138,10 +138,10 @@ declare class HttpClientError extends Failure {
|
|
|
138
138
|
*/
|
|
139
139
|
dropping(prefix: string): HttpClientError;
|
|
140
140
|
/**
|
|
141
|
-
*
|
|
142
|
-
* same shape, and the server's arrive already shaped from the wire.
|
|
141
|
+
* A problem with no context and no details.
|
|
143
142
|
* @param {string} type
|
|
144
143
|
* @param {string} reason
|
|
144
|
+
* @returns {{ type: string; context: null; reason: string; details: null; }}
|
|
145
145
|
*/
|
|
146
146
|
static problem(type: string, reason: string): {
|
|
147
147
|
type: string;
|
|
@@ -150,16 +150,24 @@ declare class HttpClientError extends Failure {
|
|
|
150
150
|
details: null;
|
|
151
151
|
};
|
|
152
152
|
/**
|
|
153
|
-
*
|
|
153
|
+
* A failure with status 0 and one problem of the given type, whose reason is
|
|
154
|
+
* the cause's message.
|
|
154
155
|
* @param {string} type
|
|
155
156
|
* @param {any} cause
|
|
156
|
-
* @returns
|
|
157
|
+
* @returns {HttpClientError}
|
|
157
158
|
*/
|
|
158
159
|
static of(type: string, cause: any): HttpClientError;
|
|
159
160
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
161
|
+
* The failure an error response stands for, keeping its status. An
|
|
162
|
+
* `application/failures+json` body is the problems list; an
|
|
163
|
+
* `application/problem+json` body contributes its non-empty `problems`
|
|
164
|
+
* array, or one GENERIC_PROBLEM made of whichever of its title and detail
|
|
165
|
+
* it has. Any other body is one GENERIC_PROBLEM carrying the body text. A
|
|
166
|
+
* json body that does not decode, or decodes to the wrong shape or to an
|
|
167
|
+
* empty failures array, and a body that cannot be read at all, each
|
|
168
|
+
* become one GENERIC_PROBLEM saying so.
|
|
169
|
+
* @param {Response} response consumed
|
|
170
|
+
* @returns {Promise<HttpClientError>}
|
|
163
171
|
*/
|
|
164
172
|
static fromResponse(response: Response): Promise<HttpClientError>;
|
|
165
173
|
}
|
|
@@ -167,28 +175,39 @@ declare class HttpClientError extends Failure {
|
|
|
167
175
|
declare class HttpClientBuilder {
|
|
168
176
|
#private;
|
|
169
177
|
constructor();
|
|
170
|
-
withCsrfToken(): this;
|
|
171
|
-
withRedirectOnUnauthorized(redirectUri: any): this;
|
|
172
178
|
/**
|
|
179
|
+
* Adds the CsrfTokenInterceptor.
|
|
180
|
+
* @returns {HttpClientBuilder} this builder
|
|
181
|
+
*/
|
|
182
|
+
withCsrfToken(): HttpClientBuilder;
|
|
183
|
+
/**
|
|
184
|
+
* Adds the RedirectOnUnauthorizedInterceptor.
|
|
185
|
+
* @param {string} redirectUri where a 401 navigates to
|
|
186
|
+
* @returns {HttpClientBuilder} this builder
|
|
187
|
+
*/
|
|
188
|
+
withRedirectOnUnauthorized(redirectUri: string): HttpClientBuilder;
|
|
189
|
+
/**
|
|
190
|
+
* Adds interceptors, run in the order given after the ones added before.
|
|
173
191
|
* @param {...HttpInterceptor} interceptors
|
|
192
|
+
* @returns {HttpClientBuilder} this builder
|
|
174
193
|
*/
|
|
175
|
-
withInterceptors(...interceptors: HttpInterceptor[]):
|
|
194
|
+
withInterceptors(...interceptors: HttpInterceptor[]): HttpClientBuilder;
|
|
195
|
+
/** @returns {HttpClient} a client running the interceptors added so far */
|
|
176
196
|
build(): HttpClient;
|
|
177
197
|
}
|
|
178
198
|
/** One request's position in the interceptor list: `proceed` runs the next interceptor, the last of which performs the request. */
|
|
179
199
|
declare class HttpInterceptorChain {
|
|
180
200
|
#private;
|
|
181
201
|
/**
|
|
182
|
-
*
|
|
183
202
|
* @param {HttpInterceptor[]} interceptors
|
|
184
|
-
* @param {number} current
|
|
203
|
+
* @param {number} current the index of the interceptor `proceed` runs
|
|
185
204
|
*/
|
|
186
205
|
constructor(interceptors: HttpInterceptor[], current: number);
|
|
187
206
|
/**
|
|
188
|
-
*
|
|
207
|
+
* Runs the next interceptor.
|
|
189
208
|
* @param {URL} url
|
|
190
209
|
* @param {RequestInit} request
|
|
191
|
-
* @returns {Promise<Response>}
|
|
210
|
+
* @returns {Promise<Response>}
|
|
192
211
|
*/
|
|
193
212
|
proceed(url: URL, request: RequestInit): Promise<Response>;
|
|
194
213
|
}
|
|
@@ -210,55 +229,57 @@ declare class HttpClient {
|
|
|
210
229
|
*/
|
|
211
230
|
constructor(interceptors: HttpInterceptor[] | undefined);
|
|
212
231
|
/**
|
|
213
|
-
* Performs an HTTP exchange
|
|
214
|
-
*
|
|
215
|
-
* @param {string} uri
|
|
216
|
-
* @param {RequestInit|undefined} options
|
|
217
|
-
* @param {HttpInterceptor[]|undefined} interceptors
|
|
218
|
-
* @returns {Promise<Response>} the response
|
|
232
|
+
* Performs an HTTP exchange through the client's interceptors, then the
|
|
233
|
+
* given ones.
|
|
234
|
+
* @param {string} uri the request url, relative to the page's
|
|
235
|
+
* @param {RequestInit|undefined} options fetch options
|
|
236
|
+
* @param {HttpInterceptor[]|undefined} interceptors run for this exchange only
|
|
237
|
+
* @returns {Promise<Response>} the response, whatever its status; rejecting
|
|
238
|
+
* with an HttpClientError CONNECTION_PROBLEM when the transport fails, or
|
|
239
|
+
* with what an interceptor throws
|
|
219
240
|
*/
|
|
220
241
|
exchange(uri: string, options: RequestInit | undefined, interceptors: HttpInterceptor[] | undefined): Promise<Response>;
|
|
221
242
|
/**
|
|
222
|
-
*
|
|
223
|
-
* @param {string} method
|
|
224
|
-
* @param {string} uri
|
|
225
|
-
* @returns {HttpRequestBuilder}
|
|
243
|
+
* Starts a request with any method.
|
|
244
|
+
* @param {string} method
|
|
245
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
246
|
+
* @returns {HttpRequestBuilder}
|
|
226
247
|
*/
|
|
227
248
|
request(method: string, uri: string): HttpRequestBuilder;
|
|
228
249
|
/**
|
|
229
|
-
*
|
|
230
|
-
* @param {string} uri
|
|
231
|
-
* @returns {HttpRequestBuilder}
|
|
250
|
+
* Starts a GET request.
|
|
251
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
252
|
+
* @returns {HttpRequestBuilder}
|
|
232
253
|
*/
|
|
233
254
|
get(uri: string): HttpRequestBuilder;
|
|
234
255
|
/**
|
|
235
|
-
*
|
|
236
|
-
* @param {string} uri
|
|
237
|
-
* @returns {HttpRequestBuilder}
|
|
256
|
+
* Starts a HEAD request.
|
|
257
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
258
|
+
* @returns {HttpRequestBuilder}
|
|
238
259
|
*/
|
|
239
260
|
head(uri: string): HttpRequestBuilder;
|
|
240
261
|
/**
|
|
241
|
-
*
|
|
242
|
-
* @param {string} uri
|
|
243
|
-
* @returns {HttpRequestBuilder}
|
|
262
|
+
* Starts a POST request.
|
|
263
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
264
|
+
* @returns {HttpRequestBuilder}
|
|
244
265
|
*/
|
|
245
266
|
post(uri: string): HttpRequestBuilder;
|
|
246
267
|
/**
|
|
247
|
-
*
|
|
248
|
-
* @param {string} uri
|
|
249
|
-
* @returns {HttpRequestBuilder}
|
|
268
|
+
* Starts a PUT request.
|
|
269
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
270
|
+
* @returns {HttpRequestBuilder}
|
|
250
271
|
*/
|
|
251
272
|
put(uri: string): HttpRequestBuilder;
|
|
252
273
|
/**
|
|
253
|
-
*
|
|
254
|
-
* @param {string} uri
|
|
255
|
-
* @returns {HttpRequestBuilder}
|
|
274
|
+
* Starts a PATCH request.
|
|
275
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
276
|
+
* @returns {HttpRequestBuilder}
|
|
256
277
|
*/
|
|
257
278
|
patch(uri: string): HttpRequestBuilder;
|
|
258
279
|
/**
|
|
259
|
-
*
|
|
260
|
-
* @param {string} uri
|
|
261
|
-
* @returns {HttpRequestBuilder}
|
|
280
|
+
* Starts a DELETE request.
|
|
281
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
282
|
+
* @returns {HttpRequestBuilder}
|
|
262
283
|
*/
|
|
263
284
|
delete(uri: string): HttpRequestBuilder;
|
|
264
285
|
}
|
|
@@ -271,18 +292,18 @@ declare class HttpClient {
|
|
|
271
292
|
declare class HttpRequestBuilder {
|
|
272
293
|
#private;
|
|
273
294
|
/**
|
|
274
|
-
*
|
|
295
|
+
* A builder for the url: its query becomes the initial params, split at the
|
|
296
|
+
* first `?`, and its fragment, from the first `#`, is kept for the final url.
|
|
275
297
|
* @param {HttpClient} client
|
|
276
|
-
* @param {string} method
|
|
277
|
-
* @param {string} uri
|
|
278
|
-
* @returns {HttpRequestBuilder}
|
|
298
|
+
* @param {string} method
|
|
299
|
+
* @param {string} uri
|
|
300
|
+
* @returns {HttpRequestBuilder}
|
|
279
301
|
*/
|
|
280
302
|
static create(client: HttpClient, method: string, uri: string): HttpRequestBuilder;
|
|
281
303
|
/**
|
|
282
|
-
* Creates an HttpRequestBuilder.
|
|
283
304
|
* @param {HttpClient} client
|
|
284
|
-
* @param {string} method
|
|
285
|
-
* @param {string} uri
|
|
305
|
+
* @param {string} method
|
|
306
|
+
* @param {string} uri the url without query and fragment
|
|
286
307
|
* @param {URLSearchParams} params
|
|
287
308
|
* @param {Headers} headers
|
|
288
309
|
* @param {any} body
|
|
@@ -292,26 +313,26 @@ declare class HttpRequestBuilder {
|
|
|
292
313
|
*/
|
|
293
314
|
constructor(client: HttpClient, method: string, uri: string, params: URLSearchParams, headers: Headers, body: any, options: Omit<RequestInit, "headers" | "method" | "body">, interceptors: HttpInterceptor[], fragment?: string);
|
|
294
315
|
/**
|
|
295
|
-
*
|
|
316
|
+
* Sets each header, replacing a header of the same name; a null or undefined value removes it.
|
|
296
317
|
* @param {HeadersInit|Record<string,string|null|undefined>} hs
|
|
297
318
|
* @returns {HttpRequestBuilder} this builder
|
|
298
319
|
*/
|
|
299
320
|
headers(hs: HeadersInit | Record<string, string | null | undefined>): HttpRequestBuilder;
|
|
300
321
|
/**
|
|
301
|
-
*
|
|
322
|
+
* Sets a header, replacing one of the same name; a null or undefined value removes it.
|
|
302
323
|
* @param {string} k
|
|
303
|
-
* @param {string} v
|
|
324
|
+
* @param {string|null|undefined} v
|
|
304
325
|
* @returns {HttpRequestBuilder} this builder
|
|
305
326
|
*/
|
|
306
|
-
header(k: string, v: string): HttpRequestBuilder;
|
|
327
|
+
header(k: string, v: string | null | undefined): HttpRequestBuilder;
|
|
307
328
|
/**
|
|
308
|
-
*
|
|
329
|
+
* Sets each query parameter in place, replacing a parameter of the same name; a null or undefined value removes it.
|
|
309
330
|
* @param {URLSearchParams|Record<string,string|null|undefined>|string[][]|string} ps
|
|
310
331
|
* @returns {HttpRequestBuilder} this builder
|
|
311
332
|
*/
|
|
312
333
|
params(ps: URLSearchParams | Record<string, string | null | undefined> | string[][] | string): HttpRequestBuilder;
|
|
313
334
|
/**
|
|
314
|
-
*
|
|
335
|
+
* Sets a query parameter to the values given, as repeated entries moved to the end of the query; nullish values are skipped, and none left removes the parameter.
|
|
315
336
|
* @param {string} k
|
|
316
337
|
* @param {...string} vs
|
|
317
338
|
* @returns {HttpRequestBuilder} this builder
|
|
@@ -336,10 +357,11 @@ declare class HttpRequestBuilder {
|
|
|
336
357
|
* Sets the request body as a FormData configured using the callback.
|
|
337
358
|
* `Content-Type: multipart/form-data` header is automatically added by fetch if not explicitly set.
|
|
338
359
|
* @param {(c: HttpMultipartRequestCustomizer) => void} callback
|
|
360
|
+
* @returns {HttpRequestBuilder} this builder
|
|
339
361
|
*/
|
|
340
|
-
multipart(callback: (c: HttpMultipartRequestCustomizer) => void):
|
|
362
|
+
multipart(callback: (c: HttpMultipartRequestCustomizer) => void): HttpRequestBuilder;
|
|
341
363
|
/**
|
|
342
|
-
*
|
|
364
|
+
* Merges fetch options into the request's.
|
|
343
365
|
* @param {Omit<RequestInit,"headers"|"method"|"body">} kvs
|
|
344
366
|
* @returns {HttpRequestBuilder} this builder
|
|
345
367
|
*/
|
|
@@ -352,92 +374,90 @@ declare class HttpRequestBuilder {
|
|
|
352
374
|
*/
|
|
353
375
|
option(k: keyof Omit<RequestInit, "headers" | "method" | "body">, v: any): HttpRequestBuilder;
|
|
354
376
|
/**
|
|
355
|
-
* Adds interceptors
|
|
356
|
-
* @param {[
|
|
377
|
+
* Adds interceptors run for this request only, after the client's.
|
|
378
|
+
* @param {HttpInterceptor[]} is
|
|
357
379
|
* @returns {HttpRequestBuilder} this builder
|
|
358
380
|
*/
|
|
359
|
-
interceptors(is: [
|
|
381
|
+
interceptors(is: HttpInterceptor[]): HttpRequestBuilder;
|
|
360
382
|
/**
|
|
361
|
-
* Adds
|
|
362
|
-
* @param {HttpInterceptor} i
|
|
383
|
+
* Adds one interceptor run for this request only, after the client's.
|
|
384
|
+
* @param {HttpInterceptor} i
|
|
363
385
|
* @returns {HttpRequestBuilder} this builder
|
|
364
386
|
*/
|
|
365
387
|
interceptor(i: HttpInterceptor): HttpRequestBuilder;
|
|
366
388
|
/**
|
|
367
|
-
*
|
|
368
|
-
* @returns {Promise<Response>}
|
|
389
|
+
* Sends the request and answers the Response, whatever its status.
|
|
390
|
+
* @returns {Promise<Response>} rejecting as `HttpClient.exchange` does
|
|
369
391
|
*/
|
|
370
392
|
exchange(): Promise<Response>;
|
|
371
393
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
394
|
+
* Sends the request and answers the Response when its status is 200-299.
|
|
395
|
+
* Always rejects with an HttpClientError: `HttpClientError.fromResponse`
|
|
396
|
+
* for an error status, CONNECTION_PROBLEM for a transport failure, and
|
|
397
|
+
* UNEXPECTED_PROBLEM, carrying the error as its cause, for anything an
|
|
398
|
+
* interceptor throws that is not already a Failure.
|
|
399
|
+
* @returns {Promise<Response>}
|
|
374
400
|
*/
|
|
375
401
|
fetch(): Promise<Response>;
|
|
376
402
|
/**
|
|
377
|
-
*
|
|
378
|
-
* @returns {Promise<string>}
|
|
403
|
+
* `fetch()`, then the body as text; a body that cannot be read rejects with UNMARSHALING_PROBLEM.
|
|
404
|
+
* @returns {Promise<string>}
|
|
379
405
|
*/
|
|
380
406
|
fetchText(): Promise<string>;
|
|
381
407
|
/**
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
* @returns {Promise<any>}
|
|
408
|
+
* `fetch()`, then the body parsed as json. A 204 yields null without reading
|
|
409
|
+
* the body; any other body that does not parse rejects with UNMARSHALING_PROBLEM.
|
|
410
|
+
* @returns {Promise<any>}
|
|
385
411
|
*/
|
|
386
412
|
fetchJson(): Promise<any>;
|
|
387
413
|
/**
|
|
388
|
-
*
|
|
389
|
-
* @returns {Promise<Blob>}
|
|
414
|
+
* `fetch()`, then the body as a Blob; a body that cannot be read rejects with UNMARSHALING_PROBLEM.
|
|
415
|
+
* @returns {Promise<Blob>}
|
|
390
416
|
*/
|
|
391
417
|
fetchBlob(): Promise<Blob>;
|
|
392
418
|
/**
|
|
393
|
-
*
|
|
394
|
-
* @returns {Promise<ArrayBuffer>}
|
|
419
|
+
* `fetch()`, then the body as an ArrayBuffer; a body that cannot be read rejects with UNMARSHALING_PROBLEM.
|
|
420
|
+
* @returns {Promise<ArrayBuffer>}
|
|
395
421
|
*/
|
|
396
422
|
fetchArrayBuffer(): Promise<ArrayBuffer>;
|
|
397
423
|
}
|
|
398
424
|
/** Builds a multipart body: text fields, json parts, and single or repeated blobs. */
|
|
399
425
|
declare class HttpMultipartRequestCustomizer {
|
|
400
426
|
#private;
|
|
401
|
-
/**
|
|
402
|
-
*
|
|
403
|
-
* @param {FormData} formData
|
|
404
|
-
*/
|
|
427
|
+
/** @param {FormData} formData the body being built */
|
|
405
428
|
constructor(formData: FormData);
|
|
406
429
|
/**
|
|
407
430
|
* Appends a value to the FormData.
|
|
408
431
|
* @param {string} name
|
|
409
432
|
* @param {*} value
|
|
410
|
-
* @returns this builder
|
|
433
|
+
* @returns {HttpMultipartRequestCustomizer} this builder
|
|
411
434
|
*/
|
|
412
|
-
field(name: string, value: any):
|
|
435
|
+
field(name: string, value: any): HttpMultipartRequestCustomizer;
|
|
413
436
|
/**
|
|
414
|
-
* Appends a Blob to the FormData.
|
|
415
|
-
*
|
|
416
|
-
* The default filename for Blob objects is "blob";
|
|
417
|
-
* The default filename for File objects is the file's filename.
|
|
437
|
+
* Appends a Blob to the FormData. Without a filename a File keeps its own
|
|
438
|
+
* and any other Blob is named "blob".
|
|
418
439
|
* @param {string} name
|
|
419
440
|
* @param {Blob} value
|
|
420
|
-
* @param {string
|
|
421
|
-
* @returns this builder
|
|
441
|
+
* @param {string} [filename]
|
|
442
|
+
* @returns {HttpMultipartRequestCustomizer} this builder
|
|
422
443
|
*/
|
|
423
|
-
blob(name: string, value: Blob, filename
|
|
444
|
+
blob(name: string, value: Blob, filename?: string): HttpMultipartRequestCustomizer;
|
|
424
445
|
/**
|
|
425
|
-
* Appends
|
|
426
|
-
*
|
|
427
|
-
* The default filename for File objects is the file's filename.
|
|
446
|
+
* Appends each Blob under the same name, a File keeping its own filename and
|
|
447
|
+
* any other Blob named "blob".
|
|
428
448
|
* @param {string} name
|
|
429
449
|
* @param {Blob[]} values
|
|
430
|
-
* @returns this builder
|
|
450
|
+
* @returns {HttpMultipartRequestCustomizer} this builder
|
|
431
451
|
*/
|
|
432
|
-
blobs(name: string, values: Blob[]):
|
|
452
|
+
blobs(name: string, values: Blob[]): HttpMultipartRequestCustomizer;
|
|
433
453
|
/**
|
|
434
|
-
* Appends
|
|
454
|
+
* Appends the value serialized as an `application/json` blob.
|
|
435
455
|
* @param {string} name
|
|
436
456
|
* @param {any} value
|
|
437
|
-
* @param {string
|
|
438
|
-
* @returns this builder
|
|
457
|
+
* @param {string} [filename]
|
|
458
|
+
* @returns {HttpMultipartRequestCustomizer} this builder
|
|
439
459
|
*/
|
|
440
|
-
json(name: string, value: any, filename
|
|
460
|
+
json(name: string, value: any, filename?: string): HttpMultipartRequestCustomizer;
|
|
441
461
|
}
|
|
442
462
|
export { Base64, Failure, Hex, HttpClient, HttpClientBuilder, HttpClientError, HttpInterceptorChain, HttpMultipartRequestCustomizer, HttpRequestBuilder, MediaType };
|
|
443
463
|
|