forked from PhilMayer/adobe-app-builder-api-mesh-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mesh.json
65 lines (65 loc) · 2.82 KB
/
mesh.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
{
"meshConfig": {
"files": [
{
"path": "./demoResponse.json",
"content": "{\n \"products\": [\n {\n \"location\": \"Warehouse A\",\n \"price\": 9.99,\n \"quantity\": 21,\n \"sku\": \"va\",\n \"ziocode\": 785585\n }\n ]\n}"
},
{
"path": "./additional-resolvers.js",
"content": " const resolvers = {\n SimpleProduct: {\n demoDetails: {\n selectionSet: /* GraphQL */ `\n {\n sku\n }\n `,\n resolve(root, _args, context, info) {\n return context.Pricing.Query.demo({\n root,\n args: {\n skus: `${root.sku}`\n },\n context,\n info,\n selectionSet: \"{ products { sku location quantity ziocode price } }\"\n }).then((response) => { \n return response.products.filter((product) => product.sku === root.sku)[0];\n })\n }\n }\n }\n}\n\nmodule.exports = {\n resolvers\n}\n "
}
],
"responseConfig": {
"CORS": {
"methods": [
"GET",
"POST"
],
"origin": [
"http://localhost:3000",
"https://tpog71-3000.preview.csb.app",
"https://96vivc-3000.preview.csb.app",
"https://cnkg7m-3000.preview.csb.app",
"https://codesandbox.io"
]
}
},
"sources": [
{
"name": "CommerceFoundationAPI",
"handler": {
"graphql": {
"endpoint": "https://venia.magento.com/graphql"
}
}
},
{
"name": "Pricing",
"handler": {
"JsonSchema": {
"baseUrl": "https://adobeioruntime.net/api/v1/web/283976-319tealcat-stage/default",
"operations": [
{
"path": "/demo?skus={args.skus}",
"argTypeMap": {
"skus": {
"type": "string"
}
},
"responseSample": "./demoResponse.json",
"type": "Query",
"field": "demo",
"method": "GET"
}
]
}
}
}
],
"additionalTypeDefs": "extend type SimpleProduct {\n demoDetails: query_demo_products_items \n}\n",
"additionalResolvers": [
"./additional-resolvers.js"
]
}
}