@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,80 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test'
|
|
2
|
+
import { parse } from 'graphql'
|
|
3
|
+
import { execute, executeSync, KnownTypeNamesRule, TypeKind, TypePattern, validate } from '../src/index.js'
|
|
4
|
+
import type { ResolveInfo, ResolverMap, Schema } from '../src/index.js'
|
|
5
|
+
|
|
6
|
+
const createSchema = (): Schema => ({
|
|
7
|
+
q: 'Query',
|
|
8
|
+
m: null,
|
|
9
|
+
s: null,
|
|
10
|
+
t: {
|
|
11
|
+
Query: [TypeKind.OBJECT, { hello: [[TypePattern.T, 'String'], null] }, []],
|
|
12
|
+
String: [TypeKind.SCALAR],
|
|
13
|
+
},
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const recordingResolvers = (infos: ResolveInfo[]): ResolverMap => ({
|
|
17
|
+
Query: {
|
|
18
|
+
hello: (_, __, ___, info) => {
|
|
19
|
+
infos.push(info)
|
|
20
|
+
return 'world'
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
const captureInfo = (schema: Schema, resolvers: ResolverMap, infos: ResolveInfo[]) => {
|
|
26
|
+
executeSync({ schema, resolvers, document: parse('{ hello }') })
|
|
27
|
+
return infos[infos.length - 1]
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe('per-schema memoization', () => {
|
|
31
|
+
it('reuses the schema merged with introspection types across executions', () => {
|
|
32
|
+
const schema = createSchema()
|
|
33
|
+
const infos: ResolveInfo[] = []
|
|
34
|
+
const resolvers = recordingResolvers(infos)
|
|
35
|
+
|
|
36
|
+
const first = captureInfo(schema, resolvers, infos)
|
|
37
|
+
const second = captureInfo(schema, resolvers, infos)
|
|
38
|
+
|
|
39
|
+
expect(first.schema).not.toBe(schema)
|
|
40
|
+
expect(first.schema.t.__Schema).toBeDefined()
|
|
41
|
+
expect(second.schema).toBe(first.schema)
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it('merges a different schema object separately', () => {
|
|
45
|
+
const infos: ResolveInfo[] = []
|
|
46
|
+
const resolvers = recordingResolvers(infos)
|
|
47
|
+
|
|
48
|
+
const first = captureInfo(createSchema(), resolvers, infos)
|
|
49
|
+
const second = captureInfo(createSchema(), resolvers, infos)
|
|
50
|
+
|
|
51
|
+
expect(second.schema).not.toBe(first.schema)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('keeps user resolvers and introspection working when the same resolvers object is reused', async () => {
|
|
55
|
+
const schema = createSchema()
|
|
56
|
+
const resolvers: ResolverMap = { Query: { hello: () => 'world' } }
|
|
57
|
+
const document = parse('{ hello __type(name: "Query") { name } }')
|
|
58
|
+
|
|
59
|
+
const first = await execute({ schema, resolvers, document })
|
|
60
|
+
const second = await execute({ schema, resolvers, document })
|
|
61
|
+
|
|
62
|
+
expect(first).toEqual({ data: { hello: 'world', __type: { name: 'Query' } } })
|
|
63
|
+
expect(second).toEqual(first)
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it('executes without resolvers', () => {
|
|
67
|
+
const result = executeSync({ schema: createSchema(), document: parse('{ hello }'), rootValue: { hello: 'root' } })
|
|
68
|
+
|
|
69
|
+
expect(result).toEqual({ data: { hello: 'root' } })
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it('suggests known type names only for unknown types', () => {
|
|
73
|
+
const schema = createSchema()
|
|
74
|
+
|
|
75
|
+
expect(validate(schema, parse('query ($a: String) { hello }'), { rules: [KnownTypeNamesRule] })).toEqual([])
|
|
76
|
+
expect(validate(schema, parse('query ($a: Strin) { hello }'), { rules: [KnownTypeNamesRule] }).map(it => it.message)).toEqual([
|
|
77
|
+
'Unknown type "Strin". Did you mean "String"?',
|
|
78
|
+
])
|
|
79
|
+
})
|
|
80
|
+
})
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test'
|
|
2
|
+
import { buildSchema as buildGraphQLJsSchema, executeSync as executeSyncWithGraphQLJs, parse } from 'graphql'
|
|
3
|
+
import { buildSchema, executeSync } from '../src/index.js'
|
|
4
|
+
|
|
5
|
+
const sdl = `
|
|
6
|
+
type Query { a: String }
|
|
7
|
+
`
|
|
8
|
+
const schema = buildSchema(sdl)
|
|
9
|
+
const graphqlJsSchema = buildGraphQLJsSchema(sdl)
|
|
10
|
+
const rootValue = { a: 'A' }
|
|
11
|
+
|
|
12
|
+
function expectSameResult(query: string, operationName?: string | null) {
|
|
13
|
+
const document = parse(query)
|
|
14
|
+
const result = executeSync({ schema, document, rootValue, operationName: operationName ?? undefined })
|
|
15
|
+
const graphqlJsResult = executeSyncWithGraphQLJs({ schema: graphqlJsSchema, document, rootValue, operationName })
|
|
16
|
+
expect(JSON.parse(JSON.stringify(result))).toEqual(JSON.parse(JSON.stringify(graphqlJsResult)))
|
|
17
|
+
return expect(JSON.parse(JSON.stringify(result)))
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
describe('operation selection matches graphql-js', () => {
|
|
21
|
+
it('executes the only operation', () => {
|
|
22
|
+
expectSameResult('query Q { a }').toEqual({ data: { a: 'A' } })
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('selects the named operation', () => {
|
|
26
|
+
expectSameResult('query Q { a } query R { r: a }', 'R').toEqual({ data: { r: 'A' } })
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('rejects several operations without a name', () => {
|
|
30
|
+
expectSameResult('query Q { a } query R { a }').toEqual({
|
|
31
|
+
errors: [{ message: 'Must provide operation name if query contains multiple operations.' }],
|
|
32
|
+
})
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('rejects an unknown operation name', () => {
|
|
36
|
+
expectSameResult('query Q { a }', 'R').toEqual({ errors: [{ message: 'Unknown operation named "R".' }] })
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('treats an empty operation name as a name', () => {
|
|
40
|
+
expectSameResult('{ a }', '').toEqual({ errors: [{ message: 'Unknown operation named "".' }] })
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('rejects a document without operations', () => {
|
|
44
|
+
expectSameResult('fragment F on Query { a }').toEqual({ errors: [{ message: 'Must provide an operation.' }] })
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
it('selects the last of equally named operations', () => {
|
|
48
|
+
expectSameResult('query Q { a } query Q { q: a }', 'Q').toEqual({ data: { q: 'A' } })
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('rejects an operation type the schema does not define', () => {
|
|
52
|
+
expectSameResult('subscription { a }').toEqual({
|
|
53
|
+
errors: [{ message: 'Schema is not configured to execute subscription operation.', locations: [{ line: 1, column: 1 }] }],
|
|
54
|
+
data: null,
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
})
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test'
|
|
2
|
+
import * as graphqlJs from 'graphql'
|
|
3
|
+
import { parse } from 'graphql'
|
|
4
|
+
import { buildSchema, execute, type ResolverMap, S, toGraphQLJsSchema, validate } from '../src/index.js'
|
|
5
|
+
|
|
6
|
+
// Names of Object.prototype members must behave as any other name the schema does not define.
|
|
7
|
+
const sdl = `
|
|
8
|
+
enum Dir { asc desc }
|
|
9
|
+
input Filter { title: String and: [Filter!] }
|
|
10
|
+
input Order { title: Dir }
|
|
11
|
+
type Article { title: String }
|
|
12
|
+
union Result = Article
|
|
13
|
+
scalar Json
|
|
14
|
+
type Query {
|
|
15
|
+
list(filter: Filter, orderBy: [Order!], dir: Dir): [Article!]!
|
|
16
|
+
hello: String
|
|
17
|
+
asyncHello: String
|
|
18
|
+
echo(value: String): String
|
|
19
|
+
echoList(values: [String]): [String]
|
|
20
|
+
echoFilter(filter: Filter): String
|
|
21
|
+
badDir: Dir
|
|
22
|
+
result: Result
|
|
23
|
+
echoJson(value: Json): String
|
|
24
|
+
}
|
|
25
|
+
type Subscription { a: String b: String }
|
|
26
|
+
`
|
|
27
|
+
|
|
28
|
+
const schema = buildSchema(sdl)
|
|
29
|
+
const graphqlJsSchema = graphqlJs.buildSchema(sdl)
|
|
30
|
+
|
|
31
|
+
const article = { title: 'a' }
|
|
32
|
+
const fields = {
|
|
33
|
+
list: () => [article],
|
|
34
|
+
hello: () => 'h',
|
|
35
|
+
asyncHello: () => Promise.resolve('async'),
|
|
36
|
+
echo: (args: Record<string, unknown>) => args.value,
|
|
37
|
+
echoList: (args: Record<string, unknown>) => args.values,
|
|
38
|
+
echoFilter: (args: Record<string, unknown>) => JSON.stringify(args.filter),
|
|
39
|
+
badDir: () => 'toString',
|
|
40
|
+
result: () => ({ __typename: 'constructor' }),
|
|
41
|
+
echoJson: (args: Record<string, unknown>) => JSON.stringify(args.value),
|
|
42
|
+
}
|
|
43
|
+
const resolvers: ResolverMap = {
|
|
44
|
+
Query: Object.fromEntries(Object.entries(fields).map(([name, resolve]) => [name, (_source, args) => resolve(args)])),
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const toJson = (value: unknown): unknown => JSON.parse(JSON.stringify(value))
|
|
48
|
+
|
|
49
|
+
const validationErrors = (query: string) => {
|
|
50
|
+
const document = parse(query)
|
|
51
|
+
return {
|
|
52
|
+
actual: toJson(validate(schema, document)),
|
|
53
|
+
expected: toJson(graphqlJs.validate(graphqlJsSchema, document)),
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const executionResults = async (query: string, variableValues?: Record<string, unknown>) => {
|
|
58
|
+
const document = parse(query)
|
|
59
|
+
return {
|
|
60
|
+
actual: toJson(await execute({ schema, document, resolvers, variableValues })),
|
|
61
|
+
expected: toJson(await graphqlJs.execute({ schema: graphqlJsSchema, document, rootValue: fields, variableValues })),
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
describe('validation reports prototype member names as graphql-js does', () => {
|
|
66
|
+
const cases: Record<string, string> = {
|
|
67
|
+
'a field': '{ constructor toString __proto__ hasOwnProperty list { valueOf } }',
|
|
68
|
+
'a field argument': '{ list(constructor: 1) { title } }',
|
|
69
|
+
'a directive argument': '{ hello @skip(if: false, toString: 1) }',
|
|
70
|
+
'an input field': '{ list(filter: { constructor: "x", and: [{ __proto__: "y" }] }) { title } }',
|
|
71
|
+
'an enum value': '{ a: list(orderBy: [{ title: toString }]) { title } b: list(dir: constructor) { title } }',
|
|
72
|
+
'a directive': '{ hello @constructor @toString }',
|
|
73
|
+
'a variable type': 'query($v: constructor) { echo(value: $v) }',
|
|
74
|
+
'a fragment type condition': '{ ... on toString { hello } ...F } fragment F on valueOf { hello }',
|
|
75
|
+
'an undefined fragment': '{ ...toString }',
|
|
76
|
+
'a subscription fragment named __proto__': 'subscription { ...__proto__ } fragment __proto__ on Subscription { a b }',
|
|
77
|
+
}
|
|
78
|
+
for (const [name, query] of Object.entries(cases)) {
|
|
79
|
+
test(name, () => {
|
|
80
|
+
const { actual, expected } = validationErrors(query)
|
|
81
|
+
expect(expected).not.toEqual([])
|
|
82
|
+
expect(actual).toEqual(expected)
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
describe('execution of a valid document treats prototype member names as graphql-js does', () => {
|
|
88
|
+
const cases: Record<string, [query: string, variables?: Record<string, unknown>]> = {
|
|
89
|
+
'__type of a prototype member name': ['{ a: __type(name: "constructor") { name } b: __type(name: "toString") { name } }'],
|
|
90
|
+
'__type with the name in a variable': ['query($n: String!) { __type(name: $n) { name } }', { n: 'hasOwnProperty' }],
|
|
91
|
+
'aliases': ['{ __proto__: hello constructor: echo(value: "x") list { __proto__: title } }'],
|
|
92
|
+
'an alias of an async field': ['{ __proto__: asyncHello }'],
|
|
93
|
+
'an object literal of a scalar without a parser': ['{ echoJson(value: { __proto__: 1, constructor: 2 }) }'],
|
|
94
|
+
'fragment names': ['{ ...__proto__ ...constructor } fragment __proto__ on Query { hello } fragment constructor on Query { echo(value: "c") }'],
|
|
95
|
+
'variables without a value': ['query($toString: String) { echo(value: $toString) echoFilter(filter: { title: $toString }) }'],
|
|
96
|
+
'input object variable keys': ['query($f: Filter) { echoFilter(filter: $f) }', { f: { constructor: 'x', and: [{ toString: 'y' }] } }],
|
|
97
|
+
'an own __proto__ key of a variable': ['query($f: Filter) { echoFilter(filter: $f) }', JSON.parse('{"f":{"__proto__":{"title":"x"}}}')],
|
|
98
|
+
'enum variable values': ['query($d: Dir, $o: [Order!]) { list(dir: $d, orderBy: $o) { title } }', { d: 'toString', o: [{ title: 'valueOf' }] }],
|
|
99
|
+
'an enum result': ['{ badDir }'],
|
|
100
|
+
'an abstract type resolved to a prototype member name': ['{ result { __typename } }'],
|
|
101
|
+
}
|
|
102
|
+
for (const [name, [query, variables]] of Object.entries(cases)) {
|
|
103
|
+
test(name, async () => {
|
|
104
|
+
expect(validationErrors(query).actual).toEqual([])
|
|
105
|
+
const { actual, expected } = await executionResults(query, variables)
|
|
106
|
+
expect(actual).toEqual(expected)
|
|
107
|
+
})
|
|
108
|
+
}
|
|
109
|
+
})
|
|
110
|
+
|
|
111
|
+
test('a list item variable without a value is null', async () => {
|
|
112
|
+
// graphql-js reads the missing variable from Object.prototype here and fails to coerce the function
|
|
113
|
+
const document = parse('query($toString: String, $valueOf: String) { echoList(values: [$toString, "x", $valueOf]) }')
|
|
114
|
+
expect(toJson(await execute({ schema, document, resolvers }))).toEqual({ data: { echoList: [null, 'x', null] } })
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
describe('execution of an unvalidated document treats prototype member names as graphql-js does', () => {
|
|
118
|
+
const cases: Record<string, string> = {
|
|
119
|
+
'a field': '{ constructor toString list { valueOf } }',
|
|
120
|
+
'an argument': '{ echo(value: "x", constructor: "y") }',
|
|
121
|
+
'an input field': '{ echoFilter(filter: { title: "x", constructor: "y" }) }',
|
|
122
|
+
'an enum value': '{ list(dir: constructor) { title } }',
|
|
123
|
+
'an undefined fragment': '{ ...toString hello }',
|
|
124
|
+
}
|
|
125
|
+
for (const [name, query] of Object.entries(cases)) {
|
|
126
|
+
test(name, async () => {
|
|
127
|
+
const { actual, expected } = await executionResults(query)
|
|
128
|
+
expect(actual).toEqual(expected)
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
describe('a schema may define prototype member names', () => {
|
|
134
|
+
const ownSdl = `
|
|
135
|
+
enum E { toString valueOf }
|
|
136
|
+
input I { constructor: String }
|
|
137
|
+
type Query {
|
|
138
|
+
toString(valueOf: String): String
|
|
139
|
+
constructor: String
|
|
140
|
+
e(v: E): E
|
|
141
|
+
i(i: I): String
|
|
142
|
+
}
|
|
143
|
+
`
|
|
144
|
+
const ownSchema = buildSchema(ownSdl)
|
|
145
|
+
const ownFields = {
|
|
146
|
+
toString: (args: Record<string, unknown>) => args.valueOf,
|
|
147
|
+
constructor: () => 'c',
|
|
148
|
+
e: (args: Record<string, unknown>) => args.v,
|
|
149
|
+
i: (args: Record<string, unknown>) => JSON.stringify(args.i),
|
|
150
|
+
}
|
|
151
|
+
const ownResolvers: ResolverMap = {
|
|
152
|
+
Query: Object.fromEntries(Object.entries(ownFields).map(([name, resolve]) => [name, (_source, args) => resolve(args)])),
|
|
153
|
+
}
|
|
154
|
+
const run = async (query: string, variableValues?: Record<string, unknown>) =>
|
|
155
|
+
toJson(await execute({ schema: ownSchema, document: parse(query), resolvers: ownResolvers, variableValues }))
|
|
156
|
+
|
|
157
|
+
test('as fields, arguments and enum values, as graphql-js does', async () => {
|
|
158
|
+
const query = '{ toString(valueOf: "x") constructor e(v: toString) __type(name: "E") { enumValues { name } } }'
|
|
159
|
+
const document = parse(query)
|
|
160
|
+
const graphqlJsSchema = graphqlJs.buildSchema(ownSdl)
|
|
161
|
+
expect(toJson(validate(ownSchema, document))).toEqual([])
|
|
162
|
+
expect(await run(query)).toEqual(toJson(await graphqlJs.execute({ schema: graphqlJsSchema, document, rootValue: ownFields })))
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
test('as an input field a variable leaves out', async () => {
|
|
166
|
+
// graphql-js reads `constructor` of the variable value from Object.prototype here and fails to coerce it
|
|
167
|
+
expect(await run('query($i: I) { i(i: $i) }', { i: {} })).toEqual({ data: { i: '{}' } })
|
|
168
|
+
})
|
|
169
|
+
|
|
170
|
+
test('as type names known to the accessors and the graphql-js conversion', () => {
|
|
171
|
+
expect(S.getType(schema, 'constructor')).toBeUndefined()
|
|
172
|
+
const typeNamedLikeMember = buildSchema('type constructor { a: String } type Query { c: constructor }')
|
|
173
|
+
expect(S.getType(typeNamedLikeMember, 'constructor')).toBeDefined()
|
|
174
|
+
expect(graphqlJs.printSchema(toGraphQLJsSchema(typeNamedLikeMember))).toContain('type constructor')
|
|
175
|
+
})
|
|
176
|
+
})
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test'
|
|
2
|
+
import { parse } from 'graphql'
|
|
3
|
+
import { buildSchema, executeSync, type ResolverMap } from '../src/index.js'
|
|
4
|
+
|
|
5
|
+
const schema = buildSchema(`
|
|
6
|
+
type Query { shared: String, overridden: String, own: String, fromSource: String, item: Item }
|
|
7
|
+
type Item { name: String }
|
|
8
|
+
`)
|
|
9
|
+
|
|
10
|
+
const shared: ResolverMap = {
|
|
11
|
+
Query: { shared: () => 'shared', overridden: () => 'shared', item: () => ({ name: 'source name' }) },
|
|
12
|
+
Item: { name: () => 'shared name' },
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
describe('resolver maps', () => {
|
|
16
|
+
test('several maps are looked up in order, field by field, before the default resolver', () => {
|
|
17
|
+
const own: ResolverMap = { Query: { overridden: () => 'own', own: () => 'own' } }
|
|
18
|
+
const result = executeSync({
|
|
19
|
+
schema,
|
|
20
|
+
document: parse('{ shared overridden own fromSource item { name } }'),
|
|
21
|
+
resolvers: [own, shared],
|
|
22
|
+
rootValue: { fromSource: 'root value' },
|
|
23
|
+
})
|
|
24
|
+
expect(result).toEqual({
|
|
25
|
+
data: { shared: 'shared', overridden: 'own', own: 'own', fromSource: 'root value', item: { name: 'shared name' } },
|
|
26
|
+
})
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
test('a single map works as before', () => {
|
|
30
|
+
expect(executeSync({ schema, document: parse('{ overridden }'), resolvers: shared })).toEqual({ data: { overridden: 'shared' } })
|
|
31
|
+
})
|
|
32
|
+
})
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { describe, expect, it } from 'bun:test'
|
|
2
|
+
import * as graphqlJs from 'graphql'
|
|
3
|
+
import { GraphQLScalarType, Kind, parse } from 'graphql'
|
|
4
|
+
import { buildSchema, execute, getArgumentValues, isObjectType, validate, withBuiltInScalars } from '../src/index.js'
|
|
5
|
+
import type { Field, ScalarImplementation } from '../src/index.js'
|
|
6
|
+
|
|
7
|
+
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
|
|
8
|
+
|
|
9
|
+
const parseUuid = (value: unknown): string | undefined => (typeof value === 'string' && UUID_PATTERN.test(value) ? value : undefined)
|
|
10
|
+
|
|
11
|
+
// Returns undefined for a malformed UUID instead of throwing, like a graphql-js scalar may.
|
|
12
|
+
const uuidScalarType = new GraphQLScalarType({
|
|
13
|
+
name: 'UUID',
|
|
14
|
+
serialize: value => value,
|
|
15
|
+
parseValue: parseUuid,
|
|
16
|
+
parseLiteral: ast => (ast.kind === Kind.STRING ? parseUuid(ast.value) : undefined),
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
// A graphql-js scalar is a ScalarImplementation as is.
|
|
20
|
+
const uuidScalar: ScalarImplementation = uuidScalarType
|
|
21
|
+
|
|
22
|
+
const sdl = `
|
|
23
|
+
scalar UUID
|
|
24
|
+
input Filter {
|
|
25
|
+
ids: [UUID!]
|
|
26
|
+
}
|
|
27
|
+
type Query {
|
|
28
|
+
node(id: UUID, filter: Filter): String
|
|
29
|
+
}
|
|
30
|
+
`
|
|
31
|
+
|
|
32
|
+
const schema = buildSchema(sdl)
|
|
33
|
+
const scalars = { UUID: uuidScalar }
|
|
34
|
+
const resolvers = { Query: { node: (_: unknown, args: Record<string, unknown>) => JSON.stringify(args) } }
|
|
35
|
+
|
|
36
|
+
const graphqlJsSchema = graphqlJs.buildSchema(sdl)
|
|
37
|
+
const graphqlJsUuidType = graphqlJsSchema.getType('UUID')
|
|
38
|
+
if (!(graphqlJsUuidType instanceof GraphQLScalarType)) {
|
|
39
|
+
throw new Error('UUID must be a scalar')
|
|
40
|
+
}
|
|
41
|
+
graphqlJsUuidType.parseValue = uuidScalarType.parseValue
|
|
42
|
+
graphqlJsUuidType.parseLiteral = uuidScalarType.parseLiteral
|
|
43
|
+
const graphqlJsResolvers = { node: (args: Record<string, unknown>) => JSON.stringify(args) }
|
|
44
|
+
|
|
45
|
+
const VALID_UUID = '123e4567-e89b-12d3-a456-426614174000'
|
|
46
|
+
|
|
47
|
+
const executeBoth = async (source: string, variableValues?: Record<string, unknown>) => {
|
|
48
|
+
const document = parse(source)
|
|
49
|
+
const ours = await execute({ schema, document, resolvers, scalars, variableValues })
|
|
50
|
+
const theirs = await graphqlJs.execute({ schema: graphqlJsSchema, document, rootValue: graphqlJsResolvers, variableValues })
|
|
51
|
+
return { ours, theirs }
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const messages = (result: { errors?: readonly { message: string }[] }) => result.errors?.map(it => it.message)
|
|
55
|
+
|
|
56
|
+
describe('scalar parser returning undefined', () => {
|
|
57
|
+
it('accepts a valid value', async () => {
|
|
58
|
+
const { ours } = await executeBoth('query ($id: UUID) { node(id: $id) }', { id: VALID_UUID })
|
|
59
|
+
|
|
60
|
+
expect(ours).toEqual({ data: { node: JSON.stringify({ id: VALID_UUID }) } })
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it('rejects a variable like graphql-js', async () => {
|
|
64
|
+
const { ours, theirs } = await executeBoth('query ($id: UUID) { node(id: $id) }', { id: 'nope' })
|
|
65
|
+
|
|
66
|
+
expect(messages(ours)).toEqual(['Variable "$id" got invalid value "nope"; Expected type "UUID".'])
|
|
67
|
+
expect(messages(ours)).toEqual(messages(theirs))
|
|
68
|
+
})
|
|
69
|
+
|
|
70
|
+
it('rejects a nested variable value with its path like graphql-js', async () => {
|
|
71
|
+
const { ours, theirs } = await executeBoth('query ($filter: Filter) { node(filter: $filter) }', { filter: { ids: [VALID_UUID, 'nope'] } })
|
|
72
|
+
|
|
73
|
+
expect(messages(ours)).toEqual(['Variable "$filter" got invalid value "nope" at "filter.ids[1]"; Expected type "UUID".'])
|
|
74
|
+
expect(messages(ours)).toEqual(messages(theirs))
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
it('rejects a literal in validation like graphql-js', () => {
|
|
78
|
+
const document = parse('{ node(id: "nope") }')
|
|
79
|
+
|
|
80
|
+
const ours = validate(schema, document, { scalars }).map(it => it.message)
|
|
81
|
+
const theirs = graphqlJs.validate(graphqlJsSchema, document).map(it => it.message)
|
|
82
|
+
|
|
83
|
+
expect(ours).toEqual(['Expected value of type "UUID", found "nope".'])
|
|
84
|
+
expect(ours).toEqual(theirs)
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
it('rejects a literal argument in execution like graphql-js', async () => {
|
|
88
|
+
const { ours, theirs } = await executeBoth('{ node(filter: { ids: ["nope"] }) }')
|
|
89
|
+
|
|
90
|
+
expect(ours).toEqual({ data: { node: null }, errors: [expect.anything()] })
|
|
91
|
+
expect(messages(ours)).toEqual(['Argument "filter" has invalid value {ids: ["nope"]}.'])
|
|
92
|
+
expect(messages(ours)).toEqual(messages(theirs))
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
it('rejects a literal argument in getArgumentValues', () => {
|
|
96
|
+
const query = schema.t.Query
|
|
97
|
+
if (!isObjectType(query)) {
|
|
98
|
+
throw new Error('Query must be an object type')
|
|
99
|
+
}
|
|
100
|
+
const nodeField: Field = query[1].node
|
|
101
|
+
const operation = parse('{ node(id: "nope") }').definitions[0]
|
|
102
|
+
if (operation.kind !== Kind.OPERATION_DEFINITION || operation.selectionSet.selections[0].kind !== Kind.FIELD) {
|
|
103
|
+
throw new Error('Expected a field selection')
|
|
104
|
+
}
|
|
105
|
+
const fieldNode = operation.selectionSet.selections[0]
|
|
106
|
+
|
|
107
|
+
expect(() => getArgumentValues(schema, nodeField, fieldNode, {}, withBuiltInScalars(scalars))).toThrow(
|
|
108
|
+
'Argument "id" has invalid value "nope".',
|
|
109
|
+
)
|
|
110
|
+
})
|
|
111
|
+
})
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { describe, expect, test } from 'bun:test'
|
|
2
|
+
import { getIntrospectionQuery, parse } from 'graphql'
|
|
3
|
+
import {
|
|
4
|
+
buildSchema,
|
|
5
|
+
executeSync,
|
|
6
|
+
getSchemaWithIntrospection,
|
|
7
|
+
introspectionTypes,
|
|
8
|
+
isObjectType,
|
|
9
|
+
type Schema,
|
|
10
|
+
SchemaInterner,
|
|
11
|
+
TypeKind,
|
|
12
|
+
TypePattern,
|
|
13
|
+
validate,
|
|
14
|
+
} from '../src/index.js'
|
|
15
|
+
|
|
16
|
+
const sdl = (extraField: string) => `
|
|
17
|
+
"""A directive"""
|
|
18
|
+
directive @tag(name: String = "x") repeatable on FIELD_DEFINITION | OBJECT
|
|
19
|
+
|
|
20
|
+
interface Node { id: ID! }
|
|
21
|
+
|
|
22
|
+
"""A user"""
|
|
23
|
+
type User implements Node {
|
|
24
|
+
id: ID!
|
|
25
|
+
name(format: String = "short", upper: Boolean @deprecated(reason: "always upper")): String @deprecated(reason: "use label")
|
|
26
|
+
label: String
|
|
27
|
+
role: Role
|
|
28
|
+
${extraField}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
type Group implements Node { id: ID! }
|
|
32
|
+
|
|
33
|
+
union Member = User | Group
|
|
34
|
+
|
|
35
|
+
enum Role { ADMIN, EDITOR @deprecated(reason: "gone") }
|
|
36
|
+
|
|
37
|
+
input UserFilter @oneOf { id: ID, name: String }
|
|
38
|
+
|
|
39
|
+
input Paging { limit: Int = 10, offset: Int @deprecated }
|
|
40
|
+
|
|
41
|
+
scalar DateTime
|
|
42
|
+
|
|
43
|
+
type Query {
|
|
44
|
+
user(filter: UserFilter, paging: Paging): User
|
|
45
|
+
members: [Member!]!
|
|
46
|
+
now: DateTime
|
|
47
|
+
}
|
|
48
|
+
`
|
|
49
|
+
|
|
50
|
+
const introspect = (schema: Parameters<typeof executeSync>[0]['schema']) =>
|
|
51
|
+
executeSync({ schema, document: parse(getIntrospectionQuery({ descriptions: true, directiveIsRepeatable: true, inputValueDeprecation: true })) })
|
|
52
|
+
|
|
53
|
+
describe('SchemaInterner', () => {
|
|
54
|
+
test('an interned schema introspects exactly like the original', () => {
|
|
55
|
+
const schema = buildSchema(sdl(''))
|
|
56
|
+
const interned = new SchemaInterner().intern(schema)
|
|
57
|
+
expect(introspect(interned)).toEqual(introspect(schema))
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
test('shares unchanged types between schemas and keeps the changed one apart', () => {
|
|
61
|
+
const interner = new SchemaInterner()
|
|
62
|
+
const first = interner.intern(buildSchema(sdl('')))
|
|
63
|
+
const second = interner.intern(buildSchema(sdl('extra: Int')))
|
|
64
|
+
|
|
65
|
+
expect(second.t.Group).toBe(first.t.Group)
|
|
66
|
+
expect(second.t.UserFilter).toBe(first.t.UserFilter)
|
|
67
|
+
expect(second.t.User).not.toBe(first.t.User)
|
|
68
|
+
expect(second.t.Query).toBe(first.t.Query)
|
|
69
|
+
expect(second.d).toBe(first.d)
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
test('interning in steps yields once per type and returns what intern returns', () => {
|
|
73
|
+
const interner = new SchemaInterner()
|
|
74
|
+
const schema = buildSchema(sdl(''))
|
|
75
|
+
const steps = interner.internSteps(buildSchema(sdl('')))
|
|
76
|
+
let stepCount = 0
|
|
77
|
+
let step = steps.next()
|
|
78
|
+
while (!step.done) {
|
|
79
|
+
stepCount++
|
|
80
|
+
step = steps.next()
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
expect(stepCount).toBe(Object.keys(schema.t).length)
|
|
84
|
+
expect(step.value).toBe(interner.intern(schema))
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
test('returns the same schema object for identical schemas', () => {
|
|
88
|
+
const interner = new SchemaInterner()
|
|
89
|
+
expect(interner.intern(buildSchema(sdl('')))).toBe(interner.intern(buildSchema(sdl(''))))
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
test('keeps identical types with different names apart', () => {
|
|
93
|
+
const interned = new SchemaInterner().intern(buildSchema('type Query { a: A, b: B } type A { x: Int } type B { x: Int } scalar C scalar D'))
|
|
94
|
+
expect(interned.t.A).not.toBe(interned.t.B)
|
|
95
|
+
expect(interned.t.C).not.toBe(interned.t.D)
|
|
96
|
+
expect(validate(interned, parse('{ b { nope } }')).map(it => it.message)).toEqual(['Cannot query field "nope" on type "B".'])
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
test('keeps the introspection types by identity, so execution needs no merged copy', () => {
|
|
100
|
+
const schema = buildSchema(sdl(''))
|
|
101
|
+
const interned = new SchemaInterner().intern({ ...schema, t: { ...schema.t, ...introspectionTypes } })
|
|
102
|
+
expect(interned.t.__Schema).toBe(introspectionTypes.__Schema)
|
|
103
|
+
expect(getSchemaWithIntrospection(interned)).toBe(interned)
|
|
104
|
+
expect(introspect(interned)).toEqual(introspect(schema))
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
test('keeps arguments apart by their deprecation and drops trailing absent elements', () => {
|
|
108
|
+
const argumentOf = (schema: Schema) => {
|
|
109
|
+
const query = schema.t.Query
|
|
110
|
+
if (!query || !isObjectType(query)) {
|
|
111
|
+
throw new Error('Query must be an object type')
|
|
112
|
+
}
|
|
113
|
+
return query[1].a?.[1]?.x
|
|
114
|
+
}
|
|
115
|
+
const withArgument = (argument: NonNullable<ReturnType<typeof argumentOf>>): Schema => ({
|
|
116
|
+
q: 'Query',
|
|
117
|
+
m: null,
|
|
118
|
+
s: null,
|
|
119
|
+
t: { Query: [TypeKind.OBJECT, { a: [[TypePattern.T, 'Int'], { x: argument }] }, []], Int: [TypeKind.SCALAR] },
|
|
120
|
+
})
|
|
121
|
+
const interner = new SchemaInterner()
|
|
122
|
+
const deprecated = argumentOf(interner.intern(withArgument([[TypePattern.T, 'Int'], undefined, undefined, 'old'])))
|
|
123
|
+
const other = argumentOf(interner.intern(withArgument([[TypePattern.T, 'Int'], undefined, undefined, 'older'])))
|
|
124
|
+
const current = argumentOf(interner.intern(withArgument([[TypePattern.T, 'Int'], undefined, undefined, undefined])))
|
|
125
|
+
|
|
126
|
+
expect(deprecated).toEqual([[TypePattern.T, 'Int'], undefined, undefined, 'old'])
|
|
127
|
+
expect(argumentOf(interner.intern(withArgument([[TypePattern.T, 'Int'], undefined, undefined, 'old'])))).toBe(deprecated)
|
|
128
|
+
expect(other).not.toBe(deprecated)
|
|
129
|
+
expect(current).toEqual([[TypePattern.T, 'Int']])
|
|
130
|
+
expect(current).toHaveLength(1)
|
|
131
|
+
})
|
|
132
|
+
})
|