@faststore/api 1.12.43 → 1.12.44

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.42";
25
+ var version = "1.12.43";
26
26
  var license = "MIT";
27
27
  var main = "dist/index.js";
28
28
  var typings = "dist/index.d.ts";
@@ -58,7 +58,7 @@ var dependencies = {
58
58
  };
59
59
  var devDependencies = {
60
60
  "@envelop/core": "^2.6.0",
61
- "@faststore/shared": "^1.12.37",
61
+ "@faststore/shared": "^1.12.43",
62
62
  "@graphql-codegen/cli": "2.2.0",
63
63
  "@graphql-codegen/typescript": "2.2.2",
64
64
  concurrently: "^6.2.1",
@@ -2170,7 +2170,7 @@ const StoreSearchResult = {
2170
2170
  },
2171
2171
  products: async ({
2172
2172
  productSearchPromise
2173
- }) => {
2173
+ }, _, ctx) => {
2174
2174
  const productSearchResult = await productSearchPromise;
2175
2175
  const skus = productSearchResult.products.map(product => {
2176
2176
  const [maybeSku] = product.items;
@@ -2184,7 +2184,14 @@ const StoreSearchResult = {
2184
2184
  endCursor: productSearchResult.recordsFiltered.toString(),
2185
2185
  totalCount: productSearchResult.recordsFiltered
2186
2186
  },
2187
- edges: skus.map((sku, index) => ({
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) => ({
2188
2195
  node: sku,
2189
2196
  cursor: index.toString()
2190
2197
  }))
@@ -2506,6 +2513,7 @@ const getContextFactory = options => ctx => {
2506
2513
  };
2507
2514
  ctx.clients = getClients(options, ctx);
2508
2515
  ctx.loaders = getLoaders(options, ctx);
2516
+ ctx.hideUnavailableItems = options.hideUnavailableItems;
2509
2517
  return ctx;
2510
2518
  };
2511
2519
  const getResolvers = _ => Resolvers;