@algolia/client-common 5.0.0-alpha.53 → 5.0.0-alpha.55

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.
@@ -67,15 +67,15 @@ function createEchoRequester({
67
67
  };
68
68
  }
69
69
 
70
- /**
71
- * Helper: Returns the promise of a given `func` to iterate on, based on a given `validate` condition.
72
- *
73
- * @param createIterator - The createIterator options.
74
- * @param createIterator.func - The function to run, which returns a promise.
75
- * @param createIterator.validate - The validator function. It receives the resolved return of `func`.
76
- * @param createIterator.aggregator - The function that runs right after the `func` method has been executed, allows you to do anything with the response before `validate`.
77
- * @param createIterator.error - The `validate` condition to throw an error, and its message.
78
- * @param createIterator.timeout - The function to decide how long to wait between iterations.
70
+ /**
71
+ * Helper: Returns the promise of a given `func` to iterate on, based on a given `validate` condition.
72
+ *
73
+ * @param createIterator - The createIterator options.
74
+ * @param createIterator.func - The function to run, which returns a promise.
75
+ * @param createIterator.validate - The validator function. It receives the resolved return of `func`.
76
+ * @param createIterator.aggregator - The function that runs right after the `func` method has been executed, allows you to do anything with the response before `validate`.
77
+ * @param createIterator.error - The `validate` condition to throw an error, and its message.
78
+ * @param createIterator.timeout - The function to decide how long to wait between iterations.
79
79
  */
