@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.
package/README.md CHANGED
@@ -41,11 +41,11 @@ All of our clients comes with type definition, and are available for both browse
41
41
  ### With a package manager
42
42
 
43
43
  ```bash
44
- yarn add @algolia/ingestion@1.36.0
44
+ yarn add @algolia/ingestion@1.38.0
45
45
  # or
46
- npm install @algolia/ingestion@1.36.0
46
+ npm install @algolia/ingestion@1.38.0
47
47
  # or
48
- pnpm add @algolia/ingestion@1.36.0
48
+ pnpm add @algolia/ingestion@1.38.0
49
49
  ```
50
50
 
51
51
  ### Without a package manager
@@ -53,7 +53,7 @@ pnpm add @algolia/ingestion@1.36.0
53
53
  Add the following JavaScript snippet to the <head> of your website:
54
54
 
55
55
  ```html
56
- <script src="https://cdn.jsdelivr.net/npm/@algolia/ingestion@1.36.0/dist/builds/browser.umd.js"></script>
56
+ <script src="https://cdn.jsdelivr.net/npm/@algolia/ingestion@1.38.0/dist/builds/browser.umd.js"></script>
57
57
  ```
58
58
 
59
59
  ### Usage
package/dist/browser.d.ts CHANGED
@@ -1636,13 +1636,44 @@ type SourceUpdate = {
1636
1636
  authenticationID?: string | undefined;
1637
1637
  };
1638
1638
 
1639
+ /**
1640
+ * API request body for updating a task.
1641
+ */
1642
+ type TaskReplace = {
1643
+ /**
1644
+ * Universally unique identifier (UUID) of a destination resource.
1645
+ */
1646
+ destinationID: string;
1647
+ action: ActionType;
1648
+ subscriptionAction?: ActionType | undefined;
1649
+ /**
1650
+ * Cron expression for the task\'s schedule.
1651
+ */
1652
+ cron?: string | undefined;
1653
+ /**
1654
+ * Whether the task is enabled.
1655
+ */
1656
+ enabled?: boolean | undefined;
1657
+ /**
1658
+ * Maximum accepted percentage of failures for a task run to finish successfully.
1659
+ */
1660
+ failureThreshold?: number | undefined;
1661
+ input?: TaskInput | undefined;
1662
+ /**
1663
+ * Date of the last cursor in RFC 3339 format.
1664
+ */
1665
+ cursor?: string | undefined;
1666
+ notifications?: Notifications | undefined;
1667
+ policies?: Policies | undefined;
1668
+ };
1669
+
1639
1670
  /**
1640
1671
  * Property by which to sort the list of tasks.
1641
1672
  */
1642
1673
  type TaskSortKeys = 'enabled' | 'triggerType' | 'action' | 'updatedAt' | 'createdAt';
1643
1674
 
1644
1675
  /**
1645
- * API request body for updating a task.
1676
+ * API request body for partially updating a task.
1646
1677
  */
1647
1678
  type TaskUpdate = {
1648
1679
  /**
@@ -2224,6 +2255,10 @@ type ListTransformationsProps = {
2224
2255
  * Sort order of the response, ascending or descending.
2225
2256
  */
2226
2257
  order?: OrderKeys | undefined;
2258
+ /**
2259
+ * Whether to filter the list of transformations by the type of transformation.
2260
+ */
2261
+ type?: TransformationType | undefined;
2227
2262
  };
2228
2263
  /**
2229
2264
  * Properties for the `push` method.
@@ -2257,6 +2292,16 @@ type PushTaskProps = {
2257
2292
  */
2258
2293
  watch?: boolean | undefined;
2259
2294
  };
2295
+ /**
2296
+ * Properties for the `replaceTask` method.
2297
+ */
2298
+ type ReplaceTaskProps = {
2299
+ /**
2300
+ * Unique identifier of a task.
2301
+ */
2302
+ taskID: string;
2303
+ taskReplace: TaskReplace;
2304
+ };
2260
2305
  /**
2261
2306
  * Properties for the `runSource` method.
2262
2307
  */
@@ -2412,7 +2457,7 @@ type ChunkedPushOptions = {
2412
2457
  objects: Array<Record<string, unknown>>;
2413
2458
  };
2414
2459
 
2415
- declare const apiClientVersion = "1.36.0";
2460
+ declare const apiClientVersion = "1.38.0";
2416
2461
  declare const REGIONS: readonly ["eu", "us"];
