scavio 0.35.0 → 0.37.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 CHANGED
@@ -685,13 +685,44 @@ to `MENARDS_PRODUCT_TIMEOUT` (120s). None ever lowers a longer client timeout.
685
685
 
686
686
  ### [Nordstrom](https://scavio.dev/docs/nordstrom-search?utm_source=npm-scavio-js&utm_medium=package&utm_campaign=readme)
687
687
 
688
- Two endpoints, new in 0.35.0, 5 credits each. nordstrom.com (US site only).
689
- `search` returns 24 products a page with current and original price ranges,
690
- percent off, on-sale flag, rating, review count, badges and colors; `sort` is
691
- `relevance` (default), `rating`, `price_high`, `price_low`, `newest` or
692
- `percent_off`. `product` takes a result's `url` or `style_id` and lists every
693
- color and size as a sku with UPC, price, price type, `in_stock` and the
694
- `quantity` available to ship online.
688
+ Eight endpoints, nordstrom.com (US site only). `search` and `product` are new in
689
+ 0.35.0; `category`, `brand`, `stores`, `availability` and `suggestions` are new
690
+ in 0.36.0; `reviews` is new in 0.37.0. `availability` costs 10 credits (the
691
+ product page plus the store lookup) and `reviews` 10; every other call costs 5.
692
+
693
+ - `search`, `category` and `brand` return 24 products a page with current and
694
+ original price ranges, percent off, on-sale flag, rating, review count,
695
+ badges and colors; `sort` is `relevance` (default), `rating`, `price_high`,
696
+ `price_low`, `newest` or `percent_off`. `category` takes a `/browse` path or
697
+ URL (departments, `sale/women`, `/browse/new`); `brand` takes a
698
+ `/brands/<slug>--<id>` path or URL (a product's `brand_url` works). Both also
699
+ return the category or brand (name, title, path, URL, breadcrumbs,
700
+ subcategories) and the filter sidebar with option counts (top 100 options per
701
+ group); filters inside a category URL are ignored.
702
+ - `product` takes a result's `url` or `style_id` and lists every color and size
703
+ as a sku with UPC, price, price type, `in_stock` and the `quantity` available
704
+ to ship. `in_stock` is true when the sku can be shipped or picked up in a
705
+ store, so a sku can be in stock with `quantity` 0 (store-only).
706
+ - `reviews` takes `url` or `style_id` and returns the product's full review
707
+ history, up to `max_reviews` per call (1-200, default 60). `sort` is
708
+ `most_helpful` (default), `most_recent`, `highest_rated` or `lowest_rated`;
709
+ filter with `stars` (e.g. `[1, 2]`), `verified_only`, `with_photos` or a text
710
+ `search` (`search` cannot be combined with `sort`). The response carries the
711
+ `summary` (average rating, total reviews, histogram, size and width rating,
712
+ praised and criticized features with a quote, rating-only count), the
713
+ `ai_summary`, `total_results`, `returned` and `has_more`. Rating-only reviews
714
+ are included with `title` and `text` null.
715
+ - `availability` takes `url` or `style_id` (optionally `sku_id`) and returns per
716
+ sku `ship_quantity`, `pickup_available`, `pick_quantity` and the stores that
717
+ can do in-store pickup. Quantities are chain-wide; per store Nordstrom only
718
+ says whether pickup is available, not how many.
719
+ - `stores` takes exactly one of `zip`, `latitude` + `longitude`, or
720
+ `store_numbers` (array or comma-separated string), with `distance_miles`
721
+ 1-100 (default 100). Each store has address, phone, hours, daily hours,
722
+ coordinates, pickup and curbside flags and amenities. A ZIP with no store in
723
+ range is an empty list (still billed).
724
+ - `suggestions` returns the site's autocomplete strings for a partial `query`
725
+ (`limit` 1-20, default 8).
695
726
 
696
727
  ```ts
697
728
  const found = await client.nordstrom.search({ query: "dress", sort: "percent_off" });
@@ -702,12 +733,37 @@ const item = await client.nordstrom.product({ style_id: top.style_id });
702
733
  for (const color of (item as any).data.colors) {
703
734
  for (const sku of color.skus) console.log(color.name, sku.size, sku.upc, sku.price, sku.price_type, sku.quantity);
704
735
  }
736
+
737
+ const dresses = await client.nordstrom.category({ category: "/browse/women/clothing/dresses", sort: "price_low" });
738
+ const label = await client.nordstrom.brand({ brand: "/brands/astr-the-label--53360" });
739
+ const near = await client.nordstrom.stores({ zip: "10001" });
740
+
741
+ const stock = await client.nordstrom.availability({ style_id: "7737947" });
742
+ for (const sku of (stock as any).data.skus) {
743
+ console.log(sku.sku_id, sku.size, sku.color, sku.ship_quantity, sku.pick_quantity, sku.pickup_store_count);
744
+ }
745
+
746
+ const ideas = await client.nordstrom.suggestions({ query: "nike air" });
747
+ console.log((ideas as any).data.suggestions);
748
+
749
+ const rev = (await client.nordstrom.reviews({ style_id: "7737947", sort: "most_recent", max_reviews: 100 })) as any;
750
+ const { summary } = rev.data;
751
+ console.log(summary.average_rating, summary.total_reviews, summary.ratings_histogram, summary.size_rating);
752
+ console.log(rev.data.total_results, rev.data.returned, rev.data.has_more, rev.data.ai_summary);
753
+ for (const r of rev.data.reviews.slice(0, 5)) {
754
+ console.log(r.date, r.rating, r.title, r.text, r.size_purchased, r.helpful_votes, r.badges, r.photos.length);
755
+ }
756
+ const critical = await client.nordstrom.reviews({ style_id: "7737947", stars: [1, 2], verified_only: true });
705
757
  ```
706
758
 
707
- Reviews are the 12-13 shown on the product page, with no deeper paging. There
708
- is no store locator, store-level stock or category endpoint. An unknown style
709
- id is a 404. Both calls raise the request timeout to `NORDSTROM_TIMEOUT`
710
- (120s), never lowering a longer client timeout.
759
+ `product` returns the reviews shown on the product page (up to about 13) plus
760
+ the total review count and star histogram; `reviews` returns the rest. An
761
+ unknown style id, sku id, category or brand is a 404. Every call raises the
762
+ request timeout to `NORDSTROM_TIMEOUT` (120s), except `reviews`, which takes
763
+ 20-60s (up to about 100s at 200 reviews) and raises it to
764
+ `NORDSTROM_REVIEWS_TIMEOUT` (150s). Neither ever lowers a longer client timeout.
765
+ If the upstream page still fails after the API's own retries, the call is an
766
+ unbilled 502.
711
767
 
712
768
  ### [Mercado Libre](https://scavio.dev/docs/mercadolibre-search?utm_source=npm-scavio-js&utm_medium=package&utm_campaign=readme)
713
769
 
package/dist/index.cjs CHANGED
@@ -76,6 +76,7 @@ __export(index_exports, {
76
76
  MetaAdsNamespace: () => MetaAdsNamespace,
77
77
  MicroCenterNamespace: () => MicroCenterNamespace,
78
78
  MissingAPIKeyError: () => MissingAPIKeyError,
79
+ NORDSTROM_REVIEWS_TIMEOUT: () => NORDSTROM_REVIEWS_TIMEOUT,
79
80
  NORDSTROM_TIMEOUT: () => NORDSTROM_TIMEOUT,
80
81
  NordstromNamespace: () => NordstromNamespace,
81
82
  NotFoundError: () => NotFoundError,
@@ -261,7 +262,7 @@ function parseRetryAfter(header) {
261
262
  var BASE_URL = "https://api.scavio.dev";
262
263
  var DEFAULT_TIMEOUT = 3e4;
263
264
  var DEFAULT_MAX_RETRIES = 2;
264
- var SDK_VERSION = true ? "0.35.0" : "0.0.0";
265
+ var SDK_VERSION = true ? "0.37.0" : "0.0.0";
265
266
  var USER_AGENT = `scavio-js/${SDK_VERSION}`;
266
267
  function isServerRuntime() {
267
268
  const g = globalThis;
@@ -3906,6 +3907,7 @@ var MenardsNamespace = class {
3906
3907
 
3907
3908
  // src/namespaces/nordstrom.ts
3908
3909
  var NORDSTROM_TIMEOUT = 12e4;
3910
+ var NORDSTROM_REVIEWS_TIMEOUT = 15e4;
3909
3911
  var NordstromNamespace = class {
3910
3912
  constructor(client) {
3911
3913
  this.client = client;
@@ -3935,16 +3937,116 @@ var NordstromNamespace = class {
3935
3937
  * criticized features with a quote each, breadcrumbs and images. Every color
3936
3938
  * lists its images and every size as a sku with sku id, size, size type,
3937
3939
  * UPC, price, original price, percent off, price type (regular, clearance,
3938
- * promotion), in_stock and the quantity available to ship. Includes the
3939
- * 12-13 reviews shown on the product page, with title, text, rating, size
3940
- * rating, author, date, helpful votes and verified-purchase flag. Pass url
3941
- * or style_id. An unknown style id is a 404.
3940
+ * promotion), in_stock and the quantity available to ship. in_stock is true
3941
+ * when the sku can be shipped or picked up in a store, so a sku held only in
3942
+ * a store reads in stock with quantity 0 (availability() lists its pickup
3943
+ * stores). Includes the reviews shown on the product page (up to about 13),
3944
+ * with the total review count; each review has title, text, rating, size
3945
+ * rating, author, date, helpful votes and verified-purchase flag
3946
+ * (reviews() pages the full review history). Pass url or style_id. An
3947
+ * unknown style id is a 404.
3942
3948
  *
3943
3949
  * Costs 5 credits.
3944
3950
  */
3945
3951
  async product(options) {
3946
3952
  return this.client._post("/api/v1/nordstrom/product", options, void 0, NORDSTROM_TIMEOUT);
3947
3953
  }
3954
+ /**
3955
+ * Browse a nordstrom.com (US) category page, 24 products per page, sorted
3956
+ * by relevance, rating, price, newest or percent off. Works on any /browse
3957
+ * category, including sale (sale/women), new arrivals (/browse/new) and
3958
+ * top-level departments (/browse/women). Returns the category's name, page
3959
+ * title, path, URL, breadcrumbs and subcategories (name and path, for
3960
+ * drilling down). Each product has the same fields as a search result. Also
3961
+ * returns the total result count, page count, and the filter sidebar: each
3962
+ * filter group with its options and product counts (groups with more than
3963
+ * 100 options list the 100 with the most products and give the full
3964
+ * option_count). An unknown category is a 404.
3965
+ *
3966
+ * Costs 5 credits.
3967
+ */
3968
+ async category(options) {
3969
+ return this.client._post("/api/v1/nordstrom/category", options, void 0, NORDSTROM_TIMEOUT);
3970
+ }
3971
+ /**
3972
+ * List a brand's products on nordstrom.com (US) from its brand page, 24 per
3973
+ * page, sorted by relevance, rating, price, newest or percent off. Returns
3974
+ * the brand's name, path, URL, breadcrumbs and sub-pages (Women, Men,
3975
+ * Kids...), products with the same fields as a search result, the total
3976
+ * result count, page count and the filter sidebar with option counts. An
3977
+ * unknown brand is a 404.
3978
+ *
3979
+ * Costs 5 credits.
3980
+ */
3981
+ async brand(options) {
3982
+ return this.client._post("/api/v1/nordstrom/brand", options, void 0, NORDSTROM_TIMEOUT);
3983
+ }
3984
+ /**
3985
+ * Find Nordstrom stores (full-line stores and Nordstrom Local) near a US ZIP
3986
+ * code or latitude/longitude within up to 100 miles, nearest first, or look
3987
+ * stores up by store number. Each store has store number, name, type
3988
+ * (full_line or local), address, phone, weekly hours, holiday hours when
3989
+ * posted, open and close times for the next 8 days, time zone, distance in
3990
+ * miles, coordinates, whether it offers buy-online pickup and curbside
3991
+ * pickup, its amenities and its store page URL. A ZIP with no store in range
3992
+ * returns an empty list.
3993
+ *
3994
+ * Costs 5 credits.
3995
+ */
3996
+ async stores(options) {
3997
+ return this.client._post("/api/v1/nordstrom/stores", options, void 0, NORDSTROM_TIMEOUT);
3998
+ }
3999
+ /**
4000
+ * Online and store-pickup availability for every size and color of one
4001
+ * nordstrom.com (US) product, by URL or style id, optionally one sku. Each
4002
+ * sku has sku id, size, color, UPC, in_stock, whether it ships and the
4003
+ * quantity available to ship, the quantity available for pickup, and the
4004
+ * stores where it can be picked up (store number, name, address, city,
4005
+ * state, ZIP, phone). Quantities are chain-wide: per store Nordstrom only
4006
+ * says whether pickup is available, not how many. An unknown style id or sku
4007
+ * id is a 404.
4008
+ *
4009
+ * Costs 10 credits (the product page plus the store lookup).
4010
+ */
4011
+ async availability(options) {
4012
+ return this.client._post("/api/v1/nordstrom/availability", options, void 0, NORDSTROM_TIMEOUT);
4013
+ }
4014
+ /**
4015
+ * The search-box autocomplete of nordstrom.com: the queries Nordstrom
4016
+ * suggests for a partial search term, most likely first. Useful for keyword
4017
+ * research and for building queries for search().
4018
+ *
4019
+ * Costs 5 credits.
4020
+ */
4021
+ async suggestions(options) {
4022
+ return this.client._post("/api/v1/nordstrom/suggestions", options, void 0, NORDSTROM_TIMEOUT);
4023
+ }
4024
+ /**
4025
+ * Customer reviews of one nordstrom.com (US) product by URL or style id, up
4026
+ * to 200 per call (default 60), sorted most helpful (default), most recent,
4027
+ * highest rated or lowest rated, optionally filtered to star ratings,
4028
+ * verified purchases, reviews with photos, or a text search. Returns the
4029
+ * product's review summary (average rating, total reviews, star histogram,
4030
+ * size rating 1 runs small to 5 runs big, width rating where the site has
4031
+ * one, the most mentioned praised and criticized features with a quote each,
4032
+ * and the count of rating-only reviews), the AI review summary when the site
4033
+ * shows one, the number of reviews matching the filters (total_results),
4034
+ * returned and has_more. Each review has id, title, text, star rating, size
4035
+ * rating, author, date, helpful votes, verified-purchase flag, reviewer
4036
+ * badges (verified_purchaser, top_250, top_1000), size and color purchased,
4037
+ * the reviewer's height, weight, body type and usual sizes when given,
4038
+ * secondary ratings (Size, with its scale), the site it was syndicated from
4039
+ * (e.g. nordstromrack.com) and photos with thumbnails. Rating-only reviews
4040
+ * are included with title and text null. Takes 20-60s, up to about 100s at
4041
+ * max_reviews 200, so the request timeout is raised to
4042
+ * NORDSTROM_REVIEWS_TIMEOUT. A product with no reviews returns an empty
4043
+ * list; an unknown style id is a 404.
4044
+ *
4045
+ * Costs 10 credits.
4046
+ */
4047
+ async reviews(options) {
4048
+ return this.client._post("/api/v1/nordstrom/reviews", options, void 0, NORDSTROM_REVIEWS_TIMEOUT);
4049
+ }
3948
4050
  };
3949
4051
 
3950
4052
  // src/namespaces/trustpilot.ts
@@ -4716,6 +4818,7 @@ async function getSubtle() {
4716
4818
  MetaAdsNamespace,
4717
4819
  MicroCenterNamespace,
4718
4820
  MissingAPIKeyError,
4821
+ NORDSTROM_REVIEWS_TIMEOUT,
4719
4822
  NORDSTROM_TIMEOUT,
4720
4823
  NordstromNamespace,
4721
4824
  NotFoundError,