@algolia/ingestion 1.52.0 → 1.53.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  // src/ingestionClient.ts
2
2
  import { createAuth, createIterablePromise, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
3
- var apiClientVersion = "1.52.0";
3
+ var apiClientVersion = "1.53.0";
4
4
  var REGIONS = ["eu", "us"];
5
5
  function getDefaultHosts(region) {
6
6
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -97,6 +97,7 @@ function createIngestionClient({
97
97
  * @param chunkedPush.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
98
98
  * @param chunkedPush.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
99
99
  * @param chunkedPush.referenceIndexName - This is required when targeting an index that does not have a push connector setup (e.g. a tmp index), but you wish to attach another index's transformation to it (e.g. the source index name).
100
+ * @param chunkedPush.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
100
101
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getEvent` method and merged with the transporter requestOptions.
101
102
  */
102
103
  async chunkedPush({
@@ -105,7 +106,8 @@ function createIngestionClient({
105
106
  action = "addObject",
106
107
  waitForTasks,
107
108
  batchSize = 1e3,
108
- referenceIndexName
109
+ referenceIndexName,
110
+ maxRetries = 100
109
111
  }, requestOptions) {
110
112
  let records = [];
111
113
  let offset = 0;
@@ -141,8 +143,8 @@ function createIngestionClient({
141
143
  validate: (response) => response !== void 0,
142
144
  aggregator: () => retryCount += 1,
143
145
  error: {
144
- validate: () => retryCount >= 50,
145
- message: () => `The maximum number of retries exceeded. (${retryCount}/${50})`
146
+ validate: () => retryCount >= maxRetries,
147
+ message: () => `Stopped waiting for the task after ${maxRetries} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`
146
148
  },
147
149
  timeout: () => Math.min(retryCount * 1500, 5e3)
148
150
  });
@@ -1434,7 +1436,7 @@ function createIngestionClient({
1434
1436
  connect: 18e4,
1435
1437
  read: 18e4,
1436
1438
  write: 18e4,
1437
- ...requestOptions == null ? void 0 : requestOptions.timeouts
1439
+ ...requestOptions?.timeouts
1438
1440
  }
1439
1441
  };
1440
1442
  return transporter.request(request, requestOptions);
@@ -1483,7 +1485,7 @@ function createIngestionClient({
1483
1485
  connect: 18e4,
1484
1486
  read: 18e4,
1485
1487
  write: 18e4,
1486
- ...requestOptions == null ? void 0 : requestOptions.timeouts
1488
+ ...requestOptions?.timeouts
1487
1489
  }
1488
1490
  };
1489
1491
  return transporter.request(request, requestOptions);
@@ -1820,7 +1822,7 @@ function createIngestionClient({
1820
1822
  connect: 18e4,
1821
1823
  read: 18e4,
1822
1824
  write: 18e4,
1823
- ...requestOptions == null ? void 0 : requestOptions.timeouts
1825
+ ...requestOptions?.timeouts
1824
1826
  }
1825
1827
  };
1826
1828
  return transporter.request(request, requestOptions);
@@ -2119,7 +2121,7 @@ function createIngestionClient({
2119
2121
  connect: 18e4,
2120
2122
  read: 18e4,
2121
2123
  write: 18e4,
2122
- ...requestOptions == null ? void 0 : requestOptions.timeouts
2124
+ ...requestOptions?.timeouts
2123
2125
  }
2124
2126
  };
2125
2127
  return transporter.request(request, requestOptions);
@@ -2158,7 +2160,7 @@ function createIngestionClient({
2158
2160
  connect: 18e4,
2159
2161
  read: 18e4,
2160
2162
  write: 18e4,
2161
- ...requestOptions == null ? void 0 : requestOptions.timeouts
2163
+ ...requestOptions?.timeouts
2162
2164
  }
2163
2165
  };
2164
2166
  return transporter.request(request, requestOptions);