@dereekb/util 13.34.0 → 13.36.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/eslint/package.json +2 -2
- package/fetch/index.cjs.js +59 -11
- package/fetch/index.esm.js +59 -12
- package/fetch/package.json +2 -2
- package/fetch/src/lib/fetch.url.d.ts +36 -0
- package/oidc/package.json +2 -2
- package/package.json +1 -1
- package/test/package.json +2 -2
package/eslint/package.json
CHANGED
package/fetch/index.cjs.js
CHANGED
|
@@ -52,7 +52,7 @@ function _inherits$3(subClass, superClass) {
|
|
|
52
52
|
if (superClass) _set_prototype_of$3(subClass, superClass);
|
|
53
53
|
}
|
|
54
54
|
function _possible_constructor_return$3(self, call) {
|
|
55
|
-
if (call && (_type_of$
|
|
55
|
+
if (call && (_type_of$6(call) === "object" || typeof call === "function")) {
|
|
56
56
|
return call;
|
|
57
57
|
}
|
|
58
58
|
return _assert_this_initialized$3(self);
|
|
@@ -64,7 +64,7 @@ function _set_prototype_of$3(o, p) {
|
|
|
64
64
|
};
|
|
65
65
|
return _set_prototype_of$3(o, p);
|
|
66
66
|
}
|
|
67
|
-
function _type_of$
|
|
67
|
+
function _type_of$6(obj) {
|
|
68
68
|
"@swc/helpers - typeof";
|
|
69
69
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
70
70
|
}
|
|
@@ -84,7 +84,7 @@ function _is_native_reflect_construct$3() {
|
|
|
84
84
|
_class_call_check$3(this, FetchRequestFactoryError);
|
|
85
85
|
var _this;
|
|
86
86
|
_this = _call_super$3(this, FetchRequestFactoryError, [
|
|
87
|
-
"Fetch request failed to build due to an unexpected error: ".concat((typeof error === "undefined" ? "undefined" : _type_of$
|
|
87
|
+
"Fetch request failed to build due to an unexpected error: ".concat((typeof error === "undefined" ? "undefined" : _type_of$6(error)) === 'object' ? error.message : error)
|
|
88
88
|
]), _define_property$5(_this, "error", void 0);
|
|
89
89
|
_this.error = error;
|
|
90
90
|
return _this;
|
|
@@ -210,7 +210,7 @@ function _object_spread_props$3(target, source) {
|
|
|
210
210
|
return target;
|
|
211
211
|
}
|
|
212
212
|
function _possible_constructor_return$2(self, call) {
|
|
213
|
-
if (call && (_type_of$
|
|
213
|
+
if (call && (_type_of$5(call) === "object" || typeof call === "function")) {
|
|
214
214
|
return call;
|
|
215
215
|
}
|
|
216
216
|
return _assert_this_initialized$2(self);
|
|
@@ -222,7 +222,7 @@ function _set_prototype_of$2(o, p) {
|
|
|
222
222
|
};
|
|
223
223
|
return _set_prototype_of$2(o, p);
|
|
224
224
|
}
|
|
225
|
-
function _type_of$
|
|
225
|
+
function _type_of$5(obj) {
|
|
226
226
|
"@swc/helpers - typeof";
|
|
227
227
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
228
228
|
}
|
|
@@ -403,7 +403,7 @@ function _object_spread_props$2(target, source) {
|
|
|
403
403
|
function _sliced_to_array$3(arr, i) {
|
|
404
404
|
return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
|
|
405
405
|
}
|
|
406
|
-
function _type_of$
|
|
406
|
+
function _type_of$4(obj) {
|
|
407
407
|
"@swc/helpers - typeof";
|
|
408
408
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
409
409
|
}
|
|
@@ -904,7 +904,7 @@ function _ts_generator$4(thisArg, body) {
|
|
|
904
904
|
value
|
|
905
905
|
]);
|
|
906
906
|
});
|
|
907
|
-
} else if ((typeof headers === "undefined" ? "undefined" : _type_of$
|
|
907
|
+
} else if ((typeof headers === "undefined" ? "undefined" : _type_of$4(headers)) === 'object') {
|
|
908
908
|
// use as a normal object
|
|
909
909
|
tuples = Object.entries(headers);
|
|
910
910
|
}
|
|
@@ -1469,7 +1469,7 @@ function _object_spread$2(target) {
|
|
|
1469
1469
|
return target;
|
|
1470
1470
|
}
|
|
1471
1471
|
function _possible_constructor_return$1(self, call) {
|
|
1472
|
-
if (call && (_type_of$
|
|
1472
|
+
if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
|
|
1473
1473
|
return call;
|
|
1474
1474
|
}
|
|
1475
1475
|
return _assert_this_initialized$1(self);
|
|
@@ -1481,7 +1481,7 @@ function _set_prototype_of$1(o, p) {
|
|
|
1481
1481
|
};
|
|
1482
1482
|
return _set_prototype_of$1(o, p);
|
|
1483
1483
|
}
|
|
1484
|
-
function _type_of$
|
|
1484
|
+
function _type_of$3(obj) {
|
|
1485
1485
|
"@swc/helpers - typeof";
|
|
1486
1486
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1487
1487
|
}
|
|
@@ -2258,6 +2258,10 @@ function _non_iterable_rest$1() {
|
|
|
2258
2258
|
function _sliced_to_array$1(arr, i) {
|
|
2259
2259
|
return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
|
|
2260
2260
|
}
|
|
2261
|
+
function _type_of$2(obj) {
|
|
2262
|
+
"@swc/helpers - typeof";
|
|
2263
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2264
|
+
}
|
|
2261
2265
|
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
2262
2266
|
if (!o) return;
|
|
2263
2267
|
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
@@ -2266,6 +2270,48 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
2266
2270
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2267
2271
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
2268
2272
|
}
|
|
2273
|
+
/**
|
|
2274
|
+
* Expands a potentially nested object into bracket-notation query key/value tuples.
|
|
2275
|
+
*
|
|
2276
|
+
* Arrays are addressed by index and object properties by key, recursively, so every leaf
|
|
2277
|
+
* gets its own fully-qualified parameter. Nullish leaves are omitted rather than emitted
|
|
2278
|
+
* as the strings `"null"`/`"undefined"`; all other leaves are stringified.
|
|
2279
|
+
*
|
|
2280
|
+
* @param input - The object to expand.
|
|
2281
|
+
* @returns The bracket-notation key/value tuples.
|
|
2282
|
+
*
|
|
2283
|
+
* @example
|
|
2284
|
+
* ```typescript
|
|
2285
|
+
* toBracketNotationSearchParamTuples({ calendarsToLoad: [{ credentialId: 1, externalId: 'a@b.com' }] });
|
|
2286
|
+
* // => [['calendarsToLoad[0][credentialId]', '1'], ['calendarsToLoad[0][externalId]', 'a@b.com']]
|
|
2287
|
+
* ```
|
|
2288
|
+
*/ function toBracketNotationSearchParamTuples(input) {
|
|
2289
|
+
var tuples = [];
|
|
2290
|
+
function expandValue(key, value) {
|
|
2291
|
+
if (value != null) {
|
|
2292
|
+
if (Array.isArray(value)) {
|
|
2293
|
+
value.forEach(function(itemValue, i) {
|
|
2294
|
+
return expandValue("".concat(key, "[").concat(i, "]"), itemValue);
|
|
2295
|
+
});
|
|
2296
|
+
} else if ((typeof value === "undefined" ? "undefined" : _type_of$2(value)) === 'object') {
|
|
2297
|
+
Object.entries(value).forEach(function(param) {
|
|
2298
|
+
var _param = _sliced_to_array$1(param, 2), childKey = _param[0], childValue = _param[1];
|
|
2299
|
+
return expandValue("".concat(key, "[").concat(childKey, "]"), childValue);
|
|
2300
|
+
});
|
|
2301
|
+
} else {
|
|
2302
|
+
tuples.push([
|
|
2303
|
+
key,
|
|
2304
|
+
String(value)
|
|
2305
|
+
]);
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
}
|
|
2309
|
+
Object.entries(input !== null && input !== void 0 ? input : {}).forEach(function(param) {
|
|
2310
|
+
var _param = _sliced_to_array$1(param, 2), key = _param[0], value = _param[1];
|
|
2311
|
+
return expandValue(key, value);
|
|
2312
|
+
});
|
|
2313
|
+
return tuples;
|
|
2314
|
+
}
|
|
2269
2315
|
/**
|
|
2270
2316
|
* Creates URLSearchParams from the input objects. The input objects are merged together.
|
|
2271
2317
|
*
|
|
@@ -2273,10 +2319,11 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
2273
2319
|
* @param options - Optional configuration for filtering, omitting keys, and space encoding.
|
|
2274
2320
|
* @returns A URLSearchParams instance built from the merged and filtered input.
|
|
2275
2321
|
*/ function makeUrlSearchParams(input, options) {
|
|
2276
|
-
var _ref = options !== null && options !== void 0 ? options : {}, omitKeys = _ref.omitKeys, filterValues = _ref.filterEmptyValues;
|
|
2322
|
+
var _ref = options !== null && options !== void 0 ? options : {}, omitKeys = _ref.omitKeys, filterValues = _ref.filterEmptyValues, useBracketNotation = _ref.useBracketNotation;
|
|
2277
2323
|
var mergedInput = Array.isArray(input) ? util.mergeObjects(input) : input;
|
|
2278
2324
|
var filteredInput = (filterValues !== null && filterValues !== void 0 ? filterValues : true) ? util.filterEmptyPojoValues(mergedInput !== null && mergedInput !== void 0 ? mergedInput : {}) : mergedInput;
|
|
2279
|
-
var
|
|
2325
|
+
var searchParamsInput = useBracketNotation ? toBracketNotationSearchParamTuples(filteredInput) : filteredInput;
|
|
2326
|
+
var searchParams = new URLSearchParams(searchParamsInput);
|
|
2280
2327
|
if (omitKeys != null) {
|
|
2281
2328
|
util.useIterableOrValue(omitKeys, function(key) {
|
|
2282
2329
|
return searchParams.delete(key);
|
|
@@ -2857,4 +2904,5 @@ exports.rateLimitedFetchHandler = rateLimitedFetchHandler;
|
|
|
2857
2904
|
exports.requireOkResponse = requireOkResponse;
|
|
2858
2905
|
exports.returnNullHandleFetchJsonParseErrorFunction = returnNullHandleFetchJsonParseErrorFunction;
|
|
2859
2906
|
exports.throwJsonResponseParseErrorFunction = throwJsonResponseParseErrorFunction;
|
|
2907
|
+
exports.toBracketNotationSearchParamTuples = toBracketNotationSearchParamTuples;
|
|
2860
2908
|
exports.updateUrlSearchParams = updateUrlSearchParams;
|
package/fetch/index.esm.js
CHANGED
|
@@ -50,7 +50,7 @@ function _inherits$3(subClass, superClass) {
|
|
|
50
50
|
if (superClass) _set_prototype_of$3(subClass, superClass);
|
|
51
51
|
}
|
|
52
52
|
function _possible_constructor_return$3(self, call) {
|
|
53
|
-
if (call && (_type_of$
|
|
53
|
+
if (call && (_type_of$6(call) === "object" || typeof call === "function")) {
|
|
54
54
|
return call;
|
|
55
55
|
}
|
|
56
56
|
return _assert_this_initialized$3(self);
|
|
@@ -62,7 +62,7 @@ function _set_prototype_of$3(o, p) {
|
|
|
62
62
|
};
|
|
63
63
|
return _set_prototype_of$3(o, p);
|
|
64
64
|
}
|
|
65
|
-
function _type_of$
|
|
65
|
+
function _type_of$6(obj) {
|
|
66
66
|
"@swc/helpers - typeof";
|
|
67
67
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
68
68
|
}
|
|
@@ -82,7 +82,7 @@ function _is_native_reflect_construct$3() {
|
|
|
82
82
|
_class_call_check$3(this, FetchRequestFactoryError);
|
|
83
83
|
var _this;
|
|
84
84
|
_this = _call_super$3(this, FetchRequestFactoryError, [
|
|
85
|
-
"Fetch request failed to build due to an unexpected error: ".concat((typeof error === "undefined" ? "undefined" : _type_of$
|
|
85
|
+
"Fetch request failed to build due to an unexpected error: ".concat((typeof error === "undefined" ? "undefined" : _type_of$6(error)) === 'object' ? error.message : error)
|
|
86
86
|
]), _define_property$5(_this, "error", void 0);
|
|
87
87
|
_this.error = error;
|
|
88
88
|
return _this;
|
|
@@ -208,7 +208,7 @@ function _object_spread_props$3(target, source) {
|
|
|
208
208
|
return target;
|
|
209
209
|
}
|
|
210
210
|
function _possible_constructor_return$2(self, call) {
|
|
211
|
-
if (call && (_type_of$
|
|
211
|
+
if (call && (_type_of$5(call) === "object" || typeof call === "function")) {
|
|
212
212
|
return call;
|
|
213
213
|
}
|
|
214
214
|
return _assert_this_initialized$2(self);
|
|
@@ -220,7 +220,7 @@ function _set_prototype_of$2(o, p) {
|
|
|
220
220
|
};
|
|
221
221
|
return _set_prototype_of$2(o, p);
|
|
222
222
|
}
|
|
223
|
-
function _type_of$
|
|
223
|
+
function _type_of$5(obj) {
|
|
224
224
|
"@swc/helpers - typeof";
|
|
225
225
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
226
226
|
}
|
|
@@ -401,7 +401,7 @@ function _object_spread_props$2(target, source) {
|
|
|
401
401
|
function _sliced_to_array$3(arr, i) {
|
|
402
402
|
return _array_with_holes$3(arr) || _iterable_to_array_limit$3(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$3();
|
|
403
403
|
}
|
|
404
|
-
function _type_of$
|
|
404
|
+
function _type_of$4(obj) {
|
|
405
405
|
"@swc/helpers - typeof";
|
|
406
406
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
407
407
|
}
|
|
@@ -902,7 +902,7 @@ function _ts_generator$4(thisArg, body) {
|
|
|
902
902
|
value
|
|
903
903
|
]);
|
|
904
904
|
});
|
|
905
|
-
} else if ((typeof headers === "undefined" ? "undefined" : _type_of$
|
|
905
|
+
} else if ((typeof headers === "undefined" ? "undefined" : _type_of$4(headers)) === 'object') {
|
|
906
906
|
// use as a normal object
|
|
907
907
|
tuples = Object.entries(headers);
|
|
908
908
|
}
|
|
@@ -1467,7 +1467,7 @@ function _object_spread$2(target) {
|
|
|
1467
1467
|
return target;
|
|
1468
1468
|
}
|
|
1469
1469
|
function _possible_constructor_return$1(self, call) {
|
|
1470
|
-
if (call && (_type_of$
|
|
1470
|
+
if (call && (_type_of$3(call) === "object" || typeof call === "function")) {
|
|
1471
1471
|
return call;
|
|
1472
1472
|
}
|
|
1473
1473
|
return _assert_this_initialized$1(self);
|
|
@@ -1479,7 +1479,7 @@ function _set_prototype_of$1(o, p) {
|
|
|
1479
1479
|
};
|
|
1480
1480
|
return _set_prototype_of$1(o, p);
|
|
1481
1481
|
}
|
|
1482
|
-
function _type_of$
|
|
1482
|
+
function _type_of$3(obj) {
|
|
1483
1483
|
"@swc/helpers - typeof";
|
|
1484
1484
|
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
1485
1485
|
}
|
|
@@ -2256,6 +2256,10 @@ function _non_iterable_rest$1() {
|
|
|
2256
2256
|
function _sliced_to_array$1(arr, i) {
|
|
2257
2257
|
return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
|
|
2258
2258
|
}
|
|
2259
|
+
function _type_of$2(obj) {
|
|
2260
|
+
"@swc/helpers - typeof";
|
|
2261
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2262
|
+
}
|
|
2259
2263
|
function _unsupported_iterable_to_array$1(o, minLen) {
|
|
2260
2264
|
if (!o) return;
|
|
2261
2265
|
if (typeof o === "string") return _array_like_to_array$1(o, minLen);
|
|
@@ -2264,6 +2268,48 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
2264
2268
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
2265
2269
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
|
|
2266
2270
|
}
|
|
2271
|
+
/**
|
|
2272
|
+
* Expands a potentially nested object into bracket-notation query key/value tuples.
|
|
2273
|
+
*
|
|
2274
|
+
* Arrays are addressed by index and object properties by key, recursively, so every leaf
|
|
2275
|
+
* gets its own fully-qualified parameter. Nullish leaves are omitted rather than emitted
|
|
2276
|
+
* as the strings `"null"`/`"undefined"`; all other leaves are stringified.
|
|
2277
|
+
*
|
|
2278
|
+
* @param input - The object to expand.
|
|
2279
|
+
* @returns The bracket-notation key/value tuples.
|
|
2280
|
+
*
|
|
2281
|
+
* @example
|
|
2282
|
+
* ```typescript
|
|
2283
|
+
* toBracketNotationSearchParamTuples({ calendarsToLoad: [{ credentialId: 1, externalId: 'a@b.com' }] });
|
|
2284
|
+
* // => [['calendarsToLoad[0][credentialId]', '1'], ['calendarsToLoad[0][externalId]', 'a@b.com']]
|
|
2285
|
+
* ```
|
|
2286
|
+
*/ function toBracketNotationSearchParamTuples(input) {
|
|
2287
|
+
var tuples = [];
|
|
2288
|
+
function expandValue(key, value) {
|
|
2289
|
+
if (value != null) {
|
|
2290
|
+
if (Array.isArray(value)) {
|
|
2291
|
+
value.forEach(function(itemValue, i) {
|
|
2292
|
+
return expandValue("".concat(key, "[").concat(i, "]"), itemValue);
|
|
2293
|
+
});
|
|
2294
|
+
} else if ((typeof value === "undefined" ? "undefined" : _type_of$2(value)) === 'object') {
|
|
2295
|
+
Object.entries(value).forEach(function(param) {
|
|
2296
|
+
var _param = _sliced_to_array$1(param, 2), childKey = _param[0], childValue = _param[1];
|
|
2297
|
+
return expandValue("".concat(key, "[").concat(childKey, "]"), childValue);
|
|
2298
|
+
});
|
|
2299
|
+
} else {
|
|
2300
|
+
tuples.push([
|
|
2301
|
+
key,
|
|
2302
|
+
String(value)
|
|
2303
|
+
]);
|
|
2304
|
+
}
|
|
2305
|
+
}
|
|
2306
|
+
}
|
|
2307
|
+
Object.entries(input !== null && input !== void 0 ? input : {}).forEach(function(param) {
|
|
2308
|
+
var _param = _sliced_to_array$1(param, 2), key = _param[0], value = _param[1];
|
|
2309
|
+
return expandValue(key, value);
|
|
2310
|
+
});
|
|
2311
|
+
return tuples;
|
|
2312
|
+
}
|
|
2267
2313
|
/**
|
|
2268
2314
|
* Creates URLSearchParams from the input objects. The input objects are merged together.
|
|
2269
2315
|
*
|
|
@@ -2271,10 +2317,11 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
2271
2317
|
* @param options - Optional configuration for filtering, omitting keys, and space encoding.
|
|
2272
2318
|
* @returns A URLSearchParams instance built from the merged and filtered input.
|
|
2273
2319
|
*/ function makeUrlSearchParams(input, options) {
|
|
2274
|
-
var _ref = options !== null && options !== void 0 ? options : {}, omitKeys = _ref.omitKeys, filterValues = _ref.filterEmptyValues;
|
|
2320
|
+
var _ref = options !== null && options !== void 0 ? options : {}, omitKeys = _ref.omitKeys, filterValues = _ref.filterEmptyValues, useBracketNotation = _ref.useBracketNotation;
|
|
2275
2321
|
var mergedInput = Array.isArray(input) ? mergeObjects(input) : input;
|
|
2276
2322
|
var filteredInput = (filterValues !== null && filterValues !== void 0 ? filterValues : true) ? filterEmptyPojoValues(mergedInput !== null && mergedInput !== void 0 ? mergedInput : {}) : mergedInput;
|
|
2277
|
-
var
|
|
2323
|
+
var searchParamsInput = useBracketNotation ? toBracketNotationSearchParamTuples(filteredInput) : filteredInput;
|
|
2324
|
+
var searchParams = new URLSearchParams(searchParamsInput);
|
|
2278
2325
|
if (omitKeys != null) {
|
|
2279
2326
|
useIterableOrValue(omitKeys, function(key) {
|
|
2280
2327
|
return searchParams.delete(key);
|
|
@@ -2811,4 +2858,4 @@ var fetchJsonRequestInit = fetchJsonRequestInitFunction();
|
|
|
2811
2858
|
}
|
|
2812
2859
|
});
|
|
2813
2860
|
|
|
2814
|
-
export { DEFAULT_FETCH_HANDLER, DEFAULT_FETCH_PAGE_FACTORY_MAX_PAGE, DEFAULT_FETCH_REQUEST_FACTORY, FetchPageLimitReachedError, FetchPageNoNextPageError, FetchRequestFactoryError, FetchResponseError, FetchTimeoutError, JsonResponseParseError, configureFetch, fetchApiFetchService, fetchFileFromUrl, fetchJsonBodyString, fetchJsonFunction, fetchJsonRequestInit, fetchJsonRequestInitFunction, fetchOk, fetchPageFactory, fetchRequestFactory, fetchService, fetchTimeout, fetchURL, fetchURLQueryKeyValueStringTuples, fetchURLSearchParamsObjectToURLSearchParams, fetchUploadFile, headersToHeadersTuple, isFetchRequest, isURL, isURLSearchParams, iterateFetchPages, iterateFetchPagesByEachItem, iterateFetchPagesByItems, makeFileForFetch, makeUrlSearchParams, makeUrlSearchParamsString, mergeMakeUrlSearchParamsOptions, mergeRequestHeaders, mergeRequestInits, parseFetchFileResponse, queryParamsToSearchParams, rateLimitedFetchHandler, requireOkResponse, returnNullHandleFetchJsonParseErrorFunction, throwJsonResponseParseErrorFunction, updateUrlSearchParams };
|
|
2861
|
+
export { DEFAULT_FETCH_HANDLER, DEFAULT_FETCH_PAGE_FACTORY_MAX_PAGE, DEFAULT_FETCH_REQUEST_FACTORY, FetchPageLimitReachedError, FetchPageNoNextPageError, FetchRequestFactoryError, FetchResponseError, FetchTimeoutError, JsonResponseParseError, configureFetch, fetchApiFetchService, fetchFileFromUrl, fetchJsonBodyString, fetchJsonFunction, fetchJsonRequestInit, fetchJsonRequestInitFunction, fetchOk, fetchPageFactory, fetchRequestFactory, fetchService, fetchTimeout, fetchURL, fetchURLQueryKeyValueStringTuples, fetchURLSearchParamsObjectToURLSearchParams, fetchUploadFile, headersToHeadersTuple, isFetchRequest, isURL, isURLSearchParams, iterateFetchPages, iterateFetchPagesByEachItem, iterateFetchPagesByItems, makeFileForFetch, makeUrlSearchParams, makeUrlSearchParamsString, mergeMakeUrlSearchParamsOptions, mergeRequestHeaders, mergeRequestInits, parseFetchFileResponse, queryParamsToSearchParams, rateLimitedFetchHandler, requireOkResponse, returnNullHandleFetchJsonParseErrorFunction, throwJsonResponseParseErrorFunction, toBracketNotationSearchParamTuples, updateUrlSearchParams };
|
package/fetch/package.json
CHANGED
|
@@ -30,7 +30,43 @@ export interface MakeUrlSearchParamsOptions {
|
|
|
30
30
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams#interaction_with_url.searchparams | MDN: Interaction with URL.searchParams}
|
|
31
31
|
*/
|
|
32
32
|
readonly useUrlSearchSpaceHandling?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Whether to expand nested arrays and objects into bracket-notation keys instead of
|
|
35
|
+
* letting `URLSearchParams` stringify them.
|
|
36
|
+
*
|
|
37
|
+
* `URLSearchParams` calls `String()` on every value, so by default an array is comma-joined
|
|
38
|
+
* and a nested object collapses to the useless `[object Object]`. Many APIs instead expect
|
|
39
|
+
* each leaf addressed by an indexed/keyed path:
|
|
40
|
+
*
|
|
41
|
+
* `{ a: [{ b: 1 }] }` becomes `a[0][b]=1` rather than `a=[object Object]`.
|
|
42
|
+
*
|
|
43
|
+
* Scalar values are unaffected. Nullish leaves are skipped.
|
|
44
|
+
*
|
|
45
|
+
* Defaults to false.
|
|
46
|
+
*/
|
|
47
|
+
readonly useBracketNotation?: boolean;
|
|
33
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* A single URL query parameter, as a key/value tuple.
|
|
51
|
+
*/
|
|
52
|
+
export type UrlSearchParamsKeyValueTuple = [string, string];
|
|
53
|
+
/**
|
|
54
|
+
* Expands a potentially nested object into bracket-notation query key/value tuples.
|
|
55
|
+
*
|
|
56
|
+
* Arrays are addressed by index and object properties by key, recursively, so every leaf
|
|
57
|
+
* gets its own fully-qualified parameter. Nullish leaves are omitted rather than emitted
|
|
58
|
+
* as the strings `"null"`/`"undefined"`; all other leaves are stringified.
|
|
59
|
+
*
|
|
60
|
+
* @param input - The object to expand.
|
|
61
|
+
* @returns The bracket-notation key/value tuples.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* toBracketNotationSearchParamTuples({ calendarsToLoad: [{ credentialId: 1, externalId: 'a@b.com' }] });
|
|
66
|
+
* // => [['calendarsToLoad[0][credentialId]', '1'], ['calendarsToLoad[0][externalId]', 'a@b.com']]
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
export declare function toBracketNotationSearchParamTuples(input: Maybe<object>): UrlSearchParamsKeyValueTuple[];
|
|
34
70
|
/**
|
|
35
71
|
* Creates URLSearchParams from the input objects. The input objects are merged together.
|
|
36
72
|
*
|
package/oidc/package.json
CHANGED
package/package.json
CHANGED