fetchfox-sdk 1.0.24 → 1.0.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.
- package/package.json +1 -1
- package/src/agent.js +1 -1
- package/src/crawl.js +1 -1
- package/src/detach.js +17 -9
- package/src/extract.js +1 -1
- package/src/scrape.js +1 -1
package/package.json
CHANGED
package/src/agent.js
CHANGED
package/src/crawl.js
CHANGED
package/src/detach.js
CHANGED
|
@@ -15,7 +15,8 @@ export const Job = class {
|
|
|
15
15
|
#completed;
|
|
16
16
|
#failed;
|
|
17
17
|
|
|
18
|
-
constructor(id, options) {
|
|
18
|
+
constructor(name, id, options) {
|
|
19
|
+
this.name = name;
|
|
19
20
|
this.id = id;
|
|
20
21
|
this.#callbacks = {
|
|
21
22
|
item: [],
|
|
@@ -39,7 +40,9 @@ export const Job = class {
|
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
get appUrl() {
|
|
42
|
-
return appHost()
|
|
43
|
+
return [appHost(), this.name == 'agent' ? 'agents' : 'jobs', this.id].join(
|
|
44
|
+
'/'
|
|
45
|
+
);
|
|
43
46
|
}
|
|
44
47
|
|
|
45
48
|
#select(data) {
|
|
@@ -108,6 +111,8 @@ export const Job = class {
|
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
if (['completed', 'failed'].includes(this.state)) {
|
|
114
|
+
console.log('Got state:', this.state);
|
|
115
|
+
|
|
111
116
|
if (this.progress?.children?.jobs) {
|
|
112
117
|
this.progress.children.jobs = this.progress.children.jobs.filter(
|
|
113
118
|
(it) => it.state != 'active'
|
|
@@ -116,13 +121,16 @@ export const Job = class {
|
|
|
116
121
|
|
|
117
122
|
this.#socket.disconnect();
|
|
118
123
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
console.log('Set timeout before triggering completion');
|
|
125
|
+
setTimeout(() => {
|
|
126
|
+
this.get()
|
|
127
|
+
.then(() => {
|
|
128
|
+
this.trigger('progress', this);
|
|
129
|
+
this.trigger(this.state, this);
|
|
130
|
+
this.trigger('finished', this);
|
|
131
|
+
})
|
|
132
|
+
.catch((e) => console.error(e));
|
|
133
|
+
}, 500);
|
|
126
134
|
}
|
|
127
135
|
}
|
|
128
136
|
|
package/src/extract.js
CHANGED
package/src/scrape.js
CHANGED