@algolia/ingestion 1.24.0 → 1.26.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 +75 -11
- package/dist/builds/browser.js +64 -9
- 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 +64 -9
- package/dist/builds/fetch.js.map +1 -1
- package/dist/builds/node.cjs +64 -9
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +64 -9
- package/dist/builds/node.js.map +1 -1
- package/dist/builds/worker.js +64 -9
- package/dist/builds/worker.js.map +1 -1
- package/dist/fetch.d.ts +75 -11
- package/dist/node.d.cts +75 -11
- package/dist/node.d.ts +75 -11
- package/dist/src/ingestionClient.cjs +64 -9
- package/dist/src/ingestionClient.cjs.map +1 -1
- package/dist/src/ingestionClient.js +64 -9
- package/dist/src/ingestionClient.js.map +1 -1
- package/dist/worker.d.ts +75 -11
- package/package.json +9 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/ingestionClient.ts
|
|
2
2
|
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
|
|
3
|
-
var apiClientVersion = "1.
|
|
3
|
+
var apiClientVersion = "1.26.0";
|
|
4
4
|
var REGIONS = ["eu", "us"];
|
|
5
5
|
function getDefaultHosts(region) {
|
|
6
6
|
const url = "data.{region}.algolia.com".replace("{region}", region);
|
|
@@ -262,12 +262,15 @@ function createIngestionClient({
|
|
|
262
262
|
if (!transformationCreate) {
|
|
263
263
|
throw new Error("Parameter `transformationCreate` is required when calling `createTransformation`.");
|
|
264
264
|
}
|
|
265
|
-
if (!transformationCreate.code) {
|
|
266
|
-
throw new Error("Parameter `transformationCreate.code` is required when calling `createTransformation`.");
|
|
267
|
-
}
|
|
268
265
|
if (!transformationCreate.name) {
|
|
269
266
|
throw new Error("Parameter `transformationCreate.name` is required when calling `createTransformation`.");
|
|
270
267
|
}
|
|
268
|
+
if (!transformationCreate.type) {
|
|
269
|
+
throw new Error("Parameter `transformationCreate.type` is required when calling `createTransformation`.");
|
|
270
|
+
}
|
|
271
|
+
if (!transformationCreate.input) {
|
|
272
|
+
throw new Error("Parameter `transformationCreate.input` is required when calling `createTransformation`.");
|
|
273
|
+
}
|
|
271
274
|
const requestPath = "/1/transformations";
|
|
272
275
|
const headers = {};
|
|
273
276
|
const queryParameters = {};
|
|
@@ -1290,7 +1293,56 @@ function createIngestionClient({
|
|
|
1290
1293
|
return transporter.request(request, requestOptions);
|
|
1291
1294
|
},
|
|
1292
1295
|
/**
|
|
1293
|
-
*
|
|
1296
|
+
* Pushes records through the Pipeline, directly to an index. You can make the call synchronous by providing the `watch` parameter, for asynchronous calls, you can use the observability endpoints and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data/), this is the recommended way of ingesting your records. This method is similar to `pushTask`, but requires an `indexName` instead of a `taskID`. If zero or many tasks are found, an error will be returned.
|
|
1297
|
+
*
|
|
1298
|
+
* Required API Key ACLs:
|
|
1299
|
+
* - addObject
|
|
1300
|
+
* - deleteIndex
|
|
1301
|
+
* - editSettings
|
|
1302
|
+
* @param push - The push object.
|
|
1303
|
+
* @param push.indexName - Name of the index on which to perform the operation.
|
|
1304
|
+
* @param push.pushTaskPayload - The pushTaskPayload object.
|
|
1305
|
+
* @param push.watch - When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
|
|
1306
|
+
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1307
|
+
*/
|
|
1308
|
+
push({ indexName, pushTaskPayload, watch }, requestOptions) {
|
|
1309
|
+
if (!indexName) {
|
|
1310
|
+
throw new Error("Parameter `indexName` is required when calling `push`.");
|
|
1311
|
+
}
|
|
1312
|
+
if (!pushTaskPayload) {
|
|
1313
|
+
throw new Error("Parameter `pushTaskPayload` is required when calling `push`.");
|
|
1314
|
+
}
|
|
1315
|
+
if (!pushTaskPayload.action) {
|
|
1316
|
+
throw new Error("Parameter `pushTaskPayload.action` is required when calling `push`.");
|
|
1317
|
+
}
|
|
1318
|
+
if (!pushTaskPayload.records) {
|
|
1319
|
+
throw new Error("Parameter `pushTaskPayload.records` is required when calling `push`.");
|
|
1320
|
+
}
|
|
1321
|
+
const requestPath = "/1/push/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
|
|
1322
|
+
const headers = {};
|
|
1323
|
+
const queryParameters = {};
|
|
1324
|
+
if (watch !== void 0) {
|
|
1325
|
+
queryParameters["watch"] = watch.toString();
|
|
1326
|
+
}
|
|
1327
|
+
const request = {
|
|
1328
|
+
method: "POST",
|
|
1329
|
+
path: requestPath,
|
|
1330
|
+
queryParameters,
|
|
1331
|
+
headers,
|
|
1332
|
+
data: pushTaskPayload
|
|
1333
|
+
};
|
|
1334
|
+
requestOptions = {
|
|
1335
|
+
timeouts: {
|
|
1336
|
+
connect: 18e4,
|
|
1337
|
+
read: 18e4,
|
|
1338
|
+
write: 18e4,
|
|
1339
|
+
...requestOptions?.timeouts
|
|
1340
|
+
}
|
|
1341
|
+
};
|
|
1342
|
+
return transporter.request(request, requestOptions);
|
|
1343
|
+
},
|
|
1344
|
+
/**
|
|
1345
|
+
* Pushes records through the Pipeline, directly to an index. You can make the call synchronous by providing the `watch` parameter, for asynchronous calls, you can use the observability endpoints and/or debugger dashboard to see the status of your task. If you want to leverage the [pre-indexing data transformation](https://www.algolia.com/doc/guides/sending-and-managing-data/send-and-update-your-data/how-to/transform-your-data/), this is the recommended way of ingesting your records. This method is similar to `push`, but requires a `taskID` instead of a `indexName`, which is useful when many `destinations` target the same `indexName`.
|
|
1294
1346
|
*
|
|
1295
1347
|
* Required API Key ACLs:
|
|
1296
1348
|
* - addObject
|
|
@@ -1298,7 +1350,7 @@ function createIngestionClient({
|
|
|
1298
1350
|
* - editSettings
|
|
1299
1351
|
* @param pushTask - The pushTask object.
|
|
1300
1352
|
* @param pushTask.taskID - Unique identifier of a task.
|
|
1301
|
-
* @param pushTask.pushTaskPayload -
|
|
1353
|
+
* @param pushTask.pushTaskPayload - The pushTaskPayload object.
|
|
1302
1354
|
* @param pushTask.watch - When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
|
|
1303
1355
|
* @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
|
|
1304
1356
|
*/
|
|
@@ -1875,12 +1927,15 @@ function createIngestionClient({
|
|
|
1875
1927
|
if (!transformationCreate) {
|
|
1876
1928
|
throw new Error("Parameter `transformationCreate` is required when calling `updateTransformation`.");
|
|
1877
1929
|
}
|
|
1878
|
-
if (!transformationCreate.code) {
|
|
1879
|
-
throw new Error("Parameter `transformationCreate.code` is required when calling `updateTransformation`.");
|
|
1880
|
-
}
|
|
1881
1930
|
if (!transformationCreate.name) {
|
|
1882
1931
|
throw new Error("Parameter `transformationCreate.name` is required when calling `updateTransformation`.");
|
|
1883
1932
|
}
|
|
1933
|
+
if (!transformationCreate.type) {
|
|
1934
|
+
throw new Error("Parameter `transformationCreate.type` is required when calling `updateTransformation`.");
|
|
1935
|
+
}
|
|
1936
|
+
if (!transformationCreate.input) {
|
|
1937
|
+
throw new Error("Parameter `transformationCreate.input` is required when calling `updateTransformation`.");
|
|
1938
|
+
}
|
|
1884
1939
|
const requestPath = "/1/transformations/{transformationID}".replace(
|
|
1885
1940
|
"{transformationID}",
|
|
1886
1941
|
encodeURIComponent(transformationID)
|