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