@graphcommerce/graphql-mesh 4.0.11 → 4.1.2
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 +26 -0
- package/api/createEnvelop.ts +35 -0
- package/index.ts +2 -3
- package/package.json +18 -32
- package/tsconfig.json +1 -1
- package/createServer.ts +0 -66
- package/next-env.d.ts +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1429](https://github.com/graphcommerce-org/graphcommerce/pull/1429) [`ba8cd4d34`](https://github.com/graphcommerce-org/graphcommerce/commit/ba8cd4d3480a7ec7e555b051cfd0fbc809c7aa12) Thanks [@paales](https://github.com/paales)! - mesh couldn’t be generated properly in a non-monorepo setup
|
|
8
|
+
|
|
9
|
+
## 4.1.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#1427](https://github.com/graphcommerce-org/graphcommerce/pull/1427) [`06f7bdff8`](https://github.com/graphcommerce-org/graphcommerce/commit/06f7bdff882396f2b0e1a2873fbb718c7b06fab4) Thanks [@paales](https://github.com/paales)! - Use playground title provided by the config
|
|
14
|
+
|
|
15
|
+
* [#1426](https://github.com/graphcommerce-org/graphcommerce/pull/1426) [`100f4c38c`](https://github.com/graphcommerce-org/graphcommerce/commit/100f4c38c8fcda4bc6e0425e38028b550b60adc2) Thanks [@paales](https://github.com/paales)! - Upgrade packages
|
|
16
|
+
|
|
17
|
+
## 4.1.0
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- [#1399](https://github.com/graphcommerce-org/graphcommerce/pull/1399) [`fb277d8e1`](https://github.com/graphcommerce-org/graphcommerce/commit/fb277d8e1e3612c5e9cf890a30d19cfd1ff70542) Thanks [@paales](https://github.com/paales)! - Now using [@graphql-yoga](https://github.com/dotansimha/graphql-yoga) for GraphQL which has full support for [envelop](https://www.envelop.dev/) plugins.
|
|
22
|
+
|
|
23
|
+
* [#1399](https://github.com/graphcommerce-org/graphcommerce/pull/1399) [`fb277d8e1`](https://github.com/graphcommerce-org/graphcommerce/commit/fb277d8e1e3612c5e9cf890a30d19cfd1ff70542) Thanks [@paales](https://github.com/paales)! - Added a new @graphcommerce/cli package to generate the mesh so it can be generated _inside_ the @graphcommerce/graphql-mesh package to allow for better future extensibility.
|
|
24
|
+
|
|
25
|
+
### Patch Changes
|
|
26
|
+
|
|
27
|
+
- [#1399](https://github.com/graphcommerce-org/graphcommerce/pull/1399) [`da0ae7d02`](https://github.com/graphcommerce-org/graphcommerce/commit/da0ae7d0236e4908ba0bf0fa16656be516e841d4) Thanks [@paales](https://github.com/paales)! - Updated dependencies
|
|
28
|
+
|
|
3
29
|
## 4.0.11
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/* eslint-disable react-hooks/rules-of-hooks */
|
|
2
|
+
import { createServer as createYogaServer, useExtendContext } from '@graphql-yoga/node'
|
|
3
|
+
import { getBuiltMesh, rawConfig } from '../.mesh'
|
|
4
|
+
|
|
5
|
+
export async function createServer(endpoint: string) {
|
|
6
|
+
// retrieve the mesh instance (with configured Envelop plugins)
|
|
7
|
+
const mesh = await getBuiltMesh()
|
|
8
|
+
|
|
9
|
+
const { cors, playgroundTitle } = rawConfig.serve ?? {}
|
|
10
|
+
|
|
11
|
+
// pass the Mesh instance to Yoga and configure GraphiQL
|
|
12
|
+
const server = createYogaServer({
|
|
13
|
+
plugins: [
|
|
14
|
+
...mesh.plugins,
|
|
15
|
+
useExtendContext(({ req, res }) => ({
|
|
16
|
+
...req,
|
|
17
|
+
headers: req.headers,
|
|
18
|
+
cookies: req.cookies,
|
|
19
|
+
res,
|
|
20
|
+
})),
|
|
21
|
+
],
|
|
22
|
+
context: ({ req }) => ({ ...req, ...mesh.meshContext }),
|
|
23
|
+
graphiql: {
|
|
24
|
+
endpoint,
|
|
25
|
+
title: playgroundTitle,
|
|
26
|
+
},
|
|
27
|
+
maskedErrors: false,
|
|
28
|
+
parserCache: false,
|
|
29
|
+
validationCache: false,
|
|
30
|
+
logging: mesh.logger,
|
|
31
|
+
cors,
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
return server.requestListener
|
|
35
|
+
}
|
package/index.ts
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
export * from './
|
|
2
|
-
|
|
3
|
-
export const config = { api: { bodyParser: false } }
|
|
1
|
+
export * from './api/createEnvelop'
|
|
2
|
+
export * from './.mesh'
|
package/package.json
CHANGED
|
@@ -2,44 +2,30 @@
|
|
|
2
2
|
"name": "@graphcommerce/graphql-mesh",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "4.
|
|
5
|
+
"version": "4.1.2",
|
|
6
6
|
"author": "",
|
|
7
7
|
"license": "MIT",
|
|
8
|
-
"
|
|
9
|
-
"dev": "next",
|
|
10
|
-
"build": "next build",
|
|
11
|
-
"start": "next start"
|
|
12
|
-
},
|
|
8
|
+
"main": "index.ts",
|
|
13
9
|
"dependencies": {
|
|
14
|
-
"@graphql-mesh/config": "0.
|
|
15
|
-
"@graphql-mesh/graphql": "0.
|
|
16
|
-
"@graphql-mesh/merger-stitching": "0.15.
|
|
17
|
-
"@graphql-mesh/runtime": "0.
|
|
18
|
-
"@graphql-mesh/store": "0.
|
|
19
|
-
"@graphql-mesh/transform-cache": "0.
|
|
20
|
-
"@graphql-mesh/transform-federation": "0.8.
|
|
21
|
-
"@graphql-mesh/transform-filter-schema": "0.14.
|
|
22
|
-
"@graphql-mesh/types": "0.
|
|
23
|
-
"@graphql-mesh/utils": "0.
|
|
24
|
-
"@
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"apollo-tracing": "^0.15.0",
|
|
28
|
-
"camel-case": "^4.1.2",
|
|
29
|
-
"fetchache": "^0.1.1",
|
|
30
|
-
"graphql": "^16.3.0",
|
|
31
|
-
"micro": "^9.3.4",
|
|
32
|
-
"micro-cors": "^0.1.1",
|
|
33
|
-
"pascal-case": "^3.1.2",
|
|
34
|
-
"ts-tiny-invariant": "^1.0.5"
|
|
10
|
+
"@graphql-mesh/config": "0.35.3",
|
|
11
|
+
"@graphql-mesh/graphql": "0.24.0",
|
|
12
|
+
"@graphql-mesh/merger-stitching": "0.15.42",
|
|
13
|
+
"@graphql-mesh/runtime": "0.34.3",
|
|
14
|
+
"@graphql-mesh/store": "0.8.1",
|
|
15
|
+
"@graphql-mesh/transform-cache": "0.12.3",
|
|
16
|
+
"@graphql-mesh/transform-federation": "0.8.49",
|
|
17
|
+
"@graphql-mesh/transform-filter-schema": "0.14.48",
|
|
18
|
+
"@graphql-mesh/types": "0.71.3",
|
|
19
|
+
"@graphql-mesh/utils": "0.34.3",
|
|
20
|
+
"@graphql-yoga/node": "^2.3.0",
|
|
21
|
+
"graphql": "16.4.0",
|
|
22
|
+
"next": "12.1.5"
|
|
35
23
|
},
|
|
36
24
|
"devDependencies": {
|
|
37
|
-
"@graphcommerce/eslint-config-pwa": "^4.1.
|
|
38
|
-
"@graphcommerce/prettier-config-pwa": "^4.0.
|
|
25
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.6",
|
|
26
|
+
"@graphcommerce/prettier-config-pwa": "^4.0.6",
|
|
39
27
|
"@graphcommerce/typescript-config-pwa": "^4.0.2",
|
|
40
|
-
"@playwright/test": "^1.
|
|
41
|
-
"@types/micro-cors": "^0.1.2",
|
|
42
|
-
"graphql-tag": "2.12.6",
|
|
28
|
+
"@playwright/test": "^1.21.1",
|
|
43
29
|
"typescript": "4.6.3"
|
|
44
30
|
},
|
|
45
31
|
"sideEffects": false,
|
package/tsconfig.json
CHANGED
package/createServer.ts
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { processConfig } from '@graphql-mesh/config'
|
|
2
|
-
import { getMesh as getGraphQLMesh, MeshInstance } from '@graphql-mesh/runtime'
|
|
3
|
-
import { YamlConfig } from '@graphql-mesh/types'
|
|
4
|
-
import { ApolloServerPluginLandingPageGraphQLPlayground } from 'apollo-server-core'
|
|
5
|
-
import { ApolloServer } from 'apollo-server-micro'
|
|
6
|
-
import '@graphql-mesh/transform-filter-schema'
|
|
7
|
-
import '@graphql-mesh/graphql'
|
|
8
|
-
import '@graphql-mesh/merger-stitching'
|
|
9
|
-
import '@graphql-mesh/transform-cache'
|
|
10
|
-
import '@graphql-mesh/cache-inmemory-lru'
|
|
11
|
-
import '@vue/compiler-sfc'
|
|
12
|
-
import 'ts-tiny-invariant'
|
|
13
|
-
import 'micro'
|
|
14
|
-
import { plugin as apolloTracingPlugin } from 'apollo-tracing'
|
|
15
|
-
import cors from 'micro-cors'
|
|
16
|
-
|
|
17
|
-
export async function getMesh(config: unknown): Promise<MeshInstance> {
|
|
18
|
-
return getGraphQLMesh(await processConfig(config as YamlConfig.Config, { dir: process.cwd() }))
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export async function createServer(mesh: Promise<MeshInstance>, path: string) {
|
|
22
|
-
const meshInstance = await mesh
|
|
23
|
-
const apolloServer = new ApolloServer({
|
|
24
|
-
context: ({ req }) => req,
|
|
25
|
-
introspection: true,
|
|
26
|
-
...meshInstance,
|
|
27
|
-
plugins: [
|
|
28
|
-
ApolloServerPluginLandingPageGraphQLPlayground({
|
|
29
|
-
// @ts-expect-error https://github.com/graphql/graphql-playground/issues/1289
|
|
30
|
-
shareEnabled: true,
|
|
31
|
-
}),
|
|
32
|
-
// @ts-expect-error apolloTracingPlugin is not officially supported anymore
|
|
33
|
-
apolloTracingPlugin(),
|
|
34
|
-
],
|
|
35
|
-
})
|
|
36
|
-
await apolloServer.start()
|
|
37
|
-
|
|
38
|
-
const apolloHandler = apolloServer.createHandler({ path })
|
|
39
|
-
|
|
40
|
-
const corsHandler = cors({
|
|
41
|
-
allowMethods: ['GET', 'POST', 'OPTIONS'],
|
|
42
|
-
allowHeaders: [
|
|
43
|
-
'X-CSRF-Token',
|
|
44
|
-
'X-Requested-With',
|
|
45
|
-
'Accept',
|
|
46
|
-
'Accept-Version',
|
|
47
|
-
'Content-Length',
|
|
48
|
-
'Content-MD5',
|
|
49
|
-
'Content-Type',
|
|
50
|
-
'Date',
|
|
51
|
-
'X-Api-Version',
|
|
52
|
-
'Access-Control-Allow-Origin',
|
|
53
|
-
'X-HTTP-Method-Override',
|
|
54
|
-
'x-apollo-tracing',
|
|
55
|
-
'apollographql-client-name',
|
|
56
|
-
|
|
57
|
-
// Magento 2 related headers
|
|
58
|
-
'Authorization',
|
|
59
|
-
'Store',
|
|
60
|
-
'Preview-Version',
|
|
61
|
-
'Content-Currency',
|
|
62
|
-
'X-ReCaptcha',
|
|
63
|
-
],
|
|
64
|
-
})
|
|
65
|
-
return corsHandler((req, res) => (req.method === 'OPTIONS' ? res.end() : apolloHandler(req, res)))
|
|
66
|
-
}
|
package/next-env.d.ts
DELETED