@faststore/api 1.12.7 → 1.12.8

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.7",
3
+ "version": "1.12.8",
4
4
  "license": "MIT",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -46,5 +46,5 @@
46
46
  "peerDependencies": {
47
47
  "graphql": "^15.6.0"
48
48
  },
49
- "gitHead": "864263fb8c6a7e3a49d0c724039545f9759c8559"
49
+ "gitHead": "52dd802b9e028d3860603e47387f250a24f264ce"
50
50
  }
@@ -53,6 +53,22 @@ export const Query = {
53
53
 
54
54
  const sku = await skuLoader.load(skuId)
55
55
 
56
+ /**
57
+ * Here be dragons 🦄🦄🦄
58
+ *
59
+ * In some cases, the slug has a valid skuId for a different
60
+ * product. This condition makes sure that the fetched sku
61
+ * is the one we actually asked for
62
+ * */
63
+ if (
64
+ slug && sku.isVariantOf.linkText &&
65
+ !slug.startsWith(sku.isVariantOf.linkText)
66
+ ) {
67
+ throw new Error(
68
+ `Slug was set but the fetched sku does not satisfy the slug condition. slug: ${slug}, linkText: ${sku.isVariantOf.linkText}`,
69
+ )
70
+ }
71
+
56
72
  return sku
57
73
  } catch (err) {
58
74
  if (slug == null) {