@dereekb/util 13.11.14 → 13.11.15
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/index.cjs.js +10008 -394
- package/eslint/index.esm.js +9982 -392
- package/eslint/package.json +4 -4
- package/eslint/src/lib/comments.d.ts +14 -3
- package/eslint/src/lib/dbx-tag-families.d.ts +280 -0
- package/eslint/src/lib/index.d.ts +26 -3
- package/eslint/src/lib/jsdoc-parser.d.ts +116 -0
- package/eslint/src/lib/no-inline-string-empty-object-intersection.rule.d.ts +44 -0
- package/eslint/src/lib/no-inline-type-import.rule.d.ts +38 -0
- package/eslint/src/lib/no-sister-re-export.rule.d.ts +69 -0
- package/eslint/src/lib/plugin.d.ts +52 -1
- package/eslint/src/lib/prefer-canonical-jsdoc.rule.d.ts +68 -0
- package/eslint/src/lib/prefer-config-object.rule.d.ts +61 -0
- package/eslint/src/lib/prefer-maybe-type.rule.d.ts +72 -0
- package/eslint/src/lib/prefer-no-side-effects-in-jsdoc.rule.d.ts +1 -1
- package/eslint/src/lib/prefer-suggested-string.rule.d.ts +51 -0
- package/eslint/src/lib/require-constant-naming.rule.d.ts +63 -0
- package/eslint/src/lib/require-dbx-action-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-auth-companion-tags.rule.d.ts +45 -0
- package/eslint/src/lib/require-dbx-docs-ui-example-companion-tags.rule.d.ts +42 -0
- package/eslint/src/lib/require-dbx-filter-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-dbx-form-field-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-model-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-model-firebase-index-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-model-snapshot-field-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-pipe-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-dbx-rule-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-util-companion-tags.rule.d.ts +74 -0
- package/eslint/src/lib/require-dbx-web-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-default-prefix-naming.rule.d.ts +60 -0
- package/eslint/src/lib/require-deprecated-alias-placement.rule.d.ts +75 -0
- package/eslint/src/lib/require-exported-jsdoc-example.rule.d.ts +61 -0
- package/eslint/src/lib/require-no-side-effects.rule.d.ts +1 -1
- package/eslint/src/lib/require-readonly-config-params.rule.d.ts +57 -0
- package/eslint/src/lib/require-single-return.rule.d.ts +42 -0
- package/fetch/index.cjs.js +95 -80
- package/fetch/index.esm.js +95 -80
- package/fetch/package.json +2 -2
- package/fetch/src/lib/error.d.ts +2 -2
- package/fetch/src/lib/fetch.d.ts +15 -15
- package/fetch/src/lib/fetch.file.d.ts +5 -5
- package/fetch/src/lib/fetch.limit.d.ts +2 -2
- package/fetch/src/lib/fetch.page.d.ts +1 -1
- package/fetch/src/lib/fetch.page.iterate.d.ts +4 -4
- package/fetch/src/lib/fetch.type.d.ts +3 -2
- package/fetch/src/lib/fetch.url.d.ts +13 -13
- package/fetch/src/lib/json.d.ts +12 -12
- package/fetch/src/lib/timeout.d.ts +2 -2
- package/fetch/src/lib/url.d.ts +11 -11
- package/index.cjs.js +2592 -2329
- package/index.esm.js +2590 -2327
- package/package.json +1 -1
- package/src/lib/array/array.boolean.d.ts +20 -20
- package/src/lib/array/array.d.ts +73 -72
- package/src/lib/array/array.factory.d.ts +8 -5
- package/src/lib/array/array.filter.d.ts +23 -20
- package/src/lib/array/array.find.d.ts +9 -8
- package/src/lib/array/array.index.d.ts +15 -14
- package/src/lib/array/array.indexed.d.ts +22 -19
- package/src/lib/array/array.make.d.ts +3 -2
- package/src/lib/array/array.map.d.ts +5 -5
- package/src/lib/array/array.number.d.ts +27 -27
- package/src/lib/array/array.random.d.ts +11 -10
- package/src/lib/array/array.set.d.ts +14 -14
- package/src/lib/array/array.string.d.ts +31 -31
- package/src/lib/array/array.unique.d.ts +22 -20
- package/src/lib/array/array.value.d.ts +3 -2
- package/src/lib/assertion/assert.error.d.ts +8 -8
- package/src/lib/assertion/assertion.d.ts +5 -5
- package/src/lib/assertion/assertion.generic.d.ts +3 -3
- package/src/lib/assertion/assertion.number.d.ts +6 -6
- package/src/lib/auth/auth.role.claims.d.ts +12 -11
- package/src/lib/auth/auth.role.d.ts +3 -3
- package/src/lib/auth/pkce.d.ts +2 -2
- package/src/lib/boolean.d.ts +11 -11
- package/src/lib/cache/cache.memoize.d.ts +6 -6
- package/src/lib/contact/domain.d.ts +9 -9
- package/src/lib/contact/email.d.ts +11 -11
- package/src/lib/contact/phone.d.ts +12 -12
- package/src/lib/contact/random.d.ts +11 -9
- package/src/lib/date/date.d.ts +60 -59
- package/src/lib/date/date.time.d.ts +2 -2
- package/src/lib/date/date.unix.d.ts +8 -8
- package/src/lib/date/duration.d.ts +17 -17
- package/src/lib/date/expires.d.ts +29 -27
- package/src/lib/date/hour.d.ts +23 -23
- package/src/lib/date/minute.d.ts +6 -6
- package/src/lib/date/time.d.ts +10 -9
- package/src/lib/date/week.d.ts +32 -31
- package/src/lib/encryption/encryption.object.d.ts +3 -3
- package/src/lib/error/error.d.ts +13 -12
- package/src/lib/error/error.server.d.ts +4 -4
- package/src/lib/file/pdf.d.ts +4 -4
- package/src/lib/filter/filter.d.ts +3 -2
- package/src/lib/function/function.boolean.d.ts +4 -3
- package/src/lib/function/function.forward.d.ts +6 -4
- package/src/lib/getter/getter.d.ts +24 -19
- package/src/lib/getter/getter.map.d.ts +6 -5
- package/src/lib/getter/getter.util.d.ts +3 -2
- package/src/lib/grouping.d.ts +25 -24
- package/src/lib/hash.d.ts +11 -10
- package/src/lib/iterable/iterable.d.ts +39 -39
- package/src/lib/iterable/iterable.map.d.ts +3 -3
- package/src/lib/key.d.ts +16 -16
- package/src/lib/map/map.d.ts +12 -12
- package/src/lib/map/map.intersection.d.ts +3 -3
- package/src/lib/map/map.key.d.ts +16 -14
- package/src/lib/misc/host.d.ts +2 -2
- package/src/lib/model/id.batch.d.ts +4 -3
- package/src/lib/model/id.factory.d.ts +4 -3
- package/src/lib/model/model.conversion.d.ts +19 -14
- package/src/lib/model/model.conversion.field.d.ts +2 -2
- package/src/lib/model/model.copy.d.ts +5 -4
- package/src/lib/model/model.d.ts +48 -46
- package/src/lib/model/model.modify.d.ts +10 -8
- package/src/lib/nodejs/stream.d.ts +6 -5
- package/src/lib/number/bitwise.dencoder.d.ts +12 -12
- package/src/lib/number/bound.d.ts +16 -13
- package/src/lib/number/dollar.d.ts +6 -5
- package/src/lib/number/encoded.d.ts +7 -7
- package/src/lib/number/factory.d.ts +4 -3
- package/src/lib/number/number.d.ts +37 -37
- package/src/lib/number/random.d.ts +11 -10
- package/src/lib/number/round.d.ts +34 -30
- package/src/lib/number/sort.d.ts +3 -2
- package/src/lib/number/transform.d.ts +5 -4
- package/src/lib/object/object.array.d.ts +6 -6
- package/src/lib/object/object.array.delta.d.ts +3 -2
- package/src/lib/object/object.d.ts +12 -12
- package/src/lib/object/object.empty.d.ts +3 -3
- package/src/lib/object/object.equal.d.ts +11 -10
- package/src/lib/object/object.filter.pojo.d.ts +74 -74
- package/src/lib/object/object.filter.tuple.d.ts +26 -26
- package/src/lib/object/object.flatten.d.ts +4 -4
- package/src/lib/object/object.key.d.ts +6 -4
- package/src/lib/object/object.map.d.ts +15 -13
- package/src/lib/page/page.d.ts +5 -5
- package/src/lib/page/page.filter.d.ts +8 -8
- package/src/lib/path/path.d.ts +98 -88
- package/src/lib/promise/callback.d.ts +2 -2
- package/src/lib/promise/is.d.ts +6 -6
- package/src/lib/promise/poll.d.ts +9 -9
- package/src/lib/promise/promise.d.ts +33 -30
- package/src/lib/promise/promise.factory.d.ts +4 -3
- package/src/lib/promise/promise.loop.d.ts +11 -11
- package/src/lib/promise/promise.task.d.ts +6 -5
- package/src/lib/promise/promise.type.d.ts +3 -3
- package/src/lib/promise/use.d.ts +3 -3
- package/src/lib/relation/relation.d.ts +15 -15
- package/src/lib/service/handler.config.d.ts +20 -16
- package/src/lib/service/handler.d.ts +3 -2
- package/src/lib/service/typed.service.d.ts +2 -2
- package/src/lib/set/set.d.ts +62 -59
- package/src/lib/set/set.delta.d.ts +5 -4
- package/src/lib/set/set.hashset.d.ts +5 -5
- package/src/lib/set/set.selection.d.ts +5 -4
- package/src/lib/sort.d.ts +11 -11
- package/src/lib/storage/storage.d.ts +2 -1
- package/src/lib/storage/storage.error.d.ts +4 -4
- package/src/lib/storage/storage.memory.d.ts +7 -7
- package/src/lib/storage/storage.object.d.ts +5 -5
- package/src/lib/string/case.d.ts +6 -6
- package/src/lib/string/char.d.ts +30 -29
- package/src/lib/string/dencoder.d.ts +25 -20
- package/src/lib/string/factory.d.ts +11 -8
- package/src/lib/string/html.d.ts +19 -19
- package/src/lib/string/mimetype.d.ts +9 -8
- package/src/lib/string/prefix.d.ts +8 -8
- package/src/lib/string/replace.d.ts +45 -39
- package/src/lib/string/search.d.ts +5 -4
- package/src/lib/string/sort.d.ts +13 -4
- package/src/lib/string/string.d.ts +44 -43
- package/src/lib/string/transform.d.ts +32 -23
- package/src/lib/string/tree.d.ts +5 -4
- package/src/lib/string/url.d.ts +5 -4
- package/src/lib/tree/tree.array.d.ts +5 -4
- package/src/lib/tree/tree.expand.d.ts +6 -6
- package/src/lib/tree/tree.explore.d.ts +13 -10
- package/src/lib/tree/tree.flatten.d.ts +10 -10
- package/src/lib/type.d.ts +42 -12
- package/src/lib/value/address.d.ts +7 -7
- package/src/lib/value/bound.d.ts +70 -66
- package/src/lib/value/build.d.ts +6 -6
- package/src/lib/value/comparator.d.ts +19 -17
- package/src/lib/value/cron.d.ts +2 -2
- package/src/lib/value/decision.d.ts +6 -5
- package/src/lib/value/equal.d.ts +11 -9
- package/src/lib/value/indexed.d.ts +101 -85
- package/src/lib/value/label.d.ts +2 -2
- package/src/lib/value/map.d.ts +20 -16
- package/src/lib/value/maybe.d.ts +36 -36
- package/src/lib/value/modifier.d.ts +24 -23
- package/src/lib/value/point.d.ts +85 -77
- package/src/lib/value/url.d.ts +2 -2
- package/src/lib/value/use.d.ts +36 -33
- package/src/lib/value/vector.d.ts +15 -14
- package/test/index.cjs.js +41 -36
- package/test/index.esm.js +41 -36
- package/test/package.json +2 -2
- package/test/src/lib/jest/jest.fail.d.ts +2 -2
- package/test/src/lib/shared/shared.d.ts +20 -20
- package/test/src/lib/shared/shared.fail.d.ts +21 -16
- package/test/src/lib/shared/shared.function.d.ts +4 -4
- package/test/src/lib/shared/shared.wrap.d.ts +10 -10
package/fetch/index.esm.js
CHANGED
|
@@ -115,8 +115,8 @@ var FetchResponseError = /*#__PURE__*/ function(BaseError) {
|
|
|
115
115
|
/**
|
|
116
116
|
* Asserts that the fetch response has an ok status code, throwing a FetchResponseError if it does not.
|
|
117
117
|
*
|
|
118
|
-
* @param responsePromise -
|
|
119
|
-
* @returns
|
|
118
|
+
* @param responsePromise - Pending fetch result whose status must be validated.
|
|
119
|
+
* @returns Same response when the status is ok; otherwise the rejected error.
|
|
120
120
|
*/ function requireOkResponse(responsePromise) {
|
|
121
121
|
return responsePromise.then(function(response) {
|
|
122
122
|
if (!response.ok) {
|
|
@@ -251,8 +251,8 @@ var FetchTimeoutError = /*#__PURE__*/ function(BaseError) {
|
|
|
251
251
|
* is present on the RequestInit or Request and no abort signal is already provided,
|
|
252
252
|
* an AbortController is created to abort the request after the specified duration.
|
|
253
253
|
*
|
|
254
|
-
* @param inputFetch -
|
|
255
|
-
* @returns
|
|
254
|
+
* @param inputFetch - The fetch function to wrap with timeout behavior.
|
|
255
|
+
* @returns A wrapped fetch function that enforces timeouts via AbortController.
|
|
256
256
|
*/ function fetchTimeout(inputFetch) {
|
|
257
257
|
return function(input, init) {
|
|
258
258
|
var _ref;
|
|
@@ -266,7 +266,7 @@ var FetchTimeoutError = /*#__PURE__*/ function(BaseError) {
|
|
|
266
266
|
signal: abortController.signal // pass the abort signal
|
|
267
267
|
});
|
|
268
268
|
}
|
|
269
|
-
var responsePromise = inputFetch(input, init);
|
|
269
|
+
var responsePromise = inputFetch(input, init !== null && init !== void 0 ? init : undefined);
|
|
270
270
|
if (timeout) {
|
|
271
271
|
var timeoutId = setTimeout(function() {
|
|
272
272
|
controller === null || controller === void 0 ? void 0 : controller.abort();
|
|
@@ -538,7 +538,7 @@ function _ts_generator$4(thisArg, body) {
|
|
|
538
538
|
};
|
|
539
539
|
}
|
|
540
540
|
/**
|
|
541
|
-
* Default FetchHabdler
|
|
541
|
+
* Default FetchHabdler.
|
|
542
542
|
*
|
|
543
543
|
* @param request
|
|
544
544
|
* @param makeFetch
|
|
@@ -595,14 +595,14 @@ function _ts_generator$4(thisArg, body) {
|
|
|
595
595
|
* @param init
|
|
596
596
|
* @returns
|
|
597
597
|
*/ var DEFAULT_FETCH_REQUEST_FACTORY = function DEFAULT_FETCH_REQUEST_FACTORY(input, init) {
|
|
598
|
-
return new Request(input, init);
|
|
598
|
+
return new Request(input, init !== null && init !== void 0 ? init : undefined);
|
|
599
599
|
};
|
|
600
600
|
/**
|
|
601
601
|
* Creates a FetchRequestFactory that builds Request objects by applying base URL resolution,
|
|
602
602
|
* base request init merging, timeout configuration, and custom request init transformations.
|
|
603
603
|
*
|
|
604
|
-
* @param config -
|
|
605
|
-
* @returns
|
|
604
|
+
* @param config - Configuration for URL resolution, base request defaults, timeout, and request init transformations.
|
|
605
|
+
* @returns A FetchRequestFactory that produces fully configured Request objects.
|
|
606
606
|
*/ function fetchRequestFactory(config) {
|
|
607
607
|
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;
|
|
608
608
|
var baseUrl = inputBaseUrl ? new URL(removeTrailingSlashes(inputBaseUrl)) : undefined;
|
|
@@ -806,7 +806,7 @@ function _ts_generator$4(thisArg, body) {
|
|
|
806
806
|
fixedRequest = _state.sent();
|
|
807
807
|
return [
|
|
808
808
|
4,
|
|
809
|
-
buildRequestInit(fixedRequest, init)
|
|
809
|
+
buildRequestInit(fixedRequest, init !== null && init !== void 0 ? init : undefined)
|
|
810
810
|
];
|
|
811
811
|
case 2:
|
|
812
812
|
init = _state.sent();
|
|
@@ -841,9 +841,9 @@ function _ts_generator$4(thisArg, body) {
|
|
|
841
841
|
* Merges two RequestInit objects, combining their headers and spreading remaining properties
|
|
842
842
|
* so that values from the second init override the base.
|
|
843
843
|
*
|
|
844
|
-
* @param base -
|
|
845
|
-
* @param requestInit -
|
|
846
|
-
* @returns
|
|
844
|
+
* @param base - The base RequestInit to merge onto.
|
|
845
|
+
* @param requestInit - Optional RequestInit whose values override the base.
|
|
846
|
+
* @returns The merged RequestInit.
|
|
847
847
|
*/ function mergeRequestInits(base, requestInit) {
|
|
848
848
|
var result;
|
|
849
849
|
if (requestInit) {
|
|
@@ -863,8 +863,8 @@ function _ts_generator$4(thisArg, body) {
|
|
|
863
863
|
* Merges an array of HeadersInit values into a single array of key-value tuples.
|
|
864
864
|
* Later headers override earlier ones on a per-key basis while preserving multi-value support.
|
|
865
865
|
*
|
|
866
|
-
* @param inputHeadersArray -
|
|
867
|
-
* @returns
|
|
866
|
+
* @param inputHeadersArray - Header sources to combine; later entries override earlier ones per header name.
|
|
867
|
+
* @returns Combined [key, value] tuples representing the merged headers in iteration order.
|
|
868
868
|
*/ function mergeRequestHeaders(inputHeadersArray) {
|
|
869
869
|
var headersMap = multiValueMapBuilder();
|
|
870
870
|
filterMaybeArrayValues(inputHeadersArray).forEach(function(headers) {
|
|
@@ -887,8 +887,8 @@ function _ts_generator$4(thisArg, body) {
|
|
|
887
887
|
* Converts a HeadersInit value (tuple array, Headers object, or plain object) into
|
|
888
888
|
* a normalized array of [key, value] tuples.
|
|
889
889
|
*
|
|
890
|
-
* @param headers -
|
|
891
|
-
* @returns
|
|
890
|
+
* @param headers - Header input in any supported shape to normalize.
|
|
891
|
+
* @returns Tuple list usable as input to multi-value header merging.
|
|
892
892
|
*/ function headersToHeadersTuple(headers) {
|
|
893
893
|
var tuples = [];
|
|
894
894
|
if (Array.isArray(headers)) {
|
|
@@ -912,8 +912,8 @@ function _ts_generator$4(thisArg, body) {
|
|
|
912
912
|
* Type guard that checks whether the given input is a fetch Request object
|
|
913
913
|
* by testing for the presence of a url property.
|
|
914
914
|
*
|
|
915
|
-
* @param input -
|
|
916
|
-
* @returns
|
|
915
|
+
* @param input - The value to test.
|
|
916
|
+
* @returns True if the input is a Request.
|
|
917
917
|
*/ function isFetchRequest(input) {
|
|
918
918
|
return Boolean(input.url);
|
|
919
919
|
}
|
|
@@ -1049,8 +1049,8 @@ function _ts_generator$3(thisArg, body) {
|
|
|
1049
1049
|
/**
|
|
1050
1050
|
* Creates a File object from the given input.
|
|
1051
1051
|
*
|
|
1052
|
-
* @param input -
|
|
1053
|
-
* @returns
|
|
1052
|
+
* @param input - Configuration containing the file content, name, optional MIME type, and last modified timestamp.
|
|
1053
|
+
* @returns A File object constructed from the provided input.
|
|
1054
1054
|
*/ function makeFileForFetch(input) {
|
|
1055
1055
|
var options = {};
|
|
1056
1056
|
if (input.mimeType) {
|
|
@@ -1130,10 +1130,10 @@ function fetchFileFromUrl(input, safe) {
|
|
|
1130
1130
|
};
|
|
1131
1131
|
}
|
|
1132
1132
|
/**
|
|
1133
|
-
* @
|
|
1133
|
+
* @param input - Upload request inputs (target URL, fetch implementation, HTTP method, and file body) used to issue the request.
|
|
1134
|
+
* @returns Resolved upload response from the underlying fetch call.
|
|
1134
1135
|
*
|
|
1135
|
-
* @
|
|
1136
|
-
* @returns a promise resolving to the fetch Response
|
|
1136
|
+
* @deprecated Use makeFileForFetch() with FormData and context.fetch() instead.
|
|
1137
1137
|
*/ // eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
1138
1138
|
function fetchUploadFile(input) {
|
|
1139
1139
|
var _input_method;
|
|
@@ -1280,8 +1280,8 @@ function _ts_generator$2(thisArg, body) {
|
|
|
1280
1280
|
* Creates a FetchHandler that enforces rate limiting via the provided PromiseRateLimiter and supports
|
|
1281
1281
|
* automatic retry when the server signals throttling.
|
|
1282
1282
|
*
|
|
1283
|
-
* @param config -
|
|
1284
|
-
* @returns
|
|
1283
|
+
* @param config - Configuration containing the rate limiter, retry settings, and response handler.
|
|
1284
|
+
* @returns A RateLimitedFetchHandler that rate-limits outgoing requests and retries on throttle responses.
|
|
1285
1285
|
*/ function rateLimitedFetchHandler(config) {
|
|
1286
1286
|
var updateWithResponse = config.updateWithResponse, inputMaxRetries = config.maxRetries;
|
|
1287
1287
|
var maxRetries = inputMaxRetries !== null && inputMaxRetries !== void 0 ? inputMaxRetries : 1;
|
|
@@ -1619,7 +1619,7 @@ var FetchPageLimitReachedError = /*#__PURE__*/ function(FetchRequestFactoryError
|
|
|
1619
1619
|
}(FetchRequestFactoryError);
|
|
1620
1620
|
/**
|
|
1621
1621
|
* Default max page for a FetchPageFactory.
|
|
1622
|
-
*/ var
|
|
1622
|
+
*/ var DEFAULT_FETCH_PAGE_FACTORY_MAX_PAGE = 100;
|
|
1623
1623
|
/**
|
|
1624
1624
|
* Creates a new FetchPageFactory from the input.
|
|
1625
1625
|
*
|
|
@@ -1630,7 +1630,7 @@ var FetchPageLimitReachedError = /*#__PURE__*/ function(FetchRequestFactoryError
|
|
|
1630
1630
|
return function(initalInput, options) {
|
|
1631
1631
|
var _ref = options !== null && options !== void 0 ? options : {}, tmp = _ref.maxPage, inputMaxPage = tmp === void 0 ? defaultMaxPage : tmp, inputMaxItemsPerPage = _ref.maxItemsPerPage;
|
|
1632
1632
|
var maxItemsPerPage = inputMaxItemsPerPage !== null && inputMaxItemsPerPage !== void 0 ? inputMaxItemsPerPage : defaultMaxItemsPerPage;
|
|
1633
|
-
var maxPage = inputMaxPage === null ? Number.MAX_SAFE_INTEGER : inputMaxPage !== null && inputMaxPage !== void 0 ? inputMaxPage :
|
|
1633
|
+
var maxPage = inputMaxPage === null ? Number.MAX_SAFE_INTEGER : inputMaxPage !== null && inputMaxPage !== void 0 ? inputMaxPage : DEFAULT_FETCH_PAGE_FACTORY_MAX_PAGE;
|
|
1634
1634
|
function fetchNextWithInput(input) {
|
|
1635
1635
|
var previous = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : undefined;
|
|
1636
1636
|
return function() {
|
|
@@ -1959,8 +1959,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1959
1959
|
* Each item's callback receives a global index that reflects its position across all pages,
|
|
1960
1960
|
* not just within the current page.
|
|
1961
1961
|
*
|
|
1962
|
-
* @param config - Configuration specifying the fetch page source, item extraction, and per-item callback
|
|
1963
|
-
* @returns Combined result from {@link iterateFetchPagesByItems} including page/item counts and per-item task results
|
|
1962
|
+
* @param config - Configuration specifying the fetch page source, item extraction, and per-item callback.
|
|
1963
|
+
* @returns Combined result from {@link iterateFetchPagesByItems} including page/item counts and per-item task results.
|
|
1964
1964
|
*
|
|
1965
1965
|
* @example
|
|
1966
1966
|
* ```typescript
|
|
@@ -2019,7 +2019,7 @@ function _ts_generator(thisArg, body) {
|
|
|
2019
2019
|
*
|
|
2020
2020
|
* For per-item processing instead of batch processing, use {@link iterateFetchPagesByEachItem}.
|
|
2021
2021
|
*
|
|
2022
|
-
* @param config - Configuration specifying fetch source, item extraction, filtering, limits, and batch callback
|
|
2022
|
+
* @param config - Configuration specifying fetch source, item extraction, filtering, limits, and batch callback.
|
|
2023
2023
|
* @returns Result with page count and item counters (loaded and visited)
|
|
2024
2024
|
*
|
|
2025
2025
|
* @example
|
|
@@ -2105,35 +2105,47 @@ function iterateFetchPages(config) {
|
|
|
2105
2105
|
var _ref, _ref1, iteratePage, inputFetchPage, input, fetchPageFactory, usePageResult, maxParallelPages, waitBetweenPages, maxPage, maxItemsPerPage, endEarly, hasReachedEnd, fetchPage, currentNextPage, performTaskFn, result;
|
|
2106
2106
|
function taskInputFactory() {
|
|
2107
2107
|
return _async_to_generator(function() {
|
|
2108
|
+
var result;
|
|
2108
2109
|
return _ts_generator(this, function(_state) {
|
|
2109
2110
|
switch(_state.label){
|
|
2110
2111
|
case 0:
|
|
2111
|
-
if (hasReachedEnd)
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2123
|
-
|
|
2112
|
+
if (!hasReachedEnd) return [
|
|
2113
|
+
3,
|
|
2114
|
+
1
|
|
2115
|
+
];
|
|
2116
|
+
result = null; // issue no more tasks
|
|
2117
|
+
return [
|
|
2118
|
+
3,
|
|
2119
|
+
4
|
|
2120
|
+
];
|
|
2121
|
+
case 1:
|
|
2122
|
+
if (!(currentNextPage != null && (currentNextPage.isAtMaxPage || !currentNextPage.hasNext))) return [
|
|
2123
|
+
3,
|
|
2124
|
+
2
|
|
2125
|
+
];
|
|
2126
|
+
hasReachedEnd = true;
|
|
2127
|
+
result = null;
|
|
2128
|
+
return [
|
|
2129
|
+
3,
|
|
2130
|
+
4
|
|
2131
|
+
];
|
|
2132
|
+
case 2:
|
|
2124
2133
|
return [
|
|
2125
2134
|
4,
|
|
2126
2135
|
fetchPage.fetchNext()
|
|
2127
2136
|
];
|
|
2128
|
-
case
|
|
2137
|
+
case 3:
|
|
2129
2138
|
currentNextPage = _state.sent();
|
|
2130
2139
|
fetchPage = currentNextPage;
|
|
2140
|
+
result = {
|
|
2141
|
+
i: currentNextPage.page,
|
|
2142
|
+
fetchPageResult: currentNextPage
|
|
2143
|
+
};
|
|
2144
|
+
_state.label = 4;
|
|
2145
|
+
case 4:
|
|
2131
2146
|
return [
|
|
2132
2147
|
2,
|
|
2133
|
-
|
|
2134
|
-
i: currentNextPage.page,
|
|
2135
|
-
fetchPageResult: currentNextPage
|
|
2136
|
-
}
|
|
2148
|
+
result
|
|
2137
2149
|
];
|
|
2138
2150
|
}
|
|
2139
2151
|
});
|
|
@@ -2255,9 +2267,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
2255
2267
|
/**
|
|
2256
2268
|
* Creates URLSearchParams from the input objects. The input objects are merged together.
|
|
2257
2269
|
*
|
|
2258
|
-
* @param input -
|
|
2259
|
-
* @param options -
|
|
2260
|
-
* @returns
|
|
2270
|
+
* @param input - One or more objects (or nullish values) whose key-value pairs become search parameters.
|
|
2271
|
+
* @param options - Optional configuration for filtering, omitting keys, and space encoding.
|
|
2272
|
+
* @returns A URLSearchParams instance built from the merged and filtered input.
|
|
2261
2273
|
*/ function makeUrlSearchParams(input, options) {
|
|
2262
2274
|
var _ref = options !== null && options !== void 0 ? options : {}, omitKeys = _ref.omitKeys, filterValues = _ref.filterEmptyValues;
|
|
2263
2275
|
var mergedInput = Array.isArray(input) ? mergeObjects(input) : input;
|
|
@@ -2278,9 +2290,9 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
2278
2290
|
* RFC 3986 percent-encoded output (`%20` for spaces) instead of the
|
|
2279
2291
|
* `application/x-www-form-urlencoded` default (`+` for spaces).
|
|
2280
2292
|
*
|
|
2281
|
-
* @param input -
|
|
2282
|
-
* @param options -
|
|
2283
|
-
* @returns
|
|
2293
|
+
* @param input - Objects to encode as query parameters.
|
|
2294
|
+
* @param options - Encoding options.
|
|
2295
|
+
* @returns The encoded query string (without a leading `?`)
|
|
2284
2296
|
*/ function makeUrlSearchParamsString(input, options) {
|
|
2285
2297
|
var params = makeUrlSearchParams(input, options);
|
|
2286
2298
|
var str = params.toString();
|
|
@@ -2294,6 +2306,11 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
2294
2306
|
* {@link MakeUrlSearchParamsOptions} such as `omitKeys`, `filterEmptyValues`, and
|
|
2295
2307
|
* `useUrlSearchSpaceHandling`.
|
|
2296
2308
|
*
|
|
2309
|
+
* @param url - The URL string to update.
|
|
2310
|
+
* @param params - New search parameters to merge into the URL.
|
|
2311
|
+
* @param options - Optional configuration for filtering, omitting keys, and space encoding.
|
|
2312
|
+
* @returns The URL string with updated query parameters.
|
|
2313
|
+
*
|
|
2297
2314
|
* @example
|
|
2298
2315
|
* ```typescript
|
|
2299
2316
|
* // Add params to a URL with no query string
|
|
@@ -2308,11 +2325,6 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
2308
2325
|
* updateUrlSearchParams('https://example.com', { scope: 'openid profile' }, { useUrlSearchSpaceHandling: true });
|
|
2309
2326
|
* // => 'https://example.com?scope=openid%20profile'
|
|
2310
2327
|
* ```
|
|
2311
|
-
*
|
|
2312
|
-
* @param url - the URL string to update
|
|
2313
|
-
* @param params - new search parameters to merge into the URL
|
|
2314
|
-
* @param options - optional configuration for filtering, omitting keys, and space encoding
|
|
2315
|
-
* @returns the URL string with updated query parameters
|
|
2316
2328
|
*/ function updateUrlSearchParams(url, params, options) {
|
|
2317
2329
|
var _url_split = _sliced_to_array$1(url.split('?', 2), 2), basePath = _url_split[0], existingQuery = _url_split[1];
|
|
2318
2330
|
var existingParams = existingQuery ? new URLSearchParams(existingQuery) : new URLSearchParams();
|
|
@@ -2353,8 +2365,8 @@ function _unsupported_iterable_to_array$1(o, minLen) {
|
|
|
2353
2365
|
/**
|
|
2354
2366
|
* Merges an array of MakeUrlSearchParamsOptions into a single MakeUrlSearchParamsOptions value.
|
|
2355
2367
|
*
|
|
2356
|
-
* @param options -
|
|
2357
|
-
* @returns
|
|
2368
|
+
* @param options - One or more options objects whose omitKeys sets are combined.
|
|
2369
|
+
* @returns A single MakeUrlSearchParamsOptions with the union of all omitKeys.
|
|
2358
2370
|
*/ function mergeMakeUrlSearchParamsOptions(options) {
|
|
2359
2371
|
var omitKeys = new Set();
|
|
2360
2372
|
useIterableOrValue(options, function(x) {
|
|
@@ -2431,8 +2443,8 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
2431
2443
|
* Resolves a FetchURLInput to a URL string. Handles plain strings, URL objects, and
|
|
2432
2444
|
* FetchURLConfiguration objects by appending query parameters when provided.
|
|
2433
2445
|
*
|
|
2434
|
-
* @param input - a string
|
|
2435
|
-
* @returns
|
|
2446
|
+
* @param input - URL source to normalize; may already be a string or carry query parameters to append.
|
|
2447
|
+
* @returns Fully resolved request URL ready to pass to `fetch`.
|
|
2436
2448
|
*/ function fetchURL(input) {
|
|
2437
2449
|
var url;
|
|
2438
2450
|
if (typeof input === 'string') {
|
|
@@ -2457,21 +2469,21 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
2457
2469
|
/**
|
|
2458
2470
|
* Type guard that checks whether the given value is a URL instance.
|
|
2459
2471
|
*
|
|
2460
|
-
* @param input -
|
|
2461
|
-
* @returns
|
|
2472
|
+
* @param input - The value to test.
|
|
2473
|
+
* @returns True if the input is a URL instance.
|
|
2462
2474
|
*/ function isURL(input) {
|
|
2463
2475
|
return (typeof input === "undefined" ? "undefined" : _type_of$1(input)) === 'object' && _instanceof(input, URL);
|
|
2464
2476
|
}
|
|
2465
2477
|
/**
|
|
2466
2478
|
* Type guard that checks whether the given value is a URLSearchParams instance.
|
|
2467
2479
|
*
|
|
2468
|
-
* @param input -
|
|
2469
|
-
* @returns
|
|
2480
|
+
* @param input - The value to test.
|
|
2481
|
+
* @returns True if the input is a URLSearchParams instance.
|
|
2470
2482
|
*/ function isURLSearchParams(input) {
|
|
2471
2483
|
return (typeof input === "undefined" ? "undefined" : _type_of$1(input)) === 'object' && _instanceof(input, URLSearchParams);
|
|
2472
2484
|
}
|
|
2473
2485
|
/**
|
|
2474
|
-
* Converts the input
|
|
2486
|
+
* Converts the input.
|
|
2475
2487
|
*
|
|
2476
2488
|
* @param input
|
|
2477
2489
|
* @returns
|
|
@@ -2499,8 +2511,8 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
2499
2511
|
* Converts a FetchURLQueryParamsInput value (URLSearchParams, string, iterable of tuples, or
|
|
2500
2512
|
* params object) into a URLSearchParams instance.
|
|
2501
2513
|
*
|
|
2502
|
-
* @param input -
|
|
2503
|
-
* @returns
|
|
2514
|
+
* @param input - The query parameters input to convert.
|
|
2515
|
+
* @returns A URLSearchParams instance representing the input.
|
|
2504
2516
|
*/ function queryParamsToSearchParams(input) {
|
|
2505
2517
|
var result;
|
|
2506
2518
|
if (isURLSearchParams(input)) {
|
|
@@ -2520,8 +2532,8 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
2520
2532
|
* Converts a FetchURLSearchParamsObject (a plain key-value record) into a URLSearchParams instance,
|
|
2521
2533
|
* expanding array values into multiple entries for the same key and filtering out null/undefined values.
|
|
2522
2534
|
*
|
|
2523
|
-
* @param input -
|
|
2524
|
-
* @returns
|
|
2535
|
+
* @param input - The params object to convert.
|
|
2536
|
+
* @returns A URLSearchParams instance representing the input object.
|
|
2525
2537
|
*/ function fetchURLSearchParamsObjectToURLSearchParams(input) {
|
|
2526
2538
|
var paramTuples = [];
|
|
2527
2539
|
forEachKeyValue(input, {
|
|
@@ -2723,9 +2735,9 @@ var returnNullHandleFetchJsonParseErrorFunction = function returnNullHandleFetch
|
|
|
2723
2735
|
/**
|
|
2724
2736
|
* Creates a FetchJsonFunction from the input ConfiguredFetch.
|
|
2725
2737
|
*
|
|
2726
|
-
* @param fetch -
|
|
2727
|
-
* @param inputConfig -
|
|
2728
|
-
* @returns
|
|
2738
|
+
* @param fetch - The configured fetch function to use for making HTTP requests.
|
|
2739
|
+
* @param inputConfig - Optional configuration or error handler for JSON parsing; when a function is provided it is used as the parse error handler.
|
|
2740
|
+
* @returns A FetchJsonFunction that performs requests and parses JSON responses.
|
|
2729
2741
|
*/ function fetchJsonFunction(fetch, inputConfig) {
|
|
2730
2742
|
var _config_handleFetchJsonParseErrorFunction;
|
|
2731
2743
|
var config;
|
|
@@ -2761,8 +2773,8 @@ var returnNullHandleFetchJsonParseErrorFunction = function returnNullHandleFetch
|
|
|
2761
2773
|
* Creates a {@link FetchJsonRequestInitFunction} that converts method/body inputs into a fully formed {@link RequestInit},
|
|
2762
2774
|
* applying the configured default method and optional input mapping.
|
|
2763
2775
|
*
|
|
2764
|
-
* @param config -
|
|
2765
|
-
* @returns
|
|
2776
|
+
* @param config - Default-method and input-mapping overrides applied by the generated function.
|
|
2777
|
+
* @returns Reusable builder that resolves a `RequestInit` for each request.
|
|
2766
2778
|
*/ function fetchJsonRequestInitFunction() {
|
|
2767
2779
|
var config = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
2768
2780
|
var _config_defaultMethod = config.defaultMethod, defaultMethod = _config_defaultMethod === void 0 ? 'GET' : _config_defaultMethod, _config_mapFetchJsonInput = config.mapFetchJsonInput, mapFetchJsonInput = _config_mapFetchJsonInput === void 0 ? mapIdentityFunction() : _config_mapFetchJsonInput;
|
|
@@ -2775,7 +2787,10 @@ var returnNullHandleFetchJsonParseErrorFunction = function returnNullHandleFetch
|
|
|
2775
2787
|
body: body
|
|
2776
2788
|
};
|
|
2777
2789
|
} else {
|
|
2778
|
-
config = methodOrInput
|
|
2790
|
+
config = methodOrInput !== null && methodOrInput !== void 0 ? methodOrInput : {
|
|
2791
|
+
method: defaultMethod,
|
|
2792
|
+
body: body
|
|
2793
|
+
};
|
|
2779
2794
|
}
|
|
2780
2795
|
config = mapFetchJsonInput(config);
|
|
2781
2796
|
var requestInit = _object_spread_props(_object_spread({}, config), {
|
|
@@ -2796,4 +2811,4 @@ var fetchJsonRequestInit = fetchJsonRequestInitFunction();
|
|
|
2796
2811
|
}
|
|
2797
2812
|
});
|
|
2798
2813
|
|
|
2799
|
-
export { DEFAULT_FETCH_HANDLER,
|
|
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 };
|
package/fetch/package.json
CHANGED
package/fetch/src/lib/error.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare class FetchResponseError extends BaseError {
|
|
|
20
20
|
/**
|
|
21
21
|
* Asserts that the fetch response has an ok status code, throwing a FetchResponseError if it does not.
|
|
22
22
|
*
|
|
23
|
-
* @param responsePromise -
|
|
24
|
-
* @returns
|
|
23
|
+
* @param responsePromise - Pending fetch result whose status must be validated.
|
|
24
|
+
* @returns Same response when the status is ok; otherwise the rejected error.
|
|
25
25
|
*/
|
|
26
26
|
export declare function requireOkResponse(responsePromise: Promise<Response>): Promise<Response>;
|
package/fetch/src/lib/fetch.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export interface ConfigureFetchInput extends FetchRequestFactoryInput {
|
|
|
50
50
|
readonly mapResponse?: MapFetchResponseFunction;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
-
* Default FetchHabdler
|
|
53
|
+
* Default FetchHabdler.
|
|
54
54
|
*
|
|
55
55
|
* @param request
|
|
56
56
|
* @param makeFetch
|
|
@@ -100,8 +100,8 @@ export interface FetchRequestFactoryInput {
|
|
|
100
100
|
*/
|
|
101
101
|
readonly requestInitFactory?: FetchRequestInitFactory;
|
|
102
102
|
}
|
|
103
|
-
export type FetchRequestInitFactory = (currRequest: PromiseOrValue<Request>, init?: PromiseOrValue<RequestInit>) => PromiseOrValue<RequestInitWithTimeout
|
|
104
|
-
export type FetchRequestFactory = (input: RequestInfo | URL, init?: RequestInit
|
|
103
|
+
export type FetchRequestInitFactory = (currRequest: PromiseOrValue<Request>, init?: PromiseOrValue<RequestInit>) => PromiseOrValue<Maybe<RequestInitWithTimeout>>;
|
|
104
|
+
export type FetchRequestFactory = (input: RequestInfo | URL, init?: Maybe<RequestInit>) => PromiseOrValue<Request>;
|
|
105
105
|
export type AbortControllerFactory = Factory<AbortController>;
|
|
106
106
|
/**
|
|
107
107
|
* The deafult FetchRequestFactory implementation that uses window/global Request.
|
|
@@ -115,40 +115,40 @@ export declare const DEFAULT_FETCH_REQUEST_FACTORY: FetchRequestFactory;
|
|
|
115
115
|
* Creates a FetchRequestFactory that builds Request objects by applying base URL resolution,
|
|
116
116
|
* base request init merging, timeout configuration, and custom request init transformations.
|
|
117
117
|
*
|
|
118
|
-
* @param config -
|
|
119
|
-
* @returns
|
|
118
|
+
* @param config - Configuration for URL resolution, base request defaults, timeout, and request init transformations.
|
|
119
|
+
* @returns A FetchRequestFactory that produces fully configured Request objects.
|
|
120
120
|
*/
|
|
121
121
|
export declare function fetchRequestFactory(config: FetchRequestFactoryInput): FetchRequestFactory;
|
|
122
122
|
/**
|
|
123
123
|
* Merges two RequestInit objects, combining their headers and spreading remaining properties
|
|
124
124
|
* so that values from the second init override the base.
|
|
125
125
|
*
|
|
126
|
-
* @param base -
|
|
127
|
-
* @param requestInit -
|
|
128
|
-
* @returns
|
|
126
|
+
* @param base - The base RequestInit to merge onto.
|
|
127
|
+
* @param requestInit - Optional RequestInit whose values override the base.
|
|
128
|
+
* @returns The merged RequestInit.
|
|
129
129
|
*/
|
|
130
|
-
export declare function mergeRequestInits<T extends RequestInit>(base: T, requestInit?: T
|
|
130
|
+
export declare function mergeRequestInits<T extends RequestInit>(base: T, requestInit?: Maybe<T>): T;
|
|
131
131
|
/**
|
|
132
132
|
* Merges an array of HeadersInit values into a single array of key-value tuples.
|
|
133
133
|
* Later headers override earlier ones on a per-key basis while preserving multi-value support.
|
|
134
134
|
*
|
|
135
|
-
* @param inputHeadersArray -
|
|
136
|
-
* @returns
|
|
135
|
+
* @param inputHeadersArray - Header sources to combine; later entries override earlier ones per header name.
|
|
136
|
+
* @returns Combined [key, value] tuples representing the merged headers in iteration order.
|
|
137
137
|
*/
|
|
138
138
|
export declare function mergeRequestHeaders(inputHeadersArray: Maybe<HeadersInit>[]): [string, string][];
|
|
139
139
|
/**
|
|
140
140
|
* Converts a HeadersInit value (tuple array, Headers object, or plain object) into
|
|
141
141
|
* a normalized array of [key, value] tuples.
|
|
142
142
|
*
|
|
143
|
-
* @param headers -
|
|
144
|
-
* @returns
|
|
143
|
+
* @param headers - Header input in any supported shape to normalize.
|
|
144
|
+
* @returns Tuple list usable as input to multi-value header merging.
|
|
145
145
|
*/
|
|
146
146
|
export declare function headersToHeadersTuple(headers: HeadersInit): [string, string][];
|
|
147
147
|
/**
|
|
148
148
|
* Type guard that checks whether the given input is a fetch Request object
|
|
149
149
|
* by testing for the presence of a url property.
|
|
150
150
|
*
|
|
151
|
-
* @param input -
|
|
152
|
-
* @returns
|
|
151
|
+
* @param input - The value to test.
|
|
152
|
+
* @returns True if the input is a Request.
|
|
153
153
|
*/
|
|
154
154
|
export declare function isFetchRequest(input: unknown): input is Request;
|
|
@@ -29,8 +29,8 @@ export interface MakeFileForFetchInput {
|
|
|
29
29
|
/**
|
|
30
30
|
* Creates a File object from the given input.
|
|
31
31
|
*
|
|
32
|
-
* @param input -
|
|
33
|
-
* @returns
|
|
32
|
+
* @param input - Configuration containing the file content, name, optional MIME type, and last modified timestamp.
|
|
33
|
+
* @returns A File object constructed from the provided input.
|
|
34
34
|
*/
|
|
35
35
|
export declare function makeFileForFetch(input: MakeFileForFetchInput): File;
|
|
36
36
|
/**
|
|
@@ -109,9 +109,9 @@ export interface FetchUploadFileBody {
|
|
|
109
109
|
readonly body: BodyInit;
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
112
|
-
* @
|
|
112
|
+
* @param input - Upload request inputs (target URL, fetch implementation, HTTP method, and file body) used to issue the request.
|
|
113
|
+
* @returns Resolved upload response from the underlying fetch call.
|
|
113
114
|
*
|
|
114
|
-
* @
|
|
115
|
-
* @returns a promise resolving to the fetch Response
|
|
115
|
+
* @deprecated Use makeFileForFetch() with FormData and context.fetch() instead.
|
|
116
116
|
*/
|
|
117
117
|
export declare function fetchUploadFile(input: FetchUploadFile): Promise<Response>;
|
|
@@ -34,7 +34,7 @@ export interface RateLimitedFetchHandlerConfig<T extends PromiseRateLimiter> {
|
|
|
34
34
|
* Creates a FetchHandler that enforces rate limiting via the provided PromiseRateLimiter and supports
|
|
35
35
|
* automatic retry when the server signals throttling.
|
|
36
36
|
*
|
|
37
|
-
* @param config -
|
|
38
|
-
* @returns
|
|
37
|
+
* @param config - Configuration containing the rate limiter, retry settings, and response handler.
|
|
38
|
+
* @returns A RateLimitedFetchHandler that rate-limits outgoing requests and retries on throttle responses.
|
|
39
39
|
*/
|
|
40
40
|
export declare function rateLimitedFetchHandler<T extends PromiseRateLimiter>(config: RateLimitedFetchHandlerConfig<T>): RateLimitedFetchHandler<T>;
|
|
@@ -128,7 +128,7 @@ export type FetchPageFactory<I, O> = (input: I, options?: Maybe<FetchPageFactory
|
|
|
128
128
|
/**
|
|
129
129
|
* Default max page for a FetchPageFactory.
|
|
130
130
|
*/
|
|
131
|
-
export declare const
|
|
131
|
+
export declare const DEFAULT_FETCH_PAGE_FACTORY_MAX_PAGE = 100;
|
|
132
132
|
/**
|
|
133
133
|
* Creates a new FetchPageFactory from the input.
|
|
134
134
|
*
|
|
@@ -62,8 +62,8 @@ export type IterateFetchPagesByEachItemResult<T, R> = PerformAsyncTasksResult<It
|
|
|
62
62
|
* Each item's callback receives a global index that reflects its position across all pages,
|
|
63
63
|
* not just within the current page.
|
|
64
64
|
*
|
|
65
|
-
* @param config - Configuration specifying the fetch page source, item extraction, and per-item callback
|
|
66
|
-
* @returns Combined result from {@link iterateFetchPagesByItems} including page/item counts and per-item task results
|
|
65
|
+
* @param config - Configuration specifying the fetch page source, item extraction, and per-item callback.
|
|
66
|
+
* @returns Combined result from {@link iterateFetchPagesByItems} including page/item counts and per-item task results.
|
|
67
67
|
*
|
|
68
68
|
* @example
|
|
69
69
|
* ```typescript
|
|
@@ -189,7 +189,7 @@ export interface IterateFetchPagesByItemsResult<I, O, T, R> extends IterateFetch
|
|
|
189
189
|
*
|
|
190
190
|
* For per-item processing instead of batch processing, use {@link iterateFetchPagesByEachItem}.
|
|
191
191
|
*
|
|
192
|
-
* @param config - Configuration specifying fetch source, item extraction, filtering, limits, and batch callback
|
|
192
|
+
* @param config - Configuration specifying fetch source, item extraction, filtering, limits, and batch callback.
|
|
193
193
|
* @returns Result with page count and item counters (loaded and visited)
|
|
194
194
|
*
|
|
195
195
|
* @example
|
|
@@ -319,7 +319,7 @@ export interface BaseIterateFetchPagesConfig<I, O, R> extends FetchPageFactoryIn
|
|
|
319
319
|
* @param pageResult - The complete iteration result for the most recent page
|
|
320
320
|
* @returns `true` to stop iteration after this page
|
|
321
321
|
*/
|
|
322
|
-
endEarly?: DecisionFunction<IterateFetchPagesIterationResult<I, O, R>>;
|
|
322
|
+
readonly endEarly?: DecisionFunction<IterateFetchPagesIterationResult<I, O, R>>;
|
|
323
323
|
}
|
|
324
324
|
/**
|
|
325
325
|
* Intermediate result produced after processing a single page during iteration.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Maybe } from '@dereekb/util';
|
|
1
2
|
/**
|
|
2
3
|
* The HTTP method to use for the request.
|
|
3
4
|
*
|
|
@@ -5,7 +6,7 @@
|
|
|
5
6
|
*/
|
|
6
7
|
export type FetchMethod = Request['method'];
|
|
7
8
|
export interface RequestTimeoutRef {
|
|
8
|
-
timeout?: number
|
|
9
|
+
timeout?: Maybe<number>;
|
|
9
10
|
}
|
|
10
11
|
/**
|
|
11
12
|
* RequestInit with timeout provided.
|
|
@@ -15,4 +16,4 @@ export interface RequestInitWithTimeout extends RequestInit, RequestTimeoutRef {
|
|
|
15
16
|
export interface RequestWithTimeout extends Request, RequestTimeoutRef {
|
|
16
17
|
}
|
|
17
18
|
export type ConfiguredFetch = typeof fetch;
|
|
18
|
-
export type ConfiguredFetchWithTimeout = (input: Parameters<typeof fetch>[0], init?: RequestInitWithTimeout
|
|
19
|
+
export type ConfiguredFetchWithTimeout = (input: Parameters<typeof fetch>[0], init?: Maybe<RequestInitWithTimeout>) => ReturnType<typeof fetch>;
|