@dereekb/util 13.4.0 → 13.4.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.
Files changed (80) hide show
  1. package/fetch/index.cjs.js +191 -109
  2. package/fetch/index.esm.js +191 -109
  3. package/fetch/package.json +2 -2
  4. package/fetch/src/lib/error.d.ts +6 -0
  5. package/fetch/src/lib/fetch.d.ts +37 -0
  6. package/fetch/src/lib/fetch.file.d.ts +7 -5
  7. package/fetch/src/lib/fetch.limit.d.ts +7 -0
  8. package/fetch/src/lib/fetch.url.d.ts +6 -3
  9. package/fetch/src/lib/json.d.ts +12 -1
  10. package/fetch/src/lib/timeout.d.ts +8 -0
  11. package/fetch/src/lib/url.d.ts +33 -0
  12. package/index.cjs.js +1440 -746
  13. package/index.esm.js +1440 -747
  14. package/package.json +1 -1
  15. package/src/lib/array/array.boolean.d.ts +7 -0
  16. package/src/lib/array/array.filter.d.ts +4 -4
  17. package/src/lib/array/array.index.d.ts +3 -1
  18. package/src/lib/array/array.indexed.d.ts +9 -3
  19. package/src/lib/array/array.limit.d.ts +2 -0
  20. package/src/lib/assertion/assert.d.ts +3 -0
  21. package/src/lib/assertion/assert.error.d.ts +6 -0
  22. package/src/lib/boolean.d.ts +3 -0
  23. package/src/lib/date/expires.d.ts +3 -3
  24. package/src/lib/date/minute.d.ts +14 -8
  25. package/src/lib/date/time.d.ts +3 -0
  26. package/src/lib/error/error.server.d.ts +1 -0
  27. package/src/lib/file/pdf.d.ts +1 -1
  28. package/src/lib/getter/getter.cache.d.ts +1 -1
  29. package/src/lib/grouping.d.ts +11 -2
  30. package/src/lib/map/map.key.d.ts +1 -1
  31. package/src/lib/model/model.d.ts +14 -9
  32. package/src/lib/number/dollar.d.ts +8 -0
  33. package/src/lib/number/number.d.ts +4 -0
  34. package/src/lib/object/object.equal.d.ts +2 -2
  35. package/src/lib/object/object.filter.pojo.d.ts +7 -0
  36. package/src/lib/object/object.filter.tuple.d.ts +2 -0
  37. package/src/lib/object/object.map.d.ts +1 -1
  38. package/src/lib/path/path.d.ts +4 -2
  39. package/src/lib/promise/poll.d.ts +3 -0
  40. package/src/lib/promise/promise.d.ts +19 -7
  41. package/src/lib/promise/promise.loop.d.ts +27 -9
  42. package/src/lib/relation/relation.d.ts +12 -0
  43. package/src/lib/service/handler.config.d.ts +3 -1
  44. package/src/lib/service/handler.d.ts +6 -2
  45. package/src/lib/service/typed.service.d.ts +3 -1
  46. package/src/lib/set/set.d.ts +32 -19
  47. package/src/lib/set/set.hashset.d.ts +3 -1
  48. package/src/lib/sort.d.ts +11 -0
  49. package/src/lib/storage/storage.error.d.ts +3 -0
  50. package/src/lib/storage/storage.memory.d.ts +7 -0
  51. package/src/lib/storage/storage.object.d.ts +5 -0
  52. package/src/lib/string/dencoder.d.ts +4 -1
  53. package/src/lib/string/mimetype.d.ts +57 -19
  54. package/src/lib/string/transform.d.ts +10 -1
  55. package/src/lib/string/tree.d.ts +18 -6
  56. package/src/lib/string/url.d.ts +57 -19
  57. package/src/lib/tree/tree.d.ts +12 -4
  58. package/src/lib/tree/tree.flatten.d.ts +3 -1
  59. package/src/lib/value/address.d.ts +24 -7
  60. package/src/lib/value/bound.d.ts +3 -0
  61. package/src/lib/value/build.d.ts +3 -0
  62. package/src/lib/value/comparator.d.ts +4 -0
  63. package/src/lib/value/cron.d.ts +1 -0
  64. package/src/lib/value/decision.d.ts +3 -0
  65. package/src/lib/value/equal.d.ts +3 -0
  66. package/src/lib/value/indexed.d.ts +4 -0
  67. package/src/lib/value/label.d.ts +1 -0
  68. package/src/lib/value/map.d.ts +9 -0
  69. package/src/lib/value/maybe.d.ts +13 -0
  70. package/src/lib/value/modifier.d.ts +9 -0
  71. package/src/lib/value/point.d.ts +3 -0
  72. package/src/lib/value/url.d.ts +1 -0
  73. package/src/lib/value/vector.d.ts +5 -0
  74. package/test/index.cjs.js +29 -6
  75. package/test/index.esm.js +29 -6
  76. package/test/package.json +2 -2
  77. package/test/src/lib/jest/jest.fail.d.ts +3 -3
  78. package/test/src/lib/shared/shared.d.ts +7 -1
  79. package/test/src/lib/shared/shared.fail.d.ts +8 -2
  80. package/test/src/lib/shared/shared.wrap.d.ts +1 -0
