@graphitation/supermassive 2.6.0 → 3.0.0-alpha.1

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 (128) hide show
  1. package/.eslintcache +1 -1
  2. package/CHANGELOG.md +10 -2
  3. package/lib/benchmarks/index.js +2 -2
  4. package/lib/benchmarks/index.js.map +2 -2
  5. package/lib/benchmarks/index.mjs +2 -2
  6. package/lib/benchmarks/index.mjs.map +2 -2
  7. package/lib/benchmarks/swapi-schema/index.d.ts +4 -2
  8. package/lib/benchmarks/swapi-schema/index.d.ts.map +1 -1
  9. package/lib/benchmarks/swapi-schema/index.js +8 -2
  10. package/lib/benchmarks/swapi-schema/index.js.map +2 -2
  11. package/lib/benchmarks/swapi-schema/index.mjs +8 -2
  12. package/lib/benchmarks/swapi-schema/index.mjs.map +2 -2
  13. package/lib/benchmarks/swapi-schema/makeExecutableSchema.d.ts +7 -0
  14. package/lib/benchmarks/swapi-schema/makeExecutableSchema.d.ts.map +1 -0
  15. package/lib/benchmarks/swapi-schema/makeExecutableSchema.js +916 -0
  16. package/lib/benchmarks/swapi-schema/makeExecutableSchema.js.map +7 -0
  17. package/lib/benchmarks/swapi-schema/makeExecutableSchema.mjs +903 -0
  18. package/lib/benchmarks/swapi-schema/makeExecutableSchema.mjs.map +7 -0
  19. package/lib/benchmarks/swapi-schema/resolvers.d.ts.map +1 -1
  20. package/lib/benchmarks/swapi-schema/resolvers.js +53 -17
  21. package/lib/benchmarks/swapi-schema/resolvers.js.map +2 -2
  22. package/lib/benchmarks/swapi-schema/resolvers.mjs +54 -18
  23. package/lib/benchmarks/swapi-schema/resolvers.mjs.map +2 -2
  24. package/lib/collectFields.d.ts +28 -6
  25. package/lib/collectFields.d.ts.map +1 -1
  26. package/lib/collectFields.js +155 -28
  27. package/lib/collectFields.js.map +3 -3
  28. package/lib/collectFields.mjs +150 -29
  29. package/lib/collectFields.mjs.map +2 -2
  30. package/lib/definition.js +1 -1
  31. package/lib/definition.js.map +2 -2
  32. package/lib/definition.mjs +1 -1
  33. package/lib/definition.mjs.map +2 -2
  34. package/lib/directives.d.ts +2 -73
  35. package/lib/directives.d.ts.map +1 -1
  36. package/lib/directives.js +10 -123
  37. package/lib/directives.js.map +2 -2
  38. package/lib/directives.mjs +13 -122
  39. package/lib/directives.mjs.map +2 -2
  40. package/lib/executeWithoutSchema.d.ts +50 -13
  41. package/lib/executeWithoutSchema.d.ts.map +1 -1
  42. package/lib/executeWithoutSchema.js +1038 -184
  43. package/lib/executeWithoutSchema.js.map +3 -3
  44. package/lib/executeWithoutSchema.mjs +1049 -186
  45. package/lib/executeWithoutSchema.mjs.map +3 -3
  46. package/lib/extractImplicitTypesRuntime.js +2 -2
  47. package/lib/extractImplicitTypesRuntime.js.map +2 -2
  48. package/lib/extractImplicitTypesRuntime.mjs +2 -2
  49. package/lib/extractImplicitTypesRuntime.mjs.map +2 -2
  50. package/lib/index.d.ts +4 -3
  51. package/lib/index.d.ts.map +1 -1
  52. package/lib/index.js +4 -1
  53. package/lib/index.js.map +2 -2
  54. package/lib/index.mjs +4 -1
  55. package/lib/index.mjs.map +2 -2
  56. package/lib/jsutils/AccumulatorMap.d.ts +8 -0
  57. package/lib/jsutils/AccumulatorMap.d.ts.map +1 -0
  58. package/lib/jsutils/AccumulatorMap.js +36 -0
  59. package/lib/jsutils/AccumulatorMap.js.map +7 -0
  60. package/lib/jsutils/AccumulatorMap.mjs +17 -0
  61. package/lib/jsutils/AccumulatorMap.mjs.map +7 -0
  62. package/lib/jsutils/didYouMean.d.ts +1 -2
  63. package/lib/jsutils/didYouMean.d.ts.map +1 -1
  64. package/lib/jsutils/didYouMean.js.map +2 -2
  65. package/lib/jsutils/didYouMean.mjs.map +2 -2
  66. package/lib/jsutils/instanceOf.js.map +2 -2
  67. package/lib/jsutils/instanceOf.mjs.map +2 -2
  68. package/lib/subscribeWithSchema.d.ts +3 -2
  69. package/lib/subscribeWithSchema.d.ts.map +1 -1
  70. package/lib/subscribeWithSchema.js.map +2 -2
  71. package/lib/subscribeWithSchema.mjs.map +2 -2
  72. package/lib/subscribeWithoutSchema.d.ts +3 -35
  73. package/lib/subscribeWithoutSchema.d.ts.map +1 -1
  74. package/lib/subscribeWithoutSchema.js +1 -163
  75. package/lib/subscribeWithoutSchema.js.map +2 -2
  76. package/lib/subscribeWithoutSchema.mjs +2 -175
  77. package/lib/subscribeWithoutSchema.mjs.map +2 -2
  78. package/lib/supermassive-ast/TypedAST.d.ts +370 -0
  79. package/lib/supermassive-ast/TypedAST.d.ts.map +1 -0
  80. package/lib/supermassive-ast/TypedAST.js +29 -0
  81. package/lib/supermassive-ast/TypedAST.js.map +7 -0
  82. package/lib/supermassive-ast/TypedAST.mjs +10 -0
  83. package/lib/supermassive-ast/TypedAST.mjs.map +7 -0
  84. package/lib/supermassive-ast/addTypesToRequestDocument.d.ts +56 -0
  85. package/lib/supermassive-ast/addTypesToRequestDocument.d.ts.map +1 -0
  86. package/lib/supermassive-ast/addTypesToRequestDocument.js +473 -0
  87. package/lib/supermassive-ast/addTypesToRequestDocument.js.map +7 -0
  88. package/lib/supermassive-ast/addTypesToRequestDocument.mjs +463 -0
  89. package/lib/supermassive-ast/addTypesToRequestDocument.mjs.map +7 -0
  90. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.d.ts +3 -0
  91. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.d.ts.map +1 -0
  92. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.js +34 -0
  93. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.js.map +7 -0
  94. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.mjs +17 -0
  95. package/lib/supermassive-ast/annotateDocumentGraphQLTransform.mjs.map +7 -0
  96. package/lib/supermassive-ast/directives.d.ts +36 -0
  97. package/lib/supermassive-ast/directives.d.ts.map +1 -0
  98. package/lib/supermassive-ast/directives.js +165 -0
  99. package/lib/supermassive-ast/directives.js.map +7 -0
  100. package/lib/supermassive-ast/directives.mjs +153 -0
  101. package/lib/supermassive-ast/directives.mjs.map +7 -0
  102. package/lib/supermassive-ast/index.d.ts +6 -0
  103. package/lib/supermassive-ast/index.d.ts.map +1 -0
  104. package/lib/supermassive-ast/index.js +37 -0
  105. package/lib/supermassive-ast/index.js.map +7 -0
  106. package/lib/supermassive-ast/index.mjs +27 -0
  107. package/lib/supermassive-ast/index.mjs.map +7 -0
  108. package/lib/types.d.ts +62 -6
  109. package/lib/types.d.ts.map +1 -1
  110. package/lib/types.js +14 -0
  111. package/lib/types.js.map +2 -2
  112. package/lib/types.mjs +11 -0
  113. package/lib/types.mjs.map +3 -3
  114. package/lib/utilities/mergeResolvers.d.ts +1 -1
  115. package/lib/utilities/mergeResolvers.d.ts.map +1 -1
  116. package/lib/utilities/mergeResolvers.js.map +2 -2
  117. package/lib/utilities/mergeResolvers.mjs.map +2 -2
  118. package/lib/utilities/typeNameFromAST.d.ts +1 -1
  119. package/lib/utilities/typeNameFromAST.d.ts.map +1 -1
  120. package/lib/utilities/typeNameFromAST.js.map +1 -1
  121. package/lib/utilities/typeNameFromAST.mjs.map +1 -1
  122. package/lib/values.d.ts +2 -3
  123. package/lib/values.d.ts.map +1 -1
  124. package/lib/values.js +10 -14
  125. package/lib/values.js.map +2 -2
  126. package/lib/values.mjs +10 -14
  127. package/lib/values.mjs.map +2 -2
  128. package/package.json +2 -5
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/supermassive-ast/TypedAST.ts"],
4
+ "sourcesContent": ["/**\n * Taken from node_modules/graphql/language/ast.d.ts\n * License: MIT License\n * Copyright (c): GraphQL Contributors\n *\n * Our changes MUST be annotated inline for ease of future merging.\n */\n\n/**\n * [SUPERMASSIVE]\n *\n * We don't need `Location`, `Token`, and `isNode` , so remove it and its dependencies.\n */\ntype Location = unknown;\n\n/**\n * The list of all possible AST node types.\n */\nexport type ASTNode =\n | NameNode\n | DocumentNode\n | OperationDefinitionNode\n | VariableDefinitionNode\n | VariableNode\n | SelectionSetNode\n | FieldNode\n | ArgumentNode\n | FragmentSpreadNode\n | InlineFragmentNode\n | FragmentDefinitionNode\n | IntValueNode\n | FloatValueNode\n | StringValueNode\n | BooleanValueNode\n | NullValueNode\n | EnumValueNode\n | ListValueNode\n | ObjectValueNode\n | ObjectFieldNode\n | DirectiveNode\n | NamedTypeNode\n | ListTypeNode\n | NonNullTypeNode\n | SchemaDefinitionNode\n | OperationTypeDefinitionNode\n | ScalarTypeDefinitionNode\n | ObjectTypeDefinitionNode\n | FieldDefinitionNode\n | InputValueDefinitionNode\n | InterfaceTypeDefinitionNode\n | UnionTypeDefinitionNode\n | EnumTypeDefinitionNode\n | EnumValueDefinitionNode\n | InputObjectTypeDefinitionNode\n | DirectiveDefinitionNode\n | SchemaExtensionNode\n | ScalarTypeExtensionNode\n | ObjectTypeExtensionNode\n | InterfaceTypeExtensionNode\n | UnionTypeExtensionNode\n | EnumTypeExtensionNode\n | InputObjectTypeExtensionNode;\n\n/**\n * Utility type listing all nodes indexed by their kind.\n */\nexport interface ASTKindToNode {\n Name: NameNode;\n Document: DocumentNode;\n OperationDefinition: OperationDefinitionNode;\n VariableDefinition: VariableDefinitionNode;\n Variable: VariableNode;\n SelectionSet: SelectionSetNode;\n Field: FieldNode;\n Argument: ArgumentNode;\n FragmentSpread: FragmentSpreadNode;\n InlineFragment: InlineFragmentNode;\n FragmentDefinition: FragmentDefinitionNode;\n IntValue: IntValueNode;\n FloatValue: FloatValueNode;\n StringValue: StringValueNode;\n BooleanValue: BooleanValueNode;\n NullValue: NullValueNode;\n EnumValue: EnumValueNode;\n ListValue: ListValueNode;\n ObjectValue: ObjectValueNode;\n ObjectField: ObjectFieldNode;\n Directive: DirectiveNode;\n NamedType: NamedTypeNode;\n ListType: ListTypeNode;\n NonNullType: NonNullTypeNode;\n SchemaDefinition: SchemaDefinitionNode;\n OperationTypeDefinition: OperationTypeDefinitionNode;\n ScalarTypeDefinition: ScalarTypeDefinitionNode;\n ObjectTypeDefinition: ObjectTypeDefinitionNode;\n FieldDefinition: FieldDefinitionNode;\n InputValueDefinition: InputValueDefinitionNode;\n InterfaceTypeDefinition: InterfaceTypeDefinitionNode;\n UnionTypeDefinition: UnionTypeDefinitionNode;\n EnumTypeDefinition: EnumTypeDefinitionNode;\n EnumValueDefinition: EnumValueDefinitionNode;\n InputObjectTypeDefinition: InputObjectTypeDefinitionNode;\n DirectiveDefinition: DirectiveDefinitionNode;\n SchemaExtension: SchemaExtensionNode;\n ScalarTypeExtension: ScalarTypeExtensionNode;\n ObjectTypeExtension: ObjectTypeExtensionNode;\n InterfaceTypeExtension: InterfaceTypeExtensionNode;\n UnionTypeExtension: UnionTypeExtensionNode;\n EnumTypeExtension: EnumTypeExtensionNode;\n InputObjectTypeExtension: InputObjectTypeExtensionNode;\n}\n\n// Name\n\nexport interface NameNode {\n readonly kind: \"Name\";\n readonly loc?: Location;\n readonly value: string;\n}\n\n// Document\n\nexport interface DocumentNode {\n readonly kind: \"Document\";\n readonly loc?: Location;\n readonly definitions: ReadonlyArray<DefinitionNode>;\n}\n\nexport type DefinitionNode =\n | ExecutableDefinitionNode\n | TypeSystemDefinitionNode\n | TypeSystemExtensionNode;\n\nexport type ExecutableDefinitionNode =\n | OperationDefinitionNode\n | FragmentDefinitionNode;\n\nexport interface OperationDefinitionNode {\n readonly kind: \"OperationDefinition\";\n readonly loc?: Location;\n readonly operation: OperationTypeNode;\n readonly name?: NameNode;\n readonly variableDefinitions?: ReadonlyArray<VariableDefinitionNode>;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly selectionSet: SelectionSetNode;\n}\n\nexport enum OperationTypeNode {\n QUERY = \"query\",\n MUTATION = \"mutation\",\n SUBSCRIPTION = \"subscription\",\n}\nexport interface VariableDefinitionNode {\n readonly kind: \"VariableDefinition\";\n readonly loc?: Location;\n readonly variable: VariableNode;\n readonly type: TypeNode;\n readonly defaultValue?: ValueNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface VariableNode {\n readonly kind: \"Variable\";\n readonly loc?: Location;\n readonly name: NameNode;\n}\n\nexport interface SelectionSetNode {\n kind: \"SelectionSet\";\n loc?: Location;\n selections: ReadonlyArray<SelectionNode>;\n}\n\nexport type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode;\n\nexport interface FieldNode {\n readonly __type: TypeNode; // [SUPERMASSIVE] Add the return type\n readonly kind: \"Field\";\n readonly loc?: Location;\n readonly alias?: NameNode;\n readonly name: NameNode;\n readonly arguments?: ReadonlyArray<ArgumentNode>;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly selectionSet?: SelectionSetNode;\n}\n\nexport interface ArgumentNode {\n readonly __type: TypeNode; // [SUPERMASSIVE] Add the value type\n readonly __defaultValue?: ValueNode | null; // [SUPERMASSIVE] Add default value\n readonly kind: \"Argument\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly value: ValueNode;\n}\n\n// Fragments\n\nexport interface FragmentSpreadNode {\n readonly kind: \"FragmentSpread\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface InlineFragmentNode {\n readonly kind: \"InlineFragment\";\n readonly loc?: Location;\n readonly typeCondition?: NamedTypeNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly selectionSet: SelectionSetNode;\n}\n\nexport interface FragmentDefinitionNode {\n readonly kind: \"FragmentDefinition\";\n readonly loc?: Location;\n readonly name: NameNode;\n // Note: fragment variable definitions are experimental and may be changed\n // or removed in the future.\n readonly variableDefinitions?: ReadonlyArray<VariableDefinitionNode>;\n readonly typeCondition: NamedTypeNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly selectionSet: SelectionSetNode;\n}\n\n// Values\n\nexport type ValueNode =\n | VariableNode\n | IntValueNode\n | FloatValueNode\n | StringValueNode\n | BooleanValueNode\n | NullValueNode\n | EnumValueNode\n | ListValueNode\n | ObjectValueNode;\n\nexport interface IntValueNode {\n readonly kind: \"IntValue\";\n readonly loc?: Location;\n readonly value: string;\n}\n\nexport interface FloatValueNode {\n readonly kind: \"FloatValue\";\n readonly loc?: Location;\n readonly value: string;\n}\n\nexport interface StringValueNode {\n readonly kind: \"StringValue\";\n readonly loc?: Location;\n readonly value: string;\n readonly block?: boolean;\n}\n\nexport interface BooleanValueNode {\n readonly kind: \"BooleanValue\";\n readonly loc?: Location;\n readonly value: boolean;\n}\n\nexport interface NullValueNode {\n readonly kind: \"NullValue\";\n readonly loc?: Location;\n}\n\nexport interface EnumValueNode {\n readonly kind: \"EnumValue\";\n readonly loc?: Location;\n readonly value: string;\n}\n\nexport interface ListValueNode {\n readonly kind: \"ListValue\";\n readonly loc?: Location;\n readonly values: ReadonlyArray<ValueNode>;\n}\n\nexport interface ObjectValueNode {\n readonly kind: \"ObjectValue\";\n readonly loc?: Location;\n readonly fields: ReadonlyArray<ObjectFieldNode>;\n}\n\nexport interface ObjectFieldNode {\n readonly kind: \"ObjectField\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly value: ValueNode;\n}\n\n// Directives\n\nexport interface DirectiveNode {\n readonly kind: \"Directive\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly arguments?: ReadonlyArray<ArgumentNode>;\n}\n\n// Type Reference\n\nexport type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode;\n\nexport interface NamedTypeNode {\n readonly kind: \"NamedType\";\n readonly loc?: Location;\n readonly name: NameNode;\n}\n\nexport interface ListTypeNode {\n readonly kind: \"ListType\";\n readonly loc?: Location;\n readonly type: TypeNode;\n}\n\nexport interface NonNullTypeNode {\n readonly kind: \"NonNullType\";\n readonly loc?: Location;\n readonly type: NamedTypeNode | ListTypeNode;\n}\n\n// Type System Definition\n\nexport type TypeSystemDefinitionNode =\n | SchemaDefinitionNode\n | TypeDefinitionNode\n | DirectiveDefinitionNode;\n\nexport interface SchemaDefinitionNode {\n readonly kind: \"SchemaDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly operationTypes: ReadonlyArray<OperationTypeDefinitionNode>;\n}\n\nexport interface OperationTypeDefinitionNode {\n readonly kind: \"OperationTypeDefinition\";\n readonly loc?: Location;\n readonly operation: OperationTypeNode;\n readonly type: NamedTypeNode;\n}\n\n// Type Definition\n\nexport type TypeDefinitionNode =\n | ScalarTypeDefinitionNode\n | ObjectTypeDefinitionNode\n | InterfaceTypeDefinitionNode\n | UnionTypeDefinitionNode\n | EnumTypeDefinitionNode\n | InputObjectTypeDefinitionNode;\n\nexport interface ScalarTypeDefinitionNode {\n readonly kind: \"ScalarTypeDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface ObjectTypeDefinitionNode {\n readonly kind: \"ObjectTypeDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly interfaces?: ReadonlyArray<NamedTypeNode>;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly fields?: ReadonlyArray<FieldDefinitionNode>;\n}\n\nexport interface FieldDefinitionNode {\n readonly kind: \"FieldDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly arguments?: ReadonlyArray<InputValueDefinitionNode>;\n readonly type: TypeNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface InputValueDefinitionNode {\n readonly kind: \"InputValueDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly type: TypeNode;\n readonly defaultValue?: ValueNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface InterfaceTypeDefinitionNode {\n readonly kind: \"InterfaceTypeDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly interfaces?: ReadonlyArray<NamedTypeNode>;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly fields?: ReadonlyArray<FieldDefinitionNode>;\n}\n\nexport interface UnionTypeDefinitionNode {\n readonly kind: \"UnionTypeDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly types?: ReadonlyArray<NamedTypeNode>;\n}\n\nexport interface EnumTypeDefinitionNode {\n readonly kind: \"EnumTypeDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly values?: ReadonlyArray<EnumValueDefinitionNode>;\n}\n\nexport interface EnumValueDefinitionNode {\n readonly kind: \"EnumValueDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface InputObjectTypeDefinitionNode {\n readonly kind: \"InputObjectTypeDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly fields?: ReadonlyArray<InputValueDefinitionNode>;\n}\n\n// Directive Definitions\n\nexport interface DirectiveDefinitionNode {\n readonly kind: \"DirectiveDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly arguments?: ReadonlyArray<InputValueDefinitionNode>;\n readonly repeatable: boolean;\n readonly locations: ReadonlyArray<NameNode>;\n}\n\n// Type System Extensions\n\nexport type TypeSystemExtensionNode = SchemaExtensionNode | TypeExtensionNode;\n\nexport interface SchemaExtensionNode {\n readonly kind: \"SchemaExtension\";\n readonly loc?: Location;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly operationTypes?: ReadonlyArray<OperationTypeDefinitionNode>;\n}\n\n// Type Extensions\n\nexport type TypeExtensionNode =\n | ScalarTypeExtensionNode\n | ObjectTypeExtensionNode\n | InterfaceTypeExtensionNode\n | UnionTypeExtensionNode\n | EnumTypeExtensionNode\n | InputObjectTypeExtensionNode;\n\nexport interface ScalarTypeExtensionNode {\n readonly kind: \"ScalarTypeExtension\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface ObjectTypeExtensionNode {\n readonly kind: \"ObjectTypeExtension\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly interfaces?: ReadonlyArray<NamedTypeNode>;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly fields?: ReadonlyArray<FieldDefinitionNode>;\n}\n\nexport interface InterfaceTypeExtensionNode {\n readonly kind: \"InterfaceTypeExtension\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly interfaces?: ReadonlyArray<NamedTypeNode>;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly fields?: ReadonlyArray<FieldDefinitionNode>;\n}\n\nexport interface UnionTypeExtensionNode {\n readonly kind: \"UnionTypeExtension\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly types?: ReadonlyArray<NamedTypeNode>;\n}\n\nexport interface EnumTypeExtensionNode {\n readonly kind: \"EnumTypeExtension\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly values?: ReadonlyArray<EnumValueDefinitionNode>;\n}\n\nexport interface InputObjectTypeExtensionNode {\n readonly kind: \"InputObjectTypeExtension\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly fields?: ReadonlyArray<InputValueDefinitionNode>;\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmJO,IAAK,oBAAL,kBAAKA,uBAAL;AACL,EAAAA,mBAAA,WAAQ;AACR,EAAAA,mBAAA,cAAW;AACX,EAAAA,mBAAA,kBAAe;AAHL,SAAAA;AAAA,GAAA;",
6
+ "names": ["OperationTypeNode"]
7
+ }
@@ -0,0 +1,10 @@
1
+ // src/supermassive-ast/TypedAST.ts
2
+ var OperationTypeNode = /* @__PURE__ */ ((OperationTypeNode2) => {
3
+ OperationTypeNode2["QUERY"] = "query";
4
+ OperationTypeNode2["MUTATION"] = "mutation";
5
+ OperationTypeNode2["SUBSCRIPTION"] = "subscription";
6
+ return OperationTypeNode2;
7
+ })(OperationTypeNode || {});
8
+ export {
9
+ OperationTypeNode
10
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/supermassive-ast/TypedAST.ts"],
4
+ "sourcesContent": ["/**\n * Taken from node_modules/graphql/language/ast.d.ts\n * License: MIT License\n * Copyright (c): GraphQL Contributors\n *\n * Our changes MUST be annotated inline for ease of future merging.\n */\n\n/**\n * [SUPERMASSIVE]\n *\n * We don't need `Location`, `Token`, and `isNode` , so remove it and its dependencies.\n */\ntype Location = unknown;\n\n/**\n * The list of all possible AST node types.\n */\nexport type ASTNode =\n | NameNode\n | DocumentNode\n | OperationDefinitionNode\n | VariableDefinitionNode\n | VariableNode\n | SelectionSetNode\n | FieldNode\n | ArgumentNode\n | FragmentSpreadNode\n | InlineFragmentNode\n | FragmentDefinitionNode\n | IntValueNode\n | FloatValueNode\n | StringValueNode\n | BooleanValueNode\n | NullValueNode\n | EnumValueNode\n | ListValueNode\n | ObjectValueNode\n | ObjectFieldNode\n | DirectiveNode\n | NamedTypeNode\n | ListTypeNode\n | NonNullTypeNode\n | SchemaDefinitionNode\n | OperationTypeDefinitionNode\n | ScalarTypeDefinitionNode\n | ObjectTypeDefinitionNode\n | FieldDefinitionNode\n | InputValueDefinitionNode\n | InterfaceTypeDefinitionNode\n | UnionTypeDefinitionNode\n | EnumTypeDefinitionNode\n | EnumValueDefinitionNode\n | InputObjectTypeDefinitionNode\n | DirectiveDefinitionNode\n | SchemaExtensionNode\n | ScalarTypeExtensionNode\n | ObjectTypeExtensionNode\n | InterfaceTypeExtensionNode\n | UnionTypeExtensionNode\n | EnumTypeExtensionNode\n | InputObjectTypeExtensionNode;\n\n/**\n * Utility type listing all nodes indexed by their kind.\n */\nexport interface ASTKindToNode {\n Name: NameNode;\n Document: DocumentNode;\n OperationDefinition: OperationDefinitionNode;\n VariableDefinition: VariableDefinitionNode;\n Variable: VariableNode;\n SelectionSet: SelectionSetNode;\n Field: FieldNode;\n Argument: ArgumentNode;\n FragmentSpread: FragmentSpreadNode;\n InlineFragment: InlineFragmentNode;\n FragmentDefinition: FragmentDefinitionNode;\n IntValue: IntValueNode;\n FloatValue: FloatValueNode;\n StringValue: StringValueNode;\n BooleanValue: BooleanValueNode;\n NullValue: NullValueNode;\n EnumValue: EnumValueNode;\n ListValue: ListValueNode;\n ObjectValue: ObjectValueNode;\n ObjectField: ObjectFieldNode;\n Directive: DirectiveNode;\n NamedType: NamedTypeNode;\n ListType: ListTypeNode;\n NonNullType: NonNullTypeNode;\n SchemaDefinition: SchemaDefinitionNode;\n OperationTypeDefinition: OperationTypeDefinitionNode;\n ScalarTypeDefinition: ScalarTypeDefinitionNode;\n ObjectTypeDefinition: ObjectTypeDefinitionNode;\n FieldDefinition: FieldDefinitionNode;\n InputValueDefinition: InputValueDefinitionNode;\n InterfaceTypeDefinition: InterfaceTypeDefinitionNode;\n UnionTypeDefinition: UnionTypeDefinitionNode;\n EnumTypeDefinition: EnumTypeDefinitionNode;\n EnumValueDefinition: EnumValueDefinitionNode;\n InputObjectTypeDefinition: InputObjectTypeDefinitionNode;\n DirectiveDefinition: DirectiveDefinitionNode;\n SchemaExtension: SchemaExtensionNode;\n ScalarTypeExtension: ScalarTypeExtensionNode;\n ObjectTypeExtension: ObjectTypeExtensionNode;\n InterfaceTypeExtension: InterfaceTypeExtensionNode;\n UnionTypeExtension: UnionTypeExtensionNode;\n EnumTypeExtension: EnumTypeExtensionNode;\n InputObjectTypeExtension: InputObjectTypeExtensionNode;\n}\n\n// Name\n\nexport interface NameNode {\n readonly kind: \"Name\";\n readonly loc?: Location;\n readonly value: string;\n}\n\n// Document\n\nexport interface DocumentNode {\n readonly kind: \"Document\";\n readonly loc?: Location;\n readonly definitions: ReadonlyArray<DefinitionNode>;\n}\n\nexport type DefinitionNode =\n | ExecutableDefinitionNode\n | TypeSystemDefinitionNode\n | TypeSystemExtensionNode;\n\nexport type ExecutableDefinitionNode =\n | OperationDefinitionNode\n | FragmentDefinitionNode;\n\nexport interface OperationDefinitionNode {\n readonly kind: \"OperationDefinition\";\n readonly loc?: Location;\n readonly operation: OperationTypeNode;\n readonly name?: NameNode;\n readonly variableDefinitions?: ReadonlyArray<VariableDefinitionNode>;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly selectionSet: SelectionSetNode;\n}\n\nexport enum OperationTypeNode {\n QUERY = \"query\",\n MUTATION = \"mutation\",\n SUBSCRIPTION = \"subscription\",\n}\nexport interface VariableDefinitionNode {\n readonly kind: \"VariableDefinition\";\n readonly loc?: Location;\n readonly variable: VariableNode;\n readonly type: TypeNode;\n readonly defaultValue?: ValueNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface VariableNode {\n readonly kind: \"Variable\";\n readonly loc?: Location;\n readonly name: NameNode;\n}\n\nexport interface SelectionSetNode {\n kind: \"SelectionSet\";\n loc?: Location;\n selections: ReadonlyArray<SelectionNode>;\n}\n\nexport type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode;\n\nexport interface FieldNode {\n readonly __type: TypeNode; // [SUPERMASSIVE] Add the return type\n readonly kind: \"Field\";\n readonly loc?: Location;\n readonly alias?: NameNode;\n readonly name: NameNode;\n readonly arguments?: ReadonlyArray<ArgumentNode>;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly selectionSet?: SelectionSetNode;\n}\n\nexport interface ArgumentNode {\n readonly __type: TypeNode; // [SUPERMASSIVE] Add the value type\n readonly __defaultValue?: ValueNode | null; // [SUPERMASSIVE] Add default value\n readonly kind: \"Argument\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly value: ValueNode;\n}\n\n// Fragments\n\nexport interface FragmentSpreadNode {\n readonly kind: \"FragmentSpread\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface InlineFragmentNode {\n readonly kind: \"InlineFragment\";\n readonly loc?: Location;\n readonly typeCondition?: NamedTypeNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly selectionSet: SelectionSetNode;\n}\n\nexport interface FragmentDefinitionNode {\n readonly kind: \"FragmentDefinition\";\n readonly loc?: Location;\n readonly name: NameNode;\n // Note: fragment variable definitions are experimental and may be changed\n // or removed in the future.\n readonly variableDefinitions?: ReadonlyArray<VariableDefinitionNode>;\n readonly typeCondition: NamedTypeNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly selectionSet: SelectionSetNode;\n}\n\n// Values\n\nexport type ValueNode =\n | VariableNode\n | IntValueNode\n | FloatValueNode\n | StringValueNode\n | BooleanValueNode\n | NullValueNode\n | EnumValueNode\n | ListValueNode\n | ObjectValueNode;\n\nexport interface IntValueNode {\n readonly kind: \"IntValue\";\n readonly loc?: Location;\n readonly value: string;\n}\n\nexport interface FloatValueNode {\n readonly kind: \"FloatValue\";\n readonly loc?: Location;\n readonly value: string;\n}\n\nexport interface StringValueNode {\n readonly kind: \"StringValue\";\n readonly loc?: Location;\n readonly value: string;\n readonly block?: boolean;\n}\n\nexport interface BooleanValueNode {\n readonly kind: \"BooleanValue\";\n readonly loc?: Location;\n readonly value: boolean;\n}\n\nexport interface NullValueNode {\n readonly kind: \"NullValue\";\n readonly loc?: Location;\n}\n\nexport interface EnumValueNode {\n readonly kind: \"EnumValue\";\n readonly loc?: Location;\n readonly value: string;\n}\n\nexport interface ListValueNode {\n readonly kind: \"ListValue\";\n readonly loc?: Location;\n readonly values: ReadonlyArray<ValueNode>;\n}\n\nexport interface ObjectValueNode {\n readonly kind: \"ObjectValue\";\n readonly loc?: Location;\n readonly fields: ReadonlyArray<ObjectFieldNode>;\n}\n\nexport interface ObjectFieldNode {\n readonly kind: \"ObjectField\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly value: ValueNode;\n}\n\n// Directives\n\nexport interface DirectiveNode {\n readonly kind: \"Directive\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly arguments?: ReadonlyArray<ArgumentNode>;\n}\n\n// Type Reference\n\nexport type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode;\n\nexport interface NamedTypeNode {\n readonly kind: \"NamedType\";\n readonly loc?: Location;\n readonly name: NameNode;\n}\n\nexport interface ListTypeNode {\n readonly kind: \"ListType\";\n readonly loc?: Location;\n readonly type: TypeNode;\n}\n\nexport interface NonNullTypeNode {\n readonly kind: \"NonNullType\";\n readonly loc?: Location;\n readonly type: NamedTypeNode | ListTypeNode;\n}\n\n// Type System Definition\n\nexport type TypeSystemDefinitionNode =\n | SchemaDefinitionNode\n | TypeDefinitionNode\n | DirectiveDefinitionNode;\n\nexport interface SchemaDefinitionNode {\n readonly kind: \"SchemaDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly operationTypes: ReadonlyArray<OperationTypeDefinitionNode>;\n}\n\nexport interface OperationTypeDefinitionNode {\n readonly kind: \"OperationTypeDefinition\";\n readonly loc?: Location;\n readonly operation: OperationTypeNode;\n readonly type: NamedTypeNode;\n}\n\n// Type Definition\n\nexport type TypeDefinitionNode =\n | ScalarTypeDefinitionNode\n | ObjectTypeDefinitionNode\n | InterfaceTypeDefinitionNode\n | UnionTypeDefinitionNode\n | EnumTypeDefinitionNode\n | InputObjectTypeDefinitionNode;\n\nexport interface ScalarTypeDefinitionNode {\n readonly kind: \"ScalarTypeDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface ObjectTypeDefinitionNode {\n readonly kind: \"ObjectTypeDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly interfaces?: ReadonlyArray<NamedTypeNode>;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly fields?: ReadonlyArray<FieldDefinitionNode>;\n}\n\nexport interface FieldDefinitionNode {\n readonly kind: \"FieldDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly arguments?: ReadonlyArray<InputValueDefinitionNode>;\n readonly type: TypeNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface InputValueDefinitionNode {\n readonly kind: \"InputValueDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly type: TypeNode;\n readonly defaultValue?: ValueNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface InterfaceTypeDefinitionNode {\n readonly kind: \"InterfaceTypeDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly interfaces?: ReadonlyArray<NamedTypeNode>;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly fields?: ReadonlyArray<FieldDefinitionNode>;\n}\n\nexport interface UnionTypeDefinitionNode {\n readonly kind: \"UnionTypeDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly types?: ReadonlyArray<NamedTypeNode>;\n}\n\nexport interface EnumTypeDefinitionNode {\n readonly kind: \"EnumTypeDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly values?: ReadonlyArray<EnumValueDefinitionNode>;\n}\n\nexport interface EnumValueDefinitionNode {\n readonly kind: \"EnumValueDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface InputObjectTypeDefinitionNode {\n readonly kind: \"InputObjectTypeDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly fields?: ReadonlyArray<InputValueDefinitionNode>;\n}\n\n// Directive Definitions\n\nexport interface DirectiveDefinitionNode {\n readonly kind: \"DirectiveDefinition\";\n readonly loc?: Location;\n readonly description?: StringValueNode;\n readonly name: NameNode;\n readonly arguments?: ReadonlyArray<InputValueDefinitionNode>;\n readonly repeatable: boolean;\n readonly locations: ReadonlyArray<NameNode>;\n}\n\n// Type System Extensions\n\nexport type TypeSystemExtensionNode = SchemaExtensionNode | TypeExtensionNode;\n\nexport interface SchemaExtensionNode {\n readonly kind: \"SchemaExtension\";\n readonly loc?: Location;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly operationTypes?: ReadonlyArray<OperationTypeDefinitionNode>;\n}\n\n// Type Extensions\n\nexport type TypeExtensionNode =\n | ScalarTypeExtensionNode\n | ObjectTypeExtensionNode\n | InterfaceTypeExtensionNode\n | UnionTypeExtensionNode\n | EnumTypeExtensionNode\n | InputObjectTypeExtensionNode;\n\nexport interface ScalarTypeExtensionNode {\n readonly kind: \"ScalarTypeExtension\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n}\n\nexport interface ObjectTypeExtensionNode {\n readonly kind: \"ObjectTypeExtension\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly interfaces?: ReadonlyArray<NamedTypeNode>;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly fields?: ReadonlyArray<FieldDefinitionNode>;\n}\n\nexport interface InterfaceTypeExtensionNode {\n readonly kind: \"InterfaceTypeExtension\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly interfaces?: ReadonlyArray<NamedTypeNode>;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly fields?: ReadonlyArray<FieldDefinitionNode>;\n}\n\nexport interface UnionTypeExtensionNode {\n readonly kind: \"UnionTypeExtension\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly types?: ReadonlyArray<NamedTypeNode>;\n}\n\nexport interface EnumTypeExtensionNode {\n readonly kind: \"EnumTypeExtension\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly values?: ReadonlyArray<EnumValueDefinitionNode>;\n}\n\nexport interface InputObjectTypeExtensionNode {\n readonly kind: \"InputObjectTypeExtension\";\n readonly loc?: Location;\n readonly name: NameNode;\n readonly directives?: ReadonlyArray<DirectiveNode>;\n readonly fields?: ReadonlyArray<InputValueDefinitionNode>;\n}\n"],
5
+ "mappings": ";AAmJO,IAAK,oBAAL,kBAAKA,uBAAL;AACL,EAAAA,mBAAA,WAAQ;AACR,EAAAA,mBAAA,cAAW;AACX,EAAAA,mBAAA,kBAAe;AAHL,SAAAA;AAAA,GAAA;",
6
+ "names": ["OperationTypeNode"]
7
+ }
@@ -0,0 +1,56 @@
1
+ import { GraphQLType, GraphQLSchema, GraphQLArgument, ASTVisitor, GraphQLCompositeType, GraphQLEnumValue, GraphQLField, GraphQLInputType, GraphQLOutputType, GraphQLDirective } from "graphql";
2
+ import * as TypelessAST from "graphql/language/ast";
3
+ import * as TypedAST from "./TypedAST";
4
+ import { Maybe } from "graphql/jsutils/Maybe";
5
+ export * from "./TypedAST";
6
+ export declare function addTypesToRequestDocument(schema: GraphQLSchema, document: TypelessAST.DocumentNode, options?: {
7
+ ignoredDirectives?: string[];
8
+ }): TypedAST.DocumentNode;
9
+ /**
10
+ * TypeInfo is a utility class which, given a GraphQL schema, can keep track
11
+ * of the current field and type definitions at any point in a GraphQL document
12
+ * AST during a recursive descent by calling `enter(node)` and `leave(node)`.
13
+ */
14
+ export declare class TypeInfo {
15
+ private _schema;
16
+ private _typeStack;
17
+ private _parentTypeStack;
18
+ private _inputTypeStack;
19
+ private _fieldDefStack;
20
+ private _defaultValueStack;
21
+ private _directive;
22
+ private _argument;
23
+ private _enumValue;
24
+ private _isInIgnoredDirective;
25
+ private _defaultDirectives;
26
+ private _ignoredDirectives;
27
+ constructor(schema: GraphQLSchema,
28
+ /**
29
+ * Initial type may be provided in rare cases to facilitate traversals
30
+ * beginning somewhere other than documents.
31
+ */
32
+ options?: {
33
+ initialType?: Maybe<GraphQLType>;
34
+ defaultDirectives?: ReadonlyArray<GraphQLDirective>;
35
+ ignoredDirectives?: ReadonlyArray<string>;
36
+ });
37
+ get [Symbol.toStringTag](): string;
38
+ getType(): Maybe<GraphQLOutputType>;
39
+ getParentType(): Maybe<GraphQLCompositeType>;
40
+ getInputType(): Maybe<GraphQLInputType>;
41
+ getParentInputType(): Maybe<GraphQLInputType>;
42
+ getFieldDef(): Maybe<GraphQLField<unknown, unknown>>;
43
+ getDefaultValue(): Maybe<unknown>;
44
+ getDirective(): Maybe<GraphQLDirective>;
45
+ getArgument(): Maybe<GraphQLArgument>;
46
+ getEnumValue(): Maybe<GraphQLEnumValue>;
47
+ isInIgnoredDirective(): boolean;
48
+ enter(node: TypelessAST.ASTNode): void;
49
+ leave(node: TypelessAST.ASTNode): void;
50
+ }
51
+ /**
52
+ * Creates a new visitor instance which maintains a provided TypeInfo instance
53
+ * along with visiting visitor.
54
+ */
55
+ export declare function visitWithTypeInfo(typeInfo: TypeInfo, visitor: ASTVisitor): ASTVisitor;
56
+ //# sourceMappingURL=addTypesToRequestDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addTypesToRequestDocument.d.ts","sourceRoot":"","sources":["../../src/supermassive-ast/addTypesToRequestDocument.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EAOb,eAAe,EACf,UAAU,EACV,oBAAoB,EACpB,gBAAgB,EAChB,YAAY,EAEZ,gBAAgB,EAChB,iBAAiB,EAWjB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAEjB,OAAO,KAAK,WAAW,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAC9C,cAAc,YAAY,CAAC;AAG3B,wBAAgB,yBAAyB,CACvC,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,WAAW,CAAC,YAAY,EAClC,OAAO,GAAE;IACP,iBAAiB,CAAC,EAAE,MAAM,EAAE,CAAC;CACzB,GACL,QAAQ,CAAC,YAAY,CA2JvB;AA2DD;;;;GAIG;AACH,qBAAa,QAAQ;IACnB,OAAO,CAAC,OAAO,CAAgB;IAC/B,OAAO,CAAC,UAAU,CAAkC;IACpD,OAAO,CAAC,gBAAgB,CAAqC;IAC7D,OAAO,CAAC,eAAe,CAAiC;IACxD,OAAO,CAAC,cAAc,CAA+C;IACrE,OAAO,CAAC,kBAAkB,CAAwB;IAClD,OAAO,CAAC,UAAU,CAA0B;IAC5C,OAAO,CAAC,SAAS,CAAyB;IAC1C,OAAO,CAAC,UAAU,CAA0B;IAC5C,OAAO,CAAC,qBAAqB,CAAU;IAEvC,OAAO,CAAC,kBAAkB,CAAgC;IAC1D,OAAO,CAAC,kBAAkB,CAAc;gBAGtC,MAAM,EAAE,aAAa;IACrB;;;OAGG;IACH,OAAO,GAAE;QACP,WAAW,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,CAAC;QACjC,iBAAiB,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;QACpD,iBAAiB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;KACtC;IA8BR,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,WAEvB;IAED,OAAO,IAAI,KAAK,CAAC,iBAAiB,CAAC;IAInC,aAAa,IAAI,KAAK,CAAC,oBAAoB,CAAC;IAI5C,YAAY,IAAI,KAAK,CAAC,gBAAgB,CAAC;IAIvC,kBAAkB,IAAI,KAAK,CAAC,gBAAgB,CAAC;IAI7C,WAAW,IAAI,KAAK,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAIpD,eAAe,IAAI,KAAK,CAAC,OAAO,CAAC;IAIjC,YAAY,IAAI,KAAK,CAAC,gBAAgB,CAAC;IAIvC,WAAW,IAAI,KAAK,CAAC,eAAe,CAAC;IAIrC,YAAY,IAAI,KAAK,CAAC,gBAAgB,CAAC;IAIvC,oBAAoB,IAAI,OAAO;IAI/B,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,OAAO;IAyH/B,KAAK,CAAC,IAAI,EAAE,WAAW,CAAC,OAAO;CAsChC;AAUD;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,UAAU,GAClB,UAAU,CA4BZ"}
@@ -0,0 +1,473 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __defProps = Object.defineProperties;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
9
+ var __getProtoOf = Object.getPrototypeOf;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
12
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
13
+ var __spreadValues = (a, b) => {
14
+ for (var prop in b || (b = {}))
15
+ if (__hasOwnProp.call(b, prop))
16
+ __defNormalProp(a, prop, b[prop]);
17
+ if (__getOwnPropSymbols)
18
+ for (var prop of __getOwnPropSymbols(b)) {
19
+ if (__propIsEnum.call(b, prop))
20
+ __defNormalProp(a, prop, b[prop]);
21
+ }
22
+ return a;
23
+ };
24
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
25
+ var __export = (target, all) => {
26
+ for (var name in all)
27
+ __defProp(target, name, { get: all[name], enumerable: true });
28
+ };
29
+ var __copyProps = (to, from, except, desc) => {
30
+ if (from && typeof from === "object" || typeof from === "function") {
31
+ for (let key of __getOwnPropNames(from))
32
+ if (!__hasOwnProp.call(to, key) && key !== except)
33
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
+ }
35
+ return to;
36
+ };
37
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
38
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
39
+ // If the importer is in node compatibility mode or this is not an ESM
40
+ // file that has been converted to a CommonJS file using a Babel-
41
+ // compatible transform (i.e. "__esModule" has not been set), then set
42
+ // "default" to the CommonJS "module.exports" for node compatibility.
43
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
44
+ mod
45
+ ));
46
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
47
+ var addTypesToRequestDocument_exports = {};
48
+ __export(addTypesToRequestDocument_exports, {
49
+ TypeInfo: () => TypeInfo,
50
+ addTypesToRequestDocument: () => addTypesToRequestDocument,
51
+ visitWithTypeInfo: () => visitWithTypeInfo
52
+ });
53
+ module.exports = __toCommonJS(addTypesToRequestDocument_exports);
54
+ var import_graphql = require("graphql");
55
+ var TypelessAST = __toESM(require("graphql/language/ast"));
56
+ __reExport(addTypesToRequestDocument_exports, require("./TypedAST"), module.exports);
57
+ var import_directives = require("./directives");
58
+ function addTypesToRequestDocument(schema, document, options = {}) {
59
+ const typeInfo = new TypeInfo(schema, {
60
+ defaultDirectives: import_directives.specifiedDirectives,
61
+ ignoredDirectives: options.ignoredDirectives
62
+ });
63
+ return (0, import_graphql.visit)(
64
+ document,
65
+ visitWithTypeInfo(typeInfo, {
66
+ Argument: {
67
+ leave(node, _key, _parent, _path, ancestors) {
68
+ const argument = typeInfo.getArgument();
69
+ if (argument) {
70
+ const typeNode = generateTypeNode(argument.type);
71
+ const newNode = __spreadProps(__spreadValues({}, node), {
72
+ __type: typeNode
73
+ });
74
+ if (argument.defaultValue && node.value.kind === import_graphql.Kind.VARIABLE) {
75
+ newNode.__defaultValue = (0, import_graphql.astFromValue)(
76
+ argument.defaultValue,
77
+ argument.type
78
+ );
79
+ }
80
+ return newNode;
81
+ }
82
+ if (!typeInfo.isInIgnoredDirective()) {
83
+ const errorPath = makeReadableErrorPath(ancestors);
84
+ throw new Error(
85
+ `Cannot find type for argument: ${errorPath.join(".")}.${node.name.value}`
86
+ );
87
+ }
88
+ }
89
+ },
90
+ Directive: {
91
+ leave(node, _key, _parent, _path, ancestors) {
92
+ const directiveDef = typeInfo.getDirective();
93
+ if (directiveDef) {
94
+ const missingArgs = directiveDef.args.filter(
95
+ (argDef) => {
96
+ var _a;
97
+ return argDef.defaultValue != null && ((_a = node.arguments) == null ? void 0 : _a.findIndex(
98
+ (arg) => arg.name.value === argDef.name
99
+ )) === -1;
100
+ }
101
+ );
102
+ if (missingArgs) {
103
+ const newNode = __spreadValues({}, node);
104
+ newNode.arguments = (newNode.arguments || []).concat(
105
+ missingArgs.map((arg) => ({
106
+ __type: generateTypeNode(arg.type),
107
+ kind: import_graphql.Kind.ARGUMENT,
108
+ name: {
109
+ kind: import_graphql.Kind.NAME,
110
+ value: arg.name
111
+ },
112
+ value: (0, import_graphql.astFromValue)(
113
+ arg.defaultValue,
114
+ arg.type
115
+ )
116
+ }))
117
+ );
118
+ return newNode;
119
+ }
120
+ return node;
121
+ }
122
+ if (!typeInfo.isInIgnoredDirective()) {
123
+ const errorPath = makeReadableErrorPath(ancestors);
124
+ throw new Error(
125
+ `Cannot find type for directive: ${errorPath.join(".")}.${node.name.value}`
126
+ );
127
+ }
128
+ }
129
+ },
130
+ Field: {
131
+ leave(node, _key, _parent, _path, ancestors) {
132
+ const fieldDef = typeInfo.getFieldDef();
133
+ if (fieldDef) {
134
+ const type = fieldDef.type;
135
+ if (type) {
136
+ const typeNode = generateTypeNode(type);
137
+ const missingArgs = fieldDef.args.filter(
138
+ (argDef) => {
139
+ var _a;
140
+ return argDef.defaultValue != null && ((_a = node.arguments) == null ? void 0 : _a.findIndex(
141
+ (arg) => arg.name.value === argDef.name
142
+ )) === -1;
143
+ }
144
+ );
145
+ const newNode = __spreadProps(__spreadValues({}, node), {
146
+ __type: typeNode
147
+ });
148
+ if (missingArgs) {
149
+ newNode.arguments = (newNode.arguments || []).concat(
150
+ missingArgs.map((arg) => ({
151
+ __type: generateTypeNode(arg.type),
152
+ kind: import_graphql.Kind.ARGUMENT,
153
+ name: {
154
+ kind: import_graphql.Kind.NAME,
155
+ value: arg.name
156
+ },
157
+ value: (0, import_graphql.astFromValue)(
158
+ arg.defaultValue,
159
+ arg.type
160
+ )
161
+ }))
162
+ );
163
+ }
164
+ return newNode;
165
+ }
166
+ }
167
+ const errorPath = makeReadableErrorPath(ancestors);
168
+ throw new Error(
169
+ `Cannot find type for field: ${errorPath.join(".")}.${node.name.value}`
170
+ );
171
+ }
172
+ }
173
+ })
174
+ );
175
+ }
176
+ function generateTypeNode(type) {
177
+ if ((0, import_graphql.isNonNullType)(type)) {
178
+ const typeNode = generateTypeNode(type.ofType);
179
+ return {
180
+ kind: "NonNullType",
181
+ type: typeNode
182
+ };
183
+ } else if ((0, import_graphql.isListType)(type)) {
184
+ const typeNode = generateTypeNode(type.ofType);
185
+ return {
186
+ kind: "ListType",
187
+ type: typeNode
188
+ };
189
+ } else if ((0, import_graphql.isNamedType)(type)) {
190
+ return {
191
+ kind: "NamedType",
192
+ name: {
193
+ kind: "Name",
194
+ value: type.name
195
+ }
196
+ };
197
+ }
198
+ throw new Error(`Can't generate TypeNode for type: ${type}`);
199
+ }
200
+ function makeReadableErrorPath(ancestors) {
201
+ const path = [];
202
+ ancestors.forEach((ancestorOrArray) => {
203
+ let ancestor;
204
+ if (!Array.isArray(ancestorOrArray)) {
205
+ ancestor = ancestorOrArray;
206
+ if (ancestor && ancestor.kind === import_graphql.Kind.FIELD) {
207
+ path.push(ancestor.name.value);
208
+ } else if (ancestor && ancestor.kind === import_graphql.Kind.DIRECTIVE) {
209
+ path.push(`@${ancestor.name.value}`);
210
+ } else if (ancestor && ancestor.kind === import_graphql.Kind.OPERATION_DEFINITION) {
211
+ let name;
212
+ if (ancestor.name) {
213
+ name = `${ancestor.operation} ${ancestor.name.value}`;
214
+ } else {
215
+ name = ancestor.operation;
216
+ }
217
+ path.push(name);
218
+ }
219
+ }
220
+ });
221
+ return path;
222
+ }
223
+ class TypeInfo {
224
+ constructor(schema, options = {}) {
225
+ this._schema = schema;
226
+ this._typeStack = [];
227
+ this._parentTypeStack = [];
228
+ this._inputTypeStack = [];
229
+ this._fieldDefStack = [];
230
+ this._defaultValueStack = [];
231
+ this._directive = null;
232
+ this._isInIgnoredDirective = false;
233
+ this._argument = null;
234
+ this._enumValue = null;
235
+ if (options.initialType) {
236
+ if ((0, import_graphql.isInputType)(options.initialType)) {
237
+ this._inputTypeStack.push(options.initialType);
238
+ }
239
+ if ((0, import_graphql.isCompositeType)(options.initialType)) {
240
+ this._parentTypeStack.push(options.initialType);
241
+ }
242
+ if ((0, import_graphql.isOutputType)(options.initialType)) {
243
+ this._typeStack.push(options.initialType);
244
+ }
245
+ }
246
+ this._defaultDirectives = /* @__PURE__ */ new Map();
247
+ for (const directive of options.defaultDirectives || []) {
248
+ this._defaultDirectives.set(directive.name, directive);
249
+ }
250
+ this._ignoredDirectives = new Set(options.ignoredDirectives || []);
251
+ }
252
+ get [Symbol.toStringTag]() {
253
+ return "TypeInfo";
254
+ }
255
+ getType() {
256
+ return at(this._typeStack, -1);
257
+ }
258
+ getParentType() {
259
+ return at(this._parentTypeStack, -1);
260
+ }
261
+ getInputType() {
262
+ return at(this._inputTypeStack, -1);
263
+ }
264
+ getParentInputType() {
265
+ return at(this._inputTypeStack, -2);
266
+ }
267
+ getFieldDef() {
268
+ return at(this._fieldDefStack, -1);
269
+ }
270
+ getDefaultValue() {
271
+ return at(this._defaultValueStack, -1);
272
+ }
273
+ getDirective() {
274
+ return this._directive;
275
+ }
276
+ getArgument() {
277
+ return this._argument;
278
+ }
279
+ getEnumValue() {
280
+ return this._enumValue;
281
+ }
282
+ isInIgnoredDirective() {
283
+ return this._isInIgnoredDirective;
284
+ }
285
+ enter(node) {
286
+ var _a;
287
+ const schema = this._schema;
288
+ switch (node.kind) {
289
+ case import_graphql.Kind.SELECTION_SET: {
290
+ const namedType = (0, import_graphql.getNamedType)(this.getType());
291
+ this._parentTypeStack.push(
292
+ (0, import_graphql.isCompositeType)(namedType) ? namedType : void 0
293
+ );
294
+ break;
295
+ }
296
+ case import_graphql.Kind.FIELD: {
297
+ const parentType = this.getParentType();
298
+ let fieldDef;
299
+ let fieldType;
300
+ if (parentType) {
301
+ fieldDef = getFieldDef(schema, parentType, node);
302
+ if (fieldDef) {
303
+ fieldType = fieldDef.type;
304
+ }
305
+ }
306
+ this._fieldDefStack.push(fieldDef);
307
+ this._typeStack.push((0, import_graphql.isOutputType)(fieldType) ? fieldType : void 0);
308
+ break;
309
+ }
310
+ case import_graphql.Kind.DIRECTIVE: {
311
+ const name = node.name.value;
312
+ this._directive = schema.getDirective(name);
313
+ if (!this._directive) {
314
+ if (this._defaultDirectives.has(name)) {
315
+ this._directive = this._defaultDirectives.get(name);
316
+ }
317
+ if (this._ignoredDirectives.has(name)) {
318
+ this._isInIgnoredDirective = true;
319
+ }
320
+ }
321
+ break;
322
+ }
323
+ case import_graphql.Kind.OPERATION_DEFINITION: {
324
+ const rootType = schema.getRootType(node.operation);
325
+ this._typeStack.push((0, import_graphql.isObjectType)(rootType) ? rootType : void 0);
326
+ break;
327
+ }
328
+ case import_graphql.Kind.INLINE_FRAGMENT:
329
+ case import_graphql.Kind.FRAGMENT_DEFINITION: {
330
+ const typeConditionAST = node.typeCondition;
331
+ const outputType = typeConditionAST ? (0, import_graphql.typeFromAST)(schema, typeConditionAST) : (0, import_graphql.getNamedType)(this.getType());
332
+ this._typeStack.push((0, import_graphql.isOutputType)(outputType) ? outputType : void 0);
333
+ break;
334
+ }
335
+ case import_graphql.Kind.VARIABLE_DEFINITION: {
336
+ const inputType = (0, import_graphql.typeFromAST)(schema, node.type);
337
+ this._inputTypeStack.push(
338
+ (0, import_graphql.isInputType)(inputType) ? inputType : void 0
339
+ );
340
+ break;
341
+ }
342
+ case import_graphql.Kind.ARGUMENT: {
343
+ let argDef;
344
+ let argType;
345
+ const fieldOrDirective = (_a = this.getDirective()) != null ? _a : this.getFieldDef();
346
+ if (fieldOrDirective) {
347
+ argDef = fieldOrDirective.args.find(
348
+ (arg) => arg.name === node.name.value
349
+ );
350
+ if (argDef) {
351
+ argType = argDef.type;
352
+ }
353
+ }
354
+ this._argument = argDef;
355
+ this._defaultValueStack.push(argDef ? argDef.defaultValue : void 0);
356
+ this._inputTypeStack.push((0, import_graphql.isInputType)(argType) ? argType : void 0);
357
+ break;
358
+ }
359
+ case import_graphql.Kind.LIST: {
360
+ const listType = (0, import_graphql.getNullableType)(this.getInputType());
361
+ const itemType = (0, import_graphql.isListType)(listType) ? listType.ofType : listType;
362
+ this._defaultValueStack.push(void 0);
363
+ this._inputTypeStack.push((0, import_graphql.isInputType)(itemType) ? itemType : void 0);
364
+ break;
365
+ }
366
+ case import_graphql.Kind.OBJECT_FIELD: {
367
+ const objectType = (0, import_graphql.getNamedType)(this.getInputType());
368
+ let inputFieldType;
369
+ let inputField;
370
+ if ((0, import_graphql.isInputObjectType)(objectType)) {
371
+ inputField = objectType.getFields()[node.name.value];
372
+ if (inputField != null) {
373
+ inputFieldType = inputField.type;
374
+ }
375
+ }
376
+ this._defaultValueStack.push(
377
+ inputField ? inputField.defaultValue : void 0
378
+ );
379
+ this._inputTypeStack.push(
380
+ (0, import_graphql.isInputType)(inputFieldType) ? inputFieldType : void 0
381
+ );
382
+ break;
383
+ }
384
+ case import_graphql.Kind.ENUM: {
385
+ const enumType = (0, import_graphql.getNamedType)(this.getInputType());
386
+ let enumValue;
387
+ if ((0, import_graphql.isEnumType)(enumType)) {
388
+ enumValue = enumType.getValue(node.value);
389
+ }
390
+ this._enumValue = enumValue;
391
+ break;
392
+ }
393
+ default:
394
+ }
395
+ }
396
+ leave(node) {
397
+ switch (node.kind) {
398
+ case import_graphql.Kind.SELECTION_SET:
399
+ this._parentTypeStack.pop();
400
+ break;
401
+ case import_graphql.Kind.FIELD:
402
+ this._fieldDefStack.pop();
403
+ this._typeStack.pop();
404
+ break;
405
+ case import_graphql.Kind.DIRECTIVE:
406
+ this._directive = null;
407
+ this._isInIgnoredDirective = false;
408
+ break;
409
+ case import_graphql.Kind.OPERATION_DEFINITION:
410
+ case import_graphql.Kind.INLINE_FRAGMENT:
411
+ case import_graphql.Kind.FRAGMENT_DEFINITION:
412
+ this._typeStack.pop();
413
+ break;
414
+ case import_graphql.Kind.VARIABLE_DEFINITION:
415
+ this._inputTypeStack.pop();
416
+ break;
417
+ case import_graphql.Kind.ARGUMENT:
418
+ this._argument = null;
419
+ this._defaultValueStack.pop();
420
+ this._inputTypeStack.pop();
421
+ break;
422
+ case import_graphql.Kind.LIST:
423
+ case import_graphql.Kind.OBJECT_FIELD:
424
+ this._defaultValueStack.pop();
425
+ this._inputTypeStack.pop();
426
+ break;
427
+ case import_graphql.Kind.ENUM:
428
+ this._enumValue = null;
429
+ break;
430
+ default:
431
+ }
432
+ }
433
+ }
434
+ function getFieldDef(schema, parentType, fieldNode) {
435
+ return schema.getField(parentType, fieldNode.name.value);
436
+ }
437
+ function visitWithTypeInfo(typeInfo, visitor) {
438
+ return {
439
+ enter(...args) {
440
+ const node = args[0];
441
+ typeInfo.enter(node);
442
+ const fn = (0, import_graphql.getEnterLeaveForKind)(visitor, node.kind).enter;
443
+ if (fn) {
444
+ const result = fn.apply(visitor, args);
445
+ if (result !== void 0) {
446
+ typeInfo.leave(node);
447
+ if (TypelessAST.isNode(result)) {
448
+ typeInfo.enter(result);
449
+ }
450
+ }
451
+ return result;
452
+ }
453
+ },
454
+ leave(...args) {
455
+ const node = args[0];
456
+ const fn = (0, import_graphql.getEnterLeaveForKind)(visitor, node.kind).leave;
457
+ let result;
458
+ if (fn) {
459
+ result = fn.apply(visitor, args);
460
+ }
461
+ typeInfo.leave(node);
462
+ return result;
463
+ }
464
+ };
465
+ }
466
+ function at(arr, index) {
467
+ const len = arr.length;
468
+ const relativeIndex = index >= 0 ? index : len + index;
469
+ if (relativeIndex < 0 || relativeIndex >= len) {
470
+ return void 0;
471
+ }
472
+ return arr[relativeIndex];
473
+ }