@dealcrawl/sdk 2.1.1 → 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.
Files changed (85) hide show
  1. package/README.md +147 -14
  2. package/dist/index.d.mts +2769 -0
  3. package/dist/index.d.ts +2748 -37
  4. package/dist/index.js +2529 -64
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +2508 -0
  7. package/dist/index.mjs.map +1 -0
  8. package/package.json +14 -7
  9. package/dist/client.d.ts +0 -285
  10. package/dist/client.d.ts.map +0 -1
  11. package/dist/client.js +0 -336
  12. package/dist/client.js.map +0 -1
  13. package/dist/error.d.ts +0 -55
  14. package/dist/error.d.ts.map +0 -1
  15. package/dist/error.js +0 -128
  16. package/dist/error.js.map +0 -1
  17. package/dist/index.d.ts.map +0 -1
  18. package/dist/resources/account.d.ts +0 -143
  19. package/dist/resources/account.d.ts.map +0 -1
  20. package/dist/resources/account.js +0 -186
  21. package/dist/resources/account.js.map +0 -1
  22. package/dist/resources/crawl.d.ts +0 -101
  23. package/dist/resources/crawl.d.ts.map +0 -1
  24. package/dist/resources/crawl.js +0 -234
  25. package/dist/resources/crawl.js.map +0 -1
  26. package/dist/resources/data.d.ts +0 -157
  27. package/dist/resources/data.d.ts.map +0 -1
  28. package/dist/resources/data.js +0 -245
  29. package/dist/resources/data.js.map +0 -1
  30. package/dist/resources/dork.d.ts +0 -104
  31. package/dist/resources/dork.d.ts.map +0 -1
  32. package/dist/resources/dork.js +0 -163
  33. package/dist/resources/dork.js.map +0 -1
  34. package/dist/resources/extract.d.ts +0 -105
  35. package/dist/resources/extract.d.ts.map +0 -1
  36. package/dist/resources/extract.js +0 -246
  37. package/dist/resources/extract.js.map +0 -1
  38. package/dist/resources/index.d.ts +0 -14
  39. package/dist/resources/index.d.ts.map +0 -1
  40. package/dist/resources/index.js +0 -14
  41. package/dist/resources/index.js.map +0 -1
  42. package/dist/resources/keys.d.ts +0 -124
  43. package/dist/resources/keys.d.ts.map +0 -1
  44. package/dist/resources/keys.js +0 -168
  45. package/dist/resources/keys.js.map +0 -1
  46. package/dist/resources/scrape.d.ts +0 -53
  47. package/dist/resources/scrape.d.ts.map +0 -1
  48. package/dist/resources/scrape.js +0 -85
  49. package/dist/resources/scrape.js.map +0 -1
  50. package/dist/resources/status.d.ts +0 -100
  51. package/dist/resources/status.d.ts.map +0 -1
  52. package/dist/resources/status.js +0 -133
  53. package/dist/resources/status.js.map +0 -1
  54. package/dist/resources/webhooks.d.ts +0 -126
  55. package/dist/resources/webhooks.d.ts.map +0 -1
  56. package/dist/resources/webhooks.js +0 -167
  57. package/dist/resources/webhooks.js.map +0 -1
  58. package/dist/types/config.d.ts +0 -45
  59. package/dist/types/config.d.ts.map +0 -1
  60. package/dist/types/config.js +0 -10
  61. package/dist/types/config.js.map +0 -1
  62. package/dist/types/index.d.ts +0 -8
  63. package/dist/types/index.d.ts.map +0 -1
  64. package/dist/types/index.js +0 -8
  65. package/dist/types/index.js.map +0 -1
  66. package/dist/types/options.d.ts +0 -328
  67. package/dist/types/options.d.ts.map +0 -1
  68. package/dist/types/options.js +0 -6
  69. package/dist/types/options.js.map +0 -1
  70. package/dist/types/responses.d.ts +0 -422
  71. package/dist/types/responses.d.ts.map +0 -1
  72. package/dist/types/responses.js +0 -6
  73. package/dist/types/responses.js.map +0 -1
  74. package/dist/types/shared.d.ts +0 -234
  75. package/dist/types/shared.d.ts.map +0 -1
  76. package/dist/types/shared.js +0 -37
  77. package/dist/types/shared.js.map +0 -1
  78. package/dist/utils/polling.d.ts +0 -57
  79. package/dist/utils/polling.d.ts.map +0 -1
  80. package/dist/utils/polling.js +0 -110
  81. package/dist/utils/polling.js.map +0 -1
  82. package/dist/utils/request.d.ts +0 -47
  83. package/dist/utils/request.d.ts.map +0 -1
  84. package/dist/utils/request.js +0 -192
  85. package/dist/utils/request.js.map +0 -1