80
80
  function createIterablePromise({
81
81
  func,
@@ -473,16 +473,16 @@ function createTransporter({
473
473
  return {
474
474
  hosts: compatibleHostsAvailable,
475
475
  getTimeout(timeoutsCount, baseTimeout) {
476
- /**
477
- * Imagine that you have 4 hosts, if timeouts will increase
478
- * on the following way: 1 (timed out) > 4 (timed out) > 5 (200).
479
- *
480
- * Note that, the very next request, we start from the previous timeout.
481
- *
482
- * 5 (timed out) > 6 (timed out) > 7 ...
483
- *
484
- * This strategy may need to be reviewed, but is the strategy on the our
485
- * current v3 version.
476
+ /**
477
+ * Imagine that you have 4 hosts, if timeouts will increase
478
+ * on the following way: 1 (timed out) > 4 (timed out) > 5 (200).
479
+ *
480
+ * Note that, the very next request, we start from the previous timeout.
481
+ *
482
+ * 5 (timed out) > 6 (timed out) > 7 ...
483
+ *
484
+ * This strategy may need to be reviewed, but is the strategy on the our
485
+ * current v3 version.
486
486
  */
487
487
  const timeoutMultiplier = hostsTimedOut.length === 0 && timeoutsCount === 0 ? 1 : hostsTimedOut.length + 3 + timeoutsCount;
488
488
  return timeoutMultiplier * baseTimeout;
@@ -491,8 +491,8 @@ function createTransporter({
491
491
  }
492
492
  async function retryableRequest(request, requestOptions, isRead = true) {
493
493
  const stackTrace = [];
494
- /**
495
- * First we prepare the payload that do not depend from hosts.
494
+ /**
495
+ * First we prepare the payload that do not depend from hosts.
496
496
  */
497
497
  const data = serializeData(request, requestOptions);
498
498
  const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);
@@ -523,8 +523,8 @@ function createTransporter({
523
523
  }
524
524
  let timeoutsCount = 0;
525
525
  const retry = async (retryableHosts, getTimeout) => {
526
- /**
527
- * We iterate on each host, until there is no host left.
526
+ /**
527
+ * We iterate on each host, until there is no host left.
528
528
  */
529
529
  const host = retryableHosts.pop();
530
530
  if (host === undefined) {
@@ -542,10 +542,10 @@ function createTransporter({
542
542
  connectTimeout: getTimeout(timeoutsCount, timeouts.connect),
543
543
  responseTimeout: getTimeout(timeoutsCount, responseTimeout)
544
544
  };
545
- /**
546
- * The stackFrame is pushed to the stackTrace so we
547
- * can have information about onRetry and onFailure
548
- * decisions.
545
+ /**
546
+ * The stackFrame is pushed to the stackTrace so we
547
+ * can have information about onRetry and onFailure
548
+ * decisions.
549
549
  */
550
550
  const pushToStackTrace = response => {
551
551
  const stackFrame = {
@@ -564,17 +564,17 @@ function createTransporter({
564
564
  if (response.isTimedOut) {
565
565
  timeoutsCount++;
566
566
  }
567
- /**
568
- * Failures are individually sent to the logger, allowing
569
- * the end user to debug / store stack frames even
570
- * when a retry error does not happen.
567
+ /**
568
+ * Failures are individually sent to the logger, allowing
569
+ * the end user to debug / store stack frames even
570
+ * when a retry error does not happen.
571
571
  */
572
572
  // eslint-disable-next-line no-console -- this will be fixed by exposing a `logger` to the transporter
573
573
  console.log('Retryable failure', stackFrameWithoutCredentials(stackFrame));
574
- /**
575
- * We also store the state of the host in failure cases. If the host, is
576
- * down it will remain down for the next 2 minutes. In a timeout situation,
577
- * this host will be added end of the list of hosts on the next request.
574
+ /**
575
+ * We also store the state of the host in failure cases. If the host, is
576
+ * down it will remain down for the next 2 minutes. In a timeout situation,
577
+ * this host will be added end of the list of hosts on the next request.
578
578
  */
579
579
  await hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? 'timed out' : 'down'));
580
580
  return retry(retryableHosts, getTimeout);
@@ -585,56 +585,56 @@ function createTransporter({
585
585
  pushToStackTrace(response);
586
586
  throw deserializeFailure(response, stackTrace);
587
587
  };
588
- /**
589
- * Finally, for each retryable host perform request until we got a non
590
- * retryable response. Some notes here:
591
- *
592
- * 1. The reverse here is applied so we can apply a `pop` later on => more performant.
593
- * 2. We also get from the retryable options a timeout multiplier that is tailored
594
- * for the current context.
588
+ /**
589
+ * Finally, for each retryable host perform request until we got a non
590
+ * retryable response. Some notes here:
591
+ *
592
+ * 1. The reverse here is applied so we can apply a `pop` later on => more performant.
593
+ * 2. We also get from the retryable options a timeout multiplier that is tailored
594
+ * for the current context.
595
595
  */
596
596
  const compatibleHosts = hosts.filter(host => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'));
597
597
  const options = await createRetryableOptions(compatibleHosts);
598
598
  return retry([...options.hosts].reverse(), options.getTimeout);
599
599
  }
600
600
  function createRequest(request, requestOptions = {}) {
601
- /**
602
- * A read request is either a `GET` request, or a request that we make
603
- * via the `read` transporter (e.g. `search`).
601
+ /**
602
+ * A read request is either a `GET` request, or a request that we make
603
+ * via the `read` transporter (e.g. `search`).
604
604
  */
605
605
  const isRead = request.useReadTransporter || request.method === 'GET';
606
606
  if (!isRead) {
607
- /**
608
- * On write requests, no cache mechanisms are applied, and we
609
- * proxy the request immediately to the requester.
607
+ /**
608
+ * On write requests, no cache mechanisms are applied, and we
609
+ * proxy the request immediately to the requester.
610
610
  */
611
611
  return retryableRequest(request, requestOptions, isRead);
612
612
  }
613
613
  const createRetryableRequest = () => {
614
- /**
615
- * Then, we prepare a function factory that contains the construction of
616
- * the retryable request. At this point, we may *not* perform the actual
617
- * request. But we want to have the function factory ready.
614
+ /**
615
+ * Then, we prepare a function factory that contains the construction of
616
+ * the retryable request. At this point, we may *not* perform the actual
617
+ * request. But we want to have the function factory ready.
618
618
  */
619
619
  return retryableRequest(request, requestOptions);
620
620
  };
621
- /**
622
- * Once we have the function factory ready, we need to determine of the
623
- * request is "cacheable" - should be cached. Note that, once again,
624
- * the user can force this option.
621
+ /**
622
+ * Once we have the function factory ready, we need to determine of the
623
+ * request is "cacheable" - should be cached. Note that, once again,
624
+ * the user can force this option.
625
625
  */
626
626
  const cacheable = requestOptions.cacheable || request.cacheable;
627
- /**
628
- * If is not "cacheable", we immediately trigger the retryable request, no
629
- * need to check cache implementations.
627
+ /**
628
+ * If is not "cacheable", we immediately trigger the retryable request, no
629
+ * need to check cache implementations.
630
630
  */
631
631
  if (cacheable !== true) {
632
632
  return createRetryableRequest();
633
633
  }
634
- /**
635
- * If the request is "cacheable", we need to first compute the key to ask
636
- * the cache implementations if this request is on progress or if the
637
- * response already exists on the cache.
634
+ /**
635
+ * If the request is "cacheable", we need to first compute the key to ask
636
+ * the cache implementations if this request is on progress or if the
637
+ * response already exists on the cache.
638
638
  */
639
639
  const key = {
640
640
  request,
@@ -644,27 +644,27 @@ function createTransporter({
644
644
  headers: baseHeaders
645
645
  }
646
646
  };
647
- /**
648
- * With the computed key, we first ask the responses cache
649
- * implementation if this request was been resolved before.
647
+ /**
648
+ * With the computed key, we first ask the responses cache
649
+ * implementation if this request was been resolved before.
650
650
  */
651
651
  return responsesCache.get(key, () => {
652
- /**
653
- * If the request has never resolved before, we actually ask if there
654
- * is a current request with the same key on progress.
652
+ /**
653
+ * If the request has never resolved before, we actually ask if there
654
+ * is a current request with the same key on progress.
655
655
  */
656
656
  return requestsCache.get(key, () =>
657
- /**
658
- * Finally, if there is no request in progress with the same key,
659
- * this `createRetryableRequest()` will actually trigger the
660
- * retryable request.
657
+ /**
658
+ * Finally, if there is no request in progress with the same key,
659
+ * this `createRetryableRequest()` will actually trigger the
660
+ * retryable request.
661
661
  */
662
662
  requestsCache.set(key, createRetryableRequest()).then(response => Promise.all([requestsCache.delete(key), response]), err => Promise.all([requestsCache.delete(key), Promise.reject(err)])).then(([_, response]) => response));
663
663
  }, {
664
- /**
665
- * Of course, once we get this response back from the server, we
666
- * tell response cache to actually store the received response
667
- * to be used later.
664
+ /**
665
+ * Of course, once we get this response back from the server, we
666
+ * tell response cache to actually store the received response
667
+ * to be used later.
668
668
  */
669
669
  miss: response => responsesCache.set(key, response)
670
670
  });
@@ -63,15 +63,15 @@ function createEchoRequester({
63
63
  };
64
64
  }
65
65
 
66
- /**
67
- * Helper: Returns the promise of a given `func` to iterate on, based on a given `validate` condition.
68
- *
69
- * @param createIterator - The createIterator options.
70
- * @param createIterator.func - The function to run, which returns a promise.
71
- * @param createIterator.validate - The validator function. It receives the resolved return of `func`.
72
- * @param createIterator.aggregator - The function that runs right after the `func` method has been executed, allows you to do anything with the response before `validate`.
73
- * @param createIterator.error - The `validate` condition to throw an error, and its message.
74
- * @param createIterator.timeout - The function to decide how long to wait between iterations.
66
+ /**
67
+ * Helper: Returns the promise of a given `func` to iterate on, based on a given `validate` condition.
68
+ *
69
+ * @param createIterator - The createIterator options.
70
+ * @param createIterator.func - The function to run, which returns a promise.
71
+ * @param createIterator.validate - The validator function. It receives the resolved return of `func`.
72
+ * @param createIterator.aggregator - The function that runs right after the `func` method has been executed, allows you to do anything with the response before `validate`.
73
+ * @param createIterator.error - The `validate` condition to throw an error, and its message.
74
+ * @param createIterator.timeout - The function to decide how long to wait between iterations.
75
75
  */
76
76
  function createIterablePromise({
77
77
  func,
@@ -469,16 +469,16 @@ function createTransporter({
469
469
  return {
470
470
  hosts: compatibleHostsAvailable,
471
471
  getTimeout(timeoutsCount, baseTimeout) {
472
- /**
473
- * Imagine that you have 4 hosts, if timeouts will increase
474
- * on the following way: 1 (timed out) > 4 (timed out) > 5 (200).
475
- *
476
- * Note that, the very next request, we start from the previous timeout.
477
- *
478
- * 5 (timed out) > 6 (timed out) > 7 ...
479
- *
480
- * This strategy may need to be reviewed, but is the strategy on the our
481
- * current v3 version.
472
+ /**
473
+ * Imagine that you have 4 hosts, if timeouts will increase
474
+ * on the following way: 1 (timed out) > 4 (timed out) > 5 (200).
475
+ *
476
+ * Note that, the very next request, we start from the previous timeout.
477
+ *
478
+ * 5 (timed out) > 6 (timed out) > 7 ...
479
+ *
480
+ * This strategy may need to be reviewed, but is the strategy on the our
481
+ * current v3 version.
482
482
  */
483
483
  const timeoutMultiplier = hostsTimedOut.length === 0 && timeoutsCount === 0 ? 1 : hostsTimedOut.length + 3 + timeoutsCount;
484
484
  return timeoutMultiplier * baseTimeout;
@@ -487,8 +487,8 @@ function createTransporter({
487
487
  }
488
488
  async function retryableRequest(request, requestOptions, isRead = true) {
489
489
  const stackTrace = [];
490
- /**
491
- * First we prepare the payload that do not depend from hosts.
490
+ /**
491
+ * First we prepare the payload that do not depend from hosts.
492
492
  */
493
493
  const data = serializeData(request, requestOptions);
494
494
  const headers = serializeHeaders(baseHeaders, request.headers, requestOptions.headers);
@@ -519,8 +519,8 @@ function createTransporter({
519
519
  }
520
520
  let timeoutsCount = 0;
521
521
  const retry = async (retryableHosts, getTimeout) => {
522
- /**
523
- * We iterate on each host, until there is no host left.
522
+ /**
523
+ * We iterate on each host, until there is no host left.
524
524
  */
525
525
  const host = retryableHosts.pop();
526
526
  if (host === undefined) {
@@ -538,10 +538,10 @@ function createTransporter({
538
538
  connectTimeout: getTimeout(timeoutsCount, timeouts.connect),
539
539
  responseTimeout: getTimeout(timeoutsCount, responseTimeout)
540
540
  };
541
- /**
542
- * The stackFrame is pushed to the stackTrace so we
543
- * can have information about onRetry and onFailure
544
- * decisions.
541
+ /**
542
+ * The stackFrame is pushed to the stackTrace so we
543
+ * can have information about onRetry and onFailure
544
+ * decisions.
545
545
  */
546
546
  const pushToStackTrace = response => {
547
547
  const stackFrame = {
@@ -560,17 +560,17 @@ function createTransporter({
560
560
  if (response.isTimedOut) {
561
561
  timeoutsCount++;
562
562
  }
563
- /**
564
- * Failures are individually sent to the logger, allowing
565
- * the end user to debug / store stack frames even
566
- * when a retry error does not happen.
563
+ /**
564
+ * Failures are individually sent to the logger, allowing
565
+ * the end user to debug / store stack frames even
566
+ * when a retry error does not happen.
567
567
  */
568
568
  // eslint-disable-next-line no-console -- this will be fixed by exposing a `logger` to the transporter
569
569
  console.log('Retryable failure', stackFrameWithoutCredentials(stackFrame));
570
- /**
571
- * We also store the state of the host in failure cases. If the host, is
572
- * down it will remain down for the next 2 minutes. In a timeout situation,
573
- * this host will be added end of the list of hosts on the next request.
570
+ /**
571
+ * We also store the state of the host in failure cases. If the host, is
572
+ * down it will remain down for the next 2 minutes. In a timeout situation,
573
+ * this host will be added end of the list of hosts on the next request.
574
574
  */
575
575
  await hostsCache.set(host, createStatefulHost(host, response.isTimedOut ? 'timed out' : 'down'));
576
576
  return retry(retryableHosts, getTimeout);
@@ -581,56 +581,56 @@ function createTransporter({
581
581
  pushToStackTrace(response);
582
582
  throw deserializeFailure(response, stackTrace);
583
583
  };
584
- /**
585
- * Finally, for each retryable host perform request until we got a non
586
- * retryable response. Some notes here:
587
- *
588
- * 1. The reverse here is applied so we can apply a `pop` later on => more performant.
589
- * 2. We also get from the retryable options a timeout multiplier that is tailored
590
- * for the current context.
584
+ /**
585
+ * Finally, for each retryable host perform request until we got a non
586
+ * retryable response. Some notes here:
587
+ *
588
+ * 1. The reverse here is applied so we can apply a `pop` later on => more performant.
589
+ * 2. We also get from the retryable options a timeout multiplier that is tailored
590
+ * for the current context.
591
591
  */
592
592
  const compatibleHosts = hosts.filter(host => host.accept === 'readWrite' || (isRead ? host.accept === 'read' : host.accept === 'write'));
593
593
  const options = await createRetryableOptions(compatibleHosts);
594
594
  return retry([...options.hosts].reverse(), options.getTimeout);
595
595
  }
596
596
  function createRequest(request, requestOptions = {}) {
597
- /**
598
- * A read request is either a `GET` request, or a request that we make
599
- * via the `read` transporter (e.g. `search`).
597
+ /**
598
+ * A read request is either a `GET` request, or a request that we make
599
+ * via the `read` transporter (e.g. `search`).
600
600
  */
601
601
  const isRead = request.useReadTransporter || request.method === 'GET';
602
602
  if (!isRead) {
603
- /**
604
- * On write requests, no cache mechanisms are applied, and we
605
- * proxy the request immediately to the requester.
603
+ /**
604
+ * On write requests, no cache mechanisms are applied, and we
605
+ * proxy the request immediately to the requester.
606
606
  */
607
607
  return retryableRequest(request, requestOptions, isRead);
608
608
  }
609
609
  const createRetryableRequest = () => {
610
- /**
611
- * Then, we prepare a function factory that contains the construction of
612
- * the retryable request. At this point, we may *not* perform the actual
613
- * request. But we want to have the function factory ready.
610
+ /**
611
+ * Then, we prepare a function factory that contains the construction of
612
+ * the retryable request. At this point, we may *not* perform the actual
613
+ * request. But we want to have the function factory ready.
614
614
  */
615
615
  return retryableRequest(request, requestOptions);
616
616
  };
617
- /**
618
- * Once we have the function factory ready, we need to determine of the
619
- * request is "cacheable" - should be cached. Note that, once again,
620
- * the user can force this option.
617
+ /**
618
+ * Once we have the function factory ready, we need to determine of the
619
+ * request is "cacheable" - should be cached. Note that, once again,
620
+ * the user can force this option.
621
621
  */
622
622
  const cacheable = requestOptions.cacheable || request.cacheable;
623
- /**
624
- * If is not "cacheable", we immediately trigger the retryable request, no
625
- * need to check cache implementations.
623
+ /**
624
+ * If is not "cacheable", we immediately trigger the retryable request, no
625
+ * need to check cache implementations.
626
626
  */
627
627
  if (cacheable !== true) {
628
628
  return createRetryableRequest();
629
629
  }
630
- /**
631
- * If the request is "cacheable", we need to first compute the key to ask
632
- * the cache implementations if this request is on progress or if the
633
- * response already exists on the cache.
630
+ /**
631
+ * If the request is "cacheable", we need to first compute the key to ask
632
+ * the cache implementations if this request is on progress or if the
633
+ * response already exists on the cache.
634
634
  */
635
635
  const key = {
636
636
  request,
@@ -640,27 +640,27 @@ function createTransporter({
640
640
  headers: baseHeaders
641
641
  }
642
642
  };
643
- /**
644
- * With the computed key, we first ask the responses cache
645
- * implementation if this request was been resolved before.
643
+ /**
644
+ * With the computed key, we first ask the responses cache
645
+ * implementation if this request was been resolved before.
646
646
  */
647
647
  return responsesCache.get(key, () => {
648
- /**
649
- * If the request has never resolved before, we actually ask if there
650
- * is a current request with the same key on progress.
648
+ /**
649
+ * If the request has never resolved before, we actually ask if there
650
+ * is a current request with the same key on progress.
651
651
  */
652
652
  return requestsCache.get(key, () =>
653
- /**
654
- * Finally, if there is no request in progress with the same key,
655
- * this `createRetryableRequest()` will actually trigger the
656
- * retryable request.
653
+ /**
654
+ * Finally, if there is no request in progress with the same key,
655
+ * this `createRetryableRequest()` will actually trigger the
656
+ * retryable request.
657
657
  */
658
658
  requestsCache.set(key, createRetryableRequest()).then(response => Promise.all([requestsCache.delete(key), response]), err => Promise.all([requestsCache.delete(key), Promise.reject(err)])).then(([_, response]) => response));
659
659
  }, {
660
- /**
661
- * Of course, once we get this response back from the server, we
662
- * tell response cache to actually store the received response
663
- * to be used later.
660
+ /**
661
+ * Of course, once we get this response back from the server, we
662
+ * tell response cache to actually store the received response
663
+ * to be used later.
664
664
  */
665
665
  miss: response => responsesCache.set(key, response)
666
666
  });
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export * from './src/createAuth';
2
- export * from './src/createEchoRequester';
3
- export * from './src/createIterablePromise';
4
- export * from './src/cache';
5
- export * from './src/transporter';
6
- export * from './src/createAlgoliaAgent';
7
- export * from './src/getAlgoliaAgent';
8
- export * from './src/types';
9
- export * from './src/constants';
1
+ export * from './src/createAuth';
2
+ export * from './src/createEchoRequester';
3
+ export * from './src/createIterablePromise';
4
+ export * from './src/cache';
5
+ export * from './src/transporter';
6
+ export * from './src/createAlgoliaAgent';
7
+ export * from './src/getAlgoliaAgent';
8
+ export * from './src/types';
9
+ export * from './src/constants';
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
- import type { BrowserLocalStorageOptions, Cache } from '../types';
2
- export declare function createBrowserLocalStorageCache(options: BrowserLocalStorageOptions): Cache;
1
+ import type { BrowserLocalStorageOptions, Cache } from '../types';
2
+ export declare function createBrowserLocalStorageCache(options: BrowserLocalStorageOptions): Cache;
3
3
  //# sourceMappingURL=createBrowserLocalStorageCache.d.ts.map
@@ -1,3 +1,3 @@
1
- import type { FallbackableCacheOptions, Cache } from '../types';
2
- export declare function createFallbackableCache(options: FallbackableCacheOptions): Cache;
1
+ import type { FallbackableCacheOptions, Cache } from '../types';
2
+ export declare function createFallbackableCache(options: FallbackableCacheOptions): Cache;
3
3
  //# sourceMappingURL=createFallbackableCache.d.ts.map
@@ -1,3 +1,3 @@
1
- import type { Cache, MemoryCacheOptions } from '../types';
2
- export declare function createMemoryCache(options?: MemoryCacheOptions): Cache;
1
+ import type { Cache, MemoryCacheOptions } from '../types';
2
+ export declare function createMemoryCache(options?: MemoryCacheOptions): Cache;
3
3
  //# sourceMappingURL=createMemoryCache.d.ts.map
@@ -1,3 +1,3 @@
1
- import type { Cache } from '../types';
2
- export declare function createNullCache(): Cache;
1
+ import type { Cache } from '../types';
2
+ export declare function createNullCache(): Cache;
3
3
  //# sourceMappingURL=createNullCache.d.ts.map
@@ -1,5 +1,5 @@
1
- export * from './createBrowserLocalStorageCache';
2
- export * from './createFallbackableCache';
3
- export * from './createMemoryCache';
4
- export * from './createNullCache';
1
+ export * from './createBrowserLocalStorageCache';
2
+ export * from './createFallbackableCache';
3
+ export * from './createMemoryCache';
4
+ export * from './createNullCache';
5
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,7 @@
1
- export declare const DEFAULT_CONNECT_TIMEOUT_BROWSER = 1000;
2
- export declare const DEFAULT_READ_TIMEOUT_BROWSER = 2000;
3
- export declare const DEFAULT_WRITE_TIMEOUT_BROWSER = 30000;
4
- export declare const DEFAULT_CONNECT_TIMEOUT_NODE = 2000;
5
- export declare const DEFAULT_READ_TIMEOUT_NODE = 5000;
6
- export declare const DEFAULT_WRITE_TIMEOUT_NODE = 30000;
1
+ export declare const DEFAULT_CONNECT_TIMEOUT_BROWSER = 1000;
2
+ export declare const DEFAULT_READ_TIMEOUT_BROWSER = 2000;
3
+ export declare const DEFAULT_WRITE_TIMEOUT_BROWSER = 30000;
4
+ export declare const DEFAULT_CONNECT_TIMEOUT_NODE = 2000;
5
+ export declare const DEFAULT_READ_TIMEOUT_NODE = 5000;
6
+ export declare const DEFAULT_WRITE_TIMEOUT_NODE = 30000;
7
7
  //# sourceMappingURL=constants.d.ts.map
@@ -1,3 +1,3 @@
1
- import type { AlgoliaAgent } from './types';
2
- export declare function createAlgoliaAgent(version: string): AlgoliaAgent;
1
+ import type { AlgoliaAgent } from './types';
2
+ export declare function createAlgoliaAgent(version: string): AlgoliaAgent;
3
3
  //# sourceMappingURL=createAlgoliaAgent.d.ts.map
@@ -1,6 +1,6 @@
1
- import type { AuthMode, Headers, QueryParameters } from './types';
2
- export declare function createAuth(appId: string, apiKey: string, authMode?: AuthMode): {
3
- readonly headers: () => Headers;
4
- readonly queryParameters: () => QueryParameters;
5
- };
1
+ import type { AuthMode, Headers, QueryParameters } from './types';
2
+ export declare function createAuth(appId: string, apiKey: string, authMode?: AuthMode): {
3
+ readonly headers: () => Headers;
4
+ readonly queryParameters: () => QueryParameters;
5
+ };
6
6
  //# sourceMappingURL=createAuth.d.ts.map
@@ -1,7 +1,7 @@
1
- import type { Requester } from './types';
2
- export type EchoRequesterParams = {
3
- getURL: (url: string) => URL;
4
- status?: number;
5
- };
6
- export declare function createEchoRequester({ getURL, status, }: EchoRequesterParams): Requester;
1
+ import type { Requester } from './types';
2
+ export type EchoRequesterParams = {
3
+ getURL: (url: string) => URL;
4
+ status?: number;
5
+ };
6
+ export declare function createEchoRequester({ getURL, status, }: EchoRequesterParams): Requester;
7
7
  //# sourceMappingURL=createEchoRequester.d.ts.map
@@ -1,13 +1,13 @@
1
- import type { CreateIterablePromise } from './types/createIterablePromise';
2
- /**
3
- * Helper: Returns the promise of a given `func` to iterate on, based on a given `validate` condition.
4
- *
5
- * @param createIterator - The createIterator options.
6
- * @param createIterator.func - The function to run, which returns a promise.
7
- * @param createIterator.validate - The validator function. It receives the resolved return of `func`.
8
- * @param createIterator.aggregator - The function that runs right after the `func` method has been executed, allows you to do anything with the response before `validate`.
9
- * @param createIterator.error - The `validate` condition to throw an error, and its message.
10
- * @param createIterator.timeout - The function to decide how long to wait between iterations.
11
- */
12
- export declare function createIterablePromise<TResponse>({ func, validate, aggregator, error, timeout, }: CreateIterablePromise<TResponse>): Promise<TResponse>;
1
+ import type { CreateIterablePromise } from './types/createIterablePromise';
2
+ /**
3
+ * Helper: Returns the promise of a given `func` to iterate on, based on a given `validate` condition.
4
+ *
5
+ * @param createIterator - The createIterator options.
6
+ * @param createIterator.func - The function to run, which returns a promise.
7
+ * @param createIterator.validate - The validator function. It receives the resolved return of `func`.
8
+ * @param createIterator.aggregator - The function that runs right after the `func` method has been executed, allows you to do anything with the response before `validate`.
9
+ * @param createIterator.error - The `validate` condition to throw an error, and its message.
10
+ * @param createIterator.timeout - The function to decide how long to wait between iterations.
11
+ */
12
+ export declare function createIterablePromise<TResponse>({ func, validate, aggregator, error, timeout, }: CreateIterablePromise<TResponse>): Promise<TResponse>;
13
13
  //# sourceMappingURL=createIterablePromise.d.ts.map
@@ -1,8 +1,8 @@
1
- import type { AlgoliaAgentOptions, AlgoliaAgent } from './types';
2
- export type GetAlgoliaAgent = {
3
- algoliaAgents: AlgoliaAgentOptions[];
4
- client: string;
5
- version: string;
6
- };
7
- export declare function getAlgoliaAgent({ algoliaAgents, client, version, }: GetAlgoliaAgent): AlgoliaAgent;
1
+ import type { AlgoliaAgentOptions, AlgoliaAgent } from './types';
2
+ export type GetAlgoliaAgent = {
3
+ algoliaAgents: AlgoliaAgentOptions[];
4
+ client: string;
5
+ version: string;
6
+ };
7
+ export declare function getAlgoliaAgent({ algoliaAgents, client, version, }: GetAlgoliaAgent): AlgoliaAgent;
8
8
  //# sourceMappingURL=getAlgoliaAgent.d.ts.map
@@ -1,3 +1,3 @@
1
- import type { Host, StatefulHost } from '../types';
2
- export declare function createStatefulHost(host: Host, status?: StatefulHost['status']): StatefulHost;
1
+ import type { Host, StatefulHost } from '../types';
2
+ export declare function createStatefulHost(host: Host, status?: StatefulHost['status']): StatefulHost;
3
3
  //# sourceMappingURL=createStatefulHost.d.ts.map