scavio 0.2.1 → 0.5.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 +16 -6
- package/dist/index.cjs +229 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +550 -30
- package/dist/index.d.ts +550 -30
- package/dist/index.js +225 -37
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -40,17 +40,27 @@ const client = new Scavio({
|
|
|
40
40
|
|
|
41
41
|
### Google
|
|
42
42
|
|
|
43
|
+
Every method hits `/api/v2/google` and returns Google's full response (raw
|
|
44
|
+
passthrough); each costs 1 credit. Any scrape.do parameter can be passed
|
|
45
|
+
through.
|
|
46
|
+
|
|
43
47
|
```typescript
|
|
48
|
+
// SERP search (includes the AI Overview when Google shows one)
|
|
44
49
|
await client.google.search({
|
|
45
50
|
query: "web scraping",
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
page: 1, // optional
|
|
49
|
-
search_type: "news", // optional
|
|
51
|
+
gl: "us", // optional — geo (country)
|
|
52
|
+
hl: "en", // optional — UI language
|
|
50
53
|
device: "desktop", // optional
|
|
51
|
-
nfpr: false, // optional — no auto-correct
|
|
52
|
-
light_request: false, // optional
|
|
53
54
|
});
|
|
55
|
+
|
|
56
|
+
// Other Google surfaces
|
|
57
|
+
await client.google.aiMode({ query: "how does rag work" });
|
|
58
|
+
await client.google.mapsSearch({ query: "coffee near me" });
|
|
59
|
+
await client.google.shopping({ query: "laptop" });
|
|
60
|
+
await client.google.flights({ departure_id: "JFK", arrival_id: "LAX", outbound_date: "2026-12-15" });
|
|
61
|
+
await client.google.hotels({ query: "Bali", check_in_date: "2026-08-01", check_out_date: "2026-08-03" });
|
|
62
|
+
await client.google.news({ query: "openai" });
|
|
63
|
+
await client.google.trends({ query: "bitcoin" });
|
|
54
64
|
```
|
|
55
65
|
|
|
56
66
|
### Amazon
|
package/dist/index.cjs
CHANGED
|
@@ -24,10 +24,13 @@ __export(index_exports, {
|
|
|
24
24
|
InsufficientCreditsError: () => InsufficientCreditsError,
|
|
25
25
|
InvalidAPIKeyError: () => InvalidAPIKeyError,
|
|
26
26
|
MissingAPIKeyError: () => MissingAPIKeyError,
|
|
27
|
+
NotFoundError: () => NotFoundError,
|
|
27
28
|
RateLimitError: () => RateLimitError,
|
|
28
29
|
Scavio: () => Scavio,
|
|
29
30
|
ScavioAPIError: () => ScavioAPIError,
|
|
30
|
-
|
|
31
|
+
ScavioConnectionError: () => ScavioConnectionError,
|
|
32
|
+
ScavioError: () => ScavioError,
|
|
33
|
+
ScavioTimeoutError: () => ScavioTimeoutError
|
|
31
34
|
});
|
|
32
35
|
module.exports = __toCommonJS(index_exports);
|
|
33
36
|
|
|
@@ -46,42 +49,121 @@ var MissingAPIKeyError = class extends ScavioError {
|
|
|
46
49
|
this.name = "MissingAPIKeyError";
|
|
47
50
|
}
|
|
48
51
|
};
|
|
52
|
+
var ScavioConnectionError = class extends ScavioError {
|
|
53
|
+
constructor(message = "Connection error") {
|
|
54
|
+
super(message);
|
|
55
|
+
this.name = "ScavioConnectionError";
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
var ScavioTimeoutError = class extends ScavioError {
|
|
59
|
+
constructor(message = "Request timed out") {
|
|
60
|
+
super(message);
|
|
61
|
+
this.name = "ScavioTimeoutError";
|
|
62
|
+
}
|
|
63
|
+
};
|
|
49
64
|
var InvalidAPIKeyError = class extends ScavioError {
|
|
50
|
-
|
|
65
|
+
statusCode = 401;
|
|
66
|
+
responseBody;
|
|
67
|
+
constructor(message = "Invalid API key", responseBody) {
|
|
51
68
|
super(message);
|
|
52
69
|
this.name = "InvalidAPIKeyError";
|
|
70
|
+
this.responseBody = responseBody;
|
|
53
71
|
}
|
|
54
72
|
};
|
|
55
73
|
var InsufficientCreditsError = class extends ScavioError {
|
|
56
|
-
|
|
74
|
+
statusCode = 402;
|
|
75
|
+
responseBody;
|
|
76
|
+
constructor(message = "Insufficient credits", responseBody) {
|
|
57
77
|
super(message);
|
|
58
78
|
this.name = "InsufficientCreditsError";
|
|
79
|
+
this.responseBody = responseBody;
|
|
59
80
|
}
|
|
60
81
|
};
|
|
61
82
|
var BadRequestError = class extends ScavioError {
|
|
62
|
-
|
|
83
|
+
statusCode = 400;
|
|
84
|
+
responseBody;
|
|
85
|
+
constructor(message = "Bad request", responseBody) {
|
|
63
86
|
super(message);
|
|
64
87
|
this.name = "BadRequestError";
|
|
88
|
+
this.responseBody = responseBody;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
var NotFoundError = class extends ScavioError {
|
|
92
|
+
statusCode = 404;
|
|
93
|
+
responseBody;
|
|
94
|
+
constructor(message = "Not found", responseBody) {
|
|
95
|
+
super(message);
|
|
96
|
+
this.name = "NotFoundError";
|
|
97
|
+
this.responseBody = responseBody;
|
|
65
98
|
}
|
|
66
99
|
};
|
|
67
100
|
var RateLimitError = class extends ScavioError {
|
|
68
|
-
|
|
101
|
+
statusCode = 429;
|
|
102
|
+
responseBody;
|
|
103
|
+
constructor(message = "Rate limit exceeded", responseBody) {
|
|
69
104
|
super(message);
|
|
70
105
|
this.name = "RateLimitError";
|
|
106
|
+
this.responseBody = responseBody;
|
|
71
107
|
}
|
|
72
108
|
};
|
|
73
109
|
var ScavioAPIError = class extends ScavioError {
|
|
74
110
|
statusCode;
|
|
75
|
-
|
|
111
|
+
responseBody;
|
|
112
|
+
constructor(statusCode, message, responseBody) {
|
|
76
113
|
super(`API error ${statusCode}: ${message}`);
|
|
77
114
|
this.name = "ScavioAPIError";
|
|
78
115
|
this.statusCode = statusCode;
|
|
116
|
+
this.responseBody = responseBody;
|
|
79
117
|
}
|
|
80
118
|
};
|
|
81
119
|
|
|
120
|
+
// src/retry.ts
|
|
121
|
+
var DEFAULT_RETRY_STATUSES = /* @__PURE__ */ new Set([
|
|
122
|
+
429,
|
|
123
|
+
500,
|
|
124
|
+
502,
|
|
125
|
+
503,
|
|
126
|
+
504
|
|
127
|
+
]);
|
|
128
|
+
function makeRetryConfig(maxRetries) {
|
|
129
|
+
return {
|
|
130
|
+
maxRetries,
|
|
131
|
+
baseDelay: 0.5,
|
|
132
|
+
maxDelay: 8,
|
|
133
|
+
retryStatuses: DEFAULT_RETRY_STATUSES
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
function shouldRetryStatus(config, statusCode, attempt) {
|
|
137
|
+
return attempt < config.maxRetries && config.retryStatuses.has(statusCode);
|
|
138
|
+
}
|
|
139
|
+
function shouldRetryException(config, attempt) {
|
|
140
|
+
return attempt < config.maxRetries;
|
|
141
|
+
}
|
|
142
|
+
function backoff(config, attempt, retryAfter) {
|
|
143
|
+
if (retryAfter !== void 0) {
|
|
144
|
+
return Math.min(Math.max(retryAfter, 0), config.maxDelay);
|
|
145
|
+
}
|
|
146
|
+
const capped = Math.min(config.maxDelay, config.baseDelay * 2 ** attempt);
|
|
147
|
+
return Math.random() * capped;
|
|
148
|
+
}
|
|
149
|
+
function parseRetryAfter(header) {
|
|
150
|
+
if (!header) return void 0;
|
|
151
|
+
const trimmed = header.trim();
|
|
152
|
+
const asNumber = Number(trimmed);
|
|
153
|
+
if (!Number.isNaN(asNumber) && trimmed !== "") {
|
|
154
|
+
return asNumber;
|
|
155
|
+
}
|
|
156
|
+
const asDate = Date.parse(trimmed);
|
|
157
|
+
if (!Number.isNaN(asDate)) {
|
|
158
|
+
return Math.max((asDate - Date.now()) / 1e3, 0);
|
|
159
|
+
}
|
|
160
|
+
return void 0;
|
|
161
|
+
}
|
|
162
|
+
|
|
82
163
|
// src/http.ts
|
|
83
164
|
var BASE_URL = "https://api.scavio.dev";
|
|
84
165
|
var DEFAULT_TIMEOUT = 3e4;
|
|
166
|
+
var DEFAULT_MAX_RETRIES = 2;
|
|
85
167
|
function buildHeaders(apiKey) {
|
|
86
168
|
return {
|
|
87
169
|
Authorization: `Bearer ${apiKey}`,
|
|
@@ -104,39 +186,80 @@ function handleError(statusCode, body) {
|
|
|
104
186
|
error = error.message;
|
|
105
187
|
}
|
|
106
188
|
const msg = String(error);
|
|
107
|
-
|
|
108
|
-
if (statusCode ===
|
|
109
|
-
if (statusCode ===
|
|
110
|
-
if (statusCode ===
|
|
111
|
-
throw new
|
|
189
|
+
const responseBody = Object.keys(body).length > 0 ? body : void 0;
|
|
190
|
+
if (statusCode === 400) throw new BadRequestError(msg, responseBody);
|
|
191
|
+
if (statusCode === 401) throw new InvalidAPIKeyError(msg, responseBody);
|
|
192
|
+
if (statusCode === 402) throw new InsufficientCreditsError(msg, responseBody);
|
|
193
|
+
if (statusCode === 404) throw new NotFoundError(msg, responseBody);
|
|
194
|
+
if (statusCode === 429) throw new RateLimitError(msg, responseBody);
|
|
195
|
+
throw new ScavioAPIError(statusCode, msg, responseBody);
|
|
196
|
+
}
|
|
197
|
+
function sleep(seconds) {
|
|
198
|
+
return new Promise((resolve) => setTimeout(resolve, seconds * 1e3));
|
|
199
|
+
}
|
|
200
|
+
function isAbortError(err) {
|
|
201
|
+
return err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError");
|
|
202
|
+
}
|
|
203
|
+
function getHeader(response, name) {
|
|
204
|
+
const headers = response.headers;
|
|
205
|
+
if (headers && typeof headers.get === "function") {
|
|
206
|
+
return headers.get(name);
|
|
207
|
+
}
|
|
208
|
+
return null;
|
|
112
209
|
}
|
|
113
210
|
async function request(options) {
|
|
114
|
-
await options.rateLimiter.wait();
|
|
115
211
|
const url = `${options.baseUrl}${options.path}`;
|
|
116
212
|
const headers = buildHeaders(options.apiKey);
|
|
117
|
-
const
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
213
|
+
const retry = makeRetryConfig(
|
|
214
|
+
options.maxRetries ?? DEFAULT_MAX_RETRIES
|
|
215
|
+
);
|
|
216
|
+
let attempt = 0;
|
|
217
|
+
for (; ; ) {
|
|
218
|
+
await options.rateLimiter.wait();
|
|
219
|
+
const controller = new AbortController();
|
|
220
|
+
const timeoutId = setTimeout(() => controller.abort(), options.timeout);
|
|
221
|
+
let response;
|
|
222
|
+
try {
|
|
223
|
+
const fetchOptions = {
|
|
224
|
+
method: options.method,
|
|
225
|
+
headers,
|
|
226
|
+
signal: controller.signal
|
|
227
|
+
};
|
|
228
|
+
if (options.method === "POST" && options.body) {
|
|
229
|
+
fetchOptions.body = JSON.stringify(stripUndefined(options.body));
|
|
230
|
+
}
|
|
231
|
+
response = await fetch(url, fetchOptions);
|
|
232
|
+
} catch (err) {
|
|
233
|
+
clearTimeout(timeoutId);
|
|
234
|
+
const timedOut = isAbortError(err);
|
|
235
|
+
if (shouldRetryException(retry, attempt)) {
|
|
236
|
+
await sleep(backoff(retry, attempt));
|
|
237
|
+
attempt += 1;
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
241
|
+
if (timedOut) {
|
|
242
|
+
throw new ScavioTimeoutError(msg);
|
|
134
243
|
}
|
|
135
|
-
|
|
244
|
+
throw new ScavioConnectionError(msg);
|
|
245
|
+
} finally {
|
|
246
|
+
clearTimeout(timeoutId);
|
|
247
|
+
}
|
|
248
|
+
if (response.ok) {
|
|
249
|
+
return await response.json();
|
|
250
|
+
}
|
|
251
|
+
if (shouldRetryStatus(retry, response.status, attempt)) {
|
|
252
|
+
const retryAfter = parseRetryAfter(getHeader(response, "Retry-After"));
|
|
253
|
+
await sleep(backoff(retry, attempt, retryAfter));
|
|
254
|
+
attempt += 1;
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
let body = {};
|
|
258
|
+
try {
|
|
259
|
+
body = await response.json();
|
|
260
|
+
} catch {
|
|
136
261
|
}
|
|
137
|
-
|
|
138
|
-
} finally {
|
|
139
|
-
clearTimeout(timeoutId);
|
|
262
|
+
handleError(response.status, body);
|
|
140
263
|
}
|
|
141
264
|
}
|
|
142
265
|
|
|
@@ -188,6 +311,10 @@ var AmazonNamespace = class {
|
|
|
188
311
|
...rest
|
|
189
312
|
});
|
|
190
313
|
}
|
|
314
|
+
/** Supported Amazon domains, languages, currencies, and countries. */
|
|
315
|
+
async options() {
|
|
316
|
+
return this.client._get("/api/v1/amazon/options");
|
|
317
|
+
}
|
|
191
318
|
};
|
|
192
319
|
|
|
193
320
|
// src/namespaces/google.ts
|
|
@@ -196,8 +323,61 @@ var GoogleNamespace = class {
|
|
|
196
323
|
this.client = client;
|
|
197
324
|
}
|
|
198
325
|
client;
|
|
326
|
+
/** Google SERP search (includes the AI Overview when Google returns one). */
|
|
199
327
|
async search(options) {
|
|
200
|
-
return this.client._post("/api/
|
|
328
|
+
return this.client._post("/api/v2/google", options);
|
|
329
|
+
}
|
|
330
|
+
/** Google AI Mode answer. */
|
|
331
|
+
async aiMode(options) {
|
|
332
|
+
return this.client._post("/api/v2/google/ai-mode", options);
|
|
333
|
+
}
|
|
334
|
+
/** Google Maps local results. */
|
|
335
|
+
async mapsSearch(options) {
|
|
336
|
+
return this.client._post("/api/v2/google/maps/search", options);
|
|
337
|
+
}
|
|
338
|
+
/** Google Maps place details. Provide place_id or data_cid. */
|
|
339
|
+
async mapsPlace(options) {
|
|
340
|
+
return this.client._post("/api/v2/google/maps/place", options);
|
|
341
|
+
}
|
|
342
|
+
/** Google Maps reviews. Provide data_id or place_id. */
|
|
343
|
+
async mapsReviews(options) {
|
|
344
|
+
return this.client._post("/api/v2/google/maps/reviews", options);
|
|
345
|
+
}
|
|
346
|
+
/** Google Shopping search results. */
|
|
347
|
+
async shopping(options) {
|
|
348
|
+
return this.client._post("/api/v2/google/shopping", options);
|
|
349
|
+
}
|
|
350
|
+
/** Google Shopping product. Pass catalog_id + query for full details and sellers. */
|
|
351
|
+
async shoppingProduct(options) {
|
|
352
|
+
return this.client._post("/api/v2/google/shopping/product", options);
|
|
353
|
+
}
|
|
354
|
+
/** Google Shopping product sellers (continuation of shoppingProduct). */
|
|
355
|
+
async shoppingStores(options) {
|
|
356
|
+
return this.client._post("/api/v2/google/shopping/product/stores", options);
|
|
357
|
+
}
|
|
358
|
+
/** Google Flights. */
|
|
359
|
+
async flights(options) {
|
|
360
|
+
return this.client._post("/api/v2/google/flights", options);
|
|
361
|
+
}
|
|
362
|
+
/** Google Hotels search. */
|
|
363
|
+
async hotels(options) {
|
|
364
|
+
return this.client._post("/api/v2/google/hotels", options);
|
|
365
|
+
}
|
|
366
|
+
/** Google Hotels property details (from a hotels listing detail_token). */
|
|
367
|
+
async hotelsDetail(options) {
|
|
368
|
+
return this.client._post("/api/v2/google/hotels/detail", options);
|
|
369
|
+
}
|
|
370
|
+
/** Google News. Provide query or a topic/story/publication token. */
|
|
371
|
+
async news(options) {
|
|
372
|
+
return this.client._post("/api/v2/google/news", options);
|
|
373
|
+
}
|
|
374
|
+
/** Google Trends data. */
|
|
375
|
+
async trends(options) {
|
|
376
|
+
return this.client._post("/api/v2/google/trends", options);
|
|
377
|
+
}
|
|
378
|
+
/** Google Trending Now for a country. */
|
|
379
|
+
async trending(options) {
|
|
380
|
+
return this.client._post("/api/v2/google/trending", options);
|
|
201
381
|
}
|
|
202
382
|
};
|
|
203
383
|
|
|
@@ -321,11 +501,15 @@ var YouTubeNamespace = class {
|
|
|
321
501
|
}
|
|
322
502
|
client;
|
|
323
503
|
async search(options) {
|
|
324
|
-
const { query, ...rest } = options;
|
|
325
|
-
|
|
504
|
+
const { query, fourK, video_360, video_3d, ...rest } = options;
|
|
505
|
+
const body = {
|
|
326
506
|
search: query,
|
|
327
507
|
...rest
|
|
328
|
-
}
|
|
508
|
+
};
|
|
509
|
+
if (fourK !== void 0) body["4k"] = fourK;
|
|
510
|
+
if (video_360 !== void 0) body["360"] = video_360;
|
|
511
|
+
if (video_3d !== void 0) body["3d"] = video_3d;
|
|
512
|
+
return this.client._post("/api/v1/youtube/search", body);
|
|
329
513
|
}
|
|
330
514
|
async metadata(options) {
|
|
331
515
|
return this.client._post("/api/v1/youtube/metadata", options);
|
|
@@ -344,6 +528,7 @@ var Scavio = class {
|
|
|
344
528
|
apiKey;
|
|
345
529
|
baseUrl;
|
|
346
530
|
timeout;
|
|
531
|
+
maxRetries;
|
|
347
532
|
rateLimiter;
|
|
348
533
|
constructor(config) {
|
|
349
534
|
this.apiKey = config?.apiKey ?? process.env.SCAVIO_API_KEY ?? "";
|
|
@@ -352,6 +537,7 @@ var Scavio = class {
|
|
|
352
537
|
}
|
|
353
538
|
this.baseUrl = (config?.baseUrl ?? BASE_URL).replace(/\/+$/, "");
|
|
354
539
|
this.timeout = config?.timeout ?? DEFAULT_TIMEOUT;
|
|
540
|
+
this.maxRetries = config?.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
355
541
|
const rps = config?.maxRequestsPerSecond ?? 1;
|
|
356
542
|
if (rps < 1 || rps > 10) {
|
|
357
543
|
throw new ScavioError("maxRequestsPerSecond must be between 1 and 10");
|
|
@@ -373,6 +559,7 @@ var Scavio = class {
|
|
|
373
559
|
apiKey: this.apiKey,
|
|
374
560
|
baseUrl: this.baseUrl,
|
|
375
561
|
timeout: this.timeout,
|
|
562
|
+
maxRetries: this.maxRetries,
|
|
376
563
|
rateLimiter: this.rateLimiter,
|
|
377
564
|
body
|
|
378
565
|
});
|
|
@@ -385,6 +572,7 @@ var Scavio = class {
|
|
|
385
572
|
apiKey: this.apiKey,
|
|
386
573
|
baseUrl: this.baseUrl,
|
|
387
574
|
timeout: this.timeout,
|
|
575
|
+
maxRetries: this.maxRetries,
|
|
388
576
|
rateLimiter: this.rateLimiter
|
|
389
577
|
});
|
|
390
578
|
}
|
|
@@ -401,9 +589,12 @@ var Scavio = class {
|
|
|
401
589
|
InsufficientCreditsError,
|
|
402
590
|
InvalidAPIKeyError,
|
|
403
591
|
MissingAPIKeyError,
|
|
592
|
+
NotFoundError,
|
|
404
593
|
RateLimitError,
|
|
405
594
|
Scavio,
|
|
406
595
|
ScavioAPIError,
|
|
407
|
-
|
|
596
|
+
ScavioConnectionError,
|
|
597
|
+
ScavioError,
|
|
598
|
+
ScavioTimeoutError
|
|
408
599
|
});
|
|
409
600
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/http.ts","../src/rate-limiter.ts","../src/namespaces/amazon.ts","../src/namespaces/google.ts","../src/namespaces/reddit.ts","../src/namespaces/tiktok.ts","../src/namespaces/instagram.ts","../src/namespaces/walmart.ts","../src/namespaces/youtube.ts","../src/client.ts"],"sourcesContent":["export { Scavio } from \"./client.js\";\nexport type { ScavioConfig } from \"./client.js\";\n\nexport {\n ScavioError,\n MissingAPIKeyError,\n InvalidAPIKeyError,\n InsufficientCreditsError,\n BadRequestError,\n RateLimitError,\n ScavioAPIError,\n} from \"./errors.js\";\n\nexport type { GoogleSearchOptions } from \"./namespaces/google.js\";\nexport type {\n AmazonSearchOptions,\n AmazonProductOptions,\n} from \"./namespaces/amazon.js\";\nexport type {\n WalmartSearchOptions,\n WalmartProductOptions,\n} from \"./namespaces/walmart.js\";\nexport type {\n YouTubeSearchOptions,\n YouTubeMetadataOptions,\n} from \"./namespaces/youtube.js\";\nexport type {\n RedditSearchOptions,\n RedditPostOptions,\n} from \"./namespaces/reddit.js\";\nexport type {\n TikTokProfileOptions,\n TikTokUserPostsOptions,\n TikTokVideoOptions,\n TikTokVideoCommentsOptions,\n TikTokCommentRepliesOptions,\n TikTokSearchVideosOptions,\n TikTokSearchUsersOptions,\n TikTokHashtagOptions,\n TikTokHashtagVideosOptions,\n TikTokUserFollowersOptions,\n TikTokUserFollowingsOptions,\n} from \"./namespaces/tiktok.js\";\nexport type {\n InstagramProfileOptions,\n InstagramUserFeedOptions,\n InstagramStoriesOptions,\n InstagramPostOptions,\n InstagramPostCommentsOptions,\n InstagramCommentRepliesOptions,\n InstagramSearchOptions,\n InstagramFollowOptions,\n} from \"./namespaces/instagram.js\";\n","export class ScavioError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ScavioError\";\n }\n}\n\nexport class MissingAPIKeyError extends ScavioError {\n constructor() {\n super(\n \"No API key provided. Pass apiKey or set the SCAVIO_API_KEY \" +\n \"environment variable. Get your free key at https://dashboard.scavio.dev\",\n );\n this.name = \"MissingAPIKeyError\";\n }\n}\n\nexport class InvalidAPIKeyError extends ScavioError {\n constructor(message = \"Invalid API key\") {\n super(message);\n this.name = \"InvalidAPIKeyError\";\n }\n}\n\nexport class InsufficientCreditsError extends ScavioError {\n constructor(message = \"Insufficient credits\") {\n super(message);\n this.name = \"InsufficientCreditsError\";\n }\n}\n\nexport class BadRequestError extends ScavioError {\n constructor(message = \"Bad request\") {\n super(message);\n this.name = \"BadRequestError\";\n }\n}\n\nexport class RateLimitError extends ScavioError {\n constructor(message = \"Rate limit exceeded\") {\n super(message);\n this.name = \"RateLimitError\";\n }\n}\n\nexport class ScavioAPIError extends ScavioError {\n public readonly statusCode: number;\n\n constructor(statusCode: number, message: string) {\n super(`API error ${statusCode}: ${message}`);\n this.name = \"ScavioAPIError\";\n this.statusCode = statusCode;\n }\n}\n","import {\n BadRequestError,\n InsufficientCreditsError,\n InvalidAPIKeyError,\n RateLimitError,\n ScavioAPIError,\n} from \"./errors.js\";\nimport type { RateLimiter } from \"./rate-limiter.js\";\n\nexport const BASE_URL = \"https://api.scavio.dev\";\nexport const DEFAULT_TIMEOUT = 30_000;\n\nfunction buildHeaders(apiKey: string): Record<string, string> {\n return {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n \"X-Client-Source\": \"scavio-js\",\n };\n}\n\nfunction stripUndefined(\n obj: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined) {\n result[key] = value;\n }\n }\n return result;\n}\n\nfunction handleError(statusCode: number, body: Record<string, unknown>): never {\n let error = body.error ?? \"Unknown error\";\n if (typeof error === \"object\" && error !== null && \"message\" in error) {\n error = (error as { message: string }).message;\n }\n const msg = String(error);\n\n if (statusCode === 400) throw new BadRequestError(msg);\n if (statusCode === 401) throw new InvalidAPIKeyError(msg);\n if (statusCode === 402) throw new InsufficientCreditsError(msg);\n if (statusCode === 429) throw new RateLimitError(msg);\n throw new ScavioAPIError(statusCode, msg);\n}\n\nexport async function request(options: {\n method: \"GET\" | \"POST\";\n path: string;\n apiKey: string;\n baseUrl: string;\n timeout: number;\n rateLimiter: RateLimiter;\n body?: Record<string, unknown>;\n}): Promise<Record<string, unknown>> {\n await options.rateLimiter.wait();\n\n const url = `${options.baseUrl}${options.path}`;\n const headers = buildHeaders(options.apiKey);\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), options.timeout);\n\n try {\n const fetchOptions: RequestInit = {\n method: options.method,\n headers,\n signal: controller.signal,\n };\n\n if (options.method === \"POST\" && options.body) {\n fetchOptions.body = JSON.stringify(stripUndefined(options.body));\n }\n\n const response = await fetch(url, fetchOptions);\n\n if (!response.ok) {\n let body: Record<string, unknown> = {};\n try {\n body = (await response.json()) as Record<string, unknown>;\n } catch {\n // ignore parse failures\n }\n handleError(response.status, body);\n }\n\n return (await response.json()) as Record<string, unknown>;\n } finally {\n clearTimeout(timeoutId);\n }\n}\n","export class RateLimiter {\n private readonly maxPerSecond: number;\n private readonly timestamps: number[] = [];\n private pending: Promise<void> = Promise.resolve();\n\n constructor(maxPerSecond: number) {\n this.maxPerSecond = maxPerSecond;\n }\n\n async wait(): Promise<void> {\n const ticket = this.pending.then(() => this.acquire());\n this.pending = ticket;\n return ticket;\n }\n\n private async acquire(): Promise<void> {\n this.cleanup();\n if (this.timestamps.length >= this.maxPerSecond) {\n const sleepMs = 1000 - (Date.now() - this.timestamps[0]!);\n if (sleepMs > 0) {\n await new Promise<void>((resolve) => setTimeout(resolve, sleepMs));\n }\n this.cleanup();\n }\n this.timestamps.push(Date.now());\n }\n\n private cleanup(): void {\n const now = Date.now();\n while (this.timestamps.length > 0 && now - this.timestamps[0]! >= 1000) {\n this.timestamps.shift();\n }\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface AmazonSearchOptions {\n query: string;\n domain?: string;\n country?: string;\n language?: string;\n currency?: string;\n device?: string;\n sort_by?: string;\n start_page?: number;\n pages?: number;\n category_id?: string;\n merchant_id?: string;\n zip_code?: string;\n autoselect_variant?: boolean;\n}\n\nexport interface AmazonProductOptions {\n asin: string;\n domain?: string;\n country?: string;\n language?: string;\n currency?: string;\n device?: string;\n zip_code?: string;\n autoselect_variant?: boolean;\n}\n\nexport class AmazonNamespace {\n constructor(private client: Scavio) {}\n\n async search(\n options: AmazonSearchOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/amazon/search\", options);\n }\n\n async product(\n options: AmazonProductOptions,\n ): Promise<Record<string, unknown>> {\n const { asin, ...rest } = options;\n return this.client._post(\"/api/v1/amazon/product\", {\n query: asin,\n ...rest,\n });\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface GoogleSearchOptions {\n query: string;\n country_code?: string;\n language?: string;\n page?: number;\n search_type?: string;\n device?: string;\n nfpr?: boolean;\n light_request?: boolean;\n}\n\nexport class GoogleNamespace {\n constructor(private client: Scavio) {}\n\n async search(options: GoogleSearchOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/google\", options);\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface RedditSearchOptions {\n query: string;\n type?: string;\n sort?: string;\n cursor?: string;\n}\n\nexport interface RedditPostOptions {\n url: string;\n}\n\nexport class RedditNamespace {\n constructor(private client: Scavio) {}\n\n async search(\n options: RedditSearchOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/reddit/search\", options);\n }\n\n async post(options: RedditPostOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/reddit/post\", options);\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface TikTokProfileOptions {\n username?: string;\n sec_user_id?: string;\n}\n\nexport interface TikTokUserPostsOptions {\n sec_user_id: string;\n cursor?: string;\n count?: number;\n sort_type?: string;\n}\n\nexport interface TikTokVideoOptions {\n video_id: string;\n}\n\nexport interface TikTokVideoCommentsOptions {\n video_id: string;\n cursor?: string;\n count?: number;\n}\n\nexport interface TikTokCommentRepliesOptions {\n video_id: string;\n comment_id: string;\n cursor?: string;\n count?: number;\n}\n\nexport interface TikTokSearchVideosOptions {\n keyword: string;\n cursor?: string;\n count?: number;\n sort_type?: string;\n publish_time?: string;\n}\n\nexport interface TikTokSearchUsersOptions {\n keyword: string;\n cursor?: string;\n count?: number;\n}\n\nexport interface TikTokHashtagOptions {\n hashtag_name?: string;\n hashtag_id?: string;\n}\n\nexport interface TikTokHashtagVideosOptions {\n hashtag_id: string;\n cursor?: string;\n count?: number;\n}\n\nexport interface TikTokUserFollowersOptions {\n sec_user_id: string;\n count?: number;\n page_token?: string;\n min_time?: number;\n}\n\nexport interface TikTokUserFollowingsOptions {\n sec_user_id: string;\n count?: number;\n page_token?: string;\n min_time?: number;\n}\n\nexport class TikTokNamespace {\n constructor(private client: Scavio) {}\n\n async profile(\n options: TikTokProfileOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/profile\", options);\n }\n\n async userPosts(\n options: TikTokUserPostsOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/user/posts\", options);\n }\n\n async video(\n options: TikTokVideoOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/video\", options);\n }\n\n async videoComments(\n options: TikTokVideoCommentsOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/video/comments\", options);\n }\n\n async commentReplies(\n options: TikTokCommentRepliesOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/video/comments/replies\", options);\n }\n\n async searchVideos(\n options: TikTokSearchVideosOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/search/videos\", options);\n }\n\n async searchUsers(\n options: TikTokSearchUsersOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/search/users\", options);\n }\n\n async hashtag(\n options: TikTokHashtagOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/hashtag\", options);\n }\n\n async hashtagVideos(\n options: TikTokHashtagVideosOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/hashtag/videos\", options);\n }\n\n async userFollowers(\n options: TikTokUserFollowersOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/user/followers\", options);\n }\n\n async userFollowings(\n options: TikTokUserFollowingsOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/user/followings\", options);\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface InstagramProfileOptions {\n username?: string;\n user_id?: string;\n}\n\nexport interface InstagramUserFeedOptions {\n username?: string;\n user_id?: string;\n count?: number;\n cursor?: string;\n}\n\nexport interface InstagramStoriesOptions {\n username?: string;\n user_id?: string;\n}\n\nexport interface InstagramPostOptions {\n url?: string;\n media_id?: string;\n shortcode?: string;\n}\n\nexport interface InstagramPostCommentsOptions {\n shortcode?: string;\n url?: string;\n cursor?: string;\n sort_order?: string;\n}\n\nexport interface InstagramCommentRepliesOptions {\n media_id: string;\n comment_id: string;\n cursor?: string;\n}\n\nexport interface InstagramSearchOptions {\n keyword: string;\n cursor?: string;\n}\n\nexport interface InstagramFollowOptions {\n username?: string;\n user_id?: string;\n count?: number;\n cursor?: string;\n}\n\nexport class InstagramNamespace {\n constructor(private client: Scavio) {}\n\n async profile(\n options: InstagramProfileOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/profile\", options);\n }\n\n async userPosts(\n options: InstagramUserFeedOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/user/posts\", options);\n }\n\n async userReels(\n options: InstagramUserFeedOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/user/reels\", options);\n }\n\n async userTagged(\n options: InstagramUserFeedOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/user/tagged\", options);\n }\n\n async userStories(\n options: InstagramStoriesOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/user/stories\", options);\n }\n\n async post(\n options: InstagramPostOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/post\", options);\n }\n\n async postComments(\n options: InstagramPostCommentsOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/post/comments\", options);\n }\n\n async commentReplies(\n options: InstagramCommentRepliesOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/post/comments/replies\", options);\n }\n\n async searchUsers(\n options: InstagramSearchOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/search/users\", options);\n }\n\n async searchHashtags(\n options: InstagramSearchOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/search/hashtags\", options);\n }\n\n async userFollowers(\n options: InstagramFollowOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/user/followers\", options);\n }\n\n async userFollowings(\n options: InstagramFollowOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/user/followings\", options);\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface WalmartSearchOptions {\n query: string;\n domain?: string;\n device?: string;\n sort_by?: string;\n start_page?: number;\n min_price?: number;\n max_price?: number;\n fulfillment_speed?: string;\n fulfillment_type?: string;\n delivery_zip?: string;\n store_id?: string;\n}\n\nexport interface WalmartProductOptions {\n product_id: string;\n domain?: string;\n device?: string;\n delivery_zip?: string;\n store_id?: string;\n}\n\nexport class WalmartNamespace {\n constructor(private client: Scavio) {}\n\n async search(\n options: WalmartSearchOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/walmart/search\", options);\n }\n\n async product(\n options: WalmartProductOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/walmart/product\", options);\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface YouTubeSearchOptions {\n query: string;\n upload_date?: string;\n type?: string;\n duration?: string;\n sort_by?: string;\n hd?: boolean;\n subtitles?: boolean;\n creative_commons?: boolean;\n live?: boolean;\n}\n\nexport interface YouTubeMetadataOptions {\n video_id: string;\n}\n\nexport class YouTubeNamespace {\n constructor(private client: Scavio) {}\n\n async search(\n options: YouTubeSearchOptions,\n ): Promise<Record<string, unknown>> {\n const { query, ...rest } = options;\n return this.client._post(\"/api/v1/youtube/search\", {\n search: query,\n ...rest,\n });\n }\n\n async metadata(\n options: YouTubeMetadataOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/youtube/metadata\", options);\n }\n}\n","import { MissingAPIKeyError, ScavioError } from \"./errors.js\";\nimport { BASE_URL, DEFAULT_TIMEOUT, request } from \"./http.js\";\nimport { RateLimiter } from \"./rate-limiter.js\";\nimport { AmazonNamespace } from \"./namespaces/amazon.js\";\nimport type { GoogleSearchOptions } from \"./namespaces/google.js\";\nimport { GoogleNamespace } from \"./namespaces/google.js\";\nimport { RedditNamespace } from \"./namespaces/reddit.js\";\nimport { TikTokNamespace } from \"./namespaces/tiktok.js\";\nimport { InstagramNamespace } from \"./namespaces/instagram.js\";\nimport { WalmartNamespace } from \"./namespaces/walmart.js\";\nimport { YouTubeNamespace } from \"./namespaces/youtube.js\";\n\nexport interface ScavioConfig {\n apiKey?: string;\n baseUrl?: string;\n timeout?: number;\n maxRequestsPerSecond?: number;\n}\n\nexport class Scavio {\n readonly google: GoogleNamespace;\n readonly amazon: AmazonNamespace;\n readonly walmart: WalmartNamespace;\n readonly youtube: YouTubeNamespace;\n readonly reddit: RedditNamespace;\n readonly tiktok: TikTokNamespace;\n readonly instagram: InstagramNamespace;\n\n private readonly apiKey: string;\n private readonly baseUrl: string;\n private readonly timeout: number;\n private readonly rateLimiter: RateLimiter;\n\n constructor(config?: ScavioConfig) {\n this.apiKey = config?.apiKey ?? process.env.SCAVIO_API_KEY ?? \"\";\n if (!this.apiKey) {\n throw new MissingAPIKeyError();\n }\n\n this.baseUrl = (config?.baseUrl ?? BASE_URL).replace(/\\/+$/, \"\");\n this.timeout = config?.timeout ?? DEFAULT_TIMEOUT;\n\n const rps = config?.maxRequestsPerSecond ?? 1;\n if (rps < 1 || rps > 10) {\n throw new ScavioError(\"maxRequestsPerSecond must be between 1 and 10\");\n }\n this.rateLimiter = new RateLimiter(rps);\n\n this.google = new GoogleNamespace(this);\n this.amazon = new AmazonNamespace(this);\n this.walmart = new WalmartNamespace(this);\n this.youtube = new YouTubeNamespace(this);\n this.reddit = new RedditNamespace(this);\n this.tiktok = new TikTokNamespace(this);\n this.instagram = new InstagramNamespace(this);\n }\n\n /** @internal */\n async _post(\n path: string,\n body: object,\n ): Promise<Record<string, unknown>> {\n return request({\n method: \"POST\",\n path,\n apiKey: this.apiKey,\n baseUrl: this.baseUrl,\n timeout: this.timeout,\n rateLimiter: this.rateLimiter,\n body: body as Record<string, unknown>,\n });\n }\n\n /** @internal */\n async _get(path: string): Promise<Record<string, unknown>> {\n return request({\n method: \"GET\",\n path,\n apiKey: this.apiKey,\n baseUrl: this.baseUrl,\n timeout: this.timeout,\n rateLimiter: this.rateLimiter,\n });\n }\n\n async search(\n options: GoogleSearchOptions,\n ): Promise<Record<string, unknown>> {\n return this.google.search(options);\n }\n\n async getUsage(): Promise<Record<string, unknown>> {\n return this._get(\"/api/v1/usage\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,cAAN,cAA0B,MA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gBAAgB,IAAI;AACtC,SAAK,SAAS,IAAI,gBAAgB,IAAI;AACtC,SAAK,UAAU,IAAI,iBAAiB,IAAI;AACxC,SAAK,UAAU,IAAI,iBAAiB,IAAI;AACxC,SAAK,SAAS,IAAI,gBAAgB,IAAI;AACtC,SAAK,SAAS,IAAI,gBAAgB,IAAI;AACtC,SAAK,YAAY,IAAI,mBAAmB,IAAI;AAAA,EAC9C;AAAA;AAAA,EAGA,MAAM,MACJ,MACA,MACkC;AAClC,WAAO,QAAQ;AAAA,MACb,QAAQ;AAAA,MACR;AAAA,MACA,QAAQ,KAAK;AAAA,MACb,SAAS,KAAK;AAAA,MACd,SAAS,KAAK;AAAA,MACd,aAAa,KAAK;AAAA,MAClB;AAAA,IACF,CAAC;AAAA,EACH;AAAA;AAAA,EAGA,MAAM,KAAK,MAAgD;AACzD,WAAO,QAAQ;AAAA,MACb,QAAQ;AAAA,MACR;AAAA,MACA,QAAQ,KAAK;AAAA,MACb,SAAS,KAAK;AAAA,MACd,SAAS,KAAK;AAAA,MACd,aAAa,KAAK;AAAA,IACpB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,OACJ,SACkC;AAClC,WAAO,KAAK,OAAO,OAAO,OAAO;AAAA,EACnC;AAAA,EAEA,MAAM,WAA6C;AACjD,WAAO,KAAK,KAAK,eAAe;AAAA,EAClC;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/retry.ts","../src/http.ts","../src/rate-limiter.ts","../src/namespaces/amazon.ts","../src/namespaces/google.ts","../src/namespaces/reddit.ts","../src/namespaces/tiktok.ts","../src/namespaces/instagram.ts","../src/namespaces/walmart.ts","../src/namespaces/youtube.ts","../src/client.ts"],"sourcesContent":["export { Scavio } from \"./client.js\";\nexport type { ScavioConfig } from \"./client.js\";\n\nexport {\n ScavioError,\n MissingAPIKeyError,\n InvalidAPIKeyError,\n InsufficientCreditsError,\n BadRequestError,\n NotFoundError,\n RateLimitError,\n ScavioAPIError,\n ScavioConnectionError,\n ScavioTimeoutError,\n} from \"./errors.js\";\n\nexport type {\n GoogleSearchOptions,\n GoogleAiModeOptions,\n GoogleMapsSearchOptions,\n GoogleMapsPlaceOptions,\n GoogleMapsReviewsOptions,\n GoogleShoppingOptions,\n GoogleShoppingProductOptions,\n GoogleShoppingStoresOptions,\n GoogleFlightsOptions,\n GoogleHotelsOptions,\n GoogleHotelsDetailOptions,\n GoogleNewsOptions,\n GoogleTrendsOptions,\n GoogleTrendingOptions,\n} from \"./namespaces/google.js\";\nexport type {\n AmazonSearchOptions,\n AmazonProductOptions,\n} from \"./namespaces/amazon.js\";\nexport type {\n WalmartSearchOptions,\n WalmartProductOptions,\n} from \"./namespaces/walmart.js\";\nexport type {\n YouTubeSearchOptions,\n YouTubeMetadataOptions,\n} from \"./namespaces/youtube.js\";\nexport type {\n RedditSearchOptions,\n RedditPostOptions,\n} from \"./namespaces/reddit.js\";\nexport type {\n TikTokProfileOptions,\n TikTokUserPostsOptions,\n TikTokVideoOptions,\n TikTokVideoCommentsOptions,\n TikTokCommentRepliesOptions,\n TikTokSearchVideosOptions,\n TikTokSearchUsersOptions,\n TikTokHashtagOptions,\n TikTokHashtagVideosOptions,\n TikTokUserFollowersOptions,\n TikTokUserFollowingsOptions,\n} from \"./namespaces/tiktok.js\";\nexport type {\n InstagramProfileOptions,\n InstagramUserFeedOptions,\n InstagramStoriesOptions,\n InstagramPostOptions,\n InstagramPostCommentsOptions,\n InstagramCommentRepliesOptions,\n InstagramSearchOptions,\n InstagramFollowOptions,\n} from \"./namespaces/instagram.js\";\n","export class ScavioError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"ScavioError\";\n }\n}\n\nexport class MissingAPIKeyError extends ScavioError {\n constructor() {\n super(\n \"No API key provided. Pass apiKey or set the SCAVIO_API_KEY \" +\n \"environment variable. Get your free key at https://dashboard.scavio.dev\",\n );\n this.name = \"MissingAPIKeyError\";\n }\n}\n\n/** The request could not reach the API (DNS, connection reset, TLS, ...). */\nexport class ScavioConnectionError extends ScavioError {\n constructor(message = \"Connection error\") {\n super(message);\n this.name = \"ScavioConnectionError\";\n }\n}\n\n/** The request did not complete within the configured timeout. */\nexport class ScavioTimeoutError extends ScavioError {\n constructor(message = \"Request timed out\") {\n super(message);\n this.name = \"ScavioTimeoutError\";\n }\n}\n\nexport class InvalidAPIKeyError extends ScavioError {\n public readonly statusCode = 401;\n public readonly responseBody?: Record<string, unknown>;\n\n constructor(message = \"Invalid API key\", responseBody?: Record<string, unknown>) {\n super(message);\n this.name = \"InvalidAPIKeyError\";\n this.responseBody = responseBody;\n }\n}\n\nexport class InsufficientCreditsError extends ScavioError {\n public readonly statusCode = 402;\n public readonly responseBody?: Record<string, unknown>;\n\n constructor(message = \"Insufficient credits\", responseBody?: Record<string, unknown>) {\n super(message);\n this.name = \"InsufficientCreditsError\";\n this.responseBody = responseBody;\n }\n}\n\nexport class BadRequestError extends ScavioError {\n public readonly statusCode = 400;\n public readonly responseBody?: Record<string, unknown>;\n\n constructor(message = \"Bad request\", responseBody?: Record<string, unknown>) {\n super(message);\n this.name = \"BadRequestError\";\n this.responseBody = responseBody;\n }\n}\n\nexport class NotFoundError extends ScavioError {\n public readonly statusCode = 404;\n public readonly responseBody?: Record<string, unknown>;\n\n constructor(message = \"Not found\", responseBody?: Record<string, unknown>) {\n super(message);\n this.name = \"NotFoundError\";\n this.responseBody = responseBody;\n }\n}\n\nexport class RateLimitError extends ScavioError {\n public readonly statusCode = 429;\n public readonly responseBody?: Record<string, unknown>;\n\n constructor(message = \"Rate limit exceeded\", responseBody?: Record<string, unknown>) {\n super(message);\n this.name = \"RateLimitError\";\n this.responseBody = responseBody;\n }\n}\n\nexport class ScavioAPIError extends ScavioError {\n public readonly statusCode: number;\n public readonly responseBody?: Record<string, unknown>;\n\n constructor(\n statusCode: number,\n message: string,\n responseBody?: Record<string, unknown>,\n ) {\n super(`API error ${statusCode}: ${message}`);\n this.name = \"ScavioAPIError\";\n this.statusCode = statusCode;\n this.responseBody = responseBody;\n }\n}\n","/**\n * Retry policy: exponential backoff with full jitter and Retry-After support.\n * Mirrors the Python SDK's RetryConfig.\n */\n\n/** Statuses that are safe to retry: rate limiting plus transient upstream errors. */\nexport const DEFAULT_RETRY_STATUSES: ReadonlySet<number> = new Set([\n 429, 500, 502, 503, 504,\n]);\n\nexport interface RetryConfig {\n /** Additional attempts after the first request. 0 disables retries. */\n maxRetries: number;\n /** Base backoff in seconds; attempt n waits up to baseDelay * 2**n before jitter. */\n baseDelay: number;\n /** Upper bound (seconds) on any single backoff wait. */\n maxDelay: number;\n /** HTTP status codes that trigger a retry. */\n retryStatuses: ReadonlySet<number>;\n}\n\nexport function makeRetryConfig(maxRetries: number): RetryConfig {\n return {\n maxRetries,\n baseDelay: 0.5,\n maxDelay: 8.0,\n retryStatuses: DEFAULT_RETRY_STATUSES,\n };\n}\n\nexport function shouldRetryStatus(\n config: RetryConfig,\n statusCode: number,\n attempt: number,\n): boolean {\n return attempt < config.maxRetries && config.retryStatuses.has(statusCode);\n}\n\nexport function shouldRetryException(\n config: RetryConfig,\n attempt: number,\n): boolean {\n return attempt < config.maxRetries;\n}\n\n/**\n * Seconds to sleep before the next attempt. Honors a Retry-After value when\n * present; otherwise uses exponential backoff with full jitter.\n */\nexport function backoff(\n config: RetryConfig,\n attempt: number,\n retryAfter?: number,\n): number {\n if (retryAfter !== undefined) {\n return Math.min(Math.max(retryAfter, 0), config.maxDelay);\n }\n const capped = Math.min(config.maxDelay, config.baseDelay * 2 ** attempt);\n return Math.random() * capped;\n}\n\n/** Parse a Retry-After header (delta-seconds or HTTP-date) to seconds. */\nexport function parseRetryAfter(header: string | null): number | undefined {\n if (!header) return undefined;\n const trimmed = header.trim();\n const asNumber = Number(trimmed);\n if (!Number.isNaN(asNumber) && trimmed !== \"\") {\n return asNumber;\n }\n const asDate = Date.parse(trimmed);\n if (!Number.isNaN(asDate)) {\n return Math.max((asDate - Date.now()) / 1000, 0);\n }\n return undefined;\n}\n","import {\n BadRequestError,\n InsufficientCreditsError,\n InvalidAPIKeyError,\n NotFoundError,\n RateLimitError,\n ScavioAPIError,\n ScavioConnectionError,\n ScavioTimeoutError,\n} from \"./errors.js\";\nimport type { RateLimiter } from \"./rate-limiter.js\";\nimport {\n backoff,\n makeRetryConfig,\n parseRetryAfter,\n shouldRetryException,\n shouldRetryStatus,\n type RetryConfig,\n} from \"./retry.js\";\n\nexport const BASE_URL = \"https://api.scavio.dev\";\nexport const DEFAULT_TIMEOUT = 30_000;\nexport const DEFAULT_MAX_RETRIES = 2;\n\nfunction buildHeaders(apiKey: string): Record<string, string> {\n return {\n Authorization: `Bearer ${apiKey}`,\n \"Content-Type\": \"application/json\",\n \"X-Client-Source\": \"scavio-js\",\n };\n}\n\nfunction stripUndefined(\n obj: Record<string, unknown>,\n): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n for (const [key, value] of Object.entries(obj)) {\n if (value !== undefined) {\n result[key] = value;\n }\n }\n return result;\n}\n\nfunction handleError(statusCode: number, body: Record<string, unknown>): never {\n let error = body.error ?? \"Unknown error\";\n if (typeof error === \"object\" && error !== null && \"message\" in error) {\n error = (error as { message: string }).message;\n }\n const msg = String(error);\n const responseBody = Object.keys(body).length > 0 ? body : undefined;\n\n if (statusCode === 400) throw new BadRequestError(msg, responseBody);\n if (statusCode === 401) throw new InvalidAPIKeyError(msg, responseBody);\n if (statusCode === 402) throw new InsufficientCreditsError(msg, responseBody);\n if (statusCode === 404) throw new NotFoundError(msg, responseBody);\n if (statusCode === 429) throw new RateLimitError(msg, responseBody);\n throw new ScavioAPIError(statusCode, msg, responseBody);\n}\n\nfunction sleep(seconds: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, seconds * 1000));\n}\n\nfunction isAbortError(err: unknown): boolean {\n return (\n err instanceof Error &&\n (err.name === \"AbortError\" || err.name === \"TimeoutError\")\n );\n}\n\nfunction getHeader(response: Response, name: string): string | null {\n const headers = response.headers;\n if (headers && typeof headers.get === \"function\") {\n return headers.get(name);\n }\n return null;\n}\n\nexport async function request(options: {\n method: \"GET\" | \"POST\";\n path: string;\n apiKey: string;\n baseUrl: string;\n timeout: number;\n rateLimiter: RateLimiter;\n body?: Record<string, unknown>;\n maxRetries?: number;\n}): Promise<Record<string, unknown>> {\n const url = `${options.baseUrl}${options.path}`;\n const headers = buildHeaders(options.apiKey);\n const retry: RetryConfig = makeRetryConfig(\n options.maxRetries ?? DEFAULT_MAX_RETRIES,\n );\n\n let attempt = 0;\n\n for (;;) {\n await options.rateLimiter.wait();\n\n const controller = new AbortController();\n const timeoutId = setTimeout(() => controller.abort(), options.timeout);\n\n let response: Response;\n try {\n const fetchOptions: RequestInit = {\n method: options.method,\n headers,\n signal: controller.signal,\n };\n\n if (options.method === \"POST\" && options.body) {\n fetchOptions.body = JSON.stringify(stripUndefined(options.body));\n }\n\n response = await fetch(url, fetchOptions);\n } catch (err) {\n clearTimeout(timeoutId);\n const timedOut = isAbortError(err);\n if (shouldRetryException(retry, attempt)) {\n await sleep(backoff(retry, attempt));\n attempt += 1;\n continue;\n }\n const msg = err instanceof Error ? err.message : String(err);\n if (timedOut) {\n throw new ScavioTimeoutError(msg);\n }\n throw new ScavioConnectionError(msg);\n } finally {\n clearTimeout(timeoutId);\n }\n\n if (response.ok) {\n return (await response.json()) as Record<string, unknown>;\n }\n\n if (shouldRetryStatus(retry, response.status, attempt)) {\n const retryAfter = parseRetryAfter(getHeader(response, \"Retry-After\"));\n await sleep(backoff(retry, attempt, retryAfter));\n attempt += 1;\n continue;\n }\n\n let body: Record<string, unknown> = {};\n try {\n body = (await response.json()) as Record<string, unknown>;\n } catch {\n // ignore parse failures\n }\n handleError(response.status, body);\n }\n}\n","export class RateLimiter {\n private readonly maxPerSecond: number;\n private readonly timestamps: number[] = [];\n private pending: Promise<void> = Promise.resolve();\n\n constructor(maxPerSecond: number) {\n this.maxPerSecond = maxPerSecond;\n }\n\n async wait(): Promise<void> {\n const ticket = this.pending.then(() => this.acquire());\n this.pending = ticket;\n return ticket;\n }\n\n private async acquire(): Promise<void> {\n this.cleanup();\n if (this.timestamps.length >= this.maxPerSecond) {\n const sleepMs = 1000 - (Date.now() - this.timestamps[0]!);\n if (sleepMs > 0) {\n await new Promise<void>((resolve) => setTimeout(resolve, sleepMs));\n }\n this.cleanup();\n }\n this.timestamps.push(Date.now());\n }\n\n private cleanup(): void {\n const now = Date.now();\n while (this.timestamps.length > 0 && now - this.timestamps[0]! >= 1000) {\n this.timestamps.shift();\n }\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface AmazonSearchOptions {\n /** Product search query (1-500 characters). */\n query: string;\n /** Amazon domain suffix (default 'com', e.g. 'co.uk'). */\n domain?: string;\n /** Country code for localization. */\n country?: string;\n /** Language code. */\n language?: string;\n /** Currency code (ISO 4217, e.g. 'USD'). */\n currency?: string;\n /** Device to emulate. */\n device?: \"desktop\" | \"mobile\" | \"tablet\";\n /** Result sort order. */\n sort_by?:\n | \"most_recent\"\n | \"price_low_to_high\"\n | \"price_high_to_low\"\n | \"featured\"\n | \"average_review\"\n | \"bestsellers\";\n /** Starting page (1-indexed). */\n start_page?: number;\n /** Number of pages to fetch. */\n pages?: number;\n /** Amazon category id. */\n category_id?: string;\n /** Filter to a specific merchant. */\n merchant_id?: string;\n /** ZIP/postal code for localized pricing. */\n zip_code?: string;\n /** Auto-select the default variant. */\n autoselect_variant?: boolean;\n [key: string]: unknown;\n}\n\nexport interface AmazonProductOptions {\n /** Amazon ASIN (e.g. 'B09XS7JWHH'). Sent to the API as 'query'. */\n asin: string;\n /** Amazon domain suffix (default 'com'). */\n domain?: string;\n /** Country code for localization. */\n country?: string;\n /** Language code. */\n language?: string;\n /** Currency code (ISO 4217, e.g. 'USD'). */\n currency?: string;\n /** Device to emulate. */\n device?: \"desktop\" | \"mobile\" | \"tablet\";\n /** ZIP/postal code for localized pricing. */\n zip_code?: string;\n /** Auto-select the default variant. */\n autoselect_variant?: boolean;\n [key: string]: unknown;\n}\n\nexport class AmazonNamespace {\n constructor(private client: Scavio) {}\n\n async search(\n options: AmazonSearchOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/amazon/search\", options);\n }\n\n async product(\n options: AmazonProductOptions,\n ): Promise<Record<string, unknown>> {\n const { asin, ...rest } = options;\n return this.client._post(\"/api/v1/amazon/product\", {\n query: asin,\n ...rest,\n });\n }\n\n /** Supported Amazon domains, languages, currencies, and countries. */\n async options(): Promise<Record<string, unknown>> {\n return this.client._get(\"/api/v1/amazon/options\");\n }\n}\n","import type { Scavio } from \"../client.js\";\n\n/**\n * Google endpoints (scrape.do engine, /api/v2/google). A faithful passthrough\n * that returns Google's full response. Every endpoint costs 1 credit. Any\n * additional scrape.do parameter can be added to the options object.\n * See https://scavio.dev/docs/search-api.\n */\n\nexport interface GoogleSearchOptions {\n /** Search query (1-500 characters). */\n query: string;\n /** Device to emulate. */\n device?: \"desktop\" | \"mobile\";\n /** Result offset: 0 = page 1, 10 = page 2, ... up to 990. */\n start?: number;\n /** Include the raw Google HTML in the response. */\n include_html?: boolean;\n /** UI language (ISO 639-1, e.g. 'en'). */\n hl?: string;\n /** Country of the search (ISO 3166-1 alpha-2, e.g. 'us'). */\n gl?: string;\n /** Regional Google domain (e.g. 'google.co.uk'). */\n google_domain?: string;\n /** Canonical location name; auto-encoded to a UULE string. */\n location?: string;\n /** Pre-encoded UULE location string (takes priority over location). */\n uule?: string;\n /** Language restrict (e.g. 'lang_en'). */\n lr?: string;\n /** Country restrict (e.g. 'countryUS'). */\n cr?: string;\n /** SafeSearch filter. */\n safe?: \"active\";\n /** Disable spelling correction / auto-fixes when true. */\n nfpr?: boolean;\n /** '0' disables the omitted/similar-results filter. */\n filter?: \"0\" | \"1\";\n /** Restrict results to a recent time window. */\n time_period?:\n | \"last_hour\"\n | \"last_day\"\n | \"last_week\"\n | \"last_month\"\n | \"last_year\";\n /** Resolve a deferred AI Overview (server default true). */\n resolve_ai_overview?: boolean;\n [key: string]: unknown;\n}\n\nexport interface GoogleAiModeOptions {\n /** Question or prompt (1-500 characters). */\n query: string;\n /** Device to emulate. */\n device?: \"desktop\" | \"mobile\";\n /** Include the raw Google HTML in the response. */\n include_html?: boolean;\n /** UI language (ISO 639-1, e.g. 'en'). */\n hl?: string;\n /** Country of the search (ISO 3166-1 alpha-2, e.g. 'us'). */\n gl?: string;\n /** Regional Google domain (e.g. 'google.co.uk'). */\n google_domain?: string;\n /** Canonical location name; auto-encoded to a UULE string. */\n location?: string;\n /** Pre-encoded UULE location string (takes priority over location). */\n uule?: string;\n /** SafeSearch filter. */\n safe?: \"active\";\n [key: string]: unknown;\n}\n\nexport interface GoogleMapsSearchOptions {\n /** Search query (1-500 characters). */\n query: string;\n /** Result offset; must be a multiple of 20 (0, 20, 40, ...). */\n start?: number;\n /** Map center as '@lat,lng,zoomz'; controls where results come from. */\n ll?: string;\n /** UI language (ISO 639-1, e.g. 'en'). */\n hl?: string;\n /** Country of the search (ISO 3166-1 alpha-2, e.g. 'us'). */\n gl?: string;\n /** Regional Google domain (e.g. 'google.co.uk'). */\n google_domain?: string;\n [key: string]: unknown;\n}\n\nexport interface GoogleMapsPlaceOptions {\n /** Place ID (ChIJ...). */\n place_id?: string;\n /** Numeric CID. */\n data_cid?: string;\n [key: string]: unknown;\n}\n\nexport interface GoogleMapsReviewsOptions {\n /** Data ID (0xHEX:0xHEX). */\n data_id?: string;\n /** Place ID (ChIJ...). */\n place_id?: string;\n /** Reviews per page (1-20). */\n num?: number;\n /** Pagination cursor from a prior response. */\n next_page_token?: string;\n /** Sort order. */\n sort_by?: \"relevance\" | \"newest\" | \"highest_rating\" | \"lowest_rating\";\n /** UI language (ISO 639-1, e.g. 'en'). */\n hl?: string;\n /** Country of the search (ISO 3166-1 alpha-2, e.g. 'us'). */\n gl?: string;\n /** Regional Google domain (e.g. 'google.co.uk'). */\n google_domain?: string;\n [key: string]: unknown;\n}\n\nexport interface GoogleShoppingOptions {\n /** Product search query (1-500 characters). */\n query: string;\n /** Device to emulate. */\n device?: \"desktop\" | \"mobile\";\n /** Result offset. */\n start?: number;\n /** Minimum price filter. */\n min_price?: number;\n /** Maximum price filter. */\n max_price?: number;\n /** 0 = relevance, 1 = price ascending, 2 = price descending. */\n sort_by?: number;\n /** Only items with free shipping. */\n free_shipping?: boolean;\n /** Only items on sale. */\n on_sale?: boolean;\n /** Opaque Google Shopping filter token. */\n shoprs?: string;\n /** UI language (ISO 639-1, e.g. 'en'). */\n hl?: string;\n /** Country of the search (ISO 3166-1 alpha-2, e.g. 'us'). */\n gl?: string;\n /** Regional Google domain (e.g. 'google.co.uk'). */\n google_domain?: string;\n /** Canonical location name; auto-encoded to a UULE string. */\n location?: string;\n /** Pre-encoded UULE location string (takes priority over location). */\n uule?: string;\n [key: string]: unknown;\n}\n\nexport interface GoogleShoppingProductOptions {\n /** Durable product catalog id. */\n catalog_id?: string;\n /** Product query; required when catalog_id is set. */\n query?: string;\n /** Immersive product page token. */\n immersive_product_page_token?: string;\n /** Alias for immersive_product_page_token. */\n page_token?: string;\n /** Product id. */\n product_id?: string;\n /** Device to emulate. */\n device?: \"desktop\" | \"mobile\" | \"tablet\";\n /** Regional Google domain (e.g. 'google.co.uk'). */\n google_domain?: string;\n /** Seller sort order. */\n sort_by?: \"base_price\" | \"total_price\" | \"promotion\" | \"seller_rating\";\n /** Load all available stores. */\n load_all_stores?: boolean;\n /** Fetch additional stores. */\n more_stores?: boolean;\n /** UI language (ISO 639-1, e.g. 'en'). */\n hl?: string;\n /** Country of the search (ISO 3166-1 alpha-2, e.g. 'us'). */\n gl?: string;\n /** Canonical location name; auto-encoded to a UULE string. */\n location?: string;\n /** Pre-encoded UULE location string (takes priority over location). */\n uule?: string;\n [key: string]: unknown;\n}\n\nexport interface GoogleShoppingStoresOptions {\n /** Durable product catalog id. */\n catalog_id: string;\n /** Pagination cursor from shopping_product. */\n next_page_token: string;\n [key: string]: unknown;\n}\n\nexport interface GoogleFlightsOptions {\n /** Departure IATA code(s); comma-separated allowed. */\n departure_id: string;\n /** Arrival IATA code(s); comma-separated allowed. */\n arrival_id: string;\n /** Outbound date (YYYY-MM-DD). */\n outbound_date: string;\n /** 1 = round trip, 2 = one way, 3 = multi-city. */\n type?: number;\n /** Return date (YYYY-MM-DD); required when type=1. */\n return_date?: string;\n /** Number of adults (1-9). */\n adults?: number;\n /** Number of children (0-9). */\n children?: number;\n /** Infants in seat (0-4). */\n infants_in_seat?: number;\n /** Infants on lap (0-4). */\n infants_on_lap?: number;\n /** 1 = economy, 2 = premium, 3 = business, 4 = first. */\n travel_class?: number;\n /** 0 = any, 1 = nonstop, 2 = <=1 stop, 3 = <=2 stops. */\n stops?: number;\n /** 1 = top, 2 = price, 3 = departure, 4 = arrival, 5 = duration, 6 = emissions. */\n sort_by?: number;\n /** Comma-separated airline codes/alliances to include. */\n include_airlines?: string;\n /** Comma-separated airline codes/alliances to exclude. */\n exclude_airlines?: string;\n /** UI language (ISO 639-1, e.g. 'en'). */\n hl?: string;\n /** Country of the search (ISO 3166-1 alpha-2, e.g. 'us'). */\n gl?: string;\n /** Currency code (ISO 4217, e.g. 'USD'). */\n currency?: string;\n [key: string]: unknown;\n}\n\nexport interface GoogleHotelsOptions {\n /** Search query; use a '<City> hotels' form. */\n query: string;\n /** Check-in date (YYYY-MM-DD). */\n check_in_date: string;\n /** Check-out date (YYYY-MM-DD). */\n check_out_date: string;\n /** UI language (ISO 639-1, e.g. 'en'). */\n hl?: string;\n /** Country of the search (ISO 3166-1 alpha-2, e.g. 'us'). */\n gl?: string;\n /** Currency code (ISO 4217, e.g. 'USD'). */\n currency?: string;\n /** 3 = lowest price, 8 = highest rating, 13 = most reviewed. */\n sort_by?: number;\n /** Minimum nightly price. */\n min_price?: number;\n /** Maximum nightly price. */\n max_price?: number;\n /** 7 = 3.5+, 8 = 4.0+, 9 = 4.5+. */\n rating?: number;\n /** Comma-separated star ratings (2-5). */\n hotel_class?: string;\n /** Comma-separated amenity ids. */\n amenities?: string;\n /** Comma-separated property-type ids (e.g. '12' for vacation rentals). */\n property_types?: string;\n /** Only properties with free cancellation. */\n free_cancellation?: boolean;\n /** Only eco-certified properties. */\n eco_certified?: boolean;\n /** Only properties with special offers. */\n special_offers?: boolean;\n /** Pagination cursor from a prior response. */\n next_page_token?: string;\n /** Number of properties to return (1-20). */\n limit?: number;\n [key: string]: unknown;\n}\n\nexport interface GoogleHotelsDetailOptions {\n /** Property detail token from a hotels listing. */\n detail_token: string;\n /** Check-in date (YYYY-MM-DD). */\n check_in_date: string;\n /** Check-out date (YYYY-MM-DD). */\n check_out_date: string;\n /** Currency code (ISO 4217, e.g. 'USD'). */\n currency?: string;\n /** Country of the search (ISO 3166-1 alpha-2, e.g. 'us'). */\n gl?: string;\n /** UI language (ISO 639-1, e.g. 'en'). */\n hl?: string;\n [key: string]: unknown;\n}\n\nexport interface GoogleNewsOptions {\n /** Keyword search. */\n query?: string;\n /** Browse a news topic. */\n topic_token?: string;\n /** Browse a topic section. */\n section_token?: string;\n /** Fetch full coverage of a story. */\n story_token?: string;\n /** Browse a publication. */\n publication_token?: string;\n /** Knowledge Graph entity id. */\n kgmid?: string;\n /** UI language (ISO 639-1, e.g. 'en'). */\n hl?: string;\n /** Country of the search (ISO 3166-1 alpha-2, e.g. 'us'). */\n gl?: string;\n /** Regional Google domain (e.g. 'google.co.uk'). */\n google_domain?: string;\n /** Sort order: 0 = relevance, 1 = date (only with query or kgmid). */\n so?: number;\n [key: string]: unknown;\n}\n\nexport interface GoogleTrendsOptions {\n /** Search term(s); comma-separated for comparisons. */\n query: string;\n /** Location code (e.g. 'US', 'GB', 'US-CA'). */\n geo?: string;\n /** UI language (ISO 639-1, e.g. 'en'). */\n hl?: string;\n /** Time range (e.g. 'today 12-m', 'now 7-d'). */\n date?: string;\n /** Timezone offset in minutes. */\n tz?: string;\n /** Which trends dataset to return. */\n data_type?:\n | \"TIMESERIES\"\n | \"GEO_MAP\"\n | \"GEO_MAP_0\"\n | \"RELATED_QUERIES\"\n | \"RELATED_TOPICS\";\n /** Category id. */\n cat?: string;\n /** Google property filter. */\n gprop?: \"images\" | \"news\" | \"youtube\" | \"froogle\";\n /** Resolution for GEO_MAP data. */\n region?: \"COUNTRY\" | \"REGION\" | \"DMA\" | \"CITY\";\n [key: string]: unknown;\n}\n\nexport interface GoogleTrendingOptions {\n /** Country code (e.g. 'US'). */\n geo: string;\n /** UI language (ISO 639-1, e.g. 'en'). */\n hl?: string;\n /** Trending window: 4, 24, 48, or 168. */\n hours?: number;\n /** Category id (0-20). */\n cat?: number;\n /** Sort order. */\n sort?: \"relevance\" | \"search_volume\" | \"recency\" | \"title\";\n /** Filter by trend status. */\n status?: \"all\" | \"active\";\n [key: string]: unknown;\n}\n\nexport class GoogleNamespace {\n constructor(private client: Scavio) {}\n\n /** Google SERP search (includes the AI Overview when Google returns one). */\n async search(options: GoogleSearchOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google\", options);\n }\n\n /** Google AI Mode answer. */\n async aiMode(options: GoogleAiModeOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/ai-mode\", options);\n }\n\n /** Google Maps local results. */\n async mapsSearch(options: GoogleMapsSearchOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/maps/search\", options);\n }\n\n /** Google Maps place details. Provide place_id or data_cid. */\n async mapsPlace(options: GoogleMapsPlaceOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/maps/place\", options);\n }\n\n /** Google Maps reviews. Provide data_id or place_id. */\n async mapsReviews(options: GoogleMapsReviewsOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/maps/reviews\", options);\n }\n\n /** Google Shopping search results. */\n async shopping(options: GoogleShoppingOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/shopping\", options);\n }\n\n /** Google Shopping product. Pass catalog_id + query for full details and sellers. */\n async shoppingProduct(\n options: GoogleShoppingProductOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/shopping/product\", options);\n }\n\n /** Google Shopping product sellers (continuation of shoppingProduct). */\n async shoppingStores(\n options: GoogleShoppingStoresOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/shopping/product/stores\", options);\n }\n\n /** Google Flights. */\n async flights(options: GoogleFlightsOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/flights\", options);\n }\n\n /** Google Hotels search. */\n async hotels(options: GoogleHotelsOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/hotels\", options);\n }\n\n /** Google Hotels property details (from a hotels listing detail_token). */\n async hotelsDetail(\n options: GoogleHotelsDetailOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/hotels/detail\", options);\n }\n\n /** Google News. Provide query or a topic/story/publication token. */\n async news(options: GoogleNewsOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/news\", options);\n }\n\n /** Google Trends data. */\n async trends(options: GoogleTrendsOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/trends\", options);\n }\n\n /** Google Trending Now for a country. */\n async trending(options: GoogleTrendingOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v2/google/trending\", options);\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface RedditSearchOptions {\n /** Search query (1-500 characters). */\n query: string;\n /** Result type (server default 'posts'). */\n type?: \"posts\" | \"comments\";\n /** Sort order (server default 'new'). */\n sort?: \"new\" | \"relevance\" | \"hot\" | \"top\" | \"comments\";\n /** Pagination cursor from a prior response. */\n cursor?: string;\n [key: string]: unknown;\n}\n\nexport interface RedditPostOptions {\n /** Full Reddit post URL. */\n url: string;\n [key: string]: unknown;\n}\n\nexport class RedditNamespace {\n constructor(private client: Scavio) {}\n\n async search(\n options: RedditSearchOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/reddit/search\", options);\n }\n\n async post(options: RedditPostOptions): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/reddit/post\", options);\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface TikTokProfileOptions {\n /** TikTok @username (without the @). */\n username?: string;\n /** TikTok sec_user_id. */\n sec_user_id?: string;\n [key: string]: unknown;\n}\n\nexport interface TikTokUserPostsOptions {\n /** TikTok sec_user_id. */\n sec_user_id: string;\n /** Pagination cursor (default '0'). */\n cursor?: string;\n /** Results per page (1-30). */\n count?: number;\n /** '0' = latest, '1' = popular. */\n sort_type?: \"0\" | \"1\";\n [key: string]: unknown;\n}\n\nexport interface TikTokVideoOptions {\n /** TikTok video id. */\n video_id: string;\n [key: string]: unknown;\n}\n\nexport interface TikTokVideoCommentsOptions {\n /** TikTok video id. */\n video_id: string;\n /** Pagination cursor (default '0'). */\n cursor?: string;\n /** Results per page (1-50). */\n count?: number;\n [key: string]: unknown;\n}\n\nexport interface TikTokCommentRepliesOptions {\n /** TikTok video id. */\n video_id: string;\n /** Parent comment id. */\n comment_id: string;\n /** Pagination cursor (default '0'). */\n cursor?: string;\n /** Results per page (1-50). */\n count?: number;\n [key: string]: unknown;\n}\n\nexport interface TikTokSearchVideosOptions {\n /** Search keyword (1-500 characters). */\n keyword: string;\n /** Pagination cursor (default '0'). */\n cursor?: string;\n /** Results per page (1-30). */\n count?: number;\n /** '0' = relevance, '1' = most likes. */\n sort_type?: \"0\" | \"1\";\n /** Age filter in days: 0 = all time, 1, 7, 30, 90, 180. */\n publish_time?: \"0\" | \"1\" | \"7\" | \"30\" | \"90\" | \"180\";\n [key: string]: unknown;\n}\n\nexport interface TikTokSearchUsersOptions {\n /** Search keyword (1-500 characters). */\n keyword: string;\n /** Pagination cursor (default '0'). */\n cursor?: string;\n /** Results per page (1-30). */\n count?: number;\n [key: string]: unknown;\n}\n\nexport interface TikTokHashtagOptions {\n /** Hashtag name (without the #). */\n hashtag_name?: string;\n /** Hashtag id. */\n hashtag_id?: string;\n [key: string]: unknown;\n}\n\nexport interface TikTokHashtagVideosOptions {\n /** Hashtag id. */\n hashtag_id: string;\n /** Pagination cursor (default '0'). */\n cursor?: string;\n /** Results per page (1-30). */\n count?: number;\n [key: string]: unknown;\n}\n\nexport interface TikTokUserFollowersOptions {\n /** TikTok sec_user_id. */\n sec_user_id: string;\n /** Results per page (1-20). */\n count?: number;\n /** Pagination token from a prior response. */\n page_token?: string;\n /** Minimum timestamp cursor. */\n min_time?: number;\n [key: string]: unknown;\n}\n\nexport interface TikTokUserFollowingsOptions {\n /** TikTok sec_user_id. */\n sec_user_id: string;\n /** Results per page (1-20). */\n count?: number;\n /** Pagination token from a prior response. */\n page_token?: string;\n /** Minimum timestamp cursor. */\n min_time?: number;\n [key: string]: unknown;\n}\n\nexport class TikTokNamespace {\n constructor(private client: Scavio) {}\n\n async profile(\n options: TikTokProfileOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/profile\", options);\n }\n\n async userPosts(\n options: TikTokUserPostsOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/user/posts\", options);\n }\n\n async video(\n options: TikTokVideoOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/video\", options);\n }\n\n async videoComments(\n options: TikTokVideoCommentsOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/video/comments\", options);\n }\n\n async commentReplies(\n options: TikTokCommentRepliesOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/video/comments/replies\", options);\n }\n\n async searchVideos(\n options: TikTokSearchVideosOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/search/videos\", options);\n }\n\n async searchUsers(\n options: TikTokSearchUsersOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/search/users\", options);\n }\n\n async hashtag(\n options: TikTokHashtagOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/hashtag\", options);\n }\n\n async hashtagVideos(\n options: TikTokHashtagVideosOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/hashtag/videos\", options);\n }\n\n async userFollowers(\n options: TikTokUserFollowersOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/user/followers\", options);\n }\n\n async userFollowings(\n options: TikTokUserFollowingsOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/tiktok/user/followings\", options);\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface InstagramProfileOptions {\n /** Instagram username (without the @). */\n username?: string;\n /** Instagram numeric user id. */\n user_id?: string;\n [key: string]: unknown;\n}\n\nexport interface InstagramUserFeedOptions {\n /** Instagram username (without the @). */\n username?: string;\n /** Instagram numeric user id. */\n user_id?: string;\n /** Results per page (1-50). */\n count?: number;\n /** Pagination cursor from a prior response. */\n cursor?: string;\n [key: string]: unknown;\n}\n\nexport interface InstagramStoriesOptions {\n /** Instagram username (without the @). */\n username?: string;\n /** Instagram numeric user id. */\n user_id?: string;\n [key: string]: unknown;\n}\n\nexport interface InstagramPostOptions {\n /** Full Instagram post URL. */\n url?: string;\n /** Instagram media id. */\n media_id?: string;\n /** Instagram shortcode (from the post URL). */\n shortcode?: string;\n [key: string]: unknown;\n}\n\nexport interface InstagramPostCommentsOptions {\n /** Instagram shortcode (from the post URL). */\n shortcode?: string;\n /** Full Instagram post URL. */\n url?: string;\n /** Pagination cursor from a prior response. */\n cursor?: string;\n /** Comment sort order. */\n sort_order?: \"popular\" | \"newest\";\n [key: string]: unknown;\n}\n\nexport interface InstagramCommentRepliesOptions {\n /** Instagram media id. */\n media_id: string;\n /** Parent comment id. */\n comment_id: string;\n /** Pagination cursor from a prior response. */\n cursor?: string;\n [key: string]: unknown;\n}\n\nexport interface InstagramSearchOptions {\n /** Search keyword (1-500 characters). */\n keyword: string;\n /** Pagination cursor from a prior response. */\n cursor?: string;\n [key: string]: unknown;\n}\n\nexport interface InstagramFollowOptions {\n /** Instagram username (without the @). */\n username?: string;\n /** Instagram numeric user id. */\n user_id?: string;\n /** Results per page (1-100). */\n count?: number;\n /** Pagination cursor from a prior response. */\n cursor?: string;\n [key: string]: unknown;\n}\n\nexport class InstagramNamespace {\n constructor(private client: Scavio) {}\n\n async profile(\n options: InstagramProfileOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/profile\", options);\n }\n\n async userPosts(\n options: InstagramUserFeedOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/user/posts\", options);\n }\n\n async userReels(\n options: InstagramUserFeedOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/user/reels\", options);\n }\n\n async userTagged(\n options: InstagramUserFeedOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/user/tagged\", options);\n }\n\n async userStories(\n options: InstagramStoriesOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/user/stories\", options);\n }\n\n async post(\n options: InstagramPostOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/post\", options);\n }\n\n async postComments(\n options: InstagramPostCommentsOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/post/comments\", options);\n }\n\n async commentReplies(\n options: InstagramCommentRepliesOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/post/comments/replies\", options);\n }\n\n async searchUsers(\n options: InstagramSearchOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/search/users\", options);\n }\n\n async searchHashtags(\n options: InstagramSearchOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/search/hashtags\", options);\n }\n\n async userFollowers(\n options: InstagramFollowOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/user/followers\", options);\n }\n\n async userFollowings(\n options: InstagramFollowOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/instagram/user/followings\", options);\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface WalmartSearchOptions {\n /** Product search query (1-500 characters). */\n query: string;\n /** Walmart domain. */\n domain?: string;\n /** Device to emulate. */\n device?: \"desktop\" | \"mobile\" | \"tablet\";\n /** Result sort order. */\n sort_by?: \"best_match\" | \"price_low\" | \"price_high\" | \"best_seller\";\n /** Starting page (1-indexed). */\n start_page?: number;\n /** Minimum price filter (USD). */\n min_price?: number;\n /** Maximum price filter (USD). */\n max_price?: number;\n /** Delivery speed filter. */\n fulfillment_speed?: \"today\" | \"tomorrow\" | \"2_days\" | \"anytime\";\n /** Fulfillment type filter. */\n fulfillment_type?: \"in_store\";\n /** ZIP code for localized results. */\n delivery_zip?: string;\n /** Store id for in-store availability. */\n store_id?: string;\n [key: string]: unknown;\n}\n\nexport interface WalmartProductOptions {\n /** Walmart product id. */\n product_id: string;\n /** Walmart domain. */\n domain?: string;\n /** Device to emulate. */\n device?: \"desktop\" | \"mobile\" | \"tablet\";\n /** ZIP code for localized pricing. */\n delivery_zip?: string;\n /** Store id for in-store availability. */\n store_id?: string;\n [key: string]: unknown;\n}\n\nexport class WalmartNamespace {\n constructor(private client: Scavio) {}\n\n async search(\n options: WalmartSearchOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/walmart/search\", options);\n }\n\n async product(\n options: WalmartProductOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/walmart/product\", options);\n }\n}\n","import type { Scavio } from \"../client.js\";\n\nexport interface YouTubeSearchOptions {\n /** Search query (1-500 characters). Sent to the API as 'search'. */\n query: string;\n /** Filter by upload date. */\n upload_date?: \"last_hour\" | \"today\" | \"this_week\" | \"this_month\" | \"this_year\";\n /** Filter by result type. */\n type?: \"video\" | \"channel\" | \"playlist\";\n /** short (<4 min), medium (4-20 min), long (>20 min). */\n duration?: \"short\" | \"medium\" | \"long\";\n /** Sort order. */\n sort_by?: \"relevance\" | \"date\" | \"view_count\" | \"rating\";\n /** HD videos only. */\n hd?: boolean;\n /** Videos with subtitles/CC only. */\n subtitles?: boolean;\n /** Creative Commons licensed only. */\n creative_commons?: boolean;\n /** Live videos only. */\n live?: boolean;\n /** HDR videos only. */\n hdr?: boolean;\n /** Videos with location metadata only. */\n location?: boolean;\n /** VR180 videos only. */\n vr180?: boolean;\n /** 4K videos only. Sent to the API as '4k'. */\n fourK?: boolean;\n /** 360-degree videos only. Sent to the API as '360'. */\n video_360?: boolean;\n /** 3D videos only. Sent to the API as '3d'. */\n video_3d?: boolean;\n [key: string]: unknown;\n}\n\nexport interface YouTubeMetadataOptions {\n /** YouTube video id (e.g. 'dQw4w9WgXcQ'). */\n video_id: string;\n [key: string]: unknown;\n}\n\nexport class YouTubeNamespace {\n constructor(private client: Scavio) {}\n\n async search(\n options: YouTubeSearchOptions,\n ): Promise<Record<string, unknown>> {\n const { query, fourK, video_360, video_3d, ...rest } = options;\n const body: Record<string, unknown> = {\n search: query,\n ...rest,\n };\n if (fourK !== undefined) body[\"4k\"] = fourK;\n if (video_360 !== undefined) body[\"360\"] = video_360;\n if (video_3d !== undefined) body[\"3d\"] = video_3d;\n return this.client._post(\"/api/v1/youtube/search\", body);\n }\n\n async metadata(\n options: YouTubeMetadataOptions,\n ): Promise<Record<string, unknown>> {\n return this.client._post(\"/api/v1/youtube/metadata\", options);\n }\n}\n","import { MissingAPIKeyError, ScavioError } from \"./errors.js\";\nimport { BASE_URL, DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT, request } from \"./http.js\";\nimport { RateLimiter } from \"./rate-limiter.js\";\nimport { AmazonNamespace } from \"./namespaces/amazon.js\";\nimport type { GoogleSearchOptions } from \"./namespaces/google.js\";\nimport { GoogleNamespace } from \"./namespaces/google.js\";\nimport { RedditNamespace } from \"./namespaces/reddit.js\";\nimport { TikTokNamespace } from \"./namespaces/tiktok.js\";\nimport { InstagramNamespace } from \"./namespaces/instagram.js\";\nimport { WalmartNamespace } from \"./namespaces/walmart.js\";\nimport { YouTubeNamespace } from \"./namespaces/youtube.js\";\n\nexport interface ScavioConfig {\n apiKey?: string;\n baseUrl?: string;\n timeout?: number;\n maxRequestsPerSecond?: number;\n /**\n * Additional retry attempts after the first request on transient failures\n * (HTTP 429/500/502/503/504 and network/timeout errors). Defaults to 2.\n * Set to 0 to disable retries.\n */\n maxRetries?: number;\n}\n\nexport class Scavio {\n readonly google: GoogleNamespace;\n readonly amazon: AmazonNamespace;\n readonly walmart: WalmartNamespace;\n readonly youtube: YouTubeNamespace;\n readonly reddit: RedditNamespace;\n readonly tiktok: TikTokNamespace;\n readonly instagram: InstagramNamespace;\n\n private readonly apiKey: string;\n private readonly baseUrl: string;\n private readonly timeout: number;\n private readonly maxRetries: number;\n private readonly rateLimiter: RateLimiter;\n\n constructor(config?: ScavioConfig) {\n this.apiKey = config?.apiKey ?? process.env.SCAVIO_API_KEY ?? \"\";\n if (!this.apiKey) {\n throw new MissingAPIKeyError();\n }\n\n this.baseUrl = (config?.baseUrl ?? BASE_URL).replace(/\\/+$/, \"\");\n this.timeout = config?.timeout ?? DEFAULT_TIMEOUT;\n this.maxRetries = config?.maxRetries ?? DEFAULT_MAX_RETRIES;\n\n const rps = config?.maxRequestsPerSecond ?? 1;\n if (rps < 1 || rps > 10) {\n throw new ScavioError(\"maxRequestsPerSecond must be between 1 and 10\");\n }\n this.rateLimiter = new RateLimiter(rps);\n\n this.google = new GoogleNamespace(this);\n this.amazon = new AmazonNamespace(this);\n this.walmart = new WalmartNamespace(this);\n this.youtube = new YouTubeNamespace(this);\n this.reddit = new RedditNamespace(this);\n this.tiktok = new TikTokNamespace(this);\n this.instagram = new InstagramNamespace(this);\n }\n\n /** @internal */\n async _post(\n path: string,\n body: object,\n ): Promise<Record<string, unknown>> {\n return request({\n method: \"POST\",\n path,\n apiKey: this.apiKey,\n baseUrl: this.baseUrl,\n timeout: this.timeout,\n maxRetries: this.maxRetries,\n rateLimiter: this.rateLimiter,\n body: body as Record<string, unknown>,\n });\n }\n\n /** @internal */\n async _get(path: string): Promise<Record<string, unknown>> {\n return request({\n method: \"GET\",\n path,\n apiKey: this.apiKey,\n baseUrl: this.baseUrl,\n timeout: this.timeout,\n maxRetries: this.maxRetries,\n rateLimiter: this.rateLimiter,\n });\n }\n\n async search(\n options: GoogleSearchOptions,\n ): Promise<Record<string, unknown>> {\n return this.google.search(options);\n }\n\n async getUsage(): Promise<Record<string, unknown>> {\n return this._get(\"/api/v1/usage\");\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,cAAN,cAA0B,MAAM;AAAA,EACrC,YAAY,SAAiB;AAC3B,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,qBAAN,cAAiC,YAAY;AAAA,EAClD,cAAc;AACZ;AAAA,MACE;AAAA,IAEF;AACA,SAAK,OAAO;AAAA,EACd;AACF;AAGO,IAAM,wBAAN,cAAoC,YAAY;AAAA,EACrD,YAAY,UAAU,oBAAoB;AACxC,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAGO,IAAM,qBAAN,cAAiC,YAAY;AAAA,EAClD,YAAY,UAAU,qBAAqB;AACzC,UAAM,OAAO;AACb,SAAK,OAAO;AAAA,EACd;AACF;AAEO,IAAM,qBAAN,cAAiC,YAAY;AAAA,EAClC,aAAa;AAAA,EACb;AAAA,EAEhB,YAAY,UAAU,mBAAmB,cAAwC;AAC/E,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,eAAe;AAAA,EACtB;AACF;AAEO,IAAM,2BAAN,cAAuC,YAAY;AAAA,EACxC,aAAa;AAAA,EACb;AAAA,EAEhB,YAAY,UAAU,wBAAwB,cAAwC;AACpF,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,eAAe;AAAA,EACtB;AACF;AAEO,IAAM,kBAAN,cAA8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