1
1
import Maybe from '../tsutils/Maybe' ;
2
2
import { PromiseOrValue } from '../jsutils/PromiseOrValue' ;
3
+ import { Path } from '../jsutils/Path' ;
3
4
import {
4
5
ScalarTypeDefinitionNode ,
5
6
ObjectTypeDefinitionNode ,
@@ -75,6 +76,7 @@ export function assertNonNullType(type: any): GraphQLNonNull<any>;
75
76
/**
76
77
* These types may be used as input types for arguments and directives.
77
78
*/
79
+ // TS_SPECIFIC: TS does not allow recursive type definitions, hence the `any`s
78
80
export type GraphQLInputType =
79
81
| GraphQLScalarType
80
82
| GraphQLEnumType
@@ -94,6 +96,7 @@ export function assertInputType(type: any): GraphQLInputType;
94
96
/**
95
97
* These types may be used as output types as the result of fields.
96
98
*/
99
+ // TS_SPECIFIC: TS does not allow recursive type definitions, hence the `any`s
97
100
export type GraphQLOutputType =
98
101
| GraphQLScalarType
99
102
| GraphQLObjectType
@@ -285,13 +288,16 @@ export class GraphQLScalarType {
285
288
serialize : GraphQLScalarSerializer < any > ;
286
289
parseValue : GraphQLScalarValueParser < any > ;
287
290
parseLiteral : GraphQLScalarLiteralParser < any > ;
291
+ extensions : Maybe < Readonly < Record < string , any > > > ;
288
292
astNode : Maybe < ScalarTypeDefinitionNode > ;
289
293
extensionASTNodes : Maybe < ReadonlyArray < ScalarTypeExtensionNode > > ;
290
294
constructor ( config : GraphQLScalarTypeConfig < any , any > ) ;
291
295
292
296
toConfig ( ) : GraphQLScalarTypeConfig < any , any > & {
297
+ serialize : GraphQLScalarSerializer < any > ;
293
298
parseValue : GraphQLScalarValueParser < any > ;
294
299
parseLiteral : GraphQLScalarLiteralParser < any > ;
300
+ extensions : Maybe < Readonly < Record < string , any > > > ;
295
301
extensionASTNodes : ReadonlyArray < ScalarTypeExtensionNode > ;
296
302
} ;
297
303
@@ -320,6 +326,7 @@ export interface GraphQLScalarTypeConfig<TInternal, TExternal> {
320
326
parseValue ?: GraphQLScalarValueParser < TInternal > ;
321
327
// Parses an externally provided literal value to use as an input.
322
328
parseLiteral ?: GraphQLScalarLiteralParser < TInternal > ;
329
+ extensions ?: Maybe < Readonly < Record < string , any > > > ;
323
330
astNode ?: Maybe < ScalarTypeDefinitionNode > ;
324
331
extensionASTNodes ?: Maybe < ReadonlyArray < ScalarTypeExtensionNode > > ;
325
332
}
@@ -368,9 +375,10 @@ export class GraphQLObjectType<
368
375
> {
369
376
name : string ;
370
377
description : Maybe < string > ;
378
+ isTypeOf : Maybe < GraphQLIsTypeOfFn < TSource , TContext > > ;
379
+ extensions : Maybe < Readonly < Record < string , any > > > ;
371
380
astNode : Maybe < ObjectTypeDefinitionNode > ;
372
381
extensionASTNodes : Maybe < ReadonlyArray < ObjectTypeExtensionNode > > ;
373
- isTypeOf : Maybe < GraphQLIsTypeOfFn < TSource , TContext > > ;
374
382
375
383
constructor ( config : GraphQLObjectTypeConfig < TSource , TContext , TArgs > ) ;
376
384
getFields ( ) : GraphQLFieldMap < any , TContext , TArgs > ;
@@ -387,20 +395,27 @@ export class GraphQLObjectType<
387
395
inspect ( ) : string ;
388
396
}
389
397
398
+ export function argsToArgsConfig (
399
+ args : ReadonlyArray < GraphQLArgument > ,
400
+ ) : GraphQLFieldConfigArgumentMap ;
401
+
402
+ // TS_SPECIFIC: TArgs
390
403
export interface GraphQLObjectTypeConfig <
391
404
TSource ,
392
405
TContext ,
393
406
TArgs = { [ key : string ] : any }
394
407
> {
395
408
name : string ;
409
+ description ?: Maybe < string > ;
396
410
interfaces ?: Thunk < Maybe < GraphQLInterfaceType [ ] > > ;
397
411
fields : Thunk < GraphQLFieldConfigMap < TSource , TContext , TArgs > > ;
398
412
isTypeOf ?: Maybe < GraphQLIsTypeOfFn < TSource , TContext > > ;
399
- description ?: Maybe < string > ;
413
+ extensions ?: Maybe < Readonly < Record < string , any > > > ;
400
414
astNode ?: Maybe < ObjectTypeDefinitionNode > ;
401
415
extensionASTNodes ?: Maybe < ReadonlyArray < ObjectTypeExtensionNode > > ;
402
416
}
403
417
418
+ // TS_SPECIFIC: TArgs
404
419
export type GraphQLTypeResolver <
405
420
TSource ,
406
421
TContext ,
@@ -435,30 +450,26 @@ export interface GraphQLResolveInfo {
435
450
readonly fieldNodes : ReadonlyArray < FieldNode > ;
436
451
readonly returnType : GraphQLOutputType ;
437
452
readonly parentType : GraphQLObjectType ;
438
- readonly path : ResponsePath ;
453
+ readonly path : Path ;
439
454
readonly schema : GraphQLSchema ;
440
455
readonly fragments : { [ key : string ] : FragmentDefinitionNode } ;
441
456
readonly rootValue : any ;
442
457
readonly operation : OperationDefinitionNode ;
443
458
readonly variableValues : { [ variableName : string ] : any } ;
444
459
}
445
460
446
- export type ResponsePath = {
447
- readonly prev : ResponsePath | undefined ;
448
- readonly key : string | number ;
449
- } ;
450
-
451
461
export interface GraphQLFieldConfig <
452
462
TSource ,
453
463
TContext ,
454
464
TArgs = { [ argName : string ] : any }
455
465
> {
466
+ description ?: Maybe < string > ;
456
467
type : GraphQLOutputType ;
457
468
args ?: GraphQLFieldConfigArgumentMap ;
458
469
resolve ?: GraphQLFieldResolver < TSource , TContext , TArgs > ;
459
470
subscribe ?: GraphQLFieldResolver < TSource , TContext , TArgs > ;
460
471
deprecationReason ?: Maybe < string > ;
461
- description ?: Maybe < string > ;
472
+ extensions ?: Maybe < Readonly < Record < string , any > > > ;
462
473
astNode ?: Maybe < FieldDefinitionNode > ;
463
474
}
464
475
@@ -467,12 +478,14 @@ export type GraphQLFieldConfigArgumentMap = {
467
478
} ;
468
479
469
480
export interface GraphQLArgumentConfig {
481
+ description ?: Maybe < string > ;
470
482
type : GraphQLInputType ;
471
483
defaultValue ?: any ;
472
- description ?: Maybe < string > ;
484
+ extensions ?: Maybe < Readonly < Record < string , any > > > ;
473
485
astNode ?: Maybe < InputValueDefinitionNode > ;
474
486
}
475
487
488
+ // TS_SPECIFIC: TArgs
476
489
export type GraphQLFieldConfigMap <
477
490
TSource ,
478
491
TContext ,
@@ -494,19 +507,22 @@ export interface GraphQLField<
494
507
subscribe ?: GraphQLFieldResolver < TSource , TContext , TArgs > ;
495
508
isDeprecated ?: boolean ;
496
509
deprecationReason ?: Maybe < string > ;
510
+ extensions : Maybe < Readonly < Record < string , any > > > ;
497
511
astNode ?: Maybe < FieldDefinitionNode > ;
498
512
}
499
513
500
514
export interface GraphQLArgument {
501
515
name : string ;
516
+ description : Maybe < string > ;
502
517
type : GraphQLInputType ;
503
- defaultValue ? : any ;
504
- description ? : Maybe < string > ;
505
- astNode ? : Maybe < InputValueDefinitionNode > ;
518
+ defaultValue : any ;
519
+ extensions : Maybe < Readonly < Record < string , any > > > ;
520
+ astNode : Maybe < InputValueDefinitionNode > ;
506
521
}
507
522
508
523
export function isRequiredArgument ( arg : GraphQLArgument ) : boolean ;
509
524
525
+ // TS_SPECIFIC: TArgs
510
526
export type GraphQLFieldMap <
511
527
TSource ,
512
528
TContext ,
@@ -536,16 +552,18 @@ export type GraphQLFieldMap<
536
552
export class GraphQLInterfaceType {
537
553
name : string ;
538
554
description : Maybe < string > ;
555
+ resolveType : Maybe < GraphQLTypeResolver < any , any > > ;
556
+ extensions : Maybe < Readonly < Record < string , any > > > ;
539
557
astNode ?: Maybe < InterfaceTypeDefinitionNode > ;
540
558
extensionASTNodes : Maybe < ReadonlyArray < InterfaceTypeExtensionNode > > ;
541
- resolveType : Maybe < GraphQLTypeResolver < any , any > > ;
542
559
543
560
constructor ( config : GraphQLInterfaceTypeConfig < any , any > ) ;
544
561
545
562
getFields ( ) : GraphQLFieldMap < any , any > ;
546
563
547
564
toConfig ( ) : GraphQLInterfaceTypeConfig < any , any > & {
548
565
fields : GraphQLFieldConfigMap < any , any > ;
566
+ extensions : Maybe < Readonly < Record < string , any > > > ;
549
567
extensionASTNodes : ReadonlyArray < InterfaceTypeExtensionNode > ;
550
568
} ;
551
569
@@ -554,20 +572,22 @@ export class GraphQLInterfaceType {
554
572
inspect ( ) : string ;
555
573
}
556
574
575
+ // TS_SPECIFIC: TArgs
557
576
export interface GraphQLInterfaceTypeConfig <
558
577
TSource ,
559
578
TContext ,
560
579
TArgs = { [ key : string ] : any }
561
580
> {
562
581
name : string ;
582
+ description ?: Maybe < string > ;
563
583
fields : Thunk < GraphQLFieldConfigMap < TSource , TContext , TArgs > > ;
564
584
/**
565
585
* Optionally provide a custom type resolver function. If one is not provided,
566
586
* the default implementation will call `isTypeOf` on each implementing
567
587
* Object type.
568
588
*/
569
589
resolveType ?: Maybe < GraphQLTypeResolver < TSource , TContext , TArgs > > ;
570
- description ?: Maybe < string > ;
590
+ extensions ?: Maybe < Readonly < Record < string , any > > > ;
571
591
astNode ?: Maybe < InterfaceTypeDefinitionNode > ;
572
592
extensionASTNodes ?: Maybe < ReadonlyArray < InterfaceTypeExtensionNode > > ;
573
593
}
@@ -598,9 +618,10 @@ export interface GraphQLInterfaceTypeConfig<
598
618
export class GraphQLUnionType {
599
619
name : string ;
600
620
description : Maybe < string > ;
621
+ resolveType : Maybe < GraphQLTypeResolver < any , any > > ;
622
+ extensions : Maybe < Readonly < Record < string , any > > > ;
601
623
astNode : Maybe < UnionTypeDefinitionNode > ;
602
624
extensionASTNodes : Maybe < ReadonlyArray < UnionTypeExtensionNode > > ;
603
- resolveType : Maybe < GraphQLTypeResolver < any , any > > ;
604
625
605
626
constructor ( config : GraphQLUnionTypeConfig < any , any > ) ;
606
627
@@ -618,14 +639,15 @@ export class GraphQLUnionType {
618
639
619
640
export interface GraphQLUnionTypeConfig < TSource , TContext > {
620
641
name : string ;
642
+ description ?: Maybe < string > ;
621
643
types : Thunk < GraphQLObjectType [ ] > ;
622
644
/**
623
645
* Optionally provide a custom type resolver function. If one is not provided,
624
646
* the default implementation will call `isTypeOf` on each implementing
625
647
* Object type.
626
648
*/
627
649
resolveType ?: Maybe < GraphQLTypeResolver < TSource , TContext > > ;
628
- description ?: Maybe < string > ;
650
+ extensions ?: Maybe < Readonly < Record < string , any > > > ;
629
651
astNode ?: Maybe < UnionTypeDefinitionNode > ;
630
652
extensionASTNodes ?: Maybe < ReadonlyArray < UnionTypeExtensionNode > > ;
631
653
}
@@ -654,6 +676,7 @@ export interface GraphQLUnionTypeConfig<TSource, TContext> {
654
676
export class GraphQLEnumType {
655
677
name : string ;
656
678
description : Maybe < string > ;
679
+ extensions : Maybe < Readonly < Record < string , any > > > ;
657
680
astNode : Maybe < EnumTypeDefinitionNode > ;
658
681
extensionASTNodes : Maybe < ReadonlyArray < EnumTypeExtensionNode > > ;
659
682
@@ -678,8 +701,9 @@ export class GraphQLEnumType {
678
701
679
702
export interface GraphQLEnumTypeConfig {
680
703
name : string ;
681
- values : GraphQLEnumValueConfigMap ;
682
704
description ?: Maybe < string > ;
705
+ values : GraphQLEnumValueConfigMap ;
706
+ extensions ?: Maybe < Readonly < Record < string , any > > > ;
683
707
astNode ?: Maybe < EnumTypeDefinitionNode > ;
684
708
extensionASTNodes ?: Maybe < ReadonlyArray < EnumTypeExtensionNode > > ;
685
709
}
@@ -689,19 +713,21 @@ export type GraphQLEnumValueConfigMap = {
689
713
} ;
690
714
691
715
export interface GraphQLEnumValueConfig {
716
+ description ?: Maybe < string > ;
692
717
value ?: any ;
693
718
deprecationReason ?: Maybe < string > ;
694
- description ?: Maybe < string > ;
719
+ extensions ?: Maybe < Readonly < Record < string , any > > > ;
695
720
astNode ?: Maybe < EnumValueDefinitionNode > ;
696
721
}
697
722
698
723
export interface GraphQLEnumValue {
699
724
name : string ;
700
725
description : Maybe < string > ;
726
+ value : any ;
701
727
isDeprecated ?: boolean ;
702
728
deprecationReason : Maybe < string > ;
729
+ extensions : Maybe < Readonly < Record < string , any > > > ;
703
730
astNode ?: Maybe < EnumValueDefinitionNode > ;
704
- value : any ;
705
731
}
706
732
707
733
/**
@@ -727,13 +753,15 @@ export interface GraphQLEnumValue {
727
753
export class GraphQLInputObjectType {
728
754
name : string ;
729
755
description : Maybe < string > ;
756
+ extensions : Maybe < Readonly < Record < string , any > > > ;
730
757
astNode : Maybe < InputObjectTypeDefinitionNode > ;
731
758
extensionASTNodes : Maybe < ReadonlyArray < InputObjectTypeExtensionNode > > ;
732
759
constructor ( config : GraphQLInputObjectTypeConfig ) ;
733
760
getFields ( ) : GraphQLInputFieldMap ;
734
761
735
762
toConfig ( ) : GraphQLInputObjectTypeConfig & {
736
763
fields : GraphQLInputFieldConfigMap ;
764
+ extensions : Maybe < Readonly < Record < string , any > > > ;
737
765
extensionASTNodes : ReadonlyArray < InputObjectTypeExtensionNode > ;
738
766
} ;
739
767
@@ -744,16 +772,18 @@ export class GraphQLInputObjectType {
744
772
745
773
export interface GraphQLInputObjectTypeConfig {
746
774
name : string ;
747
- fields : Thunk < GraphQLInputFieldConfigMap > ;
748
775
description ?: Maybe < string > ;
776
+ fields : Thunk < GraphQLInputFieldConfigMap > ;
777
+ extensions ?: Maybe < Readonly < Record < string , any > > > ;
749
778
astNode ?: Maybe < InputObjectTypeDefinitionNode > ;
750
779
extensionASTNodes ?: Maybe < ReadonlyArray < InputObjectTypeExtensionNode > > ;
751
780
}
752
781
753
782
export interface GraphQLInputFieldConfig {
783
+ description ?: Maybe < string > ;
754
784
type : GraphQLInputType ;
755
785
defaultValue ?: any ;
756
- description ?: Maybe < string > ;
786
+ extensions ?: Maybe < Readonly < Record < string , any > > > ;
757
787
astNode ?: Maybe < InputValueDefinitionNode > ;
758
788
}
759
789
@@ -763,9 +793,10 @@ export type GraphQLInputFieldConfigMap = {
763
793
764
794
export interface GraphQLInputField {
765
795
name : string ;
796
+ description ?: Maybe < string > ;
766
797
type : GraphQLInputType ;
767
798
defaultValue ?: any ;
768
- description ? : Maybe < string > ;
799
+ extensions : Maybe < Readonly < Record < string , any > > > ;
769
800
astNode ?: Maybe < InputValueDefinitionNode > ;
770
801
}
771
802
0 commit comments