@rxdi/graphql 0.7.181 → 0.7.182
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.
|
@@ -1,2 +1,19 @@
|
|
|
1
|
-
import { GraphQLInputFieldConfigMap } from
|
|
2
|
-
|
|
1
|
+
import { GraphQLInputFieldConfigMap } from 'graphql';
|
|
2
|
+
/**
|
|
3
|
+
* @Mutation annotation is creating GraphQLInputObjectType dynamically
|
|
4
|
+
* @param fields parameter is type GraphQLInputFieldConfigMap
|
|
5
|
+
* @param meta parameter has "description" field which is then added to the new GraphQLInputObjectType
|
|
6
|
+
*
|
|
7
|
+
* "input" param is actually "fields" param inside the dynamically generated GraphQLInputObjectType
|
|
8
|
+
*
|
|
9
|
+
* ```typescript
|
|
10
|
+
* new GraphQLInputObjectType({
|
|
11
|
+
* name: 'Taken from the descriptor name automatically',
|
|
12
|
+
* description: 'Taken from "meta.description" field'
|
|
13
|
+
* fields: input,
|
|
14
|
+
* })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare function Mutation(fields?: GraphQLInputFieldConfigMap, meta?: {
|
|
18
|
+
description?: string;
|
|
19
|
+
}): (t: any, propKey: string, descriptor: TypedPropertyDescriptor<any>) => TypedPropertyDescriptor<any>;
|
|
@@ -1,7 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Mutation = void 0;
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* @Mutation annotation is creating GraphQLInputObjectType dynamically
|
|
6
|
+
* @param fields parameter is type GraphQLInputFieldConfigMap
|
|
7
|
+
* @param meta parameter has "description" field which is then added to the new GraphQLInputObjectType
|
|
8
|
+
*
|
|
9
|
+
* "input" param is actually "fields" param inside the dynamically generated GraphQLInputObjectType
|
|
10
|
+
*
|
|
11
|
+
* ```typescript
|
|
12
|
+
* new GraphQLInputObjectType({
|
|
13
|
+
* name: 'Taken from the descriptor name automatically',
|
|
14
|
+
* description: 'Taken from "meta.description" field'
|
|
15
|
+
* fields: input,
|
|
16
|
+
* })
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
function Mutation(fields, meta) {
|
|
5
20
|
return (t, propKey, descriptor) => {
|
|
6
21
|
const originalMethod = descriptor.value;
|
|
7
22
|
const target = t;
|
|
@@ -9,15 +24,14 @@ function Mutation(input, meta) {
|
|
|
9
24
|
descriptor.value = function (...args) {
|
|
10
25
|
const returnValue = Object.create({});
|
|
11
26
|
returnValue.resolve = originalMethod;
|
|
12
|
-
returnValue.args =
|
|
27
|
+
returnValue.args = fields ? fields : null;
|
|
13
28
|
returnValue.method_type = 'mutation';
|
|
14
29
|
returnValue.method_name = propertyKey;
|
|
15
30
|
returnValue.description = meta ? meta.description : null;
|
|
16
31
|
returnValue.target = target;
|
|
17
32
|
return returnValue;
|
|
18
33
|
};
|
|
19
|
-
target.constructor._descriptors =
|
|
20
|
-
target.constructor._descriptors || new Map();
|
|
34
|
+
target.constructor._descriptors = target.constructor._descriptors || new Map();
|
|
21
35
|
target.constructor._descriptors.set(propertyKey, descriptor);
|
|
22
36
|
return descriptor;
|
|
23
37
|
};
|
|
@@ -20,4 +20,21 @@ export declare class GenericGapiResolversType implements GraphQLControllerOption
|
|
|
20
20
|
};
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
/**
|
|
24
|
+
* @Query annotation is creating GraphQLInputObjectType dynamically
|
|
25
|
+
* @param fields parameter is type GraphQLInputFieldConfigMap
|
|
26
|
+
* @param meta parameter has "description" field which is then added to the new GraphQLInputObjectType
|
|
27
|
+
*
|
|
28
|
+
* "input" param is actually "fields" param inside the dynamically generated GraphQLInputObjectType
|
|
29
|
+
*
|
|
30
|
+
* ```typescript
|
|
31
|
+
* new GraphQLInputObjectType({
|
|
32
|
+
* name: 'Taken from the descriptor name automatically',
|
|
33
|
+
* description: 'Taken from "meta.description" field'
|
|
34
|
+
* fields: input,
|
|
35
|
+
* })
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export declare function Query<T>(fields?: GraphQLInputFieldConfigMap, meta?: {
|
|
39
|
+
description?: string;
|
|
40
|
+
}): (t: any, propKey: any, descriptor: TypedPropertyDescriptor<any>) => TypedPropertyDescriptor<any>;
|
|
@@ -4,7 +4,22 @@ exports.Query = exports.GenericGapiResolversType = void 0;
|
|
|
4
4
|
class GenericGapiResolversType {
|
|
5
5
|
}
|
|
6
6
|
exports.GenericGapiResolversType = GenericGapiResolversType;
|
|
7
|
-
|
|
7
|
+
/**
|
|
8
|
+
* @Query annotation is creating GraphQLInputObjectType dynamically
|
|
9
|
+
* @param fields parameter is type GraphQLInputFieldConfigMap
|
|
10
|
+
* @param meta parameter has "description" field which is then added to the new GraphQLInputObjectType
|
|
11
|
+
*
|
|
12
|
+
* "input" param is actually "fields" param inside the dynamically generated GraphQLInputObjectType
|
|
13
|
+
*
|
|
14
|
+
* ```typescript
|
|
15
|
+
* new GraphQLInputObjectType({
|
|
16
|
+
* name: 'Taken from the descriptor name automatically',
|
|
17
|
+
* description: 'Taken from "meta.description" field'
|
|
18
|
+
* fields: input,
|
|
19
|
+
* })
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
function Query(fields, meta) {
|
|
8
23
|
return (t, propKey, descriptor) => {
|
|
9
24
|
const originalMethod = descriptor.value;
|
|
10
25
|
const target = t;
|
|
@@ -12,7 +27,7 @@ function Query(options, meta) {
|
|
|
12
27
|
descriptor.value = function (...args) {
|
|
13
28
|
const returnValue = Object.create({});
|
|
14
29
|
returnValue.resolve = originalMethod;
|
|
15
|
-
returnValue.args =
|
|
30
|
+
returnValue.args = fields ? fields : null;
|
|
16
31
|
returnValue.method_type = 'query';
|
|
17
32
|
returnValue.method_name = propertyKey;
|
|
18
33
|
returnValue.description = meta ? meta.description : null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rxdi/graphql",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.182",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/rxdi/graphql"
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
},
|
|
41
41
|
"devDependencies": {
|
|
42
42
|
"graphql": "^14.5.8",
|
|
43
|
-
"@rxdi/core": "^0.7.
|
|
44
|
-
"@rxdi/hapi": "^0.7.
|
|
43
|
+
"@rxdi/core": "^0.7.181",
|
|
44
|
+
"@rxdi/hapi": "^0.7.181",
|
|
45
45
|
"@types/graphql": "^14.5.0",
|
|
46
46
|
"@types/jest": "^24.0.22",
|
|
47
47
|
"@types/node": "^12.0.10",
|