@@ -1,124 +0,0 @@
1
- /**
2
- * Keys Resource
3
- * Handles API key management operations
4
- */
5
- import type { RequestContext } from "../types/config";
6
- import type { CreateApiKeyOptions, RotateApiKeyOptions, ListApiKeysOptions, GetApiKeyStatsOptions } from "../types/options";
7
- import type { ListKeysResponse, CreateKeyResponse, ApiKeyInfo, RotateKeyResponse, DeleteKeyResponse, KeyStatsResponse } from "../types/responses";
8
- /**
9
- * Keys resource class
10
- * Provides methods for managing API keys
11
- */
12
- export declare class KeysResource {
13
- private ctx;
14
- constructor(ctx: RequestContext);
15
- /**
16
- * List all API keys
17
- *
18
- * @example
19
- * ```ts
20
- * const keys = await client.keys.list();
21
- * keys.keys.forEach(k => {
22
- * console.log(k.name, k.prefix, k.isActive);
23
- * });
24
- * ```
25
- */
26
- list(options?: ListApiKeysOptions): Promise<ListKeysResponse>;
27
- /**
28
- * Create a new API key
29
- *
30
- * @example
31
- * ```ts
32
- * const newKey = await client.keys.create({
33
- * name: "Production Key",
34
- * scopes: ["scrape", "crawl", "status", "data:read"],
35
- * expiresInDays: 365
36
- * });
37
- *
38
- * // IMPORTANT: Save this key immediately - it won't be shown again!
39
- * console.log(newKey.key);
40
- * ```
41
- */
42
- create(options: CreateApiKeyOptions): Promise<CreateKeyResponse>;
43
- /**
44
- * Get details of a specific key
45
- *
46
- * @example
47
- * ```ts
48
- * const key = await client.keys.get("key_abc123");
49
- * console.log(key.scopes);
50
- * console.log(key.lastUsedAt);
51
- * ```
52
- */
53
- get(keyId: string): Promise<ApiKeyInfo>;
54
- /**
55
- * Get usage statistics for a key
56
- *
57
- * @example
58
- * ```ts
59
- * const stats = await client.keys.getStats("key_abc123", { days: 30 });
60
- * console.log(stats.stats.totalRequests);
61
- * console.log(stats.stats.byEndpoint);
62
- * ```
63
- */
64
- getStats(keyId: string, options?: GetApiKeyStatsOptions): Promise<KeyStatsResponse>;
65
- /**
66
- * Rotate an API key (revoke old, create new)
67
- *
68
- * @example
69
- * ```ts
70
- * const rotated = await client.keys.rotate("key_abc123", {
71
- * newName: "Production Key v2"
72
- * });
73
- *
74
- * // Old key is now invalid
75
- * console.log(rotated.oldKeyRevoked); // true
76
- *
77
- * // Save new key immediately!
78
- * console.log(rotated.newKey.key);
79
- * ```
80
- */
81
- rotate(keyId: string, options?: RotateApiKeyOptions): Promise<RotateKeyResponse>;
82
- /**
83
- * Revoke (delete) an API key
84
- *
85
- * @example
86
- * ```ts
87
- * await client.keys.revoke("key_abc123");
88
- * ```
89
- */
90
- revoke(keyId: string): Promise<DeleteKeyResponse>;
91
- /**
92
- * Revoke all API keys (except the current one)
93
- *
94
- * @example
95
- * ```ts
96
- * // Use with caution!
97
- * const result = await client.keys.revokeAll();
98
- * console.log(`Revoked ${result.count} keys`);
99
- * ```
100
- */
101
- revokeAll(): Promise<{
102
- success: boolean;
103
- count: number;
104
- }>;
105
- /**
106
- * Get active keys only
107
- *
108
- * @example
109
- * ```ts
110
- * const activeKeys = await client.keys.getActive();
111
- * ```
112
- */
113
- getActive(): Promise<ApiKeyInfo[]>;
114
- /**
115
- * Check if a key is valid (active and not expired)
116
- *
117
- * @example
118
- * ```ts
119
- * const isValid = await client.keys.isValid("key_abc123");
120
- * ```
121
- */
122
- isValid(keyId: string): Promise<boolean>;
123
- }
124
- //# sourceMappingURL=keys.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/resources/keys.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,qBAAqB,EACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,UAAU,EACV,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAG5B;;;GAGG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,cAAc;IAEvC;;;;;;;;;;OAUG;IACG,IAAI,CAAC,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAOvE;;;;;;;;;;;;;;OAcG;IACG,MAAM,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAUtE;;;;;;;;;OASG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAK7C;;;;;;;;;OASG;IACG,QAAQ,CACZ,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,qBAA0B,GAClC,OAAO,CAAC,gBAAgB,CAAC;IAW5B;;;;;;;;;;;;;;;OAeG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,EACb,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,iBAAiB,CAAC;IAW7B;;;;;;;OAOG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAKvD;;;;;;;;;OASG;IACG,SAAS,IAAI,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAQ/D;;;;;;;OAOG;IACG,SAAS,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;IAKxC;;;;;;;OAOG;IACG,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;CAU/C"}
@@ -1,168 +0,0 @@
1
- /**
2
- * Keys Resource
3
- * Handles API key management operations
4
- */
5
- import { get, post, del } from "../utils/request";
6
- /**
7
- * Keys resource class
8
- * Provides methods for managing API keys
9
- */
10
- export class KeysResource {
11
- ctx;
12
- constructor(ctx) {
13
- this.ctx = ctx;
14
- }
15
- /**
16
- * List all API keys
17
- *
18
- * @example
19
- * ```ts
20
- * const keys = await client.keys.list();
21
- * keys.keys.forEach(k => {
22
- * console.log(k.name, k.prefix, k.isActive);
23
- * });
24
- * ```
25
- */
26
- async list(options = {}) {
27
- const result = await get(this.ctx, "/v1/keys", {
28
- includeRevoked: options.includeRevoked,
29
- });
30
- return result.data;
31
- }
32
- /**
33
- * Create a new API key
34
- *
35
- * @example
36
- * ```ts
37
- * const newKey = await client.keys.create({
38
- * name: "Production Key",
39
- * scopes: ["scrape", "crawl", "status", "data:read"],
40
- * expiresInDays: 365
41
- * });
42
- *
43
- * // IMPORTANT: Save this key immediately - it won't be shown again!
44
- * console.log(newKey.key);
45
- * ```
46
- */
47
- async create(options) {
48
- const result = await post(this.ctx, "/v1/keys", {
49
- name: options.name,
50
- scopes: options.scopes,
51
- expiresInDays: options.expiresInDays,
52
- ipAllowlist: options.ipAllowlist,
53
- });
54
- return result.data;
55
- }
56
- /**
57
- * Get details of a specific key
58
- *
59
- * @example
60
- * ```ts
61
- * const key = await client.keys.get("key_abc123");
62
- * console.log(key.scopes);
63
- * console.log(key.lastUsedAt);
64
- * ```
65
- */
66
- async get(keyId) {
67
- const result = await get(this.ctx, `/v1/keys/${keyId}`);
68
- return result.data;
69
- }
70
- /**
71
- * Get usage statistics for a key
72
- *
73
- * @example
74
- * ```ts
75
- * const stats = await client.keys.getStats("key_abc123", { days: 30 });
76
- * console.log(stats.stats.totalRequests);
77
- * console.log(stats.stats.byEndpoint);
78
- * ```
79
- */
80
- async getStats(keyId, options = {}) {
81
- const result = await get(this.ctx, `/v1/keys/${keyId}/stats`, {
82
- days: options.days,
83
- });
84
- return result.data;
85
- }
86
- /**
87
- * Rotate an API key (revoke old, create new)
88
- *
89
- * @example
90
- * ```ts
91
- * const rotated = await client.keys.rotate("key_abc123", {
92
- * newName: "Production Key v2"
93
- * });
94
- *
95
- * // Old key is now invalid
96
- * console.log(rotated.oldKeyRevoked); // true
97
- *
98
- * // Save new key immediately!
99
- * console.log(rotated.newKey.key);
100
- * ```
101
- */
102
- async rotate(keyId, options = {}) {
103
- const result = await post(this.ctx, `/v1/keys/${keyId}/rotate`, {
104
- newName: options.newName,
105
- });
106
- return result.data;
107
- }
108
- /**
109
- * Revoke (delete) an API key
110
- *
111
- * @example
112
- * ```ts
113
- * await client.keys.revoke("key_abc123");
114
- * ```
115
- */
116
- async revoke(keyId) {
117
- const result = await del(this.ctx, `/v1/keys/${keyId}`);
118
- return result.data;
119
- }
120
- /**
121
- * Revoke all API keys (except the current one)
122
- *
123
- * @example
124
- * ```ts
125
- * // Use with caution!
126
- * const result = await client.keys.revokeAll();
127
- * console.log(`Revoked ${result.count} keys`);
128
- * ```
129
- */
130
- async revokeAll() {
131
- const result = await del(this.ctx, "/v1/keys/all");
132
- return result.data;
133
- }
134
- /**
135
- * Get active keys only
136
- *
137
- * @example
138
- * ```ts
139
- * const activeKeys = await client.keys.getActive();
140
- * ```
141
- */
142
- async getActive() {
143
- const all = await this.list({ includeRevoked: false });
144
- return all.keys.filter((k) => k.isActive);
145
- }
146
- /**
147
- * Check if a key is valid (active and not expired)
148
- *
149
- * @example
150
- * ```ts
151
- * const isValid = await client.keys.isValid("key_abc123");
152
- * ```
153
- */
154
- async isValid(keyId) {
155
- try {
156
- const key = await this.get(keyId);
157
- if (!key.isActive)
158
- return false;
159
- if (key.expiresAt && new Date(key.expiresAt) < new Date())
160
- return false;
161
- return true;
162
- }
163
- catch {
164
- return false;
165
- }
166
- }
167
- }
168
- //# sourceMappingURL=keys.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/resources/keys.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiBH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,YAAY;IACH;IAApB,YAAoB,GAAmB;QAAnB,QAAG,GAAH,GAAG,CAAgB;IAAG,CAAC;IAE3C;;;;;;;;;;OAUG;IACH,KAAK,CAAC,IAAI,CAAC,UAA8B,EAAE;QACzC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAmB,IAAI,CAAC,GAAG,EAAE,UAAU,EAAE;YAC/D,cAAc,EAAE,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AAM,GAAG,MAAM,GAAG,CAAoB,IAAI,CAAC,GAAG,EAAE,YAAY,KAAK,EAAE,CAAC,CAAC;QAC3E,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;;;;;;OASG;IACH,KAAK,CAAC,SAAS;QACb,MAAM,MAAM,GAAG,MAAM,GAAG,CACtB,IAAI,CAAC,GAAG,EACR,cAAc,CACf,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,SAAS;QACb,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,EAAE,cAAc,EAAE,KAAK,EAAE,CAAC,CAAC;QACvD,OAAO,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,OAAO,CAAC,KAAa;QACzB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAClC,IAAI,CAAC,GAAG,CAAC,QAAQ;gBAAE,OAAO,KAAK,CAAC;YAChC,IAAI,GAAG,CAAC,SAAS,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,IAAI,IAAI,EAAE;gBAAE,OAAO,KAAK,CAAC;YACxE,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;CACF"}
@@ -1,53 +0,0 @@
1
- /**
2
- * Scrape Resource
3
- * Handles single page scraping operations
4
- */
5
- import type { RequestContext } from "../types/config";
6
- import type { ScrapeOptions } from "../types/options";
7
- import type { ScrapeJobResponse } from "../types/responses";
8
- /**
9
- * Scrape resource class
10
- * Provides methods for single page scraping
11
- */
12
- export declare class ScrapeResource {
13
- private ctx;
14
- constructor(ctx: RequestContext);
15
- /**
16
- * Create a new scrape job
17
- *
18
- * @example
19
- * ```ts
20
- * const job = await client.scrape.create({
21
- * url: "https://example.com/product",
22
- * extractDeal: true,
23
- * screenshot: { enabled: true, format: "webp" }
24
- * });
25
- * console.log(job.jobId);
26
- * ```
27
- */
28
- create(options: ScrapeOptions): Promise<ScrapeJobResponse>;
29
- /**
30
- * Scrape a URL with deal extraction enabled
31
- * Convenience method for common use case
32
- *
33
- * @example
34
- * ```ts
35
- * const job = await client.scrape.extractDeal("https://example.com/sale");
36
- * ```
37
- */
38
- extractDeal(url: string, options?: Omit<ScrapeOptions, "url" | "extractDeal">): Promise<ScrapeJobResponse>;
39
- /**
40
- * Scrape a URL with screenshot capture
41
- * Convenience method for screenshot capture
42
- *
43
- * @example
44
- * ```ts
45
- * const job = await client.scrape.withScreenshot("https://example.com", {
46
- * format: "webp",
47
- * fullPage: true
48
- * });
49
- * ```
50
- */
51
- withScreenshot(url: string, screenshotOptions?: Omit<ScrapeOptions["screenshot"], "enabled">, options?: Omit<ScrapeOptions, "url" | "screenshot">): Promise<ScrapeJobResponse>;
52
- }
53
- //# sourceMappingURL=scrape.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scrape.d.ts","sourceRoot":"","sources":["../../src/resources/scrape.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAG5D;;;GAGG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,cAAc;IAEvC;;;;;;;;;;;;OAYG;IACG,MAAM,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAoBhE;;;;;;;;OAQG;IACG,WAAW,CACf,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,aAAa,CAAC,GACnD,OAAO,CAAC,iBAAiB,CAAC;IAQ7B;;;;;;;;;;;OAWG;IACG,cAAc,CAClB,GAAG,EAAE,MAAM,EACX,iBAAiB,CAAC,EAAE,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC,EAChE,OAAO,CAAC,EAAE,IAAI,CAAC,aAAa,EAAE,KAAK,GAAG,YAAY,CAAC,GAClD,OAAO,CAAC,iBAAiB,CAAC;CAU9B"}
@@ -1,85 +0,0 @@
1
- /**
2
- * Scrape Resource
3
- * Handles single page scraping operations
4
- */
5
- import { post } from "../utils/request";
6
- /**
7
- * Scrape resource class
8
- * Provides methods for single page scraping
9
- */
10
- export class ScrapeResource {
11
- ctx;
12
- constructor(ctx) {
13
- this.ctx = ctx;
14
- }
15
- /**
16
- * Create a new scrape job
17
- *
18
- * @example
19
- * ```ts
20
- * const job = await client.scrape.create({
21
- * url: "https://example.com/product",
22
- * extractDeal: true,
23
- * screenshot: { enabled: true, format: "webp" }
24
- * });
25
- * console.log(job.jobId);
26
- * ```
27
- */
28
- async create(options) {
29
- const body = {
30
- url: options.url,
31
- detectSignals: options.detectSignals ?? true,
32
- extractWithAI: options.extractWithAI,
33
- extractDeal: options.extractDeal,
34
- useAdvancedModel: options.useAdvancedModel,
35
- minDealScore: options.minDealScore,
36
- screenshot: options.screenshot,
37
- excludeTags: options.excludeTags,
38
- excludeSelectors: options.excludeSelectors,
39
- onlyMainContent: options.onlyMainContent,
40
- headers: options.headers,
41
- timeout: options.timeout,
42
- };
43
- const result = await post(this.ctx, "/v1/scrape", body);
44
- return result.data;
45
- }
46
- /**
47
- * Scrape a URL with deal extraction enabled
48
- * Convenience method for common use case
49
- *
50
- * @example
51
- * ```ts
52
- * const job = await client.scrape.extractDeal("https://example.com/sale");
53
- * ```
54
- */
55
- async extractDeal(url, options) {
56
- return this.create({
57
- url,
58
- extractDeal: true,
59
- ...options,
60
- });
61
- }
62
- /**
63
- * Scrape a URL with screenshot capture
64
- * Convenience method for screenshot capture
65
- *
66
- * @example
67
- * ```ts
68
- * const job = await client.scrape.withScreenshot("https://example.com", {
69
- * format: "webp",
70
- * fullPage: true
71
- * });
72
- * ```
73
- */
74
- async withScreenshot(url, screenshotOptions, options) {
75
- return this.create({
76
- url,
77
- screenshot: {
78
- enabled: true,
79
- ...screenshotOptions,
80
- },
81
- ...options,
82
- });
83
- }
84
- }
85
- //# sourceMappingURL=scrape.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scrape.js","sourceRoot":"","sources":["../../src/resources/scrape.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAExC;;;GAGG;AACH,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,GAAmB;QAAnB,QAAG,GAAH,GAAG,CAAgB;IAAG,CAAC;IAE3C;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,MAAM,CAAC,OAAsB;QACjC,MAAM,IAAI,GAAG;YACX,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,aAAa,EAAE,OAAO,CAAC,aAAa,IAAI,IAAI;YAC5C,aAAa,EAAE,OAAO,CAAC,aAAa;YACpC,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;YAC1C,eAAe,EAAE,OAAO,CAAC,eAAe;YACxC,OAAO,EAAE,OAAO,CAAC,OAAO;YACxB,OAAO,EAAE,OAAO,CAAC,OAAO;SACzB,CAAC;QAEF,MAAM,MAAM,GAAG,MAAM,IAAI,CAAoB,IAAI,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;QAC3E,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,WAAW,CACf,GAAW,EACX,OAAoD;QAEpD,OAAO,IAAI,CAAC,MAAM,CAAC;YACjB,GAAG;YACH,WAAW,EAAE,IAAI;YACjB,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,cAAc,CAClB,GAAW,EACX,iBAAgE,EAChE,OAAmD;QAEnD,OAAO,IAAI,CAAC,MAAM,CAAC;YACjB,GAAG;YACH,UAAU,EAAE;gBACV,OAAO,EAAE,IAAI;gBACb,GAAG,iBAAiB;aACrB;YACD,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,100 +0,0 @@
1
- /**
2
- * Status Resource
3
- * Handles job status checking and management
4
- */
5
- import type { RequestContext } from "../types/config";
6
- import type { GetDealsOptions } from "../types/options";
7
- import type { JobStatusResponse, JobDealsResponse, ResumeJobResponse, JobMetricsResponse, CancelJobResponse } from "../types/responses";
8
- /**
9
- * Status resource class
10
- * Provides methods for checking and managing job status
11
- */
12
- export declare class StatusResource {
13
- private ctx;
14
- constructor(ctx: RequestContext);
15
- /**
16
- * Get the status of a job
17
- *
18
- * @example
19
- * ```ts
20
- * const status = await client.status.get("job_abc123");
21
- * console.log(status.status); // "completed"
22
- * console.log(status.result);
23
- * ```
24
- */
25
- get(jobId: string): Promise<JobStatusResponse>;
26
- /**
27
- * Get deals found by a job
28
- *
29
- * @example
30
- * ```ts
31
- * const deals = await client.status.getDeals("job_abc123", {
32
- * minScore: 70,
33
- * limit: 20
34
- * });
35
- * console.log(deals.deals);
36
- * ```
37
- */
38
- getDeals(jobId: string, options?: GetDealsOptions): Promise<JobDealsResponse>;
39
- /**
40
- * Resume a paused or failed job from checkpoint
41
- *
42
- * @example
43
- * ```ts
44
- * const resumed = await client.status.resume("job_abc123");
45
- * console.log(resumed.newJobId);
46
- * ```
47
- */
48
- resume(jobId: string): Promise<ResumeJobResponse>;
49
- /**
50
- * Get detailed metrics for a job
51
- *
52
- * @example
53
- * ```ts
54
- * const metrics = await client.status.getMetrics("job_abc123");
55
- * console.log(metrics.metrics.successRate);
56
- * ```
57
- */
58
- getMetrics(jobId: string): Promise<JobMetricsResponse>;
59
- /**
60
- * Cancel a pending or active job
61
- *
62
- * @example
63
- * ```ts
64
- * const cancelled = await client.status.cancel("job_abc123");
65
- * console.log(cancelled.success);
66
- * ```
67
- */
68
- cancel(jobId: string): Promise<CancelJobResponse>;
69
- /**
70
- * Check if a job is complete
71
- * Convenience method for polling
72
- *
73
- * @example
74
- * ```ts
75
- * const isComplete = await client.status.isComplete("job_abc123");
76
- * ```
77
- */
78
- isComplete(jobId: string): Promise<boolean>;
79
- /**
80
- * Check if a job succeeded
81
- * Convenience method for result checking
82
- *
83
- * @example
84
- * ```ts
85
- * const succeeded = await client.status.succeeded("job_abc123");
86
- * ```
87
- */
88
- succeeded(jobId: string): Promise<boolean>;
89
- /**
90
- * Get the result of a completed job
91
- * Throws if job is not complete
92
- *
93
- * @example
94
- * ```ts
95
- * const result = await client.status.getResult("job_abc123");
96
- * ```
97
- */
98
- getResult<T = unknown>(jobId: string): Promise<T>;
99
- }
100
- //# sourceMappingURL=status.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/resources/status.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EAClB,MAAM,oBAAoB,CAAC;AAG5B;;;GAGG;AACH,qBAAa,cAAc;IACb,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,cAAc;IAEvC;;;;;;;;;OASG;IACG,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQpD;;;;;;;;;;;OAWG;IACG,QAAQ,CACZ,KAAK,EAAE,MAAM,EACb,OAAO,CAAC,EAAE,eAAe,GACxB,OAAO,CAAC,gBAAgB,CAAC;IAY5B;;;;;;;;OAQG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQvD;;;;;;;;OAQG;IACG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAQ5D;;;;;;;;OAQG;IACG,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAQvD;;;;;;;;OAQG;IACG,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKjD;;;;;;;;OAQG;IACG,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAKhD;;;;;;;;OAQG;IACG,SAAS,CAAC,CAAC,GAAG,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;CAaxD"}
@@ -1,133 +0,0 @@
1
- /**
2
- * Status Resource
3
- * Handles job status checking and management
4
- */
5
- import { get, post, del } from "../utils/request";
6
- /**
7
- * Status resource class
8
- * Provides methods for checking and managing job status
9
- */
10
- export class StatusResource {
11
- ctx;
12
- constructor(ctx) {
13
- this.ctx = ctx;
14
- }
15
- /**
16
- * Get the status of a job
17
- *
18
- * @example
19
- * ```ts
20
- * const status = await client.status.get("job_abc123");
21
- * console.log(status.status); // "completed"
22
- * console.log(status.result);
23
- * ```
24
- */
25
- async get(jobId) {
26
- const result = await get(this.ctx, `/v1/status/${jobId}`);
27
- return result.data;
28
- }
29
- /**
30
- * Get deals found by a job
31
- *
32
- * @example
33
- * ```ts
34
- * const deals = await client.status.getDeals("job_abc123", {
35
- * minScore: 70,
36
- * limit: 20
37
- * });
38
- * console.log(deals.deals);
39
- * ```
40
- */
41
- async getDeals(jobId, options) {
42
- const result = await get(this.ctx, `/v1/status/${jobId}/deals`, {
43
- minScore: options?.minScore,
44
- limit: options?.limit,
45
- });
46
- return result.data;
47
- }
48
- /**
49
- * Resume a paused or failed job from checkpoint
50
- *
51
- * @example
52
- * ```ts
53
- * const resumed = await client.status.resume("job_abc123");
54
- * console.log(resumed.newJobId);
55
- * ```
56
- */
57
- async resume(jobId) {
58
- const result = await post(this.ctx, `/v1/status/${jobId}/resume`);
59
- return result.data;
60
- }
61
- /**
62
- * Get detailed metrics for a job
63
- *
64
- * @example
65
- * ```ts
66
- * const metrics = await client.status.getMetrics("job_abc123");
67
- * console.log(metrics.metrics.successRate);
68
- * ```
69
- */
70
- async getMetrics(jobId) {
71
- const result = await get(this.ctx, `/v1/status/${jobId}/metrics`);
72
- return result.data;
73
- }
74
- /**
75
- * Cancel a pending or active job
76
- *
77
- * @example
78
- * ```ts
79
- * const cancelled = await client.status.cancel("job_abc123");
80
- * console.log(cancelled.success);
81
- * ```
82
- */
83
- async cancel(jobId) {
84
- const result = await del(this.ctx, `/v1/status/${jobId}`);
85
- return result.data;
86
- }
87
- /**
88
- * Check if a job is complete
89
- * Convenience method for polling
90
- *
91
- * @example
92
- * ```ts
93
- * const isComplete = await client.status.isComplete("job_abc123");
94
- * ```
95
- */
96
- async isComplete(jobId) {
97
- const status = await this.get(jobId);
98
- return status.status === "completed" || status.status === "failed";
99
- }
100
- /**
101
- * Check if a job succeeded
102
- * Convenience method for result checking
103
- *
104
- * @example
105
- * ```ts
106
- * const succeeded = await client.status.succeeded("job_abc123");
107
- * ```
108
- */
109
- async succeeded(jobId) {
110
- const status = await this.get(jobId);
111
- return status.status === "completed";
112
- }
113
- /**
114
- * Get the result of a completed job
115
- * Throws if job is not complete
116
- *
117
- * @example
118
- * ```ts
119
- * const result = await client.status.getResult("job_abc123");
120
- * ```
121
- */
122
- async getResult(jobId) {
123
- const status = await this.get(jobId);
124
- if (status.status === "failed") {
125
- throw new Error(`Job failed: ${status.error || "Unknown error"}`);
126
- }
127
- if (status.status !== "completed") {
128
- throw new Error(`Job not complete. Status: ${status.status}`);
129
- }
130
- return status.result;
131
- }
132
- }
133
- //# sourceMappingURL=status.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/resources/status.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;GAGG;AACH,MAAM,OAAO,cAAc;IACL;IAApB,YAAoB,GAAmB;QAAnB,QAAG,GAAH,GAAG,CAAgB;IAAG,CAAC;IAE3C;;;;;;;;;OASG;IACH,KAAK,CAAC,GAAG,CAAC,KAAa;QACrB,MAAM,MAAM,GAAG,MAAM,GAAG,CACtB,IAAI,CAAC,GAAG,EACR,cAAc,KAAK,EAAE,CACtB,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,QAAQ,CACZ,KAAa,EACb,OAAyB;QAEzB,MAAM,MAAM,GAAG,MAAM,GAAG,CACtB,IAAI,CAAC,GAAG,EACR,cAAc,KAAK,QAAQ,EAC3B;YACE,QAAQ,EAAE,OAAO,EAAE,QAAQ;YAC3B,KAAK,EAAE,OAAO,EAAE,KAAK;SACtB,CACF,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,MAAM,CAAC,KAAa;QACxB,MAAM,MAAM,GAAG,MAAM,IAAI,CACvB,IAAI,CAAC,GAAG,EACR,cAAc,KAAK,SAAS,CAC7B,CAAC;QACF,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,UAA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