@contember/graphql-json 0.0.0-stage → 2.2.0-alpha.20
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.
- package/README.md +119 -2
- package/dist/development/index.cjs +123 -0
- package/dist/development/index.cjs.map +1 -0
- package/dist/development/index.js +123 -0
- package/dist/development/index.js.map +1 -0
- package/dist/development/src/execution/collectFields.cjs +138 -0
- package/dist/development/src/execution/collectFields.cjs.map +1 -0
- package/dist/development/src/execution/collectFields.js +138 -0
- package/dist/development/src/execution/collectFields.js.map +1 -0
- package/dist/development/src/execution/complete.cjs +340 -0
- package/dist/development/src/execution/complete.cjs.map +1 -0
- package/dist/development/src/execution/complete.js +340 -0
- package/dist/development/src/execution/complete.js.map +1 -0
- package/dist/development/src/execution/context.cjs +93 -0
- package/dist/development/src/execution/context.cjs.map +1 -0
- package/dist/development/src/execution/context.js +93 -0
- package/dist/development/src/execution/context.js.map +1 -0
- package/dist/development/src/execution/directives.cjs +49 -0
- package/dist/development/src/execution/directives.cjs.map +1 -0
- package/dist/development/src/execution/directives.js +49 -0
- package/dist/development/src/execution/directives.js.map +1 -0
- package/dist/development/src/execution/execute.cjs +128 -0
- package/dist/development/src/execution/execute.cjs.map +1 -0
- package/dist/development/src/execution/execute.js +128 -0
- package/dist/development/src/execution/execute.js.map +1 -0
- package/dist/development/src/execution/fields.cjs +156 -0
- package/dist/development/src/execution/fields.cjs.map +1 -0
- package/dist/development/src/execution/fields.js +156 -0
- package/dist/development/src/execution/fields.js.map +1 -0
- package/dist/development/src/execution/introspectionResolvers.cjs +85 -0
- package/dist/development/src/execution/introspectionResolvers.cjs.map +1 -0
- package/dist/development/src/execution/introspectionResolvers.js +86 -0
- package/dist/development/src/execution/introspectionResolvers.js.map +1 -0
- package/dist/development/src/execution/values.cjs +371 -0
- package/dist/development/src/execution/values.cjs.map +1 -0
- package/dist/development/src/execution/values.js +371 -0
- package/dist/development/src/execution/values.js.map +1 -0
- package/dist/development/src/introspection/resolvers.cjs +432 -0
- package/dist/development/src/introspection/resolvers.cjs.map +1 -0
- package/dist/development/src/introspection/resolvers.js +432 -0
- package/dist/development/src/introspection/resolvers.js.map +1 -0
- package/dist/development/src/introspection/types.cjs +267 -0
- package/dist/development/src/introspection/types.cjs.map +1 -0
- package/dist/development/src/introspection/types.js +267 -0
- package/dist/development/src/introspection/types.js.map +1 -0
- package/dist/development/src/scalars/builtIn.cjs +260 -0
- package/dist/development/src/scalars/builtIn.cjs.map +1 -0
- package/dist/development/src/scalars/builtIn.js +260 -0
- package/dist/development/src/scalars/builtIn.js.map +1 -0
- package/dist/development/src/schema/buildSchema.cjs +235 -0
- package/dist/development/src/schema/buildSchema.cjs.map +1 -0
- package/dist/development/src/schema/buildSchema.js +235 -0
- package/dist/development/src/schema/buildSchema.js.map +1 -0
- package/dist/development/src/types/resolvers.cjs +15 -0
- package/dist/development/src/types/resolvers.cjs.map +1 -0
- package/dist/development/src/types/resolvers.js +15 -0
- package/dist/development/src/types/resolvers.js.map +1 -0
- package/dist/development/src/types/schema.cjs +184 -0
- package/dist/development/src/types/schema.cjs.map +1 -0
- package/dist/development/src/types/schema.js +184 -0
- package/dist/development/src/types/schema.js.map +1 -0
- package/dist/development/src/utils/enumValues.cjs +49 -0
- package/dist/development/src/utils/enumValues.cjs.map +1 -0
- package/dist/development/src/utils/enumValues.js +49 -0
- package/dist/development/src/utils/enumValues.js.map +1 -0
- package/dist/development/src/utils/helpers.cjs +122 -0
- package/dist/development/src/utils/helpers.cjs.map +1 -0
- package/dist/development/src/utils/helpers.js +122 -0
- package/dist/development/src/utils/helpers.js.map +1 -0
- package/dist/development/src/utils/path.cjs +17 -0
- package/dist/development/src/utils/path.cjs.map +1 -0
- package/dist/development/src/utils/path.js +17 -0
- package/dist/development/src/utils/path.js.map +1 -0
- package/dist/development/src/utils/schemaInterner.cjs +297 -0
- package/dist/development/src/utils/schemaInterner.cjs.map +1 -0
- package/dist/development/src/utils/schemaInterner.js +297 -0
- package/dist/development/src/utils/schemaInterner.js.map +1 -0
- package/dist/development/src/utils/toGraphQLJsSchema.cjs +130 -0
- package/dist/development/src/utils/toGraphQLJsSchema.cjs.map +1 -0
- package/dist/development/src/utils/toGraphQLJsSchema.js +130 -0
- package/dist/development/src/utils/toGraphQLJsSchema.js.map +1 -0
- package/dist/development/src/utils/typeRef.cjs +246 -0
- package/dist/development/src/utils/typeRef.cjs.map +1 -0
- package/dist/development/src/utils/typeRef.js +246 -0
- package/dist/development/src/utils/typeRef.js.map +1 -0
- package/dist/development/src/validation/TypeInfo.cjs +309 -0
- package/dist/development/src/validation/TypeInfo.cjs.map +1 -0
- package/dist/development/src/validation/TypeInfo.js +309 -0
- package/dist/development/src/validation/TypeInfo.js.map +1 -0
- package/dist/development/src/validation/ValidationContext.cjs +170 -0
- package/dist/development/src/validation/ValidationContext.cjs.map +1 -0
- package/dist/development/src/validation/ValidationContext.js +170 -0
- package/dist/development/src/validation/ValidationContext.js.map +1 -0
- package/dist/development/src/validation/helpers.cjs +233 -0
- package/dist/development/src/validation/helpers.cjs.map +1 -0
- package/dist/development/src/validation/helpers.js +233 -0
- package/dist/development/src/validation/helpers.js.map +1 -0
- package/dist/development/src/validation/rules/ExecutableDefinitionsRule.cjs +25 -0
- package/dist/development/src/validation/rules/ExecutableDefinitionsRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/ExecutableDefinitionsRule.js +25 -0
- package/dist/development/src/validation/rules/ExecutableDefinitionsRule.js.map +1 -0
- package/dist/development/src/validation/rules/FieldsOnCorrectTypeRule.cjs +80 -0
- package/dist/development/src/validation/rules/FieldsOnCorrectTypeRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/FieldsOnCorrectTypeRule.js +80 -0
- package/dist/development/src/validation/rules/FieldsOnCorrectTypeRule.js.map +1 -0
- package/dist/development/src/validation/rules/FragmentsOnCompositeTypesRule.cjs +39 -0
- package/dist/development/src/validation/rules/FragmentsOnCompositeTypesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/FragmentsOnCompositeTypesRule.js +39 -0
- package/dist/development/src/validation/rules/FragmentsOnCompositeTypesRule.js.map +1 -0
- package/dist/development/src/validation/rules/KnownArgumentNamesRule.cjs +62 -0
- package/dist/development/src/validation/rules/KnownArgumentNamesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/KnownArgumentNamesRule.js +62 -0
- package/dist/development/src/validation/rules/KnownArgumentNamesRule.js.map +1 -0
- package/dist/development/src/validation/rules/KnownDirectivesRule.cjs +99 -0
- package/dist/development/src/validation/rules/KnownDirectivesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/KnownDirectivesRule.js +99 -0
- package/dist/development/src/validation/rules/KnownDirectivesRule.js.map +1 -0
- package/dist/development/src/validation/rules/KnownFragmentNamesRule.cjs +18 -0
- package/dist/development/src/validation/rules/KnownFragmentNamesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/KnownFragmentNamesRule.js +18 -0
- package/dist/development/src/validation/rules/KnownFragmentNamesRule.js.map +1 -0
- package/dist/development/src/validation/rules/KnownTypeNamesRule.cjs +36 -0
- package/dist/development/src/validation/rules/KnownTypeNamesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/KnownTypeNamesRule.js +36 -0
- package/dist/development/src/validation/rules/KnownTypeNamesRule.js.map +1 -0
- package/dist/development/src/validation/rules/LoneAnonymousOperationRule.cjs +25 -0
- package/dist/development/src/validation/rules/LoneAnonymousOperationRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/LoneAnonymousOperationRule.js +25 -0
- package/dist/development/src/validation/rules/LoneAnonymousOperationRule.js.map +1 -0
- package/dist/development/src/validation/rules/MaxIntrospectionDepthRule.cjs +51 -0
- package/dist/development/src/validation/rules/MaxIntrospectionDepthRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/MaxIntrospectionDepthRule.js +51 -0
- package/dist/development/src/validation/rules/MaxIntrospectionDepthRule.js.map +1 -0
- package/dist/development/src/validation/rules/NoFragmentCyclesRule.cjs +68 -0
- package/dist/development/src/validation/rules/NoFragmentCyclesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/NoFragmentCyclesRule.js +68 -0
- package/dist/development/src/validation/rules/NoFragmentCyclesRule.js.map +1 -0
- package/dist/development/src/validation/rules/NoUndefinedVariablesRule.cjs +28 -0
- package/dist/development/src/validation/rules/NoUndefinedVariablesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/NoUndefinedVariablesRule.js +28 -0
- package/dist/development/src/validation/rules/NoUndefinedVariablesRule.js.map +1 -0
- package/dist/development/src/validation/rules/NoUnusedFragmentsRule.cjs +39 -0
- package/dist/development/src/validation/rules/NoUnusedFragmentsRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/NoUnusedFragmentsRule.js +39 -0
- package/dist/development/src/validation/rules/NoUnusedFragmentsRule.js.map +1 -0
- package/dist/development/src/validation/rules/NoUnusedVariablesRule.cjs +36 -0
- package/dist/development/src/validation/rules/NoUnusedVariablesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/NoUnusedVariablesRule.js +36 -0
- package/dist/development/src/validation/rules/NoUnusedVariablesRule.js.map +1 -0
- package/dist/development/src/validation/rules/OverlappingFieldsCanBeMergedRule.cjs +326 -0
- package/dist/development/src/validation/rules/OverlappingFieldsCanBeMergedRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/OverlappingFieldsCanBeMergedRule.js +326 -0
- package/dist/development/src/validation/rules/OverlappingFieldsCanBeMergedRule.js.map +1 -0
- package/dist/development/src/validation/rules/PossibleFragmentSpreadsRule.cjs +71 -0
- package/dist/development/src/validation/rules/PossibleFragmentSpreadsRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/PossibleFragmentSpreadsRule.js +71 -0
- package/dist/development/src/validation/rules/PossibleFragmentSpreadsRule.js.map +1 -0
- package/dist/development/src/validation/rules/ProvidedRequiredArgumentsRule.cjs +88 -0
- package/dist/development/src/validation/rules/ProvidedRequiredArgumentsRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/ProvidedRequiredArgumentsRule.js +88 -0
- package/dist/development/src/validation/rules/ProvidedRequiredArgumentsRule.js.map +1 -0
- package/dist/development/src/validation/rules/ScalarLeafsRule.cjs +46 -0
- package/dist/development/src/validation/rules/ScalarLeafsRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/ScalarLeafsRule.js +46 -0
- package/dist/development/src/validation/rules/ScalarLeafsRule.js.map +1 -0
- package/dist/development/src/validation/rules/SingleFieldSubscriptionsRule.cjs +51 -0
- package/dist/development/src/validation/rules/SingleFieldSubscriptionsRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/SingleFieldSubscriptionsRule.js +51 -0
- package/dist/development/src/validation/rules/SingleFieldSubscriptionsRule.js.map +1 -0
- package/dist/development/src/validation/rules/UniqueArgumentNamesRule.cjs +34 -0
- package/dist/development/src/validation/rules/UniqueArgumentNamesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/UniqueArgumentNamesRule.js +34 -0
- package/dist/development/src/validation/rules/UniqueArgumentNamesRule.js.map +1 -0
- package/dist/development/src/validation/rules/UniqueDirectivesPerLocationRule.cjs +51 -0
- package/dist/development/src/validation/rules/UniqueDirectivesPerLocationRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/UniqueDirectivesPerLocationRule.js +51 -0
- package/dist/development/src/validation/rules/UniqueDirectivesPerLocationRule.js.map +1 -0
- package/dist/development/src/validation/rules/UniqueFragmentNamesRule.cjs +28 -0
- package/dist/development/src/validation/rules/UniqueFragmentNamesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/UniqueFragmentNamesRule.js +28 -0
- package/dist/development/src/validation/rules/UniqueFragmentNamesRule.js.map +1 -0
- package/dist/development/src/validation/rules/UniqueInputFieldNamesRule.cjs +37 -0
- package/dist/development/src/validation/rules/UniqueInputFieldNamesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/UniqueInputFieldNamesRule.js +37 -0
- package/dist/development/src/validation/rules/UniqueInputFieldNamesRule.js.map +1 -0
- package/dist/development/src/validation/rules/UniqueOperationNamesRule.cjs +30 -0
- package/dist/development/src/validation/rules/UniqueOperationNamesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/UniqueOperationNamesRule.js +30 -0
- package/dist/development/src/validation/rules/UniqueOperationNamesRule.js.map +1 -0
- package/dist/development/src/validation/rules/UniqueVariableNamesRule.cjs +27 -0
- package/dist/development/src/validation/rules/UniqueVariableNamesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/UniqueVariableNamesRule.js +27 -0
- package/dist/development/src/validation/rules/UniqueVariableNamesRule.js.map +1 -0
- package/dist/development/src/validation/rules/ValuesOfCorrectTypeRule.cjs +123 -0
- package/dist/development/src/validation/rules/ValuesOfCorrectTypeRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/ValuesOfCorrectTypeRule.js +123 -0
- package/dist/development/src/validation/rules/ValuesOfCorrectTypeRule.js.map +1 -0
- package/dist/development/src/validation/rules/VariablesAreInputTypesRule.cjs +29 -0
- package/dist/development/src/validation/rules/VariablesAreInputTypesRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/VariablesAreInputTypesRule.js +29 -0
- package/dist/development/src/validation/rules/VariablesAreInputTypesRule.js.map +1 -0
- package/dist/development/src/validation/rules/VariablesInAllowedPositionRule.cjs +63 -0
- package/dist/development/src/validation/rules/VariablesInAllowedPositionRule.cjs.map +1 -0
- package/dist/development/src/validation/rules/VariablesInAllowedPositionRule.js +63 -0
- package/dist/development/src/validation/rules/VariablesInAllowedPositionRule.js.map +1 -0
- package/dist/development/src/validation/sortValueNode.cjs +71 -0
- package/dist/development/src/validation/sortValueNode.cjs.map +1 -0
- package/dist/development/src/validation/sortValueNode.js +71 -0
- package/dist/development/src/validation/sortValueNode.js.map +1 -0
- package/dist/development/src/validation/specifiedRules.cjs +87 -0
- package/dist/development/src/validation/specifiedRules.cjs.map +1 -0
- package/dist/development/src/validation/specifiedRules.js +87 -0
- package/dist/development/src/validation/specifiedRules.js.map +1 -0
- package/dist/development/src/validation/validate.cjs +53 -0
- package/dist/development/src/validation/validate.cjs.map +1 -0
- package/dist/development/src/validation/validate.js +53 -0
- package/dist/development/src/validation/validate.js.map +1 -0
- package/dist/production/index.cjs +123 -0
- package/dist/production/index.cjs.map +1 -0
- package/dist/production/index.js +123 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/src/execution/collectFields.cjs +138 -0
- package/dist/production/src/execution/collectFields.cjs.map +1 -0
- package/dist/production/src/execution/collectFields.js +138 -0
- package/dist/production/src/execution/collectFields.js.map +1 -0
- package/dist/production/src/execution/complete.cjs +340 -0
- package/dist/production/src/execution/complete.cjs.map +1 -0
- package/dist/production/src/execution/complete.js +340 -0
- package/dist/production/src/execution/complete.js.map +1 -0
- package/dist/production/src/execution/context.cjs +93 -0
- package/dist/production/src/execution/context.cjs.map +1 -0
- package/dist/production/src/execution/context.js +93 -0
- package/dist/production/src/execution/context.js.map +1 -0
- package/dist/production/src/execution/directives.cjs +49 -0
- package/dist/production/src/execution/directives.cjs.map +1 -0
- package/dist/production/src/execution/directives.js +49 -0
- package/dist/production/src/execution/directives.js.map +1 -0
- package/dist/production/src/execution/execute.cjs +128 -0
- package/dist/production/src/execution/execute.cjs.map +1 -0
- package/dist/production/src/execution/execute.js +128 -0
- package/dist/production/src/execution/execute.js.map +1 -0
- package/dist/production/src/execution/fields.cjs +156 -0
- package/dist/production/src/execution/fields.cjs.map +1 -0
- package/dist/production/src/execution/fields.js +156 -0
- package/dist/production/src/execution/fields.js.map +1 -0
- package/dist/production/src/execution/introspectionResolvers.cjs +85 -0
- package/dist/production/src/execution/introspectionResolvers.cjs.map +1 -0
- package/dist/production/src/execution/introspectionResolvers.js +86 -0
- package/dist/production/src/execution/introspectionResolvers.js.map +1 -0
- package/dist/production/src/execution/values.cjs +371 -0
- package/dist/production/src/execution/values.cjs.map +1 -0
- package/dist/production/src/execution/values.js +371 -0
- package/dist/production/src/execution/values.js.map +1 -0
- package/dist/production/src/introspection/resolvers.cjs +432 -0
- package/dist/production/src/introspection/resolvers.cjs.map +1 -0
- package/dist/production/src/introspection/resolvers.js +432 -0
- package/dist/production/src/introspection/resolvers.js.map +1 -0
- package/dist/production/src/introspection/types.cjs +267 -0
- package/dist/production/src/introspection/types.cjs.map +1 -0
- package/dist/production/src/introspection/types.js +267 -0
- package/dist/production/src/introspection/types.js.map +1 -0
- package/dist/production/src/scalars/builtIn.cjs +260 -0
- package/dist/production/src/scalars/builtIn.cjs.map +1 -0
- package/dist/production/src/scalars/builtIn.js +260 -0
- package/dist/production/src/scalars/builtIn.js.map +1 -0
- package/dist/production/src/schema/buildSchema.cjs +235 -0
- package/dist/production/src/schema/buildSchema.cjs.map +1 -0
- package/dist/production/src/schema/buildSchema.js +235 -0
- package/dist/production/src/schema/buildSchema.js.map +1 -0
- package/dist/production/src/types/resolvers.cjs +15 -0
- package/dist/production/src/types/resolvers.cjs.map +1 -0
- package/dist/production/src/types/resolvers.js +15 -0
- package/dist/production/src/types/resolvers.js.map +1 -0
- package/dist/production/src/types/schema.cjs +184 -0
- package/dist/production/src/types/schema.cjs.map +1 -0
- package/dist/production/src/types/schema.js +184 -0
- package/dist/production/src/types/schema.js.map +1 -0
- package/dist/production/src/utils/enumValues.cjs +49 -0
- package/dist/production/src/utils/enumValues.cjs.map +1 -0
- package/dist/production/src/utils/enumValues.js +49 -0
- package/dist/production/src/utils/enumValues.js.map +1 -0
- package/dist/production/src/utils/helpers.cjs +122 -0
- package/dist/production/src/utils/helpers.cjs.map +1 -0
- package/dist/production/src/utils/helpers.js +122 -0
- package/dist/production/src/utils/helpers.js.map +1 -0
- package/dist/production/src/utils/path.cjs +17 -0
- package/dist/production/src/utils/path.cjs.map +1 -0
- package/dist/production/src/utils/path.js +17 -0
- package/dist/production/src/utils/path.js.map +1 -0
- package/dist/production/src/utils/schemaInterner.cjs +297 -0
- package/dist/production/src/utils/schemaInterner.cjs.map +1 -0
- package/dist/production/src/utils/schemaInterner.js +297 -0
- package/dist/production/src/utils/schemaInterner.js.map +1 -0
- package/dist/production/src/utils/toGraphQLJsSchema.cjs +130 -0
- package/dist/production/src/utils/toGraphQLJsSchema.cjs.map +1 -0
- package/dist/production/src/utils/toGraphQLJsSchema.js +130 -0
- package/dist/production/src/utils/toGraphQLJsSchema.js.map +1 -0
- package/dist/production/src/utils/typeRef.cjs +246 -0
- package/dist/production/src/utils/typeRef.cjs.map +1 -0
- package/dist/production/src/utils/typeRef.js +246 -0
- package/dist/production/src/utils/typeRef.js.map +1 -0
- package/dist/production/src/validation/TypeInfo.cjs +309 -0
- package/dist/production/src/validation/TypeInfo.cjs.map +1 -0
- package/dist/production/src/validation/TypeInfo.js +309 -0
- package/dist/production/src/validation/TypeInfo.js.map +1 -0
- package/dist/production/src/validation/ValidationContext.cjs +170 -0
- package/dist/production/src/validation/ValidationContext.cjs.map +1 -0
- package/dist/production/src/validation/ValidationContext.js +170 -0
- package/dist/production/src/validation/ValidationContext.js.map +1 -0
- package/dist/production/src/validation/helpers.cjs +233 -0
- package/dist/production/src/validation/helpers.cjs.map +1 -0
- package/dist/production/src/validation/helpers.js +233 -0
- package/dist/production/src/validation/helpers.js.map +1 -0
- package/dist/production/src/validation/rules/ExecutableDefinitionsRule.cjs +25 -0
- package/dist/production/src/validation/rules/ExecutableDefinitionsRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/ExecutableDefinitionsRule.js +25 -0
- package/dist/production/src/validation/rules/ExecutableDefinitionsRule.js.map +1 -0
- package/dist/production/src/validation/rules/FieldsOnCorrectTypeRule.cjs +80 -0
- package/dist/production/src/validation/rules/FieldsOnCorrectTypeRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/FieldsOnCorrectTypeRule.js +80 -0
- package/dist/production/src/validation/rules/FieldsOnCorrectTypeRule.js.map +1 -0
- package/dist/production/src/validation/rules/FragmentsOnCompositeTypesRule.cjs +39 -0
- package/dist/production/src/validation/rules/FragmentsOnCompositeTypesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/FragmentsOnCompositeTypesRule.js +39 -0
- package/dist/production/src/validation/rules/FragmentsOnCompositeTypesRule.js.map +1 -0
- package/dist/production/src/validation/rules/KnownArgumentNamesRule.cjs +62 -0
- package/dist/production/src/validation/rules/KnownArgumentNamesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/KnownArgumentNamesRule.js +62 -0
- package/dist/production/src/validation/rules/KnownArgumentNamesRule.js.map +1 -0
- package/dist/production/src/validation/rules/KnownDirectivesRule.cjs +99 -0
- package/dist/production/src/validation/rules/KnownDirectivesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/KnownDirectivesRule.js +99 -0
- package/dist/production/src/validation/rules/KnownDirectivesRule.js.map +1 -0
- package/dist/production/src/validation/rules/KnownFragmentNamesRule.cjs +18 -0
- package/dist/production/src/validation/rules/KnownFragmentNamesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/KnownFragmentNamesRule.js +18 -0
- package/dist/production/src/validation/rules/KnownFragmentNamesRule.js.map +1 -0
- package/dist/production/src/validation/rules/KnownTypeNamesRule.cjs +36 -0
- package/dist/production/src/validation/rules/KnownTypeNamesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/KnownTypeNamesRule.js +36 -0
- package/dist/production/src/validation/rules/KnownTypeNamesRule.js.map +1 -0
- package/dist/production/src/validation/rules/LoneAnonymousOperationRule.cjs +25 -0
- package/dist/production/src/validation/rules/LoneAnonymousOperationRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/LoneAnonymousOperationRule.js +25 -0
- package/dist/production/src/validation/rules/LoneAnonymousOperationRule.js.map +1 -0
- package/dist/production/src/validation/rules/MaxIntrospectionDepthRule.cjs +51 -0
- package/dist/production/src/validation/rules/MaxIntrospectionDepthRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/MaxIntrospectionDepthRule.js +51 -0
- package/dist/production/src/validation/rules/MaxIntrospectionDepthRule.js.map +1 -0
- package/dist/production/src/validation/rules/NoFragmentCyclesRule.cjs +68 -0
- package/dist/production/src/validation/rules/NoFragmentCyclesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/NoFragmentCyclesRule.js +68 -0
- package/dist/production/src/validation/rules/NoFragmentCyclesRule.js.map +1 -0
- package/dist/production/src/validation/rules/NoUndefinedVariablesRule.cjs +28 -0
- package/dist/production/src/validation/rules/NoUndefinedVariablesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/NoUndefinedVariablesRule.js +28 -0
- package/dist/production/src/validation/rules/NoUndefinedVariablesRule.js.map +1 -0
- package/dist/production/src/validation/rules/NoUnusedFragmentsRule.cjs +39 -0
- package/dist/production/src/validation/rules/NoUnusedFragmentsRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/NoUnusedFragmentsRule.js +39 -0
- package/dist/production/src/validation/rules/NoUnusedFragmentsRule.js.map +1 -0
- package/dist/production/src/validation/rules/NoUnusedVariablesRule.cjs +36 -0
- package/dist/production/src/validation/rules/NoUnusedVariablesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/NoUnusedVariablesRule.js +36 -0
- package/dist/production/src/validation/rules/NoUnusedVariablesRule.js.map +1 -0
- package/dist/production/src/validation/rules/OverlappingFieldsCanBeMergedRule.cjs +326 -0
- package/dist/production/src/validation/rules/OverlappingFieldsCanBeMergedRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/OverlappingFieldsCanBeMergedRule.js +326 -0
- package/dist/production/src/validation/rules/OverlappingFieldsCanBeMergedRule.js.map +1 -0
- package/dist/production/src/validation/rules/PossibleFragmentSpreadsRule.cjs +71 -0
- package/dist/production/src/validation/rules/PossibleFragmentSpreadsRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/PossibleFragmentSpreadsRule.js +71 -0
- package/dist/production/src/validation/rules/PossibleFragmentSpreadsRule.js.map +1 -0
- package/dist/production/src/validation/rules/ProvidedRequiredArgumentsRule.cjs +88 -0
- package/dist/production/src/validation/rules/ProvidedRequiredArgumentsRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/ProvidedRequiredArgumentsRule.js +88 -0
- package/dist/production/src/validation/rules/ProvidedRequiredArgumentsRule.js.map +1 -0
- package/dist/production/src/validation/rules/ScalarLeafsRule.cjs +46 -0
- package/dist/production/src/validation/rules/ScalarLeafsRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/ScalarLeafsRule.js +46 -0
- package/dist/production/src/validation/rules/ScalarLeafsRule.js.map +1 -0
- package/dist/production/src/validation/rules/SingleFieldSubscriptionsRule.cjs +51 -0
- package/dist/production/src/validation/rules/SingleFieldSubscriptionsRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/SingleFieldSubscriptionsRule.js +51 -0
- package/dist/production/src/validation/rules/SingleFieldSubscriptionsRule.js.map +1 -0
- package/dist/production/src/validation/rules/UniqueArgumentNamesRule.cjs +34 -0
- package/dist/production/src/validation/rules/UniqueArgumentNamesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/UniqueArgumentNamesRule.js +34 -0
- package/dist/production/src/validation/rules/UniqueArgumentNamesRule.js.map +1 -0
- package/dist/production/src/validation/rules/UniqueDirectivesPerLocationRule.cjs +51 -0
- package/dist/production/src/validation/rules/UniqueDirectivesPerLocationRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/UniqueDirectivesPerLocationRule.js +51 -0
- package/dist/production/src/validation/rules/UniqueDirectivesPerLocationRule.js.map +1 -0
- package/dist/production/src/validation/rules/UniqueFragmentNamesRule.cjs +28 -0
- package/dist/production/src/validation/rules/UniqueFragmentNamesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/UniqueFragmentNamesRule.js +28 -0
- package/dist/production/src/validation/rules/UniqueFragmentNamesRule.js.map +1 -0
- package/dist/production/src/validation/rules/UniqueInputFieldNamesRule.cjs +37 -0
- package/dist/production/src/validation/rules/UniqueInputFieldNamesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/UniqueInputFieldNamesRule.js +37 -0
- package/dist/production/src/validation/rules/UniqueInputFieldNamesRule.js.map +1 -0
- package/dist/production/src/validation/rules/UniqueOperationNamesRule.cjs +30 -0
- package/dist/production/src/validation/rules/UniqueOperationNamesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/UniqueOperationNamesRule.js +30 -0
- package/dist/production/src/validation/rules/UniqueOperationNamesRule.js.map +1 -0
- package/dist/production/src/validation/rules/UniqueVariableNamesRule.cjs +27 -0
- package/dist/production/src/validation/rules/UniqueVariableNamesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/UniqueVariableNamesRule.js +27 -0
- package/dist/production/src/validation/rules/UniqueVariableNamesRule.js.map +1 -0
- package/dist/production/src/validation/rules/ValuesOfCorrectTypeRule.cjs +123 -0
- package/dist/production/src/validation/rules/ValuesOfCorrectTypeRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/ValuesOfCorrectTypeRule.js +123 -0
- package/dist/production/src/validation/rules/ValuesOfCorrectTypeRule.js.map +1 -0
- package/dist/production/src/validation/rules/VariablesAreInputTypesRule.cjs +29 -0
- package/dist/production/src/validation/rules/VariablesAreInputTypesRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/VariablesAreInputTypesRule.js +29 -0
- package/dist/production/src/validation/rules/VariablesAreInputTypesRule.js.map +1 -0
- package/dist/production/src/validation/rules/VariablesInAllowedPositionRule.cjs +63 -0
- package/dist/production/src/validation/rules/VariablesInAllowedPositionRule.cjs.map +1 -0
- package/dist/production/src/validation/rules/VariablesInAllowedPositionRule.js +63 -0
- package/dist/production/src/validation/rules/VariablesInAllowedPositionRule.js.map +1 -0
- package/dist/production/src/validation/sortValueNode.cjs +71 -0
- package/dist/production/src/validation/sortValueNode.cjs.map +1 -0
- package/dist/production/src/validation/sortValueNode.js +71 -0
- package/dist/production/src/validation/sortValueNode.js.map +1 -0
- package/dist/production/src/validation/specifiedRules.cjs +87 -0
- package/dist/production/src/validation/specifiedRules.cjs.map +1 -0
- package/dist/production/src/validation/specifiedRules.js +87 -0
- package/dist/production/src/validation/specifiedRules.js.map +1 -0
- package/dist/production/src/validation/validate.cjs +53 -0
- package/dist/production/src/validation/validate.cjs.map +1 -0
- package/dist/production/src/validation/validate.js +53 -0
- package/dist/production/src/validation/validate.js.map +1 -0
- package/dist/tests/buildSchema.test.d.ts +2 -0
- package/dist/tests/buildSchema.test.d.ts.map +1 -0
- package/dist/tests/builtInScalars.test.d.ts +2 -0
- package/dist/tests/builtInScalars.test.d.ts.map +1 -0
- package/dist/tests/coercion.test.d.ts +2 -0
- package/dist/tests/coercion.test.d.ts.map +1 -0
- package/dist/tests/compat/abstract.test.d.ts +7 -0
- package/dist/tests/compat/abstract.test.d.ts.map +1 -0
- package/dist/tests/compat/adapter.d.ts +216 -0
- package/dist/tests/compat/adapter.d.ts.map +1 -0
- package/dist/tests/compat/directives.test.d.ts +7 -0
- package/dist/tests/compat/directives.test.d.ts.map +1 -0
- package/dist/tests/compat/executor.test.d.ts +7 -0
- package/dist/tests/compat/executor.test.d.ts.map +1 -0
- package/dist/tests/compat/lists.test.d.ts +7 -0
- package/dist/tests/compat/lists.test.d.ts.map +1 -0
- package/dist/tests/compat/nonnull.test.d.ts +7 -0
- package/dist/tests/compat/nonnull.test.d.ts.map +1 -0
- package/dist/tests/compat/testUtils.d.ts +30 -0
- package/dist/tests/compat/testUtils.d.ts.map +1 -0
- package/dist/tests/completedResult.test.d.ts +2 -0
- package/dist/tests/completedResult.test.d.ts.map +1 -0
- package/dist/tests/deprecatedInputValues.test.d.ts +2 -0
- package/dist/tests/deprecatedInputValues.test.d.ts.map +1 -0
- package/dist/tests/execute.test.d.ts +2 -0
- package/dist/tests/execute.test.d.ts.map +1 -0
- package/dist/tests/fieldErrors.test.d.ts +2 -0
- package/dist/tests/fieldErrors.test.d.ts.map +1 -0
- package/dist/tests/getArgumentValues.test.d.ts +2 -0
- package/dist/tests/getArgumentValues.test.d.ts.map +1 -0
- package/dist/tests/inspect.test.d.ts +2 -0
- package/dist/tests/inspect.test.d.ts.map +1 -0
- package/dist/tests/introspection.test.d.ts +2 -0
- package/dist/tests/introspection.test.d.ts.map +1 -0
- package/dist/tests/introspectionOrder.test.d.ts +2 -0
- package/dist/tests/introspectionOrder.test.d.ts.map +1 -0
- package/dist/tests/memoization.test.d.ts +2 -0
- package/dist/tests/memoization.test.d.ts.map +1 -0
- package/dist/tests/operationSelection.test.d.ts +2 -0
- package/dist/tests/operationSelection.test.d.ts.map +1 -0
- package/dist/tests/prototypeNames.test.d.ts +2 -0
- package/dist/tests/prototypeNames.test.d.ts.map +1 -0
- package/dist/tests/resolverLayers.test.d.ts +2 -0
- package/dist/tests/resolverLayers.test.d.ts.map +1 -0
- package/dist/tests/scalarParsers.test.d.ts +2 -0
- package/dist/tests/scalarParsers.test.d.ts.map +1 -0
- package/dist/tests/schemaInterner.test.d.ts +2 -0
- package/dist/tests/schemaInterner.test.d.ts.map +1 -0
- package/dist/tests/tsconfig.tsbuildinfo +1 -0
- package/dist/tests/typedContext.test.d.ts +2 -0
- package/dist/tests/typedContext.test.d.ts.map +1 -0
- package/dist/tests/validation/graphqlJsDifferential.test.d.ts +2 -0
- package/dist/tests/validation/graphqlJsDifferential.test.d.ts.map +1 -0
- package/dist/tests/validation/rules/MaxIntrospectionDepthRule.test.d.ts +2 -0
- package/dist/tests/validation/rules/MaxIntrospectionDepthRule.test.d.ts.map +1 -0
- package/dist/tests/validation/rules/NoUnusedVariablesRule.test.d.ts +2 -0
- package/dist/tests/validation/rules/NoUnusedVariablesRule.test.d.ts.map +1 -0
- package/dist/tests/validation/rules/OverlappingFieldsCanBeMergedRule.test.d.ts +2 -0
- package/dist/tests/validation/rules/OverlappingFieldsCanBeMergedRule.test.d.ts.map +1 -0
- package/dist/tests/validation/rules/SingleFieldSubscriptionsRule.test.d.ts +2 -0
- package/dist/tests/validation/rules/SingleFieldSubscriptionsRule.test.d.ts.map +1 -0
- package/dist/tests/validation/rules/differential.test.d.ts +2 -0
- package/dist/tests/validation/rules/differential.test.d.ts.map +1 -0
- package/dist/tests/validation/rules/harness.d.ts +10 -0
- package/dist/tests/validation/rules/harness.d.ts.map +1 -0
- package/dist/tests/validation/validate.test.d.ts +2 -0
- package/dist/tests/validation/validate.test.d.ts.map +1 -0
- package/dist/types/execution/collectFields.d.ts +16 -0
- package/dist/types/execution/collectFields.d.ts.map +1 -0
- package/dist/types/execution/complete.d.ts +24 -0
- package/dist/types/execution/complete.d.ts.map +1 -0
- package/dist/types/execution/context.d.ts +23 -0
- package/dist/types/execution/context.d.ts.map +1 -0
- package/dist/types/execution/directives.d.ts +9 -0
- package/dist/types/execution/directives.d.ts.map +1 -0
- package/dist/types/execution/execute.d.ts +15 -0
- package/dist/types/execution/execute.d.ts.map +1 -0
- package/dist/types/execution/fields.d.ts +26 -0
- package/dist/types/execution/fields.d.ts.map +1 -0
- package/dist/types/execution/introspectionResolvers.d.ts +13 -0
- package/dist/types/execution/introspectionResolvers.d.ts.map +1 -0
- package/dist/types/execution/values.d.ts +17 -0
- package/dist/types/execution/values.d.ts.map +1 -0
- package/dist/types/index.d.ts +26 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/introspection/index.d.ts +10 -0
- package/dist/types/introspection/index.d.ts.map +1 -0
- package/dist/types/introspection/resolvers.d.ts +141 -0
- package/dist/types/introspection/resolvers.d.ts.map +1 -0
- package/dist/types/introspection/types.d.ts +80 -0
- package/dist/types/introspection/types.d.ts.map +1 -0
- package/dist/types/scalars/builtIn.d.ts +42 -0
- package/dist/types/scalars/builtIn.d.ts.map +1 -0
- package/dist/types/schema/buildSchema.d.ts +14 -0
- package/dist/types/schema/buildSchema.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/dist/types/types/execution.d.ts +72 -0
- package/dist/types/types/execution.d.ts.map +1 -0
- package/dist/types/types/resolvers.d.ts +82 -0
- package/dist/types/types/resolvers.d.ts.map +1 -0
- package/dist/types/types/schema.d.ts +227 -0
- package/dist/types/types/schema.d.ts.map +1 -0
- package/dist/types/utils/enumValues.d.ts +18 -0
- package/dist/types/utils/enumValues.d.ts.map +1 -0
- package/dist/types/utils/helpers.d.ts +45 -0
- package/dist/types/utils/helpers.d.ts.map +1 -0
- package/dist/types/utils/path.d.ts +17 -0
- package/dist/types/utils/path.d.ts.map +1 -0
- package/dist/types/utils/schemaInterner.d.ts +54 -0
- package/dist/types/utils/schemaInterner.d.ts.map +1 -0
- package/dist/types/utils/toGraphQLJsSchema.d.ts +5 -0
- package/dist/types/utils/toGraphQLJsSchema.d.ts.map +1 -0
- package/dist/types/utils/typeRef.d.ts +61 -0
- package/dist/types/utils/typeRef.d.ts.map +1 -0
- package/dist/types/validation/TypeInfo.d.ts +57 -0
- package/dist/types/validation/TypeInfo.d.ts.map +1 -0
- package/dist/types/validation/ValidationContext.d.ts +59 -0
- package/dist/types/validation/ValidationContext.d.ts.map +1 -0
- package/dist/types/validation/helpers.d.ts +47 -0
- package/dist/types/validation/helpers.d.ts.map +1 -0
- package/dist/types/validation/rules/ExecutableDefinitionsRule.d.ts +13 -0
- package/dist/types/validation/rules/ExecutableDefinitionsRule.d.ts.map +1 -0
- package/dist/types/validation/rules/FieldsOnCorrectTypeRule.d.ts +12 -0
- package/dist/types/validation/rules/FieldsOnCorrectTypeRule.d.ts.map +1 -0
- package/dist/types/validation/rules/FragmentsOnCompositeTypesRule.d.ts +13 -0
- package/dist/types/validation/rules/FragmentsOnCompositeTypesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/KnownArgumentNamesRule.d.ts +12 -0
- package/dist/types/validation/rules/KnownArgumentNamesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/KnownDirectivesRule.d.ts +12 -0
- package/dist/types/validation/rules/KnownDirectivesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/KnownFragmentNamesRule.d.ts +12 -0
- package/dist/types/validation/rules/KnownFragmentNamesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/KnownTypeNamesRule.d.ts +12 -0
- package/dist/types/validation/rules/KnownTypeNamesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/LoneAnonymousOperationRule.d.ts +12 -0
- package/dist/types/validation/rules/LoneAnonymousOperationRule.d.ts.map +1 -0
- package/dist/types/validation/rules/MaxIntrospectionDepthRule.d.ts +12 -0
- package/dist/types/validation/rules/MaxIntrospectionDepthRule.d.ts.map +1 -0
- package/dist/types/validation/rules/NoFragmentCyclesRule.d.ts +13 -0
- package/dist/types/validation/rules/NoFragmentCyclesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/NoUndefinedVariablesRule.d.ts +12 -0
- package/dist/types/validation/rules/NoUndefinedVariablesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/NoUnusedFragmentsRule.d.ts +12 -0
- package/dist/types/validation/rules/NoUnusedFragmentsRule.d.ts.map +1 -0
- package/dist/types/validation/rules/NoUnusedVariablesRule.d.ts +12 -0
- package/dist/types/validation/rules/NoUnusedVariablesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts +16 -0
- package/dist/types/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts.map +1 -0
- package/dist/types/validation/rules/PossibleFragmentSpreadsRule.d.ts +13 -0
- package/dist/types/validation/rules/PossibleFragmentSpreadsRule.d.ts.map +1 -0
- package/dist/types/validation/rules/ProvidedRequiredArgumentsRule.d.ts +12 -0
- package/dist/types/validation/rules/ProvidedRequiredArgumentsRule.d.ts.map +1 -0
- package/dist/types/validation/rules/ScalarLeafsRule.d.ts +12 -0
- package/dist/types/validation/rules/ScalarLeafsRule.d.ts.map +1 -0
- package/dist/types/validation/rules/SingleFieldSubscriptionsRule.d.ts +12 -0
- package/dist/types/validation/rules/SingleFieldSubscriptionsRule.d.ts.map +1 -0
- package/dist/types/validation/rules/UniqueArgumentNamesRule.d.ts +12 -0
- package/dist/types/validation/rules/UniqueArgumentNamesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/UniqueDirectivesPerLocationRule.d.ts +12 -0
- package/dist/types/validation/rules/UniqueDirectivesPerLocationRule.d.ts.map +1 -0
- package/dist/types/validation/rules/UniqueFragmentNamesRule.d.ts +11 -0
- package/dist/types/validation/rules/UniqueFragmentNamesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/UniqueInputFieldNamesRule.d.ts +12 -0
- package/dist/types/validation/rules/UniqueInputFieldNamesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/UniqueOperationNamesRule.d.ts +11 -0
- package/dist/types/validation/rules/UniqueOperationNamesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/UniqueVariableNamesRule.d.ts +11 -0
- package/dist/types/validation/rules/UniqueVariableNamesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/ValuesOfCorrectTypeRule.d.ts +12 -0
- package/dist/types/validation/rules/ValuesOfCorrectTypeRule.d.ts.map +1 -0
- package/dist/types/validation/rules/VariablesAreInputTypesRule.d.ts +12 -0
- package/dist/types/validation/rules/VariablesAreInputTypesRule.d.ts.map +1 -0
- package/dist/types/validation/rules/VariablesInAllowedPositionRule.d.ts +11 -0
- package/dist/types/validation/rules/VariablesInAllowedPositionRule.d.ts.map +1 -0
- package/dist/types/validation/sortValueNode.d.ts +10 -0
- package/dist/types/validation/sortValueNode.d.ts.map +1 -0
- package/dist/types/validation/specifiedRules.d.ts +42 -0
- package/dist/types/validation/specifiedRules.d.ts.map +1 -0
- package/dist/types/validation/typeFromAST.d.ts +6 -0
- package/dist/types/validation/typeFromAST.d.ts.map +1 -0
- package/dist/types/validation/validate.d.ts +46 -0
- package/dist/types/validation/validate.d.ts.map +1 -0
- package/package.json +37 -4
- package/src/execution/collectFields.ts +220 -0
- package/src/execution/complete.ts +528 -0
- package/src/execution/context.ts +124 -0
- package/src/execution/directives.ts +76 -0
- package/src/execution/execute.ts +204 -0
- package/src/execution/fields.ts +256 -0
- package/src/execution/introspectionResolvers.ts +120 -0
- package/src/execution/values.ts +478 -0
- package/src/index.ts +145 -0
- package/src/introspection/index.ts +40 -0
- package/src/introspection/resolvers.ts +591 -0
- package/src/introspection/types.ts +319 -0
- package/src/scalars/builtIn.ts +316 -0
- package/src/schema/buildSchema.ts +322 -0
- package/src/tsconfig.json +6 -0
- package/src/types/execution.ts +94 -0
- package/src/types/resolvers.ts +119 -0
- package/src/types/schema.ts +346 -0
- package/src/utils/enumValues.ts +64 -0
- package/src/utils/helpers.ts +200 -0
- package/src/utils/path.ts +33 -0
- package/src/utils/schemaInterner.ts +362 -0
- package/src/utils/toGraphQLJsSchema.ts +164 -0
- package/src/utils/typeRef.ts +309 -0
- package/src/validation/TypeInfo.ts +390 -0
- package/src/validation/ValidationContext.ts +239 -0
- package/src/validation/helpers.ts +341 -0
- package/src/validation/rules/ExecutableDefinitionsRule.ts +40 -0
- package/src/validation/rules/FieldsOnCorrectTypeRule.ts +127 -0
- package/src/validation/rules/FragmentsOnCompositeTypesRule.ts +49 -0
- package/src/validation/rules/KnownArgumentNamesRule.ts +82 -0
- package/src/validation/rules/KnownDirectivesRule.ts +119 -0
- package/src/validation/rules/KnownFragmentNamesRule.ts +26 -0
- package/src/validation/rules/KnownTypeNamesRule.ts +51 -0
- package/src/validation/rules/LoneAnonymousOperationRule.ts +34 -0
- package/src/validation/rules/MaxIntrospectionDepthRule.ts +83 -0
- package/src/validation/rules/NoFragmentCyclesRule.ts +98 -0
- package/src/validation/rules/NoUndefinedVariablesRule.ts +39 -0
- package/src/validation/rules/NoUnusedFragmentsRule.ts +49 -0
- package/src/validation/rules/NoUnusedVariablesRule.ts +49 -0
- package/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts +512 -0
- package/src/validation/rules/PossibleFragmentSpreadsRule.ts +118 -0
- package/src/validation/rules/ProvidedRequiredArgumentsRule.ts +105 -0
- package/src/validation/rules/ScalarLeafsRule.ts +58 -0
- package/src/validation/rules/SingleFieldSubscriptionsRule.ts +64 -0
- package/src/validation/rules/UniqueArgumentNamesRule.ts +47 -0
- package/src/validation/rules/UniqueDirectivesPerLocationRule.ts +72 -0
- package/src/validation/rules/UniqueFragmentNamesRule.ts +36 -0
- package/src/validation/rules/UniqueInputFieldNamesRule.ts +46 -0
- package/src/validation/rules/UniqueOperationNamesRule.ts +38 -0
- package/src/validation/rules/UniqueVariableNamesRule.ts +36 -0
- package/src/validation/rules/ValuesOfCorrectTypeRule.ts +158 -0
- package/src/validation/rules/VariablesAreInputTypesRule.ts +39 -0
- package/src/validation/rules/VariablesInAllowedPositionRule.ts +96 -0
- package/src/validation/sortValueNode.ts +85 -0
- package/src/validation/specifiedRules.ts +126 -0
- package/src/validation/typeFromAST.ts +5 -0
- package/src/validation/validate.ts +112 -0
- package/tests/buildSchema.test.ts +398 -0
- package/tests/builtInScalars.test.ts +74 -0
- package/tests/coercion.test.ts +88 -0
- package/tests/compat/abstract.test.ts +717 -0
- package/tests/compat/adapter.ts +779 -0
- package/tests/compat/directives.test.ts +310 -0
- package/tests/compat/executor.test.ts +774 -0
- package/tests/compat/lists.test.ts +244 -0
- package/tests/compat/nonnull.test.ts +463 -0
- package/tests/compat/testUtils.ts +134 -0
- package/tests/completedResult.test.ts +125 -0
- package/tests/deprecatedInputValues.test.ts +39 -0
- package/tests/execute.test.ts +1945 -0
- package/tests/fieldErrors.test.ts +146 -0
- package/tests/getArgumentValues.test.ts +109 -0
- package/tests/inspect.test.ts +44 -0
- package/tests/introspection.test.ts +563 -0
- package/tests/introspectionOrder.test.ts +92 -0
- package/tests/memoization.test.ts +80 -0
- package/tests/operationSelection.test.ts +57 -0
- package/tests/prototypeNames.test.ts +176 -0
- package/tests/resolverLayers.test.ts +32 -0
- package/tests/scalarParsers.test.ts +111 -0
- package/tests/schemaInterner.test.ts +132 -0
- package/tests/tsconfig.json +9 -0
- package/tests/typedContext.test.ts +87 -0
- package/tests/validation/graphqlJsDifferential.test.ts +171 -0
- package/tests/validation/rules/MaxIntrospectionDepthRule.test.ts +557 -0
- package/tests/validation/rules/NoUnusedVariablesRule.test.ts +236 -0
- package/tests/validation/rules/OverlappingFieldsCanBeMergedRule.test.ts +1191 -0
- package/tests/validation/rules/SingleFieldSubscriptionsRule.test.ts +298 -0
- package/tests/validation/rules/differential.test.ts +264 -0
- package/tests/validation/rules/harness.ts +157 -0
- package/tests/validation/validate.test.ts +904 -0
- package/tsconfig.json +8 -0
- package/tsconfig.settings.json +3 -0
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Introspection type definitions
|
|
3
|
+
*
|
|
4
|
+
* These types are added to the schema at execution time when introspection queries
|
|
5
|
+
* are detected (__schema or __type meta-fields).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { type Directive, type Schema, type Type, TypeKind, TypePattern } from '../types/schema.js'
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* __TypeKind enum values as defined by the GraphQL spec
|
|
12
|
+
*/
|
|
13
|
+
export const IntrospectionTypeKind = {
|
|
14
|
+
SCALAR: 'SCALAR',
|
|
15
|
+
OBJECT: 'OBJECT',
|
|
16
|
+
INTERFACE: 'INTERFACE',
|
|
17
|
+
UNION: 'UNION',
|
|
18
|
+
ENUM: 'ENUM',
|
|
19
|
+
INPUT_OBJECT: 'INPUT_OBJECT',
|
|
20
|
+
LIST: 'LIST',
|
|
21
|
+
NON_NULL: 'NON_NULL',
|
|
22
|
+
} as const
|
|
23
|
+
|
|
24
|
+
export type IntrospectionTypeKindValue = typeof IntrospectionTypeKind[keyof typeof IntrospectionTypeKind]
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* __DirectiveLocation enum values as defined by the GraphQL spec
|
|
28
|
+
*/
|
|
29
|
+
export const DirectiveLocation = {
|
|
30
|
+
// Executable locations
|
|
31
|
+
QUERY: 'QUERY',
|
|
32
|
+
MUTATION: 'MUTATION',
|
|
33
|
+
SUBSCRIPTION: 'SUBSCRIPTION',
|
|
34
|
+
FIELD: 'FIELD',
|
|
35
|
+
FRAGMENT_DEFINITION: 'FRAGMENT_DEFINITION',
|
|
36
|
+
FRAGMENT_SPREAD: 'FRAGMENT_SPREAD',
|
|
37
|
+
INLINE_FRAGMENT: 'INLINE_FRAGMENT',
|
|
38
|
+
VARIABLE_DEFINITION: 'VARIABLE_DEFINITION',
|
|
39
|
+
// Type system locations
|
|
40
|
+
SCHEMA: 'SCHEMA',
|
|
41
|
+
SCALAR: 'SCALAR',
|
|
42
|
+
OBJECT: 'OBJECT',
|
|
43
|
+
FIELD_DEFINITION: 'FIELD_DEFINITION',
|
|
44
|
+
ARGUMENT_DEFINITION: 'ARGUMENT_DEFINITION',
|
|
45
|
+
INTERFACE: 'INTERFACE',
|
|
46
|
+
UNION: 'UNION',
|
|
47
|
+
ENUM: 'ENUM',
|
|
48
|
+
ENUM_VALUE: 'ENUM_VALUE',
|
|
49
|
+
INPUT_OBJECT: 'INPUT_OBJECT',
|
|
50
|
+
INPUT_FIELD_DEFINITION: 'INPUT_FIELD_DEFINITION',
|
|
51
|
+
} as const
|
|
52
|
+
|
|
53
|
+
export type DirectiveLocationValue = typeof DirectiveLocation[keyof typeof DirectiveLocation]
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Introspection types in compact JSON format
|
|
57
|
+
*
|
|
58
|
+
* These are the 8 introspection types defined by the GraphQL specification:
|
|
59
|
+
* - __Schema
|
|
60
|
+
* - __Type
|
|
61
|
+
* - __Field
|
|
62
|
+
* - __InputValue
|
|
63
|
+
* - __EnumValue
|
|
64
|
+
* - __Directive
|
|
65
|
+
* - __TypeKind (enum)
|
|
66
|
+
* - __DirectiveLocation (enum)
|
|
67
|
+
*/
|
|
68
|
+
export const introspectionTypes: Record<string, Type> = {
|
|
69
|
+
// __Schema type
|
|
70
|
+
__Schema: [
|
|
71
|
+
TypeKind.OBJECT,
|
|
72
|
+
{
|
|
73
|
+
description: [[TypePattern.T, 'String'], null],
|
|
74
|
+
types: [[TypePattern.L_NN_T_NN, '__Type'], null, 'A list of all types supported by this server.'],
|
|
75
|
+
queryType: [[TypePattern.T_NN, '__Type'], null, 'The type that query operations will be rooted at.'],
|
|
76
|
+
mutationType: [[TypePattern.T, '__Type'], null, 'If this server supports mutation, the type that mutation operations will be rooted at.'],
|
|
77
|
+
subscriptionType: [
|
|
78
|
+
[TypePattern.T, '__Type'],
|
|
79
|
+
null,
|
|
80
|
+
'If this server support subscription, the type that subscription operations will be rooted at.',
|
|
81
|
+
],
|
|
82
|
+
directives: [[TypePattern.L_NN_T_NN, '__Directive'], null, 'A list of all directives supported by this server.'],
|
|
83
|
+
},
|
|
84
|
+
[],
|
|
85
|
+
'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.',
|
|
86
|
+
],
|
|
87
|
+
|
|
88
|
+
// __Type type
|
|
89
|
+
__Type: [
|
|
90
|
+
TypeKind.OBJECT,
|
|
91
|
+
{
|
|
92
|
+
kind: [[TypePattern.T_NN, '__TypeKind'], null],
|
|
93
|
+
name: [[TypePattern.T, 'String'], null],
|
|
94
|
+
description: [[TypePattern.T, 'String'], null],
|
|
95
|
+
specifiedByURL: [[TypePattern.T, 'String'], null],
|
|
96
|
+
fields: [
|
|
97
|
+
[TypePattern.L_T_NN, '__Field'],
|
|
98
|
+
{ includeDeprecated: [[TypePattern.T, 'Boolean'], false] },
|
|
99
|
+
],
|
|
100
|
+
interfaces: [[TypePattern.L_T_NN, '__Type'], null],
|
|
101
|
+
possibleTypes: [[TypePattern.L_T_NN, '__Type'], null],
|
|
102
|
+
enumValues: [
|
|
103
|
+
[TypePattern.L_T_NN, '__EnumValue'],
|
|
104
|
+
{ includeDeprecated: [[TypePattern.T, 'Boolean'], false] },
|
|
105
|
+
],
|
|
106
|
+
inputFields: [
|
|
107
|
+
[TypePattern.L_T_NN, '__InputValue'],
|
|
108
|
+
{ includeDeprecated: [[TypePattern.T, 'Boolean'], false] },
|
|
109
|
+
],
|
|
110
|
+
ofType: [[TypePattern.T, '__Type'], null],
|
|
111
|
+
isOneOf: [[TypePattern.T, 'Boolean'], null],
|
|
112
|
+
},
|
|
113
|
+
[],
|
|
114
|
+
'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.',
|
|
115
|
+
],
|
|
116
|
+
|
|
117
|
+
// __Field type
|
|
118
|
+
__Field: [
|
|
119
|
+
TypeKind.OBJECT,
|
|
120
|
+
{
|
|
121
|
+
name: [[TypePattern.T_NN, 'String'], null],
|
|
122
|
+
description: [[TypePattern.T, 'String'], null],
|
|
123
|
+
args: [
|
|
124
|
+
[TypePattern.L_NN_T_NN, '__InputValue'],
|
|
125
|
+
{ includeDeprecated: [[TypePattern.T, 'Boolean'], false] },
|
|
126
|
+
],
|
|
127
|
+
type: [[TypePattern.T_NN, '__Type'], null],
|
|
128
|
+
isDeprecated: [[TypePattern.T_NN, 'Boolean'], null],
|
|
129
|
+
deprecationReason: [[TypePattern.T, 'String'], null],
|
|
130
|
+
},
|
|
131
|
+
[],
|
|
132
|
+
'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.',
|
|
133
|
+
],
|
|
134
|
+
|
|
135
|
+
// __InputValue type
|
|
136
|
+
__InputValue: [
|
|
137
|
+
TypeKind.OBJECT,
|
|
138
|
+
{
|
|
139
|
+
name: [[TypePattern.T_NN, 'String'], null],
|
|
140
|
+
description: [[TypePattern.T, 'String'], null],
|
|
141
|
+
type: [[TypePattern.T_NN, '__Type'], null],
|
|
142
|
+
defaultValue: [[TypePattern.T, 'String'], null, 'A GraphQL-formatted string representing the default value for this input value.'],
|
|
143
|
+
isDeprecated: [[TypePattern.T_NN, 'Boolean'], null],
|
|
144
|
+
deprecationReason: [[TypePattern.T, 'String'], null],
|
|
145
|
+
},
|
|
146
|
+
[],
|
|
147
|
+
'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.',
|
|
148
|
+
],
|
|
149
|
+
|
|
150
|
+
// __EnumValue type
|
|
151
|
+
__EnumValue: [
|
|
152
|
+
TypeKind.OBJECT,
|
|
153
|
+
{
|
|
154
|
+
name: [[TypePattern.T_NN, 'String'], null],
|
|
155
|
+
description: [[TypePattern.T, 'String'], null],
|
|
156
|
+
isDeprecated: [[TypePattern.T_NN, 'Boolean'], null],
|
|
157
|
+
deprecationReason: [[TypePattern.T, 'String'], null],
|
|
158
|
+
},
|
|
159
|
+
[],
|
|
160
|
+
'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.',
|
|
161
|
+
],
|
|
162
|
+
|
|
163
|
+
// __Directive type
|
|
164
|
+
__Directive: [
|
|
165
|
+
TypeKind.OBJECT,
|
|
166
|
+
{
|
|
167
|
+
name: [[TypePattern.T_NN, 'String'], null],
|
|
168
|
+
description: [[TypePattern.T, 'String'], null],
|
|
169
|
+
isRepeatable: [[TypePattern.T_NN, 'Boolean'], null],
|
|
170
|
+
locations: [[TypePattern.L_NN_T_NN, '__DirectiveLocation'], null],
|
|
171
|
+
args: [
|
|
172
|
+
[TypePattern.L_NN_T_NN, '__InputValue'],
|
|
173
|
+
{ includeDeprecated: [[TypePattern.T, 'Boolean'], false] },
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
[],
|
|
177
|
+
"A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.",
|
|
178
|
+
],
|
|
179
|
+
|
|
180
|
+
// __TypeKind enum
|
|
181
|
+
__TypeKind: [
|
|
182
|
+
TypeKind.ENUM,
|
|
183
|
+
{
|
|
184
|
+
SCALAR: [undefined, 'Indicates this type is a scalar.'],
|
|
185
|
+
OBJECT: [undefined, 'Indicates this type is an object. `fields` and `interfaces` are valid fields.'],
|
|
186
|
+
INTERFACE: [undefined, 'Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.'],
|
|
187
|
+
UNION: [undefined, 'Indicates this type is a union. `possibleTypes` is a valid field.'],
|
|
188
|
+
ENUM: [undefined, 'Indicates this type is an enum. `enumValues` is a valid field.'],
|
|
189
|
+
INPUT_OBJECT: [undefined, 'Indicates this type is an input object. `inputFields` is a valid field.'],
|
|
190
|
+
LIST: [undefined, 'Indicates this type is a list. `ofType` is a valid field.'],
|
|
191
|
+
NON_NULL: [undefined, 'Indicates this type is a non-null. `ofType` is a valid field.'],
|
|
192
|
+
},
|
|
193
|
+
'An enum describing what kind of type a given `__Type` is.',
|
|
194
|
+
],
|
|
195
|
+
|
|
196
|
+
// __DirectiveLocation enum
|
|
197
|
+
__DirectiveLocation: [
|
|
198
|
+
TypeKind.ENUM,
|
|
199
|
+
{
|
|
200
|
+
QUERY: [undefined, 'Location adjacent to a query operation.'],
|
|
201
|
+
MUTATION: [undefined, 'Location adjacent to a mutation operation.'],
|
|
202
|
+
SUBSCRIPTION: [undefined, 'Location adjacent to a subscription operation.'],
|
|
203
|
+
FIELD: [undefined, 'Location adjacent to a field.'],
|
|
204
|
+
FRAGMENT_DEFINITION: [undefined, 'Location adjacent to a fragment definition.'],
|
|
205
|
+
FRAGMENT_SPREAD: [undefined, 'Location adjacent to a fragment spread.'],
|
|
206
|
+
INLINE_FRAGMENT: [undefined, 'Location adjacent to an inline fragment.'],
|
|
207
|
+
VARIABLE_DEFINITION: [undefined, 'Location adjacent to a variable definition.'],
|
|
208
|
+
SCHEMA: [undefined, 'Location adjacent to a schema definition.'],
|
|
209
|
+
SCALAR: [undefined, 'Location adjacent to a scalar definition.'],
|
|
210
|
+
OBJECT: [undefined, 'Location adjacent to an object type definition.'],
|
|
211
|
+
FIELD_DEFINITION: [undefined, 'Location adjacent to a field definition.'],
|
|
212
|
+
ARGUMENT_DEFINITION: [undefined, 'Location adjacent to an argument definition.'],
|
|
213
|
+
INTERFACE: [undefined, 'Location adjacent to an interface definition.'],
|
|
214
|
+
UNION: [undefined, 'Location adjacent to a union definition.'],
|
|
215
|
+
ENUM: [undefined, 'Location adjacent to an enum definition.'],
|
|
216
|
+
ENUM_VALUE: [undefined, 'Location adjacent to an enum value definition.'],
|
|
217
|
+
INPUT_OBJECT: [undefined, 'Location adjacent to an input object type definition.'],
|
|
218
|
+
INPUT_FIELD_DEFINITION: [undefined, 'Location adjacent to an input object field definition.'],
|
|
219
|
+
},
|
|
220
|
+
'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.',
|
|
221
|
+
],
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* The directives graphql-js specifies, in its `specifiedDirectives` order
|
|
226
|
+
*/
|
|
227
|
+
export const builtInDirectives: Record<'include' | 'skip' | 'deprecated' | 'specifiedBy' | 'oneOf', Directive> = {
|
|
228
|
+
include: [
|
|
229
|
+
{ if: [[TypePattern.T_NN, 'Boolean'], undefined, 'Included when true.'] },
|
|
230
|
+
['FIELD', 'FRAGMENT_SPREAD', 'INLINE_FRAGMENT'],
|
|
231
|
+
false,
|
|
232
|
+
'Directs the executor to include this field or fragment only when the `if` argument is true.',
|
|
233
|
+
],
|
|
234
|
+
skip: [
|
|
235
|
+
{ if: [[TypePattern.T_NN, 'Boolean'], undefined, 'Skipped when true.'] },
|
|
236
|
+
['FIELD', 'FRAGMENT_SPREAD', 'INLINE_FRAGMENT'],
|
|
237
|
+
false,
|
|
238
|
+
'Directs the executor to skip this field or fragment when the `if` argument is true.',
|
|
239
|
+
],
|
|
240
|
+
deprecated: [
|
|
241
|
+
{
|
|
242
|
+
reason: [
|
|
243
|
+
[TypePattern.T, 'String'],
|
|
244
|
+
'No longer supported',
|
|
245
|
+
'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).',
|
|
246
|
+
],
|
|
247
|
+
},
|
|
248
|
+
['FIELD_DEFINITION', 'ARGUMENT_DEFINITION', 'INPUT_FIELD_DEFINITION', 'ENUM_VALUE'],
|
|
249
|
+
false,
|
|
250
|
+
'Marks an element of a GraphQL schema as no longer supported.',
|
|
251
|
+
],
|
|
252
|
+
specifiedBy: [
|
|
253
|
+
{ url: [[TypePattern.T_NN, 'String'], undefined, 'The URL that specifies the behavior of this scalar.'] },
|
|
254
|
+
['SCALAR'],
|
|
255
|
+
false,
|
|
256
|
+
'Exposes a URL that specifies the behavior of this scalar.',
|
|
257
|
+
],
|
|
258
|
+
oneOf: [
|
|
259
|
+
{},
|
|
260
|
+
['INPUT_OBJECT'],
|
|
261
|
+
false,
|
|
262
|
+
'Indicates exactly one field must be supplied and this field must not be `null`.',
|
|
263
|
+
],
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const schemaDirectivesCache = new WeakMap<Schema, Record<string, Directive>>()
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* The directives of a schema in graphql-js order: those the schema defines, then the specified ones it does not redefine.
|
|
270
|
+
* Memoized per `schema` object.
|
|
271
|
+
*/
|
|
272
|
+
export function getSchemaDirectives(schema: Schema): Record<string, Directive> {
|
|
273
|
+
const schemaDirectives = schema.d
|
|
274
|
+
if (!schemaDirectives) {
|
|
275
|
+
return builtInDirectives
|
|
276
|
+
}
|
|
277
|
+
let directives = schemaDirectivesCache.get(schema)
|
|
278
|
+
if (!directives) {
|
|
279
|
+
directives = { ...schemaDirectives }
|
|
280
|
+
for (const [name, directive] of Object.entries(builtInDirectives)) {
|
|
281
|
+
if (!Object.prototype.hasOwnProperty.call(schemaDirectives, name)) {
|
|
282
|
+
directives[name] = directive
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
schemaDirectivesCache.set(schema, directives)
|
|
286
|
+
}
|
|
287
|
+
return directives
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Check if a type name is an introspection type
|
|
292
|
+
*/
|
|
293
|
+
export function isIntrospectionType(typeName: string): boolean {
|
|
294
|
+
return typeName.startsWith('__')
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
const schemaWithIntrospectionCache = new WeakMap<Schema, Schema>()
|
|
298
|
+
|
|
299
|
+
const includesIntrospectionTypes = (schema: Schema): boolean => Object.entries(introspectionTypes).every(([name, type]) => schema.t[name] === type)
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Get the schema with introspection types merged in, memoized per `schema` object - validation and execution call it per request.
|
|
303
|
+
* A schema that already holds them is returned as is, so it needs no per-schema copy of its type map.
|
|
304
|
+
* The schema is treated as immutable once passed in.
|
|
305
|
+
*/
|
|
306
|
+
export function getSchemaWithIntrospection(schema: Schema): Schema {
|
|
307
|
+
let merged = schemaWithIntrospectionCache.get(schema)
|
|
308
|
+
if (!merged) {
|
|
309
|
+
merged = includesIntrospectionTypes(schema) ? schema : {
|
|
310
|
+
...schema,
|
|
311
|
+
t: {
|
|
312
|
+
...schema.t,
|
|
313
|
+
...introspectionTypes,
|
|
314
|
+
},
|
|
315
|
+
}
|
|
316
|
+
schemaWithIntrospectionCache.set(schema, merged)
|
|
317
|
+
}
|
|
318
|
+
return merged
|
|
319
|
+
}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in scalar implementations
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GraphQLError, Kind, print } from 'graphql'
|
|
6
|
+
import type { ValueNode } from 'graphql'
|
|
7
|
+
import type { ScalarImplementation, ScalarMap } from '../types/resolvers.js'
|
|
8
|
+
import { type ScalarType, TypeKind } from '../types/schema.js'
|
|
9
|
+
import { inspect, isObjectLike } from '../utils/helpers.js'
|
|
10
|
+
|
|
11
|
+
// GraphQL Int limits (32-bit signed integer)
|
|
12
|
+
const GRAPHQL_MAX_INT = 2147483647
|
|
13
|
+
const GRAPHQL_MIN_INT = -2147483648
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Serialize object value (handles valueOf)
|
|
17
|
+
*/
|
|
18
|
+
function serializeObject(outputValue: unknown): unknown {
|
|
19
|
+
if (isObjectLike(outputValue)) {
|
|
20
|
+
const valueOf = outputValue.valueOf
|
|
21
|
+
if (typeof valueOf === 'function') {
|
|
22
|
+
const valueOfResult: unknown = valueOf.call(outputValue)
|
|
23
|
+
if (!isObjectLike(valueOfResult)) {
|
|
24
|
+
return valueOfResult
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const toJSON = outputValue.toJSON
|
|
28
|
+
if (typeof toJSON === 'function') {
|
|
29
|
+
return toJSON.call(outputValue)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return outputValue
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Int scalar
|
|
37
|
+
*/
|
|
38
|
+
export const GraphQLIntScalar: ScalarImplementation = {
|
|
39
|
+
serialize(outputValue: unknown): number {
|
|
40
|
+
const coercedValue = serializeObject(outputValue)
|
|
41
|
+
|
|
42
|
+
if (typeof coercedValue === 'boolean') {
|
|
43
|
+
return coercedValue ? 1 : 0
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
let num = coercedValue
|
|
47
|
+
if (typeof coercedValue === 'string' && coercedValue !== '') {
|
|
48
|
+
num = Number(coercedValue)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (typeof num !== 'number' || !Number.isInteger(num)) {
|
|
52
|
+
throw new GraphQLError(
|
|
53
|
+
`Int cannot represent non-integer value: ${inspect(coercedValue)}`,
|
|
54
|
+
)
|
|
55
|
+
}
|
|
56
|
+
if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) {
|
|
57
|
+
throw new GraphQLError(
|
|
58
|
+
'Int cannot represent non 32-bit signed integer value: ' + inspect(coercedValue),
|
|
59
|
+
)
|
|
60
|
+
}
|
|
61
|
+
return num
|
|
62
|
+
},
|
|
63
|
+
|
|
64
|
+
parseValue(inputValue: unknown): number {
|
|
65
|
+
if (typeof inputValue !== 'number' || !Number.isInteger(inputValue)) {
|
|
66
|
+
throw new GraphQLError(
|
|
67
|
+
`Int cannot represent non-integer value: ${inspect(inputValue)}`,
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
if (inputValue > GRAPHQL_MAX_INT || inputValue < GRAPHQL_MIN_INT) {
|
|
71
|
+
throw new GraphQLError(
|
|
72
|
+
`Int cannot represent non 32-bit signed integer value: ${inputValue}`,
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
return inputValue
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
parseLiteral(valueNode: ValueNode): number {
|
|
79
|
+
if (valueNode.kind !== Kind.INT) {
|
|
80
|
+
throw new GraphQLError(
|
|
81
|
+
`Int cannot represent non-integer value: ${print(valueNode)}`,
|
|
82
|
+
{ nodes: valueNode },
|
|
83
|
+
)
|
|
84
|
+
}
|
|
85
|
+
const num = parseInt(valueNode.value, 10)
|
|
86
|
+
if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) {
|
|
87
|
+
throw new GraphQLError(
|
|
88
|
+
`Int cannot represent non 32-bit signed integer value: ${valueNode.value}`,
|
|
89
|
+
{ nodes: valueNode },
|
|
90
|
+
)
|
|
91
|
+
}
|
|
92
|
+
return num
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Float scalar
|
|
98
|
+
*/
|
|
99
|
+
export const GraphQLFloatScalar: ScalarImplementation = {
|
|
100
|
+
serialize(outputValue: unknown): number {
|
|
101
|
+
const coercedValue = serializeObject(outputValue)
|
|
102
|
+
|
|
103
|
+
if (typeof coercedValue === 'boolean') {
|
|
104
|
+
return coercedValue ? 1 : 0
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
let num = coercedValue
|
|
108
|
+
if (typeof coercedValue === 'string' && coercedValue !== '') {
|
|
109
|
+
num = Number(coercedValue)
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
if (typeof num !== 'number' || !Number.isFinite(num)) {
|
|
113
|
+
throw new GraphQLError(
|
|
114
|
+
`Float cannot represent non numeric value: ${inspect(coercedValue)}`,
|
|
115
|
+
)
|
|
116
|
+
}
|
|
117
|
+
return num
|
|
118
|
+
},
|
|
119
|
+
|
|
120
|
+
parseValue(inputValue: unknown): number {
|
|
121
|
+
if (typeof inputValue !== 'number' || !Number.isFinite(inputValue)) {
|
|
122
|
+
throw new GraphQLError(
|
|
123
|
+
`Float cannot represent non numeric value: ${inspect(inputValue)}`,
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
return inputValue
|
|
127
|
+
},
|
|
128
|
+
|
|
129
|
+
parseLiteral(valueNode: ValueNode): number {
|
|
130
|
+
if (valueNode.kind !== Kind.FLOAT && valueNode.kind !== Kind.INT) {
|
|
131
|
+
throw new GraphQLError(
|
|
132
|
+
`Float cannot represent non numeric value: ${print(valueNode)}`,
|
|
133
|
+
{ nodes: valueNode },
|
|
134
|
+
)
|
|
135
|
+
}
|
|
136
|
+
return parseFloat(valueNode.value)
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* String scalar
|
|
142
|
+
*/
|
|
143
|
+
export const GraphQLStringScalar: ScalarImplementation = {
|
|
144
|
+
serialize(outputValue: unknown): string {
|
|
145
|
+
const coercedValue = serializeObject(outputValue)
|
|
146
|
+
|
|
147
|
+
if (typeof coercedValue === 'string') {
|
|
148
|
+
return coercedValue
|
|
149
|
+
}
|
|
150
|
+
if (typeof coercedValue === 'boolean') {
|
|
151
|
+
return coercedValue ? 'true' : 'false'
|
|
152
|
+
}
|
|
153
|
+
if (typeof coercedValue === 'number' && Number.isFinite(coercedValue)) {
|
|
154
|
+
return String(coercedValue)
|
|
155
|
+
}
|
|
156
|
+
throw new GraphQLError(
|
|
157
|
+
`String cannot represent value: ${inspect(outputValue)}`,
|
|
158
|
+
)
|
|
159
|
+
},
|
|
160
|
+
|
|
161
|
+
parseValue(inputValue: unknown): string {
|
|
162
|
+
if (typeof inputValue !== 'string') {
|
|
163
|
+
throw new GraphQLError(
|
|
164
|
+
`String cannot represent a non string value: ${inspect(inputValue)}`,
|
|
165
|
+
)
|
|
166
|
+
}
|
|
167
|
+
return inputValue
|
|
168
|
+
},
|
|
169
|
+
|
|
170
|
+
parseLiteral(valueNode: ValueNode): string {
|
|
171
|
+
if (valueNode.kind !== Kind.STRING) {
|
|
172
|
+
throw new GraphQLError(
|
|
173
|
+
`String cannot represent a non string value: ${print(valueNode)}`,
|
|
174
|
+
{ nodes: valueNode },
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
return valueNode.value
|
|
178
|
+
},
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Boolean scalar
|
|
183
|
+
*/
|
|
184
|
+
export const GraphQLBooleanScalar: ScalarImplementation = {
|
|
185
|
+
serialize(outputValue: unknown): boolean {
|
|
186
|
+
const coercedValue = serializeObject(outputValue)
|
|
187
|
+
|
|
188
|
+
if (typeof coercedValue === 'boolean') {
|
|
189
|
+
return coercedValue
|
|
190
|
+
}
|
|
191
|
+
if (typeof coercedValue === 'number' && Number.isFinite(coercedValue)) {
|
|
192
|
+
return coercedValue !== 0
|
|
193
|
+
}
|
|
194
|
+
throw new GraphQLError(
|
|
195
|
+
`Boolean cannot represent a non boolean value: ${inspect(coercedValue)}`,
|
|
196
|
+
)
|
|
197
|
+
},
|
|
198
|
+
|
|
199
|
+
parseValue(inputValue: unknown): boolean {
|
|
200
|
+
if (typeof inputValue !== 'boolean') {
|
|
201
|
+
throw new GraphQLError(
|
|
202
|
+
`Boolean cannot represent a non boolean value: ${inspect(inputValue)}`,
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
return inputValue
|
|
206
|
+
},
|
|
207
|
+
|
|
208
|
+
parseLiteral(valueNode: ValueNode): boolean {
|
|
209
|
+
if (valueNode.kind !== Kind.BOOLEAN) {
|
|
210
|
+
throw new GraphQLError(
|
|
211
|
+
`Boolean cannot represent a non boolean value: ${print(valueNode)}`,
|
|
212
|
+
{ nodes: valueNode },
|
|
213
|
+
)
|
|
214
|
+
}
|
|
215
|
+
return valueNode.value
|
|
216
|
+
},
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* ID scalar
|
|
221
|
+
*/
|
|
222
|
+
export const GraphQLIDScalar: ScalarImplementation = {
|
|
223
|
+
serialize(outputValue: unknown): string {
|
|
224
|
+
const coercedValue = serializeObject(outputValue)
|
|
225
|
+
|
|
226
|
+
if (typeof coercedValue === 'string') {
|
|
227
|
+
return coercedValue
|
|
228
|
+
}
|
|
229
|
+
if (typeof coercedValue === 'number' && Number.isInteger(coercedValue)) {
|
|
230
|
+
return String(coercedValue)
|
|
231
|
+
}
|
|
232
|
+
throw new GraphQLError(
|
|
233
|
+
`ID cannot represent value: ${inspect(outputValue)}`,
|
|
234
|
+
)
|
|
235
|
+
},
|
|
236
|
+
|
|
237
|
+
parseValue(inputValue: unknown): string {
|
|
238
|
+
if (typeof inputValue === 'string') {
|
|
239
|
+
return inputValue
|
|
240
|
+
}
|
|
241
|
+
if (typeof inputValue === 'number' && Number.isInteger(inputValue)) {
|
|
242
|
+
return String(inputValue)
|
|
243
|
+
}
|
|
244
|
+
throw new GraphQLError(
|
|
245
|
+
`ID cannot represent value: ${inspect(inputValue)}`,
|
|
246
|
+
)
|
|
247
|
+
},
|
|
248
|
+
|
|
249
|
+
parseLiteral(valueNode: ValueNode): string {
|
|
250
|
+
if (valueNode.kind !== Kind.STRING && valueNode.kind !== Kind.INT) {
|
|
251
|
+
throw new GraphQLError(
|
|
252
|
+
`ID cannot represent a non-string and non-integer value: ${print(valueNode)}`,
|
|
253
|
+
{ nodes: valueNode },
|
|
254
|
+
)
|
|
255
|
+
}
|
|
256
|
+
return valueNode.value
|
|
257
|
+
},
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* The scalar types graphql-js specifies, with their graphql-js descriptions, in its `specifiedScalarTypes` order
|
|
262
|
+
*/
|
|
263
|
+
export const specifiedScalarTypes: Record<'String' | 'Int' | 'Float' | 'Boolean' | 'ID', ScalarType> = {
|
|
264
|
+
String: [
|
|
265
|
+
TypeKind.SCALAR,
|
|
266
|
+
'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.',
|
|
267
|
+
],
|
|
268
|
+
Int: [
|
|
269
|
+
TypeKind.SCALAR,
|
|
270
|
+
'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.',
|
|
271
|
+
],
|
|
272
|
+
Float: [
|
|
273
|
+
TypeKind.SCALAR,
|
|
274
|
+
'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).',
|
|
275
|
+
],
|
|
276
|
+
Boolean: [TypeKind.SCALAR, 'The `Boolean` scalar type represents `true` or `false`.'],
|
|
277
|
+
ID: [
|
|
278
|
+
TypeKind.SCALAR,
|
|
279
|
+
'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.',
|
|
280
|
+
],
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
/**
|
|
284
|
+
* Whether the name is one of the scalars graphql-js specifies
|
|
285
|
+
*/
|
|
286
|
+
export function isSpecifiedScalarTypeName(name: string): name is keyof typeof specifiedScalarTypes {
|
|
287
|
+
return Object.prototype.hasOwnProperty.call(specifiedScalarTypes, name)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
/**
|
|
291
|
+
* Built-in scalar map
|
|
292
|
+
*/
|
|
293
|
+
export const builtInScalars: ScalarMap = {
|
|
294
|
+
Int: GraphQLIntScalar,
|
|
295
|
+
Float: GraphQLFloatScalar,
|
|
296
|
+
String: GraphQLStringScalar,
|
|
297
|
+
Boolean: GraphQLBooleanScalar,
|
|
298
|
+
ID: GraphQLIDScalar,
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
const scalarsWithBuiltInsCache = new WeakMap<ScalarMap, ScalarMap>()
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Built-in scalars overridden by the given custom scalars, memoized per `scalars` object.
|
|
305
|
+
*/
|
|
306
|
+
export function withBuiltInScalars(scalars?: ScalarMap): ScalarMap {
|
|
307
|
+
if (!scalars) {
|
|
308
|
+
return builtInScalars
|
|
309
|
+
}
|
|
310
|
+
let merged = scalarsWithBuiltInsCache.get(scalars)
|
|
311
|
+
if (!merged) {
|
|
312
|
+
merged = { ...builtInScalars, ...scalars }
|
|
313
|
+
scalarsWithBuiltInsCache.set(scalars, merged)
|
|
314
|
+
}
|
|
315
|
+
return merged
|
|
316
|
+
}
|