@8ms/helpers 2.4.24 → 2.4.25

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.
@@ -7,12 +7,13 @@ const require_api_post = require("../../../api/post.cjs");
7
7
  * Make the request to trigger the scraper and let it do its job.
8
8
  */
9
9
  const getBatch = async (auth, scraperId, data = {}, isDev = false) => {
10
- let response = false;
10
+ let response = null;
11
11
  const requestUrl = new URL("https://api.brightdata.com/dca/trigger");
12
12
  requestUrl.searchParams.append("collector", scraperId);
13
13
  requestUrl.searchParams.append("queue_next", "1");
14
14
  if (isDev) requestUrl.searchParams.append("version", "dev");
15
- if ((await require_api_post.post(requestUrl.toString(), data, { headers: { Authorization: `Bearer ${auth.apiKey}` } })).isSuccess()) response = true;
15
+ const requestResponse = await require_api_post.post(requestUrl.toString(), data, { headers: { Authorization: `Bearer ${auth.apiKey}` } });
16
+ if (requestResponse.isSuccess()) response = requestResponse.getBody();
16
17
  return response;
17
18
  };
18
19
  //#endregion
@@ -1,11 +1,15 @@
1
1
  import { Auth } from "../../server/brightData.cjs";
2
2
 
3
3
  //#region src/brightData/webScraperIde/server/getBatch.d.ts
4
+ type Response = {
5
+ collection_id: string;
6
+ start_eta: string;
7
+ };
4
8
  /**
5
9
  * Depends on the Scraper setup!
6
10
  *
7
11
  * Make the request to trigger the scraper and let it do its job.
8
12
  */
9
- declare const getBatch: (auth: Auth, scraperId: string, data?: {}, isDev?: boolean) => Promise<boolean>;
13
+ declare const getBatch: (auth: Auth, scraperId: string, data?: {}, isDev?: boolean) => Promise<Response | null>;
10
14
  //#endregion
11
15
  export { getBatch };
@@ -1,11 +1,15 @@
1
1
  import { Auth } from "../../server/brightData.mjs";
2
2
 
3
3
  //#region src/brightData/webScraperIde/server/getBatch.d.ts
4
+ type Response = {
5
+ collection_id: string;
6
+ start_eta: string;
7
+ };
4
8
  /**
5
9
  * Depends on the Scraper setup!
6
10
  *
7
11
  * Make the request to trigger the scraper and let it do its job.
8
12
  */
9
- declare const getBatch: (auth: Auth, scraperId: string, data?: {}, isDev?: boolean) => Promise<boolean>;
13
+ declare const getBatch: (auth: Auth, scraperId: string, data?: {}, isDev?: boolean) => Promise<Response | null>;
10
14
  //#endregion
11
15
  export { getBatch };
@@ -6,12 +6,13 @@ import { post } from "../../../api/post.mjs";
6
6
  * Make the request to trigger the scraper and let it do its job.
7
7
  */
8
8
  const getBatch = async (auth, scraperId, data = {}, isDev = false) => {
9
- let response = false;
9
+ let response = null;
10
10
  const requestUrl = new URL("https://api.brightdata.com/dca/trigger");
11
11
  requestUrl.searchParams.append("collector", scraperId);
12
12
  requestUrl.searchParams.append("queue_next", "1");
13
13
  if (isDev) requestUrl.searchParams.append("version", "dev");
14
- if ((await post(requestUrl.toString(), data, { headers: { Authorization: `Bearer ${auth.apiKey}` } })).isSuccess()) response = true;
14
+ const requestResponse = await post(requestUrl.toString(), data, { headers: { Authorization: `Bearer ${auth.apiKey}` } });
15
+ if (requestResponse.isSuccess()) response = requestResponse.getBody();
15
16
  return response;
16
17
  };
17
18
  //#endregion
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "2.4.24",
4
+ "version": "2.4.25",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
@@ -160,7 +160,7 @@
160
160
  "@aws-sdk/lib-storage": "^3.1028.0",
161
161
  "@aws-sdk/s3-request-presigner": "^3.1028.0",
162
162
  "@babel/core": "7.29.0",
163
- "@babel/preset-env": "7.29.2",
163
+ "@babel/preset-env": "7.29.5",
164
164
  "@babel/preset-flow": "7.27.1",
165
165
  "@babel/preset-typescript": "7.28.5",
166
166
  "@google-cloud/bigquery": "^8.1.1",
@@ -178,7 +178,7 @@
178
178
  "@types/luxon": "3.7.1",
179
179
  "@types/node": "^24.12.2",
180
180
  "@types/react": "^19.2.14",
181
- "babel-jest": "30.3.0",
181
+ "babel-jest": "30.4.1",
182
182
  "dotenv": "^17.4.1",
183
183
  "drizzle-orm": "beta",
184
184
  "fs-extra": "^11.3.4",