@dealcrawl/sdk 2.1.1 → 2.1.3

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 (84) hide show
  1. package/dist/index.d.mts +2335 -0
  2. package/dist/index.d.ts +2314 -37
  3. package/dist/index.js +2280 -64
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +2260 -0
  6. package/dist/index.mjs.map +1 -0
  7. package/package.json +14 -7
  8. package/dist/client.d.ts +0 -285
  9. package/dist/client.d.ts.map +0 -1
  10. package/dist/client.js +0 -336
  11. package/dist/client.js.map +0 -1
  12. package/dist/error.d.ts +0 -55
  13. package/dist/error.d.ts.map +0 -1
  14. package/dist/error.js +0 -128
  15. package/dist/error.js.map +0 -1
  16. package/dist/index.d.ts.map +0 -1
  17. package/dist/resources/account.d.ts +0 -143
  18. package/dist/resources/account.d.ts.map +0 -1
  19. package/dist/resources/account.js +0 -186
  20. package/dist/resources/account.js.map +0 -1
  21. package/dist/resources/crawl.d.ts +0 -101
  22. package/dist/resources/crawl.d.ts.map +0 -1
  23. package/dist/resources/crawl.js +0 -234
  24. package/dist/resources/crawl.js.map +0 -1
  25. package/dist/resources/data.d.ts +0 -157
  26. package/dist/resources/data.d.ts.map +0 -1
  27. package/dist/resources/data.js +0 -245
  28. package/dist/resources/data.js.map +0 -1
  29. package/dist/resources/dork.d.ts +0 -104
  30. package/dist/resources/dork.d.ts.map +0 -1
  31. package/dist/resources/dork.js +0 -163
  32. package/dist/resources/dork.js.map +0 -1
  33. package/dist/resources/extract.d.ts +0 -105
  34. package/dist/resources/extract.d.ts.map +0 -1
  35. package/dist/resources/extract.js +0 -246
  36. package/dist/resources/extract.js.map +0 -1
  37. package/dist/resources/index.d.ts +0 -14
  38. package/dist/resources/index.d.ts.map +0 -1
  39. package/dist/resources/index.js +0 -14
  40. package/dist/resources/index.js.map +0 -1
  41. package/dist/resources/keys.d.ts +0 -124
  42. package/dist/resources/keys.d.ts.map +0 -1
  43. package/dist/resources/keys.js +0 -168
  44. package/dist/resources/keys.js.map +0 -1
  45. package/dist/resources/scrape.d.ts +0 -53
  46. package/dist/resources/scrape.d.ts.map +0 -1
  47. package/dist/resources/scrape.js +0 -85
  48. package/dist/resources/scrape.js.map +0 -1
  49. package/dist/resources/status.d.ts +0 -100
  50. package/dist/resources/status.d.ts.map +0 -1
  51. package/dist/resources/status.js +0 -133
  52. package/dist/resources/status.js.map +0 -1
  53. package/dist/resources/webhooks.d.ts +0 -126
  54. package/dist/resources/webhooks.d.ts.map +0 -1
  55. package/dist/resources/webhooks.js +0 -167
  56. package/dist/resources/webhooks.js.map +0 -1
  57. package/dist/types/config.d.ts +0 -45
  58. package/dist/types/config.d.ts.map +0 -1
  59. package/dist/types/config.js +0 -10
  60. package/dist/types/config.js.map +0 -1
  61. package/dist/types/index.d.ts +0 -8
  62. package/dist/types/index.d.ts.map +0 -1
  63. package/dist/types/index.js +0 -8
  64. package/dist/types/index.js.map +0 -1
  65. package/dist/types/options.d.ts +0 -328
  66. package/dist/types/options.d.ts.map +0 -1
  67. package/dist/types/options.js +0 -6
  68. package/dist/types/options.js.map +0 -1
  69. package/dist/types/responses.d.ts +0 -422
  70. package/dist/types/responses.d.ts.map +0 -1
  71. package/dist/types/responses.js +0 -6
  72. package/dist/types/responses.js.map +0 -1
  73. package/dist/types/shared.d.ts +0 -234
  74. package/dist/types/shared.d.ts.map +0 -1
  75. package/dist/types/shared.js +0 -37
  76. package/dist/types/shared.js.map +0 -1
  77. package/dist/utils/polling.d.ts +0 -57
  78. package/dist/utils/polling.d.ts.map +0 -1
  79. package/dist/utils/polling.js +0 -110
  80. package/dist/utils/polling.js.map +0 -1
  81. package/dist/utils/request.d.ts +0 -47
  82. package/dist/utils/request.d.ts.map +0 -1
  83. package/dist/utils/request.js +0 -192
  84. package/dist/utils/request.js.map +0 -1