@@ -83,9 +83,8 @@ function _is_native_reflect_construct$3() {
83
83
  function FetchRequestFactoryError(error) {
84
84
  _class_call_check$3(this, FetchRequestFactoryError);
85
85
  var _this;
86
- var _error_message;
87
86
  _this = _call_super$3(this, FetchRequestFactoryError, [
88
- "Fetch request failed to build due to an unexpected error: ".concat((typeof error === "undefined" ? "undefined" : _type_of$5(error)) === 'object' ? (_error_message = error.message) !== null && _error_message !== void 0 ? _error_message : '' : error)
87
+ "Fetch request failed to build due to an unexpected error: ".concat((typeof error === "undefined" ? "undefined" : _type_of$5(error)) === 'object' ? error.message : error)
89
88
  ]), _define_property$5(_this, "error", void 0);
90
89
  _this.error = error;
91
90
  return _this;
@@ -115,7 +114,12 @@ var FetchResponseError = /*#__PURE__*/ function(BaseError) {
115
114
  }
116
115
  return FetchResponseError;
117
116
  }(makeError.BaseError);
118
- function requireOkResponse(responsePromise) {
117
+ /**
118
+ * Asserts that the fetch response has an ok status code, throwing a FetchResponseError if it does not.
119
+ *
120
+ * @param responsePromise - promise resolving to the fetch Response to validate
121
+ * @returns a promise resolving to the Response if the status is ok
122
+ */ function requireOkResponse(responsePromise) {
119
123
  return responsePromise.then(function(response) {
120
124
  if (!response.ok) {
121
125
  throw new FetchResponseError(response);
@@ -244,7 +248,14 @@ var FetchTimeoutError = /*#__PURE__*/ function(BaseError) {
244
248
  }
245
249
  return FetchTimeoutError;
246
250
  }(makeError.BaseError);
247
- function fetchTimeout(inputFetch) {
251
+ /**
252
+ * Wraps a fetch function to add automatic timeout/abort support. If a timeout value
253
+ * is present on the RequestInit or Request and no abort signal is already provided,
254
+ * an AbortController is created to abort the request after the specified duration.
255
+ *
256
+ * @param inputFetch - the fetch function to wrap with timeout behavior
257
+ * @returns a wrapped fetch function that enforces timeouts via AbortController
258
+ */ function fetchTimeout(inputFetch) {
248
259
  return function(input, init) {
249
260
  var _ref;
250
261
  var controller;
@@ -270,7 +281,7 @@ function fetchTimeout(inputFetch) {
270
281
  };
271
282
  }
272
283
 
273
- function _array_like_to_array$2(arr, len) {
284
+ function _array_like_to_array$3(arr, len) {
274
285
  if (len == null || len > arr.length) len = arr.length;
275
286
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
276
287
  return arr2;
@@ -389,19 +400,19 @@ function _object_spread_props$2(target, source) {
389
400
  return target;
390
401
  }
391
402
  function _sliced_to_array$2(arr, i) {
392
- return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$2();
403
+ return _array_with_holes$2(arr) || _iterable_to_array_limit$2(arr, i) || _unsupported_iterable_to_array$3(arr, i) || _non_iterable_rest$2();
393
404
  }
394
405
  function _type_of$3(obj) {
395
406
  "@swc/helpers - typeof";
396
407
  return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
397
408
  }
398
- function _unsupported_iterable_to_array$2(o, minLen) {
409
+ function _unsupported_iterable_to_array$3(o, minLen) {
399
410
  if (!o) return;
400
- if (typeof o === "string") return _array_like_to_array$2(o, minLen);
411
+ if (typeof o === "string") return _array_like_to_array$3(o, minLen);
401
412
  var n = Object.prototype.toString.call(o).slice(8, -1);
402
413
  if (n === "Object" && o.constructor) n = o.constructor.name;
403
414
  if (n === "Map" || n === "Set") return Array.from(n);
404
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
415
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$3(o, minLen);
405
416
  }
406
417
  function _ts_generator$4(thisArg, body) {
407
418
  var f, y, t, _ = {
@@ -509,7 +520,7 @@ function _ts_generator$4(thisArg, body) {
509
520
  * @returns
510
521
  */ function fetchService(config) {
511
522
  var inputMakeFetch = config.makeFetch, makeRequest = config.makeRequest, baseRequest = config.baseRequest;
512
- var factory = {
523
+ return {
513
524
  fetchRequestFactory: function fetchRequestFactory1(config) {
514
525
  return fetchRequestFactory(_object_spread$3({
515
526
  makeRequest: makeRequest,
@@ -526,10 +537,10 @@ function _ts_generator$4(thisArg, body) {
526
537
  },
527
538
  makeRequest: config.makeRequest
528
539
  };
529
- return factory;
530
540
  }
531
541
  /**
532
542
  * Default FetchHabdler
543
+ *
533
544
  * @param request
534
545
  * @param makeFetch
535
546
  * @returns
@@ -587,7 +598,13 @@ function _ts_generator$4(thisArg, body) {
587
598
  */ var DEFAULT_FETCH_REQUEST_FACTORY = function DEFAULT_FETCH_REQUEST_FACTORY(input, init) {
588
599
  return new Request(input, init);
589
600
  };
590
- function fetchRequestFactory(config) {
601
+ /**
602
+ * Creates a FetchRequestFactory that builds Request objects by applying base URL resolution,
603
+ * base request init merging, timeout configuration, and custom request init transformations.
604
+ *
605
+ * @param config - configuration for URL resolution, base request defaults, timeout, and request init transformations
606
+ * @returns a FetchRequestFactory that produces fully configured Request objects
607
+ */ function fetchRequestFactory(config) {
591
608
  var _config_makeRequest = config.makeRequest, makeRequest = _config_makeRequest === void 0 ? DEFAULT_FETCH_REQUEST_FACTORY : _config_makeRequest, inputBaseUrl = config.baseUrl, inputBaseRequest = config.baseRequest, timeout = config.timeout, requestInitFactory = config.requestInitFactory, _config_useBaseUrlForConfiguredFetchRequests = config.useBaseUrlForConfiguredFetchRequests, useBaseUrlForConfiguredFetchRequests = _config_useBaseUrlForConfiguredFetchRequests === void 0 ? false : _config_useBaseUrlForConfiguredFetchRequests, _config_forceBaseUrlForWebsiteUrlWithPrefix = config.forceBaseUrlForWebsiteUrlWithPrefix, forceBaseUrlForWebsiteUrlWithPrefix = _config_forceBaseUrlForWebsiteUrlWithPrefix === void 0 ? useBaseUrlForConfiguredFetchRequests : _config_forceBaseUrlForWebsiteUrlWithPrefix;
592
609
  var baseUrl = inputBaseUrl ? new URL(util.removeTrailingSlashes(inputBaseUrl)) : undefined;
593
610
  var buildUrl = baseUrl ? function(url) {
@@ -706,7 +723,7 @@ function fetchRequestFactory(config) {
706
723
  if (inputBaseRequest != null || timeout != null) {
707
724
  var computeBaseRequest = function computeBaseRequest() {
708
725
  return _async_to_generator$4(function() {
709
- var computedBaseRequest, baseRequest;
726
+ var computedBaseRequest;
710
727
  return _ts_generator$4(this, function(_state) {
711
728
  switch(_state.label){
712
729
  case 0:
@@ -716,12 +733,11 @@ function fetchRequestFactory(config) {
716
733
  ];
717
734
  case 1:
718
735
  computedBaseRequest = _state.sent();
719
- baseRequest = timeout ? _object_spread_props$2(_object_spread$3({}, computedBaseRequest), {
720
- timeout: timeout
721
- }) : computedBaseRequest;
722
736
  return [
723
737
  2,
724
- baseRequest
738
+ timeout ? _object_spread_props$2(_object_spread$3({}, computedBaseRequest), {
739
+ timeout: timeout
740
+ }) : computedBaseRequest
725
741
  ];
726
742
  }
727
743
  });
@@ -829,11 +845,18 @@ function fetchRequestFactory(config) {
829
845
  })();
830
846
  };
831
847
  }
832
- function mergeRequestInits(base, requestInit) {
848
+ /**
849
+ * Merges two RequestInit objects, combining their headers and spreading remaining properties
850
+ * so that values from the second init override the base.
851
+ *
852
+ * @param base - the base RequestInit to merge onto
853
+ * @param requestInit - optional RequestInit whose values override the base
854
+ * @returns the merged RequestInit
855
+ */ function mergeRequestInits(base, requestInit) {
833
856
  if (requestInit) {
834
857
  var headers = mergeRequestHeaders([
835
858
  base.headers,
836
- requestInit === null || requestInit === void 0 ? void 0 : requestInit.headers
859
+ requestInit.headers
837
860
  ]);
838
861
  return _object_spread_props$2(_object_spread$3({}, base, requestInit), {
839
862
  headers: headers
@@ -842,7 +865,13 @@ function mergeRequestInits(base, requestInit) {
842
865
  return base;
843
866
  }
844
867
  }
845
- function mergeRequestHeaders(inputHeadersArray) {
868
+ /**
869
+ * Merges an array of HeadersInit values into a single array of key-value tuples.
870
+ * Later headers override earlier ones on a per-key basis while preserving multi-value support.
871
+ *
872
+ * @param inputHeadersArray - array of HeadersInit values to merge, where later entries take precedence
873
+ * @returns an array of [key, value] tuples representing the merged headers
874
+ */ function mergeRequestHeaders(inputHeadersArray) {
846
875
  var headersMap = util.multiValueMapBuilder();
847
876
  util.filterMaybeArrayValues(inputHeadersArray).forEach(function(headers) {
848
877
  var tuples = headersToHeadersTuple(headers);
@@ -860,7 +889,13 @@ function mergeRequestHeaders(inputHeadersArray) {
860
889
  });
861
890
  return headersMap.tuples();
862
891
  }
863
- function headersToHeadersTuple(headers) {
892
+ /**
893
+ * Converts a HeadersInit value (tuple array, Headers object, or plain object) into
894
+ * a normalized array of [key, value] tuples.
895
+ *
896
+ * @param headers - the HeadersInit value to convert
897
+ * @returns an array of [key, value] string tuples
898
+ */ function headersToHeadersTuple(headers) {
864
899
  var tuples = [];
865
900
  if (Array.isArray(headers)) {
866
901
  // use as tuples
@@ -879,7 +914,13 @@ function headersToHeadersTuple(headers) {
879
914
  }
880
915
  return tuples;
881
916
  }
882
- function isFetchRequest(input) {
917
+ /**
918
+ * Type guard that checks whether the given input is a fetch Request object
919
+ * by testing for the presence of a url property.
920
+ *
921
+ * @param input - the value to test
922
+ * @returns true if the input is a Request
923
+ */ function isFetchRequest(input) {
883
924
  return Boolean(input.url);
884
925
  }
885
926
 
@@ -1014,8 +1055,8 @@ function _ts_generator$3(thisArg, body) {
1014
1055
  /**
1015
1056
  * Creates a File object from the given input.
1016
1057
  *
1017
- * @example
1018
- * makeFileForFetch({ content: pdfBuffer, fileName: 'doc.pdf', mimeType: 'application/pdf' })
1058
+ * @param input - configuration containing the file content, name, optional MIME type, and last modified timestamp
1059
+ * @returns a File object constructed from the provided input
1019
1060
  */ function makeFileForFetch(input) {
1020
1061
  var options = {};
1021
1062
  if (input.mimeType) {
@@ -1096,7 +1137,11 @@ function fetchFileFromUrl(input, safe) {
1096
1137
  }
1097
1138
  /**
1098
1139
  * @deprecated Use makeFileForFetch() with FormData and context.fetch() instead.
1099
- */ function fetchUploadFile(input) {
1140
+ *
1141
+ * @param input - configuration containing the upload URL, fetch function, HTTP method, and file body
1142
+ * @returns a promise resolving to the fetch Response
1143
+ */ // eslint-disable-next-line @typescript-eslint/no-deprecated
1144
+ function fetchUploadFile(input) {
1100
1145
  var _input_method;
1101
1146
  var inputFetch = input.fetch, url = input.url, inputBody = input.body;
1102
1147
  var useFetch = inputFetch !== null && inputFetch !== void 0 ? inputFetch : fetch;
@@ -1237,7 +1282,13 @@ function _ts_generator$2(thisArg, body) {
1237
1282
  };
1238
1283
  }
1239
1284
  }
1240
- function rateLimitedFetchHandler(config) {
1285
+ /**
1286
+ * Creates a FetchHandler that enforces rate limiting via the provided PromiseRateLimiter and supports
1287
+ * automatic retry when the server signals throttling.
1288
+ *
1289
+ * @param config - configuration containing the rate limiter, retry settings, and response handler
1290
+ * @returns a RateLimitedFetchHandler that rate-limits outgoing requests and retries on throttle responses
1291
+ */ function rateLimitedFetchHandler(config) {
1241
1292
  var updateWithResponse = config.updateWithResponse, inputMaxRetries = config.maxRetries;
1242
1293
  var maxRetries = inputMaxRetries !== null && inputMaxRetries !== void 0 ? inputMaxRetries : 1;
1243
1294
  var _rateLimiter = config.rateLimiter;
@@ -1245,7 +1296,7 @@ function rateLimitedFetchHandler(config) {
1245
1296
  return _async_to_generator$2(function() {
1246
1297
  function tryFetch(retriesAttempted) {
1247
1298
  return _async_to_generator$2(function() {
1248
- var response, fetchResponseError, e, shouldRetry, _tmp;
1299
+ var response, fetchResponseError, e, shouldRetry;
1249
1300
  return _ts_generator$2(this, function(_state) {
1250
1301
  switch(_state.label){
1251
1302
  case 0:
@@ -1283,50 +1334,33 @@ function rateLimitedFetchHandler(config) {
1283
1334
  5
1284
1335
  ];
1285
1336
  case 5:
1286
- if (!response) return [
1287
- 3,
1288
- 7
1289
- ];
1290
1337
  return [
1291
1338
  4,
1292
1339
  updateWithResponse(response, fetchResponseError)
1293
1340
  ];
1294
1341
  case 6:
1295
- _tmp = _state.sent();
1296
- return [
1297
- 3,
1298
- 8
1299
- ];
1300
- case 7:
1301
- _tmp = false;
1302
- _state.label = 8;
1303
- case 8:
1304
- shouldRetry = _tmp;
1342
+ shouldRetry = _state.sent();
1305
1343
  if (!(shouldRetry && retriesAttempted < maxRetries)) return [
1306
1344
  3,
1307
- 10
1345
+ 8
1308
1346
  ];
1309
1347
  return [
1310
1348
  4,
1311
1349
  tryFetch(retriesAttempted + 1)
1312
1350
  ];
1313
- case 9:
1351
+ case 7:
1314
1352
  response = _state.sent();
1315
1353
  return [
1316
1354
  3,
1317
- 11
1355
+ 9
1318
1356
  ];
1319
- case 10:
1357
+ case 8:
1320
1358
  // re-throw the fetch response error if it exists and we cannot retry
1321
1359
  if (fetchResponseError != null) {
1322
1360
  throw fetchResponseError;
1323
1361
  }
1324
- _state.label = 11;
1325
- case 11:
1326
- // if response is null at this point but fetchResponseError is not, rethrow the error
1327
- if (response == null && fetchResponseError != null) {
1328
- throw fetchResponseError;
1329
- }
1362
+ _state.label = 9;
1363
+ case 9:
1330
1364
  return [
1331
1365
  2,
1332
1366
  response
@@ -1699,7 +1733,7 @@ var FetchPageLimitReachedError = /*#__PURE__*/ function(FetchRequestFactoryError
1699
1733
  };
1700
1734
  }
1701
1735
 
1702
- function _array_like_to_array$1(arr, len) {
1736
+ function _array_like_to_array$2(arr, len) {
1703
1737
  if (len == null || len > arr.length) len = arr.length;
1704
1738
  for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
1705
1739
  return arr2;
@@ -1811,15 +1845,15 @@ function _object_spread_props$1(target, source) {
1811
1845
  return target;
1812
1846
  }
1813
1847
  function _sliced_to_array$1(arr, i) {
1814
- return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$1(arr, i) || _non_iterable_rest$1();
1848
+ return _array_with_holes$1(arr) || _iterable_to_array_limit$1(arr, i) || _unsupported_iterable_to_array$2(arr, i) || _non_iterable_rest$1();
1815
1849
  }
1816
- function _unsupported_iterable_to_array$1(o, minLen) {
1850
+ function _unsupported_iterable_to_array$2(o, minLen) {
1817
1851
  if (!o) return;
1818
- if (typeof o === "string") return _array_like_to_array$1(o, minLen);
1852
+ if (typeof o === "string") return _array_like_to_array$2(o, minLen);
1819
1853
  var n = Object.prototype.toString.call(o).slice(8, -1);
1820
1854
  if (n === "Object" && o.constructor) n = o.constructor.name;
1821
1855
  if (n === "Map" || n === "Set") return Array.from(n);
1822
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
1856
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$2(o, minLen);
1823
1857
  }
1824
1858
  function _ts_generator(thisArg, body) {
1825
1859
  var f, y, t, _ = {
@@ -1955,32 +1989,23 @@ function _ts_generator(thisArg, body) {
1955
1989
  iterateFetchPagesByItems(_object_spread_props$1(_object_spread$1({}, config), {
1956
1990
  iteratePageItems: function iteratePageItems(items, fetchPageResult, startIndex) {
1957
1991
  return _async_to_generator(function() {
1958
- var itemIndexPairs, performTasksResults;
1992
+ var itemIndexPairs;
1959
1993
  return _ts_generator(this, function(_state) {
1960
- switch(_state.label){
1961
- case 0:
1962
- itemIndexPairs = items.map(function(x, i) {
1963
- return [
1964
- x,
1965
- i + startIndex
1966
- ];
1967
- });
1968
- return [
1969
- 4,
1970
- util.performAsyncTasks(itemIndexPairs, function(param) {
1971
- var _param = _sliced_to_array$1(param, 2), item = _param[0], i = _param[1];
1972
- return iterateEachPageItem(item, i, fetchPageResult);
1973
- }, _object_spread$1({
1974
- sequential: true
1975
- }, iteratePerformTasksConfig))
1976
- ];
1977
- case 1:
1978
- performTasksResults = _state.sent();
1979
- return [
1980
- 2,
1981
- performTasksResults
1982
- ];
1983
- }
1994
+ itemIndexPairs = items.map(function(x, i) {
1995
+ return [
1996
+ x,
1997
+ i + startIndex
1998
+ ];
1999
+ });
2000
+ return [
2001
+ 2,
2002
+ util.performAsyncTasks(itemIndexPairs, function(param) {
2003
+ var _param = _sliced_to_array$1(param, 2), item = _param[0], i = _param[1];
2004
+ return iterateEachPageItem(item, i, fetchPageResult);
2005
+ }, _object_spread$1({
2006
+ sequential: true
2007
+ }, iteratePerformTasksConfig))
2008
+ ];
1984
2009
  });
1985
2010
  })();
1986
2011
  }
@@ -2187,12 +2212,37 @@ function iterateFetchPages(config) {
2187
2212
  })();
2188
2213
  }
2189
2214
 
2215
+ function _array_like_to_array$1(arr, len) {
2216
+ if (len == null || len > arr.length) len = arr.length;
2217
+ for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
2218
+ return arr2;
2219
+ }
2220
+ function _array_without_holes(arr) {
2221
+ if (Array.isArray(arr)) return _array_like_to_array$1(arr);
2222
+ }
2223
+ function _iterable_to_array(iter) {
2224
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
2225
+ }
2226
+ function _non_iterable_spread() {
2227
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2228
+ }
2229
+ function _to_consumable_array(arr) {
2230
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array$1(arr) || _non_iterable_spread();
2231
+ }
2232
+ function _unsupported_iterable_to_array$1(o, minLen) {
2233
+ if (!o) return;
2234
+ if (typeof o === "string") return _array_like_to_array$1(o, minLen);
2235
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2236
+ if (n === "Object" && o.constructor) n = o.constructor.name;
2237
+ if (n === "Map" || n === "Set") return Array.from(n);
2238
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array$1(o, minLen);
2239
+ }
2190
2240
  /**
2191
2241
  * Creates URLSearchParams from the input objects. The input objects are merged together.
2192
2242
  *
2193
- * @param input
2194
- * @param omitKeys
2195
- * @returns
2243
+ * @param input - one or more objects (or nullish values) whose key-value pairs become search parameters
2244
+ * @param options - optional configuration for filtering, omitting keys, and space encoding
2245
+ * @returns a URLSearchParams instance built from the merged and filtered input
2196
2246
  */ function makeUrlSearchParams(input, options) {
2197
2247
  var _ref = options !== null && options !== void 0 ? options : {}, omitKeys = _ref.omitKeys, filterValues = _ref.filterEmptyValues;
2198
2248
  var mergedInput = Array.isArray(input) ? util.mergeObjects(input) : input;
@@ -2223,6 +2273,9 @@ function iterateFetchPages(config) {
2223
2273
  }
2224
2274
  /**
2225
2275
  * Merges an array of MakeUrlSearchParamsOptions into a single MakeUrlSearchParamsOptions value.
2276
+ *
2277
+ * @param options - one or more options objects whose omitKeys sets are combined
2278
+ * @returns a single MakeUrlSearchParamsOptions with the union of all omitKeys
2226
2279
  */ function mergeMakeUrlSearchParamsOptions(options) {
2227
2280
  var omitKeys = new Set();
2228
2281
  util.useIterableOrValue(options, function(x) {
@@ -2233,7 +2286,7 @@ function iterateFetchPages(config) {
2233
2286
  }
2234
2287
  });
2235
2288
  return {
2236
- omitKeys: omitKeys.size > 0 ? Array.from(omitKeys) : undefined
2289
+ omitKeys: omitKeys.size > 0 ? _to_consumable_array(omitKeys) : undefined
2237
2290
  };
2238
2291
  }
2239
2292
 
@@ -2294,7 +2347,13 @@ function _unsupported_iterable_to_array(o, minLen) {
2294
2347
  if (n === "Map" || n === "Set") return Array.from(n);
2295
2348
  if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
2296
2349
  }
2297
- function fetchURL(input) {
2350
+ /**
2351
+ * Resolves a FetchURLInput to a URL string. Handles plain strings, URL objects, and
2352
+ * FetchURLConfiguration objects by appending query parameters when provided.
2353
+ *
2354
+ * @param input - a string, URL, or FetchURLConfiguration to resolve
2355
+ * @returns the resolved URL as a string
2356
+ */ function fetchURL(input) {
2298
2357
  var url;
2299
2358
  if (typeof input === 'string') {
2300
2359
  url = input;
@@ -2315,10 +2374,20 @@ function fetchURL(input) {
2315
2374
  }
2316
2375
  return url;
2317
2376
  }
2318
- function isURL(input) {
2377
+ /**
2378
+ * Type guard that checks whether the given value is a URL instance.
2379
+ *
2380
+ * @param input - the value to test
2381
+ * @returns true if the input is a URL instance
2382
+ */ function isURL(input) {
2319
2383
  return (typeof input === "undefined" ? "undefined" : _type_of$1(input)) === 'object' && _instanceof(input, URL);
2320
2384
  }
2321
- function isURLSearchParams(input) {
2385
+ /**
2386
+ * Type guard that checks whether the given value is a URLSearchParams instance.
2387
+ *
2388
+ * @param input - the value to test
2389
+ * @returns true if the input is a URLSearchParams instance
2390
+ */ function isURLSearchParams(input) {
2322
2391
  return (typeof input === "undefined" ? "undefined" : _type_of$1(input)) === 'object' && _instanceof(input, URLSearchParams);
2323
2392
  }
2324
2393
  /**
@@ -2346,7 +2415,13 @@ function isURLSearchParams(input) {
2346
2415
  });
2347
2416
  return paramTuples;
2348
2417
  }
2349
- function queryParamsToSearchParams(input) {
2418
+ /**
2419
+ * Converts a FetchURLQueryParamsInput value (URLSearchParams, string, iterable of tuples, or
2420
+ * params object) into a URLSearchParams instance.
2421
+ *
2422
+ * @param input - the query parameters input to convert
2423
+ * @returns a URLSearchParams instance representing the input
2424
+ */ function queryParamsToSearchParams(input) {
2350
2425
  var result;
2351
2426
  if (isURLSearchParams(input)) {
2352
2427
  // by url search params
@@ -2361,22 +2436,24 @@ function queryParamsToSearchParams(input) {
2361
2436
  }
2362
2437
  return result;
2363
2438
  }
2364
- function fetchURLSearchParamsObjectToURLSearchParams(input) {
2439
+ /**
2440
+ * Converts a FetchURLSearchParamsObject (a plain key-value record) into a URLSearchParams instance,
2441
+ * expanding array values into multiple entries for the same key and filtering out null/undefined values.
2442
+ *
2443
+ * @param input - the params object to convert
2444
+ * @returns a URLSearchParams instance representing the input object
2445
+ */ function fetchURLSearchParamsObjectToURLSearchParams(input) {
2365
2446
  var paramTuples = [];
2366
2447
  util.forEachKeyValue(input, {
2367
2448
  forEach: function forEach(tuple) {
2368
2449
  var _tuple = _sliced_to_array(tuple, 2), key = _tuple[0], values = _tuple[1];
2369
- // ignore null/undefined keys and values
2370
- if (key != null && values != null) {
2371
- var keyString = String(key);
2450
+ var keyString = String(key);
2451
+ if (values != null) {
2372
2452
  util.useIterableOrValue(values, function(x) {
2373
- // ignore null/undefined values
2374
- if (x != null) {
2375
- paramTuples.push([
2376
- keyString,
2377
- String(x)
2378
- ]);
2379
- }
2453
+ paramTuples.push([
2454
+ keyString,
2455
+ String(x)
2456
+ ]);
2380
2457
  });
2381
2458
  }
2382
2459
  }
@@ -2560,11 +2637,15 @@ var JsonResponseParseError = /*#__PURE__*/ function(Error1) {
2560
2637
  var throwJsonResponseParseErrorFunction = function throwJsonResponseParseErrorFunction(response) {
2561
2638
  throw new JsonResponseParseError(response);
2562
2639
  };
2563
- var returnNullHandleFetchJsonParseErrorFunction = function returnNullHandleFetchJsonParseErrorFunction(_) {
2640
+ var returnNullHandleFetchJsonParseErrorFunction = function returnNullHandleFetchJsonParseErrorFunction(_response) {
2564
2641
  return null;
2565
2642
  };
2566
2643
  /**
2567
2644
  * Creates a FetchJsonFunction from the input ConfiguredFetch.
2645
+ *
2646
+ * @param fetch - the configured fetch function to use for making HTTP requests
2647
+ * @param inputConfig - optional configuration or error handler for JSON parsing; when a function is provided it is used as the parse error handler
2648
+ * @returns a FetchJsonFunction that performs requests and parses JSON responses
2568
2649
  */ function fetchJsonFunction(fetch, inputConfig) {
2569
2650
  var _config_handleFetchJsonParseErrorFunction;
2570
2651
  var config;
@@ -2596,18 +2677,19 @@ var returnNullHandleFetchJsonParseErrorFunction = function returnNullHandleFetch
2596
2677
  });
2597
2678
  };
2598
2679
  }
2599
- function fetchJsonRequestInitFunction() {
2680
+ /**
2681
+ * Creates a {@link FetchJsonRequestInitFunction} that converts method/body inputs into a fully formed {@link RequestInit},
2682
+ * applying the configured default method and optional input mapping.
2683
+ *
2684
+ * @param config - optional configuration specifying the default HTTP method and an input mapping function
2685
+ * @returns a function that produces a {@link RequestInit} from a method string or {@link FetchJsonInput}
2686
+ */ function fetchJsonRequestInitFunction() {
2600
2687
  var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
2601
2688
  var _config_defaultMethod = config.defaultMethod, defaultMethod = _config_defaultMethod === void 0 ? 'GET' : _config_defaultMethod, _config_mapFetchJsonInput = config.mapFetchJsonInput, mapFetchJsonInput = _config_mapFetchJsonInput === void 0 ? util.mapIdentityFunction() : _config_mapFetchJsonInput;
2602
2689
  return function() {
2603
2690
  var methodOrInput = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : defaultMethod, body = arguments.length > 1 ? arguments[1] : void 0;
2604
- var _config_method;
2605
2691
  var config;
2606
- if (methodOrInput === null) {
2607
- config = {
2608
- method: defaultMethod
2609
- };
2610
- } else if (typeof methodOrInput === 'string') {
2692
+ if (typeof methodOrInput === 'string') {
2611
2693
  config = {
2612
2694
  method: methodOrInput,
2613
2695
  body: body
@@ -2617,7 +2699,7 @@ function fetchJsonRequestInitFunction() {
2617
2699
  }
2618
2700
  config = mapFetchJsonInput(config);
2619
2701
  var requestInit = _object_spread_props(_object_spread({}, config), {
2620
- method: (_config_method = config.method) !== null && _config_method !== void 0 ? _config_method : defaultMethod,
2702
+ method: config.method,
2621
2703
  body: fetchJsonBodyString(config.body)
2622
2704
  });
2623
2705
  return requestInit;