fetchfox-sdk 1.0.29 → 1.0.31

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.29",
3
+ "version": "1.0.31",
4
4
  "description": "AI scraper",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
package/src/agent.js CHANGED
@@ -7,5 +7,5 @@ export async function agent(args) {
7
7
 
8
8
  agent.detach = async (args) => {
9
9
  const data = await call('POST', '/api/agent', { ...args, detach: true });
10
- return new Job(data.jobId, { ...args, name: 'agent' });
10
+ return new Job(data.jobId, { ...args, method: 'agent' });
11
11
  };
package/src/crawl.js CHANGED
@@ -7,5 +7,5 @@ export async function crawl(args) {
7
7
 
8
8
  crawl.detach = async (args) => {
9
9
  const data = await call('POST', '/api/crawl', { ...args, detach: true });
10
- return new Job(data.jobId, { ...args, name: 'crawl' });
10
+ return new Job(data.jobId, { ...args, method: 'crawl' });
11
11
  };
package/src/detach.js CHANGED
@@ -17,7 +17,7 @@ export const Job = class {
17
17
 
18
18
  constructor(id, options) {
19
19
  this.id = id;
20
- this.name = options?.name;
20
+ this.method = options?.method;
21
21
  this.#callbacks = {
22
22
  item: [],
23
23
  completed: [],
@@ -73,9 +73,11 @@ export const Job = class {
73
73
  }
74
74
 
75
75
  get appUrl() {
76
- return [appHost(), this.name == 'agent' ? 'agents' : 'jobs', this.id].join(
77
- '/'
78
- );
76
+ return [
77
+ appHost(),
78
+ this.method == 'agent' ? 'agents' : 'jobs',
79
+ this.id,
80
+ ].join('/');
79
81
  }
80
82
 
81
83
  #select(data) {
package/src/extract.js CHANGED
@@ -7,5 +7,5 @@ export async function extract(args) {
7
7
 
8
8
  extract.detach = async (args) => {
9
9
  const data = await call('POST', '/api/extract', { ...args, detach: true });
10
- return new Job(data.jobId, { ...args, name: 'extract' });
10
+ return new Job(data.jobId, { ...args, method: 'extract' });
11
11
  };
package/src/index.js CHANGED
@@ -3,8 +3,10 @@ export * from './crawl.js';
3
3
  export * from './extract.js';
4
4
  export * from './scrape.js';
5
5
  export * from './agent.js';
6
+ export * from './plan.js';
6
7
 
7
8
  export * from './jobs.js';
9
+ export * from './items.js';
8
10
  export * from './user.js';
9
11
  export * from './credits.js';
10
12
  export * from './proxy.js';
package/src/items.js ADDED
@@ -0,0 +1,5 @@
1
+ import { call } from './api.js';
2
+
3
+ export async function items(jobId, args) {
4
+ return call('GET', `/api/jobs/${jobId}/items`, args);
5
+ }
package/src/items.js~ ADDED
File without changes
package/src/plan.js ADDED
@@ -0,0 +1,11 @@
1
+ import { call } from './api.js';
2
+ import { Job } from './detach.js';
3
+
4
+ export async function plan(args) {
5
+ return call('POST', '/api/plan', args);
6
+ }
7
+
8
+ plan.detach = async (args) => {
9
+ const data = await call('POST', '/api/plan', { ...args, detach: true });
10
+ return new Job(data.jobId, { ...args, method: 'plan' });
11
+ };
package/src/scrape.js CHANGED
@@ -7,5 +7,5 @@ export async function scrape(args) {
7
7
 
8
8
  scrape.detach = async (args) => {
9
9
  const data = await call('POST', '/api/scrape', { ...args, detach: true });
10
- return new Job(data.jobId, { ...args, name: 'scrape' });
10
+ return new Job(data.jobId, { ...args, method: 'scrape' });
11
11
  };
package/src/visit.js CHANGED
@@ -7,5 +7,5 @@ export async function visit(args) {
7
7
 
8
8
  visit.detach = async (args) => {
9
9
  const data = await call('POST', '/api/visit', { ...args, detach: true });
10
- return new Job(data.jobId, { ...args, name: 'visit' });
10
+ return new Job(data.jobId, { ...args, method: 'visit' });
11
11
  };