@algolia/ingestion 1.15.0 → 1.17.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.15.0
44
+ yarn add @algolia/ingestion@1.17.0
45
45
  # or
46
- npm install @algolia/ingestion@1.15.0
46
+ npm install @algolia/ingestion@1.17.0
47
47
  # or
48
- pnpm add @algolia/ingestion@1.15.0
48
+ pnpm add @algolia/ingestion@1.17.0
49
49
  ```
50
50
 
51
51
  ### Without a package manager
@@ -53,7 +53,7 @@ pnpm add @algolia/ingestion@1.15.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.15.0/dist/builds/browser.umd.js"></script>
56
+ <script src="https://cdn.jsdelivr.net/npm/@algolia/ingestion@1.17.0/dist/builds/browser.umd.js"></script>
57
57
  ```
58
58
 
59
59
  ### Usage
package/dist/browser.d.ts CHANGED
@@ -678,7 +678,7 @@ type SourceShopify = SourceUpdateShopify & SourceShopifyBase;
678
678
 
679
679
  type SourceInput = SourceCommercetools | SourceBigCommerce | SourceJSON | SourceCSV | SourceBigQuery | SourceGA4BigQueryExport | SourceDocker | SourceShopify;
680
680
 
681
- type SourceType = 'bigcommerce' | 'bigquery' | 'commercetools' | 'csv' | 'docker' | 'ga4BigqueryExport' | 'json' | 'shopify' | 'sfcc' | 'push';
681
+ type SourceType = 'bigcommerce' | 'bigquery' | 'commercetools' | 'csv' | 'docker' | 'ga4BigqueryExport' | 'json' | 'shopify' | 'push';
682
682
 
