@algolia/ingestion 1.34.0 → 1.35.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.
- package/README.md +4 -4
- package/dist/browser.d.ts +1 -1
- package/dist/builds/browser.js +30 -27
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +1 -1
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +2 -2
- package/dist/builds/fetch.js +30 -27
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +30 -27
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +30 -27
- package/dist/builds/node.js.map +1 -1
- package/dist/builds/worker.js +30 -27
- package/dist/builds/worker.js.map +1 -1
- package/dist/fetch.d.ts +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/src/ingestionClient.cjs +30 -27
- package/dist/src/ingestionClient.cjs.map +1 -1
- package/dist/src/ingestionClient.js +30 -27
- package/dist/src/ingestionClient.js.map +1 -1
- package/dist/worker.d.ts +1 -1
- package/package.json +6 -6
package/dist/fetch.d.ts
CHANGED
|
@@ -2412,7 +2412,7 @@ type ChunkedPushOptions = {
|
|
|
2412
2412
|
objects: Array<Record<string, unknown>>;
|
|
2413
2413
|
};
|
|
2414
2414
|
|
|
2415
|
-
declare const apiClientVersion = "1.
|
|
2415
|
+
declare const apiClientVersion = "1.35.0";
|
|
2416
2416
|
declare const REGIONS: readonly ["eu", "us"];
|
|
2417
2417
|
type Region = (typeof REGIONS)[number];
|
|
2418
2418
|
type RegionOptions = {
|
package/dist/node.d.cts
CHANGED
|
@@ -2412,7 +2412,7 @@ type ChunkedPushOptions = {
|
|
|
2412
2412
|
objects: Array<Record<string, unknown>>;
|
|
2413
2413
|
};
|
|
2414
2414
|
|
|
2415
|
-
declare const apiClientVersion = "1.
|
|
2415
|
+
declare const apiClientVersion = "1.35.0";
|
|
2416
2416
|
declare const REGIONS: readonly ["eu", "us"];
|
|
2417
2417
|
type Region = (typeof REGIONS)[number];
|
|
2418
2418
|
type RegionOptions = {
|
package/dist/node.d.ts
CHANGED
|
@@ -2412,7 +2412,7 @@ type ChunkedPushOptions = {
|
|
|
2412
2412
|
objects: Array<Record<string, unknown>>;
|
|
2413
2413
|
};
|
|
2414
2414
|
|
|
2415
|
-
declare const apiClientVersion = "1.
|
|
2415
|
+
declare const apiClientVersion = "1.35.0";
|
|
2416
2416
|
declare const REGIONS: readonly ["eu", "us"];
|
|
2417
2417
|
type Region = (typeof REGIONS)[number];
|
|
2418
2418
|
type RegionOptions = {
|
|
@@ -29,7 +29,7 @@ __export(ingestionClient_exports, {
|
|
|
29
29
|
});
|
|
30
30
|
module.exports = __toCommonJS(ingestionClient_exports);
|
|
31
31
|
var import_client_common = require("@algolia/client-common");
|
|
32
|
-
var apiClientVersion = "1.
|
|
32
|
+
var apiClientVersion = "1.35.0";
|
|
33
33
|
var REGIONS = ["eu", "us"];
|
|
34
34
|
function getDefaultHosts(region) {
|
|
35
35
|
const url = "data.{region}.algolia.com".replace("{region}", region);
|
|
@@ -137,7 +137,9 @@ function createIngestionClient({
|
|
|
137
137
|
referenceIndexName
|
|
138
138
|
}, requestOptions) {
|
|
139
139
|
let records = [];
|
|
140
|
+
let offset = 0;
|
|
140
141
|
const responses = [];
|
|
142
|
+
const waitBatchSize = Math.floor(batchSize / 10) || batchSize;
|
|
141
143
|
const objectEntries = objects.entries();
|
|
142
144
|
for (const [i, obj] of objectEntries) {
|
|
143
145
|
records.push(obj);
|
|
@@ -147,33 +149,34 @@ function createIngestionClient({
|
|
|
147
149
|
);
|
|
148
150
|
records = [];
|
|
149
151
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");
|
|
161
|
-
}
|
|
162
|
-
return this.getEvent({ runID: resp.runID, eventID: resp.eventID }).catch((error) => {
|
|
163
|
-
if (error.status === 404) {
|
|
164
|
-
return void 0;
|
|
152
|
+
if (waitForTasks && responses.length > 0 && (responses.length % waitBatchSize === 0 || i === objects.length - 1)) {
|
|
153
|
+
for (const resp of responses.slice(offset, offset + waitBatchSize)) {
|
|
154
|
+
if (!resp.eventID) {
|
|
155
|
+
throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");
|
|
156
|
+
}
|
|
157
|
+
let retryCount = 0;
|
|
158
|
+
await (0, import_client_common.createIterablePromise)({
|
|
159
|
+
func: async () => {
|
|
160
|
+
if (resp.eventID === void 0 || !resp.eventID) {
|
|
161
|
+
throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");
|
|
165
162
|
}
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
163
|
+
return this.getEvent({ runID: resp.runID, eventID: resp.eventID }).catch((error) => {
|
|
164
|
+
if (error.status === 404) {
|
|
165
|
+
return void 0;
|
|
166
|
+
}
|
|
167
|
+
throw error;
|
|
168
|
+
});
|
|
169
|
+
},
|
|
170
|
+
validate: (response) => response !== void 0,
|
|
171
|
+
aggregator: () => retryCount += 1,
|
|
172
|
+
error: {
|
|
173
|
+
validate: () => retryCount >= 50,
|
|
174
|
+
message: () => `The maximum number of retries exceeded. (${retryCount}/${50})`
|
|
175
|
+
},
|
|
176
|
+
timeout: () => Math.min(retryCount * 500, 5e3)
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
offset += waitBatchSize;
|
|
177
180
|
}
|
|
178
181
|
}
|
|
179
182
|
return responses;
|