@algolia/ingestion 1.52.1 → 1.54.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.
@@ -33,7 +33,7 @@ var import_requester_node_http = require("@algolia/requester-node-http");
33
33
 
34
34
  // src/ingestionClient.ts
35
35
  var import_client_common = require("@algolia/client-common");
36
- var apiClientVersion = "1.52.1";
36
+ var apiClientVersion = "1.54.0";
37
37
  var REGIONS = ["eu", "us"];
38
38
  function getDefaultHosts(region) {
39
39
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -130,6 +130,7 @@ function createIngestionClient({
130
130
  * @param chunkedPush.waitForTasks - Whether or not we should wait until every `batch` tasks has been processed, this operation may slow the total execution time of this method but is more reliable.
131
131
  * @param chunkedPush.batchSize - The size of the chunk of `objects`. The number of `batch` calls will be equal to `length(objects) / batchSize`. Defaults to 1000.
132
132
  * @param chunkedPush.referenceIndexName - This is required when targeting an index that does not have a push connector setup (e.g. a tmp index), but you wish to attach another index's transformation to it (e.g. the source index name).
133
+ * @param chunkedPush.maxRetries - The maximum number of retries when polling for task completion. 100 by default.
133
134
  * @param requestOptions - The requestOptions to send along with the query, they will be forwarded to the `getEvent` method and merged with the transporter requestOptions.
134
135
  */
135
136
  async chunkedPush({
@@ -138,7 +139,8 @@ function createIngestionClient({
138
139
  action = "addObject",
139
140
  waitForTasks,
140
141
  batchSize = 1e3,
141
- referenceIndexName
142
+ referenceIndexName,
143
+ maxRetries = 100
142
144
  }, requestOptions) {
143
145
  let records = [];
144
146
  let offset = 0;
@@ -174,8 +176,8 @@ function createIngestionClient({
174
176
  validate: (response) => response !== void 0,
175
177
  aggregator: () => retryCount += 1,
176
178
  error: {
177
- validate: () => retryCount >= 50,
178
- message: () => `The maximum number of retries exceeded. (${retryCount}/${50})`
179
+ validate: () => retryCount >= maxRetries,
180
+ message: () => `Stopped waiting for the task after ${maxRetries} retries. This does not mean the operation failed; it may still complete. If you need to keep polling, retry with a higher maxRetries.`
179
181
  },
180
182
  timeout: () => Math.min(retryCount * 1500, 5e3)
181
183
  });
@@ -196,18 +198,10 @@ function createIngestionClient({
196
198
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
197
199
  */
198
200
  createAuthentication(authenticationCreate, requestOptions) {
199
- if (!authenticationCreate) {
200
- throw new Error("Parameter `authenticationCreate` is required when calling `createAuthentication`.");
201
- }
202
- if (!authenticationCreate.type) {
203
- throw new Error("Parameter `authenticationCreate.type` is required when calling `createAuthentication`.");
204
- }
205
- if (!authenticationCreate.name) {
206
- throw new Error("Parameter `authenticationCreate.name` is required when calling `createAuthentication`.");
207
- }
208
- if (!authenticationCreate.input) {
209
- throw new Error("Parameter `authenticationCreate.input` is required when calling `createAuthentication`.");
210
- }
201
+ (0, import_client_common.validateRequired)("authenticationCreate", "createAuthentication", authenticationCreate);
202
+ (0, import_client_common.validateRequired)("authenticationCreate.type", "createAuthentication", authenticationCreate.type);
203
+ (0, import_client_common.validateRequired)("authenticationCreate.name", "createAuthentication", authenticationCreate.name);
204
+ (0, import_client_common.validateRequired)("authenticationCreate.input", "createAuthentication", authenticationCreate.input);
211
205
  const requestPath = "/1/authentications";
212
206
  const headers = {};
213
207
  const queryParameters = {};
@@ -231,18 +225,10 @@ function createIngestionClient({
231
225
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
232
226
  */
233
227
  createDestination(destinationCreate, requestOptions) {
234
- if (!destinationCreate) {
235
- throw new Error("Parameter `destinationCreate` is required when calling `createDestination`.");
236
- }
237
- if (!destinationCreate.type) {
238
- throw new Error("Parameter `destinationCreate.type` is required when calling `createDestination`.");
239
- }
240
- if (!destinationCreate.name) {
241
- throw new Error("Parameter `destinationCreate.name` is required when calling `createDestination`.");
242
- }
243
- if (!destinationCreate.input) {
244
- throw new Error("Parameter `destinationCreate.input` is required when calling `createDestination`.");
245
- }
228
+ (0, import_client_common.validateRequired)("destinationCreate", "createDestination", destinationCreate);
229
+ (0, import_client_common.validateRequired)("destinationCreate.type", "createDestination", destinationCreate.type);
230
+ (0, import_client_common.validateRequired)("destinationCreate.name", "createDestination", destinationCreate.name);
231
+ (0, import_client_common.validateRequired)("destinationCreate.input", "createDestination", destinationCreate.input);
246
232
  const requestPath = "/1/destinations";
247
233
  const headers = {};
248
234
  const queryParameters = {};
@@ -266,15 +252,9 @@ function createIngestionClient({
266
252
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
267
253
  */
268
254
  createSource(sourceCreate, requestOptions) {
269
- if (!sourceCreate) {
270
- throw new Error("Parameter `sourceCreate` is required when calling `createSource`.");
271
- }
272
- if (!sourceCreate.type) {
273
- throw new Error("Parameter `sourceCreate.type` is required when calling `createSource`.");
274
- }
275
- if (!sourceCreate.name) {
276
- throw new Error("Parameter `sourceCreate.name` is required when calling `createSource`.");
277
- }
255
+ (0, import_client_common.validateRequired)("sourceCreate", "createSource", sourceCreate);
256
+ (0, import_client_common.validateRequired)("sourceCreate.type", "createSource", sourceCreate.type);
257
+ (0, import_client_common.validateRequired)("sourceCreate.name", "createSource", sourceCreate.name);
278
258
  const requestPath = "/1/sources";
279
259
  const headers = {};
280
260
  const queryParameters = {};
@@ -298,18 +278,10 @@ function createIngestionClient({
298
278
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
299
279
  */
300
280
  createTask(taskCreate, requestOptions) {
301
- if (!taskCreate) {
302
- throw new Error("Parameter `taskCreate` is required when calling `createTask`.");
303
- }
304
- if (!taskCreate.sourceID) {
305
- throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTask`.");
306
- }
307
- if (!taskCreate.destinationID) {
308
- throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTask`.");
309
- }
310
- if (!taskCreate.action) {
311
- throw new Error("Parameter `taskCreate.action` is required when calling `createTask`.");
312
- }
281
+ (0, import_client_common.validateRequired)("taskCreate", "createTask", taskCreate);
282
+ (0, import_client_common.validateRequired)("taskCreate.sourceID", "createTask", taskCreate.sourceID);
283
+ (0, import_client_common.validateRequired)("taskCreate.destinationID", "createTask", taskCreate.destinationID);
284
+ (0, import_client_common.validateRequired)("taskCreate.action", "createTask", taskCreate.action);
313
285
  const requestPath = "/2/tasks";
314
286
  const headers = {};
315
287
  const queryParameters = {};
@@ -335,21 +307,11 @@ function createIngestionClient({
335
307
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
336
308
  */
337
309
  createTaskV1(taskCreate, requestOptions) {
338
- if (!taskCreate) {
339
- throw new Error("Parameter `taskCreate` is required when calling `createTaskV1`.");
340
- }
341
- if (!taskCreate.sourceID) {
342
- throw new Error("Parameter `taskCreate.sourceID` is required when calling `createTaskV1`.");
343
- }
344
- if (!taskCreate.destinationID) {
345
- throw new Error("Parameter `taskCreate.destinationID` is required when calling `createTaskV1`.");
346
- }
347
- if (!taskCreate.trigger) {
348
- throw new Error("Parameter `taskCreate.trigger` is required when calling `createTaskV1`.");
349
- }
350
- if (!taskCreate.action) {
351
- throw new Error("Parameter `taskCreate.action` is required when calling `createTaskV1`.");
352
- }
310
+ (0, import_client_common.validateRequired)("taskCreate", "createTaskV1", taskCreate);
311
+ (0, import_client_common.validateRequired)("taskCreate.sourceID", "createTaskV1", taskCreate.sourceID);
312
+ (0, import_client_common.validateRequired)("taskCreate.destinationID", "createTaskV1", taskCreate.destinationID);
313
+ (0, import_client_common.validateRequired)("taskCreate.trigger", "createTaskV1", taskCreate.trigger);
314
+ (0, import_client_common.validateRequired)("taskCreate.action", "createTaskV1", taskCreate.action);
353
315
  const requestPath = "/1/tasks";
354
316
  const headers = {};
355
317
  const queryParameters = {};
@@ -373,12 +335,8 @@ function createIngestionClient({
373
335
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
374
336
  */
375
337
  createTransformation(transformationCreate, requestOptions) {
376
- if (!transformationCreate) {
377
- throw new Error("Parameter `transformationCreate` is required when calling `createTransformation`.");
378
- }
379
- if (!transformationCreate.name) {
380
- throw new Error("Parameter `transformationCreate.name` is required when calling `createTransformation`.");
381
- }
338
+ (0, import_client_common.validateRequired)("transformationCreate", "createTransformation", transformationCreate);
339
+ (0, import_client_common.validateRequired)("transformationCreate.name", "createTransformation", transformationCreate.name);
382
340
  const requestPath = "/1/transformations";
383
341
  const headers = {};
384
342
  const queryParameters = {};
@@ -399,9 +357,7 @@ function createIngestionClient({
399
357
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
400
358
  */
401
359
  customDelete({ path, parameters }, requestOptions) {
402
- if (!path) {
403
- throw new Error("Parameter `path` is required when calling `customDelete`.");
404
- }
360
+ (0, import_client_common.validateRequired)("path", "customDelete", path);
405
361
  const requestPath = "/{path}".replace("{path}", path);
406
362
  const headers = {};
407
363
  const queryParameters = parameters ? parameters : {};
@@ -421,9 +377,7 @@ function createIngestionClient({
421
377
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
422
378
  */
423
379
  customGet({ path, parameters }, requestOptions) {
424
- if (!path) {
425
- throw new Error("Parameter `path` is required when calling `customGet`.");
426
- }
380
+ (0, import_client_common.validateRequired)("path", "customGet", path);
427
381
  const requestPath = "/{path}".replace("{path}", path);
428
382
  const headers = {};
429
383
  const queryParameters = parameters ? parameters : {};
@@ -444,9 +398,7 @@ function createIngestionClient({
444
398
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
445
399
  */
446
400
  customPost({ path, parameters, body }, requestOptions) {
447
- if (!path) {
448
- throw new Error("Parameter `path` is required when calling `customPost`.");
449
- }
401
+ (0, import_client_common.validateRequired)("path", "customPost", path);
450
402
  const requestPath = "/{path}".replace("{path}", path);
451
403
  const headers = {};
452
404
  const queryParameters = parameters ? parameters : {};
@@ -468,9 +420,7 @@ function createIngestionClient({
468
420
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
469
421
  */
470
422
  customPut({ path, parameters, body }, requestOptions) {
471
- if (!path) {
472
- throw new Error("Parameter `path` is required when calling `customPut`.");
473
- }
423
+ (0, import_client_common.validateRequired)("path", "customPut", path);
474
424
  const requestPath = "/{path}".replace("{path}", path);
475
425
  const headers = {};
476
426
  const queryParameters = parameters ? parameters : {};
@@ -495,9 +445,7 @@ function createIngestionClient({
495
445
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
496
446
  */
497
447
  deleteAuthentication({ authenticationID }, requestOptions) {
498
- if (!authenticationID) {
499
- throw new Error("Parameter `authenticationID` is required when calling `deleteAuthentication`.");
500
- }
448
+ (0, import_client_common.validateRequired)("authenticationID", "deleteAuthentication", authenticationID);
501
449
  const requestPath = "/1/authentications/{authenticationID}".replace(
502
450
  "{authenticationID}",
503
451
  encodeURIComponent(authenticationID)
@@ -524,9 +472,7 @@ function createIngestionClient({
524
472
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
525
473
  */
526
474
  deleteDestination({ destinationID }, requestOptions) {
527
- if (!destinationID) {
528
- throw new Error("Parameter `destinationID` is required when calling `deleteDestination`.");
529
- }
475
+ (0, import_client_common.validateRequired)("destinationID", "deleteDestination", destinationID);
530
476
  const requestPath = "/1/destinations/{destinationID}".replace(
531
477
  "{destinationID}",
532
478
  encodeURIComponent(destinationID)
@@ -553,9 +499,7 @@ function createIngestionClient({
553
499
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
554
500
  */
555
501
  deleteSource({ sourceID }, requestOptions) {
556
- if (!sourceID) {
557
- throw new Error("Parameter `sourceID` is required when calling `deleteSource`.");
558
- }
502
+ (0, import_client_common.validateRequired)("sourceID", "deleteSource", sourceID);
559
503
  const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
560
504
  const headers = {};
561
505
  const queryParameters = {};
@@ -579,9 +523,7 @@ function createIngestionClient({
579
523
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
580
524
  */
581
525
  deleteTask({ taskID }, requestOptions) {
582
- if (!taskID) {
583
- throw new Error("Parameter `taskID` is required when calling `deleteTask`.");
584
- }
526
+ (0, import_client_common.validateRequired)("taskID", "deleteTask", taskID);
585
527
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
586
528
  const headers = {};
587
529
  const queryParameters = {};
@@ -607,9 +549,7 @@ function createIngestionClient({
607
549
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
608
550
  */
609
551
  deleteTaskV1({ taskID }, requestOptions) {
610
- if (!taskID) {
611
- throw new Error("Parameter `taskID` is required when calling `deleteTaskV1`.");
612
- }
552
+ (0, import_client_common.validateRequired)("taskID", "deleteTaskV1", taskID);
613
553
  const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
614
554
  const headers = {};
615
555
  const queryParameters = {};
@@ -633,9 +573,7 @@ function createIngestionClient({
633
573
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
634
574
  */
635
575
  deleteTransformation({ transformationID }, requestOptions) {
636
- if (!transformationID) {
637
- throw new Error("Parameter `transformationID` is required when calling `deleteTransformation`.");
638
- }
576
+ (0, import_client_common.validateRequired)("transformationID", "deleteTransformation", transformationID);
639
577
  const requestPath = "/1/transformations/{transformationID}".replace(
640
578
  "{transformationID}",
641
579
  encodeURIComponent(transformationID)
@@ -662,9 +600,7 @@ function createIngestionClient({
662
600
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
663
601
  */
664
602
  disableTask({ taskID }, requestOptions) {
665
- if (!taskID) {
666
- throw new Error("Parameter `taskID` is required when calling `disableTask`.");
667
- }
603
+ (0, import_client_common.validateRequired)("taskID", "disableTask", taskID);
668
604
  const requestPath = "/2/tasks/{taskID}/disable".replace("{taskID}", encodeURIComponent(taskID));
669
605
  const headers = {};
670
606
  const queryParameters = {};
@@ -690,9 +626,7 @@ function createIngestionClient({
690
626
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
691
627
  */
692
628
  disableTaskV1({ taskID }, requestOptions) {
693
- if (!taskID) {
694
- throw new Error("Parameter `taskID` is required when calling `disableTaskV1`.");
695
- }
629
+ (0, import_client_common.validateRequired)("taskID", "disableTaskV1", taskID);
696
630
  const requestPath = "/1/tasks/{taskID}/disable".replace("{taskID}", encodeURIComponent(taskID));
697
631
  const headers = {};
698
632
  const queryParameters = {};
@@ -716,9 +650,7 @@ function createIngestionClient({
716
650
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
717
651
  */
718
652
  enableTask({ taskID }, requestOptions) {
719
- if (!taskID) {
720
- throw new Error("Parameter `taskID` is required when calling `enableTask`.");
721
- }
653
+ (0, import_client_common.validateRequired)("taskID", "enableTask", taskID);
722
654
  const requestPath = "/2/tasks/{taskID}/enable".replace("{taskID}", encodeURIComponent(taskID));
723
655
  const headers = {};
724
656
  const queryParameters = {};
@@ -744,9 +676,7 @@ function createIngestionClient({
744
676
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
745
677
  */
746
678
  enableTaskV1({ taskID }, requestOptions) {
747
- if (!taskID) {
748
- throw new Error("Parameter `taskID` is required when calling `enableTaskV1`.");
749
- }
679
+ (0, import_client_common.validateRequired)("taskID", "enableTaskV1", taskID);
750
680
  const requestPath = "/1/tasks/{taskID}/enable".replace("{taskID}", encodeURIComponent(taskID));
751
681
  const headers = {};
752
682
  const queryParameters = {};
@@ -770,9 +700,7 @@ function createIngestionClient({
770
700
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
771
701
  */
772
702
  getAuthentication({ authenticationID }, requestOptions) {
773
- if (!authenticationID) {
774
- throw new Error("Parameter `authenticationID` is required when calling `getAuthentication`.");
775
- }
703
+ (0, import_client_common.validateRequired)("authenticationID", "getAuthentication", authenticationID);
776
704
  const requestPath = "/1/authentications/{authenticationID}".replace(
777
705
  "{authenticationID}",
778
706
  encodeURIComponent(authenticationID)
@@ -799,9 +727,7 @@ function createIngestionClient({
799
727
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
800
728
  */
801
729
  getDestination({ destinationID }, requestOptions) {
802
- if (!destinationID) {
803
- throw new Error("Parameter `destinationID` is required when calling `getDestination`.");
804
- }
730
+ (0, import_client_common.validateRequired)("destinationID", "getDestination", destinationID);
805
731
  const requestPath = "/1/destinations/{destinationID}".replace(
806
732
  "{destinationID}",
807
733
  encodeURIComponent(destinationID)
@@ -829,12 +755,8 @@ function createIngestionClient({
829
755
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
830
756
  */
831
757
  getEvent({ runID, eventID }, requestOptions) {
832
- if (!runID) {
833
- throw new Error("Parameter `runID` is required when calling `getEvent`.");
834
- }
835
- if (!eventID) {
836
- throw new Error("Parameter `eventID` is required when calling `getEvent`.");
837
- }
758
+ (0, import_client_common.validateRequired)("runID", "getEvent", runID);
759
+ (0, import_client_common.validateRequired)("eventID", "getEvent", eventID);
838
760
  const requestPath = "/1/runs/{runID}/events/{eventID}".replace("{runID}", encodeURIComponent(runID)).replace("{eventID}", encodeURIComponent(eventID));
839
761
  const headers = {};
840
762
  const queryParameters = {};
@@ -858,9 +780,7 @@ function createIngestionClient({
858
780
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
859
781
  */
860
782
  getRun({ runID }, requestOptions) {
861
- if (!runID) {
862
- throw new Error("Parameter `runID` is required when calling `getRun`.");
863
- }
783
+ (0, import_client_common.validateRequired)("runID", "getRun", runID);
864
784
  const requestPath = "/1/runs/{runID}".replace("{runID}", encodeURIComponent(runID));
865
785
  const headers = {};
866
786
  const queryParameters = {};
@@ -884,9 +804,7 @@ function createIngestionClient({
884
804
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
885
805
  */
886
806
  getSource({ sourceID }, requestOptions) {
887
- if (!sourceID) {
888
- throw new Error("Parameter `sourceID` is required when calling `getSource`.");
889
- }
807
+ (0, import_client_common.validateRequired)("sourceID", "getSource", sourceID);
890
808
  const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
891
809
  const headers = {};
892
810
  const queryParameters = {};
@@ -910,9 +828,7 @@ function createIngestionClient({
910
828
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
911
829
  */
912
830
  getTask({ taskID }, requestOptions) {
913
- if (!taskID) {
914
- throw new Error("Parameter `taskID` is required when calling `getTask`.");
915
- }
831
+ (0, import_client_common.validateRequired)("taskID", "getTask", taskID);
916
832
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
917
833
  const headers = {};
918
834
  const queryParameters = {};
@@ -938,9 +854,7 @@ function createIngestionClient({
938
854
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
939
855
  */
940
856
  getTaskV1({ taskID }, requestOptions) {
941
- if (!taskID) {
942
- throw new Error("Parameter `taskID` is required when calling `getTaskV1`.");
943
- }
857
+ (0, import_client_common.validateRequired)("taskID", "getTaskV1", taskID);
944
858
  const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
945
859
  const headers = {};
946
860
  const queryParameters = {};
@@ -964,9 +878,7 @@ function createIngestionClient({
964
878
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
965
879
  */
966
880
  getTransformation({ transformationID }, requestOptions) {
967
- if (!transformationID) {
968
- throw new Error("Parameter `transformationID` is required when calling `getTransformation`.");
969
- }
881
+ (0, import_client_common.validateRequired)("transformationID", "getTransformation", transformationID);
970
882
  const requestPath = "/1/transformations/{transformationID}".replace(
971
883
  "{transformationID}",
972
884
  encodeURIComponent(transformationID)
@@ -1097,9 +1009,7 @@ function createIngestionClient({
1097
1009
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1098
1010
  */
1099
1011
  listEvents({ runID, itemsPerPage, page, status, type, sort, order, startDate, endDate }, requestOptions) {
1100
- if (!runID) {
1101
- throw new Error("Parameter `runID` is required when calling `listEvents`.");
1102
- }
1012
+ (0, import_client_common.validateRequired)("runID", "listEvents", runID);
1103
1013
  const requestPath = "/1/runs/{runID}/events".replace("{runID}", encodeURIComponent(runID));
1104
1014
  const headers = {};
1105
1015
  const queryParameters = {};
@@ -1434,18 +1344,10 @@ function createIngestionClient({
1434
1344
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1435
1345
  */
1436
1346
  push({ indexName, pushTaskPayload, watch, referenceIndexName }, requestOptions) {
1437
- if (!indexName) {
1438
- throw new Error("Parameter `indexName` is required when calling `push`.");
1439
- }
1440
- if (!pushTaskPayload) {
1441
- throw new Error("Parameter `pushTaskPayload` is required when calling `push`.");
1442
- }
1443
- if (!pushTaskPayload.action) {
1444
- throw new Error("Parameter `pushTaskPayload.action` is required when calling `push`.");
1445
- }
1446
- if (!pushTaskPayload.records) {
1447
- throw new Error("Parameter `pushTaskPayload.records` is required when calling `push`.");
1448
- }
1347
+ (0, import_client_common.validateRequired)("indexName", "push", indexName);
1348
+ (0, import_client_common.validateRequired)("pushTaskPayload", "push", pushTaskPayload);
1349
+ (0, import_client_common.validateRequired)("pushTaskPayload.action", "push", pushTaskPayload.action);
1350
+ (0, import_client_common.validateRequired)("pushTaskPayload.records", "push", pushTaskPayload.records);
1449
1351
  const requestPath = "/1/push/{indexName}".replace("{indexName}", encodeURIComponent(indexName));
1450
1352
  const headers = {};
1451
1353
  const queryParameters = {};
@@ -1486,18 +1388,10 @@ function createIngestionClient({
1486
1388
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1487
1389
  */
1488
1390
  pushTask({ taskID, pushTaskPayload, watch }, requestOptions) {
1489
- if (!taskID) {
1490
- throw new Error("Parameter `taskID` is required when calling `pushTask`.");
1491
- }
1492
- if (!pushTaskPayload) {
1493
- throw new Error("Parameter `pushTaskPayload` is required when calling `pushTask`.");
1494
- }
1495
- if (!pushTaskPayload.action) {
1496
- throw new Error("Parameter `pushTaskPayload.action` is required when calling `pushTask`.");
1497
- }
1498
- if (!pushTaskPayload.records) {
1499
- throw new Error("Parameter `pushTaskPayload.records` is required when calling `pushTask`.");
1500
- }
1391
+ (0, import_client_common.validateRequired)("taskID", "pushTask", taskID);
1392
+ (0, import_client_common.validateRequired)("pushTaskPayload", "pushTask", pushTaskPayload);
1393
+ (0, import_client_common.validateRequired)("pushTaskPayload.action", "pushTask", pushTaskPayload.action);
1394
+ (0, import_client_common.validateRequired)("pushTaskPayload.records", "pushTask", pushTaskPayload.records);
1501
1395
  const requestPath = "/2/tasks/{taskID}/push".replace("{taskID}", encodeURIComponent(taskID));
1502
1396
  const headers = {};
1503
1397
  const queryParameters = {};
@@ -1534,18 +1428,10 @@ function createIngestionClient({
1534
1428
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1535
1429
  */
1536
1430
  replaceTask({ taskID, taskReplace }, requestOptions) {
1537
- if (!taskID) {
1538
- throw new Error("Parameter `taskID` is required when calling `replaceTask`.");
1539
- }
1540
- if (!taskReplace) {
1541
- throw new Error("Parameter `taskReplace` is required when calling `replaceTask`.");
1542
- }
1543
- if (!taskReplace.destinationID) {
1544
- throw new Error("Parameter `taskReplace.destinationID` is required when calling `replaceTask`.");
1545
- }
1546
- if (!taskReplace.action) {
1547
- throw new Error("Parameter `taskReplace.action` is required when calling `replaceTask`.");
1548
- }
1431
+ (0, import_client_common.validateRequired)("taskID", "replaceTask", taskID);
1432
+ (0, import_client_common.validateRequired)("taskReplace", "replaceTask", taskReplace);
1433
+ (0, import_client_common.validateRequired)("taskReplace.destinationID", "replaceTask", taskReplace.destinationID);
1434
+ (0, import_client_common.validateRequired)("taskReplace.action", "replaceTask", taskReplace.action);
1549
1435
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1550
1436
  const headers = {};
1551
1437
  const queryParameters = {};
@@ -1571,9 +1457,7 @@ function createIngestionClient({
1571
1457
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1572
1458
  */
1573
1459
  runSource({ sourceID, runSourcePayload }, requestOptions) {
1574
- if (!sourceID) {
1575
- throw new Error("Parameter `sourceID` is required when calling `runSource`.");
1576
- }
1460
+ (0, import_client_common.validateRequired)("sourceID", "runSource", sourceID);
1577
1461
  const requestPath = "/1/sources/{sourceID}/run".replace("{sourceID}", encodeURIComponent(sourceID));
1578
1462
  const headers = {};
1579
1463
  const queryParameters = {};
@@ -1599,9 +1483,7 @@ function createIngestionClient({
1599
1483
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1600
1484
  */
1601
1485
  runTask({ taskID, runTaskPayload }, requestOptions) {
1602
- if (!taskID) {
1603
- throw new Error("Parameter `taskID` is required when calling `runTask`.");
1604
- }
1486
+ (0, import_client_common.validateRequired)("taskID", "runTask", taskID);
1605
1487
  const requestPath = "/2/tasks/{taskID}/run".replace("{taskID}", encodeURIComponent(taskID));
1606
1488
  const headers = {};
1607
1489
  const queryParameters = {};
@@ -1629,9 +1511,7 @@ function createIngestionClient({
1629
1511
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1630
1512
  */
1631
1513
  runTaskV1({ taskID, runTaskPayload }, requestOptions) {
1632
- if (!taskID) {
1633
- throw new Error("Parameter `taskID` is required when calling `runTaskV1`.");
1634
- }
1514
+ (0, import_client_common.validateRequired)("taskID", "runTaskV1", taskID);
1635
1515
  const requestPath = "/1/tasks/{taskID}/run".replace("{taskID}", encodeURIComponent(taskID));
1636
1516
  const headers = {};
1637
1517
  const queryParameters = {};
@@ -1655,14 +1535,12 @@ function createIngestionClient({
1655
1535
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1656
1536
  */
1657
1537
  searchAuthentications(authenticationSearch, requestOptions) {
1658
- if (!authenticationSearch) {
1659
- throw new Error("Parameter `authenticationSearch` is required when calling `searchAuthentications`.");
1660
- }
1661
- if (!authenticationSearch.authenticationIDs) {
1662
- throw new Error(
1663
- "Parameter `authenticationSearch.authenticationIDs` is required when calling `searchAuthentications`."
1664
- );
1665
- }
1538
+ (0, import_client_common.validateRequired)("authenticationSearch", "searchAuthentications", authenticationSearch);
1539
+ (0, import_client_common.validateRequired)(
1540
+ "authenticationSearch.authenticationIDs",
1541
+ "searchAuthentications",
1542
+ authenticationSearch.authenticationIDs
1543
+ );
1666
1544
  const requestPath = "/1/authentications/search";
1667
1545
  const headers = {};
1668
1546
  const queryParameters = {};
@@ -1686,12 +1564,8 @@ function createIngestionClient({
1686
1564
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1687
1565
  */
1688
1566
  searchDestinations(destinationSearch, requestOptions) {
1689
- if (!destinationSearch) {
1690
- throw new Error("Parameter `destinationSearch` is required when calling `searchDestinations`.");
1691
- }
1692
- if (!destinationSearch.destinationIDs) {
1693
- throw new Error("Parameter `destinationSearch.destinationIDs` is required when calling `searchDestinations`.");
1694
- }
1567
+ (0, import_client_common.validateRequired)("destinationSearch", "searchDestinations", destinationSearch);
1568
+ (0, import_client_common.validateRequired)("destinationSearch.destinationIDs", "searchDestinations", destinationSearch.destinationIDs);
1695
1569
  const requestPath = "/1/destinations/search";
1696
1570
  const headers = {};
1697
1571
  const queryParameters = {};
@@ -1715,12 +1589,8 @@ function createIngestionClient({
1715
1589
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1716
1590
  */
1717
1591
  searchSources(sourceSearch, requestOptions) {
1718
- if (!sourceSearch) {
1719
- throw new Error("Parameter `sourceSearch` is required when calling `searchSources`.");
1720
- }
1721
- if (!sourceSearch.sourceIDs) {
1722
- throw new Error("Parameter `sourceSearch.sourceIDs` is required when calling `searchSources`.");
1723
- }
1592
+ (0, import_client_common.validateRequired)("sourceSearch", "searchSources", sourceSearch);
1593
+ (0, import_client_common.validateRequired)("sourceSearch.sourceIDs", "searchSources", sourceSearch.sourceIDs);
1724
1594
  const requestPath = "/1/sources/search";
1725
1595
  const headers = {};
1726
1596
  const queryParameters = {};
@@ -1744,12 +1614,8 @@ function createIngestionClient({
1744
1614
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1745
1615
  */
1746
1616
  searchTasks(taskSearch, requestOptions) {
1747
- if (!taskSearch) {
1748
- throw new Error("Parameter `taskSearch` is required when calling `searchTasks`.");
1749
- }
1750
- if (!taskSearch.taskIDs) {
1751
- throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasks`.");
1752
- }
1617
+ (0, import_client_common.validateRequired)("taskSearch", "searchTasks", taskSearch);
1618
+ (0, import_client_common.validateRequired)("taskSearch.taskIDs", "searchTasks", taskSearch.taskIDs);
1753
1619
  const requestPath = "/2/tasks/search";
1754
1620
  const headers = {};
1755
1621
  const queryParameters = {};
@@ -1775,12 +1641,8 @@ function createIngestionClient({
1775
1641
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1776
1642
  */
1777
1643
  searchTasksV1(taskSearch, requestOptions) {
1778
- if (!taskSearch) {
1779
- throw new Error("Parameter `taskSearch` is required when calling `searchTasksV1`.");
1780
- }
1781
- if (!taskSearch.taskIDs) {
1782
- throw new Error("Parameter `taskSearch.taskIDs` is required when calling `searchTasksV1`.");
1783
- }
1644
+ (0, import_client_common.validateRequired)("taskSearch", "searchTasksV1", taskSearch);
1645
+ (0, import_client_common.validateRequired)("taskSearch.taskIDs", "searchTasksV1", taskSearch.taskIDs);
1784
1646
  const requestPath = "/1/tasks/search";
1785
1647
  const headers = {};
1786
1648
  const queryParameters = {};
@@ -1804,14 +1666,12 @@ function createIngestionClient({
1804
1666
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1805
1667
  */
1806
1668
  searchTransformations(transformationSearch, requestOptions) {
1807
- if (!transformationSearch) {
1808
- throw new Error("Parameter `transformationSearch` is required when calling `searchTransformations`.");
1809
- }
1810
- if (!transformationSearch.transformationIDs) {
1811
- throw new Error(
1812
- "Parameter `transformationSearch.transformationIDs` is required when calling `searchTransformations`."
1813
- );
1814
- }
1669
+ (0, import_client_common.validateRequired)("transformationSearch", "searchTransformations", transformationSearch);
1670
+ (0, import_client_common.validateRequired)(
1671
+ "transformationSearch.transformationIDs",
1672
+ "searchTransformations",
1673
+ transformationSearch.transformationIDs
1674
+ );
1815
1675
  const requestPath = "/1/transformations/search";
1816
1676
  const headers = {};
1817
1677
  const queryParameters = {};
@@ -1836,9 +1696,7 @@ function createIngestionClient({
1836
1696
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1837
1697
  */
1838
1698
  triggerDockerSourceDiscover({ sourceID }, requestOptions) {
1839
- if (!sourceID) {
1840
- throw new Error("Parameter `sourceID` is required when calling `triggerDockerSourceDiscover`.");
1841
- }
1699
+ (0, import_client_common.validateRequired)("sourceID", "triggerDockerSourceDiscover", sourceID);
1842
1700
  const requestPath = "/1/sources/{sourceID}/discover".replace("{sourceID}", encodeURIComponent(sourceID));
1843
1701
  const headers = {};
1844
1702
  const queryParameters = {};
@@ -1869,12 +1727,8 @@ function createIngestionClient({
1869
1727
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1870
1728
  */
1871
1729
  tryTransformation(transformationTry, requestOptions) {
1872
- if (!transformationTry) {
1873
- throw new Error("Parameter `transformationTry` is required when calling `tryTransformation`.");
1874
- }
1875
- if (!transformationTry.sampleRecord) {
1876
- throw new Error("Parameter `transformationTry.sampleRecord` is required when calling `tryTransformation`.");
1877
- }
1730
+ (0, import_client_common.validateRequired)("transformationTry", "tryTransformation", transformationTry);
1731
+ (0, import_client_common.validateRequired)("transformationTry.sampleRecord", "tryTransformation", transformationTry.sampleRecord);
1878
1732
  const requestPath = "/1/transformations/try";
1879
1733
  const headers = {};
1880
1734
  const queryParameters = {};
@@ -1900,17 +1754,13 @@ function createIngestionClient({
1900
1754
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1901
1755
  */
1902
1756
  tryTransformationBeforeUpdate({ transformationID, transformationTry }, requestOptions) {
1903
- if (!transformationID) {
1904
- throw new Error("Parameter `transformationID` is required when calling `tryTransformationBeforeUpdate`.");
1905
- }
1906
- if (!transformationTry) {
1907
- throw new Error("Parameter `transformationTry` is required when calling `tryTransformationBeforeUpdate`.");
1908
- }
1909
- if (!transformationTry.sampleRecord) {
1910
- throw new Error(
1911
- "Parameter `transformationTry.sampleRecord` is required when calling `tryTransformationBeforeUpdate`."
1912
- );
1913
- }
1757
+ (0, import_client_common.validateRequired)("transformationID", "tryTransformationBeforeUpdate", transformationID);
1758
+ (0, import_client_common.validateRequired)("transformationTry", "tryTransformationBeforeUpdate", transformationTry);
1759
+ (0, import_client_common.validateRequired)(
1760
+ "transformationTry.sampleRecord",
1761
+ "tryTransformationBeforeUpdate",
1762
+ transformationTry.sampleRecord
1763
+ );
1914
1764
  const requestPath = "/1/transformations/{transformationID}/try".replace(
1915
1765
  "{transformationID}",
1916
1766
  encodeURIComponent(transformationID)
@@ -1939,12 +1789,8 @@ function createIngestionClient({
1939
1789
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1940
1790
  */
1941
1791
  updateAuthentication({ authenticationID, authenticationUpdate }, requestOptions) {
1942
- if (!authenticationID) {
1943
- throw new Error("Parameter `authenticationID` is required when calling `updateAuthentication`.");
1944
- }
1945
- if (!authenticationUpdate) {
1946
- throw new Error("Parameter `authenticationUpdate` is required when calling `updateAuthentication`.");
1947
- }
1792
+ (0, import_client_common.validateRequired)("authenticationID", "updateAuthentication", authenticationID);
1793
+ (0, import_client_common.validateRequired)("authenticationUpdate", "updateAuthentication", authenticationUpdate);
1948
1794
  const requestPath = "/1/authentications/{authenticationID}".replace(
1949
1795
  "{authenticationID}",
1950
1796
  encodeURIComponent(authenticationID)
@@ -1973,12 +1819,8 @@ function createIngestionClient({
1973
1819
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1974
1820
  */
1975
1821
  updateDestination({ destinationID, destinationUpdate }, requestOptions) {
1976
- if (!destinationID) {
1977
- throw new Error("Parameter `destinationID` is required when calling `updateDestination`.");
1978
- }
1979
- if (!destinationUpdate) {
1980
- throw new Error("Parameter `destinationUpdate` is required when calling `updateDestination`.");
1981
- }
1822
+ (0, import_client_common.validateRequired)("destinationID", "updateDestination", destinationID);
1823
+ (0, import_client_common.validateRequired)("destinationUpdate", "updateDestination", destinationUpdate);
1982
1824
  const requestPath = "/1/destinations/{destinationID}".replace(
1983
1825
  "{destinationID}",
1984
1826
  encodeURIComponent(destinationID)
@@ -2007,12 +1849,8 @@ function createIngestionClient({
2007
1849
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2008
1850
  */
2009
1851
  updateSource({ sourceID, sourceUpdate }, requestOptions) {
2010
- if (!sourceID) {
2011
- throw new Error("Parameter `sourceID` is required when calling `updateSource`.");
2012
- }
2013
- if (!sourceUpdate) {
2014
- throw new Error("Parameter `sourceUpdate` is required when calling `updateSource`.");
2015
- }
1852
+ (0, import_client_common.validateRequired)("sourceID", "updateSource", sourceID);
1853
+ (0, import_client_common.validateRequired)("sourceUpdate", "updateSource", sourceUpdate);
2016
1854
  const requestPath = "/1/sources/{sourceID}".replace("{sourceID}", encodeURIComponent(sourceID));
2017
1855
  const headers = {};
2018
1856
  const queryParameters = {};
@@ -2038,12 +1876,8 @@ function createIngestionClient({
2038
1876
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2039
1877
  */
2040
1878
  updateTask({ taskID, taskUpdate }, requestOptions) {
2041
- if (!taskID) {
2042
- throw new Error("Parameter `taskID` is required when calling `updateTask`.");
2043
- }
2044
- if (!taskUpdate) {
2045
- throw new Error("Parameter `taskUpdate` is required when calling `updateTask`.");
2046
- }
1879
+ (0, import_client_common.validateRequired)("taskID", "updateTask", taskID);
1880
+ (0, import_client_common.validateRequired)("taskUpdate", "updateTask", taskUpdate);
2047
1881
  const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
2048
1882
  const headers = {};
2049
1883
  const queryParameters = {};
@@ -2071,12 +1905,8 @@ function createIngestionClient({
2071
1905
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2072
1906
  */
2073
1907
  updateTaskV1({ taskID, taskUpdate }, requestOptions) {
2074
- if (!taskID) {
2075
- throw new Error("Parameter `taskID` is required when calling `updateTaskV1`.");
2076
- }
2077
- if (!taskUpdate) {
2078
- throw new Error("Parameter `taskUpdate` is required when calling `updateTaskV1`.");
2079
- }
1908
+ (0, import_client_common.validateRequired)("taskID", "updateTaskV1", taskID);
1909
+ (0, import_client_common.validateRequired)("taskUpdate", "updateTaskV1", taskUpdate);
2080
1910
  const requestPath = "/1/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
2081
1911
  const headers = {};
2082
1912
  const queryParameters = {};
@@ -2102,15 +1932,9 @@ function createIngestionClient({
2102
1932
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2103
1933
  */
2104
1934
  updateTransformation({ transformationID, transformationCreate }, requestOptions) {
2105
- if (!transformationID) {
2106
- throw new Error("Parameter `transformationID` is required when calling `updateTransformation`.");
2107
- }
2108
- if (!transformationCreate) {
2109
- throw new Error("Parameter `transformationCreate` is required when calling `updateTransformation`.");
2110
- }
2111
- if (!transformationCreate.name) {
2112
- throw new Error("Parameter `transformationCreate.name` is required when calling `updateTransformation`.");
2113
- }
1935
+ (0, import_client_common.validateRequired)("transformationID", "updateTransformation", transformationID);
1936
+ (0, import_client_common.validateRequired)("transformationCreate", "updateTransformation", transformationCreate);
1937
+ (0, import_client_common.validateRequired)("transformationCreate.name", "updateTransformation", transformationCreate.name);
2114
1938
  const requestPath = "/1/transformations/{transformationID}".replace(
2115
1939
  "{transformationID}",
2116
1940
  encodeURIComponent(transformationID)
@@ -2170,12 +1994,8 @@ function createIngestionClient({
2170
1994
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2171
1995
  */
2172
1996
  validateSourceBeforeUpdate({ sourceID, sourceUpdate }, requestOptions) {
2173
- if (!sourceID) {
2174
- throw new Error("Parameter `sourceID` is required when calling `validateSourceBeforeUpdate`.");
2175
- }
2176
- if (!sourceUpdate) {
2177
- throw new Error("Parameter `sourceUpdate` is required when calling `validateSourceBeforeUpdate`.");
2178
- }
1997
+ (0, import_client_common.validateRequired)("sourceID", "validateSourceBeforeUpdate", sourceID);
1998
+ (0, import_client_common.validateRequired)("sourceUpdate", "validateSourceBeforeUpdate", sourceUpdate);
2179
1999
  const requestPath = "/1/sources/{sourceID}/validate".replace("{sourceID}", encodeURIComponent(sourceID));
2180
2000
  const headers = {};
2181
2001
  const queryParameters = {};