crw-sdk 0.15.2 → 0.17.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/dist/cjs/client.js +24 -0
- package/dist/esm/client.d.ts +14 -1
- package/dist/esm/client.js +24 -0
- package/dist/esm/types.d.ts +21 -0
- package/package.json +1 -1
package/dist/cjs/client.js
CHANGED
|
@@ -115,6 +115,30 @@ class CrwClient {
|
|
|
115
115
|
return this.httpPost("/v1/search", args);
|
|
116
116
|
return this.localTransport().toolCall("crw_search", args);
|
|
117
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Firecrawl-compatible Research API (cloud only). Mirrors the Firecrawl
|
|
120
|
+
* research SDK surface over `/v2/search/research/*`. Each method GETs the
|
|
121
|
+
* hosted endpoint and returns its `{ success, ... }` payload verbatim.
|
|
122
|
+
*/
|
|
123
|
+
get research() {
|
|
124
|
+
const get = (path, params) => {
|
|
125
|
+
if (this.apiUrl === null)
|
|
126
|
+
throw new errors_js_1.CrwError("research API requires cloud mode (set apiKey/apiUrl)");
|
|
127
|
+
const qs = Object.entries(params)
|
|
128
|
+
.filter(([, v]) => v !== undefined && v !== null)
|
|
129
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(String(v))}`)
|
|
130
|
+
.join("&");
|
|
131
|
+
return this.httpRequest("GET", qs ? `${path}?${qs}` : path, undefined, {
|
|
132
|
+
checkSuccess: false,
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
return {
|
|
136
|
+
searchPapers: (query, opts = {}) => get("/v2/search/research/papers", { query, ...opts }),
|
|
137
|
+
getPaper: (id, opts = {}) => get(`/v2/search/research/papers/${encodeURIComponent(id)}`, { ...opts }),
|
|
138
|
+
similarPapers: (id, opts) => get(`/v2/search/research/papers/${encodeURIComponent(id)}/similar`, { ...opts }),
|
|
139
|
+
searchGithub: (query, opts = {}) => get("/v2/search/research/github", { query, ...opts }),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
118
142
|
/**
|
|
119
143
|
* Parse a document (PDF) into markdown / structured JSON. Works in both modes.
|
|
120
144
|
*/
|
package/dist/esm/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/** CRW client — cloud (default), self-hosted HTTP, or local subprocess mode. */
|
|
2
|
-
import type { BatchResult, BatchScrapeOptions, Capabilities, ChangeTrackingOptions, ClientOptions, CrawlOptions, CrawlResult, DiffResult, ExtractOptions, ExtractResult, Json, MapOptions, ParseFileOptions, ParseResult, ScrapeOptions, ScrapeResult, SearchOptions, SearchResult } from "./types.js";
|
|
2
|
+
import type { BatchResult, BatchScrapeOptions, Capabilities, ChangeTrackingOptions, ClientOptions, CrawlOptions, CrawlResult, DiffResult, ExtractOptions, ExtractResult, Json, MapOptions, ParseFileOptions, ParseResult, ScrapeOptions, ScrapeResult, SearchOptions, SearchResult, ResearchSearchOptions, ResearchReadOptions, ResearchSimilarOptions } from "./types.js";
|
|
3
3
|
export declare const CLOUD_API_URL = "https://api.fastcrw.com";
|
|
4
4
|
export declare const DASHBOARD_URL = "https://fastcrw.com/dashboard";
|
|
5
5
|
export declare const DOCS_URL = "https://us.github.io/crw";
|
|
@@ -20,6 +20,19 @@ export declare class CrwClient {
|
|
|
20
20
|
* Works in both modes; local mode needs a SearXNG URL configured on the engine.
|
|
21
21
|
*/
|
|
22
22
|
search(query: string, opts?: SearchOptions): Promise<SearchResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Firecrawl-compatible Research API (cloud only). Mirrors the Firecrawl
|
|
25
|
+
* research SDK surface over `/v2/search/research/*`. Each method GETs the
|
|
26
|
+
* hosted endpoint and returns its `{ success, ... }` payload verbatim.
|
|
27
|
+
*/
|
|
28
|
+
get research(): {
|
|
29
|
+
searchPapers: (query: string, opts?: ResearchSearchOptions) => Promise<Json>;
|
|
30
|
+
getPaper: (id: string, opts?: ResearchReadOptions) => Promise<Json>;
|
|
31
|
+
similarPapers: (id: string, opts: ResearchSimilarOptions) => Promise<Json>;
|
|
32
|
+
searchGithub: (query: string, opts?: {
|
|
33
|
+
k?: number;
|
|
34
|
+
}) => Promise<Json>;
|
|
35
|
+
};
|
|
23
36
|
/**
|
|
24
37
|
* Parse a document (PDF) into markdown / structured JSON. Works in both modes.
|
|
25
38
|
*/
|
package/dist/esm/client.js
CHANGED
|
@@ -112,6 +112,30 @@ export class CrwClient {
|
|
|
112
112
|
return this.httpPost("/v1/search", args);
|
|
113
113
|
return this.localTransport().toolCall("crw_search", args);
|
|
114
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Firecrawl-compatible Research API (cloud only). Mirrors the Firecrawl
|
|
117
|
+
* research SDK surface over `/v2/search/research/*`. Each method GETs the
|
|
118
|
+
* hosted endpoint and returns its `{ success, ... }` payload verbatim.
|
|
119
|
+
*/
|
|
120
|
+
get research() {
|
|
121
|
+
const get = (path, params) => {
|
|
122
|
+
if (this.apiUrl === null)
|
|
123
|
+
throw new CrwError("research API requires cloud mode (set apiKey/apiUrl)");
|
|
124
|
+
const qs = Object.entries(params)
|
|
125
|
+
.filter(([, v]) => v !== undefined && v !== null)
|
|
126
|
+
.map(([k, v]) => `${encodeURIComponent(k)}=${encodeURIComponent(String(v))}`)
|
|
127
|
+
.join("&");
|
|
128
|
+
return this.httpRequest("GET", qs ? `${path}?${qs}` : path, undefined, {
|
|
129
|
+
checkSuccess: false,
|
|
130
|
+
});
|
|
131
|
+
};
|
|
132
|
+
return {
|
|
133
|
+
searchPapers: (query, opts = {}) => get("/v2/search/research/papers", { query, ...opts }),
|
|
134
|
+
getPaper: (id, opts = {}) => get(`/v2/search/research/papers/${encodeURIComponent(id)}`, { ...opts }),
|
|
135
|
+
similarPapers: (id, opts) => get(`/v2/search/research/papers/${encodeURIComponent(id)}/similar`, { ...opts }),
|
|
136
|
+
searchGithub: (query, opts = {}) => get("/v2/search/research/github", { query, ...opts }),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
115
139
|
/**
|
|
116
140
|
* Parse a document (PDF) into markdown / structured JSON. Works in both modes.
|
|
117
141
|
*/
|
package/dist/esm/types.d.ts
CHANGED
|
@@ -84,3 +84,24 @@ export type ExtractResult = Json;
|
|
|
84
84
|
export type BatchResult = Json[];
|
|
85
85
|
export type Capabilities = Json;
|
|
86
86
|
export type DiffResult = Json;
|
|
87
|
+
/** Firecrawl-compatible Research API options (cloud only). */
|
|
88
|
+
export interface ResearchSearchOptions {
|
|
89
|
+
k?: number;
|
|
90
|
+
authors?: string;
|
|
91
|
+
categories?: string;
|
|
92
|
+
from?: string;
|
|
93
|
+
to?: string;
|
|
94
|
+
}
|
|
95
|
+
export interface ResearchReadOptions {
|
|
96
|
+
/** When set, returns top passages answering this question instead of metadata. */
|
|
97
|
+
query?: string;
|
|
98
|
+
k?: number;
|
|
99
|
+
}
|
|
100
|
+
export interface ResearchSimilarOptions {
|
|
101
|
+
/** Required by Firecrawl: natural-language ranking intent. */
|
|
102
|
+
intent: string;
|
|
103
|
+
mode?: "similar" | "citers" | "references";
|
|
104
|
+
k?: number;
|
|
105
|
+
rerank?: boolean;
|
|
106
|
+
anchor?: string[];
|
|
107
|
+
}
|
package/package.json
CHANGED