683
683
  type Source = {
684
684
  /**
@@ -2046,6 +2046,10 @@ type ListTasksProps = {
2046
2046
  * Source IDs for filtering the list of tasks.
2047
2047
  */
2048
2048
  sourceID?: Array<string>;
2049
+ /**
2050
+ * Filters the tasks with the specified source type.
2051
+ */
2052
+ sourceType?: Array<SourceType>;
2049
2053
  /**
2050
2054
  * Destination IDs for filtering the list of tasks.
2051
2055
  */
@@ -2137,6 +2141,10 @@ type PushTaskProps = {
2137
2141
  * Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
2138
2142
  */
2139
2143
  pushTaskPayload: PushTaskPayload;
2144
+ /**
2145
+ * When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
2146
+ */
2147
+ watch?: boolean;
2140
2148
  };
2141
2149
  /**
2142
2150
  * Properties for the `runSource` method.
@@ -2259,7 +2267,7 @@ type ValidateSourceBeforeUpdateProps = {
2259
2267
  sourceUpdate: SourceUpdate;
2260
2268
  };
2261
2269
 
2262
- declare const apiClientVersion = "1.15.0";
2270
+ declare const apiClientVersion = "1.17.0";
2263
2271
  declare const REGIONS: readonly ["eu", "us"];
2264
2272
  type Region = (typeof REGIONS)[number];
2265
2273
  type RegionOptions = {
@@ -2708,13 +2716,14 @@ declare function createIngestionClient({ appId: appIdOption, apiKey: apiKeyOptio
2708
2716
  * @param listTasks.action - Actions for filtering the list of tasks.
2709
2717
  * @param listTasks.enabled - Whether to filter the list of tasks by the `enabled` status.
2710
2718
  * @param listTasks.sourceID - Source IDs for filtering the list of tasks.
2719
+ * @param listTasks.sourceType - Filters the tasks with the specified source type.
2711
2720
  * @param listTasks.destinationID - Destination IDs for filtering the list of tasks.
2712
2721
  * @param listTasks.triggerType - Type of task trigger for filtering the list of tasks.
2713
2722
  * @param listTasks.sort - Property by which to sort the list of tasks.
2714
2723
  * @param listTasks.order - Sort order of the response, ascending or descending.
2715
2724
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2716
2725
  */
2717
- listTasks({ itemsPerPage, page, action, enabled, sourceID, destinationID, triggerType, sort, order }?: ListTasksProps, requestOptions?: RequestOptions | undefined): Promise<ListTasksResponse>;
2726
+ listTasks({ itemsPerPage, page, action, enabled, sourceID, sourceType, destinationID, triggerType, sort, order, }?: ListTasksProps, requestOptions?: RequestOptions | undefined): Promise<ListTasksResponse>;
2718
2727
  /**
2719
2728
  * Retrieves a list of tasks using the v1 endpoint, please use `getTasks` instead.
2720
2729
  *
@@ -2760,9 +2769,10 @@ declare function createIngestionClient({ appId: appIdOption, apiKey: apiKeyOptio
2760
2769
  * @param pushTask - The pushTask object.
2761
2770
  * @param pushTask.taskID - Unique identifier of a task.
2762
2771
  * @param pushTask.pushTaskPayload - Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
2772
+ * @param pushTask.watch - When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
2763
2773
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
2764
2774
  */
2765
- pushTask({ taskID, pushTaskPayload }: PushTaskProps, requestOptions?: RequestOptions): Promise<RunResponse>;
2775
+ pushTask({ taskID, pushTaskPayload, watch }: PushTaskProps, requestOptions?: RequestOptions): Promise<RunResponse>;
2766
2776
  /**
2767
2777
  * Runs all tasks linked to a source, only available for Shopify sources. It will create 1 run per task.
2768
2778
  *
@@ -4,15 +4,12 @@ import {
4
4
  createBrowserLocalStorageCache,
5
5
  createFallbackableCache,
6
6
  createMemoryCache,
7
- createNullLogger,
8
- DEFAULT_CONNECT_TIMEOUT_BROWSER,
9
- DEFAULT_READ_TIMEOUT_BROWSER,
10
- DEFAULT_WRITE_TIMEOUT_BROWSER
7
+ createNullLogger
11
8
  } from "@algolia/client-common";
12
9
 
13
10
  // src/ingestionClient.ts
14
11
  import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
15
- var apiClientVersion = "1.15.0";
12
+ var apiClientVersion = "1.17.0";
16
13
  var REGIONS = ["eu", "us"];
17
14
  function getDefaultHosts(region) {
18
15
  const url = "data.{region}.algolia.com".replace("{region}", region);
@@ -1124,13 +1121,25 @@ function createIngestionClient({
1124
1121
  * @param listTasks.action - Actions for filtering the list of tasks.
1125
1122
  * @param listTasks.enabled - Whether to filter the list of tasks by the `enabled` status.
1126
1123
  * @param listTasks.sourceID - Source IDs for filtering the list of tasks.
1124
+ * @param listTasks.sourceType - Filters the tasks with the specified source type.
1127
1125
  * @param listTasks.destinationID - Destination IDs for filtering the list of tasks.
1128
1126
  * @param listTasks.triggerType - Type of task trigger for filtering the list of tasks.
1129
1127
  * @param listTasks.sort - Property by which to sort the list of tasks.
1130
1128
  * @param listTasks.order - Sort order of the response, ascending or descending.
1131
1129
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1132
1130
  */
1133
- listTasks({ itemsPerPage, page, action, enabled, sourceID, destinationID, triggerType, sort, order } = {}, requestOptions = void 0) {
1131
+ listTasks({
1132
+ itemsPerPage,
1133
+ page,
1134
+ action,
1135
+ enabled,
1136
+ sourceID,
1137
+ sourceType,
1138
+ destinationID,
1139
+ triggerType,
1140
+ sort,
1141
+ order
1142
+ } = {}, requestOptions = void 0) {
1134
1143
  const requestPath = "/2/tasks";
1135
1144
  const headers = {};
1136
1145
  const queryParameters = {};
@@ -1149,6 +1158,9 @@ function createIngestionClient({
1149
1158
  if (sourceID !== void 0) {
1150
1159
  queryParameters["sourceID"] = sourceID.toString();
1151
1160
  }
1161
+ if (sourceType !== void 0) {
1162
+ queryParameters["sourceType"] = sourceType.toString();
1163
+ }
1152
1164
  if (destinationID !== void 0) {
1153
1165
  queryParameters["destinationID"] = destinationID.toString();
1154
1166
  }
@@ -1275,9 +1287,10 @@ function createIngestionClient({
1275
1287
  * @param pushTask - The pushTask object.
1276
1288
  * @param pushTask.taskID - Unique identifier of a task.
1277
1289
  * @param pushTask.pushTaskPayload - Request body of a Search API `batch` request that will be pushed in the Connectors pipeline.
1290
+ * @param pushTask.watch - When provided, the push operation will be synchronous and the API will wait for the ingestion to be finished before responding.
1278
1291
  * @param requestOptions - The requestOptions to send along with the query, they will be merged with the transporter requestOptions.
1279
1292
  */
1280
- pushTask({ taskID, pushTaskPayload }, requestOptions) {
1293
+ pushTask({ taskID, pushTaskPayload, watch }, requestOptions) {
1281
1294
  if (!taskID) {
1282
1295
  throw new Error("Parameter `taskID` is required when calling `pushTask`.");
1283
1296
  }
@@ -1293,6 +1306,9 @@ function createIngestionClient({
1293
1306
  const requestPath = "/2/tasks/{taskID}/push".replace("{taskID}", encodeURIComponent(taskID));
1294
1307
  const headers = {};
1295
1308
  const queryParameters = {};
1309
+ if (watch !== void 0) {
1310
+ queryParameters["watch"] = watch.toString();
1311
+ }
1296
1312
  const request = {
1297
1313
  method: "POST",
1298
1314
  path: requestPath,
@@ -1919,9 +1935,9 @@ function ingestionClient(appId, apiKey, region, options) {
1919
1935
  apiKey,
1920
1936
  region,
1921
1937
  timeouts: {
1922
- connect: DEFAULT_CONNECT_TIMEOUT_BROWSER,
1923
- read: DEFAULT_READ_TIMEOUT_BROWSER,
1924
- write: DEFAULT_WRITE_TIMEOUT_BROWSER
1938
+ connect: 25e3,
1939
+ read: 25e3,
1940
+ write: 25e3
1925
1941
  },
1926
1942
  logger: createNullLogger(),
1927
1943
  requester: createXhrRequester(),