fetchfox-sdk 1.0.31 → 1.0.32

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fetchfox-sdk",
3
- "version": "1.0.31",
3
+ "version": "1.0.32",
4
4
  "description": "AI scraper",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/api.js CHANGED
@@ -18,16 +18,12 @@ const FetchFoxAPIError = class extends Error {
18
18
  };
19
19
 
20
20
  export const call = async (method, path, params) => {
21
+ const headers = { 'Content-Type': 'application/json' };
21
22
  const key = apiKey(params);
22
-
23
- const args = {
24
- method,
25
- headers: {
26
- Authorization: `Bearer ${key}`,
27
- 'Content-Type': 'application/json',
28
- },
29
- };
30
-
23
+ if (key) {
24
+ headers['Authorization'] = `Bearer ${key}`;
25
+ }
26
+ const args = { method, headers };
31
27
  let url = endpoint(path, params);
32
28
  if (method == 'GET') {
33
29
  const clean = {};
package/src/configure.js CHANGED
@@ -26,6 +26,6 @@ export const host = (options) =>
26
26
  'https://api.fetchfox.ai';
27
27
 
28
28
  export const appHost = (options) =>
29
- host(options).replace('api.fetchfox.ai', 'app.fetchfox.ai');
29
+ host(options).replace('api.fetchfox.ai', 'fetchfox.ai');
30
30
 
31
31
  export const ws = (options) => host(options).replace('http', 'ws');
package/src/detach.js CHANGED
@@ -141,6 +141,6 @@ export const Job = class {
141
141
  }
142
142
 
143
143
  async finished() {
144
- return this.waitFor('finished');
144
+ return Promise.race([this.completed(), this.failed()]);
145
145
  }
146
146
  };