@howells/fieldwork-sdk 0.10.2 → 0.12.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 +104 -16
- package/dist/{adapter-DWYJys20.js → adapter-CBSAfErv.js} +1 -1
- package/dist/adapter-J2yatZJ0.d.ts +73 -0
- package/dist/best-CO9liYDa.js +1436 -0
- package/dist/brave.d.ts +7 -6
- package/dist/brave.js +180 -173
- package/dist/browserbase.d.ts +4 -3
- package/dist/browserbase.js +185 -170
- package/dist/{document-DMIUCoDA.js → document-BSCwJgBM.js} +4 -4
- package/dist/{download-CP8noBdX.js → download-kuTqNnuZ.js} +1 -1
- package/dist/{adapter-DQrBP1tj.d.ts → errors-gMtejKHc.d.ts} +111 -70
- package/dist/exa.d.ts +18 -11
- package/dist/exa.js +306 -275
- package/dist/fieldwork-D7npPoUf.d.ts +35 -0
- package/dist/firecrawl.d.ts +4 -3
- package/dist/firecrawl.js +450 -417
- package/dist/{parse-Q7H4mrnO.js → http-CJcvTPnE.js} +223 -225
- package/dist/image.d.ts +253 -0
- package/dist/image.js +1 -0
- package/dist/index.d.ts +6 -7
- package/dist/index.js +67 -82
- package/dist/{job-DnavRq_s.js → job-JLEpszjr.js} +9 -9
- package/dist/kernel.d.ts +20 -2
- package/dist/kernel.js +65 -19
- package/dist/llamaparse.d.ts +3 -2
- package/dist/llamaparse.js +16 -16
- package/dist/parallel.d.ts +9 -9
- package/dist/parallel.js +423 -389
- package/dist/path-DO2llIdp.js +10 -0
- package/dist/perplexity.d.ts +6 -5
- package/dist/perplexity.js +21 -21
- package/dist/reducto.d.ts +3 -2
- package/dist/reducto.js +14 -14
- package/dist/{schema-BFjS6CSz.d.ts → schema-C9xzRkKJ.d.ts} +17 -6
- package/dist/{schema--iU4AXSM.js → schema-CJXFAZ-x.js} +12 -3
- package/dist/serpapi.d.ts +63 -5
- package/dist/serpapi.js +374 -144
- package/dist/tavily.d.ts +4 -3
- package/dist/tavily.js +247 -234
- package/dist/tools.d.ts +76 -15
- package/dist/tools.js +522 -154
- package/dist/{types-rc8bl8Em.js → types-mq6d6YOK.js} +1 -0
- package/dist/{util-DFUXQX6v.js → util-LvME_uOj.js} +35 -11
- package/package.json +7 -2
- package/dist/fieldwork-JCfyw58T.d.ts +0 -113
- package/dist/path-DL5P8XH2.js +0 -17
- package/dist/util-DhYr1OS3.d.ts +0 -1
- package/dist/{errors-DkFJysIM.js → errors-gpxg6Tnh.js} +5 -5
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { n as AnyAdapter, r as Operations, t as Adapter } from "./adapter-J2yatZJ0.js";
|
|
2
|
+
import { u as Capability } from "./errors-gMtejKHc.js";
|
|
3
|
+
/** What `fieldwork` takes. */
|
|
4
|
+
interface FieldworkOptions<A extends AnyAdapter> {
|
|
5
|
+
/** The provider to call, such as `exa()`, or a `router` over several. */
|
|
6
|
+
adapter: A;
|
|
7
|
+
}
|
|
8
|
+
interface FieldworkBase<A extends AnyAdapter> {
|
|
9
|
+
/** The adapter's name, such as "firecrawl" or "router". */
|
|
10
|
+
readonly provider: A["name"];
|
|
11
|
+
/** Which capabilities this instance can call. */
|
|
12
|
+
readonly capabilities: Readonly<Record<Capability, boolean>>;
|
|
13
|
+
/** The provider's HTTP API, for anything Fieldwork does not wrap. */
|
|
14
|
+
readonly raw: A["raw"];
|
|
15
|
+
/** Whether the capability can be called. Same as `capabilities[capability]`. */
|
|
16
|
+
supports: (capability: Capability) => boolean;
|
|
17
|
+
/** The provider that serves a capability, or undefined when none does. */
|
|
18
|
+
providerFor: (capability: Capability) => string | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A Fieldwork instance has exactly the methods its adapter's provider offers.
|
|
22
|
+
* `fieldwork({ adapter: tavily() }).act(...)` does not compile, because
|
|
23
|
+
* Tavily has no browser.
|
|
24
|
+
*/
|
|
25
|
+
type Fieldwork<A extends AnyAdapter> = FieldworkBase<A> & Readonly<A["operations"]>;
|
|
26
|
+
/**
|
|
27
|
+
* The client: `fieldwork({ adapter })` has exactly the methods its adapter
|
|
28
|
+
* offers, each the adapter's own operation, so it can be called detached.
|
|
29
|
+
*
|
|
30
|
+
* Untyped callers and dynamic dispatch reach every capability name: one the
|
|
31
|
+
* provider lacks throws `Unsupported` rather than falling back to another
|
|
32
|
+
* provider. Check `supports` or `capabilities` before calling dynamically.
|
|
33
|
+
*/
|
|
34
|
+
declare const fieldwork: <A extends Adapter<string, Operations, unknown>>(options: FieldworkOptions<A>) => Fieldwork<A>;
|
|
35
|
+
export { FieldworkOptions as n, fieldwork as r, Fieldwork as t };
|
package/dist/firecrawl.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as OutputSchema } from "./schema-
|
|
1
|
+
import { a as RawClient, t as Adapter } from "./adapter-J2yatZJ0.js";
|
|
2
|
+
import { t as OutputSchema } from "./schema-C9xzRkKJ.js";
|
|
3
|
+
import { B as Page, C as DownloadedFile, G as Product, H as ParsedDocument, J as Recency, L as MonitorEvents, Q as SearchResponse, R as MonitorInfo, S as DownloadOptions, T as Extraction, V as PageBatch, Y as Research, i as ActResult, j as ImageSearch, l as CallOptions, p as Crawl, r as AccountUsage, s as BrowserSession, tt as SiteMap, y as DocumentInput, z as MonitorSchedule } from "./errors-gMtejKHc.js";
|
|
3
4
|
/** Settings for the Firecrawl adapter. */
|
|
4
5
|
interface FirecrawlConfig {
|
|
5
6
|
/** Defaults to the FIRECRAWL_API_KEY environment variable. */
|
|
@@ -400,7 +401,7 @@ interface FirecrawlOperations {
|
|
|
400
401
|
usage: (options?: CallOptions) => Promise<AccountUsage>;
|
|
401
402
|
}
|
|
402
403
|
/**
|
|
403
|
-
* An adapter for Firecrawl: search, images, read, readMany, extract, product, map, crawl, research, act, browser, parse, download, monitor and usage. Pass it to `
|
|
404
|
+
* An adapter for Firecrawl: search, images, read, readMany, extract, product, map, crawl, research, act, browser, parse, download, monitor and usage. Pass it to `fieldwork({ adapter })`.
|
|
404
405
|
*
|
|
405
406
|
* Throws `Unauthorized` when neither `apiKey` nor `FIRECRAWL_API_KEY` is set.
|
|
406
407
|
*/
|