@envelop/graphql-modules 4.0.0-alpha-d0d0776.0 → 4.0.0-alpha-ccec0fc.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 +10 -8
- package/{index.js → cjs/index.js} +5 -6
- package/cjs/package.json +1 -0
- package/{index.mjs → esm/index.js} +3 -4
- package/package.json +29 -17
- /package/{index.d.ts → typings/index.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -13,20 +13,22 @@ yarn add @envelop/graphql-modules
|
|
|
13
13
|
## Usage Example
|
|
14
14
|
|
|
15
15
|
```ts
|
|
16
|
-
import { envelop } from '@envelop/core'
|
|
17
|
-
import { createApplication } from 'graphql-modules'
|
|
18
|
-
import { useGraphQLModules } from '@envelop/graphql-modules'
|
|
16
|
+
import { envelop } from '@envelop/core'
|
|
17
|
+
import { createApplication } from 'graphql-modules'
|
|
18
|
+
import { useGraphQLModules } from '@envelop/graphql-modules'
|
|
19
19
|
|
|
20
20
|
const myApp = createApplication({
|
|
21
|
-
modules: [
|
|
21
|
+
modules: [
|
|
22
|
+
/* ... */
|
|
23
|
+
]
|
|
22
24
|
})
|
|
23
25
|
|
|
24
26
|
const getEnveloped = envelop({
|
|
25
27
|
plugins: [
|
|
26
28
|
// ... other plugins ...
|
|
27
|
-
useGraphQLModules(myApp)
|
|
28
|
-
]
|
|
29
|
-
})
|
|
29
|
+
useGraphQLModules(myApp)
|
|
30
|
+
]
|
|
31
|
+
})
|
|
30
32
|
```
|
|
31
33
|
|
|
32
34
|
Then, you can use GraphQL-Modules `injector` in your resolvers:
|
|
@@ -35,7 +37,7 @@ Then, you can use GraphQL-Modules `injector` in your resolvers:
|
|
|
35
37
|
const resolvers = {
|
|
36
38
|
Query: {
|
|
37
39
|
foo: (root, args, context, info) => {
|
|
38
|
-
const myProviderInstance = context.injector.get(...)
|
|
40
|
+
const myProviderInstance = context.injector.get(/* ... */)
|
|
39
41
|
}
|
|
40
42
|
}
|
|
41
43
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useGraphQLModules = void 0;
|
|
4
|
+
const compat_1 = require("@graphql-tools/compat");
|
|
5
5
|
const graphqlModulesControllerSymbol = Symbol('GRAPHQL_MODULES');
|
|
6
6
|
const useGraphQLModules = (app) => {
|
|
7
7
|
return {
|
|
8
8
|
onPluginInit({ setSchema }) {
|
|
9
|
-
setSchema(app.schema);
|
|
9
|
+
setSchema(compat_1.compatSchema.toTools(app.schema));
|
|
10
10
|
},
|
|
11
11
|
onContextBuilding({ extendContext, context }) {
|
|
12
12
|
const controller = app.createOperationController({
|
|
@@ -30,5 +30,4 @@ const useGraphQLModules = (app) => {
|
|
|
30
30
|
},
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
|
|
34
33
|
exports.useGraphQLModules = useGraphQLModules;
|
package/cjs/package.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"commonjs"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { compatSchema } from '@graphql-tools/compat';
|
|
1
2
|
const graphqlModulesControllerSymbol = Symbol('GRAPHQL_MODULES');
|
|
2
|
-
const useGraphQLModules = (app) => {
|
|
3
|
+
export const useGraphQLModules = (app) => {
|
|
3
4
|
return {
|
|
4
5
|
onPluginInit({ setSchema }) {
|
|
5
|
-
setSchema(app.schema);
|
|
6
|
+
setSchema(compatSchema.toTools(app.schema));
|
|
6
7
|
},
|
|
7
8
|
onContextBuilding({ extendContext, context }) {
|
|
8
9
|
const controller = app.createOperationController({
|
|
@@ -26,5 +27,3 @@ const useGraphQLModules = (app) => {
|
|
|
26
27
|
},
|
|
27
28
|
};
|
|
28
29
|
};
|
|
29
|
-
|
|
30
|
-
export { useGraphQLModules };
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/graphql-modules",
|
|
3
|
-
"version": "4.0.0-alpha-
|
|
3
|
+
"version": "4.0.0-alpha-ccec0fc.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "3.0.0-alpha-
|
|
7
|
-
"graphql": "
|
|
8
|
-
"graphql-
|
|
6
|
+
"@envelop/core": "3.0.0-alpha-ccec0fc.0",
|
|
7
|
+
"@graphql-tools/graphql": "0.1.0-alpha-e7752ba5.0",
|
|
8
|
+
"@graphql-tools/compat": "0.0.1-alpha-e7752ba5.0",
|
|
9
|
+
"graphql-modules": "^1 || ^2.0.0",
|
|
10
|
+
"graphql": "^15 |^16"
|
|
9
11
|
},
|
|
12
|
+
"dependencies": {},
|
|
10
13
|
"repository": {
|
|
11
14
|
"type": "git",
|
|
12
15
|
"url": "https://github.com/n1ru4l/envelop.git",
|
|
@@ -14,33 +17,42 @@
|
|
|
14
17
|
},
|
|
15
18
|
"author": "Dotan Simha <dotansimha@gmail.com>",
|
|
16
19
|
"license": "MIT",
|
|
17
|
-
"main": "index.js",
|
|
18
|
-
"module": "index.
|
|
19
|
-
"typings": "index.d.ts",
|
|
20
|
+
"main": "cjs/index.js",
|
|
21
|
+
"module": "esm/index.js",
|
|
22
|
+
"typings": "typings/index.d.ts",
|
|
20
23
|
"typescript": {
|
|
21
|
-
"definition": "index.d.ts"
|
|
24
|
+
"definition": "typings/index.d.ts"
|
|
22
25
|
},
|
|
26
|
+
"type": "module",
|
|
23
27
|
"exports": {
|
|
24
28
|
".": {
|
|
25
29
|
"require": {
|
|
26
|
-
"
|
|
27
|
-
"
|
|
30
|
+
"types": "./typings/index.d.ts",
|
|
31
|
+
"default": "./cjs/index.js"
|
|
28
32
|
},
|
|
29
33
|
"import": {
|
|
30
|
-
"
|
|
31
|
-
"
|
|
34
|
+
"types": "./typings/index.d.ts",
|
|
35
|
+
"default": "./esm/index.js"
|
|
36
|
+
},
|
|
37
|
+
"default": {
|
|
38
|
+
"types": "./typings/index.d.ts",
|
|
39
|
+
"default": "./esm/index.js"
|
|
32
40
|
}
|
|
33
41
|
},
|
|
34
42
|
"./*": {
|
|
35
43
|
"require": {
|
|
36
|
-
"
|
|
37
|
-
"
|
|
44
|
+
"types": "./typings/*.d.ts",
|
|
45
|
+
"default": "./cjs/*.js"
|
|
38
46
|
},
|
|
39
47
|
"import": {
|
|
40
|
-
"
|
|
41
|
-
"
|
|
48
|
+
"types": "./typings/*.d.ts",
|
|
49
|
+
"default": "./esm/*.js"
|
|
50
|
+
},
|
|
51
|
+
"default": {
|
|
52
|
+
"types": "./typings/*.d.ts",
|
|
53
|
+
"default": "./esm/*.js"
|
|
42
54
|
}
|
|
43
55
|
},
|
|
44
56
|
"./package.json": "./package.json"
|
|
45
57
|
}
|
|
46
|
-
}
|
|
58
|
+
}
|
|
File without changes
|