@faststore/api 1.12.44 → 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.
@@ -22,7 +22,7 @@ var api = require('@opentelemetry/api');
22
22
  var apiLogs = require('@opentelemetry/api-logs');
23
23
 
24
24
  var name = "@faststore/api";
25
- var version = "1.12.43";
25
+ var version = "1.12.44";
26
26
  var license = "MIT";
27
27
  var main = "dist/index.js";
28
28
  var typings = "dist/index.d.ts";
@@ -2170,10 +2170,10 @@ const StoreSearchResult = {
2170
2170
  },
2171
2171
  products: async ({
2172
2172
  productSearchPromise
2173
- }, _, ctx) => {
2173
+ }, _) => {
2174
2174
  const productSearchResult = await productSearchPromise;
2175
2175
  const skus = productSearchResult.products.map(product => {
2176
- const [maybeSku] = product.items;
2176
+ const maybeSku = product.items.find(item => item.sellers.some(item => inStock(item.commertialOffer)));
2177
2177
  return maybeSku && enhanceSku(maybeSku, product);
2178
2178
  }).filter(sku => !!sku);
2179
2179
  return {
@@ -2184,14 +2184,7 @@ const StoreSearchResult = {
2184
2184
  endCursor: productSearchResult.recordsFiltered.toString(),
2185
2185
  totalCount: productSearchResult.recordsFiltered
2186
2186
  },
2187
- edges: skus.filter(sku => {
2188
- if (ctx.hideUnavailableItems) {
2189
- return sku.sellers.some(item => inStock(item.commertialOffer));
2190
- } else {
2191
- return true;
2192
- }
2193
- }) // TODO: remove this filter when the IS returns correctly with hideUnavailableItems
2194
- .map((sku, index) => ({
2187
+ edges: skus.map((sku, index) => ({
2195
2188
  node: sku,
2196
2189
  cursor: index.toString()
2197
2190
  }))
@@ -2513,7 +2506,6 @@ const getContextFactory = options => ctx => {
2513
2506
  };
2514
2507
  ctx.clients = getClients(options, ctx);
2515
2508
  ctx.loaders = getLoaders(options, ctx);
2516
- ctx.hideUnavailableItems = options.hideUnavailableItems;
2517
2509
  return ctx;
2518
2510
  };
2519
2511
  const getResolvers = _ => Resolvers;