@dealcrawl/sdk 2.12.0 → 2.14.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 CHANGED
@@ -6,7 +6,83 @@ Official TypeScript SDK for the DealCrawl web scraping and crawling API.
6
6
  [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
7
7
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
8
8
 
9
- ## What's New in v2.12.0 (January 2026) ✨
9
+ ## What's New in v2.13.0 (January 2026) ✨
10
+
11
+ ### New Resources
12
+
13
+ **Postprocessors Resource (`client.postprocessors.*`)**
14
+
15
+ Discover and check site-specific enrichment postprocessors (Amazon, Fnac, eBay):
16
+
17
+ ```typescript
18
+ // List all available postprocessors
19
+ const list = await client.postprocessors.list();
20
+ console.log(list.postprocessors);
21
+ // [{ name: "amazon", domains: [...], extractedFields: [...] }, ...]
22
+
23
+ // Check if a URL will be enriched
24
+ const check = await client.postprocessors.check({
25
+ url: "https://www.amazon.fr/dp/B09V3KXJPB"
26
+ });
27
+ console.log(check.hasPostprocessor); // true
28
+ console.log(check.postprocessor); // "amazon"
29
+ ```
30
+
31
+ **Usage Resource (`client.usage.*`)**
32
+
33
+ Monitor usage, quotas, and LLM token consumption:
34
+
35
+ ```typescript
36
+ // Get current usage and quotas
37
+ const usage = await client.usage.current();
38
+ console.log(usage.usage.scrapes); // 150
39
+ console.log(usage.quotas.scrapes); // 10000
40
+ console.log(usage.percentUsed.scrapes); // 1.5
41
+
42
+ // Get LLM token usage
43
+ const tokens = await client.usage.tokens({ days: 30 });
44
+ console.log(tokens.totals.estimatedCostUsd); // 12.34
45
+
46
+ // Get daily token breakdown
47
+ const daily = await client.usage.dailyTokens({ days: 7 });
48
+ ```
49
+
50
+ ### New Agent Vision Capabilities
51
+
52
+ Enable multi-modal vision for better page understanding:
53
+
54
+ ```typescript
55
+ const job = await client.agent.create({
56
+ url: "https://complex-site.com",
57
+ prompt: "Navigate and extract data",
58
+ enableVision: true, // NEW: Enable vision-based navigation
59
+ visionOptions: { // NEW: Configure vision behavior
60
+ quality: 80, // JPEG quality (1-100)
61
+ annotateElements: true, // Label clickable elements
62
+ captureFrequency: "on_stuck" // When to capture: every_step | on_demand | on_stuck
63
+ }
64
+ });
65
+ ```
66
+
67
+ ### New Scrape Options
68
+
69
+ Control scraping behavior with new options:
70
+
71
+ ```typescript
72
+ const job = await client.scrape.create({
73
+ url: "https://example.com",
74
+ // NEW: Control postprocessor execution
75
+ runPostprocessors: true, // Enable/disable site enrichment (default: true)
76
+ // NEW: Force browser-based scraping (uses 'render' quota)
77
+ forceDynamic: false,
78
+ // NEW: Force stealth mode for anti-bot sites
79
+ forceStealth: false,
80
+ });
81
+ ```
82
+
83
+ ---
84
+
85
+ ## What's New in v2.12.0 (January 2026)
10
86
 
11
87
  ### New Methods - 100% API Coverage
12
88
 
@@ -362,6 +438,222 @@ const deals = await client.status.getDeals(job.jobId, {
362
438
  console.log(deals.deals); // Array of ExtractedDeal objects
363
439
  ```
364
440
 
441
+ ### 🏪 Site-Specific Data (Postprocessors)
442
+
443
+ Automatic enrichment for major e-commerce sites. When scraping Amazon, Fnac, or eBay, you get structured site-specific data:
444
+
445
+ ```typescript
446
+ // Scrape an Amazon product
447
+ const result = await client.scrapeAndWait({
448
+ url: "https://www.amazon.fr/dp/B0EXAMPLE",
449
+ extractDeal: true,
450
+ });
451
+
452
+ // Site-specific data automatically extracted
453
+ console.log(result.data.siteData);
454
+ // {
455
+ // site: "amazon",
456
+ // productId: "B0EXAMPLE",
457
+ // seller: {
458
+ // name: "Official Store",
459
+ // rating: 4.8,
460
+ // reviewCount: 12543,
461
+ // isPrime: true
462
+ // },
463
+ // shipping: {
464
+ // free: true,
465
+ // prime: true,
466
+ // estimatedDelivery: "Tomorrow"
467
+ // },
468
+ // availability: {
469
+ // inStock: true,
470
+ // stockLevel: "in_stock",
471
+ // quantity: 50
472
+ // },
473
+ // condition: "new",
474
+ // buyBox: {
475
+ // seller: "Official Store",
476
+ // price: 29.99,
477
+ // isPrime: true
478
+ // },
479
+ // coupon: {
480
+ // discount: "10%",
481
+ // autoApplied: true
482
+ // },
483
+ // subscribeAndSave: {
484
+ // available: true,
485
+ // discountPercent: 15,
486
+ // price: 25.49
487
+ // },
488
+ // categories: ["Electronics", "Accessories", "Headphones"]
489
+ // }
490
+
491
+ // Check which postprocessors ran
492
+ console.log(result.data.postprocessorsUsed);
493
+ // ["amazon"]
494
+ ```
495
+
496
+ **Amazon-Specific Fields:**
497
+
498
+ ```typescript
499
+ // Amazon product with all enrichments
500
+ const result = await client.scrapeAndWait({
501
+ url: "https://www.amazon.com/dp/B0EXAMPLE",
502
+ });
503
+
504
+ if (result.data.siteData?.site === "amazon") {
505
+ const { siteData } = result.data;
506
+
507
+ // Prime eligibility
508
+ console.log("Prime:", siteData.shipping?.prime);
509
+ console.log("Free shipping:", siteData.shipping?.free);
510
+
511
+ // Buy Box winner
512
+ if (siteData.buyBox) {
513
+ console.log(`Best price: $${siteData.buyBox.price} from ${siteData.buyBox.seller}`);
514
+ }
515
+
516
+ // Subscribe & Save
517
+ if (siteData.subscribeAndSave?.available) {
518
+ console.log(`S&S: ${siteData.subscribeAndSave.discountPercent}% off`);
519
+ }
520
+
521
+ // Lightning deals
522
+ if (siteData.flashDeal?.active) {
523
+ console.log(`Flash deal ends: ${siteData.flashDeal.endsAt}`);
524
+ console.log(`${siteData.flashDeal.percentClaimed}% claimed`);
525
+ }
526
+
527
+ // Coupons
528
+ if (siteData.coupon) {
529
+ console.log(`Coupon: ${siteData.coupon.discount}`);
530
+ }
531
+ }
532
+ ```
533
+
534
+ **Fnac-Specific Fields:**
535
+
536
+ ```typescript
537
+ // Fnac product
538
+ const result = await client.scrapeAndWait({
539
+ url: "https://www.fnac.com/product/12345",
540
+ });
541
+
542
+ if (result.data.siteData?.site === "fnac") {
543
+ const { siteData } = result.data;
544
+
545
+ // Fnac Pro sellers
546
+ console.log("Pro Seller:", siteData.seller?.isProSeller);
547
+
548
+ // Express delivery
549
+ console.log("Express available:", siteData.shipping?.expressAvailable);
550
+
551
+ // Product condition
552
+ console.log("Condition:", siteData.condition);
553
+ // "new" | "refurbished" | "used" | "like_new" | "acceptable"
554
+
555
+ // Product variations
556
+ if (siteData.variations) {
557
+ siteData.variations.forEach(v => {
558
+ console.log(`${v.type}: ${v.options.join(", ")}`);
559
+ });
560
+ }
561
+ }
562
+ ```
563
+
564
+ **eBay-Specific Fields:**
565
+
566
+ ```typescript
567
+ // eBay listing
568
+ const result = await client.scrapeAndWait({
569
+ url: "https://www.ebay.com/itm/123456789",
570
+ });
571
+
572
+ if (result.data.siteData?.site === "ebay") {
573
+ const { siteData } = result.data;
574
+
575
+ // Top-rated seller badge
576
+ console.log("Top Rated:", siteData.seller?.topRated);
577
+
578
+ // Item condition
579
+ console.log("Condition:", siteData.condition);
580
+
581
+ // Stock level
582
+ if (siteData.availability) {
583
+ console.log("In stock:", siteData.availability.inStock);
584
+ console.log("Quantity:", siteData.availability.quantity);
585
+ }
586
+ }
587
+ ```
588
+
589
+ **Supported Domains:**
590
+
591
+ | Site | Domains |
592
+ |--------|-------------------------------------------------------------------------------------------|
593
+ | Amazon | amazon.com, amazon.fr, amazon.de, amazon.co.uk, amazon.es, amazon.it, amazon.ca, +12 more |
594
+ | Fnac | fnac.com, fnac.be, fnac.ch, fnac.pt, fnac.es |
595
+ | eBay | ebay.com, ebay.fr, ebay.de, ebay.co.uk, ebay.es, ebay.it, ebay.ca, ebay.com.au, +6 more |
596
+
597
+ **SiteSpecificData Type:**
598
+
599
+ ```typescript
600
+ import type { SiteSpecificData } from "@dealcrawl/sdk";
601
+
602
+ interface SiteSpecificData {
603
+ site: string; // "amazon" | "fnac" | "ebay"
604
+ productId?: string; // ASIN, SKU, or item ID
605
+ seller?: {
606
+ name: string;
607
+ url?: string;
608
+ rating?: number;
609
+ reviewCount?: number;
610
+ isPrime?: boolean; // Amazon
611
+ isProSeller?: boolean; // Fnac
612
+ topRated?: boolean; // eBay
613
+ };
614
+ shipping?: {
615
+ free: boolean;
616
+ estimatedDelivery?: string;
617
+ prime?: boolean; // Amazon Prime
618
+ expressAvailable?: boolean; // Fnac Express
619
+ };
620
+ availability?: {
621
+ inStock: boolean;
622
+ stockLevel?: "in_stock" | "low_stock" | "out_of_stock" | "preorder";
623
+ quantity?: number;
624
+ message?: string;
625
+ };
626
+ condition?: "new" | "refurbished" | "used" | "like_new" | "acceptable";
627
+ buyBox?: { // Amazon only
628
+ seller: string;
629
+ price: number;
630
+ isPrime: boolean;
631
+ };
632
+ coupon?: {
633
+ code?: string;
634
+ discount: string;
635
+ autoApplied: boolean;
636
+ };
637
+ flashDeal?: { // Lightning deals
638
+ active: boolean;
639
+ endsAt?: string;
640
+ percentClaimed?: number;
641
+ };
642
+ subscribeAndSave?: { // Amazon only
643
+ available: boolean;
644
+ discountPercent?: number;
645
+ price?: number;
646
+ };
647
+ categories?: string[];
648
+ variations?: Array<{
649
+ type: string;
650
+ options: string[];
651
+ selected?: string;
652
+ }>;
653
+ rawData?: Record<string, unknown>;
654
+ }
655
+ ```
656
+
365
657
  ### 📝 Markdown Output
366
658
 
367
659
  Convert HTML to clean, structured markdown:
@@ -471,6 +763,9 @@ const job = await client.scrape.withScreenshot("https://example.com", {
471
763
  | `outputMarkdown` | boolean | false | Convert content to Markdown (GFM) |
472
764
  | `markdownBaseUrl` | string | - | Base URL for resolving relative URLs in markdown |
473
765
  | `actions` | array | - | Browser actions to execute before scraping |
766
+ | `runPostprocessors` | boolean | true | Run site-specific postprocessors (Amazon, Fnac, eBay) |
767
+ | `forceDynamic` | boolean | false | Force browser-based scraping (uses 'render' quota) |
768
+ | `forceStealth` | boolean | false | Force stealth mode for anti-bot sites |
474
769
 
475
770
  ### Batch Scrape - Bulk URL Scraping
476
771
 
@@ -788,6 +1083,16 @@ const job = await client.agent.withClaude(
788
1083
  | `timeout` | number | 30000 | Per-step timeout in ms (max: 60000) |
789
1084
  | `takeScreenshots` | boolean | false | Capture screenshot at each step |
790
1085
  | `onlyMainContent` | boolean | true | Extract main content only |
1086
+ | `enableVision` | boolean | tier | Enable vision-based navigation (screenshots for LLM) |
1087
+ | `visionOptions` | object | - | Vision capture configuration (see below) |
1088
+
1089
+ **Vision Options:**
1090
+
1091
+ | Option | Type | Default | Description |
1092
+ | ------------------- | ------ | ------- | ------------------------------------------------ |
1093
+ | `quality` | number | tier | JPEG quality for screenshots (1-100) |
1094
+ | `annotateElements` | boolean| false | Label clickable elements on screenshots |
1095
+ | `captureFrequency` | string | tier | When to capture: `every_step`, `on_demand`, `on_stuck` |
791
1096
 
792
1097
  **Action Types:**
793
1098
 
@@ -1039,6 +1344,90 @@ await client.keys.create({
1039
1344
  });
1040
1345
  ```
1041
1346
 
1347
+ ### Postprocessors - Site Enrichment Discovery
1348
+
1349
+ Discover which postprocessors are available and check URL applicability:
1350
+
1351
+ ```typescript
1352
+ // List all available postprocessors
1353
+ const list = await client.postprocessors.list();
1354
+ console.log(list.postprocessors);
1355
+ // [
1356
+ // {
1357
+ // name: "amazon",
1358
+ // domains: ["amazon.com", "amazon.fr", "amazon.de", ...],
1359
+ // extractedFields: ["productId", "seller", "shipping", "availability", ...],
1360
+ // description: "Amazon product page enrichment..."
1361
+ // },
1362
+ // ...
1363
+ // ]
1364
+ console.log(list.totalDomains); // 30+ supported domains
1365
+
1366
+ // Check if a specific URL will be enriched
1367
+ const amazonCheck = await client.postprocessors.check({
1368
+ url: "https://www.amazon.fr/dp/B09V3KXJPB"
1369
+ });
1370
+ console.log(amazonCheck.hasPostprocessor); // true
1371
+ console.log(amazonCheck.postprocessor); // "amazon"
1372
+ console.log(amazonCheck.extractedFields); // ["productId", "seller", ...]
1373
+
1374
+ // Check unsupported URL
1375
+ const genericCheck = await client.postprocessors.check({
1376
+ url: "https://example.com/product"
1377
+ });
1378
+ console.log(genericCheck.hasPostprocessor); // false
1379
+ console.log(genericCheck.message); // "No postprocessor available..."
1380
+ ```
1381
+
1382
+ **Disable postprocessors for faster scraping:**
1383
+
1384
+ ```typescript
1385
+ const job = await client.scrape.create({
1386
+ url: "https://amazon.com/dp/B123",
1387
+ runPostprocessors: false, // Skip enrichment for speed
1388
+ });
1389
+ ```
1390
+
1391
+ ### Usage - Quota & Token Monitoring
1392
+
1393
+ Monitor your usage, quotas, and LLM token consumption:
1394
+
1395
+ ```typescript
1396
+ // Get current usage and quotas
1397
+ const usage = await client.usage.current();
1398
+ console.log(usage.tier); // "pro"
1399
+ console.log(usage.usage.scrapes); // 150
1400
+ console.log(usage.quotas.scrapes); // 10000
1401
+ console.log(usage.percentUsed.scrapes); // 1.5
1402
+ console.log(usage.billingPeriod.daysRemaining); // 15
1403
+
1404
+ // Get historical usage (for billing analysis)
1405
+ const history = await client.usage.history({ months: 6 });
1406
+ history.data.forEach(period => {
1407
+ console.log(`${period.periodStart}: ${period.usage.scrapes} scrapes`);
1408
+ });
1409
+
1410
+ // Get LLM token usage summary
1411
+ const tokens = await client.usage.tokens({ days: 30 });
1412
+ console.log(tokens.totals.totalTokens); // 1234567
1413
+ console.log(tokens.totals.estimatedCostUsd); // 12.34
1414
+ tokens.breakdown.forEach(item => {
1415
+ console.log(`${item.provider}/${item.model}: ${item.totalTokens} tokens`);
1416
+ });
1417
+
1418
+ // Filter by provider
1419
+ const openaiTokens = await client.usage.tokens({
1420
+ days: 30,
1421
+ provider: "openai"
1422
+ });
1423
+
1424
+ // Get daily token breakdown (for charts)
1425
+ const daily = await client.usage.dailyTokens({ days: 7 });
1426
+ daily.daily.forEach(day => {
1427
+ console.log(`${day.date}: ${day.totalTokens} tokens ($${day.estimatedCostUsd})`);
1428
+ });
1429
+ ```
1430
+
1042
1431
  ### Account - Profile & Preferences
1043
1432
 
1044
1433
  ```typescript
@@ -1208,6 +1597,8 @@ import type {
1208
1597
  ExtractOptions,
1209
1598
  DorkOptions,
1210
1599
  AgentOptions,
1600
+ VisionOptions, // NEW: Vision configuration
1601
+ VisionCaptureFrequency, // NEW: "every_step" | "on_demand" | "on_stuck"
1211
1602
  SchemaGenerationOptions,
1212
1603
 
1213
1604
  // Responses
@@ -1217,10 +1608,25 @@ import type {
1217
1608
  AgentJobResponse,
1218
1609
  AgentStatusResponse,
1219
1610
  AgentResultResponse,
1611
+ AgentMemoryStats, // NEW: Memory stats from agent sessions
1220
1612
  SchemaGenerationResponse,
1221
1613
  SearchJobResponse,
1222
1614
  BatchScrapeResponse,
1223
1615
 
1616
+ // Postprocessor Types (NEW)
1617
+ PostprocessorInfo,
1618
+ PostprocessorsListResponse,
1619
+ PostprocessorCheckResponse,
1620
+
1621
+ // Usage Types (NEW)
1622
+ CurrentUsageResponse,
1623
+ UsageHistoryResponse,
1624
+ TokenUsageResponse,
1625
+ DailyTokenUsageResponse,
1626
+ BillingPeriod,
1627
+ QuotaLimits,
1628
+ UsagePercentages,
1629
+
1224
1630
  // Action Types
1225
1631
  ActionInput,
1226
1632
  ClickAction,
@@ -1244,6 +1650,7 @@ import type {
1244
1650
  ExtractedDeal,
1245
1651
  Signal,
1246
1652
  ParsedPage, // Includes markdown field
1653
+ SiteSpecificData, // Postprocessor enrichment data
1247
1654
  } from "@dealcrawl/sdk";
1248
1655
  ```
1249
1656