@optionfactory/ful 0.97.0 → 0.99.0
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/ful.iife.js +28 -10
- 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 +28 -10
- package/dist/ful.mjs.map +1 -1
- package/package.json +4 -4
package/dist/ful.iife.js
CHANGED
|
@@ -97,7 +97,7 @@ var ful = (function (exports) {
|
|
|
97
97
|
this.#type = type;
|
|
98
98
|
this.#subtype = subtype;
|
|
99
99
|
}
|
|
100
|
-
get normalized(){
|
|
100
|
+
get normalized() {
|
|
101
101
|
return `${this.#type}/${this.#subtype}`;
|
|
102
102
|
}
|
|
103
103
|
get type() {
|
|
@@ -162,7 +162,7 @@ var ful = (function (exports) {
|
|
|
162
162
|
* @returns an HttpClientError
|
|
163
163
|
*/
|
|
164
164
|
static async fromResponse(response) {
|
|
165
|
-
switch(MediaType.parse(response.headers.get("Content-Type")).normalized){
|
|
165
|
+
switch (MediaType.parse(response.headers.get("Content-Type")).normalized) {
|
|
166
166
|
case 'application/failures+json': {
|
|
167
167
|
const data = await response.json();
|
|
168
168
|
const message = `${response.status} ${response.statusText}: ${data.length} failures`;
|
|
@@ -441,45 +441,61 @@ var ful = (function (exports) {
|
|
|
441
441
|
this.#interceptors = interceptors;
|
|
442
442
|
}
|
|
443
443
|
/**
|
|
444
|
-
* Add all passed headers to the request, overriding existing ones if that key already exists.
|
|
444
|
+
* 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.
|
|
445
445
|
* @param {HeadersInit} hs
|
|
446
446
|
* @returns {HttpRequestBuilder} this builder
|
|
447
447
|
*/
|
|
448
448
|
headers(hs) {
|
|
449
449
|
for (const [k, v] of new Headers(hs).entries()) {
|
|
450
|
-
|
|
450
|
+
if (v === null || v === undefined) {
|
|
451
|
+
this.#headers.delete(k);
|
|
452
|
+
} else {
|
|
453
|
+
this.#headers.set(k, v);
|
|
454
|
+
}
|
|
451
455
|
}
|
|
452
456
|
return this;
|
|
453
457
|
}
|
|
454
458
|
/**
|
|
455
|
-
* Adds an header to the request, overriding it if it already exists.
|
|
459
|
+
* Adds an header to the request, overriding it if it already exists. Null and undefined values cause the key to be removed
|
|
456
460
|
* @param {string} k
|
|
457
461
|
* @param {string} v
|
|
458
462
|
* @returns {HttpRequestBuilder} this builder
|
|
459
463
|
*/
|
|
460
464
|
header(k, v) {
|
|
461
|
-
|
|
465
|
+
if (v === null || v === undefined) {
|
|
466
|
+
this.#headers.delete(k);
|
|
467
|
+
} else {
|
|
468
|
+
this.#headers.set(k, v);
|
|
469
|
+
}
|
|
462
470
|
return this;
|
|
463
471
|
}
|
|
464
472
|
/**
|
|
465
|
-
* Add all query parameters to the request, overriding existing ones if that key already exists.
|
|
473
|
+
* 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
|
|
466
474
|
* @param {URLSearchParams|Record<string,string>|string[][]|string} ps
|
|
467
475
|
* @returns {HttpRequestBuilder} this builder
|
|
468
476
|
*/
|
|
469
477
|
params(ps) {
|
|
470
478
|
for (const [k, v] of new URLSearchParams(ps).entries()) {
|
|
471
|
-
|
|
479
|
+
if (v === null || v === undefined) {
|
|
480
|
+
this.#params.delete(k);
|
|
481
|
+
} else {
|
|
482
|
+
this.#params.set(k, v);
|
|
483
|
+
}
|
|
472
484
|
}
|
|
473
485
|
return this;
|
|
474
486
|
}
|
|
475
487
|
/**
|
|
476
|
-
* Adds a query parameter to the request, overriding it if it already exists.
|
|
488
|
+
* Adds a query parameter to the request, overriding it if it already exists. Null and undefined values cause the key to be removed.
|
|
477
489
|
* @param {string} k
|
|
478
490
|
* @param {string} v
|
|
479
491
|
* @returns {HttpRequestBuilder} this builder
|
|
480
492
|
*/
|
|
481
493
|
param(k, v) {
|
|
482
|
-
|
|
494
|
+
if (v === null || v === undefined) {
|
|
495
|
+
this.#params.delete(k);
|
|
496
|
+
} else {
|
|
497
|
+
this.#params.set(k, v);
|
|
498
|
+
}
|
|
483
499
|
return this;
|
|
484
500
|
}
|
|
485
501
|
/**
|
|
@@ -855,6 +871,7 @@ var ful = (function (exports) {
|
|
|
855
871
|
constructor(clientId, t, {token, logout, redirect}) {
|
|
856
872
|
this.clientId = clientId;
|
|
857
873
|
this.token = t;
|
|
874
|
+
this.idToken = AuthorizationCodeFlowSession.parseToken(t.id_token);
|
|
858
875
|
this.accessToken = AuthorizationCodeFlowSession.parseToken(t.access_token);
|
|
859
876
|
this.refreshToken = AuthorizationCodeFlowSession.parseToken(t.refresh_token);
|
|
860
877
|
this.uri = { token, logout, redirect };
|
|
@@ -881,6 +898,7 @@ var ful = (function (exports) {
|
|
|
881
898
|
}
|
|
882
899
|
const token = await response.json();
|
|
883
900
|
this.token = token;
|
|
901
|
+
this.idToken = AuthorizationCodeFlowSession.parseToken(token.id_token);
|
|
884
902
|
this.accessToken = AuthorizationCodeFlowSession.parseToken(token.access_token);
|
|
885
903
|
this.refreshToken = AuthorizationCodeFlowSession.parseToken(token.refresh_token);
|
|
886
904
|
if (this.refreshCallback) {
|