@faststore/api 1.12.43 → 1.12.45

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@faststore/api",
3
- "version": "1.12.43",
3
+ "version": "1.12.45",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -53,5 +53,5 @@
53
53
  "@envelop/core": "^1 || ^2",
54
54
  "graphql": "^15.6.0"
55
55
  },
56
- "gitHead": "6ac829dd59600d5ea9a02820294310bdecaa4b79"
56
+ "gitHead": "121360b0bdbc8eac7c71d660e3e6b3604bda7703"
57
57
  }
@@ -3,6 +3,7 @@ import type { Resolver } from '..'
3
3
  import type { SearchArgs } from '../clients/search'
4
4
  import type { Facet } from '../clients/search/types/FacetSearchResult'
5
5
  import { ProductSearchResult } from '../clients/search/types/ProductSearchResult'
6
+ import { inStock } from '../utils/productStock'
6
7
 
7
8
  type Root = {
8
9
  searchArgs: Omit<SearchArgs, 'type'>
@@ -53,12 +54,14 @@ export const StoreSearchResult: Record<string, Resolver<Root>> = {
53
54
  products: skus,
54
55
  }
55
56
  },
56
- products: async ({ productSearchPromise }) => {
57
+ products: async ({ productSearchPromise }, _) => {
57
58
  const productSearchResult = await productSearchPromise
58
59
 
59
60
  const skus = productSearchResult.products
60
61
  .map((product) => {
61
- const [maybeSku] = product.items
62
+ const maybeSku = product.items.find((item) =>
63
+ item.sellers.some((item) => inStock(item.commertialOffer))
64
+ )
62
65
 
63
66
  return maybeSku && enhanceSku(maybeSku, product)
64
67
  })