@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/README.md
CHANGED
|
@@ -41,11 +41,11 @@ All of our clients comes with type definition, and are available for both browse
|
|
|
41
41
|
### With a package manager
|
|
42
42
|
|
|
43
43
|
```bash
|
|
44
|
-
yarn add @algolia/ingestion@1.
|
|
44
|
+
yarn add @algolia/ingestion@1.35.0
|
|
45
45
|
# or
|
|
46
|
-
npm install @algolia/ingestion@1.
|
|
46
|
+
npm install @algolia/ingestion@1.35.0
|
|
47
47
|
# or
|
|
48
|
-
pnpm add @algolia/ingestion@1.
|
|
48
|
+
pnpm add @algolia/ingestion@1.35.0
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
### Without a package manager
|
|
@@ -53,7 +53,7 @@ pnpm add @algolia/ingestion@1.34.0
|
|
|
53
53
|
Add the following JavaScript snippet to the <head> of your website:
|
|
54
54
|
|
|
55
55
|
```html
|
|
56
|
-
<script src="https://cdn.jsdelivr.net/npm/@algolia/ingestion@1.
|
|
56
|
+
<script src="https://cdn.jsdelivr.net/npm/@algolia/ingestion@1.35.0/dist/builds/browser.umd.js"></script>
|
|
57
57
|
```
|
|
58
58
|
|
|
59
59
|
### Usage
|
package/dist/browser.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/builds/browser.js
CHANGED
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
// src/ingestionClient.ts
|
|
11
11
|
import { createAuth, createIterablePromise, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
|
|
12
|
-
var apiClientVersion = "1.
|
|
12
|
+
var apiClientVersion = "1.35.0";
|
|
13
13
|
var REGIONS = ["eu", "us"];
|
|
14
14
|
function getDefaultHosts(region) {
|
|
15
15
|
const url = "data.{region}.algolia.com".replace("{region}", region);
|
|
@@ -117,7 +117,9 @@ function createIngestionClient({
|
|
|
117
117
|
referenceIndexName
|
|
118
118
|
}, requestOptions) {
|
|
119
119
|
let records = [];
|
|
120
|
+
let offset = 0;
|
|
120
121
|
const responses = [];
|
|
122
|
+
const waitBatchSize = Math.floor(batchSize / 10) || batchSize;
|
|
121
123
|
const objectEntries = objects.entries();
|
|
122
124
|
for (const [i, obj] of objectEntries) {
|
|
123
125
|
records.push(obj);
|
|
@@ -127,33 +129,34 @@ function createIngestionClient({
|
|
|
127
129
|
);
|
|
128
130
|
records = [];
|
|
129
131
|
}
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");
|
|
141
|
-
}
|
|
142
|
-
return this.getEvent({ runID: resp.runID, eventID: resp.eventID }).catch((error) => {
|
|
143
|
-
if (error.status === 404) {
|
|
144
|
-
return void 0;
|
|
132
|
+
if (waitForTasks && responses.length > 0 && (responses.length % waitBatchSize === 0 || i === objects.length - 1)) {
|
|
133
|
+
for (const resp of responses.slice(offset, offset + waitBatchSize)) {
|
|
134
|
+
if (!resp.eventID) {
|
|
135
|
+
throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");
|
|
136
|
+
}
|
|
137
|
+
let retryCount = 0;
|
|
138
|
+
await createIterablePromise({
|
|
139
|
+
func: async () => {
|
|
140
|
+
if (resp.eventID === void 0 || !resp.eventID) {
|
|
141
|
+
throw new Error("received unexpected response from the push endpoint, eventID must not be undefined");
|
|
145
142
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
143
|
+
return this.getEvent({ runID: resp.runID, eventID: resp.eventID }).catch((error) => {
|
|
144
|
+
if (error.status === 404) {
|
|
145
|
+
return void 0;
|
|
146
|
+
}
|
|
147
|
+
throw error;
|
|
148
|
+
});
|
|
149
|
+
},
|
|
150
|
+
validate: (response) => response !== void 0,
|
|
151
|
+
aggregator: () => retryCount += 1,
|
|
152
|
+
error: {
|
|
153
|
+
validate: () => retryCount >= 50,
|
|
154
|
+
message: () => `The maximum number of retries exceeded. (${retryCount}/${50})`
|
|
155
|
+
},
|
|
156
|
+
timeout: () => Math.min(retryCount * 500, 5e3)
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
offset += waitBatchSize;
|
|
157
160
|
}
|
|
158
161
|
}
|
|
159
162
|
return responses;
|