scavio 0.15.0 → 0.18.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/dist/index.js CHANGED
@@ -611,7 +611,11 @@ var WalmartNamespace = class {
611
611
  * Structured Walmart search results: `products[]`, `products_count` and the
612
612
  * resolved `location`. Page through with `page` (1-indexed).
613
613
  *
614
- * Costs 1 credit for `domain` "com" or "ca", 2 credits for "com.mx".
614
+ * Pass `delivery_zip` + `store_id` to get one store's results (walmart.com
615
+ * and walmart.ca); `data.location` confirms the store.
616
+ *
617
+ * Costs 1 credit for `domain` "com" or "ca", 2 credits for "com.mx", and 2
618
+ * credits when store-targeted.
615
619
  */
616
620
  async search(options) {
617
621
  return this.client._post("/api/v1/walmart/search", options);
@@ -620,8 +624,11 @@ var WalmartNamespace = class {
620
624
  * Full product detail: price, rating, images, specifications, availability
621
625
  * and seller.
622
626
  *
623
- * Costs 1 credit. Walmart.ca product pages are not fetchable, so this is
624
- * walmart.com only.
627
+ * Pass `delivery_zip` + `store_id` for one store's price and availability.
628
+ * `domain: "ca"` is available only together with a store target.
629
+ *
630
+ * Costs 1 credit, or 2 when store-targeted. A store that does not carry the
631
+ * item returns 404.
625
632
  */
626
633
  async product(options) {
627
634
  return this.client._post("/api/v1/walmart/product", options);
@@ -672,6 +679,20 @@ var WalmartNamespace = class {
672
679
  async sellerProducts(options) {
673
680
  return this.client._post("/api/v1/walmart/seller-products", options);
674
681
  }
682
+ /**
683
+ * Walmart stores near a US ZIP (or a Canadian postal code with `domain: "ca"`),
684
+ * nearest first, with `store_id`, address, distance, coordinates and hours.
685
+ * Use a `store_id` with `delivery_zip` on `search()` or `product()`, on the
686
+ * same domain, to target that store.
687
+ *
688
+ * Costs 1 credit.
689
+ */
690
+ async stores(options) {
691
+ return await this.client._post(
692
+ "/api/v1/walmart/stores",
693
+ options
694
+ );
695
+ }
675
696
  };
676
697
 
677
698
  // src/namespaces/youtube.ts
@@ -2236,7 +2257,144 @@ var MetaAdsNamespace = class {
2236
2257
  }
2237
2258
  };
2238
2259
 
2260
+ // src/namespaces/costco.ts
2261
+ var CostcoNamespace = class {
2262
+ constructor(client) {
2263
+ this.client = client;
2264
+ }
2265
+ client;
2266
+ /**
2267
+ * Search Costco by keyword or item number: online price and original price,
2268
+ * ratings, member-only and stock flags, promotions and facets. Pass
2269
+ * `warehouse_id` to add that warehouse's in-store price and stock to every
2270
+ * result.
2271
+ *
2272
+ * Costs 1 credit.
2273
+ */
2274
+ async search(options) {
2275
+ return this.client._post("/api/v1/costco/search", options);
2276
+ }
2277
+ /**
2278
+ * Products in a Costco category, with the same sort, filters and
2279
+ * per-warehouse pricing as search().
2280
+ *
2281
+ * Costs 1 credit.
2282
+ */
2283
+ async category(options) {
2284
+ return this.client._post("/api/v1/costco/category", options);
2285
+ }
2286
+ /**
2287
+ * The Costco department list, or the full subcategory tree under one
2288
+ * department when `category_id` is set.
2289
+ *
2290
+ * Costs 1 credit.
2291
+ */
2292
+ async categories(options = {}) {
2293
+ return this.client._post("/api/v1/costco/categories", options);
2294
+ }
2295
+ /**
2296
+ * Full details for up to 20 items: description, features, specifications,
2297
+ * variants, member-only and purchase limits, delivery fee, and promotions
2298
+ * with start and end dates. Pass `item_id` or `item_ids`.
2299
+ *
2300
+ * Costs 1 credit.
2301
+ */
2302
+ async product(options) {
2303
+ return this.client._post("/api/v1/costco/product", options);
2304
+ }
2305
+ /**
2306
+ * Online price versus in-warehouse price for up to 20 items across up to 10
2307
+ * warehouses, with each location's discount, final price, promotion dates
2308
+ * and price code.
2309
+ *
2310
+ * Costs 1 credit for up to 9 warehouses and 2 credits for 10.
2311
+ */
2312
+ async prices(options) {
2313
+ return this.client._post("/api/v1/costco/prices", options);
2314
+ }
2315
+ /**
2316
+ * In-warehouse stock status for one item at up to 10 warehouses, plus
2317
+ * pickup and same-day delivery availability. A status, never a quantity.
2318
+ *
2319
+ * Costs 1 credit per 5 warehouses.
2320
+ */
2321
+ async availability(options) {
2322
+ return this.client._post("/api/v1/costco/availability", options);
2323
+ }
2324
+ /**
2325
+ * Customer reviews for a Costco product with the rating distribution and
2326
+ * recommend count; sort, star filter and up to 100 reviews per page.
2327
+ *
2328
+ * Costs 1 credit.
2329
+ */
2330
+ async reviews(options) {
2331
+ return this.client._post("/api/v1/costco/reviews", options);
2332
+ }
2333
+ /**
2334
+ * Costco warehouses near a US zip code or coordinates, nearest first:
2335
+ * warehouse_id, address, hours, departments, services, and gas station hours
2336
+ * and prices.
2337
+ *
2338
+ * Costs 1 credit, or 2 with country "ca".
2339
+ */
2340
+ async warehouses(options) {
2341
+ return this.client._post("/api/v1/costco/warehouses", options);
2342
+ }
2343
+ /**
2344
+ * Current regular, premium and diesel prices at Costco gas stations near a
2345
+ * location, or at specific warehouses.
2346
+ *
2347
+ * Costs 1 credit by location (2 with country "ca"); by `warehouse_ids`,
2348
+ * 1 credit per 5 warehouses on us and 2 credits per warehouse on ca.
2349
+ */
2350
+ async gas(options) {
2351
+ return this.client._post("/api/v1/costco/gas", options);
2352
+ }
2353
+ /**
2354
+ * The current Costco member coupon book (US): every offer with its item
2355
+ * number, discount, final price, warehouse/online scope, limits and the
2356
+ * book's valid dates. Takes no parameters.
2357
+ *
2358
+ * Costs 1 credit.
2359
+ */
2360
+ async coupons(options = {}) {
2361
+ return this.client._post("/api/v1/costco/coupons", options);
2362
+ }
2363
+ /**
2364
+ * Costco deal feeds: new items, while supplies last, treasure hunt, member
2365
+ * favorites, online-only and everything on sale, with the same filters and
2366
+ * optional per-warehouse pricing as search().
2367
+ *
2368
+ * Costs 1 credit.
2369
+ */
2370
+ async deals(options) {
2371
+ return this.client._post("/api/v1/costco/deals", options);
2372
+ }
2373
+ /**
2374
+ * Markdown finder for one warehouse: scans a query or category and keeps
2375
+ * the items whose in-warehouse price ends in a markdown code - .97
2376
+ * clearance and .00/.88 manager markdown by default, .49/.79/.89 special
2377
+ * buys on request. The codes are the member-community decode; Costco does
2378
+ * not publish them. Only items Costco lists online are covered.
2379
+ *
2380
+ * Costs 1 credit.
2381
+ */
2382
+ async clearance(options) {
2383
+ return this.client._post("/api/v1/costco/clearance", options);
2384
+ }
2385
+ /**
2386
+ * Costco search-box suggestions for a partial query.
2387
+ *
2388
+ * Costs 1 credit.
2389
+ */
2390
+ async autocomplete(options) {
2391
+ return this.client._post("/api/v1/costco/autocomplete", options);
2392
+ }
2393
+ };
2394
+
2239
2395
  // src/client.ts
2396
+ var DEFAULT_MAX_REQUESTS_PER_SECOND = 1;
2397
+ var MAX_REQUESTS_PER_SECOND = 50;
2240
2398
  var Scavio = class {
2241
2399
  google;
2242
2400
  amazon;
@@ -2269,6 +2427,7 @@ var Scavio = class {
2269
2427
  companiesHouse;
2270
2428
  googleAds;
2271
2429
  metaAds;
2430
+ costco;
2272
2431
  apiKey;
2273
2432
  baseUrl;
2274
2433
  timeout;
@@ -2282,9 +2441,11 @@ var Scavio = class {
2282
2441
  this.baseUrl = (config?.baseUrl ?? BASE_URL).replace(/\/+$/, "");
2283
2442
  this.timeout = config?.timeout ?? DEFAULT_TIMEOUT;
2284
2443
  this.maxRetries = config?.maxRetries ?? DEFAULT_MAX_RETRIES;
2285
- const rps = config?.maxRequestsPerSecond ?? 1;
2286
- if (rps < 1 || rps > 10) {
2287
- throw new ScavioError("maxRequestsPerSecond must be between 1 and 10");
2444
+ const rps = config?.maxRequestsPerSecond ?? DEFAULT_MAX_REQUESTS_PER_SECOND;
2445
+ if (rps < 1 || rps > MAX_REQUESTS_PER_SECOND) {
2446
+ throw new ScavioError(
2447
+ `maxRequestsPerSecond must be between 1 and ${MAX_REQUESTS_PER_SECOND}`
2448
+ );
2288
2449
  }
2289
2450
  this.rateLimiter = new RateLimiter(rps);
2290
2451
  this.google = new GoogleNamespace(this);
@@ -2318,6 +2479,7 @@ var Scavio = class {
2318
2479
  this.companiesHouse = new CompaniesHouseNamespace(this);
2319
2480
  this.googleAds = new GoogleAdsNamespace(this);
2320
2481
  this.metaAds = new MetaAdsNamespace(this);
2482
+ this.costco = new CostcoNamespace(this);
2321
2483
  }
2322
2484
  /** @internal */
2323
2485
  async _post(path, body) {
@@ -2382,6 +2544,8 @@ export {
2382
2544
  BookingNamespace,
2383
2545
  CapterraNamespace,
2384
2546
  CompaniesHouseNamespace,
2547
+ CostcoNamespace,
2548
+ DEFAULT_MAX_REQUESTS_PER_SECOND,
2385
2549
  EbayNamespace,
2386
2550
  G2Namespace,
2387
2551
  GlassdoorNamespace,
@@ -2395,6 +2559,7 @@ export {
2395
2559
  InvalidAPIKeyError,
2396
2560
  KuaishouNamespace,
2397
2561
  LinkedInNamespace,
2562
+ MAX_REQUESTS_PER_SECOND,
2398
2563
  MetaAdsNamespace,
2399
2564
  MissingAPIKeyError,
2400
2565
  NotFoundError,