nest-access-control 2.0.3 → 2.0.4
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.
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.UserRoles = void 0;
|
|
4
4
|
const common_1 = require("@nestjs/common");
|
|
5
|
-
const graphql_1 = require("@nestjs/graphql");
|
|
6
5
|
function userFactory(ctx) {
|
|
7
6
|
const contextType = ctx.getType();
|
|
8
7
|
if (contextType === 'http') {
|
|
@@ -19,8 +18,10 @@ function userFactory(ctx) {
|
|
|
19
18
|
throw new Error('Websockets context is not implemented yet');
|
|
20
19
|
}
|
|
21
20
|
else if (ctx.getType() === 'graphql') {
|
|
21
|
+
// inline require here, since we don't want to require the graphql module in the pacakge.
|
|
22
|
+
const { GqlExecutionContext } = require('@nestjs/graphql');
|
|
22
23
|
// do something that is only important in the context of GraphQL requests
|
|
23
|
-
const gqlExecutionContext =
|
|
24
|
+
const gqlExecutionContext = GqlExecutionContext.create(ctx);
|
|
24
25
|
return gqlExecutionContext.getContext().req.user;
|
|
25
26
|
}
|
|
26
27
|
throw new Error('Invalid context');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nest-access-control",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"description": "Access Control Module For Nestjs Framework",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -28,12 +28,10 @@
|
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@nestjs/common": "^7.6.18",
|
|
30
30
|
"@nestjs/core": "^7.6.18",
|
|
31
|
-
"@nestjs/graphql": "^7.6.18",
|
|
32
31
|
"@nestjs/testing": "^7.6.18",
|
|
33
32
|
"@types/jest": "^27.0.0",
|
|
34
33
|
"@types/node": "^10.1.2",
|
|
35
34
|
"coveralls": "^3.0.1",
|
|
36
|
-
"graphql": "15.0.0",
|
|
37
35
|
"gulp": "^4.0.0",
|
|
38
36
|
"gulp-sequence": "^1.0.0",
|
|
39
37
|
"gulp-typescript": "^5.0.1",
|
|
@@ -51,5 +49,12 @@
|
|
|
51
49
|
"homepage": "https://github.com/nestjsx/nest-access-control#readme",
|
|
52
50
|
"dependencies": {
|
|
53
51
|
"accesscontrol": "^2.2.1"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"@apollo/gateway": "^0.45.1",
|
|
55
|
+
"@nestjs/graphql": "^7.6.18",
|
|
56
|
+
"apollo-server-core": "^3.6.1",
|
|
57
|
+
"graphql": "15.0.0",
|
|
58
|
+
"ts-morph": "^13.0.2"
|
|
54
59
|
}
|
|
55
60
|
}
|