scavio 0.36.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,10 +685,10 @@ 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
- Seven endpoints, nordstrom.com (US site only). `search` and `product` are new in
688
+ Eight endpoints, nordstrom.com (US site only). `search` and `product` are new in
689
689
  0.35.0; `category`, `brand`, `stores`, `availability` and `suggestions` are new
690
- in 0.36.0. `availability` costs 10 credits (the product page plus the store
691
- lookup); every other call costs 5.
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
692
 
693
693
  - `search`, `category` and `brand` return 24 products a page with current and
694
694
  original price ranges, percent off, on-sale flag, rating, review count,
@@ -703,6 +703,15 @@ lookup); every other call costs 5.
703
703
  as a sku with UPC, price, price type, `in_stock` and the `quantity` available
704
704
  to ship. `in_stock` is true when the sku can be shipped or picked up in a
705
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.
706
715
  - `availability` takes `url` or `style_id` (optionally `sku_id`) and returns per
707
716
  sku `ship_quantity`, `pickup_available`, `pick_quantity` and the stores that
708
717
  can do in-store pickup. Quantities are chain-wide; per store Nordstrom only
@@ -736,13 +745,25 @@ for (const sku of (stock as any).data.skus) {
736
745
 
737
746
  const ideas = await client.nordstrom.suggestions({ query: "nike air" });
738
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 });
739
757
  ```
740
758
 
741
759
  `product` returns the reviews shown on the product page (up to about 13) plus
742
- the total review count and star histogram; the full review history is not
743
- available. An unknown style id, sku id, category or brand is a 404. Every call
744
- raises the request timeout to `NORDSTROM_TIMEOUT` (120s), never lowering a
745
- longer client timeout.
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.
746
767
 
747
768
  ### [Mercado Libre](https://scavio.dev/docs/mercadolibre-search?utm_source=npm-scavio-js&utm_medium=package&utm_campaign=readme)
748
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.36.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;
@@ -3940,8 +3942,9 @@ var NordstromNamespace = class {
3940
3942
  * a store reads in stock with quantity 0 (availability() lists its pickup
3941
3943
  * stores). Includes the reviews shown on the product page (up to about 13),
3942
3944
  * with the total review count; each review has title, text, rating, size
3943
- * rating, author, date, helpful votes and verified-purchase flag. Pass url
3944
- * or style_id. An unknown style id is a 404.
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.
3945
3948
  *
3946
3949
  * Costs 5 credits.
3947
3950
  */
@@ -4018,6 +4021,32 @@ var NordstromNamespace = class {
4018
4021
  async suggestions(options) {
4019
4022
  return this.client._post("/api/v1/nordstrom/suggestions", options, void 0, NORDSTROM_TIMEOUT);
4020
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
+ }
4021
4050
  };
4022
4051
 
4023
4052
  // src/namespaces/trustpilot.ts
@@ -4789,6 +4818,7 @@ async function getSubtle() {
4789
4818
  MetaAdsNamespace,
4790
4819
  MicroCenterNamespace,
4791
4820
  MissingAPIKeyError,
4821
+ NORDSTROM_REVIEWS_TIMEOUT,
4792
4822
  NORDSTROM_TIMEOUT,
4793
4823
  NordstromNamespace,
4794
4824
  NotFoundError,