@zuplo/graphql 5.1976.0 → 5.1978.0

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/types-beta.d.ts +462 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/graphql",
3
- "version": "5.1976.0",
3
+ "version": "5.1978.0",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "exports": {
package/types-beta.d.ts CHANGED
@@ -1,5 +1,3 @@
1
- import type { OpenAPIV3_1 } from 'openapi-types';
2
-
3
1
  declare interface BuildRouteConfiguration {
4
2
  path: string;
5
3
  methods: HttpMethod[];
@@ -558,6 +556,468 @@ declare interface OnResponseSendingHook {
558
556
  (response: Response, request: ZuploRequest, context: ZuploContext): Promise<Response> | Response;
559
557
  }
560
558
 
559
+ declare namespace OpenAPIV3 {
560
+ interface Document<T extends {} = {}> {
561
+ openapi: string;
562
+ info: InfoObject;
563
+ servers?: ServerObject[];
564
+ paths: PathsObject<T>;
565
+ components?: ComponentsObject;
566
+ security?: SecurityRequirementObject[];
567
+ tags?: TagObject[];
568
+ externalDocs?: ExternalDocumentationObject;
569
+ 'x-express-openapi-additional-middleware'?: (((request: any, response: any, next: any) => Promise<void>) | ((request: any, response: any, next: any) => void))[];
570
+ 'x-express-openapi-validation-strict'?: boolean;
571
+ }
572
+ interface InfoObject {
573
+ title: string;
574
+ description?: string;
575
+ termsOfService?: string;
576
+ contact?: ContactObject;
577
+ license?: LicenseObject;
578
+ version: string;
579
+ }
580
+ interface ContactObject {
581
+ name?: string;
582
+ url?: string;
583
+ email?: string;
584
+ }
585
+ interface LicenseObject {
586
+ name: string;
587
+ url?: string;
588
+ }
589
+ interface ServerObject {
590
+ url: string;
591
+ description?: string;
592
+ variables?: {
593
+ [variable: string]: ServerVariableObject;
594
+ };
595
+ }
596
+ interface ServerVariableObject {
597
+ enum?: string[];
598
+ default: string;
599
+ description?: string;
600
+ }
601
+ interface PathsObject<T extends {} = {}, P extends {} = {}> {
602
+ [pattern: string]: (PathItemObject<T> & P) | undefined;
603
+ }
604
+ enum HttpMethods {
605
+ GET = "get",
606
+ PUT = "put",
607
+ POST = "post",
608
+ DELETE = "delete",
609
+ OPTIONS = "options",
610
+ HEAD = "head",
611
+ PATCH = "patch",
612
+ TRACE = "trace"
613
+ }
614
+ type PathItemObject<T extends {} = {}> = {
615
+ $ref?: string;
616
+ summary?: string;
617
+ description?: string;
618
+ servers?: ServerObject[];
619
+ parameters?: (ReferenceObject | ParameterObject)[];
620
+ } & {
621
+ [method in HttpMethods]?: OperationObject<T>;
622
+ };
623
+ type OperationObject<T extends {} = {}> = {
624
+ tags?: string[];
625
+ summary?: string;
626
+ description?: string;
627
+ externalDocs?: ExternalDocumentationObject;
628
+ operationId?: string;
629
+ parameters?: (ReferenceObject | ParameterObject)[];
630
+ requestBody?: ReferenceObject | RequestBodyObject;
631
+ responses: ResponsesObject;
632
+ callbacks?: {
633
+ [callback: string]: ReferenceObject | CallbackObject;
634
+ };
635
+ deprecated?: boolean;
636
+ security?: SecurityRequirementObject[];
637
+ servers?: ServerObject[];
638
+ } & T;
639
+ interface ExternalDocumentationObject {
640
+ description?: string;
641
+ url: string;
642
+ }
643
+ interface ParameterObject extends ParameterBaseObject {
644
+ name: string;
645
+ in: string;
646
+ }
647
+ interface HeaderObject extends ParameterBaseObject {
648
+ }
649
+ interface ParameterBaseObject {
650
+ description?: string;
651
+ required?: boolean;
652
+ deprecated?: boolean;
653
+ allowEmptyValue?: boolean;
654
+ style?: string;
655
+ explode?: boolean;
656
+ allowReserved?: boolean;
657
+ schema?: ReferenceObject | SchemaObject;
658
+ example?: any;
659
+ examples?: {
660
+ [media: string]: ReferenceObject | ExampleObject;
661
+ };
662
+ content?: {
663
+ [media: string]: MediaTypeObject;
664
+ };
665
+ }
666
+ type NonArraySchemaObjectType = 'boolean' | 'object' | 'number' | 'string' | 'integer';
667
+ type ArraySchemaObjectType = 'array';
668
+ type SchemaObject = ArraySchemaObject | NonArraySchemaObject;
669
+ interface ArraySchemaObject extends BaseSchemaObject {
670
+ type: ArraySchemaObjectType;
671
+ items: ReferenceObject | SchemaObject;
672
+ }
673
+ interface NonArraySchemaObject extends BaseSchemaObject {
674
+ type?: NonArraySchemaObjectType;
675
+ }
676
+ interface BaseSchemaObject {
677
+ title?: string;
678
+ description?: string;
679
+ format?: string;
680
+ default?: any;
681
+ multipleOf?: number;
682
+ maximum?: number;
683
+ exclusiveMaximum?: boolean;
684
+ minimum?: number;
685
+ exclusiveMinimum?: boolean;
686
+ maxLength?: number;
687
+ minLength?: number;
688
+ pattern?: string;
689
+ additionalProperties?: boolean | ReferenceObject | SchemaObject;
690
+ maxItems?: number;
691
+ minItems?: number;
692
+ uniqueItems?: boolean;
693
+ maxProperties?: number;
694
+ minProperties?: number;
695
+ required?: string[];
696
+ enum?: any[];
697
+ properties?: {
698
+ [name: string]: ReferenceObject | SchemaObject;
699
+ };
700
+ allOf?: (ReferenceObject | SchemaObject)[];
701
+ oneOf?: (ReferenceObject | SchemaObject)[];
702
+ anyOf?: (ReferenceObject | SchemaObject)[];
703
+ not?: ReferenceObject | SchemaObject;
704
+ nullable?: boolean;
705
+ discriminator?: DiscriminatorObject;
706
+ readOnly?: boolean;
707
+ writeOnly?: boolean;
708
+ xml?: XMLObject;
709
+ externalDocs?: ExternalDocumentationObject;
710
+ example?: any;
711
+ deprecated?: boolean;
712
+ }
713
+ interface DiscriminatorObject {
714
+ propertyName: string;
715
+ mapping?: {
716
+ [value: string]: string;
717
+ };
718
+ }
719
+ interface XMLObject {
720
+ name?: string;
721
+ namespace?: string;
722
+ prefix?: string;
723
+ attribute?: boolean;
724
+ wrapped?: boolean;
725
+ }
726
+ interface ReferenceObject {
727
+ $ref: string;
728
+ }
729
+ interface ExampleObject {
730
+ summary?: string;
731
+ description?: string;
732
+ value?: any;
733
+ externalValue?: string;
734
+ }
735
+ interface MediaTypeObject {
736
+ schema?: ReferenceObject | SchemaObject;
737
+ example?: any;
738
+ examples?: {
739
+ [media: string]: ReferenceObject | ExampleObject;
740
+ };
741
+ encoding?: {
742
+ [media: string]: EncodingObject;
743
+ };
744
+ }
745
+ interface EncodingObject {
746
+ contentType?: string;
747
+ headers?: {
748
+ [header: string]: ReferenceObject | HeaderObject;
749
+ };
750
+ style?: string;
751
+ explode?: boolean;
752
+ allowReserved?: boolean;
753
+ }
754
+ interface RequestBodyObject {
755
+ description?: string;
756
+ content: {
757
+ [media: string]: MediaTypeObject;
758
+ };
759
+ required?: boolean;
760
+ }
761
+ interface ResponsesObject {
762
+ [code: string]: ReferenceObject | ResponseObject;
763
+ }
764
+ interface ResponseObject {
765
+ description: string;
766
+ headers?: {
767
+ [header: string]: ReferenceObject | HeaderObject;
768
+ };
769
+ content?: {
770
+ [media: string]: MediaTypeObject;
771
+ };
772
+ links?: {
773
+ [link: string]: ReferenceObject | LinkObject;
774
+ };
775
+ }
776
+ interface LinkObject {
777
+ operationRef?: string;
778
+ operationId?: string;
779
+ parameters?: {
780
+ [parameter: string]: any;
781
+ };
782
+ requestBody?: any;
783
+ description?: string;
784
+ server?: ServerObject;
785
+ }
786
+ interface CallbackObject {
787
+ [url: string]: PathItemObject;
788
+ }
789
+ interface SecurityRequirementObject {
790
+ [name: string]: string[];
791
+ }
792
+ interface ComponentsObject {
793
+ schemas?: {
794
+ [key: string]: ReferenceObject | SchemaObject;
795
+ };
796
+ responses?: {
797
+ [key: string]: ReferenceObject | ResponseObject;
798
+ };
799
+ parameters?: {
800
+ [key: string]: ReferenceObject | ParameterObject;
801
+ };
802
+ examples?: {
803
+ [key: string]: ReferenceObject | ExampleObject;
804
+ };
805
+ requestBodies?: {
806
+ [key: string]: ReferenceObject | RequestBodyObject;
807
+ };
808
+ headers?: {
809
+ [key: string]: ReferenceObject | HeaderObject;
810
+ };
811
+ securitySchemes?: {
812
+ [key: string]: ReferenceObject | SecuritySchemeObject;
813
+ };
814
+ links?: {
815
+ [key: string]: ReferenceObject | LinkObject;
816
+ };
817
+ callbacks?: {
818
+ [key: string]: ReferenceObject | CallbackObject;
819
+ };
820
+ }
821
+ type SecuritySchemeObject = HttpSecurityScheme | ApiKeySecurityScheme | OAuth2SecurityScheme | OpenIdSecurityScheme;
822
+ interface HttpSecurityScheme {
823
+ type: 'http';
824
+ description?: string;
825
+ scheme: string;
826
+ bearerFormat?: string;
827
+ }
828
+ interface ApiKeySecurityScheme {
829
+ type: 'apiKey';
830
+ description?: string;
831
+ name: string;
832
+ in: string;
833
+ }
834
+ interface OAuth2SecurityScheme {
835
+ type: 'oauth2';
836
+ description?: string;
837
+ flows: {
838
+ implicit?: {
839
+ authorizationUrl: string;
840
+ refreshUrl?: string;
841
+ scopes: {
842
+ [scope: string]: string;
843
+ };
844
+ };
845
+ password?: {
846
+ tokenUrl: string;
847
+ refreshUrl?: string;
848
+ scopes: {
849
+ [scope: string]: string;
850
+ };
851
+ };
852
+ clientCredentials?: {
853
+ tokenUrl: string;
854
+ refreshUrl?: string;
855
+ scopes: {
856
+ [scope: string]: string;
857
+ };
858
+ };
859
+ authorizationCode?: {
860
+ authorizationUrl: string;
861
+ tokenUrl: string;
862
+ refreshUrl?: string;
863
+ scopes: {
864
+ [scope: string]: string;
865
+ };
866
+ };
867
+ };
868
+ }
869
+ interface OpenIdSecurityScheme {
870
+ type: 'openIdConnect';
871
+ description?: string;
872
+ openIdConnectUrl: string;
873
+ }
874
+ interface TagObject {
875
+ name: string;
876
+ description?: string;
877
+ externalDocs?: ExternalDocumentationObject;
878
+ }
879
+ }
880
+
881
+ declare namespace OpenAPIV3_1 {
882
+ type Modify<T, R> = Omit<T, keyof R> & R;
883
+ type PathsWebhooksComponents<T extends {} = {}> = {
884
+ paths: PathsObject<T>;
885
+ webhooks: Record<string, PathItemObject | ReferenceObject>;
886
+ components: ComponentsObject;
887
+ };
888
+ type Document<T extends {} = {}> = Modify<Omit<OpenAPIV3.Document<T>, 'paths' | 'components'>, {
889
+ info: InfoObject;
890
+ jsonSchemaDialect?: string;
891
+ servers?: ServerObject[];
892
+ } & ((Pick<PathsWebhooksComponents<T>, 'paths'> & Omit<Partial<PathsWebhooksComponents<T>>, 'paths'>) | (Pick<PathsWebhooksComponents<T>, 'webhooks'> & Omit<Partial<PathsWebhooksComponents<T>>, 'webhooks'>) | (Pick<PathsWebhooksComponents<T>, 'components'> & Omit<Partial<PathsWebhooksComponents<T>>, 'components'>))>;
893
+ type InfoObject = Modify<OpenAPIV3.InfoObject, {
894
+ summary?: string;
895
+ license?: LicenseObject;
896
+ }>;
897
+ type ContactObject = OpenAPIV3.ContactObject;
898
+ type LicenseObject = Modify<OpenAPIV3.LicenseObject, {
899
+ identifier?: string;
900
+ }>;
901
+ type ServerObject = Modify<OpenAPIV3.ServerObject, {
902
+ url: string;
903
+ description?: string;
904
+ variables?: Record<string, ServerVariableObject>;
905
+ }>;
906
+ type ServerVariableObject = Modify<OpenAPIV3.ServerVariableObject, {
907
+ enum?: [string, ...string[]];
908
+ }>;
909
+ type PathsObject<T extends {} = {}, P extends {} = {}> = Record<string, (PathItemObject<T> & P) | undefined>;
910
+ type HttpMethods = OpenAPIV3.HttpMethods;
911
+ type PathItemObject<T extends {} = {}> = Modify<OpenAPIV3.PathItemObject<T>, {
912
+ servers?: ServerObject[];
913
+ parameters?: (ReferenceObject | ParameterObject)[];
914
+ }> & {
915
+ [method in HttpMethods]?: OperationObject<T>;
916
+ };
917
+ type OperationObject<T extends {} = {}> = Modify<OpenAPIV3.OperationObject<T>, {
918
+ parameters?: (ReferenceObject | ParameterObject)[];
919
+ requestBody?: ReferenceObject | RequestBodyObject;
920
+ responses?: ResponsesObject;
921
+ callbacks?: Record<string, ReferenceObject | CallbackObject>;
922
+ servers?: ServerObject[];
923
+ }> & T;
924
+ type ExternalDocumentationObject = OpenAPIV3.ExternalDocumentationObject;
925
+ type ParameterObject = OpenAPIV3.ParameterObject;
926
+ type HeaderObject = OpenAPIV3.HeaderObject;
927
+ type ParameterBaseObject = OpenAPIV3.ParameterBaseObject;
928
+ type NonArraySchemaObjectType = OpenAPIV3.NonArraySchemaObjectType | 'null';
929
+ type ArraySchemaObjectType = OpenAPIV3.ArraySchemaObjectType;
930
+ /**
931
+ * There is no way to tell typescript to require items when type is either 'array' or array containing 'array' type
932
+ * 'items' will be always visible as optional
933
+ * Casting schema object to ArraySchemaObject or NonArraySchemaObject will work fine
934
+ */
935
+ type SchemaObject = ArraySchemaObject | NonArraySchemaObject | MixedSchemaObject;
936
+ interface ArraySchemaObject extends BaseSchemaObject {
937
+ type: ArraySchemaObjectType;
938
+ items: ReferenceObject | SchemaObject;
939
+ }
940
+ interface NonArraySchemaObject extends BaseSchemaObject {
941
+ type?: NonArraySchemaObjectType;
942
+ }
943
+ interface MixedSchemaObject extends BaseSchemaObject {
944
+ type?: (ArraySchemaObjectType | NonArraySchemaObjectType)[];
945
+ items?: ReferenceObject | SchemaObject;
946
+ }
947
+ type BaseSchemaObject = Modify<Omit<OpenAPIV3.BaseSchemaObject, 'nullable'>, {
948
+ examples?: OpenAPIV3.BaseSchemaObject['example'][];
949
+ exclusiveMinimum?: boolean | number;
950
+ exclusiveMaximum?: boolean | number;
951
+ contentMediaType?: string;
952
+ $schema?: string;
953
+ additionalProperties?: boolean | ReferenceObject | SchemaObject;
954
+ properties?: {
955
+ [name: string]: ReferenceObject | SchemaObject;
956
+ };
957
+ allOf?: (ReferenceObject | SchemaObject)[];
958
+ oneOf?: (ReferenceObject | SchemaObject)[];
959
+ anyOf?: (ReferenceObject | SchemaObject)[];
960
+ not?: ReferenceObject | SchemaObject;
961
+ discriminator?: DiscriminatorObject;
962
+ externalDocs?: ExternalDocumentationObject;
963
+ xml?: XMLObject;
964
+ const?: any;
965
+ }>;
966
+ type DiscriminatorObject = OpenAPIV3.DiscriminatorObject;
967
+ type XMLObject = OpenAPIV3.XMLObject;
968
+ type ReferenceObject = Modify<OpenAPIV3.ReferenceObject, {
969
+ summary?: string;
970
+ description?: string;
971
+ }>;
972
+ type ExampleObject = OpenAPIV3.ExampleObject;
973
+ type MediaTypeObject = Modify<OpenAPIV3.MediaTypeObject, {
974
+ schema?: SchemaObject | ReferenceObject;
975
+ examples?: Record<string, ReferenceObject | ExampleObject>;
976
+ }>;
977
+ type EncodingObject = OpenAPIV3.EncodingObject;
978
+ type RequestBodyObject = Modify<OpenAPIV3.RequestBodyObject, {
979
+ content: {
980
+ [media: string]: MediaTypeObject;
981
+ };
982
+ }>;
983
+ type ResponsesObject = Record<string, ReferenceObject | ResponseObject>;
984
+ type ResponseObject = Modify<OpenAPIV3.ResponseObject, {
985
+ headers?: {
986
+ [header: string]: ReferenceObject | HeaderObject;
987
+ };
988
+ content?: {
989
+ [media: string]: MediaTypeObject;
990
+ };
991
+ links?: {
992
+ [link: string]: ReferenceObject | LinkObject;
993
+ };
994
+ }>;
995
+ type LinkObject = Modify<OpenAPIV3.LinkObject, {
996
+ server?: ServerObject;
997
+ }>;
998
+ type CallbackObject = Record<string, PathItemObject | ReferenceObject>;
999
+ type SecurityRequirementObject = OpenAPIV3.SecurityRequirementObject;
1000
+ type ComponentsObject = Modify<OpenAPIV3.ComponentsObject, {
1001
+ schemas?: Record<string, SchemaObject>;
1002
+ responses?: Record<string, ReferenceObject | ResponseObject>;
1003
+ parameters?: Record<string, ReferenceObject | ParameterObject>;
1004
+ examples?: Record<string, ReferenceObject | ExampleObject>;
1005
+ requestBodies?: Record<string, ReferenceObject | RequestBodyObject>;
1006
+ headers?: Record<string, ReferenceObject | HeaderObject>;
1007
+ securitySchemes?: Record<string, ReferenceObject | SecuritySchemeObject>;
1008
+ links?: Record<string, ReferenceObject | LinkObject>;
1009
+ callbacks?: Record<string, ReferenceObject | CallbackObject>;
1010
+ pathItems?: Record<string, ReferenceObject | PathItemObject>;
1011
+ }>;
1012
+ type SecuritySchemeObject = OpenAPIV3.SecuritySchemeObject;
1013
+ type HttpSecurityScheme = OpenAPIV3.HttpSecurityScheme;
1014
+ type ApiKeySecurityScheme = OpenAPIV3.ApiKeySecurityScheme;
1015
+ type OAuth2SecurityScheme = OpenAPIV3.OAuth2SecurityScheme;
1016
+ type OpenIdSecurityScheme = OpenAPIV3.OpenIdSecurityScheme;
1017
+ type TagObject = OpenAPIV3.TagObject;
1018
+ {};
1019
+ }
1020
+
561
1021
  /**
562
1022
  * @beta
563
1023
  */