@@ -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;A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AAiB;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,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AI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,MAAM,CAAC,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC;IACrE,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,SAAS,CAAC,KAAa;QAC3B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACrC,OAAO,MAAM,CAAC,MAAM,KAAK,WAAW,CAAC;IACvC,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,SAAS,CAAc,KAAa;QACxC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAErC,IAAI,MAAM,CAAC,MAAM,KAAK,QAAQ,EAAE,CAAC;YAC/B,MAAM,IAAI,KAAK,CAAC,eAAe,MAAM,CAAC,KAAK,IAAI,eAAe,EAAE,CAAC,CAAC;QACpE,CAAC;QAED,IAAI,MAAM,CAAC,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CAAC,6BAA6B,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;QAChE,CAAC;QAED,OAAO,MAAM,CAAC,MAAW,CAAC;IAC5B,CAAC;CACF"}
@@ -1,126 +0,0 @@
1
- /**
2
- * Webhooks Resource
3
- * Handles webhook CRUD operations
4
- */
5
- import type { RequestContext } from "../types/config";
6
- import type { CreateWebhookOptions, UpdateWebhookOptions } from "../types/options";
7
- import type { CreateWebhookResponse, ListWebhooksResponse, WebhookItem, UpdateWebhookResponse, DeleteWebhookResponse, TestWebhookResponse } from "../types/responses";
8
- /**
9
- * Webhooks resource class
10
- * Provides methods for managing webhooks
11
- */
12
- export declare class WebhooksResource {
13
- private ctx;
14
- constructor(ctx: RequestContext);
15
- /**
16
- * Create a new webhook
17
- *
18
- * @example
19
- * ```ts
20
- * const webhook = await client.webhooks.create({
21
- * event: "deal.found",
22
- * url: "https://my-server.com/webhooks/deals",
23
- * secret: "my-webhook-secret",
24
- * minDealScore: 70
25
- * });
26
- * console.log(webhook.webhookId);
27
- * ```
28
- */
29
- create(options: CreateWebhookOptions): Promise<CreateWebhookResponse>;
30
- /**
31
- * List all webhooks
32
- *
33
- * @example
34
- * ```ts
35
- * const webhooks = await client.webhooks.list();
36
- * webhooks.webhooks.forEach(w => {
37
- * console.log(w.event, w.url, w.active);
38
- * });
39
- * ```
40
- */
41
- list(): Promise<ListWebhooksResponse>;
42
- /**
43
- * Get a webhook by ID
44
- *
45
- * @example
46
- * ```ts
47
- * const webhook = await client.webhooks.get("webhook_abc123");
48
- * console.log(webhook.event);
49
- * ```
50
- */
51
- get(webhookId: string): Promise<WebhookItem>;
52
- /**
53
- * Update a webhook
54
- *
55
- * @example
56
- * ```ts
57
- * const updated = await client.webhooks.update("webhook_abc123", {
58
- * minDealScore: 80,
59
- * active: false
60
- * });
61
- * ```
62
- */
63
- update(webhookId: string, options: UpdateWebhookOptions): Promise<UpdateWebhookResponse>;
64
- /**
65
- * Delete a webhook
66
- *
67
- * @example
68
- * ```ts
69
- * await client.webhooks.delete("webhook_abc123");
70
- * ```
71
- */
72
- delete(webhookId: string): Promise<DeleteWebhookResponse>;
73
- /**
74
- * Test a webhook by sending a test payload
75
- *
76
- * @example
77
- * ```ts
78
- * const result = await client.webhooks.test("webhook_abc123");
79
- * if (result.delivered) {
80
- * console.log(`Delivered in ${result.responseTime}ms`);
81
- * } else {
82
- * console.log(`Failed: ${result.error}`);
83
- * }
84
- * ```
85
- */
86
- test(webhookId: string): Promise<TestWebhookResponse>;
87
- /**
88
- * Enable a webhook
89
- * Convenience method for activating a webhook
90
- *
91
- * @example
92
- * ```ts
93
- * await client.webhooks.enable("webhook_abc123");
94
- * ```
95
- */
96
- enable(webhookId: string): Promise<UpdateWebhookResponse>;
97
- /**
98
- * Disable a webhook
99
- * Convenience method for deactivating a webhook
100
- *
101
- * @example
102
- * ```ts
103
- * await client.webhooks.disable("webhook_abc123");
104
- * ```
105
- */
106
- disable(webhookId: string): Promise<UpdateWebhookResponse>;
107
- /**
108
- * Get active webhooks only
109
- *
110
- * @example
111
- * ```ts
112
- * const active = await client.webhooks.getActive();
113
- * ```
114
- */
115
- getActive(): Promise<WebhookItem[]>;
116
- /**
117
- * Get webhooks by event type
118
- *
119
- * @example
120
- * ```ts
121
- * const dealWebhooks = await client.webhooks.getByEvent("deal.found");
122
- * ```
123
- */
124
- getByEvent(event: CreateWebhookOptions["event"]): Promise<WebhookItem[]>;
125
- }
126
- //# sourceMappingURL=webhooks.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EACV,oBAAoB,EACpB,oBAAoB,EACrB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,WAAW,EACX,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAG5B;;;GAGG;AACH,qBAAa,gBAAgB;IACf,OAAO,CAAC,GAAG;gBAAH,GAAG,EAAE,cAAc;IAEvC;;;;;;;;;;;;;OAaG;IACG,MAAM,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAY3E;;;;;;;;;;OAUG;IACG,IAAI,IAAI,OAAO,CAAC,oBAAoB,CAAC;IAK3C;;;;;;;;OAQG;IACG,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAQlD;;;;;;;;;;OAUG;IACG,MAAM,CACV,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAejC;;;;;;;OAOG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAQ/D;;;;;;;;;;;;OAYG;IACG,IAAI,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAQ3D;;;;;;;;OAQG;IACG,MAAM,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI/D;;;;;;;;OAQG;IACG,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIhE;;;;;;;OAOG;IACG,SAAS,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAKzC;;;;;;;OAOG;IACG,UAAU,CACd,KAAK,EAAE,oBAAoB,CAAC,OAAO,CAAC,GACnC,OAAO,CAAC,WAAW,EAAE,CAAC;CAI1B"}
@@ -1,167 +0,0 @@
1
- /**
2
- * Webhooks Resource
3
- * Handles webhook CRUD operations
4
- */
5
- import { get, post, patch, del } from "../utils/request";
6
- /**
7
- * Webhooks resource class
8
- * Provides methods for managing webhooks
9
- */
10
- export class WebhooksResource {
11
- ctx;
12
- constructor(ctx) {
13
- this.ctx = ctx;
14
- }
15
- /**
16
- * Create a new webhook
17
- *
18
- * @example
19
- * ```ts
20
- * const webhook = await client.webhooks.create({
21
- * event: "deal.found",
22
- * url: "https://my-server.com/webhooks/deals",
23
- * secret: "my-webhook-secret",
24
- * minDealScore: 70
25
- * });
26
- * console.log(webhook.webhookId);
27
- * ```
28
- */
29
- async create(options) {
30
- const result = await post(this.ctx, "/v1/webhooks", {
31
- event: options.event,
32
- url: options.url,
33
- secret: options.secret,
34
- minDealScore: options.minDealScore,
35
- categories: options.categories,
36
- active: options.active,
37
- });
38
- return result.data;
39
- }
40
- /**
41
- * List all webhooks
42
- *
43
- * @example
44
- * ```ts
45
- * const webhooks = await client.webhooks.list();
46
- * webhooks.webhooks.forEach(w => {
47
- * console.log(w.event, w.url, w.active);
48
- * });
49
- * ```
50
- */
51
- async list() {
52
- const result = await get(this.ctx, "/v1/webhooks");
53
- return result.data;
54
- }
55
- /**
56
- * Get a webhook by ID
57
- *
58
- * @example
59
- * ```ts
60
- * const webhook = await client.webhooks.get("webhook_abc123");
61
- * console.log(webhook.event);
62
- * ```
63
- */
64
- async get(webhookId) {
65
- const result = await get(this.ctx, `/v1/webhooks/${webhookId}`);
66
- return result.data;
67
- }
68
- /**
69
- * Update a webhook
70
- *
71
- * @example
72
- * ```ts
73
- * const updated = await client.webhooks.update("webhook_abc123", {
74
- * minDealScore: 80,
75
- * active: false
76
- * });
77
- * ```
78
- */
79
- async update(webhookId, options) {
80
- const result = await patch(this.ctx, `/v1/webhooks/${webhookId}`, {
81
- url: options.url,
82
- secret: options.secret,
83
- minDealScore: options.minDealScore,
84
- categories: options.categories,
85
- active: options.active,
86
- });
87
- return result.data;
88
- }
89
- /**
90
- * Delete a webhook
91
- *
92
- * @example
93
- * ```ts
94
- * await client.webhooks.delete("webhook_abc123");
95
- * ```
96
- */
97
- async delete(webhookId) {
98
- const result = await del(this.ctx, `/v1/webhooks/${webhookId}`);
99
- return result.data;
100
- }
101
- /**
102
- * Test a webhook by sending a test payload
103
- *
104
- * @example
105
- * ```ts
106
- * const result = await client.webhooks.test("webhook_abc123");
107
- * if (result.delivered) {
108
- * console.log(`Delivered in ${result.responseTime}ms`);
109
- * } else {
110
- * console.log(`Failed: ${result.error}`);
111
- * }
112
- * ```
113
- */
114
- async test(webhookId) {
115
- const result = await post(this.ctx, `/v1/webhooks/${webhookId}/test`);
116
- return result.data;
117
- }
118
- /**
119
- * Enable a webhook
120
- * Convenience method for activating a webhook
121
- *
122
- * @example
123
- * ```ts
124
- * await client.webhooks.enable("webhook_abc123");
125
- * ```
126
- */
127
- async enable(webhookId) {
128
- return this.update(webhookId, { active: true });
129
- }
130
- /**
131
- * Disable a webhook
132
- * Convenience method for deactivating a webhook
133
- *
134
- * @example
135
- * ```ts
136
- * await client.webhooks.disable("webhook_abc123");
137
- * ```
138
- */
139
- async disable(webhookId) {
140
- return this.update(webhookId, { active: false });
141
- }
142
- /**
143
- * Get active webhooks only
144
- *
145
- * @example
146
- * ```ts
147
- * const active = await client.webhooks.getActive();
148
- * ```
149
- */
150
- async getActive() {
151
- const all = await this.list();
152
- return all.webhooks.filter((w) => w.active);
153
- }
154
- /**
155
- * Get webhooks by event type
156
- *
157
- * @example
158
- * ```ts
159
- * const dealWebhooks = await client.webhooks.getByEvent("deal.found");
160
- * ```
161
- */
162
- async getByEvent(event) {
163
- const all = await this.list();
164
- return all.webhooks.filter((w) => w.event === event);
165
- }
166
- }
167
- //# sourceMappingURL=webhooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webhooks.js","sourceRoot":"","sources":["../../src/resources/webhooks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAeH,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEzD;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IACP;IAApB,YAAoB,GAAmB;QAAnB,QAAG,GAAH,GAAG,CAAgB;IAAG,CAAC;IAE3C;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,MAAM,CAAC,OAA6B;QACxC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAwB,IAAI,CAAC,GAAG,EAAE,cAAc,EAAE;YACzE,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;QACH,OAAO,MAAM,CAAC,IAAI,CAAC;IACrB,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,MAAM,GAAG,MAAM,GAAG,CAAuB,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;QACzE,OAA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IACH,KAAK,CAAC,OAAO,CAAC,SAAiB;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,SAAS;QACb,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9B,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,UAAU,CACd,KAAoC;QAEpC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QAC9B,OAAO,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IACvD,CAAC;CACF"}
@@ -1,45 +0,0 @@
1
- import type { RateLimitInfo } from "./shared";
2
- /**
3
- * SDK Configuration options
4
- */
5
- export interface DealCrawlConfig {
6
- /** API key for authentication (required) */
7
- apiKey: string;
8
- /** Base URL for the API (default: https://api.dealcrawl.dev) */
9
- baseUrl?: string;
10
- /** Default timeout for requests in milliseconds (default: 30000) */
11
- timeout?: number;
12
- /** Maximum number of retries for failed requests (default: 3) */
13
- maxRetries?: number;
14
- /** Delay between retries in milliseconds (default: 1000) */
15
- retryDelay?: number;
16
- /** Callback when rate limit is hit */
17
- onRateLimit?: (info: RateLimitInfo) => void;
18
- }
19
- /**
20
- * Internal request context passed to resources
21
- */
22
- export interface RequestContext {
23
- /** Base URL for API requests */
24
- baseUrl: string;
25
- /** API key for authentication */
26
- apiKey: string;
27
- /** Default timeout in milliseconds */
28
- timeout: number;
29
- /** Maximum number of retries */
30
- maxRetries: number;
31
- /** Delay between retries in milliseconds */
32
- retryDelay: number;
33
- /** Rate limit callback */
34
- onRateLimit?: (info: RateLimitInfo) => void;
35
- }
36
- /**
37
- * Default configuration values
38
- */
39
- export declare const DEFAULT_CONFIG: {
40
- readonly baseUrl: "https://api.dealcrawl.dev";
41
- readonly timeout: 30000;
42
- readonly maxRetries: 3;
43
- readonly retryDelay: 1000;
44
- };
45
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,4CAA4C;IAC5C,MAAM,EAAE,MAAM,CAAC;IAEf,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,oEAAoE;IACpE,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,iEAAiE;IACjE,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,sCAAsC;IACtC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;CAC7C;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAEhB,iCAAiC;IACjC,MAAM,EAAE,MAAM,CAAC;IAEf,sCAAsC;IACtC,OAAO,EAAE,MAAM,CAAC;IAEhB,gCAAgC;IAChC,UAAU,EAAE,MAAM,CAAC;IAEnB,4CAA4C;IAC5C,UAAU,EAAE,MAAM,CAAC;IAEnB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;CAC7C;AAED;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;CAKjB,CAAC"}