fetchfox-sdk 1.0.9 → 1.0.11

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.9",
3
+ "version": "1.0.11",
4
4
  "description": "AI scraper",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/crawl.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { call } from './api.js';
2
2
  import { Job } from './detach.js';
3
3
 
4
- export const crawl = async (args) => {
4
+ export async function crawl(args) {
5
5
  return call('POST', '/api/crawl', args);
6
- };
6
+ }
7
7
 
8
8
  crawl.detach = async (args) => {
9
9
  const data = await call('POST', '/api/crawl', { ...args, detach: true });
package/src/extract.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { call } from './api.js';
2
2
  import { Job } from './detach.js';
3
3
 
4
- export const extract = async (args) => {
4
+ export async function extract(args) {
5
5
  return call('POST', '/api/extract', args);
6
- };
6
+ }
7
7
 
8
8
  extract.detach = async (args) => {
9
9
  const data = await call('POST', '/api/extract', { ...args, detach: true });
package/src/jobs.js CHANGED
@@ -5,8 +5,18 @@ export const jobs = {
5
5
  return call('GET', `/api/jobs/${id}`);
6
6
  },
7
7
  list: async (args) => {
8
- const limit = args?.limit ?? 100;
9
- const offset = args?.offset ?? 0;
10
- return call('GET', '/api/jobs', { limit, offset });
8
+ const params = {};
9
+ params.limit = args?.limit ?? 100;
10
+ params.offset = args?.offset ?? 0;
11
+
12
+ if (args?.types) {
13
+ if (Array.isArray(args.types)) {
14
+ params.types = args.types.join(',');
15
+ } else {
16
+ params.types = args.types;
17
+ }
18
+ }
19
+ const types = args?.types ?? 0;
20
+ return call('GET', '/api/jobs', params);
11
21
  },
12
22
  };
package/src/scrape.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { call } from './api.js';
2
2
  import { Job } from './detach.js';
3
3
 
4
- export const scrape = async (args) => {
4
+ export async function scrape(args) {
5
5
  return call('POST', '/api/scrape', args);
6
- };
6
+ }
7
7
 
8
8
  scrape.detach = async (args) => {
9
9
  const data = await call('POST', '/api/scrape', { ...args, detach: true });