@@ -15,7 +15,6 @@ export const GQ_QUERY_KEY = 'gq_query';
1515export const GQ_MUTATION_KEY = 'gq_mutation' ;
1616export const GQ_SUBSCRIPTION_KEY = 'gq_subscription' ;
1717export const GQ_FIELDS_KEY = 'gq_fields' ;
18- export const GQ_OBJECT_METADATA_KEY = 'gq_object_type' ;
1918export const GQ_DESCRIPTION_KEY = 'gq_description' ;
2019
2120export interface TypeMetadata {
@@ -46,12 +45,6 @@ export interface FieldTypeMetadata extends RootMetadata {
4645 context ?: ContextMetadata ;
4746}
4847
49- export interface ObjectTypeMetadata {
50- name ?: string ;
51- description ?: string ;
52- isInput ?: boolean ;
53- }
54-
5548export interface DefaultOption {
5649 description ?: string ;
5750}
@@ -95,16 +88,6 @@ function mergeDescriptionMetadata(target: any, sourceMetadata: any): any {
9588 return sourceMetadata ;
9689}
9790
98- function createOrSetObjectTypeMetadata ( target : any , metadata : ObjectTypeMetadata ) {
99- if ( ! Reflect . hasMetadata ( GQ_OBJECT_METADATA_KEY , target . prototype ) ) {
100- let mergedMetadata = mergeDescriptionMetadata ( target , metadata ) ;
101- Reflect . defineMetadata ( GQ_OBJECT_METADATA_KEY , mergedMetadata , target . prototype ) ;
102- } else {
103- const originalMetadata = Reflect . getMetadata ( GQ_OBJECT_METADATA_KEY , target . prototype ) as ObjectTypeMetadata ;
104- Object . assign ( originalMetadata , metadata ) ;
105- }
106- }
107-
10891function createOrSetFieldTypeMetadata ( target : any , metadata : FieldTypeMetadata ) {
10992 let fieldDefs : FieldTypeMetadata [ ] ;
11093 if ( ! Reflect . hasMetadata ( GQ_FIELDS_KEY , target ) ) {
@@ -215,13 +198,7 @@ function setDescriptionMetadata(description: string, target: any, propertyKey: s
215198 createPropertyDescriptionMetadata ( target , description , propertyKey ) ;
216199 }
217200 } else {
218- if ( Reflect . hasMetadata ( GQ_OBJECT_METADATA_KEY , target . prototype ) ) {
219- createOrSetObjectTypeMetadata ( target , {
220- description : description ,
221- } ) ;
222- } else {
223- createDescriptionMetadata ( target , description ) ;
224- }
201+ createDescriptionMetadata ( target , description ) ;
225202 }
226203}
227204
@@ -265,38 +242,6 @@ function setPaginationMetadata(target: any, propertyKey: string, methodDescripto
265242 } ;
266243}
267244
268- export function ObjectType ( option ?: DefaultOption ) {
269- return function ( target : any ) {
270- createOrSetObjectTypeMetadata ( target , {
271- name : target . name ,
272- isInput : false ,
273- } ) ;
274-
275- if ( option ) {
276- // description
277- if ( option . description ) {
278- setDescriptionMetadata ( option . description , target ) ;
279- }
280- }
281- } as Function ;
282- }
283-
284- export function InputObjectType ( option ?: DefaultOption ) {
285- return function ( target : any ) {
286- createOrSetObjectTypeMetadata ( target , {
287- name : target . name ,
288- isInput : true ,
289- } ) ;
290-
291- if ( option ) {
292- // description
293- if ( option . description ) {
294- setDescriptionMetadata ( option . description , target ) ;
295- }
296- }
297- } as Function ;
298- }
299-
300245export function Field ( option ?: FieldOption ) {
301246 return function ( target : any , propertyKey : any , methodDescriptor ?: any ) {
302247 createOrSetFieldTypeMetadata ( target , {
0 commit comments