@dereekb/util 11.0.6 → 11.0.8

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.
@@ -4922,7 +4922,7 @@ function fetchTimeout(inputFetch) {
4922
4922
  * @returns
4923
4923
  */
4924
4924
 
4925
- function _await$1(value, then, direct) {
4925
+ function _await$2(value, then, direct) {
4926
4926
  if (direct) {
4927
4927
  return then ? then(value) : value;
4928
4928
  }
@@ -4937,7 +4937,7 @@ function _await$1(value, then, direct) {
4937
4937
  * @returns
4938
4938
  */
4939
4939
 
4940
- function _async$1(f) {
4940
+ function _async$2(f) {
4941
4941
  return function () {
4942
4942
  for (var args = [], i = 0; i < arguments.length; i++) {
4943
4943
  args[i] = arguments[i];
@@ -5022,8 +5022,8 @@ function configureFetch(config) {
5022
5022
  makeFetch = fetchOk(makeFetch);
5023
5023
  }
5024
5024
  const makeFetchRequest = fetchRequestFactory(config);
5025
- return _async$1(function (input, init) {
5026
- return _await$1(makeFetchRequest(input, init), function (request) {
5025
+ return _async$2(function (input, init) {
5026
+ return _await$2(makeFetchRequest(input, init), function (request) {
5027
5027
  let response = makeFetch(request);
5028
5028
  if (mapResponse) {
5029
5029
  response = mapResponse(response);
@@ -5033,9 +5033,9 @@ function configureFetch(config) {
5033
5033
  });
5034
5034
  }
5035
5035
  function fetchRequestFactory(config) {
5036
- const asFetchRequest = _async$1(function (input) {
5036
+ const asFetchRequest = _async$2(function (input) {
5037
5037
  const _isPromiseLike = util.isPromiseLike(input);
5038
- return _await$1(input, function (awaitedInput) {
5038
+ return _await$2(input, function (awaitedInput) {
5039
5039
  if (isFetchRequest(awaitedInput)) {
5040
5040
  return awaitedInput;
5041
5041
  } else {
@@ -5058,7 +5058,7 @@ function fetchRequestFactory(config) {
5058
5058
  const result = new URL(urlPath, baseUrl);
5059
5059
  return result;
5060
5060
  } : undefined;
5061
- const buildRequestWithFixedUrl = buildUrl ? _async$1(function (input) {
5061
+ const buildRequestWithFixedUrl = buildUrl ? _async$2(function (input) {
5062
5062
  let relativeUrl;
5063
5063
  let baseRequest;
5064
5064
  let request;
@@ -5074,7 +5074,7 @@ function fetchRequestFactory(config) {
5074
5074
  request = input;
5075
5075
  }
5076
5076
  } else {
5077
- return _await$1(makeRequest(input), function (_makeRequest) {
5077
+ return _await$2(makeRequest(input), function (_makeRequest) {
5078
5078
  request = _makeRequest;
5079
5079
  });
5080
5080
  }
@@ -5083,7 +5083,7 @@ function fetchRequestFactory(config) {
5083
5083
  return _invoke(function () {
5084
5084
  if (!request) {
5085
5085
  const url = buildUrl(relativeUrl);
5086
- return _await$1(makeRequest(url.href, baseRequest), function (_makeRequest2) {
5086
+ return _await$2(makeRequest(url.href, baseRequest), function (_makeRequest2) {
5087
5087
  request = _makeRequest2;
5088
5088
  });
5089
5089
  }
@@ -5096,7 +5096,7 @@ function fetchRequestFactory(config) {
5096
5096
  if (inputBaseRequest != null || timeout != null) {
5097
5097
  const combineRequestInits = function combineRequestInits(request, requestInit) {
5098
5098
  return _call(computeBaseRequest, function (baseRequest) {
5099
- return _await$1(requestInit, function (_requestInit) {
5099
+ return _await$2(requestInit, function (_requestInit) {
5100
5100
  const merged = mergeRequestInits(baseRequest, _requestInit);
5101
5101
  const timeout = merged.timeout === undefined ? request.timeout : merged.timeout;
5102
5102
  return Object.assign({}, merged, {
@@ -5124,12 +5124,12 @@ function fetchRequestFactory(config) {
5124
5124
  } else {
5125
5125
  buildRequestInit = (_, x) => x;
5126
5126
  }
5127
- return _async$1(function (input, init) {
5127
+ return _async$2(function (input, init) {
5128
5128
  return _catch(function () {
5129
- return _await$1(buildRequestWithFixedUrl(input), function (fixedRequest) {
5130
- return _await$1(buildRequestInit(fixedRequest, init), function (_buildRequestInit) {
5129
+ return _await$2(buildRequestWithFixedUrl(input), function (fixedRequest) {
5130
+ return _await$2(buildRequestInit(fixedRequest, init), function (_buildRequestInit) {
5131
5131
  init = _buildRequestInit;
5132
- return _await$1(makeRequest(fixedRequest, init), function (request) {
5132
+ return _await$2(makeRequest(fixedRequest, init), function (request) {
5133
5133
  request.timeout = timeout; // copy/set timeout on the request directly
5134
5134
  return request;
5135
5135
  });
@@ -5191,7 +5191,7 @@ function isFetchRequest(input) {
5191
5191
  return Boolean(input.url);
5192
5192
  }
5193
5193
 
5194
- function _await(value, then, direct) {
5194
+ function _await$1(value, then, direct) {
5195
5195
  if (direct) {
5196
5196
  return then ? then(value) : value;
5197
5197
  }
@@ -5200,7 +5200,7 @@ function _await(value, then, direct) {
5200
5200
  }
5201
5201
  return then ? value.then(then) : value;
5202
5202
  }
5203
- function _async(f) {
5203
+ function _async$1(f) {
5204
5204
  return function () {
5205
5205
  for (var args = [], i = 0; i < arguments.length; i++) {
5206
5206
  args[i] = arguments[i];
@@ -5243,17 +5243,20 @@ function fetchPageFactory(config) {
5243
5243
  fetch,
5244
5244
  readFetchPageResultInfo,
5245
5245
  buildInputForNextPage,
5246
- defaultMaxPage
5246
+ defaultMaxPage,
5247
+ defaultMaxItemsPerPage
5247
5248
  } = config;
5248
5249
  return (initalInput, options) => {
5249
5250
  const {
5250
- maxPage: inputMaxPage = defaultMaxPage
5251
+ maxPage: inputMaxPage = defaultMaxPage,
5252
+ maxItemsPerPage: inputMaxItemsPerPage
5251
5253
  } = options != null ? options : {};
5254
+ const maxItemsPerPage = inputMaxItemsPerPage != null ? inputMaxItemsPerPage : defaultMaxItemsPerPage;
5252
5255
  const maxPage = inputMaxPage === null ? Number.MAX_SAFE_INTEGER : inputMaxPage != null ? inputMaxPage : FETCH_PAGE_FACTORY_DEFAULT_MAX_PAGE;
5253
5256
  function fetchNextWithInput(input, previous = undefined) {
5254
- return _async(function () {
5255
- return _await(fetch(input), function (result) {
5256
- return _await(readFetchPageResultInfo(result), function ({
5257
+ return _async$1(function () {
5258
+ return _await$1(fetch(input), function (result) {
5259
+ return _await$1(readFetchPageResultInfo(result), function ({
5257
5260
  cursor,
5258
5261
  hasNext: readHasNext
5259
5262
  }) {
@@ -5268,13 +5271,16 @@ function fetchPageFactory(config) {
5268
5271
  hasNext,
5269
5272
  isAtMaxPage,
5270
5273
  cursor,
5271
- fetchNext: util.cachedGetter(_async(function () {
5274
+ fetchNext: util.cachedGetter(_async$1(function () {
5272
5275
  // assert max page
5273
5276
  if (isAtMaxPage) {
5274
5277
  throw new FetchPageLimitReachedError(nextPageResult, maxPage);
5275
5278
  }
5276
5279
  // assert next page
5277
- return _await(hasNext ? buildInputForNextPage(nextPageResult, input) : undefined, function (nextPageInfo) {
5280
+ return _await$1(hasNext ? buildInputForNextPage(nextPageResult, input, {
5281
+ maxPage,
5282
+ maxItemsPerPage
5283
+ }) : undefined, function (nextPageInfo) {
5278
5284
  if (!nextPageInfo) {
5279
5285
  throw new FetchPageNoNextPageError(nextPageResult);
5280
5286
  }
@@ -5295,6 +5301,152 @@ function fetchPageFactory(config) {
5295
5301
  };
5296
5302
  }
5297
5303
 
5304
+ /**
5305
+ * Iterates through the pages of a created FetchPage instance.
5306
+ *
5307
+ * @param config
5308
+ * @returns
5309
+ */
5310
+
5311
+ function _async(f) {
5312
+ return function () {
5313
+ for (var args = [], i = 0; i < arguments.length; i++) {
5314
+ args[i] = arguments[i];
5315
+ }
5316
+ try {
5317
+ return Promise.resolve(f.apply(this, args));
5318
+ } catch (e) {
5319
+ return Promise.reject(e);
5320
+ }
5321
+ };
5322
+ }
5323
+ function _await(value, then, direct) {
5324
+ if (direct) {
5325
+ return then ? then(value) : value;
5326
+ }
5327
+ if (!value || !value.then) {
5328
+ value = Promise.resolve(value);
5329
+ }
5330
+ return then ? value.then(then) : value;
5331
+ }
5332
+ const iterateFetchPages = _async(function (config) {
5333
+ const taskInputFactory = _async(function () {
5334
+ if (hasReachedEnd) {
5335
+ return null; // issue no more tasks
5336
+ }
5337
+
5338
+ if (currentNextPage != null && (currentNextPage.isAtMaxPage || !currentNextPage.hasNext)) {
5339
+ hasReachedEnd = true;
5340
+ return null;
5341
+ }
5342
+ return _await(fetchPage.fetchNext(), function (_fetchPage$fetchNext) {
5343
+ currentNextPage = _fetchPage$fetchNext;
5344
+ fetchPage = currentNextPage;
5345
+ return {
5346
+ i: currentNextPage.page,
5347
+ fetchPageResult: currentNextPage
5348
+ };
5349
+ });
5350
+ });
5351
+ const {
5352
+ iteratePage,
5353
+ fetchPage: inputFetchPage,
5354
+ input,
5355
+ fetchPageFactory,
5356
+ usePageResult,
5357
+ maxParallelPages,
5358
+ waitBetweenPages,
5359
+ maxPage,
5360
+ maxItemsPerPage,
5361
+ endEarly
5362
+ } = config;
5363
+ let hasReachedEnd = false;
5364
+ let fetchPage = inputFetchPage != null ? inputFetchPage : fetchPageFactory(input, {
5365
+ maxPage,
5366
+ maxItemsPerPage
5367
+ });
5368
+ let currentNextPage;
5369
+ const performTaskFn = util.performTasksFromFactoryInParallelFunction({
5370
+ maxParallelTasks: maxParallelPages,
5371
+ waitBetweenTasks: waitBetweenPages,
5372
+ taskFactory: _async(function ({
5373
+ i,
5374
+ fetchPageResult
5375
+ }) {
5376
+ return _await(iteratePage(fetchPageResult), function (result) {
5377
+ const iterationResult = {
5378
+ i,
5379
+ fetchPageResult,
5380
+ result
5381
+ };
5382
+ return _await(usePageResult == null ? void 0 : usePageResult(iterationResult), function () {
5383
+ const shouldEndEarly = endEarly == null ? void 0 : endEarly(iterationResult);
5384
+ if (shouldEndEarly) {
5385
+ hasReachedEnd = true;
5386
+ }
5387
+ });
5388
+ });
5389
+ })
5390
+ });
5391
+ return _await(performTaskFn(taskInputFactory), function () {
5392
+ var _currentNextPage$page, _currentNextPage, _currentNextPage$isAt, _currentNextPage2;
5393
+ const result = {
5394
+ totalPages: ((_currentNextPage$page = (_currentNextPage = currentNextPage) == null ? void 0 : _currentNextPage.page) != null ? _currentNextPage$page : 0) + 1,
5395
+ totalPagesLimitReached: (_currentNextPage$isAt = (_currentNextPage2 = currentNextPage) == null ? void 0 : _currentNextPage2.isAtMaxPage) != null ? _currentNextPage$isAt : false
5396
+ };
5397
+ return result;
5398
+ });
5399
+ });
5400
+ const iterateFetchPagesByItems = _async(function (config) {
5401
+ const {
5402
+ readItemsFromPageResult,
5403
+ iterateItemsLimit: inputTotalIterateItemsLimit,
5404
+ loadItemLimit: inputTotalLoadItemLimit,
5405
+ filterPageItems: inputFilterPageItems,
5406
+ iteratePageItems
5407
+ } = config;
5408
+ const iterateItemsLimit = inputTotalIterateItemsLimit != null ? inputTotalIterateItemsLimit : Number.MAX_SAFE_INTEGER;
5409
+ const loadItemLimit = inputTotalLoadItemLimit != null ? inputTotalLoadItemLimit : Number.MAX_SAFE_INTEGER;
5410
+ const filterPageItems = inputFilterPageItems != null ? inputFilterPageItems : util.mapIdentityFunction();
5411
+ let totalItemsLoaded = 0;
5412
+ let totalItemsVisited = 0;
5413
+ let hasReachedFinalItem = false;
5414
+ const fetchPagesConfig = Object.assign({}, config, {
5415
+ iteratePage: _async(function (fetchPageResult) {
5416
+ const items = readItemsFromPageResult(fetchPageResult);
5417
+ return _await(filterPageItems(items, fetchPageResult), function (filteredItems) {
5418
+ return _await(iteratePageItems(filteredItems, fetchPageResult), function (results) {
5419
+ totalItemsLoaded += items.length;
5420
+ totalItemsVisited += filteredItems.length;
5421
+ hasReachedFinalItem = totalItemsLoaded >= loadItemLimit || totalItemsVisited >= iterateItemsLimit;
5422
+ return results;
5423
+ });
5424
+ });
5425
+ }),
5426
+ endEarly: () => hasReachedFinalItem
5427
+ });
5428
+ return iterateFetchPages(fetchPagesConfig);
5429
+ });
5430
+
5431
+ /**
5432
+ * Creates URLSearchParams from the input objects. The input objects are merged together.
5433
+ *
5434
+ * @param input
5435
+ * @param omitKeys
5436
+ * @returns
5437
+ */
5438
+ function makeUrlSearchParams(input, options) {
5439
+ const {
5440
+ omitKeys
5441
+ } = options != null ? options : {};
5442
+ const mergedInput = Array.isArray(input) ? util.mergeObjects(input) : input;
5443
+ const searchParams = new URLSearchParams(mergedInput);
5444
+ if (omitKeys != null) {
5445
+ util.useIterableOrValue(omitKeys, key => searchParams.delete(key), false);
5446
+ }
5447
+ return searchParams;
5448
+ }
5449
+
5298
5450
  var anObject$1 = anObject$e;
5299
5451
 
5300
5452
  // `RegExp.prototype.flags` getter implementation
@@ -5549,6 +5701,9 @@ exports.headersToHeadersTuple = headersToHeadersTuple;
5549
5701
  exports.isFetchRequest = isFetchRequest;
5550
5702
  exports.isURL = isURL;
5551
5703
  exports.isURLSearchParams = isURLSearchParams;
5704
+ exports.iterateFetchPages = iterateFetchPages;
5705
+ exports.iterateFetchPagesByItems = iterateFetchPagesByItems;
5706
+ exports.makeUrlSearchParams = makeUrlSearchParams;
5552
5707
  exports.mergeRequestHeaders = mergeRequestHeaders;
5553
5708
  exports.mergeRequestInits = mergeRequestInits;
5554
5709
  exports.nodeFetchService = nodeFetchService;
@@ -1,4 +1,4 @@
1
- import { removeTrailingSlashes, asGetter, multiValueMapBuilder, filterMaybeValues, objectToTuples, fixMultiSlashesInSlashPath, isPromiseLike, cachedGetter, FIRST_PAGE, isEmptyIterable, fixExtraQueryParameters, forEachInIterable, useIterableOrValue, isIterable, forEachKeyValue, mapIdentityFunction } from '@dereekb/util';
1
+ import { removeTrailingSlashes, asGetter, multiValueMapBuilder, filterMaybeValues, objectToTuples, fixMultiSlashesInSlashPath, isPromiseLike, cachedGetter, FIRST_PAGE, mapIdentityFunction, performTasksFromFactoryInParallelFunction, mergeObjects, useIterableOrValue, isEmptyIterable, fixExtraQueryParameters, forEachInIterable, isIterable, forEachKeyValue } from '@dereekb/util';
2
2
 
3
3
  var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
4
4
 
@@ -5158,12 +5158,15 @@ function fetchPageFactory(config) {
5158
5158
  fetch,
5159
5159
  readFetchPageResultInfo,
5160
5160
  buildInputForNextPage,
5161
- defaultMaxPage
5161
+ defaultMaxPage,
5162
+ defaultMaxItemsPerPage
5162
5163
  } = config;
5163
5164
  return (initalInput, options) => {
5164
5165
  const {
5165
- maxPage: inputMaxPage = defaultMaxPage
5166
+ maxPage: inputMaxPage = defaultMaxPage,
5167
+ maxItemsPerPage: inputMaxItemsPerPage
5166
5168
  } = options != null ? options : {};
5169
+ const maxItemsPerPage = inputMaxItemsPerPage != null ? inputMaxItemsPerPage : defaultMaxItemsPerPage;
5167
5170
  const maxPage = inputMaxPage === null ? Number.MAX_SAFE_INTEGER : inputMaxPage != null ? inputMaxPage : FETCH_PAGE_FACTORY_DEFAULT_MAX_PAGE;
5168
5171
  function fetchNextWithInput(input, previous = undefined) {
5169
5172
  return async () => {
@@ -5190,7 +5193,10 @@ function fetchPageFactory(config) {
5190
5193
  }
5191
5194
 
5192
5195
  // assert next page
5193
- const nextPageInfo = hasNext ? await buildInputForNextPage(nextPageResult, input) : undefined;
5196
+ const nextPageInfo = hasNext ? await buildInputForNextPage(nextPageResult, input, {
5197
+ maxPage,
5198
+ maxItemsPerPage
5199
+ }) : undefined;
5194
5200
  if (!nextPageInfo) {
5195
5201
  throw new FetchPageNoNextPageError(nextPageResult);
5196
5202
  }
@@ -5208,6 +5214,150 @@ function fetchPageFactory(config) {
5208
5214
  };
5209
5215
  }
5210
5216
 
5217
+ // MARK: Compat
5218
+ /**
5219
+ * @deprecated Use FetchPageResult instead.
5220
+ */
5221
+
5222
+ // MARK: IterateFetchPagesByItems
5223
+ /**
5224
+ * Filter function used to filter out items.
5225
+ *
5226
+ * @param snapshot
5227
+ * @returns
5228
+ */
5229
+
5230
+ /**
5231
+ * Iterates through the pages of a created FetchPage instance.
5232
+ *
5233
+ * @param config
5234
+ * @returns
5235
+ */
5236
+ async function iterateFetchPagesByItems(config) {
5237
+ const {
5238
+ readItemsFromPageResult,
5239
+ iterateItemsLimit: inputTotalIterateItemsLimit,
5240
+ loadItemLimit: inputTotalLoadItemLimit,
5241
+ filterPageItems: inputFilterPageItems,
5242
+ iteratePageItems
5243
+ } = config;
5244
+ const iterateItemsLimit = inputTotalIterateItemsLimit != null ? inputTotalIterateItemsLimit : Number.MAX_SAFE_INTEGER;
5245
+ const loadItemLimit = inputTotalLoadItemLimit != null ? inputTotalLoadItemLimit : Number.MAX_SAFE_INTEGER;
5246
+ const filterPageItems = inputFilterPageItems != null ? inputFilterPageItems : mapIdentityFunction();
5247
+ let totalItemsLoaded = 0;
5248
+ let totalItemsVisited = 0;
5249
+ let hasReachedFinalItem = false;
5250
+ const fetchPagesConfig = Object.assign({}, config, {
5251
+ iteratePage: async fetchPageResult => {
5252
+ const items = readItemsFromPageResult(fetchPageResult);
5253
+ const filteredItems = await filterPageItems(items, fetchPageResult);
5254
+ const results = await iteratePageItems(filteredItems, fetchPageResult);
5255
+ totalItemsLoaded += items.length;
5256
+ totalItemsVisited += filteredItems.length;
5257
+ hasReachedFinalItem = totalItemsLoaded >= loadItemLimit || totalItemsVisited >= iterateItemsLimit;
5258
+ return results;
5259
+ },
5260
+ endEarly: () => hasReachedFinalItem
5261
+ });
5262
+ return iterateFetchPages(fetchPagesConfig);
5263
+ }
5264
+
5265
+ // MARK: IterateFetchPages
5266
+
5267
+ /**
5268
+ * Iterates through the pages of a created FetchPage instance.
5269
+ *
5270
+ * @param config
5271
+ * @returns
5272
+ */
5273
+
5274
+ async function iterateFetchPages(config) {
5275
+ var _currentNextPage$page, _currentNextPage, _currentNextPage$isAt, _currentNextPage2;
5276
+ const {
5277
+ iteratePage,
5278
+ fetchPage: inputFetchPage,
5279
+ input,
5280
+ fetchPageFactory,
5281
+ usePageResult,
5282
+ maxParallelPages,
5283
+ waitBetweenPages,
5284
+ maxPage,
5285
+ maxItemsPerPage,
5286
+ endEarly
5287
+ } = config;
5288
+ let hasReachedEnd = false;
5289
+ let fetchPage = inputFetchPage != null ? inputFetchPage : fetchPageFactory(input, {
5290
+ maxPage,
5291
+ maxItemsPerPage
5292
+ });
5293
+ let currentNextPage;
5294
+ async function taskInputFactory() {
5295
+ if (hasReachedEnd) {
5296
+ return null; // issue no more tasks
5297
+ }
5298
+
5299
+ if (currentNextPage != null && (currentNextPage.isAtMaxPage || !currentNextPage.hasNext)) {
5300
+ hasReachedEnd = true;
5301
+ return null;
5302
+ }
5303
+ currentNextPage = await fetchPage.fetchNext();
5304
+ fetchPage = currentNextPage;
5305
+ return {
5306
+ i: currentNextPage.page,
5307
+ fetchPageResult: currentNextPage
5308
+ };
5309
+ }
5310
+ const performTaskFn = performTasksFromFactoryInParallelFunction({
5311
+ maxParallelTasks: maxParallelPages,
5312
+ waitBetweenTasks: waitBetweenPages,
5313
+ taskFactory: async ({
5314
+ i,
5315
+ fetchPageResult
5316
+ }) => {
5317
+ const result = await iteratePage(fetchPageResult);
5318
+ const iterationResult = {
5319
+ i,
5320
+ fetchPageResult,
5321
+ result
5322
+ };
5323
+ await (usePageResult == null ? void 0 : usePageResult(iterationResult));
5324
+ const shouldEndEarly = endEarly == null ? void 0 : endEarly(iterationResult);
5325
+ if (shouldEndEarly) {
5326
+ hasReachedEnd = true;
5327
+ }
5328
+ }
5329
+ });
5330
+ await performTaskFn(taskInputFactory);
5331
+ const result = {
5332
+ totalPages: ((_currentNextPage$page = (_currentNextPage = currentNextPage) == null ? void 0 : _currentNextPage.page) != null ? _currentNextPage$page : 0) + 1,
5333
+ totalPagesLimitReached: (_currentNextPage$isAt = (_currentNextPage2 = currentNextPage) == null ? void 0 : _currentNextPage2.isAtMaxPage) != null ? _currentNextPage$isAt : false
5334
+ };
5335
+ return result;
5336
+ }
5337
+
5338
+ /**
5339
+ * Options for makeUrlSearchParams()
5340
+ */
5341
+
5342
+ /**
5343
+ * Creates URLSearchParams from the input objects. The input objects are merged together.
5344
+ *
5345
+ * @param input
5346
+ * @param omitKeys
5347
+ * @returns
5348
+ */
5349
+ function makeUrlSearchParams(input, options) {
5350
+ const {
5351
+ omitKeys
5352
+ } = options != null ? options : {};
5353
+ const mergedInput = Array.isArray(input) ? mergeObjects(input) : input;
5354
+ const searchParams = new URLSearchParams(mergedInput);
5355
+ if (omitKeys != null) {
5356
+ useIterableOrValue(omitKeys, key => searchParams.delete(key), false);
5357
+ }
5358
+ return searchParams;
5359
+ }
5360
+
5211
5361
  var anObject$1 = anObject$e;
5212
5362
 
5213
5363
  // `RegExp.prototype.flags` getter implementation
@@ -5445,4 +5595,4 @@ const nodeFetchService = fetchService({
5445
5595
  makeRequest: (x, y) => new Request(x, y)
5446
5596
  });
5447
5597
 
5448
- export { FETCH_PAGE_FACTORY_DEFAULT_MAX_PAGE, FetchPageLimitReachedError, FetchPageNoNextPageError, FetchRequestFactoryError, FetchResponseError, FetchTimeoutError, JsonResponseParseError, configureFetch, fetchJsonBodyString, fetchJsonFunction, fetchJsonRequestInit, fetchJsonRequestInitFunction, fetchOk, fetchPageFactory, fetchRequestFactory, fetchService, fetchTimeout, fetchURL, fetchURLQueryKeyValueStringTuples, fetchURLSearchParamsObjectToURLSearchParams, headersToHeadersTuple, isFetchRequest, isURL, isURLSearchParams, mergeRequestHeaders, mergeRequestInits, nodeFetchService, queryParamsToSearchParams, requireOkResponse, returnNullHandleFetchJsonParseErrorFunction, throwJsonResponseParseErrorFunction };
5598
+ export { FETCH_PAGE_FACTORY_DEFAULT_MAX_PAGE, FetchPageLimitReachedError, FetchPageNoNextPageError, FetchRequestFactoryError, FetchResponseError, FetchTimeoutError, JsonResponseParseError, configureFetch, fetchJsonBodyString, fetchJsonFunction, fetchJsonRequestInit, fetchJsonRequestInitFunction, fetchOk, fetchPageFactory, fetchRequestFactory, fetchService, fetchTimeout, fetchURL, fetchURLQueryKeyValueStringTuples, fetchURLSearchParamsObjectToURLSearchParams, headersToHeadersTuple, isFetchRequest, isURL, isURLSearchParams, iterateFetchPages, iterateFetchPagesByItems, makeUrlSearchParams, mergeRequestHeaders, mergeRequestInits, nodeFetchService, queryParamsToSearchParams, requireOkResponse, returnNullHandleFetchJsonParseErrorFunction, throwJsonResponseParseErrorFunction };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util/fetch",
3
- "version": "11.0.6",
3
+ "version": "11.0.8",
4
4
  ".": {
5
5
  "types": "./src/index.d.ts",
6
6
  "node": {
@@ -43,25 +43,56 @@ export interface FetchPageResultInfo extends Page {
43
43
  */
44
44
  readonly hasNext?: Maybe<boolean>;
45
45
  }
46
- export interface FetchPageResults<O> extends FetchPageResultInfo {
46
+ export interface FetchPageResult<O> extends FetchPageResultInfo {
47
47
  /**
48
48
  * Result for this page.
49
49
  */
50
50
  readonly result: O;
51
+ /**
52
+ * Whether or not the max page has been reached.
53
+ */
54
+ readonly isAtMaxPage?: boolean;
51
55
  }
52
- export interface FetchNextPage<I, O> extends FetchPageResults<O>, FetchPage<I, O> {
56
+ export interface FetchPageResultWithInput<I, O> extends FetchPageResult<O> {
57
+ /**
58
+ * Input for this page.
59
+ */
60
+ readonly input: I;
61
+ }
62
+ export interface FetchNextPage<I, O> extends FetchPageResult<O>, FetchPage<I, O> {
53
63
  /**
54
64
  * Previous page.
55
65
  *
56
66
  * Undefined if this is the first page.
57
67
  */
58
68
  readonly previous?: Maybe<FetchNextPage<I, O>>;
69
+ }
70
+ export interface FetchPageFactoryInputOptions {
59
71
  /**
60
- * Whether or not the max page has been reached.
72
+ * The max number of pages to load.
73
+ *
74
+ * Pass null to disable the max page amount.
61
75
  */
62
- readonly isAtMaxPage?: boolean;
76
+ readonly maxPage?: Maybe<number>;
77
+ /**
78
+ * The maximum number of items to load per page.
79
+ */
80
+ readonly maxItemsPerPage?: Maybe<number>;
81
+ }
82
+ export type ReadFetchPageResultInfo = Omit<FetchPageResultInfo, 'page'>;
83
+ export interface FetchPageFactoryConfigDefaults {
84
+ /**
85
+ * The default max page to load up to.
86
+ *
87
+ * Defaults to 100. Pass null to disable the max page amount.
88
+ */
89
+ readonly defaultMaxPage?: Maybe<number>;
90
+ /**
91
+ * The default maximum number of items to load per page.
92
+ */
93
+ readonly defaultMaxItemsPerPage?: Maybe<number>;
63
94
  }
64
- export interface FetchPageFactoryConfig<I, O> {
95
+ export interface FetchPageFactoryConfig<I, O> extends FetchPageFactoryConfigDefaults {
65
96
  /**
66
97
  * The configured Fetch function that takes in the input and returns a results.
67
98
  */
@@ -74,7 +105,7 @@ export interface FetchPageFactoryConfig<I, O> {
74
105
  * @param result
75
106
  * @returns
76
107
  */
77
- readonly readFetchPageResultInfo: (result: O) => PromiseOrValue<Omit<FetchPageResultInfo, 'page'>>;
108
+ readonly readFetchPageResultInfo: (result: O) => PromiseOrValue<ReadFetchPageResultInfo>;
78
109
  /**
79
110
  * Creates new input for the next page that is merged with the previous input.
80
111
  *
@@ -83,22 +114,9 @@ export interface FetchPageFactoryConfig<I, O> {
83
114
  * @param result
84
115
  * @returns
85
116
  */
86
- readonly buildInputForNextPage: (pageResult: Partial<FetchPageResults<O>>, input: I) => PromiseOrValue<Maybe<Partial<I>>>;
87
- /**
88
- * The default max page to load up to.
89
- *
90
- * Defaults to 100. Pass null to disable the max page amount.
91
- */
92
- readonly defaultMaxPage?: Maybe<number>;
93
- }
94
- export interface FetchPageFactoryOptions<I, O> {
95
- /**
96
- * The max number of pages to load.
97
- *
98
- * Pass null to disable the max page amount.
99
- */
100
- readonly maxPage?: Maybe<number>;
117
+ readonly buildInputForNextPage: (pageResult: Partial<FetchPageResult<O>>, input: I, options: FetchPageFactoryInputOptions) => PromiseOrValue<Maybe<Partial<I>>>;
101
118
  }
119
+ export type FetchPageFactoryOptions<I, O> = FetchPageFactoryInputOptions;
102
120
  /**
103
121
  * Creates a new FetchPage instance.
104
122
  */
@@ -114,3 +132,7 @@ export declare const FETCH_PAGE_FACTORY_DEFAULT_MAX_PAGE = 100;
114
132
  * @returns
115
133
  */
116
134
  export declare function fetchPageFactory<I, O>(config: FetchPageFactoryConfig<I, O>): FetchPageFactory<I, O>;
135
+ /**
136
+ * @deprecated Use FetchPageResult instead.
137
+ */
138
+ export type FetchPageResults<T> = FetchPageResult<T>;
@@ -0,0 +1,132 @@
1
+ import { type DecisionFunction, type IndexNumber, type IndexRef, type Maybe, type Milliseconds, type PromiseOrValue } from '@dereekb/util';
2
+ import { type FetchPage, type FetchPageFactory, type FetchPageFactoryInputOptions, type FetchPageResult, type FetchPageResultWithInput } from './fetch.page';
3
+ /**
4
+ * Filter function used to filter out items.
5
+ *
6
+ * @param snapshot
7
+ * @returns
8
+ */
9
+ export type IterateFetchPagesByItemsFilterFunction<I, O, T> = (items: T[], pageResult: FetchPageResult<O>) => PromiseOrValue<T[]>;
10
+ export interface IterateFetchPagesByItemsConfig<I, O, T, R> extends Omit<IterateFetchPagesConfig<I, O, R[]>, 'iteratePage'> {
11
+ /**
12
+ * Read individual items from page result.
13
+ *
14
+ * @param items
15
+ * @returns
16
+ */
17
+ readItemsFromPageResult(results: FetchPageResult<O>): T[];
18
+ /**
19
+ * The total number of items allowed to be visited/used.
20
+ *
21
+ * If items are filtered out, they do not count towards the visit total.
22
+ *
23
+ * Ends on the page that reaches this limit.
24
+ */
25
+ readonly iterateItemsLimit?: Maybe<number>;
26
+ /**
27
+ * The total number of items allowed to be loaded from all pages.
28
+ *
29
+ * Ends on the page that reaches this limit.
30
+ */
31
+ readonly loadItemLimit?: Maybe<number>;
32
+ /**
33
+ * Filter function that can be used to filter out items from a result
34
+ *
35
+ * If all items are filtered out then the iteration will continue with final item of the snapshot regardless of filtering. The filtering does not impact the continuation decision.
36
+ * Use the handleRepeatCursor to properly exit the loop in unwanted repeat cursor cases.
37
+ *
38
+ * @param snapshot
39
+ * @returns
40
+ */
41
+ readonly filterPageItems?: IterateFetchPagesByItemsFilterFunction<I, O, T>;
42
+ /**
43
+ * The iterate function per each page result.
44
+ */
45
+ iteratePageItems(items: T[], fetchPageResult: FetchPageResult<O>): Promise<R[]>;
46
+ }
47
+ /**
48
+ * Iterates through the pages of a created FetchPage instance.
49
+ *
50
+ * @param config
51
+ * @returns
52
+ */
53
+ export declare function iterateFetchPagesByItems<I, O, T, R>(config: IterateFetchPagesByItemsConfig<I, O, T, R>): Promise<IterateFetchPagesResult>;
54
+ export type IterateFetchPagesConfig<I, O, R> = IterateFetchPagesConfigWithFactoryAndInput<I, O, R> | IterateFetchPagesConfigWithFetchPageInstance<I, O, R>;
55
+ export interface IterateFetchPagesConfigWithFactoryAndInput<I, O, R> extends BaseIterateFetchPagesConfig<I, O, R> {
56
+ /**
57
+ * Input for the page fetch.
58
+ */
59
+ readonly input: I;
60
+ readonly fetchPageFactory: FetchPageFactory<I, O>;
61
+ }
62
+ export interface IterateFetchPagesConfigWithFetchPageInstance<I, O, R> extends BaseIterateFetchPagesConfig<I, O, R> {
63
+ readonly fetchPage: FetchPage<I, O>;
64
+ }
65
+ export interface BaseIterateFetchPagesConfig<I, O, R> extends FetchPageFactoryInputOptions {
66
+ /**
67
+ * Input for the page fetch.
68
+ */
69
+ readonly input?: I;
70
+ readonly fetchPageFactory?: FetchPageFactory<I, O>;
71
+ readonly fetchPage?: FetchPage<I, O>;
72
+ /**
73
+ * The number of max parallel pages to run.
74
+ *
75
+ * By default pages are run serially (max of 1), but can be run in parallel.
76
+ */
77
+ readonly maxParallelPages?: number;
78
+ /**
79
+ * The amount of time to add as a delay between beginning a new page.
80
+ *
81
+ * If in parallel this is the minimum amount of time to wait before starting a new page.
82
+ */
83
+ readonly waitBetweenPages?: Milliseconds;
84
+ /**
85
+ * The iterate function per each page result.
86
+ */
87
+ iteratePage(result: FetchPageResult<O>): Promise<R>;
88
+ /**
89
+ * (Optional) Called at the end of each page.
90
+ */
91
+ usePageResult?(pageResult: IterateFetchPagesIterationResult<I, O, R>): PromiseOrValue<void>;
92
+ /**
93
+ * (Optional) Function to check whether or not to end the iteration early based on the result.
94
+ *
95
+ * @param pageResult
96
+ * @returns
97
+ */
98
+ endEarly?: DecisionFunction<IterateFetchPagesIterationResult<I, O, R>>;
99
+ }
100
+ export interface IterateFetchPagesIterationResult<I, O, R> extends IndexRef {
101
+ /***
102
+ * Page index number
103
+ */
104
+ readonly i: IndexNumber;
105
+ /**
106
+ * The returned fetch page result
107
+ */
108
+ readonly fetchPageResult: FetchPageResultWithInput<I, O>;
109
+ /**
110
+ * Results returned from each page.
111
+ */
112
+ readonly result: R;
113
+ }
114
+ export interface IterateFetchPagesResult {
115
+ /**
116
+ * The total number of pages visited.
117
+ */
118
+ readonly totalPages: number;
119
+ /**
120
+ * Whether or not the total page limit was reached.
121
+ */
122
+ readonly totalPagesLimitReached: boolean;
123
+ }
124
+ /**
125
+ * Iterates through the pages of a created FetchPage instance.
126
+ *
127
+ * @param config
128
+ * @returns
129
+ */
130
+ export declare function iterateFetchPages<I, O, R>(config: IterateFetchPagesConfigWithFactoryAndInput<I, O, R>): Promise<IterateFetchPagesResult>;
131
+ export declare function iterateFetchPages<I, O, R>(config: IterateFetchPagesConfigWithFetchPageInstance<I, O, R>): Promise<IterateFetchPagesResult>;
132
+ export declare function iterateFetchPages<I, O, R>(config: IterateFetchPagesConfig<I, O, R>): Promise<IterateFetchPagesResult>;
@@ -0,0 +1,22 @@
1
+ import { type Maybe, type ArrayOrValue, type IterableOrValue, type ObjectKey, type FilterKeyValueTuplesInput } from '@dereekb/util';
2
+ /**
3
+ * Options for makeUrlSearchParams()
4
+ */
5
+ export interface MakeUrlSearchParamsOptions {
6
+ /**
7
+ * Optional iterable of keys to remove from the search params.
8
+ */
9
+ readonly omitKeys?: Maybe<IterableOrValue<ObjectKey>>;
10
+ /**
11
+ * Optional filter for merging the objects together.
12
+ */
13
+ readonly mergeFilter?: FilterKeyValueTuplesInput;
14
+ }
15
+ /**
16
+ * Creates URLSearchParams from the input objects. The input objects are merged together.
17
+ *
18
+ * @param input
19
+ * @param omitKeys
20
+ * @returns
21
+ */
22
+ export declare function makeUrlSearchParams(input: Maybe<ArrayOrValue<Maybe<object | Record<string, string | number>>>>, options?: Maybe<MakeUrlSearchParamsOptions>): URLSearchParams;
@@ -2,6 +2,8 @@ export * from './error';
2
2
  export * from './fetch';
3
3
  export * from './fetch.type';
4
4
  export * from './fetch.page';
5
+ export * from './fetch.page.iterate';
6
+ export * from './fetch.url';
5
7
  export * from './json';
6
8
  export * from './provider';
7
9
  export * from './timeout';
package/index.esm.js CHANGED
@@ -2788,6 +2788,10 @@ function arrayDecision(values, decision, mode) {
2788
2788
  return arrayDecisionFunction(decision, mode)(values);
2789
2789
  }
2790
2790
 
2791
+ /**
2792
+ * Key of an object.
2793
+ */
2794
+
2791
2795
  function objectHasNoKeys(obj) {
2792
2796
  return Object.keys(obj).length === 0;
2793
2797
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util",
3
- "version": "11.0.6",
3
+ "version": "11.0.8",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./src/index.d.ts",
@@ -1,6 +1,10 @@
1
1
  import { type FieldOfType } from '../key';
2
2
  import { type SetIncludesMode } from '../set/set.mode';
3
3
  import { type KeyAsString } from '../type';
4
+ /**
5
+ * Key of an object.
6
+ */
7
+ export type ObjectKey = string;
4
8
  export type EmptyObject = Record<string, never>;
5
9
  export declare function objectHasNoKeys(obj: object): obj is EmptyObject;
6
10
  export declare function objectHasKey<T>(obj: T, key: KeyAsString<keyof T>): boolean;
@@ -13,7 +17,7 @@ export declare function objectHasKey<T, K extends keyof T>(obj: T, key: K): bool
13
17
  * @param keys
14
18
  */
15
19
  export declare function objectHasKeys<T>(obj: T, keys: KeyAsString<keyof T>[], mode?: SetIncludesMode): boolean;
16
- export declare function objectHasKeys(obj: unknown, keys: string[], mode?: SetIncludesMode): boolean;
20
+ export declare function objectHasKeys(obj: unknown, keys: ObjectKey[], mode?: SetIncludesMode): boolean;
17
21
  export declare function objectHasKeys<T, K extends keyof T>(obj: T, keys: K[], mode?: SetIncludesMode): boolean;
18
22
  export declare function applyToMultipleFields<T extends object, X = unknown>(value: X, fields: FieldOfType<T>[]): Partial<{
19
23
  [K in keyof T]: X;
@@ -21,6 +21,6 @@ export interface Page {
21
21
  */
22
22
  page: PageNumber;
23
23
  }
24
- export declare function getPageNumber(page: Maybe<Page>): number;
25
- export declare function getNextPageNumber(page: Maybe<Page>): number;
26
- export declare function isFinalPage(page: Maybe<Page>): boolean;
24
+ export declare function getPageNumber(page: Maybe<Partial<Page>>): number;
25
+ export declare function getNextPageNumber(page: Maybe<Partial<Page>>): number;
26
+ export declare function isFinalPage(page: Maybe<Partial<Page>>): boolean;
package/test/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [11.0.8](https://github.com/dereekb/dbx-components/compare/v11.0.7-dev...v11.0.8) (2024-11-23)
6
+
7
+
8
+
9
+ ## [11.0.7](https://github.com/dereekb/dbx-components/compare/v11.0.6-dev...v11.0.7) (2024-11-22)
10
+
11
+
12
+
5
13
  ## [11.0.6](https://github.com/dereekb/dbx-components/compare/v11.0.5-dev...v11.0.6) (2024-11-20)
6
14
 
7
15
 
package/test/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "11.0.6",
3
+ "version": "11.0.8",
4
4
  "type": "commonjs",
5
5
  "peerDependencies": {
6
6
  "@dereekb/util": "*"
@@ -40,8 +40,10 @@ export declare function failDueToSuccessError(message?: string): JestUnexpectedS
40
40
  /**
41
41
  * Error thrown when the error type was different than the expected type.
42
42
  */
43
- export declare class JestExpeectedErrorOfSpecificTypeError extends BaseError {
44
- constructor(encounteredType: unknown, expectedType?: Maybe<ClassLikeType | string>);
43
+ export declare class JestExpectedErrorOfSpecificTypeError extends BaseError {
44
+ readonly encounteredType: unknown;
45
+ readonly expectedType?: Maybe<string | ClassLikeType>;
46
+ constructor(encounteredType: unknown, expectedType?: Maybe<string | ClassLikeType>);
45
47
  }
46
48
  export declare function failTest(message?: string): never;
47
49
  export declare function failDueToSuccess(): never;
@@ -50,11 +52,13 @@ export declare function EXPECT_ERROR_DEFAULT_HANDLER(e: unknown): void;
50
52
  /**
51
53
  * Used to assert additional information about the expected error.
52
54
  *
53
- * Can assert within this function, or return a boolean. A boolean returning false means the test should throw a JestExpeectedErrorOfSpecificTypeError.
55
+ * Can assert within this function, or return a boolean. A boolean returning false means the test should throw a JestExpectedErrorOfSpecificTypeError.
54
56
  */
55
57
  export type JestExpectFailAssertionFunction = (error: unknown) => PromiseOrValue<Maybe<boolean> | void>;
56
58
  /**
57
- * Creates a JestExpeectedErrorOfSpecificTypeError that asserts the encountered error is of the expected type using the instanceof keyword.
59
+ * Creates a JestExpectFailAssertionFunction that asserts the encountered error is of the expected type using the instanceof keyword.
60
+ *
61
+ * Throws a JestExpectedErrorOfSpecificTypeError on failures.
58
62
  *
59
63
  * @param expectedType
60
64
  * @returns
@@ -5,7 +5,7 @@
5
5
  * Since fail() was silently removed, we redefine it.
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.fakeDoneHandler = exports.itShouldFail = exports.shouldFail = exports.expectSuccessfulFail = exports.expectFail = exports.jestExpectFailAssertErrorType = exports.EXPECT_ERROR_DEFAULT_HANDLER = exports.failWithDoneDueToSuccess = exports.failDueToSuccess = exports.failTest = exports.JestExpeectedErrorOfSpecificTypeError = exports.failDueToSuccessError = exports.JestUnexpectedSuccessFailureError = exports.failSuccessfully = exports.failSuccessfullyError = exports.JestExpectedFailError = exports.failWithJestDoneCallback = void 0;
8
+ exports.fakeDoneHandler = exports.itShouldFail = exports.shouldFail = exports.expectSuccessfulFail = exports.expectFail = exports.jestExpectFailAssertErrorType = exports.EXPECT_ERROR_DEFAULT_HANDLER = exports.failWithDoneDueToSuccess = exports.failDueToSuccess = exports.failTest = exports.JestExpectedErrorOfSpecificTypeError = exports.failDueToSuccessError = exports.JestUnexpectedSuccessFailureError = exports.failSuccessfully = exports.failSuccessfullyError = exports.JestExpectedFailError = exports.failWithJestDoneCallback = void 0;
9
9
  const util_1 = require("@dereekb/util");
10
10
  const make_error_1 = require("make-error");
11
11
  /**
@@ -50,12 +50,16 @@ exports.failDueToSuccessError = failDueToSuccessError;
50
50
  /**
51
51
  * Error thrown when the error type was different than the expected type.
52
52
  */
53
- class JestExpeectedErrorOfSpecificTypeError extends make_error_1.BaseError {
53
+ class JestExpectedErrorOfSpecificTypeError extends make_error_1.BaseError {
54
+ encounteredType;
55
+ expectedType;
54
56
  constructor(encounteredType, expectedType) {
55
57
  super(`The error encountered was not of the expected type. Expected: ${expectedType ?? 'n/a'}, but encountered: ${encounteredType} `);
58
+ this.encounteredType = encounteredType;
59
+ this.expectedType = expectedType;
56
60
  }
57
61
  }
58
- exports.JestExpeectedErrorOfSpecificTypeError = JestExpeectedErrorOfSpecificTypeError;
62
+ exports.JestExpectedErrorOfSpecificTypeError = JestExpectedErrorOfSpecificTypeError;
59
63
  function failTest(message) {
60
64
  throw failDueToSuccessError(message);
61
65
  }
@@ -78,7 +82,9 @@ function EXPECT_ERROR_DEFAULT_HANDLER(e) {
78
82
  }
79
83
  exports.EXPECT_ERROR_DEFAULT_HANDLER = EXPECT_ERROR_DEFAULT_HANDLER;
80
84
  /**
81
- * Creates a JestExpeectedErrorOfSpecificTypeError that asserts the encountered error is of the expected type using the instanceof keyword.
85
+ * Creates a JestExpectFailAssertionFunction that asserts the encountered error is of the expected type using the instanceof keyword.
86
+ *
87
+ * Throws a JestExpectedErrorOfSpecificTypeError on failures.
82
88
  *
83
89
  * @param expectedType
84
90
  * @returns
@@ -86,7 +92,7 @@ exports.EXPECT_ERROR_DEFAULT_HANDLER = EXPECT_ERROR_DEFAULT_HANDLER;
86
92
  function jestExpectFailAssertErrorType(expectedType) {
87
93
  return (error) => {
88
94
  if (!(error instanceof expectedType)) {
89
- throw new JestExpeectedErrorOfSpecificTypeError(error, expectedType);
95
+ throw new JestExpectedErrorOfSpecificTypeError(error, expectedType);
90
96
  }
91
97
  };
92
98
  }
@@ -99,7 +105,7 @@ function expectFail(errorFn, assertFailType) {
99
105
  else {
100
106
  const assertionResult = assertFailType?.(e);
101
107
  if (assertionResult === false) {
102
- throw new JestExpeectedErrorOfSpecificTypeError(e);
108
+ throw new JestExpectedErrorOfSpecificTypeError(e);
103
109
  }
104
110
  failSuccessfully();
105
111
  }
@@ -1 +1 @@
1
- {"version":3,"file":"jest.fail.js","sourceRoot":"","sources":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