@dealcrawl/sdk 2.11.0 → 2.11.1
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 +23 -0
- package/dist/index.d.mts +32 -27
- package/dist/index.d.ts +32 -27
- package/dist/index.js +40 -46
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +40 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1169,9 +1169,9 @@ var AuthResource = class {
|
|
|
1169
1169
|
* and how many are currently active.
|
|
1170
1170
|
*
|
|
1171
1171
|
* Tier limits:
|
|
1172
|
-
* - Free:
|
|
1173
|
-
* - Pro:
|
|
1174
|
-
* - Enterprise:
|
|
1172
|
+
* - Free: 10 concurrent connections
|
|
1173
|
+
* - Pro: 50 concurrent connections
|
|
1174
|
+
* - Enterprise: 200 concurrent connections
|
|
1175
1175
|
*
|
|
1176
1176
|
* @example
|
|
1177
1177
|
* ```ts
|
|
@@ -1529,12 +1529,10 @@ var CrawlResource = class {
|
|
|
1529
1529
|
* ```
|
|
1530
1530
|
*/
|
|
1531
1531
|
async analyze(url) {
|
|
1532
|
-
const result = await
|
|
1532
|
+
const result = await post(
|
|
1533
1533
|
this.ctx,
|
|
1534
1534
|
"/v1/crawl/analyze",
|
|
1535
|
-
{
|
|
1536
|
-
url
|
|
1537
|
-
}
|
|
1535
|
+
{ url }
|
|
1538
1536
|
);
|
|
1539
1537
|
return result.data;
|
|
1540
1538
|
}
|
|
@@ -1700,31 +1698,28 @@ var DataResource = class {
|
|
|
1700
1698
|
});
|
|
1701
1699
|
}
|
|
1702
1700
|
/**
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
)
|
|
1713
|
-
|
|
1714
|
-
throw new Error("category is required and cannot be empty");
|
|
1715
|
-
}
|
|
1716
|
-
return this.listDeals({ category, ...options });
|
|
1717
|
-
} return this.listDeals({ category, ...options });
|
|
1701
|
+
* Get deals by category
|
|
1702
|
+
* Convenience method for filtering by category
|
|
1703
|
+
*
|
|
1704
|
+
* @example
|
|
1705
|
+
* ```ts
|
|
1706
|
+
* const electronicsDeals = await client.data.getDealsByCategory("electronics");
|
|
1707
|
+
* ```
|
|
1708
|
+
*/
|
|
1709
|
+
async getDealsByCategory(category, options) {
|
|
1710
|
+
if (!category || !category.trim()) {
|
|
1711
|
+
throw new Error("category is required and cannot be empty");
|
|
1718
1712
|
}
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1713
|
+
return this.listDeals({ category, ...options });
|
|
1714
|
+
}
|
|
1715
|
+
/**
|
|
1716
|
+
* Get unsynced deals (not yet sent to DealUp)
|
|
1717
|
+
*
|
|
1718
|
+
* @example
|
|
1719
|
+
* ```ts
|
|
1720
|
+
* const unsyncedDeals = await client.data.getUnsyncedDeals();
|
|
1721
|
+
* ```
|
|
1722
|
+
*/
|
|
1728
1723
|
async getUnsyncedDeals(options) {
|
|
1729
1724
|
return this.listDeals({ synced: false, ...options });
|
|
1730
1725
|
}
|
|
@@ -1780,9 +1775,11 @@ var DataResource = class {
|
|
|
1780
1775
|
{
|
|
1781
1776
|
format: options.format || "json",
|
|
1782
1777
|
minScore: options.minScore,
|
|
1783
|
-
maxPrice: options.maxPrice,
|
|
1784
1778
|
category: options.category,
|
|
1785
|
-
|
|
1779
|
+
synced: options.synced?.toString(),
|
|
1780
|
+
fromDate: options.fromDate,
|
|
1781
|
+
toDate: options.toDate,
|
|
1782
|
+
limit: options.limit
|
|
1786
1783
|
}
|
|
1787
1784
|
);
|
|
1788
1785
|
return result.data;
|
|
@@ -1827,8 +1824,8 @@ var DorkResource = class {
|
|
|
1827
1824
|
async create(options) {
|
|
1828
1825
|
const body = {
|
|
1829
1826
|
query: this.buildQuery(options),
|
|
1830
|
-
|
|
1831
|
-
|
|
1827
|
+
site: options.site,
|
|
1828
|
+
maxResults: options.maxResults
|
|
1832
1829
|
};
|
|
1833
1830
|
const result = await post(this.ctx, "/v1/dork", body);
|
|
1834
1831
|
return result.data;
|
|
@@ -1943,9 +1940,6 @@ var DorkResource = class {
|
|
|
1943
1940
|
if (typeof options.query === "string" && options.query.trim() !== "") {
|
|
1944
1941
|
parts.push(options.query);
|
|
1945
1942
|
}
|
|
1946
|
-
if (options.site) {
|
|
1947
|
-
parts.push(`site:${options.site}`);
|
|
1948
|
-
}
|
|
1949
1943
|
if (options.fileType) {
|
|
1950
1944
|
parts.push(`filetype:${options.fileType}`);
|
|
1951
1945
|
}
|
|
@@ -2570,10 +2564,7 @@ var KeysResource = class {
|
|
|
2570
2564
|
* ```
|
|
2571
2565
|
*/
|
|
2572
2566
|
async revokeAll() {
|
|
2573
|
-
const result = await
|
|
2574
|
-
this.ctx,
|
|
2575
|
-
"/v1/keys/all"
|
|
2576
|
-
);
|
|
2567
|
+
const result = await post(this.ctx, "/v1/keys/revoke-all");
|
|
2577
2568
|
return result.data;
|
|
2578
2569
|
}
|
|
2579
2570
|
/**
|
|
@@ -3102,7 +3093,9 @@ var WebhooksResource = class {
|
|
|
3102
3093
|
*/
|
|
3103
3094
|
async create(options) {
|
|
3104
3095
|
const result = await post(this.ctx, "/v1/webhooks", {
|
|
3096
|
+
events: options.events ?? (options.event ? [options.event] : void 0),
|
|
3105
3097
|
event: options.event,
|
|
3098
|
+
// Legacy fallback
|
|
3106
3099
|
url: options.url,
|
|
3107
3100
|
secret: options.secret,
|
|
3108
3101
|
minDealScore: options.minDealScore,
|
|
@@ -3140,7 +3133,7 @@ var WebhooksResource = class {
|
|
|
3140
3133
|
this.ctx,
|
|
3141
3134
|
`/v1/webhooks/${webhookId}`
|
|
3142
3135
|
);
|
|
3143
|
-
return result.data;
|
|
3136
|
+
return result.data.webhook;
|
|
3144
3137
|
}
|
|
3145
3138
|
/**
|
|
3146
3139
|
* Update a webhook
|
|
@@ -3198,7 +3191,8 @@ var WebhooksResource = class {
|
|
|
3198
3191
|
async test(webhookId) {
|
|
3199
3192
|
const result = await post(
|
|
3200
3193
|
this.ctx,
|
|
3201
|
-
|
|
3194
|
+
"/v1/webhooks/test",
|
|
3195
|
+
{ webhookId }
|
|
3202
3196
|
);
|
|
3203
3197
|
return result.data;
|
|
3204
3198
|
}
|
|
@@ -3236,7 +3230,7 @@ var WebhooksResource = class {
|
|
|
3236
3230
|
*/
|
|
3237
3231
|
async getActive() {
|
|
3238
3232
|
const all = await this.list();
|
|
3239
|
-
return all.
|
|
3233
|
+
return all.data.filter((w) => w.active);
|
|
3240
3234
|
}
|
|
3241
3235
|
/**
|
|
3242
3236
|
* Get webhooks by event type
|
|
@@ -3248,7 +3242,7 @@ var WebhooksResource = class {
|
|
|
3248
3242
|
*/
|
|
3249
3243
|
async getByEvent(event) {
|
|
3250
3244
|
const all = await this.list();
|
|
3251
|
-
return all.
|
|
3245
|
+
return all.data.filter((w) => w.event === event);
|
|
3252
3246
|
}
|
|
3253
3247
|
};
|
|
3254
3248
|
|