@graphcommerce/graphql-mesh 9.1.0-canary.16 → 9.1.0-canary.18
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/CHANGELOG.md +4 -0
- package/index.ts +1 -0
- package/package.json +4 -4
- package/utils/storefrontFromContext.ts +10 -0
package/CHANGELOG.md
CHANGED
package/index.ts
CHANGED
|
@@ -5,3 +5,4 @@ export * from './.mesh'
|
|
|
5
5
|
// @ts-expect-error getBuiltMesh and createBuiltMeshHTTPHandler are re-exported here and override the export from .mesh
|
|
6
6
|
export * from './api/globalThisMesh'
|
|
7
7
|
export * from './utils/traverseSelectionSet'
|
|
8
|
+
export * from './utils/storefrontFromContext'
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/graphql-mesh",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "9.1.0-canary.
|
|
5
|
+
"version": "9.1.0-canary.18",
|
|
6
6
|
"main": "index.ts",
|
|
7
7
|
"dependencies": {
|
|
8
8
|
"@whatwg-node/fetch": "^0.10.1",
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"@apollo/client": "*",
|
|
17
|
-
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.
|
|
18
|
-
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.
|
|
19
|
-
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.
|
|
17
|
+
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.18",
|
|
18
|
+
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.18",
|
|
19
|
+
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.18",
|
|
20
20
|
"@graphql-mesh/runtime": "*",
|
|
21
21
|
"@graphql-mesh/types": "*"
|
|
22
22
|
},
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { GraphCommerceStorefrontConfig } from '@graphcommerce/next-config'
|
|
2
|
+
import type { MeshContext } from '@graphql-mesh/runtime'
|
|
3
|
+
|
|
4
|
+
export function storefrontFromContext(
|
|
5
|
+
context: MeshContext & { headers?: Record<string, string> },
|
|
6
|
+
): GraphCommerceStorefrontConfig | undefined {
|
|
7
|
+
const storefrontAll = import.meta.graphCommerce.storefront
|
|
8
|
+
const store = context.headers?.store
|
|
9
|
+
return storefrontAll.find((s) => s.magentoStoreCode === store)
|
|
10
|
+
}
|