@optionfactory/fml 8.0.0 → 8.0.1
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/dist/client-errors.iife.js +11 -8
- 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/fml.css +10 -1
- package/dist/fml.css.map +1 -1
- package/dist/fml.d.mts +73 -13
- package/dist/fml.iife.js +598 -208
- 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/fml.min.mjs +1 -1
- package/dist/fml.min.mjs.map +1 -1
- package/dist/fml.mjs +598 -208
- package/dist/fml.mjs.map +1 -1
- package/dist/ftl.d.mts +2 -1
- package/dist/ftl.iife.js +60 -33
- 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 +60 -33
- package/dist/ftl.mjs.map +1 -1
- package/dist/ful.css +10 -1
- package/dist/ful.css.map +1 -1
- package/dist/ful.d.mts +22 -6
- package/dist/ful.iife.js +496 -166
- 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 +496 -166
- package/dist/ful.mjs.map +1 -1
- package/dist/httpc.d.mts +49 -6
- package/dist/httpc.iife.js +40 -9
- 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 +40 -9
- package/dist/httpc.mjs.map +1 -1
- package/package.json +6 -7
package/dist/httpc.d.mts
CHANGED
|
@@ -200,10 +200,10 @@ declare class HttpRequestBuilder {
|
|
|
200
200
|
constructor(client: HttpClient, method: string, uri: string, params: URLSearchParams, headers: Headers, body: any, options: Omit<RequestInit, "headers" | "method" | "body">, interceptors: HttpInterceptor[]);
|
|
201
201
|
/**
|
|
202
202
|
* Add all passed headers to the request, overriding existing ones if that key already exists. Null and undefined values cause the key to be removed.
|
|
203
|
-
* @param {HeadersInit} hs
|
|
203
|
+
* @param {HeadersInit|Record<string,string|null|undefined>} hs
|
|
204
204
|
* @returns {HttpRequestBuilder} this builder
|
|
205
205
|
*/
|
|
206
|
-
headers(hs: HeadersInit): HttpRequestBuilder;
|
|
206
|
+
headers(hs: HeadersInit | Record<string, string | null | undefined>): HttpRequestBuilder;
|
|
207
207
|
/**
|
|
208
208
|
* Adds an header to the request, overriding it if it already exists. Null and undefined values cause the key to be removed
|
|
209
209
|
* @param {string} k
|
|
@@ -213,10 +213,10 @@ declare class HttpRequestBuilder {
|
|
|
213
213
|
header(k: string, v: string): HttpRequestBuilder;
|
|
214
214
|
/**
|
|
215
215
|
* Add all query parameters to the request, overriding existing ones if that key already exists. Null and undefined values cause the key to be removed
|
|
216
|
-
* @param {URLSearchParams|Record<string,string>|string[][]|string} ps
|
|
216
|
+
* @param {URLSearchParams|Record<string,string|null|undefined>|string[][]|string} ps
|
|
217
217
|
* @returns {HttpRequestBuilder} this builder
|
|
218
218
|
*/
|
|
219
|
-
params(ps: URLSearchParams | Record<string, string> | string[][] | string): HttpRequestBuilder;
|
|
219
|
+
params(ps: URLSearchParams | Record<string, string | null | undefined> | string[][] | string): HttpRequestBuilder;
|
|
220
220
|
/**
|
|
221
221
|
* Adds a query parameter to the request, overriding it if it already exists. Empty vs, or a single null or undefined value cause the key to be removed.
|
|
222
222
|
* @param {string} k
|
|
@@ -242,9 +242,9 @@ declare class HttpRequestBuilder {
|
|
|
242
242
|
/**
|
|
243
243
|
* Sets the request body as a FormData configured using the callback.
|
|
244
244
|
* `Content-Type: multipart/form-data` header is automatically added by fetch if not explicitly set.
|
|
245
|
-
* @param {
|
|
245
|
+
* @param {(c: HttpMultipartRequestCustomizer) => void} callback
|
|
246
246
|
*/
|
|
247
|
-
multipart(callback:
|
|
247
|
+
multipart(callback: (c: HttpMultipartRequestCustomizer) => void): this;
|
|
248
248
|
/**
|
|
249
249
|
* Sets a fetch options for the request.
|
|
250
250
|
* @param {Omit<RequestInit,"headers"|"method"|"body">} kvs
|
|
@@ -301,6 +301,49 @@ declare class HttpRequestBuilder {
|
|
|
301
301
|
*/
|
|
302
302
|
fetchArrayBuffer(): Promise<ArrayBuffer>;
|
|
303
303
|
}
|
|
304
|
+
declare class HttpMultipartRequestCustomizer {
|
|
305
|
+
#private;
|
|
306
|
+
/**
|
|
307
|
+
*
|
|
308
|
+
* @param {FormData} formData
|
|
309
|
+
*/
|
|
310
|
+
constructor(formData: FormData);
|
|
311
|
+
/**
|
|
312
|
+
* Appends a value to the FormData.
|
|
313
|
+
* @param {string} name
|
|
314
|
+
* @param {*} value
|
|
315
|
+
* @returns this builder
|
|
316
|
+
*/
|
|
317
|
+
field(name: string, value: any): this;
|
|
318
|
+
/**
|
|
319
|
+
* Appends a Blob to the FormData.
|
|
320
|
+
* If `filename` is omitted, FormData defaults are applied:
|
|
321
|
+
* The default filename for Blob objects is "blob";
|
|
322
|
+
* The default filename for File objects is the file's filename.
|
|
323
|
+
* @param {string} name
|
|
324
|
+
* @param {Blob} value
|
|
325
|
+
* @param {string|undefined} filename
|
|
326
|
+
* @returns this builder
|
|
327
|
+
*/
|
|
328
|
+
blob(name: string, value: Blob, filename: string | undefined): this;
|
|
329
|
+
/**
|
|
330
|
+
* Appends multiple Blobs to the FormData with the same name.
|
|
331
|
+
* The default filename for Blob objects is "blob";
|
|
332
|
+
* The default filename for File objects is the file's filename.
|
|
333
|
+
* @param {string} name
|
|
334
|
+
* @param {Blob[]} values
|
|
335
|
+
* @returns this builder
|
|
336
|
+
*/
|
|
337
|
+
blobs(name: string, values: Blob[]): this;
|
|
338
|
+
/**
|
|
339
|
+
* Appends a JSON serialized blob to the FormData.
|
|
340
|
+
* @param {string} name
|
|
341
|
+
* @param {any} value
|
|
342
|
+
* @param {string|undefined} filename
|
|
343
|
+
* @returns this builder
|
|
344
|
+
*/
|
|
345
|
+
json(name: string, value: any, filename: string | undefined): this;
|
|
346
|
+
}
|
|
304
347
|
export { Base64, Failure, Hex, HttpClient, HttpClientError, MediaType };
|
|
305
348
|
|
|
306
349
|
export as namespace httpc;
|
package/dist/httpc.iife.js
CHANGED
|
@@ -60,13 +60,22 @@ var httpc = (function (exports) {
|
|
|
60
60
|
|
|
61
61
|
let vi = 0;
|
|
62
62
|
let si = 0;
|
|
63
|
-
|
|
63
|
+
//every group yields three bytes, but a padded input stops short of the last
|
|
64
|
+
//one or two: writing them anyway would rely on typed arrays dropping writes
|
|
65
|
+
//past their length
|
|
66
|
+
while (vi < nbytes) {
|
|
64
67
|
const v1 = d.indexOf(str.charAt(si++));
|
|
65
68
|
const v2 = d.indexOf(str.charAt(si++));
|
|
66
69
|
const v3 = d.indexOf(str.charAt(si++));
|
|
67
70
|
const v4 = d.indexOf(str.charAt(si++));
|
|
68
71
|
view[vi++] = (v1 << 2) | (v2 >> 4);
|
|
72
|
+
if (vi === nbytes) {
|
|
73
|
+
break;
|
|
74
|
+
}
|
|
69
75
|
view[vi++] = ((v2 & 15) << 4) | (v3 >> 2);
|
|
76
|
+
if (vi === nbytes) {
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
70
79
|
view[vi++] = ((v3 & 3) << 6) | v4;
|
|
71
80
|
}
|
|
72
81
|
|
|
@@ -93,7 +102,7 @@ var httpc = (function (exports) {
|
|
|
93
102
|
return Array.from(bytes)
|
|
94
103
|
.map((b) => b.toString(16))
|
|
95
104
|
.map((b) => (upper ? b.toUpperCase() : b))
|
|
96
|
-
.map((o) => o.padStart(2, 0))
|
|
105
|
+
.map((o) => o.padStart(2, '0'))
|
|
97
106
|
.join('');
|
|
98
107
|
}
|
|
99
108
|
}
|
|
@@ -423,6 +432,26 @@ var httpc = (function (exports) {
|
|
|
423
432
|
}
|
|
424
433
|
};
|
|
425
434
|
|
|
435
|
+
/**
|
|
436
|
+
* Yields the entries of a headers or params initializer preserving nullish values:
|
|
437
|
+
* normalizing through `Headers`/`URLSearchParams` first would stringify them to
|
|
438
|
+
* "null"/"undefined" instead of removing the key.
|
|
439
|
+
* @param {any} source
|
|
440
|
+
* @returns {Iterable<[string, any]>}
|
|
441
|
+
*/
|
|
442
|
+
const rawEntries = (source) => {
|
|
443
|
+
if (source == null) {
|
|
444
|
+
return [];
|
|
445
|
+
}
|
|
446
|
+
if (typeof source === 'string') {
|
|
447
|
+
return new URLSearchParams(source);
|
|
448
|
+
}
|
|
449
|
+
if (typeof source[Symbol.iterator] === 'function') {
|
|
450
|
+
return source;
|
|
451
|
+
}
|
|
452
|
+
return Object.entries(source);
|
|
453
|
+
};
|
|
454
|
+
|
|
426
455
|
class HttpRequestBuilder {
|
|
427
456
|
#client;
|
|
428
457
|
#method;
|
|
@@ -475,11 +504,11 @@ var httpc = (function (exports) {
|
|
|
475
504
|
}
|
|
476
505
|
/**
|
|
477
506
|
* Add all passed headers to the request, overriding existing ones if that key already exists. Null and undefined values cause the key to be removed.
|
|
478
|
-
* @param {HeadersInit} hs
|
|
507
|
+
* @param {HeadersInit|Record<string,string|null|undefined>} hs
|
|
479
508
|
* @returns {HttpRequestBuilder} this builder
|
|
480
509
|
*/
|
|
481
510
|
headers(hs) {
|
|
482
|
-
for (const [k, v] of
|
|
511
|
+
for (const [k, v] of rawEntries(hs)) {
|
|
483
512
|
if (v == null) {
|
|
484
513
|
this.#headers.delete(k);
|
|
485
514
|
} else {
|
|
@@ -504,11 +533,11 @@ var httpc = (function (exports) {
|
|
|
504
533
|
}
|
|
505
534
|
/**
|
|
506
535
|
* Add all query parameters to the request, overriding existing ones if that key already exists. Null and undefined values cause the key to be removed
|
|
507
|
-
* @param {URLSearchParams|Record<string,string>|string[][]|string} ps
|
|
536
|
+
* @param {URLSearchParams|Record<string,string|null|undefined>|string[][]|string} ps
|
|
508
537
|
* @returns {HttpRequestBuilder} this builder
|
|
509
538
|
*/
|
|
510
539
|
params(ps) {
|
|
511
|
-
for (const [k, v] of
|
|
540
|
+
for (const [k, v] of rawEntries(ps)) {
|
|
512
541
|
if (v == null) {
|
|
513
542
|
this.#params.delete(k);
|
|
514
543
|
} else {
|
|
@@ -524,8 +553,10 @@ var httpc = (function (exports) {
|
|
|
524
553
|
* @returns {HttpRequestBuilder} this builder
|
|
525
554
|
*/
|
|
526
555
|
param(k, ...vs) {
|
|
556
|
+
//overriding, as header, headers and params all do: pass every value in one
|
|
557
|
+
//call to get a multi valued parameter
|
|
558
|
+
this.#params.delete(k);
|
|
527
559
|
if (vs.length === 0 || vs[0] == null) {
|
|
528
|
-
this.#params.delete(k);
|
|
529
560
|
return this;
|
|
530
561
|
}
|
|
531
562
|
for (const v of vs) {
|
|
@@ -558,7 +589,7 @@ var httpc = (function (exports) {
|
|
|
558
589
|
/**
|
|
559
590
|
* Sets the request body as a FormData configured using the callback.
|
|
560
591
|
* `Content-Type: multipart/form-data` header is automatically added by fetch if not explicitly set.
|
|
561
|
-
* @param {
|
|
592
|
+
* @param {(c: HttpMultipartRequestCustomizer) => void} callback
|
|
562
593
|
*/
|
|
563
594
|
multipart(callback) {
|
|
564
595
|
const formData = new FormData();
|
|
@@ -723,7 +754,7 @@ var httpc = (function (exports) {
|
|
|
723
754
|
* @returns this builder
|
|
724
755
|
*/
|
|
725
756
|
blobs(name, values) {
|
|
726
|
-
for (
|
|
757
|
+
for (const v of values) {
|
|
727
758
|
this.#formData.append(name, v);
|
|
728
759
|
}
|
|
729
760
|
return this;
|
package/dist/httpc.iife.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpc.iife.js","sources":["../src/httpc/failure.mjs","../src/httpc/encodings.mjs","../src/httpc/http-client.mjs"],"sourcesContent":["/**\n * @typedef {{ type: string; context: string?; reason: string; details: any?; }} Problem\n */\nclass Failure extends Error {\n /**\n *\n * @param {string} message\n * @param {Problem[]} problems\n * @param {*} cause\n */\n constructor(message, problems, cause) {\n super(message, { cause });\n this.name = 'Failure';\n this.problems = problems;\n }\n dropping(prefix) {\n return new Failure(this.message, Failure.dropProblemsContext(this.problems, prefix), this);\n }\n static dropProblemsContext(problems, prefix) {\n return problems.map(({ type, context, reason, details }) => {\n const nctx = context?.startsWith(prefix) ? context.substring(prefix.length) : context;\n return { type, context: nctx, reason, details };\n });\n }\n}\n\nexport { Failure };\n","class Base64 {\n static encode(arrayBuffer, dialect) {\n const d = dialect || Base64.URL_SAFE;\n const len = arrayBuffer.byteLength;\n const view = new Uint8Array(arrayBuffer);\n let res = '';\n for (let i = 0; i < len; i += 3) {\n const v1 = d[view[i] >> 2];\n const v2 = d[((view[i] & 3) << 4) | (view[i + 1] >> 4)];\n const v3 = d[((view[i + 1] & 15) << 2) | (view[i + 2] >> 6)];\n const v4 = d[view[i + 2] & 63];\n res += v1 + v2 + v3 + v4;\n }\n if (len % 3 === 2) {\n res = res.substring(0, res.length - 1);\n } else if (len % 3 === 1) {\n res = res.substring(0, res.length - 2);\n }\n return res;\n }\n static decode(str, dialect) {\n const d = dialect || Base64.URL_SAFE;\n let nbytes = Math.floor(str.length * 0.75);\n for (let i = 0; i !== str.length; ++i) {\n if (str[str.length - i - 1] !== '=') {\n break;\n }\n --nbytes;\n }\n const view = new Uint8Array(nbytes);\n\n let vi = 0;\n let si = 0;\n while (vi < str.length * 0.75) {\n const v1 = d.indexOf(str.charAt(si++));\n const v2 = d.indexOf(str.charAt(si++));\n const v3 = d.indexOf(str.charAt(si++));\n const v4 = d.indexOf(str.charAt(si++));\n view[vi++] = (v1 << 2) | (v2 >> 4);\n view[vi++] = ((v2 & 15) << 4) | (v3 >> 2);\n view[vi++] = ((v3 & 3) << 6) | v4;\n }\n\n return view.buffer;\n }\n}\n\nBase64.STANDARD = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nBase64.URL_SAFE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';\n\nclass Hex {\n static decode(hex) {\n if (hex.length % 2 !== 0) {\n throw new Error('invalid length');\n }\n const lenInBytes = hex.length / 2;\n return new Uint8Array(lenInBytes).map((e, i) => {\n const offset = i * 2;\n const octet = hex.substring(offset, offset + 2);\n return parseInt(octet, 16);\n });\n }\n static encode(bytes, upper) {\n return Array.from(bytes)\n .map((b) => b.toString(16))\n .map((b) => (upper ? b.toUpperCase() : b))\n .map((o) => o.padStart(2, 0))\n .join('');\n }\n}\n\nexport { Base64, Hex };\n","import { Failure } from './failure.mjs';\n\nclass MediaType {\n #type;\n #subtype;\n constructor(type, subtype) {\n this.#type = type;\n this.#subtype = subtype;\n }\n get normalized() {\n return `${this.#type}/${this.#subtype}`;\n }\n get type() {\n return this.#type;\n }\n get subtype() {\n return this.#subtype;\n }\n /**\n *\n * @param {string|null|undefined} v\n * @returns\n */\n static parse(v) {\n if (!v) {\n return new MediaType('unknown', 'unknown');\n }\n const [prefix, _] = v.split(';');\n const [ptype, psubtype] = prefix.trim().split('/');\n return new MediaType(ptype.toLowerCase(), psubtype?.toLowerCase());\n }\n}\n\n/**\n * @typedef {Int8Array| Uint8Array| Uint8ClampedArray| Int16Array| Uint16Array| Int32Array| Uint32Array| Float32Array| Float64Array| BigInt64Array| BigUint64Array} TypedArray\n */\n/**\n * @typedef {object} HttpInterceptor\n * @property {(url: URL, init: RequestInit|undefined, chain: HttpInterceptorChain) => Promise<Response>} intercept\n */\n\nclass HttpClientError extends Failure {\n /**\n * @param {string} message\n * @param {number} status\n * @param {{ type: string; context: string?; reason: string; details: any?; }[]} problems\n * @param {Error|undefined} [cause]\n */\n constructor(message, status, problems, cause) {\n super(message, problems, cause);\n this.name = 'HttpClientError';\n this.status = status;\n }\n dropping(prefix) {\n return new HttpClientError(this.message, this.status, Failure.dropProblemsContext(this.problems, prefix), this);\n }\n /**\n *\n * @param {string} type\n * @param {any} cause\n * @returns\n */\n static of(type, cause) {\n return new HttpClientError(\n cause.message,\n 0,\n [\n {\n type,\n context: null,\n reason: cause.message,\n details: null,\n },\n ],\n cause,\n );\n }\n /**\n * Creates an HttpClientError from a Response.\n * @param {Response} response\n * @returns an HttpClientError\n */\n static async fromResponse(response) {\n switch (MediaType.parse(response.headers.get('Content-Type')).normalized) {\n case 'application/failures+json': {\n const data = await response.json();\n const message = `${response.status} ${response.statusText}: ${data.length} failures`;\n return new HttpClientError(message, response.status, data);\n }\n case 'application/problem+json': {\n const data = await response.json();\n const message = `${response.status} ${response.statusText}: ${data.title} ${data.detail}`;\n return new HttpClientError(\n message,\n response.status,\n data.problems || [\n {\n type: 'GENERIC_PROBLEM',\n context: null,\n reason: message,\n details: null,\n },\n ],\n );\n }\n default: {\n const text = await response.text();\n const message = `${response.status} ${response.statusText}: ${text}`;\n return new HttpClientError(message, response.status, [\n {\n type: 'GENERIC_PROBLEM',\n context: null,\n reason: message,\n details: null,\n },\n ]);\n }\n }\n }\n}\n\n/**\n * @implements {HttpInterceptor}\n */\nclass CsrfTokenInterceptor {\n #k;\n #v;\n constructor() {\n this.#k = document.querySelector(\"meta[name='_csrf_header']\")?.getAttribute('content');\n this.#v = document.querySelector(\"meta[name='_csrf']\")?.getAttribute('content');\n }\n async intercept(url, request, chain) {\n if (this.#k && this.#v) {\n request.headers.set(this.#k, this.#v);\n }\n return await chain.proceed(url, request);\n }\n}\n/**\n * @implements {HttpInterceptor}\n */\nclass RedirectOnUnauthorizedInterceptor {\n #redirectUri;\n /**\n * @param {string} redirectUri\n */\n constructor(redirectUri) {\n this.#redirectUri = redirectUri;\n }\n async intercept(url, request, chain) {\n const response = await chain.proceed(url, request);\n if (response.status === 401) {\n window.location.href = this.#redirectUri;\n return new Promise(() => {});\n }\n return response;\n }\n}\n\nclass HttpClientBuilder {\n /**\n * @type {HttpInterceptor[]}\n */\n #interceptors;\n constructor() {\n this.#interceptors = [];\n }\n withCsrfToken() {\n this.#interceptors.push(new CsrfTokenInterceptor());\n return this;\n }\n withRedirectOnUnauthorized(redirectUri) {\n this.#interceptors.push(new RedirectOnUnauthorizedInterceptor(redirectUri));\n return this;\n }\n /**\n * @param {...HttpInterceptor} interceptors\n */\n withInterceptors(...interceptors) {\n this.#interceptors.push(...interceptors);\n return this;\n }\n build() {\n return new HttpClient(this.#interceptors);\n }\n}\n\n/**\n * @implements {HttpInterceptor}\n */\nclass HttpCall {\n async intercept(url, request, chain) {\n return await fetch(url, request);\n }\n}\n\nclass HttpInterceptorChain {\n #interceptors;\n #current;\n /**\n *\n * @param {HttpInterceptor[]} interceptors\n * @param {number} current\n */\n constructor(interceptors, current) {\n this.#interceptors = interceptors;\n this.#current = current;\n }\n /**\n *\n * @param {URL} url\n * @param {RequestInit} request\n * @returns {Promise<Response>} the response\n */\n async proceed(url, request) {\n const interceptor = this.#interceptors[this.#current];\n return await interceptor.intercept(\n url,\n request,\n new HttpInterceptorChain(this.#interceptors, this.#current + 1),\n );\n }\n}\n\nclass HttpClient {\n #interceptors;\n /**\n * Creates a builder for an HttpClient.\n * @returns {HttpClientBuilder} the client builder\n */\n static builder() {\n return new HttpClientBuilder();\n }\n /**\n * Creates an HttpClient.\n * @param {HttpInterceptor[]|undefined} interceptors - a list of interceptors to be registered for every request performed by the created client.\n */\n constructor(interceptors) {\n this.#interceptors = interceptors || [];\n }\n /**\n * Performs an HTTP exchange.\n * @async\n * @param {string} uri - the (possibly relative) request url\n * @param {RequestInit|undefined} options - fetch options\n * @param {HttpInterceptor[]|undefined} interceptors - the HttpInterceptors to be registered for this exchange.\n * @returns {Promise<Response>} the response\n */\n async exchange(uri, options, interceptors) {\n const is = [...this.#interceptors, ...(interceptors || []), new HttpCall()];\n const chain = new HttpInterceptorChain(is, 0);\n const url = new URL(new Request(uri).url);\n return await chain.proceed(url, options ?? {});\n }\n /**\n * Creates a request builder.\n * @param {string} method - the HTTP method to be used\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n request(method, uri) {\n return HttpRequestBuilder.create(this, method, uri);\n }\n /**\n * Creates a request builder.\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n get(uri) {\n return HttpRequestBuilder.create(this, 'GET', uri);\n }\n /**\n * Creates a request builder.\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n head(uri) {\n return HttpRequestBuilder.create(this, 'HEAD', uri);\n }\n /**\n * Creates a request builder.\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n post(uri) {\n return HttpRequestBuilder.create(this, 'POST', uri);\n }\n /**\n * Creates a request builder.\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n put(uri) {\n return HttpRequestBuilder.create(this, 'PUT', uri);\n }\n /**\n * Creates a request builder.\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n patch(uri) {\n return HttpRequestBuilder.create(this, 'PATCH', uri);\n }\n /**\n * Creates a request builder.\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n delete(uri) {\n return HttpRequestBuilder.create(this, 'DELETE', uri);\n }\n}\n\n/**\n *\n * @param {Response} response\n * @param {'text'|'json'|'blob'|'arrayBuffer'} type\n * @returns\n */\nconst unmarshal = async (response, type) => {\n try {\n return await response[type]();\n } catch (ex) {\n throw HttpClientError.of('UNMARSHALING_PROBLEM', ex);\n }\n};\n\nclass HttpRequestBuilder {\n #client;\n #method;\n #uri;\n #params;\n #headers;\n #body;\n #options;\n #interceptors;\n /**\n * Creates an HttpRequestBuilder.\n * @param {HttpClient} client\n * @param {string} method - the HTTP method to be used\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the builder\n */\n static create(client, method, uri) {\n const [baseUri, queryString = ''] = uri.split('?');\n return new HttpRequestBuilder(\n client,\n method,\n baseUri,\n new URLSearchParams(queryString),\n new Headers(),\n undefined,\n {},\n [],\n );\n }\n /**\n * Creates an HttpRequestBuilder.\n * @param {HttpClient} client\n * @param {string} method - the HTTP method to be used\n * @param {string} uri - the (possibly relative) request url\n * @param {URLSearchParams} params\n * @param {Headers} headers\n * @param {any} body\n * @param {Omit<RequestInit,\"headers\"|\"method\"|\"body\">} options\n * @param {HttpInterceptor[]} interceptors\n */\n constructor(client, method, uri, params, headers, body, options, interceptors) {\n this.#client = client;\n this.#method = method;\n this.#uri = uri;\n this.#params = params;\n this.#body = body;\n this.#headers = headers;\n this.#options = options;\n this.#interceptors = interceptors;\n }\n /**\n * Add all passed headers to the request, overriding existing ones if that key already exists. Null and undefined values cause the key to be removed.\n * @param {HeadersInit} hs\n * @returns {HttpRequestBuilder} this builder\n */\n headers(hs) {\n for (const [k, v] of new Headers(hs).entries()) {\n if (v == null) {\n this.#headers.delete(k);\n } else {\n this.#headers.set(k, v);\n }\n }\n return this;\n }\n /**\n * Adds an header to the request, overriding it if it already exists. Null and undefined values cause the key to be removed\n * @param {string} k\n * @param {string} v\n * @returns {HttpRequestBuilder} this builder\n */\n header(k, v) {\n if (v == null) {\n this.#headers.delete(k);\n } else {\n this.#headers.set(k, v);\n }\n return this;\n }\n /**\n * Add all query parameters to the request, overriding existing ones if that key already exists. Null and undefined values cause the key to be removed\n * @param {URLSearchParams|Record<string,string>|string[][]|string} ps\n * @returns {HttpRequestBuilder} this builder\n */\n params(ps) {\n for (const [k, v] of new URLSearchParams(ps).entries()) {\n if (v == null) {\n this.#params.delete(k);\n } else {\n this.#params.set(k, v);\n }\n }\n return this;\n }\n /**\n * Adds a query parameter to the request, overriding it if it already exists. Empty vs, or a single null or undefined value cause the key to be removed.\n * @param {string} k\n * @param {...string} vs\n * @returns {HttpRequestBuilder} this builder\n */\n param(k, ...vs) {\n if (vs.length === 0 || vs[0] == null) {\n this.#params.delete(k);\n return this;\n }\n for (const v of vs) {\n this.#params.append(k, v);\n }\n return this;\n }\n /**\n * Sets the request body.\n * `Content-Type: multipart/form-data` header is automatically added by fetch when data is a FormData instance if not explicitly set.\n * `Content-Type: application/x-www-form-urlencoded` header is automatically added by fetch when data is an URLSearchParams instance if not explicitly set.\n * `Content-Type: text/plain` header is automatically added by fetch when data is a string instance if not explicitly set.\n * @param {string|ArrayBuffer|Blob|DataView|File|FormData|TypedArray|URLSearchParams|ReadableStream} data\n * @returns {HttpRequestBuilder} this builder\n */\n body(data) {\n this.#body = data;\n return this;\n }\n /**\n * Sets the request body that will be serialized as json. Calling this method adds the `Content-Type application/json` header for the request.\n * @param {any} body - the body to be serialized as json\n * @returns {HttpRequestBuilder} this builder\n */\n json(body) {\n this.#headers.set('Content-Type', 'application/json');\n this.#body = JSON.stringify(body);\n return this;\n }\n /**\n * Sets the request body as a FormData configured using the callback.\n * `Content-Type: multipart/form-data` header is automatically added by fetch if not explicitly set.\n * @param {function(HttpMultipartRequestCustomizer):void} callback\n */\n multipart(callback) {\n const formData = new FormData();\n const builder = new HttpMultipartRequestCustomizer(formData);\n callback(builder);\n this.#body = formData;\n return this;\n }\n /**\n * Sets a fetch options for the request.\n * @param {Omit<RequestInit,\"headers\"|\"method\"|\"body\">} kvs\n * @returns {HttpRequestBuilder} this builder\n */\n options(kvs) {\n for (const [k, v] of Object.entries(kvs)) {\n this.#options[k] = v;\n }\n return this;\n }\n /**\n * Sets a fetch option for the request.\n * @param {keyof Omit<RequestInit,\"headers\"|\"method\"|\"body\">} k\n * @param {*} v\n * @returns {HttpRequestBuilder} this builder\n */\n option(k, v) {\n this.#options[k] = v;\n return this;\n }\n /**\n * Adds interceptors to the request.\n * @param {[HttpInterceptor]} is - the interceptor to be regisered\n * @returns {HttpRequestBuilder} this builder\n */\n interceptors(is) {\n for (const i of is) {\n this.#interceptors.push(i);\n }\n return this;\n }\n /**\n * Adds an interceptor to the request.\n * @param {HttpInterceptor} i - the interceptor to be regisered\n * @returns {HttpRequestBuilder} this builder\n */\n interceptor(i) {\n this.#interceptors.push(i);\n return this;\n }\n /**\n * Performs an HTTP exchange using the configured client, request and interceptors.\n * @returns {Promise<Response>} the response\n */\n async exchange() {\n const uri = this.#params.size ? `${this.#uri}?${this.#params}` : this.#uri;\n const opts = {\n ...this.#options,\n headers: this.#headers,\n method: this.#method,\n body: this.#body,\n };\n return await this.#client.exchange(uri, opts, this.#interceptors);\n }\n /**\n * Performs an HTTP exchange using the configured client request, and interceptos throwing a failure when response status is not in the 200-299 range.\n * @returns {Promise<Response>} the response\n */\n async fetch() {\n const uri = this.#params.size ? `${this.#uri}?${this.#params}` : this.#uri;\n const opts = {\n ...this.#options,\n headers: this.#headers,\n method: this.#method,\n body: this.#body,\n };\n try {\n const response = await this.#client.exchange(uri, opts, this.#interceptors);\n if (!response.ok) {\n throw await HttpClientError.fromResponse(response);\n }\n return response;\n } catch (ex) {\n if (ex instanceof Failure) {\n throw ex;\n }\n throw HttpClientError.of('CONNECTION_PROBLEM', ex);\n }\n }\n /**\n * Performs an HTTP exchange using the configured client request, and interceptos throwing a failure when response status is not in the 200-299 range.\n * @returns {Promise<string>} the response body, as text\n */\n async fetchText() {\n const response = await this.fetch();\n return await unmarshal(response, 'text');\n }\n /**\n * Performs an HTTP exchange using the configured client request, and interceptos throwing a failure when response status is not in the 200-299 range.\n * @returns {Promise<any>} the response body, deserialized as JSON\n */\n async fetchJson() {\n const response = await this.fetch();\n return await unmarshal(response, 'json');\n }\n /**\n * Performs an HTTP exchange using the configured client request, and interceptos throwing a failure when response status is not in the 200-299 range.\n * @returns {Promise<Blob>} the response body, as a Blob\n */\n async fetchBlob() {\n const response = await this.fetch();\n return await unmarshal(response, 'blob');\n }\n /**\n * Performs an HTTP exchange using the configured client request, and interceptos throwing a failure when response status is not in the 200-299 range.\n * @returns {Promise<ArrayBuffer>} the response body, as an ArrayBuffer\n */\n async fetchArrayBuffer() {\n const response = await this.fetch();\n return await unmarshal(response, 'arrayBuffer');\n }\n}\n\nclass HttpMultipartRequestCustomizer {\n #formData;\n /**\n *\n * @param {FormData} formData\n */\n constructor(formData) {\n this.#formData = formData;\n }\n /**\n * Appends a value to the FormData.\n * @param {string} name\n * @param {*} value\n * @returns this builder\n */\n field(name, value) {\n this.#formData.append(name, value);\n return this;\n }\n /**\n * Appends a Blob to the FormData.\n * If `filename` is omitted, FormData defaults are applied:\n * The default filename for Blob objects is \"blob\";\n * The default filename for File objects is the file's filename.\n * @param {string} name\n * @param {Blob} value\n * @param {string|undefined} filename\n * @returns this builder\n */\n blob(name, value, filename) {\n this.#formData.append(name, value, filename);\n return this;\n }\n /**\n * Appends multiple Blobs to the FormData with the same name.\n * The default filename for Blob objects is \"blob\";\n * The default filename for File objects is the file's filename.\n * @param {string} name\n * @param {Blob[]} values\n * @returns this builder\n */\n blobs(name, values) {\n for (let v of values) {\n this.#formData.append(name, v);\n }\n return this;\n }\n /**\n * Appends a JSON serialized blob to the FormData.\n * @param {string} name\n * @param {any} value\n * @param {string|undefined} filename\n * @returns this builder\n */\n json(name, value, filename) {\n const blob = new Blob([JSON.stringify(value)], { type: 'application/json' });\n this.#formData.append(name, blob, filename);\n return this;\n }\n}\n\nexport { MediaType, HttpClient, HttpClientError };\n"],"names":[],"mappings":";;;IAAA;IACA;IACA;IACA,MAAM,OAAO,SAAS,KAAK,CAAC;IAC5B;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,WAAW,CAAC,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE;IAC1C,QAAQ,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,CAAC;IACjC,QAAQ,IAAI,CAAC,IAAI,GAAG,SAAS;IAC7B,QAAQ,IAAI,CAAC,QAAQ,GAAG,QAAQ;IAChC,IAAI;IACJ,IAAI,QAAQ,CAAC,MAAM,EAAE;IACrB,QAAQ,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,mBAAmB,CAAC,IAAI,CAAC,QAAQ,EAAE,MA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A;IACA,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;IACvB,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC;IAC1C,QAAQ,OAAO,IAAI;IACnB,IAAI;IACJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE;IAChC,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC;IACpD,QAAQ,OAAO,IAAI;IACnB,IAAI;IACJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE;IACxB,QAAQ,KAAK,IAAI,CAAC,IAAI,MAAM,EAAE;IAC9B,YAAY,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1C,QAAQ;IACR,QAAQ,OAAO,IAAI;IACnB,IAAI;IACJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE;IAChC,QAAQ,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;IACpF,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC;IACnD,QAAQ,OAAO,IAAI;IACnB,IAAI;IACJ;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"httpc.iife.js","sources":["../src/httpc/failure.mjs","../src/httpc/encodings.mjs","../src/httpc/http-client.mjs"],"sourcesContent":["/**\n * @typedef {{ type: string; context: string?; reason: string; details: any?; }} Problem\n */\nclass Failure extends Error {\n /**\n *\n * @param {string} message\n * @param {Problem[]} problems\n * @param {*} cause\n */\n constructor(message, problems, cause) {\n super(message, { cause });\n this.name = 'Failure';\n this.problems = problems;\n }\n dropping(prefix) {\n return new Failure(this.message, Failure.dropProblemsContext(this.problems, prefix), this);\n }\n static dropProblemsContext(problems, prefix) {\n return problems.map(({ type, context, reason, details }) => {\n const nctx = context?.startsWith(prefix) ? context.substring(prefix.length) : context;\n return { type, context: nctx, reason, details };\n });\n }\n}\n\nexport { Failure };\n","class Base64 {\n static encode(arrayBuffer, dialect) {\n const d = dialect || Base64.URL_SAFE;\n const len = arrayBuffer.byteLength;\n const view = new Uint8Array(arrayBuffer);\n let res = '';\n for (let i = 0; i < len; i += 3) {\n const v1 = d[view[i] >> 2];\n const v2 = d[((view[i] & 3) << 4) | (view[i + 1] >> 4)];\n const v3 = d[((view[i + 1] & 15) << 2) | (view[i + 2] >> 6)];\n const v4 = d[view[i + 2] & 63];\n res += v1 + v2 + v3 + v4;\n }\n if (len % 3 === 2) {\n res = res.substring(0, res.length - 1);\n } else if (len % 3 === 1) {\n res = res.substring(0, res.length - 2);\n }\n return res;\n }\n static decode(str, dialect) {\n const d = dialect || Base64.URL_SAFE;\n let nbytes = Math.floor(str.length * 0.75);\n for (let i = 0; i !== str.length; ++i) {\n if (str[str.length - i - 1] !== '=') {\n break;\n }\n --nbytes;\n }\n const view = new Uint8Array(nbytes);\n\n let vi = 0;\n let si = 0;\n //every group yields three bytes, but a padded input stops short of the last\n //one or two: writing them anyway would rely on typed arrays dropping writes\n //past their length\n while (vi < nbytes) {\n const v1 = d.indexOf(str.charAt(si++));\n const v2 = d.indexOf(str.charAt(si++));\n const v3 = d.indexOf(str.charAt(si++));\n const v4 = d.indexOf(str.charAt(si++));\n view[vi++] = (v1 << 2) | (v2 >> 4);\n if (vi === nbytes) {\n break;\n }\n view[vi++] = ((v2 & 15) << 4) | (v3 >> 2);\n if (vi === nbytes) {\n break;\n }\n view[vi++] = ((v3 & 3) << 6) | v4;\n }\n\n return view.buffer;\n }\n}\n\nBase64.STANDARD = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\nBase64.URL_SAFE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_';\n\nclass Hex {\n static decode(hex) {\n if (hex.length % 2 !== 0) {\n throw new Error('invalid length');\n }\n const lenInBytes = hex.length / 2;\n return new Uint8Array(lenInBytes).map((e, i) => {\n const offset = i * 2;\n const octet = hex.substring(offset, offset + 2);\n return parseInt(octet, 16);\n });\n }\n static encode(bytes, upper) {\n return Array.from(bytes)\n .map((b) => b.toString(16))\n .map((b) => (upper ? b.toUpperCase() : b))\n .map((o) => o.padStart(2, '0'))\n .join('');\n }\n}\n\nexport { Base64, Hex };\n","import { Failure } from './failure.mjs';\n\nclass MediaType {\n #type;\n #subtype;\n constructor(type, subtype) {\n this.#type = type;\n this.#subtype = subtype;\n }\n get normalized() {\n return `${this.#type}/${this.#subtype}`;\n }\n get type() {\n return this.#type;\n }\n get subtype() {\n return this.#subtype;\n }\n /**\n *\n * @param {string|null|undefined} v\n * @returns\n */\n static parse(v) {\n if (!v) {\n return new MediaType('unknown', 'unknown');\n }\n const [prefix, _] = v.split(';');\n const [ptype, psubtype] = prefix.trim().split('/');\n return new MediaType(ptype.toLowerCase(), psubtype?.toLowerCase());\n }\n}\n\n/**\n * @typedef {Int8Array| Uint8Array| Uint8ClampedArray| Int16Array| Uint16Array| Int32Array| Uint32Array| Float32Array| Float64Array| BigInt64Array| BigUint64Array} TypedArray\n */\n/**\n * @typedef {object} HttpInterceptor\n * @property {(url: URL, init: RequestInit|undefined, chain: HttpInterceptorChain) => Promise<Response>} intercept\n */\n\nclass HttpClientError extends Failure {\n /**\n * @param {string} message\n * @param {number} status\n * @param {{ type: string; context: string?; reason: string; details: any?; }[]} problems\n * @param {Error|undefined} [cause]\n */\n constructor(message, status, problems, cause) {\n super(message, problems, cause);\n this.name = 'HttpClientError';\n this.status = status;\n }\n dropping(prefix) {\n return new HttpClientError(this.message, this.status, Failure.dropProblemsContext(this.problems, prefix), this);\n }\n /**\n *\n * @param {string} type\n * @param {any} cause\n * @returns\n */\n static of(type, cause) {\n return new HttpClientError(\n cause.message,\n 0,\n [\n {\n type,\n context: null,\n reason: cause.message,\n details: null,\n },\n ],\n cause,\n );\n }\n /**\n * Creates an HttpClientError from a Response.\n * @param {Response} response\n * @returns an HttpClientError\n */\n static async fromResponse(response) {\n switch (MediaType.parse(response.headers.get('Content-Type')).normalized) {\n case 'application/failures+json': {\n const data = await response.json();\n const message = `${response.status} ${response.statusText}: ${data.length} failures`;\n return new HttpClientError(message, response.status, data);\n }\n case 'application/problem+json': {\n const data = await response.json();\n const message = `${response.status} ${response.statusText}: ${data.title} ${data.detail}`;\n return new HttpClientError(\n message,\n response.status,\n data.problems || [\n {\n type: 'GENERIC_PROBLEM',\n context: null,\n reason: message,\n details: null,\n },\n ],\n );\n }\n default: {\n const text = await response.text();\n const message = `${response.status} ${response.statusText}: ${text}`;\n return new HttpClientError(message, response.status, [\n {\n type: 'GENERIC_PROBLEM',\n context: null,\n reason: message,\n details: null,\n },\n ]);\n }\n }\n }\n}\n\n/**\n * @implements {HttpInterceptor}\n */\nclass CsrfTokenInterceptor {\n #k;\n #v;\n constructor() {\n this.#k = document.querySelector(\"meta[name='_csrf_header']\")?.getAttribute('content');\n this.#v = document.querySelector(\"meta[name='_csrf']\")?.getAttribute('content');\n }\n async intercept(url, request, chain) {\n if (this.#k && this.#v) {\n request.headers.set(this.#k, this.#v);\n }\n return await chain.proceed(url, request);\n }\n}\n/**\n * @implements {HttpInterceptor}\n */\nclass RedirectOnUnauthorizedInterceptor {\n #redirectUri;\n /**\n * @param {string} redirectUri\n */\n constructor(redirectUri) {\n this.#redirectUri = redirectUri;\n }\n async intercept(url, request, chain) {\n const response = await chain.proceed(url, request);\n if (response.status === 401) {\n window.location.href = this.#redirectUri;\n return new Promise(() => {});\n }\n return response;\n }\n}\n\nclass HttpClientBuilder {\n /**\n * @type {HttpInterceptor[]}\n */\n #interceptors;\n constructor() {\n this.#interceptors = [];\n }\n withCsrfToken() {\n this.#interceptors.push(new CsrfTokenInterceptor());\n return this;\n }\n withRedirectOnUnauthorized(redirectUri) {\n this.#interceptors.push(new RedirectOnUnauthorizedInterceptor(redirectUri));\n return this;\n }\n /**\n * @param {...HttpInterceptor} interceptors\n */\n withInterceptors(...interceptors) {\n this.#interceptors.push(...interceptors);\n return this;\n }\n build() {\n return new HttpClient(this.#interceptors);\n }\n}\n\n/**\n * @implements {HttpInterceptor}\n */\nclass HttpCall {\n async intercept(url, request, chain) {\n return await fetch(url, request);\n }\n}\n\nclass HttpInterceptorChain {\n #interceptors;\n #current;\n /**\n *\n * @param {HttpInterceptor[]} interceptors\n * @param {number} current\n */\n constructor(interceptors, current) {\n this.#interceptors = interceptors;\n this.#current = current;\n }\n /**\n *\n * @param {URL} url\n * @param {RequestInit} request\n * @returns {Promise<Response>} the response\n */\n async proceed(url, request) {\n const interceptor = this.#interceptors[this.#current];\n return await interceptor.intercept(\n url,\n request,\n new HttpInterceptorChain(this.#interceptors, this.#current + 1),\n );\n }\n}\n\nclass HttpClient {\n #interceptors;\n /**\n * Creates a builder for an HttpClient.\n * @returns {HttpClientBuilder} the client builder\n */\n static builder() {\n return new HttpClientBuilder();\n }\n /**\n * Creates an HttpClient.\n * @param {HttpInterceptor[]|undefined} interceptors - a list of interceptors to be registered for every request performed by the created client.\n */\n constructor(interceptors) {\n this.#interceptors = interceptors || [];\n }\n /**\n * Performs an HTTP exchange.\n * @async\n * @param {string} uri - the (possibly relative) request url\n * @param {RequestInit|undefined} options - fetch options\n * @param {HttpInterceptor[]|undefined} interceptors - the HttpInterceptors to be registered for this exchange.\n * @returns {Promise<Response>} the response\n */\n async exchange(uri, options, interceptors) {\n const is = [...this.#interceptors, ...(interceptors || []), new HttpCall()];\n const chain = new HttpInterceptorChain(is, 0);\n const url = new URL(new Request(uri).url);\n return await chain.proceed(url, options ?? {});\n }\n /**\n * Creates a request builder.\n * @param {string} method - the HTTP method to be used\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n request(method, uri) {\n return HttpRequestBuilder.create(this, method, uri);\n }\n /**\n * Creates a request builder.\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n get(uri) {\n return HttpRequestBuilder.create(this, 'GET', uri);\n }\n /**\n * Creates a request builder.\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n head(uri) {\n return HttpRequestBuilder.create(this, 'HEAD', uri);\n }\n /**\n * Creates a request builder.\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n post(uri) {\n return HttpRequestBuilder.create(this, 'POST', uri);\n }\n /**\n * Creates a request builder.\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n put(uri) {\n return HttpRequestBuilder.create(this, 'PUT', uri);\n }\n /**\n * Creates a request builder.\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n patch(uri) {\n return HttpRequestBuilder.create(this, 'PATCH', uri);\n }\n /**\n * Creates a request builder.\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the request builder\n */\n delete(uri) {\n return HttpRequestBuilder.create(this, 'DELETE', uri);\n }\n}\n\n/**\n *\n * @param {Response} response\n * @param {'text'|'json'|'blob'|'arrayBuffer'} type\n * @returns\n */\nconst unmarshal = async (response, type) => {\n try {\n return await response[type]();\n } catch (ex) {\n throw HttpClientError.of('UNMARSHALING_PROBLEM', ex);\n }\n};\n\n/**\n * Yields the entries of a headers or params initializer preserving nullish values:\n * normalizing through `Headers`/`URLSearchParams` first would stringify them to\n * \"null\"/\"undefined\" instead of removing the key.\n * @param {any} source\n * @returns {Iterable<[string, any]>}\n */\nconst rawEntries = (source) => {\n if (source == null) {\n return [];\n }\n if (typeof source === 'string') {\n return new URLSearchParams(source);\n }\n if (typeof source[Symbol.iterator] === 'function') {\n return source;\n }\n return Object.entries(source);\n};\n\nclass HttpRequestBuilder {\n #client;\n #method;\n #uri;\n #params;\n #headers;\n #body;\n #options;\n #interceptors;\n /**\n * Creates an HttpRequestBuilder.\n * @param {HttpClient} client\n * @param {string} method - the HTTP method to be used\n * @param {string} uri - the (possibly relative) request url\n * @returns {HttpRequestBuilder} the builder\n */\n static create(client, method, uri) {\n const [baseUri, queryString = ''] = uri.split('?');\n return new HttpRequestBuilder(\n client,\n method,\n baseUri,\n new URLSearchParams(queryString),\n new Headers(),\n undefined,\n {},\n [],\n );\n }\n /**\n * Creates an HttpRequestBuilder.\n * @param {HttpClient} client\n * @param {string} method - the HTTP method to be used\n * @param {string} uri - the (possibly relative) request url\n * @param {URLSearchParams} params\n * @param {Headers} headers\n * @param {any} body\n * @param {Omit<RequestInit,\"headers\"|\"method\"|\"body\">} options\n * @param {HttpInterceptor[]} interceptors\n */\n constructor(client, method, uri, params, headers, body, options, interceptors) {\n this.#client = client;\n this.#method = method;\n this.#uri = uri;\n this.#params = params;\n this.#body = body;\n this.#headers = headers;\n this.#options = options;\n this.#interceptors = interceptors;\n }\n /**\n * Add all passed headers to the request, overriding existing ones if that key already exists. Null and undefined values cause the key to be removed.\n * @param {HeadersInit|Record<string,string|null|undefined>} hs\n * @returns {HttpRequestBuilder} this builder\n */\n headers(hs) {\n for (const [k, v] of rawEntries(hs)) {\n if (v == null) {\n this.#headers.delete(k);\n } else {\n this.#headers.set(k, v);\n }\n }\n return this;\n }\n /**\n * Adds an header to the request, overriding it if it already exists. Null and undefined values cause the key to be removed\n * @param {string} k\n * @param {string} v\n * @returns {HttpRequestBuilder} this builder\n */\n header(k, v) {\n if (v == null) {\n this.#headers.delete(k);\n } else {\n this.#headers.set(k, v);\n }\n return this;\n }\n /**\n * Add all query parameters to the request, overriding existing ones if that key already exists. Null and undefined values cause the key to be removed\n * @param {URLSearchParams|Record<string,string|null|undefined>|string[][]|string} ps\n * @returns {HttpRequestBuilder} this builder\n */\n params(ps) {\n for (const [k, v] of rawEntries(ps)) {\n if (v == null) {\n this.#params.delete(k);\n } else {\n this.#params.set(k, v);\n }\n }\n return this;\n }\n /**\n * Adds a query parameter to the request, overriding it if it already exists. Empty vs, or a single null or undefined value cause the key to be removed.\n * @param {string} k\n * @param {...string} vs\n * @returns {HttpRequestBuilder} this builder\n */\n param(k, ...vs) {\n //overriding, as header, headers and params all do: pass every value in one\n //call to get a multi valued parameter\n this.#params.delete(k);\n if (vs.length === 0 || vs[0] == null) {\n return this;\n }\n for (const v of vs) {\n this.#params.append(k, v);\n }\n return this;\n }\n /**\n * Sets the request body.\n * `Content-Type: multipart/form-data` header is automatically added by fetch when data is a FormData instance if not explicitly set.\n * `Content-Type: application/x-www-form-urlencoded` header is automatically added by fetch when data is an URLSearchParams instance if not explicitly set.\n * `Content-Type: text/plain` header is automatically added by fetch when data is a string instance if not explicitly set.\n * @param {string|ArrayBuffer|Blob|DataView|File|FormData|TypedArray|URLSearchParams|ReadableStream} data\n * @returns {HttpRequestBuilder} this builder\n */\n body(data) {\n this.#body = data;\n return this;\n }\n /**\n * Sets the request body that will be serialized as json. Calling this method adds the `Content-Type application/json` header for the request.\n * @param {any} body - the body to be serialized as json\n * @returns {HttpRequestBuilder} this builder\n */\n json(body) {\n this.#headers.set('Content-Type', 'application/json');\n this.#body = JSON.stringify(body);\n return this;\n }\n /**\n * Sets the request body as a FormData configured using the callback.\n * `Content-Type: multipart/form-data` header is automatically added by fetch if not explicitly set.\n * @param {(c: HttpMultipartRequestCustomizer) => void} callback\n */\n multipart(callback) {\n const formData = new FormData();\n const builder = new HttpMultipartRequestCustomizer(formData);\n callback(builder);\n this.#body = formData;\n return this;\n }\n /**\n * Sets a fetch options for the request.\n * @param {Omit<RequestInit,\"headers\"|\"method\"|\"body\">} kvs\n * @returns {HttpRequestBuilder} this builder\n */\n options(kvs) {\n for (const [k, v] of Object.entries(kvs)) {\n this.#options[k] = v;\n }\n return this;\n }\n /**\n * Sets a fetch option for the request.\n * @param {keyof Omit<RequestInit,\"headers\"|\"method\"|\"body\">} k\n * @param {*} v\n * @returns {HttpRequestBuilder} this builder\n */\n option(k, v) {\n this.#options[k] = v;\n return this;\n }\n /**\n * Adds interceptors to the request.\n * @param {[HttpInterceptor]} is - the interceptor to be regisered\n * @returns {HttpRequestBuilder} this builder\n */\n interceptors(is) {\n for (const i of is) {\n this.#interceptors.push(i);\n }\n return this;\n }\n /**\n * Adds an interceptor to the request.\n * @param {HttpInterceptor} i - the interceptor to be regisered\n * @returns {HttpRequestBuilder} this builder\n */\n interceptor(i) {\n this.#interceptors.push(i);\n return this;\n }\n /**\n * Performs an HTTP exchange using the configured client, request and interceptors.\n * @returns {Promise<Response>} the response\n */\n async exchange() {\n const uri = this.#params.size ? `${this.#uri}?${this.#params}` : this.#uri;\n const opts = {\n ...this.#options,\n headers: this.#headers,\n method: this.#method,\n body: this.#body,\n };\n return await this.#client.exchange(uri, opts, this.#interceptors);\n }\n /**\n * Performs an HTTP exchange using the configured client request, and interceptos throwing a failure when response status is not in the 200-299 range.\n * @returns {Promise<Response>} the response\n */\n async fetch() {\n const uri = this.#params.size ? `${this.#uri}?${this.#params}` : this.#uri;\n const opts = {\n ...this.#options,\n headers: this.#headers,\n method: this.#method,\n body: this.#body,\n };\n try {\n const response = await this.#client.exchange(uri, opts, this.#interceptors);\n if (!response.ok) {\n throw await HttpClientError.fromResponse(response);\n }\n return response;\n } catch (ex) {\n if (ex instanceof Failure) {\n throw ex;\n }\n throw HttpClientError.of('CONNECTION_PROBLEM', ex);\n }\n }\n /**\n * Performs an HTTP exchange using the configured client request, and interceptos throwing a failure when response status is not in the 200-299 range.\n * @returns {Promise<string>} the response body, as text\n */\n async fetchText() {\n const response = await this.fetch();\n return await unmarshal(response, 'text');\n }\n /**\n * Performs an HTTP exchange using the configured client request, and interceptos throwing a failure when response status is not in the 200-299 range.\n * @returns {Promise<any>} the response body, deserialized as JSON\n */\n async fetchJson() {\n const response = await this.fetch();\n return await unmarshal(response, 'json');\n }\n /**\n * Performs an HTTP exchange using the configured client request, and interceptos throwing a failure when response status is not in the 200-299 range.\n * @returns {Promise<Blob>} the response body, as a Blob\n */\n async fetchBlob() {\n const response = await this.fetch();\n return await unmarshal(response, 'blob');\n }\n /**\n * Performs an HTTP exchange using the configured client request, and interceptos throwing a failure when response status is not in the 200-299 range.\n * @returns {Promise<ArrayBuffer>} the response body, as an ArrayBuffer\n */\n async fetchArrayBuffer() {\n const response = await this.fetch();\n return await unmarshal(response, 'arrayBuffer');\n }\n}\n\nclass HttpMultipartRequestCustomizer {\n #formData;\n /**\n *\n * @param {FormData} formData\n */\n constructor(formData) {\n this.#formData = formData;\n }\n /**\n * Appends a value to the FormData.\n * @param {string} name\n * @param {*} value\n * @returns this builder\n */\n field(name, value) {\n this.#formData.append(name, value);\n return this;\n }\n /**\n * Appends a Blob to the FormData.\n * If `filename` is omitted, FormData defaults are applied:\n * The default filename for Blob objects is \"blob\";\n * The default filename for File objects is the file's filename.\n * @param {string} name\n * @param {Blob} value\n * @param {string|undefined} filename\n * @returns this builder\n */\n blob(name, value, filename) {\n this.#formData.append(name, value, filename);\n return this;\n }\n /**\n * Appends multiple Blobs to the FormData with the same name.\n * The default filename for Blob objects is \"blob\";\n * The default filename for File objects is the file's filename.\n * @param {string} name\n * @param {Blob[]} values\n * @returns this builder\n */\n blobs(name, values) {\n for (const v of values) {\n this.#formData.append(name, v);\n }\n return this;\n }\n /**\n * Appends a JSON serialized blob to the FormData.\n * @param {string} name\n * @param {any} value\n * @param {string|undefined} filename\n * @returns this builder\n */\n json(name, value, filename) {\n const blob = new Blob([JSON.stringify(value)], { type: 'application/json' });\n this.#formData.append(name, blob, filename);\n return this;\n }\n}\n\nexport { MediaType, HttpClient, HttpClientError };\n"],"names":[],"mappings":";;;IAAA;IACA;IACA;IACA,MAAM,OAAO,SAAS,KAAK,CAAC;IAC5B;IACA;IACA;IACA;IACA;IACA;IACA,IA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M,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC;IACpD,QAAQ,OAAO,IAAI;IACnB,IAAI;IACJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE;IACxB,QAAQ,KAAK,MAAM,CAAC,IAAI,MAAM,EAAE;IAChC,YAAY,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1C,QAAQ;IACR,QAAQ,OAAO,IAAI;IACnB,IAAI;IACJ;IACA;IACA;IACA;IACA;IACA;IACA;IACA,IAAI,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE;IAChC,QAAQ,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC;IACpF,QAAQ,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,CAAC;IACnD,QAAQ,OAAO,IAAI;IACnB,IAAI;IACJ;;;;;;;;;;;"}
|
package/dist/httpc.iife.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var httpc=function(t){"use strict";class e extends Error{constructor(t,e,s){super(t,{cause:s}),this.name="Failure",this.problems=e}dropping(t){return new e(this.message,e.dropProblemsContext(this.problems,t),this)}static dropProblemsContext(t,e){return t.map(({type:t,context:s,reason:r,details:n})=>({type:t,context:s?.startsWith(e)?s.substring(e.length):s,reason:r,details:n}))}}class s{static encode(t,e){const r=e||s.URL_SAFE,n=t.byteLength,i=new Uint8Array(t);let a="";for(let t=0;t<n;t+=3){a+=r[i[t]>>2]+r[(3&i[t])<<4|i[t+1]>>4]+r[(15&i[t+1])<<2|i[t+2]>>6]+r[63&i[t+2]]}return n%3==2?a=a.substring(0,a.length-1):n%3==1&&(a=a.substring(0,a.length-2)),a}static decode(t,e){const r=e||s.URL_SAFE;let n=Math.floor(.75*t.length);for(let e=0;e!==t.length&&"="===t[t.length-e-1];++e)--n;const i=new Uint8Array(n);let a=0,o=0;for(;a
|
|
1
|
+
var httpc=function(t){"use strict";class e extends Error{constructor(t,e,s){super(t,{cause:s}),this.name="Failure",this.problems=e}dropping(t){return new e(this.message,e.dropProblemsContext(this.problems,t),this)}static dropProblemsContext(t,e){return t.map(({type:t,context:s,reason:r,details:n})=>({type:t,context:s?.startsWith(e)?s.substring(e.length):s,reason:r,details:n}))}}class s{static encode(t,e){const r=e||s.URL_SAFE,n=t.byteLength,i=new Uint8Array(t);let a="";for(let t=0;t<n;t+=3){a+=r[i[t]>>2]+r[(3&i[t])<<4|i[t+1]>>4]+r[(15&i[t+1])<<2|i[t+2]>>6]+r[63&i[t+2]]}return n%3==2?a=a.substring(0,a.length-1):n%3==1&&(a=a.substring(0,a.length-2)),a}static decode(t,e){const r=e||s.URL_SAFE;let n=Math.floor(.75*t.length);for(let e=0;e!==t.length&&"="===t[t.length-e-1];++e)--n;const i=new Uint8Array(n);let a=0,o=0;for(;a<n;){const e=r.indexOf(t.charAt(o++)),s=r.indexOf(t.charAt(o++)),c=r.indexOf(t.charAt(o++)),h=r.indexOf(t.charAt(o++));if(i[a++]=e<<2|s>>4,a===n)break;if(i[a++]=(15&s)<<4|c>>2,a===n)break;i[a++]=(3&c)<<6|h}return i.buffer}}s.STANDARD="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s.URL_SAFE="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";class r{#t;#e;constructor(t,e){this.#t=t,this.#e=e}get normalized(){return`${this.#t}/${this.#e}`}get type(){return this.#t}get subtype(){return this.#e}static parse(t){if(!t)return new r("unknown","unknown");const[e,s]=t.split(";"),[n,i]=e.trim().split("/");return new r(n.toLowerCase(),i?.toLowerCase())}}class n extends e{constructor(t,e,s,r){super(t,s,r),this.name="HttpClientError",this.status=e}dropping(t){return new n(this.message,this.status,e.dropProblemsContext(this.problems,t),this)}static of(t,e){return new n(e.message,0,[{type:t,context:null,reason:e.message,details:null}],e)}static async fromResponse(t){switch(r.parse(t.headers.get("Content-Type")).normalized){case"application/failures+json":{const e=await t.json(),s=`${t.status} ${t.statusText}: ${e.length} failures`;return new n(s,t.status,e)}case"application/problem+json":{const e=await t.json(),s=`${t.status} ${t.statusText}: ${e.title} ${e.detail}`;return new n(s,t.status,e.problems||[{type:"GENERIC_PROBLEM",context:null,reason:s,details:null}])}default:{const e=await t.text(),s=`${t.status} ${t.statusText}: ${e}`;return new n(s,t.status,[{type:"GENERIC_PROBLEM",context:null,reason:s,details:null}])}}}}class i{#s;#r;constructor(){this.#s=document.querySelector("meta[name='_csrf_header']")?.getAttribute("content"),this.#r=document.querySelector("meta[name='_csrf']")?.getAttribute("content")}async intercept(t,e,s){return this.#s&&this.#r&&e.headers.set(this.#s,this.#r),await s.proceed(t,e)}}class a{#n;constructor(t){this.#n=t}async intercept(t,e,s){const r=await s.proceed(t,e);return 401===r.status?(window.location.href=this.#n,new Promise(()=>{})):r}}class o{#i;constructor(){this.#i=[]}withCsrfToken(){return this.#i.push(new i),this}withRedirectOnUnauthorized(t){return this.#i.push(new a(t)),this}withInterceptors(...t){return this.#i.push(...t),this}build(){return new u(this.#i)}}class c{async intercept(t,e,s){return await fetch(t,e)}}class h{#i;#a;constructor(t,e){this.#i=t,this.#a=e}async proceed(t,e){const s=this.#i[this.#a];return await s.intercept(t,e,new h(this.#i,this.#a+1))}}class u{#i;static builder(){return new o}constructor(t){this.#i=t||[]}async exchange(t,e,s){const r=[...this.#i,...s||[],new c],n=new h(r,0),i=new URL(new Request(t).url);return await n.proceed(i,e??{})}request(t,e){return d.create(this,t,e)}get(t){return d.create(this,"GET",t)}head(t){return d.create(this,"HEAD",t)}post(t){return d.create(this,"POST",t)}put(t){return d.create(this,"PUT",t)}patch(t){return d.create(this,"PATCH",t)}delete(t){return d.create(this,"DELETE",t)}}const p=async(t,e)=>{try{return await t[e]()}catch(t){throw n.of("UNMARSHALING_PROBLEM",t)}},l=t=>null==t?[]:"string"==typeof t?new URLSearchParams(t):"function"==typeof t[Symbol.iterator]?t:Object.entries(t);class d{#o;#c;#h;#u;#p;#l;#d;#i;static create(t,e,s){const[r,n=""]=s.split("?");return new d(t,e,r,new URLSearchParams(n),new Headers,void 0,{},[])}constructor(t,e,s,r,n,i,a,o){this.#o=t,this.#c=e,this.#h=s,this.#u=r,this.#l=i,this.#p=n,this.#d=a,this.#i=o}headers(t){for(const[e,s]of l(t))null==s?this.#p.delete(e):this.#p.set(e,s);return this}header(t,e){return null==e?this.#p.delete(t):this.#p.set(t,e),this}params(t){for(const[e,s]of l(t))null==s?this.#u.delete(e):this.#u.set(e,s);return this}param(t,...e){if(this.#u.delete(t),0===e.length||null==e[0])return this;for(const s of e)this.#u.append(t,s);return this}body(t){return this.#l=t,this}json(t){return this.#p.set("Content-Type","application/json"),this.#l=JSON.stringify(t),this}multipart(t){const e=new FormData;return t(new f(e)),this.#l=e,this}options(t){for(const[e,s]of Object.entries(t))this.#d[e]=s;return this}option(t,e){return this.#d[t]=e,this}interceptors(t){for(const e of t)this.#i.push(e);return this}interceptor(t){return this.#i.push(t),this}async exchange(){const t=this.#u.size?`${this.#h}?${this.#u}`:this.#h,e={...this.#d,headers:this.#p,method:this.#c,body:this.#l};return await this.#o.exchange(t,e,this.#i)}async fetch(){const t=this.#u.size?`${this.#h}?${this.#u}`:this.#h,s={...this.#d,headers:this.#p,method:this.#c,body:this.#l};try{const e=await this.#o.exchange(t,s,this.#i);if(!e.ok)throw await n.fromResponse(e);return e}catch(t){if(t instanceof e)throw t;throw n.of("CONNECTION_PROBLEM",t)}}async fetchText(){const t=await this.fetch();return await p(t,"text")}async fetchJson(){const t=await this.fetch();return await p(t,"json")}async fetchBlob(){const t=await this.fetch();return await p(t,"blob")}async fetchArrayBuffer(){const t=await this.fetch();return await p(t,"arrayBuffer")}}class f{#f;constructor(t){this.#f=t}field(t,e){return this.#f.append(t,e),this}blob(t,e,s){return this.#f.append(t,e,s),this}blobs(t,e){for(const s of e)this.#f.append(t,s);return this}json(t,e,s){const r=new Blob([JSON.stringify(e)],{type:"application/json"});return this.#f.append(t,r,s),this}}return t.Base64=s,t.Failure=e,t.Hex=class{static decode(t){if(t.length%2!=0)throw new Error("invalid length");const e=t.length/2;return new Uint8Array(e).map((e,s)=>{const r=2*s,n=t.substring(r,r+2);return parseInt(n,16)})}static encode(t,e){return Array.from(t).map(t=>t.toString(16)).map(t=>e?t.toUpperCase():t).map(t=>t.padStart(2,"0")).join("")}},t.HttpClient=u,t.HttpClientError=n,t.MediaType=r,t}({});
|
|
2
2
|
//# sourceMappingURL=httpc.iife.min.js.map
|