2417
2462
  type Region = (typeof REGIONS)[number];
2418
2463
  type RegionOptions = {
@@ -2932,9 +2977,10 @@ declare function createIngestionClient({ appId: appIdOption, apiKey: apiKeyOptio
2932
2977
  * @param listTransformations.page - Page number of the paginated API response.
2933
2978
  * @param listTransformations.sort - Property by which to sort the list of transformations.
2934
2979
  * @param listTransformations.order - Sort order of the response, ascending or descending.
2980
+ * @param listTransformations.type - Whether to filter the list of transformations by the type of transformation.
2935
2981
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2936
2982
  */
2937
- listTransformations({ itemsPerPage, page, sort, order }?: ListTransformationsProps, requestOptions?: RequestOptions | undefined): Promise<ListTransformationsResponse>;
2983
+ listTransformations({ itemsPerPage, page, sort, order, type }?: ListTransformationsProps, requestOptions?: RequestOptions | undefined): Promise<ListTransformationsResponse>;
2938
2984
  /**
2939
2985
  * 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.
2940
2986
  *
@@ -2951,7 +2997,7 @@ declare function createIngestionClient({ appId: appIdOption, apiKey: apiKeyOptio
2951
2997
  */
2952
2998
  push({ indexName, pushTaskPayload, watch, referenceIndexName }: PushProps, requestOptions?: RequestOptions): Promise<WatchResponse>;
2953
2999
  /**
2954
- * 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`.
3000
+ * 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`.
2955
3001
  *
2956
3002
  * Required API Key ACLs:
2957
3003
  * - addObject
@@ -2964,6 +3010,14 @@ declare function createIngestionClient({ appId: appIdOption, apiKey: apiKeyOptio
2964
3010
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2965
3011
  */
2966
3012
  pushTask({ taskID, pushTaskPayload, watch }: PushTaskProps, requestOptions?: RequestOptions): Promise<WatchResponse>;
3013
+ /**
3014
+ * Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields.
3015
+ * @param replaceTask - The replaceTask object.
3016
+ * @param replaceTask.taskID - Unique identifier of a task.
3017
+ * @param replaceTask.taskReplace - The taskReplace object.
3018
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
3019
+ */
3020
+ replaceTask({ taskID, taskReplace }: ReplaceTaskProps, requestOptions?: RequestOptions): Promise<TaskUpdateResponse>;
2967
3021
  /**
2968
3022
  * Runs all tasks linked to a source, only available for Shopify, BigCommerce and commercetools sources. Creates one run per task.
2969
3023
  *
@@ -3149,7 +3203,7 @@ declare function createIngestionClient({ appId: appIdOption, apiKey: apiKeyOptio
3149
3203
  */
3150
3204
  updateSource({ sourceID, sourceUpdate }: UpdateSourceProps, requestOptions?: RequestOptions): Promise<SourceUpdateResponse>;
3151
3205
  /**
3152
- * Updates a task by its ID.
3206
+ * Partially updates a task by its ID.
3153
3207
  * @param updateTask - The updateTask object.
3154
3208
  * @param updateTask.taskID - Unique identifier of a task.
3155
3209
  * @param updateTask.taskUpdate - The taskUpdate object.
@@ -3210,4 +3264,4 @@ type ErrorBase = Record<string, any> & {
3210
3264
  declare function ingestionClient(appId: string, apiKey: string, region: Region, options?: ClientOptions | undefined): IngestionClient;
3211
3265
  type IngestionClient = ReturnType<typeof createIngestionClient>;
3212
3266
 
3213
- export { type Action, type ActionType, type AuthAPIKey, type AuthAPIKeyPartial, type AuthAlgolia, type AuthAlgoliaInsights, type AuthAlgoliaInsightsPartial, type AuthAlgoliaPartial, type AuthBasic, type AuthBasicPartial, type AuthGoogleServiceAccount, type AuthGoogleServiceAccountPartial, type AuthInput, type AuthInputPartial, type AuthOAuth, type AuthOAuthPartial, type Authentication, type AuthenticationCreate, type AuthenticationCreateResponse, type AuthenticationSearch, type AuthenticationSortKeys, type AuthenticationType, type AuthenticationUpdate, type AuthenticationUpdateResponse, type BigCommerceChannel, type BigCommerceMetafield, type BigQueryDataType, type ChunkedPushOptions, type CommercetoolsCustomFields, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type DeleteAuthenticationProps, type DeleteDestinationProps, type DeleteResponse, type DeleteSourceProps, type DeleteTaskProps, type DeleteTaskV1Props, type DeleteTransformationProps, type Destination, type DestinationCreate, type DestinationCreateResponse, type DestinationInput, type DestinationSearch, type DestinationSortKeys, type DestinationType, type DestinationUpdate, type DestinationUpdateResponse, type DisableTaskProps, type DisableTaskV1Props, type DockerStreams, type DockerStreamsInput, type DockerStreamsSyncMode, type EmailNotifications, type EnableTaskProps, type EnableTaskV1Props, type EntityType, type ErrorBase, type Event, type EventSortKeys, type EventStatus, type EventType, type GetAuthenticationProps, type GetDestinationProps, type GetEventProps, type GetRunProps, type GetSourceProps, type GetTaskProps, type GetTaskV1Props, type GetTransformationProps, type IngestionClient, type ListAuthenticationsProps, type ListAuthenticationsResponse, type ListDestinationsProps, type ListDestinationsResponse, type ListEventsProps, type ListEventsResponse, type ListRunsProps, type ListSourcesProps, type ListSourcesResponse, type ListTasksProps, type ListTasksResponse, type ListTasksResponseV1, type ListTasksV1Props, type ListTransformationsProps, type ListTransformationsResponse, type MappingFieldDirective, type MappingFormatSchema, type MappingInput, type MappingKitAction, type MappingTypeCSV, type MethodType, type Notifications, type OnDemandTrigger, type OnDemandTriggerInput, type OnDemandTriggerType, type OrderKeys, type Pagination, type Platform, type PlatformNone, type PlatformWithNone, type Policies, type PushProps, type PushTaskPayload, type PushTaskProps, type PushTaskRecords, type RecordType, type Region, type RegionOptions, type Run, type RunListResponse, type RunOutcome, type RunProgress, type RunReasonCode, type RunResponse, type RunSortKeys, type RunSourcePayload, type RunSourceProps, type RunSourceResponse, type RunStatus, type RunTaskPayload, type RunTaskProps, type RunTaskV1Props, type RunType, type ScheduleTrigger, type ScheduleTriggerInput, type ScheduleTriggerType, type ShopifyInput, type ShopifyMarket, type ShopifyMetafield, type Source, type SourceBigCommerce, type SourceBigQuery, type SourceCSV, type SourceCommercetools, type SourceCreate, type SourceCreateResponse, type SourceDocker, type SourceGA4BigQueryExport, type SourceInput, type SourceJSON, type SourceSearch, type SourceShopify, type SourceShopifyBase, type SourceSortKeys, type SourceType, type SourceUpdate, type SourceUpdateCommercetools, type SourceUpdateDocker, type SourceUpdateInput, type SourceUpdateResponse, type SourceUpdateShopify, type StreamingInput, type StreamingTrigger, type StreamingTriggerType, type SubscriptionTrigger, type SubscriptionTriggerType, type Task, type TaskCreate, type TaskCreateResponse, type TaskCreateTrigger, type TaskCreateV1, type TaskInput, type TaskSearch, type TaskSortKeys, type TaskUpdate, type TaskUpdateResponse, type TaskUpdateV1, type TaskV1, type Transformation, type TransformationCode, type TransformationCreate, type TransformationCreateResponse, type TransformationError, type TransformationInput, type TransformationNoCode, type TransformationSearch, type TransformationSortKeys, type TransformationTry, type TransformationTryResponse, type TransformationType, type TransformationUpdateResponse, type Trigger, type TriggerDockerSourceDiscoverProps, type TriggerType, type TriggerUpdateInput, type TryTransformationBeforeUpdateProps, type UpdateAuthenticationProps, type UpdateDestinationProps, type UpdateSourceProps, type UpdateTaskProps, type UpdateTaskV1Props, type UpdateTransformationProps, type ValidateSourceBeforeUpdateProps, type WatchResponse, type Window, apiClientVersion, ingestionClient, isOnDemandTrigger, isScheduleTrigger, isSubscriptionTrigger };
3267
+ export { type Action, type ActionType, type AuthAPIKey, type AuthAPIKeyPartial, type AuthAlgolia, type AuthAlgoliaInsights, type AuthAlgoliaInsightsPartial, type AuthAlgoliaPartial, type AuthBasic, type AuthBasicPartial, type AuthGoogleServiceAccount, type AuthGoogleServiceAccountPartial, type AuthInput, type AuthInputPartial, type AuthOAuth, type AuthOAuthPartial, type Authentication, type AuthenticationCreate, type AuthenticationCreateResponse, type AuthenticationSearch, type AuthenticationSortKeys, type AuthenticationType, type AuthenticationUpdate, type AuthenticationUpdateResponse, type BigCommerceChannel, type BigCommerceMetafield, type BigQueryDataType, type ChunkedPushOptions, type CommercetoolsCustomFields, type CustomDeleteProps, type CustomGetProps, type CustomPostProps, type CustomPutProps, type DeleteAuthenticationProps, type DeleteDestinationProps, type DeleteResponse, type DeleteSourceProps, type DeleteTaskProps, type DeleteTaskV1Props, type DeleteTransformationProps, type Destination, type DestinationCreate, type DestinationCreateResponse, type DestinationInput, type DestinationSearch, type DestinationSortKeys, type DestinationType, type DestinationUpdate, type DestinationUpdateResponse, type DisableTaskProps, type DisableTaskV1Props, type DockerStreams, type DockerStreamsInput, type DockerStreamsSyncMode, type EmailNotifications, type EnableTaskProps, type EnableTaskV1Props, type EntityType, type ErrorBase, type Event, type EventSortKeys, type EventStatus, type EventType, type GetAuthenticationProps, type GetDestinationProps, type GetEventProps, type GetRunProps, type GetSourceProps, type GetTaskProps, type GetTaskV1Props, type GetTransformationProps, type IngestionClient, type ListAuthenticationsProps, type ListAuthenticationsResponse, type ListDestinationsProps, type ListDestinationsResponse, type ListEventsProps, type ListEventsResponse, type ListRunsProps, type ListSourcesProps, type ListSourcesResponse, type ListTasksProps, type ListTasksResponse, type ListTasksResponseV1, type ListTasksV1Props, type ListTransformationsProps, type ListTransformationsResponse, type MappingFieldDirective, type MappingFormatSchema, type MappingInput, type MappingKitAction, type MappingTypeCSV, type MethodType, type Notifications, type OnDemandTrigger, type OnDemandTriggerInput, type OnDemandTriggerType, type OrderKeys, type Pagination, type Platform, type PlatformNone, type PlatformWithNone, type Policies, type PushProps, type PushTaskPayload, type PushTaskProps, type PushTaskRecords, type RecordType, type Region, type RegionOptions, type ReplaceTaskProps, type Run, type RunListResponse, type RunOutcome, type RunProgress, type RunReasonCode, type RunResponse, type RunSortKeys, type RunSourcePayload, type RunSourceProps, type RunSourceResponse, type RunStatus, type RunTaskPayload, type RunTaskProps, type RunTaskV1Props, type RunType, type ScheduleTrigger, type ScheduleTriggerInput, type ScheduleTriggerType, type ShopifyInput, type ShopifyMarket, type ShopifyMetafield, type Source, type SourceBigCommerce, type SourceBigQuery, type SourceCSV, type SourceCommercetools, type SourceCreate, type SourceCreateResponse, type SourceDocker, type SourceGA4BigQueryExport, type SourceInput, type SourceJSON, type SourceSearch, type SourceShopify, type SourceShopifyBase, type SourceSortKeys, type SourceType, type SourceUpdate, type SourceUpdateCommercetools, type SourceUpdateDocker, type SourceUpdateInput, type SourceUpdateResponse, type SourceUpdateShopify, type StreamingInput, type StreamingTrigger, type StreamingTriggerType, type SubscriptionTrigger, type SubscriptionTriggerType, type Task, type TaskCreate, type TaskCreateResponse, type TaskCreateTrigger, type TaskCreateV1, type TaskInput, type TaskReplace, type TaskSearch, type TaskSortKeys, type TaskUpdate, type TaskUpdateResponse, type TaskUpdateV1, type TaskV1, type Transformation, type TransformationCode, type TransformationCreate, type TransformationCreateResponse, type TransformationError, type TransformationInput, type TransformationNoCode, type TransformationSearch, type TransformationSortKeys, type TransformationTry, type TransformationTryResponse, type TransformationType, type TransformationUpdateResponse, type Trigger, type TriggerDockerSourceDiscoverProps, type TriggerType, type TriggerUpdateInput, type TryTransformationBeforeUpdateProps, type UpdateAuthenticationProps, type UpdateDestinationProps, type UpdateSourceProps, type UpdateTaskProps, type UpdateTaskV1Props, type UpdateTransformationProps, type ValidateSourceBeforeUpdateProps, type WatchResponse, type Window, apiClientVersion, ingestionClient, isOnDemandTrigger, isScheduleTrigger, isSubscriptionTrigger };
@@ -9,7 +9,7 @@ import {
9
9
 
10
10
  // src/ingestionClient.ts
11
11
  import { createAuth, createIterablePromise, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
12
- var apiClientVersion = "1.36.0";
12
+ var apiClientVersion = "1.38.0";
13
13
  var REGIONS = ["eu", "us"];
14
14
  function getDefaultHosts(region) {
15
15
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -1335,9 +1335,10 @@ function createIngestionClient({
1335
1335
  * @param listTransformations.page - Page number of the paginated API response.
1336
1336
  * @param listTransformations.sort - Property by which to sort the list of transformations.
1337
1337
  * @param listTransformations.order - Sort order of the response, ascending or descending.
1338
+ * @param listTransformations.type - Whether to filter the list of transformations by the type of transformation.
1338
1339
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1339
1340
  */
1340
- listTransformations({ itemsPerPage, page, sort, order } = {}, requestOptions = void 0) {
1341
+ listTransformations({ itemsPerPage, page, sort, order, type } = {}, requestOptions = void 0) {
1341
1342
  const requestPath = "/1/transformations";
1342
1343
  const headers = {};
1343
1344
  const queryParameters = {};
@@ -1353,6 +1354,9 @@ function createIngestionClient({
1353
1354
  if (order !== void 0) {
1354
1355
  queryParameters["order"] = order.toString();
1355
1356
  }
1357
+ if (type !== void 0) {
1358
+ queryParameters["type"] = type.toString();
1359
+ }
1356
1360
  const request = {
1357
1361
  method: "GET",
1358
1362
  path: requestPath,
@@ -1415,7 +1419,7 @@ function createIngestionClient({
1415
1419
  return transporter.request(request, requestOptions);
1416
1420
  },
1417
1421
  /**
1418
- * 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`.
1422
+ * 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`.
1419
1423
  *
1420
1424
  * Required API Key ACLs:
1421
1425
  * - addObject
@@ -1463,6 +1467,38 @@ function createIngestionClient({
1463
1467
  };
1464
1468
  return transporter.request(request, requestOptions);
1465
1469
  },
1470
+ /**
1471
+ * Fully updates a task by its ID, use partialUpdateTask if you only want to update a subset of fields.
1472
+ * @param replaceTask - The replaceTask object.
1473
+ * @param replaceTask.taskID - Unique identifier of a task.
1474
+ * @param replaceTask.taskReplace - The taskReplace object.
1475
+ * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1476
+ */
1477
+ replaceTask({ taskID, taskReplace }, requestOptions) {
1478
+ if (!taskID) {
1479
+ throw new Error("Parameter `taskID` is required when calling `replaceTask`.");
1480
+ }
1481
+ if (!taskReplace) {
1482
+ throw new Error("Parameter `taskReplace` is required when calling `replaceTask`.");
1483
+ }
1484
+ if (!taskReplace.destinationID) {
1485
+ throw new Error("Parameter `taskReplace.destinationID` is required when calling `replaceTask`.");
1486
+ }
1487
+ if (!taskReplace.action) {
1488
+ throw new Error("Parameter `taskReplace.action` is required when calling `replaceTask`.");
1489
+ }
1490
+ const requestPath = "/2/tasks/{taskID}".replace("{taskID}", encodeURIComponent(taskID));
1491
+ const headers = {};
1492
+ const queryParameters = {};
1493
+ const request = {
1494
+ method: "PUT",
1495
+ path: requestPath,
1496
+ queryParameters,
1497
+ headers,
1498
+ data: taskReplace
1499
+ };
1500
+ return transporter.request(request, requestOptions);
1501
+ },
1466
1502
  /**
1467
1503
  * Runs all tasks linked to a source, only available for Shopify, BigCommerce and commercetools sources. Creates one run per task.
1468
1504
  *
@@ -1931,7 +1967,7 @@ function createIngestionClient({
1931
1967
  return transporter.request(request, requestOptions);
1932
1968
  },
1933
1969
  /**
1934
- * Updates a task by its ID.
1970
+ * Partially updates a task by its ID.
1935
1971
  * @param updateTask - The updateTask object.
1936
1972
  * @param updateTask.taskID - Unique identifier of a task.
1937
1973
  * @param updateTask.taskUpdate - The taskUpdate object.