@orion-js/graphql 3.6.5 → 3.7.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/lib/service/global.js
CHANGED
|
@@ -18,6 +18,7 @@ function Query(options) {
|
|
|
18
18
|
throw new Error(`You must pass resolver function to ${propertyKey}`);
|
|
19
19
|
target.resolvers = target.resolvers || {};
|
|
20
20
|
target.resolvers[propertyKey] = (0, resolvers_1.resolver)({
|
|
21
|
+
resolverId: propertyKey,
|
|
21
22
|
params: (0, otherParams_1.getTargetMetadata)(target, propertyKey, 'params'),
|
|
22
23
|
returns: (0, otherParams_1.getTargetMetadata)(target, propertyKey, 'returns'),
|
|
23
24
|
middlewares: (0, otherParams_1.getTargetMetadata)(target, propertyKey, 'middlewares'),
|
|
@@ -36,6 +37,7 @@ function Mutation(options) {
|
|
|
36
37
|
throw new Error(`You must pass resolver function to ${propertyKey}`);
|
|
37
38
|
target.resolvers = target.resolvers || {};
|
|
38
39
|
target.resolvers[propertyKey] = (0, resolvers_1.resolver)({
|
|
40
|
+
resolverId: propertyKey,
|
|
39
41
|
params: (0, otherParams_1.getTargetMetadata)(target, propertyKey, 'params'),
|
|
40
42
|
returns: (0, otherParams_1.getTargetMetadata)(target, propertyKey, 'returns'),
|
|
41
43
|
middlewares: (0, otherParams_1.getTargetMetadata)(target, propertyKey, 'middlewares'),
|
|
@@ -96,4 +96,30 @@ describe('Resolvers with service injection and middlewares', () => {
|
|
|
96
96
|
const result = await data.Person.getAge.execute({ parent: item });
|
|
97
97
|
expect(result).toBe(`hello Orion, nice to meet you`);
|
|
98
98
|
});
|
|
99
|
+
it('should pass the mutation name in the middleware', async () => {
|
|
100
|
+
let mutationName = '';
|
|
101
|
+
const exampleMiddleware = (0, resolvers_1.createResolverMiddleware)(async (executeOptions, next) => {
|
|
102
|
+
mutationName = executeOptions.options.resolverId;
|
|
103
|
+
await next();
|
|
104
|
+
});
|
|
105
|
+
let ExampleResolverService = class ExampleResolverService {
|
|
106
|
+
async sayHi(params) {
|
|
107
|
+
return 'text';
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
__decorate([
|
|
111
|
+
(0, index_1.Query)(),
|
|
112
|
+
(0, otherParams_1.ResolverReturns)(String),
|
|
113
|
+
(0, otherParams_1.UseMiddleware)(exampleMiddleware),
|
|
114
|
+
__metadata("design:type", Function),
|
|
115
|
+
__metadata("design:paramtypes", [Object]),
|
|
116
|
+
__metadata("design:returntype", Promise)
|
|
117
|
+
], ExampleResolverService.prototype, "sayHi", null);
|
|
118
|
+
ExampleResolverService = __decorate([
|
|
119
|
+
(0, index_1.Resolvers)()
|
|
120
|
+
], ExampleResolverService);
|
|
121
|
+
const resolvers = (0, index_1.getServiceResolvers)(ExampleResolverService);
|
|
122
|
+
await resolvers.sayHi.execute({ params: {} });
|
|
123
|
+
expect(mutationName).toBe('sayHi');
|
|
124
|
+
});
|
|
99
125
|
});
|
|
@@ -19,7 +19,7 @@ const createSubscription = function (options) {
|
|
|
19
19
|
subscription.subscribe = async (params, viewer) => {
|
|
20
20
|
const pubsub = (0, pubsub_1.getPubsub)();
|
|
21
21
|
try {
|
|
22
|
-
await (0, resolvers_1.checkPermissions)({ params, viewer }, options);
|
|
22
|
+
await (0, resolvers_1.checkPermissions)({ params, viewer, options: null }, options);
|
|
23
23
|
const channelName = (0, getChannelName_1.default)(subscription.name, params);
|
|
24
24
|
return pubsub.asyncIterator(channelName);
|
|
25
25
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/graphql",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.2",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"author": "nicolaslopezj",
|
|
6
6
|
"license": "MIT",
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
"dependencies": {
|
|
16
16
|
"@apollo/server": "^4.3.0",
|
|
17
17
|
"@graphql-tools/schema": "^9.0.12",
|
|
18
|
-
"@orion-js/env": "^3.
|
|
19
|
-
"@orion-js/helpers": "^3.
|
|
20
|
-
"@orion-js/http": "^3.
|
|
21
|
-
"@orion-js/models": "^3.
|
|
22
|
-
"@orion-js/resolvers": "^3.
|
|
23
|
-
"@orion-js/schema": "^3.
|
|
24
|
-
"@orion-js/services": "^3.
|
|
25
|
-
"@orion-js/typed-model": "^3.
|
|
18
|
+
"@orion-js/env": "^3.7.2",
|
|
19
|
+
"@orion-js/helpers": "^3.7.2",
|
|
20
|
+
"@orion-js/http": "^3.7.2",
|
|
21
|
+
"@orion-js/models": "^3.7.2",
|
|
22
|
+
"@orion-js/resolvers": "^3.7.2",
|
|
23
|
+
"@orion-js/schema": "^3.7.2",
|
|
24
|
+
"@orion-js/services": "^3.7.2",
|
|
25
|
+
"@orion-js/typed-model": "^3.7.2",
|
|
26
26
|
"graphql-iso-date": "^3.6.1",
|
|
27
27
|
"graphql-subscriptions": "2.0.0",
|
|
28
28
|
"graphql-ws": "^5.11.2",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"publishConfig": {
|
|
52
52
|
"access": "public"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "78fd47c75e4a7a280850e7f779b08a326bac34c6"
|
|
55
55
|
}
|