searchhive 1.1.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 +128 -0
- package/dist/client.d.ts +30 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +97 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +123 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/package.json +21 -0
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# searchhive-js
|
|
2
|
+
|
|
3
|
+
TypeScript SDK for the [SearchHive](https://www.searchhive.dev) API. Zero runtime dependencies — uses native `fetch`.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install searchhive-js
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
```typescript
|
|
14
|
+
import { SearchHive } from "searchhive-js";
|
|
15
|
+
|
|
16
|
+
const client = new SearchHive({ apiKey: "sk_live_..." });
|
|
17
|
+
// Or custom base URL:
|
|
18
|
+
// const client = new SearchHive({ apiKey: "sk_live_...", baseUrl: "https://your-instance.com/api/v1" });
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Methods
|
|
22
|
+
|
|
23
|
+
### `client.swiftSearch({ query, max_results?, auto_scrape_top?, include_contacts?, include_social? })`
|
|
24
|
+
|
|
25
|
+
Search + optional auto-scraping, contacts, and social profiles.
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
const res = await client.swiftSearch({
|
|
29
|
+
query: "best AI tools 2025",
|
|
30
|
+
max_results: 10,
|
|
31
|
+
auto_scrape_top: 3,
|
|
32
|
+
include_contacts: true,
|
|
33
|
+
include_social: true,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
console.log(res.search_results); // [{title, link, snippet, position, date}]
|
|
37
|
+
console.log(res.scraped_content); // [{url, title, text, links, images, metadata, error}]
|
|
38
|
+
console.log(res.contacts); // [{type, value, source_url, source_title}]
|
|
39
|
+
console.log(res.social_profiles); // [{platform, url, username, source_url, source_title}]
|
|
40
|
+
console.log(res.credits_used, res.remaining_credits);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### `client.scrapeForge({ url, extract?, wait_for?, timeout?, use_browser? })`
|
|
44
|
+
|
|
45
|
+
Scrape a single URL.
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
const res = await client.scrapeForge({
|
|
49
|
+
url: "https://example.com",
|
|
50
|
+
extract: ["h1", ".main-content"],
|
|
51
|
+
wait_for: "article.loaded",
|
|
52
|
+
timeout: 30,
|
|
53
|
+
use_browser: false,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
console.log(res.title, res.text);
|
|
57
|
+
console.log(res.credits_used);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### `client.deepDive({ query, max_pages?, extract_content?, include_domains?, exclude_domains? })`
|
|
61
|
+
|
|
62
|
+
Deep research: search + multi-page scraping + summary.
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
const res = await client.deepDive({
|
|
66
|
+
query: "Rust vs Go performance comparison",
|
|
67
|
+
max_pages: 5,
|
|
68
|
+
extract_content: true,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
console.log(res.summary);
|
|
72
|
+
console.log(res.scraped_content);
|
|
73
|
+
console.log(res.credits_used, res.remaining_credits);
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### `client.batchScrape({ urls, extract?, timeout?, use_browser? })`
|
|
77
|
+
|
|
78
|
+
Scrape multiple URLs in one request.
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
const results = await client.batchScrape({
|
|
82
|
+
urls: ["https://example.com", "https://other.com"],
|
|
83
|
+
timeout: 30,
|
|
84
|
+
});
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### `client.health()`
|
|
88
|
+
|
|
89
|
+
Check API status.
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
const { status } = await client.health();
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## Error Handling
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
import { SearchHiveError, RateLimitError, AuthenticationError } from "searchhive-js";
|
|
99
|
+
|
|
100
|
+
try {
|
|
101
|
+
await client.swiftSearch({ query: "test" });
|
|
102
|
+
} catch (err) {
|
|
103
|
+
if (err instanceof AuthenticationError) {
|
|
104
|
+
// Invalid API key
|
|
105
|
+
} else if (err instanceof RateLimitError) {
|
|
106
|
+
// 429 — back off
|
|
107
|
+
} else if (err instanceof SearchHiveError) {
|
|
108
|
+
console.log(err.status, err.message);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Backwards Compatibility
|
|
114
|
+
|
|
115
|
+
Old method names still work as aliases:
|
|
116
|
+
|
|
117
|
+
| Old | New |
|
|
118
|
+
|-----|-----|
|
|
119
|
+
| `client.search()` | `client.swiftSearch()` |
|
|
120
|
+
| `client.scrape()` | `client.scrapeForge()` |
|
|
121
|
+
| `client.research()` | `client.deepDive()` |
|
|
122
|
+
| `client.batchScrape()` | *(unchanged)* |
|
|
123
|
+
|
|
124
|
+
These are marked `@deprecated` and will be removed in a future version.
|
|
125
|
+
|
|
126
|
+
## License
|
|
127
|
+
|
|
128
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { SearchHiveConfig, SwiftSearchParams, SwiftSearchResponse, ScrapeForgeParams, ScrapeForgeResponse, DeepDiveParams, DeepDiveResponse, BatchScrapeParams, HealthResponse, SearchParams, ScrapeParams, ResearchParams, SearchResponse, ScrapeResponse, ResearchResponse } from "./types";
|
|
2
|
+
export declare class SearchHiveError extends Error {
|
|
3
|
+
status?: number | undefined;
|
|
4
|
+
body?: unknown | undefined;
|
|
5
|
+
constructor(message: string, status?: number | undefined, body?: unknown | undefined);
|
|
6
|
+
}
|
|
7
|
+
export declare class RateLimitError extends SearchHiveError {
|
|
8
|
+
constructor(retryAfter?: number);
|
|
9
|
+
}
|
|
10
|
+
export declare class AuthenticationError extends SearchHiveError {
|
|
11
|
+
constructor();
|
|
12
|
+
}
|
|
13
|
+
export declare class SearchHive {
|
|
14
|
+
private baseUrl;
|
|
15
|
+
private headers;
|
|
16
|
+
constructor(config: SearchHiveConfig);
|
|
17
|
+
private request;
|
|
18
|
+
swiftSearch(params: SwiftSearchParams): Promise<SwiftSearchResponse>;
|
|
19
|
+
scrapeForge(params: ScrapeForgeParams): Promise<ScrapeForgeResponse>;
|
|
20
|
+
deepDive(params: DeepDiveParams): Promise<DeepDiveResponse>;
|
|
21
|
+
batchScrape(params: BatchScrapeParams): Promise<ScrapeForgeResponse[]>;
|
|
22
|
+
health(): Promise<HealthResponse>;
|
|
23
|
+
/** @deprecated Use .swiftSearch() */
|
|
24
|
+
search(params: SearchParams): Promise<SearchResponse>;
|
|
25
|
+
/** @deprecated Use .scrapeForge() */
|
|
26
|
+
scrape(params: ScrapeParams): Promise<ScrapeResponse>;
|
|
27
|
+
/** @deprecated Use .deepDive() */
|
|
28
|
+
research(params: ResearchParams): Promise<ResearchResponse>;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,cAAc,EACd,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,qBAAa,eAAgB,SAAQ,KAAK;IAG/B,MAAM,CAAC,EAAE,MAAM;IACf,IAAI,CAAC,EAAE,OAAO;gBAFrB,OAAO,EAAE,MAAM,EACR,MAAM,CAAC,EAAE,MAAM,YAAA,EACf,IAAI,CAAC,EAAE,OAAO,YAAA;CAKxB;AAED,qBAAa,cAAe,SAAQ,eAAe;gBACrC,UAAU,CAAC,EAAE,MAAM;CAOhC;AAED,qBAAa,mBAAoB,SAAQ,eAAe;;CAKvD;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,OAAO,CAAyB;gBAE5B,MAAM,EAAE,gBAAgB;YAStB,OAAO;IAiCrB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAIpE,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAIpE,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAI3D,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,mBAAmB,EAAE,CAAC;IAItE,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC;IAMjC,qCAAqC;IACrC,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;IAOrD,qCAAqC;IACrC,MAAM,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC;IAIrD,kCAAkC;IAClC,QAAQ,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAG5D"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SearchHive = exports.AuthenticationError = exports.RateLimitError = exports.SearchHiveError = void 0;
|
|
4
|
+
class SearchHiveError extends Error {
|
|
5
|
+
constructor(message, status, body) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.status = status;
|
|
8
|
+
this.body = body;
|
|
9
|
+
this.name = "SearchHiveError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.SearchHiveError = SearchHiveError;
|
|
13
|
+
class RateLimitError extends SearchHiveError {
|
|
14
|
+
constructor(retryAfter) {
|
|
15
|
+
super(`Rate limited${retryAfter ? `, retry after ${retryAfter}s` : ""}`, 429);
|
|
16
|
+
this.name = "RateLimitError";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.RateLimitError = RateLimitError;
|
|
20
|
+
class AuthenticationError extends SearchHiveError {
|
|
21
|
+
constructor() {
|
|
22
|
+
super("Authentication failed: invalid API key", 401);
|
|
23
|
+
this.name = "AuthenticationError";
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
exports.AuthenticationError = AuthenticationError;
|
|
27
|
+
class SearchHive {
|
|
28
|
+
constructor(config) {
|
|
29
|
+
if (!config.apiKey)
|
|
30
|
+
throw new Error("apiKey is required");
|
|
31
|
+
this.baseUrl = config.baseUrl?.replace(/\/+$/, "") ?? "https://www.searchhive.dev/api/v1";
|
|
32
|
+
this.headers = {
|
|
33
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
34
|
+
"Content-Type": "application/json",
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
async request(method, path, body) {
|
|
38
|
+
const url = `${this.baseUrl}${path}`;
|
|
39
|
+
const res = await fetch(url, {
|
|
40
|
+
method,
|
|
41
|
+
headers: this.headers,
|
|
42
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
43
|
+
});
|
|
44
|
+
if (!res.ok) {
|
|
45
|
+
if (res.status === 401)
|
|
46
|
+
throw new AuthenticationError();
|
|
47
|
+
if (res.status === 429) {
|
|
48
|
+
const retryAfter = res.headers.get("Retry-After");
|
|
49
|
+
throw new RateLimitError(retryAfter ? parseInt(retryAfter, 10) : undefined);
|
|
50
|
+
}
|
|
51
|
+
let detail = "";
|
|
52
|
+
try {
|
|
53
|
+
const json = await res.json();
|
|
54
|
+
detail = json?.detail || json?.error || JSON.stringify(json);
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
detail = await res.text().catch(() => "");
|
|
58
|
+
}
|
|
59
|
+
throw new SearchHiveError(`${res.status}: ${detail}`, res.status);
|
|
60
|
+
}
|
|
61
|
+
return res.json();
|
|
62
|
+
}
|
|
63
|
+
// ─── Branded methods ────────────────────────────────────────
|
|
64
|
+
swiftSearch(params) {
|
|
65
|
+
return this.request("POST", "/swiftsearch", params);
|
|
66
|
+
}
|
|
67
|
+
scrapeForge(params) {
|
|
68
|
+
return this.request("POST", "/scrapeforge", params);
|
|
69
|
+
}
|
|
70
|
+
deepDive(params) {
|
|
71
|
+
return this.request("POST", "/deepdive", params);
|
|
72
|
+
}
|
|
73
|
+
batchScrape(params) {
|
|
74
|
+
return this.request("POST", "/scrapeforge/batch", params);
|
|
75
|
+
}
|
|
76
|
+
health() {
|
|
77
|
+
return this.request("GET", "/health");
|
|
78
|
+
}
|
|
79
|
+
// ─── Backwards-compatible aliases ───────────────────────────
|
|
80
|
+
/** @deprecated Use .swiftSearch() */
|
|
81
|
+
search(params) {
|
|
82
|
+
return this.swiftSearch({
|
|
83
|
+
query: params.query,
|
|
84
|
+
max_results: params.num_results,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
/** @deprecated Use .scrapeForge() */
|
|
88
|
+
scrape(params) {
|
|
89
|
+
return this.scrapeForge(params);
|
|
90
|
+
}
|
|
91
|
+
/** @deprecated Use .deepDive() */
|
|
92
|
+
research(params) {
|
|
93
|
+
return this.deepDive(params);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.SearchHive = SearchHive;
|
|
97
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["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AC,CAAC;IACtD,CAAC;IAED,WAAW,CAAC,MAAyB;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,CAAC,CAAC;IACtD,CAAC;IAED,QAAQ,CAAC,MAAsB;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,CAAC;IACnD,CAAC;IAED,WAAW,CAAC,MAAyB;QACnC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,CAAC,CAAC;IAC5D,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;IACxC,CAAC;IAED,+DAA+D;IAE/D,qCAAqC;IACrC,MAAM,CAAC,MAAoB;QACzB,OAAO,IAAI,CAAC,WAAW,CAAC;YACtB,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,WAAW,EAAE,MAAM,CAAC,WAAW;SAChC,CAAuC,CAAC;IAC3C,CAAC;IAED,qCAAqC;IACrC,MAAM,CAAC,MAAoB;QACzB,OAAO,IAAI,CAAC,WAAW,CAAC,MAAM,CAAuC,CAAC;IACxE,CAAC;IAED,kCAAkC;IAClC,QAAQ,CAAC,MAAsB;QAC7B,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAyC,CAAC;IACvE,CAAC;CACF;AArFD,gCAqFC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { SearchHive, SearchHiveError, RateLimitError, AuthenticationError } from "./client";
|
|
2
|
+
export type { SearchHiveConfig, SwiftSearchParams, SwiftSearchResponse, SwiftSearchResult, ScrapeForgeParams, ScrapeForgeResponse, DeepDiveParams, DeepDiveResponse, BatchScrapeParams, ScrapedContent, Contact, SocialProfile, HealthResponse, SearchParams, SearchResponse, SearchResult, ScrapeParams, ScrapeResponse, ResearchParams, ResearchResponse, } from "./types";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC5F,YAAY,EACV,gBAAgB,EAEhB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,OAAO,EACP,aAAa,EACb,cAAc,EAEd,YAAY,EACZ,cAAc,EACd,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AuthenticationError = exports.RateLimitError = exports.SearchHiveError = exports.SearchHive = void 0;
|
|
4
|
+
var client_1 = require("./client");
|
|
5
|
+
Object.defineProperty(exports, "SearchHive", { enumerable: true, get: function () { return client_1.SearchHive; } });
|
|
6
|
+
Object.defineProperty(exports, "SearchHiveError", { enumerable: true, get: function () { return client_1.SearchHiveError; } });
|
|
7
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return client_1.RateLimitError; } });
|
|
8
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return client_1.AuthenticationError; } });
|
|
9
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAA4F;AAAnF,oGAAA,UAAU,OAAA;AAAE,yGAAA,eAAe,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAE,6GAAA,mBAAmB,OAAA"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
export interface SearchHiveConfig {
|
|
2
|
+
apiKey: string;
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface SwiftSearchParams {
|
|
6
|
+
query: string;
|
|
7
|
+
max_results?: number;
|
|
8
|
+
auto_scrape_top?: boolean;
|
|
9
|
+
include_contacts?: boolean;
|
|
10
|
+
include_social?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SwiftSearchResult {
|
|
13
|
+
title: string;
|
|
14
|
+
link: string;
|
|
15
|
+
snippet: string;
|
|
16
|
+
position: number;
|
|
17
|
+
date?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface ScrapedContent {
|
|
20
|
+
url: string;
|
|
21
|
+
title: string | null;
|
|
22
|
+
text: string | null;
|
|
23
|
+
links: {
|
|
24
|
+
text: string;
|
|
25
|
+
href: string;
|
|
26
|
+
}[];
|
|
27
|
+
images: string[];
|
|
28
|
+
metadata: Record<string, unknown>;
|
|
29
|
+
error: string | null;
|
|
30
|
+
}
|
|
31
|
+
export interface Contact {
|
|
32
|
+
type: string;
|
|
33
|
+
value: string;
|
|
34
|
+
source_url: string;
|
|
35
|
+
source_title: string;
|
|
36
|
+
}
|
|
37
|
+
export interface SocialProfile {
|
|
38
|
+
platform: string;
|
|
39
|
+
url: string;
|
|
40
|
+
username: string;
|
|
41
|
+
source_url: string;
|
|
42
|
+
source_title: string;
|
|
43
|
+
}
|
|
44
|
+
export interface SwiftSearchResponse {
|
|
45
|
+
query: string;
|
|
46
|
+
search_results: SwiftSearchResult[];
|
|
47
|
+
scraped_content: ScrapedContent[];
|
|
48
|
+
contacts?: Contact[];
|
|
49
|
+
social_profiles?: SocialProfile[];
|
|
50
|
+
credits_used: number;
|
|
51
|
+
remaining_credits: number;
|
|
52
|
+
results_count: number;
|
|
53
|
+
scraped_count: number;
|
|
54
|
+
}
|
|
55
|
+
export interface ScrapeForgeParams {
|
|
56
|
+
url: string;
|
|
57
|
+
extract?: string[];
|
|
58
|
+
wait_for?: string | null;
|
|
59
|
+
timeout?: number;
|
|
60
|
+
use_browser?: boolean;
|
|
61
|
+
}
|
|
62
|
+
export interface ScrapeForgeResponse {
|
|
63
|
+
url: string;
|
|
64
|
+
title: string | null;
|
|
65
|
+
text: string | null;
|
|
66
|
+
links: {
|
|
67
|
+
text: string;
|
|
68
|
+
href: string;
|
|
69
|
+
}[];
|
|
70
|
+
images: string[];
|
|
71
|
+
metadata: Record<string, unknown>;
|
|
72
|
+
error: string | null;
|
|
73
|
+
credits_used: number;
|
|
74
|
+
remaining_credits: number;
|
|
75
|
+
}
|
|
76
|
+
export interface DeepDiveParams {
|
|
77
|
+
query: string;
|
|
78
|
+
max_pages?: number;
|
|
79
|
+
extract_content?: boolean;
|
|
80
|
+
include_domains?: string[] | null;
|
|
81
|
+
exclude_domains?: string[] | null;
|
|
82
|
+
}
|
|
83
|
+
export interface DeepDiveResponse {
|
|
84
|
+
search_results: SwiftSearchResult[];
|
|
85
|
+
scraped_content: ScrapedContent[];
|
|
86
|
+
summary: string | null;
|
|
87
|
+
credits_used: number;
|
|
88
|
+
remaining_credits: number;
|
|
89
|
+
}
|
|
90
|
+
export interface BatchScrapeParams {
|
|
91
|
+
urls: string[];
|
|
92
|
+
extract?: string[];
|
|
93
|
+
timeout?: number;
|
|
94
|
+
use_browser?: boolean;
|
|
95
|
+
}
|
|
96
|
+
export interface HealthResponse {
|
|
97
|
+
status: string;
|
|
98
|
+
[key: string]: unknown;
|
|
99
|
+
}
|
|
100
|
+
/** @deprecated Use SwiftSearchParams */
|
|
101
|
+
export type SearchParams = Omit<SwiftSearchParams, 'auto_scrape_top' | 'include_contacts' | 'include_social'> & {
|
|
102
|
+
num_results?: number;
|
|
103
|
+
search_type?: "search" | "news" | "images" | null;
|
|
104
|
+
};
|
|
105
|
+
/** @deprecated Use SwiftSearchResponse */
|
|
106
|
+
export type SearchResponse = Omit<SwiftSearchResponse, 'scraped_content' | 'contacts' | 'social_profiles' | 'scraped_count'> & {
|
|
107
|
+
results: SwiftSearchResult[];
|
|
108
|
+
total_results: number;
|
|
109
|
+
search_metadata: Record<string, unknown>;
|
|
110
|
+
};
|
|
111
|
+
/** @deprecated Use ScrapeForgeParams */
|
|
112
|
+
export type ScrapeParams = ScrapeForgeParams;
|
|
113
|
+
/** @deprecated Use ScrapeForgeResponse */
|
|
114
|
+
export type ScrapeResponse = Omit<ScrapeForgeResponse, 'credits_used' | 'remaining_credits'> & {
|
|
115
|
+
full_text: string | null;
|
|
116
|
+
};
|
|
117
|
+
/** @deprecated Use DeepDiveParams */
|
|
118
|
+
export type ResearchParams = DeepDiveParams;
|
|
119
|
+
/** @deprecated Use DeepDiveResponse */
|
|
120
|
+
export type ResearchResponse = DeepDiveResponse;
|
|
121
|
+
/** @deprecated Use SwiftSearchResult */
|
|
122
|
+
export type SearchResult = SwiftSearchResult;
|
|
123
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,cAAc;IAC7B,GAA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AAY,GAAG,IAAI,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,kBAAkB,GAAG,gBAAgB,CAAC,GAAG;IAC9G,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;CACnD,CAAC;AAEF,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,mBAAmB,EAAE,iBAAiB,GAAG,UAAU,GAAG,iBAAiB,GAAG,eAAe,CAAC,GAAG;IAC7H,OAAO,EAAE,iBAAiB,EAAE,CAAC;IAC7B,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C,CAAC;AAEF,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC;AAE7C,0CAA0C;AAC1C,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,mBAAmB,EAAE,cAAc,GAAG,mBAAmB,CAAC,GAAG;IAC7F,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B,CAAC;AAEF,qCAAqC;AACrC,MAAM,MAAM,cAAc,GAAG,cAAc,CAAC;AAE5C,uCAAuC;AACvC,MAAM,MAAM,gBAAgB,GAAG,gBAAgB,CAAC;AAEhD,wCAAwC;AACxC,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "searchhive",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "TypeScript SDK for the SearchHive API",
|
|
5
|
+
"author": "SearchHive",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"typescript": "^5.0.0"
|
|
20
|
+
}
|
|
21
|
+
}
|