@contember/graphql-json 0.0.0-stage → 2.2.0-alpha.21
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,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const graphql = require("graphql");
|
|
4
|
+
function UniqueInputFieldNamesRule(context) {
|
|
5
|
+
const knownNameStack = [];
|
|
6
|
+
let knownNames = /* @__PURE__ */ new Map();
|
|
7
|
+
return {
|
|
8
|
+
ObjectValue: {
|
|
9
|
+
enter() {
|
|
10
|
+
knownNameStack.push(knownNames);
|
|
11
|
+
knownNames = /* @__PURE__ */ new Map();
|
|
12
|
+
},
|
|
13
|
+
leave() {
|
|
14
|
+
const prevKnownNames = knownNameStack.pop();
|
|
15
|
+
if (prevKnownNames) {
|
|
16
|
+
knownNames = prevKnownNames;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
ObjectField(node) {
|
|
21
|
+
const fieldName = node.name.value;
|
|
22
|
+
const knownField = knownNames.get(fieldName);
|
|
23
|
+
if (knownField) {
|
|
24
|
+
context.reportError(
|
|
25
|
+
new graphql.GraphQLError(
|
|
26
|
+
`There can be only one input field named "${fieldName}".`,
|
|
27
|
+
{ nodes: [knownField, node.name] }
|
|
28
|
+
)
|
|
29
|
+
);
|
|
30
|
+
} else {
|
|
31
|
+
knownNames.set(fieldName, node.name);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
exports.UniqueInputFieldNamesRule = UniqueInputFieldNamesRule;
|
|
37
|
+
//# sourceMappingURL=UniqueInputFieldNamesRule.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniqueInputFieldNamesRule.cjs","sources":["../../../../../../packages/graphql-json/src/validation/rules/UniqueInputFieldNamesRule.ts"],"sourcesContent":["/**\n * Unique input field names\n *\n * A GraphQL input object value is only valid if all supplied fields are\n * uniquely named.\n *\n * See https://spec.graphql.org/draft/#sec-Input-Object-Field-Uniqueness\n */\nimport type { ASTVisitor, NameNode } from 'graphql'\nimport { GraphQLError } from 'graphql'\n\nimport type { ValidationContext } from '../ValidationContext.js'\n\nexport function UniqueInputFieldNamesRule(context: ValidationContext): ASTVisitor {\n\tconst knownNameStack: Array<Map<string, NameNode>> = []\n\tlet knownNames = new Map<string, NameNode>()\n\n\treturn {\n\t\tObjectValue: {\n\t\t\tenter() {\n\t\t\t\tknownNameStack.push(knownNames)\n\t\t\t\tknownNames = new Map()\n\t\t\t},\n\t\t\tleave() {\n\t\t\t\tconst prevKnownNames = knownNameStack.pop()\n\t\t\t\tif (prevKnownNames) {\n\t\t\t\t\tknownNames = prevKnownNames\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tObjectField(node) {\n\t\t\tconst fieldName = node.name.value\n\t\t\tconst knownField = knownNames.get(fieldName)\n\t\t\tif (knownField) {\n\t\t\t\tcontext.reportError(\n\t\t\t\t\tnew GraphQLError(\n\t\t\t\t\t\t`There can be only one input field named \"${fieldName}\".`,\n\t\t\t\t\t\t{ nodes: [knownField, node.name] },\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tknownNames.set(fieldName, node.name)\n\t\t\t}\n\t\t},\n\t}\n}\n"],"names":["GraphQLError"],"mappings":";;;AAaO,SAAS,0BAA0B,SAAwC;AACjF,QAAM,iBAA+C,CAAA;AACrD,MAAI,iCAAiB,IAAA;AAErB,SAAO;AAAA,IACN,aAAa;AAAA,MACZ,QAAQ;AACP,uBAAe,KAAK,UAAU;AAC9B,yCAAiB,IAAA;AAAA,MAClB;AAAA,MACA,QAAQ;AACP,cAAM,iBAAiB,eAAe,IAAA;AACtC,YAAI,gBAAgB;AACnB,uBAAa;AAAA,QACd;AAAA,MACD;AAAA,IAAA;AAAA,IAED,YAAY,MAAM;AACjB,YAAM,YAAY,KAAK,KAAK;AAC5B,YAAM,aAAa,WAAW,IAAI,SAAS;AAC3C,UAAI,YAAY;AACf,gBAAQ;AAAA,UACP,IAAIA,QAAAA;AAAAA,YACH,4CAA4C,SAAS;AAAA,YACrD,EAAE,OAAO,CAAC,YAAY,KAAK,IAAI,EAAA;AAAA,UAAE;AAAA,QAClC;AAAA,MAEF,OAAO;AACN,mBAAW,IAAI,WAAW,KAAK,IAAI;AAAA,MACpC;AAAA,IACD;AAAA,EAAA;AAEF;;"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { GraphQLError } from "graphql";
|
|
2
|
+
function UniqueInputFieldNamesRule(context) {
|
|
3
|
+
const knownNameStack = [];
|
|
4
|
+
let knownNames = /* @__PURE__ */ new Map();
|
|
5
|
+
return {
|
|
6
|
+
ObjectValue: {
|
|
7
|
+
enter() {
|
|
8
|
+
knownNameStack.push(knownNames);
|
|
9
|
+
knownNames = /* @__PURE__ */ new Map();
|
|
10
|
+
},
|
|
11
|
+
leave() {
|
|
12
|
+
const prevKnownNames = knownNameStack.pop();
|
|
13
|
+
if (prevKnownNames) {
|
|
14
|
+
knownNames = prevKnownNames;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
ObjectField(node) {
|
|
19
|
+
const fieldName = node.name.value;
|
|
20
|
+
const knownField = knownNames.get(fieldName);
|
|
21
|
+
if (knownField) {
|
|
22
|
+
context.reportError(
|
|
23
|
+
new GraphQLError(
|
|
24
|
+
`There can be only one input field named "${fieldName}".`,
|
|
25
|
+
{ nodes: [knownField, node.name] }
|
|
26
|
+
)
|
|
27
|
+
);
|
|
28
|
+
} else {
|
|
29
|
+
knownNames.set(fieldName, node.name);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
UniqueInputFieldNamesRule
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=UniqueInputFieldNamesRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniqueInputFieldNamesRule.js","sources":["../../../../../../packages/graphql-json/src/validation/rules/UniqueInputFieldNamesRule.ts"],"sourcesContent":["/**\n * Unique input field names\n *\n * A GraphQL input object value is only valid if all supplied fields are\n * uniquely named.\n *\n * See https://spec.graphql.org/draft/#sec-Input-Object-Field-Uniqueness\n */\nimport type { ASTVisitor, NameNode } from 'graphql'\nimport { GraphQLError } from 'graphql'\n\nimport type { ValidationContext } from '../ValidationContext.js'\n\nexport function UniqueInputFieldNamesRule(context: ValidationContext): ASTVisitor {\n\tconst knownNameStack: Array<Map<string, NameNode>> = []\n\tlet knownNames = new Map<string, NameNode>()\n\n\treturn {\n\t\tObjectValue: {\n\t\t\tenter() {\n\t\t\t\tknownNameStack.push(knownNames)\n\t\t\t\tknownNames = new Map()\n\t\t\t},\n\t\t\tleave() {\n\t\t\t\tconst prevKnownNames = knownNameStack.pop()\n\t\t\t\tif (prevKnownNames) {\n\t\t\t\t\tknownNames = prevKnownNames\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t\tObjectField(node) {\n\t\t\tconst fieldName = node.name.value\n\t\t\tconst knownField = knownNames.get(fieldName)\n\t\t\tif (knownField) {\n\t\t\t\tcontext.reportError(\n\t\t\t\t\tnew GraphQLError(\n\t\t\t\t\t\t`There can be only one input field named \"${fieldName}\".`,\n\t\t\t\t\t\t{ nodes: [knownField, node.name] },\n\t\t\t\t\t),\n\t\t\t\t)\n\t\t\t} else {\n\t\t\t\tknownNames.set(fieldName, node.name)\n\t\t\t}\n\t\t},\n\t}\n}\n"],"names":[],"mappings":";AAaO,SAAS,0BAA0B,SAAwC;AACjF,QAAM,iBAA+C,CAAA;AACrD,MAAI,iCAAiB,IAAA;AAErB,SAAO;AAAA,IACN,aAAa;AAAA,MACZ,QAAQ;AACP,uBAAe,KAAK,UAAU;AAC9B,yCAAiB,IAAA;AAAA,MAClB;AAAA,MACA,QAAQ;AACP,cAAM,iBAAiB,eAAe,IAAA;AACtC,YAAI,gBAAgB;AACnB,uBAAa;AAAA,QACd;AAAA,MACD;AAAA,IAAA;AAAA,IAED,YAAY,MAAM;AACjB,YAAM,YAAY,KAAK,KAAK;AAC5B,YAAM,aAAa,WAAW,IAAI,SAAS;AAC3C,UAAI,YAAY;AACf,gBAAQ;AAAA,UACP,IAAI;AAAA,YACH,4CAA4C,SAAS;AAAA,YACrD,EAAE,OAAO,CAAC,YAAY,KAAK,IAAI,EAAA;AAAA,UAAE;AAAA,QAClC;AAAA,MAEF,OAAO;AACN,mBAAW,IAAI,WAAW,KAAK,IAAI;AAAA,MACpC;AAAA,IACD;AAAA,EAAA;AAEF;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const graphql = require("graphql");
|
|
4
|
+
function UniqueOperationNamesRule(context) {
|
|
5
|
+
const knownOperationNames = /* @__PURE__ */ new Map();
|
|
6
|
+
return {
|
|
7
|
+
OperationDefinition(node) {
|
|
8
|
+
const operationName = node.name;
|
|
9
|
+
if (operationName) {
|
|
10
|
+
const knownName = knownOperationNames.get(operationName.value);
|
|
11
|
+
if (knownName) {
|
|
12
|
+
context.reportError(
|
|
13
|
+
new graphql.GraphQLError(
|
|
14
|
+
`There can be only one operation named "${operationName.value}".`,
|
|
15
|
+
{ nodes: [knownName, operationName] }
|
|
16
|
+
)
|
|
17
|
+
);
|
|
18
|
+
} else {
|
|
19
|
+
knownOperationNames.set(operationName.value, operationName);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
},
|
|
24
|
+
FragmentDefinition() {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
exports.UniqueOperationNamesRule = UniqueOperationNamesRule;
|
|
30
|
+
//# sourceMappingURL=UniqueOperationNamesRule.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniqueOperationNamesRule.cjs","sources":["../../../../../../packages/graphql-json/src/validation/rules/UniqueOperationNamesRule.ts"],"sourcesContent":["/**\n * Unique operation names\n *\n * A GraphQL document is only valid if all defined operations have unique names.\n *\n * See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness\n */\nimport type { ASTVisitor, NameNode } from 'graphql'\nimport { GraphQLError } from 'graphql'\n\nimport type { ValidationContext } from '../ValidationContext.js'\n\nexport function UniqueOperationNamesRule(context: ValidationContext): ASTVisitor {\n\tconst knownOperationNames = new Map<string, NameNode>()\n\n\treturn {\n\t\tOperationDefinition(node) {\n\t\t\tconst operationName = node.name\n\t\t\tif (operationName) {\n\t\t\t\tconst knownName = knownOperationNames.get(operationName.value)\n\t\t\t\tif (knownName) {\n\t\t\t\t\tcontext.reportError(\n\t\t\t\t\t\tnew GraphQLError(\n\t\t\t\t\t\t\t`There can be only one operation named \"${operationName.value}\".`,\n\t\t\t\t\t\t\t{ nodes: [knownName, operationName] },\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tknownOperationNames.set(operationName.value, operationName)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t\tFragmentDefinition() {\n\t\t\treturn false\n\t\t},\n\t}\n}\n"],"names":["GraphQLError"],"mappings":";;;AAYO,SAAS,yBAAyB,SAAwC;AAChF,QAAM,0CAA0B,IAAA;AAEhC,SAAO;AAAA,IACN,oBAAoB,MAAM;AACzB,YAAM,gBAAgB,KAAK;AAC3B,UAAI,eAAe;AAClB,cAAM,YAAY,oBAAoB,IAAI,cAAc,KAAK;AAC7D,YAAI,WAAW;AACd,kBAAQ;AAAA,YACP,IAAIA,QAAAA;AAAAA,cACH,0CAA0C,cAAc,KAAK;AAAA,cAC7D,EAAE,OAAO,CAAC,WAAW,aAAa,EAAA;AAAA,YAAE;AAAA,UACrC;AAAA,QAEF,OAAO;AACN,8BAAoB,IAAI,cAAc,OAAO,aAAa;AAAA,QAC3D;AAAA,MACD;AACA,aAAO;AAAA,IACR;AAAA,IACA,qBAAqB;AACpB,aAAO;AAAA,IACR;AAAA,EAAA;AAEF;;"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { GraphQLError } from "graphql";
|
|
2
|
+
function UniqueOperationNamesRule(context) {
|
|
3
|
+
const knownOperationNames = /* @__PURE__ */ new Map();
|
|
4
|
+
return {
|
|
5
|
+
OperationDefinition(node) {
|
|
6
|
+
const operationName = node.name;
|
|
7
|
+
if (operationName) {
|
|
8
|
+
const knownName = knownOperationNames.get(operationName.value);
|
|
9
|
+
if (knownName) {
|
|
10
|
+
context.reportError(
|
|
11
|
+
new GraphQLError(
|
|
12
|
+
`There can be only one operation named "${operationName.value}".`,
|
|
13
|
+
{ nodes: [knownName, operationName] }
|
|
14
|
+
)
|
|
15
|
+
);
|
|
16
|
+
} else {
|
|
17
|
+
knownOperationNames.set(operationName.value, operationName);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
},
|
|
22
|
+
FragmentDefinition() {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
UniqueOperationNamesRule
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=UniqueOperationNamesRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniqueOperationNamesRule.js","sources":["../../../../../../packages/graphql-json/src/validation/rules/UniqueOperationNamesRule.ts"],"sourcesContent":["/**\n * Unique operation names\n *\n * A GraphQL document is only valid if all defined operations have unique names.\n *\n * See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness\n */\nimport type { ASTVisitor, NameNode } from 'graphql'\nimport { GraphQLError } from 'graphql'\n\nimport type { ValidationContext } from '../ValidationContext.js'\n\nexport function UniqueOperationNamesRule(context: ValidationContext): ASTVisitor {\n\tconst knownOperationNames = new Map<string, NameNode>()\n\n\treturn {\n\t\tOperationDefinition(node) {\n\t\t\tconst operationName = node.name\n\t\t\tif (operationName) {\n\t\t\t\tconst knownName = knownOperationNames.get(operationName.value)\n\t\t\t\tif (knownName) {\n\t\t\t\t\tcontext.reportError(\n\t\t\t\t\t\tnew GraphQLError(\n\t\t\t\t\t\t\t`There can be only one operation named \"${operationName.value}\".`,\n\t\t\t\t\t\t\t{ nodes: [knownName, operationName] },\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t} else {\n\t\t\t\t\tknownOperationNames.set(operationName.value, operationName)\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn false\n\t\t},\n\t\tFragmentDefinition() {\n\t\t\treturn false\n\t\t},\n\t}\n}\n"],"names":[],"mappings":";AAYO,SAAS,yBAAyB,SAAwC;AAChF,QAAM,0CAA0B,IAAA;AAEhC,SAAO;AAAA,IACN,oBAAoB,MAAM;AACzB,YAAM,gBAAgB,KAAK;AAC3B,UAAI,eAAe;AAClB,cAAM,YAAY,oBAAoB,IAAI,cAAc,KAAK;AAC7D,YAAI,WAAW;AACd,kBAAQ;AAAA,YACP,IAAI;AAAA,cACH,0CAA0C,cAAc,KAAK;AAAA,cAC7D,EAAE,OAAO,CAAC,WAAW,aAAa,EAAA;AAAA,YAAE;AAAA,UACrC;AAAA,QAEF,OAAO;AACN,8BAAoB,IAAI,cAAc,OAAO,aAAa;AAAA,QAC3D;AAAA,MACD;AACA,aAAO;AAAA,IACR;AAAA,IACA,qBAAqB;AACpB,aAAO;AAAA,IACR;AAAA,EAAA;AAEF;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const graphql = require("graphql");
|
|
4
|
+
function UniqueVariableNamesRule(context) {
|
|
5
|
+
return {
|
|
6
|
+
OperationDefinition(operationNode) {
|
|
7
|
+
const seenVariableNames = /* @__PURE__ */ new Map();
|
|
8
|
+
for (const varDef of operationNode.variableDefinitions ?? []) {
|
|
9
|
+
const name = varDef.variable.name;
|
|
10
|
+
const names = seenVariableNames.get(name.value);
|
|
11
|
+
if (names) {
|
|
12
|
+
names.push(name);
|
|
13
|
+
} else {
|
|
14
|
+
seenVariableNames.set(name.value, [name]);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
for (const [variableName, names] of seenVariableNames) {
|
|
18
|
+
if (names.length > 1) {
|
|
19
|
+
context.reportError(new graphql.GraphQLError(`There can be only one variable named "$${variableName}".`, { nodes: names }));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
exports.UniqueVariableNamesRule = UniqueVariableNamesRule;
|
|
27
|
+
//# sourceMappingURL=UniqueVariableNamesRule.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniqueVariableNamesRule.cjs","sources":["../../../../../../packages/graphql-json/src/validation/rules/UniqueVariableNamesRule.ts"],"sourcesContent":["/**\n * Unique variable names\n *\n * A GraphQL operation is only valid if all its variables are uniquely named.\n *\n * See https://spec.graphql.org/draft/#sec-Variable-Uniqueness\n */\nimport type { ASTVisitor, NameNode, OperationDefinitionNode } from 'graphql'\nimport { GraphQLError } from 'graphql'\n\nimport type { ValidationContext } from '../ValidationContext.js'\n\nexport function UniqueVariableNamesRule(context: ValidationContext): ASTVisitor {\n\treturn {\n\t\tOperationDefinition(operationNode: OperationDefinitionNode) {\n\t\t\tconst seenVariableNames = new Map<string, NameNode[]>()\n\t\t\tfor (const varDef of operationNode.variableDefinitions ?? []) {\n\t\t\t\tconst name = varDef.variable.name\n\t\t\t\tconst names = seenVariableNames.get(name.value)\n\t\t\t\tif (names) {\n\t\t\t\t\tnames.push(name)\n\t\t\t\t} else {\n\t\t\t\t\tseenVariableNames.set(name.value, [name])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [variableName, names] of seenVariableNames) {\n\t\t\t\tif (names.length > 1) {\n\t\t\t\t\tcontext.reportError(new GraphQLError(`There can be only one variable named \"$${variableName}\".`, { nodes: names }))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false // Don't visit deeper\n\t\t},\n\t}\n}\n"],"names":["GraphQLError"],"mappings":";;;AAYO,SAAS,wBAAwB,SAAwC;AAC/E,SAAO;AAAA,IACN,oBAAoB,eAAwC;AAC3D,YAAM,wCAAwB,IAAA;AAC9B,iBAAW,UAAU,cAAc,uBAAuB,CAAA,GAAI;AAC7D,cAAM,OAAO,OAAO,SAAS;AAC7B,cAAM,QAAQ,kBAAkB,IAAI,KAAK,KAAK;AAC9C,YAAI,OAAO;AACV,gBAAM,KAAK,IAAI;AAAA,QAChB,OAAO;AACN,4BAAkB,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC;AAAA,QACzC;AAAA,MACD;AAEA,iBAAW,CAAC,cAAc,KAAK,KAAK,mBAAmB;AACtD,YAAI,MAAM,SAAS,GAAG;AACrB,kBAAQ,YAAY,IAAIA,QAAAA,aAAa,0CAA0C,YAAY,MAAM,EAAE,OAAO,MAAA,CAAO,CAAC;AAAA,QACnH;AAAA,MACD;AAEA,aAAO;AAAA,IACR;AAAA,EAAA;AAEF;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { GraphQLError } from "graphql";
|
|
2
|
+
function UniqueVariableNamesRule(context) {
|
|
3
|
+
return {
|
|
4
|
+
OperationDefinition(operationNode) {
|
|
5
|
+
const seenVariableNames = /* @__PURE__ */ new Map();
|
|
6
|
+
for (const varDef of operationNode.variableDefinitions ?? []) {
|
|
7
|
+
const name = varDef.variable.name;
|
|
8
|
+
const names = seenVariableNames.get(name.value);
|
|
9
|
+
if (names) {
|
|
10
|
+
names.push(name);
|
|
11
|
+
} else {
|
|
12
|
+
seenVariableNames.set(name.value, [name]);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
for (const [variableName, names] of seenVariableNames) {
|
|
16
|
+
if (names.length > 1) {
|
|
17
|
+
context.reportError(new GraphQLError(`There can be only one variable named "$${variableName}".`, { nodes: names }));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
UniqueVariableNamesRule
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=UniqueVariableNamesRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniqueVariableNamesRule.js","sources":["../../../../../../packages/graphql-json/src/validation/rules/UniqueVariableNamesRule.ts"],"sourcesContent":["/**\n * Unique variable names\n *\n * A GraphQL operation is only valid if all its variables are uniquely named.\n *\n * See https://spec.graphql.org/draft/#sec-Variable-Uniqueness\n */\nimport type { ASTVisitor, NameNode, OperationDefinitionNode } from 'graphql'\nimport { GraphQLError } from 'graphql'\n\nimport type { ValidationContext } from '../ValidationContext.js'\n\nexport function UniqueVariableNamesRule(context: ValidationContext): ASTVisitor {\n\treturn {\n\t\tOperationDefinition(operationNode: OperationDefinitionNode) {\n\t\t\tconst seenVariableNames = new Map<string, NameNode[]>()\n\t\t\tfor (const varDef of operationNode.variableDefinitions ?? []) {\n\t\t\t\tconst name = varDef.variable.name\n\t\t\t\tconst names = seenVariableNames.get(name.value)\n\t\t\t\tif (names) {\n\t\t\t\t\tnames.push(name)\n\t\t\t\t} else {\n\t\t\t\t\tseenVariableNames.set(name.value, [name])\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor (const [variableName, names] of seenVariableNames) {\n\t\t\t\tif (names.length > 1) {\n\t\t\t\t\tcontext.reportError(new GraphQLError(`There can be only one variable named \"$${variableName}\".`, { nodes: names }))\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn false // Don't visit deeper\n\t\t},\n\t}\n}\n"],"names":[],"mappings":";AAYO,SAAS,wBAAwB,SAAwC;AAC/E,SAAO;AAAA,IACN,oBAAoB,eAAwC;AAC3D,YAAM,wCAAwB,IAAA;AAC9B,iBAAW,UAAU,cAAc,uBAAuB,CAAA,GAAI;AAC7D,cAAM,OAAO,OAAO,SAAS;AAC7B,cAAM,QAAQ,kBAAkB,IAAI,KAAK,KAAK;AAC9C,YAAI,OAAO;AACV,gBAAM,KAAK,IAAI;AAAA,QAChB,OAAO;AACN,4BAAkB,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC;AAAA,QACzC;AAAA,MACD;AAEA,iBAAW,CAAC,cAAc,KAAK,KAAK,mBAAmB;AACtD,YAAI,MAAM,SAAS,GAAG;AACrB,kBAAQ,YAAY,IAAI,aAAa,0CAA0C,YAAY,MAAM,EAAE,OAAO,MAAA,CAAO,CAAC;AAAA,QACnH;AAAA,MACD;AAEA,aAAO;AAAA,IACR;AAAA,EAAA;AAEF;"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const graphql = require("graphql");
|
|
4
|
+
const schema = require("../../types/schema.cjs");
|
|
5
|
+
const typeRef = require("../../utils/typeRef.cjs");
|
|
6
|
+
const enumValues = require("../../utils/enumValues.cjs");
|
|
7
|
+
const helpers$1 = require("../../utils/helpers.cjs");
|
|
8
|
+
const helpers = require("../helpers.cjs");
|
|
9
|
+
function ValuesOfCorrectTypeRule(context) {
|
|
10
|
+
const getNamedInputType = (typeRef$1) => typeRef$1 ? helpers$1.getOwn(context.getSchema().t, typeRef.getTypeName(typeRef$1)) : void 0;
|
|
11
|
+
return {
|
|
12
|
+
ListValue(node) {
|
|
13
|
+
const type = context.getParentInputType();
|
|
14
|
+
if (!type || !typeRef.isListType(type[0])) {
|
|
15
|
+
isValidValueNode(context, node);
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return void 0;
|
|
19
|
+
},
|
|
20
|
+
ObjectValue(node) {
|
|
21
|
+
const typeRef$1 = context.getInputType();
|
|
22
|
+
const type = getNamedInputType(typeRef$1);
|
|
23
|
+
if (!typeRef$1 || !type || !schema.isInputObjectType(type)) {
|
|
24
|
+
isValidValueNode(context, node);
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
const typeName = typeRef.getTypeName(typeRef$1);
|
|
28
|
+
const fieldNodeMap = /* @__PURE__ */ new Map();
|
|
29
|
+
for (const field of node.fields) {
|
|
30
|
+
fieldNodeMap.set(field.name.value, field);
|
|
31
|
+
}
|
|
32
|
+
const fieldDefs = type[1];
|
|
33
|
+
for (const fieldName in fieldDefs) {
|
|
34
|
+
const fieldDef = fieldDefs[fieldName];
|
|
35
|
+
if (!fieldNodeMap.has(fieldName) && typeRef.isNonNullType(fieldDef[0][0]) && fieldDef[1] === void 0) {
|
|
36
|
+
context.reportError(
|
|
37
|
+
new graphql.GraphQLError(`Field "${typeName}.${fieldName}" of required type "${typeRef.formatTypeRef(fieldDef[0])}" was not provided.`, { nodes: node })
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (type[2]) {
|
|
42
|
+
validateOneOfInputObject(context, node, typeName, fieldNodeMap);
|
|
43
|
+
}
|
|
44
|
+
return void 0;
|
|
45
|
+
},
|
|
46
|
+
ObjectField(node) {
|
|
47
|
+
const parentTypeRef = context.getParentInputType();
|
|
48
|
+
const parentType = getNamedInputType(parentTypeRef);
|
|
49
|
+
const fieldType = context.getInputType();
|
|
50
|
+
if (!fieldType && parentTypeRef && parentType && schema.isInputObjectType(parentType)) {
|
|
51
|
+
const suggestions = helpers.suggestionList(node.name.value, Object.keys(parentType[1]));
|
|
52
|
+
context.reportError(
|
|
53
|
+
new graphql.GraphQLError(`Field "${node.name.value}" is not defined by type "${typeRef.getTypeName(parentTypeRef)}".` + helpers.didYouMean(suggestions), {
|
|
54
|
+
nodes: node
|
|
55
|
+
})
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
NullValue(node) {
|
|
60
|
+
const type = context.getInputType();
|
|
61
|
+
if (type && typeRef.isNonNullType(type[0])) {
|
|
62
|
+
context.reportError(new graphql.GraphQLError(`Expected value of type "${typeRef.formatTypeRef(type)}", found ${graphql.print(node)}.`, { nodes: node }));
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
EnumValue: (node) => isValidValueNode(context, node),
|
|
66
|
+
IntValue: (node) => isValidValueNode(context, node),
|
|
67
|
+
FloatValue: (node) => isValidValueNode(context, node),
|
|
68
|
+
StringValue: (node) => isValidValueNode(context, node),
|
|
69
|
+
BooleanValue: (node) => isValidValueNode(context, node)
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function isValidValueNode(context, node) {
|
|
73
|
+
const locationType = context.getInputType();
|
|
74
|
+
if (!locationType) {
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
const typeName = typeRef.getTypeName(locationType);
|
|
78
|
+
const type = helpers$1.getOwn(context.getSchema().t, typeName);
|
|
79
|
+
if (!type) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (!schema.isLeafType(type)) {
|
|
83
|
+
context.reportError(new graphql.GraphQLError(`Expected value of type "${typeRef.formatTypeRef(locationType)}", found ${graphql.print(node)}.`, { nodes: node }));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
let parseResult;
|
|
88
|
+
if (schema.isEnumType(type)) {
|
|
89
|
+
parseResult = enumValues.parseEnumLiteral(typeName, type, node);
|
|
90
|
+
} else {
|
|
91
|
+
const scalar = helpers$1.getOwn(context.getScalars(), typeName);
|
|
92
|
+
parseResult = scalar ? scalar.parseLiteral(node, void 0) : true;
|
|
93
|
+
}
|
|
94
|
+
if (parseResult === void 0) {
|
|
95
|
+
context.reportError(new graphql.GraphQLError(`Expected value of type "${typeRef.formatTypeRef(locationType)}", found ${graphql.print(node)}.`, { nodes: node }));
|
|
96
|
+
}
|
|
97
|
+
} catch (error) {
|
|
98
|
+
if (error instanceof graphql.GraphQLError) {
|
|
99
|
+
context.reportError(error);
|
|
100
|
+
} else {
|
|
101
|
+
const message = typeof error === "object" && error !== null && "message" in error ? error.message : void 0;
|
|
102
|
+
context.reportError(
|
|
103
|
+
new graphql.GraphQLError(`Expected value of type "${typeRef.formatTypeRef(locationType)}", found ${graphql.print(node)}; ` + String(message), {
|
|
104
|
+
nodes: node,
|
|
105
|
+
originalError: error instanceof Error ? error : void 0
|
|
106
|
+
})
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function validateOneOfInputObject(context, node, typeName, fieldNodeMap) {
|
|
112
|
+
const keys = [...fieldNodeMap.keys()];
|
|
113
|
+
if (keys.length !== 1) {
|
|
114
|
+
context.reportError(new graphql.GraphQLError(`OneOf Input Object "${typeName}" must specify exactly one key.`, { nodes: [node] }));
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const value = fieldNodeMap.get(keys[0])?.value;
|
|
118
|
+
if (!value || value.kind === graphql.Kind.NULL) {
|
|
119
|
+
context.reportError(new graphql.GraphQLError(`Field "${typeName}.${keys[0]}" must be non-null.`, { nodes: [node] }));
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
exports.ValuesOfCorrectTypeRule = ValuesOfCorrectTypeRule;
|
|
123
|
+
//# sourceMappingURL=ValuesOfCorrectTypeRule.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValuesOfCorrectTypeRule.cjs","sources":["../../../../../../packages/graphql-json/src/validation/rules/ValuesOfCorrectTypeRule.ts"],"sourcesContent":["/**\n * Value literals of correct type\n *\n * A GraphQL document is only valid if all value literals are of the type\n * expected at their position.\n *\n * See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type\n */\nimport type { ASTVisitor, ObjectFieldNode, ObjectValueNode, ValueNode } from 'graphql'\nimport { GraphQLError, Kind, print } from 'graphql'\n\nimport type { TypeRef } from '../../types/schema.js'\nimport { isEnumType, isInputObjectType, isLeafType } from '../../types/schema.js'\nimport { formatTypeRef, getTypeName, isListType, isNonNullType } from '../../utils/typeRef.js'\nimport { parseEnumLiteral } from '../../utils/enumValues.js'\nimport { getOwn } from '../../utils/helpers.js'\nimport { didYouMean, suggestionList } from '../helpers.js'\nimport type { ValidationContext } from '../ValidationContext.js'\n\nexport function ValuesOfCorrectTypeRule(context: ValidationContext): ASTVisitor {\n\tconst getNamedInputType = (typeRef: TypeRef | null | undefined) => (typeRef ? getOwn(context.getSchema().t, getTypeName(typeRef)) : undefined)\n\n\treturn {\n\t\tListValue(node) {\n\t\t\t// Note: TypeInfo will traverse into a list's item type, so look to the parent input type to check if it is a list.\n\t\t\tconst type = context.getParentInputType()\n\t\t\tif (!type || !isListType(type[0])) {\n\t\t\t\tisValidValueNode(context, node)\n\t\t\t\treturn false // Don't traverse further.\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\n\t\tObjectValue(node) {\n\t\t\tconst typeRef = context.getInputType()\n\t\t\tconst type = getNamedInputType(typeRef)\n\t\t\tif (!typeRef || !type || !isInputObjectType(type)) {\n\t\t\t\tisValidValueNode(context, node)\n\t\t\t\treturn false // Don't traverse further.\n\t\t\t}\n\t\t\tconst typeName = getTypeName(typeRef)\n\n\t\t\t// Ensure every required field exists.\n\t\t\tconst fieldNodeMap = new Map<string, ObjectFieldNode>()\n\t\t\tfor (const field of node.fields) {\n\t\t\t\tfieldNodeMap.set(field.name.value, field)\n\t\t\t}\n\t\t\tconst fieldDefs = type[1]\n\t\t\tfor (const fieldName in fieldDefs) {\n\t\t\t\tconst fieldDef = fieldDefs[fieldName]\n\t\t\t\tif (!fieldNodeMap.has(fieldName) && isNonNullType(fieldDef[0][0]) && fieldDef[1] === undefined) {\n\t\t\t\t\tcontext.reportError(\n\t\t\t\t\t\tnew GraphQLError(`Field \"${typeName}.${fieldName}\" of required type \"${formatTypeRef(fieldDef[0])}\" was not provided.`, { nodes: node }),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (type[2]) {\n\t\t\t\tvalidateOneOfInputObject(context, node, typeName, fieldNodeMap)\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\n\t\tObjectField(node) {\n\t\t\tconst parentTypeRef = context.getParentInputType()\n\t\t\tconst parentType = getNamedInputType(parentTypeRef)\n\t\t\tconst fieldType = context.getInputType()\n\t\t\tif (!fieldType && parentTypeRef && parentType && isInputObjectType(parentType)) {\n\t\t\t\tconst suggestions = suggestionList(node.name.value, Object.keys(parentType[1]))\n\t\t\t\tcontext.reportError(\n\t\t\t\t\tnew GraphQLError(`Field \"${node.name.value}\" is not defined by type \"${getTypeName(parentTypeRef)}\".` + didYouMean(suggestions), {\n\t\t\t\t\t\tnodes: node,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t},\n\n\t\tNullValue(node) {\n\t\t\tconst type = context.getInputType()\n\t\t\tif (type && isNonNullType(type[0])) {\n\t\t\t\tcontext.reportError(new GraphQLError(`Expected value of type \"${formatTypeRef(type)}\", found ${print(node)}.`, { nodes: node }))\n\t\t\t}\n\t\t},\n\n\t\tEnumValue: node => isValidValueNode(context, node),\n\t\tIntValue: node => isValidValueNode(context, node),\n\t\tFloatValue: node => isValidValueNode(context, node),\n\t\tStringValue: node => isValidValueNode(context, node),\n\t\tBooleanValue: node => isValidValueNode(context, node),\n\t}\n}\n\n/**\n * Any value literal may be a valid representation of a Scalar, depending on that scalar type.\n */\nfunction isValidValueNode(context: ValidationContext, node: ValueNode): void {\n\t// Report any error at the full type expected by the location.\n\tconst locationType = context.getInputType()\n\tif (!locationType) {\n\t\treturn\n\t}\n\n\tconst typeName = getTypeName(locationType)\n\tconst type = getOwn(context.getSchema().t, typeName)\n\tif (!type) {\n\t\treturn\n\t}\n\n\tif (!isLeafType(type)) {\n\t\tcontext.reportError(new GraphQLError(`Expected value of type \"${formatTypeRef(locationType)}\", found ${print(node)}.`, { nodes: node }))\n\t\treturn\n\t}\n\n\t// Scalars and Enums determine if a literal value is valid via parseLiteral(), which may throw or return an invalid value to indicate failure.\n\ttry {\n\t\tlet parseResult: unknown\n\t\tif (isEnumType(type)) {\n\t\t\tparseResult = parseEnumLiteral(typeName, type, node)\n\t\t} else {\n\t\t\tconst scalar = getOwn(context.getScalars(), typeName)\n\t\t\t// a scalar without an implementation accepts any literal, as a graphql-js scalar without parsers does\n\t\t\tparseResult = scalar ? scalar.parseLiteral(node, undefined) : true\n\t\t}\n\t\tif (parseResult === undefined) {\n\t\t\tcontext.reportError(new GraphQLError(`Expected value of type \"${formatTypeRef(locationType)}\", found ${print(node)}.`, { nodes: node }))\n\t\t}\n\t} catch (error) {\n\t\tif (error instanceof GraphQLError) {\n\t\t\tcontext.reportError(error)\n\t\t} else {\n\t\t\tconst message: unknown = typeof error === 'object' && error !== null && 'message' in error ? error.message : undefined\n\t\t\tcontext.reportError(\n\t\t\t\tnew GraphQLError(`Expected value of type \"${formatTypeRef(locationType)}\", found ${print(node)}; ` + String(message), {\n\t\t\t\t\tnodes: node,\n\t\t\t\t\toriginalError: error instanceof Error ? error : undefined,\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\t}\n}\n\nfunction validateOneOfInputObject(\n\tcontext: ValidationContext,\n\tnode: ObjectValueNode,\n\ttypeName: string,\n\tfieldNodeMap: ReadonlyMap<string, ObjectFieldNode>,\n): void {\n\tconst keys = [...fieldNodeMap.keys()]\n\tif (keys.length !== 1) {\n\t\tcontext.reportError(new GraphQLError(`OneOf Input Object \"${typeName}\" must specify exactly one key.`, { nodes: [node] }))\n\t\treturn\n\t}\n\n\tconst value = fieldNodeMap.get(keys[0])?.value\n\tif (!value || value.kind === Kind.NULL) {\n\t\tcontext.reportError(new GraphQLError(`Field \"${typeName}.${keys[0]}\" must be non-null.`, { nodes: [node] }))\n\t}\n}\n"],"names":["typeRef","getOwn","getTypeName","isListType","isInputObjectType","isNonNullType","GraphQLError","formatTypeRef","suggestionList","didYouMean","print","isLeafType","isEnumType","parseEnumLiteral","Kind"],"mappings":"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"}
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { GraphQLError, print, Kind } from "graphql";
|
|
2
|
+
import { isInputObjectType, isLeafType, isEnumType } from "../../types/schema.js";
|
|
3
|
+
import { isNonNullType, formatTypeRef, getTypeName, isListType } from "../../utils/typeRef.js";
|
|
4
|
+
import { parseEnumLiteral } from "../../utils/enumValues.js";
|
|
5
|
+
import { getOwn } from "../../utils/helpers.js";
|
|
6
|
+
import { suggestionList, didYouMean } from "../helpers.js";
|
|
7
|
+
function ValuesOfCorrectTypeRule(context) {
|
|
8
|
+
const getNamedInputType = (typeRef) => typeRef ? getOwn(context.getSchema().t, getTypeName(typeRef)) : void 0;
|
|
9
|
+
return {
|
|
10
|
+
ListValue(node) {
|
|
11
|
+
const type = context.getParentInputType();
|
|
12
|
+
if (!type || !isListType(type[0])) {
|
|
13
|
+
isValidValueNode(context, node);
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
return void 0;
|
|
17
|
+
},
|
|
18
|
+
ObjectValue(node) {
|
|
19
|
+
const typeRef = context.getInputType();
|
|
20
|
+
const type = getNamedInputType(typeRef);
|
|
21
|
+
if (!typeRef || !type || !isInputObjectType(type)) {
|
|
22
|
+
isValidValueNode(context, node);
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
const typeName = getTypeName(typeRef);
|
|
26
|
+
const fieldNodeMap = /* @__PURE__ */ new Map();
|
|
27
|
+
for (const field of node.fields) {
|
|
28
|
+
fieldNodeMap.set(field.name.value, field);
|
|
29
|
+
}
|
|
30
|
+
const fieldDefs = type[1];
|
|
31
|
+
for (const fieldName in fieldDefs) {
|
|
32
|
+
const fieldDef = fieldDefs[fieldName];
|
|
33
|
+
if (!fieldNodeMap.has(fieldName) && isNonNullType(fieldDef[0][0]) && fieldDef[1] === void 0) {
|
|
34
|
+
context.reportError(
|
|
35
|
+
new GraphQLError(`Field "${typeName}.${fieldName}" of required type "${formatTypeRef(fieldDef[0])}" was not provided.`, { nodes: node })
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (type[2]) {
|
|
40
|
+
validateOneOfInputObject(context, node, typeName, fieldNodeMap);
|
|
41
|
+
}
|
|
42
|
+
return void 0;
|
|
43
|
+
},
|
|
44
|
+
ObjectField(node) {
|
|
45
|
+
const parentTypeRef = context.getParentInputType();
|
|
46
|
+
const parentType = getNamedInputType(parentTypeRef);
|
|
47
|
+
const fieldType = context.getInputType();
|
|
48
|
+
if (!fieldType && parentTypeRef && parentType && isInputObjectType(parentType)) {
|
|
49
|
+
const suggestions = suggestionList(node.name.value, Object.keys(parentType[1]));
|
|
50
|
+
context.reportError(
|
|
51
|
+
new GraphQLError(`Field "${node.name.value}" is not defined by type "${getTypeName(parentTypeRef)}".` + didYouMean(suggestions), {
|
|
52
|
+
nodes: node
|
|
53
|
+
})
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
NullValue(node) {
|
|
58
|
+
const type = context.getInputType();
|
|
59
|
+
if (type && isNonNullType(type[0])) {
|
|
60
|
+
context.reportError(new GraphQLError(`Expected value of type "${formatTypeRef(type)}", found ${print(node)}.`, { nodes: node }));
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
EnumValue: (node) => isValidValueNode(context, node),
|
|
64
|
+
IntValue: (node) => isValidValueNode(context, node),
|
|
65
|
+
FloatValue: (node) => isValidValueNode(context, node),
|
|
66
|
+
StringValue: (node) => isValidValueNode(context, node),
|
|
67
|
+
BooleanValue: (node) => isValidValueNode(context, node)
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function isValidValueNode(context, node) {
|
|
71
|
+
const locationType = context.getInputType();
|
|
72
|
+
if (!locationType) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const typeName = getTypeName(locationType);
|
|
76
|
+
const type = getOwn(context.getSchema().t, typeName);
|
|
77
|
+
if (!type) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (!isLeafType(type)) {
|
|
81
|
+
context.reportError(new GraphQLError(`Expected value of type "${formatTypeRef(locationType)}", found ${print(node)}.`, { nodes: node }));
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
let parseResult;
|
|
86
|
+
if (isEnumType(type)) {
|
|
87
|
+
parseResult = parseEnumLiteral(typeName, type, node);
|
|
88
|
+
} else {
|
|
89
|
+
const scalar = getOwn(context.getScalars(), typeName);
|
|
90
|
+
parseResult = scalar ? scalar.parseLiteral(node, void 0) : true;
|
|
91
|
+
}
|
|
92
|
+
if (parseResult === void 0) {
|
|
93
|
+
context.reportError(new GraphQLError(`Expected value of type "${formatTypeRef(locationType)}", found ${print(node)}.`, { nodes: node }));
|
|
94
|
+
}
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (error instanceof GraphQLError) {
|
|
97
|
+
context.reportError(error);
|
|
98
|
+
} else {
|
|
99
|
+
const message = typeof error === "object" && error !== null && "message" in error ? error.message : void 0;
|
|
100
|
+
context.reportError(
|
|
101
|
+
new GraphQLError(`Expected value of type "${formatTypeRef(locationType)}", found ${print(node)}; ` + String(message), {
|
|
102
|
+
nodes: node,
|
|
103
|
+
originalError: error instanceof Error ? error : void 0
|
|
104
|
+
})
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function validateOneOfInputObject(context, node, typeName, fieldNodeMap) {
|
|
110
|
+
const keys = [...fieldNodeMap.keys()];
|
|
111
|
+
if (keys.length !== 1) {
|
|
112
|
+
context.reportError(new GraphQLError(`OneOf Input Object "${typeName}" must specify exactly one key.`, { nodes: [node] }));
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const value = fieldNodeMap.get(keys[0])?.value;
|
|
116
|
+
if (!value || value.kind === Kind.NULL) {
|
|
117
|
+
context.reportError(new GraphQLError(`Field "${typeName}.${keys[0]}" must be non-null.`, { nodes: [node] }));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export {
|
|
121
|
+
ValuesOfCorrectTypeRule
|
|
122
|
+
};
|
|
123
|
+
//# sourceMappingURL=ValuesOfCorrectTypeRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ValuesOfCorrectTypeRule.js","sources":["../../../../../../packages/graphql-json/src/validation/rules/ValuesOfCorrectTypeRule.ts"],"sourcesContent":["/**\n * Value literals of correct type\n *\n * A GraphQL document is only valid if all value literals are of the type\n * expected at their position.\n *\n * See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type\n */\nimport type { ASTVisitor, ObjectFieldNode, ObjectValueNode, ValueNode } from 'graphql'\nimport { GraphQLError, Kind, print } from 'graphql'\n\nimport type { TypeRef } from '../../types/schema.js'\nimport { isEnumType, isInputObjectType, isLeafType } from '../../types/schema.js'\nimport { formatTypeRef, getTypeName, isListType, isNonNullType } from '../../utils/typeRef.js'\nimport { parseEnumLiteral } from '../../utils/enumValues.js'\nimport { getOwn } from '../../utils/helpers.js'\nimport { didYouMean, suggestionList } from '../helpers.js'\nimport type { ValidationContext } from '../ValidationContext.js'\n\nexport function ValuesOfCorrectTypeRule(context: ValidationContext): ASTVisitor {\n\tconst getNamedInputType = (typeRef: TypeRef | null | undefined) => (typeRef ? getOwn(context.getSchema().t, getTypeName(typeRef)) : undefined)\n\n\treturn {\n\t\tListValue(node) {\n\t\t\t// Note: TypeInfo will traverse into a list's item type, so look to the parent input type to check if it is a list.\n\t\t\tconst type = context.getParentInputType()\n\t\t\tif (!type || !isListType(type[0])) {\n\t\t\t\tisValidValueNode(context, node)\n\t\t\t\treturn false // Don't traverse further.\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\n\t\tObjectValue(node) {\n\t\t\tconst typeRef = context.getInputType()\n\t\t\tconst type = getNamedInputType(typeRef)\n\t\t\tif (!typeRef || !type || !isInputObjectType(type)) {\n\t\t\t\tisValidValueNode(context, node)\n\t\t\t\treturn false // Don't traverse further.\n\t\t\t}\n\t\t\tconst typeName = getTypeName(typeRef)\n\n\t\t\t// Ensure every required field exists.\n\t\t\tconst fieldNodeMap = new Map<string, ObjectFieldNode>()\n\t\t\tfor (const field of node.fields) {\n\t\t\t\tfieldNodeMap.set(field.name.value, field)\n\t\t\t}\n\t\t\tconst fieldDefs = type[1]\n\t\t\tfor (const fieldName in fieldDefs) {\n\t\t\t\tconst fieldDef = fieldDefs[fieldName]\n\t\t\t\tif (!fieldNodeMap.has(fieldName) && isNonNullType(fieldDef[0][0]) && fieldDef[1] === undefined) {\n\t\t\t\t\tcontext.reportError(\n\t\t\t\t\t\tnew GraphQLError(`Field \"${typeName}.${fieldName}\" of required type \"${formatTypeRef(fieldDef[0])}\" was not provided.`, { nodes: node }),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (type[2]) {\n\t\t\t\tvalidateOneOfInputObject(context, node, typeName, fieldNodeMap)\n\t\t\t}\n\t\t\treturn undefined\n\t\t},\n\n\t\tObjectField(node) {\n\t\t\tconst parentTypeRef = context.getParentInputType()\n\t\t\tconst parentType = getNamedInputType(parentTypeRef)\n\t\t\tconst fieldType = context.getInputType()\n\t\t\tif (!fieldType && parentTypeRef && parentType && isInputObjectType(parentType)) {\n\t\t\t\tconst suggestions = suggestionList(node.name.value, Object.keys(parentType[1]))\n\t\t\t\tcontext.reportError(\n\t\t\t\t\tnew GraphQLError(`Field \"${node.name.value}\" is not defined by type \"${getTypeName(parentTypeRef)}\".` + didYouMean(suggestions), {\n\t\t\t\t\t\tnodes: node,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t}\n\t\t},\n\n\t\tNullValue(node) {\n\t\t\tconst type = context.getInputType()\n\t\t\tif (type && isNonNullType(type[0])) {\n\t\t\t\tcontext.reportError(new GraphQLError(`Expected value of type \"${formatTypeRef(type)}\", found ${print(node)}.`, { nodes: node }))\n\t\t\t}\n\t\t},\n\n\t\tEnumValue: node => isValidValueNode(context, node),\n\t\tIntValue: node => isValidValueNode(context, node),\n\t\tFloatValue: node => isValidValueNode(context, node),\n\t\tStringValue: node => isValidValueNode(context, node),\n\t\tBooleanValue: node => isValidValueNode(context, node),\n\t}\n}\n\n/**\n * Any value literal may be a valid representation of a Scalar, depending on that scalar type.\n */\nfunction isValidValueNode(context: ValidationContext, node: ValueNode): void {\n\t// Report any error at the full type expected by the location.\n\tconst locationType = context.getInputType()\n\tif (!locationType) {\n\t\treturn\n\t}\n\n\tconst typeName = getTypeName(locationType)\n\tconst type = getOwn(context.getSchema().t, typeName)\n\tif (!type) {\n\t\treturn\n\t}\n\n\tif (!isLeafType(type)) {\n\t\tcontext.reportError(new GraphQLError(`Expected value of type \"${formatTypeRef(locationType)}\", found ${print(node)}.`, { nodes: node }))\n\t\treturn\n\t}\n\n\t// Scalars and Enums determine if a literal value is valid via parseLiteral(), which may throw or return an invalid value to indicate failure.\n\ttry {\n\t\tlet parseResult: unknown\n\t\tif (isEnumType(type)) {\n\t\t\tparseResult = parseEnumLiteral(typeName, type, node)\n\t\t} else {\n\t\t\tconst scalar = getOwn(context.getScalars(), typeName)\n\t\t\t// a scalar without an implementation accepts any literal, as a graphql-js scalar without parsers does\n\t\t\tparseResult = scalar ? scalar.parseLiteral(node, undefined) : true\n\t\t}\n\t\tif (parseResult === undefined) {\n\t\t\tcontext.reportError(new GraphQLError(`Expected value of type \"${formatTypeRef(locationType)}\", found ${print(node)}.`, { nodes: node }))\n\t\t}\n\t} catch (error) {\n\t\tif (error instanceof GraphQLError) {\n\t\t\tcontext.reportError(error)\n\t\t} else {\n\t\t\tconst message: unknown = typeof error === 'object' && error !== null && 'message' in error ? error.message : undefined\n\t\t\tcontext.reportError(\n\t\t\t\tnew GraphQLError(`Expected value of type \"${formatTypeRef(locationType)}\", found ${print(node)}; ` + String(message), {\n\t\t\t\t\tnodes: node,\n\t\t\t\t\toriginalError: error instanceof Error ? error : undefined,\n\t\t\t\t}),\n\t\t\t)\n\t\t}\n\t}\n}\n\nfunction validateOneOfInputObject(\n\tcontext: ValidationContext,\n\tnode: ObjectValueNode,\n\ttypeName: string,\n\tfieldNodeMap: ReadonlyMap<string, ObjectFieldNode>,\n): void {\n\tconst keys = [...fieldNodeMap.keys()]\n\tif (keys.length !== 1) {\n\t\tcontext.reportError(new GraphQLError(`OneOf Input Object \"${typeName}\" must specify exactly one key.`, { nodes: [node] }))\n\t\treturn\n\t}\n\n\tconst value = fieldNodeMap.get(keys[0])?.value\n\tif (!value || value.kind === Kind.NULL) {\n\t\tcontext.reportError(new GraphQLError(`Field \"${typeName}.${keys[0]}\" must be non-null.`, { nodes: [node] }))\n\t}\n}\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const graphql = require("graphql");
|
|
4
|
+
const typeRef = require("../../utils/typeRef.cjs");
|
|
5
|
+
const helpers = require("../../utils/helpers.cjs");
|
|
6
|
+
const helpers$1 = require("../helpers.cjs");
|
|
7
|
+
function VariablesAreInputTypesRule(context) {
|
|
8
|
+
return {
|
|
9
|
+
VariableDefinition(node) {
|
|
10
|
+
const typeRef$1 = context.getInputType();
|
|
11
|
+
if (typeRef$1) {
|
|
12
|
+
const schema = context.getSchema();
|
|
13
|
+
const typeName = typeRef.getNamedType(typeRef$1);
|
|
14
|
+
const type = helpers.getOwn(schema.t, typeName);
|
|
15
|
+
if (type && !helpers$1.isInputType(type)) {
|
|
16
|
+
const varName = node.variable.name.value;
|
|
17
|
+
context.reportError(
|
|
18
|
+
new graphql.GraphQLError(
|
|
19
|
+
`Variable "$${varName}" cannot be non-input type "${graphql.print(node.type)}".`,
|
|
20
|
+
{ nodes: node.type }
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
exports.VariablesAreInputTypesRule = VariablesAreInputTypesRule;
|
|
29
|
+
//# sourceMappingURL=VariablesAreInputTypesRule.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VariablesAreInputTypesRule.cjs","sources":["../../../../../../packages/graphql-json/src/validation/rules/VariablesAreInputTypesRule.ts"],"sourcesContent":["/**\n * Variables are input types\n *\n * A GraphQL operation is only valid if all the variables it defines are of\n * input types (scalar, enum, or input object).\n *\n * See https://spec.graphql.org/draft/#sec-Variables-Are-Input-Types\n */\nimport type { ASTVisitor, VariableDefinitionNode } from 'graphql'\nimport { GraphQLError, print } from 'graphql'\n\nimport { getNamedType } from '../../utils/typeRef.js'\nimport { getOwn } from '../../utils/helpers.js'\nimport { isInputType } from '../helpers.js'\nimport type { ValidationContext } from '../ValidationContext.js'\n\nexport function VariablesAreInputTypesRule(context: ValidationContext): ASTVisitor {\n\treturn {\n\t\tVariableDefinition(node: VariableDefinitionNode) {\n\t\t\tconst typeRef = context.getInputType()\n\n\t\t\tif (typeRef) {\n\t\t\t\tconst schema = context.getSchema()\n\t\t\t\tconst typeName = getNamedType(typeRef)\n\t\t\t\tconst type = getOwn(schema.t, typeName)\n\n\t\t\t\tif (type && !isInputType(type)) {\n\t\t\t\t\tconst varName = node.variable.name.value\n\t\t\t\t\tcontext.reportError(\n\t\t\t\t\t\tnew GraphQLError(\n\t\t\t\t\t\t\t`Variable \"$${varName}\" cannot be non-input type \"${print(node.type)}\".`,\n\t\t\t\t\t\t\t{ nodes: node.type },\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}\n}\n"],"names":["typeRef","getNamedType","getOwn","isInputType","GraphQLError","print"],"mappings":";;;;;;AAgBO,SAAS,2BAA2B,SAAwC;AAClF,SAAO;AAAA,IACN,mBAAmB,MAA8B;AAChD,YAAMA,YAAU,QAAQ,aAAA;AAExB,UAAIA,WAAS;AACZ,cAAM,SAAS,QAAQ,UAAA;AACvB,cAAM,WAAWC,QAAAA,aAAaD,SAAO;AACrC,cAAM,OAAOE,QAAAA,OAAO,OAAO,GAAG,QAAQ;AAEtC,YAAI,QAAQ,CAACC,sBAAY,IAAI,GAAG;AAC/B,gBAAM,UAAU,KAAK,SAAS,KAAK;AACnC,kBAAQ;AAAA,YACP,IAAIC,QAAAA;AAAAA,cACH,cAAc,OAAO,+BAA+BC,QAAAA,MAAM,KAAK,IAAI,CAAC;AAAA,cACpE,EAAE,OAAO,KAAK,KAAA;AAAA,YAAK;AAAA,UACpB;AAAA,QAEF;AAAA,MACD;AAAA,IACD;AAAA,EAAA;AAEF;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { GraphQLError, print } from "graphql";
|
|
2
|
+
import { getNamedType } from "../../utils/typeRef.js";
|
|
3
|
+
import { getOwn } from "../../utils/helpers.js";
|
|
4
|
+
import { isInputType } from "../helpers.js";
|
|
5
|
+
function VariablesAreInputTypesRule(context) {
|
|
6
|
+
return {
|
|
7
|
+
VariableDefinition(node) {
|
|
8
|
+
const typeRef = context.getInputType();
|
|
9
|
+
if (typeRef) {
|
|
10
|
+
const schema = context.getSchema();
|
|
11
|
+
const typeName = getNamedType(typeRef);
|
|
12
|
+
const type = getOwn(schema.t, typeName);
|
|
13
|
+
if (type && !isInputType(type)) {
|
|
14
|
+
const varName = node.variable.name.value;
|
|
15
|
+
context.reportError(
|
|
16
|
+
new GraphQLError(
|
|
17
|
+
`Variable "$${varName}" cannot be non-input type "${print(node.type)}".`,
|
|
18
|
+
{ nodes: node.type }
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
VariablesAreInputTypesRule
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=VariablesAreInputTypesRule.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VariablesAreInputTypesRule.js","sources":["../../../../../../packages/graphql-json/src/validation/rules/VariablesAreInputTypesRule.ts"],"sourcesContent":["/**\n * Variables are input types\n *\n * A GraphQL operation is only valid if all the variables it defines are of\n * input types (scalar, enum, or input object).\n *\n * See https://spec.graphql.org/draft/#sec-Variables-Are-Input-Types\n */\nimport type { ASTVisitor, VariableDefinitionNode } from 'graphql'\nimport { GraphQLError, print } from 'graphql'\n\nimport { getNamedType } from '../../utils/typeRef.js'\nimport { getOwn } from '../../utils/helpers.js'\nimport { isInputType } from '../helpers.js'\nimport type { ValidationContext } from '../ValidationContext.js'\n\nexport function VariablesAreInputTypesRule(context: ValidationContext): ASTVisitor {\n\treturn {\n\t\tVariableDefinition(node: VariableDefinitionNode) {\n\t\t\tconst typeRef = context.getInputType()\n\n\t\t\tif (typeRef) {\n\t\t\t\tconst schema = context.getSchema()\n\t\t\t\tconst typeName = getNamedType(typeRef)\n\t\t\t\tconst type = getOwn(schema.t, typeName)\n\n\t\t\t\tif (type && !isInputType(type)) {\n\t\t\t\t\tconst varName = node.variable.name.value\n\t\t\t\t\tcontext.reportError(\n\t\t\t\t\t\tnew GraphQLError(\n\t\t\t\t\t\t\t`Variable \"$${varName}\" cannot be non-input type \"${print(node.type)}\".`,\n\t\t\t\t\t\t\t{ nodes: node.type },\n\t\t\t\t\t\t),\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t}\n}\n"],"names":[],"mappings":";;;;AAgBO,SAAS,2BAA2B,SAAwC;AAClF,SAAO;AAAA,IACN,mBAAmB,MAA8B;AAChD,YAAM,UAAU,QAAQ,aAAA;AAExB,UAAI,SAAS;AACZ,cAAM,SAAS,QAAQ,UAAA;AACvB,cAAM,WAAW,aAAa,OAAO;AACrC,cAAM,OAAO,OAAO,OAAO,GAAG,QAAQ;AAEtC,YAAI,QAAQ,CAAC,YAAY,IAAI,GAAG;AAC/B,gBAAM,UAAU,KAAK,SAAS,KAAK;AACnC,kBAAQ;AAAA,YACP,IAAI;AAAA,cACH,cAAc,OAAO,+BAA+B,MAAM,KAAK,IAAI,CAAC;AAAA,cACpE,EAAE,OAAO,KAAK,KAAA;AAAA,YAAK;AAAA,UACpB;AAAA,QAEF;AAAA,MACD;AAAA,IACD;AAAA,EAAA;AAEF;"}
|