@optionfactory/fml 9.0.0-rc2 → 9.0.0-rc21
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 -89
- package/dist/client-errors.iife.js +23 -37
- 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 +459 -36
- package/dist/fml.css +24 -19
- package/dist/fml.css.map +1 -1
- package/dist/fml.iife.js +4656 -1778
- 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 +395 -224
- package/dist/ftl.iife.js +402 -332
- 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 +402 -332
- package/dist/ftl.mjs.map +1 -1
- package/dist/ful.css +24 -19
- package/dist/ful.css.map +1 -1
- package/dist/ful.d.mts +2801 -519
- package/dist/ful.iife.js +4105 -1273
- 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 +4102 -1275
- package/dist/ful.mjs.map +1 -1
- package/dist/httpc.d.mts +139 -121
- package/dist/httpc.iife.js +137 -166
- 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 +137 -166
- package/dist/httpc.mjs.map +1 -1
- package/dist/vscode.html-custom-data.json +215 -27
- package/dist/web-types.json +463 -36
- package/package.json +1 -1
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,29 +56,28 @@ 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
78
|
* @param {Iterable<number>} bytes
|
|
83
|
-
* @param {boolean} [upper]
|
|
84
|
-
* @returns {string}
|
|
79
|
+
* @param {boolean} [upper] uppercase digits instead of lowercase
|
|
80
|
+
* @returns {string} two digits per byte
|
|
85
81
|
*/
|
|
86
82
|
static encode(bytes: Iterable<number>, upper?: boolean): string;
|
|
87
83
|
}
|
|
@@ -89,13 +85,16 @@ declare class Hex {
|
|
|
89
85
|
declare class MediaType {
|
|
90
86
|
#private;
|
|
91
87
|
constructor(type: any, subtype: any);
|
|
88
|
+
/** @returns {string} `type/subtype`, lowercase */
|
|
92
89
|
get normalized(): string;
|
|
93
|
-
|
|
94
|
-
get
|
|
90
|
+
/** @returns {string} */
|
|
91
|
+
get type(): string;
|
|
92
|
+
/** @returns {string} */
|
|
93
|
+
get subtype(): string;
|
|
95
94
|
/**
|
|
96
95
|
* Parses a Content-Type header value into its type/subtype pair, dropping any parameter.
|
|
97
96
|
* @param {string|null|undefined} v
|
|
98
|
-
* @returns
|
|
97
|
+
* @returns {MediaType} `unknown/unknown` for a missing or malformed value
|
|
99
98
|
*/
|
|
100
99
|
static parse(v: string | null | undefined): MediaType;
|
|
101
100
|
}
|
|
@@ -138,10 +137,10 @@ declare class HttpClientError extends Failure {
|
|
|
138
137
|
*/
|
|
139
138
|
dropping(prefix: string): HttpClientError;
|
|
140
139
|
/**
|
|
141
|
-
*
|
|
142
|
-
* same shape, and the server's arrive already shaped from the wire.
|
|
140
|
+
* A problem with no context and no details.
|
|
143
141
|
* @param {string} type
|
|
144
142
|
* @param {string} reason
|
|
143
|
+
* @returns {{ type: string; context: null; reason: string; details: null; }}
|
|
145
144
|
*/
|
|
146
145
|
static problem(type: string, reason: string): {
|
|
147
146
|
type: string;
|
|
@@ -150,16 +149,23 @@ declare class HttpClientError extends Failure {
|
|
|
150
149
|
details: null;
|
|
151
150
|
};
|
|
152
151
|
/**
|
|
153
|
-
*
|
|
152
|
+
* A failure with status 0 and one problem of the given type, whose reason is
|
|
153
|
+
* the cause's message.
|
|
154
154
|
* @param {string} type
|
|
155
155
|
* @param {any} cause
|
|
156
|
-
* @returns
|
|
156
|
+
* @returns {HttpClientError}
|
|
157
157
|
*/
|
|
158
158
|
static of(type: string, cause: any): HttpClientError;
|
|
159
159
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
160
|
+
* The failure an error response stands for, keeping its status. An
|
|
161
|
+
* `application/failures+json` body is the problems list; an
|
|
162
|
+
* `application/problem+json` body contributes its `problems`, or one
|
|
163
|
+
* GENERIC_PROBLEM made of its title and detail. Any other body is one
|
|
164
|
+
* GENERIC_PROBLEM carrying the body text. A json body that does not decode,
|
|
165
|
+
* or decodes to the wrong shape, and a body that cannot be read at all,
|
|
166
|
+
* each become one GENERIC_PROBLEM saying so.
|
|
167
|
+
* @param {Response} response consumed
|
|
168
|
+
* @returns {Promise<HttpClientError>}
|
|
163
169
|
*/
|
|
164
170
|
static fromResponse(response: Response): Promise<HttpClientError>;
|
|
165
171
|
}
|
|
@@ -167,28 +173,39 @@ declare class HttpClientError extends Failure {
|
|
|
167
173
|
declare class HttpClientBuilder {
|
|
168
174
|
#private;
|
|
169
175
|
constructor();
|
|
170
|
-
withCsrfToken(): this;
|
|
171
|
-
withRedirectOnUnauthorized(redirectUri: any): this;
|
|
172
176
|
/**
|
|
177
|
+
* Adds the CsrfTokenInterceptor.
|
|
178
|
+
* @returns {HttpClientBuilder} this builder
|
|
179
|
+
*/
|
|
180
|
+
withCsrfToken(): HttpClientBuilder;
|
|
181
|
+
/**
|
|
182
|
+
* Adds the RedirectOnUnauthorizedInterceptor.
|
|
183
|
+
* @param {string} redirectUri where a 401 navigates to
|
|
184
|
+
* @returns {HttpClientBuilder} this builder
|
|
185
|
+
*/
|
|
186
|
+
withRedirectOnUnauthorized(redirectUri: string): HttpClientBuilder;
|
|
187
|
+
/**
|
|
188
|
+
* Adds interceptors, run in the order given after the ones added before.
|
|
173
189
|
* @param {...HttpInterceptor} interceptors
|
|
190
|
+
* @returns {HttpClientBuilder} this builder
|
|
174
191
|
*/
|
|
175
|
-
withInterceptors(...interceptors: HttpInterceptor[]):
|
|
192
|
+
withInterceptors(...interceptors: HttpInterceptor[]): HttpClientBuilder;
|
|
193
|
+
/** @returns {HttpClient} a client running the interceptors added so far */
|
|
176
194
|
build(): HttpClient;
|
|
177
195
|
}
|
|
178
196
|
/** One request's position in the interceptor list: `proceed` runs the next interceptor, the last of which performs the request. */
|
|
179
197
|
declare class HttpInterceptorChain {
|
|
180
198
|
#private;
|
|
181
199
|
/**
|
|
182
|
-
*
|
|
183
200
|
* @param {HttpInterceptor[]} interceptors
|
|
184
|
-
* @param {number} current
|
|
201
|
+
* @param {number} current the index of the interceptor `proceed` runs
|
|
185
202
|
*/
|
|
186
203
|
constructor(interceptors: HttpInterceptor[], current: number);
|
|
187
204
|
/**
|
|
188
|
-
*
|
|
205
|
+
* Runs the next interceptor.
|
|
189
206
|
* @param {URL} url
|
|
190
207
|
* @param {RequestInit} request
|
|
191
|
-
* @returns {Promise<Response>}
|
|
208
|
+
* @returns {Promise<Response>}
|
|
192
209
|
*/
|
|
193
210
|
proceed(url: URL, request: RequestInit): Promise<Response>;
|
|
194
211
|
}
|
|
@@ -210,55 +227,57 @@ declare class HttpClient {
|
|
|
210
227
|
*/
|
|
211
228
|
constructor(interceptors: HttpInterceptor[] | undefined);
|
|
212
229
|
/**
|
|
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
|
|
230
|
+
* Performs an HTTP exchange through the client's interceptors, then the
|
|
231
|
+
* given ones.
|
|
232
|
+
* @param {string} uri the request url, relative to the page's
|
|
233
|
+
* @param {RequestInit|undefined} options fetch options
|
|
234
|
+
* @param {HttpInterceptor[]|undefined} interceptors run for this exchange only
|
|
235
|
+
* @returns {Promise<Response>} the response, whatever its status; rejecting
|
|
236
|
+
* with an HttpClientError CONNECTION_PROBLEM when the transport fails, or
|
|
237
|
+
* with what an interceptor throws
|
|
219
238
|
*/
|
|
220
239
|
exchange(uri: string, options: RequestInit | undefined, interceptors: HttpInterceptor[] | undefined): Promise<Response>;
|
|
221
240
|
/**
|
|
222
|
-
*
|
|
223
|
-
* @param {string} method
|
|
224
|
-
* @param {string} uri
|
|
225
|
-
* @returns {HttpRequestBuilder}
|
|
241
|
+
* Starts a request with any method.
|
|
242
|
+
* @param {string} method
|
|
243
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
244
|
+
* @returns {HttpRequestBuilder}
|
|
226
245
|
*/
|
|
227
246
|
request(method: string, uri: string): HttpRequestBuilder;
|
|
228
247
|
/**
|
|
229
|
-
*
|
|
230
|
-
* @param {string} uri
|
|
231
|
-
* @returns {HttpRequestBuilder}
|
|
248
|
+
* Starts a GET request.
|
|
249
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
250
|
+
* @returns {HttpRequestBuilder}
|
|
232
251
|
*/
|
|
233
252
|
get(uri: string): HttpRequestBuilder;
|
|
234
253
|
/**
|
|
235
|
-
*
|
|
236
|
-
* @param {string} uri
|
|
237
|
-
* @returns {HttpRequestBuilder}
|
|
254
|
+
* Starts a HEAD request.
|
|
255
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
256
|
+
* @returns {HttpRequestBuilder}
|
|
238
257
|
*/
|
|
239
258
|
head(uri: string): HttpRequestBuilder;
|
|
240
259
|
/**
|
|
241
|
-
*
|
|
242
|
-
* @param {string} uri
|
|
243
|
-
* @returns {HttpRequestBuilder}
|
|
260
|
+
* Starts a POST request.
|
|
261
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
262
|
+
* @returns {HttpRequestBuilder}
|
|
244
263
|
*/
|
|
245
264
|
post(uri: string): HttpRequestBuilder;
|
|
246
265
|
/**
|
|
247
|
-
*
|
|
248
|
-
* @param {string} uri
|
|
249
|
-
* @returns {HttpRequestBuilder}
|
|
266
|
+
* Starts a PUT request.
|
|
267
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
268
|
+
* @returns {HttpRequestBuilder}
|
|
250
269
|
*/
|
|
251
270
|
put(uri: string): HttpRequestBuilder;
|
|
252
271
|
/**
|
|
253
|
-
*
|
|
254
|
-
* @param {string} uri
|
|
255
|
-
* @returns {HttpRequestBuilder}
|
|
272
|
+
* Starts a PATCH request.
|
|
273
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
274
|
+
* @returns {HttpRequestBuilder}
|
|
256
275
|
*/
|
|
257
276
|
patch(uri: string): HttpRequestBuilder;
|
|
258
277
|
/**
|
|
259
|
-
*
|
|
260
|
-
* @param {string} uri
|
|
261
|
-
* @returns {HttpRequestBuilder}
|
|
278
|
+
* Starts a DELETE request.
|
|
279
|
+
* @param {string} uri the request url, relative to the page's; a query and a fragment in it are kept
|
|
280
|
+
* @returns {HttpRequestBuilder}
|
|
262
281
|
*/
|
|
263
282
|
delete(uri: string): HttpRequestBuilder;
|
|
264
283
|
}
|
|
@@ -271,18 +290,18 @@ declare class HttpClient {
|
|
|
271
290
|
declare class HttpRequestBuilder {
|
|
272
291
|
#private;
|
|
273
292
|
/**
|
|
274
|
-
*
|
|
293
|
+
* A builder for the url: its query becomes the initial params, split at the
|
|
294
|
+
* first `?`, and its fragment, from the first `#`, is kept for the final url.
|
|
275
295
|
* @param {HttpClient} client
|
|
276
|
-
* @param {string} method
|
|
277
|
-
* @param {string} uri
|
|
278
|
-
* @returns {HttpRequestBuilder}
|
|
296
|
+
* @param {string} method
|
|
297
|
+
* @param {string} uri
|
|
298
|
+
* @returns {HttpRequestBuilder}
|
|
279
299
|
*/
|
|
280
300
|
static create(client: HttpClient, method: string, uri: string): HttpRequestBuilder;
|
|
281
301
|
/**
|
|
282
|
-
* Creates an HttpRequestBuilder.
|
|
283
302
|
* @param {HttpClient} client
|
|
284
|
-
* @param {string} method
|
|
285
|
-
* @param {string} uri
|
|
303
|
+
* @param {string} method
|
|
304
|
+
* @param {string} uri the url without query and fragment
|
|
286
305
|
* @param {URLSearchParams} params
|
|
287
306
|
* @param {Headers} headers
|
|
288
307
|
* @param {any} body
|
|
@@ -292,26 +311,26 @@ declare class HttpRequestBuilder {
|
|
|
292
311
|
*/
|
|
293
312
|
constructor(client: HttpClient, method: string, uri: string, params: URLSearchParams, headers: Headers, body: any, options: Omit<RequestInit, "headers" | "method" | "body">, interceptors: HttpInterceptor[], fragment?: string);
|
|
294
313
|
/**
|
|
295
|
-
*
|
|
314
|
+
* Sets each header, replacing a header of the same name; a null or undefined value removes it.
|
|
296
315
|
* @param {HeadersInit|Record<string,string|null|undefined>} hs
|
|
297
316
|
* @returns {HttpRequestBuilder} this builder
|
|
298
317
|
*/
|
|
299
318
|
headers(hs: HeadersInit | Record<string, string | null | undefined>): HttpRequestBuilder;
|
|
300
319
|
/**
|
|
301
|
-
*
|
|
320
|
+
* Sets a header, replacing one of the same name; a null or undefined value removes it.
|
|
302
321
|
* @param {string} k
|
|
303
|
-
* @param {string} v
|
|
322
|
+
* @param {string|null|undefined} v
|
|
304
323
|
* @returns {HttpRequestBuilder} this builder
|
|
305
324
|
*/
|
|
306
|
-
header(k: string, v: string): HttpRequestBuilder;
|
|
325
|
+
header(k: string, v: string | null | undefined): HttpRequestBuilder;
|
|
307
326
|
/**
|
|
308
|
-
*
|
|
327
|
+
* Sets each query parameter in place, replacing a parameter of the same name; a null or undefined value removes it.
|
|
309
328
|
* @param {URLSearchParams|Record<string,string|null|undefined>|string[][]|string} ps
|
|
310
329
|
* @returns {HttpRequestBuilder} this builder
|
|
311
330
|
*/
|
|
312
331
|
params(ps: URLSearchParams | Record<string, string | null | undefined> | string[][] | string): HttpRequestBuilder;
|
|
313
332
|
/**
|
|
314
|
-
*
|
|
333
|
+
* 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
334
|
* @param {string} k
|
|
316
335
|
* @param {...string} vs
|
|
317
336
|
* @returns {HttpRequestBuilder} this builder
|
|
@@ -336,10 +355,11 @@ declare class HttpRequestBuilder {
|
|
|
336
355
|
* Sets the request body as a FormData configured using the callback.
|
|
337
356
|
* `Content-Type: multipart/form-data` header is automatically added by fetch if not explicitly set.
|
|
338
357
|
* @param {(c: HttpMultipartRequestCustomizer) => void} callback
|
|
358
|
+
* @returns {HttpRequestBuilder} this builder
|
|
339
359
|
*/
|
|
340
|
-
multipart(callback: (c: HttpMultipartRequestCustomizer) => void):
|
|
360
|
+
multipart(callback: (c: HttpMultipartRequestCustomizer) => void): HttpRequestBuilder;
|
|
341
361
|
/**
|
|
342
|
-
*
|
|
362
|
+
* Merges fetch options into the request's.
|
|
343
363
|
* @param {Omit<RequestInit,"headers"|"method"|"body">} kvs
|
|
344
364
|
* @returns {HttpRequestBuilder} this builder
|
|
345
365
|
*/
|
|
@@ -352,92 +372,90 @@ declare class HttpRequestBuilder {
|
|
|
352
372
|
*/
|
|
353
373
|
option(k: keyof Omit<RequestInit, "headers" | "method" | "body">, v: any): HttpRequestBuilder;
|
|
354
374
|
/**
|
|
355
|
-
* Adds interceptors
|
|
356
|
-
* @param {[
|
|
375
|
+
* Adds interceptors run for this request only, after the client's.
|
|
376
|
+
* @param {HttpInterceptor[]} is
|
|
357
377
|
* @returns {HttpRequestBuilder} this builder
|
|
358
378
|
*/
|
|
359
|
-
interceptors(is: [
|
|
379
|
+
interceptors(is: HttpInterceptor[]): HttpRequestBuilder;
|
|
360
380
|
/**
|
|
361
|
-
* Adds
|
|
362
|
-
* @param {HttpInterceptor} i
|
|
381
|
+
* Adds one interceptor run for this request only, after the client's.
|
|
382
|
+
* @param {HttpInterceptor} i
|
|
363
383
|
* @returns {HttpRequestBuilder} this builder
|
|
364
384
|
*/
|
|
365
385
|
interceptor(i: HttpInterceptor): HttpRequestBuilder;
|
|
366
386
|
/**
|
|
367
|
-
*
|
|
368
|
-
* @returns {Promise<Response>}
|
|
387
|
+
* Sends the request and answers the Response, whatever its status.
|
|
388
|
+
* @returns {Promise<Response>} rejecting as `HttpClient.exchange` does
|
|
369
389
|
*/
|
|
370
390
|
exchange(): Promise<Response>;
|
|
371
391
|
/**
|
|
372
|
-
*
|
|
373
|
-
*
|
|
392
|
+
* Sends the request and answers the Response when its status is 200-299.
|
|
393
|
+
* Always rejects with an HttpClientError: `HttpClientError.fromResponse`
|
|
394
|
+
* for an error status, CONNECTION_PROBLEM for a transport failure, and
|
|
395
|
+
* UNEXPECTED_PROBLEM, carrying the error as its cause, for anything an
|
|
396
|
+
* interceptor throws that is not already a Failure.
|
|
397
|
+
* @returns {Promise<Response>}
|
|
374
398
|
*/
|
|
375
399
|
fetch(): Promise<Response>;
|
|
376
400
|
/**
|
|
377
|
-
*
|
|
378
|
-
* @returns {Promise<string>}
|
|
401
|
+
* `fetch()`, then the body as text; a body that cannot be read rejects with UNMARSHALING_PROBLEM.
|
|
402
|
+
* @returns {Promise<string>}
|
|
379
403
|
*/
|
|
380
404
|
fetchText(): Promise<string>;
|
|
381
405
|
/**
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
* @returns {Promise<any>}
|
|
406
|
+
* `fetch()`, then the body parsed as json. A 204 yields null without reading
|
|
407
|
+
* the body; any other body that does not parse rejects with UNMARSHALING_PROBLEM.
|
|
408
|
+
* @returns {Promise<any>}
|
|
385
409
|
*/
|
|
386
410
|
fetchJson(): Promise<any>;
|
|
387
411
|
/**
|
|
388
|
-
*
|
|
389
|
-
* @returns {Promise<Blob>}
|
|
412
|
+
* `fetch()`, then the body as a Blob; a body that cannot be read rejects with UNMARSHALING_PROBLEM.
|
|
413
|
+
* @returns {Promise<Blob>}
|
|
390
414
|
*/
|
|
391
415
|
fetchBlob(): Promise<Blob>;
|
|
392
416
|
/**
|
|
393
|
-
*
|
|
394
|
-
* @returns {Promise<ArrayBuffer>}
|
|
417
|
+
* `fetch()`, then the body as an ArrayBuffer; a body that cannot be read rejects with UNMARSHALING_PROBLEM.
|
|
418
|
+
* @returns {Promise<ArrayBuffer>}
|
|
395
419
|
*/
|
|
396
420
|
fetchArrayBuffer(): Promise<ArrayBuffer>;
|
|
397
421
|
}
|
|
398
422
|
/** Builds a multipart body: text fields, json parts, and single or repeated blobs. */
|
|
399
423
|
declare class HttpMultipartRequestCustomizer {
|
|
400
424
|
#private;
|
|
401
|
-
/**
|
|
402
|
-
*
|
|
403
|
-
* @param {FormData} formData
|
|
404
|
-
*/
|
|
425
|
+
/** @param {FormData} formData the body being built */
|
|
405
426
|
constructor(formData: FormData);
|
|
406
427
|
/**
|
|
407
428
|
* Appends a value to the FormData.
|
|
408
429
|
* @param {string} name
|
|
409
430
|
* @param {*} value
|
|
410
|
-
* @returns this builder
|
|
431
|
+
* @returns {HttpMultipartRequestCustomizer} this builder
|
|
411
432
|
*/
|
|
412
|
-
field(name: string, value: any):
|
|
433
|
+
field(name: string, value: any): HttpMultipartRequestCustomizer;
|
|
413
434
|
/**
|
|
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.
|
|
435
|
+
* Appends a Blob to the FormData. Without a filename a File keeps its own
|
|
436
|
+
* and any other Blob is named "blob".
|
|
418
437
|
* @param {string} name
|
|
419
438
|
* @param {Blob} value
|
|
420
|
-
* @param {string
|
|
421
|
-
* @returns this builder
|
|
439
|
+
* @param {string} [filename]
|
|
440
|
+
* @returns {HttpMultipartRequestCustomizer} this builder
|
|
422
441
|
*/
|
|
423
|
-
blob(name: string, value: Blob, filename
|
|
442
|
+
blob(name: string, value: Blob, filename?: string): HttpMultipartRequestCustomizer;
|
|
424
443
|
/**
|
|
425
|
-
* Appends
|
|
426
|
-
*
|
|
427
|
-
* The default filename for File objects is the file's filename.
|
|
444
|
+
* Appends each Blob under the same name, a File keeping its own filename and
|
|
445
|
+
* any other Blob named "blob".
|
|
428
446
|
* @param {string} name
|
|
429
447
|
* @param {Blob[]} values
|
|
430
|
-
* @returns this builder
|
|
448
|
+
* @returns {HttpMultipartRequestCustomizer} this builder
|
|
431
449
|
*/
|
|
432
|
-
blobs(name: string, values: Blob[]):
|
|
450
|
+
blobs(name: string, values: Blob[]): HttpMultipartRequestCustomizer;
|
|
433
451
|
/**
|
|
434
|
-
* Appends
|
|
452
|
+
* Appends the value serialized as an `application/json` blob.
|
|
435
453
|
* @param {string} name
|
|
436
454
|
* @param {any} value
|
|
437
|
-
* @param {string
|
|
438
|
-
* @returns this builder
|
|
455
|
+
* @param {string} [filename]
|
|
456
|
+
* @returns {HttpMultipartRequestCustomizer} this builder
|
|
439
457
|
*/
|
|
440
|
-
json(name: string, value: any, filename
|
|
458
|
+
json(name: string, value: any, filename?: string): HttpMultipartRequestCustomizer;
|
|
441
459
|
}
|
|
442
460
|
export { Base64, Failure, Hex, HttpClient, HttpClientBuilder, HttpClientError, HttpInterceptorChain, HttpMultipartRequestCustomizer, HttpRequestBuilder, MediaType };
|
|
443
461
|
|