@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.
@@ -1,6 +1,6 @@
1
1
  // src/ingestionClient.ts
2
2
  import { createAuth, createIterablePromise, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
3
- var apiClientVersion = "1.36.0";
3
+ var apiClientVersion = "1.38.0";
4
4
  var REGIONS = ["eu", "us"];
5
5
  function getDefaultHosts(region) {
6
6
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -1326,9 +1326,10 @@ function createIngestionClient({
1326
1326
  * @param listTransformations.page - Page number of the paginated API response.
1327
1327
  * @param listTransformations.sort - Property by which to sort the list of transformations.
1328
1328
  * @param listTransformations.order - Sort order of the response, ascending or descending.
1329
+ * @param listTransformations.type - Whether to filter the list of transformations by the type of transformation.
1329
1330
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1330
1331
  */
1331
- listTransformations({ itemsPerPage, page, sort, order } = {}, requestOptions = void 0) {
1332
+ listTransformations({ itemsPerPage, page, sort, order, type } = {}, requestOptions = void 0) {
1332
1333
  const requestPath = "/1/transformations";
1333
1334
  const headers = {};
1334
1335
  const queryParameters = {};
@@ -1344,6 +1345,9 @@ function createIngestionClient({
1344
1345
  if (order !== void 0) {
1345
1346
  queryParameters["order"] = order.toString();
1346
1347
  }
1348
+ if (type !== void 0) {
1349
+ queryParameters["type"] = type.toString();
1350
+ }
1347
1351
  const request = {
1348
1352
  method: "GET",
1349
1353
  path: requestPath,
@@ -1400,13 +1404,13 @@ function createIngestionClient({
1400
1404
  connect: 18e4,
1401
1405
  read: 18e4,
1402
1406
  write: 18e4,
1403
- ...requestOptions?.timeouts
1407
+ ...requestOptions == null ? void 0 : requestOptions.timeouts
1404
1408
  }
1405
1409
  };
1406
1410
  return transporter.request(request, requestOptions);
1407
1411
  },
1408
1412
  /**
1409
- * 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`.
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 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`.
1410
1414
  *
1411
1415
  * Required API Key ACLs:
1412
1416
  * - addObject
@@ -1449,11 +1453,43 @@ function createIngestionClient({
1449
1453
  connect: 18e4,
1450
1454
  read: 18e4,
1451
1455
  write: 18e4,
1452
- ...requestOptions?.timeouts
1456
+ ...requestOptions == null ? void 0 : requestOptions.timeouts
1453
1457
  }
1454
1458
  };
1455
1459
  return transporter.request(request, requestOptions);
1456
1460
  },
1461
+ /**
1462
+ * Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields.
1463
+ * @param replaceTask - The replaceTask object.
1464
+ * @param replaceTask.taskID - Unique identifier of a task.
1465
+ * @param replaceTask.taskReplace - The taskReplace object.
1466
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1467
+ */
1468
+ replaceTask({ taskID, taskReplace }, requestOptions) {
1469
+ if (!taskID) {
1470
+ throw new Error("Parameter `taskID` is required when calling `replaceTask`.");
1471
+ }
1472
+ if (!taskReplace) {
1473
+ throw new Error("Parameter `taskReplace` is required when calling `replaceTask`.");
1474
+ }
1475
+ if (!taskReplace.destinationID) {
1476
+ throw new Error("Parameter `taskReplace.destinationID` is required when calling `replaceTask`.");
1477
+ }
1478
+ if (!taskReplace.action) {
1479
+ throw new Error("Parameter `taskReplace.action` is required when calling `replaceTask`.");
1480
+ }
1481
+ const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1482
+ const headers = {};
1483
+ const queryParameters = {};
1484
+ const request = {
1485
+ method: "PUT",
1486
+ path: requestPath,
1487
+ queryParameters,
1488
+ headers,
1489
+ data: taskReplace
1490
+ };
1491
+ return transporter.request(request, requestOptions);
1492
+ },
1457
1493
  /**
1458
1494
  * Runs all tasks linked to a source, only available for Shopify, BigCommerce and commercetools sources. Creates one run per task.
1459
1495
  *
@@ -1749,7 +1785,7 @@ function createIngestionClient({
1749
1785
  connect: 18e4,
1750
1786
  read: 18e4,
1751
1787
  write: 18e4,
1752
- ...requestOptions?.timeouts
1788
+ ...requestOptions == null ? void 0 : requestOptions.timeouts
1753
1789
  }
1754
1790
  };
1755
1791
  return transporter.request(request, requestOptions);
@@ -1922,7 +1958,7 @@ function createIngestionClient({
1922
1958
  return transporter.request(request, requestOptions);
1923
1959
  },
1924
1960
  /**
1925
- * Updates a task by its ID.
1961
+ * Partially updates a task by its ID.
1926
1962
  * @param updateTask - The updateTask object.
1927
1963
  * @param updateTask.taskID - Unique identifier of a task.
1928
1964
  * @param updateTask.taskUpdate - The taskUpdate object.
@@ -2033,7 +2069,7 @@ function createIngestionClient({
2033
2069
  connect: 18e4,
2034
2070
  read: 18e4,
2035
2071
  write: 18e4,
2036
- ...requestOptions?.timeouts
2072
+ ...requestOptions == null ? void 0 : requestOptions.timeouts
2037
2073
  }
2038
2074
  };
2039
2075
  return transporter.request(request, requestOptions);
@@ -2072,7 +2108,7 @@ function createIngestionClient({
2072
2108
  connect: 18e4,
2073
2109
  read: 18e4,
2074
2110
  write: 18e4,
2075
- ...requestOptions?.timeouts
2111
+ ...requestOptions == null ? void 0 : requestOptions.timeouts
2076
2112
  }
2077
2113
  };
2078
2114
  return transporter.request(request, requestOptions);
@@ -2087,11 +2123,4 @@ export {
2087
2123
  isScheduleTrigger,
2088
2124
  isSubscriptionTrigger
2089
2125
  };
2090
- //# sourceMappingURL=ingestionClient.js.mapEGIONS,
2091
- apiClientVersion,
2092
- createIngestionClient,
2093
- isOnDemandTrigger,
2094
- isScheduleTrigger,
2095
- isSubscriptionTrigger
2096
- };
2097
2126
  //# sourceMappingURL=ingestionClient.js.map