@howells/fieldwork-sdk 0.5.1 → 0.6.0
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/README.md +25 -24
- package/dist/{adapter-BgdfLBs-.d.ts → adapter-Bh8EIrNe.d.ts} +20 -6
- package/dist/brave.d.ts +22 -4
- package/dist/brave.js +71 -2
- package/dist/browserbase.d.ts +29 -4
- package/dist/browserbase.js +9 -4
- package/dist/{document-Dpj01mGx.js → document-Clmi51Sf.js} +5 -2
- package/dist/{errors-Yvk42oZH.js → errors-DROZyb9T.js} +13 -0
- package/dist/exa.d.ts +49 -7
- package/dist/exa.js +80 -13
- package/dist/{fieldwork-CXNIcqSN.d.ts → fieldwork-BaWqUNI3.d.ts} +20 -4
- package/dist/firecrawl.d.ts +64 -4
- package/dist/firecrawl.js +181 -54
- package/dist/index.d.ts +3 -3
- package/dist/index.js +26 -2
- package/dist/job-CWHOfhP_.js +102 -0
- package/dist/kernel.d.ts +99 -0
- package/dist/kernel.js +313 -0
- package/dist/llamaparse.d.ts +7 -2
- package/dist/llamaparse.js +23 -12
- package/dist/parallel.d.ts +83 -7
- package/dist/parallel.js +186 -26
- package/dist/{parse-n8MmaK1x.js → parse-COHKvfH9.js} +115 -17
- package/dist/perplexity.d.ts +37 -5
- package/dist/perplexity.js +146 -36
- package/dist/reducto.d.ts +16 -2
- package/dist/reducto.js +28 -15
- package/dist/{schema-Cupy7-7q.d.ts → schema-BWWiMvkg.d.ts} +1 -1
- package/dist/{schema-DbSIABP0.js → schema-BYcXgfuZ.js} +8 -4
- package/dist/serpapi.d.ts +25 -5
- package/dist/serpapi.js +99 -2
- package/dist/tavily.d.ts +44 -4
- package/dist/tavily.js +45 -13
- package/dist/tools.d.ts +16 -18
- package/dist/tools.js +150 -16
- package/package.json +9 -2
- package/dist/job-BGTwH3F-.js +0 -41
package/dist/job-BGTwH3F-.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { i as withJob, t as FieldworkError } from "./errors-Yvk42oZH.js";
|
|
2
|
-
import { D as sleep, O as stopped } from "./parse-n8MmaK1x.js";
|
|
3
|
-
// src/job.ts
|
|
4
|
-
const waitFor = async (provider, id, check, settings) => {
|
|
5
|
-
const interval = settings.interval ?? 2e3;
|
|
6
|
-
const deadline = Date.now() + (settings.timeout ?? 6e5);
|
|
7
|
-
const request = {
|
|
8
|
-
retries: settings.retries,
|
|
9
|
-
signal: settings.signal
|
|
10
|
-
};
|
|
11
|
-
for (;;) {
|
|
12
|
-
if (settings.signal?.aborted === true) throw stopped(settings.signal, `stopped waiting for ${provider} job ${id}; it may still be running`, {
|
|
13
|
-
jobId: id,
|
|
14
|
-
provider
|
|
15
|
-
});
|
|
16
|
-
const found = await check(id, request);
|
|
17
|
-
if (found !== void 0) return found;
|
|
18
|
-
if (Date.now() + interval > deadline) throw new FieldworkError("Timeout", `${provider} job ${id} did not finish in time; it may still be running`, {
|
|
19
|
-
jobId: id,
|
|
20
|
-
provider
|
|
21
|
-
});
|
|
22
|
-
await sleep(interval, settings.signal);
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
/**
|
|
26
|
-
* Runs an asynchronous job to its result: resumes the job named by `resume`
|
|
27
|
-
* or starts one, checks it until it finishes, then builds the result.
|
|
28
|
-
*
|
|
29
|
-
* Every error after the job has an id carries it as `jobId`, including a
|
|
30
|
-
* timeout or cancellation while waiting, so the caller can resume rather than
|
|
31
|
-
* start a second job.
|
|
32
|
-
*/
|
|
33
|
-
const runJob = async (provider, job, settings) => {
|
|
34
|
-
const id = settings.resume ?? await job.start();
|
|
35
|
-
try {
|
|
36
|
-
return await job.finish(await waitFor(provider, id, job.check, settings), id);
|
|
37
|
-
} catch (error) {
|
|
38
|
-
throw withJob(error, id);
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
export { runJob as t };
|