@envelop/graphql-middleware 3.4.0 → 3.4.1-alpha-88024a80.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 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -15,9 +15,9 @@ yarn add graphql-middleware @envelop/graphql-middleware
|
|
|
15
15
|
You can use any type of middleware defined for `graphql-middleware`, here's an example for doing that with [`graphql-shield`](https://github.com/maticzav/graphql-shield):
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
|
-
import { envelop } from '@envelop/core'
|
|
19
|
-
import { useGraphQLMiddleware } from '@envelop/graphql-middleware'
|
|
20
|
-
import { rule, shield, and, or, not } from 'graphql-shield'
|
|
18
|
+
import { envelop } from '@envelop/core'
|
|
19
|
+
import { useGraphQLMiddleware } from '@envelop/graphql-middleware'
|
|
20
|
+
import { rule, shield, and, or, not } from 'graphql-shield'
|
|
21
21
|
|
|
22
22
|
// ...
|
|
23
23
|
// You can find a complete example here: https://github.com/maticzav/graphql-shield#graphql-yoga
|
|
@@ -25,20 +25,20 @@ import { rule, shield, and, or, not } from 'graphql-shield';
|
|
|
25
25
|
|
|
26
26
|
const permissions = shield({
|
|
27
27
|
Query: {
|
|
28
|
-
fruits: and(isAuthenticated, or(isAdmin, isEditor))
|
|
28
|
+
fruits: and(isAuthenticated, or(isAdmin, isEditor))
|
|
29
29
|
},
|
|
30
30
|
Mutation: {
|
|
31
|
-
addFruitToBasket: isAuthenticated
|
|
31
|
+
addFruitToBasket: isAuthenticated
|
|
32
32
|
},
|
|
33
33
|
Fruit: isAuthenticated,
|
|
34
|
-
Customer: isAdmin
|
|
35
|
-
})
|
|
34
|
+
Customer: isAdmin
|
|
35
|
+
})
|
|
36
36
|
|
|
37
37
|
const getEnveloped = envelop({
|
|
38
38
|
plugins: [
|
|
39
39
|
// ... other plugins ...
|
|
40
40
|
useSchema(mySchema),
|
|
41
|
-
useGraphQLMiddleware([permissions])
|
|
42
|
-
]
|
|
43
|
-
})
|
|
41
|
+
useGraphQLMiddleware([permissions])
|
|
42
|
+
]
|
|
43
|
+
})
|
|
44
44
|
```
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@envelop/graphql-middleware",
|
|
3
|
-
"version": "3.4.0",
|
|
3
|
+
"version": "3.4.1-alpha-88024a80.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"peerDependencies": {
|
|
6
|
-
"@envelop/core": "
|
|
6
|
+
"@envelop/core": "2.4.1-alpha-88024a80.0",
|
|
7
7
|
"graphql-middleware": "^6.0.0",
|
|
8
8
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0"
|
|
9
9
|
},
|