@dealcrawl/sdk 2.1.3 → 2.2.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 +147 -14
- package/dist/index.d.mts +445 -11
- package/dist/index.d.ts +445 -11
- package/dist/index.js +252 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +252 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -137,6 +137,15 @@ interface ScrapeResult {
|
|
|
137
137
|
signals: Signal[];
|
|
138
138
|
aiExtraction?: AIExtraction;
|
|
139
139
|
dealExtraction?: ExtractedDeal;
|
|
140
|
+
/** Multiple deals extracted from list pages */
|
|
141
|
+
multipleDeals?: ExtractedDeal[];
|
|
142
|
+
/** Metadata for multi-deal extraction */
|
|
143
|
+
multiDealMetadata?: {
|
|
144
|
+
totalFound: number;
|
|
145
|
+
category?: string;
|
|
146
|
+
hasNextPage?: boolean;
|
|
147
|
+
extractionConfidence: number;
|
|
148
|
+
};
|
|
140
149
|
dealScore?: DealScoreSummary;
|
|
141
150
|
screenshot?: string;
|
|
142
151
|
screenshotMetadata?: ScreenshotResult;
|
|
@@ -285,6 +294,120 @@ interface PaginationInfo {
|
|
|
285
294
|
/** Scrape job creation response */
|
|
286
295
|
interface ScrapeJobResponse extends JobResponse {
|
|
287
296
|
}
|
|
297
|
+
/** Individual batch scrape result item */
|
|
298
|
+
interface BatchScrapeResultItem {
|
|
299
|
+
/** URL that was scraped */
|
|
300
|
+
url: string;
|
|
301
|
+
/** Reference ID if provided in request */
|
|
302
|
+
ref?: string;
|
|
303
|
+
/** Job ID created for this URL */
|
|
304
|
+
jobId: string;
|
|
305
|
+
/** Status of job creation */
|
|
306
|
+
status: "queued" | "failed";
|
|
307
|
+
/** Error message if job creation failed */
|
|
308
|
+
error?: string;
|
|
309
|
+
}
|
|
310
|
+
/** Batch scrape response */
|
|
311
|
+
interface BatchScrapeResponse {
|
|
312
|
+
/** Batch ID for tracking */
|
|
313
|
+
batchId: string;
|
|
314
|
+
/** Total number of URLs in batch */
|
|
315
|
+
total: number;
|
|
316
|
+
/** Number of jobs successfully queued */
|
|
317
|
+
queued: number;
|
|
318
|
+
/** Number of jobs that failed to queue */
|
|
319
|
+
failed: number;
|
|
320
|
+
/** Individual results per URL */
|
|
321
|
+
results: BatchScrapeResultItem[];
|
|
322
|
+
/** Timestamp when batch was created */
|
|
323
|
+
createdAt: string;
|
|
324
|
+
}
|
|
325
|
+
/** Batch status response */
|
|
326
|
+
interface BatchStatusResponse {
|
|
327
|
+
/** Batch ID */
|
|
328
|
+
batchId: string;
|
|
329
|
+
/** Total URLs in batch */
|
|
330
|
+
total: number;
|
|
331
|
+
/** Number queued */
|
|
332
|
+
queued: number;
|
|
333
|
+
/** Number failed */
|
|
334
|
+
failed: number;
|
|
335
|
+
/** Webhook URL if configured */
|
|
336
|
+
webhookUrl?: string;
|
|
337
|
+
/** Priority level */
|
|
338
|
+
priority: number;
|
|
339
|
+
/** Creation timestamp */
|
|
340
|
+
createdAt: string;
|
|
341
|
+
/** Individual job statuses */
|
|
342
|
+
jobs: Array<{
|
|
343
|
+
id: string;
|
|
344
|
+
status: JobStatus;
|
|
345
|
+
result?: unknown;
|
|
346
|
+
error?: string;
|
|
347
|
+
}>;
|
|
348
|
+
}
|
|
349
|
+
/** Individual search result */
|
|
350
|
+
interface SearchResultItem {
|
|
351
|
+
/** Result title */
|
|
352
|
+
title: string;
|
|
353
|
+
/** Result URL */
|
|
354
|
+
url: string;
|
|
355
|
+
/** Result description/snippet */
|
|
356
|
+
description: string;
|
|
357
|
+
/** Deal score if useDealScoring enabled (0-100) */
|
|
358
|
+
dealScore?: number;
|
|
359
|
+
/** Display URL */
|
|
360
|
+
displayUrl?: string;
|
|
361
|
+
}
|
|
362
|
+
/** Search job response data */
|
|
363
|
+
interface SearchData {
|
|
364
|
+
/** Search results */
|
|
365
|
+
results: SearchResultItem[];
|
|
366
|
+
/** Total results found */
|
|
367
|
+
total: number;
|
|
368
|
+
/** Original query */
|
|
369
|
+
query: string;
|
|
370
|
+
/** AI-optimized query (if useAiOptimization=true) */
|
|
371
|
+
aiOptimizedQuery?: string;
|
|
372
|
+
/** Whether results were from cache */
|
|
373
|
+
cached: boolean;
|
|
374
|
+
/** Search duration in ms */
|
|
375
|
+
durationMs: number;
|
|
376
|
+
/** Job IDs for auto-scraped URLs */
|
|
377
|
+
scrapedJobIds?: string[];
|
|
378
|
+
}
|
|
379
|
+
/** Search job response */
|
|
380
|
+
interface SearchJobResponse {
|
|
381
|
+
/** Success status */
|
|
382
|
+
success: boolean;
|
|
383
|
+
/** Search results data */
|
|
384
|
+
data: SearchData;
|
|
385
|
+
/** Response metadata */
|
|
386
|
+
meta: {
|
|
387
|
+
/** Search provider used */
|
|
388
|
+
provider: "serpapi" | "google";
|
|
389
|
+
/** Number of scrape jobs created */
|
|
390
|
+
scrapeJobsCreated: number;
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
/** Search API status response */
|
|
394
|
+
interface SearchStatusResponse {
|
|
395
|
+
/** Whether search is available */
|
|
396
|
+
available: boolean;
|
|
397
|
+
/** Search provider */
|
|
398
|
+
provider: "serpapi" | "google" | "none";
|
|
399
|
+
/** Available features */
|
|
400
|
+
features: {
|
|
401
|
+
/** AI query optimization available */
|
|
402
|
+
aiOptimization: boolean;
|
|
403
|
+
/** Redis caching enabled */
|
|
404
|
+
caching: boolean;
|
|
405
|
+
/** Deal scoring enabled */
|
|
406
|
+
dealScoring: boolean;
|
|
407
|
+
};
|
|
408
|
+
/** Cache TTL */
|
|
409
|
+
cacheTtl: string;
|
|
410
|
+
}
|
|
288
411
|
/** Crawl job creation response */
|
|
289
412
|
interface CrawlJobResponse extends JobResponse {
|
|
290
413
|
}
|
|
@@ -514,19 +637,29 @@ interface TestWebhookResponse {
|
|
|
514
637
|
interface ApiKeyInfo {
|
|
515
638
|
id: string;
|
|
516
639
|
name: string;
|
|
517
|
-
prefix
|
|
640
|
+
/** Key prefix (e.g., "sk_dev_abc123") */
|
|
641
|
+
keyPrefix: string;
|
|
518
642
|
scopes: string[];
|
|
519
643
|
isActive: boolean;
|
|
520
|
-
expiresAt
|
|
521
|
-
lastUsedAt
|
|
644
|
+
expiresAt: string | null;
|
|
645
|
+
lastUsedAt: string | null;
|
|
522
646
|
createdAt: string;
|
|
647
|
+
revokedAt: string | null;
|
|
648
|
+
revokedReason: string | null;
|
|
523
649
|
usageCount: number;
|
|
524
|
-
ipAllowlist
|
|
650
|
+
ipAllowlist: string[] | null;
|
|
525
651
|
}
|
|
526
652
|
/** Created API key (includes secret - only shown once) */
|
|
527
|
-
interface CreatedApiKey
|
|
653
|
+
interface CreatedApiKey {
|
|
654
|
+
id: string;
|
|
528
655
|
/** The full API key - only returned on creation, never stored */
|
|
529
|
-
|
|
656
|
+
rawKey: string;
|
|
657
|
+
/** Key prefix for identification */
|
|
658
|
+
keyPrefix: string;
|
|
659
|
+
name: string;
|
|
660
|
+
scopes: string[];
|
|
661
|
+
expiresAt: string | null;
|
|
662
|
+
createdAt: string;
|
|
530
663
|
}
|
|
531
664
|
/** List keys response */
|
|
532
665
|
interface ListKeysResponse {
|
|
@@ -559,7 +692,9 @@ interface KeyStatsResponse {
|
|
|
559
692
|
totalRequests: number;
|
|
560
693
|
successfulRequests: number;
|
|
561
694
|
failedRequests: number;
|
|
695
|
+
avgDurationMs: number;
|
|
562
696
|
byEndpoint: Record<string, number>;
|
|
697
|
+
requestsByDay: Record<string, number>;
|
|
563
698
|
};
|
|
564
699
|
}
|
|
565
700
|
/** Usage stats */
|
|
@@ -727,6 +862,10 @@ interface ScrapeOptions {
|
|
|
727
862
|
extractWithAI?: boolean;
|
|
728
863
|
/** Extract deal-specific information (product, price, discount, urgency) */
|
|
729
864
|
extractDeal?: boolean;
|
|
865
|
+
/** Extract MULTIPLE deals from list/category pages */
|
|
866
|
+
extractMultipleDeals?: boolean;
|
|
867
|
+
/** Maximum deals to extract from list pages (default: 20, max: 50) */
|
|
868
|
+
maxDeals?: number;
|
|
730
869
|
/** Use advanced AI model (GPT-4o) for complex pages - higher cost, better quality */
|
|
731
870
|
useAdvancedModel?: boolean;
|
|
732
871
|
/** Minimum deal score threshold (0-100) - only returns deals above this score */
|
|
@@ -744,6 +883,118 @@ interface ScrapeOptions {
|
|
|
744
883
|
/** Timeout in milliseconds (default: 30000, max: 120000) */
|
|
745
884
|
timeout?: number;
|
|
746
885
|
}
|
|
886
|
+
/** Individual URL item for batch scraping */
|
|
887
|
+
interface BatchScrapeItem {
|
|
888
|
+
/** URL to scrape */
|
|
889
|
+
url: string;
|
|
890
|
+
/** Optional reference ID for tracking */
|
|
891
|
+
ref?: string;
|
|
892
|
+
/** Override detectSignals for this URL */
|
|
893
|
+
detectSignals?: boolean;
|
|
894
|
+
/** Override extractWithAI for this URL */
|
|
895
|
+
extractWithAI?: boolean;
|
|
896
|
+
/** Override extractDeal for this URL */
|
|
897
|
+
extractDeal?: boolean;
|
|
898
|
+
/** Override screenshot for this URL */
|
|
899
|
+
screenshot?: ScreenshotOptions;
|
|
900
|
+
/** Override headers for this URL */
|
|
901
|
+
headers?: Record<string, string>;
|
|
902
|
+
/** Override timeout for this URL */
|
|
903
|
+
timeout?: number;
|
|
904
|
+
}
|
|
905
|
+
/** Default options applied to all URLs in a batch */
|
|
906
|
+
interface BatchScrapeDefaults {
|
|
907
|
+
/** Don't save scrape results (zero data retention) */
|
|
908
|
+
noStore?: boolean;
|
|
909
|
+
/** Detect signals like prices, discounts, urgency */
|
|
910
|
+
detectSignals?: boolean;
|
|
911
|
+
/** Extract content using AI */
|
|
912
|
+
extractWithAI?: boolean;
|
|
913
|
+
/** Extract deal-specific information */
|
|
914
|
+
extractDeal?: boolean;
|
|
915
|
+
/** Extract multiple deals from list pages */
|
|
916
|
+
extractMultipleDeals?: boolean;
|
|
917
|
+
/** Maximum deals to extract (default: 20, max: 50) */
|
|
918
|
+
maxDeals?: number;
|
|
919
|
+
/** Use advanced AI model (higher cost, better quality) */
|
|
920
|
+
useAdvancedModel?: boolean;
|
|
921
|
+
/** Minimum deal score threshold (0-100) */
|
|
922
|
+
minDealScore?: number;
|
|
923
|
+
/** Screenshot configuration */
|
|
924
|
+
screenshot?: ScreenshotOptions;
|
|
925
|
+
/** HTML tags to exclude */
|
|
926
|
+
excludeTags?: string[];
|
|
927
|
+
/** CSS selectors to exclude */
|
|
928
|
+
excludeSelectors?: string[];
|
|
929
|
+
/** Only extract main content area */
|
|
930
|
+
onlyMainContent?: boolean;
|
|
931
|
+
/** Custom headers for requests */
|
|
932
|
+
headers?: Record<string, string>;
|
|
933
|
+
/** Timeout in milliseconds */
|
|
934
|
+
timeout?: number;
|
|
935
|
+
}
|
|
936
|
+
/** Options for batch scraping multiple URLs */
|
|
937
|
+
interface BatchScrapeOptions {
|
|
938
|
+
/** Array of URLs to scrape (1-100) */
|
|
939
|
+
urls: BatchScrapeItem[];
|
|
940
|
+
/** Default options applied to all URLs */
|
|
941
|
+
defaults?: BatchScrapeDefaults;
|
|
942
|
+
/** Webhook URL for batch completion notification */
|
|
943
|
+
webhookUrl?: string;
|
|
944
|
+
/** Priority for batch jobs (1-10, higher = faster) */
|
|
945
|
+
priority?: number;
|
|
946
|
+
/** Delay between job submissions in ms (0-5000) */
|
|
947
|
+
delay?: number;
|
|
948
|
+
}
|
|
949
|
+
/** AI provider for search optimization */
|
|
950
|
+
type SearchAiProvider = "openai" | "anthropic";
|
|
951
|
+
/** AI model for search optimization */
|
|
952
|
+
type SearchAiModel = "gpt-4o-mini" | "gpt-4o" | "gpt-4o-2024-11-20" | "o1-mini" | "o1-preview" | "claude-3-5-haiku-20241022" | "claude-3-5-sonnet-20241022" | "claude-3-5-sonnet-20240620" | "claude-3-opus-20240229";
|
|
953
|
+
/** Date range filter for search */
|
|
954
|
+
type SearchDateRange = "day" | "week" | "month" | "year" | "all";
|
|
955
|
+
/** Search filters */
|
|
956
|
+
interface SearchFilters {
|
|
957
|
+
/** Country code (e.g., 'fr', 'us') */
|
|
958
|
+
location?: string;
|
|
959
|
+
/** Language code (e.g., 'fr', 'en') */
|
|
960
|
+
language?: string;
|
|
961
|
+
/** Filter by date range */
|
|
962
|
+
dateRange?: SearchDateRange;
|
|
963
|
+
/** Exclude PDF files from results */
|
|
964
|
+
excludePdf?: boolean;
|
|
965
|
+
/** Limit to specific domain */
|
|
966
|
+
domain?: string;
|
|
967
|
+
/** Must contain these deal keywords (OR logic) */
|
|
968
|
+
dealKeywords?: string[];
|
|
969
|
+
}
|
|
970
|
+
/** Options for web search */
|
|
971
|
+
interface SearchOptions {
|
|
972
|
+
/** Search query (required) */
|
|
973
|
+
query: string;
|
|
974
|
+
/** Maximum number of results (1-100, default: 10) */
|
|
975
|
+
maxResults?: number;
|
|
976
|
+
/** Auto-scrape top results */
|
|
977
|
+
autoScrape?: boolean;
|
|
978
|
+
/** Number of results to auto-scrape (1-10, default: 5) */
|
|
979
|
+
autoScrapeLimit?: number;
|
|
980
|
+
/** Use AI to optimize the search query */
|
|
981
|
+
useAiOptimization?: boolean;
|
|
982
|
+
/** AI provider for query optimization */
|
|
983
|
+
aiProvider?: SearchAiProvider;
|
|
984
|
+
/** AI model to use */
|
|
985
|
+
aiModel?: SearchAiModel;
|
|
986
|
+
/** Enable deal scoring for results (0-100) */
|
|
987
|
+
useDealScoring?: boolean;
|
|
988
|
+
/** Skip cache and force fresh search */
|
|
989
|
+
skipCache?: boolean;
|
|
990
|
+
/** Search filters */
|
|
991
|
+
filters?: SearchFilters;
|
|
992
|
+
/** Webhook for async notifications */
|
|
993
|
+
webhook?: {
|
|
994
|
+
url: string;
|
|
995
|
+
headers?: Record<string, string>;
|
|
996
|
+
};
|
|
997
|
+
}
|
|
747
998
|
/** Options for crawling a website */
|
|
748
999
|
interface CrawlOptions {
|
|
749
1000
|
/** Starting URL for the crawl (required) */
|
|
@@ -947,6 +1198,14 @@ interface UpdateWebhookOptions {
|
|
|
947
1198
|
* These are the actual scopes enforced by the backend via requireScope() middleware
|
|
948
1199
|
*/
|
|
949
1200
|
type ApiKeyScope = "scrape" | "crawl" | "dork" | "extract" | "status" | "data:read" | "data:export" | "keys:manage" | "webhooks:manage";
|
|
1201
|
+
/**
|
|
1202
|
+
* All available scopes (for reference and validation)
|
|
1203
|
+
*/
|
|
1204
|
+
declare const ALL_API_KEY_SCOPES: ApiKeyScope[];
|
|
1205
|
+
/**
|
|
1206
|
+
* Default scopes for new keys
|
|
1207
|
+
*/
|
|
1208
|
+
declare const DEFAULT_API_KEY_SCOPES: ApiKeyScope[];
|
|
950
1209
|
/** Options for creating an API key */
|
|
951
1210
|
interface CreateApiKeyOptions {
|
|
952
1211
|
/** Key name/description */
|
|
@@ -968,9 +1227,14 @@ interface ListApiKeysOptions {
|
|
|
968
1227
|
/** Include revoked keys */
|
|
969
1228
|
includeRevoked?: boolean;
|
|
970
1229
|
}
|
|
1230
|
+
/** Options for revoking an API key */
|
|
1231
|
+
interface RevokeApiKeyOptions {
|
|
1232
|
+
/** Reason for revocation */
|
|
1233
|
+
reason?: string;
|
|
1234
|
+
}
|
|
971
1235
|
/** Options for getting API key stats */
|
|
972
1236
|
interface GetApiKeyStatsOptions {
|
|
973
|
-
/** Number of days to get stats for (default: 30) */
|
|
1237
|
+
/** Number of days to get stats for (default: 7, max: 30) */
|
|
974
1238
|
days?: number;
|
|
975
1239
|
}
|
|
976
1240
|
/** Product category */
|
|
@@ -1665,10 +1929,16 @@ declare class KeysResource {
|
|
|
1665
1929
|
*
|
|
1666
1930
|
* @example
|
|
1667
1931
|
* ```ts
|
|
1932
|
+
* // Simple revoke
|
|
1668
1933
|
* await client.keys.revoke("key_abc123");
|
|
1934
|
+
*
|
|
1935
|
+
* // With reason
|
|
1936
|
+
* await client.keys.revoke("key_abc123", {
|
|
1937
|
+
* reason: "Key compromised"
|
|
1938
|
+
* });
|
|
1669
1939
|
* ```
|
|
1670
1940
|
*/
|
|
1671
|
-
revoke(keyId: string): Promise<DeleteKeyResponse>;
|
|
1941
|
+
revoke(keyId: string, options?: RevokeApiKeyOptions): Promise<DeleteKeyResponse>;
|
|
1672
1942
|
/**
|
|
1673
1943
|
* Revoke all API keys (except the current one)
|
|
1674
1944
|
*
|
|
@@ -1705,7 +1975,7 @@ declare class KeysResource {
|
|
|
1705
1975
|
|
|
1706
1976
|
/**
|
|
1707
1977
|
* Scrape Resource
|
|
1708
|
-
* Handles single page scraping operations
|
|
1978
|
+
* Handles single page and batch scraping operations
|
|
1709
1979
|
*/
|
|
1710
1980
|
|
|
1711
1981
|
/**
|
|
@@ -1739,6 +2009,19 @@ declare class ScrapeResource {
|
|
|
1739
2009
|
* ```
|
|
1740
2010
|
*/
|
|
1741
2011
|
extractDeal(url: string, options?: Omit<ScrapeOptions, "url" | "extractDeal">): Promise<ScrapeJobResponse>;
|
|
2012
|
+
/**
|
|
2013
|
+
* Scrape a list page and extract multiple deals
|
|
2014
|
+
* Use for category pages, deal lists, search results
|
|
2015
|
+
*
|
|
2016
|
+
* @example
|
|
2017
|
+
* ```ts
|
|
2018
|
+
* const job = await client.scrape.extractDeals(
|
|
2019
|
+
* "https://amazon.fr/deals",
|
|
2020
|
+
* { maxDeals: 30, useAdvancedModel: true }
|
|
2021
|
+
* );
|
|
2022
|
+
* ```
|
|
2023
|
+
*/
|
|
2024
|
+
extractDeals(url: string, options?: Omit<ScrapeOptions, "url" | "extractMultipleDeals">): Promise<ScrapeJobResponse>;
|
|
1742
2025
|
/**
|
|
1743
2026
|
* Scrape a URL with screenshot capture
|
|
1744
2027
|
* Convenience method for screenshot capture
|
|
@@ -1752,6 +2035,122 @@ declare class ScrapeResource {
|
|
|
1752
2035
|
* ```
|
|
1753
2036
|
*/
|
|
1754
2037
|
withScreenshot(url: string, screenshotOptions?: Omit<ScrapeOptions["screenshot"], "enabled">, options?: Omit<ScrapeOptions, "url" | "screenshot">): Promise<ScrapeJobResponse>;
|
|
2038
|
+
/**
|
|
2039
|
+
* Create a batch scrape job for multiple URLs
|
|
2040
|
+
* Scrapes 1-100 URLs in a single request
|
|
2041
|
+
*
|
|
2042
|
+
* @example
|
|
2043
|
+
* ```ts
|
|
2044
|
+
* const batch = await client.scrape.batch({
|
|
2045
|
+
* urls: [
|
|
2046
|
+
* { url: "https://shop1.com/product1" },
|
|
2047
|
+
* { url: "https://shop2.com/deal", extractDeal: true }
|
|
2048
|
+
* ],
|
|
2049
|
+
* defaults: { detectSignals: true }
|
|
2050
|
+
* });
|
|
2051
|
+
* console.log(batch.batchId, batch.results);
|
|
2052
|
+
* ```
|
|
2053
|
+
*/
|
|
2054
|
+
batch(options: BatchScrapeOptions): Promise<BatchScrapeResponse>;
|
|
2055
|
+
/**
|
|
2056
|
+
* Get status of a batch scrape operation
|
|
2057
|
+
*
|
|
2058
|
+
* @example
|
|
2059
|
+
* ```ts
|
|
2060
|
+
* const status = await client.scrape.getBatchStatus(batchId);
|
|
2061
|
+
* console.log(`Completed: ${status.completed}/${status.total}`);
|
|
2062
|
+
* ```
|
|
2063
|
+
*/
|
|
2064
|
+
getBatchStatus(batchId: string): Promise<BatchStatusResponse>;
|
|
2065
|
+
/**
|
|
2066
|
+
* Batch scrape with deal extraction enabled for all URLs
|
|
2067
|
+
* Convenience method for deal-focused batch scraping
|
|
2068
|
+
*
|
|
2069
|
+
* @example
|
|
2070
|
+
* ```ts
|
|
2071
|
+
* const batch = await client.scrape.batchForDeals([
|
|
2072
|
+
* "https://shop1.com/sale",
|
|
2073
|
+
* "https://shop2.com/deals"
|
|
2074
|
+
* ]);
|
|
2075
|
+
* ```
|
|
2076
|
+
*/
|
|
2077
|
+
batchForDeals(urls: string[], options?: Omit<BatchScrapeOptions, "urls">): Promise<BatchScrapeResponse>;
|
|
2078
|
+
}
|
|
2079
|
+
|
|
2080
|
+
/**
|
|
2081
|
+
* Search Resource
|
|
2082
|
+
* Handles web search operations with AI optimization
|
|
2083
|
+
*/
|
|
2084
|
+
|
|
2085
|
+
/**
|
|
2086
|
+
* Search resource class
|
|
2087
|
+
* Provides methods for web search with AI optimization
|
|
2088
|
+
*/
|
|
2089
|
+
declare class SearchResource {
|
|
2090
|
+
private ctx;
|
|
2091
|
+
constructor(ctx: RequestContext);
|
|
2092
|
+
/**
|
|
2093
|
+
* Create a new search job
|
|
2094
|
+
*
|
|
2095
|
+
* @example
|
|
2096
|
+
* ```ts
|
|
2097
|
+
* const result = await client.search.create({
|
|
2098
|
+
* query: "laptop deals black friday",
|
|
2099
|
+
* maxResults: 20,
|
|
2100
|
+
* useDealScoring: true
|
|
2101
|
+
* });
|
|
2102
|
+
* ```
|
|
2103
|
+
*/
|
|
2104
|
+
create(options: SearchOptions): Promise<SearchJobResponse>;
|
|
2105
|
+
/**
|
|
2106
|
+
* Search with AI query optimization
|
|
2107
|
+
* Convenience method for AI-enhanced searches
|
|
2108
|
+
*
|
|
2109
|
+
* @example
|
|
2110
|
+
* ```ts
|
|
2111
|
+
* const result = await client.search.withAI("iphone discount", {
|
|
2112
|
+
* aiProvider: "openai",
|
|
2113
|
+
* aiModel: "gpt-4o-mini"
|
|
2114
|
+
* });
|
|
2115
|
+
* ```
|
|
2116
|
+
*/
|
|
2117
|
+
withAI(query: string, options?: Omit<SearchOptions, "query" | "useAiOptimization">): Promise<SearchJobResponse>;
|
|
2118
|
+
/**
|
|
2119
|
+
* Search with deal scoring enabled
|
|
2120
|
+
* Scores each result for deal relevance (0-100)
|
|
2121
|
+
*
|
|
2122
|
+
* @example
|
|
2123
|
+
* ```ts
|
|
2124
|
+
* const result = await client.search.forDeals("gaming laptop");
|
|
2125
|
+
* ```
|
|
2126
|
+
*/
|
|
2127
|
+
forDeals(query: string, options?: Omit<SearchOptions, "query" | "useDealScoring">): Promise<SearchJobResponse>;
|
|
2128
|
+
/**
|
|
2129
|
+
* Search and auto-scrape top results
|
|
2130
|
+
* Creates scrape jobs for the best matching URLs
|
|
2131
|
+
*
|
|
2132
|
+
* @example
|
|
2133
|
+
* ```ts
|
|
2134
|
+
* const result = await client.search.andScrape("promo codes", {
|
|
2135
|
+
* autoScrapeLimit: 5
|
|
2136
|
+
* });
|
|
2137
|
+
* console.log(result.data.scrapedJobIds);
|
|
2138
|
+
* ```
|
|
2139
|
+
*/
|
|
2140
|
+
andScrape(query: string, options?: Omit<SearchOptions, "query" | "autoScrape">): Promise<SearchJobResponse>;
|
|
2141
|
+
/**
|
|
2142
|
+
* Check search API status
|
|
2143
|
+
* Returns availability and features info
|
|
2144
|
+
*
|
|
2145
|
+
* @example
|
|
2146
|
+
* ```ts
|
|
2147
|
+
* const status = await client.search.getStatus();
|
|
2148
|
+
* if (status.available) {
|
|
2149
|
+
* console.log(`Provider: ${status.provider}`);
|
|
2150
|
+
* }
|
|
2151
|
+
* ```
|
|
2152
|
+
*/
|
|
2153
|
+
getStatus(): Promise<SearchStatusResponse>;
|
|
1755
2154
|
}
|
|
1756
2155
|
|
|
1757
2156
|
/**
|
|
@@ -2032,17 +2431,38 @@ declare class DealCrawl {
|
|
|
2032
2431
|
/** Internal request context */
|
|
2033
2432
|
private readonly ctx;
|
|
2034
2433
|
/**
|
|
2035
|
-
* Scrape resource - Single page scraping
|
|
2434
|
+
* Scrape resource - Single page and batch scraping
|
|
2036
2435
|
*
|
|
2037
2436
|
* @example
|
|
2038
2437
|
* ```ts
|
|
2438
|
+
* // Single page
|
|
2039
2439
|
* const job = await client.scrape.create({
|
|
2040
2440
|
* url: "https://example.com",
|
|
2041
2441
|
* extractDeal: true
|
|
2042
2442
|
* });
|
|
2443
|
+
*
|
|
2444
|
+
* // Batch scraping
|
|
2445
|
+
* const batch = await client.scrape.batch({
|
|
2446
|
+
* urls: [{ url: "https://shop1.com" }, { url: "https://shop2.com" }]
|
|
2447
|
+
* });
|
|
2043
2448
|
* ```
|
|
2044
2449
|
*/
|
|
2045
2450
|
readonly scrape: ScrapeResource;
|
|
2451
|
+
/**
|
|
2452
|
+
* Search resource - Web search with AI optimization
|
|
2453
|
+
*
|
|
2454
|
+
* @example
|
|
2455
|
+
* ```ts
|
|
2456
|
+
* const result = await client.search.create({
|
|
2457
|
+
* query: "laptop deals",
|
|
2458
|
+
* useDealScoring: true
|
|
2459
|
+
* });
|
|
2460
|
+
*
|
|
2461
|
+
* // With AI optimization
|
|
2462
|
+
* const result = await client.search.withAI("iphone discount");
|
|
2463
|
+
* ```
|
|
2464
|
+
*/
|
|
2465
|
+
readonly search: SearchResource;
|
|
2046
2466
|
/**
|
|
2047
2467
|
* Crawl resource - Website crawling
|
|
2048
2468
|
*
|
|
@@ -2249,6 +2669,20 @@ declare class DealCrawl {
|
|
|
2249
2669
|
* ```
|
|
2250
2670
|
*/
|
|
2251
2671
|
extractAndWait<T = unknown>(options: Parameters<ExtractResource["create"]>[0], waitOptions?: WaitOptions): Promise<WaitResult<T>>;
|
|
2672
|
+
/**
|
|
2673
|
+
* Search and return results directly
|
|
2674
|
+
* Note: Search is synchronous, no waiting needed
|
|
2675
|
+
*
|
|
2676
|
+
* @example
|
|
2677
|
+
* ```ts
|
|
2678
|
+
* const result = await client.searchAndWait({
|
|
2679
|
+
* query: "gaming laptop deals",
|
|
2680
|
+
* useDealScoring: true
|
|
2681
|
+
* });
|
|
2682
|
+
* console.log(result.data.results);
|
|
2683
|
+
* ```
|
|
2684
|
+
*/
|
|
2685
|
+
searchAndWait(options: Parameters<SearchResource["create"]>[0]): Promise<ReturnType<SearchResource["create"]>>;
|
|
2252
2686
|
}
|
|
2253
2687
|
|
|
2254
2688
|
/**
|
|
@@ -2332,4 +2766,4 @@ declare class DealCrawlError extends Error {
|
|
|
2332
2766
|
}, retryAfter?: number | string | null): DealCrawlError;
|
|
2333
2767
|
}
|
|
2334
2768
|
|
|
2335
|
-
export { type AccountInfoResponse, type AccountMetricsResponse, AccountResource, type ApiError, type ApiKeyInfo, type ApiKeyScope, type ApiResponse, type CancelJobResponse, type CheckpointInfo, type ClientPreferences, type ClientStatsResponse, type CrawlAnalysisResponse, type CrawlJobResponse, type CrawlOptions, type CrawlRecommendation, CrawlResource, type CrawlResult, type CrawlTemplate, type CrawlTemplateId, type CreateApiKeyOptions, type CreateKeyResponse, type CreateWebhookOptions, type CreateWebhookResponse, type CreatedApiKey, DEFAULT_CONFIG, DataResource, DealCrawl, type DealCrawlConfig, DealCrawlError, type DealDetails, type DealItem, type DealMetrics, type DealScoreSummary, type DealSummary, type DealUpMetrics, type DealUpMetricsResponse, type DeleteKeyResponse, type DeleteWebhookResponse, type DiscountSignal, type DorkJobResponse, type DorkOptions, DorkResource, type DorkResult, ERROR_CODES, type ErrorCode, type ExportDealsOptions, type ExportFormat, type ExportJobsOptions, type ExtractJobResponse, type ExtractModel, type ExtractOptions, ExtractResource, type ExtractedDeal, type GetApiKeyStatsOptions, type GetDealsOptions, type JobDealsResponse, type JobMetricsResponse, type JobResponse, type JobStatus, type JobStatusFilter, type JobStatusResponse, type JobSummary, type JobTypeFilter, type KeyStatsResponse, KeysResource, type ListApiKeysOptions, type ListDealsOptions, type ListDealsResponse, type ListJobsOptions, type ListJobsResponse, type ListKeysResponse, type ListWebhooksResponse, type PaginatedResponse, type PaginationInfo, type ParsedPage, type PreferencesResponse, type PriceSignal, type PricingInfo, type ProductCategory, type ProductInfo, type RateLimitInfo, type RecommendationsResponse, type RequestContext, type ResumeJobResponse, type RotateApiKeyOptions, type RotateKeyResponse, type ScrapeJobResponse, type ScrapeOptions, ScrapeResource, type ScrapeResult, type ScreenshotOptions, type Signal, type SortOrder, StatusResource, type TestWebhookResponse, type UpdatePreferencesOptions, type UpdatePreferencesResponse, type UpdateWebhookOptions, type UpdateWebhookResponse, type UsageStats, type WaitOptions, type WaitResult, type WebhookEvent, type WebhookItem, WebhooksResource, DealCrawl as default, pollUntil, waitForAll, waitForAny, waitForResult };
|
|
2769
|
+
export { ALL_API_KEY_SCOPES, type AccountInfoResponse, type AccountMetricsResponse, AccountResource, type ApiError, type ApiKeyInfo, type ApiKeyScope, type ApiResponse, type BatchScrapeDefaults, type BatchScrapeItem, type BatchScrapeOptions, type BatchScrapeResponse, type BatchScrapeResultItem, type BatchStatusResponse, type CancelJobResponse, type CheckpointInfo, type ClientPreferences, type ClientStatsResponse, type CrawlAnalysisResponse, type CrawlJobResponse, type CrawlOptions, type CrawlRecommendation, CrawlResource, type CrawlResult, type CrawlTemplate, type CrawlTemplateId, type CreateApiKeyOptions, type CreateKeyResponse, type CreateWebhookOptions, type CreateWebhookResponse, type CreatedApiKey, DEFAULT_API_KEY_SCOPES, DEFAULT_CONFIG, DataResource, DealCrawl, type DealCrawlConfig, DealCrawlError, type DealDetails, type DealItem, type DealMetrics, type DealScoreSummary, type DealSummary, type DealUpMetrics, type DealUpMetricsResponse, type DeleteKeyResponse, type DeleteWebhookResponse, type DiscountSignal, type DorkJobResponse, type DorkOptions, DorkResource, type DorkResult, ERROR_CODES, type ErrorCode, type ExportDealsOptions, type ExportFormat, type ExportJobsOptions, type ExtractJobResponse, type ExtractModel, type ExtractOptions, ExtractResource, type ExtractedDeal, type GetApiKeyStatsOptions, type GetDealsOptions, type JobDealsResponse, type JobMetricsResponse, type JobResponse, type JobStatus, type JobStatusFilter, type JobStatusResponse, type JobSummary, type JobTypeFilter, type KeyStatsResponse, KeysResource, type ListApiKeysOptions, type ListDealsOptions, type ListDealsResponse, type ListJobsOptions, type ListJobsResponse, type ListKeysResponse, type ListWebhooksResponse, type PaginatedResponse, type PaginationInfo, type ParsedPage, type PreferencesResponse, type PriceSignal, type PricingInfo, type ProductCategory, type ProductInfo, type RateLimitInfo, type RecommendationsResponse, type RequestContext, type ResumeJobResponse, type RevokeApiKeyOptions, type RotateApiKeyOptions, type RotateKeyResponse, type ScrapeJobResponse, type ScrapeOptions, ScrapeResource, type ScrapeResult, type ScreenshotOptions, type SearchAiModel, type SearchAiProvider, type SearchData, type SearchDateRange, type SearchFilters, type SearchJobResponse, type SearchOptions, SearchResource, type SearchResultItem, type SearchStatusResponse, type Signal, type SortOrder, StatusResource, type TestWebhookResponse, type UpdatePreferencesOptions, type UpdatePreferencesResponse, type UpdateWebhookOptions, type UpdateWebhookResponse, type UsageStats, type WaitOptions, type WaitResult, type WebhookEvent, type WebhookItem, WebhooksResource, DealCrawl as default, pollUntil, waitForAll, waitForAny, waitForResult };
|