@algolia/ingestion 1.36.0 → 1.38.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.
@@ -4,7 +4,7 @@ import { createFetchRequester } from "@algolia/requester-fetch";
4
4
 
5
5
  // src/ingestionClient.ts
6
6
  import { createAuth, createIterablePromise, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
7
- var apiClientVersion = "1.36.0";
7
+ var apiClientVersion = "1.38.0";
8
8
  var REGIONS = ["eu", "us"];
9
9
  function getDefaultHosts(region) {
10
10
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -1330,9 +1330,10 @@ function createIngestionClient({
1330
1330
  * @param listTransformations.page - Page number of the paginated API response.
1331
1331
  * @param listTransformations.sort - Property by which to sort the list of transformations.
1332
1332
  * @param listTransformations.order - Sort order of the response, ascending or descending.
1333
+ * @param listTransformations.type - Whether to filter the list of transformations by the type of transformation.
1333
1334
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1334
1335
  */
1335
- listTransformations({ itemsPerPage, page, sort, order } = {}, requestOptions = void 0) {
1336
+ listTransformations({ itemsPerPage, page, sort, order, type } = {}, requestOptions = void 0) {
1336
1337
  const requestPath = "/1/transformations";
1337
1338
  const headers = {};
1338
1339
  const queryParameters = {};
@@ -1348,6 +1349,9 @@ function createIngestionClient({
1348
1349
  if (order !== void 0) {
1349
1350
  queryParameters["order"] = order.toString();
1350
1351
  }
1352
+ if (type !== void 0) {
1353
+ queryParameters["type"] = type.toString();
1354
+ }
1351
1355
  const request = {
1352
1356
  method: "GET",
1353
1357
  path: requestPath,
@@ -1410,7 +1414,7 @@ function createIngestionClient({
1410
1414
  return transporter.request(request, requestOptions);
1411
1415
  },
1412
1416
  /**
1413
- * 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`.
1417
+ * 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 or the debugger dashboard to see the status of your task. If you want to transform your data before indexing, 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`.
1414
1418
  *
1415
1419
  * Required API Key ACLs:
1416
1420
  * - addObject
@@ -1458,6 +1462,38 @@ function createIngestionClient({
1458
1462
  };
1459
1463
  return transporter.request(request, requestOptions);
1460
1464
  },
1465
+ /**
1466
+ * Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields.
1467
+ * @param replaceTask - The replaceTask object.
1468
+ * @param replaceTask.taskID - Unique identifier of a task.
1469
+ * @param replaceTask.taskReplace - The taskReplace object.
1470
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1471
+ */
1472
+ replaceTask({ taskID, taskReplace }, requestOptions) {
1473
+ if (!taskID) {
1474
+ throw new Error("Parameter `taskID` is required when calling `replaceTask`.");
1475
+ }
1476
+ if (!taskReplace) {
1477
+ throw new Error("Parameter `taskReplace` is required when calling `replaceTask`.");
1478
+ }
1479
+ if (!taskReplace.destinationID) {
1480
+ throw new Error("Parameter `taskReplace.destinationID` is required when calling `replaceTask`.");
1481
+ }
1482
+ if (!taskReplace.action) {
1483
+ throw new Error("Parameter `taskReplace.action` is required when calling `replaceTask`.");
1484
+ }
1485
+ const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1486
+ const headers = {};
1487
+ const queryParameters = {};
1488
+ const request = {
1489
+ method: "PUT",
1490
+ path: requestPath,
1491
+ queryParameters,
1492
+ headers,
1493
+ data: taskReplace
1494
+ };
1495
+ return transporter.request(request, requestOptions);
1496
+ },
1461
1497
  /**
1462
1498
  * Runs all tasks linked to a source, only available for Shopify, BigCommerce and commercetools sources. Creates one run per task.
1463
1499
  *
@@ -1926,7 +1962,7 @@ function createIngestionClient({
1926
1962
  return transporter.request(request, requestOptions);
1927
1963
  },
1928
1964
  /**
1929
- * Updates a task by its ID.
1965
+ * Partially updates a task by its ID.
1930
1966
  * @param updateTask - The updateTask object.
1931
1967
  * @param updateTask.taskID - Unique identifier of a task.
1932
1968
  * @param updateTask.taskUpdate - The taskUpdate object.