@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.
@@ -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.24.0";
32
+ var apiClientVersion = "1.26.0";
33
33
  var REGIONS = ["eu", "us"];
34
34
  function getDefaultHosts(region) {
35
35
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -291,12 +291,15 @@ function createIngestionClient({
291
291
  if (!transformationCreate) {
292
292
  throw new Error("Parameter `transformationCreate` is required when calling `createTransformation`.");
293
293
  }
294
- if (!transformationCreate.code) {
295
- throw new Error("Parameter `transformationCreate.code` is required when calling `createTransformation`.");
296
- }
297
294
  if (!transformationCreate.name) {
298
295
  throw new Error("Parameter `transformationCreate.name` is required when calling `createTransformation`.");
299
296
  }
297
+ if (!transformationCreate.type) {
298
+ throw new Error("Parameter `transformationCreate.type` is required when calling `createTransformation`.");
299
+ }
300
+ if (!transformationCreate.input) {
301
+ throw new Error("Parameter `transformationCreate.input` is required when calling `createTransformation`.");
302
+ }
300
303
  const requestPath = "/1/transformations";
301
304
  const headers = {};
302
305
  const queryParameters = {};
@@ -1319,7 +1322,56 @@ function createIngestionClient({
1319
1322
  return transporter.request(request, requestOptions);
1320
1323
  },
1321
1324
  /**
1322
- * Push a `batch` request payload through the Pipeline. You can check the status of task pushes with the observability endpoints.
1325
+ * 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.
1326
+ *
1327
+ * Required API Key ACLs:
1328
+ * - addObject
1329
+ * - deleteIndex
1330
+ * - editSettings
1331
+ * @param push - The push object.
1332
+ * @param push.indexName - Name of the index on which to perform the operation.
1333
+ * @param push.pushTaskPayload - The pushTaskPayload object.
1334
+ * @param push.watch - When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
1335
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1336
+ */
1337
+ push({ indexName, pushTaskPayload, watch }, requestOptions) {
1338
+ if (!indexName) {
1339
+ throw new Error("Parameter `indexName` is required when calling `push`.");
1340
+ }
1341
+ if (!pushTaskPayload) {
1342
+ throw new Error("Parameter `pushTaskPayload` is required when calling `push`.");
1343
+ }
1344
+ if (!pushTaskPayload.action) {
1345
+ throw new Error("Parameter `pushTaskPayload.action` is required when calling `push`.");
1346
+ }
1347
+ if (!pushTaskPayload.records) {
1348
+ throw new Error("Parameter `pushTaskPayload.records` is required when calling `push`.");
1349
+ }
1350
+ const requestPath = "/1/push/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
1351
+ const headers = {};
1352
+ const queryParameters = {};
1353
+ if (watch !== void 0) {
1354
+ queryParameters["watch"] = watch.toString();
1355
+ }
1356
+ const request = {
1357
+ method: "POST",
1358
+ path: requestPath,
1359
+ queryParameters,
1360
+ headers,
1361
+ data: pushTaskPayload
1362
+ };
1363
+ requestOptions = {
1364
+ timeouts: {
1365
+ connect: 18e4,
1366
+ read: 18e4,
1367
+ write: 18e4,
1368
+ ...requestOptions == null ? void 0 : requestOptions.timeouts
1369
+ }
1370
+ };
1371
+ return transporter.request(request, requestOptions);
1372
+ },
1373
+ /**
1374
+ * 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`.
1323
1375
  *
1324
1376
  * Required API Key ACLs:
1325
1377
  * - addObject
@@ -1327,7 +1379,7 @@ function createIngestionClient({
1327
1379
  * - editSettings
1328
1380
  * @param pushTask - The pushTask object.
1329
1381
  * @param pushTask.taskID - Unique identifier of a task.
1330
- * @param pushTask.pushTaskPayload - Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
1382
+ * @param pushTask.pushTaskPayload - The pushTaskPayload object.
1331
1383
  * @param pushTask.watch - When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
1332
1384
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1333
1385
  */
@@ -1904,12 +1956,15 @@ function createIngestionClient({
1904
1956
  if (!transformationCreate) {
1905
1957
  throw new Error("Parameter `transformationCreate` is required when calling `updateTransformation`.");
1906
1958
  }
1907
- if (!transformationCreate.code) {
1908
- throw new Error("Parameter `transformationCreate.code` is required when calling `updateTransformation`.");
1909
- }
1910
1959
  if (!transformationCreate.name) {
1911
1960
  throw new Error("Parameter `transformationCreate.name` is required when calling `updateTransformation`.");
1912
1961
  }
1962
+ if (!transformationCreate.type) {
1963
+ throw new Error("Parameter `transformationCreate.type` is required when calling `updateTransformation`.");
1964
+ }
1965
+ if (!transformationCreate.input) {
1966
+ throw new Error("Parameter `transformationCreate.input` is required when calling `updateTransformation`.");
1967
+ }
1913
1968
  const requestPath = "/1/transformations/{transformationID}".replace(
1914
1969
  "{transformationID}",
1915
1970
  encodeURIComponent(transformationID)