@envelop/graphql-modules 3.4.0-alpha-26c4ae2.0 → 3.4.0
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/README.md +42 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
## `@envelop/graphql-modules`
|
|
2
|
+
|
|
3
|
+
This plugins integrates [`graphql-modules`](https://github.com/Urigo/graphql-modules) execution lifecycle into the GraphQL execution flow.
|
|
4
|
+
|
|
5
|
+
If you are using `graphql-modules` dependency injection - this setup is needed in order to make sure `Injector` is created and destroyed at the right time.
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
yarn add @envelop/graphql-modules
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage Example
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { envelop } from '@envelop/core';
|
|
17
|
+
import { createApplication } from 'graphql-modules';
|
|
18
|
+
import { useGraphQLModules } from '@envelop/graphql-modules';
|
|
19
|
+
|
|
20
|
+
const myApp = createApplication({
|
|
21
|
+
modules: [ ... ]
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
const getEnveloped = envelop({
|
|
25
|
+
plugins: [
|
|
26
|
+
// ... other plugins ...
|
|
27
|
+
useGraphQLModules(myApp),
|
|
28
|
+
],
|
|
29
|
+
});
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Then, you can use GraphQL-Modules `injector` in your resolvers:
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
const resolvers = {
|
|
36
|
+
Query: {
|
|
37
|
+
foo: (root, args, context, info) => {
|
|
38
|
+
const myProviderInstance = context.injector.get(...);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
```
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/graphql-modules",
|
|
3
|
-
"version": "3.4.0
|
|
3
|
+
"version": "3.4.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "2.4.0
|
|
6
|
+
"@envelop/core": "^2.4.0",
|
|
7
7
|
"graphql-modules": "^1 || ^2.0.0",
|
|
8
8
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
9
9
|
},
|