scavio 0.15.0 → 0.16.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 +4 -3
- package/dist/index.cjs +11 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +9 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -49,7 +49,7 @@ const client = new Scavio({
|
|
|
49
49
|
apiKey: "sk_...", // or set SCAVIO_API_KEY env var
|
|
50
50
|
baseUrl: "https://api.scavio.dev", // default
|
|
51
51
|
timeout: 30_000, // ms, default
|
|
52
|
-
maxRequestsPerSecond: 1, // 1-
|
|
52
|
+
maxRequestsPerSecond: 1, // 1-50, default 1
|
|
53
53
|
maxRetries: 2, // default 2, set 0 to disable
|
|
54
54
|
});
|
|
55
55
|
```
|
|
@@ -62,8 +62,9 @@ errors. Backoff is exponential with full jitter, capped at 8s, and a
|
|
|
62
62
|
|
|
63
63
|
`maxRequestsPerSecond` throttles the client so it never sends more than N
|
|
64
64
|
requests in any one-second window. Your plan also has a server-side concurrency
|
|
65
|
-
limit on simultaneous in-flight requests: 1 on free and pay-as-you-go,
|
|
66
|
-
Project,
|
|
65
|
+
limit on simultaneous in-flight requests: 1 on free and pay-as-you-go, 5 on
|
|
66
|
+
Project, 10 on Bootstrap, 15 on Startup, 50 on Growth, and unlimited on
|
|
67
|
+
Enterprise.
|
|
67
68
|
|
|
68
69
|
## API Reference
|
|
69
70
|
|
package/dist/index.cjs
CHANGED
|
@@ -27,6 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
BookingNamespace: () => BookingNamespace,
|
|
28
28
|
CapterraNamespace: () => CapterraNamespace,
|
|
29
29
|
CompaniesHouseNamespace: () => CompaniesHouseNamespace,
|
|
30
|
+
DEFAULT_MAX_REQUESTS_PER_SECOND: () => DEFAULT_MAX_REQUESTS_PER_SECOND,
|
|
30
31
|
EbayNamespace: () => EbayNamespace,
|
|
31
32
|
G2Namespace: () => G2Namespace,
|
|
32
33
|
GlassdoorNamespace: () => GlassdoorNamespace,
|
|
@@ -40,6 +41,7 @@ __export(index_exports, {
|
|
|
40
41
|
InvalidAPIKeyError: () => InvalidAPIKeyError,
|
|
41
42
|
KuaishouNamespace: () => KuaishouNamespace,
|
|
42
43
|
LinkedInNamespace: () => LinkedInNamespace,
|
|
44
|
+
MAX_REQUESTS_PER_SECOND: () => MAX_REQUESTS_PER_SECOND,
|
|
43
45
|
MetaAdsNamespace: () => MetaAdsNamespace,
|
|
44
46
|
MissingAPIKeyError: () => MissingAPIKeyError,
|
|
45
47
|
NotFoundError: () => NotFoundError,
|
|
@@ -2304,6 +2306,8 @@ var MetaAdsNamespace = class {
|
|
|
2304
2306
|
};
|
|
2305
2307
|
|
|
2306
2308
|
// src/client.ts
|
|
2309
|
+
var DEFAULT_MAX_REQUESTS_PER_SECOND = 1;
|
|
2310
|
+
var MAX_REQUESTS_PER_SECOND = 50;
|
|
2307
2311
|
var Scavio = class {
|
|
2308
2312
|
google;
|
|
2309
2313
|
amazon;
|
|
@@ -2349,9 +2353,11 @@ var Scavio = class {
|
|
|
2349
2353
|
this.baseUrl = (config?.baseUrl ?? BASE_URL).replace(/\/+$/, "");
|
|
2350
2354
|
this.timeout = config?.timeout ?? DEFAULT_TIMEOUT;
|
|
2351
2355
|
this.maxRetries = config?.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
2352
|
-
const rps = config?.maxRequestsPerSecond ??
|
|
2353
|
-
if (rps < 1 || rps >
|
|
2354
|
-
throw new ScavioError(
|
|
2356
|
+
const rps = config?.maxRequestsPerSecond ?? DEFAULT_MAX_REQUESTS_PER_SECOND;
|
|
2357
|
+
if (rps < 1 || rps > MAX_REQUESTS_PER_SECOND) {
|
|
2358
|
+
throw new ScavioError(
|
|
2359
|
+
`maxRequestsPerSecond must be between 1 and ${MAX_REQUESTS_PER_SECOND}`
|
|
2360
|
+
);
|
|
2355
2361
|
}
|
|
2356
2362
|
this.rateLimiter = new RateLimiter(rps);
|
|
2357
2363
|
this.google = new GoogleNamespace(this);
|
|
@@ -2450,6 +2456,7 @@ var Scavio = class {
|
|
|
2450
2456
|
BookingNamespace,
|
|
2451
2457
|
CapterraNamespace,
|
|
2452
2458
|
CompaniesHouseNamespace,
|
|
2459
|
+
DEFAULT_MAX_REQUESTS_PER_SECOND,
|
|
2453
2460
|
EbayNamespace,
|
|
2454
2461
|
G2Namespace,
|
|
2455
2462
|
GlassdoorNamespace,
|
|
@@ -2463,6 +2470,7 @@ var Scavio = class {
|
|
|
2463
2470
|
InvalidAPIKeyError,
|
|
2464
2471
|
KuaishouNamespace,
|
|
2465
2472
|
LinkedInNamespace,
|
|
2473
|
+
MAX_REQUESTS_PER_SECOND,
|
|
2466
2474
|
MetaAdsNamespace,
|
|
2467
2475
|
MissingAPIKeyError,
|
|
2468
2476
|
NotFoundError,
|