diff --git a/.babelrc-deno.json b/.babelrc-deno.json new file mode 100644 index 00000000..0e173bfb --- /dev/null +++ b/.babelrc-deno.json @@ -0,0 +1,7 @@ +{ + "plugins": [ + "@babel/plugin-syntax-typescript", + ["./resources/add-extension-to-import-paths", { "extension": "ts" }], + "./resources/inline-invariant" + ] +} diff --git a/.babelrc-npm.json b/.babelrc-npm.json new file mode 100644 index 00000000..357c91db --- /dev/null +++ b/.babelrc-npm.json @@ -0,0 +1,27 @@ +{ + "plugins": [ + "@babel/plugin-transform-typescript", + "./resources/inline-invariant" + ], + "env": { + "cjs": { + "presets": [ + [ + "@babel/preset-env", + { "modules": "commonjs", "targets": { "node": "12" } } + ] + ], + "plugins": [ + ["./resources/add-extension-to-import-paths", { "extension": "js" }] + ] + }, + "mjs": { + "presets": [ + ["@babel/preset-env", { "modules": false, "targets": { "node": "12" } }] + ], + "plugins": [ + ["./resources/add-extension-to-import-paths", { "extension": "mjs" }] + ] + } + } +} diff --git a/.babelrc.json b/.babelrc.json new file mode 100644 index 00000000..caa5300a --- /dev/null +++ b/.babelrc.json @@ -0,0 +1,9 @@ +{ + "plugins": ["@babel/plugin-transform-typescript"], + "presets": [ + [ + "@babel/preset-env", + { "bugfixes": true, "targets": { "node": "current" } } + ] + ] +} diff --git a/.c8rc.json b/.c8rc.json new file mode 100644 index 00000000..22bb450e --- /dev/null +++ b/.c8rc.json @@ -0,0 +1,23 @@ +{ + "all": true, + "include": ["src/"], + "exclude": [ + "src/**/index.ts", + "src/**/*-fuzz.ts", + "src/jsutils/Maybe.ts", + "src/jsutils/ObjMap.ts", + "src/jsutils/PromiseOrValue.ts", + "src/utilities/assertValidName.ts", + "src/utilities/typedQueryDocumentNode.ts" + ], + "clean": true, + "temp-directory": "coverage", + "report-dir": "coverage", + "skip-full": true, + "reporter": ["json", "html", "text"], + "check-coverage": true, + "branches": 100, + "lines": 100, + "functions": 100, + "statements": 100 +} diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..a872ca6e --- /dev/null +++ b/.eslintignore @@ -0,0 +1,9 @@ +# Copied from '.gitignore', please keep it in sync. +/.eslintcache +/node_modules +/coverage +/npmDist +/denoDist + +# Ignore TS files inside integration test +/integrationTests/ts/*.ts diff --git a/.eslintrc.yml b/.eslintrc.yml new file mode 100644 index 00000000..6e21f0e9 --- /dev/null +++ b/.eslintrc.yml @@ -0,0 +1,693 @@ +parserOptions: + sourceType: script + ecmaVersion: 2020 +env: + es6: true + node: true +reportUnusedDisableDirectives: true +plugins: + - internal-rules + - node + - import + - simple-import-sort +settings: + node: + tryExtensions: ['.js', '.json', '.node', '.ts', '.d.ts'] + +rules: + ############################################################################## + # Internal rules located in 'resources/eslint-internal-rules'. + # See './resources/eslint-internal-rules/README.md' + ############################################################################## + + internal-rules/only-ascii: error + internal-rules/no-dir-import: error + internal-rules/require-to-string-tag: off + + ############################################################################## + # `eslint-plugin-node` rule list based on `v11.1.x` + ############################################################################## + + # Possible Errors + # https://github.com/mysticatea/eslint-plugin-node#possible-errors + + node/handle-callback-err: [error, error] + node/no-callback-literal: error + node/no-exports-assign: error + node/no-extraneous-import: error + node/no-extraneous-require: error + node/no-missing-import: error + node/no-missing-require: error + node/no-new-require: error + node/no-path-concat: error + node/no-process-exit: off + node/no-unpublished-bin: error + node/no-unpublished-import: error + node/no-unpublished-require: error + node/no-unsupported-features/es-builtins: error + node/no-unsupported-features/es-syntax: [error, { ignores: [modules] }] + node/no-unsupported-features/node-builtins: error + node/process-exit-as-throw: error + node/shebang: error + + # Best Practices + # https://github.com/mysticatea/eslint-plugin-node#best-practices + node/no-deprecated-api: error + + # Stylistic Issues + # https://github.com/mysticatea/eslint-plugin-node#stylistic-issues + + node/callback-return: error + node/exports-style: off # TODO consider + node/file-extension-in-import: off # TODO consider + node/global-require: error + node/no-mixed-requires: error + node/no-process-env: off + node/no-restricted-import: off + node/no-restricted-require: off + node/no-sync: error + node/prefer-global/buffer: error + node/prefer-global/console: error + node/prefer-global/process: error + node/prefer-global/text-decoder: error + node/prefer-global/text-encoder: error + node/prefer-global/url-search-params: error + node/prefer-global/url: error + node/prefer-promises/dns: off + node/prefer-promises/fs: off + + ############################################################################## + # `eslint-plugin-import` rule list based on `v2.25.x` + ############################################################################## + + # Static analysis + # https://github.com/benmosher/eslint-plugin-import#static-analysis + import/no-unresolved: error + import/named: error + import/default: error + import/namespace: error + import/no-restricted-paths: + - error + - basePath: './' + zones: + - { target: './src', from: 'src/__testUtils__' } + import/no-absolute-path: error + import/no-dynamic-require: error + import/no-internal-modules: off + import/no-webpack-loader-syntax: error + import/no-self-import: error + import/no-cycle: error + import/no-useless-path-segments: error + import/no-relative-parent-imports: off + import/no-relative-packages: off + + # Helpful warnings + # https://github.com/benmosher/eslint-plugin-import#helpful-warnings + import/export: error + import/no-named-as-default: error + import/no-named-as-default-member: error + import/no-deprecated: error + import/no-extraneous-dependencies: [error, { devDependencies: false }] + import/no-mutable-exports: error + import/no-unused-modules: error + + # Module systems + # https://github.com/benmosher/eslint-plugin-import#module-systems + import/unambiguous: error + import/no-commonjs: error + import/no-amd: error + import/no-nodejs-modules: error + import/no-import-module-exports: off + + # Style guide + # https://github.com/benmosher/eslint-plugin-import#style-guide + import/first: error + import/exports-last: off + import/no-duplicates: error + import/no-namespace: error + import/extensions: + - error + - ignorePackages + - ts: never # TODO: remove once TS supports extensions + import/order: [error, { newlines-between: always-and-inside-groups }] + import/newline-after-import: error + import/prefer-default-export: off + import/max-dependencies: off + import/no-unassigned-import: error + import/no-named-default: error + import/no-default-export: error + import/no-named-export: off + import/no-anonymous-default-export: error + import/group-exports: off + import/dynamic-import-chunkname: off + + ############################################################################## + # `eslint-plugin-simple-import-sort` rule list based on `v2.25.x` + # https://github.com/lydell/eslint-plugin-simple-import-sort + ############################################################################## + simple-import-sort/imports: + - error + - groups: + # Packages. + # Things that start with a letter (or digit or underscore), or `@` followed by a letter. + - ["^@?\\w"] + + # General utilities + - ["^(\\./|(\\.\\./)+)__testUtils__/"] + - ["^(\\./|(\\.\\./)+)jsutils/"] + + # Top-level directories + - ["^(\\./|(\\.\\./)+)error/"] + - ["^(\\./|(\\.\\./)+)language/"] + - ["^(\\./|(\\.\\./)+)type/"] + - ["^(\\./|(\\.\\./)+)validation/"] + - ["^(\\./|(\\.\\./)+)execution/"] + - ["^(\\./|(\\.\\./)+)utilities/"] + + # Relative imports. + # Anything that starts with a dot. + - ["^(\\.\\./){4,}"] + - ["^(\\.\\./){3}"] + - ["^(\\.\\./){2}"] + - ["^(\\.\\./){1}"] + - ["^\\./"] + simple-import-sort/exports: off # TODO + + ############################################################################## + # ESLint builtin rules list based on `v8.5.x` + ############################################################################## + + # Possible Errors + # https://eslint.org/docs/rules/#possible-errors + + for-direction: error + getter-return: error + no-async-promise-executor: error + no-await-in-loop: error + no-compare-neg-zero: error + no-cond-assign: error + no-console: warn + no-constant-condition: error + no-control-regex: error + no-debugger: warn + no-dupe-args: error + no-dupe-else-if: error + no-dupe-keys: error + no-duplicate-case: error + no-empty: error + no-empty-character-class: error + no-ex-assign: error + no-extra-boolean-cast: error + no-func-assign: error + no-import-assign: error + no-inner-declarations: [error, both] + no-invalid-regexp: error + no-irregular-whitespace: error + no-loss-of-precision: error + no-misleading-character-class: error + no-obj-calls: error + no-promise-executor-return: off # TODO + no-prototype-builtins: error + no-regex-spaces: error + no-setter-return: error + no-sparse-arrays: error + no-template-curly-in-string: error + no-unreachable: error + no-unreachable-loop: error + no-unsafe-finally: error + no-unsafe-negation: error + no-unsafe-optional-chaining: [error, { disallowArithmeticOperators: true }] + no-unused-private-class-members: error + no-useless-backreference: error + require-atomic-updates: error + use-isnan: error + valid-typeof: error + + # Best Practices + # https://eslint.org/docs/rules/#best-practices + + accessor-pairs: error + array-callback-return: error + block-scoped-var: error + class-methods-use-this: off + complexity: off + consistent-return: off + curly: error + default-case: off + default-case-last: error + default-param-last: error + dot-notation: error + eqeqeq: [error, smart] + grouped-accessor-pairs: error + guard-for-in: error + max-classes-per-file: off + no-alert: error + no-caller: error + no-case-declarations: error + no-constructor-return: error + no-div-regex: error + no-else-return: error + no-empty-function: error + no-empty-pattern: error + no-eq-null: off + no-eval: error + no-extend-native: error + no-extra-bind: error + no-extra-label: error + no-fallthrough: error + no-global-assign: error + no-implicit-coercion: error + no-implicit-globals: off + no-implied-eval: error + no-invalid-this: error + no-iterator: error + no-labels: error + no-lone-blocks: error + no-loop-func: error + no-magic-numbers: off + no-multi-str: error + no-new: error + no-new-func: error + no-new-wrappers: error + no-nonoctal-decimal-escape: error + no-octal: error + no-octal-escape: error + no-param-reassign: error + no-proto: error + no-redeclare: error + no-restricted-properties: off + no-return-assign: error + no-return-await: error + no-script-url: error + no-self-assign: error + no-self-compare: off # TODO + no-sequences: error + no-throw-literal: error + no-unmodified-loop-condition: error + no-unused-expressions: error + no-unused-labels: error + no-useless-call: error + no-useless-catch: error + no-useless-concat: error + no-useless-escape: error + no-useless-return: error + no-void: error + no-warning-comments: off + no-with: error + prefer-named-capture-group: off # ES2018 + prefer-promise-reject-errors: error + prefer-regex-literals: error + radix: error + require-await: error + require-unicode-regexp: off + vars-on-top: error + yoda: [error, never, { exceptRange: true }] + + # Strict Mode + # https://eslint.org/docs/rules/#strict-mode + + strict: error + + # Variables + # https://eslint.org/docs/rules/#variables + + init-declarations: off + no-delete-var: error + no-label-var: error + no-restricted-globals: off + no-shadow: error + no-shadow-restricted-names: error + no-undef: error + no-undef-init: error + no-undefined: off + no-unused-vars: [error, { vars: all, args: all, argsIgnorePattern: '^_' }] + no-use-before-define: off + + # Stylistic Issues + # https://eslint.org/docs/rules/#stylistic-issues + + camelcase: error + capitalized-comments: off # maybe + consistent-this: off + func-name-matching: off + func-names: [error, as-needed] # improve debug experience + func-style: off + id-denylist: off + id-length: off + id-match: [error, '^(?:_?[a-zA-Z0-9]*)|[_A-Z0-9]+$'] + line-comment-position: off + lines-around-comment: off + lines-between-class-members: [error, always, { exceptAfterSingleLine: true }] + max-depth: off + max-lines: off + max-lines-per-function: off + max-nested-callbacks: off + max-params: off + max-statements: off + max-statements-per-line: off + multiline-comment-style: off + new-cap: error + no-array-constructor: error + no-bitwise: off + no-continue: off + no-inline-comments: off + no-lonely-if: error + no-multi-assign: off + no-negated-condition: off + no-nested-ternary: off + no-new-object: error + no-plusplus: off + no-restricted-syntax: off + no-tabs: error + no-ternary: off + no-underscore-dangle: off # TODO + no-unneeded-ternary: error + one-var: [error, never] + operator-assignment: error + padding-line-between-statements: off + prefer-exponentiation-operator: error + prefer-object-spread: error + quotes: [error, single, { avoidEscape: true }] + sort-keys: off + sort-vars: off + spaced-comment: error + + # ECMAScript 6 + # https://eslint.org/docs/rules/#ecmascript-6 + + arrow-body-style: error + constructor-super: error + no-class-assign: error + no-const-assign: error + no-dupe-class-members: error + no-duplicate-imports: off # Superseded by `import/no-duplicates` + no-new-symbol: error + no-restricted-exports: off + no-restricted-imports: off + no-this-before-super: error + no-useless-computed-key: error + no-useless-constructor: error + no-useless-rename: error + no-var: error + object-shorthand: error + prefer-arrow-callback: error + prefer-const: error + prefer-destructuring: off + prefer-numeric-literals: error + prefer-object-has-own: off # TODO requires Node.js v16.9.0 + prefer-rest-params: off # TODO + prefer-spread: error + prefer-template: off + require-yield: error + sort-imports: off + symbol-description: off + + # Bellow rules are disabled because coflicts with Prettier, see: + # https://github.com/prettier/eslint-config-prettier/blob/master/index.js + array-bracket-newline: off + array-bracket-spacing: off + array-element-newline: off + arrow-parens: off + arrow-spacing: off + block-spacing: off + brace-style: off + comma-dangle: off + comma-spacing: off + comma-style: off + computed-property-spacing: off + dot-location: off + eol-last: off + func-call-spacing: off + function-call-argument-newline: off + function-paren-newline: off + generator-star-spacing: off + implicit-arrow-linebreak: off + indent: off + jsx-quotes: off + key-spacing: off + keyword-spacing: off + linebreak-style: off + max-len: off + multiline-ternary: off + newline-per-chained-call: off + new-parens: off + no-confusing-arrow: off + no-extra-parens: off + no-extra-semi: off + no-floating-decimal: off + no-mixed-operators: off + no-mixed-spaces-and-tabs: off + no-multi-spaces: off + no-multiple-empty-lines: off + no-trailing-spaces: off + no-unexpected-multiline: off + no-whitespace-before-property: off + nonblock-statement-body-position: off + object-curly-newline: off + object-curly-spacing: off + object-property-newline: off + one-var-declaration-per-line: off + operator-linebreak: off + padded-blocks: off + quote-props: off + rest-spread-spacing: off + semi: off + semi-spacing: off + semi-style: off + space-before-blocks: off + space-before-function-paren: off + space-in-parens: off + space-infix-ops: off + space-unary-ops: off + switch-colon-spacing: off + template-curly-spacing: off + template-tag-spacing: off + unicode-bom: off + wrap-iife: off + wrap-regex: off + yield-star-spacing: off + +overrides: + - files: '**/*.ts' + parser: '@typescript-eslint/parser' + parserOptions: + sourceType: module + project: ['tsconfig.json'] + plugins: + - '@typescript-eslint' + - 'eslint-plugin-tsdoc' + extends: + - plugin:import/typescript + rules: + ########################################################################## + # `eslint-plugin-tsdoc` rule list based on `v0.2.x` + # https://github.com/microsoft/tsdoc/tree/master/eslint-plugin + ########################################################################## + + tsdoc/syntax: error + + ########################################################################## + # `@typescript-eslint/eslint-plugin` rule list based on `v5.8.x` + ########################################################################## + + # Supported Rules + # https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules + '@typescript-eslint/adjacent-overload-signatures': error + '@typescript-eslint/array-type': [error, { default: generic }] + '@typescript-eslint/await-thenable': error + '@typescript-eslint/ban-ts-comment': [error, { 'ts-expect-error': false }] + '@typescript-eslint/ban-tslint-comment': error + '@typescript-eslint/ban-types': off # TODO temporarily disabled + '@typescript-eslint/class-literal-property-style': off # TODO enable after TS conversion + '@typescript-eslint/consistent-indexed-object-style': + [error, index-signature] + '@typescript-eslint/consistent-type-assertions': off # TODO temporarily disable + '@typescript-eslint/consistent-type-definitions': error + '@typescript-eslint/consistent-type-exports': error + '@typescript-eslint/consistent-type-imports': error + '@typescript-eslint/explicit-function-return-type': off # TODO consider + '@typescript-eslint/explicit-member-accessibility': off # TODO consider + '@typescript-eslint/explicit-module-boundary-types': off # TODO consider + '@typescript-eslint/member-ordering': error + '@typescript-eslint/method-signature-style': error + '@typescript-eslint/naming-convention': off # TODO consider + '@typescript-eslint/no-base-to-string': error + '@typescript-eslint/no-confusing-non-null-assertion': error + '@typescript-eslint/no-confusing-void-expression': off # TODO enable with ignoreArrowShorthand + '@typescript-eslint/no-dynamic-delete': off + '@typescript-eslint/no-empty-interface': error + '@typescript-eslint/no-explicit-any': off # TODO error + '@typescript-eslint/no-extra-non-null-assertion': error + '@typescript-eslint/no-extraneous-class': off # TODO consider + '@typescript-eslint/no-floating-promises': error + '@typescript-eslint/no-for-in-array': error + '@typescript-eslint/no-implicit-any-catch': off # TODO: Enable after TS conversion + '@typescript-eslint/no-implied-eval': error + '@typescript-eslint/no-inferrable-types': + [error, { ignoreParameters: true, ignoreProperties: true }] + '@typescript-eslint/no-misused-new': error + '@typescript-eslint/no-misused-promises': error + '@typescript-eslint/no-namespace': error + '@typescript-eslint/no-non-null-asserted-nullish-coalescing': error + '@typescript-eslint/no-non-null-asserted-optional-chain': error + '@typescript-eslint/no-non-null-assertion': error + '@typescript-eslint/no-parameter-properties': error + '@typescript-eslint/no-invalid-void-type': error + '@typescript-eslint/no-require-imports': error + '@typescript-eslint/no-this-alias': error + '@typescript-eslint/no-type-alias': off # TODO consider + '@typescript-eslint/no-unnecessary-boolean-literal-compare': error + '@typescript-eslint/no-unnecessary-condition': off # TODO temporary disable + '@typescript-eslint/no-unnecessary-qualifier': error + '@typescript-eslint/no-unnecessary-type-arguments': error + '@typescript-eslint/no-unnecessary-type-assertion': error + '@typescript-eslint/no-unnecessary-type-constraint': error + '@typescript-eslint/no-unsafe-argument': off # TODO consider + '@typescript-eslint/no-unsafe-assignment': off # TODO consider + '@typescript-eslint/no-unsafe-call': off # TODO consider + '@typescript-eslint/no-unsafe-member-access': off # TODO consider + '@typescript-eslint/no-unsafe-return': off # TODO consider + '@typescript-eslint/no-var-requires': error + '@typescript-eslint/non-nullable-type-assertion-style': off #TODO temporarily disabled + '@typescript-eslint/prefer-as-const': error + '@typescript-eslint/prefer-enum-initializers': error + '@typescript-eslint/prefer-for-of': error + '@typescript-eslint/prefer-function-type': error + '@typescript-eslint/prefer-includes': error + '@typescript-eslint/prefer-literal-enum-member': error + '@typescript-eslint/prefer-namespace-keyword': error + '@typescript-eslint/prefer-nullish-coalescing': error + '@typescript-eslint/prefer-optional-chain': error + '@typescript-eslint/prefer-readonly': off + '@typescript-eslint/prefer-readonly-parameter-types': off # TODO consider + '@typescript-eslint/prefer-reduce-type-parameter': error + '@typescript-eslint/prefer-regexp-exec': off + '@typescript-eslint/prefer-return-this-type': error + '@typescript-eslint/prefer-string-starts-ends-with': error + '@typescript-eslint/prefer-ts-expect-error': error + '@typescript-eslint/promise-function-async': off + '@typescript-eslint/require-array-sort-compare': error + '@typescript-eslint/restrict-plus-operands': off #TODO temporarily disabled + '@typescript-eslint/restrict-template-expressions': off #TODO temporarily disabled + '@typescript-eslint/sort-type-union-intersection-members': off # TODO consider + '@typescript-eslint/strict-boolean-expressions': off # TODO consider + '@typescript-eslint/switch-exhaustiveness-check': error + '@typescript-eslint/triple-slash-reference': error + '@typescript-eslint/typedef': off + '@typescript-eslint/unbound-method': off # TODO consider + '@typescript-eslint/unified-signatures': error + + # Extension Rules + # https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#extension-rules + + # Disable conflicting ESLint rules and enable TS-compatible ones + default-param-last: off + dot-notation: off + lines-between-class-members: off + no-array-constructor: off + no-dupe-class-members: off + no-empty-function: off + no-invalid-this: off + no-loop-func: off + no-loss-of-precision: off + no-redeclare: off + no-throw-literal: off + no-shadow: off + no-unused-expressions: off + no-unused-vars: off + no-useless-constructor: off + require-await: off + no-return-await: off + '@typescript-eslint/default-param-last': error + '@typescript-eslint/dot-notation': error + '@typescript-eslint/lines-between-class-members': + [error, always, { exceptAfterSingleLine: true }] + '@typescript-eslint/no-array-constructor': error + '@typescript-eslint/no-dupe-class-members': error + '@typescript-eslint/no-empty-function': error + '@typescript-eslint/no-invalid-this': error + '@typescript-eslint/no-loop-func': error + '@typescript-eslint/no-loss-of-precision': error + '@typescript-eslint/no-redeclare': error + '@typescript-eslint/no-throw-literal': error # TODO [error, { allowThrowingAny: false, allowThrowingUnknown: false }] + '@typescript-eslint/no-shadow': error + '@typescript-eslint/no-unused-expressions': error + '@typescript-eslint/no-unused-vars': + [ + error, + { + vars: all, + args: all, + argsIgnorePattern: '^_', + varsIgnorePattern: '^_T', + }, + ] + '@typescript-eslint/no-useless-constructor': error + '@typescript-eslint/require-await': error + '@typescript-eslint/return-await': error + + # Disable for JS and TS + '@typescript-eslint/init-declarations': off + '@typescript-eslint/no-magic-numbers': off + '@typescript-eslint/no-restricted-imports': off + '@typescript-eslint/no-use-before-define': off + '@typescript-eslint/no-duplicate-imports': off # Superseded by `import/no-duplicates` + + # Below rules are disabled because they conflict with Prettier, see: + # https://github.com/prettier/eslint-config-prettier/blob/main/index.js + '@typescript-eslint/object-curly-spacing': off + '@typescript-eslint/quotes': off + '@typescript-eslint/brace-style': off + '@typescript-eslint/comma-dangle': off + '@typescript-eslint/comma-spacing': off + '@typescript-eslint/func-call-spacing': off + '@typescript-eslint/indent': off + '@typescript-eslint/keyword-spacing': off + '@typescript-eslint/member-delimiter-style': off + '@typescript-eslint/no-extra-parens': off + '@typescript-eslint/no-extra-semi': off + '@typescript-eslint/semi': off + '@typescript-eslint/space-before-function-paren': off + '@typescript-eslint/space-infix-ops': off + '@typescript-eslint/type-annotation-spacing': off + - files: 'src/**' + rules: + internal-rules/require-to-string-tag: error + - files: 'src/**/__*__/**' + rules: + internal-rules/require-to-string-tag: off + node/no-unpublished-import: [error, { allowModules: ['chai', 'mocha'] }] + import/no-deprecated: off + import/no-restricted-paths: off + import/no-extraneous-dependencies: [error, { devDependencies: true }] + - files: 'integrationTests/*' + rules: + node/no-sync: off + node/no-unpublished-require: [error, { allowModules: ['mocha'] }] + import/no-extraneous-dependencies: [error, { devDependencies: true }] + import/no-nodejs-modules: off + - files: 'integrationTests/*/**' + rules: + node/no-sync: off + node/no-missing-require: [error, { allowModules: ['graphql'] }] + import/no-commonjs: off + import/no-nodejs-modules: off + no-console: off + - files: 'benchmark/**' + rules: + internal-rules/only-ascii: [error, { allowEmoji: true }] + node/no-sync: off + node/no-missing-require: off + import/no-nodejs-modules: off + import/no-commonjs: off + no-console: off + no-await-in-loop: off + - files: 'resources/**' + rules: + internal-rules/only-ascii: [error, { allowEmoji: true }] + node/no-unpublished-require: off + node/no-sync: off + import/no-extraneous-dependencies: [error, { devDependencies: true }] + import/no-nodejs-modules: off + import/no-commonjs: off + no-console: off diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 00000000..d935f6d4 --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,101 @@ +# Contributing to graphql-js + +We want to make contributing to this project as easy and transparent as +possible. Hopefully this document makes the process for contributing clear and +answers any questions you may have. If not, feel free to open an +[Issue](https://github.com/graphql/graphql-spec/issues/). + +## Issues + +We use GitHub issues to track public bugs and requests. Please ensure your bug +description is clear and has sufficient instructions to be able to reproduce the +issue. The best way is to provide a reduced test case on jsFiddle or jsBin. + +## Pull Requests + +All active development of graphql-js happens on GitHub. We actively welcome +your [pull requests](https://help.github.com/articles/creating-a-pull-request). + +### Considered Changes + +Since graphql-js is a reference implementation of the +[GraphQL spec](https://graphql.github.io/graphql-spec/), only changes which comply +with this spec will be considered. If you have a change in mind which requires a +change to the spec, please first open an +[issue](https://github.com/graphql/graphql-spec/issues/) against the spec. + +### GraphQL Specification Membership Agreement + +This repository is managed by EasyCLA. Project participants must sign the free ([GraphQL Specification Membership agreement](https://preview-spec-membership.graphql.org) before making a contribution. You only need to do this one time, and it can be signed by [individual contributors](http://individual-spec-membership.graphql.org/) or their [employers](http://corporate-spec-membership.graphql.org/). + +To initiate the signature process please open a PR against this repo. The EasyCLA bot will block the merge if we still need a membership agreement from you. + +You can find [detailed information here](https://github.com/graphql/graphql-wg/tree/main/membership). If you have issues, please email [operations@graphql.org](mailto:operations@graphql.org). + +If your company benefits from GraphQL and you would like to provide essential financial support for the systems and people that power our community, please also consider membership in the [GraphQL Foundation](https://foundation.graphql.org/join). + +### Getting Started + +1. Fork this repo by using the "Fork" button in the upper-right + +2. Check out your fork + + ```sh + git clone git@github.com:your_name_here/graphql-js.git + ``` + +3. Install or Update all dependencies + + ```sh + npm install + ``` + +4. Get coding! If you've added code, add tests. If you've changed APIs, update + any relevant documentation or tests. Ensure your work is committed within a + feature branch. + +5. Ensure all tests pass + + ```sh + npm test + ``` + +## Coding Style + +This project uses [Prettier](https://prettier.io/) for standard formatting. To +ensure your pull request matches the style guides, run `npm run prettier`. + +- 2 spaces for indentation (no tabs) +- 80 character line length strongly preferred. +- Prefer `'` over `"` +- ES6 syntax when possible. However do not rely on ES6-specific functions to be available. +- Use [TypeScript](https://www.typescriptlang.org). +- Use semicolons; +- Trailing commas, +- Avd abbr wrds. + +## Release on NPM + +_Only core contributors may release to NPM._ + +To release a new version on NPM, first ensure all tests pass with `npm test`, +then use `npm version patch|minor|major` in order to increment the version in +package.json and tag and commit a release. Then `git push && git push --tags` +to sync this change with source control. Then `npm publish npmDist` to actually +publish the release to NPM. +Once published, add [release notes](https://github.com/graphql/graphql-js/tags). +Use [semver](https://semver.org/) to determine which version part to increment. + +Example for a patch release: + +```sh +npm test +npm version patch +git push --follow-tags +npm publish npmDist +``` + +## License + +By contributing to graphql-js, you agree that your contributions will be +licensed under its [MIT license](../LICENSE). diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 00000000..d8236318 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,21 @@ +# Questions regarding how to use GraphQL + +We want to keep signal strong in the GitHub issue tracker – to make sure that it remains the best place to track bugs and features that affect development. + +If you have a question on how to use GraphQL, please [post it to Stack Overflow](https://stackoverflow.com/questions/ask?tags=graphql) with the tag [#graphql](https://stackoverflow.com/questions/tagged/graphql). + +Please do not post general questions directly as GitHub issues. They may sit for weeks unanswered, or may be spontaneously closed without answer. + +# Reporting issues with GraphQL.js + +Before filing a new issue, make sure an issue for your problem doesn't already exist. + +The best way to get a bug fixed is to provide a _pull request_ with a simplified failing test case (or better yet, include a fix). + +# Feature requests + +GraphQL.js is a reference implementation of the [GraphQL specification](https://github.com/graphql/graphql-spec). To discuss new features which are not GraphQL.js specific and fundamentally change the way GraphQL works, open an issue against the specification. + +# Security bugs + +Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe disclosure of security bugs. With that in mind, please do not file public issues; go through the process outlined on that page. diff --git a/.github/actions/deploy-dir-as-branch/action.yml b/.github/actions/deploy-dir-as-branch/action.yml new file mode 100644 index 00000000..0910ca75 --- /dev/null +++ b/.github/actions/deploy-dir-as-branch/action.yml @@ -0,0 +1,52 @@ +name: 'Deploy specified directory as a branch' +description: 'This action deploys directory as branch.' +inputs: + src_dir: + required: true + target_branch: + required: true +runs: + using: 'composite' + steps: + - name: Creating temporary directory to clone the branch + shell: bash + run: | + BRANCH_DIR=$(mktemp -d "`pwd`/cloned_${{ inputs.target_branch }}_XXXXXX") + echo "BRANCH_DIR=$BRANCH_DIR" >> $GITHUB_ENV + + - name: Checkout `${{ inputs.target_branch }}` branch + uses: actions/checkout@v2 + with: + ref: ${{ inputs.target_branch }} + path: ${{ env.BRANCH_DIR }} + + - name: Publish `${{ inputs.target_branch }}` branch + working-directory: ${{ env.BRANCH_DIR }} + shell: bash + run: | + echo '::echo::on' + + echo '::group::Remove existing files first' + git rm -r . + echo '::endgroup::' + + echo '::group::Move necessary files' + cp -vnR '${{ github.workspace }}/${{ inputs.src_dir }}/.' . + echo '::endgroup::' + + git add -A + if git diff --staged --quiet; then + echo 'Nothing to publish' + else + git config user.name 'GitHub Action Script' + git config user.email 'please@open.issue' + + git commit -a -m 'Deploy ${{ github.sha }} to '${{ inputs.target_branch }}' branch' + git push + echo 'Pushed' + fi + + - name: Remove cloned branch + if: ${{ always() }} + shell: bash + run: 'rm -rf $BRANCH_DIR' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..f8f6b196 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,300 @@ +name: CI +on: [push, pull_request] +env: + NODE_VERSION_USED_FOR_DEVELOPMENT: 17 +jobs: + lint: + name: Lint source files + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + cache: npm + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} + + - name: Install Dependencies + run: npm ci --ignore-scripts + + - name: Lint ESLint + run: npm run lint + + - name: Check Types + run: npm run check + + - name: Lint Prettier + run: npm run prettier:check + + - name: Spellcheck + run: npm run check:spelling + + checkForCommonlyIgnoredFiles: + name: Check for commonly ignored files + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Check if commit contains files that should be ignored + run: | + git clone --depth 1 https://github.com/github/gitignore.git && + cat gitignore/Node.gitignore $(find gitignore/Global -name "*.gitignore" | grep -v ModelSim) > all.gitignore && + if [[ "$(git ls-files -iX all.gitignore)" != "" ]]; then + echo "::error::Please remove these files:" + git ls-files -iX all.gitignore + exit 1 + fi + + checkPackageLock: + name: Check health of package-lock.json file + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + cache: npm + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} + + - name: Install Dependencies + run: npm ci --ignore-scripts + + - name: Check that package-lock.json doesn't have conflicts + run: npm ls --depth 999 + + - name: Run npm install + run: npm install --force --package-lock-only --ignore-scripts --engine-strict --strict-peer-deps + + - name: Check that package-lock.json is in sync with package.json + run: git diff --exit-code package-lock.json + + integrationTests: + name: Run integration tests + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} + # We install bunch of packages during integration tests without locking them + # so we skip cache action to not pollute cache for other jobs. + + - name: Install Dependencies + run: npm ci --ignore-scripts + + - name: Run Integration Tests + run: npm run check:integrations + + fuzz: + name: Run fuzzing tests + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + cache: npm + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} + + - name: Install Dependencies + run: npm ci --ignore-scripts + + - name: Run Tests + run: npm run fuzzonly + + coverage: + name: Measure test coverage + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + cache: npm + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} + + - name: Install Dependencies + run: npm ci --ignore-scripts + + - name: Run tests and measure code coverage + run: npm run testonly:cover + + - name: Upload coverage to Codecov + if: ${{ always() }} + uses: codecov/codecov-action@v1 + with: + file: ./coverage/coverage-final.json + fail_ci_if_error: true + + test: + name: Run tests on Node v${{ matrix.node_version_to_setup }} + runs-on: ubuntu-latest + strategy: + matrix: + node_version_to_setup: [12, 14, 16, 17] + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Node.js v${{ matrix.node_version_to_setup }} + uses: actions/setup-node@v2 + with: + cache: npm + node-version: ${{ matrix.node_version_to_setup }} + + - name: Install Dependencies + run: npm ci --ignore-scripts + + - name: Run Tests + run: npm run testonly + + benchmark: + name: Run benchmark + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Deepen cloned repo + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + run: 'git fetch --depth=1 origin $BASE_SHA:refs/tags/BASE' + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + cache: npm + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} + + - name: Install Dependencies + run: npm ci --ignore-scripts + + - name: Run Benchmark + run: 'npm run benchmark -- --revs HEAD BASE' + + diff-npm-package: + name: Diff content of NPM package + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Deepen cloned repo + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + run: 'git fetch --depth=1 origin $BASE_SHA:refs/tags/BASE' + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + cache: npm + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} + + - name: Install Dependencies + run: npm ci --ignore-scripts + + - name: Generate report + run: 'node resources/diff-npm-package.js BASE HEAD' + + - name: Upload generated report + uses: actions/upload-artifact@v2 + with: + name: npm-dist-diff.html + path: ./npm-dist-diff.html + if-no-files-found: ignore + + deploy-to-npm-branch: + name: Deploy to `npm` branch + runs-on: ubuntu-latest + if: | + github.event_name == 'push' && + github.repository == 'graphql/graphql-js' && + github.ref == 'refs/heads/main' + needs: [test, fuzz, lint, checkForCommonlyIgnoredFiles, integrationTests] + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + cache: npm + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} + + - name: Install Dependencies + run: npm ci --ignore-scripts + + - name: Build NPM package + run: npm run build:npm + + - name: Deploy to `npm` branch + uses: ./.github/actions/deploy-dir-as-branch + with: + src_dir: npmDist + target_branch: npm + + deploy-to-deno-branch: + name: Deploy to `deno` branch + runs-on: ubuntu-latest + if: | + github.event_name == 'push' && + github.repository == 'graphql/graphql-js' && + github.ref == 'refs/heads/main' + needs: [test, fuzz, lint, checkForCommonlyIgnoredFiles, integrationTests] + steps: + - name: Checkout repo + uses: actions/checkout@v2 + with: + persist-credentials: false + + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + cache: npm + node-version: ${{ env.NODE_VERSION_USED_FOR_DEVELOPMENT }} + + - name: Install Dependencies + run: npm ci --ignore-scripts + + - name: Build Deno package + run: npm run build:deno + + - name: Deploy to `deno` branch + uses: ./.github/actions/deploy-dir-as-branch + with: + src_dir: denoDist + target_branch: deno diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..69b0985a --- /dev/null +++ b/.gitignore @@ -0,0 +1,14 @@ +# This .gitignore only ignores files specific to this repository. +# If you see other files generated by your OS or tools you use, consider +# creating a global .gitignore file. +# +# https://help.github.com/articles/ignoring-files/#create-a-global-gitignore +# https://www.gitignore.io/ + +/diff-npm-package.html +/.eslintcache +/.cspellcache +/node_modules +/coverage +/npmDist +/denoDist diff --git a/.mocharc.yml b/.mocharc.yml new file mode 100644 index 00000000..5050fbe4 --- /dev/null +++ b/.mocharc.yml @@ -0,0 +1,7 @@ +fail-zero: true +throw-deprecation: true +check-leaks: true +require: + - 'resources/ts-register.js' +extension: + - 'ts' diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 00000000..07b1fbef --- /dev/null +++ b/.prettierignore @@ -0,0 +1,7 @@ +# Copied from '.gitignore', please keep it in sync. +/diff-npm-package.html +/.eslintcache +/node_modules +/coverage +/npmDist +/denoDist diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..a20502b7 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "singleQuote": true, + "trailingComma": "all" +} diff --git a/LICENSE b/LICENSE new file mode 100644 index 00000000..7bbf892a --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) GraphQL Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 00000000..34753472 --- /dev/null +++ b/README.md @@ -0,0 +1,158 @@ +# GraphQL.js + +The JavaScript reference implementation for GraphQL, a query language for APIs created by Facebook. + +[![npm version](https://badge.fury.io/js/graphql.svg)](https://badge.fury.io/js/graphql) +[![Build Status](https://github.com/graphql/graphql-js/workflows/CI/badge.svg?branch=main)](https://github.com/graphql/graphql-js/actions?query=branch%3Amain) +[![Coverage Status](https://codecov.io/gh/graphql/graphql-js/branch/main/graph/badge.svg)](https://codecov.io/gh/graphql/graphql-js) + +See more complete documentation at https://graphql.org/ and +https://graphql.org/graphql-js/. + +Looking for help? Find resources [from the community](https://graphql.org/community/). + +## Getting Started + +A general overview of GraphQL is available in the +[README](https://github.com/graphql/graphql-spec/blob/main/README.md) for the +[Specification for GraphQL](https://github.com/graphql/graphql-spec). That overview +describes a simple set of GraphQL examples that exist as [tests](src/__tests__) +in this repository. A good way to get started with this repository is to walk +through that README and the corresponding tests in parallel. + +### Using GraphQL.js + +Install GraphQL.js from npm + +With npm: + +```sh +npm install --save graphql +``` + +or using yarn: + +```sh +yarn add graphql +``` + +GraphQL.js provides two important capabilities: building a type schema and +serving queries against that type schema. + +First, build a GraphQL type schema which maps to your codebase. + +```js +import { + graphql, + GraphQLSchema, + GraphQLObjectType, + GraphQLString, +} from 'graphql'; + +var schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'RootQueryType', + fields: { + hello: { + type: GraphQLString, + resolve() { + return 'world'; + }, + }, + }, + }), +}); +``` + +This defines a simple schema, with one type and one field, that resolves +to a fixed value. The `resolve` function can return a value, a promise, +or an array of promises. A more complex example is included in the top-level [tests](src/__tests__) directory. + +Then, serve the result of a query against that type schema. + +```js +var source = '{ hello }'; + +graphql({ schema, source }).then((result) => { + // Prints + // { + // data: { hello: "world" } + // } + console.log(result); +}); +``` + +This runs a query fetching the one field defined. The `graphql` function will +first ensure the query is syntactically and semantically valid before executing +it, reporting errors otherwise. + +```js +var source = '{ BoyHowdy }'; + +graphql({ schema, source }).then((result) => { + // Prints + // { + // errors: [ + // { message: 'Cannot query field BoyHowdy on RootQueryType', + // locations: [ { line: 1, column: 3 } ] } + // ] + // } + console.log(result); +}); +``` + +**Note**: Please don't forget to set `NODE_ENV=production` if you are running a production server. It will disable some checks that can be useful during development but will significantly improve performance. + +### Want to ride the bleeding edge? + +The `npm` branch in this repository is automatically maintained to be the last +commit to `main` to pass all tests, in the same form found on npm. It is +recommended to use builds deployed to npm for many reasons, but if you want to use +the latest not-yet-released version of graphql-js, you can do so by depending +directly on this branch: + +``` +npm install graphql@git://github.com/graphql/graphql-js.git#npm +``` + +### Experimental features + +Each release of GraphQL.js will be accompanied by an experimental release containing support for the `@defer` and `@stream` directive proposal. We are hoping to get community feedback on these releases before the proposal is accepted into the GraphQL specification. You can use this experimental release of GraphQL.js by adding the following to your project's `package.json` file. + +``` +"graphql": "experimental-stream-defer" +``` + +Community feedback on this experimental release is much appreciated and can be provided on the [issue created for this purpose](https://github.com/graphql/graphql-js/issues/2848). + +### Using in a Browser + +GraphQL.js is a general-purpose library and can be used both in a Node server +and in the browser. As an example, the [GraphiQL](https://github.com/graphql/graphiql/) +tool is built with GraphQL.js! + +Building a project using GraphQL.js with [webpack](https://webpack.js.org) or +[rollup](https://github.com/rollup/rollup) should just work and only include +the portions of the library you use. This works because GraphQL.js is distributed +with both CommonJS (`require()`) and ESModule (`import`) files. Ensure that any +custom build configurations look for `.mjs` files! + +### Contributing + +We actively welcome pull requests. Learn how to [contribute](./.github/CONTRIBUTING.md). + +This repository is managed by EasyCLA. Project participants must sign the free ([GraphQL Specification Membership agreement](https://preview-spec-membership.graphql.org) before making a contribution. You only need to do this one time, and it can be signed by [individual contributors](http://individual-spec-membership.graphql.org/) or their [employers](http://corporate-spec-membership.graphql.org/). + +To initiate the signature process please open a PR against this repo. The EasyCLA bot will block the merge if we still need a membership agreement from you. + +You can find [detailed information here](https://github.com/graphql/graphql-wg/tree/main/membership). If you have issues, please email [operations@graphql.org](mailto:operations@graphql.org). + +If your company benefits from GraphQL and you would like to provide essential financial support for the systems and people that power our community, please also consider membership in the [GraphQL Foundation](https://foundation.graphql.org/join). + +### Changelog + +Changes are tracked as [GitHub releases](https://github.com/graphql/graphql-js/releases). + +### License + +GraphQL.js is [MIT-licensed](./LICENSE). diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js new file mode 100644 index 00000000..9288d1f2 --- /dev/null +++ b/benchmark/benchmark.js @@ -0,0 +1,393 @@ +'use strict'; + +const os = require('os'); +const fs = require('fs'); +const path = require('path'); +const assert = require('assert'); +const cp = require('child_process'); + +const NS_PER_SEC = 1e9; +const LOCAL = 'local'; + +// The maximum time in seconds a benchmark is allowed to run before finishing. +const maxTime = 5; +// The minimum sample size required to perform statistical analysis. +const minSamples = 5; + +// Get the revisions and make things happen! +if (require.main === module) { + const { benchmarks, revisions } = getArguments(process.argv.slice(2)); + const benchmarkProjects = prepareBenchmarkProjects(revisions); + + runBenchmarks(benchmarks, benchmarkProjects).catch((error) => { + console.error(error); + process.exit(1); + }); +} + +function localDir(...paths) { + return path.join(__dirname, '..', ...paths); +} + +function exec(command, options = {}) { + const result = cp.execSync(command, { + encoding: 'utf-8', + stdio: ['inherit', 'pipe', 'inherit'], + ...options, + }); + return result?.trimEnd(); +} + +// Build a benchmark-friendly environment for the given revision +// and returns path to its 'dist' directory. +function prepareBenchmarkProjects(revisionList) { + const tmpDir = path.join(os.tmpdir(), 'graphql-js-benchmark'); + fs.rmSync(tmpDir, { recursive: true, force: true }); + fs.mkdirSync(tmpDir); + + const setupDir = path.join(tmpDir, 'setup'); + fs.mkdirSync(setupDir); + + return revisionList.map((revision) => { + console.log(`🍳 Preparing ${revision}...`); + const projectPath = path.join(setupDir, revision); + fs.rmSync(projectPath, { recursive: true, force: true }); + fs.mkdirSync(projectPath); + + fs.writeFileSync( + path.join(projectPath, 'package.json'), + '{ "private": true }', + ); + exec( + 'npm --quiet install --ignore-scripts ' + prepareNPMPackage(revision), + { cwd: projectPath }, + ); + exec(`cp -R ${localDir('benchmark')} ${projectPath}`); + + return { revision, projectPath }; + }); + + function prepareNPMPackage(revision) { + if (revision === LOCAL) { + const repoDir = localDir(); + const archivePath = path.join(tmpDir, 'graphql-local.tgz'); + fs.renameSync(buildNPMArchive(repoDir), archivePath); + return archivePath; + } + + // Returns the complete git hash for a given git revision reference. + const hash = exec(`git rev-parse "${revision}"`); + + const archivePath = path.join(tmpDir, `graphql-${hash}.tgz`); + if (fs.existsSync(archivePath)) { + return archivePath; + } + + const repoDir = path.join(tmpDir, hash); + fs.rmSync(repoDir, { recursive: true, force: true }); + fs.mkdirSync(repoDir); + exec(`git archive "${hash}" | tar -xC "${repoDir}"`); + exec('npm --quiet ci --ignore-scripts', { cwd: repoDir }); + fs.renameSync(buildNPMArchive(repoDir), archivePath); + fs.rmSync(repoDir, { recursive: true }); + return archivePath; + } + + function buildNPMArchive(repoDir) { + exec('npm --quiet run build:npm', { cwd: repoDir }); + + const distDir = path.join(repoDir, 'npmDist'); + const archiveName = exec(`npm --quiet pack ${distDir}`, { cwd: repoDir }); + return path.join(repoDir, archiveName); + } +} + +async function collectSamples(modulePath) { + const samples = []; + + // If time permits, increase sample size to reduce the margin of error. + const start = Date.now(); + while (samples.length < minSamples || (Date.now() - start) / 1e3 < maxTime) { + const { clocked, memUsed } = await sampleModule(modulePath); + assert(clocked > 0); + assert(memUsed > 0); + samples.push({ clocked, memUsed }); + } + return samples; +} + +// T-Distribution two-tailed critical values for 95% confidence. +// See http://www.itl.nist.gov/div898/handbook/eda/section3/eda3672.htm. +// prettier-ignore +const tTable = { + '1': 12.706, '2': 4.303, '3': 3.182, '4': 2.776, '5': 2.571, '6': 2.447, + '7': 2.365, '8': 2.306, '9': 2.262, '10': 2.228, '11': 2.201, '12': 2.179, + '13': 2.16, '14': 2.145, '15': 2.131, '16': 2.12, '17': 2.11, '18': 2.101, + '19': 2.093, '20': 2.086, '21': 2.08, '22': 2.074, '23': 2.069, '24': 2.064, + '25': 2.06, '26': 2.056, '27': 2.052, '28': 2.048, '29': 2.045, '30': 2.042, + infinity: 1.96, +}; + +// Computes stats on benchmark results. +function computeStats(samples) { + assert(samples.length > 1); + + // Compute the sample mean (estimate of the population mean). + let mean = 0; + let meanMemUsed = 0; + for (const { clocked, memUsed } of samples) { + mean += clocked; + meanMemUsed += memUsed; + } + mean /= samples.length; + meanMemUsed /= samples.length; + + // Compute the sample variance (estimate of the population variance). + let variance = 0; + for (const { clocked } of samples) { + variance += (clocked - mean) ** 2; + } + variance /= samples.length - 1; + + // Compute the sample standard deviation (estimate of the population standard deviation). + const sd = Math.sqrt(variance); + + // Compute the standard error of the mean (a.k.a. the standard deviation of the sampling distribution of the sample mean). + const sem = sd / Math.sqrt(samples.length); + + // Compute the degrees of freedom. + const df = samples.length - 1; + + // Compute the critical value. + const critical = tTable[df] || tTable.infinity; + + // Compute the margin of error. + const moe = sem * critical; + + // The relative margin of error (expressed as a percentage of the mean). + const rme = (moe / mean) * 100 || 0; + + return { + memPerOp: Math.floor(meanMemUsed), + ops: NS_PER_SEC / mean, + deviation: rme, + numSamples: samples.length, + }; +} + +function beautifyBenchmark(results) { + const nameMaxLen = maxBy(results, ({ name }) => name.length); + const opsTop = maxBy(results, ({ ops }) => ops); + const opsMaxLen = maxBy(results, ({ ops }) => beautifyNumber(ops).length); + const memPerOpMaxLen = maxBy( + results, + ({ memPerOp }) => beautifyBytes(memPerOp).length, + ); + + for (const result of results) { + printBench(result); + } + + function printBench(bench) { + const { name, memPerOp, ops, deviation, numSamples } = bench; + console.log( + ' ' + + nameStr() + + grey(' x ') + + opsStr() + + ' ops/sec ' + + grey('\xb1') + + deviationStr() + + cyan('%') + + grey(' x ') + + memPerOpStr() + + '/op' + + grey(' (' + numSamples + ' runs sampled)'), + ); + + function nameStr() { + const nameFmt = name.padEnd(nameMaxLen); + return ops === opsTop ? green(nameFmt) : nameFmt; + } + + function opsStr() { + const percent = ops / opsTop; + const colorFn = percent > 0.95 ? green : percent > 0.8 ? yellow : red; + return colorFn(beautifyNumber(ops).padStart(opsMaxLen)); + } + + function deviationStr() { + const colorFn = deviation > 5 ? red : deviation > 2 ? yellow : green; + return colorFn(deviation.toFixed(2)); + } + + function memPerOpStr() { + return beautifyBytes(memPerOp).padStart(memPerOpMaxLen); + } + } +} + +function beautifyBytes(bytes) { + const sizes = ['Bytes', 'KB', 'MB', 'GB']; + const i = Math.floor(Math.log2(bytes) / 10); + return beautifyNumber(bytes / 2 ** (i * 10)) + ' ' + sizes[i]; +} + +function beautifyNumber(num) { + return Number(num.toFixed(num > 100 ? 0 : 2)).toLocaleString(); +} + +function maxBy(array, fn) { + return Math.max(...array.map(fn)); +} + +// Prepare all revisions and run benchmarks matching a pattern against them. +async function runBenchmarks(benchmarks, benchmarkProjects) { + for (const benchmark of benchmarks) { + const results = []; + for (let i = 0; i < benchmarkProjects.length; ++i) { + const { revision, projectPath } = benchmarkProjects[i]; + const modulePath = path.join(projectPath, benchmark); + + if (i === 0) { + const { name } = await sampleModule(modulePath); + console.log('⏱ ' + name); + } + + try { + const samples = await collectSamples(modulePath); + + results.push({ + name: revision, + samples, + ...computeStats(samples), + }); + process.stdout.write(' ' + cyan(i + 1) + ' tests completed.\u000D'); + } catch (error) { + console.log(' ' + revision + ': ' + red(String(error))); + } + } + console.log('\n'); + + beautifyBenchmark(results); + console.log(''); + } +} + +function getArguments(argv) { + const revsIndex = argv.indexOf('--revs'); + const revisions = revsIndex === -1 ? [] : argv.slice(revsIndex + 1); + const benchmarks = revsIndex === -1 ? argv : argv.slice(0, revsIndex); + + switch (revisions.length) { + case 0: + revisions.unshift('HEAD'); + // fall through + case 1: { + revisions.unshift('local'); + + const assumeArgv = ['benchmark', ...benchmarks, '--revs', ...revisions]; + console.warn('Assuming you meant: ' + bold(assumeArgv.join(' '))); + break; + } + } + + if (benchmarks.length === 0) { + benchmarks.push(...findAllBenchmarks()); + } + + return { benchmarks, revisions }; +} + +function findAllBenchmarks() { + return fs + .readdirSync(localDir('benchmark'), { withFileTypes: true }) + .filter((dirent) => dirent.isFile()) + .map((dirent) => dirent.name) + .filter((name) => name.endsWith('-benchmark.js')) + .map((name) => path.join('benchmark', name)); +} + +function bold(str) { + return '\u001b[1m' + str + '\u001b[0m'; +} + +function red(str) { + return '\u001b[31m' + str + '\u001b[0m'; +} + +function green(str) { + return '\u001b[32m' + str + '\u001b[0m'; +} + +function yellow(str) { + return '\u001b[33m' + str + '\u001b[0m'; +} + +function cyan(str) { + return '\u001b[36m' + str + '\u001b[0m'; +} + +function grey(str) { + return '\u001b[90m' + str + '\u001b[0m'; +} + +function sampleModule(modulePath) { + const sampleCode = ` + const assert = require('assert'); + + assert(global.gc); + assert(process.send); + const module = require('${modulePath}'); + + clock(7, module.measure); // warm up + global.gc(); + process.nextTick(() => { + const memBaseline = process.memoryUsage().heapUsed; + const clocked = clock(module.count, module.measure); + process.send({ + name: module.name, + clocked: clocked / module.count, + memUsed: (process.memoryUsage().heapUsed - memBaseline) / module.count, + }); + }); + + // Clocks the time taken to execute a test per cycle (secs). + function clock(count, fn) { + const start = process.hrtime.bigint(); + for (let i = 0; i < count; ++i) { + fn(); + } + return Number(process.hrtime.bigint() - start); + } + `; + + return new Promise((resolve, reject) => { + const child = cp.spawn( + process.argv[0], + [ + '--no-concurrent-sweeping', + '--predictable', + '--expose-gc', + '--eval', + sampleCode, + ], + { + stdio: ['inherit', 'inherit', 'inherit', 'ipc'], + env: { NODE_ENV: 'production' }, + }, + ); + + let message; + let error; + + child.on('message', (msg) => (message = msg)); + child.on('error', (e) => (error = e)); + child.on('close', () => { + if (message) { + return resolve(message); + } + reject(error || new Error('Spawn process closed without error')); + }); + }); +} diff --git a/benchmark/buildASTSchema-benchmark.js b/benchmark/buildASTSchema-benchmark.js new file mode 100644 index 00000000..b578d71a --- /dev/null +++ b/benchmark/buildASTSchema-benchmark.js @@ -0,0 +1,16 @@ +'use strict'; + +const { parse } = require('graphql/language/parser.js'); +const { buildASTSchema } = require('graphql/utilities/buildASTSchema.js'); + +const { bigSchemaSDL } = require('./fixtures.js'); + +const schemaAST = parse(bigSchemaSDL); + +module.exports = { + name: 'Build Schema from AST', + count: 10, + measure() { + buildASTSchema(schemaAST, { assumeValid: true }); + }, +}; diff --git a/benchmark/buildClientSchema-benchmark.js b/benchmark/buildClientSchema-benchmark.js new file mode 100644 index 00000000..240c9ca1 --- /dev/null +++ b/benchmark/buildClientSchema-benchmark.js @@ -0,0 +1,13 @@ +'use strict'; + +const { buildClientSchema } = require('graphql/utilities/buildClientSchema.js'); + +const { bigSchemaIntrospectionResult } = require('./fixtures.js'); + +module.exports = { + name: 'Build Schema from Introspection', + count: 10, + measure() { + buildClientSchema(bigSchemaIntrospectionResult.data, { assumeValid: true }); + }, +}; diff --git a/benchmark/fixtures.js b/benchmark/fixtures.js new file mode 100644 index 00000000..d057a805 --- /dev/null +++ b/benchmark/fixtures.js @@ -0,0 +1,13 @@ +'use strict'; + +const fs = require('fs'); +const path = require('path'); + +exports.bigSchemaSDL = fs.readFileSync( + path.join(__dirname, 'github-schema.graphql'), + 'utf8', +); + +exports.bigSchemaIntrospectionResult = JSON.parse( + fs.readFileSync(path.join(__dirname, 'github-schema.json'), 'utf8'), +); diff --git a/benchmark/github-schema.graphql b/benchmark/github-schema.graphql new file mode 100644 index 00000000..7baa4239 --- /dev/null +++ b/benchmark/github-schema.graphql @@ -0,0 +1,20367 @@ +""" +Autogenerated input type of AcceptTopicSuggestion +""" +input AcceptTopicSuggestionInput { + """ + The Node ID of the repository. + """ + repositoryId: ID! + + """ + The name of the suggested topic. + """ + name: String! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of AcceptTopicSuggestion +""" +type AcceptTopicSuggestionPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The accepted topic. + """ + topic: Topic +} + +""" +Represents an object which can take actions on GitHub. Typically a User or Bot. +""" +interface Actor { + """ + A URL pointing to the actor's public avatar. + """ + avatarUrl( + """ + The size of the resulting square image. + """ + size: Int + ): URI! + + """ + The username of the actor. + """ + login: String! + + """ + The HTTP path for this actor. + """ + resourcePath: URI! + + """ + The HTTP URL for this actor. + """ + url: URI! +} + +""" +Autogenerated input type of AddAssigneesToAssignable +""" +input AddAssigneesToAssignableInput { + """ + The id of the assignable object to add assignees to. + """ + assignableId: ID! + + """ + The id of users to add as assignees. + """ + assigneeIds: [ID!]! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of AddAssigneesToAssignable +""" +type AddAssigneesToAssignablePayload { + """ + The item that was assigned. + """ + assignable: Assignable + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated input type of AddComment +""" +input AddCommentInput { + """ + The Node ID of the subject to modify. + """ + subjectId: ID! + + """ + The contents of the comment. + """ + body: String! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of AddComment +""" +type AddCommentPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The edge from the subject's comment connection. + """ + commentEdge: IssueCommentEdge + + """ + The subject + """ + subject: Node + + """ + The edge from the subject's timeline connection. + """ + timelineEdge: IssueTimelineItemEdge +} + +""" +Represents a 'added_to_project' event on a given issue or pull request. +""" +type AddedToProjectEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! +} + +""" +Autogenerated input type of AddLabelsToLabelable +""" +input AddLabelsToLabelableInput { + """ + The id of the labelable object to add labels to. + """ + labelableId: ID! + + """ + The ids of the labels to add. + """ + labelIds: [ID!]! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of AddLabelsToLabelable +""" +type AddLabelsToLabelablePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The item that was labeled. + """ + labelable: Labelable +} + +""" +Autogenerated input type of AddProjectCard +""" +input AddProjectCardInput { + """ + The Node ID of the ProjectColumn. + """ + projectColumnId: ID! + + """ + The content of the card. Must be a member of the ProjectCardItem union + """ + contentId: ID + + """ + The note on the card. + """ + note: String + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of AddProjectCard +""" +type AddProjectCardPayload { + """ + The edge from the ProjectColumn's card connection. + """ + cardEdge: ProjectCardEdge + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The ProjectColumn + """ + projectColumn: ProjectColumn +} + +""" +Autogenerated input type of AddProjectColumn +""" +input AddProjectColumnInput { + """ + The Node ID of the project. + """ + projectId: ID! + + """ + The name of the column. + """ + name: String! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of AddProjectColumn +""" +type AddProjectColumnPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The edge from the project's column connection. + """ + columnEdge: ProjectColumnEdge + + """ + The project + """ + project: Project +} + +""" +Autogenerated input type of AddPullRequestReviewComment +""" +input AddPullRequestReviewCommentInput { + """ + The Node ID of the review to modify. + """ + pullRequestReviewId: ID! + + """ + The SHA of the commit to comment on. + """ + commitOID: GitObjectID + + """ + The text of the comment. + """ + body: String! + + """ + The relative path of the file to comment on. + """ + path: String + + """ + The line index in the diff to comment on. + """ + position: Int + + """ + The comment id to reply to. + """ + inReplyTo: ID + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of AddPullRequestReviewComment +""" +type AddPullRequestReviewCommentPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The newly created comment. + """ + comment: PullRequestReviewComment + + """ + The edge from the review's comment connection. + """ + commentEdge: PullRequestReviewCommentEdge +} + +""" +Autogenerated input type of AddPullRequestReview +""" +input AddPullRequestReviewInput { + """ + The Node ID of the pull request to modify. + """ + pullRequestId: ID! + + """ + The commit OID the review pertains to. + """ + commitOID: GitObjectID + + """ + The contents of the review body comment. + """ + body: String + + """ + The event to perform on the pull request review. + """ + event: PullRequestReviewEvent + + """ + The review line comments. + """ + comments: [DraftPullRequestReviewComment] + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of AddPullRequestReview +""" +type AddPullRequestReviewPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The newly created pull request review. + """ + pullRequestReview: PullRequestReview + + """ + The edge from the pull request's review connection. + """ + reviewEdge: PullRequestReviewEdge +} + +""" +Autogenerated input type of AddReaction +""" +input AddReactionInput { + """ + The Node ID of the subject to modify. + """ + subjectId: ID! + + """ + The name of the emoji to react with. + """ + content: ReactionContent! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of AddReaction +""" +type AddReactionPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The reaction object. + """ + reaction: Reaction + + """ + The reactable subject. + """ + subject: Reactable +} + +""" +Autogenerated input type of AddStar +""" +input AddStarInput { + """ + The Starrable ID to star. + """ + starrableId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of AddStar +""" +type AddStarPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The starrable. + """ + starrable: Starrable +} + +""" +A GitHub App. +""" +type App implements Node { + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The description of the app. + """ + description: String + id: ID! + + """ + The hex color code, without the leading '#', for the logo background. + """ + logoBackgroundColor: String! + + """ + A URL pointing to the app's logo. + """ + logoUrl( + """ + The size of the resulting image. + """ + size: Int + ): URI! + + """ + The name of the app. + """ + name: String! + + """ + A slug based on the name of the app for use in URLs. + """ + slug: String! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The URL to the app's homepage. + """ + url: URI! +} + +""" +An edge in a connection. +""" +type AppEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: App +} + +""" +An object that can have users assigned to it. +""" +interface Assignable { + """ + A list of Users assigned to this object. + """ + assignees( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserConnection! +} + +""" +Represents an 'assigned' event on any assignable object. +""" +type AssignedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the assignable associated with the event. + """ + assignable: Assignable! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Identifies the user who was assigned. + """ + user: User +} + +""" +Represents a 'base_ref_changed' event on a given issue or pull request. +""" +type BaseRefChangedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! +} + +""" +Represents a 'base_ref_force_pushed' event on a given pull request. +""" +type BaseRefForcePushedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the after commit SHA for the 'base_ref_force_pushed' event. + """ + afterCommit: Commit + + """ + Identifies the before commit SHA for the 'base_ref_force_pushed' event. + """ + beforeCommit: Commit + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + PullRequest referenced by event. + """ + pullRequest: PullRequest! + + """ + Identifies the fully qualified ref name for the 'base_ref_force_pushed' event. + """ + ref: Ref +} + +""" +Represents a Git blame. +""" +type Blame { + """ + The list of ranges from a Git blame. + """ + ranges: [BlameRange!]! +} + +""" +Represents a range of information from a Git blame. +""" +type BlameRange { + """ + Identifies the recency of the change, from 1 (new) to 10 (old). This is + calculated as a 2-quantile and determines the length of distance between the + median age of all the changes in the file and the recency of the current + range's change. + """ + age: Int! + + """ + Identifies the line author + """ + commit: Commit! + + """ + The ending line for the range + """ + endingLine: Int! + + """ + The starting line for the range + """ + startingLine: Int! +} + +""" +Represents a Git blob. +""" +type Blob implements Node & GitObject { + """ + An abbreviated version of the Git object ID + """ + abbreviatedOid: String! + + """ + Byte size of Blob object + """ + byteSize: Int! + + """ + The HTTP path for this Git object + """ + commitResourcePath: URI! + + """ + The HTTP URL for this Git object + """ + commitUrl: URI! + id: ID! + + """ + Indicates whether the Blob is binary or text + """ + isBinary: Boolean! + + """ + Indicates whether the contents is truncated + """ + isTruncated: Boolean! + + """ + The Git object ID + """ + oid: GitObjectID! + + """ + The Repository the Git object belongs to + """ + repository: Repository! + + """ + UTF8 text data or null if the Blob is binary + """ + text: String +} + +""" +A special type of user which takes actions on behalf of GitHub Apps. +""" +type Bot implements Node & Actor & UniformResourceLocatable { + """ + A URL pointing to the GitHub App's public avatar. + """ + avatarUrl( + """ + The size of the resulting square image. + """ + size: Int + ): URI! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! + + """ + The username of the actor. + """ + login: String! + + """ + The HTTP path for this bot + """ + resourcePath: URI! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this bot + """ + url: URI! +} + +""" +A branch protection rule. +""" +type BranchProtectionRule implements Node { + """ + A list of conflicts matching branches protection rule and other branch protection rules + """ + branchProtectionRuleConflicts( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): BranchProtectionRuleConflictConnection! + + """ + The actor who created this branch protection rule. + """ + creator: Actor + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + Will new commits pushed to matching branches dismiss pull request review approvals. + """ + dismissesStaleReviews: Boolean! + id: ID! + + """ + Can admins overwrite branch protection. + """ + isAdminEnforced: Boolean! + + """ + Repository refs that are protected by this rule + """ + matchingRefs( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): RefConnection! + + """ + Identifies the protection rule pattern. + """ + pattern: String! + + """ + A list push allowances for this branch protection rule. + """ + pushAllowances( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PushAllowanceConnection! + + """ + The repository associated with this branch protection rule. + """ + repository: Repository + + """ + Number of approving reviews required to update matching branches. + """ + requiredApprovingReviewCount: Int + + """ + List of required status check contexts that must pass for commits to be accepted to matching branches. + """ + requiredStatusCheckContexts: [String] + + """ + Are approving reviews required to update matching branches. + """ + requiresApprovingReviews: Boolean! + + """ + Are commits required to be signed. + """ + requiresCommitSignatures: Boolean! + + """ + Are status checks required to update matching branches. + """ + requiresStatusChecks: Boolean! + + """ + Are branches required to be up to date before merging. + """ + requiresStrictStatusChecks: Boolean! + + """ + Is pushing to matching branches restricted. + """ + restrictsPushes: Boolean! + + """ + Is dismissal of pull request reviews restricted. + """ + restrictsReviewDismissals: Boolean! + + """ + A list review dismissal allowances for this branch protection rule. + """ + reviewDismissalAllowances( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): ReviewDismissalAllowanceConnection! +} + +""" +A conflict between two branch protection rules. +""" +type BranchProtectionRuleConflict { + """ + Identifies the branch protection rule. + """ + branchProtectionRule: BranchProtectionRule + + """ + Identifies the conflicting branch protection rule. + """ + conflictingBranchProtectionRule: BranchProtectionRule + + """ + Identifies the branch ref that has conflicting rules + """ + ref: Ref +} + +""" +The connection type for BranchProtectionRuleConflict. +""" +type BranchProtectionRuleConflictConnection { + """ + A list of edges. + """ + edges: [BranchProtectionRuleConflictEdge] + + """ + A list of nodes. + """ + nodes: [BranchProtectionRuleConflict] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type BranchProtectionRuleConflictEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: BranchProtectionRuleConflict +} + +""" +The connection type for BranchProtectionRule. +""" +type BranchProtectionRuleConnection { + """ + A list of edges. + """ + edges: [BranchProtectionRuleEdge] + + """ + A list of nodes. + """ + nodes: [BranchProtectionRule] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type BranchProtectionRuleEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: BranchProtectionRule +} + +""" +Autogenerated input type of ChangeUserStatus +""" +input ChangeUserStatusInput { + """ + The emoji to represent your status. Can either be a native Unicode emoji or an emoji name with colons, e.g., :grinning:. + """ + emoji: String + + """ + A short description of your current status. + """ + message: String + + """ + The ID of the organization whose members will be allowed to see the status. If + omitted, the status will be publicly visible. + """ + organizationId: ID + + """ + Whether this status should indicate you are not fully available on GitHub, e.g., you are away. + """ + limitedAvailability: Boolean = false + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of ChangeUserStatus +""" +type ChangeUserStatusPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + Your updated status. + """ + status: UserStatus +} + +""" +Autogenerated input type of ClearLabelsFromLabelable +""" +input ClearLabelsFromLabelableInput { + """ + The id of the labelable object to clear the labels from. + """ + labelableId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of ClearLabelsFromLabelable +""" +type ClearLabelsFromLabelablePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The item that was unlabeled. + """ + labelable: Labelable +} + +""" +Autogenerated input type of CloneProject +""" +input CloneProjectInput { + """ + The owner ID to create the project under. + """ + targetOwnerId: ID! + + """ + The source project to clone. + """ + sourceId: ID! + + """ + Whether or not to clone the source project's workflows. + """ + includeWorkflows: Boolean! + + """ + The name of the project. + """ + name: String! + + """ + The description of the project. + """ + body: String + + """ + The visibility of the project, defaults to false (private). + """ + public: Boolean + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of CloneProject +""" +type CloneProjectPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The id of the JobStatus for populating cloned fields. + """ + jobStatusId: String + + """ + The new cloned project. + """ + project: Project +} + +""" +An object that can be closed +""" +interface Closable { + """ + `true` if the object is closed (definition of closed may depend on type) + """ + closed: Boolean! + + """ + Identifies the date and time when the object was closed. + """ + closedAt: DateTime +} + +""" +Represents a 'closed' event on any `Closable`. +""" +type ClosedEvent implements Node & UniformResourceLocatable { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Object that was closed. + """ + closable: Closable! + + """ + Object which triggered the creation of this event. + """ + closer: Closer + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + The HTTP path for this closed event. + """ + resourcePath: URI! + + """ + The HTTP URL for this closed event. + """ + url: URI! +} + +""" +Autogenerated input type of CloseIssue +""" +input CloseIssueInput { + """ + ID of the issue to be closed. + """ + issueId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of CloseIssue +""" +type CloseIssuePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The issue that was closed. + """ + issue: Issue +} + +""" +Autogenerated input type of ClosePullRequest +""" +input ClosePullRequestInput { + """ + ID of the pull request to be closed. + """ + pullRequestId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of ClosePullRequest +""" +type ClosePullRequestPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The pull request that was closed. + """ + pullRequest: PullRequest +} + +""" +The object which triggered a `ClosedEvent`. +""" +union Closer = Commit | PullRequest + +""" +The Code of Conduct for a repository +""" +type CodeOfConduct implements Node { + """ + The body of the Code of Conduct + """ + body: String + id: ID! + + """ + The key for the Code of Conduct + """ + key: String! + + """ + The formal name of the Code of Conduct + """ + name: String! + + """ + The HTTP path for this Code of Conduct + """ + resourcePath: URI + + """ + The HTTP URL for this Code of Conduct + """ + url: URI +} + +""" +Collaborators affiliation level with a subject. +""" +enum CollaboratorAffiliation { + """ + All outside collaborators of an organization-owned subject. + """ + OUTSIDE + + """ + All collaborators with permissions to an organization-owned subject, regardless of organization membership status. + """ + DIRECT + + """ + All collaborators the authenticated user can see. + """ + ALL +} + +""" +Types that can be inside Collection Items. +""" +union CollectionItemContent = Repository | Organization | User + +""" +Represents a comment. +""" +interface Comment { + """ + The actor who authored the comment. + """ + author: Actor + + """ + Author's association with the subject of the comment. + """ + authorAssociation: CommentAuthorAssociation! + + """ + The body as Markdown. + """ + body: String! + + """ + The body rendered to HTML. + """ + bodyHTML: HTML! + + """ + The body rendered to text. + """ + bodyText: String! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Check if this comment was created via an email reply. + """ + createdViaEmail: Boolean! + + """ + The actor who edited the comment. + """ + editor: Actor + id: ID! + + """ + Check if this comment was edited and includes an edit with the creation data + """ + includesCreatedEdit: Boolean! + + """ + The moment the editor made the last edit + """ + lastEditedAt: DateTime + + """ + Identifies when the comment was published at. + """ + publishedAt: DateTime + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + A list of edits to this content. + """ + userContentEdits( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserContentEditConnection + + """ + Did the viewer author this comment. + """ + viewerDidAuthor: Boolean! +} + +""" +A comment author association with repository. +""" +enum CommentAuthorAssociation { + """ + Author is a member of the organization that owns the repository. + """ + MEMBER + + """ + Author is the owner of the repository. + """ + OWNER + + """ + Author has been invited to collaborate on the repository. + """ + COLLABORATOR + + """ + Author has previously committed to the repository. + """ + CONTRIBUTOR + + """ + Author has not previously committed to the repository. + """ + FIRST_TIME_CONTRIBUTOR + + """ + Author has not previously committed to GitHub. + """ + FIRST_TIMER + + """ + Author has no association with the repository. + """ + NONE +} + +""" +The possible errors that will prevent a user from updating a comment. +""" +enum CommentCannotUpdateReason { + """ + You must be the author or have write access to this repository to update this comment. + """ + INSUFFICIENT_ACCESS + + """ + Unable to create comment because issue is locked. + """ + LOCKED + + """ + You must be logged in to update this comment. + """ + LOGIN_REQUIRED + + """ + Repository is under maintenance. + """ + MAINTENANCE + + """ + At least one email address must be verified to update this comment. + """ + VERIFIED_EMAIL_REQUIRED + + """ + You cannot update this comment + """ + DENIED +} + +""" +Represents a 'comment_deleted' event on a given issue or pull request. +""" +type CommentDeletedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! +} + +""" +Represents a Git commit. +""" +type Commit implements Node & GitObject & Subscribable & UniformResourceLocatable { + """ + An abbreviated version of the Git object ID + """ + abbreviatedOid: String! + + """ + The number of additions in this commit. + """ + additions: Int! + + """ + The pull requests associated with a commit + """ + associatedPullRequests( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for pull requests. + """ + orderBy: PullRequestOrder + ): PullRequestConnection + + """ + Authorship details of the commit. + """ + author: GitActor + + """ + Check if the committer and the author match. + """ + authoredByCommitter: Boolean! + + """ + The datetime when this commit was authored. + """ + authoredDate: DateTime! + + """ + Fetches `git blame` information. + """ + blame( + """ + The file whose Git blame information you want. + """ + path: String! + ): Blame! + + """ + The number of changed files in this commit. + """ + changedFiles: Int! + + """ + Comments made on the commit. + """ + comments( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): CommitCommentConnection! + + """ + The HTTP path for this Git object + """ + commitResourcePath: URI! + + """ + The HTTP URL for this Git object + """ + commitUrl: URI! + + """ + The datetime when this commit was committed. + """ + committedDate: DateTime! + + """ + Check if commited via GitHub web UI. + """ + committedViaWeb: Boolean! + + """ + Committership details of the commit. + """ + committer: GitActor + + """ + The number of deletions in this commit. + """ + deletions: Int! + + """ + The deployments associated with a commit. + """ + deployments( + """ + Environments to list deployments for + """ + environments: [String!] + + """ + Ordering options for deployments returned from the connection. + """ + orderBy: DeploymentOrder + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): DeploymentConnection + + """ + The linear commit history starting from (and including) this commit, in the same order as `git log`. + """ + history( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + If non-null, filters history to only show commits touching files under this path. + """ + path: String + + """ + If non-null, filters history to only show commits with matching authorship. + """ + author: CommitAuthor + + """ + Allows specifying a beginning time or date for fetching commits. + """ + since: GitTimestamp + + """ + Allows specifying an ending time or date for fetching commits. + """ + until: GitTimestamp + ): CommitHistoryConnection! + id: ID! + + """ + The Git commit message + """ + message: String! + + """ + The Git commit message body + """ + messageBody: String! + + """ + The commit message body rendered to HTML. + """ + messageBodyHTML: HTML! + + """ + The Git commit message headline + """ + messageHeadline: String! + + """ + The commit message headline rendered to HTML. + """ + messageHeadlineHTML: HTML! + + """ + The Git object ID + """ + oid: GitObjectID! + + """ + The parents of a commit. + """ + parents( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): CommitConnection! + + """ + The datetime when this commit was pushed. + """ + pushedDate: DateTime + + """ + The Repository this commit belongs to + """ + repository: Repository! + + """ + The HTTP path for this commit + """ + resourcePath: URI! + + """ + Commit signing information, if present. + """ + signature: GitSignature + + """ + Status information for this commit + """ + status: Status + + """ + Returns a URL to download a tarball archive for a repository. + Note: For private repositories, these links are temporary and expire after five minutes. + """ + tarballUrl: URI! + + """ + Commit's root Tree + """ + tree: Tree! + + """ + The HTTP path for the tree of this commit + """ + treeResourcePath: URI! + + """ + The HTTP URL for the tree of this commit + """ + treeUrl: URI! + + """ + The HTTP URL for this commit + """ + url: URI! + + """ + Check if the viewer is able to change their subscription status for the repository. + """ + viewerCanSubscribe: Boolean! + + """ + Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. + """ + viewerSubscription: SubscriptionState + + """ + Returns a URL to download a zipball archive for a repository. + Note: For private repositories, these links are temporary and expire after five minutes. + """ + zipballUrl: URI! +} + +""" +Specifies an author for filtering Git commits. +""" +input CommitAuthor { + """ + ID of a User to filter by. If non-null, only commits authored by this user + will be returned. This field takes precedence over emails. + """ + id: ID + + """ + Email addresses to filter by. Commits authored by any of the specified email addresses will be returned. + """ + emails: [String!] +} + +""" +Represents a comment on a given Commit. +""" +type CommitComment implements Node & Comment & Deletable & Updatable & UpdatableComment & Reactable & RepositoryNode { + """ + The actor who authored the comment. + """ + author: Actor + + """ + Author's association with the subject of the comment. + """ + authorAssociation: CommentAuthorAssociation! + + """ + Identifies the comment body. + """ + body: String! + + """ + Identifies the comment body rendered to HTML. + """ + bodyHTML: HTML! + + """ + The body rendered to text. + """ + bodyText: String! + + """ + Identifies the commit associated with the comment, if the commit exists. + """ + commit: Commit + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Check if this comment was created via an email reply. + """ + createdViaEmail: Boolean! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The actor who edited the comment. + """ + editor: Actor + id: ID! + + """ + Check if this comment was edited and includes an edit with the creation data + """ + includesCreatedEdit: Boolean! + + """ + Returns whether or not a comment has been minimized. + """ + isMinimized: Boolean! + + """ + The moment the editor made the last edit + """ + lastEditedAt: DateTime + + """ + Returns why the comment was minimized. + """ + minimizedReason: String + + """ + Identifies the file path associated with the comment. + """ + path: String + + """ + Identifies the line position associated with the comment. + """ + position: Int + + """ + Identifies when the comment was published at. + """ + publishedAt: DateTime + + """ + A list of reactions grouped by content left on the subject. + """ + reactionGroups: [ReactionGroup!] + + """ + A list of Reactions left on the Issue. + """ + reactions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Allows filtering Reactions by emoji. + """ + content: ReactionContent + + """ + Allows specifying the order in which reactions are returned. + """ + orderBy: ReactionOrder + ): ReactionConnection! + + """ + The repository associated with this node. + """ + repository: Repository! + + """ + The HTTP path permalink for this commit comment. + """ + resourcePath: URI! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL permalink for this commit comment. + """ + url: URI! + + """ + A list of edits to this content. + """ + userContentEdits( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserContentEditConnection + + """ + Check if the current viewer can delete this object. + """ + viewerCanDelete: Boolean! + + """ + Check if the current viewer can minimize this object. + """ + viewerCanMinimize: Boolean! + + """ + Can user react to this subject + """ + viewerCanReact: Boolean! + + """ + Check if the current viewer can update this object. + """ + viewerCanUpdate: Boolean! + + """ + Reasons why the current viewer can not update this comment. + """ + viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! + + """ + Did the viewer author this comment. + """ + viewerDidAuthor: Boolean! +} + +""" +The connection type for CommitComment. +""" +type CommitCommentConnection { + """ + A list of edges. + """ + edges: [CommitCommentEdge] + + """ + A list of nodes. + """ + nodes: [CommitComment] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type CommitCommentEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: CommitComment +} + +""" +A thread of comments on a commit. +""" +type CommitCommentThread implements Node & RepositoryNode { + """ + The comments that exist in this thread. + """ + comments( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): CommitCommentConnection! + + """ + The commit the comments were made on. + """ + commit: Commit! + id: ID! + + """ + The file the comments were made on. + """ + path: String + + """ + The position in the diff for the commit that the comment was made on. + """ + position: Int + + """ + The repository associated with this node. + """ + repository: Repository! +} + +""" +The connection type for Commit. +""" +type CommitConnection { + """ + A list of edges. + """ + edges: [CommitEdge] + + """ + A list of nodes. + """ + nodes: [Commit] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +Ordering options for commit contribution connections. +""" +input CommitContributionOrder { + """ + The field by which to order commit contributions. + """ + field: CommitContributionOrderField! + + """ + The ordering direction. + """ + direction: OrderDirection! +} + +""" +Properties by which commit contribution connections can be ordered. +""" +enum CommitContributionOrderField { + """ + Order commit contributions by when they were made. + """ + OCCURRED_AT + + """ + Order commit contributions by how many commits they represent. + """ + COMMIT_COUNT +} + +""" +This aggregates commits made by a user within one repository. +""" +type CommitContributionsByRepository { + """ + The commit contributions, each representing a day. + """ + contributions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for commit contributions returned from the connection. + """ + orderBy: CommitContributionOrder + ): CreatedCommitContributionConnection! + + """ + The repository in which the commits were made. + """ + repository: Repository! + + """ + The HTTP path for the user's commits to the repository in this time range. + """ + resourcePath: URI! + + """ + The HTTP URL for the user's commits to the repository in this time range. + """ + url: URI! +} + +""" +An edge in a connection. +""" +type CommitEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Commit +} + +""" +The connection type for Commit. +""" +type CommitHistoryConnection { + """ + A list of edges. + """ + edges: [CommitEdge] + + """ + A list of nodes. + """ + nodes: [Commit] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +A content attachment +""" +type ContentAttachment { + """ + The body text of the content attachment. This parameter supports markdown. + """ + body: String! + + """ + The content reference that the content attachment is attached to. + """ + contentReference: ContentReference! + + """ + Identifies the primary key from the database. + """ + databaseId: Int! + id: ID! + + """ + The title of the content attachment. + """ + title: String! +} + +""" +A content reference +""" +type ContentReference { + """ + Identifies the primary key from the database. + """ + databaseId: Int! + id: ID! + + """ + The reference of the content reference. + """ + reference: String! +} + +""" +Represents a contribution a user made on GitHub, such as opening an issue. +""" +interface Contribution { + """ + Whether this contribution is associated with a record you do not have access to. For + example, your own 'first issue' contribution may have been made on a repository you can no + longer access. + """ + isRestricted: Boolean! + + """ + When this contribution was made. + """ + occurredAt: DateTime! + + """ + The HTTP path for this contribution. + """ + resourcePath: URI! + + """ + The HTTP URL for this contribution. + """ + url: URI! + + """ + The user who made this contribution. + """ + user: User! +} + +""" +A calendar of contributions made on GitHub by a user. +""" +type ContributionCalendar { + """ + A list of hex color codes used in this calendar. The darker the color, the more contributions it represents. + """ + colors: [String!]! + + """ + Determine if the color set was chosen because it's currently Halloween. + """ + isHalloween: Boolean! + + """ + A list of the months of contributions in this calendar. + """ + months: [ContributionCalendarMonth!]! + + """ + The count of total contributions in the calendar. + """ + totalContributions: Int! + + """ + A list of the weeks of contributions in this calendar. + """ + weeks: [ContributionCalendarWeek!]! +} + +""" +Represents a single day of contributions on GitHub by a user. +""" +type ContributionCalendarDay { + """ + The hex color code that represents how many contributions were made on this day compared to others in the calendar. + """ + color: String! + + """ + How many contributions were made by the user on this day. + """ + contributionCount: Int! + + """ + The day this square represents. + """ + date: Date! + + """ + A number representing which day of the week this square represents, e.g., 1 is Monday. + """ + weekday: Int! +} + +""" +A month of contributions in a user's contribution graph. +""" +type ContributionCalendarMonth { + """ + The date of the first day of this month. + """ + firstDay: Date! + + """ + The name of the month. + """ + name: String! + + """ + How many weeks started in this month. + """ + totalWeeks: Int! + + """ + The year the month occurred in. + """ + year: Int! +} + +""" +A week of contributions in a user's contribution graph. +""" +type ContributionCalendarWeek { + """ + The days of contributions in this week. + """ + contributionDays: [ContributionCalendarDay!]! + + """ + The date of the earliest square in this week. + """ + firstDay: Date! +} + +""" +Ordering options for contribution connections. +""" +input ContributionOrder { + """ + The field by which to order contributions. + """ + field: ContributionOrderField! + + """ + The ordering direction. + """ + direction: OrderDirection! +} + +""" +Properties by which contribution connections can be ordered. +""" +enum ContributionOrderField { + """ + Order contributions by when they were made. + """ + OCCURRED_AT +} + +""" +A contributions collection aggregates contributions such as opened issues and commits created by a user. +""" +type ContributionsCollection { + """ + Commit contributions made by the user, grouped by repository. + """ + commitContributionsByRepository( + """ + How many repositories should be included. + """ + maxRepositories: Int = 25 + ): [CommitContributionsByRepository!]! + + """ + A calendar of this user's contributions on GitHub. + """ + contributionCalendar: ContributionCalendar! + + """ + The years the user has been making contributions with the most recent year first. + """ + contributionYears: [Int!]! + + """ + Determine if this collection's time span ends in the current month. + """ + doesEndInCurrentMonth: Boolean! + + """ + The date of the first restricted contribution the user made in this time + period. Can only be non-null when the user has enabled private contribution counts. + """ + earliestRestrictedContributionDate: Date + + """ + The ending date and time of this collection. + """ + endedAt: DateTime! + + """ + The first issue the user opened on GitHub. This will be null if that issue was + opened outside the collection's time range and ignoreTimeRange is false. If + the issue is not visible but the user has opted to show private contributions, + a RestrictedContribution will be returned. + """ + firstIssueContribution( + """ + If true, the first issue will be returned even if it was opened outside of the collection's time range. + + **Upcoming Change on 2019-07-01 UTC** + **Description:** `ignoreTimeRange` will be removed. Use a `ContributionsCollection` starting sufficiently far back + **Reason:** ignore_time_range will be removed + """ + ignoreTimeRange: Boolean = false + ): CreatedIssueOrRestrictedContribution + + """ + The first pull request the user opened on GitHub. This will be null if that + pull request was opened outside the collection's time range and + ignoreTimeRange is not true. If the pull request is not visible but the user + has opted to show private contributions, a RestrictedContribution will be returned. + """ + firstPullRequestContribution( + """ + If true, the first pull request will be returned even if it was opened outside of the collection's time range. + + **Upcoming Change on 2019-07-01 UTC** + **Description:** `ignoreTimeRange` will be removed. Use a `ContributionsCollection` starting sufficiently far back + **Reason:** ignore_time_range will be removed + """ + ignoreTimeRange: Boolean = false + ): CreatedPullRequestOrRestrictedContribution + + """ + The first repository the user created on GitHub. This will be null if that + first repository was created outside the collection's time range and + ignoreTimeRange is false. If the repository is not visible, then a + RestrictedContribution is returned. + """ + firstRepositoryContribution( + """ + If true, the first repository will be returned even if it was opened outside of the collection's time range. + + **Upcoming Change on 2019-07-01 UTC** + **Description:** `ignoreTimeRange` will be removed. Use a `ContributionsCollection` starting sufficiently far back + **Reason:** ignore_time_range will be removed + """ + ignoreTimeRange: Boolean = false + ): CreatedRepositoryOrRestrictedContribution + + """ + Does the user have any more activity in the timeline that occurred prior to the collection's time range? + """ + hasActivityInThePast: Boolean! + + """ + Determine if there are any contributions in this collection. + """ + hasAnyContributions: Boolean! + + """ + Determine if the user made any contributions in this time frame whose details + are not visible because they were made in a private repository. Can only be + true if the user enabled private contribution counts. + """ + hasAnyRestrictedContributions: Boolean! + + """ + Whether or not the collector's time span is all within the same day. + """ + isSingleDay: Boolean! + + """ + A list of issues the user opened. + """ + issueContributions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Should the user's first issue ever be excluded from the result. + """ + excludeFirst: Boolean = false + + """ + Should the user's most commented issue be excluded from the result. + """ + excludePopular: Boolean = false + + """ + Ordering options for contributions returned from the connection. + """ + orderBy: ContributionOrder + ): CreatedIssueContributionConnection! + + """ + Issue contributions made by the user, grouped by repository. + """ + issueContributionsByRepository( + """ + How many repositories should be included. + """ + maxRepositories: Int = 25 + + """ + Should the user's first issue ever be excluded from the result. + """ + excludeFirst: Boolean = false + + """ + Should the user's most commented issue be excluded from the result. + """ + excludePopular: Boolean = false + ): [IssueContributionsByRepository!]! + + """ + When the user signed up for GitHub. This will be null if that sign up date + falls outside the collection's time range and ignoreTimeRange is false. + """ + joinedGitHubContribution( + """ + If true, the contribution will be returned even if the user signed up outside of the collection's time range. + + **Upcoming Change on 2019-07-01 UTC** + **Description:** `ignoreTimeRange` will be removed. Use a `ContributionsCollection` starting sufficiently far back + **Reason:** ignore_time_range will be removed + """ + ignoreTimeRange: Boolean = false + ): JoinedGitHubContribution + + """ + The date of the most recent restricted contribution the user made in this time + period. Can only be non-null when the user has enabled private contribution counts. + """ + latestRestrictedContributionDate: Date + + """ + When this collection's time range does not include any activity from the user, use this + to get a different collection from an earlier time range that does have activity. + """ + mostRecentCollectionWithActivity: ContributionsCollection + + """ + Returns a different contributions collection from an earlier time range than this one + that does not have any contributions. + """ + mostRecentCollectionWithoutActivity: ContributionsCollection + + """ + The issue the user opened on GitHub that received the most comments in the specified + time frame. + """ + popularIssueContribution: CreatedIssueContribution + + """ + The pull request the user opened on GitHub that received the most comments in the + specified time frame. + """ + popularPullRequestContribution: CreatedPullRequestContribution + + """ + Pull request contributions made by the user. + """ + pullRequestContributions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Should the user's first pull request ever be excluded from the result. + """ + excludeFirst: Boolean = false + + """ + Should the user's most commented pull request be excluded from the result. + """ + excludePopular: Boolean = false + + """ + Ordering options for contributions returned from the connection. + """ + orderBy: ContributionOrder + ): CreatedPullRequestContributionConnection! + + """ + Pull request contributions made by the user, grouped by repository. + """ + pullRequestContributionsByRepository( + """ + How many repositories should be included. + """ + maxRepositories: Int = 25 + + """ + Should the user's first pull request ever be excluded from the result. + """ + excludeFirst: Boolean = false + + """ + Should the user's most commented pull request be excluded from the result. + """ + excludePopular: Boolean = false + ): [PullRequestContributionsByRepository!]! + + """ + Pull request review contributions made by the user. + """ + pullRequestReviewContributions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for contributions returned from the connection. + """ + orderBy: ContributionOrder + ): CreatedPullRequestReviewContributionConnection! + + """ + Pull request review contributions made by the user, grouped by repository. + """ + pullRequestReviewContributionsByRepository( + """ + How many repositories should be included. + """ + maxRepositories: Int = 25 + ): [PullRequestReviewContributionsByRepository!]! + + """ + A list of repositories owned by the user that the user created in this time range. + """ + repositoryContributions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Should the user's first repository ever be excluded from the result. + """ + excludeFirst: Boolean = false + + """ + Ordering options for contributions returned from the connection. + """ + orderBy: ContributionOrder + ): CreatedRepositoryContributionConnection! + + """ + A count of contributions made by the user that the viewer cannot access. Only + non-zero when the user has chosen to share their private contribution counts. + """ + restrictedContributionsCount: Int! + + """ + The beginning date and time of this collection. + """ + startedAt: DateTime! + + """ + How many commits were made by the user in this time span. + """ + totalCommitContributions: Int! + + """ + How many issues the user opened. + """ + totalIssueContributions( + """ + Should the user's first issue ever be excluded from this count. + """ + excludeFirst: Boolean = false + + """ + Should the user's most commented issue be excluded from this count. + """ + excludePopular: Boolean = false + ): Int! + + """ + How many pull requests the user opened. + """ + totalPullRequestContributions( + """ + Should the user's first pull request ever be excluded from this count. + """ + excludeFirst: Boolean = false + + """ + Should the user's most commented pull request be excluded from this count. + """ + excludePopular: Boolean = false + ): Int! + + """ + How many pull request reviews the user left. + """ + totalPullRequestReviewContributions: Int! + + """ + How many different repositories the user committed to. + """ + totalRepositoriesWithContributedCommits: Int! + + """ + How many different repositories the user opened issues in. + """ + totalRepositoriesWithContributedIssues( + """ + Should the user's first issue ever be excluded from this count. + """ + excludeFirst: Boolean = false + + """ + Should the user's most commented issue be excluded from this count. + """ + excludePopular: Boolean = false + ): Int! + + """ + How many different repositories the user left pull request reviews in. + """ + totalRepositoriesWithContributedPullRequestReviews: Int! + + """ + How many different repositories the user opened pull requests in. + """ + totalRepositoriesWithContributedPullRequests( + """ + Should the user's first pull request ever be excluded from this count. + """ + excludeFirst: Boolean = false + + """ + Should the user's most commented pull request be excluded from this count. + """ + excludePopular: Boolean = false + ): Int! + + """ + How many repositories the user created. + """ + totalRepositoryContributions( + """ + Should the user's first repository ever be excluded from this count. + """ + excludeFirst: Boolean = false + ): Int! + + """ + The user who made the contributions in this collection. + """ + user: User! +} + +""" +Represents a 'converted_note_to_issue' event on a given issue or pull request. +""" +type ConvertedNoteToIssueEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! +} + +""" +Autogenerated input type of ConvertProjectCardNoteToIssue +""" +input ConvertProjectCardNoteToIssueInput { + """ + The ProjectCard ID to convert. + """ + projectCardId: ID! + + """ + The ID of the repository to create the issue in. + """ + repositoryId: ID! + + """ + The title of the newly created issue. Defaults to the card's note text. + """ + title: String + + """ + The body of the newly created issue. + """ + body: String + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of ConvertProjectCardNoteToIssue +""" +type ConvertProjectCardNoteToIssuePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The updated ProjectCard. + """ + projectCard: ProjectCard +} + +""" +Autogenerated input type of CreateBranchProtectionRule +""" +input CreateBranchProtectionRuleInput { + """ + The global relay id of the repository in which a new branch protection rule should be created in. + """ + repositoryId: ID! + + """ + The glob-like pattern used to determine matching branches. + """ + pattern: String! + + """ + Are approving reviews required to update matching branches. + """ + requiresApprovingReviews: Boolean + + """ + Number of approving reviews required to update matching branches. + """ + requiredApprovingReviewCount: Int + + """ + Are commits required to be signed. + """ + requiresCommitSignatures: Boolean + + """ + Can admins overwrite branch protection. + """ + isAdminEnforced: Boolean + + """ + Are status checks required to update matching branches. + """ + requiresStatusChecks: Boolean + + """ + Are branches required to be up to date before merging. + """ + requiresStrictStatusChecks: Boolean + + """ + Are reviews from code owners required to update matching branches. + """ + requiresCodeOwnerReviews: Boolean + + """ + Will new commits pushed to matching branches dismiss pull request review approvals. + """ + dismissesStaleReviews: Boolean + + """ + Is dismissal of pull request reviews restricted. + """ + restrictsReviewDismissals: Boolean + + """ + A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches. + """ + reviewDismissalActorIds: [ID!] + + """ + Is pushing to matching branches restricted. + """ + restrictsPushes: Boolean + + """ + A list of User or Team IDs allowed to push to matching branches. + """ + pushActorIds: [ID!] + + """ + List of required status check contexts that must pass for commits to be accepted to matching branches. + """ + requiredStatusCheckContexts: [String!] + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of CreateBranchProtectionRule +""" +type CreateBranchProtectionRulePayload { + """ + The newly created BranchProtectionRule. + """ + branchProtectionRule: BranchProtectionRule + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated input type of CreateContentAttachment +""" +input CreateContentAttachmentInput { + """ + The node ID of the content_reference. + """ + contentReferenceId: ID! + + """ + The title of the content attachment. + """ + title: String! + + """ + The body of the content attachment, which may contain markdown. + """ + body: String! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Represents the contribution a user made by committing to a repository. +""" +type CreatedCommitContribution implements Contribution { + """ + How many commits were made on this day to this repository by the user. + """ + commitCount: Int! + + """ + Whether this contribution is associated with a record you do not have access to. For + example, your own 'first issue' contribution may have been made on a repository you can no + longer access. + """ + isRestricted: Boolean! + + """ + When this contribution was made. + """ + occurredAt: DateTime! + + """ + The repository the user made a commit in. + """ + repository: Repository! + + """ + The HTTP path for this contribution. + """ + resourcePath: URI! + + """ + The HTTP URL for this contribution. + """ + url: URI! + + """ + The user who made this contribution. + """ + user: User! +} + +""" +The connection type for CreatedCommitContribution. +""" +type CreatedCommitContributionConnection { + """ + A list of edges. + """ + edges: [CreatedCommitContributionEdge] + + """ + A list of nodes. + """ + nodes: [CreatedCommitContribution] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of commits across days and repositories in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type CreatedCommitContributionEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: CreatedCommitContribution +} + +""" +Represents the contribution a user made on GitHub by opening an issue. +""" +type CreatedIssueContribution implements Contribution { + """ + Whether this contribution is associated with a record you do not have access to. For + example, your own 'first issue' contribution may have been made on a repository you can no + longer access. + """ + isRestricted: Boolean! + + """ + The issue that was opened. + """ + issue: Issue! + + """ + When this contribution was made. + """ + occurredAt: DateTime! + + """ + The HTTP path for this contribution. + """ + resourcePath: URI! + + """ + The HTTP URL for this contribution. + """ + url: URI! + + """ + The user who made this contribution. + """ + user: User! +} + +""" +The connection type for CreatedIssueContribution. +""" +type CreatedIssueContributionConnection { + """ + A list of edges. + """ + edges: [CreatedIssueContributionEdge] + + """ + A list of nodes. + """ + nodes: [CreatedIssueContribution] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type CreatedIssueContributionEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: CreatedIssueContribution +} + +""" +Represents either a issue the viewer can access or a restricted contribution. +""" +union CreatedIssueOrRestrictedContribution = + CreatedIssueContribution + | RestrictedContribution + +""" +Represents the contribution a user made on GitHub by opening a pull request. +""" +type CreatedPullRequestContribution implements Contribution { + """ + Whether this contribution is associated with a record you do not have access to. For + example, your own 'first issue' contribution may have been made on a repository you can no + longer access. + """ + isRestricted: Boolean! + + """ + When this contribution was made. + """ + occurredAt: DateTime! + + """ + The pull request that was opened. + """ + pullRequest: PullRequest! + + """ + The HTTP path for this contribution. + """ + resourcePath: URI! + + """ + The HTTP URL for this contribution. + """ + url: URI! + + """ + The user who made this contribution. + """ + user: User! +} + +""" +The connection type for CreatedPullRequestContribution. +""" +type CreatedPullRequestContributionConnection { + """ + A list of edges. + """ + edges: [CreatedPullRequestContributionEdge] + + """ + A list of nodes. + """ + nodes: [CreatedPullRequestContribution] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type CreatedPullRequestContributionEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: CreatedPullRequestContribution +} + +""" +Represents either a pull request the viewer can access or a restricted contribution. +""" +union CreatedPullRequestOrRestrictedContribution = + CreatedPullRequestContribution + | RestrictedContribution + +""" +Represents the contribution a user made by leaving a review on a pull request. +""" +type CreatedPullRequestReviewContribution implements Contribution { + """ + Whether this contribution is associated with a record you do not have access to. For + example, your own 'first issue' contribution may have been made on a repository you can no + longer access. + """ + isRestricted: Boolean! + + """ + When this contribution was made. + """ + occurredAt: DateTime! + + """ + The pull request the user reviewed. + """ + pullRequest: PullRequest! + + """ + The review the user left on the pull request. + """ + pullRequestReview: PullRequestReview! + + """ + The repository containing the pull request that the user reviewed. + """ + repository: Repository! + + """ + The HTTP path for this contribution. + """ + resourcePath: URI! + + """ + The HTTP URL for this contribution. + """ + url: URI! + + """ + The user who made this contribution. + """ + user: User! +} + +""" +The connection type for CreatedPullRequestReviewContribution. +""" +type CreatedPullRequestReviewContributionConnection { + """ + A list of edges. + """ + edges: [CreatedPullRequestReviewContributionEdge] + + """ + A list of nodes. + """ + nodes: [CreatedPullRequestReviewContribution] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type CreatedPullRequestReviewContributionEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: CreatedPullRequestReviewContribution +} + +""" +Represents the contribution a user made on GitHub by creating a repository. +""" +type CreatedRepositoryContribution implements Contribution { + """ + Whether this contribution is associated with a record you do not have access to. For + example, your own 'first issue' contribution may have been made on a repository you can no + longer access. + """ + isRestricted: Boolean! + + """ + When this contribution was made. + """ + occurredAt: DateTime! + + """ + The repository that was created. + """ + repository: Repository! + + """ + The HTTP path for this contribution. + """ + resourcePath: URI! + + """ + The HTTP URL for this contribution. + """ + url: URI! + + """ + The user who made this contribution. + """ + user: User! +} + +""" +The connection type for CreatedRepositoryContribution. +""" +type CreatedRepositoryContributionConnection { + """ + A list of edges. + """ + edges: [CreatedRepositoryContributionEdge] + + """ + A list of nodes. + """ + nodes: [CreatedRepositoryContribution] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type CreatedRepositoryContributionEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: CreatedRepositoryContribution +} + +""" +Represents either a repository the viewer can access or a restricted contribution. +""" +union CreatedRepositoryOrRestrictedContribution = + CreatedRepositoryContribution + | RestrictedContribution + +""" +Autogenerated input type of CreateIssue +""" +input CreateIssueInput { + """ + The Node ID of the repository. + """ + repositoryId: ID! + + """ + The title for the issue. + """ + title: String! + + """ + The body for the issue description. + """ + body: String + + """ + The Node ID for the user assignee for this issue. + """ + assigneeIds: [ID!] + + """ + The Node ID of the milestone for this issue. + """ + milestoneId: ID + + """ + An array of Node IDs of labels for this issue. + """ + labelIds: [ID!] + + """ + An array of Node IDs for projects associated with this issue. + """ + projectIds: [ID!] + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of CreateIssue +""" +type CreateIssuePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The new issue. + """ + issue: Issue +} + +""" +Autogenerated input type of CreateProject +""" +input CreateProjectInput { + """ + The owner ID to create the project under. + """ + ownerId: ID! + + """ + The name of project. + """ + name: String! + + """ + The description of project. + """ + body: String + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of CreateProject +""" +type CreateProjectPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The new project. + """ + project: Project +} + +""" +Autogenerated input type of CreatePullRequest +""" +input CreatePullRequestInput { + """ + The Node ID of the repository. + """ + repositoryId: ID! + + """ + The name of the branch you want your changes pulled into. This should be an existing branch + on the current repository. You cannot update the base branch on a pull request to point + to another repository. + """ + baseRefName: String! + + """ + The name of the branch where your changes are implemented. For cross-repository pull requests + in the same network, namespace `head_ref_name` with a user like this: `username:branch`. + """ + headRefName: String! + + """ + The title of the pull request. + """ + title: String! + + """ + The contents of the pull request. + """ + body: String + + """ + Indicates whether maintainers can modify the pull request. + """ + maintainerCanModify: Boolean = true + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of CreatePullRequest +""" +type CreatePullRequestPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The new pull request. + """ + pullRequest: PullRequest +} + +""" +Represents a mention made by one issue or pull request to another. +""" +type CrossReferencedEvent implements Node & UniformResourceLocatable { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Reference originated in a different repository. + """ + isCrossRepository: Boolean! + + """ + Identifies when the reference was made. + """ + referencedAt: DateTime! + + """ + The HTTP path for this pull request. + """ + resourcePath: URI! + + """ + Issue or pull request that made the reference. + """ + source: ReferencedSubject! + + """ + Issue or pull request to which the reference was made. + """ + target: ReferencedSubject! + + """ + The HTTP URL for this pull request. + """ + url: URI! + + """ + Checks if the target will be closed when the source is merged. + """ + willCloseTarget: Boolean! +} + +""" +An ISO-8601 encoded date string. +""" +scalar Date + +""" +An ISO-8601 encoded UTC date string. +""" +scalar DateTime + +""" +Autogenerated input type of DeclineTopicSuggestion +""" +input DeclineTopicSuggestionInput { + """ + The Node ID of the repository. + """ + repositoryId: ID! + + """ + The name of the suggested topic. + """ + name: String! + + """ + The reason why the suggested topic is declined. + """ + reason: TopicSuggestionDeclineReason! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of DeclineTopicSuggestion +""" +type DeclineTopicSuggestionPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The declined topic. + """ + topic: Topic +} + +""" +The possible default permissions for repositories. +""" +enum DefaultRepositoryPermissionField { + """ + No access + """ + NONE + + """ + Can read repos by default + """ + READ + + """ + Can read and write repos by default + """ + WRITE + + """ + Can read, write, and administrate repos by default + """ + ADMIN +} + +""" +Entities that can be deleted. +""" +interface Deletable { + """ + Check if the current viewer can delete this object. + """ + viewerCanDelete: Boolean! +} + +""" +Autogenerated input type of DeleteBranchProtectionRule +""" +input DeleteBranchProtectionRuleInput { + """ + The global relay id of the branch protection rule to be deleted. + """ + branchProtectionRuleId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of DeleteBranchProtectionRule +""" +type DeleteBranchProtectionRulePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated input type of DeleteIssueComment +""" +input DeleteIssueCommentInput { + """ + The ID of the comment to delete. + """ + id: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of DeleteIssueComment +""" +type DeleteIssueCommentPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated input type of DeleteIssue +""" +input DeleteIssueInput { + """ + The ID of the issue to delete. + """ + issueId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of DeleteIssue +""" +type DeleteIssuePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The repository the issue belonged to + """ + repository: Repository +} + +""" +Autogenerated input type of DeleteProjectCard +""" +input DeleteProjectCardInput { + """ + The id of the card to delete. + """ + cardId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of DeleteProjectCard +""" +type DeleteProjectCardPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The column the deleted card was in. + """ + column: ProjectColumn + + """ + The deleted card ID. + """ + deletedCardId: ID +} + +""" +Autogenerated input type of DeleteProjectColumn +""" +input DeleteProjectColumnInput { + """ + The id of the column to delete. + """ + columnId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of DeleteProjectColumn +""" +type DeleteProjectColumnPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The deleted column ID. + """ + deletedColumnId: ID + + """ + The project the deleted column was in. + """ + project: Project +} + +""" +Autogenerated input type of DeleteProject +""" +input DeleteProjectInput { + """ + The Project ID to update. + """ + projectId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of DeleteProject +""" +type DeleteProjectPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The repository or organization the project was removed from. + """ + owner: ProjectOwner +} + +""" +Autogenerated input type of DeletePullRequestReviewComment +""" +input DeletePullRequestReviewCommentInput { + """ + The ID of the comment to delete. + """ + id: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of DeletePullRequestReviewComment +""" +type DeletePullRequestReviewCommentPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The pull request review the deleted comment belonged to. + """ + pullRequestReview: PullRequestReview +} + +""" +Autogenerated input type of DeletePullRequestReview +""" +input DeletePullRequestReviewInput { + """ + The Node ID of the pull request review to delete. + """ + pullRequestReviewId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of DeletePullRequestReview +""" +type DeletePullRequestReviewPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The deleted pull request review. + """ + pullRequestReview: PullRequestReview +} + +""" +Represents a 'demilestoned' event on a given issue or pull request. +""" +type DemilestonedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Identifies the milestone title associated with the 'demilestoned' event. + """ + milestoneTitle: String! + + """ + Object referenced by event. + """ + subject: MilestoneItem! +} + +""" +Represents a 'deployed' event on a given pull request. +""" +type DeployedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The deployment associated with the 'deployed' event. + """ + deployment: Deployment! + id: ID! + + """ + PullRequest referenced by event. + """ + pullRequest: PullRequest! + + """ + The ref associated with the 'deployed' event. + """ + ref: Ref +} + +""" +A repository deploy key. +""" +type DeployKey implements Node { + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + The deploy key. + """ + key: String! + + """ + Whether or not the deploy key is read only. + """ + readOnly: Boolean! + + """ + The deploy key title. + """ + title: String! + + """ + Whether or not the deploy key has been verified. + """ + verified: Boolean! +} + +""" +The connection type for DeployKey. +""" +type DeployKeyConnection { + """ + A list of edges. + """ + edges: [DeployKeyEdge] + + """ + A list of nodes. + """ + nodes: [DeployKey] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type DeployKeyEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: DeployKey +} + +""" +Represents triggered deployment instance. +""" +type Deployment implements Node { + """ + Identifies the commit sha of the deployment. + """ + commit: Commit + + """ + Identifies the oid of the deployment commit, even if the commit has been deleted. + """ + commitOid: String! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the actor who triggered the deployment. + """ + creator: Actor + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The deployment description. + """ + description: String + + """ + The environment to which this deployment was made. + """ + environment: String + id: ID! + + """ + The latest status of this deployment. + """ + latestStatus: DeploymentStatus + + """ + Extra information that a deployment system might need. + """ + payload: String + + """ + Identifies the Ref of the deployment, if the deployment was created by ref. + """ + ref: Ref + + """ + Identifies the repository associated with the deployment. + """ + repository: Repository! + + """ + The current state of the deployment. + """ + state: DeploymentState + + """ + A list of statuses associated with the deployment. + """ + statuses( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): DeploymentStatusConnection + + """ + The deployment task. + """ + task: String + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! +} + +""" +The connection type for Deployment. +""" +type DeploymentConnection { + """ + A list of edges. + """ + edges: [DeploymentEdge] + + """ + A list of nodes. + """ + nodes: [Deployment] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type DeploymentEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Deployment +} + +""" +Represents a 'deployment_environment_changed' event on a given pull request. +""" +type DeploymentEnvironmentChangedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + The deployment status that updated the deployment environment. + """ + deploymentStatus: DeploymentStatus! + id: ID! + + """ + PullRequest referenced by event. + """ + pullRequest: PullRequest! +} + +""" +Ordering options for deployment connections +""" +input DeploymentOrder { + """ + The field to order deployments by. + """ + field: DeploymentOrderField! + + """ + The ordering direction. + """ + direction: OrderDirection! +} + +""" +Properties by which deployment connections can be ordered. +""" +enum DeploymentOrderField { + """ + Order collection by creation time + """ + CREATED_AT +} + +""" +The possible states in which a deployment can be. +""" +enum DeploymentState { + """ + The pending deployment was not updated after 30 minutes. + """ + ABANDONED + + """ + The deployment is currently active. + """ + ACTIVE + + """ + An inactive transient deployment. + """ + DESTROYED + + """ + The deployment experienced an error. + """ + ERROR + + """ + The deployment has failed. + """ + FAILURE + + """ + The deployment is inactive. + """ + INACTIVE + + """ + The deployment is pending. + """ + PENDING + + """ + The deployment has queued + """ + QUEUED + + """ + The deployment is in progress. + """ + IN_PROGRESS +} + +""" +Describes the status of a given deployment attempt. +""" +type DeploymentStatus implements Node { + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the actor who triggered the deployment. + """ + creator: Actor + + """ + Identifies the deployment associated with status. + """ + deployment: Deployment! + + """ + Identifies the description of the deployment. + """ + description: String + + """ + Identifies the environment URL of the deployment. + """ + environmentUrl: URI + id: ID! + + """ + Identifies the log URL of the deployment. + """ + logUrl: URI + + """ + Identifies the current state of the deployment. + """ + state: DeploymentStatusState! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! +} + +""" +The connection type for DeploymentStatus. +""" +type DeploymentStatusConnection { + """ + A list of edges. + """ + edges: [DeploymentStatusEdge] + + """ + A list of nodes. + """ + nodes: [DeploymentStatus] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type DeploymentStatusEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: DeploymentStatus +} + +""" +The possible states for a deployment status. +""" +enum DeploymentStatusState { + """ + The deployment is pending. + """ + PENDING + + """ + The deployment was successful. + """ + SUCCESS + + """ + The deployment has failed. + """ + FAILURE + + """ + The deployment is inactive. + """ + INACTIVE + + """ + The deployment experienced an error. + """ + ERROR + + """ + The deployment is queued + """ + QUEUED + + """ + The deployment is in progress. + """ + IN_PROGRESS +} + +""" +Autogenerated input type of DismissPullRequestReview +""" +input DismissPullRequestReviewInput { + """ + The Node ID of the pull request review to modify. + """ + pullRequestReviewId: ID! + + """ + The contents of the pull request review dismissal message. + """ + message: String! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of DismissPullRequestReview +""" +type DismissPullRequestReviewPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The dismissed pull request review. + """ + pullRequestReview: PullRequestReview +} + +""" +Specifies a review comment to be left with a Pull Request Review. +""" +input DraftPullRequestReviewComment { + """ + Path to the file being commented on. + """ + path: String! + + """ + Position in the file to leave a comment on. + """ + position: Int! + + """ + Body of the comment to leave. + """ + body: String! +} + +""" +An external identity provisioned by SAML SSO or SCIM. +""" +type ExternalIdentity implements Node { + """ + The GUID for this identity + """ + guid: String! + id: ID! + + """ + Organization invitation for this SCIM-provisioned external identity + """ + organizationInvitation: OrganizationInvitation + + """ + SAML Identity attributes + """ + samlIdentity: ExternalIdentitySamlAttributes + + """ + SCIM Identity attributes + """ + scimIdentity: ExternalIdentityScimAttributes + + """ + User linked to this external identity. Will be NULL if this identity has not been claimed by an organization member. + """ + user: User +} + +""" +The connection type for ExternalIdentity. +""" +type ExternalIdentityConnection { + """ + A list of edges. + """ + edges: [ExternalIdentityEdge] + + """ + A list of nodes. + """ + nodes: [ExternalIdentity] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type ExternalIdentityEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: ExternalIdentity +} + +""" +SAML attributes for the External Identity +""" +type ExternalIdentitySamlAttributes { + """ + The NameID of the SAML identity + """ + nameId: String +} + +""" +SCIM attributes for the External Identity +""" +type ExternalIdentityScimAttributes { + """ + The userName of the SCIM identity + """ + username: String +} + +""" +The connection type for User. +""" +type FollowerConnection { + """ + A list of edges. + """ + edges: [UserEdge] + + """ + A list of nodes. + """ + nodes: [User] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +The connection type for User. +""" +type FollowingConnection { + """ + A list of edges. + """ + edges: [UserEdge] + + """ + A list of nodes. + """ + nodes: [User] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +A Gist. +""" +type Gist implements Node & Starrable { + """ + A list of comments associated with the gist + """ + comments( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): GistCommentConnection! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + The gist description. + """ + description: String + + """ + The files in this gist. + """ + files( + """ + The maximum number of files to return. + """ + limit: Int = 10 + ): [GistFile] + id: ID! + + """ + Identifies if the gist is a fork. + """ + isFork: Boolean! + + """ + Whether the gist is public or not. + """ + isPublic: Boolean! + + """ + The gist name. + """ + name: String! + + """ + The gist owner. + """ + owner: RepositoryOwner + + """ + Identifies when the gist was last pushed to. + """ + pushedAt: DateTime + + """ + A list of users who have starred this starrable. + """ + stargazers( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Order for connection + """ + orderBy: StarOrder + ): StargazerConnection! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + Returns a boolean indicating whether the viewing user has starred this starrable. + """ + viewerHasStarred: Boolean! +} + +""" +Represents a comment on an Gist. +""" +type GistComment implements Node & Comment & Deletable & Updatable & UpdatableComment { + """ + The actor who authored the comment. + """ + author: Actor + + """ + Author's association with the gist. + """ + authorAssociation: CommentAuthorAssociation! + + """ + Identifies the comment body. + """ + body: String! + + """ + The comment body rendered to HTML. + """ + bodyHTML: HTML! + + """ + The body rendered to text. + """ + bodyText: String! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Check if this comment was created via an email reply. + """ + createdViaEmail: Boolean! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The actor who edited the comment. + """ + editor: Actor + + """ + The associated gist. + """ + gist: Gist! + id: ID! + + """ + Check if this comment was edited and includes an edit with the creation data + """ + includesCreatedEdit: Boolean! + + """ + Returns whether or not a comment has been minimized. + """ + isMinimized: Boolean! + + """ + The moment the editor made the last edit + """ + lastEditedAt: DateTime + + """ + Returns why the comment was minimized. + """ + minimizedReason: String + + """ + Identifies when the comment was published at. + """ + publishedAt: DateTime + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + A list of edits to this content. + """ + userContentEdits( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserContentEditConnection + + """ + Check if the current viewer can delete this object. + """ + viewerCanDelete: Boolean! + + """ + Check if the current viewer can minimize this object. + """ + viewerCanMinimize: Boolean! + + """ + Check if the current viewer can update this object. + """ + viewerCanUpdate: Boolean! + + """ + Reasons why the current viewer can not update this comment. + """ + viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! + + """ + Did the viewer author this comment. + """ + viewerDidAuthor: Boolean! +} + +""" +The connection type for GistComment. +""" +type GistCommentConnection { + """ + A list of edges. + """ + edges: [GistCommentEdge] + + """ + A list of nodes. + """ + nodes: [GistComment] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type GistCommentEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: GistComment +} + +""" +The connection type for Gist. +""" +type GistConnection { + """ + A list of edges. + """ + edges: [GistEdge] + + """ + A list of nodes. + """ + nodes: [Gist] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type GistEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Gist +} + +""" +A file in a gist. +""" +type GistFile { + """ + The file name encoded to remove characters that are invalid in URL paths. + """ + encodedName: String + + """ + The gist file encoding. + """ + encoding: String + + """ + The file extension from the file name. + """ + extension: String + + """ + Indicates if this file is an image. + """ + isImage: Boolean! + + """ + Whether the file's contents were truncated. + """ + isTruncated: Boolean! + + """ + The programming language this file is written in. + """ + language: Language + + """ + The gist file name. + """ + name: String + + """ + The gist file size in bytes. + """ + size: Int + + """ + UTF8 text data or null if the file is binary + """ + text( + """ + Optionally truncate the returned file to this length. + """ + truncate: Int + ): String +} + +""" +Ordering options for gist connections +""" +input GistOrder { + """ + The field to order repositories by. + """ + field: GistOrderField! + + """ + The ordering direction. + """ + direction: OrderDirection! +} + +""" +Properties by which gist connections can be ordered. +""" +enum GistOrderField { + """ + Order gists by creation time + """ + CREATED_AT + + """ + Order gists by update time + """ + UPDATED_AT + + """ + Order gists by push time + """ + PUSHED_AT +} + +""" +The privacy of a Gist +""" +enum GistPrivacy { + """ + Public + """ + PUBLIC + + """ + Secret + """ + SECRET + + """ + Gists that are public and secret + """ + ALL +} + +""" +Represents an actor in a Git commit (ie. an author or committer). +""" +type GitActor { + """ + A URL pointing to the author's public avatar. + """ + avatarUrl( + """ + The size of the resulting square image. + """ + size: Int + ): URI! + + """ + The timestamp of the Git action (authoring or committing). + """ + date: GitTimestamp + + """ + The email in the Git commit. + """ + email: String + + """ + The name in the Git commit. + """ + name: String + + """ + The GitHub user corresponding to the email field. Null if no such user exists. + """ + user: User +} + +""" +Represents information about the GitHub instance. +""" +type GitHubMetadata { + """ + Returns a String that's a SHA of `github-services` + """ + gitHubServicesSha: GitObjectID! + + """ + IP addresses that users connect to for git operations + """ + gitIpAddresses: [String!] + + """ + IP addresses that service hooks are sent from + """ + hookIpAddresses: [String!] + + """ + IP addresses that the importer connects from + """ + importerIpAddresses: [String!] + + """ + Whether or not users are verified + """ + isPasswordAuthenticationVerifiable: Boolean! + + """ + IP addresses for GitHub Pages' A records + """ + pagesIpAddresses: [String!] +} + +""" +Represents a Git object. +""" +interface GitObject { + """ + An abbreviated version of the Git object ID + """ + abbreviatedOid: String! + + """ + The HTTP path for this Git object + """ + commitResourcePath: URI! + + """ + The HTTP URL for this Git object + """ + commitUrl: URI! + id: ID! + + """ + The Git object ID + """ + oid: GitObjectID! + + """ + The Repository the Git object belongs to + """ + repository: Repository! +} + +""" +A Git object ID. +""" +scalar GitObjectID + +""" +Information about a signature (GPG or S/MIME) on a Commit or Tag. +""" +interface GitSignature { + """ + Email used to sign this object. + """ + email: String! + + """ + True if the signature is valid and verified by GitHub. + """ + isValid: Boolean! + + """ + Payload for GPG signing object. Raw ODB object without the signature header. + """ + payload: String! + + """ + ASCII-armored signature header from object. + """ + signature: String! + + """ + GitHub user corresponding to the email signing this commit. + """ + signer: User + + """ + The state of this signature. `VALID` if signature is valid and verified by + GitHub, otherwise represents reason why signature is considered invalid. + """ + state: GitSignatureState! + + """ + True if the signature was made with GitHub's signing key. + """ + wasSignedByGitHub: Boolean! +} + +""" +The state of a Git signature. +""" +enum GitSignatureState { + """ + Valid signature and verified by GitHub + """ + VALID + + """ + Invalid signature + """ + INVALID + + """ + Malformed signature + """ + MALFORMED_SIG + + """ + Key used for signing not known to GitHub + """ + UNKNOWN_KEY + + """ + Invalid email used for signing + """ + BAD_EMAIL + + """ + Email used for signing unverified on GitHub + """ + UNVERIFIED_EMAIL + + """ + Email used for signing not known to GitHub + """ + NO_USER + + """ + Unknown signature type + """ + UNKNOWN_SIG_TYPE + + """ + Unsigned + """ + UNSIGNED + + """ + Internal error - the GPG verification service is unavailable at the moment + """ + GPGVERIFY_UNAVAILABLE + + """ + Internal error - the GPG verification service misbehaved + """ + GPGVERIFY_ERROR + + """ + The usage flags for the key that signed this don't allow signing + """ + NOT_SIGNING_KEY + + """ + Signing key expired + """ + EXPIRED_KEY + + """ + Valid signature, pending certificate revocation checking + """ + OCSP_PENDING + + """ + Valid siganture, though certificate revocation check failed + """ + OCSP_ERROR + + """ + The signing certificate or its chain could not be verified + """ + BAD_CERT + + """ + One or more certificates in chain has been revoked + """ + OCSP_REVOKED +} + +""" +Git SSH string +""" +scalar GitSSHRemote + +""" +An ISO-8601 encoded date string. Unlike the DateTime type, GitTimestamp is not converted in UTC. +""" +scalar GitTimestamp + +""" +Represents a GPG signature on a Commit or Tag. +""" +type GpgSignature implements GitSignature { + """ + Email used to sign this object. + """ + email: String! + + """ + True if the signature is valid and verified by GitHub. + """ + isValid: Boolean! + + """ + Hex-encoded ID of the key that signed this object. + """ + keyId: String + + """ + Payload for GPG signing object. Raw ODB object without the signature header. + """ + payload: String! + + """ + ASCII-armored signature header from object. + """ + signature: String! + + """ + GitHub user corresponding to the email signing this commit. + """ + signer: User + + """ + The state of this signature. `VALID` if signature is valid and verified by + GitHub, otherwise represents reason why signature is considered invalid. + """ + state: GitSignatureState! + + """ + True if the signature was made with GitHub's signing key. + """ + wasSignedByGitHub: Boolean! +} + +""" +Represents a 'head_ref_deleted' event on a given pull request. +""" +type HeadRefDeletedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the Ref associated with the `head_ref_deleted` event. + """ + headRef: Ref + + """ + Identifies the name of the Ref associated with the `head_ref_deleted` event. + """ + headRefName: String! + id: ID! + + """ + PullRequest referenced by event. + """ + pullRequest: PullRequest! +} + +""" +Represents a 'head_ref_force_pushed' event on a given pull request. +""" +type HeadRefForcePushedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the after commit SHA for the 'head_ref_force_pushed' event. + """ + afterCommit: Commit + + """ + Identifies the before commit SHA for the 'head_ref_force_pushed' event. + """ + beforeCommit: Commit + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + PullRequest referenced by event. + """ + pullRequest: PullRequest! + + """ + Identifies the fully qualified ref name for the 'head_ref_force_pushed' event. + """ + ref: Ref +} + +""" +Represents a 'head_ref_restored' event on a given pull request. +""" +type HeadRefRestoredEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + PullRequest referenced by event. + """ + pullRequest: PullRequest! +} + +""" +A string containing HTML code. +""" +scalar HTML + +""" +The possible states in which authentication can be configured with an identity provider. +""" +enum IdentityProviderConfigurationState { + """ + Authentication with an identity provider is configured and enforced. + """ + ENFORCED + + """ + Authentication with an identity provider is configured but not enforced. + """ + CONFIGURED + + """ + Authentication with an identity provider is not configured. + """ + UNCONFIGURED +} + +""" +Autogenerated input type of ImportProject +""" +input ImportProjectInput { + """ + The name of the Organization or User to create the Project under. + """ + ownerName: String! + + """ + The name of Project. + """ + name: String! + + """ + The description of Project. + """ + body: String + + """ + Whether the Project is public or not. + """ + public: Boolean = false + + """ + A list of columns containing issues and pull requests. + """ + columnImports: [ProjectColumnImport!]! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +An Issue is a place to discuss ideas, enhancements, tasks, and bugs for a project. +""" +type Issue implements Node & Assignable & Closable & Comment & Updatable & UpdatableComment & Labelable & Lockable & Reactable & RepositoryNode & Subscribable & UniformResourceLocatable { + """ + Reason that the conversation was locked. + """ + activeLockReason: LockReason + + """ + A list of Users assigned to this object. + """ + assignees( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserConnection! + + """ + The actor who authored the comment. + """ + author: Actor + + """ + Author's association with the subject of the comment. + """ + authorAssociation: CommentAuthorAssociation! + + """ + Identifies the body of the issue. + """ + body: String! + + """ + Identifies the body of the issue rendered to HTML. + """ + bodyHTML: HTML! + + """ + Identifies the body of the issue rendered to text. + """ + bodyText: String! + + """ + `true` if the object is closed (definition of closed may depend on type) + """ + closed: Boolean! + + """ + Identifies the date and time when the object was closed. + """ + closedAt: DateTime + + """ + A list of comments associated with the Issue. + """ + comments( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): IssueCommentConnection! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Check if this comment was created via an email reply. + """ + createdViaEmail: Boolean! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The actor who edited the comment. + """ + editor: Actor + id: ID! + + """ + Check if this comment was edited and includes an edit with the creation data + """ + includesCreatedEdit: Boolean! + + """ + A list of labels associated with the object. + """ + labels( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): LabelConnection + + """ + The moment the editor made the last edit + """ + lastEditedAt: DateTime + + """ + `true` if the object is locked + """ + locked: Boolean! + + """ + Identifies the milestone associated with the issue. + """ + milestone: Milestone + + """ + Identifies the issue number. + """ + number: Int! + + """ + A list of Users that are participating in the Issue conversation. + """ + participants( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserConnection! + + """ + List of project cards associated with this issue. + """ + projectCards( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + A list of archived states to filter the cards by + """ + archivedStates: [ProjectCardArchivedState] + ): ProjectCardConnection! + + """ + Identifies when the comment was published at. + """ + publishedAt: DateTime + + """ + A list of reactions grouped by content left on the subject. + """ + reactionGroups: [ReactionGroup!] + + """ + A list of Reactions left on the Issue. + """ + reactions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Allows filtering Reactions by emoji. + """ + content: ReactionContent + + """ + Allows specifying the order in which reactions are returned. + """ + orderBy: ReactionOrder + ): ReactionConnection! + + """ + The repository associated with this node. + """ + repository: Repository! + + """ + The HTTP path for this issue + """ + resourcePath: URI! + + """ + Identifies the state of the issue. + """ + state: IssueState! + + """ + A list of events, comments, commits, etc. associated with the issue. + """ + timeline( + """ + Allows filtering timeline events by a `since` timestamp. + """ + since: DateTime + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): IssueTimelineConnection! + + """ + A list of events, comments, commits, etc. associated with the issue. + """ + timelineItems( + """ + Filter timeline items by a `since` timestamp. + """ + since: DateTime + + """ + Skips the first _n_ elements in the list. + """ + skip: Int + + """ + Filter timeline items by type. + """ + itemTypes: [IssueTimelineItemsItemType!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): IssueTimelineItemsConnection! + + """ + Identifies the issue title. + """ + title: String! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this issue + """ + url: URI! + + """ + A list of edits to this content. + """ + userContentEdits( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserContentEditConnection + + """ + Can user react to this subject + """ + viewerCanReact: Boolean! + + """ + Check if the viewer is able to change their subscription status for the repository. + """ + viewerCanSubscribe: Boolean! + + """ + Check if the current viewer can update this object. + """ + viewerCanUpdate: Boolean! + + """ + Reasons why the current viewer can not update this comment. + """ + viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! + + """ + Did the viewer author this comment. + """ + viewerDidAuthor: Boolean! + + """ + Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. + """ + viewerSubscription: SubscriptionState +} + +""" +Represents a comment on an Issue. +""" +type IssueComment implements Node & Comment & Deletable & Updatable & UpdatableComment & Reactable & RepositoryNode { + """ + The actor who authored the comment. + """ + author: Actor + + """ + Author's association with the subject of the comment. + """ + authorAssociation: CommentAuthorAssociation! + + """ + The body as Markdown. + """ + body: String! + + """ + The body rendered to HTML. + """ + bodyHTML: HTML! + + """ + The body rendered to text. + """ + bodyText: String! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Check if this comment was created via an email reply. + """ + createdViaEmail: Boolean! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The actor who edited the comment. + """ + editor: Actor + id: ID! + + """ + Check if this comment was edited and includes an edit with the creation data + """ + includesCreatedEdit: Boolean! + + """ + Returns whether or not a comment has been minimized. + """ + isMinimized: Boolean! + + """ + Identifies the issue associated with the comment. + """ + issue: Issue! + + """ + The moment the editor made the last edit + """ + lastEditedAt: DateTime + + """ + Returns why the comment was minimized. + """ + minimizedReason: String + + """ + Identifies when the comment was published at. + """ + publishedAt: DateTime + + """ + Returns the pull request associated with the comment, if this comment was made on a + pull request. + """ + pullRequest: PullRequest + + """ + A list of reactions grouped by content left on the subject. + """ + reactionGroups: [ReactionGroup!] + + """ + A list of Reactions left on the Issue. + """ + reactions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Allows filtering Reactions by emoji. + """ + content: ReactionContent + + """ + Allows specifying the order in which reactions are returned. + """ + orderBy: ReactionOrder + ): ReactionConnection! + + """ + The repository associated with this node. + """ + repository: Repository! + + """ + The HTTP path for this issue comment + """ + resourcePath: URI! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this issue comment + """ + url: URI! + + """ + A list of edits to this content. + """ + userContentEdits( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserContentEditConnection + + """ + Check if the current viewer can delete this object. + """ + viewerCanDelete: Boolean! + + """ + Check if the current viewer can minimize this object. + """ + viewerCanMinimize: Boolean! + + """ + Can user react to this subject + """ + viewerCanReact: Boolean! + + """ + Check if the current viewer can update this object. + """ + viewerCanUpdate: Boolean! + + """ + Reasons why the current viewer can not update this comment. + """ + viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! + + """ + Did the viewer author this comment. + """ + viewerDidAuthor: Boolean! +} + +""" +The connection type for IssueComment. +""" +type IssueCommentConnection { + """ + A list of edges. + """ + edges: [IssueCommentEdge] + + """ + A list of nodes. + """ + nodes: [IssueComment] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type IssueCommentEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: IssueComment +} + +""" +The connection type for Issue. +""" +type IssueConnection { + """ + A list of edges. + """ + edges: [IssueEdge] + + """ + A list of nodes. + """ + nodes: [Issue] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +This aggregates issues opened by a user within one repository. +""" +type IssueContributionsByRepository { + """ + The issue contributions. + """ + contributions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for contributions returned from the connection. + """ + orderBy: ContributionOrder + ): CreatedIssueContributionConnection! + + """ + The repository in which the issues were opened. + """ + repository: Repository! +} + +""" +An edge in a connection. +""" +type IssueEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Issue +} + +""" +Ways in which to filter lists of issues. +""" +input IssueFilters { + """ + List issues assigned to given name. Pass in `null` for issues with no assigned + user, and `*` for issues assigned to any user. + """ + assignee: String + + """ + List issues created by given name. + """ + createdBy: String + + """ + List issues where the list of label names exist on the issue. + """ + labels: [String!] + + """ + List issues where the given name is mentioned in the issue. + """ + mentioned: String + + """ + List issues by given milestone argument. If an string representation of an + integer is passed, it should refer to a milestone by its number field. Pass in + `null` for issues with no milestone, and `*` for issues that are assigned to any milestone. + """ + milestone: String + + """ + List issues that have been updated at or after the given date. + """ + since: DateTime + + """ + List issues filtered by the list of states given. + """ + states: [IssueState!] + + """ + List issues subscribed to by viewer. + """ + viewerSubscribed: Boolean = false +} + +""" +Ways in which lists of issues can be ordered upon return. +""" +input IssueOrder { + """ + The field in which to order issues by. + """ + field: IssueOrderField! + + """ + The direction in which to order issues by the specified field. + """ + direction: OrderDirection! +} + +""" +Properties by which issue connections can be ordered. +""" +enum IssueOrderField { + """ + Order issues by creation time + """ + CREATED_AT + + """ + Order issues by update time + """ + UPDATED_AT + + """ + Order issues by comment count + """ + COMMENTS +} + +""" +Used for return value of Repository.issueOrPullRequest. +""" +union IssueOrPullRequest = Issue | PullRequest + +""" +The possible PubSub channels for an issue. +""" +enum IssuePubSubTopic { + """ + The channel ID for observing issue updates. + """ + UPDATED + + """ + The channel ID for marking an issue as read. + """ + MARKASREAD + + """ + The channel ID for updating items on the issue timeline. + """ + TIMELINE + + """ + The channel ID for observing issue state updates. + """ + STATE +} + +""" +The possible states of an issue. +""" +enum IssueState { + """ + An issue that is still open + """ + OPEN + + """ + An issue that has been closed + """ + CLOSED +} + +""" +The connection type for IssueTimelineItem. +""" +type IssueTimelineConnection { + """ + A list of edges. + """ + edges: [IssueTimelineItemEdge] + + """ + A list of nodes. + """ + nodes: [IssueTimelineItem] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An item in an issue timeline +""" +union IssueTimelineItem = + Commit + | IssueComment + | CrossReferencedEvent + | ClosedEvent + | ReopenedEvent + | SubscribedEvent + | UnsubscribedEvent + | ReferencedEvent + | AssignedEvent + | UnassignedEvent + | LabeledEvent + | UnlabeledEvent + | UserBlockedEvent + | MilestonedEvent + | DemilestonedEvent + | RenamedTitleEvent + | LockedEvent + | UnlockedEvent + | TransferredEvent + +""" +An edge in a connection. +""" +type IssueTimelineItemEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: IssueTimelineItem +} + +""" +An item in an issue timeline +""" +union IssueTimelineItems = + IssueComment + | CrossReferencedEvent + | AddedToProjectEvent + | AssignedEvent + | ClosedEvent + | CommentDeletedEvent + | ConvertedNoteToIssueEvent + | DemilestonedEvent + | LabeledEvent + | LockedEvent + | MentionedEvent + | MilestonedEvent + | MovedColumnsInProjectEvent + | PinnedEvent + | ReferencedEvent + | RemovedFromProjectEvent + | RenamedTitleEvent + | ReopenedEvent + | SubscribedEvent + | TransferredEvent + | UnassignedEvent + | UnlabeledEvent + | UnlockedEvent + | UserBlockedEvent + | UnpinnedEvent + | UnsubscribedEvent + +""" +The connection type for IssueTimelineItems. +""" +type IssueTimelineItemsConnection { + """ + A list of edges. + """ + edges: [IssueTimelineItemsEdge] + + """ + Identifies the count of items after applying `before` and `after` filters. + """ + filteredCount: Int! + + """ + A list of nodes. + """ + nodes: [IssueTimelineItems] + + """ + Identifies the count of items after applying `before`/`after` filters and `first`/`last`/`skip` slicing. + """ + pageCount: Int! + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! + + """ + Identifies the date and time when the timeline was last updated. + """ + updatedAt: DateTime! +} + +""" +An edge in a connection. +""" +type IssueTimelineItemsEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: IssueTimelineItems +} + +""" +The possible item types found in a timeline. +""" +enum IssueTimelineItemsItemType { + """ + Represents a comment on an Issue. + """ + ISSUE_COMMENT + + """ + Represents a mention made by one issue or pull request to another. + """ + CROSS_REFERENCED_EVENT + + """ + Represents a 'added_to_project' event on a given issue or pull request. + """ + ADDED_TO_PROJECT_EVENT + + """ + Represents an 'assigned' event on any assignable object. + """ + ASSIGNED_EVENT + + """ + Represents a 'closed' event on any `Closable`. + """ + CLOSED_EVENT + + """ + Represents a 'comment_deleted' event on a given issue or pull request. + """ + COMMENT_DELETED_EVENT + + """ + Represents a 'converted_note_to_issue' event on a given issue or pull request. + """ + CONVERTED_NOTE_TO_ISSUE_EVENT + + """ + Represents a 'demilestoned' event on a given issue or pull request. + """ + DEMILESTONED_EVENT + + """ + Represents a 'labeled' event on a given issue or pull request. + """ + LABELED_EVENT + + """ + Represents a 'locked' event on a given issue or pull request. + """ + LOCKED_EVENT + + """ + Represents a 'mentioned' event on a given issue or pull request. + """ + MENTIONED_EVENT + + """ + Represents a 'milestoned' event on a given issue or pull request. + """ + MILESTONED_EVENT + + """ + Represents a 'moved_columns_in_project' event on a given issue or pull request. + """ + MOVED_COLUMNS_IN_PROJECT_EVENT + + """ + Represents a 'pinned' event on a given issue or pull request. + """ + PINNED_EVENT + + """ + Represents a 'referenced' event on a given `ReferencedSubject`. + """ + REFERENCED_EVENT + + """ + Represents a 'removed_from_project' event on a given issue or pull request. + """ + REMOVED_FROM_PROJECT_EVENT + + """ + Represents a 'renamed' event on a given issue or pull request + """ + RENAMED_TITLE_EVENT + + """ + Represents a 'reopened' event on any `Closable`. + """ + REOPENED_EVENT + + """ + Represents a 'subscribed' event on a given `Subscribable`. + """ + SUBSCRIBED_EVENT + + """ + Represents a 'transferred' event on a given issue or pull request. + """ + TRANSFERRED_EVENT + + """ + Represents an 'unassigned' event on any assignable object. + """ + UNASSIGNED_EVENT + + """ + Represents an 'unlabeled' event on a given issue or pull request. + """ + UNLABELED_EVENT + + """ + Represents an 'unlocked' event on a given issue or pull request. + """ + UNLOCKED_EVENT + + """ + Represents a 'user_blocked' event on a given user. + """ + USER_BLOCKED_EVENT + + """ + Represents an 'unpinned' event on a given issue or pull request. + """ + UNPINNED_EVENT + + """ + Represents an 'unsubscribed' event on a given `Subscribable`. + """ + UNSUBSCRIBED_EVENT +} + +""" +Represents a user signing up for a GitHub account. +""" +type JoinedGitHubContribution implements Contribution { + """ + Whether this contribution is associated with a record you do not have access to. For + example, your own 'first issue' contribution may have been made on a repository you can no + longer access. + """ + isRestricted: Boolean! + + """ + When this contribution was made. + """ + occurredAt: DateTime! + + """ + The HTTP path for this contribution. + """ + resourcePath: URI! + + """ + The HTTP URL for this contribution. + """ + url: URI! + + """ + The user who made this contribution. + """ + user: User! +} + +""" +A label for categorizing Issues or Milestones with a given Repository. +""" +type Label implements Node { + """ + Identifies the label color. + """ + color: String! + + """ + Identifies the date and time when the label was created. + """ + createdAt: DateTime + + """ + A brief description of this label. + """ + description: String + id: ID! + + """ + Indicates whether or not this is a default label. + """ + isDefault: Boolean! + + """ + A list of issues associated with this label. + """ + issues( + """ + Ordering options for issues returned from the connection. + """ + orderBy: IssueOrder + + """ + A list of label names to filter the pull requests by. + """ + labels: [String!] + + """ + A list of states to filter the issues by. + """ + states: [IssueState!] + + """ + Filtering options for issues returned from the connection. + """ + filterBy: IssueFilters + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): IssueConnection! + + """ + Identifies the label name. + """ + name: String! + + """ + A list of pull requests associated with this label. + """ + pullRequests( + """ + A list of states to filter the pull requests by. + """ + states: [PullRequestState!] + + """ + A list of label names to filter the pull requests by. + """ + labels: [String!] + + """ + The head ref name to filter the pull requests by. + """ + headRefName: String + + """ + The base ref name to filter the pull requests by. + """ + baseRefName: String + + """ + Ordering options for pull requests returned from the connection. + """ + orderBy: IssueOrder + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PullRequestConnection! + + """ + The repository associated with this label. + """ + repository: Repository! + + """ + The HTTP path for this label. + """ + resourcePath: URI! + + """ + Identifies the date and time when the label was last updated. + """ + updatedAt: DateTime + + """ + The HTTP URL for this label. + """ + url: URI! +} + +""" +An object that can have labels assigned to it. +""" +interface Labelable { + """ + A list of labels associated with the object. + """ + labels( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): LabelConnection +} + +""" +The connection type for Label. +""" +type LabelConnection { + """ + A list of edges. + """ + edges: [LabelEdge] + + """ + A list of nodes. + """ + nodes: [Label] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +Represents a 'labeled' event on a given issue or pull request. +""" +type LabeledEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Identifies the label associated with the 'labeled' event. + """ + label: Label! + + """ + Identifies the `Labelable` associated with the event. + """ + labelable: Labelable! +} + +""" +An edge in a connection. +""" +type LabelEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Label +} + +""" +Represents a given language found in repositories. +""" +type Language implements Node { + """ + The color defined for the current language. + """ + color: String + id: ID! + + """ + The name of the current language. + """ + name: String! +} + +""" +A list of languages associated with the parent. +""" +type LanguageConnection { + """ + A list of edges. + """ + edges: [LanguageEdge] + + """ + A list of nodes. + """ + nodes: [Language] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! + + """ + The total size in bytes of files written in that language. + """ + totalSize: Int! +} + +""" +Represents the language of a repository. +""" +type LanguageEdge { + cursor: String! + node: Language! + + """ + The number of bytes of code written in the language. + """ + size: Int! +} + +""" +Ordering options for language connections. +""" +input LanguageOrder { + """ + The field to order languages by. + """ + field: LanguageOrderField! + + """ + The ordering direction. + """ + direction: OrderDirection! +} + +""" +Properties by which language connections can be ordered. +""" +enum LanguageOrderField { + """ + Order languages by the size of all files containing the language + """ + SIZE +} + +""" +A repository's open source license +""" +type License implements Node { + """ + The full text of the license + """ + body: String! + + """ + The conditions set by the license + """ + conditions: [LicenseRule]! + + """ + A human-readable description of the license + """ + description: String + + """ + Whether the license should be featured + """ + featured: Boolean! + + """ + Whether the license should be displayed in license pickers + """ + hidden: Boolean! + id: ID! + + """ + Instructions on how to implement the license + """ + implementation: String + + """ + The lowercased SPDX ID of the license + """ + key: String! + + """ + The limitations set by the license + """ + limitations: [LicenseRule]! + + """ + The license full name specified by + """ + name: String! + + """ + Customary short name if applicable (e.g, GPLv3) + """ + nickname: String + + """ + The permissions set by the license + """ + permissions: [LicenseRule]! + + """ + Whether the license is a pseudo-license placeholder (e.g., other, no-license) + """ + pseudoLicense: Boolean! + + """ + Short identifier specified by + """ + spdxId: String + + """ + URL to the license on + """ + url: URI +} + +""" +Describes a License's conditions, permissions, and limitations +""" +type LicenseRule { + """ + A description of the rule + """ + description: String! + + """ + The machine-readable rule key + """ + key: String! + + """ + The human-readable rule label + """ + label: String! +} + +""" +An object that can be locked. +""" +interface Lockable { + """ + Reason that the conversation was locked. + """ + activeLockReason: LockReason + + """ + `true` if the object is locked + """ + locked: Boolean! +} + +""" +Represents a 'locked' event on a given issue or pull request. +""" +type LockedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Reason that the conversation was locked (optional). + """ + lockReason: LockReason + + """ + Object that was locked. + """ + lockable: Lockable! +} + +""" +Autogenerated input type of LockLockable +""" +input LockLockableInput { + """ + ID of the issue or pull request to be locked. + """ + lockableId: ID! + + """ + A reason for why the issue or pull request will be locked. + """ + lockReason: LockReason + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of LockLockable +""" +type LockLockablePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The item that was locked. + """ + lockedRecord: Lockable +} + +""" +The possible reasons that an issue or pull request was locked. +""" +enum LockReason { + """ + The issue or pull request was locked because the conversation was off-topic. + """ + OFF_TOPIC + + """ + The issue or pull request was locked because the conversation was too heated. + """ + TOO_HEATED + + """ + The issue or pull request was locked because the conversation was resolved. + """ + RESOLVED + + """ + The issue or pull request was locked because the conversation was spam. + """ + SPAM +} + +""" +A placeholder user for attribution of imported data on GitHub. +""" +type Mannequin implements Node & Actor & UniformResourceLocatable { + """ + A URL pointing to the GitHub App's public avatar. + """ + avatarUrl( + """ + The size of the resulting square image. + """ + size: Int + ): URI! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! + + """ + The username of the actor. + """ + login: String! + + """ + The HTML path to this resource. + """ + resourcePath: URI! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The URL to this resource. + """ + url: URI! +} + +""" +A public description of a Marketplace category. +""" +type MarketplaceCategory implements Node { + """ + The category's description. + """ + description: String + + """ + The technical description of how apps listed in this category work with GitHub. + """ + howItWorks: String + id: ID! + + """ + The category's name. + """ + name: String! + + """ + How many Marketplace listings have this as their primary category. + """ + primaryListingCount: Int! + + """ + The HTTP path for this Marketplace category. + """ + resourcePath: URI! + + """ + How many Marketplace listings have this as their secondary category. + """ + secondaryListingCount: Int! + + """ + The short name of the category used in its URL. + """ + slug: String! + + """ + The HTTP URL for this Marketplace category. + """ + url: URI! +} + +""" +A listing in the GitHub integration marketplace. +""" +type MarketplaceListing implements Node { + """ + The GitHub App this listing represents. + """ + app: App + + """ + URL to the listing owner's company site. + """ + companyUrl: URI + + """ + The HTTP path for configuring access to the listing's integration or OAuth app + """ + configurationResourcePath: URI! + + """ + The HTTP URL for configuring access to the listing's integration or OAuth app + """ + configurationUrl: URI! + + """ + URL to the listing's documentation. + """ + documentationUrl: URI + + """ + The listing's detailed description. + """ + extendedDescription: String + + """ + The listing's detailed description rendered to HTML. + """ + extendedDescriptionHTML: HTML! + + """ + The listing's introductory description. + """ + fullDescription: String! + + """ + The listing's introductory description rendered to HTML. + """ + fullDescriptionHTML: HTML! + + """ + Whether this listing has been submitted for review from GitHub for approval to be displayed in the Marketplace. + """ + hasApprovalBeenRequested: Boolean! + @deprecated( + reason: "`hasApprovalBeenRequested` will be removed. Use `isVerificationPendingFromDraft` instead. Removal on 2019-10-01 UTC." + ) + + """ + Does this listing have any plans with a free trial? + """ + hasPublishedFreeTrialPlans: Boolean! + + """ + Does this listing have a terms of service link? + """ + hasTermsOfService: Boolean! + + """ + A technical description of how this app works with GitHub. + """ + howItWorks: String + + """ + The listing's technical description rendered to HTML. + """ + howItWorksHTML: HTML! + id: ID! + + """ + URL to install the product to the viewer's account or organization. + """ + installationUrl: URI + + """ + Whether this listing's app has been installed for the current viewer + """ + installedForViewer: Boolean! + + """ + Whether this listing has been approved for display in the Marketplace. + """ + isApproved: Boolean! + @deprecated( + reason: "`isApproved` will be removed. Use `isPublic` instead. Removal on 2019-10-01 UTC." + ) + + """ + Whether this listing has been removed from the Marketplace. + """ + isArchived: Boolean! + + """ + Whether this listing has been removed from the Marketplace. + """ + isDelisted: Boolean! + @deprecated( + reason: "`isDelisted` will be removed. Use `isArchived` instead. Removal on 2019-10-01 UTC." + ) + + """ + Whether this listing is still an editable draft that has not been submitted + for review and is not publicly visible in the Marketplace. + """ + isDraft: Boolean! + + """ + Whether the product this listing represents is available as part of a paid plan. + """ + isPaid: Boolean! + + """ + Whether this listing has been approved for display in the Marketplace. + """ + isPublic: Boolean! + + """ + Whether this listing has been rejected by GitHub for display in the Marketplace. + """ + isRejected: Boolean! + + """ + Whether this listing has been approved for unverified display in the Marketplace. + """ + isUnverified: Boolean! + + """ + Whether this draft listing has been submitted for review for approval to be unverified in the Marketplace. + """ + isUnverifiedPending: Boolean! + + """ + Whether this draft listing has been submitted for review from GitHub for approval to be verified in the Marketplace. + """ + isVerificationPendingFromDraft: Boolean! + + """ + Whether this unverified listing has been submitted for review from GitHub for approval to be verified in the Marketplace. + """ + isVerificationPendingFromUnverified: Boolean! + + """ + Whether this listing has been approved for verified display in the Marketplace. + """ + isVerified: Boolean! + + """ + The hex color code, without the leading '#', for the logo background. + """ + logoBackgroundColor: String! + + """ + URL for the listing's logo image. + """ + logoUrl( + """ + The size in pixels of the resulting square image. + """ + size: Int = 400 + ): URI + + """ + The listing's full name. + """ + name: String! + + """ + The listing's very short description without a trailing period or ampersands. + """ + normalizedShortDescription: String! + + """ + URL to the listing's detailed pricing. + """ + pricingUrl: URI + + """ + The category that best describes the listing. + """ + primaryCategory: MarketplaceCategory! + + """ + URL to the listing's privacy policy, may return an empty string for listings that do not require a privacy policy URL. + """ + privacyPolicyUrl: URI! + + """ + The HTTP path for the Marketplace listing. + """ + resourcePath: URI! + + """ + The URLs for the listing's screenshots. + """ + screenshotUrls: [String]! + + """ + An alternate category that describes the listing. + """ + secondaryCategory: MarketplaceCategory + + """ + The listing's very short description. + """ + shortDescription: String! + + """ + The short name of the listing used in its URL. + """ + slug: String! + + """ + URL to the listing's status page. + """ + statusUrl: URI + + """ + An email address for support for this listing's app. + """ + supportEmail: String + + """ + Either a URL or an email address for support for this listing's app, may + return an empty string for listings that do not require a support URL. + """ + supportUrl: URI! + + """ + URL to the listing's terms of service. + """ + termsOfServiceUrl: URI + + """ + The HTTP URL for the Marketplace listing. + """ + url: URI! + + """ + Can the current viewer add plans for this Marketplace listing. + """ + viewerCanAddPlans: Boolean! + + """ + Can the current viewer approve this Marketplace listing. + """ + viewerCanApprove: Boolean! + + """ + Can the current viewer delist this Marketplace listing. + """ + viewerCanDelist: Boolean! + + """ + Can the current viewer edit this Marketplace listing. + """ + viewerCanEdit: Boolean! + + """ + Can the current viewer edit the primary and secondary category of this + Marketplace listing. + """ + viewerCanEditCategories: Boolean! + + """ + Can the current viewer edit the plans for this Marketplace listing. + """ + viewerCanEditPlans: Boolean! + + """ + Can the current viewer return this Marketplace listing to draft state + so it becomes editable again. + """ + viewerCanRedraft: Boolean! + + """ + Can the current viewer reject this Marketplace listing by returning it to + an editable draft state or rejecting it entirely. + """ + viewerCanReject: Boolean! + + """ + Can the current viewer request this listing be reviewed for display in + the Marketplace as verified. + """ + viewerCanRequestApproval: Boolean! + + """ + Indicates whether the current user has an active subscription to this Marketplace listing. + """ + viewerHasPurchased: Boolean! + + """ + Indicates if the current user has purchased a subscription to this Marketplace listing + for all of the organizations the user owns. + """ + viewerHasPurchasedForAllOrganizations: Boolean! + + """ + Does the current viewer role allow them to administer this Marketplace listing. + """ + viewerIsListingAdmin: Boolean! +} + +""" +Look up Marketplace Listings +""" +type MarketplaceListingConnection { + """ + A list of edges. + """ + edges: [MarketplaceListingEdge] + + """ + A list of nodes. + """ + nodes: [MarketplaceListing] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type MarketplaceListingEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: MarketplaceListing +} + +""" +Entities that have members who can set status messages. +""" +interface MemberStatusable { + """ + Get the status messages members of this entity have set that are either public or visible only to the organization. + """ + memberStatuses( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for user statuses returned from the connection. + """ + orderBy: UserStatusOrder + ): UserStatusConnection! +} + +""" +Represents a 'mentioned' event on a given issue or pull request. +""" +type MentionedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! +} + +""" +Whether or not a PullRequest can be merged. +""" +enum MergeableState { + """ + The pull request can be merged. + """ + MERGEABLE + + """ + The pull request cannot be merged due to merge conflicts. + """ + CONFLICTING + + """ + The mergeability of the pull request is still being calculated. + """ + UNKNOWN +} + +""" +Represents a 'merged' event on a given pull request. +""" +type MergedEvent implements Node & UniformResourceLocatable { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the commit associated with the `merge` event. + """ + commit: Commit + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Identifies the Ref associated with the `merge` event. + """ + mergeRef: Ref + + """ + Identifies the name of the Ref associated with the `merge` event. + """ + mergeRefName: String! + + """ + PullRequest referenced by event. + """ + pullRequest: PullRequest! + + """ + The HTTP path for this merged event. + """ + resourcePath: URI! + + """ + The HTTP URL for this merged event. + """ + url: URI! +} + +""" +Autogenerated input type of MergePullRequest +""" +input MergePullRequestInput { + """ + ID of the pull request to be merged. + """ + pullRequestId: ID! + + """ + Commit headline to use for the merge commit; if omitted, a default message will be used. + """ + commitHeadline: String + + """ + Commit body to use for the merge commit; if omitted, a default message will be used + """ + commitBody: String + + """ + OID that the pull request head ref must match to allow merge; if omitted, no check is performed. + """ + expectedHeadOid: GitObjectID + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of MergePullRequest +""" +type MergePullRequestPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The pull request that was merged. + """ + pullRequest: PullRequest +} + +""" +Represents a Milestone object on a given repository. +""" +type Milestone implements Node & Closable & UniformResourceLocatable { + """ + `true` if the object is closed (definition of closed may depend on type) + """ + closed: Boolean! + + """ + Identifies the date and time when the object was closed. + """ + closedAt: DateTime + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the actor who created the milestone. + """ + creator: Actor + + """ + Identifies the description of the milestone. + """ + description: String + + """ + Identifies the due date of the milestone. + """ + dueOn: DateTime + id: ID! + + """ + A list of issues associated with the milestone. + """ + issues( + """ + Ordering options for issues returned from the connection. + """ + orderBy: IssueOrder + + """ + A list of label names to filter the pull requests by. + """ + labels: [String!] + + """ + A list of states to filter the issues by. + """ + states: [IssueState!] + + """ + Filtering options for issues returned from the connection. + """ + filterBy: IssueFilters + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): IssueConnection! + + """ + Identifies the number of the milestone. + """ + number: Int! + + """ + A list of pull requests associated with the milestone. + """ + pullRequests( + """ + A list of states to filter the pull requests by. + """ + states: [PullRequestState!] + + """ + A list of label names to filter the pull requests by. + """ + labels: [String!] + + """ + The head ref name to filter the pull requests by. + """ + headRefName: String + + """ + The base ref name to filter the pull requests by. + """ + baseRefName: String + + """ + Ordering options for pull requests returned from the connection. + """ + orderBy: IssueOrder + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PullRequestConnection! + + """ + The repository associated with this milestone. + """ + repository: Repository! + + """ + The HTTP path for this milestone + """ + resourcePath: URI! + + """ + Identifies the state of the milestone. + """ + state: MilestoneState! + + """ + Identifies the title of the milestone. + """ + title: String! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this milestone + """ + url: URI! +} + +""" +The connection type for Milestone. +""" +type MilestoneConnection { + """ + A list of edges. + """ + edges: [MilestoneEdge] + + """ + A list of nodes. + """ + nodes: [Milestone] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +Represents a 'milestoned' event on a given issue or pull request. +""" +type MilestonedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Identifies the milestone title associated with the 'milestoned' event. + """ + milestoneTitle: String! + + """ + Object referenced by event. + """ + subject: MilestoneItem! +} + +""" +An edge in a connection. +""" +type MilestoneEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Milestone +} + +""" +Types that can be inside a Milestone. +""" +union MilestoneItem = Issue | PullRequest + +""" +Ordering options for milestone connections. +""" +input MilestoneOrder { + """ + The field to order milestones by. + """ + field: MilestoneOrderField! + + """ + The ordering direction. + """ + direction: OrderDirection! +} + +""" +Properties by which milestone connections can be ordered. +""" +enum MilestoneOrderField { + """ + Order milestones by when they are due. + """ + DUE_DATE + + """ + Order milestones by when they were created. + """ + CREATED_AT + + """ + Order milestones by when they were last updated. + """ + UPDATED_AT + + """ + Order milestones by their number. + """ + NUMBER +} + +""" +The possible states of a milestone. +""" +enum MilestoneState { + """ + A milestone that is still open. + """ + OPEN + + """ + A milestone that has been closed. + """ + CLOSED +} + +""" +Autogenerated input type of MinimizeComment +""" +input MinimizeCommentInput { + """ + The Node ID of the subject to modify. + """ + subjectId: ID! + + """ + The classification of comment + """ + classifier: ReportedContentClassifiers! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Represents a 'moved_columns_in_project' event on a given issue or pull request. +""" +type MovedColumnsInProjectEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! +} + +""" +Autogenerated input type of MoveProjectCard +""" +input MoveProjectCardInput { + """ + The id of the card to move. + """ + cardId: ID! + + """ + The id of the column to move it into. + """ + columnId: ID! + + """ + Place the new card after the card with this id. Pass null to place it at the top. + """ + afterCardId: ID + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of MoveProjectCard +""" +type MoveProjectCardPayload { + """ + The new edge of the moved card. + """ + cardEdge: ProjectCardEdge + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated input type of MoveProjectColumn +""" +input MoveProjectColumnInput { + """ + The id of the column to move. + """ + columnId: ID! + + """ + Place the new column after the column with this id. Pass null to place it at the front. + """ + afterColumnId: ID + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of MoveProjectColumn +""" +type MoveProjectColumnPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The new edge of the moved column. + """ + columnEdge: ProjectColumnEdge +} + +""" +The root query for implementing GraphQL mutations. +""" +type Mutation { + """ + Applies a suggested topic to the repository. + """ + acceptTopicSuggestion( + input: AcceptTopicSuggestionInput! + ): AcceptTopicSuggestionPayload + + """ + Adds assignees to an assignable object. + """ + addAssigneesToAssignable( + input: AddAssigneesToAssignableInput! + ): AddAssigneesToAssignablePayload + + """ + Adds a comment to an Issue or Pull Request. + """ + addComment(input: AddCommentInput!): AddCommentPayload + + """ + Adds labels to a labelable object. + """ + addLabelsToLabelable( + input: AddLabelsToLabelableInput! + ): AddLabelsToLabelablePayload + + """ + Adds a card to a ProjectColumn. Either `contentId` or `note` must be provided but **not** both. + """ + addProjectCard(input: AddProjectCardInput!): AddProjectCardPayload + + """ + Adds a column to a Project. + """ + addProjectColumn(input: AddProjectColumnInput!): AddProjectColumnPayload + + """ + Adds a review to a Pull Request. + """ + addPullRequestReview( + input: AddPullRequestReviewInput! + ): AddPullRequestReviewPayload + + """ + Adds a comment to a review. + """ + addPullRequestReviewComment( + input: AddPullRequestReviewCommentInput! + ): AddPullRequestReviewCommentPayload + + """ + Adds a reaction to a subject. + """ + addReaction(input: AddReactionInput!): AddReactionPayload + + """ + Adds a star to a Starrable. + """ + addStar(input: AddStarInput!): AddStarPayload + + """ + Update your status on GitHub. + """ + changeUserStatus(input: ChangeUserStatusInput!): ChangeUserStatusPayload + + """ + Clears all labels from a labelable object. + """ + clearLabelsFromLabelable( + input: ClearLabelsFromLabelableInput! + ): ClearLabelsFromLabelablePayload + + """ + Creates a new project by cloning configuration from an existing project. + """ + cloneProject(input: CloneProjectInput!): CloneProjectPayload + + """ + Close an issue. + """ + closeIssue(input: CloseIssueInput!): CloseIssuePayload + + """ + Close a pull request. + """ + closePullRequest(input: ClosePullRequestInput!): ClosePullRequestPayload + + """ + Convert a project note card to one associated with a newly created issue. + """ + convertProjectCardNoteToIssue( + input: ConvertProjectCardNoteToIssueInput! + ): ConvertProjectCardNoteToIssuePayload + + """ + Create a new branch protection rule + """ + createBranchProtectionRule( + input: CreateBranchProtectionRuleInput! + ): CreateBranchProtectionRulePayload + + """ + Creates a new issue. + """ + createIssue(input: CreateIssueInput!): CreateIssuePayload + + """ + Creates a new project. + """ + createProject(input: CreateProjectInput!): CreateProjectPayload + + """ + Create a new pull request + """ + createPullRequest(input: CreatePullRequestInput!): CreatePullRequestPayload + + """ + Rejects a suggested topic for the repository. + """ + declineTopicSuggestion( + input: DeclineTopicSuggestionInput! + ): DeclineTopicSuggestionPayload + + """ + Delete a branch protection rule + """ + deleteBranchProtectionRule( + input: DeleteBranchProtectionRuleInput! + ): DeleteBranchProtectionRulePayload + + """ + Deletes an Issue object. + """ + deleteIssue(input: DeleteIssueInput!): DeleteIssuePayload + + """ + Deletes an IssueComment object. + """ + deleteIssueComment(input: DeleteIssueCommentInput!): DeleteIssueCommentPayload + + """ + Deletes a project. + """ + deleteProject(input: DeleteProjectInput!): DeleteProjectPayload + + """ + Deletes a project card. + """ + deleteProjectCard(input: DeleteProjectCardInput!): DeleteProjectCardPayload + + """ + Deletes a project column. + """ + deleteProjectColumn( + input: DeleteProjectColumnInput! + ): DeleteProjectColumnPayload + + """ + Deletes a pull request review. + """ + deletePullRequestReview( + input: DeletePullRequestReviewInput! + ): DeletePullRequestReviewPayload + + """ + Deletes a pull request review comment. + """ + deletePullRequestReviewComment( + input: DeletePullRequestReviewCommentInput! + ): DeletePullRequestReviewCommentPayload + + """ + Dismisses an approved or rejected pull request review. + """ + dismissPullRequestReview( + input: DismissPullRequestReviewInput! + ): DismissPullRequestReviewPayload + + """ + Lock a lockable object + """ + lockLockable(input: LockLockableInput!): LockLockablePayload + + """ + Merge a pull request. + """ + mergePullRequest(input: MergePullRequestInput!): MergePullRequestPayload + + """ + Moves a project card to another place. + """ + moveProjectCard(input: MoveProjectCardInput!): MoveProjectCardPayload + + """ + Moves a project column to another place. + """ + moveProjectColumn(input: MoveProjectColumnInput!): MoveProjectColumnPayload + + """ + Removes assignees from an assignable object. + """ + removeAssigneesFromAssignable( + input: RemoveAssigneesFromAssignableInput! + ): RemoveAssigneesFromAssignablePayload + + """ + Removes labels from a Labelable object. + """ + removeLabelsFromLabelable( + input: RemoveLabelsFromLabelableInput! + ): RemoveLabelsFromLabelablePayload + + """ + Removes outside collaborator from all repositories in an organization. + """ + removeOutsideCollaborator( + input: RemoveOutsideCollaboratorInput! + ): RemoveOutsideCollaboratorPayload + + """ + Removes a reaction from a subject. + """ + removeReaction(input: RemoveReactionInput!): RemoveReactionPayload + + """ + Removes a star from a Starrable. + """ + removeStar(input: RemoveStarInput!): RemoveStarPayload + + """ + Reopen a issue. + """ + reopenIssue(input: ReopenIssueInput!): ReopenIssuePayload + + """ + Reopen a pull request. + """ + reopenPullRequest(input: ReopenPullRequestInput!): ReopenPullRequestPayload + + """ + Set review requests on a pull request. + """ + requestReviews(input: RequestReviewsInput!): RequestReviewsPayload + + """ + Marks a review thread as resolved. + """ + resolveReviewThread( + input: ResolveReviewThreadInput! + ): ResolveReviewThreadPayload + + """ + Submits a pending pull request review. + """ + submitPullRequestReview( + input: SubmitPullRequestReviewInput! + ): SubmitPullRequestReviewPayload + + """ + Unlock a lockable object + """ + unlockLockable(input: UnlockLockableInput!): UnlockLockablePayload + + """ + Unmark an issue as a duplicate of another issue. + """ + unmarkIssueAsDuplicate( + input: UnmarkIssueAsDuplicateInput! + ): UnmarkIssueAsDuplicatePayload + + """ + Marks a review thread as unresolved. + """ + unresolveReviewThread( + input: UnresolveReviewThreadInput! + ): UnresolveReviewThreadPayload + + """ + Create a new branch protection rule + """ + updateBranchProtectionRule( + input: UpdateBranchProtectionRuleInput! + ): UpdateBranchProtectionRulePayload + + """ + Updates an Issue. + """ + updateIssue(input: UpdateIssueInput!): UpdateIssuePayload + + """ + Updates an IssueComment object. + """ + updateIssueComment(input: UpdateIssueCommentInput!): UpdateIssueCommentPayload + + """ + Updates an existing project. + """ + updateProject(input: UpdateProjectInput!): UpdateProjectPayload + + """ + Updates an existing project card. + """ + updateProjectCard(input: UpdateProjectCardInput!): UpdateProjectCardPayload + + """ + Updates an existing project column. + """ + updateProjectColumn( + input: UpdateProjectColumnInput! + ): UpdateProjectColumnPayload + + """ + Update a pull request + """ + updatePullRequest(input: UpdatePullRequestInput!): UpdatePullRequestPayload + + """ + Updates the body of a pull request review. + """ + updatePullRequestReview( + input: UpdatePullRequestReviewInput! + ): UpdatePullRequestReviewPayload + + """ + Updates a pull request review comment. + """ + updatePullRequestReviewComment( + input: UpdatePullRequestReviewCommentInput! + ): UpdatePullRequestReviewCommentPayload + + """ + Updates the state for subscribable subjects. + """ + updateSubscription(input: UpdateSubscriptionInput!): UpdateSubscriptionPayload + + """ + Replaces the repository's topics with the given topics. + """ + updateTopics(input: UpdateTopicsInput!): UpdateTopicsPayload +} + +""" +An object with an ID. +""" +interface Node { + """ + ID of the object. + """ + id: ID! +} + +""" +Possible directions in which to order a list of items when provided an `orderBy` argument. +""" +enum OrderDirection { + """ + Specifies an ascending order for a given `orderBy` argument. + """ + ASC + + """ + Specifies a descending order for a given `orderBy` argument. + """ + DESC +} + +""" +An account on GitHub, with one or more owners, that has repositories, members and teams. +""" +type Organization implements Node & Actor & RegistryPackageOwner & RegistryPackageSearch & ProjectOwner & RepositoryOwner & UniformResourceLocatable & MemberStatusable & ProfileOwner { + """ + Determine if this repository owner has any items that can be pinned to their profile. + """ + anyPinnableItems( + """ + Filter to only a particular kind of pinnable item. + """ + type: PinnableItemType + ): Boolean! + + """ + A URL pointing to the organization's public avatar. + """ + avatarUrl( + """ + The size of the resulting square image. + """ + size: Int + ): URI! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The organization's public profile description. + """ + description: String + + """ + The organization's public email. + """ + email: String + id: ID! + + """ + Whether the organization has verified its profile email and website. + """ + isVerified: Boolean! + + """ + Showcases a selection of repositories and gists that the profile owner has + either curated or that have been selected automatically based on popularity. + """ + itemShowcase: ProfileItemShowcase! + + """ + The organization's public profile location. + """ + location: String + + """ + The organization's login name. + """ + login: String! + + """ + Get the status messages members of this entity have set that are either public or visible only to the organization. + """ + memberStatuses( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for user statuses returned from the connection. + """ + orderBy: UserStatusOrder + ): UserStatusConnection! + + """ + A list of users who are members of this organization. + """ + membersWithRole( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): OrganizationMemberConnection! + + """ + The organization's public profile name. + """ + name: String + + """ + The HTTP path creating a new team + """ + newTeamResourcePath: URI! + + """ + The HTTP URL creating a new team + """ + newTeamUrl: URI! + + """ + The billing email for the organization. + """ + organizationBillingEmail: String + + """ + A list of users who have been invited to join this organization. + """ + pendingMembers( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserConnection! + + """ + A list of repositories and gists this profile owner can pin to their profile. + """ + pinnableItems( + """ + Filter the types of pinnable items that are returned. + """ + types: [PinnableItemType!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PinnableItemConnection! + + """ + A list of repositories and gists this profile owner has pinned to their profile + """ + pinnedItems( + """ + Filter the types of pinned items that are returned. + """ + types: [PinnableItemType!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PinnableItemConnection! + + """ + Returns how many more items this profile owner can pin to their profile. + """ + pinnedItemsRemaining: Int! + + """ + A list of repositories this user has pinned to their profile + """ + pinnedRepositories( + """ + If non-null, filters repositories according to privacy + """ + privacy: RepositoryPrivacy + + """ + Ordering options for repositories returned from the connection + """ + orderBy: RepositoryOrder + + """ + Array of viewer's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + current viewer owns. + """ + affiliations: [RepositoryAffiliation] + + """ + Array of owner's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + organization or user being viewed owns. + """ + ownerAffiliations: [RepositoryAffiliation] + + """ + If non-null, filters repositories according to whether they have been locked + """ + isLocked: Boolean + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): RepositoryConnection! + @deprecated( + reason: "pinnedRepositories will be removed Use ProfileOwner.pinnedItems instead. Removal on 2019-07-01 UTC." + ) + + """ + Find project by number. + """ + project( + """ + The project number to find. + """ + number: Int! + ): Project + + """ + A list of projects under the owner. + """ + projects( + """ + Ordering options for projects returned from the connection + """ + orderBy: ProjectOrder + + """ + Query to search projects by, currently only searching by name. + """ + search: String + + """ + A list of states to filter the projects by. + """ + states: [ProjectState!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): ProjectConnection! + + """ + The HTTP path listing organization's projects + """ + projectsResourcePath: URI! + + """ + The HTTP URL listing organization's projects + """ + projectsUrl: URI! + + """ + A list of repositories that the user owns. + """ + repositories( + """ + If non-null, filters repositories according to privacy + """ + privacy: RepositoryPrivacy + + """ + Ordering options for repositories returned from the connection + """ + orderBy: RepositoryOrder + + """ + Array of viewer's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + current viewer owns. + """ + affiliations: [RepositoryAffiliation] + + """ + Array of owner's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + organization or user being viewed owns. + """ + ownerAffiliations: [RepositoryAffiliation] + + """ + If non-null, filters repositories according to whether they have been locked + """ + isLocked: Boolean + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + If non-null, filters repositories according to whether they are forks of another repository + """ + isFork: Boolean + ): RepositoryConnection! + + """ + Find Repository. + """ + repository( + """ + Name of Repository to find. + """ + name: String! + ): Repository + + """ + When true the organization requires all members, billing managers, and outside + collaborators to enable two-factor authentication. + """ + requiresTwoFactorAuthentication: Boolean + + """ + The HTTP path for this organization. + """ + resourcePath: URI! + + """ + The Organization's SAML identity providers + """ + samlIdentityProvider: OrganizationIdentityProvider + + """ + Find an organization's team by its slug. + """ + team( + """ + The name or slug of the team to find. + """ + slug: String! + ): Team + + """ + A list of teams in this organization. + """ + teams( + """ + If non-null, filters teams according to privacy + """ + privacy: TeamPrivacy + + """ + If non-null, filters teams according to whether the viewer is an admin or member on team + """ + role: TeamRole + + """ + If non-null, filters teams with query on team name and team slug + """ + query: String + + """ + User logins to filter by + """ + userLogins: [String!] + + """ + Ordering options for teams returned from the connection + """ + orderBy: TeamOrder + + """ + If true, filters teams that are mapped to an LDAP Group (Enterprise only) + """ + ldapMapped: Boolean + + """ + If true, restrict to only root teams + """ + rootTeamsOnly: Boolean = false + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): TeamConnection! + + """ + The HTTP path listing organization's teams + """ + teamsResourcePath: URI! + + """ + The HTTP URL listing organization's teams + """ + teamsUrl: URI! + + """ + The HTTP URL for this organization. + """ + url: URI! + + """ + Organization is adminable by the viewer. + """ + viewerCanAdminister: Boolean! + + """ + Can the viewer pin repositories and gists to the profile? + """ + viewerCanChangePinnedItems: Boolean! + + """ + Can the current viewer create new projects on this owner. + """ + viewerCanCreateProjects: Boolean! + + """ + Viewer can create repositories on this organization + """ + viewerCanCreateRepositories: Boolean! + + """ + Viewer can create teams on this organization. + """ + viewerCanCreateTeams: Boolean! + + """ + Viewer is an active member of this organization. + """ + viewerIsAMember: Boolean! + + """ + The organization's public profile URL. + """ + websiteUrl: URI +} + +""" +The connection type for Organization. +""" +type OrganizationConnection { + """ + A list of edges. + """ + edges: [OrganizationEdge] + + """ + A list of nodes. + """ + nodes: [Organization] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type OrganizationEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Organization +} + +""" +An Identity Provider configured to provision SAML and SCIM identities for Organizations +""" +type OrganizationIdentityProvider implements Node { + """ + The digest algorithm used to sign SAML requests for the Identity Provider. + """ + digestMethod: URI + + """ + External Identities provisioned by this Identity Provider + """ + externalIdentities( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): ExternalIdentityConnection! + id: ID! + + """ + The x509 certificate used by the Identity Provder to sign assertions and responses. + """ + idpCertificate: X509Certificate + + """ + The Issuer Entity ID for the SAML Identity Provider + """ + issuer: String + + """ + Organization this Identity Provider belongs to + """ + organization: Organization + + """ + The signature algorithm used to sign SAML requests for the Identity Provider. + """ + signatureMethod: URI + + """ + The URL endpoint for the Identity Provider's SAML SSO. + """ + ssoUrl: URI +} + +""" +An Invitation for a user to an organization. +""" +type OrganizationInvitation implements Node { + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + The email address of the user invited to the organization. + """ + email: String + id: ID! + + """ + The type of invitation that was sent (e.g. email, user). + """ + invitationType: OrganizationInvitationType! + + """ + The user who was invited to the organization. + """ + invitee: User + + """ + The user who created the invitation. + """ + inviter: User! + + """ + The organization the invite is for + """ + organization: Organization! + + """ + The user's pending role in the organization (e.g. member, owner). + """ + role: OrganizationInvitationRole! +} + +""" +The connection type for OrganizationInvitation. +""" +type OrganizationInvitationConnection { + """ + A list of edges. + """ + edges: [OrganizationInvitationEdge] + + """ + A list of nodes. + """ + nodes: [OrganizationInvitation] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type OrganizationInvitationEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: OrganizationInvitation +} + +""" +The possible organization invitation roles. +""" +enum OrganizationInvitationRole { + """ + The user is invited to be a direct member of the organization. + """ + DIRECT_MEMBER + + """ + The user is invited to be an admin of the organization. + """ + ADMIN + + """ + The user is invited to be a billing manager of the organization. + """ + BILLING_MANAGER + + """ + The user's previous role will be reinstated. + """ + REINSTATE +} + +""" +The possible organization invitation types. +""" +enum OrganizationInvitationType { + """ + The invitation was to an existing user. + """ + USER + + """ + The invitation was to an email address. + """ + EMAIL +} + +""" +The connection type for User. +""" +type OrganizationMemberConnection { + """ + A list of edges. + """ + edges: [OrganizationMemberEdge] + + """ + A list of nodes. + """ + nodes: [User] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +Represents a user within an organization. +""" +type OrganizationMemberEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + Whether the organization member has two factor enabled or not. Returns null if information is not available to viewer. + """ + hasTwoFactorEnabled: Boolean + + """ + The item at the end of the edge. + """ + node: User + + """ + The role this user has in the organization. + """ + role: OrganizationMemberRole +} + +""" +The possible roles within an organization for its members. +""" +enum OrganizationMemberRole { + """ + The user is a member of the organization. + """ + MEMBER + + """ + The user is an administrator of the organization. + """ + ADMIN +} + +""" +Information about pagination in a connection. +""" +type PageInfo { + """ + When paginating forwards, the cursor to continue. + """ + endCursor: String + + """ + When paginating forwards, are there more items? + """ + hasNextPage: Boolean! + + """ + When paginating backwards, are there more items? + """ + hasPreviousPage: Boolean! + + """ + When paginating backwards, the cursor to continue. + """ + startCursor: String +} + +""" +Types that can grant permissions on a repository to a user +""" +union PermissionGranter = Organization | Repository | Team + +""" +A level of permission and source for a user's access to a repository. +""" +type PermissionSource { + """ + The organization the repository belongs to. + """ + organization: Organization! + + """ + The level of access this source has granted to the user. + """ + permission: DefaultRepositoryPermissionField! + + """ + The source of this permission. + """ + source: PermissionGranter! +} + +""" +Autogenerated input type of PinIssue +""" +input PinIssueInput { + """ + The ID of the issue to be pinned + """ + issueId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Types that can be pinned to a profile page. +""" +union PinnableItem = Gist | Repository + +""" +The connection type for PinnableItem. +""" +type PinnableItemConnection { + """ + A list of edges. + """ + edges: [PinnableItemEdge] + + """ + A list of nodes. + """ + nodes: [PinnableItem] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type PinnableItemEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: PinnableItem +} + +""" +Represents items that can be pinned to a profile page or dashboard. +""" +enum PinnableItemType { + """ + A repository. + """ + REPOSITORY + + """ + A gist. + """ + GIST + + """ + An issue. + """ + ISSUE +} + +""" +Represents a 'pinned' event on a given issue or pull request. +""" +type PinnedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Identifies the issue associated with the event. + """ + issue: Issue! +} + +""" +A curatable list of repositories relating to a repository owner, which defaults +to showing the most popular repositories they own. +""" +type ProfileItemShowcase { + """ + Whether or not the owner has pinned any repositories or gists. + """ + hasPinnedItems: Boolean! + + """ + The repositories and gists in the showcase. If the profile owner has any + pinned items, those will be returned. Otherwise, the profile owner's popular + repositories will be returned. + """ + items( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PinnableItemConnection! +} + +""" +Represents any entity on GitHub that has a profile page. +""" +interface ProfileOwner { + """ + Determine if this repository owner has any items that can be pinned to their profile. + """ + anyPinnableItems( + """ + Filter to only a particular kind of pinnable item. + """ + type: PinnableItemType + ): Boolean! + + """ + The public profile email. + """ + email: String + id: ID! + + """ + Showcases a selection of repositories and gists that the profile owner has + either curated or that have been selected automatically based on popularity. + """ + itemShowcase: ProfileItemShowcase! + + """ + The public profile location. + """ + location: String + + """ + The username used to login. + """ + login: String! + + """ + The public profile name. + """ + name: String + + """ + A list of repositories and gists this profile owner can pin to their profile. + """ + pinnableItems( + """ + Filter the types of pinnable items that are returned. + """ + types: [PinnableItemType!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PinnableItemConnection! + + """ + A list of repositories and gists this profile owner has pinned to their profile + """ + pinnedItems( + """ + Filter the types of pinned items that are returned. + """ + types: [PinnableItemType!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PinnableItemConnection! + + """ + Returns how many more items this profile owner can pin to their profile. + """ + pinnedItemsRemaining: Int! + + """ + Can the viewer pin repositories and gists to the profile? + """ + viewerCanChangePinnedItems: Boolean! + + """ + The public profile website URL. + """ + websiteUrl: URI +} + +""" +Projects manage issues, pull requests and notes within a project owner. +""" +type Project implements Node & Closable & Updatable { + """ + The project's description body. + """ + body: String + + """ + The projects description body rendered to HTML. + """ + bodyHTML: HTML! + + """ + `true` if the object is closed (definition of closed may depend on type) + """ + closed: Boolean! + + """ + Identifies the date and time when the object was closed. + """ + closedAt: DateTime + + """ + List of columns in the project + """ + columns( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): ProjectColumnConnection! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + The actor who originally created the project. + """ + creator: Actor + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! + + """ + The project's name. + """ + name: String! + + """ + The project's number. + """ + number: Int! + + """ + The project's owner. Currently limited to repositories, organizations, and users. + """ + owner: ProjectOwner! + + """ + List of pending cards in this project + """ + pendingCards( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + A list of archived states to filter the cards by + """ + archivedStates: [ProjectCardArchivedState] + ): ProjectCardConnection! + + """ + The HTTP path for this project + """ + resourcePath: URI! + + """ + Whether the project is open or closed. + """ + state: ProjectState! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this project + """ + url: URI! + + """ + Check if the current viewer can update this object. + """ + viewerCanUpdate: Boolean! +} + +""" +A card in a project. +""" +type ProjectCard implements Node { + """ + The project column this card is associated under. A card may only belong to one + project column at a time. The column field will be null if the card is created + in a pending state and has yet to be associated with a column. Once cards are + associated with a column, they will not become pending in the future. + """ + column: ProjectColumn + + """ + The card content item + """ + content: ProjectCardItem + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + The actor who created this card + """ + creator: Actor + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! + + """ + Whether the card is archived + """ + isArchived: Boolean! + + """ + The card note + """ + note: String + + """ + The project that contains this card. + """ + project: Project! + + """ + The HTTP path for this card + """ + resourcePath: URI! + + """ + The state of ProjectCard + """ + state: ProjectCardState + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this card + """ + url: URI! +} + +""" +The possible archived states of a project card. +""" +enum ProjectCardArchivedState { + """ + A project card that is archived + """ + ARCHIVED + + """ + A project card that is not archived + """ + NOT_ARCHIVED +} + +""" +The connection type for ProjectCard. +""" +type ProjectCardConnection { + """ + A list of edges. + """ + edges: [ProjectCardEdge] + + """ + A list of nodes. + """ + nodes: [ProjectCard] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type ProjectCardEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: ProjectCard +} + +""" +An issue or PR and its owning repository to be used in a project card. +""" +input ProjectCardImport { + """ + Repository name with owner (owner/repository). + """ + repository: String! + + """ + The issue or pull request number. + """ + number: Int! +} + +""" +Types that can be inside Project Cards. +""" +union ProjectCardItem = Issue | PullRequest + +""" +Various content states of a ProjectCard +""" +enum ProjectCardState { + """ + The card has content only. + """ + CONTENT_ONLY + + """ + The card has a note only. + """ + NOTE_ONLY + + """ + The card is redacted. + """ + REDACTED +} + +""" +A column inside a project. +""" +type ProjectColumn implements Node { + """ + List of cards in the column + """ + cards( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + A list of archived states to filter the cards by + """ + archivedStates: [ProjectCardArchivedState] + ): ProjectCardConnection! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! + + """ + The project column's name. + """ + name: String! + + """ + The project that contains this column. + """ + project: Project! + + """ + The semantic purpose of the column + """ + purpose: ProjectColumnPurpose + + """ + The HTTP path for this project column + """ + resourcePath: URI! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this project column + """ + url: URI! +} + +""" +The connection type for ProjectColumn. +""" +type ProjectColumnConnection { + """ + A list of edges. + """ + edges: [ProjectColumnEdge] + + """ + A list of nodes. + """ + nodes: [ProjectColumn] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type ProjectColumnEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: ProjectColumn +} + +""" +A project column and a list of its issues and PRs. +""" +input ProjectColumnImport { + """ + The name of the column. + """ + columnName: String! + + """ + The position of the column, starting from 0. + """ + position: Int! + + """ + A list of issues and pull requests in the column. + """ + issues: [ProjectCardImport!] +} + +""" +The semantic purpose of the column - todo, in progress, or done. +""" +enum ProjectColumnPurpose { + """ + The column contains cards still to be worked on + """ + TODO + + """ + The column contains cards which are currently being worked on + """ + IN_PROGRESS + + """ + The column contains cards which are complete + """ + DONE +} + +""" +A list of projects associated with the owner. +""" +type ProjectConnection { + """ + A list of edges. + """ + edges: [ProjectEdge] + + """ + A list of nodes. + """ + nodes: [Project] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type ProjectEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Project +} + +""" +Ways in which lists of projects can be ordered upon return. +""" +input ProjectOrder { + """ + The field in which to order projects by. + """ + field: ProjectOrderField! + + """ + The direction in which to order projects by the specified field. + """ + direction: OrderDirection! +} + +""" +Properties by which project connections can be ordered. +""" +enum ProjectOrderField { + """ + Order projects by creation time + """ + CREATED_AT + + """ + Order projects by update time + """ + UPDATED_AT + + """ + Order projects by name + """ + NAME +} + +""" +Represents an owner of a Project. +""" +interface ProjectOwner { + id: ID! + + """ + Find project by number. + """ + project( + """ + The project number to find. + """ + number: Int! + ): Project + + """ + A list of projects under the owner. + """ + projects( + """ + Ordering options for projects returned from the connection + """ + orderBy: ProjectOrder + + """ + Query to search projects by, currently only searching by name. + """ + search: String + + """ + A list of states to filter the projects by. + """ + states: [ProjectState!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): ProjectConnection! + + """ + The HTTP path listing owners projects + """ + projectsResourcePath: URI! + + """ + The HTTP URL listing owners projects + """ + projectsUrl: URI! + + """ + Can the current viewer create new projects on this owner. + """ + viewerCanCreateProjects: Boolean! +} + +""" +State of the project; either 'open' or 'closed' +""" +enum ProjectState { + """ + The project is open. + """ + OPEN + + """ + The project is closed. + """ + CLOSED +} + +""" +A user's public key. +""" +type PublicKey implements Node { + """ + The last time this authorization was used to perform an action + """ + accessedAt: DateTime + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + The fingerprint for this PublicKey + """ + fingerprint: String + id: ID! + + """ + Whether this PublicKey is read-only or not + """ + isReadOnly: Boolean! + + """ + The public key string + """ + key: String! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! +} + +""" +The connection type for PublicKey. +""" +type PublicKeyConnection { + """ + A list of edges. + """ + edges: [PublicKeyEdge] + + """ + A list of nodes. + """ + nodes: [PublicKey] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type PublicKeyEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: PublicKey +} + +""" +A repository pull request. +""" +type PullRequest implements Node & Assignable & Closable & Comment & Updatable & UpdatableComment & Labelable & Lockable & Reactable & RepositoryNode & Subscribable & UniformResourceLocatable { + """ + Reason that the conversation was locked. + """ + activeLockReason: LockReason + + """ + The number of additions in this pull request. + """ + additions: Int! + + """ + A list of Users assigned to this object. + """ + assignees( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserConnection! + + """ + The actor who authored the comment. + """ + author: Actor + + """ + Author's association with the subject of the comment. + """ + authorAssociation: CommentAuthorAssociation! + + """ + Identifies the base Ref associated with the pull request. + """ + baseRef: Ref + + """ + Identifies the name of the base Ref associated with the pull request, even if the ref has been deleted. + """ + baseRefName: String! + + """ + Identifies the oid of the base ref associated with the pull request, even if the ref has been deleted. + """ + baseRefOid: GitObjectID! + + """ + The repository associated with this pull request's base Ref. + """ + baseRepository: Repository + + """ + The body as Markdown. + """ + body: String! + + """ + The body rendered to HTML. + """ + bodyHTML: HTML! + + """ + The body rendered to text. + """ + bodyText: String! + + """ + The number of changed files in this pull request. + """ + changedFiles: Int! + + """ + `true` if the pull request is closed + """ + closed: Boolean! + + """ + Identifies the date and time when the object was closed. + """ + closedAt: DateTime + + """ + A list of comments associated with the pull request. + """ + comments( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): IssueCommentConnection! + + """ + A list of commits present in this pull request's head branch not present in the base branch. + """ + commits( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PullRequestCommitConnection! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Check if this comment was created via an email reply. + """ + createdViaEmail: Boolean! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The number of deletions in this pull request. + """ + deletions: Int! + + """ + The actor who edited this pull request's body. + """ + editor: Actor + + """ + Lists the files changed within this pull request. + """ + files( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PullRequestChangedFileConnection + + """ + Identifies the head Ref associated with the pull request. + """ + headRef: Ref + + """ + Identifies the name of the head Ref associated with the pull request, even if the ref has been deleted. + """ + headRefName: String! + + """ + Identifies the oid of the head ref associated with the pull request, even if the ref has been deleted. + """ + headRefOid: GitObjectID! + + """ + The repository associated with this pull request's head Ref. + """ + headRepository: Repository + + """ + The owner of the repository associated with this pull request's head Ref. + """ + headRepositoryOwner: RepositoryOwner + id: ID! + + """ + Check if this comment was edited and includes an edit with the creation data + """ + includesCreatedEdit: Boolean! + + """ + The head and base repositories are different. + """ + isCrossRepository: Boolean! + + """ + A list of labels associated with the object. + """ + labels( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): LabelConnection + + """ + The moment the editor made the last edit + """ + lastEditedAt: DateTime + + """ + `true` if the pull request is locked + """ + locked: Boolean! + + """ + Indicates whether maintainers can modify the pull request. + """ + maintainerCanModify: Boolean! + + """ + The commit that was created when this pull request was merged. + """ + mergeCommit: Commit + + """ + Whether or not the pull request can be merged based on the existence of merge conflicts. + """ + mergeable: MergeableState! + + """ + Whether or not the pull request was merged. + """ + merged: Boolean! + + """ + The date and time that the pull request was merged. + """ + mergedAt: DateTime + + """ + The actor who merged the pull request. + """ + mergedBy: Actor + + """ + Identifies the milestone associated with the pull request. + """ + milestone: Milestone + + """ + Identifies the pull request number. + """ + number: Int! + + """ + A list of Users that are participating in the Pull Request conversation. + """ + participants( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserConnection! + + """ + The permalink to the pull request. + """ + permalink: URI! + + """ + The commit that GitHub automatically generated to test if this pull request + could be merged. This field will not return a value if the pull request is + merged, or if the test merge commit is still being generated. See the + `mergeable` field for more details on the mergeability of the pull request. + """ + potentialMergeCommit: Commit + + """ + List of project cards associated with this pull request. + """ + projectCards( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + A list of archived states to filter the cards by + """ + archivedStates: [ProjectCardArchivedState] + ): ProjectCardConnection! + + """ + Identifies when the comment was published at. + """ + publishedAt: DateTime + + """ + A list of reactions grouped by content left on the subject. + """ + reactionGroups: [ReactionGroup!] + + """ + A list of Reactions left on the Issue. + """ + reactions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Allows filtering Reactions by emoji. + """ + content: ReactionContent + + """ + Allows specifying the order in which reactions are returned. + """ + orderBy: ReactionOrder + ): ReactionConnection! + + """ + The repository associated with this node. + """ + repository: Repository! + + """ + The HTTP path for this pull request. + """ + resourcePath: URI! + + """ + The HTTP path for reverting this pull request. + """ + revertResourcePath: URI! + + """ + The HTTP URL for reverting this pull request. + """ + revertUrl: URI! + + """ + A list of review requests associated with the pull request. + """ + reviewRequests( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): ReviewRequestConnection + + """ + The list of all review threads for this pull request. + """ + reviewThreads( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PullRequestReviewThreadConnection! + + """ + A list of reviews associated with the pull request. + """ + reviews( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + A list of states to filter the reviews. + """ + states: [PullRequestReviewState!] + + """ + Filter by author of the review. + """ + author: String + ): PullRequestReviewConnection + + """ + Identifies the state of the pull request. + """ + state: PullRequestState! + + """ + A list of reviewer suggestions based on commit history and past review comments. + """ + suggestedReviewers: [SuggestedReviewer]! + + """ + A list of events, comments, commits, etc. associated with the pull request. + """ + timeline( + """ + Allows filtering timeline events by a `since` timestamp. + """ + since: DateTime + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PullRequestTimelineConnection! + + """ + A list of events, comments, commits, etc. associated with the pull request. + """ + timelineItems( + """ + Filter timeline items by a `since` timestamp. + """ + since: DateTime + + """ + Skips the first _n_ elements in the list. + """ + skip: Int + + """ + Filter timeline items by type. + """ + itemTypes: [PullRequestTimelineItemsItemType!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PullRequestTimelineItemsConnection! + + """ + Identifies the pull request title. + """ + title: String! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this pull request. + """ + url: URI! + + """ + A list of edits to this content. + """ + userContentEdits( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserContentEditConnection + + """ + Whether or not the viewer can apply suggestion. + """ + viewerCanApplySuggestion: Boolean! + + """ + Can user react to this subject + """ + viewerCanReact: Boolean! + + """ + Check if the viewer is able to change their subscription status for the repository. + """ + viewerCanSubscribe: Boolean! + + """ + Check if the current viewer can update this object. + """ + viewerCanUpdate: Boolean! + + """ + Reasons why the current viewer can not update this comment. + """ + viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! + + """ + Did the viewer author this comment. + """ + viewerDidAuthor: Boolean! + + """ + Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. + """ + viewerSubscription: SubscriptionState +} + +""" +A file changed in a pull request. +""" +type PullRequestChangedFile { + """ + The number of additions to the file. + """ + additions: Int! + + """ + The number of deletions to the file. + """ + deletions: Int! + + """ + The path of the file. + """ + path: String! +} + +""" +The connection type for PullRequestChangedFile. +""" +type PullRequestChangedFileConnection { + """ + A list of edges. + """ + edges: [PullRequestChangedFileEdge] + + """ + A list of nodes. + """ + nodes: [PullRequestChangedFile] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type PullRequestChangedFileEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: PullRequestChangedFile +} + +""" +Represents a Git commit part of a pull request. +""" +type PullRequestCommit implements Node & UniformResourceLocatable { + """ + The Git commit object + """ + commit: Commit! + id: ID! + + """ + The pull request this commit belongs to + """ + pullRequest: PullRequest! + + """ + The HTTP path for this pull request commit + """ + resourcePath: URI! + + """ + The HTTP URL for this pull request commit + """ + url: URI! +} + +""" +Represents a commit comment thread part of a pull request. +""" +type PullRequestCommitCommentThread implements Node & RepositoryNode { + """ + The comments that exist in this thread. + """ + comments( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): CommitCommentConnection! + + """ + The commit the comments were made on. + """ + commit: Commit! + id: ID! + + """ + The file the comments were made on. + """ + path: String + + """ + The position in the diff for the commit that the comment was made on. + """ + position: Int + + """ + The pull request this commit comment thread belongs to + """ + pullRequest: PullRequest! + + """ + The repository associated with this node. + """ + repository: Repository! +} + +""" +The connection type for PullRequestCommit. +""" +type PullRequestCommitConnection { + """ + A list of edges. + """ + edges: [PullRequestCommitEdge] + + """ + A list of nodes. + """ + nodes: [PullRequestCommit] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type PullRequestCommitEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: PullRequestCommit +} + +""" +The connection type for PullRequest. +""" +type PullRequestConnection { + """ + A list of edges. + """ + edges: [PullRequestEdge] + + """ + A list of nodes. + """ + nodes: [PullRequest] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +This aggregates pull requests opened by a user within one repository. +""" +type PullRequestContributionsByRepository { + """ + The pull request contributions. + """ + contributions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for contributions returned from the connection. + """ + orderBy: ContributionOrder + ): CreatedPullRequestContributionConnection! + + """ + The repository in which the pull requests were opened. + """ + repository: Repository! +} + +""" +An edge in a connection. +""" +type PullRequestEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: PullRequest +} + +""" +Ways in which lists of issues can be ordered upon return. +""" +input PullRequestOrder { + """ + The field in which to order pull requests by. + """ + field: PullRequestOrderField! + + """ + The direction in which to order pull requests by the specified field. + """ + direction: OrderDirection! +} + +""" +Properties by which pull_requests connections can be ordered. +""" +enum PullRequestOrderField { + """ + Order pull_requests by creation time + """ + CREATED_AT + + """ + Order pull_requests by update time + """ + UPDATED_AT +} + +""" +The possible PubSub channels for a pull request. +""" +enum PullRequestPubSubTopic { + """ + The channel ID for observing pull request updates. + """ + UPDATED + + """ + The channel ID for marking an pull request as read. + """ + MARKASREAD + + """ + The channel ID for observing head ref updates. + """ + HEAD_REF + + """ + The channel ID for updating items on the pull request timeline. + """ + TIMELINE + + """ + The channel ID for observing pull request state updates. + """ + STATE +} + +""" +A review object for a given pull request. +""" +type PullRequestReview implements Node & Comment & Deletable & Updatable & UpdatableComment & Reactable & RepositoryNode { + """ + The actor who authored the comment. + """ + author: Actor + + """ + Author's association with the subject of the comment. + """ + authorAssociation: CommentAuthorAssociation! + + """ + Identifies the pull request review body. + """ + body: String! + + """ + The body of this review rendered to HTML. + """ + bodyHTML: HTML! + + """ + The body of this review rendered as plain text. + """ + bodyText: String! + + """ + A list of review comments for the current pull request review. + """ + comments( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PullRequestReviewCommentConnection! + + """ + Identifies the commit associated with this pull request review. + """ + commit: Commit + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Check if this comment was created via an email reply. + """ + createdViaEmail: Boolean! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The actor who edited the comment. + """ + editor: Actor + id: ID! + + """ + Check if this comment was edited and includes an edit with the creation data + """ + includesCreatedEdit: Boolean! + + """ + The moment the editor made the last edit + """ + lastEditedAt: DateTime + + """ + A list of teams that this review was made on behalf of. + """ + onBehalfOf( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): TeamConnection! + + """ + Identifies when the comment was published at. + """ + publishedAt: DateTime + + """ + Identifies the pull request associated with this pull request review. + """ + pullRequest: PullRequest! + + """ + A list of reactions grouped by content left on the subject. + """ + reactionGroups: [ReactionGroup!] + + """ + A list of Reactions left on the Issue. + """ + reactions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Allows filtering Reactions by emoji. + """ + content: ReactionContent + + """ + Allows specifying the order in which reactions are returned. + """ + orderBy: ReactionOrder + ): ReactionConnection! + + """ + The repository associated with this node. + """ + repository: Repository! + + """ + The HTTP path permalink for this PullRequestReview. + """ + resourcePath: URI! + + """ + Identifies the current state of the pull request review. + """ + state: PullRequestReviewState! + + """ + Identifies when the Pull Request Review was submitted + """ + submittedAt: DateTime + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL permalink for this PullRequestReview. + """ + url: URI! + + """ + A list of edits to this content. + """ + userContentEdits( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserContentEditConnection + + """ + Check if the current viewer can delete this object. + """ + viewerCanDelete: Boolean! + + """ + Can user react to this subject + """ + viewerCanReact: Boolean! + + """ + Check if the current viewer can update this object. + """ + viewerCanUpdate: Boolean! + + """ + Reasons why the current viewer can not update this comment. + """ + viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! + + """ + Did the viewer author this comment. + """ + viewerDidAuthor: Boolean! +} + +""" +A review comment associated with a given repository pull request. +""" +type PullRequestReviewComment implements Node & Comment & Deletable & Updatable & UpdatableComment & Reactable & RepositoryNode { + """ + The actor who authored the comment. + """ + author: Actor + + """ + Author's association with the subject of the comment. + """ + authorAssociation: CommentAuthorAssociation! + + """ + The comment body of this review comment. + """ + body: String! + + """ + The comment body of this review comment rendered to HTML. + """ + bodyHTML: HTML! + + """ + The comment body of this review comment rendered as plain text. + """ + bodyText: String! + + """ + Identifies the commit associated with the comment. + """ + commit: Commit! + + """ + Identifies when the comment was created. + """ + createdAt: DateTime! + + """ + Check if this comment was created via an email reply. + """ + createdViaEmail: Boolean! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The diff hunk to which the comment applies. + """ + diffHunk: String! + + """ + Identifies when the comment was created in a draft state. + """ + draftedAt: DateTime! + + """ + The actor who edited the comment. + """ + editor: Actor + id: ID! + + """ + Check if this comment was edited and includes an edit with the creation data + """ + includesCreatedEdit: Boolean! + + """ + Returns whether or not a comment has been minimized. + """ + isMinimized: Boolean! + + """ + The moment the editor made the last edit + """ + lastEditedAt: DateTime + + """ + Returns why the comment was minimized. + """ + minimizedReason: String + + """ + Identifies the original commit associated with the comment. + """ + originalCommit: Commit + + """ + The original line index in the diff to which the comment applies. + """ + originalPosition: Int! + + """ + Identifies when the comment body is outdated + """ + outdated: Boolean! + + """ + The path to which the comment applies. + """ + path: String! + + """ + The line index in the diff to which the comment applies. + """ + position: Int + + """ + Identifies when the comment was published at. + """ + publishedAt: DateTime + + """ + The pull request associated with this review comment. + """ + pullRequest: PullRequest! + + """ + The pull request review associated with this review comment. + """ + pullRequestReview: PullRequestReview + + """ + A list of reactions grouped by content left on the subject. + """ + reactionGroups: [ReactionGroup!] + + """ + A list of Reactions left on the Issue. + """ + reactions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Allows filtering Reactions by emoji. + """ + content: ReactionContent + + """ + Allows specifying the order in which reactions are returned. + """ + orderBy: ReactionOrder + ): ReactionConnection! + + """ + The comment this is a reply to. + """ + replyTo: PullRequestReviewComment + + """ + The repository associated with this node. + """ + repository: Repository! + + """ + The HTTP path permalink for this review comment. + """ + resourcePath: URI! + + """ + Identifies the state of the comment. + """ + state: PullRequestReviewCommentState! + + """ + Identifies when the comment was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL permalink for this review comment. + """ + url: URI! + + """ + A list of edits to this content. + """ + userContentEdits( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserContentEditConnection + + """ + Check if the current viewer can delete this object. + """ + viewerCanDelete: Boolean! + + """ + Check if the current viewer can minimize this object. + """ + viewerCanMinimize: Boolean! + + """ + Can user react to this subject + """ + viewerCanReact: Boolean! + + """ + Check if the current viewer can update this object. + """ + viewerCanUpdate: Boolean! + + """ + Reasons why the current viewer can not update this comment. + """ + viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! + + """ + Did the viewer author this comment. + """ + viewerDidAuthor: Boolean! +} + +""" +The connection type for PullRequestReviewComment. +""" +type PullRequestReviewCommentConnection { + """ + A list of edges. + """ + edges: [PullRequestReviewCommentEdge] + + """ + A list of nodes. + """ + nodes: [PullRequestReviewComment] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type PullRequestReviewCommentEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: PullRequestReviewComment +} + +""" +The possible states of a pull request review comment. +""" +enum PullRequestReviewCommentState { + """ + A comment that is part of a pending review + """ + PENDING + + """ + A comment that is part of a submitted review + """ + SUBMITTED +} + +""" +The connection type for PullRequestReview. +""" +type PullRequestReviewConnection { + """ + A list of edges. + """ + edges: [PullRequestReviewEdge] + + """ + A list of nodes. + """ + nodes: [PullRequestReview] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +This aggregates pull request reviews made by a user within one repository. +""" +type PullRequestReviewContributionsByRepository { + """ + The pull request review contributions. + """ + contributions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for contributions returned from the connection. + """ + orderBy: ContributionOrder + ): CreatedPullRequestReviewContributionConnection! + + """ + The repository in which the pull request reviews were made. + """ + repository: Repository! +} + +""" +An edge in a connection. +""" +type PullRequestReviewEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: PullRequestReview +} + +""" +The possible events to perform on a pull request review. +""" +enum PullRequestReviewEvent { + """ + Submit general feedback without explicit approval. + """ + COMMENT + + """ + Submit feedback and approve merging these changes. + """ + APPROVE + + """ + Submit feedback that must be addressed before merging. + """ + REQUEST_CHANGES + + """ + Dismiss review so it now longer effects merging. + """ + DISMISS +} + +""" +The possible states of a pull request review. +""" +enum PullRequestReviewState { + """ + A review that has not yet been submitted. + """ + PENDING + + """ + An informational review. + """ + COMMENTED + + """ + A review allowing the pull request to merge. + """ + APPROVED + + """ + A review blocking the pull request from merging. + """ + CHANGES_REQUESTED + + """ + A review that has been dismissed. + """ + DISMISSED +} + +""" +A threaded list of comments for a given pull request. +""" +type PullRequestReviewThread implements Node { + """ + A list of pull request comments associated with the thread. + """ + comments( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PullRequestReviewCommentConnection! + id: ID! + + """ + Whether this thread has been resolved + """ + isResolved: Boolean! + + """ + Identifies the pull request associated with this thread. + """ + pullRequest: PullRequest! + + """ + Identifies the repository associated with this thread. + """ + repository: Repository! + + """ + The user who resolved this thread + """ + resolvedBy: User + + """ + Whether or not the viewer can resolve this thread + """ + viewerCanResolve: Boolean! + + """ + Whether or not the viewer can unresolve this thread + """ + viewerCanUnresolve: Boolean! +} + +""" +Review comment threads for a pull request review. +""" +type PullRequestReviewThreadConnection { + """ + A list of edges. + """ + edges: [PullRequestReviewThreadEdge] + + """ + A list of nodes. + """ + nodes: [PullRequestReviewThread] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type PullRequestReviewThreadEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: PullRequestReviewThread +} + +""" +Represents the latest point in the pull request timeline for which the viewer has seen the pull request's commits. +""" +type PullRequestRevisionMarker { + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + The last commit the viewer has seen. + """ + lastSeenCommit: Commit! + + """ + The pull request to which the marker belongs. + """ + pullRequest: PullRequest! +} + +""" +The possible states of a pull request. +""" +enum PullRequestState { + """ + A pull request that is still open. + """ + OPEN + + """ + A pull request that has been closed without being merged. + """ + CLOSED + + """ + A pull request that has been closed by being merged. + """ + MERGED +} + +""" +The connection type for PullRequestTimelineItem. +""" +type PullRequestTimelineConnection { + """ + A list of edges. + """ + edges: [PullRequestTimelineItemEdge] + + """ + A list of nodes. + """ + nodes: [PullRequestTimelineItem] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An item in an pull request timeline +""" +union PullRequestTimelineItem = + Commit + | CommitCommentThread + | PullRequestReview + | PullRequestReviewThread + | PullRequestReviewComment + | IssueComment + | ClosedEvent + | ReopenedEvent + | SubscribedEvent + | UnsubscribedEvent + | MergedEvent + | ReferencedEvent + | CrossReferencedEvent + | AssignedEvent + | UnassignedEvent + | LabeledEvent + | UnlabeledEvent + | MilestonedEvent + | DemilestonedEvent + | RenamedTitleEvent + | LockedEvent + | UnlockedEvent + | DeployedEvent + | DeploymentEnvironmentChangedEvent + | HeadRefDeletedEvent + | HeadRefRestoredEvent + | HeadRefForcePushedEvent + | BaseRefForcePushedEvent + | ReviewRequestedEvent + | ReviewRequestRemovedEvent + | ReviewDismissedEvent + | UserBlockedEvent + +""" +An edge in a connection. +""" +type PullRequestTimelineItemEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: PullRequestTimelineItem +} + +""" +An item in a pull request timeline +""" +union PullRequestTimelineItems = + PullRequestCommit + | PullRequestCommitCommentThread + | PullRequestReview + | PullRequestReviewThread + | PullRequestRevisionMarker + | BaseRefChangedEvent + | BaseRefForcePushedEvent + | DeployedEvent + | DeploymentEnvironmentChangedEvent + | HeadRefDeletedEvent + | HeadRefForcePushedEvent + | HeadRefRestoredEvent + | MergedEvent + | ReviewDismissedEvent + | ReviewRequestedEvent + | ReviewRequestRemovedEvent + | IssueComment + | CrossReferencedEvent + | AddedToProjectEvent + | AssignedEvent + | ClosedEvent + | CommentDeletedEvent + | ConvertedNoteToIssueEvent + | DemilestonedEvent + | LabeledEvent + | LockedEvent + | MentionedEvent + | MilestonedEvent + | MovedColumnsInProjectEvent + | PinnedEvent + | ReferencedEvent + | RemovedFromProjectEvent + | RenamedTitleEvent + | ReopenedEvent + | SubscribedEvent + | TransferredEvent + | UnassignedEvent + | UnlabeledEvent + | UnlockedEvent + | UserBlockedEvent + | UnpinnedEvent + | UnsubscribedEvent + +""" +The connection type for PullRequestTimelineItems. +""" +type PullRequestTimelineItemsConnection { + """ + A list of edges. + """ + edges: [PullRequestTimelineItemsEdge] + + """ + Identifies the count of items after applying `before` and `after` filters. + """ + filteredCount: Int! + + """ + A list of nodes. + """ + nodes: [PullRequestTimelineItems] + + """ + Identifies the count of items after applying `before`/`after` filters and `first`/`last`/`skip` slicing. + """ + pageCount: Int! + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! + + """ + Identifies the date and time when the timeline was last updated. + """ + updatedAt: DateTime! +} + +""" +An edge in a connection. +""" +type PullRequestTimelineItemsEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: PullRequestTimelineItems +} + +""" +The possible item types found in a timeline. +""" +enum PullRequestTimelineItemsItemType { + """ + Represents a Git commit part of a pull request. + """ + PULL_REQUEST_COMMIT + + """ + Represents a commit comment thread part of a pull request. + """ + PULL_REQUEST_COMMIT_COMMENT_THREAD + + """ + A review object for a given pull request. + """ + PULL_REQUEST_REVIEW + + """ + A threaded list of comments for a given pull request. + """ + PULL_REQUEST_REVIEW_THREAD + + """ + Represents the latest point in the pull request timeline for which the viewer has seen the pull request's commits. + """ + PULL_REQUEST_REVISION_MARKER + + """ + Represents a 'base_ref_changed' event on a given issue or pull request. + """ + BASE_REF_CHANGED_EVENT + + """ + Represents a 'base_ref_force_pushed' event on a given pull request. + """ + BASE_REF_FORCE_PUSHED_EVENT + + """ + Represents a 'deployed' event on a given pull request. + """ + DEPLOYED_EVENT + + """ + Represents a 'deployment_environment_changed' event on a given pull request. + """ + DEPLOYMENT_ENVIRONMENT_CHANGED_EVENT + + """ + Represents a 'head_ref_deleted' event on a given pull request. + """ + HEAD_REF_DELETED_EVENT + + """ + Represents a 'head_ref_force_pushed' event on a given pull request. + """ + HEAD_REF_FORCE_PUSHED_EVENT + + """ + Represents a 'head_ref_restored' event on a given pull request. + """ + HEAD_REF_RESTORED_EVENT + + """ + Represents a 'merged' event on a given pull request. + """ + MERGED_EVENT + + """ + Represents a 'review_dismissed' event on a given issue or pull request. + """ + REVIEW_DISMISSED_EVENT + + """ + Represents an 'review_requested' event on a given pull request. + """ + REVIEW_REQUESTED_EVENT + + """ + Represents an 'review_request_removed' event on a given pull request. + """ + REVIEW_REQUEST_REMOVED_EVENT + + """ + Represents a comment on an Issue. + """ + ISSUE_COMMENT + + """ + Represents a mention made by one issue or pull request to another. + """ + CROSS_REFERENCED_EVENT + + """ + Represents a 'added_to_project' event on a given issue or pull request. + """ + ADDED_TO_PROJECT_EVENT + + """ + Represents an 'assigned' event on any assignable object. + """ + ASSIGNED_EVENT + + """ + Represents a 'closed' event on any `Closable`. + """ + CLOSED_EVENT + + """ + Represents a 'comment_deleted' event on a given issue or pull request. + """ + COMMENT_DELETED_EVENT + + """ + Represents a 'converted_note_to_issue' event on a given issue or pull request. + """ + CONVERTED_NOTE_TO_ISSUE_EVENT + + """ + Represents a 'demilestoned' event on a given issue or pull request. + """ + DEMILESTONED_EVENT + + """ + Represents a 'labeled' event on a given issue or pull request. + """ + LABELED_EVENT + + """ + Represents a 'locked' event on a given issue or pull request. + """ + LOCKED_EVENT + + """ + Represents a 'mentioned' event on a given issue or pull request. + """ + MENTIONED_EVENT + + """ + Represents a 'milestoned' event on a given issue or pull request. + """ + MILESTONED_EVENT + + """ + Represents a 'moved_columns_in_project' event on a given issue or pull request. + """ + MOVED_COLUMNS_IN_PROJECT_EVENT + + """ + Represents a 'pinned' event on a given issue or pull request. + """ + PINNED_EVENT + + """ + Represents a 'referenced' event on a given `ReferencedSubject`. + """ + REFERENCED_EVENT + + """ + Represents a 'removed_from_project' event on a given issue or pull request. + """ + REMOVED_FROM_PROJECT_EVENT + + """ + Represents a 'renamed' event on a given issue or pull request + """ + RENAMED_TITLE_EVENT + + """ + Represents a 'reopened' event on any `Closable`. + """ + REOPENED_EVENT + + """ + Represents a 'subscribed' event on a given `Subscribable`. + """ + SUBSCRIBED_EVENT + + """ + Represents a 'transferred' event on a given issue or pull request. + """ + TRANSFERRED_EVENT + + """ + Represents an 'unassigned' event on any assignable object. + """ + UNASSIGNED_EVENT + + """ + Represents an 'unlabeled' event on a given issue or pull request. + """ + UNLABELED_EVENT + + """ + Represents an 'unlocked' event on a given issue or pull request. + """ + UNLOCKED_EVENT + + """ + Represents a 'user_blocked' event on a given user. + """ + USER_BLOCKED_EVENT + + """ + Represents an 'unpinned' event on a given issue or pull request. + """ + UNPINNED_EVENT + + """ + Represents an 'unsubscribed' event on a given `Subscribable`. + """ + UNSUBSCRIBED_EVENT +} + +""" +A team or user who has the ability to push to a protected branch. +""" +type PushAllowance implements Node { + """ + The actor that can push. + """ + actor: PushAllowanceActor + + """ + Identifies the branch protection rule associated with the allowed user or team. + """ + branchProtectionRule: BranchProtectionRule + id: ID! +} + +""" +Types that can be an actor. +""" +union PushAllowanceActor = User | Team + +""" +The connection type for PushAllowance. +""" +type PushAllowanceConnection { + """ + A list of edges. + """ + edges: [PushAllowanceEdge] + + """ + A list of nodes. + """ + nodes: [PushAllowance] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type PushAllowanceEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: PushAllowance +} + +""" +The query root of GitHub's GraphQL interface. +""" +type Query { + """ + Look up a code of conduct by its key + """ + codeOfConduct( + """ + The code of conduct's key + """ + key: String! + ): CodeOfConduct + + """ + Look up a code of conduct by its key + """ + codesOfConduct: [CodeOfConduct] + + """ + Look up an open source license by its key + """ + license( + """ + The license's downcased SPDX ID + """ + key: String! + ): License + + """ + Return a list of known open source licenses + """ + licenses: [License]! + + """ + Get alphabetically sorted list of Marketplace categories + """ + marketplaceCategories( + """ + Return only the specified categories. + """ + includeCategories: [String!] + + """ + Exclude categories with no listings. + """ + excludeEmpty: Boolean + + """ + Returns top level categories only, excluding any subcategories. + """ + excludeSubcategories: Boolean + ): [MarketplaceCategory!]! + + """ + Look up a Marketplace category by its slug. + """ + marketplaceCategory( + """ + The URL slug of the category. + """ + slug: String! + + """ + Also check topic aliases for the category slug + """ + useTopicAliases: Boolean + ): MarketplaceCategory + + """ + Look up a single Marketplace listing + """ + marketplaceListing( + """ + Select the listing that matches this slug. It's the short name of the listing used in its URL. + """ + slug: String! + ): MarketplaceListing + + """ + Look up Marketplace listings + """ + marketplaceListings( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Select only listings with the given category. + """ + categorySlug: String + + """ + Also check topic aliases for the category slug + """ + useTopicAliases: Boolean + + """ + Select listings to which user has admin access. If omitted, listings visible to the + viewer are returned. + """ + viewerCanAdmin: Boolean + + """ + Select listings that can be administered by the specified user. + """ + adminId: ID + + """ + Select listings for products owned by the specified organization. + """ + organizationId: ID + + """ + Select listings visible to the viewer even if they are not approved. If omitted or + false, only approved listings will be returned. + """ + allStates: Boolean + + """ + Select the listings with these slugs, if they are visible to the viewer. + """ + slugs: [String] + + """ + Select only listings where the primary category matches the given category slug. + """ + primaryCategoryOnly: Boolean = false + + """ + Select only listings that offer a free trial. + """ + withFreeTrialsOnly: Boolean = false + ): MarketplaceListingConnection! + + """ + Return information about the GitHub instance + """ + meta: GitHubMetadata! + + """ + Fetches an object given its ID. + """ + node( + """ + ID of the object. + """ + id: ID! + ): Node + + """ + Lookup nodes by a list of IDs. + """ + nodes( + """ + The list of node IDs. + """ + ids: [ID!]! + ): [Node]! + + """ + Lookup a organization by login. + """ + organization( + """ + The organization's login. + """ + login: String! + ): Organization + + """ + The client's rate limit information. + """ + rateLimit( + """ + If true, calculate the cost for the query without evaluating it + """ + dryRun: Boolean = false + ): RateLimit + + """ + Hack to workaround https://github.com/facebook/relay/issues/112 re-exposing the root query object + """ + relay: Query! + + """ + Lookup a given repository by the owner and repository name. + """ + repository( + """ + The login field of a user or organization + """ + owner: String! + + """ + The name of the repository + """ + name: String! + ): Repository + + """ + Lookup a repository owner (ie. either a User or an Organization) by login. + """ + repositoryOwner( + """ + The username to lookup the owner by. + """ + login: String! + ): RepositoryOwner + + """ + Lookup resource by a URL. + """ + resource( + """ + The URL. + """ + url: URI! + ): UniformResourceLocatable + + """ + Perform a search across resources. + """ + search( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + The search string to look for. + """ + query: String! + + """ + The types of search items to search within. + """ + type: SearchType! + ): SearchResultItemConnection! + + """ + GitHub Security Advisories + """ + securityAdvisories( + """ + Ordering options for the returned topics. + """ + orderBy: SecurityAdvisoryOrder + + """ + Filter advisories by identifier, e.g. GHSA or CVE. + """ + identifier: SecurityAdvisoryIdentifierFilter + + """ + Filter advisories to those published since a time in the past. + """ + publishedSince: DateTime + + """ + Filter advisories to those updated since a time in the past. + """ + updatedSince: DateTime + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): SecurityAdvisoryConnection! + + """ + Fetch a Security Advisory by its GHSA ID + """ + securityAdvisory( + """ + GitHub Security Advisory ID. + """ + ghsaId: String! + ): SecurityAdvisory + + """ + Software Vulnerabilities documented by GitHub Security Advisories + """ + securityVulnerabilities( + """ + Ordering options for the returned topics. + """ + orderBy: SecurityVulnerabilityOrder + + """ + An ecosystem to filter vulnerabilities by. + """ + ecosystem: SecurityAdvisoryEcosystem + + """ + A package name to filter vulnerabilities by. + """ + package: String + + """ + A list of severities to filter vulnerabilities by. + """ + severities: [SecurityAdvisorySeverity!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): SecurityVulnerabilityConnection! + + """ + Look up a topic by name. + """ + topic( + """ + The topic's name. + """ + name: String! + ): Topic + + """ + Lookup a user by login. + """ + user( + """ + The user's login. + """ + login: String! + ): User + + """ + The currently authenticated user. + """ + viewer: User! +} + +""" +Represents the client's rate limit. +""" +type RateLimit { + """ + The point cost for the current query counting against the rate limit. + """ + cost: Int! + + """ + The maximum number of points the client is permitted to consume in a 60 minute window. + """ + limit: Int! + + """ + The maximum number of nodes this query may return + """ + nodeCount: Int! + + """ + The number of points remaining in the current rate limit window. + """ + remaining: Int! + + """ + The time at which the current rate limit window resets in UTC epoch seconds. + """ + resetAt: DateTime! +} + +""" +Represents a subject that can be reacted on. +""" +interface Reactable { + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! + + """ + A list of reactions grouped by content left on the subject. + """ + reactionGroups: [ReactionGroup!] + + """ + A list of Reactions left on the Issue. + """ + reactions( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Allows filtering Reactions by emoji. + """ + content: ReactionContent + + """ + Allows specifying the order in which reactions are returned. + """ + orderBy: ReactionOrder + ): ReactionConnection! + + """ + Can user react to this subject + """ + viewerCanReact: Boolean! +} + +""" +The connection type for User. +""" +type ReactingUserConnection { + """ + A list of edges. + """ + edges: [ReactingUserEdge] + + """ + A list of nodes. + """ + nodes: [User] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +Represents a user that's made a reaction. +""" +type ReactingUserEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + node: User! + + """ + The moment when the user made the reaction. + """ + reactedAt: DateTime! +} + +""" +An emoji reaction to a particular piece of content. +""" +type Reaction implements Node { + """ + Identifies the emoji reaction. + """ + content: ReactionContent! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! + + """ + The reactable piece of content + """ + reactable: Reactable! + + """ + Identifies the user who created this reaction. + """ + user: User +} + +""" +A list of reactions that have been left on the subject. +""" +type ReactionConnection { + """ + A list of edges. + """ + edges: [ReactionEdge] + + """ + A list of nodes. + """ + nodes: [Reaction] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! + + """ + Whether or not the authenticated user has left a reaction on the subject. + """ + viewerHasReacted: Boolean! +} + +""" +Emojis that can be attached to Issues, Pull Requests and Comments. +""" +enum ReactionContent { + """ + Represents the 👍 emoji. + """ + THUMBS_UP + + """ + Represents the 👎 emoji. + """ + THUMBS_DOWN + + """ + Represents the 😄 emoji. + """ + LAUGH + + """ + Represents the 🎉 emoji. + """ + HOORAY + + """ + Represents the 😕 emoji. + """ + CONFUSED + + """ + Represents the ❤️ emoji. + """ + HEART + + """ + Represents the 🚀 emoji. + """ + ROCKET + + """ + Represents the 👀 emoji. + """ + EYES +} + +""" +An edge in a connection. +""" +type ReactionEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Reaction +} + +""" +A group of emoji reactions to a particular piece of content. +""" +type ReactionGroup { + """ + Identifies the emoji reaction. + """ + content: ReactionContent! + + """ + Identifies when the reaction was created. + """ + createdAt: DateTime + + """ + The subject that was reacted to. + """ + subject: Reactable! + + """ + Users who have reacted to the reaction subject with the emotion represented by this reaction group + """ + users( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): ReactingUserConnection! + + """ + Whether or not the authenticated user has left a reaction on the subject. + """ + viewerHasReacted: Boolean! +} + +""" +Ways in which lists of reactions can be ordered upon return. +""" +input ReactionOrder { + """ + The field in which to order reactions by. + """ + field: ReactionOrderField! + + """ + The direction in which to order reactions by the specified field. + """ + direction: OrderDirection! +} + +""" +A list of fields that reactions can be ordered by. +""" +enum ReactionOrderField { + """ + Allows ordering a list of reactions by when they were created. + """ + CREATED_AT +} + +""" +Represents a Git reference. +""" +type Ref implements Node { + """ + A list of pull requests with this ref as the head ref. + """ + associatedPullRequests( + """ + A list of states to filter the pull requests by. + """ + states: [PullRequestState!] + + """ + A list of label names to filter the pull requests by. + """ + labels: [String!] + + """ + The head ref name to filter the pull requests by. + """ + headRefName: String + + """ + The base ref name to filter the pull requests by. + """ + baseRefName: String + + """ + Ordering options for pull requests returned from the connection. + """ + orderBy: IssueOrder + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PullRequestConnection! + id: ID! + + """ + The ref name. + """ + name: String! + + """ + The ref's prefix, such as `refs/heads/` or `refs/tags/`. + """ + prefix: String! + + """ + The repository the ref belongs to. + """ + repository: Repository! + + """ + The object the ref points to. + """ + target: GitObject! +} + +""" +The connection type for Ref. +""" +type RefConnection { + """ + A list of edges. + """ + edges: [RefEdge] + + """ + A list of nodes. + """ + nodes: [Ref] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type RefEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Ref +} + +""" +Represents a 'referenced' event on a given `ReferencedSubject`. +""" +type ReferencedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the commit associated with the 'referenced' event. + """ + commit: Commit + + """ + Identifies the repository associated with the 'referenced' event. + """ + commitRepository: Repository! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Reference originated in a different repository. + """ + isCrossRepository: Boolean! + + """ + Checks if the commit message itself references the subject. Can be false in the case of a commit comment reference. + """ + isDirectReference: Boolean! + + """ + Object referenced by event. + """ + subject: ReferencedSubject! +} + +""" +Any referencable object +""" +union ReferencedSubject = Issue | PullRequest + +""" +Ways in which lists of git refs can be ordered upon return. +""" +input RefOrder { + """ + The field in which to order refs by. + """ + field: RefOrderField! + + """ + The direction in which to order refs by the specified field. + """ + direction: OrderDirection! +} + +""" +Properties by which ref connections can be ordered. +""" +enum RefOrderField { + """ + Order refs by underlying commit date if the ref prefix is refs/tags/ + """ + TAG_COMMIT_DATE + + """ + Order refs by their alphanumeric name + """ + ALPHABETICAL +} + +""" +Represents an owner of a registry package. +""" +interface RegistryPackageOwner { + id: ID! +} + +""" +Represents an interface to search packages on an object. +""" +interface RegistryPackageSearch { + id: ID! +} + +""" +A release contains the content for a release. +""" +type Release implements Node & UniformResourceLocatable { + """ + The author of the release + """ + author: User + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the description of the release. + """ + description: String + id: ID! + + """ + Whether or not the release is a draft + """ + isDraft: Boolean! + + """ + Whether or not the release is a prerelease + """ + isPrerelease: Boolean! + + """ + Identifies the title of the release. + """ + name: String + + """ + Identifies the date and time when the release was created. + """ + publishedAt: DateTime + + """ + List of releases assets which are dependent on this release. + """ + releaseAssets( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + A list of names to filter the assets by. + """ + name: String + ): ReleaseAssetConnection! + + """ + The HTTP path for this issue + """ + resourcePath: URI! + + """ + The Git tag the release points to + """ + tag: Ref + + """ + The name of the release's Git tag + """ + tagName: String! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this issue + """ + url: URI! +} + +""" +A release asset contains the content for a release asset. +""" +type ReleaseAsset implements Node { + """ + The asset's content-type + """ + contentType: String! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + The number of times this asset was downloaded + """ + downloadCount: Int! + + """ + Identifies the URL where you can download the release asset via the browser. + """ + downloadUrl: URI! + id: ID! + + """ + Identifies the title of the release asset. + """ + name: String! + + """ + Release that the asset is associated with + """ + release: Release + + """ + The size (in bytes) of the asset + """ + size: Int! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The user that performed the upload + """ + uploadedBy: User! + + """ + Identifies the URL of the release asset. + """ + url: URI! +} + +""" +The connection type for ReleaseAsset. +""" +type ReleaseAssetConnection { + """ + A list of edges. + """ + edges: [ReleaseAssetEdge] + + """ + A list of nodes. + """ + nodes: [ReleaseAsset] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type ReleaseAssetEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: ReleaseAsset +} + +""" +The connection type for Release. +""" +type ReleaseConnection { + """ + A list of edges. + """ + edges: [ReleaseEdge] + + """ + A list of nodes. + """ + nodes: [Release] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type ReleaseEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Release +} + +""" +Ways in which lists of releases can be ordered upon return. +""" +input ReleaseOrder { + """ + The field in which to order releases by. + """ + field: ReleaseOrderField! + + """ + The direction in which to order releases by the specified field. + """ + direction: OrderDirection! +} + +""" +Properties by which release connections can be ordered. +""" +enum ReleaseOrderField { + """ + Order releases by creation time + """ + CREATED_AT + + """ + Order releases alphabetically by name + """ + NAME +} + +""" +Autogenerated input type of RemoveAssigneesFromAssignable +""" +input RemoveAssigneesFromAssignableInput { + """ + The id of the assignable object to remove assignees from. + """ + assignableId: ID! + + """ + The id of users to remove as assignees. + """ + assigneeIds: [ID!]! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of RemoveAssigneesFromAssignable +""" +type RemoveAssigneesFromAssignablePayload { + """ + The item that was unassigned. + """ + assignable: Assignable + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Represents a 'removed_from_project' event on a given issue or pull request. +""" +type RemovedFromProjectEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! +} + +""" +Autogenerated input type of RemoveLabelsFromLabelable +""" +input RemoveLabelsFromLabelableInput { + """ + The id of the Labelable to remove labels from. + """ + labelableId: ID! + + """ + The ids of labels to remove. + """ + labelIds: [ID!]! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of RemoveLabelsFromLabelable +""" +type RemoveLabelsFromLabelablePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The Labelable the labels were removed from. + """ + labelable: Labelable +} + +""" +Autogenerated input type of RemoveOutsideCollaborator +""" +input RemoveOutsideCollaboratorInput { + """ + The ID of the outside collaborator to remove. + """ + userId: ID! + + """ + The ID of the organization to remove the outside collaborator from. + """ + organizationId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of RemoveOutsideCollaborator +""" +type RemoveOutsideCollaboratorPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The user that was removed as an outside collaborator. + """ + removedUser: User +} + +""" +Autogenerated input type of RemoveReaction +""" +input RemoveReactionInput { + """ + The Node ID of the subject to modify. + """ + subjectId: ID! + + """ + The name of the emoji reaction to remove. + """ + content: ReactionContent! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of RemoveReaction +""" +type RemoveReactionPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The reaction object. + """ + reaction: Reaction + + """ + The reactable subject. + """ + subject: Reactable +} + +""" +Autogenerated input type of RemoveStar +""" +input RemoveStarInput { + """ + The Starrable ID to unstar. + """ + starrableId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of RemoveStar +""" +type RemoveStarPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The starrable. + """ + starrable: Starrable +} + +""" +Represents a 'renamed' event on a given issue or pull request +""" +type RenamedTitleEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the current title of the issue or pull request. + """ + currentTitle: String! + id: ID! + + """ + Identifies the previous title of the issue or pull request. + """ + previousTitle: String! + + """ + Subject that was renamed. + """ + subject: RenamedTitleSubject! +} + +""" +An object which has a renamable title +""" +union RenamedTitleSubject = Issue | PullRequest + +""" +Represents a 'reopened' event on any `Closable`. +""" +type ReopenedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Object that was reopened. + """ + closable: Closable! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! +} + +""" +Autogenerated input type of ReopenIssue +""" +input ReopenIssueInput { + """ + ID of the issue to be opened. + """ + issueId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of ReopenIssue +""" +type ReopenIssuePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The issue that was opened. + """ + issue: Issue +} + +""" +Autogenerated input type of ReopenPullRequest +""" +input ReopenPullRequestInput { + """ + ID of the pull request to be reopened. + """ + pullRequestId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of ReopenPullRequest +""" +type ReopenPullRequestPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The pull request that was reopened. + """ + pullRequest: PullRequest +} + +""" +The reasons a piece of content can be reported or minimized. +""" +enum ReportedContentClassifiers { + """ + A spammy piece of content + """ + SPAM + + """ + An abusive or harassing piece of content + """ + ABUSE + + """ + An irrelevant piece of content + """ + OFF_TOPIC + + """ + An outdated piece of content + """ + OUTDATED + + """ + The content has been resolved + """ + RESOLVED +} + +""" +A repository contains the content for a project. +""" +type Repository implements Node & ProjectOwner & RegistryPackageOwner & Subscribable & Starrable & UniformResourceLocatable & RepositoryInfo { + """ + A list of users that can be assigned to issues in this repository. + """ + assignableUsers( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserConnection! + + """ + A list of branch protection rules for this repository. + """ + branchProtectionRules( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): BranchProtectionRuleConnection! + + """ + Returns the code of conduct for this repository + """ + codeOfConduct: CodeOfConduct + + """ + A list of collaborators associated with the repository. + """ + collaborators( + """ + Collaborators affiliation level with a repository. + """ + affiliation: CollaboratorAffiliation + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): RepositoryCollaboratorConnection + + """ + A list of commit comments associated with the repository. + """ + commitComments( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): CommitCommentConnection! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The Ref associated with the repository's default branch. + """ + defaultBranchRef: Ref + + """ + A list of deploy keys that are on this repository. + """ + deployKeys( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): DeployKeyConnection! + + """ + Deployments associated with the repository + """ + deployments( + """ + Environments to list deployments for + """ + environments: [String!] + + """ + Ordering options for deployments returned from the connection. + """ + orderBy: DeploymentOrder + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): DeploymentConnection! + + """ + The description of the repository. + """ + description: String + + """ + The description of the repository rendered to HTML. + """ + descriptionHTML: HTML! + + """ + The number of kilobytes this repository occupies on disk. + """ + diskUsage: Int + + """ + Returns how many forks there are of this repository in the whole network. + """ + forkCount: Int! + + """ + A list of direct forked repositories. + """ + forks( + """ + If non-null, filters repositories according to privacy + """ + privacy: RepositoryPrivacy + + """ + Ordering options for repositories returned from the connection + """ + orderBy: RepositoryOrder + + """ + Array of viewer's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + current viewer owns. + """ + affiliations: [RepositoryAffiliation] + + """ + Array of owner's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + organization or user being viewed owns. + """ + ownerAffiliations: [RepositoryAffiliation] + + """ + If non-null, filters repositories according to whether they have been locked + """ + isLocked: Boolean + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): RepositoryConnection! + + """ + Indicates if the repository has issues feature enabled. + """ + hasIssuesEnabled: Boolean! + + """ + Indicates if the repository has wiki feature enabled. + """ + hasWikiEnabled: Boolean! + + """ + The repository's URL. + """ + homepageUrl: URI + id: ID! + + """ + Indicates if the repository is unmaintained. + """ + isArchived: Boolean! + + """ + Returns whether or not this repository disabled. + """ + isDisabled: Boolean! + + """ + Identifies if the repository is a fork. + """ + isFork: Boolean! + + """ + Indicates if the repository has been locked or not. + """ + isLocked: Boolean! + + """ + Identifies if the repository is a mirror. + """ + isMirror: Boolean! + + """ + Identifies if the repository is private. + """ + isPrivate: Boolean! + + """ + Returns a single issue from the current repository by number. + """ + issue( + """ + The number for the issue to be returned. + """ + number: Int! + ): Issue + + """ + Returns a single issue-like object from the current repository by number. + """ + issueOrPullRequest( + """ + The number for the issue to be returned. + """ + number: Int! + ): IssueOrPullRequest + + """ + A list of issues that have been opened in the repository. + """ + issues( + """ + Ordering options for issues returned from the connection. + """ + orderBy: IssueOrder + + """ + A list of label names to filter the pull requests by. + """ + labels: [String!] + + """ + A list of states to filter the issues by. + """ + states: [IssueState!] + + """ + Filtering options for issues returned from the connection. + """ + filterBy: IssueFilters + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): IssueConnection! + + """ + Returns a single label by name + """ + label( + """ + Label name + """ + name: String! + ): Label + + """ + A list of labels associated with the repository. + """ + labels( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + If provided, searches labels by name and description. + """ + query: String + ): LabelConnection + + """ + A list containing a breakdown of the language composition of the repository. + """ + languages( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Order for connection + """ + orderBy: LanguageOrder + ): LanguageConnection + + """ + The license associated with the repository + """ + licenseInfo: License + + """ + The reason the repository has been locked. + """ + lockReason: RepositoryLockReason + + """ + A list of Users that can be mentioned in the context of the repository. + """ + mentionableUsers( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserConnection! + + """ + Whether or not PRs are merged with a merge commit on this repository. + """ + mergeCommitAllowed: Boolean! + + """ + Returns a single milestone from the current repository by number. + """ + milestone( + """ + The number for the milestone to be returned. + """ + number: Int! + ): Milestone + + """ + A list of milestones associated with the repository. + """ + milestones( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Filter by the state of the milestones. + """ + states: [MilestoneState!] + + """ + Ordering options for milestones. + """ + orderBy: MilestoneOrder + ): MilestoneConnection + + """ + The repository's original mirror URL. + """ + mirrorUrl: URI + + """ + The name of the repository. + """ + name: String! + + """ + The repository's name with owner. + """ + nameWithOwner: String! + + """ + A Git object in the repository + """ + object( + """ + The Git object ID + """ + oid: GitObjectID + + """ + A Git revision expression suitable for rev-parse + """ + expression: String + ): GitObject + + """ + The User owner of the repository. + """ + owner: RepositoryOwner! + + """ + The repository parent, if this is a fork. + """ + parent: Repository + + """ + The primary language of the repository's code. + """ + primaryLanguage: Language + + """ + Find project by number. + """ + project( + """ + The project number to find. + """ + number: Int! + ): Project + + """ + A list of projects under the owner. + """ + projects( + """ + Ordering options for projects returned from the connection + """ + orderBy: ProjectOrder + + """ + Query to search projects by, currently only searching by name. + """ + search: String + + """ + A list of states to filter the projects by. + """ + states: [ProjectState!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): ProjectConnection! + + """ + The HTTP path listing the repository's projects + """ + projectsResourcePath: URI! + + """ + The HTTP URL listing the repository's projects + """ + projectsUrl: URI! + + """ + Returns a single pull request from the current repository by number. + """ + pullRequest( + """ + The number for the pull request to be returned. + """ + number: Int! + ): PullRequest + + """ + A list of pull requests that have been opened in the repository. + """ + pullRequests( + """ + A list of states to filter the pull requests by. + """ + states: [PullRequestState!] + + """ + A list of label names to filter the pull requests by. + """ + labels: [String!] + + """ + The head ref name to filter the pull requests by. + """ + headRefName: String + + """ + The base ref name to filter the pull requests by. + """ + baseRefName: String + + """ + Ordering options for pull requests returned from the connection. + """ + orderBy: IssueOrder + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PullRequestConnection! + + """ + Identifies when the repository was last pushed to. + """ + pushedAt: DateTime + + """ + Whether or not rebase-merging is enabled on this repository. + """ + rebaseMergeAllowed: Boolean! + + """ + Fetch a given ref from the repository + """ + ref( + """ + The ref to retrieve. Fully qualified matches are checked in order + (`refs/heads/master`) before falling back onto checks for short name matches (`master`). + """ + qualifiedName: String! + ): Ref + + """ + Fetch a list of refs from the repository + """ + refs( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + A ref name prefix like `refs/heads/`, `refs/tags/`, etc. + """ + refPrefix: String! + + """ + DEPRECATED: use orderBy. The ordering direction. + """ + direction: OrderDirection + + """ + Ordering options for refs returned from the connection. + """ + orderBy: RefOrder + ): RefConnection + + """ + Lookup a single release given various criteria. + """ + release( + """ + The name of the Tag the Release was created from + """ + tagName: String! + ): Release + + """ + List of releases which are dependent on this repository. + """ + releases( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Order for connection + """ + orderBy: ReleaseOrder + ): ReleaseConnection! + + """ + A list of applied repository-topic associations for this repository. + """ + repositoryTopics( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): RepositoryTopicConnection! + + """ + The HTTP path for this repository + """ + resourcePath: URI! + + """ + A description of the repository, rendered to HTML without any links in it. + """ + shortDescriptionHTML( + """ + How many characters to return. + """ + limit: Int = 200 + ): HTML! + + """ + Whether or not squash-merging is enabled on this repository. + """ + squashMergeAllowed: Boolean! + + """ + The SSH URL to clone this repository + """ + sshUrl: GitSSHRemote! + + """ + A list of users who have starred this starrable. + """ + stargazers( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Order for connection + """ + orderBy: StarOrder + ): StargazerConnection! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this repository + """ + url: URI! + + """ + Indicates whether the viewer has admin permissions on this repository. + """ + viewerCanAdminister: Boolean! + + """ + Can the current viewer create new projects on this owner. + """ + viewerCanCreateProjects: Boolean! + + """ + Check if the viewer is able to change their subscription status for the repository. + """ + viewerCanSubscribe: Boolean! + + """ + Indicates whether the viewer can update the topics of this repository. + """ + viewerCanUpdateTopics: Boolean! + + """ + Returns a boolean indicating whether the viewing user has starred this starrable. + """ + viewerHasStarred: Boolean! + + """ + The users permission level on the repository. Will return null if authenticated as an GitHub App. + """ + viewerPermission: RepositoryPermission + + """ + Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. + """ + viewerSubscription: SubscriptionState + + """ + A list of users watching the repository. + """ + watchers( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): UserConnection! +} + +""" +The affiliation of a user to a repository +""" +enum RepositoryAffiliation { + """ + Repositories that are owned by the authenticated user. + """ + OWNER + + """ + Repositories that the user has been added to as a collaborator. + """ + COLLABORATOR + + """ + Repositories that the user has access to through being a member of an + organization. This includes every repository on every team that the user is on. + """ + ORGANIZATION_MEMBER +} + +""" +The affiliation type between collaborator and repository. +""" +enum RepositoryCollaboratorAffiliation { + """ + All collaborators of the repository. + """ + ALL + + """ + All outside collaborators of an organization-owned repository. + """ + OUTSIDE +} + +""" +The connection type for User. +""" +type RepositoryCollaboratorConnection { + """ + A list of edges. + """ + edges: [RepositoryCollaboratorEdge] + + """ + A list of nodes. + """ + nodes: [User] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +Represents a user who is a collaborator of a repository. +""" +type RepositoryCollaboratorEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + node: User! + + """ + The permission the user has on the repository. + """ + permission: RepositoryPermission! + + """ + A list of sources for the user's access to the repository. + """ + permissionSources: [PermissionSource!] +} + +""" +A list of repositories owned by the subject. +""" +type RepositoryConnection { + """ + A list of edges. + """ + edges: [RepositoryEdge] + + """ + A list of nodes. + """ + nodes: [Repository] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! + + """ + The total size in kilobytes of all repositories in the connection. + """ + totalDiskUsage: Int! +} + +""" +The reason a repository is listed as 'contributed'. +""" +enum RepositoryContributionType { + """ + Created a commit + """ + COMMIT + + """ + Created an issue + """ + ISSUE + + """ + Created a pull request + """ + PULL_REQUEST + + """ + Created the repository + """ + REPOSITORY + + """ + Reviewed a pull request + """ + PULL_REQUEST_REVIEW +} + +""" +An edge in a connection. +""" +type RepositoryEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Repository +} + +""" +A subset of repository info. +""" +interface RepositoryInfo { + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + The description of the repository. + """ + description: String + + """ + The description of the repository rendered to HTML. + """ + descriptionHTML: HTML! + + """ + Returns how many forks there are of this repository in the whole network. + """ + forkCount: Int! + + """ + Indicates if the repository has issues feature enabled. + """ + hasIssuesEnabled: Boolean! + + """ + Indicates if the repository has wiki feature enabled. + """ + hasWikiEnabled: Boolean! + + """ + The repository's URL. + """ + homepageUrl: URI + + """ + Indicates if the repository is unmaintained. + """ + isArchived: Boolean! + + """ + Identifies if the repository is a fork. + """ + isFork: Boolean! + + """ + Indicates if the repository has been locked or not. + """ + isLocked: Boolean! + + """ + Identifies if the repository is a mirror. + """ + isMirror: Boolean! + + """ + Identifies if the repository is private. + """ + isPrivate: Boolean! + + """ + The license associated with the repository + """ + licenseInfo: License + + """ + The reason the repository has been locked. + """ + lockReason: RepositoryLockReason + + """ + The repository's original mirror URL. + """ + mirrorUrl: URI + + """ + The name of the repository. + """ + name: String! + + """ + The repository's name with owner. + """ + nameWithOwner: String! + + """ + The User owner of the repository. + """ + owner: RepositoryOwner! + + """ + Identifies when the repository was last pushed to. + """ + pushedAt: DateTime + + """ + The HTTP path for this repository + """ + resourcePath: URI! + + """ + A description of the repository, rendered to HTML without any links in it. + """ + shortDescriptionHTML( + """ + How many characters to return. + """ + limit: Int = 200 + ): HTML! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this repository + """ + url: URI! +} + +""" +An invitation for a user to be added to a repository. +""" +type RepositoryInvitation implements Node { + id: ID! + + """ + The user who received the invitation. + """ + invitee: User! + + """ + The user who created the invitation. + """ + inviter: User! + + """ + The permission granted on this repository by this invitation. + """ + permission: RepositoryPermission! + + """ + The Repository the user is invited to. + """ + repository: RepositoryInfo +} + +""" +An edge in a connection. +""" +type RepositoryInvitationEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: RepositoryInvitation +} + +""" +The possible reasons a given repository could be in a locked state. +""" +enum RepositoryLockReason { + """ + The repository is locked due to a move. + """ + MOVING + + """ + The repository is locked due to a billing related reason. + """ + BILLING + + """ + The repository is locked due to a rename. + """ + RENAME + + """ + The repository is locked due to a migration. + """ + MIGRATING +} + +""" +Represents a object that belongs to a repository. +""" +interface RepositoryNode { + """ + The repository associated with this node. + """ + repository: Repository! +} + +""" +Ordering options for repository connections +""" +input RepositoryOrder { + """ + The field to order repositories by. + """ + field: RepositoryOrderField! + + """ + The ordering direction. + """ + direction: OrderDirection! +} + +""" +Properties by which repository connections can be ordered. +""" +enum RepositoryOrderField { + """ + Order repositories by creation time + """ + CREATED_AT + + """ + Order repositories by update time + """ + UPDATED_AT + + """ + Order repositories by push time + """ + PUSHED_AT + + """ + Order repositories by name + """ + NAME + + """ + Order repositories by number of stargazers + """ + STARGAZERS +} + +""" +Represents an owner of a Repository. +""" +interface RepositoryOwner { + """ + A URL pointing to the owner's public avatar. + """ + avatarUrl( + """ + The size of the resulting square image. + """ + size: Int + ): URI! + id: ID! + + """ + The username used to login. + """ + login: String! + + """ + A list of repositories this user has pinned to their profile + """ + pinnedRepositories( + """ + If non-null, filters repositories according to privacy + """ + privacy: RepositoryPrivacy + + """ + Ordering options for repositories returned from the connection + """ + orderBy: RepositoryOrder + + """ + Array of viewer's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + current viewer owns. + """ + affiliations: [RepositoryAffiliation] + + """ + Array of owner's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + organization or user being viewed owns. + """ + ownerAffiliations: [RepositoryAffiliation] + + """ + If non-null, filters repositories according to whether they have been locked + """ + isLocked: Boolean + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): RepositoryConnection! + @deprecated( + reason: "pinnedRepositories will be removed Use ProfileOwner.pinnedItems instead. Removal on 2019-07-01 UTC." + ) + + """ + A list of repositories that the user owns. + """ + repositories( + """ + If non-null, filters repositories according to privacy + """ + privacy: RepositoryPrivacy + + """ + Ordering options for repositories returned from the connection + """ + orderBy: RepositoryOrder + + """ + Array of viewer's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + current viewer owns. + """ + affiliations: [RepositoryAffiliation] + + """ + Array of owner's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + organization or user being viewed owns. + """ + ownerAffiliations: [RepositoryAffiliation] + + """ + If non-null, filters repositories according to whether they have been locked + """ + isLocked: Boolean + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + If non-null, filters repositories according to whether they are forks of another repository + """ + isFork: Boolean + ): RepositoryConnection! + + """ + Find Repository. + """ + repository( + """ + Name of Repository to find. + """ + name: String! + ): Repository + + """ + The HTTP URL for the owner. + """ + resourcePath: URI! + + """ + The HTTP URL for the owner. + """ + url: URI! +} + +""" +The access level to a repository +""" +enum RepositoryPermission { + """ + Can read, clone, push, and add collaborators + """ + ADMIN + + """ + Can read, clone and push + """ + WRITE + + """ + Can read and clone + """ + READ +} + +""" +The privacy of a repository +""" +enum RepositoryPrivacy { + """ + Public + """ + PUBLIC + + """ + Private + """ + PRIVATE +} + +""" +A repository-topic connects a repository to a topic. +""" +type RepositoryTopic implements Node & UniformResourceLocatable { + id: ID! + + """ + The HTTP path for this repository-topic. + """ + resourcePath: URI! + + """ + The topic. + """ + topic: Topic! + + """ + The HTTP URL for this repository-topic. + """ + url: URI! +} + +""" +The connection type for RepositoryTopic. +""" +type RepositoryTopicConnection { + """ + A list of edges. + """ + edges: [RepositoryTopicEdge] + + """ + A list of nodes. + """ + nodes: [RepositoryTopic] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type RepositoryTopicEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: RepositoryTopic +} + +""" +Types that can be requested reviewers. +""" +union RequestedReviewer = User | Team | Mannequin + +""" +Autogenerated input type of RequestReviews +""" +input RequestReviewsInput { + """ + The Node ID of the pull request to modify. + """ + pullRequestId: ID! + + """ + The Node IDs of the user to request. + """ + userIds: [ID!] + + """ + The Node IDs of the team to request. + """ + teamIds: [ID!] + + """ + Add users to the set rather than replace. + """ + union: Boolean + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of RequestReviews +""" +type RequestReviewsPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The pull request that is getting requests. + """ + pullRequest: PullRequest + + """ + The edge from the pull request to the requested reviewers. + """ + requestedReviewersEdge: UserEdge +} + +""" +Autogenerated input type of ResolveReviewThread +""" +input ResolveReviewThreadInput { + """ + The ID of the thread to resolve + """ + threadId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of ResolveReviewThread +""" +type ResolveReviewThreadPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The thread to resolve. + """ + thread: PullRequestReviewThread +} + +""" +Represents a private contribution a user made on GitHub. +""" +type RestrictedContribution implements Contribution { + """ + Whether this contribution is associated with a record you do not have access to. For + example, your own 'first issue' contribution may have been made on a repository you can no + longer access. + """ + isRestricted: Boolean! + + """ + When this contribution was made. + """ + occurredAt: DateTime! + + """ + The HTTP path for this contribution. + """ + resourcePath: URI! + + """ + The HTTP URL for this contribution. + """ + url: URI! + + """ + The user who made this contribution. + """ + user: User! +} + +""" +A team or user who has the ability to dismiss a review on a protected branch. +""" +type ReviewDismissalAllowance implements Node { + """ + The actor that can dismiss. + """ + actor: ReviewDismissalAllowanceActor + + """ + Identifies the branch protection rule associated with the allowed user or team. + """ + branchProtectionRule: BranchProtectionRule + id: ID! +} + +""" +Types that can be an actor. +""" +union ReviewDismissalAllowanceActor = User | Team + +""" +The connection type for ReviewDismissalAllowance. +""" +type ReviewDismissalAllowanceConnection { + """ + A list of edges. + """ + edges: [ReviewDismissalAllowanceEdge] + + """ + A list of nodes. + """ + nodes: [ReviewDismissalAllowance] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type ReviewDismissalAllowanceEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: ReviewDismissalAllowance +} + +""" +Represents a 'review_dismissed' event on a given issue or pull request. +""" +type ReviewDismissedEvent implements Node & UniformResourceLocatable { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + Identifies the optional message associated with the 'review_dismissed' event. + """ + dismissalMessage: String + + """ + Identifies the optional message associated with the event, rendered to HTML. + """ + dismissalMessageHTML: String + id: ID! + + """ + Identifies the message associated with the 'review_dismissed' event. + """ + message: String! + @deprecated( + reason: "`message` is being removed because it not nullable, whereas the underlying field is optional. Use `dismissalMessage` instead. Removal on 2019-07-01 UTC." + ) + + """ + The message associated with the event, rendered to HTML. + """ + messageHtml: HTML! + @deprecated( + reason: "`messageHtml` is being removed because it not nullable, whereas the underlying field is optional. Use `dismissalMessageHTML` instead. Removal on 2019-07-01 UTC." + ) + + """ + Identifies the previous state of the review with the 'review_dismissed' event. + """ + previousReviewState: PullRequestReviewState! + + """ + PullRequest referenced by event. + """ + pullRequest: PullRequest! + + """ + Identifies the commit which caused the review to become stale. + """ + pullRequestCommit: PullRequestCommit + + """ + The HTTP path for this review dismissed event. + """ + resourcePath: URI! + + """ + Identifies the review associated with the 'review_dismissed' event. + """ + review: PullRequestReview + + """ + The HTTP URL for this review dismissed event. + """ + url: URI! +} + +""" +A request for a user to review a pull request. +""" +type ReviewRequest implements Node { + """ + Identifies the primary key from the database. + """ + databaseId: Int + id: ID! + + """ + Identifies the pull request associated with this review request. + """ + pullRequest: PullRequest! + + """ + The reviewer that is requested. + """ + requestedReviewer: RequestedReviewer +} + +""" +The connection type for ReviewRequest. +""" +type ReviewRequestConnection { + """ + A list of edges. + """ + edges: [ReviewRequestEdge] + + """ + A list of nodes. + """ + nodes: [ReviewRequest] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +Represents an 'review_requested' event on a given pull request. +""" +type ReviewRequestedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + PullRequest referenced by event. + """ + pullRequest: PullRequest! + + """ + Identifies the reviewer whose review was requested. + """ + requestedReviewer: RequestedReviewer +} + +""" +An edge in a connection. +""" +type ReviewRequestEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: ReviewRequest +} + +""" +Represents an 'review_request_removed' event on a given pull request. +""" +type ReviewRequestRemovedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + PullRequest referenced by event. + """ + pullRequest: PullRequest! + + """ + Identifies the reviewer whose review request was removed. + """ + requestedReviewer: RequestedReviewer +} + +""" +The results of a search. +""" +union SearchResultItem = + Issue + | PullRequest + | Repository + | User + | Organization + | MarketplaceListing + +""" +A list of results that matched against a search query. +""" +type SearchResultItemConnection { + """ + The number of pieces of code that matched the search query. + """ + codeCount: Int! + + """ + A list of edges. + """ + edges: [SearchResultItemEdge] + + """ + The number of issues that matched the search query. + """ + issueCount: Int! + + """ + A list of nodes. + """ + nodes: [SearchResultItem] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + The number of repositories that matched the search query. + """ + repositoryCount: Int! + + """ + The number of users that matched the search query. + """ + userCount: Int! + + """ + The number of wiki pages that matched the search query. + """ + wikiCount: Int! +} + +""" +An edge in a connection. +""" +type SearchResultItemEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: SearchResultItem + + """ + Text matches on the result found. + """ + textMatches: [TextMatch] +} + +""" +Represents the individual results of a search. +""" +enum SearchType { + """ + Returns results matching issues in repositories. + """ + ISSUE + + """ + Returns results matching repositories. + """ + REPOSITORY + + """ + Returns results matching users and organizations on GitHub. + """ + USER +} + +""" +A GitHub Security Advisory +""" +type SecurityAdvisory implements Node { + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + This is a long plaintext description of the advisory + """ + description: String! + + """ + The GitHub Security Advisory ID + """ + ghsaId: String! + id: ID! + + """ + A list of identifiers for this advisory + """ + identifiers: [SecurityAdvisoryIdentifier!]! + + """ + The organization that originated the advisory + """ + origin: String! + + """ + When the advisory was published + """ + publishedAt: DateTime! + + """ + A list of references for this advisory + """ + references: [SecurityAdvisoryReference!]! + + """ + The severity of the advisory + """ + severity: SecurityAdvisorySeverity! + + """ + A short plaintext summary of the advisory + """ + summary: String! + + """ + When the advisory was last updated + """ + updatedAt: DateTime! + + """ + Vulnerabilities associated with this Advisory + """ + vulnerabilities( + """ + Ordering options for the returned topics. + """ + orderBy: SecurityVulnerabilityOrder + + """ + An ecosystem to filter vulnerabilities by. + """ + ecosystem: SecurityAdvisoryEcosystem + + """ + A package name to filter vulnerabilities by. + """ + package: String + + """ + A list of severities to filter vulnerabilities by. + """ + severities: [SecurityAdvisorySeverity!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): SecurityVulnerabilityConnection! + + """ + When the advisory was withdrawn, if it has been withdrawn + """ + withdrawnAt: DateTime +} + +""" +The connection type for SecurityAdvisory. +""" +type SecurityAdvisoryConnection { + """ + A list of edges. + """ + edges: [SecurityAdvisoryEdge] + + """ + A list of nodes. + """ + nodes: [SecurityAdvisory] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +The possible ecosystems of a security vulnerability's package. +""" +enum SecurityAdvisoryEcosystem { + """ + Ruby gems hosted at RubyGems.org + """ + RUBYGEMS + + """ + JavaScript packages hosted at npmjs.com + """ + NPM + + """ + Python packages hosted at PyPI.org + """ + PIP + + """ + Java artifacts hosted at the Maven central repository + """ + MAVEN + + """ + .NET packages hosted at the NuGet Gallery + """ + NUGET +} + +""" +An edge in a connection. +""" +type SecurityAdvisoryEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: SecurityAdvisory +} + +""" +A GitHub Security Advisory Identifier +""" +type SecurityAdvisoryIdentifier { + """ + The identifier type, e.g. GHSA, CVE + """ + type: String! + + """ + The identifier + """ + value: String! +} + +""" +An advisory identifier to filter results on. +""" +input SecurityAdvisoryIdentifierFilter { + """ + The identifier type. + """ + type: SecurityAdvisoryIdentifierType! + + """ + The identifier string. Supports exact or partial matching. + """ + value: String! +} + +""" +Identifier formats available for advisories. +""" +enum SecurityAdvisoryIdentifierType { + """ + Common Vulnerabilities and Exposures Identifier. + """ + CVE + + """ + GitHub Security Advisory ID. + """ + GHSA +} + +""" +Ordering options for security advisory connections +""" +input SecurityAdvisoryOrder { + """ + The field to order security advisories by. + """ + field: SecurityAdvisoryOrderField! + + """ + The ordering direction. + """ + direction: OrderDirection! +} + +""" +Properties by which security advisory connections can be ordered. +""" +enum SecurityAdvisoryOrderField { + """ + Order advisories by publication time + """ + PUBLISHED_AT + + """ + Order advisories by update time + """ + UPDATED_AT +} + +""" +An individual package +""" +type SecurityAdvisoryPackage { + """ + The ecosystem the package belongs to, e.g. RUBYGEMS, NPM + """ + ecosystem: SecurityAdvisoryEcosystem! + + """ + The package name + """ + name: String! +} + +""" +An individual package version +""" +type SecurityAdvisoryPackageVersion { + """ + The package name or version + """ + identifier: String! +} + +""" +A GitHub Security Advisory Reference +""" +type SecurityAdvisoryReference { + """ + A publicly accessible reference + """ + url: URI! +} + +""" +Severity of the vulnerability. +""" +enum SecurityAdvisorySeverity { + """ + Low. + """ + LOW + + """ + Moderate. + """ + MODERATE + + """ + High. + """ + HIGH + + """ + Critical. + """ + CRITICAL +} + +""" +An individual vulnerability within an Advisory +""" +type SecurityVulnerability { + """ + The Advisory associated with this Vulnerability + """ + advisory: SecurityAdvisory! + + """ + The first version containing a fix for the vulnerability + """ + firstPatchedVersion: SecurityAdvisoryPackageVersion + + """ + A description of the vulnerable package + """ + package: SecurityAdvisoryPackage! + + """ + The severity of the vulnerability within this package + """ + severity: SecurityAdvisorySeverity! + + """ + When the vulnerability was last updated + """ + updatedAt: DateTime! + + """ + A string that describes the vulnerable package versions. + This string follows a basic syntax with a few forms. + + `= 0.2.0` denotes a single vulnerable version. + + `<= 1.0.8` denotes a version range up to and including the specified version + + `< 0.1.11` denotes a version range up to, but excluding, the specified version + + `>= 4.3.0, < 4.3.5` denotes a version range with a known minimum and maximum version. + + `>= 0.0.1` denotes a version range with a known minimum, but no known maximum + """ + vulnerableVersionRange: String! +} + +""" +The connection type for SecurityVulnerability. +""" +type SecurityVulnerabilityConnection { + """ + A list of edges. + """ + edges: [SecurityVulnerabilityEdge] + + """ + A list of nodes. + """ + nodes: [SecurityVulnerability] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type SecurityVulnerabilityEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: SecurityVulnerability +} + +""" +Ordering options for security vulnerability connections +""" +input SecurityVulnerabilityOrder { + """ + The field to order security vulnerabilities by. + """ + field: SecurityVulnerabilityOrderField! + + """ + The ordering direction. + """ + direction: OrderDirection! +} + +""" +Properties by which security vulnerability connections can be ordered. +""" +enum SecurityVulnerabilityOrderField { + """ + Order vulnerability by update time + """ + UPDATED_AT +} + +""" +Represents an S/MIME signature on a Commit or Tag. +""" +type SmimeSignature implements GitSignature { + """ + Email used to sign this object. + """ + email: String! + + """ + True if the signature is valid and verified by GitHub. + """ + isValid: Boolean! + + """ + Payload for GPG signing object. Raw ODB object without the signature header. + """ + payload: String! + + """ + ASCII-armored signature header from object. + """ + signature: String! + + """ + GitHub user corresponding to the email signing this commit. + """ + signer: User + + """ + The state of this signature. `VALID` if signature is valid and verified by + GitHub, otherwise represents reason why signature is considered invalid. + """ + state: GitSignatureState! + + """ + True if the signature was made with GitHub's signing key. + """ + wasSignedByGitHub: Boolean! +} + +""" +The connection type for User. +""" +type StargazerConnection { + """ + A list of edges. + """ + edges: [StargazerEdge] + + """ + A list of nodes. + """ + nodes: [User] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +Represents a user that's starred a repository. +""" +type StargazerEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + node: User! + + """ + Identifies when the item was starred. + """ + starredAt: DateTime! +} + +""" +Ways in which star connections can be ordered. +""" +input StarOrder { + """ + The field in which to order nodes by. + """ + field: StarOrderField! + + """ + The direction in which to order nodes. + """ + direction: OrderDirection! +} + +""" +Properties by which star connections can be ordered. +""" +enum StarOrderField { + """ + Allows ordering a list of stars by when they were created. + """ + STARRED_AT +} + +""" +Things that can be starred. +""" +interface Starrable { + id: ID! + + """ + A list of users who have starred this starrable. + """ + stargazers( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Order for connection + """ + orderBy: StarOrder + ): StargazerConnection! + + """ + Returns a boolean indicating whether the viewing user has starred this starrable. + """ + viewerHasStarred: Boolean! +} + +""" +The connection type for Repository. +""" +type StarredRepositoryConnection { + """ + A list of edges. + """ + edges: [StarredRepositoryEdge] + + """ + A list of nodes. + """ + nodes: [Repository] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +Represents a starred repository. +""" +type StarredRepositoryEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + node: Repository! + + """ + Identifies when the item was starred. + """ + starredAt: DateTime! +} + +""" +Represents a commit status. +""" +type Status implements Node { + """ + The commit this status is attached to. + """ + commit: Commit + + """ + Looks up an individual status context by context name. + """ + context( + """ + The context name. + """ + name: String! + ): StatusContext + + """ + The individual status contexts for this commit. + """ + contexts: [StatusContext!]! + id: ID! + + """ + The combined commit status. + """ + state: StatusState! +} + +""" +Represents an individual commit status context +""" +type StatusContext implements Node { + """ + This commit this status context is attached to. + """ + commit: Commit + + """ + The name of this status context. + """ + context: String! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + The actor who created this status context. + """ + creator: Actor + + """ + The description for this status context. + """ + description: String + id: ID! + + """ + The state of this status context. + """ + state: StatusState! + + """ + The URL for this status context. + """ + targetUrl: URI +} + +""" +The possible commit status states. +""" +enum StatusState { + """ + Status is expected. + """ + EXPECTED + + """ + Status is errored. + """ + ERROR + + """ + Status is failing. + """ + FAILURE + + """ + Status is pending. + """ + PENDING + + """ + Status is successful. + """ + SUCCESS +} + +""" +Autogenerated input type of SubmitPullRequestReview +""" +input SubmitPullRequestReviewInput { + """ + The Pull Request Review ID to submit. + """ + pullRequestReviewId: ID! + + """ + The event to send to the Pull Request Review. + """ + event: PullRequestReviewEvent! + + """ + The text field to set on the Pull Request Review. + """ + body: String + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of SubmitPullRequestReview +""" +type SubmitPullRequestReviewPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The submitted pull request review. + """ + pullRequestReview: PullRequestReview +} + +""" +Entities that can be subscribed to for web and email notifications. +""" +interface Subscribable { + id: ID! + + """ + Check if the viewer is able to change their subscription status for the repository. + """ + viewerCanSubscribe: Boolean! + + """ + Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. + """ + viewerSubscription: SubscriptionState +} + +""" +Represents a 'subscribed' event on a given `Subscribable`. +""" +type SubscribedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Object referenced by event. + """ + subscribable: Subscribable! +} + +""" +The possible states of a subscription. +""" +enum SubscriptionState { + """ + The User is only notified when participating or @mentioned. + """ + UNSUBSCRIBED + + """ + The User is notified of all conversations. + """ + SUBSCRIBED + + """ + The User is never notified. + """ + IGNORED +} + +""" +A suggestion to review a pull request based on a user's commit history and review comments. +""" +type SuggestedReviewer { + """ + Is this suggestion based on past commits? + """ + isAuthor: Boolean! + + """ + Is this suggestion based on past review comments? + """ + isCommenter: Boolean! + + """ + Identifies the user suggested to review the pull request. + """ + reviewer: User! +} + +""" +Represents a Git tag. +""" +type Tag implements Node & GitObject { + """ + An abbreviated version of the Git object ID + """ + abbreviatedOid: String! + + """ + The HTTP path for this Git object + """ + commitResourcePath: URI! + + """ + The HTTP URL for this Git object + """ + commitUrl: URI! + id: ID! + + """ + The Git tag message. + """ + message: String + + """ + The Git tag name. + """ + name: String! + + """ + The Git object ID + """ + oid: GitObjectID! + + """ + The Repository the Git object belongs to + """ + repository: Repository! + + """ + Details about the tag author. + """ + tagger: GitActor + + """ + The Git object the tag points to. + """ + target: GitObject! +} + +""" +A team of users in an organization. +""" +type Team implements Node & Subscribable & MemberStatusable { + """ + A list of teams that are ancestors of this team. + """ + ancestors( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): TeamConnection! + + """ + A URL pointing to the team's avatar. + """ + avatarUrl( + """ + The size in pixels of the resulting square image. + """ + size: Int = 400 + ): URI + + """ + List of child teams belonging to this team + """ + childTeams( + """ + Order for connection + """ + orderBy: TeamOrder + + """ + User logins to filter by + """ + userLogins: [String!] + + """ + Whether to list immediate child teams or all descendant child teams. + """ + immediateOnly: Boolean = true + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): TeamConnection! + + """ + The slug corresponding to the organization and team. + """ + combinedSlug: String! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + The description of the team. + """ + description: String + + """ + The HTTP path for editing this team + """ + editTeamResourcePath: URI! + + """ + The HTTP URL for editing this team + """ + editTeamUrl: URI! + id: ID! + + """ + A list of pending invitations for users to this team + """ + invitations( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): OrganizationInvitationConnection + + """ + Get the status messages members of this entity have set that are either public or visible only to the organization. + """ + memberStatuses( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Ordering options for user statuses returned from the connection. + """ + orderBy: UserStatusOrder + ): UserStatusConnection! + + """ + A list of users who are members of this team. + """ + members( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + The search string to look for. + """ + query: String + + """ + Filter by membership type + """ + membership: TeamMembershipType = ALL + + """ + Filter by team member role + """ + role: TeamMemberRole + + """ + Order for the connection. + """ + orderBy: TeamMemberOrder + ): TeamMemberConnection! + + """ + The HTTP path for the team' members + """ + membersResourcePath: URI! + + """ + The HTTP URL for the team' members + """ + membersUrl: URI! + + """ + The name of the team. + """ + name: String! + + """ + The HTTP path creating a new team + """ + newTeamResourcePath: URI! + + """ + The HTTP URL creating a new team + """ + newTeamUrl: URI! + + """ + The organization that owns this team. + """ + organization: Organization! + + """ + The parent team of the team. + """ + parentTeam: Team + + """ + The level of privacy the team has. + """ + privacy: TeamPrivacy! + + """ + A list of repositories this team has access to. + """ + repositories( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + The search string to look for. + """ + query: String + + """ + Order for the connection. + """ + orderBy: TeamRepositoryOrder + ): TeamRepositoryConnection! + + """ + The HTTP path for this team's repositories + """ + repositoriesResourcePath: URI! + + """ + The HTTP URL for this team's repositories + """ + repositoriesUrl: URI! + + """ + The HTTP path for this team + """ + resourcePath: URI! + + """ + The slug corresponding to the team. + """ + slug: String! + + """ + The HTTP path for this team's teams + """ + teamsResourcePath: URI! + + """ + The HTTP URL for this team's teams + """ + teamsUrl: URI! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this team + """ + url: URI! + + """ + Team is adminable by the viewer. + """ + viewerCanAdminister: Boolean! + + """ + Check if the viewer is able to change their subscription status for the repository. + """ + viewerCanSubscribe: Boolean! + + """ + Identifies if the viewer is watching, not watching, or ignoring the subscribable entity. + """ + viewerSubscription: SubscriptionState +} + +""" +The connection type for Team. +""" +type TeamConnection { + """ + A list of edges. + """ + edges: [TeamEdge] + + """ + A list of nodes. + """ + nodes: [Team] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type TeamEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Team +} + +""" +The connection type for User. +""" +type TeamMemberConnection { + """ + A list of edges. + """ + edges: [TeamMemberEdge] + + """ + A list of nodes. + """ + nodes: [User] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +Represents a user who is a member of a team. +""" +type TeamMemberEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The HTTP path to the organization's member access page. + """ + memberAccessResourcePath: URI! + + """ + The HTTP URL to the organization's member access page. + """ + memberAccessUrl: URI! + node: User! + + """ + The role the member has on the team. + """ + role: TeamMemberRole! +} + +""" +Ordering options for team member connections +""" +input TeamMemberOrder { + """ + The field to order team members by. + """ + field: TeamMemberOrderField! + + """ + The ordering direction. + """ + direction: OrderDirection! +} + +""" +Properties by which team member connections can be ordered. +""" +enum TeamMemberOrderField { + """ + Order team members by login + """ + LOGIN + + """ + Order team members by creation time + """ + CREATED_AT +} + +""" +The possible team member roles; either 'maintainer' or 'member'. +""" +enum TeamMemberRole { + """ + A team maintainer has permission to add and remove team members. + """ + MAINTAINER + + """ + A team member has no administrative permissions on the team. + """ + MEMBER +} + +""" +Defines which types of team members are included in the returned list. Can be one of IMMEDIATE, CHILD_TEAM or ALL. +""" +enum TeamMembershipType { + """ + Includes only immediate members of the team. + """ + IMMEDIATE + + """ + Includes only child team members for the team. + """ + CHILD_TEAM + + """ + Includes immediate and child team members for the team. + """ + ALL +} + +""" +Ways in which team connections can be ordered. +""" +input TeamOrder { + """ + The field in which to order nodes by. + """ + field: TeamOrderField! + + """ + The direction in which to order nodes. + """ + direction: OrderDirection! +} + +""" +Properties by which team connections can be ordered. +""" +enum TeamOrderField { + """ + Allows ordering a list of teams by name. + """ + NAME +} + +""" +The possible team privacy values. +""" +enum TeamPrivacy { + """ + A secret team can only be seen by its members. + """ + SECRET + + """ + A visible team can be seen and @mentioned by every member of the organization. + """ + VISIBLE +} + +""" +The connection type for Repository. +""" +type TeamRepositoryConnection { + """ + A list of edges. + """ + edges: [TeamRepositoryEdge] + + """ + A list of nodes. + """ + nodes: [Repository] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +Represents a team repository. +""" +type TeamRepositoryEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + node: Repository! + + """ + The permission level the team has on the repository + """ + permission: RepositoryPermission! +} + +""" +Ordering options for team repository connections +""" +input TeamRepositoryOrder { + """ + The field to order repositories by. + """ + field: TeamRepositoryOrderField! + + """ + The ordering direction. + """ + direction: OrderDirection! +} + +""" +Properties by which team repository connections can be ordered. +""" +enum TeamRepositoryOrderField { + """ + Order repositories by creation time + """ + CREATED_AT + + """ + Order repositories by update time + """ + UPDATED_AT + + """ + Order repositories by push time + """ + PUSHED_AT + + """ + Order repositories by name + """ + NAME + + """ + Order repositories by permission + """ + PERMISSION + + """ + Order repositories by number of stargazers + """ + STARGAZERS +} + +""" +The role of a user on a team. +""" +enum TeamRole { + """ + User has admin rights on the team. + """ + ADMIN + + """ + User is a member of the team. + """ + MEMBER +} + +""" +A text match within a search result. +""" +type TextMatch { + """ + The specific text fragment within the property matched on. + """ + fragment: String! + + """ + Highlights within the matched fragment. + """ + highlights: [TextMatchHighlight!]! + + """ + The property matched on. + """ + property: String! +} + +""" +Represents a single highlight in a search result match. +""" +type TextMatchHighlight { + """ + The indice in the fragment where the matched text begins. + """ + beginIndice: Int! + + """ + The indice in the fragment where the matched text ends. + """ + endIndice: Int! + + """ + The text matched. + """ + text: String! +} + +""" +A topic aggregates entities that are related to a subject. +""" +type Topic implements Node & Starrable { + id: ID! + + """ + The topic's name. + """ + name: String! + + """ + A list of related topics, including aliases of this topic, sorted with the most relevant + first. Returns up to 10 Topics. + """ + relatedTopics( + """ + How many topics to return. + """ + first: Int = 3 + ): [Topic!]! + + """ + A list of users who have starred this starrable. + """ + stargazers( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + Order for connection + """ + orderBy: StarOrder + ): StargazerConnection! + + """ + Returns a boolean indicating whether the viewing user has starred this starrable. + """ + viewerHasStarred: Boolean! +} + +""" +The connection type for Topic. +""" +type TopicConnection { + """ + A list of edges. + """ + edges: [TopicEdge] + + """ + A list of nodes. + """ + nodes: [Topic] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type TopicEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: Topic +} + +""" +Reason that the suggested topic is declined. +""" +enum TopicSuggestionDeclineReason { + """ + The suggested topic is not relevant to the repository. + """ + NOT_RELEVANT + + """ + The suggested topic is too specific for the repository (e.g. #ruby-on-rails-version-4-2-1). + """ + TOO_SPECIFIC + + """ + The viewer does not like the suggested topic. + """ + PERSONAL_PREFERENCE + + """ + The suggested topic is too general for the repository. + """ + TOO_GENERAL +} + +""" +Represents a 'transferred' event on a given issue or pull request. +""" +type TransferredEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + The repository this came from + """ + fromRepository: Repository + id: ID! + + """ + Identifies the issue associated with the event. + """ + issue: Issue! +} + +""" +Represents a Git tree. +""" +type Tree implements Node & GitObject { + """ + An abbreviated version of the Git object ID + """ + abbreviatedOid: String! + + """ + The HTTP path for this Git object + """ + commitResourcePath: URI! + + """ + The HTTP URL for this Git object + """ + commitUrl: URI! + + """ + A list of tree entries. + """ + entries: [TreeEntry!] + id: ID! + + """ + The Git object ID + """ + oid: GitObjectID! + + """ + The Repository the Git object belongs to + """ + repository: Repository! +} + +""" +Represents a Git tree entry. +""" +type TreeEntry { + """ + Entry file mode. + """ + mode: Int! + + """ + Entry file name. + """ + name: String! + + """ + Entry file object. + """ + object: GitObject + + """ + Entry file Git object ID. + """ + oid: GitObjectID! + + """ + The Repository the tree entry belongs to + """ + repository: Repository! + + """ + Entry file type. + """ + type: String! +} + +""" +Represents an 'unassigned' event on any assignable object. +""" +type UnassignedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the assignable associated with the event. + """ + assignable: Assignable! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Identifies the subject (user) who was unassigned. + """ + user: User +} + +""" +Represents a type that can be retrieved by a URL. +""" +interface UniformResourceLocatable { + """ + The HTML path to this resource. + """ + resourcePath: URI! + + """ + The URL to this resource. + """ + url: URI! +} + +""" +Represents an unknown signature on a Commit or Tag. +""" +type UnknownSignature implements GitSignature { + """ + Email used to sign this object. + """ + email: String! + + """ + True if the signature is valid and verified by GitHub. + """ + isValid: Boolean! + + """ + Payload for GPG signing object. Raw ODB object without the signature header. + """ + payload: String! + + """ + ASCII-armored signature header from object. + """ + signature: String! + + """ + GitHub user corresponding to the email signing this commit. + """ + signer: User + + """ + The state of this signature. `VALID` if signature is valid and verified by + GitHub, otherwise represents reason why signature is considered invalid. + """ + state: GitSignatureState! + + """ + True if the signature was made with GitHub's signing key. + """ + wasSignedByGitHub: Boolean! +} + +""" +Represents an 'unlabeled' event on a given issue or pull request. +""" +type UnlabeledEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Identifies the label associated with the 'unlabeled' event. + """ + label: Label! + + """ + Identifies the `Labelable` associated with the event. + """ + labelable: Labelable! +} + +""" +Represents an 'unlocked' event on a given issue or pull request. +""" +type UnlockedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Object that was unlocked. + """ + lockable: Lockable! +} + +""" +Autogenerated input type of UnlockLockable +""" +input UnlockLockableInput { + """ + ID of the issue or pull request to be unlocked. + """ + lockableId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UnlockLockable +""" +type UnlockLockablePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The item that was unlocked. + """ + unlockedRecord: Lockable +} + +""" +Autogenerated input type of UnmarkIssueAsDuplicate +""" +input UnmarkIssueAsDuplicateInput { + """ + ID of the issue or pull request currently marked as a duplicate. + """ + duplicateId: ID! + + """ + ID of the issue or pull request currently considered canonical/authoritative/original. + """ + canonicalId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UnmarkIssueAsDuplicate +""" +type UnmarkIssueAsDuplicatePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The issue or pull request that was marked as a duplicate. + """ + duplicate: IssueOrPullRequest +} + +""" +Autogenerated input type of UnminimizeComment +""" +input UnminimizeCommentInput { + """ + The Node ID of the subject to modify. + """ + subjectId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated input type of UnpinIssue +""" +input UnpinIssueInput { + """ + The ID of the issue to be unpinned + """ + issueId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Represents an 'unpinned' event on a given issue or pull request. +""" +type UnpinnedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Identifies the issue associated with the event. + """ + issue: Issue! +} + +""" +Autogenerated input type of UnresolveReviewThread +""" +input UnresolveReviewThreadInput { + """ + The ID of the thread to unresolve + """ + threadId: ID! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UnresolveReviewThread +""" +type UnresolveReviewThreadPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The thread to resolve. + """ + thread: PullRequestReviewThread +} + +""" +Represents an 'unsubscribed' event on a given `Subscribable`. +""" +type UnsubscribedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + Object referenced by event. + """ + subscribable: Subscribable! +} + +""" +Entities that can be updated. +""" +interface Updatable { + """ + Check if the current viewer can update this object. + """ + viewerCanUpdate: Boolean! +} + +""" +Comments that can be updated. +""" +interface UpdatableComment { + """ + Reasons why the current viewer can not update this comment. + """ + viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! +} + +""" +Autogenerated input type of UpdateBranchProtectionRule +""" +input UpdateBranchProtectionRuleInput { + """ + The global relay id of the branch protection rule to be updated. + """ + branchProtectionRuleId: ID! + + """ + The glob-like pattern used to determine matching branches. + """ + pattern: String + + """ + Are approving reviews required to update matching branches. + """ + requiresApprovingReviews: Boolean + + """ + Number of approving reviews required to update matching branches. + """ + requiredApprovingReviewCount: Int + + """ + Are commits required to be signed. + """ + requiresCommitSignatures: Boolean + + """ + Can admins overwrite branch protection. + """ + isAdminEnforced: Boolean + + """ + Are status checks required to update matching branches. + """ + requiresStatusChecks: Boolean + + """ + Are branches required to be up to date before merging. + """ + requiresStrictStatusChecks: Boolean + + """ + Are reviews from code owners required to update matching branches. + """ + requiresCodeOwnerReviews: Boolean + + """ + Will new commits pushed to matching branches dismiss pull request review approvals. + """ + dismissesStaleReviews: Boolean + + """ + Is dismissal of pull request reviews restricted. + """ + restrictsReviewDismissals: Boolean + + """ + A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches. + """ + reviewDismissalActorIds: [ID!] + + """ + Is pushing to matching branches restricted. + """ + restrictsPushes: Boolean + + """ + A list of User or Team IDs allowed to push to matching branches. + """ + pushActorIds: [ID!] + + """ + List of required status check contexts that must pass for commits to be accepted to matching branches. + """ + requiredStatusCheckContexts: [String!] + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UpdateBranchProtectionRule +""" +type UpdateBranchProtectionRulePayload { + """ + The newly created BranchProtectionRule. + """ + branchProtectionRule: BranchProtectionRule + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated input type of UpdateIssueComment +""" +input UpdateIssueCommentInput { + """ + The ID of the IssueComment to modify. + """ + id: ID! + + """ + The updated text of the comment. + """ + body: String! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UpdateIssueComment +""" +type UpdateIssueCommentPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The updated comment. + """ + issueComment: IssueComment +} + +""" +Autogenerated input type of UpdateIssue +""" +input UpdateIssueInput { + """ + The ID of the Issue to modify. + """ + id: ID! + + """ + The title for the issue. + """ + title: String + + """ + The body for the issue description. + """ + body: String + + """ + An array of Node IDs of users for this issue. + """ + assigneeIds: [ID!] + + """ + The Node ID of the milestone for this issue. + """ + milestoneId: ID + + """ + An array of Node IDs of labels for this issue. + """ + labelIds: [ID!] + + """ + The desired issue state. + """ + state: IssueState + + """ + An array of Node IDs for projects associated with this issue. + """ + projectIds: [ID!] + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UpdateIssue +""" +type UpdateIssuePayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The issue. + """ + issue: Issue +} + +""" +Autogenerated input type of UpdateProjectCard +""" +input UpdateProjectCardInput { + """ + The ProjectCard ID to update. + """ + projectCardId: ID! + + """ + Whether or not the ProjectCard should be archived + """ + isArchived: Boolean + + """ + The note of ProjectCard. + """ + note: String + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UpdateProjectCard +""" +type UpdateProjectCardPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The updated ProjectCard. + """ + projectCard: ProjectCard +} + +""" +Autogenerated input type of UpdateProjectColumn +""" +input UpdateProjectColumnInput { + """ + The ProjectColumn ID to update. + """ + projectColumnId: ID! + + """ + The name of project column. + """ + name: String! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UpdateProjectColumn +""" +type UpdateProjectColumnPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The updated project column. + """ + projectColumn: ProjectColumn +} + +""" +Autogenerated input type of UpdateProject +""" +input UpdateProjectInput { + """ + The Project ID to update. + """ + projectId: ID! + + """ + The name of project. + """ + name: String + + """ + The description of project. + """ + body: String + + """ + Whether the project is open or closed. + """ + state: ProjectState + + """ + Whether the project is public or not. + """ + public: Boolean + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UpdateProject +""" +type UpdateProjectPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The updated project. + """ + project: Project +} + +""" +Autogenerated input type of UpdatePullRequest +""" +input UpdatePullRequestInput { + """ + The Node ID of the pull request. + """ + pullRequestId: ID! + + """ + The name of the branch you want your changes pulled into. This should be an existing branch + on the current repository. + """ + baseRefName: String + + """ + The title of the pull request. + """ + title: String + + """ + The contents of the pull request. + """ + body: String + + """ + Indicates whether maintainers can modify the pull request. + """ + maintainerCanModify: Boolean + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UpdatePullRequest +""" +type UpdatePullRequestPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The updated pull request. + """ + pullRequest: PullRequest +} + +""" +Autogenerated input type of UpdatePullRequestReviewComment +""" +input UpdatePullRequestReviewCommentInput { + """ + The Node ID of the comment to modify. + """ + pullRequestReviewCommentId: ID! + + """ + The text of the comment. + """ + body: String! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UpdatePullRequestReviewComment +""" +type UpdatePullRequestReviewCommentPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The updated comment. + """ + pullRequestReviewComment: PullRequestReviewComment +} + +""" +Autogenerated input type of UpdatePullRequestReview +""" +input UpdatePullRequestReviewInput { + """ + The Node ID of the pull request review to modify. + """ + pullRequestReviewId: ID! + + """ + The contents of the pull request review body. + """ + body: String! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UpdatePullRequestReview +""" +type UpdatePullRequestReviewPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The updated pull request review. + """ + pullRequestReview: PullRequestReview +} + +""" +Autogenerated input type of UpdateSubscription +""" +input UpdateSubscriptionInput { + """ + The Node ID of the subscribable object to modify. + """ + subscribableId: ID! + + """ + The new state of the subscription. + """ + state: SubscriptionState! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UpdateSubscription +""" +type UpdateSubscriptionPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + The input subscribable entity. + """ + subscribable: Subscribable +} + +""" +Autogenerated input type of UpdateTopics +""" +input UpdateTopicsInput { + """ + The Node ID of the repository. + """ + repositoryId: ID! + + """ + An array of topic names. + """ + topicNames: [String!]! + + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String +} + +""" +Autogenerated return type of UpdateTopics +""" +type UpdateTopicsPayload { + """ + A unique identifier for the client performing the mutation. + """ + clientMutationId: String + + """ + Names of the provided topics that are not valid. + """ + invalidTopicNames: [String!] + + """ + The updated repository. + """ + repository: Repository +} + +""" +An RFC 3986, RFC 3987, and RFC 6570 (level 4) compliant URI string. +""" +scalar URI + +""" +A user is an individual's account on GitHub that owns repositories and can make new content. +""" +type User implements Node & Actor & RegistryPackageOwner & RegistryPackageSearch & ProjectOwner & RepositoryOwner & UniformResourceLocatable & ProfileOwner { + """ + Determine if this repository owner has any items that can be pinned to their profile. + """ + anyPinnableItems( + """ + Filter to only a particular kind of pinnable item. + """ + type: PinnableItemType + ): Boolean! + + """ + A URL pointing to the user's public avatar. + """ + avatarUrl( + """ + The size of the resulting square image. + """ + size: Int + ): URI! + + """ + The user's public profile bio. + """ + bio: String + + """ + The user's public profile bio as HTML. + """ + bioHTML: HTML! + + """ + A list of commit comments made by this user. + """ + commitComments( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): CommitCommentConnection! + + """ + The user's public profile company. + """ + company: String + + """ + The user's public profile company as HTML. + """ + companyHTML: HTML! + + """ + The collection of contributions this user has made to different repositories. + """ + contributionsCollection( + """ + The ID of the organization used to filter contributions. + """ + organizationID: ID + + """ + Only contributions made at this time or later will be counted. If omitted, defaults to a year ago. + """ + from: DateTime + + """ + Only contributions made before and up to and including this time will be + counted. If omitted, defaults to the current time. + """ + to: DateTime + ): ContributionsCollection! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the primary key from the database. + """ + databaseId: Int + + """ + The user's publicly visible profile email. + """ + email: String! + + """ + A list of users the given user is followed by. + """ + followers( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): FollowerConnection! + + """ + A list of users the given user is following. + """ + following( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): FollowingConnection! + + """ + Find gist by repo name. + """ + gist( + """ + The gist name to find. + """ + name: String! + ): Gist + + """ + A list of gist comments made by this user. + """ + gistComments( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): GistCommentConnection! + + """ + A list of the Gists the user has created. + """ + gists( + """ + Filters Gists according to privacy. + """ + privacy: GistPrivacy + + """ + Ordering options for gists returned from the connection + """ + orderBy: GistOrder + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): GistConnection! + id: ID! + + """ + Whether or not this user is a participant in the GitHub Security Bug Bounty. + """ + isBountyHunter: Boolean! + + """ + Whether or not this user is a participant in the GitHub Campus Experts Program. + """ + isCampusExpert: Boolean! + + """ + Whether or not this user is a GitHub Developer Program member. + """ + isDeveloperProgramMember: Boolean! + + """ + Whether or not this user is a GitHub employee. + """ + isEmployee: Boolean! + + """ + Whether or not the user has marked themselves as for hire. + """ + isHireable: Boolean! + + """ + Whether or not this user is a site administrator. + """ + isSiteAdmin: Boolean! + + """ + Whether or not this user is the viewing user. + """ + isViewer: Boolean! + + """ + A list of issue comments made by this user. + """ + issueComments( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): IssueCommentConnection! + + """ + A list of issues associated with this user. + """ + issues( + """ + Ordering options for issues returned from the connection. + """ + orderBy: IssueOrder + + """ + A list of label names to filter the pull requests by. + """ + labels: [String!] + + """ + A list of states to filter the issues by. + """ + states: [IssueState!] + + """ + Filtering options for issues returned from the connection. + """ + filterBy: IssueFilters + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): IssueConnection! + + """ + Showcases a selection of repositories and gists that the profile owner has + either curated or that have been selected automatically based on popularity. + """ + itemShowcase: ProfileItemShowcase! + + """ + The user's public profile location. + """ + location: String + + """ + The username used to login. + """ + login: String! + + """ + The user's public profile name. + """ + name: String + + """ + Find an organization by its login that the user belongs to. + """ + organization( + """ + The login of the organization to find. + """ + login: String! + ): Organization + + """ + A list of organizations the user belongs to. + """ + organizations( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): OrganizationConnection! + + """ + A list of repositories and gists this profile owner can pin to their profile. + """ + pinnableItems( + """ + Filter the types of pinnable items that are returned. + """ + types: [PinnableItemType!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PinnableItemConnection! + + """ + A list of repositories and gists this profile owner has pinned to their profile + """ + pinnedItems( + """ + Filter the types of pinned items that are returned. + """ + types: [PinnableItemType!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PinnableItemConnection! + + """ + Returns how many more items this profile owner can pin to their profile. + """ + pinnedItemsRemaining: Int! + + """ + A list of repositories this user has pinned to their profile + """ + pinnedRepositories( + """ + If non-null, filters repositories according to privacy + """ + privacy: RepositoryPrivacy + + """ + Ordering options for repositories returned from the connection + """ + orderBy: RepositoryOrder + + """ + Array of viewer's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + current viewer owns. + """ + affiliations: [RepositoryAffiliation] + + """ + Array of owner's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + organization or user being viewed owns. + """ + ownerAffiliations: [RepositoryAffiliation] + + """ + If non-null, filters repositories according to whether they have been locked + """ + isLocked: Boolean + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): RepositoryConnection! + @deprecated( + reason: "pinnedRepositories will be removed Use ProfileOwner.pinnedItems instead. Removal on 2019-07-01 UTC." + ) + + """ + Find project by number. + """ + project( + """ + The project number to find. + """ + number: Int! + ): Project + + """ + A list of projects under the owner. + """ + projects( + """ + Ordering options for projects returned from the connection + """ + orderBy: ProjectOrder + + """ + Query to search projects by, currently only searching by name. + """ + search: String + + """ + A list of states to filter the projects by. + """ + states: [ProjectState!] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): ProjectConnection! + + """ + The HTTP path listing user's projects + """ + projectsResourcePath: URI! + + """ + The HTTP URL listing user's projects + """ + projectsUrl: URI! + + """ + A list of public keys associated with this user. + """ + publicKeys( + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PublicKeyConnection! + + """ + A list of pull requests associated with this user. + """ + pullRequests( + """ + A list of states to filter the pull requests by. + """ + states: [PullRequestState!] + + """ + A list of label names to filter the pull requests by. + """ + labels: [String!] + + """ + The head ref name to filter the pull requests by. + """ + headRefName: String + + """ + The base ref name to filter the pull requests by. + """ + baseRefName: String + + """ + Ordering options for pull requests returned from the connection. + """ + orderBy: IssueOrder + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): PullRequestConnection! + + """ + A list of repositories that the user owns. + """ + repositories( + """ + If non-null, filters repositories according to privacy + """ + privacy: RepositoryPrivacy + + """ + Ordering options for repositories returned from the connection + """ + orderBy: RepositoryOrder + + """ + Array of viewer's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + current viewer owns. + """ + affiliations: [RepositoryAffiliation] + + """ + Array of owner's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + organization or user being viewed owns. + """ + ownerAffiliations: [RepositoryAffiliation] + + """ + If non-null, filters repositories according to whether they have been locked + """ + isLocked: Boolean + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + + """ + If non-null, filters repositories according to whether they are forks of another repository + """ + isFork: Boolean + ): RepositoryConnection! + + """ + A list of repositories that the user recently contributed to. + """ + repositoriesContributedTo( + """ + If non-null, filters repositories according to privacy + """ + privacy: RepositoryPrivacy + + """ + Ordering options for repositories returned from the connection + """ + orderBy: RepositoryOrder + + """ + If non-null, filters repositories according to whether they have been locked + """ + isLocked: Boolean + + """ + If true, include user repositories + """ + includeUserRepositories: Boolean + + """ + If non-null, include only the specified types of contributions. The + GitHub.com UI uses [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY] + """ + contributionTypes: [RepositoryContributionType] + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): RepositoryConnection! + + """ + Find Repository. + """ + repository( + """ + Name of Repository to find. + """ + name: String! + ): Repository + + """ + The HTTP path for this user + """ + resourcePath: URI! + + """ + Repositories the user has starred. + """ + starredRepositories( + """ + Filters starred repositories to only return repositories owned by the viewer. + """ + ownedByViewer: Boolean + + """ + Order for connection + """ + orderBy: StarOrder + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): StarredRepositoryConnection! + + """ + The user's description of what they're currently doing. + """ + status: UserStatus + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The HTTP URL for this user + """ + url: URI! + + """ + Can the viewer pin repositories and gists to the profile? + """ + viewerCanChangePinnedItems: Boolean! + + """ + Can the current viewer create new projects on this owner. + """ + viewerCanCreateProjects: Boolean! + + """ + Whether or not the viewer is able to follow the user. + """ + viewerCanFollow: Boolean! + + """ + Whether or not this user is followed by the viewer. + """ + viewerIsFollowing: Boolean! + + """ + A list of repositories the given user is watching. + """ + watching( + """ + If non-null, filters repositories according to privacy + """ + privacy: RepositoryPrivacy + + """ + Ordering options for repositories returned from the connection + """ + orderBy: RepositoryOrder + + """ + Affiliation options for repositories returned from the connection + """ + affiliations: [RepositoryAffiliation] + + """ + Array of owner's affiliation options for repositories returned from the + connection. For example, OWNER will include only repositories that the + organization or user being viewed owns. + """ + ownerAffiliations: [RepositoryAffiliation] + + """ + If non-null, filters repositories according to whether they have been locked + """ + isLocked: Boolean + + """ + Returns the elements in the list that come after the specified cursor. + """ + after: String + + """ + Returns the elements in the list that come before the specified cursor. + """ + before: String + + """ + Returns the first _n_ elements from the list. + """ + first: Int + + """ + Returns the last _n_ elements from the list. + """ + last: Int + ): RepositoryConnection! + + """ + A URL pointing to the user's public website/blog. + """ + websiteUrl: URI +} + +""" +The possible durations that a user can be blocked for. +""" +enum UserBlockDuration { + """ + The user was blocked for 1 day + """ + ONE_DAY + + """ + The user was blocked for 3 days + """ + THREE_DAYS + + """ + The user was blocked for 7 days + """ + ONE_WEEK + + """ + The user was blocked for 30 days + """ + ONE_MONTH + + """ + The user was blocked permanently + """ + PERMANENT +} + +""" +Represents a 'user_blocked' event on a given user. +""" +type UserBlockedEvent implements Node { + """ + Identifies the actor who performed the event. + """ + actor: Actor + + """ + Number of days that the user was blocked for. + """ + blockDuration: UserBlockDuration! + + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + id: ID! + + """ + The user who was blocked. + """ + subject: User +} + +""" +The connection type for User. +""" +type UserConnection { + """ + A list of edges. + """ + edges: [UserEdge] + + """ + A list of nodes. + """ + nodes: [User] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edit on user content +""" +type UserContentEdit implements Node { + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + Identifies the date and time when the object was deleted. + """ + deletedAt: DateTime + + """ + The actor who deleted this content + """ + deletedBy: Actor + + """ + A summary of the changes for this edit + """ + diff: String + + """ + When this content was edited + """ + editedAt: DateTime! + + """ + The actor who edited this content + """ + editor: Actor + id: ID! + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! +} + +""" +A list of edits to content. +""" +type UserContentEditConnection { + """ + A list of edges. + """ + edges: [UserContentEditEdge] + + """ + A list of nodes. + """ + nodes: [UserContentEdit] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type UserContentEditEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: UserContentEdit +} + +""" +Represents a user. +""" +type UserEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: User +} + +""" +The user's description of what they're currently doing. +""" +type UserStatus implements Node { + """ + Identifies the date and time when the object was created. + """ + createdAt: DateTime! + + """ + An emoji summarizing the user's status. + """ + emoji: String + + """ + ID of the object. + """ + id: ID! + + """ + Whether this status indicates the user is not fully available on GitHub. + """ + indicatesLimitedAvailability: Boolean! + + """ + A brief message describing what the user is doing. + """ + message: String + + """ + The organization whose members can see this status. If null, this status is publicly visible. + """ + organization: Organization + + """ + Identifies the date and time when the object was last updated. + """ + updatedAt: DateTime! + + """ + The user who has this status. + """ + user: User! +} + +""" +The connection type for UserStatus. +""" +type UserStatusConnection { + """ + A list of edges. + """ + edges: [UserStatusEdge] + + """ + A list of nodes. + """ + nodes: [UserStatus] + + """ + Information to aid in pagination. + """ + pageInfo: PageInfo! + + """ + Identifies the total count of items in the connection. + """ + totalCount: Int! +} + +""" +An edge in a connection. +""" +type UserStatusEdge { + """ + A cursor for use in pagination. + """ + cursor: String! + + """ + The item at the end of the edge. + """ + node: UserStatus +} + +""" +Ordering options for user status connections. +""" +input UserStatusOrder { + """ + The field to order user statuses by. + """ + field: UserStatusOrderField! + + """ + The ordering direction. + """ + direction: OrderDirection! +} + +""" +Properties by which user status connections can be ordered. +""" +enum UserStatusOrderField { + """ + Order user statuses by when they were updated. + """ + UPDATED_AT +} + +""" +A valid x509 certificate string +""" +scalar X509Certificate diff --git a/benchmark/github-schema.json b/benchmark/github-schema.json new file mode 100644 index 00000000..7352a87f --- /dev/null +++ b/benchmark/github-schema.json @@ -0,0 +1,56836 @@ +{ + "data": { + "__schema": { + "queryType": { + "name": "Query" + }, + "mutationType": { + "name": "Mutation" + }, + "subscriptionType": null, + "types": [ + { + "kind": "SCALAR", + "name": "Boolean", + "description": "Represents `true` or `false` values.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "String", + "description": "Represents textual data as UTF-8 character sequences. This type is most often used by GraphQL to represent free-form human-readable text.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Query", + "description": "The query root of GitHub's GraphQL interface.", + "fields": [ + { + "name": "codeOfConduct", + "description": "Look up a code of conduct by its key", + "args": [ + { + "name": "key", + "description": "The code of conduct's key", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "CodeOfConduct", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "codesOfConduct", + "description": "Look up a code of conduct by its key", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CodeOfConduct", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "license", + "description": "Look up an open source license by its key", + "args": [ + { + "name": "key", + "description": "The license's downcased SPDX ID", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "License", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "licenses", + "description": "Return a list of known open source licenses", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "License", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "marketplaceCategories", + "description": "Get alphabetically sorted list of Marketplace categories", + "args": [ + { + "name": "includeCategories", + "description": "Return only the specified categories.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "excludeEmpty", + "description": "Exclude categories with no listings.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "excludeSubcategories", + "description": "Returns top level categories only, excluding any subcategories.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MarketplaceCategory", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "marketplaceCategory", + "description": "Look up a Marketplace category by its slug.", + "args": [ + { + "name": "slug", + "description": "The URL slug of the category.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "useTopicAliases", + "description": "Also check topic aliases for the category slug", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "MarketplaceCategory", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "marketplaceListing", + "description": "Look up a single Marketplace listing", + "args": [ + { + "name": "slug", + "description": "Select the listing that matches this slug. It's the short name of the listing used in its URL.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "MarketplaceListing", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "marketplaceListings", + "description": "Look up Marketplace listings", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "categorySlug", + "description": "Select only listings with the given category.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "useTopicAliases", + "description": "Also check topic aliases for the category slug", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "viewerCanAdmin", + "description": "Select listings to which user has admin access. If omitted, listings visible to the\nviewer are returned.\n", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "adminId", + "description": "Select listings that can be administered by the specified user.", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "organizationId", + "description": "Select listings for products owned by the specified organization.", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "allStates", + "description": "Select listings visible to the viewer even if they are not approved. If omitted or\nfalse, only approved listings will be returned.\n", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "slugs", + "description": "Select the listings with these slugs, if they are visible to the viewer.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "primaryCategoryOnly", + "description": "Select only listings where the primary category matches the given category slug.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "withFreeTrialsOnly", + "description": "Select only listings that offer a free trial.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MarketplaceListingConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "meta", + "description": "Return information about the GitHub instance", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "GitHubMetadata", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "Fetches an object given its ID.", + "args": [ + { + "name": "id", + "description": "ID of the object.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "Lookup nodes by a list of IDs.", + "args": [ + { + "name": "ids", + "description": "The list of node IDs.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organization", + "description": "Lookup a organization by login.", + "args": [ + { + "name": "login", + "description": "The organization's login.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rateLimit", + "description": "The client's rate limit information.", + "args": [ + { + "name": "dryRun", + "description": "If true, calculate the cost for the query without evaluating it", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "OBJECT", + "name": "RateLimit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "relay", + "description": "Hack to workaround https://github.com/facebook/relay/issues/112 re-exposing the root query object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Query", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "Lookup a given repository by the owner and repository name.", + "args": [ + { + "name": "owner", + "description": "The login field of a user or organization", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "name", + "description": "The name of the repository", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repositoryOwner", + "description": "Lookup a repository owner (ie. either a User or an Organization) by login.", + "args": [ + { + "name": "login", + "description": "The username to lookup the owner by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "INTERFACE", + "name": "RepositoryOwner", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resource", + "description": "Lookup resource by a URL.", + "args": [ + { + "name": "url", + "description": "The URL.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "search", + "description": "Perform a search across resources.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "query", + "description": "The search string to look for.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "type", + "description": "The types of search items to search within.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "SearchType", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SearchResultItemConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "securityAdvisories", + "description": "GitHub Security Advisories", + "args": [ + { + "name": "orderBy", + "description": "Ordering options for the returned topics.", + "type": { + "kind": "INPUT_OBJECT", + "name": "SecurityAdvisoryOrder", + "ofType": null + }, + "defaultValue": "{field:\"UPDATED_AT\",direction:\"DESC\"}" + }, + { + "name": "identifier", + "description": "Filter advisories by identifier, e.g. GHSA or CVE.", + "type": { + "kind": "INPUT_OBJECT", + "name": "SecurityAdvisoryIdentifierFilter", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "publishedSince", + "description": "Filter advisories to those published since a time in the past.", + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "updatedSince", + "description": "Filter advisories to those updated since a time in the past.", + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SecurityAdvisoryConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "securityAdvisory", + "description": "Fetch a Security Advisory by its GHSA ID", + "args": [ + { + "name": "ghsaId", + "description": "GitHub Security Advisory ID.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "SecurityAdvisory", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "securityVulnerabilities", + "description": "Software Vulnerabilities documented by GitHub Security Advisories", + "args": [ + { + "name": "orderBy", + "description": "Ordering options for the returned topics.", + "type": { + "kind": "INPUT_OBJECT", + "name": "SecurityVulnerabilityOrder", + "ofType": null + }, + "defaultValue": "{field:\"UPDATED_AT\",direction:\"DESC\"}" + }, + { + "name": "ecosystem", + "description": "An ecosystem to filter vulnerabilities by.", + "type": { + "kind": "ENUM", + "name": "SecurityAdvisoryEcosystem", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "package", + "description": "A package name to filter vulnerabilities by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "severities", + "description": "A list of severities to filter vulnerabilities by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "SecurityAdvisorySeverity", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SecurityVulnerabilityConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "topic", + "description": "Look up a topic by name.", + "args": [ + { + "name": "name", + "description": "The topic's name.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Topic", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "Lookup a user by login.", + "args": [ + { + "name": "login", + "description": "The user's login.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewer", + "description": "The currently authenticated user.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "Node", + "description": "An object with an ID.", + "fields": [ + { + "name": "id", + "description": "ID of the object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "AddedToProjectEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "App", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "AssignedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "BaseRefChangedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "BaseRefForcePushedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Blob", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Bot", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "BranchProtectionRule", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ClosedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CodeOfConduct", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CommentDeletedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CommitComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CommitCommentThread", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ConvertedNoteToIssueEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CrossReferencedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DemilestonedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DeployKey", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DeployedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Deployment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DeploymentEnvironmentChangedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DeploymentStatus", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ExternalIdentity", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Gist", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "GistComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "HeadRefDeletedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "HeadRefForcePushedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "HeadRefRestoredEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Label", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "LabeledEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Language", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "License", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "LockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Mannequin", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MarketplaceCategory", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MarketplaceListing", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MentionedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MergedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Milestone", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MilestonedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MovedColumnsInProjectEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "OrganizationIdentityProvider", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "OrganizationInvitation", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PinnedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ProjectCard", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ProjectColumn", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PublicKey", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestCommit", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestCommitCommentThread", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewThread", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PushAllowance", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Reaction", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReferencedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Release", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReleaseAsset", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RemovedFromProjectEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RenamedTitleEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReopenedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RepositoryInvitation", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RepositoryTopic", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReviewDismissalAllowance", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReviewDismissedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReviewRequest", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReviewRequestRemovedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReviewRequestedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "SecurityAdvisory", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Status", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "StatusContext", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "SubscribedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Tag", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Team", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Topic", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "TransferredEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Tree", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnassignedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnlabeledEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnlockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnpinnedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnsubscribedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UserBlockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UserContentEdit", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UserStatus", + "ofType": null + } + ] + }, + { + "kind": "SCALAR", + "name": "ID", + "description": "Represents a unique identifier that is Base64 obfuscated. It is often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"VXNlci0xMA==\"`) or integer (such as `4`) input value will be accepted as an ID.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "description": "Represents a type that can be retrieved by a URL.", + "fields": [ + { + "name": "resourcePath", + "description": "The HTML path to this resource.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The URL to this resource.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Bot", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ClosedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CrossReferencedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Mannequin", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MergedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Milestone", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestCommit", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Release", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RepositoryTopic", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReviewDismissedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + ] + }, + { + "kind": "SCALAR", + "name": "URI", + "description": "An RFC 3986, RFC 3987, and RFC 6570 (level 4) compliant URI string.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "User", + "description": "A user is an individual's account on GitHub that owns repositories and can make new content.", + "fields": [ + { + "name": "anyPinnableItems", + "description": "Determine if this repository owner has any items that can be pinned to their profile.", + "args": [ + { + "name": "type", + "description": "Filter to only a particular kind of pinnable item.", + "type": { + "kind": "ENUM", + "name": "PinnableItemType", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "avatarUrl", + "description": "A URL pointing to the user's public avatar.", + "args": [ + { + "name": "size", + "description": "The size of the resulting square image.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bio", + "description": "The user's public profile bio.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bioHTML", + "description": "The user's public profile bio as HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitComments", + "description": "A list of commit comments made by this user.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommitCommentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "company", + "description": "The user's public profile company.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "companyHTML", + "description": "The user's public profile company as HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "contributionsCollection", + "description": "The collection of contributions this user has made to different repositories.", + "args": [ + { + "name": "organizationID", + "description": "The ID of the organization used to filter contributions.", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "from", + "description": "Only contributions made at this time or later will be counted. If omitted, defaults to a year ago.", + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "to", + "description": "Only contributions made before and up to and including this time will be counted. If omitted, defaults to the current time.", + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ContributionsCollection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "email", + "description": "The user's publicly visible profile email.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "followers", + "description": "A list of users the given user is followed by.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "FollowerConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "following", + "description": "A list of users the given user is following.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "FollowingConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "gist", + "description": "Find gist by repo name.", + "args": [ + { + "name": "name", + "description": "The gist name to find.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Gist", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "gistComments", + "description": "A list of gist comments made by this user.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "GistCommentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "gists", + "description": "A list of the Gists the user has created.", + "args": [ + { + "name": "privacy", + "description": "Filters Gists according to privacy.", + "type": { + "kind": "ENUM", + "name": "GistPrivacy", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for gists returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "GistOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "GistConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isBountyHunter", + "description": "Whether or not this user is a participant in the GitHub Security Bug Bounty.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isCampusExpert", + "description": "Whether or not this user is a participant in the GitHub Campus Experts Program.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeveloperProgramMember", + "description": "Whether or not this user is a GitHub Developer Program member.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isEmployee", + "description": "Whether or not this user is a GitHub employee.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isHireable", + "description": "Whether or not the user has marked themselves as for hire.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isSiteAdmin", + "description": "Whether or not this user is a site administrator.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isViewer", + "description": "Whether or not this user is the viewing user.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issueComments", + "description": "A list of issue comments made by this user.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueCommentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issues", + "description": "A list of issues associated with this user.", + "args": [ + { + "name": "orderBy", + "description": "Ordering options for issues returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "labels", + "description": "A list of label names to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "states", + "description": "A list of states to filter the issues by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "IssueState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "filterBy", + "description": "Filtering options for issues returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueFilters", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "itemShowcase", + "description": "Showcases a selection of repositories and gists that the profile owner has either curated or that have been selected automatically based on popularity.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProfileItemShowcase", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "location", + "description": "The user's public profile location.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "login", + "description": "The username used to login.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The user's public profile name.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organization", + "description": "Find an organization by its login that the user belongs to.", + "args": [ + { + "name": "login", + "description": "The login of the organization to find.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organizations", + "description": "A list of organizations the user belongs to.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "OrganizationConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnableItems", + "description": "A list of repositories and gists this profile owner can pin to their profile.", + "args": [ + { + "name": "types", + "description": "Filter the types of pinnable items that are returned.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PinnableItemType", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PinnableItemConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnedItems", + "description": "A list of repositories and gists this profile owner has pinned to their profile", + "args": [ + { + "name": "types", + "description": "Filter the types of pinned items that are returned.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PinnableItemType", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PinnableItemConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnedItemsRemaining", + "description": "Returns how many more items this profile owner can pin to their profile.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnedRepositories", + "description": "A list of repositories this user has pinned to their profile", + "args": [ + { + "name": "privacy", + "description": "If non-null, filters repositories according to privacy", + "type": { + "kind": "ENUM", + "name": "RepositoryPrivacy", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for repositories returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "RepositoryOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "affiliations", + "description": "Array of viewer's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the current viewer owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "ownerAffiliations", + "description": "Array of owner's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the organization or user being viewed owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "isLocked", + "description": "If non-null, filters repositories according to whether they have been locked", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryConnection", + "ofType": null + } + }, + "isDeprecated": true, + "deprecationReason": "pinnedRepositories will be removed Use ProfileOwner.pinnedItems instead. Removal on 2019-07-01 UTC." + }, + { + "name": "project", + "description": "Find project by number.", + "args": [ + { + "name": "number", + "description": "The project number to find.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projects", + "description": "A list of projects under the owner.", + "args": [ + { + "name": "orderBy", + "description": "Ordering options for projects returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "ProjectOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "search", + "description": "Query to search projects by, currently only searching by name.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "states", + "description": "A list of states to filter the projects by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProjectState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectsResourcePath", + "description": "The HTTP path listing user's projects", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectsUrl", + "description": "The HTTP URL listing user's projects", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "publicKeys", + "description": "A list of public keys associated with this user.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PublicKeyConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequests", + "description": "A list of pull requests associated with this user.", + "args": [ + { + "name": "states", + "description": "A list of states to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "labels", + "description": "A list of label names to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "headRefName", + "description": "The head ref name to filter the pull requests by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "baseRefName", + "description": "The base ref name to filter the pull requests by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for pull requests returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repositories", + "description": "A list of repositories that the user owns.", + "args": [ + { + "name": "privacy", + "description": "If non-null, filters repositories according to privacy", + "type": { + "kind": "ENUM", + "name": "RepositoryPrivacy", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for repositories returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "RepositoryOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "affiliations", + "description": "Array of viewer's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the current viewer owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "ownerAffiliations", + "description": "Array of owner's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the organization or user being viewed owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "isLocked", + "description": "If non-null, filters repositories according to whether they have been locked", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "isFork", + "description": "If non-null, filters repositories according to whether they are forks of another repository", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repositoriesContributedTo", + "description": "A list of repositories that the user recently contributed to.", + "args": [ + { + "name": "privacy", + "description": "If non-null, filters repositories according to privacy", + "type": { + "kind": "ENUM", + "name": "RepositoryPrivacy", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for repositories returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "RepositoryOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "isLocked", + "description": "If non-null, filters repositories according to whether they have been locked", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "includeUserRepositories", + "description": "If true, include user repositories", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "contributionTypes", + "description": "If non-null, include only the specified types of contributions. The GitHub.com UI uses [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryContributionType", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "Find Repository.", + "args": [ + { + "name": "name", + "description": "Name of Repository to find.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this user", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "starredRepositories", + "description": "Repositories the user has starred.", + "args": [ + { + "name": "ownedByViewer", + "description": "Filters starred repositories to only return repositories owned by the viewer.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Order for connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "StarOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "StarredRepositoryConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status", + "description": "The user's description of what they're currently doing.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "UserStatus", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this user", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanChangePinnedItems", + "description": "Can the viewer pin repositories and gists to the profile?", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanCreateProjects", + "description": "Can the current viewer create new projects on this owner.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanFollow", + "description": "Whether or not the viewer is able to follow the user.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerIsFollowing", + "description": "Whether or not this user is followed by the viewer.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "watching", + "description": "A list of repositories the given user is watching.", + "args": [ + { + "name": "privacy", + "description": "If non-null, filters repositories according to privacy", + "type": { + "kind": "ENUM", + "name": "RepositoryPrivacy", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for repositories returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "RepositoryOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "affiliations", + "description": "Affiliation options for repositories returned from the connection", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\", \"ORGANIZATION_MEMBER\"]" + }, + { + "name": "ownerAffiliations", + "description": "Array of owner's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the organization or user being viewed owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "isLocked", + "description": "If non-null, filters repositories according to whether they have been locked", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "websiteUrl", + "description": "A URL pointing to the user's public website/blog.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RegistryPackageOwner", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RegistryPackageSearch", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "ProjectOwner", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryOwner", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "ProfileOwner", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "Actor", + "description": "Represents an object which can take actions on GitHub. Typically a User or Bot.", + "fields": [ + { + "name": "avatarUrl", + "description": "A URL pointing to the actor's public avatar.", + "args": [ + { + "name": "size", + "description": "The size of the resulting square image.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "login", + "description": "The username of the actor.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this actor.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this actor.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Bot", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Mannequin", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + ] + }, + { + "kind": "SCALAR", + "name": "Int", + "description": "Represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PageInfo", + "description": "Information about pagination in a connection.", + "fields": [ + { + "name": "endCursor", + "description": "When paginating forwards, the cursor to continue.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasNextPage", + "description": "When paginating forwards, are there more items?", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasPreviousPage", + "description": "When paginating backwards, are there more items?", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "startCursor", + "description": "When paginating backwards, the cursor to continue.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "DateTime", + "description": "An ISO-8601 encoded UTC date string.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "RegistryPackageOwner", + "description": "Represents an owner of a registry package.", + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "Repository", + "description": "A repository contains the content for a project.", + "fields": [ + { + "name": "assignableUsers", + "description": "A list of users that can be assigned to issues in this repository.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "branchProtectionRules", + "description": "A list of branch protection rules for this repository.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "BranchProtectionRuleConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "codeOfConduct", + "description": "Returns the code of conduct for this repository", + "args": [], + "type": { + "kind": "OBJECT", + "name": "CodeOfConduct", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "collaborators", + "description": "A list of collaborators associated with the repository.", + "args": [ + { + "name": "affiliation", + "description": "Collaborators affiliation level with a repository.", + "type": { + "kind": "ENUM", + "name": "CollaboratorAffiliation", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "RepositoryCollaboratorConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitComments", + "description": "A list of commit comments associated with the repository.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommitCommentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "defaultBranchRef", + "description": "The Ref associated with the repository's default branch.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deployKeys", + "description": "A list of deploy keys that are on this repository.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DeployKeyConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deployments", + "description": "Deployments associated with the repository", + "args": [ + { + "name": "environments", + "description": "Environments to list deployments for", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for deployments returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "DeploymentOrder", + "ofType": null + }, + "defaultValue": "{field:\"CREATED_AT\",direction:\"ASC\"}" + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DeploymentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "The description of the repository.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "descriptionHTML", + "description": "The description of the repository rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "diskUsage", + "description": "The number of kilobytes this repository occupies on disk.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "forkCount", + "description": "Returns how many forks there are of this repository in the whole network.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "forks", + "description": "A list of direct forked repositories.", + "args": [ + { + "name": "privacy", + "description": "If non-null, filters repositories according to privacy", + "type": { + "kind": "ENUM", + "name": "RepositoryPrivacy", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for repositories returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "RepositoryOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "affiliations", + "description": "Array of viewer's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the current viewer owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "ownerAffiliations", + "description": "Array of owner's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the organization or user being viewed owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "isLocked", + "description": "If non-null, filters repositories according to whether they have been locked", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasIssuesEnabled", + "description": "Indicates if the repository has issues feature enabled.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasWikiEnabled", + "description": "Indicates if the repository has wiki feature enabled.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "homepageUrl", + "description": "The repository's URL.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isArchived", + "description": "Indicates if the repository is unmaintained.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDisabled", + "description": "Returns whether or not this repository disabled.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isFork", + "description": "Identifies if the repository is a fork.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isLocked", + "description": "Indicates if the repository has been locked or not.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isMirror", + "description": "Identifies if the repository is a mirror.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isPrivate", + "description": "Identifies if the repository is private.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issue", + "description": "Returns a single issue from the current repository by number.", + "args": [ + { + "name": "number", + "description": "The number for the issue to be returned.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issueOrPullRequest", + "description": "Returns a single issue-like object from the current repository by number.", + "args": [ + { + "name": "number", + "description": "The number for the issue to be returned.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "UNION", + "name": "IssueOrPullRequest", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issues", + "description": "A list of issues that have been opened in the repository.", + "args": [ + { + "name": "orderBy", + "description": "Ordering options for issues returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "labels", + "description": "A list of label names to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "states", + "description": "A list of states to filter the issues by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "IssueState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "filterBy", + "description": "Filtering options for issues returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueFilters", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "label", + "description": "Returns a single label by name", + "args": [ + { + "name": "name", + "description": "Label name", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Label", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "labels", + "description": "A list of labels associated with the repository.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "query", + "description": "If provided, searches labels by name and description.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "LabelConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "languages", + "description": "A list containing a breakdown of the language composition of the repository.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Order for connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "LanguageOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "LanguageConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "licenseInfo", + "description": "The license associated with the repository", + "args": [], + "type": { + "kind": "OBJECT", + "name": "License", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lockReason", + "description": "The reason the repository has been locked.", + "args": [], + "type": { + "kind": "ENUM", + "name": "RepositoryLockReason", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mentionableUsers", + "description": "A list of Users that can be mentioned in the context of the repository.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mergeCommitAllowed", + "description": "Whether or not PRs are merged with a merge commit on this repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "milestone", + "description": "Returns a single milestone from the current repository by number.", + "args": [ + { + "name": "number", + "description": "The number for the milestone to be returned.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Milestone", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "milestones", + "description": "A list of milestones associated with the repository.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "states", + "description": "Filter by the state of the milestones.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "MilestoneState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for milestones.", + "type": { + "kind": "INPUT_OBJECT", + "name": "MilestoneOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "MilestoneConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mirrorUrl", + "description": "The repository's original mirror URL.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The name of the repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nameWithOwner", + "description": "The repository's name with owner.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "object", + "description": "A Git object in the repository", + "args": [ + { + "name": "oid", + "description": "The Git object ID", + "type": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "expression", + "description": "A Git revision expression suitable for rev-parse", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "INTERFACE", + "name": "GitObject", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "owner", + "description": "The User owner of the repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "RepositoryOwner", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "parent", + "description": "The repository parent, if this is a fork.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "primaryLanguage", + "description": "The primary language of the repository's code.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Language", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "project", + "description": "Find project by number.", + "args": [ + { + "name": "number", + "description": "The project number to find.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projects", + "description": "A list of projects under the owner.", + "args": [ + { + "name": "orderBy", + "description": "Ordering options for projects returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "ProjectOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "search", + "description": "Query to search projects by, currently only searching by name.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "states", + "description": "A list of states to filter the projects by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProjectState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectsResourcePath", + "description": "The HTTP path listing the repository's projects", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectsUrl", + "description": "The HTTP URL listing the repository's projects", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "Returns a single pull request from the current repository by number.", + "args": [ + { + "name": "number", + "description": "The number for the pull request to be returned.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequests", + "description": "A list of pull requests that have been opened in the repository.", + "args": [ + { + "name": "states", + "description": "A list of states to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "labels", + "description": "A list of label names to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "headRefName", + "description": "The head ref name to filter the pull requests by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "baseRefName", + "description": "The base ref name to filter the pull requests by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for pull requests returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pushedAt", + "description": "Identifies when the repository was last pushed to.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "rebaseMergeAllowed", + "description": "Whether or not rebase-merging is enabled on this repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ref", + "description": "Fetch a given ref from the repository", + "args": [ + { + "name": "qualifiedName", + "description": "The ref to retrieve. Fully qualified matches are checked in order (`refs/heads/master`) before falling back onto checks for short name matches (`master`).", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "refs", + "description": "Fetch a list of refs from the repository", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "refPrefix", + "description": "A ref name prefix like `refs/heads/`, `refs/tags/`, etc.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "DEPRECATED: use orderBy. The ordering direction.", + "type": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for refs returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "RefOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "RefConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "release", + "description": "Lookup a single release given various criteria.", + "args": [ + { + "name": "tagName", + "description": "The name of the Tag the Release was created from", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Release", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "releases", + "description": "List of releases which are dependent on this repository.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Order for connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "ReleaseOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReleaseConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repositoryTopics", + "description": "A list of applied repository-topic associations for this repository.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryTopicConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this repository", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "shortDescriptionHTML", + "description": "A description of the repository, rendered to HTML without any links in it.", + "args": [ + { + "name": "limit", + "description": "How many characters to return.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "200" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "squashMergeAllowed", + "description": "Whether or not squash-merging is enabled on this repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "sshUrl", + "description": "The SSH URL to clone this repository", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "GitSSHRemote", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "stargazers", + "description": "A list of users who have starred this starrable.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Order for connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "StarOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "StargazerConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this repository", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanAdminister", + "description": "Indicates whether the viewer has admin permissions on this repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanCreateProjects", + "description": "Can the current viewer create new projects on this owner.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanSubscribe", + "description": "Check if the viewer is able to change their subscription status for the repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanUpdateTopics", + "description": "Indicates whether the viewer can update the topics of this repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerHasStarred", + "description": "Returns a boolean indicating whether the viewing user has starred this starrable.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerPermission", + "description": "The users permission level on the repository. Will return null if authenticated as an GitHub App.", + "args": [], + "type": { + "kind": "ENUM", + "name": "RepositoryPermission", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerSubscription", + "description": "Identifies if the viewer is watching, not watching, or ignoring the subscribable entity.", + "args": [], + "type": { + "kind": "ENUM", + "name": "SubscriptionState", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "watchers", + "description": "A list of users watching the repository.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "ProjectOwner", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RegistryPackageOwner", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Subscribable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Starrable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryInfo", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "ProjectOwner", + "description": "Represents an owner of a Project.", + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "project", + "description": "Find project by number.", + "args": [ + { + "name": "number", + "description": "The project number to find.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projects", + "description": "A list of projects under the owner.", + "args": [ + { + "name": "orderBy", + "description": "Ordering options for projects returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "ProjectOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "search", + "description": "Query to search projects by, currently only searching by name.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "states", + "description": "A list of states to filter the projects by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProjectState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectsResourcePath", + "description": "The HTTP path listing owners projects", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectsUrl", + "description": "The HTTP URL listing owners projects", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanCreateProjects", + "description": "Can the current viewer create new projects on this owner.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "Project", + "description": "Projects manage issues, pull requests and notes within a project owner.", + "fields": [ + { + "name": "body", + "description": "The project's description body.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyHTML", + "description": "The projects description body rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closed", + "description": "`true` if the object is closed (definition of closed may depend on type)", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closedAt", + "description": "Identifies the date and time when the object was closed.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "columns", + "description": "List of columns in the project", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectColumnConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "creator", + "description": "The actor who originally created the project.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The project's name.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "number", + "description": "The project's number.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "owner", + "description": "The project's owner. Currently limited to repositories, organizations, and users.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "ProjectOwner", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pendingCards", + "description": "List of pending cards in this project", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "archivedStates", + "description": "A list of archived states to filter the cards by", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProjectCardArchivedState", + "ofType": null + } + }, + "defaultValue": "[\"ARCHIVED\", \"NOT_ARCHIVED\"]" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectCardConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this project", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "Whether the project is open or closed.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProjectState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this project", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanUpdate", + "description": "Check if the current viewer can update this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Closable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Updatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "Closable", + "description": "An object that can be closed", + "fields": [ + { + "name": "closed", + "description": "`true` if the object is closed (definition of closed may depend on type)", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closedAt", + "description": "Identifies the date and time when the object was closed.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Milestone", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + ] + }, + { + "kind": "INTERFACE", + "name": "Updatable", + "description": "Entities that can be updated.", + "fields": [ + { + "name": "viewerCanUpdate", + "description": "Check if the current viewer can update this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "CommitComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "GistComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + } + ] + }, + { + "kind": "ENUM", + "name": "ProjectState", + "description": "State of the project; either 'open' or 'closed'", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "OPEN", + "description": "The project is open.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CLOSED", + "description": "The project is closed.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "HTML", + "description": "A string containing HTML code.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProjectColumnConnection", + "description": "The connection type for ProjectColumn.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectColumnEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectColumn", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProjectColumnEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectColumn", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProjectColumn", + "description": "A column inside a project.", + "fields": [ + { + "name": "cards", + "description": "List of cards in the column", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "archivedStates", + "description": "A list of archived states to filter the cards by", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProjectCardArchivedState", + "ofType": null + } + }, + "defaultValue": "[\"ARCHIVED\", \"NOT_ARCHIVED\"]" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectCardConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The project column's name.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "project", + "description": "The project that contains this column.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "purpose", + "description": "The semantic purpose of the column", + "args": [], + "type": { + "kind": "ENUM", + "name": "ProjectColumnPurpose", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this project column", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this project column", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ProjectColumnPurpose", + "description": "The semantic purpose of the column - todo, in progress, or done.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "TODO", + "description": "The column contains cards still to be worked on", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "IN_PROGRESS", + "description": "The column contains cards which are currently being worked on", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "DONE", + "description": "The column contains cards which are complete", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProjectCardConnection", + "description": "The connection type for ProjectCard.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectCardEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectCard", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProjectCardEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectCard", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProjectCard", + "description": "A card in a project.", + "fields": [ + { + "name": "column", + "description": "The project column this card is associated under. A card may only belong to one\nproject column at a time. The column field will be null if the card is created\nin a pending state and has yet to be associated with a column. Once cards are\nassociated with a column, they will not become pending in the future.\n", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectColumn", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "content", + "description": "The card content item", + "args": [], + "type": { + "kind": "UNION", + "name": "ProjectCardItem", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "creator", + "description": "The actor who created this card", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isArchived", + "description": "Whether the card is archived", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "note", + "description": "The card note", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "project", + "description": "The project that contains this card.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this card", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "The state of ProjectCard", + "args": [], + "type": { + "kind": "ENUM", + "name": "ProjectCardState", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this card", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ProjectCardState", + "description": "Various content states of a ProjectCard", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "CONTENT_ONLY", + "description": "The card has content only.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NOTE_ONLY", + "description": "The card has a note only.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REDACTED", + "description": "The card is redacted.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "ProjectCardItem", + "description": "Types that can be inside Project Cards.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "Issue", + "description": "An Issue is a place to discuss ideas, enhancements, tasks, and bugs for a project.", + "fields": [ + { + "name": "activeLockReason", + "description": "Reason that the conversation was locked.", + "args": [], + "type": { + "kind": "ENUM", + "name": "LockReason", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "assignees", + "description": "A list of Users assigned to this object.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "author", + "description": "The actor who authored the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authorAssociation", + "description": "Author's association with the subject of the comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentAuthorAssociation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "body", + "description": "Identifies the body of the issue.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyHTML", + "description": "Identifies the body of the issue rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyText", + "description": "Identifies the body of the issue rendered to text.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closed", + "description": "`true` if the object is closed (definition of closed may depend on type)", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closedAt", + "description": "Identifies the date and time when the object was closed.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "comments", + "description": "A list of comments associated with the Issue.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueCommentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdViaEmail", + "description": "Check if this comment was created via an email reply.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "editor", + "description": "The actor who edited the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "includesCreatedEdit", + "description": "Check if this comment was edited and includes an edit with the creation data", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "labels", + "description": "A list of labels associated with the object.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "LabelConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastEditedAt", + "description": "The moment the editor made the last edit", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "locked", + "description": "`true` if the object is locked", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "milestone", + "description": "Identifies the milestone associated with the issue.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Milestone", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "number", + "description": "Identifies the issue number.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "participants", + "description": "A list of Users that are participating in the Issue conversation.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectCards", + "description": "List of project cards associated with this issue.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "archivedStates", + "description": "A list of archived states to filter the cards by", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProjectCardArchivedState", + "ofType": null + } + }, + "defaultValue": "[\"ARCHIVED\", \"NOT_ARCHIVED\"]" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectCardConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "publishedAt", + "description": "Identifies when the comment was published at.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactionGroups", + "description": "A list of reactions grouped by content left on the subject.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionGroup", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactions", + "description": "A list of Reactions left on the Issue.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "content", + "description": "Allows filtering Reactions by emoji.", + "type": { + "kind": "ENUM", + "name": "ReactionContent", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Allows specifying the order in which reactions are returned.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ReactionOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository associated with this node.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this issue", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "Identifies the state of the issue.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "IssueState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timeline", + "description": "A list of events, comments, commits, etc. associated with the issue.", + "args": [ + { + "name": "since", + "description": "Allows filtering timeline events by a `since` timestamp.", + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueTimelineConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timelineItems", + "description": "A list of events, comments, commits, etc. associated with the issue.", + "args": [ + { + "name": "since", + "description": "Filter timeline items by a `since` timestamp.", + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "skip", + "description": "Skips the first _n_ elements in the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "itemTypes", + "description": "Filter timeline items by type.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "IssueTimelineItemsItemType", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueTimelineItemsConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "title", + "description": "Identifies the issue title.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this issue", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userContentEdits", + "description": "A list of edits to this content.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UserContentEditConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanReact", + "description": "Can user react to this subject", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanSubscribe", + "description": "Check if the viewer is able to change their subscription status for the repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanUpdate", + "description": "Check if the current viewer can update this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCannotUpdateReasons", + "description": "Reasons why the current viewer can not update this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentCannotUpdateReason", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerDidAuthor", + "description": "Did the viewer author this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerSubscription", + "description": "Identifies if the viewer is watching, not watching, or ignoring the subscribable entity.", + "args": [], + "type": { + "kind": "ENUM", + "name": "SubscriptionState", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Assignable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Closable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Comment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Updatable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UpdatableComment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Labelable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Lockable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Reactable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryNode", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Subscribable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "Assignable", + "description": "An object that can have users assigned to it.", + "fields": [ + { + "name": "assignees", + "description": "A list of Users assigned to this object.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "UserConnection", + "description": "The connection type for User.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UserEdge", + "description": "Represents a user.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "Comment", + "description": "Represents a comment.", + "fields": [ + { + "name": "author", + "description": "The actor who authored the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authorAssociation", + "description": "Author's association with the subject of the comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentAuthorAssociation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "body", + "description": "The body as Markdown.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyHTML", + "description": "The body rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyText", + "description": "The body rendered to text.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdViaEmail", + "description": "Check if this comment was created via an email reply.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "editor", + "description": "The actor who edited the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "includesCreatedEdit", + "description": "Check if this comment was edited and includes an edit with the creation data", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastEditedAt", + "description": "The moment the editor made the last edit", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "publishedAt", + "description": "Identifies when the comment was published at.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userContentEdits", + "description": "A list of edits to this content.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UserContentEditConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerDidAuthor", + "description": "Did the viewer author this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "CommitComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "GistComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "UserContentEditConnection", + "description": "A list of edits to content.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserContentEditEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserContentEdit", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UserContentEditEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "UserContentEdit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UserContentEdit", + "description": "An edit on user content", + "fields": [ + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deletedAt", + "description": "Identifies the date and time when the object was deleted.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deletedBy", + "description": "The actor who deleted this content", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "diff", + "description": "A summary of the changes for this edit", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "editedAt", + "description": "When this content was edited", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "editor", + "description": "The actor who edited this content", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "CommentAuthorAssociation", + "description": "A comment author association with repository.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "MEMBER", + "description": "Author is a member of the organization that owns the repository.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OWNER", + "description": "Author is the owner of the repository.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "COLLABORATOR", + "description": "Author has been invited to collaborate on the repository.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CONTRIBUTOR", + "description": "Author has previously committed to the repository.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIRST_TIME_CONTRIBUTOR", + "description": "Author has not previously committed to the repository.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIRST_TIMER", + "description": "Author has not previously committed to GitHub.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NONE", + "description": "Author has no association with the repository.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "UpdatableComment", + "description": "Comments that can be updated.", + "fields": [ + { + "name": "viewerCannotUpdateReasons", + "description": "Reasons why the current viewer can not update this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentCannotUpdateReason", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "CommitComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "GistComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + } + ] + }, + { + "kind": "ENUM", + "name": "CommentCannotUpdateReason", + "description": "The possible errors that will prevent a user from updating a comment.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "INSUFFICIENT_ACCESS", + "description": "You must be the author or have write access to this repository to update this comment.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LOCKED", + "description": "Unable to create comment because issue is locked.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LOGIN_REQUIRED", + "description": "You must be logged in to update this comment.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MAINTENANCE", + "description": "Repository is under maintenance.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "VERIFIED_EMAIL_REQUIRED", + "description": "At least one email address must be verified to update this comment.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "DENIED", + "description": "You cannot update this comment", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "Labelable", + "description": "An object that can have labels assigned to it.", + "fields": [ + { + "name": "labels", + "description": "A list of labels associated with the object.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "LabelConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "LabelConnection", + "description": "The connection type for Label.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "LabelEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Label", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "LabelEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Label", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Label", + "description": "A label for categorizing Issues or Milestones with a given Repository.", + "fields": [ + { + "name": "color", + "description": "Identifies the label color.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the label was created.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "A brief description of this label.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDefault", + "description": "Indicates whether or not this is a default label.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issues", + "description": "A list of issues associated with this label.", + "args": [ + { + "name": "orderBy", + "description": "Ordering options for issues returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "labels", + "description": "A list of label names to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "states", + "description": "A list of states to filter the issues by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "IssueState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "filterBy", + "description": "Filtering options for issues returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueFilters", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "Identifies the label name.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequests", + "description": "A list of pull requests associated with this label.", + "args": [ + { + "name": "states", + "description": "A list of states to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "labels", + "description": "A list of label names to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "headRefName", + "description": "The head ref name to filter the pull requests by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "baseRefName", + "description": "The base ref name to filter the pull requests by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for pull requests returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository associated with this label.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this label.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the label was last updated.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this label.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "IssueConnection", + "description": "The connection type for Issue.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "IssueEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "IssueOrder", + "description": "Ways in which lists of issues can be ordered upon return.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field in which to order issues by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "IssueOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The direction in which to order issues by the specified field.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "IssueOrderField", + "description": "Properties by which issue connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "CREATED_AT", + "description": "Order issues by creation time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UPDATED_AT", + "description": "Order issues by update time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "COMMENTS", + "description": "Order issues by comment count", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "OrderDirection", + "description": "Possible directions in which to order a list of items when provided an `orderBy` argument.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "ASC", + "description": "Specifies an ascending order for a given `orderBy` argument.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "DESC", + "description": "Specifies a descending order for a given `orderBy` argument.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "IssueState", + "description": "The possible states of an issue.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "OPEN", + "description": "An issue that is still open", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CLOSED", + "description": "An issue that has been closed", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "IssueFilters", + "description": "Ways in which to filter lists of issues.", + "fields": null, + "inputFields": [ + { + "name": "assignee", + "description": "List issues assigned to given name. Pass in `null` for issues with no assigned user, and `*` for issues assigned to any user.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "createdBy", + "description": "List issues created by given name.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "labels", + "description": "List issues where the list of label names exist on the issue.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "mentioned", + "description": "List issues where the given name is mentioned in the issue.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "milestone", + "description": "List issues by given milestone argument. If an string representation of an integer is passed, it should refer to a milestone by its number field. Pass in `null` for issues with no milestone, and `*` for issues that are assigned to any milestone.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "since", + "description": "List issues that have been updated at or after the given date.", + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "states", + "description": "List issues filtered by the list of states given.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "IssueState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "viewerSubscribed", + "description": "List issues subscribed to by viewer.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestConnection", + "description": "The connection type for PullRequest.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "description": "A repository pull request.", + "fields": [ + { + "name": "activeLockReason", + "description": "Reason that the conversation was locked.", + "args": [], + "type": { + "kind": "ENUM", + "name": "LockReason", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "additions", + "description": "The number of additions in this pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "assignees", + "description": "A list of Users assigned to this object.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "author", + "description": "The actor who authored the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authorAssociation", + "description": "Author's association with the subject of the comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentAuthorAssociation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "baseRef", + "description": "Identifies the base Ref associated with the pull request.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "baseRefName", + "description": "Identifies the name of the base Ref associated with the pull request, even if the ref has been deleted.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "baseRefOid", + "description": "Identifies the oid of the base ref associated with the pull request, even if the ref has been deleted.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "baseRepository", + "description": "The repository associated with this pull request's base Ref.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "body", + "description": "The body as Markdown.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyHTML", + "description": "The body rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyText", + "description": "The body rendered to text.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "changedFiles", + "description": "The number of changed files in this pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closed", + "description": "`true` if the pull request is closed", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closedAt", + "description": "Identifies the date and time when the object was closed.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "comments", + "description": "A list of comments associated with the pull request.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueCommentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commits", + "description": "A list of commits present in this pull request's head branch not present in the base branch.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestCommitConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdViaEmail", + "description": "Check if this comment was created via an email reply.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deletions", + "description": "The number of deletions in this pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "editor", + "description": "The actor who edited this pull request's body.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "files", + "description": "Lists the files changed within this pull request.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "PullRequestChangedFileConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "headRef", + "description": "Identifies the head Ref associated with the pull request.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "headRefName", + "description": "Identifies the name of the head Ref associated with the pull request, even if the ref has been deleted.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "headRefOid", + "description": "Identifies the oid of the head ref associated with the pull request, even if the ref has been deleted.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "headRepository", + "description": "The repository associated with this pull request's head Ref.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "headRepositoryOwner", + "description": "The owner of the repository associated with this pull request's head Ref.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "RepositoryOwner", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "includesCreatedEdit", + "description": "Check if this comment was edited and includes an edit with the creation data", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isCrossRepository", + "description": "The head and base repositories are different.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "labels", + "description": "A list of labels associated with the object.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "LabelConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastEditedAt", + "description": "The moment the editor made the last edit", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "locked", + "description": "`true` if the pull request is locked", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "maintainerCanModify", + "description": "Indicates whether maintainers can modify the pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mergeCommit", + "description": "The commit that was created when this pull request was merged.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mergeable", + "description": "Whether or not the pull request can be merged based on the existence of merge conflicts.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "MergeableState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "merged", + "description": "Whether or not the pull request was merged.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mergedAt", + "description": "The date and time that the pull request was merged.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mergedBy", + "description": "The actor who merged the pull request.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "milestone", + "description": "Identifies the milestone associated with the pull request.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Milestone", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "number", + "description": "Identifies the pull request number.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "participants", + "description": "A list of Users that are participating in the Pull Request conversation.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "permalink", + "description": "The permalink to the pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "potentialMergeCommit", + "description": "The commit that GitHub automatically generated to test if this pull request could be merged. This field will not return a value if the pull request is merged, or if the test merge commit is still being generated. See the `mergeable` field for more details on the mergeability of the pull request.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectCards", + "description": "List of project cards associated with this pull request.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "archivedStates", + "description": "A list of archived states to filter the cards by", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProjectCardArchivedState", + "ofType": null + } + }, + "defaultValue": "[\"ARCHIVED\", \"NOT_ARCHIVED\"]" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectCardConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "publishedAt", + "description": "Identifies when the comment was published at.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactionGroups", + "description": "A list of reactions grouped by content left on the subject.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionGroup", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactions", + "description": "A list of Reactions left on the Issue.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "content", + "description": "Allows filtering Reactions by emoji.", + "type": { + "kind": "ENUM", + "name": "ReactionContent", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Allows specifying the order in which reactions are returned.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ReactionOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository associated with this node.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "revertResourcePath", + "description": "The HTTP path for reverting this pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "revertUrl", + "description": "The HTTP URL for reverting this pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reviewRequests", + "description": "A list of review requests associated with the pull request.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "ReviewRequestConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reviewThreads", + "description": "The list of all review threads for this pull request.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestReviewThreadConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reviews", + "description": "A list of reviews associated with the pull request.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "states", + "description": "A list of states to filter the reviews.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestReviewState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "author", + "description": "Filter by author of the review.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "PullRequestReviewConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "Identifies the state of the pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "suggestedReviewers", + "description": "A list of reviewer suggestions based on commit history and past review comments.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SuggestedReviewer", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timeline", + "description": "A list of events, comments, commits, etc. associated with the pull request.", + "args": [ + { + "name": "since", + "description": "Allows filtering timeline events by a `since` timestamp.", + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestTimelineConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timelineItems", + "description": "A list of events, comments, commits, etc. associated with the pull request.", + "args": [ + { + "name": "since", + "description": "Filter timeline items by a `since` timestamp.", + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "skip", + "description": "Skips the first _n_ elements in the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "itemTypes", + "description": "Filter timeline items by type.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestTimelineItemsItemType", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestTimelineItemsConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "title", + "description": "Identifies the pull request title.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userContentEdits", + "description": "A list of edits to this content.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UserContentEditConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanApplySuggestion", + "description": "Whether or not the viewer can apply suggestion.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanReact", + "description": "Can user react to this subject", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanSubscribe", + "description": "Check if the viewer is able to change their subscription status for the repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanUpdate", + "description": "Check if the current viewer can update this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCannotUpdateReasons", + "description": "Reasons why the current viewer can not update this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentCannotUpdateReason", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerDidAuthor", + "description": "Did the viewer author this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerSubscription", + "description": "Identifies if the viewer is watching, not watching, or ignoring the subscribable entity.", + "args": [], + "type": { + "kind": "ENUM", + "name": "SubscriptionState", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Assignable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Closable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Comment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Updatable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UpdatableComment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Labelable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Lockable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Reactable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryNode", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Subscribable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "Lockable", + "description": "An object that can be locked.", + "fields": [ + { + "name": "activeLockReason", + "description": "Reason that the conversation was locked.", + "args": [], + "type": { + "kind": "ENUM", + "name": "LockReason", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "locked", + "description": "`true` if the object is locked", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + ] + }, + { + "kind": "ENUM", + "name": "LockReason", + "description": "The possible reasons that an issue or pull request was locked.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "OFF_TOPIC", + "description": "The issue or pull request was locked because the conversation was off-topic.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "TOO_HEATED", + "description": "The issue or pull request was locked because the conversation was too heated.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "RESOLVED", + "description": "The issue or pull request was locked because the conversation was resolved.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SPAM", + "description": "The issue or pull request was locked because the conversation was spam.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "App", + "description": "A GitHub App.", + "fields": [ + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "The description of the app.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "logoBackgroundColor", + "description": "The hex color code, without the leading '#', for the logo background.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "logoUrl", + "description": "A URL pointing to the app's logo.", + "args": [ + { + "name": "size", + "description": "The size of the resulting image.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The name of the app.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "slug", + "description": "A slug based on the name of the app for use in URLs.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The URL to the app's homepage.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MarketplaceListing", + "description": "A listing in the GitHub integration marketplace.", + "fields": [ + { + "name": "app", + "description": "The GitHub App this listing represents.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "App", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "companyUrl", + "description": "URL to the listing owner's company site.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "configurationResourcePath", + "description": "The HTTP path for configuring access to the listing's integration or OAuth app", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "configurationUrl", + "description": "The HTTP URL for configuring access to the listing's integration or OAuth app", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "documentationUrl", + "description": "URL to the listing's documentation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "extendedDescription", + "description": "The listing's detailed description.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "extendedDescriptionHTML", + "description": "The listing's detailed description rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fullDescription", + "description": "The listing's introductory description.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fullDescriptionHTML", + "description": "The listing's introductory description rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasApprovalBeenRequested", + "description": "Whether this listing has been submitted for review from GitHub for approval to be displayed in the Marketplace.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": true, + "deprecationReason": "`hasApprovalBeenRequested` will be removed. Use `isVerificationPendingFromDraft` instead. Removal on 2019-10-01 UTC." + }, + { + "name": "hasPublishedFreeTrialPlans", + "description": "Does this listing have any plans with a free trial?", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasTermsOfService", + "description": "Does this listing have a terms of service link?", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "howItWorks", + "description": "A technical description of how this app works with GitHub.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "howItWorksHTML", + "description": "The listing's technical description rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "installationUrl", + "description": "URL to install the product to the viewer's account or organization.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "installedForViewer", + "description": "Whether this listing's app has been installed for the current viewer", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isApproved", + "description": "Whether this listing has been approved for display in the Marketplace.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": true, + "deprecationReason": "`isApproved` will be removed. Use `isPublic` instead. Removal on 2019-10-01 UTC." + }, + { + "name": "isArchived", + "description": "Whether this listing has been removed from the Marketplace.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDelisted", + "description": "Whether this listing has been removed from the Marketplace.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": true, + "deprecationReason": "`isDelisted` will be removed. Use `isArchived` instead. Removal on 2019-10-01 UTC." + }, + { + "name": "isDraft", + "description": "Whether this listing is still an editable draft that has not been submitted for review and is not publicly visible in the Marketplace.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isPaid", + "description": "Whether the product this listing represents is available as part of a paid plan.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isPublic", + "description": "Whether this listing has been approved for display in the Marketplace.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isRejected", + "description": "Whether this listing has been rejected by GitHub for display in the Marketplace.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isUnverified", + "description": "Whether this listing has been approved for unverified display in the Marketplace.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isUnverifiedPending", + "description": "Whether this draft listing has been submitted for review for approval to be unverified in the Marketplace.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isVerificationPendingFromDraft", + "description": "Whether this draft listing has been submitted for review from GitHub for approval to be verified in the Marketplace.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isVerificationPendingFromUnverified", + "description": "Whether this unverified listing has been submitted for review from GitHub for approval to be verified in the Marketplace.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isVerified", + "description": "Whether this listing has been approved for verified display in the Marketplace.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "logoBackgroundColor", + "description": "The hex color code, without the leading '#', for the logo background.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "logoUrl", + "description": "URL for the listing's logo image.", + "args": [ + { + "name": "size", + "description": "The size in pixels of the resulting square image.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "400" + } + ], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The listing's full name.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "normalizedShortDescription", + "description": "The listing's very short description without a trailing period or ampersands.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pricingUrl", + "description": "URL to the listing's detailed pricing.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "primaryCategory", + "description": "The category that best describes the listing.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MarketplaceCategory", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "privacyPolicyUrl", + "description": "URL to the listing's privacy policy, may return an empty string for listings that do not require a privacy policy URL.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for the Marketplace listing.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "screenshotUrls", + "description": "The URLs for the listing's screenshots.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "secondaryCategory", + "description": "An alternate category that describes the listing.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "MarketplaceCategory", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "shortDescription", + "description": "The listing's very short description.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "slug", + "description": "The short name of the listing used in its URL.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "statusUrl", + "description": "URL to the listing's status page.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "supportEmail", + "description": "An email address for support for this listing's app.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "supportUrl", + "description": "Either a URL or an email address for support for this listing's app, may return an empty string for listings that do not require a support URL.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "termsOfServiceUrl", + "description": "URL to the listing's terms of service.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for the Marketplace listing.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanAddPlans", + "description": "Can the current viewer add plans for this Marketplace listing.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanApprove", + "description": "Can the current viewer approve this Marketplace listing.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanDelist", + "description": "Can the current viewer delist this Marketplace listing.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanEdit", + "description": "Can the current viewer edit this Marketplace listing.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanEditCategories", + "description": "Can the current viewer edit the primary and secondary category of this\nMarketplace listing.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanEditPlans", + "description": "Can the current viewer edit the plans for this Marketplace listing.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanRedraft", + "description": "Can the current viewer return this Marketplace listing to draft state\nso it becomes editable again.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanReject", + "description": "Can the current viewer reject this Marketplace listing by returning it to\nan editable draft state or rejecting it entirely.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanRequestApproval", + "description": "Can the current viewer request this listing be reviewed for display in\nthe Marketplace as verified.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerHasPurchased", + "description": "Indicates whether the current user has an active subscription to this Marketplace listing.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerHasPurchasedForAllOrganizations", + "description": "Indicates if the current user has purchased a subscription to this Marketplace listing\nfor all of the organizations the user owns.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerIsListingAdmin", + "description": "Does the current viewer role allow them to administer this Marketplace listing.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Organization", + "description": "An account on GitHub, with one or more owners, that has repositories, members and teams.", + "fields": [ + { + "name": "anyPinnableItems", + "description": "Determine if this repository owner has any items that can be pinned to their profile.", + "args": [ + { + "name": "type", + "description": "Filter to only a particular kind of pinnable item.", + "type": { + "kind": "ENUM", + "name": "PinnableItemType", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "avatarUrl", + "description": "A URL pointing to the organization's public avatar.", + "args": [ + { + "name": "size", + "description": "The size of the resulting square image.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "The organization's public profile description.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "email", + "description": "The organization's public email.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isVerified", + "description": "Whether the organization has verified its profile email and website.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "itemShowcase", + "description": "Showcases a selection of repositories and gists that the profile owner has either curated or that have been selected automatically based on popularity.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProfileItemShowcase", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "location", + "description": "The organization's public profile location.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "login", + "description": "The organization's login name.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "memberStatuses", + "description": "Get the status messages members of this entity have set that are either public or visible only to the organization.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for user statuses returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "UserStatusOrder", + "ofType": null + }, + "defaultValue": "{field:\"UPDATED_AT\",direction:\"DESC\"}" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserStatusConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "membersWithRole", + "description": "A list of users who are members of this organization.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "OrganizationMemberConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The organization's public profile name.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "newTeamResourcePath", + "description": "The HTTP path creating a new team", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "newTeamUrl", + "description": "The HTTP URL creating a new team", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organizationBillingEmail", + "description": "The billing email for the organization.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pendingMembers", + "description": "A list of users who have been invited to join this organization.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnableItems", + "description": "A list of repositories and gists this profile owner can pin to their profile.", + "args": [ + { + "name": "types", + "description": "Filter the types of pinnable items that are returned.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PinnableItemType", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PinnableItemConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnedItems", + "description": "A list of repositories and gists this profile owner has pinned to their profile", + "args": [ + { + "name": "types", + "description": "Filter the types of pinned items that are returned.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PinnableItemType", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PinnableItemConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnedItemsRemaining", + "description": "Returns how many more items this profile owner can pin to their profile.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnedRepositories", + "description": "A list of repositories this user has pinned to their profile", + "args": [ + { + "name": "privacy", + "description": "If non-null, filters repositories according to privacy", + "type": { + "kind": "ENUM", + "name": "RepositoryPrivacy", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for repositories returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "RepositoryOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "affiliations", + "description": "Array of viewer's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the current viewer owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "ownerAffiliations", + "description": "Array of owner's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the organization or user being viewed owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "isLocked", + "description": "If non-null, filters repositories according to whether they have been locked", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryConnection", + "ofType": null + } + }, + "isDeprecated": true, + "deprecationReason": "pinnedRepositories will be removed Use ProfileOwner.pinnedItems instead. Removal on 2019-07-01 UTC." + }, + { + "name": "project", + "description": "Find project by number.", + "args": [ + { + "name": "number", + "description": "The project number to find.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projects", + "description": "A list of projects under the owner.", + "args": [ + { + "name": "orderBy", + "description": "Ordering options for projects returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "ProjectOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "search", + "description": "Query to search projects by, currently only searching by name.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "states", + "description": "A list of states to filter the projects by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProjectState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectsResourcePath", + "description": "The HTTP path listing organization's projects", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectsUrl", + "description": "The HTTP URL listing organization's projects", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repositories", + "description": "A list of repositories that the user owns.", + "args": [ + { + "name": "privacy", + "description": "If non-null, filters repositories according to privacy", + "type": { + "kind": "ENUM", + "name": "RepositoryPrivacy", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for repositories returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "RepositoryOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "affiliations", + "description": "Array of viewer's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the current viewer owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "ownerAffiliations", + "description": "Array of owner's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the organization or user being viewed owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "isLocked", + "description": "If non-null, filters repositories according to whether they have been locked", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "isFork", + "description": "If non-null, filters repositories according to whether they are forks of another repository", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "Find Repository.", + "args": [ + { + "name": "name", + "description": "Name of Repository to find.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requiresTwoFactorAuthentication", + "description": "When true the organization requires all members, billing managers, and outside collaborators to enable two-factor authentication.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this organization.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "samlIdentityProvider", + "description": "The Organization's SAML identity providers", + "args": [], + "type": { + "kind": "OBJECT", + "name": "OrganizationIdentityProvider", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "team", + "description": "Find an organization's team by its slug.", + "args": [ + { + "name": "slug", + "description": "The name or slug of the team to find.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Team", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "teams", + "description": "A list of teams in this organization.", + "args": [ + { + "name": "privacy", + "description": "If non-null, filters teams according to privacy", + "type": { + "kind": "ENUM", + "name": "TeamPrivacy", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "role", + "description": "If non-null, filters teams according to whether the viewer is an admin or member on team", + "type": { + "kind": "ENUM", + "name": "TeamRole", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "query", + "description": "If non-null, filters teams with query on team name and team slug", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "userLogins", + "description": "User logins to filter by", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for teams returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "TeamOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "ldapMapped", + "description": "If true, filters teams that are mapped to an LDAP Group (Enterprise only)", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "rootTeamsOnly", + "description": "If true, restrict to only root teams", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TeamConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "teamsResourcePath", + "description": "The HTTP path listing organization's teams", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "teamsUrl", + "description": "The HTTP URL listing organization's teams", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this organization.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanAdminister", + "description": "Organization is adminable by the viewer.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanChangePinnedItems", + "description": "Can the viewer pin repositories and gists to the profile?", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanCreateProjects", + "description": "Can the current viewer create new projects on this owner.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanCreateRepositories", + "description": "Viewer can create repositories on this organization", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanCreateTeams", + "description": "Viewer can create teams on this organization.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerIsAMember", + "description": "Viewer is an active member of this organization.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "websiteUrl", + "description": "The organization's public profile URL.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RegistryPackageOwner", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RegistryPackageSearch", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "ProjectOwner", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryOwner", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "MemberStatusable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "ProfileOwner", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "RegistryPackageSearch", + "description": "Represents an interface to search packages on an object.", + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + ] + }, + { + "kind": "INTERFACE", + "name": "RepositoryOwner", + "description": "Represents an owner of a Repository.", + "fields": [ + { + "name": "avatarUrl", + "description": "A URL pointing to the owner's public avatar.", + "args": [ + { + "name": "size", + "description": "The size of the resulting square image.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "login", + "description": "The username used to login.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnedRepositories", + "description": "A list of repositories this user has pinned to their profile", + "args": [ + { + "name": "privacy", + "description": "If non-null, filters repositories according to privacy", + "type": { + "kind": "ENUM", + "name": "RepositoryPrivacy", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for repositories returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "RepositoryOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "affiliations", + "description": "Array of viewer's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the current viewer owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "ownerAffiliations", + "description": "Array of owner's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the organization or user being viewed owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "isLocked", + "description": "If non-null, filters repositories according to whether they have been locked", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryConnection", + "ofType": null + } + }, + "isDeprecated": true, + "deprecationReason": "pinnedRepositories will be removed Use ProfileOwner.pinnedItems instead. Removal on 2019-07-01 UTC." + }, + { + "name": "repositories", + "description": "A list of repositories that the user owns.", + "args": [ + { + "name": "privacy", + "description": "If non-null, filters repositories according to privacy", + "type": { + "kind": "ENUM", + "name": "RepositoryPrivacy", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for repositories returned from the connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "RepositoryOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "affiliations", + "description": "Array of viewer's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the current viewer owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "ownerAffiliations", + "description": "Array of owner's affiliation options for repositories returned from the connection. For example, OWNER will include only repositories that the organization or user being viewed owns.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "ofType": null + } + }, + "defaultValue": "[\"OWNER\", \"COLLABORATOR\"]" + }, + { + "name": "isLocked", + "description": "If non-null, filters repositories according to whether they have been locked", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "isFork", + "description": "If non-null, filters repositories according to whether they are forks of another repository", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "Find Repository.", + "args": [ + { + "name": "name", + "description": "Name of Repository to find.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP URL for the owner.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for the owner.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "RepositoryConnection", + "description": "A list of repositories owned by the subject.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalDiskUsage", + "description": "The total size in kilobytes of all repositories in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RepositoryEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "RepositoryPrivacy", + "description": "The privacy of a repository", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "PUBLIC", + "description": "Public", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PRIVATE", + "description": "Private", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "RepositoryOrder", + "description": "Ordering options for repository connections", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field to order repositories by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The ordering direction.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "RepositoryOrderField", + "description": "Properties by which repository connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "CREATED_AT", + "description": "Order repositories by creation time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UPDATED_AT", + "description": "Order repositories by update time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PUSHED_AT", + "description": "Order repositories by push time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NAME", + "description": "Order repositories by name", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "STARGAZERS", + "description": "Order repositories by number of stargazers", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "RepositoryAffiliation", + "description": "The affiliation of a user to a repository", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "OWNER", + "description": "Repositories that are owned by the authenticated user.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "COLLABORATOR", + "description": "Repositories that the user has been added to as a collaborator.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ORGANIZATION_MEMBER", + "description": "Repositories that the user has access to through being a member of an organization. This includes every repository on every team that the user is on.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Float", + "description": "Represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "MemberStatusable", + "description": "Entities that have members who can set status messages.", + "fields": [ + { + "name": "memberStatuses", + "description": "Get the status messages members of this entity have set that are either public or visible only to the organization.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for user statuses returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "UserStatusOrder", + "ofType": null + }, + "defaultValue": "{field:\"UPDATED_AT\",direction:\"DESC\"}" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserStatusConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Team", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "UserStatusConnection", + "description": "The connection type for UserStatus.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserStatusEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserStatus", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UserStatusEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "UserStatus", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UserStatus", + "description": "The user's description of what they're currently doing.", + "fields": [ + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "emoji", + "description": "An emoji summarizing the user's status.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": "ID of the object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "indicatesLimitedAvailability", + "description": "Whether this status indicates the user is not fully available on GitHub.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message", + "description": "A brief message describing what the user is doing.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organization", + "description": "The organization whose members can see this status. If null, this status is publicly visible.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "The user who has this status.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UserStatusOrder", + "description": "Ordering options for user status connections.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field to order user statuses by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "UserStatusOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The ordering direction.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "UserStatusOrderField", + "description": "Properties by which user status connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "UPDATED_AT", + "description": "Order user statuses by when they were updated.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "ProfileOwner", + "description": "Represents any entity on GitHub that has a profile page.", + "fields": [ + { + "name": "anyPinnableItems", + "description": "Determine if this repository owner has any items that can be pinned to their profile.", + "args": [ + { + "name": "type", + "description": "Filter to only a particular kind of pinnable item.", + "type": { + "kind": "ENUM", + "name": "PinnableItemType", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "email", + "description": "The public profile email.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "itemShowcase", + "description": "Showcases a selection of repositories and gists that the profile owner has either curated or that have been selected automatically based on popularity.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProfileItemShowcase", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "location", + "description": "The public profile location.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "login", + "description": "The username used to login.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The public profile name.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnableItems", + "description": "A list of repositories and gists this profile owner can pin to their profile.", + "args": [ + { + "name": "types", + "description": "Filter the types of pinnable items that are returned.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PinnableItemType", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PinnableItemConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnedItems", + "description": "A list of repositories and gists this profile owner has pinned to their profile", + "args": [ + { + "name": "types", + "description": "Filter the types of pinned items that are returned.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PinnableItemType", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PinnableItemConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pinnedItemsRemaining", + "description": "Returns how many more items this profile owner can pin to their profile.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanChangePinnedItems", + "description": "Can the viewer pin repositories and gists to the profile?", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "websiteUrl", + "description": "The public profile website URL.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "ProfileItemShowcase", + "description": "A curatable list of repositories relating to a repository owner, which defaults to showing the most popular repositories they own.", + "fields": [ + { + "name": "hasPinnedItems", + "description": "Whether or not the owner has pinned any repositories or gists.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "items", + "description": "The repositories and gists in the showcase. If the profile owner has any pinned items, those will be returned. Otherwise, the profile owner's popular repositories will be returned.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PinnableItemConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PinnableItemConnection", + "description": "The connection type for PinnableItem.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PinnableItemEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "UNION", + "name": "PinnableItem", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PinnableItemEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "UNION", + "name": "PinnableItem", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "PinnableItem", + "description": "Types that can be pinned to a profile page.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Gist", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "Gist", + "description": "A Gist.", + "fields": [ + { + "name": "comments", + "description": "A list of comments associated with the gist", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "GistCommentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "The gist description.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "files", + "description": "The files in this gist.", + "args": [ + { + "name": "limit", + "description": "The maximum number of files to return.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "10" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "GistFile", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isFork", + "description": "Identifies if the gist is a fork.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isPublic", + "description": "Whether the gist is public or not.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The gist name.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "owner", + "description": "The gist owner.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "RepositoryOwner", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pushedAt", + "description": "Identifies when the gist was last pushed to.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "stargazers", + "description": "A list of users who have starred this starrable.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Order for connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "StarOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "StargazerConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerHasStarred", + "description": "Returns a boolean indicating whether the viewing user has starred this starrable.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Starrable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "Starrable", + "description": "Things that can be starred.", + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "stargazers", + "description": "A list of users who have starred this starrable.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Order for connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "StarOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "StargazerConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerHasStarred", + "description": "Returns a boolean indicating whether the viewing user has starred this starrable.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Gist", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Topic", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "StargazerConnection", + "description": "The connection type for User.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "StargazerEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "StargazerEdge", + "description": "Represents a user that's starred a repository.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "starredAt", + "description": "Identifies when the item was starred.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "StarOrder", + "description": "Ways in which star connections can be ordered.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field in which to order nodes by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "StarOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The direction in which to order nodes.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "StarOrderField", + "description": "Properties by which star connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "STARRED_AT", + "description": "Allows ordering a list of stars by when they were created.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "GistCommentConnection", + "description": "The connection type for GistComment.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "GistCommentEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "GistComment", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "GistCommentEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "GistComment", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "GistComment", + "description": "Represents a comment on an Gist.", + "fields": [ + { + "name": "author", + "description": "The actor who authored the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authorAssociation", + "description": "Author's association with the gist.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentAuthorAssociation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "body", + "description": "Identifies the comment body.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyHTML", + "description": "The comment body rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyText", + "description": "The body rendered to text.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdViaEmail", + "description": "Check if this comment was created via an email reply.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "editor", + "description": "The actor who edited the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "gist", + "description": "The associated gist.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Gist", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "includesCreatedEdit", + "description": "Check if this comment was edited and includes an edit with the creation data", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isMinimized", + "description": "Returns whether or not a comment has been minimized.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastEditedAt", + "description": "The moment the editor made the last edit", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "minimizedReason", + "description": "Returns why the comment was minimized.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "publishedAt", + "description": "Identifies when the comment was published at.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userContentEdits", + "description": "A list of edits to this content.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UserContentEditConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanDelete", + "description": "Check if the current viewer can delete this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanMinimize", + "description": "Check if the current viewer can minimize this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanUpdate", + "description": "Check if the current viewer can update this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCannotUpdateReasons", + "description": "Reasons why the current viewer can not update this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentCannotUpdateReason", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerDidAuthor", + "description": "Did the viewer author this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Comment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Deletable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Updatable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UpdatableComment", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "Deletable", + "description": "Entities that can be deleted.", + "fields": [ + { + "name": "viewerCanDelete", + "description": "Check if the current viewer can delete this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "CommitComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "GistComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "GistFile", + "description": "A file in a gist.", + "fields": [ + { + "name": "encodedName", + "description": "The file name encoded to remove characters that are invalid in URL paths.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "encoding", + "description": "The gist file encoding.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "extension", + "description": "The file extension from the file name.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isImage", + "description": "Indicates if this file is an image.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isTruncated", + "description": "Whether the file's contents were truncated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "language", + "description": "The programming language this file is written in.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Language", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The gist file name.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "size", + "description": "The gist file size in bytes.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "text", + "description": "UTF8 text data or null if the file is binary", + "args": [ + { + "name": "truncate", + "description": "Optionally truncate the returned file to this length.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Language", + "description": "Represents a given language found in repositories.", + "fields": [ + { + "name": "color", + "description": "The color defined for the current language.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The name of the current language.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PinnableItemType", + "description": "Represents items that can be pinned to a profile page or dashboard.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "REPOSITORY", + "description": "A repository.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "GIST", + "description": "A gist.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ISSUE", + "description": "An issue.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProjectConnection", + "description": "A list of projects associated with the owner.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ProjectEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ProjectEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ProjectOrder", + "description": "Ways in which lists of projects can be ordered upon return.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field in which to order projects by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ProjectOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The direction in which to order projects by the specified field.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ProjectOrderField", + "description": "Properties by which project connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "CREATED_AT", + "description": "Order projects by creation time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UPDATED_AT", + "description": "Order projects by update time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NAME", + "description": "Order projects by name", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Bot", + "description": "A special type of user which takes actions on behalf of GitHub Apps.", + "fields": [ + { + "name": "avatarUrl", + "description": "A URL pointing to the GitHub App's public avatar.", + "args": [ + { + "name": "size", + "description": "The size of the resulting square image.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "login", + "description": "The username of the actor.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this bot", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this bot", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "IssueComment", + "description": "Represents a comment on an Issue.", + "fields": [ + { + "name": "author", + "description": "The actor who authored the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authorAssociation", + "description": "Author's association with the subject of the comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentAuthorAssociation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "body", + "description": "The body as Markdown.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyHTML", + "description": "The body rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyText", + "description": "The body rendered to text.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdViaEmail", + "description": "Check if this comment was created via an email reply.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "editor", + "description": "The actor who edited the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "includesCreatedEdit", + "description": "Check if this comment was edited and includes an edit with the creation data", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isMinimized", + "description": "Returns whether or not a comment has been minimized.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issue", + "description": "Identifies the issue associated with the comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastEditedAt", + "description": "The moment the editor made the last edit", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "minimizedReason", + "description": "Returns why the comment was minimized.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "publishedAt", + "description": "Identifies when the comment was published at.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "Returns the pull request associated with the comment, if this comment was made on a\npull request.\n", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactionGroups", + "description": "A list of reactions grouped by content left on the subject.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionGroup", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactions", + "description": "A list of Reactions left on the Issue.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "content", + "description": "Allows filtering Reactions by emoji.", + "type": { + "kind": "ENUM", + "name": "ReactionContent", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Allows specifying the order in which reactions are returned.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ReactionOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository associated with this node.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this issue comment", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this issue comment", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userContentEdits", + "description": "A list of edits to this content.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UserContentEditConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanDelete", + "description": "Check if the current viewer can delete this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanMinimize", + "description": "Check if the current viewer can minimize this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanReact", + "description": "Can user react to this subject", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanUpdate", + "description": "Check if the current viewer can update this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCannotUpdateReasons", + "description": "Reasons why the current viewer can not update this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentCannotUpdateReason", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerDidAuthor", + "description": "Did the viewer author this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Comment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Deletable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Updatable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UpdatableComment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Reactable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryNode", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "Reactable", + "description": "Represents a subject that can be reacted on.", + "fields": [ + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactionGroups", + "description": "A list of reactions grouped by content left on the subject.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionGroup", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactions", + "description": "A list of Reactions left on the Issue.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "content", + "description": "Allows filtering Reactions by emoji.", + "type": { + "kind": "ENUM", + "name": "ReactionContent", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Allows specifying the order in which reactions are returned.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ReactionOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanReact", + "description": "Can user react to this subject", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "CommitComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "ReactionGroup", + "description": "A group of emoji reactions to a particular piece of content.", + "fields": [ + { + "name": "content", + "description": "Identifies the emoji reaction.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ReactionContent", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies when the reaction was created.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subject", + "description": "The subject that was reacted to.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Reactable", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "users", + "description": "Users who have reacted to the reaction subject with the emotion represented by this reaction group", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactingUserConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerHasReacted", + "description": "Whether or not the authenticated user has left a reaction on the subject.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ReactionContent", + "description": "Emojis that can be attached to Issues, Pull Requests and Comments.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "THUMBS_UP", + "description": "Represents the 👍 emoji.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "THUMBS_DOWN", + "description": "Represents the 👎 emoji.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LAUGH", + "description": "Represents the 😄 emoji.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "HOORAY", + "description": "Represents the 🎉 emoji.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CONFUSED", + "description": "Represents the 😕 emoji.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "HEART", + "description": "Represents the ❤️ emoji.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ROCKET", + "description": "Represents the 🚀 emoji.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "EYES", + "description": "Represents the 👀 emoji.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReactingUserConnection", + "description": "The connection type for User.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactingUserEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReactingUserEdge", + "description": "Represents a user that's made a reaction.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactedAt", + "description": "The moment when the user made the reaction.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReactionConnection", + "description": "A list of reactions that have been left on the subject.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Reaction", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerHasReacted", + "description": "Whether or not the authenticated user has left a reaction on the subject.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReactionEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Reaction", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Reaction", + "description": "An emoji reaction to a particular piece of content.", + "fields": [ + { + "name": "content", + "description": "Identifies the emoji reaction.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ReactionContent", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactable", + "description": "The reactable piece of content", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Reactable", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "Identifies the user who created this reaction.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ReactionOrder", + "description": "Ways in which lists of reactions can be ordered upon return.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field in which to order reactions by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ReactionOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The direction in which to order reactions by the specified field.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ReactionOrderField", + "description": "A list of fields that reactions can be ordered by.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "CREATED_AT", + "description": "Allows ordering a list of reactions by when they were created.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryInfo", + "description": "A subset of repository info.", + "fields": [ + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "The description of the repository.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "descriptionHTML", + "description": "The description of the repository rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "forkCount", + "description": "Returns how many forks there are of this repository in the whole network.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasIssuesEnabled", + "description": "Indicates if the repository has issues feature enabled.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasWikiEnabled", + "description": "Indicates if the repository has wiki feature enabled.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "homepageUrl", + "description": "The repository's URL.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isArchived", + "description": "Indicates if the repository is unmaintained.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isFork", + "description": "Identifies if the repository is a fork.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isLocked", + "description": "Indicates if the repository has been locked or not.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isMirror", + "description": "Identifies if the repository is a mirror.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isPrivate", + "description": "Identifies if the repository is private.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "licenseInfo", + "description": "The license associated with the repository", + "args": [], + "type": { + "kind": "OBJECT", + "name": "License", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lockReason", + "description": "The reason the repository has been locked.", + "args": [], + "type": { + "kind": "ENUM", + "name": "RepositoryLockReason", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mirrorUrl", + "description": "The repository's original mirror URL.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The name of the repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nameWithOwner", + "description": "The repository's name with owner.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "owner", + "description": "The User owner of the repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "RepositoryOwner", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pushedAt", + "description": "Identifies when the repository was last pushed to.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this repository", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "shortDescriptionHTML", + "description": "A description of the repository, rendered to HTML without any links in it.", + "args": [ + { + "name": "limit", + "description": "How many characters to return.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "200" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this repository", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + ] + }, + { + "kind": "ENUM", + "name": "RepositoryLockReason", + "description": "The possible reasons a given repository could be in a locked state.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "MOVING", + "description": "The repository is locked due to a move.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "BILLING", + "description": "The repository is locked due to a billing related reason.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "RENAME", + "description": "The repository is locked due to a rename.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MIGRATING", + "description": "The repository is locked due to a migration.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "License", + "description": "A repository's open source license", + "fields": [ + { + "name": "body", + "description": "The full text of the license", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "conditions", + "description": "The conditions set by the license", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "LicenseRule", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "A human-readable description of the license", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "featured", + "description": "Whether the license should be featured", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hidden", + "description": "Whether the license should be displayed in license pickers", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "implementation", + "description": "Instructions on how to implement the license", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "key", + "description": "The lowercased SPDX ID of the license", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "limitations", + "description": "The limitations set by the license", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "LicenseRule", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The license full name specified by ", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nickname", + "description": "Customary short name if applicable (e.g, GPLv3)", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "permissions", + "description": "The permissions set by the license", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "LicenseRule", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pseudoLicense", + "description": "Whether the license is a pseudo-license placeholder (e.g., other, no-license)", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "spdxId", + "description": "Short identifier specified by ", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "URL to the license on ", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "LicenseRule", + "description": "Describes a License's conditions, permissions, and limitations", + "fields": [ + { + "name": "description", + "description": "A description of the rule", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "key", + "description": "The machine-readable rule key", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "label", + "description": "The human-readable rule label", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RepositoryTopicConnection", + "description": "The connection type for RepositoryTopic.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryTopicEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryTopic", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RepositoryTopicEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "RepositoryTopic", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RepositoryTopic", + "description": "A repository-topic connects a repository to a topic.", + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this repository-topic.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "topic", + "description": "The topic.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Topic", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this repository-topic.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Topic", + "description": "A topic aggregates entities that are related to a subject.", + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The topic's name.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "relatedTopics", + "description": "A list of related topics, including aliases of this topic, sorted with the most relevant\nfirst. Returns up to 10 Topics.\n", + "args": [ + { + "name": "first", + "description": "How many topics to return.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "3" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Topic", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "stargazers", + "description": "A list of users who have starred this starrable.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Order for connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "StarOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "StargazerConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerHasStarred", + "description": "Returns a boolean indicating whether the viewing user has starred this starrable.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Starrable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Release", + "description": "A release contains the content for a release.", + "fields": [ + { + "name": "author", + "description": "The author of the release", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "Identifies the description of the release.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDraft", + "description": "Whether or not the release is a draft", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isPrerelease", + "description": "Whether or not the release is a prerelease", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "Identifies the title of the release.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "publishedAt", + "description": "Identifies the date and time when the release was created.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "releaseAssets", + "description": "List of releases assets which are dependent on this release.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "name", + "description": "A list of names to filter the assets by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReleaseAssetConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this issue", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tag", + "description": "The Git tag the release points to", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tagName", + "description": "The name of the release's Git tag", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this issue", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Ref", + "description": "Represents a Git reference.", + "fields": [ + { + "name": "associatedPullRequests", + "description": "A list of pull requests with this ref as the head ref.", + "args": [ + { + "name": "states", + "description": "A list of states to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "labels", + "description": "A list of label names to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "headRefName", + "description": "The head ref name to filter the pull requests by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "baseRefName", + "description": "The base ref name to filter the pull requests by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for pull requests returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The ref name.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "prefix", + "description": "The ref's prefix, such as `refs/heads/` or `refs/tags/`.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository the ref belongs to.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "target", + "description": "The object the ref points to.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "GitObject", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "GitObject", + "description": "Represents a Git object.", + "fields": [ + { + "name": "abbreviatedOid", + "description": "An abbreviated version of the Git object ID", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitResourcePath", + "description": "The HTTP path for this Git object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitUrl", + "description": "The HTTP URL for this Git object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "oid", + "description": "The Git object ID", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The Repository the Git object belongs to", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Blob", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Tag", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Tree", + "ofType": null + } + ] + }, + { + "kind": "SCALAR", + "name": "GitObjectID", + "description": "A Git object ID.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryNode", + "description": "Represents a object that belongs to a repository.", + "fields": [ + { + "name": "repository", + "description": "The repository associated with this node.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "CommitComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CommitCommentThread", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestCommitCommentThread", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "Blob", + "description": "Represents a Git blob.", + "fields": [ + { + "name": "abbreviatedOid", + "description": "An abbreviated version of the Git object ID", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "byteSize", + "description": "Byte size of Blob object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitResourcePath", + "description": "The HTTP path for this Git object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitUrl", + "description": "The HTTP URL for this Git object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isBinary", + "description": "Indicates whether the Blob is binary or text", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isTruncated", + "description": "Indicates whether the contents is truncated", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "oid", + "description": "The Git object ID", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The Repository the Git object belongs to", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "text", + "description": "UTF8 text data or null if the Blob is binary", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "GitObject", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Commit", + "description": "Represents a Git commit.", + "fields": [ + { + "name": "abbreviatedOid", + "description": "An abbreviated version of the Git object ID", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "additions", + "description": "The number of additions in this commit.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "associatedPullRequests", + "description": "The pull requests associated with a commit", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for pull requests.", + "type": { + "kind": "INPUT_OBJECT", + "name": "PullRequestOrder", + "ofType": null + }, + "defaultValue": "{field:\"CREATED_AT\",direction:\"ASC\"}" + } + ], + "type": { + "kind": "OBJECT", + "name": "PullRequestConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "author", + "description": "Authorship details of the commit.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "GitActor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authoredByCommitter", + "description": "Check if the committer and the author match.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authoredDate", + "description": "The datetime when this commit was authored.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "blame", + "description": "Fetches `git blame` information.", + "args": [ + { + "name": "path", + "description": "The file whose Git blame information you want.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Blame", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "changedFiles", + "description": "The number of changed files in this commit.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "comments", + "description": "Comments made on the commit.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommitCommentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitResourcePath", + "description": "The HTTP path for this Git object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitUrl", + "description": "The HTTP URL for this Git object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "committedDate", + "description": "The datetime when this commit was committed.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "committedViaWeb", + "description": "Check if commited via GitHub web UI.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "committer", + "description": "Committership details of the commit.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "GitActor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deletions", + "description": "The number of deletions in this commit.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deployments", + "description": "The deployments associated with a commit.", + "args": [ + { + "name": "environments", + "description": "Environments to list deployments for", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for deployments returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "DeploymentOrder", + "ofType": null + }, + "defaultValue": "{field:\"CREATED_AT\",direction:\"ASC\"}" + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DeploymentConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "history", + "description": "The linear commit history starting from (and including) this commit, in the same order as `git log`.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "path", + "description": "If non-null, filters history to only show commits touching files under this path.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "author", + "description": "If non-null, filters history to only show commits with matching authorship.", + "type": { + "kind": "INPUT_OBJECT", + "name": "CommitAuthor", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "since", + "description": "Allows specifying a beginning time or date for fetching commits.", + "type": { + "kind": "SCALAR", + "name": "GitTimestamp", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "until", + "description": "Allows specifying an ending time or date for fetching commits.", + "type": { + "kind": "SCALAR", + "name": "GitTimestamp", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommitHistoryConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message", + "description": "The Git commit message", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "messageBody", + "description": "The Git commit message body", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "messageBodyHTML", + "description": "The commit message body rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "messageHeadline", + "description": "The Git commit message headline", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "messageHeadlineHTML", + "description": "The commit message headline rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "oid", + "description": "The Git object ID", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "parents", + "description": "The parents of a commit.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommitConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pushedDate", + "description": "The datetime when this commit was pushed.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The Repository this commit belongs to", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this commit", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signature", + "description": "Commit signing information, if present.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "GitSignature", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status", + "description": "Status information for this commit", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Status", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tarballUrl", + "description": "Returns a URL to download a tarball archive for a repository.\nNote: For private repositories, these links are temporary and expire after five minutes.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tree", + "description": "Commit's root Tree", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Tree", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "treeResourcePath", + "description": "The HTTP path for the tree of this commit", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "treeUrl", + "description": "The HTTP URL for the tree of this commit", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this commit", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanSubscribe", + "description": "Check if the viewer is able to change their subscription status for the repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerSubscription", + "description": "Identifies if the viewer is watching, not watching, or ignoring the subscribable entity.", + "args": [], + "type": { + "kind": "ENUM", + "name": "SubscriptionState", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "zipballUrl", + "description": "Returns a URL to download a zipball archive for a repository.\nNote: For private repositories, these links are temporary and expire after five minutes.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "GitObject", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Subscribable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "Subscribable", + "description": "Entities that can be subscribed to for web and email notifications.", + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanSubscribe", + "description": "Check if the viewer is able to change their subscription status for the repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerSubscription", + "description": "Identifies if the viewer is watching, not watching, or ignoring the subscribable entity.", + "args": [], + "type": { + "kind": "ENUM", + "name": "SubscriptionState", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Team", + "ofType": null + } + ] + }, + { + "kind": "ENUM", + "name": "SubscriptionState", + "description": "The possible states of a subscription.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "UNSUBSCRIBED", + "description": "The User is only notified when participating or @mentioned.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUBSCRIBED", + "description": "The User is notified of all conversations.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "IGNORED", + "description": "The User is never notified.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Tree", + "description": "Represents a Git tree.", + "fields": [ + { + "name": "abbreviatedOid", + "description": "An abbreviated version of the Git object ID", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitResourcePath", + "description": "The HTTP path for this Git object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitUrl", + "description": "The HTTP URL for this Git object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "entries", + "description": "A list of tree entries.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TreeEntry", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "oid", + "description": "The Git object ID", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The Repository the Git object belongs to", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "GitObject", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TreeEntry", + "description": "Represents a Git tree entry.", + "fields": [ + { + "name": "mode", + "description": "Entry file mode.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "Entry file name.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "object", + "description": "Entry file object.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "GitObject", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "oid", + "description": "Entry file Git object ID.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The Repository the tree entry belongs to", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": "Entry file type.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "GitActor", + "description": "Represents an actor in a Git commit (ie. an author or committer).", + "fields": [ + { + "name": "avatarUrl", + "description": "A URL pointing to the author's public avatar.", + "args": [ + { + "name": "size", + "description": "The size of the resulting square image.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "date", + "description": "The timestamp of the Git action (authoring or committing).", + "args": [], + "type": { + "kind": "SCALAR", + "name": "GitTimestamp", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "email", + "description": "The email in the Git commit.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The name in the Git commit.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "The GitHub user corresponding to the email field. Null if no such user exists.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "GitTimestamp", + "description": "An ISO-8601 encoded date string. Unlike the DateTime type, GitTimestamp is not converted in UTC.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CommitConnection", + "description": "The connection type for Commit.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommitEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CommitEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CommitHistoryConnection", + "description": "The connection type for Commit.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommitEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "CommitAuthor", + "description": "Specifies an author for filtering Git commits.", + "fields": null, + "inputFields": [ + { + "name": "id", + "description": "ID of a User to filter by. If non-null, only commits authored by this user will be returned. This field takes precedence over emails.", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "emails", + "description": "Email addresses to filter by. Commits authored by any of the specified email addresses will be returned.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CommitCommentConnection", + "description": "The connection type for CommitComment.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommitCommentEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommitComment", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CommitCommentEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "CommitComment", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CommitComment", + "description": "Represents a comment on a given Commit.", + "fields": [ + { + "name": "author", + "description": "The actor who authored the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authorAssociation", + "description": "Author's association with the subject of the comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentAuthorAssociation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "body", + "description": "Identifies the comment body.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyHTML", + "description": "Identifies the comment body rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyText", + "description": "The body rendered to text.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commit", + "description": "Identifies the commit associated with the comment, if the commit exists.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdViaEmail", + "description": "Check if this comment was created via an email reply.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "editor", + "description": "The actor who edited the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "includesCreatedEdit", + "description": "Check if this comment was edited and includes an edit with the creation data", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isMinimized", + "description": "Returns whether or not a comment has been minimized.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastEditedAt", + "description": "The moment the editor made the last edit", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "minimizedReason", + "description": "Returns why the comment was minimized.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "path", + "description": "Identifies the file path associated with the comment.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "position", + "description": "Identifies the line position associated with the comment.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "publishedAt", + "description": "Identifies when the comment was published at.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactionGroups", + "description": "A list of reactions grouped by content left on the subject.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionGroup", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactions", + "description": "A list of Reactions left on the Issue.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "content", + "description": "Allows filtering Reactions by emoji.", + "type": { + "kind": "ENUM", + "name": "ReactionContent", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Allows specifying the order in which reactions are returned.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ReactionOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository associated with this node.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path permalink for this commit comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL permalink for this commit comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userContentEdits", + "description": "A list of edits to this content.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UserContentEditConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanDelete", + "description": "Check if the current viewer can delete this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanMinimize", + "description": "Check if the current viewer can minimize this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanReact", + "description": "Can user react to this subject", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanUpdate", + "description": "Check if the current viewer can update this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCannotUpdateReasons", + "description": "Reasons why the current viewer can not update this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentCannotUpdateReason", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerDidAuthor", + "description": "Did the viewer author this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Comment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Deletable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Updatable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UpdatableComment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Reactable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryNode", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "GitSignature", + "description": "Information about a signature (GPG or S/MIME) on a Commit or Tag.", + "fields": [ + { + "name": "email", + "description": "Email used to sign this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isValid", + "description": "True if the signature is valid and verified by GitHub.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payload", + "description": "Payload for GPG signing object. Raw ODB object without the signature header.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signature", + "description": "ASCII-armored signature header from object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signer", + "description": "GitHub user corresponding to the email signing this commit.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "The state of this signature. `VALID` if signature is valid and verified by GitHub, otherwise represents reason why signature is considered invalid.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "GitSignatureState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "wasSignedByGitHub", + "description": "True if the signature was made with GitHub's signing key.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "GpgSignature", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "SmimeSignature", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnknownSignature", + "ofType": null + } + ] + }, + { + "kind": "ENUM", + "name": "GitSignatureState", + "description": "The state of a Git signature.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "VALID", + "description": "Valid signature and verified by GitHub", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INVALID", + "description": "Invalid signature", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MALFORMED_SIG", + "description": "Malformed signature", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNKNOWN_KEY", + "description": "Key used for signing not known to GitHub", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "BAD_EMAIL", + "description": "Invalid email used for signing", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNVERIFIED_EMAIL", + "description": "Email used for signing unverified on GitHub", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NO_USER", + "description": "Email used for signing not known to GitHub", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNKNOWN_SIG_TYPE", + "description": "Unknown signature type", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNSIGNED", + "description": "Unsigned", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "GPGVERIFY_UNAVAILABLE", + "description": "Internal error - the GPG verification service is unavailable at the moment", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "GPGVERIFY_ERROR", + "description": "Internal error - the GPG verification service misbehaved", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NOT_SIGNING_KEY", + "description": "The usage flags for the key that signed this don't allow signing", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "EXPIRED_KEY", + "description": "Signing key expired", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OCSP_PENDING", + "description": "Valid signature, pending certificate revocation checking", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OCSP_ERROR", + "description": "Valid siganture, though certificate revocation check failed", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "BAD_CERT", + "description": "The signing certificate or its chain could not be verified", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OCSP_REVOKED", + "description": "One or more certificates in chain has been revoked", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Status", + "description": "Represents a commit status.", + "fields": [ + { + "name": "commit", + "description": "The commit this status is attached to.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "context", + "description": "Looks up an individual status context by context name.", + "args": [ + { + "name": "name", + "description": "The context name.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "StatusContext", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "contexts", + "description": "The individual status contexts for this commit.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "StatusContext", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "The combined commit status.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "StatusState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "StatusState", + "description": "The possible commit status states.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "EXPECTED", + "description": "Status is expected.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ERROR", + "description": "Status is errored.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FAILURE", + "description": "Status is failing.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PENDING", + "description": "Status is pending.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUCCESS", + "description": "Status is successful.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "StatusContext", + "description": "Represents an individual commit status context", + "fields": [ + { + "name": "commit", + "description": "This commit this status context is attached to.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "context", + "description": "The name of this status context.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "creator", + "description": "The actor who created this status context.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "The description for this status context.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "The state of this status context.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "StatusState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "targetUrl", + "description": "The URL for this status context.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PullRequestState", + "description": "The possible states of a pull request.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "OPEN", + "description": "A pull request that is still open.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CLOSED", + "description": "A pull request that has been closed without being merged.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MERGED", + "description": "A pull request that has been closed by being merged.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Blame", + "description": "Represents a Git blame.", + "fields": [ + { + "name": "ranges", + "description": "The list of ranges from a Git blame.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "BlameRange", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "BlameRange", + "description": "Represents a range of information from a Git blame.", + "fields": [ + { + "name": "age", + "description": "Identifies the recency of the change, from 1 (new) to 10 (old). This is calculated as a 2-quantile and determines the length of distance between the median age of all the changes in the file and the recency of the current range's change.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commit", + "description": "Identifies the line author", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "endingLine", + "description": "The ending line for the range", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "startingLine", + "description": "The starting line for the range", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeploymentConnection", + "description": "The connection type for Deployment.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DeploymentEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Deployment", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeploymentEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Deployment", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Deployment", + "description": "Represents triggered deployment instance.", + "fields": [ + { + "name": "commit", + "description": "Identifies the commit sha of the deployment.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitOid", + "description": "Identifies the oid of the deployment commit, even if the commit has been deleted.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "creator", + "description": "Identifies the actor who triggered the deployment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "The deployment description.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "environment", + "description": "The environment to which this deployment was made.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "latestStatus", + "description": "The latest status of this deployment.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "DeploymentStatus", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payload", + "description": "Extra information that a deployment system might need.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ref", + "description": "Identifies the Ref of the deployment, if the deployment was created by ref.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "Identifies the repository associated with the deployment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "The current state of the deployment.", + "args": [], + "type": { + "kind": "ENUM", + "name": "DeploymentState", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "statuses", + "description": "A list of statuses associated with the deployment.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DeploymentStatusConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "task", + "description": "The deployment task.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeploymentStatusConnection", + "description": "The connection type for DeploymentStatus.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DeploymentStatusEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DeploymentStatus", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeploymentStatusEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "DeploymentStatus", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeploymentStatus", + "description": "Describes the status of a given deployment attempt.", + "fields": [ + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "creator", + "description": "Identifies the actor who triggered the deployment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deployment", + "description": "Identifies the deployment associated with status.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Deployment", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "Identifies the description of the deployment.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "environmentUrl", + "description": "Identifies the environment URL of the deployment.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "logUrl", + "description": "Identifies the log URL of the deployment.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "Identifies the current state of the deployment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "DeploymentStatusState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "DeploymentStatusState", + "description": "The possible states for a deployment status.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "PENDING", + "description": "The deployment is pending.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUCCESS", + "description": "The deployment was successful.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FAILURE", + "description": "The deployment has failed.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INACTIVE", + "description": "The deployment is inactive.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ERROR", + "description": "The deployment experienced an error.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "QUEUED", + "description": "The deployment is queued", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "IN_PROGRESS", + "description": "The deployment is in progress.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "DeploymentState", + "description": "The possible states in which a deployment can be.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "ABANDONED", + "description": "The pending deployment was not updated after 30 minutes.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ACTIVE", + "description": "The deployment is currently active.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "DESTROYED", + "description": "An inactive transient deployment.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ERROR", + "description": "The deployment experienced an error.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FAILURE", + "description": "The deployment has failed.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INACTIVE", + "description": "The deployment is inactive.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PENDING", + "description": "The deployment is pending.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "QUEUED", + "description": "The deployment has queued", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "IN_PROGRESS", + "description": "The deployment is in progress.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DeploymentOrder", + "description": "Ordering options for deployment connections", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field to order deployments by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "DeploymentOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The ordering direction.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "DeploymentOrderField", + "description": "Properties by which deployment connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "CREATED_AT", + "description": "Order collection by creation time", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "PullRequestOrder", + "description": "Ways in which lists of issues can be ordered upon return.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field in which to order pull requests by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The direction in which to order pull requests by the specified field.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PullRequestOrderField", + "description": "Properties by which pull_requests connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "CREATED_AT", + "description": "Order pull_requests by creation time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UPDATED_AT", + "description": "Order pull_requests by update time", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReleaseAssetConnection", + "description": "The connection type for ReleaseAsset.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReleaseAssetEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReleaseAsset", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReleaseAssetEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ReleaseAsset", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReleaseAsset", + "description": "A release asset contains the content for a release asset.", + "fields": [ + { + "name": "contentType", + "description": "The asset's content-type", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "downloadCount", + "description": "The number of times this asset was downloaded", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "downloadUrl", + "description": "Identifies the URL where you can download the release asset via the browser.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "Identifies the title of the release asset.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "release", + "description": "Release that the asset is associated with", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Release", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "size", + "description": "The size (in bytes) of the asset", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "uploadedBy", + "description": "The user that performed the upload", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "Identifies the URL of the release asset.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MarketplaceCategory", + "description": "A public description of a Marketplace category.", + "fields": [ + { + "name": "description", + "description": "The category's description.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "howItWorks", + "description": "The technical description of how apps listed in this category work with GitHub.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The category's name.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "primaryListingCount", + "description": "How many Marketplace listings have this as their primary category.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this Marketplace category.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "secondaryListingCount", + "description": "How many Marketplace listings have this as their secondary category.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "slug", + "description": "The short name of the category used in its URL.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this Marketplace category.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MarketplaceListingConnection", + "description": "Look up Marketplace Listings", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MarketplaceListingEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MarketplaceListing", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MarketplaceListingEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "MarketplaceListing", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReleaseConnection", + "description": "The connection type for Release.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReleaseEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Release", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReleaseEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Release", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ReleaseOrder", + "description": "Ways in which lists of releases can be ordered upon return.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field in which to order releases by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ReleaseOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The direction in which to order releases by the specified field.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ReleaseOrderField", + "description": "Properties by which release connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "CREATED_AT", + "description": "Order releases by creation time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NAME", + "description": "Order releases alphabetically by name", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "IssuePubSubTopic", + "description": "The possible PubSub channels for an issue.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "UPDATED", + "description": "The channel ID for observing issue updates.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MARKASREAD", + "description": "The channel ID for marking an issue as read.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "TIMELINE", + "description": "The channel ID for updating items on the issue timeline.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "STATE", + "description": "The channel ID for observing issue state updates.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OrganizationConnection", + "description": "The connection type for Organization.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "OrganizationEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OrganizationEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OrganizationInvitation", + "description": "An Invitation for a user to an organization.", + "fields": [ + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "email", + "description": "The email address of the user invited to the organization.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "invitationType", + "description": "The type of invitation that was sent (e.g. email, user).", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrganizationInvitationType", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "invitee", + "description": "The user who was invited to the organization.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inviter", + "description": "The user who created the invitation.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organization", + "description": "The organization the invite is for", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "role", + "description": "The user's pending role in the organization (e.g. member, owner).", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrganizationInvitationRole", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "OrganizationInvitationType", + "description": "The possible organization invitation types.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "USER", + "description": "The invitation was to an existing user.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "EMAIL", + "description": "The invitation was to an email address.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "OrganizationInvitationRole", + "description": "The possible organization invitation roles.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "DIRECT_MEMBER", + "description": "The user is invited to be a direct member of the organization.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ADMIN", + "description": "The user is invited to be an admin of the organization.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "BILLING_MANAGER", + "description": "The user is invited to be a billing manager of the organization.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REINSTATE", + "description": "The user's previous role will be reinstated.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TeamConnection", + "description": "The connection type for Team.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TeamEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Team", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TeamEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Team", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Team", + "description": "A team of users in an organization.", + "fields": [ + { + "name": "ancestors", + "description": "A list of teams that are ancestors of this team.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TeamConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "avatarUrl", + "description": "A URL pointing to the team's avatar.", + "args": [ + { + "name": "size", + "description": "The size in pixels of the resulting square image.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "400" + } + ], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "childTeams", + "description": "List of child teams belonging to this team", + "args": [ + { + "name": "orderBy", + "description": "Order for connection", + "type": { + "kind": "INPUT_OBJECT", + "name": "TeamOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "userLogins", + "description": "User logins to filter by", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "immediateOnly", + "description": "Whether to list immediate child teams or all descendant child teams.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "true" + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TeamConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "combinedSlug", + "description": "The slug corresponding to the organization and team.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "The description of the team.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "editTeamResourcePath", + "description": "The HTTP path for editing this team", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "editTeamUrl", + "description": "The HTTP URL for editing this team", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "invitations", + "description": "A list of pending invitations for users to this team", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "OrganizationInvitationConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "memberStatuses", + "description": "Get the status messages members of this entity have set that are either public or visible only to the organization.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for user statuses returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "UserStatusOrder", + "ofType": null + }, + "defaultValue": "{field:\"UPDATED_AT\",direction:\"DESC\"}" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserStatusConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "members", + "description": "A list of users who are members of this team.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "query", + "description": "The search string to look for.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "membership", + "description": "Filter by membership type", + "type": { + "kind": "ENUM", + "name": "TeamMembershipType", + "ofType": null + }, + "defaultValue": "ALL" + }, + { + "name": "role", + "description": "Filter by team member role", + "type": { + "kind": "ENUM", + "name": "TeamMemberRole", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Order for the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "TeamMemberOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TeamMemberConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "membersResourcePath", + "description": "The HTTP path for the team' members", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "membersUrl", + "description": "The HTTP URL for the team' members", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The name of the team.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "newTeamResourcePath", + "description": "The HTTP path creating a new team", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "newTeamUrl", + "description": "The HTTP URL creating a new team", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organization", + "description": "The organization that owns this team.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "parentTeam", + "description": "The parent team of the team.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Team", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "privacy", + "description": "The level of privacy the team has.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "TeamPrivacy", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repositories", + "description": "A list of repositories this team has access to.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "query", + "description": "The search string to look for.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Order for the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "TeamRepositoryOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TeamRepositoryConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repositoriesResourcePath", + "description": "The HTTP path for this team's repositories", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repositoriesUrl", + "description": "The HTTP URL for this team's repositories", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this team", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "slug", + "description": "The slug corresponding to the team.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "teamsResourcePath", + "description": "The HTTP path for this team's teams", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "teamsUrl", + "description": "The HTTP URL for this team's teams", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this team", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanAdminister", + "description": "Team is adminable by the viewer.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanSubscribe", + "description": "Check if the viewer is able to change their subscription status for the repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerSubscription", + "description": "Identifies if the viewer is watching, not watching, or ignoring the subscribable entity.", + "args": [], + "type": { + "kind": "ENUM", + "name": "SubscriptionState", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Subscribable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "MemberStatusable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "TeamPrivacy", + "description": "The possible team privacy values.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "SECRET", + "description": "A secret team can only be seen by its members.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "VISIBLE", + "description": "A visible team can be seen and @mentioned by every member of the organization.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TeamMemberConnection", + "description": "The connection type for User.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TeamMemberEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TeamMemberEdge", + "description": "Represents a user who is a member of a team.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "memberAccessResourcePath", + "description": "The HTTP path to the organization's member access page.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "memberAccessUrl", + "description": "The HTTP URL to the organization's member access page.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "role", + "description": "The role the member has on the team.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "TeamMemberRole", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "TeamMemberRole", + "description": "The possible team member roles; either 'maintainer' or 'member'.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "MAINTAINER", + "description": "A team maintainer has permission to add and remove team members.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MEMBER", + "description": "A team member has no administrative permissions on the team.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "TeamMembershipType", + "description": "Defines which types of team members are included in the returned list. Can be one of IMMEDIATE, CHILD_TEAM or ALL.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "IMMEDIATE", + "description": "Includes only immediate members of the team.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CHILD_TEAM", + "description": "Includes only child team members for the team.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ALL", + "description": "Includes immediate and child team members for the team.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "TeamMemberOrder", + "description": "Ordering options for team member connections", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field to order team members by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "TeamMemberOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The ordering direction.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "TeamMemberOrderField", + "description": "Properties by which team member connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "LOGIN", + "description": "Order team members by login", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CREATED_AT", + "description": "Order team members by creation time", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TeamRepositoryConnection", + "description": "The connection type for Repository.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TeamRepositoryEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TeamRepositoryEdge", + "description": "Represents a team repository.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "permission", + "description": "The permission level the team has on the repository", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryPermission", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "RepositoryPermission", + "description": "The access level to a repository", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "ADMIN", + "description": "Can read, clone, push, and add collaborators", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "WRITE", + "description": "Can read, clone and push", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "READ", + "description": "Can read and clone", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "TeamRepositoryOrder", + "description": "Ordering options for team repository connections", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field to order repositories by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "TeamRepositoryOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The ordering direction.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "TeamRepositoryOrderField", + "description": "Properties by which team repository connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "CREATED_AT", + "description": "Order repositories by creation time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UPDATED_AT", + "description": "Order repositories by update time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PUSHED_AT", + "description": "Order repositories by push time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NAME", + "description": "Order repositories by name", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PERMISSION", + "description": "Order repositories by permission", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "STARGAZERS", + "description": "Order repositories by number of stargazers", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OrganizationInvitationConnection", + "description": "The connection type for OrganizationInvitation.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "OrganizationInvitationEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "OrganizationInvitation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OrganizationInvitationEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "OrganizationInvitation", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "TeamOrder", + "description": "Ways in which team connections can be ordered.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field in which to order nodes by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "TeamOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The direction in which to order nodes.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "TeamOrderField", + "description": "Properties by which team connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "NAME", + "description": "Allows ordering a list of teams by name.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "DefaultRepositoryPermissionField", + "description": "The possible default permissions for repositories.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "NONE", + "description": "No access", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "READ", + "description": "Can read repos by default", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "WRITE", + "description": "Can read and write repos by default", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ADMIN", + "description": "Can read, write, and administrate repos by default", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ExternalIdentityConnection", + "description": "The connection type for ExternalIdentity.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ExternalIdentityEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ExternalIdentity", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ExternalIdentityEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ExternalIdentity", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ExternalIdentity", + "description": "An external identity provisioned by SAML SSO or SCIM.", + "fields": [ + { + "name": "guid", + "description": "The GUID for this identity", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organizationInvitation", + "description": "Organization invitation for this SCIM-provisioned external identity", + "args": [], + "type": { + "kind": "OBJECT", + "name": "OrganizationInvitation", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "samlIdentity", + "description": "SAML Identity attributes", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ExternalIdentitySamlAttributes", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "scimIdentity", + "description": "SCIM Identity attributes", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ExternalIdentityScimAttributes", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "User linked to this external identity. Will be NULL if this identity has not been claimed by an organization member.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ExternalIdentitySamlAttributes", + "description": "SAML attributes for the External Identity", + "fields": [ + { + "name": "nameId", + "description": "The NameID of the SAML identity", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ExternalIdentityScimAttributes", + "description": "SCIM attributes for the External Identity", + "fields": [ + { + "name": "username", + "description": "The userName of the SCIM identity", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PublicKey", + "description": "A user's public key.", + "fields": [ + { + "name": "accessedAt", + "description": "The last time this authorization was used to perform an action", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fingerprint", + "description": "The fingerprint for this PublicKey", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isReadOnly", + "description": "Whether this PublicKey is read-only or not", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "key", + "description": "The public key string", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "X509Certificate", + "description": "A valid x509 certificate string", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "IdentityProviderConfigurationState", + "description": "The possible states in which authentication can be configured with an identity provider.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "ENFORCED", + "description": "Authentication with an identity provider is configured and enforced.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CONFIGURED", + "description": "Authentication with an identity provider is configured but not enforced.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNCONFIGURED", + "description": "Authentication with an identity provider is not configured.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "Date", + "description": "An ISO-8601 encoded date string.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OrganizationIdentityProvider", + "description": "An Identity Provider configured to provision SAML and SCIM identities for Organizations", + "fields": [ + { + "name": "digestMethod", + "description": "The digest algorithm used to sign SAML requests for the Identity Provider.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "externalIdentities", + "description": "External Identities provisioned by this Identity Provider", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ExternalIdentityConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "idpCertificate", + "description": "The x509 certificate used by the Identity Provder to sign assertions and responses.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "X509Certificate", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issuer", + "description": "The Issuer Entity ID for the SAML Identity Provider", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "organization", + "description": "Organization this Identity Provider belongs to", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signatureMethod", + "description": "The signature algorithm used to sign SAML requests for the Identity Provider.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ssoUrl", + "description": "The URL endpoint for the Identity Provider's SAML SSO.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OrganizationMemberConnection", + "description": "The connection type for User.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "OrganizationMemberEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "OrganizationMemberEdge", + "description": "Represents a user within an organization.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasTwoFactorEnabled", + "description": "Whether the organization member has two factor enabled or not. Returns null if information is not available to viewer.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "role", + "description": "The role this user has in the organization.", + "args": [], + "type": { + "kind": "ENUM", + "name": "OrganizationMemberRole", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "OrganizationMemberRole", + "description": "The possible roles within an organization for its members.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "MEMBER", + "description": "The user is a member of the organization.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ADMIN", + "description": "The user is an administrator of the organization.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "TeamRole", + "description": "The role of a user on a team.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "ADMIN", + "description": "User has admin rights on the team.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MEMBER", + "description": "User is a member of the team.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "GistConnection", + "description": "The connection type for Gist.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "GistEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Gist", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "GistEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Gist", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "GistPrivacy", + "description": "The privacy of a Gist", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "PUBLIC", + "description": "Public", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SECRET", + "description": "Secret", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ALL", + "description": "Gists that are public and secret", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "GistOrder", + "description": "Ordering options for gist connections", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field to order repositories by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "GistOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The ordering direction.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "GistOrderField", + "description": "Properties by which gist connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "CREATED_AT", + "description": "Order gists by creation time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UPDATED_AT", + "description": "Order gists by update time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PUSHED_AT", + "description": "Order gists by push time", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RepositoryInvitationEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "RepositoryInvitation", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RepositoryInvitation", + "description": "An invitation for a user to be added to a repository.", + "fields": [ + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "invitee", + "description": "The user who received the invitation.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inviter", + "description": "The user who created the invitation.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "permission", + "description": "The permission granted on this repository by this invitation.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryPermission", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The Repository the user is invited to.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "RepositoryInfo", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Mannequin", + "description": "A placeholder user for attribution of imported data on GitHub.", + "fields": [ + { + "name": "avatarUrl", + "description": "A URL pointing to the GitHub App's public avatar.", + "args": [ + { + "name": "size", + "description": "The size of the resulting square image.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "login", + "description": "The username of the actor.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTML path to this resource.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The URL to this resource.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "LanguageConnection", + "description": "A list of languages associated with the parent.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "LanguageEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Language", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalSize", + "description": "The total size in bytes of files written in that language.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "LanguageEdge", + "description": "Represents the language of a repository.", + "fields": [ + { + "name": "cursor", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Language", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "size", + "description": "The number of bytes of code written in the language.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Milestone", + "description": "Represents a Milestone object on a given repository.", + "fields": [ + { + "name": "closed", + "description": "`true` if the object is closed (definition of closed may depend on type)", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closedAt", + "description": "Identifies the date and time when the object was closed.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "creator", + "description": "Identifies the actor who created the milestone.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "Identifies the description of the milestone.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dueOn", + "description": "Identifies the due date of the milestone.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issues", + "description": "A list of issues associated with the milestone.", + "args": [ + { + "name": "orderBy", + "description": "Ordering options for issues returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "labels", + "description": "A list of label names to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "states", + "description": "A list of states to filter the issues by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "IssueState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "filterBy", + "description": "Filtering options for issues returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueFilters", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "number", + "description": "Identifies the number of the milestone.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequests", + "description": "A list of pull requests associated with the milestone.", + "args": [ + { + "name": "states", + "description": "A list of states to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestState", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "labels", + "description": "A list of label names to filter the pull requests by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "headRefName", + "description": "The head ref name to filter the pull requests by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "baseRefName", + "description": "The base ref name to filter the pull requests by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for pull requests returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "IssueOrder", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository associated with this milestone.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this milestone", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "Identifies the state of the milestone.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "MilestoneState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "title", + "description": "Identifies the title of the milestone.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this milestone", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Closable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "MilestoneState", + "description": "The possible states of a milestone.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "OPEN", + "description": "A milestone that is still open.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CLOSED", + "description": "A milestone that has been closed.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestChangedFileConnection", + "description": "The connection type for PullRequestChangedFile.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestChangedFileEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestChangedFile", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestChangedFileEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestChangedFile", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestChangedFile", + "description": "A file changed in a pull request.", + "fields": [ + { + "name": "additions", + "description": "The number of additions to the file.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deletions", + "description": "The number of deletions to the file.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "path", + "description": "The path of the file.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "MergeableState", + "description": "Whether or not a PullRequest can be merged.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "MERGEABLE", + "description": "The pull request can be merged.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CONFLICTING", + "description": "The pull request cannot be merged due to merge conflicts.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNKNOWN", + "description": "The mergeability of the pull request is still being calculated.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "description": "A review comment associated with a given repository pull request.", + "fields": [ + { + "name": "author", + "description": "The actor who authored the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authorAssociation", + "description": "Author's association with the subject of the comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentAuthorAssociation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "body", + "description": "The comment body of this review comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyHTML", + "description": "The comment body of this review comment rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyText", + "description": "The comment body of this review comment rendered as plain text.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commit", + "description": "Identifies the commit associated with the comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies when the comment was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdViaEmail", + "description": "Check if this comment was created via an email reply.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "diffHunk", + "description": "The diff hunk to which the comment applies.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "draftedAt", + "description": "Identifies when the comment was created in a draft state.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "editor", + "description": "The actor who edited the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "includesCreatedEdit", + "description": "Check if this comment was edited and includes an edit with the creation data", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isMinimized", + "description": "Returns whether or not a comment has been minimized.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastEditedAt", + "description": "The moment the editor made the last edit", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "minimizedReason", + "description": "Returns why the comment was minimized.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "originalCommit", + "description": "Identifies the original commit associated with the comment.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "originalPosition", + "description": "The original line index in the diff to which the comment applies.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "outdated", + "description": "Identifies when the comment body is outdated", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "path", + "description": "The path to which the comment applies.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "position", + "description": "The line index in the diff to which the comment applies.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "publishedAt", + "description": "Identifies when the comment was published at.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "The pull request associated with this review comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestReview", + "description": "The pull request review associated with this review comment.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactionGroups", + "description": "A list of reactions grouped by content left on the subject.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionGroup", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactions", + "description": "A list of Reactions left on the Issue.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "content", + "description": "Allows filtering Reactions by emoji.", + "type": { + "kind": "ENUM", + "name": "ReactionContent", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Allows specifying the order in which reactions are returned.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ReactionOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "replyTo", + "description": "The comment this is a reply to.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository associated with this node.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path permalink for this review comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "Identifies the state of the comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestReviewCommentState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies when the comment was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL permalink for this review comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userContentEdits", + "description": "A list of edits to this content.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UserContentEditConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanDelete", + "description": "Check if the current viewer can delete this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanMinimize", + "description": "Check if the current viewer can minimize this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanReact", + "description": "Can user react to this subject", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanUpdate", + "description": "Check if the current viewer can update this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCannotUpdateReasons", + "description": "Reasons why the current viewer can not update this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentCannotUpdateReason", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerDidAuthor", + "description": "Did the viewer author this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Comment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Deletable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Updatable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UpdatableComment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Reactable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryNode", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReview", + "description": "A review object for a given pull request.", + "fields": [ + { + "name": "author", + "description": "The actor who authored the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "authorAssociation", + "description": "Author's association with the subject of the comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentAuthorAssociation", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "body", + "description": "Identifies the pull request review body.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyHTML", + "description": "The body of this review rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "bodyText", + "description": "The body of this review rendered as plain text.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "comments", + "description": "A list of review comments for the current pull request review.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestReviewCommentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commit", + "description": "Identifies the commit associated with this pull request review.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdViaEmail", + "description": "Check if this comment was created via an email reply.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "editor", + "description": "The actor who edited the comment.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "includesCreatedEdit", + "description": "Check if this comment was edited and includes an edit with the creation data", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastEditedAt", + "description": "The moment the editor made the last edit", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "onBehalfOf", + "description": "A list of teams that this review was made on behalf of.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TeamConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "publishedAt", + "description": "Identifies when the comment was published at.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "Identifies the pull request associated with this pull request review.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactionGroups", + "description": "A list of reactions grouped by content left on the subject.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionGroup", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reactions", + "description": "A list of Reactions left on the Issue.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "content", + "description": "Allows filtering Reactions by emoji.", + "type": { + "kind": "ENUM", + "name": "ReactionContent", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Allows specifying the order in which reactions are returned.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ReactionOrder", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReactionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository associated with this node.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path permalink for this PullRequestReview.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "Identifies the current state of the pull request review.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestReviewState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "submittedAt", + "description": "Identifies when the Pull Request Review was submitted", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the object was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL permalink for this PullRequestReview.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userContentEdits", + "description": "A list of edits to this content.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UserContentEditConnection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanDelete", + "description": "Check if the current viewer can delete this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanReact", + "description": "Can user react to this subject", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanUpdate", + "description": "Check if the current viewer can update this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCannotUpdateReasons", + "description": "Reasons why the current viewer can not update this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommentCannotUpdateReason", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerDidAuthor", + "description": "Did the viewer author this comment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Comment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Deletable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Updatable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UpdatableComment", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "Reactable", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryNode", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PullRequestReviewState", + "description": "The possible states of a pull request review.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "PENDING", + "description": "A review that has not yet been submitted.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "COMMENTED", + "description": "An informational review.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "APPROVED", + "description": "A review allowing the pull request to merge.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CHANGES_REQUESTED", + "description": "A review blocking the pull request from merging.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "DISMISSED", + "description": "A review that has been dismissed.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewCommentConnection", + "description": "The connection type for PullRequestReviewComment.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestReviewCommentEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewCommentEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewThread", + "description": "A threaded list of comments for a given pull request.", + "fields": [ + { + "name": "comments", + "description": "A list of pull request comments associated with the thread.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestReviewCommentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isResolved", + "description": "Whether this thread has been resolved", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "Identifies the pull request associated with this thread.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "Identifies the repository associated with this thread.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resolvedBy", + "description": "The user who resolved this thread", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanResolve", + "description": "Whether or not the viewer can resolve this thread", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "viewerCanUnresolve", + "description": "Whether or not the viewer can unresolve this thread", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestCommit", + "description": "Represents a Git commit part of a pull request.", + "fields": [ + { + "name": "commit", + "description": "The Git commit object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "The pull request this commit belongs to", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this pull request commit", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this pull request commit", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewThreadConnection", + "description": "Review comment threads for a pull request review.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestReviewThreadEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestReviewThread", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewThreadEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReviewThread", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PullRequestReviewCommentState", + "description": "The possible states of a pull request review comment.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "PENDING", + "description": "A comment that is part of a pending review", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUBMITTED", + "description": "A comment that is part of a submitted review", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PullRequestPubSubTopic", + "description": "The possible PubSub channels for a pull request.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "UPDATED", + "description": "The channel ID for observing pull request updates.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MARKASREAD", + "description": "The channel ID for marking an pull request as read.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "HEAD_REF", + "description": "The channel ID for observing head ref updates.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "TIMELINE", + "description": "The channel ID for updating items on the pull request timeline.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "STATE", + "description": "The channel ID for observing pull request state updates.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "IssueCommentConnection", + "description": "The connection type for IssueComment.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueCommentEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "IssueCommentEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewConnection", + "description": "The connection type for PullRequestReview.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestReviewEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestCommitConnection", + "description": "The connection type for PullRequestCommit.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestCommitEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestCommit", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestCommitEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestCommit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReviewRequestConnection", + "description": "The connection type for ReviewRequest.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReviewRequestEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReviewRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReviewRequestEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ReviewRequest", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReviewRequest", + "description": "A request for a user to review a pull request.", + "fields": [ + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "Identifies the pull request associated with this review request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requestedReviewer", + "description": "The reviewer that is requested.", + "args": [], + "type": { + "kind": "UNION", + "name": "RequestedReviewer", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "RequestedReviewer", + "description": "Types that can be requested reviewers.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Team", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Mannequin", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "PullRequestTimelineConnection", + "description": "The connection type for PullRequestTimelineItem.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestTimelineItemEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "UNION", + "name": "PullRequestTimelineItem", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestTimelineItemEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "UNION", + "name": "PullRequestTimelineItem", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "PullRequestTimelineItem", + "description": "An item in an pull request timeline", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CommitCommentThread", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewThread", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ClosedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReopenedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "SubscribedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnsubscribedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MergedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReferencedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CrossReferencedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "AssignedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnassignedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "LabeledEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnlabeledEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MilestonedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DemilestonedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RenamedTitleEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "LockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnlockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DeployedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DeploymentEnvironmentChangedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "HeadRefDeletedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "HeadRefRestoredEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "HeadRefForcePushedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "BaseRefForcePushedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReviewRequestedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReviewRequestRemovedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReviewDismissedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UserBlockedEvent", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "CommitCommentThread", + "description": "A thread of comments on a commit.", + "fields": [ + { + "name": "comments", + "description": "The comments that exist in this thread.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommitCommentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commit", + "description": "The commit the comments were made on.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "path", + "description": "The file the comments were made on.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "position", + "description": "The position in the diff for the commit that the comment was made on.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository associated with this node.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryNode", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ClosedEvent", + "description": "Represents a 'closed' event on any `Closable`.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closable", + "description": "Object that was closed.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Closable", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closer", + "description": "Object which triggered the creation of this event.", + "args": [], + "type": { + "kind": "UNION", + "name": "Closer", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this closed event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this closed event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "Closer", + "description": "The object which triggered a `ClosedEvent`.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "ReopenedEvent", + "description": "Represents a 'reopened' event on any `Closable`.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closable", + "description": "Object that was reopened.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Closable", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SubscribedEvent", + "description": "Represents a 'subscribed' event on a given `Subscribable`.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscribable", + "description": "Object referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Subscribable", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UnsubscribedEvent", + "description": "Represents an 'unsubscribed' event on a given `Subscribable`.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscribable", + "description": "Object referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Subscribable", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MergedEvent", + "description": "Represents a 'merged' event on a given pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commit", + "description": "Identifies the commit associated with the `merge` event.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mergeRef", + "description": "Identifies the Ref associated with the `merge` event.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mergeRefName", + "description": "Identifies the name of the Ref associated with the `merge` event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "PullRequest referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this merged event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this merged event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReferencedEvent", + "description": "Represents a 'referenced' event on a given `ReferencedSubject`.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commit", + "description": "Identifies the commit associated with the 'referenced' event.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitRepository", + "description": "Identifies the repository associated with the 'referenced' event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isCrossRepository", + "description": "Reference originated in a different repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDirectReference", + "description": "Checks if the commit message itself references the subject. Can be false in the case of a commit comment reference.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subject", + "description": "Object referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "UNION", + "name": "ReferencedSubject", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "ReferencedSubject", + "description": "Any referencable object", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "CrossReferencedEvent", + "description": "Represents a mention made by one issue or pull request to another.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isCrossRepository", + "description": "Reference originated in a different repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "referencedAt", + "description": "Identifies when the reference was made.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source", + "description": "Issue or pull request that made the reference.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "UNION", + "name": "ReferencedSubject", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "target", + "description": "Issue or pull request to which the reference was made.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "UNION", + "name": "ReferencedSubject", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "willCloseTarget", + "description": "Checks if the target will be closed when the source is merged.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AssignedEvent", + "description": "Represents an 'assigned' event on any assignable object.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "assignable", + "description": "Identifies the assignable associated with the event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Assignable", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "Identifies the user who was assigned.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UnassignedEvent", + "description": "Represents an 'unassigned' event on any assignable object.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "assignable", + "description": "Identifies the assignable associated with the event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Assignable", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "Identifies the subject (user) who was unassigned.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "LabeledEvent", + "description": "Represents a 'labeled' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "label", + "description": "Identifies the label associated with the 'labeled' event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Label", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "labelable", + "description": "Identifies the `Labelable` associated with the event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Labelable", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UnlabeledEvent", + "description": "Represents an 'unlabeled' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "label", + "description": "Identifies the label associated with the 'unlabeled' event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Label", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "labelable", + "description": "Identifies the `Labelable` associated with the event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Labelable", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MilestonedEvent", + "description": "Represents a 'milestoned' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "milestoneTitle", + "description": "Identifies the milestone title associated with the 'milestoned' event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subject", + "description": "Object referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "UNION", + "name": "MilestoneItem", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "MilestoneItem", + "description": "Types that can be inside a Milestone.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "DemilestonedEvent", + "description": "Represents a 'demilestoned' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "milestoneTitle", + "description": "Identifies the milestone title associated with the 'demilestoned' event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subject", + "description": "Object referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "UNION", + "name": "MilestoneItem", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RenamedTitleEvent", + "description": "Represents a 'renamed' event on a given issue or pull request", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "currentTitle", + "description": "Identifies the current title of the issue or pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "previousTitle", + "description": "Identifies the previous title of the issue or pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subject", + "description": "Subject that was renamed.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "UNION", + "name": "RenamedTitleSubject", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "RenamedTitleSubject", + "description": "An object which has a renamable title", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "LockedEvent", + "description": "Represents a 'locked' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lockReason", + "description": "Reason that the conversation was locked (optional).", + "args": [], + "type": { + "kind": "ENUM", + "name": "LockReason", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lockable", + "description": "Object that was locked.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Lockable", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UnlockedEvent", + "description": "Represents an 'unlocked' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lockable", + "description": "Object that was unlocked.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "Lockable", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeployedEvent", + "description": "Represents a 'deployed' event on a given pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deployment", + "description": "The deployment associated with the 'deployed' event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Deployment", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "PullRequest referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ref", + "description": "The ref associated with the 'deployed' event.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeploymentEnvironmentChangedEvent", + "description": "Represents a 'deployment_environment_changed' event on a given pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deploymentStatus", + "description": "The deployment status that updated the deployment environment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DeploymentStatus", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "PullRequest referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HeadRefDeletedEvent", + "description": "Represents a 'head_ref_deleted' event on a given pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "headRef", + "description": "Identifies the Ref associated with the `head_ref_deleted` event.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "headRefName", + "description": "Identifies the name of the Ref associated with the `head_ref_deleted` event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "PullRequest referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HeadRefRestoredEvent", + "description": "Represents a 'head_ref_restored' event on a given pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "PullRequest referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "HeadRefForcePushedEvent", + "description": "Represents a 'head_ref_force_pushed' event on a given pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "afterCommit", + "description": "Identifies the after commit SHA for the 'head_ref_force_pushed' event.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "beforeCommit", + "description": "Identifies the before commit SHA for the 'head_ref_force_pushed' event.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "PullRequest referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ref", + "description": "Identifies the fully qualified ref name for the 'head_ref_force_pushed' event.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "BaseRefForcePushedEvent", + "description": "Represents a 'base_ref_force_pushed' event on a given pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "afterCommit", + "description": "Identifies the after commit SHA for the 'base_ref_force_pushed' event.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "beforeCommit", + "description": "Identifies the before commit SHA for the 'base_ref_force_pushed' event.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "PullRequest referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ref", + "description": "Identifies the fully qualified ref name for the 'base_ref_force_pushed' event.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReviewRequestedEvent", + "description": "Represents an 'review_requested' event on a given pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "PullRequest referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requestedReviewer", + "description": "Identifies the reviewer whose review was requested.", + "args": [], + "type": { + "kind": "UNION", + "name": "RequestedReviewer", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReviewRequestRemovedEvent", + "description": "Represents an 'review_request_removed' event on a given pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "PullRequest referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requestedReviewer", + "description": "Identifies the reviewer whose review request was removed.", + "args": [], + "type": { + "kind": "UNION", + "name": "RequestedReviewer", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReviewDismissedEvent", + "description": "Represents a 'review_dismissed' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dismissalMessage", + "description": "Identifies the optional message associated with the 'review_dismissed' event.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dismissalMessageHTML", + "description": "Identifies the optional message associated with the event, rendered to HTML.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message", + "description": "Identifies the message associated with the 'review_dismissed' event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": true, + "deprecationReason": "`message` is being removed because it not nullable, whereas the underlying field is optional. Use `dismissalMessage` instead. Removal on 2019-07-01 UTC." + }, + { + "name": "messageHtml", + "description": "The message associated with the event, rendered to HTML.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "HTML", + "ofType": null + } + }, + "isDeprecated": true, + "deprecationReason": "`messageHtml` is being removed because it not nullable, whereas the underlying field is optional. Use `dismissalMessageHTML` instead. Removal on 2019-07-01 UTC." + }, + { + "name": "previousReviewState", + "description": "Identifies the previous state of the review with the 'review_dismissed' event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestReviewState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "PullRequest referenced by event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestCommit", + "description": "Identifies the commit which caused the review to become stale.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestCommit", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this review dismissed event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "review", + "description": "Identifies the review associated with the 'review_dismissed' event.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this review dismissed event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "UniformResourceLocatable", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UserBlockedEvent", + "description": "Represents a 'user_blocked' event on a given user.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "blockDuration", + "description": "Number of days that the user was blocked for.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "UserBlockDuration", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subject", + "description": "The user who was blocked.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "UserBlockDuration", + "description": "The possible durations that a user can be blocked for.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "ONE_DAY", + "description": "The user was blocked for 1 day", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "THREE_DAYS", + "description": "The user was blocked for 3 days", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ONE_WEEK", + "description": "The user was blocked for 7 days", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ONE_MONTH", + "description": "The user was blocked for 30 days", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PERMANENT", + "description": "The user was blocked permanently", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestTimelineItemsConnection", + "description": "The connection type for PullRequestTimelineItems.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestTimelineItemsEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "filteredCount", + "description": "Identifies the count of items after applying `before` and `after` filters.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "UNION", + "name": "PullRequestTimelineItems", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageCount", + "description": "Identifies the count of items after applying `before`/`after` filters and `first`/`last`/`skip` slicing.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the timeline was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestTimelineItemsEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "UNION", + "name": "PullRequestTimelineItems", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "PullRequestTimelineItems", + "description": "An item in a pull request timeline", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "PullRequestCommit", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestCommitCommentThread", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewThread", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequestRevisionMarker", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "BaseRefChangedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "BaseRefForcePushedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DeployedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DeploymentEnvironmentChangedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "HeadRefDeletedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "HeadRefForcePushedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "HeadRefRestoredEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MergedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReviewDismissedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReviewRequestedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReviewRequestRemovedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CrossReferencedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "AddedToProjectEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "AssignedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ClosedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CommentDeletedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ConvertedNoteToIssueEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DemilestonedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "LabeledEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "LockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MentionedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MilestonedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MovedColumnsInProjectEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PinnedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReferencedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RemovedFromProjectEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RenamedTitleEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReopenedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "SubscribedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "TransferredEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnassignedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnlabeledEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnlockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UserBlockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnpinnedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnsubscribedEvent", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "PullRequestCommitCommentThread", + "description": "Represents a commit comment thread part of a pull request.", + "fields": [ + { + "name": "comments", + "description": "The comments that exist in this thread.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommitCommentConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commit", + "description": "The commit the comments were made on.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "path", + "description": "The file the comments were made on.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "position", + "description": "The position in the diff for the commit that the comment was made on.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "The pull request this commit comment thread belongs to", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository associated with this node.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "RepositoryNode", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestRevisionMarker", + "description": "Represents the latest point in the pull request timeline for which the viewer has seen the pull request's commits.", + "fields": [ + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lastSeenCommit", + "description": "The last commit the viewer has seen.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "The pull request to which the marker belongs.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "BaseRefChangedEvent", + "description": "Represents a 'base_ref_changed' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AddedToProjectEvent", + "description": "Represents a 'added_to_project' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CommentDeletedEvent", + "description": "Represents a 'comment_deleted' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ConvertedNoteToIssueEvent", + "description": "Represents a 'converted_note_to_issue' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "IssueOrPullRequest", + "description": "Used for return value of Repository.issueOrPullRequest.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "MentionedEvent", + "description": "Represents a 'mentioned' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MovedColumnsInProjectEvent", + "description": "Represents a 'moved_columns_in_project' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PinnedEvent", + "description": "Represents a 'pinned' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issue", + "description": "Identifies the issue associated with the event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RemovedFromProjectEvent", + "description": "Represents a 'removed_from_project' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TransferredEvent", + "description": "Represents a 'transferred' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fromRepository", + "description": "The repository this came from", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issue", + "description": "Identifies the issue associated with the event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UnpinnedEvent", + "description": "Represents an 'unpinned' event on a given issue or pull request.", + "fields": [ + { + "name": "actor", + "description": "Identifies the actor who performed the event.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issue", + "description": "Identifies the issue associated with the event.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PullRequestTimelineItemsItemType", + "description": "The possible item types found in a timeline.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "PULL_REQUEST_COMMIT", + "description": "Represents a Git commit part of a pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PULL_REQUEST_COMMIT_COMMENT_THREAD", + "description": "Represents a commit comment thread part of a pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PULL_REQUEST_REVIEW", + "description": "A review object for a given pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PULL_REQUEST_REVIEW_THREAD", + "description": "A threaded list of comments for a given pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PULL_REQUEST_REVISION_MARKER", + "description": "Represents the latest point in the pull request timeline for which the viewer has seen the pull request's commits.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "BASE_REF_CHANGED_EVENT", + "description": "Represents a 'base_ref_changed' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "BASE_REF_FORCE_PUSHED_EVENT", + "description": "Represents a 'base_ref_force_pushed' event on a given pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "DEPLOYED_EVENT", + "description": "Represents a 'deployed' event on a given pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "DEPLOYMENT_ENVIRONMENT_CHANGED_EVENT", + "description": "Represents a 'deployment_environment_changed' event on a given pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "HEAD_REF_DELETED_EVENT", + "description": "Represents a 'head_ref_deleted' event on a given pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "HEAD_REF_FORCE_PUSHED_EVENT", + "description": "Represents a 'head_ref_force_pushed' event on a given pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "HEAD_REF_RESTORED_EVENT", + "description": "Represents a 'head_ref_restored' event on a given pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MERGED_EVENT", + "description": "Represents a 'merged' event on a given pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REVIEW_DISMISSED_EVENT", + "description": "Represents a 'review_dismissed' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REVIEW_REQUESTED_EVENT", + "description": "Represents an 'review_requested' event on a given pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REVIEW_REQUEST_REMOVED_EVENT", + "description": "Represents an 'review_request_removed' event on a given pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ISSUE_COMMENT", + "description": "Represents a comment on an Issue.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CROSS_REFERENCED_EVENT", + "description": "Represents a mention made by one issue or pull request to another.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ADDED_TO_PROJECT_EVENT", + "description": "Represents a 'added_to_project' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ASSIGNED_EVENT", + "description": "Represents an 'assigned' event on any assignable object.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CLOSED_EVENT", + "description": "Represents a 'closed' event on any `Closable`.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "COMMENT_DELETED_EVENT", + "description": "Represents a 'comment_deleted' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CONVERTED_NOTE_TO_ISSUE_EVENT", + "description": "Represents a 'converted_note_to_issue' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "DEMILESTONED_EVENT", + "description": "Represents a 'demilestoned' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LABELED_EVENT", + "description": "Represents a 'labeled' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LOCKED_EVENT", + "description": "Represents a 'locked' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MENTIONED_EVENT", + "description": "Represents a 'mentioned' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MILESTONED_EVENT", + "description": "Represents a 'milestoned' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MOVED_COLUMNS_IN_PROJECT_EVENT", + "description": "Represents a 'moved_columns_in_project' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PINNED_EVENT", + "description": "Represents a 'pinned' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REFERENCED_EVENT", + "description": "Represents a 'referenced' event on a given `ReferencedSubject`.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REMOVED_FROM_PROJECT_EVENT", + "description": "Represents a 'removed_from_project' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "RENAMED_TITLE_EVENT", + "description": "Represents a 'renamed' event on a given issue or pull request", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REOPENED_EVENT", + "description": "Represents a 'reopened' event on any `Closable`.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUBSCRIBED_EVENT", + "description": "Represents a 'subscribed' event on a given `Subscribable`.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "TRANSFERRED_EVENT", + "description": "Represents a 'transferred' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNASSIGNED_EVENT", + "description": "Represents an 'unassigned' event on any assignable object.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNLABELED_EVENT", + "description": "Represents an 'unlabeled' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNLOCKED_EVENT", + "description": "Represents an 'unlocked' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "USER_BLOCKED_EVENT", + "description": "Represents a 'user_blocked' event on a given user.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNPINNED_EVENT", + "description": "Represents an 'unpinned' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNSUBSCRIBED_EVENT", + "description": "Represents an 'unsubscribed' event on a given `Subscribable`.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SuggestedReviewer", + "description": "A suggestion to review a pull request based on a user's commit history and review comments.", + "fields": [ + { + "name": "isAuthor", + "description": "Is this suggestion based on past commits?", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isCommenter", + "description": "Is this suggestion based on past review comments?", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reviewer", + "description": "Identifies the user suggested to review the pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ProjectCardArchivedState", + "description": "The possible archived states of a project card.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "ARCHIVED", + "description": "A project card that is archived", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NOT_ARCHIVED", + "description": "A project card that is not archived", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "IssueTimelineConnection", + "description": "The connection type for IssueTimelineItem.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueTimelineItemEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "UNION", + "name": "IssueTimelineItem", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "IssueTimelineItemEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "UNION", + "name": "IssueTimelineItem", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "IssueTimelineItem", + "description": "An item in an issue timeline", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Commit", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CrossReferencedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ClosedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReopenedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "SubscribedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnsubscribedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReferencedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "AssignedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnassignedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "LabeledEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnlabeledEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UserBlockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MilestonedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DemilestonedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RenamedTitleEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "LockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnlockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "TransferredEvent", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "IssueTimelineItemsConnection", + "description": "The connection type for IssueTimelineItems.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueTimelineItemsEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "filteredCount", + "description": "Identifies the count of items after applying `before` and `after` filters.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "UNION", + "name": "IssueTimelineItems", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageCount", + "description": "Identifies the count of items after applying `before`/`after` filters and `first`/`last`/`skip` slicing.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "Identifies the date and time when the timeline was last updated.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "IssueTimelineItemsEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "UNION", + "name": "IssueTimelineItems", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "IssueTimelineItems", + "description": "An item in an issue timeline", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CrossReferencedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "AddedToProjectEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "AssignedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ClosedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CommentDeletedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ConvertedNoteToIssueEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "DemilestonedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "LabeledEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "LockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MentionedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MilestonedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MovedColumnsInProjectEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PinnedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReferencedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RemovedFromProjectEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RenamedTitleEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "ReopenedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "SubscribedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "TransferredEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnassignedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnlabeledEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnlockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UserBlockedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnpinnedEvent", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "UnsubscribedEvent", + "ofType": null + } + ] + }, + { + "kind": "ENUM", + "name": "IssueTimelineItemsItemType", + "description": "The possible item types found in a timeline.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "ISSUE_COMMENT", + "description": "Represents a comment on an Issue.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CROSS_REFERENCED_EVENT", + "description": "Represents a mention made by one issue or pull request to another.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ADDED_TO_PROJECT_EVENT", + "description": "Represents a 'added_to_project' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ASSIGNED_EVENT", + "description": "Represents an 'assigned' event on any assignable object.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CLOSED_EVENT", + "description": "Represents a 'closed' event on any `Closable`.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "COMMENT_DELETED_EVENT", + "description": "Represents a 'comment_deleted' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CONVERTED_NOTE_TO_ISSUE_EVENT", + "description": "Represents a 'converted_note_to_issue' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "DEMILESTONED_EVENT", + "description": "Represents a 'demilestoned' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LABELED_EVENT", + "description": "Represents a 'labeled' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LOCKED_EVENT", + "description": "Represents a 'locked' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MENTIONED_EVENT", + "description": "Represents a 'mentioned' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MILESTONED_EVENT", + "description": "Represents a 'milestoned' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MOVED_COLUMNS_IN_PROJECT_EVENT", + "description": "Represents a 'moved_columns_in_project' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PINNED_EVENT", + "description": "Represents a 'pinned' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REFERENCED_EVENT", + "description": "Represents a 'referenced' event on a given `ReferencedSubject`.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REMOVED_FROM_PROJECT_EVENT", + "description": "Represents a 'removed_from_project' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "RENAMED_TITLE_EVENT", + "description": "Represents a 'renamed' event on a given issue or pull request", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REOPENED_EVENT", + "description": "Represents a 'reopened' event on any `Closable`.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUBSCRIBED_EVENT", + "description": "Represents a 'subscribed' event on a given `Subscribable`.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "TRANSFERRED_EVENT", + "description": "Represents a 'transferred' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNASSIGNED_EVENT", + "description": "Represents an 'unassigned' event on any assignable object.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNLABELED_EVENT", + "description": "Represents an 'unlabeled' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNLOCKED_EVENT", + "description": "Represents an 'unlocked' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "USER_BLOCKED_EVENT", + "description": "Represents a 'user_blocked' event on a given user.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNPINNED_EVENT", + "description": "Represents an 'unpinned' event on a given issue or pull request.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNSUBSCRIBED_EVENT", + "description": "Represents an 'unsubscribed' event on a given `Subscribable`.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "CollaboratorAffiliation", + "description": "Collaborators affiliation level with a subject.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "OUTSIDE", + "description": "All outside collaborators of an organization-owned subject.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "DIRECT", + "description": "All collaborators with permissions to an organization-owned subject, regardless of organization membership status.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ALL", + "description": "All collaborators the authenticated user can see.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeployKeyConnection", + "description": "The connection type for DeployKey.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DeployKeyEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "DeployKey", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeployKeyEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "DeployKey", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeployKey", + "description": "A repository deploy key.", + "fields": [ + { + "name": "createdAt", + "description": "Identifies the date and time when the object was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "key", + "description": "The deploy key.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "readOnly", + "description": "Whether or not the deploy key is read only.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "title", + "description": "The deploy key title.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "verified", + "description": "Whether or not the deploy key has been verified.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "RepositoryCollaboratorAffiliation", + "description": "The affiliation type between collaborator and repository.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "ALL", + "description": "All collaborators of the repository.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OUTSIDE", + "description": "All outside collaborators of an organization-owned repository.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "BranchProtectionRuleConnection", + "description": "The connection type for BranchProtectionRule.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "BranchProtectionRuleEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "BranchProtectionRule", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "BranchProtectionRuleEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "BranchProtectionRule", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "BranchProtectionRule", + "description": "A branch protection rule.", + "fields": [ + { + "name": "branchProtectionRuleConflicts", + "description": "A list of conflicts matching branches protection rule and other branch protection rules", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "BranchProtectionRuleConflictConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "creator", + "description": "The actor who created this branch protection rule.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Actor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dismissesStaleReviews", + "description": "Will new commits pushed to matching branches dismiss pull request review approvals.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isAdminEnforced", + "description": "Can admins overwrite branch protection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "matchingRefs", + "description": "Repository refs that are protected by this rule", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RefConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pattern", + "description": "Identifies the protection rule pattern.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pushAllowances", + "description": "A list push allowances for this branch protection rule.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PushAllowanceConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository associated with this branch protection rule.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requiredApprovingReviewCount", + "description": "Number of approving reviews required to update matching branches.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requiredStatusCheckContexts", + "description": "List of required status check contexts that must pass for commits to be accepted to matching branches.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requiresApprovingReviews", + "description": "Are approving reviews required to update matching branches.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requiresCommitSignatures", + "description": "Are commits required to be signed.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requiresStatusChecks", + "description": "Are status checks required to update matching branches.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requiresStrictStatusChecks", + "description": "Are branches required to be up to date before merging.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "restrictsPushes", + "description": "Is pushing to matching branches restricted.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "restrictsReviewDismissals", + "description": "Is dismissal of pull request reviews restricted.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reviewDismissalAllowances", + "description": "A list review dismissal allowances for this branch protection rule.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReviewDismissalAllowanceConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReviewDismissalAllowanceConnection", + "description": "The connection type for ReviewDismissalAllowance.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReviewDismissalAllowanceEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ReviewDismissalAllowance", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReviewDismissalAllowanceEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ReviewDismissalAllowance", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReviewDismissalAllowance", + "description": "A team or user who has the ability to dismiss a review on a protected branch.", + "fields": [ + { + "name": "actor", + "description": "The actor that can dismiss.", + "args": [], + "type": { + "kind": "UNION", + "name": "ReviewDismissalAllowanceActor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "branchProtectionRule", + "description": "Identifies the branch protection rule associated with the allowed user or team.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "BranchProtectionRule", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "ReviewDismissalAllowanceActor", + "description": "Types that can be an actor.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Team", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "PushAllowanceConnection", + "description": "The connection type for PushAllowance.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PushAllowanceEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PushAllowance", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PushAllowanceEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PushAllowance", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PushAllowance", + "description": "A team or user who has the ability to push to a protected branch.", + "fields": [ + { + "name": "actor", + "description": "The actor that can push.", + "args": [], + "type": { + "kind": "UNION", + "name": "PushAllowanceActor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "branchProtectionRule", + "description": "Identifies the branch protection rule associated with the allowed user or team.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "BranchProtectionRule", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "PushAllowanceActor", + "description": "Types that can be an actor.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Team", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "RefConnection", + "description": "The connection type for Ref.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RefEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RefEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "BranchProtectionRuleConflictConnection", + "description": "The connection type for BranchProtectionRuleConflict.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "BranchProtectionRuleConflictEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "BranchProtectionRuleConflict", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "BranchProtectionRuleConflictEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "BranchProtectionRuleConflict", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "BranchProtectionRuleConflict", + "description": "A conflict between two branch protection rules.", + "fields": [ + { + "name": "branchProtectionRule", + "description": "Identifies the branch protection rule.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "BranchProtectionRule", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "conflictingBranchProtectionRule", + "description": "Identifies the conflicting branch protection rule.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "BranchProtectionRule", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ref", + "description": "Identifies the branch ref that has conflicting rules", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Ref", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MilestoneConnection", + "description": "The connection type for Milestone.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "MilestoneEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Milestone", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MilestoneEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Milestone", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "MilestoneOrder", + "description": "Ordering options for milestone connections.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field to order milestones by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "MilestoneOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The ordering direction.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "MilestoneOrderField", + "description": "Properties by which milestone connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "DUE_DATE", + "description": "Order milestones by when they are due.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CREATED_AT", + "description": "Order milestones by when they were created.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UPDATED_AT", + "description": "Order milestones by when they were last updated.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NUMBER", + "description": "Order milestones by their number.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CodeOfConduct", + "description": "The Code of Conduct for a repository", + "fields": [ + { + "name": "body", + "description": "The body of the Code of Conduct", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "key", + "description": "The key for the Code of Conduct", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The formal name of the Code of Conduct", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this Code of Conduct", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this Code of Conduct", + "args": [], + "type": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RepositoryCollaboratorConnection", + "description": "The connection type for User.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "RepositoryCollaboratorEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RepositoryCollaboratorEdge", + "description": "Represents a user who is a collaborator of a repository.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "permission", + "description": "The permission the user has on the repository.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RepositoryPermission", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "permissionSources", + "description": "A list of sources for the user's access to the repository.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PermissionSource", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PermissionSource", + "description": "A level of permission and source for a user's access to a repository.", + "fields": [ + { + "name": "organization", + "description": "The organization the repository belongs to.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "permission", + "description": "The level of access this source has granted to the user.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "DefaultRepositoryPermissionField", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "source", + "description": "The source of this permission.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "UNION", + "name": "PermissionGranter", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "PermissionGranter", + "description": "Types that can grant permissions on a repository to a user", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Team", + "ofType": null + } + ] + }, + { + "kind": "INPUT_OBJECT", + "name": "LanguageOrder", + "description": "Ordering options for language connections.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field to order languages by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "LanguageOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The ordering direction.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "LanguageOrderField", + "description": "Properties by which language connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "SIZE", + "description": "Order languages by the size of all files containing the language", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "RefOrder", + "description": "Ways in which lists of git refs can be ordered upon return.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field in which to order refs by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "RefOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The direction in which to order refs by the specified field.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "RefOrderField", + "description": "Properties by which ref connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "TAG_COMMIT_DATE", + "description": "Order refs by underlying commit date if the ref prefix is refs/tags/", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ALPHABETICAL", + "description": "Order refs by their alphanumeric name", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SecurityAdvisory", + "description": "A GitHub Security Advisory", + "fields": [ + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": "This is a long plaintext description of the advisory", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ghsaId", + "description": "The GitHub Security Advisory ID", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "identifiers", + "description": "A list of identifiers for this advisory", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SecurityAdvisoryIdentifier", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "origin", + "description": "The organization that originated the advisory", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "publishedAt", + "description": "When the advisory was published", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "references", + "description": "A list of references for this advisory", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SecurityAdvisoryReference", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "severity", + "description": "The severity of the advisory", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "SecurityAdvisorySeverity", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "summary", + "description": "A short plaintext summary of the advisory", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "When the advisory was last updated", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "vulnerabilities", + "description": "Vulnerabilities associated with this Advisory", + "args": [ + { + "name": "orderBy", + "description": "Ordering options for the returned topics.", + "type": { + "kind": "INPUT_OBJECT", + "name": "SecurityVulnerabilityOrder", + "ofType": null + }, + "defaultValue": "{field:\"UPDATED_AT\",direction:\"DESC\"}" + }, + { + "name": "ecosystem", + "description": "An ecosystem to filter vulnerabilities by.", + "type": { + "kind": "ENUM", + "name": "SecurityAdvisoryEcosystem", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "package", + "description": "A package name to filter vulnerabilities by.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "severities", + "description": "A list of severities to filter vulnerabilities by.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "SecurityAdvisorySeverity", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SecurityVulnerabilityConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "withdrawnAt", + "description": "When the advisory was withdrawn, if it has been withdrawn", + "args": [], + "type": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "SecurityAdvisorySeverity", + "description": "Severity of the vulnerability.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "LOW", + "description": "Low.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MODERATE", + "description": "Moderate.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "HIGH", + "description": "High.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "CRITICAL", + "description": "Critical.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SecurityAdvisoryIdentifier", + "description": "A GitHub Security Advisory Identifier", + "fields": [ + { + "name": "type", + "description": "The identifier type, e.g. GHSA, CVE", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "value", + "description": "The identifier", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SecurityAdvisoryReference", + "description": "A GitHub Security Advisory Reference", + "fields": [ + { + "name": "url", + "description": "A publicly accessible reference", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SecurityVulnerabilityConnection", + "description": "The connection type for SecurityVulnerability.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SecurityVulnerabilityEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SecurityVulnerability", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SecurityVulnerabilityEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "SecurityVulnerability", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SecurityVulnerability", + "description": "An individual vulnerability within an Advisory", + "fields": [ + { + "name": "advisory", + "description": "The Advisory associated with this Vulnerability", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SecurityAdvisory", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "firstPatchedVersion", + "description": "The first version containing a fix for the vulnerability", + "args": [], + "type": { + "kind": "OBJECT", + "name": "SecurityAdvisoryPackageVersion", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "package", + "description": "A description of the vulnerable package", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SecurityAdvisoryPackage", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "severity", + "description": "The severity of the vulnerability within this package", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "SecurityAdvisorySeverity", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatedAt", + "description": "When the vulnerability was last updated", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "vulnerableVersionRange", + "description": "A string that describes the vulnerable package versions.\nThis string follows a basic syntax with a few forms.\n+ `= 0.2.0` denotes a single vulnerable version.\n+ `<= 1.0.8` denotes a version range up to and including the specified version\n+ `< 0.1.11` denotes a version range up to, but excluding, the specified version\n+ `>= 4.3.0, < 4.3.5` denotes a version range with a known minimum and maximum version.\n+ `>= 0.0.1` denotes a version range with a known minimum, but no known maximum\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SecurityAdvisoryPackage", + "description": "An individual package", + "fields": [ + { + "name": "ecosystem", + "description": "The ecosystem the package belongs to, e.g. RUBYGEMS, NPM", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "SecurityAdvisoryEcosystem", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The package name", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "SecurityAdvisoryEcosystem", + "description": "The possible ecosystems of a security vulnerability's package.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "RUBYGEMS", + "description": "Ruby gems hosted at RubyGems.org", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NPM", + "description": "JavaScript packages hosted at npmjs.com", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PIP", + "description": "Python packages hosted at PyPI.org", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MAVEN", + "description": "Java artifacts hosted at the Maven central repository", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NUGET", + "description": ".NET packages hosted at the NuGet Gallery", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SecurityAdvisoryPackageVersion", + "description": "An individual package version", + "fields": [ + { + "name": "identifier", + "description": "The package name or version", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "SecurityVulnerabilityOrder", + "description": "Ordering options for security vulnerability connections", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field to order security vulnerabilities by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "SecurityVulnerabilityOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The ordering direction.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "SecurityVulnerabilityOrderField", + "description": "Properties by which security vulnerability connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "UPDATED_AT", + "description": "Order vulnerability by update time", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "SCALAR", + "name": "GitSSHRemote", + "description": "Git SSH string", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TopicConnection", + "description": "The connection type for Topic.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TopicEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Topic", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TopicEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Topic", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ContributionsCollection", + "description": "A contributions collection aggregates contributions such as opened issues and commits created by a user.", + "fields": [ + { + "name": "commitContributionsByRepository", + "description": "Commit contributions made by the user, grouped by repository.", + "args": [ + { + "name": "maxRepositories", + "description": "How many repositories should be included.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "25" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CommitContributionsByRepository", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "contributionCalendar", + "description": "A calendar of this user's contributions on GitHub.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ContributionCalendar", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "contributionYears", + "description": "The years the user has been making contributions with the most recent year first.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "doesEndInCurrentMonth", + "description": "Determine if this collection's time span ends in the current month.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "earliestRestrictedContributionDate", + "description": "The date of the first restricted contribution the user made in this time period. Can only be non-null when the user has enabled private contribution counts.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "endedAt", + "description": "The ending date and time of this collection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "firstIssueContribution", + "description": "The first issue the user opened on GitHub. This will be null if that issue was opened outside the collection's time range and ignoreTimeRange is false. If the issue is not visible but the user has opted to show private contributions, a RestrictedContribution will be returned.", + "args": [ + { + "name": "ignoreTimeRange", + "description": "If true, the first issue will be returned even if it was opened outside of the collection's time range.\n\n**Upcoming Change on 2019-07-01 UTC**\n**Description:** `ignoreTimeRange` will be removed. Use a `ContributionsCollection` starting sufficiently far back\n**Reason:** ignore_time_range will be removed\n", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "UNION", + "name": "CreatedIssueOrRestrictedContribution", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "firstPullRequestContribution", + "description": "The first pull request the user opened on GitHub. This will be null if that pull request was opened outside the collection's time range and ignoreTimeRange is not true. If the pull request is not visible but the user has opted to show private contributions, a RestrictedContribution will be returned.", + "args": [ + { + "name": "ignoreTimeRange", + "description": "If true, the first pull request will be returned even if it was opened outside of the collection's time range.\n\n**Upcoming Change on 2019-07-01 UTC**\n**Description:** `ignoreTimeRange` will be removed. Use a `ContributionsCollection` starting sufficiently far back\n**Reason:** ignore_time_range will be removed\n", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "UNION", + "name": "CreatedPullRequestOrRestrictedContribution", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "firstRepositoryContribution", + "description": "The first repository the user created on GitHub. This will be null if that first repository was created outside the collection's time range and ignoreTimeRange is false. If the repository is not visible, then a RestrictedContribution is returned.", + "args": [ + { + "name": "ignoreTimeRange", + "description": "If true, the first repository will be returned even if it was opened outside of the collection's time range.\n\n**Upcoming Change on 2019-07-01 UTC**\n**Description:** `ignoreTimeRange` will be removed. Use a `ContributionsCollection` starting sufficiently far back\n**Reason:** ignore_time_range will be removed\n", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "UNION", + "name": "CreatedRepositoryOrRestrictedContribution", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasActivityInThePast", + "description": "Does the user have any more activity in the timeline that occurred prior to the collection's time range?", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasAnyContributions", + "description": "Determine if there are any contributions in this collection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hasAnyRestrictedContributions", + "description": "Determine if the user made any contributions in this time frame whose details are not visible because they were made in a private repository. Can only be true if the user enabled private contribution counts.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isSingleDay", + "description": "Whether or not the collector's time span is all within the same day.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issueContributions", + "description": "A list of issues the user opened.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "excludeFirst", + "description": "Should the user's first issue ever be excluded from the result.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "excludePopular", + "description": "Should the user's most commented issue be excluded from the result.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "orderBy", + "description": "Ordering options for contributions returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ContributionOrder", + "ofType": null + }, + "defaultValue": "{field:\"OCCURRED_AT\",direction:\"DESC\"}" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedIssueContributionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issueContributionsByRepository", + "description": "Issue contributions made by the user, grouped by repository.", + "args": [ + { + "name": "maxRepositories", + "description": "How many repositories should be included.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "25" + }, + { + "name": "excludeFirst", + "description": "Should the user's first issue ever be excluded from the result.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "excludePopular", + "description": "Should the user's most commented issue be excluded from the result.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "IssueContributionsByRepository", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "joinedGitHubContribution", + "description": "When the user signed up for GitHub. This will be null if that sign up date falls outside the collection's time range and ignoreTimeRange is false.", + "args": [ + { + "name": "ignoreTimeRange", + "description": "If true, the contribution will be returned even if the user signed up outside of the collection's time range.\n\n**Upcoming Change on 2019-07-01 UTC**\n**Description:** `ignoreTimeRange` will be removed. Use a `ContributionsCollection` starting sufficiently far back\n**Reason:** ignore_time_range will be removed\n", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "OBJECT", + "name": "JoinedGitHubContribution", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "latestRestrictedContributionDate", + "description": "The date of the most recent restricted contribution the user made in this time period. Can only be non-null when the user has enabled private contribution counts.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mostRecentCollectionWithActivity", + "description": "When this collection's time range does not include any activity from the user, use this\nto get a different collection from an earlier time range that does have activity.\n", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ContributionsCollection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mostRecentCollectionWithoutActivity", + "description": "Returns a different contributions collection from an earlier time range than this one\nthat does not have any contributions.\n", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ContributionsCollection", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "popularIssueContribution", + "description": "The issue the user opened on GitHub that received the most comments in the specified\ntime frame.\n", + "args": [], + "type": { + "kind": "OBJECT", + "name": "CreatedIssueContribution", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "popularPullRequestContribution", + "description": "The pull request the user opened on GitHub that received the most comments in the\nspecified time frame.\n", + "args": [], + "type": { + "kind": "OBJECT", + "name": "CreatedPullRequestContribution", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestContributions", + "description": "Pull request contributions made by the user.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "excludeFirst", + "description": "Should the user's first pull request ever be excluded from the result.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "excludePopular", + "description": "Should the user's most commented pull request be excluded from the result.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "orderBy", + "description": "Ordering options for contributions returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ContributionOrder", + "ofType": null + }, + "defaultValue": "{field:\"OCCURRED_AT\",direction:\"DESC\"}" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedPullRequestContributionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestContributionsByRepository", + "description": "Pull request contributions made by the user, grouped by repository.", + "args": [ + { + "name": "maxRepositories", + "description": "How many repositories should be included.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "25" + }, + { + "name": "excludeFirst", + "description": "Should the user's first pull request ever be excluded from the result.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "excludePopular", + "description": "Should the user's most commented pull request be excluded from the result.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestContributionsByRepository", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestReviewContributions", + "description": "Pull request review contributions made by the user.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for contributions returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ContributionOrder", + "ofType": null + }, + "defaultValue": "{field:\"OCCURRED_AT\",direction:\"DESC\"}" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedPullRequestReviewContributionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestReviewContributionsByRepository", + "description": "Pull request review contributions made by the user, grouped by repository.", + "args": [ + { + "name": "maxRepositories", + "description": "How many repositories should be included.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": "25" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestReviewContributionsByRepository", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repositoryContributions", + "description": "A list of repositories owned by the user that the user created in this time range.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "excludeFirst", + "description": "Should the user's first repository ever be excluded from the result.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "orderBy", + "description": "Ordering options for contributions returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ContributionOrder", + "ofType": null + }, + "defaultValue": "{field:\"OCCURRED_AT\",direction:\"DESC\"}" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedRepositoryContributionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "restrictedContributionsCount", + "description": "A count of contributions made by the user that the viewer cannot access. Only non-zero when the user has chosen to share their private contribution counts.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "startedAt", + "description": "The beginning date and time of this collection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCommitContributions", + "description": "How many commits were made by the user in this time span.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalIssueContributions", + "description": "How many issues the user opened.", + "args": [ + { + "name": "excludeFirst", + "description": "Should the user's first issue ever be excluded from this count.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "excludePopular", + "description": "Should the user's most commented issue be excluded from this count.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalPullRequestContributions", + "description": "How many pull requests the user opened.", + "args": [ + { + "name": "excludeFirst", + "description": "Should the user's first pull request ever be excluded from this count.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "excludePopular", + "description": "Should the user's most commented pull request be excluded from this count.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalPullRequestReviewContributions", + "description": "How many pull request reviews the user left.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalRepositoriesWithContributedCommits", + "description": "How many different repositories the user committed to.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalRepositoriesWithContributedIssues", + "description": "How many different repositories the user opened issues in.", + "args": [ + { + "name": "excludeFirst", + "description": "Should the user's first issue ever be excluded from this count.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "excludePopular", + "description": "Should the user's most commented issue be excluded from this count.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalRepositoriesWithContributedPullRequestReviews", + "description": "How many different repositories the user left pull request reviews in.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalRepositoriesWithContributedPullRequests", + "description": "How many different repositories the user opened pull requests in.", + "args": [ + { + "name": "excludeFirst", + "description": "Should the user's first pull request ever be excluded from this count.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "excludePopular", + "description": "Should the user's most commented pull request be excluded from this count.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalRepositoryContributions", + "description": "How many repositories the user created.", + "args": [ + { + "name": "excludeFirst", + "description": "Should the user's first repository ever be excluded from this count.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "The user who made the contributions in this collection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedIssueContributionConnection", + "description": "The connection type for CreatedIssueContribution.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedIssueContributionEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedIssueContribution", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedIssueContributionEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "CreatedIssueContribution", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedIssueContribution", + "description": "Represents the contribution a user made on GitHub by opening an issue.", + "fields": [ + { + "name": "isRestricted", + "description": "Whether this contribution is associated with a record you do not have access to. For\nexample, your own 'first issue' contribution may have been made on a repository you can no\nlonger access.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issue", + "description": "The issue that was opened.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "occurredAt", + "description": "When this contribution was made.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "The user who made this contribution.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Contribution", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INTERFACE", + "name": "Contribution", + "description": "Represents a contribution a user made on GitHub, such as opening an issue.", + "fields": [ + { + "name": "isRestricted", + "description": "Whether this contribution is associated with a record you do not have access to. For\nexample, your own 'first issue' contribution may have been made on a repository you can no\nlonger access.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "occurredAt", + "description": "When this contribution was made.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "The user who made this contribution.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "CreatedCommitContribution", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CreatedIssueContribution", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CreatedPullRequestContribution", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CreatedPullRequestReviewContribution", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "CreatedRepositoryContribution", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "JoinedGitHubContribution", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RestrictedContribution", + "ofType": null + } + ] + }, + { + "kind": "INPUT_OBJECT", + "name": "ContributionOrder", + "description": "Ordering options for contribution connections.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field by which to order contributions.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ContributionOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The ordering direction.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ContributionOrderField", + "description": "Properties by which contribution connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "OCCURRED_AT", + "description": "Order contributions by when they were made.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedRepositoryContributionConnection", + "description": "The connection type for CreatedRepositoryContribution.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedRepositoryContributionEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedRepositoryContribution", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedRepositoryContributionEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "CreatedRepositoryContribution", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedRepositoryContribution", + "description": "Represents the contribution a user made on GitHub by creating a repository.", + "fields": [ + { + "name": "isRestricted", + "description": "Whether this contribution is associated with a record you do not have access to. For\nexample, your own 'first issue' contribution may have been made on a repository you can no\nlonger access.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "occurredAt", + "description": "When this contribution was made.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository that was created.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "The user who made this contribution.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Contribution", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "JoinedGitHubContribution", + "description": "Represents a user signing up for a GitHub account.", + "fields": [ + { + "name": "isRestricted", + "description": "Whether this contribution is associated with a record you do not have access to. For\nexample, your own 'first issue' contribution may have been made on a repository you can no\nlonger access.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "occurredAt", + "description": "When this contribution was made.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "The user who made this contribution.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Contribution", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "CreatedRepositoryOrRestrictedContribution", + "description": "Represents either a repository the viewer can access or a restricted contribution.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "CreatedRepositoryContribution", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RestrictedContribution", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "RestrictedContribution", + "description": "Represents a private contribution a user made on GitHub.", + "fields": [ + { + "name": "isRestricted", + "description": "Whether this contribution is associated with a record you do not have access to. For\nexample, your own 'first issue' contribution may have been made on a repository you can no\nlonger access.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "occurredAt", + "description": "When this contribution was made.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "The user who made this contribution.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Contribution", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "CreatedIssueOrRestrictedContribution", + "description": "Represents either a issue the viewer can access or a restricted contribution.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "CreatedIssueContribution", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RestrictedContribution", + "ofType": null + } + ] + }, + { + "kind": "UNION", + "name": "CreatedPullRequestOrRestrictedContribution", + "description": "Represents either a pull request the viewer can access or a restricted contribution.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "CreatedPullRequestContribution", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "RestrictedContribution", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "CreatedPullRequestContribution", + "description": "Represents the contribution a user made on GitHub by opening a pull request.", + "fields": [ + { + "name": "isRestricted", + "description": "Whether this contribution is associated with a record you do not have access to. For\nexample, your own 'first issue' contribution may have been made on a repository you can no\nlonger access.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "occurredAt", + "description": "When this contribution was made.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "The pull request that was opened.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "The user who made this contribution.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Contribution", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ContributionCalendar", + "description": "A calendar of contributions made on GitHub by a user.", + "fields": [ + { + "name": "colors", + "description": "A list of hex color codes used in this calendar. The darker the color, the more contributions it represents.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isHalloween", + "description": "Determine if the color set was chosen because it's currently Halloween.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "months", + "description": "A list of the months of contributions in this calendar.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ContributionCalendarMonth", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalContributions", + "description": "The count of total contributions in the calendar.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "weeks", + "description": "A list of the weeks of contributions in this calendar.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ContributionCalendarWeek", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ContributionCalendarWeek", + "description": "A week of contributions in a user's contribution graph.", + "fields": [ + { + "name": "contributionDays", + "description": "The days of contributions in this week.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ContributionCalendarDay", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "firstDay", + "description": "The date of the earliest square in this week.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ContributionCalendarDay", + "description": "Represents a single day of contributions on GitHub by a user.", + "fields": [ + { + "name": "color", + "description": "The hex color code that represents how many contributions were made on this day compared to others in the calendar.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "contributionCount", + "description": "How many contributions were made by the user on this day.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "date", + "description": "The day this square represents.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "weekday", + "description": "A number representing which day of the week this square represents, e.g., 1 is Monday.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ContributionCalendarMonth", + "description": "A month of contributions in a user's contribution graph.", + "fields": [ + { + "name": "firstDay", + "description": "The date of the first day of this month.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Date", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The name of the month.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalWeeks", + "description": "How many weeks started in this month.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "year", + "description": "The year the month occurred in.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedPullRequestReviewContributionConnection", + "description": "The connection type for CreatedPullRequestReviewContribution.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedPullRequestReviewContributionEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedPullRequestReviewContribution", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedPullRequestReviewContributionEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "CreatedPullRequestReviewContribution", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedPullRequestReviewContribution", + "description": "Represents the contribution a user made by leaving a review on a pull request.", + "fields": [ + { + "name": "isRestricted", + "description": "Whether this contribution is associated with a record you do not have access to. For\nexample, your own 'first issue' contribution may have been made on a repository you can no\nlonger access.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "occurredAt", + "description": "When this contribution was made.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "The pull request the user reviewed.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestReview", + "description": "The review the user left on the pull request.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository containing the pull request that the user reviewed.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "The user who made this contribution.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Contribution", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestReviewContributionsByRepository", + "description": "This aggregates pull request reviews made by a user within one repository.", + "fields": [ + { + "name": "contributions", + "description": "The pull request review contributions.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for contributions returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ContributionOrder", + "ofType": null + }, + "defaultValue": "{field:\"OCCURRED_AT\",direction:\"DESC\"}" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedPullRequestReviewContributionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository in which the pull request reviews were made.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CommitContributionsByRepository", + "description": "This aggregates commits made by a user within one repository.", + "fields": [ + { + "name": "contributions", + "description": "The commit contributions, each representing a day.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for commit contributions returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "CommitContributionOrder", + "ofType": null + }, + "defaultValue": "{field:\"OCCURRED_AT\",direction:\"DESC\"}" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedCommitContributionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository in which the commits were made.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for the user's commits to the repository in this time range.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for the user's commits to the repository in this time range.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedCommitContributionConnection", + "description": "The connection type for CreatedCommitContribution.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedCommitContributionEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedCommitContribution", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of commits across days and repositories in the connection.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedCommitContributionEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "CreatedCommitContribution", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedCommitContribution", + "description": "Represents the contribution a user made by committing to a repository.", + "fields": [ + { + "name": "commitCount", + "description": "How many commits were made on this day to this repository by the user.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isRestricted", + "description": "Whether this contribution is associated with a record you do not have access to. For\nexample, your own 'first issue' contribution may have been made on a repository you can no\nlonger access.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "occurredAt", + "description": "When this contribution was made.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository the user made a commit in.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resourcePath", + "description": "The HTTP path for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "url", + "description": "The HTTP URL for this contribution.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "user", + "description": "The user who made this contribution.\n", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Contribution", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "CommitContributionOrder", + "description": "Ordering options for commit contribution connections.", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field by which to order commit contributions.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "CommitContributionOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The ordering direction.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "CommitContributionOrderField", + "description": "Properties by which commit contribution connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "OCCURRED_AT", + "description": "Order commit contributions by when they were made.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "COMMIT_COUNT", + "description": "Order commit contributions by how many commits they represent.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedPullRequestContributionConnection", + "description": "The connection type for CreatedPullRequestContribution.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedPullRequestContributionEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedPullRequestContribution", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatedPullRequestContributionEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "CreatedPullRequestContribution", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PullRequestContributionsByRepository", + "description": "This aggregates pull requests opened by a user within one repository.", + "fields": [ + { + "name": "contributions", + "description": "The pull request contributions.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for contributions returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ContributionOrder", + "ofType": null + }, + "defaultValue": "{field:\"OCCURRED_AT\",direction:\"DESC\"}" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedPullRequestContributionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository in which the pull requests were opened.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "IssueContributionsByRepository", + "description": "This aggregates issues opened by a user within one repository.", + "fields": [ + { + "name": "contributions", + "description": "The issue contributions.", + "args": [ + { + "name": "after", + "description": "Returns the elements in the list that come after the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "before", + "description": "Returns the elements in the list that come before the specified cursor.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "first", + "description": "Returns the first _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "last", + "description": "Returns the last _n_ elements from the list.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "orderBy", + "description": "Ordering options for contributions returned from the connection.", + "type": { + "kind": "INPUT_OBJECT", + "name": "ContributionOrder", + "ofType": null + }, + "defaultValue": "{field:\"OCCURRED_AT\",direction:\"DESC\"}" + } + ], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "CreatedIssueContributionConnection", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository in which the issues were opened.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "RepositoryContributionType", + "description": "The reason a repository is listed as 'contributed'.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "COMMIT", + "description": "Created a commit", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ISSUE", + "description": "Created an issue", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PULL_REQUEST", + "description": "Created a pull request", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REPOSITORY", + "description": "Created the repository", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PULL_REQUEST_REVIEW", + "description": "Reviewed a pull request", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PublicKeyConnection", + "description": "The connection type for PublicKey.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PublicKeyEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PublicKey", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "PublicKeyEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PublicKey", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "FollowingConnection", + "description": "The connection type for User.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "FollowerConnection", + "description": "The connection type for User.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "UserEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "StarredRepositoryConnection", + "description": "The connection type for Repository.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "StarredRepositoryEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "StarredRepositoryEdge", + "description": "Represents a starred repository.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "starredAt", + "description": "Identifies when the item was starred.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AppEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "App", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RateLimit", + "description": "Represents the client's rate limit.", + "fields": [ + { + "name": "cost", + "description": "The point cost for the current query counting against the rate limit.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "limit", + "description": "The maximum number of points the client is permitted to consume in a 60 minute window.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodeCount", + "description": "The maximum number of nodes this query may return", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "remaining", + "description": "The number of points remaining in the current rate limit window.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resetAt", + "description": "The time at which the current rate limit window resets in UTC epoch seconds.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "DateTime", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SearchResultItemConnection", + "description": "A list of results that matched against a search query.", + "fields": [ + { + "name": "codeCount", + "description": "The number of pieces of code that matched the search query.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SearchResultItemEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issueCount", + "description": "The number of issues that matched the search query.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "UNION", + "name": "SearchResultItem", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repositoryCount", + "description": "The number of repositories that matched the search query.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "userCount", + "description": "The number of users that matched the search query.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "wikiCount", + "description": "The number of wiki pages that matched the search query.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SearchResultItemEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "UNION", + "name": "SearchResultItem", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "textMatches", + "description": "Text matches on the result found.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TextMatch", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "SearchResultItem", + "description": "The results of a search.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "MarketplaceListing", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "TextMatch", + "description": "A text match within a search result.", + "fields": [ + { + "name": "fragment", + "description": "The specific text fragment within the property matched on.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "highlights", + "description": "Highlights within the matched fragment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "TextMatchHighlight", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "property", + "description": "The property matched on.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "TextMatchHighlight", + "description": "Represents a single highlight in a search result match.", + "fields": [ + { + "name": "beginIndice", + "description": "The indice in the fragment where the matched text begins.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "endIndice", + "description": "The indice in the fragment where the matched text ends.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "text", + "description": "The text matched.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "SearchType", + "description": "Represents the individual results of a search.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "ISSUE", + "description": "Returns results matching issues in repositories.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REPOSITORY", + "description": "Returns results matching repositories.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "USER", + "description": "Returns results matching users and organizations on GitHub.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "UNION", + "name": "CollectionItemContent", + "description": "Types that can be inside Collection Items.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": null, + "possibleTypes": [ + { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "Organization", + "ofType": null + }, + { + "kind": "OBJECT", + "name": "User", + "ofType": null + } + ] + }, + { + "kind": "OBJECT", + "name": "GitHubMetadata", + "description": "Represents information about the GitHub instance.", + "fields": [ + { + "name": "gitHubServicesSha", + "description": "Returns a String that's a SHA of `github-services`", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "gitIpAddresses", + "description": "IP addresses that users connect to for git operations", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "hookIpAddresses", + "description": "IP addresses that service hooks are sent from", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "importerIpAddresses", + "description": "IP addresses that the importer connects from", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isPasswordAuthenticationVerifiable", + "description": "Whether or not users are verified", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pagesIpAddresses", + "description": "IP addresses for GitHub Pages' A records", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SecurityAdvisoryConnection", + "description": "The connection type for SecurityAdvisory.", + "fields": [ + { + "name": "edges", + "description": "A list of edges.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SecurityAdvisoryEdge", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "nodes", + "description": "A list of nodes.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "SecurityAdvisory", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pageInfo", + "description": "Information to aid in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "PageInfo", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "totalCount", + "description": "Identifies the total count of items in the connection.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SecurityAdvisoryEdge", + "description": "An edge in a connection.", + "fields": [ + { + "name": "cursor", + "description": "A cursor for use in pagination.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "node", + "description": "The item at the end of the edge.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "SecurityAdvisory", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "SecurityAdvisoryOrder", + "description": "Ordering options for security advisory connections", + "fields": null, + "inputFields": [ + { + "name": "field", + "description": "The field to order security advisories by.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "SecurityAdvisoryOrderField", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "direction", + "description": "The ordering direction.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "OrderDirection", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "SecurityAdvisoryOrderField", + "description": "Properties by which security advisory connections can be ordered.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "PUBLISHED_AT", + "description": "Order advisories by publication time", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UPDATED_AT", + "description": "Order advisories by update time", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "SecurityAdvisoryIdentifierFilter", + "description": "An advisory identifier to filter results on.", + "fields": null, + "inputFields": [ + { + "name": "type", + "description": "The identifier type.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "SecurityAdvisoryIdentifierType", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "value", + "description": "The identifier string. Supports exact or partial matching.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "SecurityAdvisoryIdentifierType", + "description": "Identifier formats available for advisories.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "CVE", + "description": "Common Vulnerabilities and Exposures Identifier.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "GHSA", + "description": "GitHub Security Advisory ID.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Mutation", + "description": "The root query for implementing GraphQL mutations.", + "fields": [ + { + "name": "acceptTopicSuggestion", + "description": "Applies a suggested topic to the repository.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "AcceptTopicSuggestionInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "AcceptTopicSuggestionPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "addAssigneesToAssignable", + "description": "Adds assignees to an assignable object.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "AddAssigneesToAssignableInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "AddAssigneesToAssignablePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "addComment", + "description": "Adds a comment to an Issue or Pull Request.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "AddCommentInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "AddCommentPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "addLabelsToLabelable", + "description": "Adds labels to a labelable object.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "AddLabelsToLabelableInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "AddLabelsToLabelablePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "addProjectCard", + "description": "Adds a card to a ProjectColumn. Either `contentId` or `note` must be provided but **not** both.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "AddProjectCardInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "AddProjectCardPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "addProjectColumn", + "description": "Adds a column to a Project.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "AddProjectColumnInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "AddProjectColumnPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "addPullRequestReview", + "description": "Adds a review to a Pull Request.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "AddPullRequestReviewInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "AddPullRequestReviewPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "addPullRequestReviewComment", + "description": "Adds a comment to a review.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "AddPullRequestReviewCommentInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "AddPullRequestReviewCommentPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "addReaction", + "description": "Adds a reaction to a subject.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "AddReactionInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "AddReactionPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "addStar", + "description": "Adds a star to a Starrable.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "AddStarInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "AddStarPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "changeUserStatus", + "description": "Update your status on GitHub.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ChangeUserStatusInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "ChangeUserStatusPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "clearLabelsFromLabelable", + "description": "Clears all labels from a labelable object.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ClearLabelsFromLabelableInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "ClearLabelsFromLabelablePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "cloneProject", + "description": "Creates a new project by cloning configuration from an existing project.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "CloneProjectInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "CloneProjectPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closeIssue", + "description": "Close an issue.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "CloseIssueInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "CloseIssuePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "closePullRequest", + "description": "Close a pull request.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ClosePullRequestInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "ClosePullRequestPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "convertProjectCardNoteToIssue", + "description": "Convert a project note card to one associated with a newly created issue.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ConvertProjectCardNoteToIssueInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "ConvertProjectCardNoteToIssuePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createBranchProtectionRule", + "description": "Create a new branch protection rule", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "CreateBranchProtectionRuleInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "CreateBranchProtectionRulePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createIssue", + "description": "Creates a new issue.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "CreateIssueInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "CreateIssuePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createProject", + "description": "Creates a new project.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "CreateProjectInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "CreateProjectPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "createPullRequest", + "description": "Create a new pull request", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "CreatePullRequestInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "CreatePullRequestPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "declineTopicSuggestion", + "description": "Rejects a suggested topic for the repository.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DeclineTopicSuggestionInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DeclineTopicSuggestionPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deleteBranchProtectionRule", + "description": "Delete a branch protection rule", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DeleteBranchProtectionRuleInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DeleteBranchProtectionRulePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deleteIssue", + "description": "Deletes an Issue object.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DeleteIssueInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DeleteIssuePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deleteIssueComment", + "description": "Deletes an IssueComment object.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DeleteIssueCommentInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DeleteIssueCommentPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deleteProject", + "description": "Deletes a project.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DeleteProjectInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DeleteProjectPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deleteProjectCard", + "description": "Deletes a project card.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DeleteProjectCardInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DeleteProjectCardPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deleteProjectColumn", + "description": "Deletes a project column.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DeleteProjectColumnInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DeleteProjectColumnPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deletePullRequestReview", + "description": "Deletes a pull request review.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DeletePullRequestReviewInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DeletePullRequestReviewPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deletePullRequestReviewComment", + "description": "Deletes a pull request review comment.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DeletePullRequestReviewCommentInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DeletePullRequestReviewCommentPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "dismissPullRequestReview", + "description": "Dismisses an approved or rejected pull request review.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DismissPullRequestReviewInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "DismissPullRequestReviewPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lockLockable", + "description": "Lock a lockable object", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "LockLockableInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "LockLockablePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mergePullRequest", + "description": "Merge a pull request.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "MergePullRequestInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "MergePullRequestPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "moveProjectCard", + "description": "Moves a project card to another place.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "MoveProjectCardInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "MoveProjectCardPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "moveProjectColumn", + "description": "Moves a project column to another place.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "MoveProjectColumnInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "MoveProjectColumnPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "removeAssigneesFromAssignable", + "description": "Removes assignees from an assignable object.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "RemoveAssigneesFromAssignableInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "RemoveAssigneesFromAssignablePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "removeLabelsFromLabelable", + "description": "Removes labels from a Labelable object.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "RemoveLabelsFromLabelableInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "RemoveLabelsFromLabelablePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "removeOutsideCollaborator", + "description": "Removes outside collaborator from all repositories in an organization.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "RemoveOutsideCollaboratorInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "RemoveOutsideCollaboratorPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "removeReaction", + "description": "Removes a reaction from a subject.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "RemoveReactionInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "RemoveReactionPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "removeStar", + "description": "Removes a star from a Starrable.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "RemoveStarInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "RemoveStarPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reopenIssue", + "description": "Reopen a issue.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ReopenIssueInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "ReopenIssuePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reopenPullRequest", + "description": "Reopen a pull request.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ReopenPullRequestInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "ReopenPullRequestPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requestReviews", + "description": "Set review requests on a pull request.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "RequestReviewsInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "RequestReviewsPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "resolveReviewThread", + "description": "Marks a review thread as resolved.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ResolveReviewThreadInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "ResolveReviewThreadPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "submitPullRequestReview", + "description": "Submits a pending pull request review.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "SubmitPullRequestReviewInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "SubmitPullRequestReviewPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "unlockLockable", + "description": "Unlock a lockable object", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UnlockLockableInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UnlockLockablePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "unmarkIssueAsDuplicate", + "description": "Unmark an issue as a duplicate of another issue.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UnmarkIssueAsDuplicateInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UnmarkIssueAsDuplicatePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "unresolveReviewThread", + "description": "Marks a review thread as unresolved.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UnresolveReviewThreadInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UnresolveReviewThreadPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updateBranchProtectionRule", + "description": "Create a new branch protection rule", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UpdateBranchProtectionRuleInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UpdateBranchProtectionRulePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updateIssue", + "description": "Updates an Issue.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UpdateIssueInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UpdateIssuePayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updateIssueComment", + "description": "Updates an IssueComment object.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UpdateIssueCommentInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UpdateIssueCommentPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updateProject", + "description": "Updates an existing project.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UpdateProjectInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UpdateProjectPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updateProjectCard", + "description": "Updates an existing project card.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UpdateProjectCardInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UpdateProjectCardPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updateProjectColumn", + "description": "Updates an existing project column.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UpdateProjectColumnInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UpdateProjectColumnPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatePullRequest", + "description": "Update a pull request", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UpdatePullRequestInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UpdatePullRequestPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatePullRequestReview", + "description": "Updates the body of a pull request review.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UpdatePullRequestReviewInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UpdatePullRequestReviewPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updatePullRequestReviewComment", + "description": "Updates a pull request review comment.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UpdatePullRequestReviewCommentInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UpdatePullRequestReviewCommentPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updateSubscription", + "description": "Updates the state for subscribable subjects.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UpdateSubscriptionInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UpdateSubscriptionPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "updateTopics", + "description": "Replaces the repository's topics with the given topics.", + "args": [ + { + "name": "input", + "description": null, + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "UpdateTopicsInput", + "ofType": null + } + }, + "defaultValue": null + } + ], + "type": { + "kind": "OBJECT", + "name": "UpdateTopicsPayload", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AddReactionPayload", + "description": "Autogenerated return type of AddReaction", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reaction", + "description": "The reaction object.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Reaction", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subject", + "description": "The reactable subject.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Reactable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "AddReactionInput", + "description": "Autogenerated input type of AddReaction", + "fields": null, + "inputFields": [ + { + "name": "subjectId", + "description": "The Node ID of the subject to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "content", + "description": "The name of the emoji to react with.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ReactionContent", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RemoveReactionPayload", + "description": "Autogenerated return type of RemoveReaction", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reaction", + "description": "The reaction object.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Reaction", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subject", + "description": "The reactable subject.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Reactable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "RemoveReactionInput", + "description": "Autogenerated input type of RemoveReaction", + "fields": null, + "inputFields": [ + { + "name": "subjectId", + "description": "The Node ID of the subject to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "content", + "description": "The name of the emoji reaction to remove.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ReactionContent", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UpdateSubscriptionPayload", + "description": "Autogenerated return type of UpdateSubscription", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscribable", + "description": "The input subscribable entity.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Subscribable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UpdateSubscriptionInput", + "description": "Autogenerated input type of UpdateSubscription", + "fields": null, + "inputFields": [ + { + "name": "subscribableId", + "description": "The Node ID of the subscribable object to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "state", + "description": "The new state of the subscription.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "SubscriptionState", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AddCommentPayload", + "description": "Autogenerated return type of AddComment", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commentEdge", + "description": "The edge from the subject's comment connection.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "IssueCommentEdge", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subject", + "description": "The subject", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "timelineEdge", + "description": "The edge from the subject's timeline connection.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "IssueTimelineItemEdge", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "AddCommentInput", + "description": "Autogenerated input type of AddComment", + "fields": null, + "inputFields": [ + { + "name": "subjectId", + "description": "The Node ID of the subject to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The contents of the comment.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "MinimizeCommentInput", + "description": "Autogenerated input type of MinimizeComment", + "fields": null, + "inputFields": [ + { + "name": "subjectId", + "description": "The Node ID of the subject to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "classifier", + "description": "The classification of comment", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "ReportedContentClassifiers", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "ReportedContentClassifiers", + "description": "The reasons a piece of content can be reported or minimized.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "SPAM", + "description": "A spammy piece of content", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ABUSE", + "description": "An abusive or harassing piece of content", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OFF_TOPIC", + "description": "An irrelevant piece of content", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OUTDATED", + "description": "An outdated piece of content", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "RESOLVED", + "description": "The content has been resolved", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UnminimizeCommentInput", + "description": "Autogenerated input type of UnminimizeComment", + "fields": null, + "inputFields": [ + { + "name": "subjectId", + "description": "The Node ID of the subject to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UpdateIssueCommentPayload", + "description": "Autogenerated return type of UpdateIssueComment", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issueComment", + "description": "The updated comment.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "IssueComment", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UpdateIssueCommentInput", + "description": "Autogenerated input type of UpdateIssueComment", + "fields": null, + "inputFields": [ + { + "name": "id", + "description": "The ID of the IssueComment to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The updated text of the comment.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreateProjectPayload", + "description": "Autogenerated return type of CreateProject", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "project", + "description": "The new project.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "CreateProjectInput", + "description": "Autogenerated input type of CreateProject", + "fields": null, + "inputFields": [ + { + "name": "ownerId", + "description": "The owner ID to create the project under.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "name", + "description": "The name of project.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The description of project.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UpdateProjectPayload", + "description": "Autogenerated return type of UpdateProject", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "project", + "description": "The updated project.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UpdateProjectInput", + "description": "Autogenerated input type of UpdateProject", + "fields": null, + "inputFields": [ + { + "name": "projectId", + "description": "The Project ID to update.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "name", + "description": "The name of project.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The description of project.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "state", + "description": "Whether the project is open or closed.", + "type": { + "kind": "ENUM", + "name": "ProjectState", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "public", + "description": "Whether the project is public or not.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeleteProjectPayload", + "description": "Autogenerated return type of DeleteProject", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "owner", + "description": "The repository or organization the project was removed from.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "ProjectOwner", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DeleteProjectInput", + "description": "Autogenerated input type of DeleteProject", + "fields": null, + "inputFields": [ + { + "name": "projectId", + "description": "The Project ID to update.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CloneProjectPayload", + "description": "Autogenerated return type of CloneProject", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "jobStatusId", + "description": "The id of the JobStatus for populating cloned fields.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "project", + "description": "The new cloned project.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "CloneProjectInput", + "description": "Autogenerated input type of CloneProject", + "fields": null, + "inputFields": [ + { + "name": "targetOwnerId", + "description": "The owner ID to create the project under.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "sourceId", + "description": "The source project to clone.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "includeWorkflows", + "description": "Whether or not to clone the source project's workflows.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "name", + "description": "The name of the project.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The description of the project.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "public", + "description": "The visibility of the project, defaults to false (private).", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ImportProjectInput", + "description": "Autogenerated input type of ImportProject", + "fields": null, + "inputFields": [ + { + "name": "ownerName", + "description": "The name of the Organization or User to create the Project under.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "name", + "description": "The name of Project.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The description of Project.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "public", + "description": "Whether the Project is public or not.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "columnImports", + "description": "A list of columns containing issues and pull requests.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ProjectColumnImport", + "ofType": null + } + } + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ProjectColumnImport", + "description": "A project column and a list of its issues and PRs.", + "fields": null, + "inputFields": [ + { + "name": "columnName", + "description": "The name of the column.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "position", + "description": "The position of the column, starting from 0.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "issues", + "description": "A list of issues and pull requests in the column.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "ProjectCardImport", + "ofType": null + } + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ProjectCardImport", + "description": "An issue or PR and its owning repository to be used in a project card.", + "fields": null, + "inputFields": [ + { + "name": "repository", + "description": "Repository name with owner (owner/repository).", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "number", + "description": "The issue or pull request number.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AddProjectColumnPayload", + "description": "Autogenerated return type of AddProjectColumn", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "columnEdge", + "description": "The edge from the project's column connection.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectColumnEdge", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "project", + "description": "The project", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "AddProjectColumnInput", + "description": "Autogenerated input type of AddProjectColumn", + "fields": null, + "inputFields": [ + { + "name": "projectId", + "description": "The Node ID of the project.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "name", + "description": "The name of the column.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MoveProjectColumnPayload", + "description": "Autogenerated return type of MoveProjectColumn", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "columnEdge", + "description": "The new edge of the moved column.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectColumnEdge", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "MoveProjectColumnInput", + "description": "Autogenerated input type of MoveProjectColumn", + "fields": null, + "inputFields": [ + { + "name": "columnId", + "description": "The id of the column to move.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "afterColumnId", + "description": "Place the new column after the column with this id. Pass null to place it at the front.", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UpdateProjectColumnPayload", + "description": "Autogenerated return type of UpdateProjectColumn", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectColumn", + "description": "The updated project column.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectColumn", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UpdateProjectColumnInput", + "description": "Autogenerated input type of UpdateProjectColumn", + "fields": null, + "inputFields": [ + { + "name": "projectColumnId", + "description": "The ProjectColumn ID to update.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "name", + "description": "The name of project column.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeleteProjectColumnPayload", + "description": "Autogenerated return type of DeleteProjectColumn", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deletedColumnId", + "description": "The deleted column ID.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "project", + "description": "The project the deleted column was in.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Project", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DeleteProjectColumnInput", + "description": "Autogenerated input type of DeleteProjectColumn", + "fields": null, + "inputFields": [ + { + "name": "columnId", + "description": "The id of the column to delete.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AddProjectCardPayload", + "description": "Autogenerated return type of AddProjectCard", + "fields": [ + { + "name": "cardEdge", + "description": "The edge from the ProjectColumn's card connection.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectCardEdge", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectColumn", + "description": "The ProjectColumn", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectColumn", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "AddProjectCardInput", + "description": "Autogenerated input type of AddProjectCard", + "fields": null, + "inputFields": [ + { + "name": "projectColumnId", + "description": "The Node ID of the ProjectColumn.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "contentId", + "description": "The content of the card. Must be a member of the ProjectCardItem union", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "note", + "description": "The note on the card.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UpdateProjectCardPayload", + "description": "Autogenerated return type of UpdateProjectCard", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectCard", + "description": "The updated ProjectCard.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectCard", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UpdateProjectCardInput", + "description": "Autogenerated input type of UpdateProjectCard", + "fields": null, + "inputFields": [ + { + "name": "projectCardId", + "description": "The ProjectCard ID to update.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "isArchived", + "description": "Whether or not the ProjectCard should be archived", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "note", + "description": "The note of ProjectCard.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MoveProjectCardPayload", + "description": "Autogenerated return type of MoveProjectCard", + "fields": [ + { + "name": "cardEdge", + "description": "The new edge of the moved card.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectCardEdge", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "MoveProjectCardInput", + "description": "Autogenerated input type of MoveProjectCard", + "fields": null, + "inputFields": [ + { + "name": "cardId", + "description": "The id of the card to move.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "columnId", + "description": "The id of the column to move it into.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "afterCardId", + "description": "Place the new card after the card with this id. Pass null to place it at the top.", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeleteProjectCardPayload", + "description": "Autogenerated return type of DeleteProjectCard", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "column", + "description": "The column the deleted card was in.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectColumn", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deletedCardId", + "description": "The deleted card ID.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DeleteProjectCardInput", + "description": "Autogenerated input type of DeleteProjectCard", + "fields": null, + "inputFields": [ + { + "name": "cardId", + "description": "The id of the card to delete.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ConvertProjectCardNoteToIssuePayload", + "description": "Autogenerated return type of ConvertProjectCardNoteToIssue", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "projectCard", + "description": "The updated ProjectCard.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "ProjectCard", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ConvertProjectCardNoteToIssueInput", + "description": "Autogenerated input type of ConvertProjectCardNoteToIssue", + "fields": null, + "inputFields": [ + { + "name": "projectCardId", + "description": "The ProjectCard ID to convert.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "repositoryId", + "description": "The ID of the repository to create the issue in.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "title", + "description": "The title of the newly created issue. Defaults to the card's note text.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The body of the newly created issue.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UnmarkIssueAsDuplicatePayload", + "description": "Autogenerated return type of UnmarkIssueAsDuplicate", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "duplicate", + "description": "The issue or pull request that was marked as a duplicate.", + "args": [], + "type": { + "kind": "UNION", + "name": "IssueOrPullRequest", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UnmarkIssueAsDuplicateInput", + "description": "Autogenerated input type of UnmarkIssueAsDuplicate", + "fields": null, + "inputFields": [ + { + "name": "duplicateId", + "description": "ID of the issue or pull request currently marked as a duplicate.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "canonicalId", + "description": "ID of the issue or pull request currently considered canonical/authoritative/original.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "LockLockablePayload", + "description": "Autogenerated return type of LockLockable", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "lockedRecord", + "description": "The item that was locked.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Lockable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "LockLockableInput", + "description": "Autogenerated input type of LockLockable", + "fields": null, + "inputFields": [ + { + "name": "lockableId", + "description": "ID of the issue or pull request to be locked.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "lockReason", + "description": "A reason for why the issue or pull request will be locked.", + "type": { + "kind": "ENUM", + "name": "LockReason", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UnlockLockablePayload", + "description": "Autogenerated return type of UnlockLockable", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "unlockedRecord", + "description": "The item that was unlocked.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Lockable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UnlockLockableInput", + "description": "Autogenerated input type of UnlockLockable", + "fields": null, + "inputFields": [ + { + "name": "lockableId", + "description": "ID of the issue or pull request to be unlocked.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AddAssigneesToAssignablePayload", + "description": "Autogenerated return type of AddAssigneesToAssignable", + "fields": [ + { + "name": "assignable", + "description": "The item that was assigned.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Assignable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "AddAssigneesToAssignableInput", + "description": "Autogenerated input type of AddAssigneesToAssignable", + "fields": null, + "inputFields": [ + { + "name": "assignableId", + "description": "The id of the assignable object to add assignees to.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "assigneeIds", + "description": "The id of users to add as assignees.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RemoveAssigneesFromAssignablePayload", + "description": "Autogenerated return type of RemoveAssigneesFromAssignable", + "fields": [ + { + "name": "assignable", + "description": "The item that was unassigned.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Assignable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "RemoveAssigneesFromAssignableInput", + "description": "Autogenerated input type of RemoveAssigneesFromAssignable", + "fields": null, + "inputFields": [ + { + "name": "assignableId", + "description": "The id of the assignable object to remove assignees from.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "assigneeIds", + "description": "The id of users to remove as assignees.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AddLabelsToLabelablePayload", + "description": "Autogenerated return type of AddLabelsToLabelable", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "labelable", + "description": "The item that was labeled.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Labelable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "AddLabelsToLabelableInput", + "description": "Autogenerated input type of AddLabelsToLabelable", + "fields": null, + "inputFields": [ + { + "name": "labelableId", + "description": "The id of the labelable object to add labels to.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "labelIds", + "description": "The ids of the labels to add.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreateIssuePayload", + "description": "Autogenerated return type of CreateIssue", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issue", + "description": "The new issue.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "CreateIssueInput", + "description": "Autogenerated input type of CreateIssue", + "fields": null, + "inputFields": [ + { + "name": "repositoryId", + "description": "The Node ID of the repository.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "title", + "description": "The title for the issue.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The body for the issue description.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "assigneeIds", + "description": "The Node ID for the user assignee for this issue.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "milestoneId", + "description": "The Node ID of the milestone for this issue.", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "labelIds", + "description": "An array of Node IDs of labels for this issue.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "projectIds", + "description": "An array of Node IDs for projects associated with this issue.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ClearLabelsFromLabelablePayload", + "description": "Autogenerated return type of ClearLabelsFromLabelable", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "labelable", + "description": "The item that was unlabeled.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Labelable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ClearLabelsFromLabelableInput", + "description": "Autogenerated input type of ClearLabelsFromLabelable", + "fields": null, + "inputFields": [ + { + "name": "labelableId", + "description": "The id of the labelable object to clear the labels from.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RemoveLabelsFromLabelablePayload", + "description": "Autogenerated return type of RemoveLabelsFromLabelable", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "labelable", + "description": "The Labelable the labels were removed from.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Labelable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "RemoveLabelsFromLabelableInput", + "description": "Autogenerated input type of RemoveLabelsFromLabelable", + "fields": null, + "inputFields": [ + { + "name": "labelableId", + "description": "The id of the Labelable to remove labels from.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "labelIds", + "description": "The ids of labels to remove.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CloseIssuePayload", + "description": "Autogenerated return type of CloseIssue", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issue", + "description": "The issue that was closed.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "CloseIssueInput", + "description": "Autogenerated input type of CloseIssue", + "fields": null, + "inputFields": [ + { + "name": "issueId", + "description": "ID of the issue to be closed.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReopenIssuePayload", + "description": "Autogenerated return type of ReopenIssue", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issue", + "description": "The issue that was opened.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ReopenIssueInput", + "description": "Autogenerated input type of ReopenIssue", + "fields": null, + "inputFields": [ + { + "name": "issueId", + "description": "ID of the issue to be opened.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeleteIssueCommentPayload", + "description": "Autogenerated return type of DeleteIssueComment", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DeleteIssueCommentInput", + "description": "Autogenerated input type of DeleteIssueComment", + "fields": null, + "inputFields": [ + { + "name": "id", + "description": "The ID of the comment to delete.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UpdateIssuePayload", + "description": "Autogenerated return type of UpdateIssue", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "issue", + "description": "The issue.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Issue", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UpdateIssueInput", + "description": "Autogenerated input type of UpdateIssue", + "fields": null, + "inputFields": [ + { + "name": "id", + "description": "The ID of the Issue to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "title", + "description": "The title for the issue.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The body for the issue description.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "assigneeIds", + "description": "An array of Node IDs of users for this issue.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "milestoneId", + "description": "The Node ID of the milestone for this issue.", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "labelIds", + "description": "An array of Node IDs of labels for this issue.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "state", + "description": "The desired issue state.", + "type": { + "kind": "ENUM", + "name": "IssueState", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "projectIds", + "description": "An array of Node IDs for projects associated with this issue.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeleteIssuePayload", + "description": "Autogenerated return type of DeleteIssue", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The repository the issue belonged to", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DeleteIssueInput", + "description": "Autogenerated input type of DeleteIssue", + "fields": null, + "inputFields": [ + { + "name": "issueId", + "description": "The ID of the issue to delete.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "PinIssueInput", + "description": "Autogenerated input type of PinIssue", + "fields": null, + "inputFields": [ + { + "name": "issueId", + "description": "The ID of the issue to be pinned", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UnpinIssueInput", + "description": "Autogenerated input type of UnpinIssue", + "fields": null, + "inputFields": [ + { + "name": "issueId", + "description": "The ID of the issue to be unpinned", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreatePullRequestPayload", + "description": "Autogenerated return type of CreatePullRequest", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "The new pull request.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "CreatePullRequestInput", + "description": "Autogenerated input type of CreatePullRequest", + "fields": null, + "inputFields": [ + { + "name": "repositoryId", + "description": "The Node ID of the repository.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "baseRefName", + "description": "The name of the branch you want your changes pulled into. This should be an existing branch\non the current repository. You cannot update the base branch on a pull request to point\nto another repository.\n", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "headRefName", + "description": "The name of the branch where your changes are implemented. For cross-repository pull requests\nin the same network, namespace `head_ref_name` with a user like this: `username:branch`.\n", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "title", + "description": "The title of the pull request.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The contents of the pull request.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "maintainerCanModify", + "description": "Indicates whether maintainers can modify the pull request.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "true" + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UpdatePullRequestPayload", + "description": "Autogenerated return type of UpdatePullRequest", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "The updated pull request.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UpdatePullRequestInput", + "description": "Autogenerated input type of UpdatePullRequest", + "fields": null, + "inputFields": [ + { + "name": "pullRequestId", + "description": "The Node ID of the pull request.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "baseRefName", + "description": "The name of the branch you want your changes pulled into. This should be an existing branch\non the current repository.\n", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "title", + "description": "The title of the pull request.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The contents of the pull request.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "maintainerCanModify", + "description": "Indicates whether maintainers can modify the pull request.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ClosePullRequestPayload", + "description": "Autogenerated return type of ClosePullRequest", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "The pull request that was closed.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ClosePullRequestInput", + "description": "Autogenerated input type of ClosePullRequest", + "fields": null, + "inputFields": [ + { + "name": "pullRequestId", + "description": "ID of the pull request to be closed.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ReopenPullRequestPayload", + "description": "Autogenerated return type of ReopenPullRequest", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "The pull request that was reopened.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ReopenPullRequestInput", + "description": "Autogenerated input type of ReopenPullRequest", + "fields": null, + "inputFields": [ + { + "name": "pullRequestId", + "description": "ID of the pull request to be reopened.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "MergePullRequestPayload", + "description": "Autogenerated return type of MergePullRequest", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "The pull request that was merged.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "MergePullRequestInput", + "description": "Autogenerated input type of MergePullRequest", + "fields": null, + "inputFields": [ + { + "name": "pullRequestId", + "description": "ID of the pull request to be merged.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "commitHeadline", + "description": "Commit headline to use for the merge commit; if omitted, a default message will be used.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "commitBody", + "description": "Commit body to use for the merge commit; if omitted, a default message will be used", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "expectedHeadOid", + "description": "OID that the pull request head ref must match to allow merge; if omitted, no check is performed.", + "type": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeletePullRequestReviewCommentPayload", + "description": "Autogenerated return type of DeletePullRequestReviewComment", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestReview", + "description": "The pull request review the deleted comment belonged to.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DeletePullRequestReviewCommentInput", + "description": "Autogenerated input type of DeletePullRequestReviewComment", + "fields": null, + "inputFields": [ + { + "name": "id", + "description": "The ID of the comment to delete.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AddPullRequestReviewPayload", + "description": "Autogenerated return type of AddPullRequestReview", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestReview", + "description": "The newly created pull request review.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reviewEdge", + "description": "The edge from the pull request's review connection.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReviewEdge", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "AddPullRequestReviewInput", + "description": "Autogenerated input type of AddPullRequestReview", + "fields": null, + "inputFields": [ + { + "name": "pullRequestId", + "description": "The Node ID of the pull request to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "commitOID", + "description": "The commit OID the review pertains to.", + "type": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The contents of the review body comment.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "event", + "description": "The event to perform on the pull request review.", + "type": { + "kind": "ENUM", + "name": "PullRequestReviewEvent", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "comments", + "description": "The review line comments.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "INPUT_OBJECT", + "name": "DraftPullRequestReviewComment", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "PullRequestReviewEvent", + "description": "The possible events to perform on a pull request review.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "COMMENT", + "description": "Submit general feedback without explicit approval.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "APPROVE", + "description": "Submit feedback and approve merging these changes.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "REQUEST_CHANGES", + "description": "Submit feedback that must be addressed before merging.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "DISMISS", + "description": "Dismiss review so it now longer effects merging.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DraftPullRequestReviewComment", + "description": "Specifies a review comment to be left with a Pull Request Review.", + "fields": null, + "inputFields": [ + { + "name": "path", + "description": "Path to the file being commented on.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "position", + "description": "Position in the file to leave a comment on.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "body", + "description": "Body of the comment to leave.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SubmitPullRequestReviewPayload", + "description": "Autogenerated return type of SubmitPullRequestReview", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestReview", + "description": "The submitted pull request review.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "SubmitPullRequestReviewInput", + "description": "Autogenerated input type of SubmitPullRequestReview", + "fields": null, + "inputFields": [ + { + "name": "pullRequestReviewId", + "description": "The Pull Request Review ID to submit.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "event", + "description": "The event to send to the Pull Request Review.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "PullRequestReviewEvent", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The text field to set on the Pull Request Review.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UpdatePullRequestReviewPayload", + "description": "Autogenerated return type of UpdatePullRequestReview", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestReview", + "description": "The updated pull request review.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UpdatePullRequestReviewInput", + "description": "Autogenerated input type of UpdatePullRequestReview", + "fields": null, + "inputFields": [ + { + "name": "pullRequestReviewId", + "description": "The Node ID of the pull request review to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The contents of the pull request review body.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DismissPullRequestReviewPayload", + "description": "Autogenerated return type of DismissPullRequestReview", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestReview", + "description": "The dismissed pull request review.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DismissPullRequestReviewInput", + "description": "Autogenerated input type of DismissPullRequestReview", + "fields": null, + "inputFields": [ + { + "name": "pullRequestReviewId", + "description": "The Node ID of the pull request review to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "message", + "description": "The contents of the pull request review dismissal message.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeletePullRequestReviewPayload", + "description": "Autogenerated return type of DeletePullRequestReview", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestReview", + "description": "The deleted pull request review.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReview", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DeletePullRequestReviewInput", + "description": "Autogenerated input type of DeletePullRequestReview", + "fields": null, + "inputFields": [ + { + "name": "pullRequestReviewId", + "description": "The Node ID of the pull request review to delete.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ResolveReviewThreadPayload", + "description": "Autogenerated return type of ResolveReviewThread", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "thread", + "description": "The thread to resolve.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReviewThread", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ResolveReviewThreadInput", + "description": "Autogenerated input type of ResolveReviewThread", + "fields": null, + "inputFields": [ + { + "name": "threadId", + "description": "The ID of the thread to resolve", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UnresolveReviewThreadPayload", + "description": "Autogenerated return type of UnresolveReviewThread", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "thread", + "description": "The thread to resolve.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReviewThread", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UnresolveReviewThreadInput", + "description": "Autogenerated input type of UnresolveReviewThread", + "fields": null, + "inputFields": [ + { + "name": "threadId", + "description": "The ID of the thread to unresolve", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AddPullRequestReviewCommentPayload", + "description": "Autogenerated return type of AddPullRequestReviewComment", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "comment", + "description": "The newly created comment.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commentEdge", + "description": "The edge from the review's comment connection.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReviewCommentEdge", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "AddPullRequestReviewCommentInput", + "description": "Autogenerated input type of AddPullRequestReviewComment", + "fields": null, + "inputFields": [ + { + "name": "pullRequestReviewId", + "description": "The Node ID of the review to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "commitOID", + "description": "The SHA of the commit to comment on.", + "type": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The text of the comment.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "path", + "description": "The relative path of the file to comment on.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "position", + "description": "The line index in the diff to comment on.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "inReplyTo", + "description": "The comment id to reply to.", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UpdatePullRequestReviewCommentPayload", + "description": "Autogenerated return type of UpdatePullRequestReviewComment", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequestReviewComment", + "description": "The updated comment.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequestReviewComment", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UpdatePullRequestReviewCommentInput", + "description": "Autogenerated input type of UpdatePullRequestReviewComment", + "fields": null, + "inputFields": [ + { + "name": "pullRequestReviewCommentId", + "description": "The Node ID of the comment to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The text of the comment.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RemoveOutsideCollaboratorPayload", + "description": "Autogenerated return type of RemoveOutsideCollaborator", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "removedUser", + "description": "The user that was removed as an outside collaborator.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "RemoveOutsideCollaboratorInput", + "description": "Autogenerated input type of RemoveOutsideCollaborator", + "fields": null, + "inputFields": [ + { + "name": "userId", + "description": "The ID of the outside collaborator to remove.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "organizationId", + "description": "The ID of the organization to remove the outside collaborator from.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RequestReviewsPayload", + "description": "Autogenerated return type of RequestReviews", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "pullRequest", + "description": "The pull request that is getting requests.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "PullRequest", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "requestedReviewersEdge", + "description": "The edge from the pull request to the requested reviewers.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "UserEdge", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "RequestReviewsInput", + "description": "Autogenerated input type of RequestReviews", + "fields": null, + "inputFields": [ + { + "name": "pullRequestId", + "description": "The Node ID of the pull request to modify.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "userIds", + "description": "The Node IDs of the user to request.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "teamIds", + "description": "The Node IDs of the team to request.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "union", + "description": "Add users to the set rather than replace.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AddStarPayload", + "description": "Autogenerated return type of AddStar", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "starrable", + "description": "The starrable.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Starrable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "AddStarInput", + "description": "Autogenerated input type of AddStar", + "fields": null, + "inputFields": [ + { + "name": "starrableId", + "description": "The Starrable ID to star.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "RemoveStarPayload", + "description": "Autogenerated return type of RemoveStar", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "starrable", + "description": "The starrable.", + "args": [], + "type": { + "kind": "INTERFACE", + "name": "Starrable", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "RemoveStarInput", + "description": "Autogenerated input type of RemoveStar", + "fields": null, + "inputFields": [ + { + "name": "starrableId", + "description": "The Starrable ID to unstar.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "AcceptTopicSuggestionPayload", + "description": "Autogenerated return type of AcceptTopicSuggestion", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "topic", + "description": "The accepted topic.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Topic", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "AcceptTopicSuggestionInput", + "description": "Autogenerated input type of AcceptTopicSuggestion", + "fields": null, + "inputFields": [ + { + "name": "repositoryId", + "description": "The Node ID of the repository.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "name", + "description": "The name of the suggested topic.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeclineTopicSuggestionPayload", + "description": "Autogenerated return type of DeclineTopicSuggestion", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "topic", + "description": "The declined topic.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Topic", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DeclineTopicSuggestionInput", + "description": "Autogenerated input type of DeclineTopicSuggestion", + "fields": null, + "inputFields": [ + { + "name": "repositoryId", + "description": "The Node ID of the repository.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "name", + "description": "The name of the suggested topic.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "reason", + "description": "The reason why the suggested topic is declined.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "TopicSuggestionDeclineReason", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "TopicSuggestionDeclineReason", + "description": "Reason that the suggested topic is declined.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "NOT_RELEVANT", + "description": "The suggested topic is not relevant to the repository.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "TOO_SPECIFIC", + "description": "The suggested topic is too specific for the repository (e.g. #ruby-on-rails-version-4-2-1).", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "PERSONAL_PREFERENCE", + "description": "The viewer does not like the suggested topic.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "TOO_GENERAL", + "description": "The suggested topic is too general for the repository.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UpdateTopicsPayload", + "description": "Autogenerated return type of UpdateTopics", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "invalidTopicNames", + "description": "Names of the provided topics that are not valid.", + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The updated repository.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UpdateTopicsInput", + "description": "Autogenerated input type of UpdateTopics", + "fields": null, + "inputFields": [ + { + "name": "repositoryId", + "description": "The Node ID of the repository.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "topicNames", + "description": "An array of topic names.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "CreateBranchProtectionRulePayload", + "description": "Autogenerated return type of CreateBranchProtectionRule", + "fields": [ + { + "name": "branchProtectionRule", + "description": "The newly created BranchProtectionRule.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "BranchProtectionRule", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "CreateBranchProtectionRuleInput", + "description": "Autogenerated input type of CreateBranchProtectionRule", + "fields": null, + "inputFields": [ + { + "name": "repositoryId", + "description": "The global relay id of the repository in which a new branch protection rule should be created in.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "pattern", + "description": "The glob-like pattern used to determine matching branches.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "requiresApprovingReviews", + "description": "Are approving reviews required to update matching branches.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "requiredApprovingReviewCount", + "description": "Number of approving reviews required to update matching branches.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "requiresCommitSignatures", + "description": "Are commits required to be signed.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "isAdminEnforced", + "description": "Can admins overwrite branch protection.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "requiresStatusChecks", + "description": "Are status checks required to update matching branches.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "requiresStrictStatusChecks", + "description": "Are branches required to be up to date before merging.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "requiresCodeOwnerReviews", + "description": "Are reviews from code owners required to update matching branches.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "dismissesStaleReviews", + "description": "Will new commits pushed to matching branches dismiss pull request review approvals.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "restrictsReviewDismissals", + "description": "Is dismissal of pull request reviews restricted.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "reviewDismissalActorIds", + "description": "A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "restrictsPushes", + "description": "Is pushing to matching branches restricted.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "pushActorIds", + "description": "A list of User or Team IDs allowed to push to matching branches.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "requiredStatusCheckContexts", + "description": "List of required status check contexts that must pass for commits to be accepted to matching branches.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UpdateBranchProtectionRulePayload", + "description": "Autogenerated return type of UpdateBranchProtectionRule", + "fields": [ + { + "name": "branchProtectionRule", + "description": "The newly created BranchProtectionRule.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "BranchProtectionRule", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "UpdateBranchProtectionRuleInput", + "description": "Autogenerated input type of UpdateBranchProtectionRule", + "fields": null, + "inputFields": [ + { + "name": "branchProtectionRuleId", + "description": "The global relay id of the branch protection rule to be updated.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "pattern", + "description": "The glob-like pattern used to determine matching branches.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "requiresApprovingReviews", + "description": "Are approving reviews required to update matching branches.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "requiredApprovingReviewCount", + "description": "Number of approving reviews required to update matching branches.", + "type": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "requiresCommitSignatures", + "description": "Are commits required to be signed.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "isAdminEnforced", + "description": "Can admins overwrite branch protection.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "requiresStatusChecks", + "description": "Are status checks required to update matching branches.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "requiresStrictStatusChecks", + "description": "Are branches required to be up to date before merging.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "requiresCodeOwnerReviews", + "description": "Are reviews from code owners required to update matching branches.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "dismissesStaleReviews", + "description": "Will new commits pushed to matching branches dismiss pull request review approvals.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "restrictsReviewDismissals", + "description": "Is dismissal of pull request reviews restricted.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "reviewDismissalActorIds", + "description": "A list of User or Team IDs allowed to dismiss reviews on pull requests targeting matching branches.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "restrictsPushes", + "description": "Is pushing to matching branches restricted.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "pushActorIds", + "description": "A list of User or Team IDs allowed to push to matching branches.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "requiredStatusCheckContexts", + "description": "List of required status check contexts that must pass for commits to be accepted to matching branches.", + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "DeleteBranchProtectionRulePayload", + "description": "Autogenerated return type of DeleteBranchProtectionRule", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "DeleteBranchProtectionRuleInput", + "description": "Autogenerated input type of DeleteBranchProtectionRule", + "fields": null, + "inputFields": [ + { + "name": "branchProtectionRuleId", + "description": "The global relay id of the branch protection rule to be deleted.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ChangeUserStatusPayload", + "description": "Autogenerated return type of ChangeUserStatus", + "fields": [ + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "status", + "description": "Your updated status.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "UserStatus", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "ChangeUserStatusInput", + "description": "Autogenerated input type of ChangeUserStatus", + "fields": null, + "inputFields": [ + { + "name": "emoji", + "description": "The emoji to represent your status. Can either be a native Unicode emoji or an emoji name with colons, e.g., :grinning:.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "message", + "description": "A short description of your current status.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "organizationId", + "description": "The ID of the organization whose members will be allowed to see the status. If omitted, the status will be publicly visible.", + "type": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + }, + "defaultValue": null + }, + { + "name": "limitedAvailability", + "description": "Whether this status should indicate you are not fully available on GitHub, e.g., you are away.", + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ContentAttachment", + "description": "A content attachment", + "fields": [ + { + "name": "body", + "description": "The body text of the content attachment. This parameter supports markdown.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "contentReference", + "description": "The content reference that the content attachment is attached to.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "ContentReference", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "title", + "description": "The title of the content attachment.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "ContentReference", + "description": "A content reference", + "fields": [ + { + "name": "databaseId", + "description": "Identifies the primary key from the database.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Int", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "reference", + "description": "The reference of the content reference.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "INPUT_OBJECT", + "name": "CreateContentAttachmentInput", + "description": "Autogenerated input type of CreateContentAttachment", + "fields": null, + "inputFields": [ + { + "name": "contentReferenceId", + "description": "The node ID of the content_reference.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "title", + "description": "The title of the content attachment.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "body", + "description": "The body of the content attachment, which may contain markdown.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "defaultValue": null + }, + { + "name": "clientMutationId", + "description": "A unique identifier for the client performing the mutation.", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": null + } + ], + "interfaces": null, + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Schema", + "description": "A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.", + "fields": [ + { + "name": "directives", + "description": "A list of all directives supported by this server.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Directive", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "mutationType", + "description": "If this server supports mutation, the type that mutation operations will be rooted at.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "queryType", + "description": "The type that query operations will be rooted at.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "subscriptionType", + "description": "If this server support subscription, the type that subscription operations will be rooted at.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "types", + "description": "A list of all types supported by this server.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Type", + "description": "The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name and description, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.", + "fields": [ + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "enumValues", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__EnumValue", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "fields", + "description": null, + "args": [ + { + "name": "includeDeprecated", + "description": null, + "type": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + }, + "defaultValue": "false" + } + ], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Field", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "inputFields", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__InputValue", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "interfaces", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "kind", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "__TypeKind", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ofType", + "description": null, + "args": [], + "type": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "possibleTypes", + "description": null, + "args": [], + "type": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Field", + "description": "Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.", + "fields": [ + { + "name": "args", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__InputValue", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__Directive", + "description": "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", + "fields": [ + { + "name": "args", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__InputValue", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "locations", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "LIST", + "name": null, + "ofType": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "__DirectiveLocation", + "ofType": null + } + } + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "onField", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": true, + "deprecationReason": "Use `locations`." + }, + { + "name": "onFragment", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": true, + "deprecationReason": "Use `locations`." + }, + { + "name": "onOperation", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": true, + "deprecationReason": "Use `locations`." + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__EnumValue", + "description": "One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.", + "fields": [ + { + "name": "deprecationReason", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isDeprecated", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "__InputValue", + "description": "Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.", + "fields": [ + { + "name": "defaultValue", + "description": "A GraphQL-formatted string representing the default value for this input value.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "description", + "description": null, + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "type", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "__Type", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "__TypeKind", + "description": "An enum describing what kind of type a given `__Type` is.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "SCALAR", + "description": "Indicates this type is a scalar.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "description": "Indicates this type is an object. `fields` and `interfaces` are valid fields.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "description": "Indicates this type is an interface. `fields` and `possibleTypes` are valid fields.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "description": "Indicates this type is a union. `possibleTypes` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "description": "Indicates this type is an enum. `enumValues` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "description": "Indicates this type is an input object. `inputFields` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "LIST", + "description": "Indicates this type is a list. `ofType` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "NON_NULL", + "description": "Indicates this type is a non-null. `ofType` is a valid field.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "ENUM", + "name": "__DirectiveLocation", + "description": "A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.", + "fields": null, + "inputFields": null, + "interfaces": null, + "enumValues": [ + { + "name": "QUERY", + "description": "Location adjacent to a query operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "MUTATION", + "description": "Location adjacent to a mutation operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SUBSCRIPTION", + "description": "Location adjacent to a subscription operation.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD", + "description": "Location adjacent to a field.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_DEFINITION", + "description": "Location adjacent to a fragment definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FRAGMENT_SPREAD", + "description": "Location adjacent to a fragment spread.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INLINE_FRAGMENT", + "description": "Location adjacent to an inline fragment.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCHEMA", + "description": "Location adjacent to a schema definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "SCALAR", + "description": "Location adjacent to a scalar definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "OBJECT", + "description": "Location adjacent to an object type definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "FIELD_DEFINITION", + "description": "Location adjacent to a field definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ARGUMENT_DEFINITION", + "description": "Location adjacent to an argument definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INTERFACE", + "description": "Location adjacent to an interface definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "UNION", + "description": "Location adjacent to a union definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM", + "description": "Location adjacent to an enum definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "ENUM_VALUE", + "description": "Location adjacent to an enum value definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_OBJECT", + "description": "Location adjacent to an input object type definition.", + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "INPUT_FIELD_DEFINITION", + "description": "Location adjacent to an input object field definition.", + "isDeprecated": false, + "deprecationReason": null + } + ], + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "GpgSignature", + "description": "Represents a GPG signature on a Commit or Tag.", + "fields": [ + { + "name": "email", + "description": "Email used to sign this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isValid", + "description": "True if the signature is valid and verified by GitHub.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "keyId", + "description": "Hex-encoded ID of the key that signed this object.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payload", + "description": "Payload for GPG signing object. Raw ODB object without the signature header.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signature", + "description": "ASCII-armored signature header from object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signer", + "description": "GitHub user corresponding to the email signing this commit.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "The state of this signature. `VALID` if signature is valid and verified by GitHub, otherwise represents reason why signature is considered invalid.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "GitSignatureState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "wasSignedByGitHub", + "description": "True if the signature was made with GitHub's signing key.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "GitSignature", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "SmimeSignature", + "description": "Represents an S/MIME signature on a Commit or Tag.", + "fields": [ + { + "name": "email", + "description": "Email used to sign this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isValid", + "description": "True if the signature is valid and verified by GitHub.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payload", + "description": "Payload for GPG signing object. Raw ODB object without the signature header.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signature", + "description": "ASCII-armored signature header from object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signer", + "description": "GitHub user corresponding to the email signing this commit.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "The state of this signature. `VALID` if signature is valid and verified by GitHub, otherwise represents reason why signature is considered invalid.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "GitSignatureState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "wasSignedByGitHub", + "description": "True if the signature was made with GitHub's signing key.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "GitSignature", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "Tag", + "description": "Represents a Git tag.", + "fields": [ + { + "name": "abbreviatedOid", + "description": "An abbreviated version of the Git object ID", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitResourcePath", + "description": "The HTTP path for this Git object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "commitUrl", + "description": "The HTTP URL for this Git object", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "URI", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "id", + "description": null, + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "ID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "message", + "description": "The Git tag message.", + "args": [], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "name", + "description": "The Git tag name.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "oid", + "description": "The Git object ID", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "GitObjectID", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "repository", + "description": "The Repository the Git object belongs to", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "OBJECT", + "name": "Repository", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "tagger", + "description": "Details about the tag author.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "GitActor", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "target", + "description": "The Git object the tag points to.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "INTERFACE", + "name": "GitObject", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "Node", + "ofType": null + }, + { + "kind": "INTERFACE", + "name": "GitObject", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + }, + { + "kind": "OBJECT", + "name": "UnknownSignature", + "description": "Represents an unknown signature on a Commit or Tag.", + "fields": [ + { + "name": "email", + "description": "Email used to sign this object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "isValid", + "description": "True if the signature is valid and verified by GitHub.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "payload", + "description": "Payload for GPG signing object. Raw ODB object without the signature header.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signature", + "description": "ASCII-armored signature header from object.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "String", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "signer", + "description": "GitHub user corresponding to the email signing this commit.", + "args": [], + "type": { + "kind": "OBJECT", + "name": "User", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "state", + "description": "The state of this signature. `VALID` if signature is valid and verified by GitHub, otherwise represents reason why signature is considered invalid.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "ENUM", + "name": "GitSignatureState", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + }, + { + "name": "wasSignedByGitHub", + "description": "True if the signature was made with GitHub's signing key.", + "args": [], + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "isDeprecated": false, + "deprecationReason": null + } + ], + "inputFields": null, + "interfaces": [ + { + "kind": "INTERFACE", + "name": "GitSignature", + "ofType": null + } + ], + "enumValues": null, + "possibleTypes": null + } + ], + "directives": [ + { + "name": "include", + "description": "Directs the executor to include this field or fragment only when the `if` argument is true.", + "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], + "args": [ + { + "name": "if", + "description": "Included when true.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": null + } + ] + }, + { + "name": "skip", + "description": "Directs the executor to skip this field or fragment when the `if` argument is true.", + "locations": ["FIELD", "FRAGMENT_SPREAD", "INLINE_FRAGMENT"], + "args": [ + { + "name": "if", + "description": "Skipped when true.", + "type": { + "kind": "NON_NULL", + "name": null, + "ofType": { + "kind": "SCALAR", + "name": "Boolean", + "ofType": null + } + }, + "defaultValue": null + } + ] + }, + { + "name": "deprecated", + "description": "Marks an element of a GraphQL schema as no longer supported.", + "locations": ["FIELD_DEFINITION", "ENUM_VALUE"], + "args": [ + { + "name": "reason", + "description": "Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted in [Markdown](https://daringfireball.net/projects/markdown/).", + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "defaultValue": "\"No longer supported\"" + } + ] + } + ] + } + } +} diff --git a/benchmark/introspectionFromSchema-benchmark.js b/benchmark/introspectionFromSchema-benchmark.js new file mode 100644 index 00000000..125ca9c3 --- /dev/null +++ b/benchmark/introspectionFromSchema-benchmark.js @@ -0,0 +1,21 @@ +'use strict'; + +const { parse } = require('graphql/language/parser.js'); +const { executeSync } = require('graphql/execution/execute.js'); +const { buildSchema } = require('graphql/utilities/buildASTSchema.js'); +const { + getIntrospectionQuery, +} = require('graphql/utilities/getIntrospectionQuery.js'); + +const { bigSchemaSDL } = require('./fixtures.js'); + +const schema = buildSchema(bigSchemaSDL, { assumeValid: true }); +const document = parse(getIntrospectionQuery()); + +module.exports = { + name: 'Execute Introspection Query', + count: 10, + measure() { + executeSync({ schema, document }); + }, +}; diff --git a/benchmark/parser-benchmark.js b/benchmark/parser-benchmark.js new file mode 100644 index 00000000..7f2e7931 --- /dev/null +++ b/benchmark/parser-benchmark.js @@ -0,0 +1,16 @@ +'use strict'; + +const { parse } = require('graphql/language/parser.js'); +const { + getIntrospectionQuery, +} = require('graphql/utilities/getIntrospectionQuery.js'); + +const introspectionQuery = getIntrospectionQuery(); + +module.exports = { + name: 'Parse introspection query', + count: 1000, + measure() { + parse(introspectionQuery); + }, +}; diff --git a/benchmark/validateGQL-benchmark.js b/benchmark/validateGQL-benchmark.js new file mode 100644 index 00000000..cc60a7ad --- /dev/null +++ b/benchmark/validateGQL-benchmark.js @@ -0,0 +1,21 @@ +'use strict'; + +const { parse } = require('graphql/language/parser.js'); +const { validate } = require('graphql/validation/validate.js'); +const { buildSchema } = require('graphql/utilities/buildASTSchema.js'); +const { + getIntrospectionQuery, +} = require('graphql/utilities/getIntrospectionQuery.js'); + +const { bigSchemaSDL } = require('./fixtures.js'); + +const schema = buildSchema(bigSchemaSDL, { assumeValid: true }); +const queryAST = parse(getIntrospectionQuery()); + +module.exports = { + name: 'Validate Introspection Query', + count: 50, + measure() { + validate(schema, queryAST); + }, +}; diff --git a/benchmark/validateInvalidGQL-benchmark.js b/benchmark/validateInvalidGQL-benchmark.js new file mode 100644 index 00000000..1e44b489 --- /dev/null +++ b/benchmark/validateInvalidGQL-benchmark.js @@ -0,0 +1,30 @@ +'use strict'; + +const { parse } = require('graphql/language/parser.js'); +const { validate } = require('graphql/validation/validate.js'); +const { buildSchema } = require('graphql/utilities/buildASTSchema.js'); + +const { bigSchemaSDL } = require('./fixtures.js'); + +const schema = buildSchema(bigSchemaSDL, { assumeValid: true }); +const queryAST = parse(` + { + unknownField + ... on unknownType { + anotherUnknownField + ...unknownFragment + } + } + + fragment TestFragment on anotherUnknownType { + yetAnotherUnknownField + } +`); + +module.exports = { + name: 'Validate Invalid Query', + count: 50, + measure() { + validate(schema, queryAST); + }, +}; diff --git a/benchmark/validateSDL-benchmark.js b/benchmark/validateSDL-benchmark.js new file mode 100644 index 00000000..93c80bbc --- /dev/null +++ b/benchmark/validateSDL-benchmark.js @@ -0,0 +1,16 @@ +'use strict'; + +const { parse } = require('graphql/language/parser.js'); +const { validateSDL } = require('graphql/validation/validate.js'); + +const { bigSchemaSDL } = require('./fixtures.js'); + +const sdlAST = parse(bigSchemaSDL); + +module.exports = { + name: 'Validate SDL Document', + count: 10, + measure() { + validateSDL(sdlAST); + }, +}; diff --git a/benchmark/visit-benchmark.js b/benchmark/visit-benchmark.js new file mode 100644 index 00000000..ab6a2baa --- /dev/null +++ b/benchmark/visit-benchmark.js @@ -0,0 +1,25 @@ +'use strict'; + +const { parse } = require('graphql/language/parser.js'); +const { visit } = require('graphql/language/visitor.js'); + +const { bigSchemaSDL } = require('./fixtures.js'); + +const documentAST = parse(bigSchemaSDL); + +const visitor = { + enter() { + /* do nothing */ + }, + leave() { + /* do nothing */ + }, +}; + +module.exports = { + name: 'Visit all AST nodes', + count: 10, + measure() { + visit(documentAST, visitor); + }, +}; diff --git a/benchmark/visitInParallel-benchmark.js b/benchmark/visitInParallel-benchmark.js new file mode 100644 index 00000000..cd835dd1 --- /dev/null +++ b/benchmark/visitInParallel-benchmark.js @@ -0,0 +1,25 @@ +'use strict'; + +const { parse } = require('graphql/language/parser.js'); +const { visit, visitInParallel } = require('graphql/language/visitor.js'); + +const { bigSchemaSDL } = require('./fixtures.js'); + +const documentAST = parse(bigSchemaSDL); + +const visitors = new Array(50).fill({ + enter() { + /* do nothing */ + }, + leave() { + /* do nothing */ + }, +}); + +module.exports = { + name: 'Visit all AST nodes in parallel', + count: 10, + measure() { + visit(documentAST, visitInParallel(visitors)); + }, +}; diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 00000000..ca5256f7 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,14 @@ +codecov: + notify: + require_ci_to_pass: yes + +parsers: + javascript: + enable_partials: yes + +comment: no +coverage: + status: + project: + default: + target: auto diff --git a/cspell.yml b/cspell.yml new file mode 100644 index 00000000..5b4e41d5 --- /dev/null +++ b/cspell.yml @@ -0,0 +1,50 @@ +language: en +useGitignore: true +# TODO enableGlobDot: true +ignorePaths: + # Excluded from spelling check + - cspell.yml + - package.json + - package-lock.json + - tsconfig.json + - benchmark/github-schema.graphql + - benchmark/github-schema.json +overrides: + - filename: '**/docs/APIReference-*.md' + ignoreRegExpList: ['/href="[^"]*"/'] + +ignoreRegExpList: + - u\{[0-9a-f]{1,8}\} + +words: + - graphiql + - sublinks + - instanceof + + # Different names used inside tests + - Skywalker + - Leia + - Wilhuff + - Tarkin + - Artoo + - Threepio + - Odie + - Odie's + - Damerau + - Alderaan + - Tatooine + - astromech + + # TODO: contribute upstream + - deno + - codecov + + # TODO: remove bellow words + - QLID # GraphQLID + - QLJS # GraphQLJS + - iface + - Reqs + - FXXX + - XXXF + - bfnrt + - wrds diff --git a/docs/APIReference-Errors.md b/docs/APIReference-Errors.md new file mode 100644 index 00000000..eccd0934 --- /dev/null +++ b/docs/APIReference-Errors.md @@ -0,0 +1,109 @@ +--- +title: graphql/error +layout: ../_core/GraphQLJSLayout +category: API Reference +permalink: /graphql-js/error/ +sublinks: formatError,GraphQLError,locatedError,syntaxError +next: /graphql-js/execution/ +--- + +The `graphql/error` module is responsible for creating and formatting +GraphQL errors. You can import either from the `graphql/error` module, or from the root `graphql` module. For example: + +```js +import { GraphQLError } from 'graphql'; // ES6 +var { GraphQLError } = require('graphql'); // CommonJS +``` + +## Overview + + + +## Errors + +### GraphQLError + +```js +class GraphQLError extends Error { + constructor( + message: string, + nodes?: Array, + stack?: ?string, + source?: Source, + positions?: Array, + originalError?: ?Error, + extensions?: ?{ [key: string]: mixed } + ) +} +``` + +A representation of an error that occurred within GraphQL. Contains +information about where in the query the error occurred for debugging. Most +commonly constructed with `locatedError` below. + +### syntaxError + +```js +function syntaxError( + source: Source, + position: number, + description: string +): GraphQLError; +``` + +Produces a GraphQLError representing a syntax error, containing useful +descriptive information about the syntax error's position in the source. + +### locatedError + +```js +function locatedError(error: ?Error, nodes: Array): GraphQLError { +``` + +Given an arbitrary Error, presumably thrown while attempting to execute a +GraphQL operation, produce a new GraphQLError aware of the location in the +document responsible for the original Error. + +### formatError + +```js +function formatError(error: GraphQLError): GraphQLFormattedError + +type GraphQLFormattedError = { + message: string, + locations: ?Array +}; + +type GraphQLErrorLocation = { + line: number, + column: number +}; +``` + +Given a GraphQLError, format it according to the rules described by the +Response Format, Errors section of the GraphQL Specification. diff --git a/docs/APIReference-Execution.md b/docs/APIReference-Execution.md new file mode 100644 index 00000000..750c2889 --- /dev/null +++ b/docs/APIReference-Execution.md @@ -0,0 +1,60 @@ +--- +title: graphql/execution +layout: ../_core/GraphQLJSLayout +category: API Reference +permalink: /graphql-js/execution/ +sublinks: execute +next: /graphql-js/language/ +--- + +The `graphql/execution` module is responsible for the execution phase of +fulfilling a GraphQL request. You can import either from the `graphql/execution` module, or from the root `graphql` module. For example: + +```js +import { execute } from 'graphql'; // ES6 +var { execute } = require('graphql'); // CommonJS +``` + +## Overview + + + +## Execution + +### execute + +```js +export function execute( + schema: GraphQLSchema, + documentAST: Document, + rootValue?: mixed, + contextValue?: mixed, + variableValues?: ?{[key: string]: mixed}, + operationName?: ?string +): MaybePromise + +type MaybePromise = Promise | T; + +type ExecutionResult = { + data: ?Object; + errors?: Array; +} +``` + +Implements the "Evaluating requests" section of the GraphQL specification. + +Returns a Promise that will eventually be resolved and never rejected. + +If the arguments to this function do not result in a legal execution context, +a GraphQLError will be thrown immediately explaining the invalid input. + +`ExecutionResult` represents the result of execution. `data` is the result of +executing the query, `errors` is null if no errors occurred, and is a +non-empty array if an error occurred. diff --git a/docs/APIReference-ExpressGraphQL.md b/docs/APIReference-ExpressGraphQL.md new file mode 100644 index 00000000..eac9f42b --- /dev/null +++ b/docs/APIReference-ExpressGraphQL.md @@ -0,0 +1,35 @@ +--- +title: express-graphql +layout: ../_core/GraphQLJSLayout +category: API Reference +permalink: /graphql-js/express-graphql/ +sublinks: graphqlHTTP +next: /graphql-js/graphql/ +--- + +The `express-graphql` module provides a simple way to create an [Express](https://expressjs.com/) server that runs a GraphQL API. + +```js +import { graphqlHTTP } from 'express-graphql'; // ES6 +var { graphqlHTTP } = require('express-graphql'); // CommonJS +``` + +### graphqlHTTP + +```js +graphqlHTTP({ + schema: GraphQLSchema, + graphiql?: ?boolean, + rootValue?: ?any, + context?: ?any, + pretty?: ?boolean, + formatError?: ?Function, + validationRules?: ?Array, +}): Middleware +``` + +Constructs an Express application based on a GraphQL schema. + +See the [express-graphql tutorial](/graphql-js/running-an-express-graphql-server/) for sample usage. + +See the [GitHub README](https://github.com/graphql/express-graphql) for more extensive documentation of the details of this method. diff --git a/docs/APIReference-GraphQL.md b/docs/APIReference-GraphQL.md new file mode 100644 index 00000000..3aea9e87 --- /dev/null +++ b/docs/APIReference-GraphQL.md @@ -0,0 +1,179 @@ +--- +title: graphql +layout: ../_core/GraphQLJSLayout +category: API Reference +permalink: /graphql-js/graphql/ +sublinks: graphql +next: /graphql-js/error/ +--- + +The `graphql` module exports a core subset of GraphQL functionality for creation +of GraphQL type systems and servers. + +```js +import { graphql } from 'graphql'; // ES6 +var { graphql } = require('graphql'); // CommonJS +``` + +## Overview + +_Entry Point_ + + + +_Schema_ + + + +_Type Definitions_ + + + +_Scalars_ + + + +_Errors_ + + + +## Entry Point + +### graphql + +```js +graphql( + schema: GraphQLSchema, + requestString: string, + rootValue?: ?any, + contextValue?: ?any, + variableValues?: ?{[key: string]: any}, + operationName?: ?string +): Promise +``` + +The `graphql` function lexes, parses, validates and executes a GraphQL request. +It requires a `schema` and a `requestString`. Optional arguments include a +`rootValue`, which will get passed as the root value to the executor, a `contextValue`, +which will get passed to all resolve functions, +`variableValues`, which will get passed to the executor to provide values for +any variables in `requestString`, and `operationName`, which allows the caller +to specify which operation in `requestString` will be run, in cases where +`requestString` contains multiple top-level operations. + +## Schema + +See the [Type System API Reference](../type#schema). + +## Type Definitions + +See the [Type System API Reference](../type#definitions). + +## Scalars + +See the [Type System API Reference](../type#scalars). + +## Errors + +See the [Errors API Reference](../error) diff --git a/docs/APIReference-Language.md b/docs/APIReference-Language.md new file mode 100644 index 00000000..4d430c37 --- /dev/null +++ b/docs/APIReference-Language.md @@ -0,0 +1,311 @@ +--- +title: graphql/language +layout: ../_core/GraphQLJSLayout +category: API Reference +permalink: /graphql-js/language/ +sublinks: BREAK,getLocation,Kind,lex,parse,parseValue,printSource,visit +next: /graphql-js/type/ +--- + +The `graphql/language` module is responsible for parsing and operating on the GraphQL language. You can import either from the `graphql/language` module, or from the root `graphql` module. For example: + +```js +import { Source } from 'graphql'; // ES6 +var { Source } = require('graphql'); // CommonJS +``` + +## Overview + +_Source_ + + + +_Lexer_ + + + +_Parser_ + + + +_Visitor_ + + + +_Printer_ + + + +## Source + +### Source + +```js +export class Source { + constructor(body: string, name?: string, locationOffset?: Location) +} + +type Location = { + line: number; + column: number; +} +``` + +A representation of source input to GraphQL. The `name` and `locationOffset` parameters are +optional, but they are useful for clients who store GraphQL documents in source files. +For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might +be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. +The `line` and `column` properties in `locationOffset` are 1-indexed. + +### getLocation + +```js +function getLocation(source: Source, position: number): SourceLocation + +type SourceLocation = { + line: number; + column: number; +} +``` + +Takes a Source and a UTF-8 character offset, and returns the corresponding +line and column as a SourceLocation. + +## Lexer + +### lex + +```js +function lex(source: Source): Lexer; + +type Lexer = (resetPosition?: number) => Token; + +export type Token = { + kind: number; + start: number; + end: number; + value: ?string; +}; +``` + +Given a Source object, this returns a Lexer for that source. +A Lexer is a function that acts as a generator in that every time +it is called, it returns the next token in the Source. Assuming the +source lexes, the final Token emitted by the lexer will be of kind +EOF, after which the lexer will repeatedly return EOF tokens whenever +called. + +The argument to the lexer function is optional and can be used to +rewind or fast forward the lexer to a new position in the source. + +## Parser + +### parse + +```js +export function parse( + source: Source | string, + options?: ParseOptions +): Document +``` + +Given a GraphQL source, parses it into a Document. + +Throws GraphQLError if a syntax error is encountered. + +### parseValue + +```js +export function parseValue( + source: Source | string, + options?: ParseOptions +): Value +``` + +Given a string containing a GraphQL value, parse the AST for that value. + +Throws GraphQLError if a syntax error is encountered. + +This is useful within tools that operate upon GraphQL Values directly and +in isolation of complete GraphQL documents. + +### Kind + +An enum that describes the different kinds of AST nodes. + +## Visitor + +### visit + +```js +function visit(root, visitor, keyMap) +``` + +visit() will walk through an AST using a depth-first traversal, calling +the visitor's enter function at each node in the traversal, and calling the +leave function after visiting that node and all of its child nodes. + +By returning different values from the enter and leave functions, the +behavior of the visitor can be altered, including skipping over a sub-tree of +the AST (by returning false), editing the AST by returning a value or null +to remove the value, or to stop the whole traversal by returning BREAK. + +When using visit() to edit an AST, the original AST will not be modified, and +a new version of the AST with the changes applied will be returned from the +visit function. + +```js +var editedAST = visit(ast, { + enter(node, key, parent, path, ancestors) { + // @return + // undefined: no action + // false: skip visiting this node + // visitor.BREAK: stop visiting altogether + // null: delete this node + // any value: replace this node with the returned value + }, + leave(node, key, parent, path, ancestors) { + // @return + // undefined: no action + // false: no action + // visitor.BREAK: stop visiting altogether + // null: delete this node + // any value: replace this node with the returned value + }, +}); +``` + +Alternatively to providing enter() and leave() functions, a visitor can +instead provide functions named the same as the kinds of AST nodes, or +enter/leave visitors at a named key, leading to four permutations of the +visitor API: + +1. Named visitors triggered when entering a node of a specific kind. + +```js +visit(ast, { + Kind(node) { + // enter the "Kind" node + }, +}); +``` + +2. Named visitors that trigger upon entering and leaving a node of + a specific kind. + +```js +visit(ast, { + Kind: { + enter(node) { + // enter the "Kind" node + } + leave(node) { + // leave the "Kind" node + } + } +}); +``` + +3. Generic visitors that trigger upon entering and leaving any node. + +```js +visit(ast, { + enter(node) { + // enter any node + }, + leave(node) { + // leave any node + }, +}); +``` + +4. Parallel visitors for entering and leaving nodes of a specific kind. + +```js +visit(ast, { + enter: { + Kind(node) { + // enter the "Kind" node + }, + }, + leave: { + Kind(node) { + // leave the "Kind" node + }, + }, +}); +``` + +### BREAK + +The sentinel `BREAK` value described in the documentation of `visitor`. + +## Printer + +### print + +```js +function print(ast): string +``` + +Converts an AST into a string, using one set of reasonable +formatting rules. diff --git a/docs/APIReference-TypeSystem.md b/docs/APIReference-TypeSystem.md new file mode 100644 index 00000000..5b5047c3 --- /dev/null +++ b/docs/APIReference-TypeSystem.md @@ -0,0 +1,667 @@ +--- +title: graphql/type +layout: ../_core/GraphQLJSLayout +category: API Reference +permalink: /graphql-js/type/ +sublinks: getNamedType,getNullableType,GraphQLBoolean,GraphQLEnumType,GraphQLFloat,GraphQLID,GraphQLInputObjectType,GraphQLInt,GraphQLInterfaceType,GraphQLList,GraphQLNonNull,GraphQLObjectType,GraphQLScalarType,GraphQLSchema,GraphQLString,GraphQLUnionType,isAbstractType,isCompositeType,isInputType,isLeafType,isOutputType +next: /graphql-js/utilities/ +--- + +The `graphql/type` module is responsible for defining GraphQL types and schema. You can import either from the `graphql/type` module, or from the root `graphql` module. For example: + +```js +import { GraphQLSchema } from 'graphql'; // ES6 +var { GraphQLSchema } = require('graphql'); // CommonJS +``` + +## Overview + +_Schema_ + + + +_Definitions_ + + + +_Predicates_ + + + +_Un-modifiers_ + + + +_Scalars_ + + + +## Schema + +### GraphQLSchema + +```js +class GraphQLSchema { + constructor(config: GraphQLSchemaConfig) +} + +type GraphQLSchemaConfig = { + query: GraphQLObjectType; + mutation?: ?GraphQLObjectType; +} +``` + +A Schema is created by supplying the root types of each type of operation, +query and mutation (optional). A schema definition is then supplied to the +validator and executor. + +#### Example + +```js +var MyAppSchema = new GraphQLSchema({ + query: MyAppQueryRootType + mutation: MyAppMutationRootType +}); +``` + +## Definitions + +### GraphQLScalarType + +```js +class GraphQLScalarType { + constructor(config: GraphQLScalarTypeConfig) +} + +type GraphQLScalarTypeConfig = { + name: string; + description?: ?string; + specifiedByURL?: string; + serialize: (value: mixed) => ?InternalType; + parseValue?: (value: mixed) => ?InternalType; + parseLiteral?: (valueAST: Value) => ?InternalType; +} +``` + +The leaf values of any request and input values to arguments are +Scalars (or Enums) and are defined with a name and a series of serialization +functions used to ensure validity. + +#### Example + +```js +var OddType = new GraphQLScalarType({ + name: 'Odd', + serialize: oddValue, + parseValue: oddValue, + parseLiteral(ast) { + if (ast.kind === Kind.INT) { + return oddValue(parseInt(ast.value, 10)); + } + return null; + }, +}); + +function oddValue(value) { + return value % 2 === 1 ? value : null; +} +``` + +### GraphQLObjectType + +```js +class GraphQLObjectType { + constructor(config: GraphQLObjectTypeConfig) +} + +type GraphQLObjectTypeConfig = { + name: string; + interfaces?: GraphQLInterfacesThunk | Array; + fields: GraphQLFieldConfigMapThunk | GraphQLFieldConfigMap; + isTypeOf?: (value: any, info?: GraphQLResolveInfo) => boolean; + description?: ?string +} + +type GraphQLInterfacesThunk = () => Array; + +type GraphQLFieldConfigMapThunk = () => GraphQLFieldConfigMap; + +// See below about resolver functions. +type GraphQLFieldResolveFn = ( + source?: any, + args?: {[argName: string]: any}, + context?: any, + info?: GraphQLResolveInfo +) => any + +type GraphQLResolveInfo = { + fieldName: string, + fieldNodes: Array, + returnType: GraphQLOutputType, + parentType: GraphQLCompositeType, + schema: GraphQLSchema, + fragments: { [fragmentName: string]: FragmentDefinition }, + rootValue: any, + operation: OperationDefinition, + variableValues: { [variableName: string]: any }, +} + +type GraphQLFieldConfig = { + type: GraphQLOutputType; + args?: GraphQLFieldConfigArgumentMap; + resolve?: GraphQLFieldResolveFn; + deprecationReason?: string; + description?: ?string; +} + +type GraphQLFieldConfigArgumentMap = { + [argName: string]: GraphQLArgumentConfig; +}; + +type GraphQLArgumentConfig = { + type: GraphQLInputType; + defaultValue?: any; + description?: ?string; +} + +type GraphQLFieldConfigMap = { + [fieldName: string]: GraphQLFieldConfig; +}; +``` + +Almost all of the GraphQL types you define will be object types. Object types +have a name, but most importantly describe their fields. + +When two types need to refer to each other, or a type needs to refer to +itself in a field, you can use a function expression (aka a closure or a +thunk) to supply the fields lazily. + +Note that resolver functions are provided the `source` object as the first parameter. +However, if a resolver function is not provided, then the default resolver is +used, which looks for a method on `source` of the same name as the field. If found, +the method is called with `(args, context, info)`. Since it is a method on `source`, +that value can always be referenced with `this`. + +#### Examples + +```js +var AddressType = new GraphQLObjectType({ + name: 'Address', + fields: { + street: { type: GraphQLString }, + number: { type: GraphQLInt }, + formatted: { + type: GraphQLString, + resolve(obj) { + return obj.number + ' ' + obj.street; + }, + }, + }, +}); + +var PersonType = new GraphQLObjectType({ + name: 'Person', + fields: () => ({ + name: { type: GraphQLString }, + bestFriend: { type: PersonType }, + }), +}); +``` + +### GraphQLInterfaceType + +```js +class GraphQLInterfaceType { + constructor(config: GraphQLInterfaceTypeConfig) +} + +type GraphQLInterfaceTypeConfig = { + name: string, + fields: GraphQLFieldConfigMapThunk | GraphQLFieldConfigMap, + resolveType?: (value: any, info?: GraphQLResolveInfo) => ?GraphQLObjectType, + description?: ?string +}; +``` + +When a field can return one of a heterogeneous set of types, a Interface type +is used to describe what types are possible, what fields are in common across +all types, as well as a function to determine which type is actually used +when the field is resolved. + +#### Example + +```js +var EntityType = new GraphQLInterfaceType({ + name: 'Entity', + fields: { + name: { type: GraphQLString }, + }, +}); +``` + +### GraphQLUnionType + +```js +class GraphQLUnionType { + constructor(config: GraphQLUnionTypeConfig) +} + +type GraphQLUnionTypeConfig = { + name: string, + types: GraphQLObjectsThunk | Array, + resolveType?: (value: any, info?: GraphQLResolveInfo) => ?GraphQLObjectType; + description?: ?string; +}; + +type GraphQLObjectsThunk = () => Array; +``` + +When a field can return one of a heterogeneous set of types, a Union type +is used to describe what types are possible as well as providing a function +to determine which type is actually used when the field is resolved. + +### Example + +```js +var PetType = new GraphQLUnionType({ + name: 'Pet', + types: [DogType, CatType], + resolveType(value) { + if (value instanceof Dog) { + return DogType; + } + if (value instanceof Cat) { + return CatType; + } + }, +}); +``` + +### GraphQLEnumType + +```js +class GraphQLEnumType { + constructor(config: GraphQLEnumTypeConfig) +} + +type GraphQLEnumTypeConfig = { + name: string; + values: GraphQLEnumValueConfigMap; + description?: ?string; +} + +type GraphQLEnumValueConfigMap = { + [valueName: string]: GraphQLEnumValueConfig; +}; + +type GraphQLEnumValueConfig = { + value?: any; + deprecationReason?: string; + description?: ?string; +} + +type GraphQLEnumValueDefinition = { + name: string; + value?: any; + deprecationReason?: string; + description?: ?string; +} +``` + +Some leaf values of requests and input values are Enums. GraphQL serializes +Enum values as strings, however internally Enums can be represented by any +kind of type, often integers. + +Note: If a value is not provided in a definition, the name of the enum value +will be used as its internal value. + +#### Example + +```js +var RGBType = new GraphQLEnumType({ + name: 'RGB', + values: { + RED: { value: 0 }, + GREEN: { value: 1 }, + BLUE: { value: 2 }, + }, +}); +``` + +### GraphQLInputObjectType + +```js +class GraphQLInputObjectType { + constructor(config: GraphQLInputObjectConfig) +} + +type GraphQLInputObjectConfig = { + name: string; + fields: GraphQLInputObjectConfigFieldMapThunk | GraphQLInputObjectConfigFieldMap; + description?: ?string; +} + +type GraphQLInputObjectConfigFieldMapThunk = () => GraphQLInputObjectConfigFieldMap; + +type GraphQLInputObjectFieldConfig = { + type: GraphQLInputType; + defaultValue?: any; + description?: ?string; +} + +type GraphQLInputObjectConfigFieldMap = { + [fieldName: string]: GraphQLInputObjectFieldConfig; +}; + +type GraphQLInputObjectField = { + name: string; + type: GraphQLInputType; + defaultValue?: any; + description?: ?string; +} + +type GraphQLInputObjectFieldMap = { + [fieldName: string]: GraphQLInputObjectField; +}; +``` + +An input object defines a structured collection of fields which may be +supplied to a field argument. + +Using `NonNull` will ensure that a value must be provided by the query + +#### Example + +```js +var GeoPoint = new GraphQLInputObjectType({ + name: 'GeoPoint', + fields: { + lat: { type: new GraphQLNonNull(GraphQLFloat) }, + lon: { type: new GraphQLNonNull(GraphQLFloat) }, + alt: { type: GraphQLFloat, defaultValue: 0 }, + }, +}); +``` + +### GraphQLList + +```js +class GraphQLList { + constructor(type: GraphQLType) +} +``` + +A list is a kind of type marker, a wrapping type which points to another +type. Lists are often created within the context of defining the fields of +an object type. + +#### Example + +```js +var PersonType = new GraphQLObjectType({ + name: 'Person', + fields: () => ({ + parents: { type: new GraphQLList(Person) }, + children: { type: new GraphQLList(Person) }, + }), +}); +``` + +### GraphQLNonNull + +```js +class GraphQLNonNull { + constructor(type: GraphQLType) +} +``` + +A non-null is a kind of type marker, a wrapping type which points to another +type. Non-null types enforce that their values are never null and can ensure +an error is raised if this ever occurs during a request. It is useful for +fields which you can make a strong guarantee on non-nullability, for example +usually the id field of a database row will never be null. + +#### Example + +```js +var RowType = new GraphQLObjectType({ + name: 'Row', + fields: () => ({ + id: { type: new GraphQLNonNull(String) }, + }), +}); +``` + +## Predicates + +### isInputType + +```js +function isInputType(type: ?GraphQLType): boolean +``` + +These types may be used as input types for arguments and directives. + +### isOutputType + +```js +function isOutputType(type: ?GraphQLType): boolean +``` + +These types may be used as output types as the result of fields + +### isLeafType + +```js +function isLeafType(type: ?GraphQLType): boolean +``` + +These types may describe types which may be leaf values + +### isCompositeType + +```js +function isCompositeType(type: ?GraphQLType): boolean +``` + +These types may describe the parent context of a selection set + +### isAbstractType + +```js +function isAbstractType(type: ?GraphQLType): boolean +``` + +These types may describe a combination of object types + +## Un-modifiers + +### getNullableType + +```js +function getNullableType(type: ?GraphQLType): ?GraphQLNullableType +``` + +If a given type is non-nullable, this strips the non-nullability and +returns the underlying type. + +### getNamedType + +```js +function getNamedType(type: ?GraphQLType): ?GraphQLNamedType +``` + +If a given type is non-nullable or a list, this repeated strips the +non-nullability and list wrappers and returns the underlying type. + +## Scalars + +### GraphQLInt + +```js +var GraphQLInt: GraphQLScalarType; +``` + +A `GraphQLScalarType` that represents an int. + +### GraphQLFloat + +```js +var GraphQLFloat: GraphQLScalarType; +``` + +A `GraphQLScalarType` that represents a float. + +### GraphQLString + +```js +var GraphQLString: GraphQLScalarType; +``` + +A `GraphQLScalarType` that represents a string. + +### GraphQLBoolean + +```js +var GraphQLBoolean: GraphQLScalarType; +``` + +A `GraphQLScalarType` that represents a boolean. + +### GraphQLID + +```js +var GraphQLID: GraphQLScalarType; +``` + +A `GraphQLScalarType` that represents an ID. diff --git a/docs/APIReference-Utilities.md b/docs/APIReference-Utilities.md new file mode 100644 index 00000000..a9455aad --- /dev/null +++ b/docs/APIReference-Utilities.md @@ -0,0 +1,266 @@ +--- +title: graphql/utilities +layout: ../_core/GraphQLJSLayout +category: API Reference +permalink: /graphql-js/utilities/ +sublinks: astFromValue,buildASTSchema,buildClientSchema,buildSchema,introspectionQuery,isValidJSValue,isValidLiteralValue,printIntrospectionSchema,printSchema,typeFromAST,TypeInfo +next: /graphql-js/validation/ +--- + +The `graphql/utilities` module contains common useful computations to use with +the GraphQL language and type objects. You can import either from the `graphql/utilities` module, or from the root `graphql` module. For example: + +```js +import { introspectionQuery } from 'graphql'; // ES6 +var { introspectionQuery } = require('graphql'); // CommonJS +``` + +## Overview + +_Introspection_ + + + +_Schema Language_ + + + +_Visitors_ + + + +_Value Validation_ + + + +## Introspection + +### getIntrospectionQuery + +```js +interface IntrospectionOptions { + // Whether to include descriptions in the introspection result. + // Default: true + descriptions?: boolean; + + // Whether to include `specifiedByUrl` in the introspection result. + // Default: false + specifiedByUrl?: boolean; + + // Whether to include `isRepeatable` flag on directives. + // Default: false + directiveIsRepeatable?: boolean; + + // Whether to include `description` field on schema. + // Default: false + schemaDescription?: boolean; +} + +function getIntrospectionQuery( + options: IntrospectionOptions +): string; +``` + +Build a GraphQL query that queries a server's introspection system for enough +information to reproduce that server's type system. + +### buildClientSchema + +```js +function buildClientSchema( + introspection: IntrospectionQuery +): GraphQLSchema +``` + +Build a GraphQLSchema for use by client tools. + +Given the result of a client running the introspection query, creates and +returns a GraphQLSchema instance which can be then used with all GraphQL.js +tools, but cannot be used to execute a query, as introspection does not +represent the "resolver", "parse" or "serialize" functions or any other +server-internal mechanisms. + +## Schema Representation + +### buildSchema + +```js +function buildSchema(source: string | Source): GraphQLSchema { +``` + +Creates a GraphQLSchema object from GraphQL schema language. The schema will use default resolvers. For more detail on the GraphQL schema language, see the [schema language docs](/learn/schema/) or this [schema language cheat sheet](https://wehavefaces.net/graphql-shorthand-notation-cheatsheet-17cd715861b6#.9oztv0a7n). + +### printSchema + +```js +function printSchema(schema: GraphQLSchema): string { +``` + +Prints the provided schema in the Schema Language format. + +### printIntrospectionSchema + +```js +function printIntrospectionSchema(schema: GraphQLSchema): string { +``` + +Prints the built-in introspection schema in the Schema Language format. + +### buildASTSchema + +```js +function buildASTSchema( + ast: SchemaDocument, + queryTypeName: string, + mutationTypeName: ?string +): GraphQLSchema +``` + +This takes the ast of a schema document produced by `parse` in +`graphql/language` and constructs a GraphQLSchema instance which can be +then used with all GraphQL.js tools, but cannot be used to execute a query, as +introspection does not represent the "resolver", "parse" or "serialize" +functions or any other server-internal mechanisms. + +### typeFromAST + +```js +function typeFromAST( + schema: GraphQLSchema, + inputTypeAST: Type +): ?GraphQLType +``` + +Given the name of a Type as it appears in a GraphQL AST and a Schema, return the +corresponding GraphQLType from that schema. + +### astFromValue + +```js +function astFromValue( + value: any, + type?: ?GraphQLType +): ?Value +``` + +Produces a GraphQL Input Value AST given a JavaScript value. + +Optionally, a GraphQL type may be provided, which will be used to +disambiguate between value primitives. + +## Visitors + +### TypeInfo + +```js +class TypeInfo { + constructor(schema: GraphQLSchema) + getType(): ?GraphQLOutputType { + getParentType(): ?GraphQLCompositeType { + getInputType(): ?GraphQLInputType { + getFieldDef(): ?GraphQLFieldDefinition { + getDirective(): ?GraphQLDirective { + getArgument(): ?GraphQLArgument { +} +``` + +TypeInfo is a utility class which, given a GraphQL schema, can keep track +of the current field and type definitions at any point in a GraphQL document +AST during a recursive descent by calling `enter(node)` and `leave(node)`. + +## Value Validation + +### isValidJSValue + +```js +function isValidJSValue(value: any, type: GraphQLInputType): string[] +``` + +Given a JavaScript value and a GraphQL type, determine if the value will be +accepted for that type. This is primarily useful for validating the +runtime values of query variables. + +### isValidLiteralValue + +```js +function isValidLiteralValue( + type: GraphQLInputType, + valueAST: Value +): string[] +``` + +Utility for validators which determines if a value literal AST is valid given +an input type. + +Note that this only validates literal values, variables are assumed to +provide values of the correct type. diff --git a/docs/APIReference-Validation.md b/docs/APIReference-Validation.md new file mode 100644 index 00000000..e9c28ebb --- /dev/null +++ b/docs/APIReference-Validation.md @@ -0,0 +1,68 @@ +--- +title: graphql/validation +layout: ../_core/GraphQLJSLayout +category: API Reference +permalink: /graphql-js/validation/ +sublinks: specifiedRules,validate +--- + +The `graphql/validation` module fulfills the Validation phase of fulfilling a +GraphQL result. You can import either from the `graphql/validation` module, or from the root `graphql` module. For example: + +```js +import { validate } from 'graphql/validation'; // ES6 +var { validate } = require('graphql/validation'); // CommonJS +``` + +## Overview + + + +## Validation + +### validate + +```js +function validate( + schema: GraphQLSchema, + ast: Document, + rules?: Array +): Array +``` + +Implements the "Validation" section of the spec. + +Validation runs synchronously, returning an array of encountered errors, or +an empty array if no errors were encountered and the document is valid. + +A list of specific validation rules may be provided. If not provided, the +default list of rules defined by the GraphQL specification will be used. + +Each validation rules is a function which returns a visitor +(see the language/visitor API). Visitor methods are expected to return +GraphQLErrors, or Arrays of GraphQLErrors when invalid. + +Visitors can also supply `visitSpreadFragments: true` which will alter the +behavior of the visitor to skip over top level defined fragments, and instead +visit those fragments at every point a spread is encountered. + +### specifiedRules + +```js +var specifiedRules: Array<(context: ValidationContext): any> +``` + +This set includes all validation rules defined by the GraphQL spec diff --git a/docs/Guides-ConstructingTypes.md b/docs/Guides-ConstructingTypes.md new file mode 100644 index 00000000..e8737c33 --- /dev/null +++ b/docs/Guides-ConstructingTypes.md @@ -0,0 +1,125 @@ +--- +title: Constructing Types +layout: ../_core/GraphQLJSLayout +category: Advanced Guides +permalink: /graphql-js/constructing-types/ +next: /graphql-js/express-graphql/ +--- + +For many apps, you can define a fixed schema when the application starts, and define it using GraphQL schema language. In some cases, it's useful to construct a schema programmatically. You can do this using the `GraphQLSchema` constructor. + +When you are using the `GraphQLSchema` constructor to create a schema, instead of defining `Query` and `Mutation` types solely using schema language, you create them as separate object types. + +For example, let's say we are building a simple API that lets you fetch user data for a few hardcoded users based on an id. Using `buildSchema` we could write a server with: + +```js +var express = require('express'); +var { graphqlHTTP } = require('express-graphql'); +var { buildSchema } = require('graphql'); + +var schema = buildSchema(` + type User { + id: String + name: String + } + + type Query { + user(id: String): User + } +`); + +// Maps id to User object +var fakeDatabase = { + a: { + id: 'a', + name: 'alice', + }, + b: { + id: 'b', + name: 'bob', + }, +}; + +var root = { + user: function ({ id }) { + return fakeDatabase[id]; + }, +}; + +var app = express(); +app.use( + '/graphql', + graphqlHTTP({ + schema: schema, + rootValue: root, + graphiql: true, + }), +); +app.listen(4000, () => { + console.log('Running a GraphQL API server at localhost:4000/graphql'); +}); +``` + +We can implement this same API without using GraphQL schema language: + +```js +var express = require('express'); +var { graphqlHTTP } = require('express-graphql'); +var graphql = require('graphql'); + +// Maps id to User object +var fakeDatabase = { + a: { + id: 'a', + name: 'alice', + }, + b: { + id: 'b', + name: 'bob', + }, +}; + +// Define the User type +var userType = new graphql.GraphQLObjectType({ + name: 'User', + fields: { + id: { type: graphql.GraphQLString }, + name: { type: graphql.GraphQLString }, + }, +}); + +// Define the Query type +var queryType = new graphql.GraphQLObjectType({ + name: 'Query', + fields: { + user: { + type: userType, + // `args` describes the arguments that the `user` query accepts + args: { + id: { type: graphql.GraphQLString }, + }, + resolve: function (_, { id }) { + return fakeDatabase[id]; + }, + }, + }, +}); + +var schema = new graphql.GraphQLSchema({ query: queryType }); + +var app = express(); +app.use( + '/graphql', + graphqlHTTP({ + schema: schema, + graphiql: true, + }), +); +app.listen(4000, () => { + console.log('Running a GraphQL API server at localhost:4000/graphql'); +}); +``` + +When we use this method of creating the API, the root level resolvers are implemented on the `Query` and `Mutation` types rather than on a `root` object. + +This is particularly useful if you want to create a GraphQL schema automatically from something else, like a database schema. You might have a common format for something like creating and updating database records. This is also useful for implementing features like union types which don't map cleanly to ES6 classes and schema language. diff --git a/docs/Tutorial-Authentication.md b/docs/Tutorial-Authentication.md new file mode 100644 index 00000000..28376bc1 --- /dev/null +++ b/docs/Tutorial-Authentication.md @@ -0,0 +1,57 @@ +--- +title: Authentication and Express Middleware +sidebarTitle: Authentication & Middleware +layout: ../_core/GraphQLJSLayout +category: GraphQL.js Tutorial +permalink: /graphql-js/authentication-and-express-middleware/ +next: /graphql-js/constructing-types/ +--- + +It's simple to use any Express middleware in conjunction with `express-graphql`. In particular, this is a great pattern for handling authentication. + +To use middleware with a GraphQL resolver, just use the middleware like you would with a normal Express app. The `request` object is then available as the second argument in any resolver. + +For example, let's say we wanted our server to log the IP address of every request, and we also want to write an API that returns the IP address of the caller. We can do the former with middleware, and the latter by accessing the `request` object in a resolver. Here's server code that implements this: + +```js +var express = require('express'); +var { graphqlHTTP } = require('express-graphql'); +var { buildSchema } = require('graphql'); + +var schema = buildSchema(` + type Query { + ip: String + } +`); + +function loggingMiddleware(req, res, next) { + console.log('ip:', req.ip); + next(); +} + +var root = { + ip: function (args, request) { + return request.ip; + }, +}; + +var app = express(); +app.use(loggingMiddleware); +app.use( + '/graphql', + graphqlHTTP({ + schema: schema, + rootValue: root, + graphiql: true, + }), +); +app.listen(4000, () => { + console.log('Running a GraphQL API server at localhost:4000/graphql'); +}); +``` + +In a REST API, authentication is often handled with a header, that contains an auth token which proves what user is making this request. Express middleware processes these headers and puts authentication data on the Express `request` object. Some middleware modules that handle authentication like this are [Passport](http://passportjs.org/), [express-jwt](https://github.com/auth0/express-jwt), and [express-session](https://github.com/expressjs/session). Each of these modules works with `express-graphql`. + +If you aren't familiar with any of these authentication mechanisms, we recommend using `express-jwt` because it's simple without sacrificing any future flexibility. + +If you've read through the docs linearly to get to this point, congratulations! You now know everything you need to build a practical GraphQL API server. diff --git a/docs/Tutorial-BasicTypes.md b/docs/Tutorial-BasicTypes.md new file mode 100644 index 00000000..2367b7d3 --- /dev/null +++ b/docs/Tutorial-BasicTypes.md @@ -0,0 +1,62 @@ +--- +title: Basic Types +layout: ../_core/GraphQLJSLayout +category: GraphQL.js Tutorial +permalink: /graphql-js/basic-types/ +next: /graphql-js/passing-arguments/ +--- + +In most situations, all you need to do is to specify the types for your API using the GraphQL schema language, taken as an argument to the `buildSchema` function. + +The GraphQL schema language supports the scalar types of `String`, `Int`, `Float`, `Boolean`, and `ID`, so you can use these directly in the schema you pass to `buildSchema`. + +By default, every type is nullable - it's legitimate to return `null` as any of the scalar types. Use an exclamation point to indicate a type cannot be nullable, so `String!` is a non-nullable string. + +To use a list type, surround the type in square brackets, so `[Int]` is a list of integers. + +Each of these types maps straightforwardly to JavaScript, so you can just return plain old JavaScript objects in APIs that return these types. Here's an example that shows how to use some of these basic types: + +```js +var express = require('express'); +var { graphqlHTTP } = require('express-graphql'); +var { buildSchema } = require('graphql'); + +// Construct a schema, using GraphQL schema language +var schema = buildSchema(` + type Query { + quoteOfTheDay: String + random: Float! + rollThreeDice: [Int] + } +`); + +// The root provides a resolver function for each API endpoint +var root = { + quoteOfTheDay: () => { + return Math.random() < 0.5 ? 'Take it easy' : 'Salvation lies within'; + }, + random: () => { + return Math.random(); + }, + rollThreeDice: () => { + return [1, 2, 3].map((_) => 1 + Math.floor(Math.random() * 6)); + }, +}; + +var app = express(); +app.use( + '/graphql', + graphqlHTTP({ + schema: schema, + rootValue: root, + graphiql: true, + }), +); +app.listen(4000, () => { + console.log('Running a GraphQL API server at localhost:4000/graphql'); +}); +``` + +If you run this code with `node server.js` and browse to http://localhost:4000/graphql you can try out these APIs. + +These examples show you how to call APIs that return different types. To send different types of data into an API, you will also need to learn about [passing arguments to a GraphQL API](/graphql-js/passing-arguments/). diff --git a/docs/Tutorial-ExpressGraphQL.md b/docs/Tutorial-ExpressGraphQL.md new file mode 100644 index 00000000..69b49c0a --- /dev/null +++ b/docs/Tutorial-ExpressGraphQL.md @@ -0,0 +1,63 @@ +--- +title: Running an Express GraphQL Server +sidebarTitle: Running Express + GraphQL +layout: ../_core/GraphQLJSLayout +category: GraphQL.js Tutorial +permalink: /graphql-js/running-an-express-graphql-server/ +next: /graphql-js/graphql-clients/ +--- + +The simplest way to run a GraphQL API server is to use [Express](https://expressjs.com), a popular web application framework for Node.js. You will need to install two additional dependencies: + +```bash +npm install express express-graphql graphql --save +``` + +Let's modify our “hello world” example so that it's an API server rather than a script that runs a single query. We can use the 'express' module to run a webserver, and instead of executing a query directly with the `graphql` function, we can use the `express-graphql` library to mount a GraphQL API server on the “/graphql” HTTP endpoint: + +```js +var express = require('express'); +var { graphqlHTTP } = require('express-graphql'); +var { buildSchema } = require('graphql'); + +// Construct a schema, using GraphQL schema language +var schema = buildSchema(` + type Query { + hello: String + } +`); + +// The root provides a resolver function for each API endpoint +var root = { + hello: () => { + return 'Hello world!'; + }, +}; + +var app = express(); +app.use( + '/graphql', + graphqlHTTP({ + schema: schema, + rootValue: root, + graphiql: true, + }), +); +app.listen(4000, () => { + console.log('Running a GraphQL API server at localhost:4000/graphql'); +}); +``` + +You can run this GraphQL server with: + +```bash +node server.js +``` + +Since we configured `graphqlHTTP` with `graphiql: true`, you can use the GraphiQL tool to manually issue GraphQL queries. If you navigate in a web browser to `http://localhost:4000/graphql`, you should see an interface that lets you enter queries. It should look like: + +![hello world graphql example](/img/hello.png) + +This screen shot shows the GraphQL query `{ hello }` being issued and giving a result of `{ data: { hello: 'Hello world!' } }`. GraphiQL is a great tool for debugging and inspecting a server, so we recommend running it whenever your application is in development mode. + +At this point you have learned how to run a GraphQL server and how to use GraphiQL interface to issue queries. The next step is to learn how to [issue GraphQL queries from client code](/graphql-js/graphql-clients/). diff --git a/docs/Tutorial-GettingStarted.md b/docs/Tutorial-GettingStarted.md new file mode 100644 index 00000000..19c4cfb1 --- /dev/null +++ b/docs/Tutorial-GettingStarted.md @@ -0,0 +1,66 @@ +--- +title: Getting Started With GraphQL.js +sidebarTitle: Getting Started +layout: ../_core/GraphQLJSLayout +category: GraphQL.js Tutorial +permalink: /graphql-js/ +next: /graphql-js/running-an-express-graphql-server/ +--- + +## Prerequisites + +Before getting started, you should have Node v6 installed, although the examples should mostly work in previous versions of Node as well. For this guide, we won't use any language features that require transpilation, but we will use some ES6 features like [Promises](http://www.html5rocks.com/en/tutorials/es6/promises/), [classes](http://javascriptplayground.com/blog/2014/07/introduction-to-es6-classes-tutorial/), and [fat arrow functions](https://strongloop.com/strongblog/an-introduction-to-javascript-es6-arrow-functions/), so if you aren't familiar with them you might want to read up on them first. + +To create a new project and install GraphQL.js in your current directory: + +```bash +npm init +npm install graphql --save +``` + +## Writing Code + +To handle GraphQL queries, we need a schema that defines the `Query` type, and we need an API root with a function called a “resolver” for each API endpoint. For an API that just returns “Hello world!”, we can put this code in a file named `server.js`: + +```js +var { graphql, buildSchema } = require('graphql'); + +// Construct a schema, using GraphQL schema language +var schema = buildSchema(` + type Query { + hello: String + } +`); + +// The root provides a resolver function for each API endpoint +var root = { + hello: () => { + return 'Hello world!'; + }, +}; + +// Run the GraphQL query '{ hello }' and print out the response +graphql(schema, '{ hello }', root).then((response) => { + console.log(response); +}); +``` + +If you run this with: + +```bash +node server.js +``` + +You should see the GraphQL response printed out: + +```js +{ + data: { + hello: 'Hello world!'; + } +} +``` + +Congratulations - you just executed a GraphQL query! + +For practical applications, you'll probably want to run GraphQL queries from an API server, rather than executing GraphQL with a command line tool. To use GraphQL for an API server over HTTP, check out [Running an Express GraphQL Server](/graphql-js/running-an-express-graphql-server/). diff --git a/docs/Tutorial-GraphQLClients.md b/docs/Tutorial-GraphQLClients.md new file mode 100644 index 00000000..578a0d8f --- /dev/null +++ b/docs/Tutorial-GraphQLClients.md @@ -0,0 +1,87 @@ +--- +title: GraphQL Clients +layout: ../_core/GraphQLJSLayout +category: GraphQL.js Tutorial +permalink: /graphql-js/graphql-clients/ +next: /graphql-js/basic-types/ +--- + +Since a GraphQL API has more underlying structure than a REST API, there are more powerful clients like [Relay](https://facebook.github.io/relay/) which can automatically handle batching, caching, and other features. But you don't need a complex client to call a GraphQL server. With `express-graphql`, you can just send an HTTP POST request to the endpoint you mounted your GraphQL server on, passing the GraphQL query as the `query` field in a JSON payload. + +For example, let's say we mounted a GraphQL server on http://localhost:4000/graphql as in the example code for [running an Express GraphQL server](/graphql-js/running-an-express-graphql-server/), and we want to send the GraphQL query `{ hello }`. We can do this from the command line with `curl`. If you paste this into a terminal: + +```bash +curl -X POST \ +-H "Content-Type: application/json" \ +-d '{"query": "{ hello }"}' \ +http://localhost:4000/graphql +``` + +You should see the output returned as JSON: + +``` +{"data":{"hello":"Hello world!"}} +``` + +If you prefer to use a graphical user interface to send a test query, you can use clients such as [GraphiQL](https://github.com/graphql/graphiql) and [Insomnia](https://github.com/getinsomnia/insomnia). + +It's also simple to send GraphQL from the browser. Open up http://localhost:4000, open a developer console, and paste in: + +```js +fetch('/graphql', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + body: JSON.stringify({ query: '{ hello }' }), +}) + .then((r) => r.json()) + .then((data) => console.log('data returned:', data)); +``` + +You should see the data returned, logged in the console: + +``` +data returned: Object { hello: "Hello world!" } +``` + +In this example, the query was just a hardcoded string. As your application becomes more complex, and you add GraphQL endpoints that take arguments as described in [Passing Arguments](/graphql-js/passing-arguments/), you will want to construct GraphQL queries using variables in client code. You can do this by including a keyword prefixed with a dollar sign in the query, and passing an extra `variables` field on the payload. + +For example, let's say you're running the example server from [Passing Arguments](/graphql-js/passing-arguments/) that has a schema of + +```graphql +type Query { + rollDice(numDice: Int!, numSides: Int): [Int] +} +``` + +You could access this from JavaScript with the code: + +```js +var dice = 3; +var sides = 6; +var query = `query RollDice($dice: Int!, $sides: Int) { + rollDice(numDice: $dice, numSides: $sides) +}`; + +fetch('/graphql', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + body: JSON.stringify({ + query, + variables: { dice, sides }, + }), +}) + .then((r) => r.json()) + .then((data) => console.log('data returned:', data)); +``` + +Using this syntax for variables is a good idea because it automatically prevents bugs due to escaping, and it makes it easier to monitor your server. + +In general, it will take a bit more time to set up a GraphQL client like Relay, but it's worth it to get more features as your application grows. You might want to start out just using HTTP requests as the underlying transport layer, and switching to a more complex client as your application gets more complex. + +At this point you can write a client and server in GraphQL for an API that receives a single string. To do more, you will want to [learn how to use the other basic data types](/graphql-js/basic-types/). diff --git a/docs/Tutorial-Mutations.md b/docs/Tutorial-Mutations.md new file mode 100644 index 00000000..4b19fc0e --- /dev/null +++ b/docs/Tutorial-Mutations.md @@ -0,0 +1,193 @@ +--- +title: Mutations and Input Types +layout: ../_core/GraphQLJSLayout +category: GraphQL.js Tutorial +permalink: /graphql-js/mutations-and-input-types/ +next: /graphql-js/authentication-and-express-middleware/ +--- + +If you have an API endpoint that alters data, like inserting data into a database or altering data already in a database, you should make this endpoint a `Mutation` rather than a `Query`. This is as simple as making the API endpoint part of the top-level `Mutation` type instead of the top-level `Query` type. + +Let's say we have a “message of the day” server, where anyone can update the message of the day, and anyone can read the current one. The GraphQL schema for this is simply: + +```graphql +type Mutation { + setMessage(message: String): String +} + +type Query { + getMessage: String +} +``` + +It's often convenient to have a mutation that maps to a database create or update operation, like `setMessage`, return the same thing that the server stored. That way, if you modify the data on the server, the client can learn about those modifications. + +Both mutations and queries can be handled by root resolvers, so the root that implements this schema can simply be: + +```js +var fakeDatabase = {}; +var root = { + setMessage: function ({ message }) { + fakeDatabase.message = message; + return message; + }, + getMessage: function () { + return fakeDatabase.message; + }, +}; +``` + +You don't need anything more than this to implement mutations. But in many cases, you will find a number of different mutations that all accept the same input parameters. A common example is that creating an object in a database and updating an object in a database often take the same parameters. To make your schema simpler, you can use “input types” for this, by using the `input` keyword instead of the `type` keyword. + +For example, instead of a single message of the day, let's say we have many messages, indexed in a database by the `id` field, and each message has both a `content` string and an `author` string. We want a mutation API both for creating a new message and for updating an old message. We could use the schema: + +```graphql +input MessageInput { + content: String + author: String +} + +type Message { + id: ID! + content: String + author: String +} + +type Query { + getMessage(id: ID!): Message +} + +type Mutation { + createMessage(input: MessageInput): Message + updateMessage(id: ID!, input: MessageInput): Message +} +``` + +Here, the mutations return a `Message` type, so that the client can get more information about the newly-modified `Message` in the same request as the request that mutates it. + +Input types can't have fields that are other objects, only basic scalar types, list types, and other input types. + +Naming input types with `Input` on the end is a useful convention, because you will often want both an input type and an output type that are slightly different for a single conceptual object. + +Here's some runnable code that implements this schema, keeping the data in memory: + +```js +var express = require('express'); +var { graphqlHTTP } = require('express-graphql'); +var { buildSchema } = require('graphql'); + +// Construct a schema, using GraphQL schema language +var schema = buildSchema(` + input MessageInput { + content: String + author: String + } + + type Message { + id: ID! + content: String + author: String + } + + type Query { + getMessage(id: ID!): Message + } + + type Mutation { + createMessage(input: MessageInput): Message + updateMessage(id: ID!, input: MessageInput): Message + } +`); + +// If Message had any complex fields, we'd put them on this object. +class Message { + constructor(id, { content, author }) { + this.id = id; + this.content = content; + this.author = author; + } +} + +// Maps username to content +var fakeDatabase = {}; + +var root = { + getMessage: function ({ id }) { + if (!fakeDatabase[id]) { + throw new Error('no message exists with id ' + id); + } + return new Message(id, fakeDatabase[id]); + }, + createMessage: function ({ input }) { + // Create a random id for our "database". + var id = require('crypto').randomBytes(10).toString('hex'); + + fakeDatabase[id] = input; + return new Message(id, input); + }, + updateMessage: function ({ id, input }) { + if (!fakeDatabase[id]) { + throw new Error('no message exists with id ' + id); + } + // This replaces all old data, but some apps might want partial update. + fakeDatabase[id] = input; + return new Message(id, input); + }, +}; + +var app = express(); +app.use( + '/graphql', + graphqlHTTP({ + schema: schema, + rootValue: root, + graphiql: true, + }), +); +app.listen(4000, () => { + console.log('Running a GraphQL API server at localhost:4000/graphql'); +}); +``` + +To call a mutation, you must use the keyword `mutation` before your GraphQL query. To pass an input type, provide the data written as if it's a JSON object. For example, with the server defined above, you can create a new message and return the `id` of the new message with this operation: + +```graphql +mutation { + createMessage(input: { author: "andy", content: "hope is a good thing" }) { + id + } +} +``` + +You can use variables to simplify mutation client logic just like you can with queries. For example, some JavaScript code that calls the server to execute this mutation is: + +```js +var author = 'andy'; +var content = 'hope is a good thing'; +var query = `mutation CreateMessage($input: MessageInput) { + createMessage(input: $input) { + id + } +}`; + +fetch('/graphql', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + body: JSON.stringify({ + query, + variables: { + input: { + author, + content, + }, + }, + }), +}) + .then((r) => r.json()) + .then((data) => console.log('data returned:', data)); +``` + +One particular type of mutation is operations that change users, like signing up a new user. While you can implement this using GraphQL mutations, you can reuse many existing libraries if you learn about [GraphQL with authentication and Express middleware](/graphql-js/authentication-and-express-middleware/). diff --git a/docs/Tutorial-ObjectTypes.md b/docs/Tutorial-ObjectTypes.md new file mode 100644 index 00000000..246aa67a --- /dev/null +++ b/docs/Tutorial-ObjectTypes.md @@ -0,0 +1,148 @@ +--- +title: Object Types +layout: ../_core/GraphQLJSLayout +category: GraphQL.js Tutorial +permalink: /graphql-js/object-types/ +next: /graphql-js/mutations-and-input-types/ +--- + +In many cases, you don't want to return a number or a string from an API. You want to return an object that has its own complex behavior. GraphQL is a perfect fit for this. + +In GraphQL schema language, the way you define a new object type is the same way we have been defining the `Query` type in our examples. Each object can have fields that return a particular type, and methods that take arguments. For example, in the [Passing Arguments](/graphql-js/passing-arguments/) documentation, we had a method to roll some random dice: + +```graphql +type Query { + rollDice(numDice: Int!, numSides: Int): [Int] +} +``` + +If we wanted to have more and more methods based on a random die over time, we could implement this with a `RandomDie` object type instead. + +```graphql +type RandomDie { + roll(numRolls: Int!): [Int] +} + +type Query { + getDie(numSides: Int): RandomDie +} +``` + +Instead of a root-level resolver for the `RandomDie` type, we can instead use an ES6 class, where the resolvers are instance methods. This code shows how the `RandomDie` schema above can be implemented: + +```js +class RandomDie { + constructor(numSides) { + this.numSides = numSides; + } + + rollOnce() { + return 1 + Math.floor(Math.random() * this.numSides); + } + + roll({ numRolls }) { + var output = []; + for (var i = 0; i < numRolls; i++) { + output.push(this.rollOnce()); + } + return output; + } +} + +var root = { + getDie: function ({ numSides }) { + return new RandomDie(numSides || 6); + }, +}; +``` + +For fields that don't use any arguments, you can use either properties on the object or instance methods. So for the example code above, both `numSides` and `rollOnce` can actually be used to implement GraphQL fields, so that code also implements the schema of: + +```graphql +type RandomDie { + numSides: Int! + rollOnce: Int! + roll(numRolls: Int!): [Int] +} + +type Query { + getDie(numSides: Int): RandomDie +} +``` + +Putting this all together, here is some sample code that runs a server with this GraphQL API: + +```js +var express = require('express'); +var { graphqlHTTP } = require('express-graphql'); +var { buildSchema } = require('graphql'); + +// Construct a schema, using GraphQL schema language +var schema = buildSchema(` + type RandomDie { + numSides: Int! + rollOnce: Int! + roll(numRolls: Int!): [Int] + } + + type Query { + getDie(numSides: Int): RandomDie + } +`); + +// This class implements the RandomDie GraphQL type +class RandomDie { + constructor(numSides) { + this.numSides = numSides; + } + + rollOnce() { + return 1 + Math.floor(Math.random() * this.numSides); + } + + roll({ numRolls }) { + var output = []; + for (var i = 0; i < numRolls; i++) { + output.push(this.rollOnce()); + } + return output; + } +} + +// The root provides the top-level API endpoints +var root = { + getDie: function ({ numSides }) { + return new RandomDie(numSides || 6); + }, +}; + +var app = express(); +app.use( + '/graphql', + graphqlHTTP({ + schema: schema, + rootValue: root, + graphiql: true, + }), +); +app.listen(4000, () => { + console.log('Running a GraphQL API server at localhost:4000/graphql'); +}); +``` + +When you issue a GraphQL query against an API that returns object types, you can call multiple methods on the object at once by nesting the GraphQL field names. For example, if you wanted to call both `rollOnce` to roll a die once, and `roll` to roll a die three times, you could do it with this query: + +```graphql +{ + getDie(numSides: 6) { + rollOnce + roll(numRolls: 3) + } +} +``` + +If you run this code with `node server.js` and browse to http://localhost:4000/graphql you can try out these APIs with GraphiQL. + +This way of defining object types often provides advantages over a traditional REST API. Instead of doing one API request to get basic information about an object, and then multiple subsequent API requests to find out more information about that object, you can get all of that information in one API request. That saves bandwidth, makes your app run faster, and simplifies your client-side logic. + +So far, every API we've looked at is designed for returning data. In order to modify stored data or handle complex input, it helps to [learn about mutations and input types](/graphql-js/mutations-and-input-types/). diff --git a/docs/Tutorial-PassingArguments.md b/docs/Tutorial-PassingArguments.md new file mode 100644 index 00000000..df8fda9e --- /dev/null +++ b/docs/Tutorial-PassingArguments.md @@ -0,0 +1,134 @@ +--- +title: Passing Arguments +layout: ../_core/GraphQLJSLayout +category: GraphQL.js Tutorial +permalink: /graphql-js/passing-arguments/ +next: /graphql-js/object-types/ +--- + +Just like a REST API, it's common to pass arguments to an endpoint in a GraphQL API. By defining the arguments in the schema language, type checking happens automatically. Each argument must be named and have a type. For example, in the [Basic Types documentation](/graphql-js/basic-types/) we had an endpoint called `rollThreeDice`: + +```graphql +type Query { + rollThreeDice: [Int] +} +``` + +Instead of hard-coding “three”, we might want a more general function that rolls `numDice` dice, each of which have `numSides` sides. We can add arguments to the GraphQL schema language like this: + +```graphql +type Query { + rollDice(numDice: Int!, numSides: Int): [Int] +} +``` + +The exclamation point in `Int!` indicates that `numDice` can't be null, which means we can skip a bit of validation logic to make our server code simpler. We can let `numSides` be null and assume that by default a die has 6 sides. + +So far, our resolver functions took no arguments. When a resolver takes arguments, they are passed as one “args” object, as the first argument to the function. So rollDice could be implemented as: + +```js +var root = { + rollDice: function (args) { + var output = []; + for (var i = 0; i < args.numDice; i++) { + output.push(1 + Math.floor(Math.random() * (args.numSides || 6))); + } + return output; + }, +}; +``` + +It's convenient to use [ES6 destructuring assignment](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment) for these parameters, since you know what format they will be. So we can also write `rollDice` as + +```js +var root = { + rollDice: function ({ numDice, numSides }) { + var output = []; + for (var i = 0; i < numDice; i++) { + output.push(1 + Math.floor(Math.random() * (numSides || 6))); + } + return output; + }, +}; +``` + +If you're familiar with destructuring, this is a bit nicer because the line of code where `rollDice` is defined tells you about what the arguments are. + +The entire code for a server that hosts this `rollDice` API is: + +```js +var express = require('express'); +var { graphqlHTTP } = require('express-graphql'); +var { buildSchema } = require('graphql'); + +// Construct a schema, using GraphQL schema language +var schema = buildSchema(` + type Query { + rollDice(numDice: Int!, numSides: Int): [Int] + } +`); + +// The root provides a resolver function for each API endpoint +var root = { + rollDice: function ({ numDice, numSides }) { + var output = []; + for (var i = 0; i < numDice; i++) { + output.push(1 + Math.floor(Math.random() * (numSides || 6))); + } + return output; + }, +}; + +var app = express(); +app.use( + '/graphql', + graphqlHTTP({ + schema: schema, + rootValue: root, + graphiql: true, + }), +); +app.listen(4000, () => { + console.log('Running a GraphQL API server at localhost:4000/graphql'); +}); +``` + +When you call this API, you have to pass each argument by name. So for the server above, you could issue this GraphQL query to roll three six-sided dice: + +```graphql +{ + rollDice(numDice: 3, numSides: 6) +} +``` + +If you run this code with `node server.js` and browse to http://localhost:4000/graphql you can try out this API. + +When you're passing arguments in code, it's generally better to avoid constructing the whole query string yourself. Instead, you can use `$` syntax to define variables in your query, and pass the variables as a separate map. + +For example, some JavaScript code that calls our server above is: + +```js +var dice = 3; +var sides = 6; +var query = `query RollDice($dice: Int!, $sides: Int) { + rollDice(numDice: $dice, numSides: $sides) +}`; + +fetch('/graphql', { + method: 'POST', + headers: { + 'Content-Type': 'application/json', + Accept: 'application/json', + }, + body: JSON.stringify({ + query, + variables: { dice, sides }, + }), +}) + .then((r) => r.json()) + .then((data) => console.log('data returned:', data)); +``` + +Using `$dice` and `$sides` as variables in GraphQL means we don't have to worry about escaping on the client side. + +With basic types and argument passing, you can implement anything you can implement in a REST API. But GraphQL supports even more powerful queries. You can replace multiple API calls with a single API call if you learn how to [define your own object types](/graphql-js/object-types/). diff --git a/integrationTests/README.md b/integrationTests/README.md new file mode 100644 index 00000000..70644910 --- /dev/null +++ b/integrationTests/README.md @@ -0,0 +1 @@ +# TBD diff --git a/integrationTests/integration-test.js b/integrationTests/integration-test.js new file mode 100644 index 00000000..91d1575b --- /dev/null +++ b/integrationTests/integration-test.js @@ -0,0 +1,49 @@ +'use strict'; + +const os = require('os'); +const fs = require('fs'); +const path = require('path'); +const childProcess = require('child_process'); + +const { describe, it } = require('mocha'); + +function exec(command, options = {}) { + const output = childProcess.execSync(command, { + encoding: 'utf-8', + ...options, + }); + return output && output.trimEnd(); +} + +describe('Integration Tests', () => { + const tmpDir = path.join(os.tmpdir(), 'graphql-js-integrationTmp'); + fs.rmSync(tmpDir, { recursive: true, force: true }); + fs.mkdirSync(tmpDir); + + const distDir = path.resolve('./npmDist'); + const archiveName = exec(`npm --quiet pack ${distDir}`, { cwd: tmpDir }); + fs.renameSync( + path.join(tmpDir, archiveName), + path.join(tmpDir, 'graphql.tgz'), + ); + + function testOnNodeProject(projectName) { + const projectPath = path.join(__dirname, projectName); + + const packageJSONPath = path.join(projectPath, 'package.json'); + const packageJSON = JSON.parse(fs.readFileSync(packageJSONPath, 'utf-8')); + + it(packageJSON.description, () => { + exec(`cp -R ${projectPath} ${tmpDir}`); + + const cwd = path.join(tmpDir, projectName); + // TODO: figure out a way to run it with --ignore-scripts + exec('npm --quiet install', { cwd, stdio: 'inherit' }); + exec('npm --quiet test', { cwd, stdio: 'inherit' }); + }).timeout(60000); + } + + testOnNodeProject('ts'); + testOnNodeProject('node'); + testOnNodeProject('webpack'); +}); diff --git a/integrationTests/node/index.js b/integrationTests/node/index.js new file mode 100644 index 00000000..4815fe52 --- /dev/null +++ b/integrationTests/node/index.js @@ -0,0 +1,27 @@ +'use strict'; + +const assert = require('assert'); +const { readFileSync } = require('fs'); + +const { version, graphqlSync } = require('graphql'); +const { buildSchema } = require('graphql/utilities'); + +assert.deepStrictEqual( + version, + JSON.parse(readFileSync('./node_modules/graphql/package.json')).version, +); + +const schema = buildSchema('type Query { hello: String }'); + +const result = graphqlSync({ + schema, + source: '{ hello }', + rootValue: { hello: 'world' }, +}); + +assert.deepStrictEqual(result, { + data: { + __proto__: null, + hello: 'world', + }, +}); diff --git a/integrationTests/node/package.json b/integrationTests/node/package.json new file mode 100644 index 00000000..87f399e7 --- /dev/null +++ b/integrationTests/node/package.json @@ -0,0 +1,14 @@ +{ + "private": true, + "description": "graphql-js should work on all supported node versions", + "scripts": { + "test": "node test.js" + }, + "dependencies": { + "graphql": "file:../graphql.tgz", + "node-12": "npm:node@12.x.x", + "node-14": "npm:node@14.x.x", + "node-16": "npm:node@16.x.x", + "node-17": "npm:node@17.x.x" + } +} diff --git a/integrationTests/node/test.js b/integrationTests/node/test.js new file mode 100644 index 00000000..94cc957b --- /dev/null +++ b/integrationTests/node/test.js @@ -0,0 +1,17 @@ +'use strict'; + +const path = require('path'); +const childProcess = require('child_process'); + +const { dependencies } = require('./package.json'); + +const nodeVersions = Object.keys(dependencies) + .filter((pkg) => pkg.startsWith('node-')) + .sort((a, b) => b.localeCompare(a)); + +for (const version of nodeVersions) { + console.log(`Testing on ${version} ...`); + + const nodePath = path.join(__dirname, 'node_modules', version, 'bin/node'); + childProcess.execSync(nodePath + ' index.js', { stdio: 'inherit' }); +} diff --git a/integrationTests/ts/TypedQueryDocumentNode-test.ts b/integrationTests/ts/TypedQueryDocumentNode-test.ts new file mode 100644 index 00000000..89044efb --- /dev/null +++ b/integrationTests/ts/TypedQueryDocumentNode-test.ts @@ -0,0 +1,72 @@ +import type { ExecutionResult } from 'graphql/execution'; +import type { TypedQueryDocumentNode } from 'graphql/utilities'; + +import { parse } from 'graphql/language'; +import { execute } from 'graphql/execution'; +import { buildSchema } from 'graphql/utilities'; + +const schema = buildSchema(` + type Query { + test: String + } +`); + +// Tests for TS specific TypedQueryDocumentNode type +const queryDocument = parse('{ test }'); + +type ResponseData = { test: string }; +const typedQueryDocument = queryDocument as TypedQueryDocumentNode< + ResponseData, + {} +>; + +// Supports conversion to DocumentNode +execute({ schema, document: typedQueryDocument }); + +function wrappedExecute(document: TypedQueryDocumentNode) { + return execute({ schema, document }) as ExecutionResult; +} + +const response = wrappedExecute(typedQueryDocument); +const responseData: ResponseData | undefined | null = response.data; + +declare function runQueryA( + q: TypedQueryDocumentNode<{ output: string }, { input: string | null }>, +): void; + +// valid +declare const optionalInputRequiredOutput: TypedQueryDocumentNode< + { output: string }, + { input: string | null } +>; +runQueryA(optionalInputRequiredOutput); + +declare function runQueryB( + q: TypedQueryDocumentNode<{ output: string | null }, { input: string }>, +): void; + +// still valid: We still accept {output: string} as a valid result. +// We're now passing in {input: string} which is still assignable to {input: string | null} +runQueryB(optionalInputRequiredOutput); + +// valid: we now accept {output: null} as a valid Result +declare const optionalInputOptionalOutput: TypedQueryDocumentNode< + { output: string | null }, + { input: string | null } +>; +runQueryB(optionalInputOptionalOutput); + +// valid: we now only pass {input: string} to the query +declare const requiredInputRequiredOutput: TypedQueryDocumentNode< + { output: string }, + { input: string } +>; +runQueryB(requiredInputRequiredOutput); + +// valid: we now accept {output: null} as a valid Result AND +// we now only pass {input: string} to the query +declare const requiredInputOptionalOutput: TypedQueryDocumentNode< + { output: null }, + { input: string } +>; +runQueryB(requiredInputOptionalOutput); diff --git a/integrationTests/ts/basic-test.ts b/integrationTests/ts/basic-test.ts new file mode 100644 index 00000000..a28bd840 --- /dev/null +++ b/integrationTests/ts/basic-test.ts @@ -0,0 +1,34 @@ +import type { ExecutionResult } from 'graphql/execution'; + +import { graphqlSync } from 'graphql'; +import { GraphQLString, GraphQLSchema, GraphQLObjectType } from 'graphql/type'; + +const queryType: GraphQLObjectType = new GraphQLObjectType({ + name: 'Query', + fields: () => ({ + sayHi: { + type: GraphQLString, + args: { + who: { + type: GraphQLString, + defaultValue: 'World', + }, + }, + resolve(_root, args: { who: string }) { + return 'Hello ' + args.who; + }, + }, + }), +}); + +const schema: GraphQLSchema = new GraphQLSchema({ query: queryType }); + +const result: ExecutionResult = graphqlSync({ + schema, + source: ` + query helloWho($who: String){ + test(who: $who) + } + `, + variableValues: { who: 'Dolly' }, +}); diff --git a/integrationTests/ts/extensions-test.ts b/integrationTests/ts/extensions-test.ts new file mode 100644 index 00000000..689d9435 --- /dev/null +++ b/integrationTests/ts/extensions-test.ts @@ -0,0 +1,62 @@ +import { GraphQLError } from 'graphql/error'; +import { GraphQLString, GraphQLObjectType } from 'graphql/type'; + +interface SomeExtension { + meaningOfLife: 42; +} + +declare module 'graphql' { + interface GraphQLObjectTypeExtensions<_TSource, _TContext> { + someObjectExtension?: SomeExtension; + } + + interface GraphQLFieldExtensions<_TSource, _TContext, _TArgs> { + someFieldExtension?: SomeExtension; + } + + interface GraphQLArgumentExtensions { + someArgumentExtension?: SomeExtension; + } +} + +const queryType: GraphQLObjectType = new GraphQLObjectType({ + name: 'Query', + fields: () => ({ + sayHi: { + type: GraphQLString, + args: { + who: { + type: GraphQLString, + extensions: { + someArgumentExtension: { meaningOfLife: 42 }, + }, + }, + }, + resolve: (_root, args) => 'Hello ' + (args.who || 'World'), + extensions: { + someFieldExtension: { meaningOfLife: 42 }, + }, + }, + }), + extensions: { + someObjectExtension: { meaningOfLife: 42 }, + }, +}); + +function checkExtensionTypes(_test: SomeExtension | null | undefined) {} + +checkExtensionTypes(queryType.extensions.someObjectExtension); + +const sayHiField = queryType.getFields().sayHi; +checkExtensionTypes(sayHiField.extensions.someFieldExtension); + +checkExtensionTypes(sayHiField.args[0].extensions.someArgumentExtension); + +declare module 'graphql' { + export interface GraphQLErrorExtensions { + someErrorExtension?: SomeExtension; + } +} + +const error = new GraphQLError('foo'); +checkExtensionTypes(error.extensions.someErrorExtension); diff --git a/integrationTests/ts/internalImports-test.ts b/integrationTests/ts/internalImports-test.ts new file mode 100644 index 00000000..62d9628d --- /dev/null +++ b/integrationTests/ts/internalImports-test.ts @@ -0,0 +1,8 @@ +import type { NameNode } from 'graphql/language'; + +// Parser class is internal API so so any changes to it are never considered breaking changes. +// We just want to test that we are able to import it. +import { Parser } from 'graphql/language/parser'; + +const parser = new Parser('foo'); +const ast: NameNode = parser.parseName(); diff --git a/integrationTests/ts/package.json b/integrationTests/ts/package.json new file mode 100644 index 00000000..505c9c3f --- /dev/null +++ b/integrationTests/ts/package.json @@ -0,0 +1,15 @@ +{ + "private": true, + "description": "graphql-js should compile with all supported TS versions", + "scripts": { + "test": "node test.js" + }, + "dependencies": { + "graphql": "file:../graphql.tgz", + "typescript-4.1": "npm:typescript@4.1.x", + "typescript-4.2": "npm:typescript@4.2.x", + "typescript-4.3": "npm:typescript@4.3.x", + "typescript-4.4": "npm:typescript@4.4.x", + "typescript-4.5": "npm:typescript@4.5.x" + } +} diff --git a/integrationTests/ts/test.js b/integrationTests/ts/test.js new file mode 100644 index 00000000..b328fe16 --- /dev/null +++ b/integrationTests/ts/test.js @@ -0,0 +1,19 @@ +'use strict'; + +const path = require('path'); +const childProcess = require('child_process'); + +const { dependencies } = require('./package.json'); + +const tsVersions = Object.keys(dependencies) + .filter((pkg) => pkg.startsWith('typescript-')) + .sort((a, b) => b.localeCompare(a)); + +for (const version of tsVersions) { + console.log(`Testing on ${version} ...`); + childProcess.execSync(tscPath(version), { stdio: 'inherit' }); +} + +function tscPath(version) { + return path.join(__dirname, 'node_modules', version, 'bin/tsc'); +} diff --git a/integrationTests/ts/tsconfig.json b/integrationTests/ts/tsconfig.json new file mode 100644 index 00000000..403b4c21 --- /dev/null +++ b/integrationTests/ts/tsconfig.json @@ -0,0 +1,9 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"], + "strict": true, + "noEmit": true, + "types": [] + } +} diff --git a/integrationTests/webpack/entry.js b/integrationTests/webpack/entry.js new file mode 100644 index 00000000..8f51030c --- /dev/null +++ b/integrationTests/webpack/entry.js @@ -0,0 +1,13 @@ +'use strict'; + +const { buildSchema, graphqlSync } = require('graphql'); + +const schema = buildSchema('type Query { hello: String }'); + +const result = graphqlSync({ + schema, + source: '{ hello }', + rootValue: { hello: 'world' }, +}); + +module.exports = { result }; diff --git a/integrationTests/webpack/package.json b/integrationTests/webpack/package.json new file mode 100644 index 00000000..aec7a21a --- /dev/null +++ b/integrationTests/webpack/package.json @@ -0,0 +1,12 @@ +{ + "private": true, + "description": "graphql-js should be compatible with Webpack", + "scripts": { + "test": "webpack && node test.js" + }, + "dependencies": { + "graphql": "file:../graphql.tgz", + "webpack": "5.x.x", + "webpack-cli": "4.x.x" + } +} diff --git a/integrationTests/webpack/test.js b/integrationTests/webpack/test.js new file mode 100644 index 00000000..40c22233 --- /dev/null +++ b/integrationTests/webpack/test.js @@ -0,0 +1,14 @@ +'use strict'; + +const assert = require('assert'); + +// eslint-disable-next-line node/no-missing-require +const { result } = require('./dist/main.js'); + +assert.deepStrictEqual(result, { + data: { + __proto__: null, + hello: 'world', + }, +}); +console.log('Test script: Got correct result from Webpack bundle!'); diff --git a/integrationTests/webpack/webpack.config.json b/integrationTests/webpack/webpack.config.json new file mode 100644 index 00000000..830b2bd5 --- /dev/null +++ b/integrationTests/webpack/webpack.config.json @@ -0,0 +1,7 @@ +{ + "mode": "production", + "entry": "./entry.js", + "output": { + "libraryTarget": "commonjs2" + } +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..46934fc8 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,11393 @@ +{ + "name": "graphql", + "version": "16.2.0", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "graphql", + "version": "16.2.0", + "license": "MIT", + "devDependencies": { + "@babel/core": "7.16.5", + "@babel/plugin-syntax-typescript": "7.16.5", + "@babel/plugin-transform-typescript": "7.16.1", + "@babel/preset-env": "7.16.5", + "@babel/register": "7.16.5", + "@types/chai": "4.3.0", + "@types/mocha": "9.0.0", + "@types/node": "17.0.5", + "@typescript-eslint/eslint-plugin": "5.8.0", + "@typescript-eslint/parser": "5.8.0", + "c8": "7.10.0", + "chai": "4.3.4", + "cspell": "5.13.4", + "eslint": "8.5.0", + "eslint-plugin-import": "2.25.3", + "eslint-plugin-internal-rules": "file:./resources/eslint-internal-rules", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-simple-import-sort": "7.0.0", + "eslint-plugin-tsdoc": "0.2.14", + "mocha": "9.1.3", + "prettier": "2.5.1", + "typescript": "4.5.4" + }, + "engines": { + "node": "^12.22.0 || ^14.16.0 || >=16.0.0" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", + "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.16.4", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.4.tgz", + "integrity": "sha512-1o/jo7D+kC9ZjHX5v+EHrdjl3PhxMrLSOTGsOdHJ+KL8HCaEK6ehrVL2RS6oHDZp+L7xLirLrPmQtEng769J/Q==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.5.tgz", + "integrity": "sha512-wUcenlLzuWMZ9Zt8S0KmFwGlH6QKRh3vsm/dhDA3CHkiTA45YuG1XkHRcNRl73EFPXDp/d5kVOU0/y7x2w6OaQ==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.16.0", + "@babel/generator": "^7.16.5", + "@babel/helper-compilation-targets": "^7.16.3", + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helpers": "^7.16.5", + "@babel/parser": "^7.16.5", + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.5.tgz", + "integrity": "sha512-kIvCdjZqcdKqoDbVVdt5R99icaRtrtYhYK/xux5qiWCBmfdvEYMFZ68QCrpE5cbFM1JsuArUNs1ZkuKtTtUcZA==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.0", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-annotate-as-pure": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.0.tgz", + "integrity": "sha512-ItmYF9vR4zA8cByDocY05o0LGUkp1zhbTQOH1NFyl5xXEqlTJQCEJjieriw+aFpxo16swMxUnUiKS7a/r4vtHg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.16.5.tgz", + "integrity": "sha512-3JEA9G5dmmnIWdzaT9d0NmFRgYnWUThLsDaL7982H0XqqWr56lRrsmwheXFMjR+TMl7QMBb6mzy9kvgr1lRLUA==", + "dev": true, + "dependencies": { + "@babel/helper-explode-assignable-expression": "^7.16.0", + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.16.3", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.3.tgz", + "integrity": "sha512-vKsoSQAyBmxS35JUOOt+07cLc6Nk/2ljLIHwmq2/NM6hdioUaqEXq/S+nXvbvXbZkNDlWOymPanJGOc4CBjSJA==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.16.0", + "@babel/helper-validator-option": "^7.14.5", + "browserslist": "^4.17.5", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-create-class-features-plugin": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.5.tgz", + "integrity": "sha512-NEohnYA7mkB8L5JhU7BLwcBdU3j83IziR9aseMueWGeAjblbul3zzb8UvJ3a1zuBiqCMObzCJHFqKIQE6hTVmg==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-member-expression-to-functions": "^7.16.5", + "@babel/helper-optimise-call-expression": "^7.16.0", + "@babel/helper-replace-supers": "^7.16.5", + "@babel/helper-split-export-declaration": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-create-regexp-features-plugin": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.16.0.tgz", + "integrity": "sha512-3DyG0zAFAZKcOp7aVr33ddwkxJ0Z0Jr5V99y3I690eYLpukJsJvAbzTy1ewoCqsML8SbIrjH14Jc/nSQ4TvNPA==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "regexpu-core": "^4.7.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.0.tgz", + "integrity": "sha512-7hfT8lUljl/tM3h+izTX/pO3W3frz2ok6Pk+gzys8iJqDfZrZy2pXjRTZAvG2YmfHun1X4q8/UZRLatMfqc5Tg==", + "dev": true, + "dependencies": { + "@babel/helper-compilation-targets": "^7.13.0", + "@babel/helper-module-imports": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/traverse": "^7.13.0", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2", + "semver": "^6.1.2" + }, + "peerDependencies": { + "@babel/core": "^7.4.0-0" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.5.tgz", + "integrity": "sha512-ODQyc5AnxmZWm/R2W7fzhamOk1ey8gSguo5SGvF0zcB3uUzRpTRmM/jmLSm9bDMyPlvbyJ+PwPEK0BWIoZ9wjg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-explode-assignable-expression": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.0.tgz", + "integrity": "sha512-Hk2SLxC9ZbcOhLpg/yMznzJ11W++lg5GMbxt1ev6TXUiJB0N42KPC+7w8a+eWGuqDnUYuwStJoZHM7RgmIOaGQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz", + "integrity": "sha512-BZh4mEk1xi2h4HFjWUXRQX5AEx4rvaZxHgax9gcjdLWdkjsY7MKt5p0otjsg5noXw+pB+clMCjw+aEVYADMjog==", + "dev": true, + "dependencies": { + "@babel/helper-get-function-arity": "^7.16.0", + "@babel/template": "^7.16.0", + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-get-function-arity": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.0.tgz", + "integrity": "sha512-ASCquNcywC1NkYh/z7Cgp3w31YW8aojjYIlNg4VeJiHkqyP4AzIvr4qx7pYDb4/s8YcsZWqqOSxgkvjUz1kpDQ==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.0.tgz", + "integrity": "sha512-1AZlpazjUR0EQZQv3sgRNfM9mEVWPK3M6vlalczA+EECcPz3XPh6VplbErL5UoMpChhSck5wAJHthlj1bYpcmg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-member-expression-to-functions": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.5.tgz", + "integrity": "sha512-7fecSXq7ZrLE+TWshbGT+HyCLkxloWNhTbU2QM1NTI/tDqyf0oZiMcEfYtDuUDCo528EOlt39G1rftea4bRZIw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.0.tgz", + "integrity": "sha512-kkH7sWzKPq0xt3H1n+ghb4xEMP8k0U7XV3kkB+ZGy69kDk2ySFW1qPi06sjKzFY3t1j6XbJSqr4mF9L7CYVyhg==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.5.tgz", + "integrity": "sha512-CkvMxgV4ZyyioElFwcuWnDCcNIeyqTkCm9BxXZi73RR1ozqlpboqsbGUNvRTflgZtFbbJ1v5Emvm+lkjMYY/LQ==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-module-imports": "^7.16.0", + "@babel/helper-simple-access": "^7.16.0", + "@babel/helper-split-export-declaration": "^7.16.0", + "@babel/helper-validator-identifier": "^7.15.7", + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-optimise-call-expression": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.0.tgz", + "integrity": "sha512-SuI467Gi2V8fkofm2JPnZzB/SUuXoJA5zXe/xzyPP2M04686RzFKFHPK6HDVN6JvWBIEW8tt9hPR7fXdn2Lgpw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.5.tgz", + "integrity": "sha512-59KHWHXxVA9K4HNF4sbHCf+eJeFe0Te/ZFGqBT4OjXhrwvA04sGfaEGsVTdsjoszq0YTP49RC9UKe5g8uN2RwQ==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-remap-async-to-generator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.16.5.tgz", + "integrity": "sha512-X+aAJldyxrOmN9v3FKp+Hu1NO69VWgYgDGq6YDykwRPzxs5f2N+X988CBXS7EQahDU+Vpet5QYMqLk+nsp+Qxw==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "@babel/helper-wrap-function": "^7.16.5", + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-replace-supers": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.5.tgz", + "integrity": "sha512-ao3seGVa/FZCMCCNDuBcqnBFSbdr8N2EW35mzojx3TwfIbdPmNK+JV6+2d5bR0Z71W5ocLnQp9en/cTF7pBJiQ==", + "dev": true, + "dependencies": { + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-member-expression-to-functions": "^7.16.5", + "@babel/helper-optimise-call-expression": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-simple-access": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.0.tgz", + "integrity": "sha512-o1rjBT/gppAqKsYfUdfHq5Rk03lMQrkPHG1OWzHWpLgVXRH4HnMM9Et9CVdIqwkCQlobnGHEJMsgWP/jE1zUiw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.16.0.tgz", + "integrity": "sha512-+il1gTy0oHwUsBQZyJvukbB4vPMdcYBrFHa0Uc4AizLxbq6BOYC51Rv4tWocX9BLBDLZ4kc6qUFpQ6HRgL+3zw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.0.tgz", + "integrity": "sha512-0YMMRpuDFNGTHNRiiqJX19GjNXA4H0E8jZ2ibccfSxaCogbm3am5WN/2nQNj0YnQwGWM1J06GOcQ2qnh3+0paw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", + "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", + "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-wrap-function": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.16.5.tgz", + "integrity": "sha512-2J2pmLBqUqVdJw78U0KPNdeE2qeuIyKoG4mKV7wAq3mc4jJG282UgjZw4ZYDnqiWQuS3Y3IYdF/AQ6CpyBV3VA==", + "dev": true, + "dependencies": { + "@babel/helper-function-name": "^7.16.0", + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.5.tgz", + "integrity": "sha512-TLgi6Lh71vvMZGEkFuIxzaPsyeYCHQ5jJOOX1f0xXn0uciFuE8cEk0wyBquMcCxBXZ5BJhE2aUB7pnWTD150Tw==", + "dev": true, + "dependencies": { + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", + "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.15.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.16.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.6.tgz", + "integrity": "sha512-Gr86ujcNuPDnNOY8mi383Hvi8IYrJVJYuf3XcuBM/Dgd+bINn/7tHqsj+tKkoreMbmGsFLsltI/JJd8fOFWGDQ==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.16.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.2.tgz", + "integrity": "sha512-h37CvpLSf8gb2lIJ2CgC3t+EjFbi0t8qS7LCS1xcJIlEXE4czlofwaW7W1HA8zpgOCzI9C1nmoqNR1zWkk0pQg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.16.0.tgz", + "integrity": "sha512-4tcFwwicpWTrpl9qjf7UsoosaArgImF85AxqCRZlgc3IQDvkUHjJpruXAL58Wmj+T6fypWTC/BakfEkwIL/pwA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", + "@babel/plugin-proposal-optional-chaining": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.13.0" + } + }, + "node_modules/@babel/plugin-proposal-async-generator-functions": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.16.5.tgz", + "integrity": "sha512-C/FX+3HNLV6sz7AqbTQqEo1L9/kfrKjxcVtgyBCmvIgOjvuBVUWooDoi7trsLxOzCEo5FccjRvKHkfDsJFZlfA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-remap-async-to-generator": "^7.16.5", + "@babel/plugin-syntax-async-generators": "^7.8.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-class-properties": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.5.tgz", + "integrity": "sha512-pJD3HjgRv83s5dv1sTnDbZOaTjghKEz8KUn1Kbh2eAIRhGuyQ1XSeI4xVXU3UlIEVA3DAyIdxqT1eRn7Wcn55A==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-class-static-block": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.16.5.tgz", + "integrity": "sha512-EEFzuLZcm/rNJ8Q5krK+FRKdVkd6FjfzT9tuSZql9sQn64K0hHA2KLJ0DqVot9/iV6+SsuadC5yI39zWnm+nmQ==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-class-static-block": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.12.0" + } + }, + "node_modules/@babel/plugin-proposal-dynamic-import": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.16.5.tgz", + "integrity": "sha512-P05/SJZTTvHz79LNYTF8ff5xXge0kk5sIIWAypcWgX4BTRUgyHc8wRxJ/Hk+mU0KXldgOOslKaeqnhthcDJCJQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-export-namespace-from": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.16.5.tgz", + "integrity": "sha512-i+sltzEShH1vsVydvNaTRsgvq2vZsfyrd7K7vPLUU/KgS0D5yZMe6uipM0+izminnkKrEfdUnz7CxMRb6oHZWw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-json-strings": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.16.5.tgz", + "integrity": "sha512-QQJueTFa0y9E4qHANqIvMsuxM/qcLQmKttBACtPCQzGUEizsXDACGonlPiSwynHfOa3vNw0FPMVvQzbuXwh4SQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-json-strings": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-logical-assignment-operators": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.16.5.tgz", + "integrity": "sha512-xqibl7ISO2vjuQM+MzR3rkd0zfNWltk7n9QhaD8ghMmMceVguYrNDt7MikRyj4J4v3QehpnrU8RYLnC7z/gZLA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.16.5.tgz", + "integrity": "sha512-YwMsTp/oOviSBhrjwi0vzCUycseCYwoXnLiXIL3YNjHSMBHicGTz7GjVU/IGgz4DtOEXBdCNG72pvCX22ehfqg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-numeric-separator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.16.5.tgz", + "integrity": "sha512-DvB9l/TcsCRvsIV9v4jxR/jVP45cslTVC0PMVHvaJhhNuhn2Y1SOhCSFlPK777qLB5wb8rVDaNoqMTyOqtY5Iw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-numeric-separator": "^7.10.4" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-object-rest-spread": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.16.5.tgz", + "integrity": "sha512-UEd6KpChoyPhCoE840KRHOlGhEZFutdPDMGj+0I56yuTTOaT51GzmnEl/0uT41fB/vD2nT+Pci2KjezyE3HmUw==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-compilation-targets": "^7.16.3", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-optional-catch-binding": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.16.5.tgz", + "integrity": "sha512-ihCMxY1Iljmx4bWy/PIMJGXN4NS4oUj1MKynwO07kiKms23pNvIn1DMB92DNB2R0EA882sw0VXIelYGdtF7xEQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-optional-chaining": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.16.5.tgz", + "integrity": "sha512-kzdHgnaXRonttiTfKYnSVafbWngPPr2qKw9BWYBESl91W54e+9R5pP70LtWxV56g0f05f/SQrwHYkfvbwcdQ/A==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-private-methods": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.5.tgz", + "integrity": "sha512-+yFMO4BGT3sgzXo+lrq7orX5mAZt57DwUK6seqII6AcJnJOIhBJ8pzKH47/ql/d426uQ7YhN8DpUFirQzqYSUA==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.16.5.tgz", + "integrity": "sha512-+YGh5Wbw0NH3y/E5YMu6ci5qTDmAEVNoZ3I54aB6nVEOZ5BQ7QJlwKq5pYVucQilMByGn/bvX0af+uNaPRCabA==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "@babel/helper-create-class-features-plugin": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-proposal-unicode-property-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.16.5.tgz", + "integrity": "sha512-s5sKtlKQyFSatt781HQwv1hoM5BQ9qRH30r+dK56OLDsHmV74mzwJNX7R1yMuE7VZKG5O6q/gmOGSAO6ikTudg==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.12.13" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", + "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-export-namespace-from": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", + "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.3" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.10.4" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.8.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-syntax-typescript": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.16.5.tgz", + "integrity": "sha512-/d4//lZ1Vqb4mZ5xTep3dDK888j7BGM/iKqBmndBaoYAFPlPKrGU608VVBz5JeyAb6YQDjRu1UKqj86UhwWVgw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-arrow-functions": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.5.tgz", + "integrity": "sha512-8bTHiiZyMOyfZFULjsCnYOWG059FVMes0iljEHSfARhNgFfpsqE92OrCffv3veSw9rwMkYcFe9bj0ZoXU2IGtQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-async-to-generator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.16.5.tgz", + "integrity": "sha512-TMXgfioJnkXU+XRoj7P2ED7rUm5jbnDWwlCuFVTpQboMfbSya5WrmubNBAMlk7KXvywpo8rd8WuYZkis1o2H8w==", + "dev": true, + "dependencies": { + "@babel/helper-module-imports": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-remap-async-to-generator": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoped-functions": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.16.5.tgz", + "integrity": "sha512-BxmIyKLjUGksJ99+hJyL/HIxLIGnLKtw772zYDER7UuycDZ+Xvzs98ZQw6NGgM2ss4/hlFAaGiZmMNKvValEjw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-block-scoping": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.16.5.tgz", + "integrity": "sha512-JxjSPNZSiOtmxjX7PBRBeRJTUKTyJ607YUYeT0QJCNdsedOe+/rXITjP08eG8xUpsLfPirgzdCFN+h0w6RI+pQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-classes": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.16.5.tgz", + "integrity": "sha512-DzJ1vYf/7TaCYy57J3SJ9rV+JEuvmlnvvyvYKFbk5u46oQbBvuB9/0w+YsVsxkOv8zVWKpDmUoj4T5ILHoXevA==", + "dev": true, + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-optimise-call-expression": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-replace-supers": "^7.16.5", + "@babel/helper-split-export-declaration": "^7.16.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-computed-properties": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.16.5.tgz", + "integrity": "sha512-n1+O7xtU5lSLraRzX88CNcpl7vtGdPakKzww74bVwpAIRgz9JVLJJpOLb0uYqcOaXVM0TL6X0RVeIJGD2CnCkg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-destructuring": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.16.5.tgz", + "integrity": "sha512-GuRVAsjq+c9YPK6NeTkRLWyQskDC099XkBSVO+6QzbnOnH2d/4mBVXYStaPrZD3dFRfg00I6BFJ9Atsjfs8mlg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-dotall-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.16.5.tgz", + "integrity": "sha512-iQiEMt8Q4/5aRGHpGVK2Zc7a6mx7qEAO7qehgSug3SDImnuMzgmm/wtJALXaz25zUj1PmnNHtShjFgk4PDx4nw==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-duplicate-keys": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.16.5.tgz", + "integrity": "sha512-81tijpDg2a6I1Yhj4aWY1l3O1J4Cg/Pd7LfvuaH2VVInAkXtzibz9+zSPdUM1WvuUi128ksstAP0hM5w48vQgg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-exponentiation-operator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.16.5.tgz", + "integrity": "sha512-12rba2HwemQPa7BLIKCzm1pT2/RuQHtSFHdNl41cFiC6oi4tcrp7gjB07pxQvFpcADojQywSjblQth6gJyE6CA==", + "dev": true, + "dependencies": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-for-of": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.16.5.tgz", + "integrity": "sha512-+DpCAJFPAvViR17PIMi9x2AE34dll5wNlXO43wagAX2YcRGgEVHCNFC4azG85b4YyyFarvkc/iD5NPrz4Oneqw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-function-name": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.16.5.tgz", + "integrity": "sha512-Fuec/KPSpVLbGo6z1RPw4EE1X+z9gZk1uQmnYy7v4xr4TO9p41v1AoUuXEtyqAI7H+xNJYSICzRqZBhDEkd3kQ==", + "dev": true, + "dependencies": { + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-literals": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.16.5.tgz", + "integrity": "sha512-B1j9C/IfvshnPcklsc93AVLTrNVa69iSqztylZH6qnmiAsDDOmmjEYqOm3Ts2lGSgTSywnBNiqC949VdD0/gfw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-member-expression-literals": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.16.5.tgz", + "integrity": "sha512-d57i3vPHWgIde/9Y8W/xSFUndhvhZN5Wu2TjRrN1MVz5KzdUihKnfDVlfP1U7mS5DNj/WHHhaE4/tTi4hIyHwQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-amd": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.16.5.tgz", + "integrity": "sha512-oHI15S/hdJuSCfnwIz+4lm6wu/wBn7oJ8+QrkzPPwSFGXk8kgdI/AIKcbR/XnD1nQVMg/i6eNaXpszbGuwYDRQ==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "babel-plugin-dynamic-import-node": "^2.3.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-commonjs": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.16.5.tgz", + "integrity": "sha512-ABhUkxvoQyqhCWyb8xXtfwqNMJD7tx+irIRnUh6lmyFud7Jln1WzONXKlax1fg/ey178EXbs4bSGNd6PngO+SQ==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-simple-access": "^7.16.0", + "babel-plugin-dynamic-import-node": "^2.3.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-systemjs": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.16.5.tgz", + "integrity": "sha512-53gmLdScNN28XpjEVIm7LbWnD/b/TpbwKbLk6KV4KqC9WyU6rq1jnNmVG6UgAdQZVVGZVoik3DqHNxk4/EvrjA==", + "dev": true, + "dependencies": { + "@babel/helper-hoist-variables": "^7.16.0", + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-validator-identifier": "^7.15.7", + "babel-plugin-dynamic-import-node": "^2.3.3" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-modules-umd": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.16.5.tgz", + "integrity": "sha512-qTFnpxHMoenNHkS3VoWRdwrcJ3FhX567GvDA3hRZKF0Dj8Fmg0UzySZp3AP2mShl/bzcywb/UWAMQIjA1bhXvw==", + "dev": true, + "dependencies": { + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.16.5.tgz", + "integrity": "sha512-/wqGDgvFUeKELW6ex6QB7dLVRkd5ehjw34tpXu1nhKC0sFfmaLabIswnpf8JgDyV2NeDmZiwoOb0rAmxciNfjA==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/plugin-transform-new-target": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.16.5.tgz", + "integrity": "sha512-ZaIrnXF08ZC8jnKR4/5g7YakGVL6go6V9ql6Jl3ecO8PQaQqFE74CuM384kezju7Z9nGCCA20BqZaR1tJ/WvHg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-object-super": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.16.5.tgz", + "integrity": "sha512-tded+yZEXuxt9Jdtkc1RraW1zMF/GalVxaVVxh41IYwirdRgyAxxxCKZ9XB7LxZqmsjfjALxupNE1MIz9KH+Zg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-replace-supers": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-parameters": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.16.5.tgz", + "integrity": "sha512-B3O6AL5oPop1jAVg8CV+haeUte9oFuY85zu0jwnRNZZi3tVAbJriu5tag/oaO2kGaQM/7q7aGPBlTI5/sr9enA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-property-literals": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.16.5.tgz", + "integrity": "sha512-+IRcVW71VdF9pEH/2R/Apab4a19LVvdVsr/gEeotH00vSDVlKD+XgfSIw+cgGWsjDB/ziqGv/pGoQZBIiQVXHg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-regenerator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.16.5.tgz", + "integrity": "sha512-2z+it2eVWU8TtQQRauvGUqZwLy4+7rTfo6wO4npr+fvvN1SW30ZF3O/ZRCNmTuu4F5MIP8OJhXAhRV5QMJOuYg==", + "dev": true, + "dependencies": { + "regenerator-transform": "^0.14.2" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-reserved-words": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.16.5.tgz", + "integrity": "sha512-aIB16u8lNcf7drkhXJRoggOxSTUAuihTSTfAcpynowGJOZiGf+Yvi7RuTwFzVYSYPmWyARsPqUGoZWWWxLiknw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-shorthand-properties": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.5.tgz", + "integrity": "sha512-ZbuWVcY+MAXJuuW7qDoCwoxDUNClfZxoo7/4swVbOW1s/qYLOMHlm9YRWMsxMFuLs44eXsv4op1vAaBaBaDMVg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-spread": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.16.5.tgz", + "integrity": "sha512-5d6l/cnG7Lw4tGHEoga4xSkYp1euP7LAtrah1h1PgJ3JY7yNsjybsxQAnVK4JbtReZ/8z6ASVmd3QhYYKLaKZw==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-sticky-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.16.5.tgz", + "integrity": "sha512-usYsuO1ID2LXxzuUxifgWtJemP7wL2uZtyrTVM4PKqsmJycdS4U4mGovL5xXkfUheds10Dd2PjoQLXw6zCsCbg==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-template-literals": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.16.5.tgz", + "integrity": "sha512-gnyKy9RyFhkovex4BjKWL3BVYzUDG6zC0gba7VMLbQoDuqMfJ1SDXs8k/XK41Mmt1Hyp4qNAvGFb9hKzdCqBRQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-typeof-symbol": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.16.5.tgz", + "integrity": "sha512-ldxCkW180qbrvyCVDzAUZqB0TAeF8W/vGJoRcaf75awm6By+PxfJKvuqVAnq8N9wz5Xa6mSpM19OfVKKVmGHSQ==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-typescript": { + "version": "7.16.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.16.1.tgz", + "integrity": "sha512-NO4XoryBng06jjw/qWEU2LhcLJr1tWkhpMam/H4eas/CDKMX/b2/Ylb6EI256Y7+FVPCawwSM1rrJNOpDiz+Lg==", + "dev": true, + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.16.0", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-typescript": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-escapes": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.5.tgz", + "integrity": "sha512-shiCBHTIIChGLdyojsKQjoAyB8MBwat25lKM7MJjbe1hE0bgIppD+LX9afr41lLHOhqceqeWl4FkLp+Bgn9o1Q==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-unicode-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.16.5.tgz", + "integrity": "sha512-GTJ4IW012tiPEMMubd7sD07iU9O/LOo8Q/oU4xNhcaq0Xn8+6TcUQaHtC8YxySo1T+ErQ8RaWogIEeFhKGNPzw==", + "dev": true, + "dependencies": { + "@babel/helper-create-regexp-features-plugin": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-env": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.5.tgz", + "integrity": "sha512-MiJJW5pwsktG61NDxpZ4oJ1CKxM1ncam9bzRtx9g40/WkLRkxFP6mhpkYV0/DxcciqoiHicx291+eUQrXb/SfQ==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-compilation-targets": "^7.16.3", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-validator-option": "^7.14.5", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.16.2", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.16.0", + "@babel/plugin-proposal-async-generator-functions": "^7.16.5", + "@babel/plugin-proposal-class-properties": "^7.16.5", + "@babel/plugin-proposal-class-static-block": "^7.16.5", + "@babel/plugin-proposal-dynamic-import": "^7.16.5", + "@babel/plugin-proposal-export-namespace-from": "^7.16.5", + "@babel/plugin-proposal-json-strings": "^7.16.5", + "@babel/plugin-proposal-logical-assignment-operators": "^7.16.5", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5", + "@babel/plugin-proposal-numeric-separator": "^7.16.5", + "@babel/plugin-proposal-object-rest-spread": "^7.16.5", + "@babel/plugin-proposal-optional-catch-binding": "^7.16.5", + "@babel/plugin-proposal-optional-chaining": "^7.16.5", + "@babel/plugin-proposal-private-methods": "^7.16.5", + "@babel/plugin-proposal-private-property-in-object": "^7.16.5", + "@babel/plugin-proposal-unicode-property-regex": "^7.16.5", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-transform-arrow-functions": "^7.16.5", + "@babel/plugin-transform-async-to-generator": "^7.16.5", + "@babel/plugin-transform-block-scoped-functions": "^7.16.5", + "@babel/plugin-transform-block-scoping": "^7.16.5", + "@babel/plugin-transform-classes": "^7.16.5", + "@babel/plugin-transform-computed-properties": "^7.16.5", + "@babel/plugin-transform-destructuring": "^7.16.5", + "@babel/plugin-transform-dotall-regex": "^7.16.5", + "@babel/plugin-transform-duplicate-keys": "^7.16.5", + "@babel/plugin-transform-exponentiation-operator": "^7.16.5", + "@babel/plugin-transform-for-of": "^7.16.5", + "@babel/plugin-transform-function-name": "^7.16.5", + "@babel/plugin-transform-literals": "^7.16.5", + "@babel/plugin-transform-member-expression-literals": "^7.16.5", + "@babel/plugin-transform-modules-amd": "^7.16.5", + "@babel/plugin-transform-modules-commonjs": "^7.16.5", + "@babel/plugin-transform-modules-systemjs": "^7.16.5", + "@babel/plugin-transform-modules-umd": "^7.16.5", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.16.5", + "@babel/plugin-transform-new-target": "^7.16.5", + "@babel/plugin-transform-object-super": "^7.16.5", + "@babel/plugin-transform-parameters": "^7.16.5", + "@babel/plugin-transform-property-literals": "^7.16.5", + "@babel/plugin-transform-regenerator": "^7.16.5", + "@babel/plugin-transform-reserved-words": "^7.16.5", + "@babel/plugin-transform-shorthand-properties": "^7.16.5", + "@babel/plugin-transform-spread": "^7.16.5", + "@babel/plugin-transform-sticky-regex": "^7.16.5", + "@babel/plugin-transform-template-literals": "^7.16.5", + "@babel/plugin-transform-typeof-symbol": "^7.16.5", + "@babel/plugin-transform-unicode-escapes": "^7.16.5", + "@babel/plugin-transform-unicode-regex": "^7.16.5", + "@babel/preset-modules": "^0.1.5", + "@babel/types": "^7.16.0", + "babel-plugin-polyfill-corejs2": "^0.3.0", + "babel-plugin-polyfill-corejs3": "^0.4.0", + "babel-plugin-polyfill-regenerator": "^0.3.0", + "core-js-compat": "^3.19.1", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/preset-modules": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.5.tgz", + "integrity": "sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/register": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.16.5.tgz", + "integrity": "sha512-NpluD+cToBiZiDsG3y9rtIcqDyivsahpaM9csfyfiq1qQWduSmihUZ+ruIqqSDGjZKZMJfgAElo9x2YWlOQuRw==", + "dev": true, + "dependencies": { + "clone-deep": "^4.0.1", + "find-cache-dir": "^2.0.0", + "make-dir": "^2.1.0", + "pirates": "^4.0.0", + "source-map-support": "^0.5.16" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.5.tgz", + "integrity": "sha512-TXWihFIS3Pyv5hzR7j6ihmeLkZfrXGxAr5UfSl8CHf+6q/wpiYDkUau0czckpYG8QmnCIuPpdLtuA9VmuGGyMA==", + "dev": true, + "dependencies": { + "regenerator-runtime": "^0.13.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/template": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.0.tgz", + "integrity": "sha512-MnZdpFD/ZdYhXwiunMqqgyZyucaYsbL0IrjoGjaVhGilz+x8YB++kRfygSOIj1yOtWKPlx7NBp+9I1RQSgsd5A==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.16.0", + "@babel/parser": "^7.16.0", + "@babel/types": "^7.16.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.5.tgz", + "integrity": "sha512-FOCODAzqUMROikDYLYxl4nmwiLlu85rNqBML/A5hKRVXG2LV8d0iMqgPzdYTcIpjZEBB7D6UDU9vxRZiriASdQ==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.16.0", + "@babel/generator": "^7.16.5", + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-hoist-variables": "^7.16.0", + "@babel/helper-split-export-declaration": "^7.16.0", + "@babel/parser": "^7.16.5", + "@babel/types": "^7.16.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.0.tgz", + "integrity": "sha512-PJgg/k3SdLsGb3hhisFvtLOw5ts113klrpLuIPtCJIU+BB24fqq6lf8RWqKJEjzqXR9AEH1rIb5XTqwBHB+kQg==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.15.7", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "node_modules/@cspell/cspell-bundled-dicts": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-5.13.4.tgz", + "integrity": "sha512-D88zFAcEbUJiM03cY1U4Fb1c9BcECi6RvSwwJG/Ayc4lLO9uZgFyKlzQwjSEgTzuCME9A0Nn2hXrD+aWol85Mg==", + "dev": true, + "dependencies": { + "@cspell/dict-ada": "^1.1.2", + "@cspell/dict-aws": "^1.0.14", + "@cspell/dict-bash": "^1.0.17", + "@cspell/dict-companies": "^2.0.2", + "@cspell/dict-cpp": "^1.1.40", + "@cspell/dict-cryptocurrencies": "^1.0.10", + "@cspell/dict-csharp": "^2.0.1", + "@cspell/dict-css": "^1.0.12", + "@cspell/dict-django": "^1.0.26", + "@cspell/dict-dotnet": "^1.0.32", + "@cspell/dict-elixir": "^1.0.26", + "@cspell/dict-en_us": "^2.1.4", + "@cspell/dict-en-gb": "^1.1.33", + "@cspell/dict-filetypes": "^2.0.1", + "@cspell/dict-fonts": "^1.0.14", + "@cspell/dict-fullstack": "^2.0.4", + "@cspell/dict-golang": "^1.1.24", + "@cspell/dict-haskell": "^1.0.13", + "@cspell/dict-html": "^1.1.9", + "@cspell/dict-html-symbol-entities": "^1.0.23", + "@cspell/dict-java": "^1.0.23", + "@cspell/dict-latex": "^1.0.25", + "@cspell/dict-lorem-ipsum": "^1.0.22", + "@cspell/dict-lua": "^1.0.16", + "@cspell/dict-node": "^1.0.12", + "@cspell/dict-npm": "^1.0.16", + "@cspell/dict-php": "^1.0.25", + "@cspell/dict-powershell": "^1.0.19", + "@cspell/dict-public-licenses": "^1.0.4", + "@cspell/dict-python": "^2.0.5", + "@cspell/dict-ruby": "^1.0.15", + "@cspell/dict-rust": "^1.0.23", + "@cspell/dict-scala": "^1.0.21", + "@cspell/dict-software-terms": "^2.0.11", + "@cspell/dict-swift": "^1.0.1", + "@cspell/dict-typescript": "^1.0.19", + "@cspell/dict-vue": "^2.0.1" + }, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/@cspell/cspell-types": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/@cspell/cspell-types/-/cspell-types-5.13.4.tgz", + "integrity": "sha512-OH3aqFfmRNOSO0K0h5JNm84I5RLDgngp1Qa9YeEm9oj1U/qjrm2bOwOGGh9XU/ZjLl56JMbtbnfSpHpT7tLc+A==", + "dev": true, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/@cspell/dict-ada": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@cspell/dict-ada/-/dict-ada-1.1.2.tgz", + "integrity": "sha512-UDrcYcKIVyXDz5mInJabRNQpJoehjBFvja5W+GQyu9pGcx3BS3cAU8mWENstGR0Qc/iFTxB010qwF8F3cHA/aA==", + "dev": true + }, + "node_modules/@cspell/dict-aws": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/@cspell/dict-aws/-/dict-aws-1.0.14.tgz", + "integrity": "sha512-K21CfB4ZpKYwwDQiPfic2zJA/uxkbsd4IQGejEvDAhE3z8wBs6g6BwwqdVO767M9NgZqc021yAVpr79N5pWe3w==", + "dev": true + }, + "node_modules/@cspell/dict-bash": { + "version": "1.0.17", + "resolved": "https://registry.npmjs.org/@cspell/dict-bash/-/dict-bash-1.0.17.tgz", + "integrity": "sha512-BlX+pnDlLmIf776C9d71QjXl4NOIz+yloeixx1ZZjrwvKPLF+ffE/Ez13eV+D9R2Ps1rW10UvW8u3Hbmwme+Fw==", + "dev": true + }, + "node_modules/@cspell/dict-companies": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@cspell/dict-companies/-/dict-companies-2.0.2.tgz", + "integrity": "sha512-LPKwBMAWRz+p1R8q+TV6E1sGOOTvxJOaJeXNN++CZQ7i6JMn5Rf+BSxagwkeK6z3o9vIC5ZE4AcQ5BMkvyjqGw==", + "dev": true + }, + "node_modules/@cspell/dict-cpp": { + "version": "1.1.40", + "resolved": "https://registry.npmjs.org/@cspell/dict-cpp/-/dict-cpp-1.1.40.tgz", + "integrity": "sha512-sscfB3woNDNj60/yGXAdwNtIRWZ89y35xnIaJVDMk5TPMMpaDvuk0a34iOPIq0g4V+Y8e3RyAg71SH6ADwSjGw==", + "dev": true + }, + "node_modules/@cspell/dict-cryptocurrencies": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@cspell/dict-cryptocurrencies/-/dict-cryptocurrencies-1.0.10.tgz", + "integrity": "sha512-47ABvDJOkaST/rXipNMfNvneHUzASvmL6K/CbOFpYKfsd0x23Jc9k1yaOC7JAm82XSC/8a7+3Yu+Fk2jVJNnsA==", + "dev": true + }, + "node_modules/@cspell/dict-csharp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@cspell/dict-csharp/-/dict-csharp-2.0.1.tgz", + "integrity": "sha512-ZzAr+WRP2FUtXHZtfhe8f3j9vPjH+5i44Hcr5JqbWxmqciGoTbWBPQXwu9y+J4mbdC69HSWRrVGkNJ8rQk8pSw==", + "dev": true + }, + "node_modules/@cspell/dict-css": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@cspell/dict-css/-/dict-css-1.0.12.tgz", + "integrity": "sha512-K6yuxej7n454O7dwKG6lHacHrAOMZ0PhMEbmV6qH2JH0U4TtWXfBASYugHvXZCDDx1UObpiJP+3tQJiBqfGpHA==", + "dev": true + }, + "node_modules/@cspell/dict-django": { + "version": "1.0.26", + "resolved": "https://registry.npmjs.org/@cspell/dict-django/-/dict-django-1.0.26.tgz", + "integrity": "sha512-mn9bd7Et1L2zuibc08GVHTiD2Go3/hdjyX5KLukXDklBkq06r+tb0OtKtf1zKodtFDTIaYekGADhNhA6AnKLkg==", + "dev": true + }, + "node_modules/@cspell/dict-dotnet": { + "version": "1.0.32", + "resolved": "https://registry.npmjs.org/@cspell/dict-dotnet/-/dict-dotnet-1.0.32.tgz", + "integrity": "sha512-9H9vXrgJB4KF8xsyTToXO53cXD33iyfrpT4mhCds+YLUw3P3x3E9myszgJzshnrxYBvQZ+QMII57Qr6SjZVk4Q==", + "dev": true + }, + "node_modules/@cspell/dict-elixir": { + "version": "1.0.26", + "resolved": "https://registry.npmjs.org/@cspell/dict-elixir/-/dict-elixir-1.0.26.tgz", + "integrity": "sha512-hz1yETUiRJM7yjN3mITSnxcmZaEyaBbyJhpZPpg+cKUil+xhHeZ2wwfbRc83QHGmlqEuDWbdCFqKSpCDJYpYhg==", + "dev": true + }, + "node_modules/@cspell/dict-en_us": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@cspell/dict-en_us/-/dict-en_us-2.1.4.tgz", + "integrity": "sha512-W4b+aIvZ637FqtTmrTe/T9i9748cuTQf82eWUgV9O296WzZj7rCxm+rzOrmRTAcCmU+9+6Cdsr0unETFQfuxww==", + "dev": true + }, + "node_modules/@cspell/dict-en-gb": { + "version": "1.1.33", + "resolved": "https://registry.npmjs.org/@cspell/dict-en-gb/-/dict-en-gb-1.1.33.tgz", + "integrity": "sha512-tKSSUf9BJEV+GJQAYGw5e+ouhEe2ZXE620S7BLKe3ZmpnjlNG9JqlnaBhkIMxKnNFkLY2BP/EARzw31AZnOv4g==", + "dev": true + }, + "node_modules/@cspell/dict-filetypes": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@cspell/dict-filetypes/-/dict-filetypes-2.0.1.tgz", + "integrity": "sha512-bQ7K3U/3hKO2lpQjObf0veNP/n50qk5CVezSwApMBckf/sAVvDTR1RGAvYdr+vdQnkdQrk6wYmhbshXi0sLDVg==", + "dev": true + }, + "node_modules/@cspell/dict-fonts": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/@cspell/dict-fonts/-/dict-fonts-1.0.14.tgz", + "integrity": "sha512-VhIX+FVYAnqQrOuoFEtya6+H72J82cIicz9QddgknsTqZQ3dvgp6lmVnsQXPM3EnzA8n1peTGpLDwHzT7ociLA==", + "dev": true + }, + "node_modules/@cspell/dict-fullstack": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@cspell/dict-fullstack/-/dict-fullstack-2.0.4.tgz", + "integrity": "sha512-+JtYO58QAXnetRN+MGVzI8YbkbFTLpYfl/Cw/tmNqy7U1IDVC4sTXQ2pZvbbeKQWFHBqYvBs0YASV+mTouXYBw==", + "dev": true + }, + "node_modules/@cspell/dict-golang": { + "version": "1.1.24", + "resolved": "https://registry.npmjs.org/@cspell/dict-golang/-/dict-golang-1.1.24.tgz", + "integrity": "sha512-qq3Cjnx2U1jpeWAGJL1GL0ylEhUMqyaR36Xij6Y6Aq4bViCRp+HRRqk0x5/IHHbOrti45h3yy7ii1itRFo+Xkg==", + "dev": true + }, + "node_modules/@cspell/dict-haskell": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@cspell/dict-haskell/-/dict-haskell-1.0.13.tgz", + "integrity": "sha512-kvl8T84cnYRPpND/P3D86P6WRSqebsbk0FnMfy27zo15L5MLAb3d3MOiT1kW3vEWfQgzUD7uddX/vUiuroQ8TA==", + "dev": true + }, + "node_modules/@cspell/dict-html": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@cspell/dict-html/-/dict-html-1.1.9.tgz", + "integrity": "sha512-vvnYia0tyIS5Fdoz+gEQm77MGZZE66kOJjuNpIYyRHCXFAhWdYz3SmkRm6YKJSWSvuO+WBJYTKDvkOxSh3Fx/w==", + "dev": true + }, + "node_modules/@cspell/dict-html-symbol-entities": { + "version": "1.0.23", + "resolved": "https://registry.npmjs.org/@cspell/dict-html-symbol-entities/-/dict-html-symbol-entities-1.0.23.tgz", + "integrity": "sha512-PV0UBgcBFbBLf/m1wfkVMM8w96kvfHoiCGLWO6BR3Q9v70IXoE4ae0+T+f0CkxcEkacMqEQk/I7vuE9MzrjaNw==", + "dev": true + }, + "node_modules/@cspell/dict-java": { + "version": "1.0.23", + "resolved": "https://registry.npmjs.org/@cspell/dict-java/-/dict-java-1.0.23.tgz", + "integrity": "sha512-LcOg9srYLDoNGd8n3kbfDBlZD+LOC9IVcnFCdua1b/luCHNVmlgBx7e677qPu7olpMYOD5TQIVW2OmM1+/6MFA==", + "dev": true + }, + "node_modules/@cspell/dict-latex": { + "version": "1.0.25", + "resolved": "https://registry.npmjs.org/@cspell/dict-latex/-/dict-latex-1.0.25.tgz", + "integrity": "sha512-cEgg91Migqcp1SdVV7dUeMxbPDhxdNo6Fgq2eygAXQjIOFK520FFvh/qxyBvW90qdZbIRoU2AJpchyHfGuwZFA==", + "dev": true + }, + "node_modules/@cspell/dict-lorem-ipsum": { + "version": "1.0.22", + "resolved": "https://registry.npmjs.org/@cspell/dict-lorem-ipsum/-/dict-lorem-ipsum-1.0.22.tgz", + "integrity": "sha512-yqzspR+2ADeAGUxLTfZ4pXvPl7FmkENMRcGDECmddkOiuEwBCWMZdMP5fng9B0Q6j91hQ8w9CLvJKBz10TqNYg==", + "dev": true + }, + "node_modules/@cspell/dict-lua": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/@cspell/dict-lua/-/dict-lua-1.0.16.tgz", + "integrity": "sha512-YiHDt8kmHJ8nSBy0tHzaxiuitYp+oJ66ffCYuFWTNB3//Y0SI4OGHU3omLsQVeXIfCeVrO4DrVvRDoCls9B5zQ==", + "dev": true + }, + "node_modules/@cspell/dict-node": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@cspell/dict-node/-/dict-node-1.0.12.tgz", + "integrity": "sha512-RPNn/7CSkflAWk0sbSoOkg0ORrgBARUjOW3QjB11KwV1gSu8f5W/ij/S50uIXtlrfoBLqd4OyE04jyON+g/Xfg==", + "dev": true + }, + "node_modules/@cspell/dict-npm": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/@cspell/dict-npm/-/dict-npm-1.0.16.tgz", + "integrity": "sha512-RwkuZGcYBxL3Yux3cSG/IOWGlQ1e9HLCpHeyMtTVGYKAIkFAVUnGrz20l16/Q7zUG7IEktBz5O42kAozrEnqMQ==", + "dev": true + }, + "node_modules/@cspell/dict-php": { + "version": "1.0.25", + "resolved": "https://registry.npmjs.org/@cspell/dict-php/-/dict-php-1.0.25.tgz", + "integrity": "sha512-RoBIP5MRdByyPaXcznZMfOY1JdCMYPPLua5E9gkq0TJO7bX5mC9hyAKfYBSWVQunZydd82HZixjb5MPkDFU1uw==", + "dev": true + }, + "node_modules/@cspell/dict-powershell": { + "version": "1.0.19", + "resolved": "https://registry.npmjs.org/@cspell/dict-powershell/-/dict-powershell-1.0.19.tgz", + "integrity": "sha512-zF/raM/lkhXeHf4I43OtK0gP9rBeEJFArscTVwLWOCIvNk21MJcNoTYoaGw+c056+Q+hJL0psGLO7QN+mxYH1A==", + "dev": true + }, + "node_modules/@cspell/dict-public-licenses": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@cspell/dict-public-licenses/-/dict-public-licenses-1.0.4.tgz", + "integrity": "sha512-h4xULfVEDUeWyvp1OO19pcGDqWcBEQ7WGMp3QBHyYpjsamlzsyYYjCRSY2ZvpM7wruDmywSRFmRHJ/+uNFT7nA==", + "dev": true + }, + "node_modules/@cspell/dict-python": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@cspell/dict-python/-/dict-python-2.0.5.tgz", + "integrity": "sha512-WkyGYtNmUsOHsWixck7AxNvveDgVPqw0H51hzIY+/5u3c94wZUweIj0vfFOGIfOBq8e1ZxpjumKBxVDGXTmQkw==", + "dev": true + }, + "node_modules/@cspell/dict-ruby": { + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/@cspell/dict-ruby/-/dict-ruby-1.0.15.tgz", + "integrity": "sha512-I76hJA///lc1pgmDTGUFHN/O8KLIZIU/8TgIYIGI6Ix/YzSEvWNdQYbANn6JbCynS0X+7IbZ2Ft+QqvmGtIWuA==", + "dev": true + }, + "node_modules/@cspell/dict-rust": { + "version": "1.0.23", + "resolved": "https://registry.npmjs.org/@cspell/dict-rust/-/dict-rust-1.0.23.tgz", + "integrity": "sha512-lR4boDzs79YD6+30mmiSGAMMdwh7HTBAPUFSB0obR3Kidibfc3GZ+MHWZXay5dxZ4nBKM06vyjtanF9VJ8q1Iw==", + "dev": true + }, + "node_modules/@cspell/dict-scala": { + "version": "1.0.21", + "resolved": "https://registry.npmjs.org/@cspell/dict-scala/-/dict-scala-1.0.21.tgz", + "integrity": "sha512-5V/R7PRbbminTpPS3ywgdAalI9BHzcEjEj9ug4kWYvBIGwSnS7T6QCFCiu+e9LvEGUqQC+NHgLY4zs1NaBj2vA==", + "dev": true + }, + "node_modules/@cspell/dict-software-terms": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@cspell/dict-software-terms/-/dict-software-terms-2.0.11.tgz", + "integrity": "sha512-ix5k4m9Y5ZcozgE8QdEhiMIksreGozBETsCo5tGKAs4xDDkS4G07lOMFbek6m5poJ5qk5My0A/iz1j9f3L3aOg==", + "dev": true + }, + "node_modules/@cspell/dict-swift": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@cspell/dict-swift/-/dict-swift-1.0.1.tgz", + "integrity": "sha512-M4onLt10Ptld8Q1BwBit8BBYVZ0d2ZEiBTW1AXekIVPQkPKkwa/RkGlR0GESWNTC2Zbmt/qge7trksVdaYVWFQ==", + "dev": true + }, + "node_modules/@cspell/dict-typescript": { + "version": "1.0.19", + "resolved": "https://registry.npmjs.org/@cspell/dict-typescript/-/dict-typescript-1.0.19.tgz", + "integrity": "sha512-qmJApzoVskDeJnLZzZMaafEDGbEg5Elt4c3Mpg49SWzIHm1N4VXCp5CcFfHsOinJ30dGrs3ARAJGJZIw56kK6A==", + "dev": true + }, + "node_modules/@cspell/dict-vue": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@cspell/dict-vue/-/dict-vue-2.0.1.tgz", + "integrity": "sha512-n9So2C2Zw+uSDRzb2h9wq3PjZBqoHx+vBvu6a34H2qpumNjZ6HaEronrzX5tXJJXzOtocIQYrLxdd128TAU3+g==", + "dev": true + }, + "node_modules/@eslint/eslintrc": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.5.tgz", + "integrity": "sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ==", + "dev": true, + "dependencies": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.2.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/@eslint/eslintrc/node_modules/globals": { + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", + "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@eslint/eslintrc/node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/@humanwhocodes/config-array": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.2.tgz", + "integrity": "sha512-UXOuFCGcwciWckOpmfKDq/GyhlTf9pN/BzG//x8p8zTOFEcGuA68ANXheFS0AGvy3qgZqLBUkMs7hqzqCKOVwA==", + "dev": true, + "dependencies": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=10.10.0" + } + }, + "node_modules/@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "node_modules/@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@microsoft/tsdoc": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz", + "integrity": "sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg==", + "dev": true + }, + "node_modules/@microsoft/tsdoc-config": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz", + "integrity": "sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA==", + "dev": true, + "dependencies": { + "@microsoft/tsdoc": "0.13.2", + "ajv": "~6.12.6", + "jju": "~1.4.0", + "resolve": "~1.19.0" + } + }, + "node_modules/@microsoft/tsdoc-config/node_modules/resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dev": true, + "dependencies": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@types/chai": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", + "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", + "dev": true + }, + "node_modules/@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "node_modules/@types/json-schema": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", + "dev": true + }, + "node_modules/@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, + "node_modules/@types/mocha": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.0.0.tgz", + "integrity": "sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==", + "dev": true + }, + "node_modules/@types/node": { + "version": "17.0.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.5.tgz", + "integrity": "sha512-w3mrvNXLeDYV1GKTZorGJQivK6XLCoGwpnyJFbJVK/aTBQUxOCaa/GlFAAN3OTDFcb7h5tiFG+YXCO2By+riZw==", + "dev": true + }, + "node_modules/@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.8.0.tgz", + "integrity": "sha512-spu1UW7QuBn0nJ6+psnfCc3iVoQAifjKORgBngKOmC8U/1tbe2YJMzYQqDGYB4JCss7L8+RM2kKLb1B1Aw9BNA==", + "dev": true, + "dependencies": { + "@typescript-eslint/experimental-utils": "5.8.0", + "@typescript-eslint/scope-manager": "5.8.0", + "debug": "^4.3.2", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.1.8", + "regexpp": "^3.2.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^5.0.0", + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/experimental-utils": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.8.0.tgz", + "integrity": "sha512-KN5FvNH71bhZ8fKtL+lhW7bjm7cxs1nt+hrDZWIqb6ViCffQcWyLunGrgvISgkRojIDcXIsH+xlFfI4RCDA0xA==", + "dev": true, + "dependencies": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.8.0", + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/typescript-estree": "5.8.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.8.0.tgz", + "integrity": "sha512-Gleacp/ZhRtJRYs5/T8KQR3pAQjQI89Dn/k+OzyCKOsLiZH2/Vh60cFBTnFsHNI6WAD+lNUo/xGZ4NeA5u0Ipw==", + "dev": true, + "dependencies": { + "@typescript-eslint/scope-manager": "5.8.0", + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/typescript-estree": "5.8.0", + "debug": "^4.3.2" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.8.0.tgz", + "integrity": "sha512-x82CYJsLOjPCDuFFEbS6e7K1QEWj7u5Wk1alw8A+gnJiYwNnDJk0ib6PCegbaPMjrfBvFKa7SxE3EOnnIQz2Gg==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/visitor-keys": "5.8.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.8.0.tgz", + "integrity": "sha512-LdCYOqeqZWqCMOmwFnum6YfW9F3nKuxJiR84CdIRN5nfHJ7gyvGpXWqL/AaW0k3Po0+wm93ARAsOdzlZDPCcXg==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.8.0.tgz", + "integrity": "sha512-srfeZ3URdEcUsSLbkOFqS7WoxOqn8JNil2NSLO9O+I2/Uyc85+UlfpEvQHIpj5dVts7KKOZnftoJD/Fdv0L7nQ==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/visitor-keys": "5.8.0", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.8.0.tgz", + "integrity": "sha512-+HDIGOEMnqbxdAHegxvnOqESUH6RWFRR2b8qxP1W9CZnnYh4Usz6MBL+2KMAgPk/P0o9c1HqnYtwzVH6GTIqug==", + "dev": true, + "dependencies": { + "@typescript-eslint/types": "5.8.0", + "eslint-visitor-keys": "^3.0.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "node_modules/acorn": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz", + "integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==", + "dev": true, + "bin": { + "acorn": "bin/acorn" + }, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "peerDependencies": { + "acorn": "^6.0.0 || ^7.0.0 || ^8.0.0" + } + }, + "node_modules/ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "dependencies": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/array-includes": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", + "integrity": "sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1", + "get-intrinsic": "^1.1.1", + "is-string": "^1.0.7" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/array-timsort": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-timsort/-/array-timsort-1.0.3.tgz", + "integrity": "sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==", + "dev": true + }, + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/array.prototype.flat": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", + "integrity": "sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/babel-plugin-dynamic-import-node": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", + "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", + "dev": true, + "dependencies": { + "object.assign": "^4.1.0" + } + }, + "node_modules/babel-plugin-polyfill-corejs2": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.0.tgz", + "integrity": "sha512-wMDoBJ6uG4u4PNFh72Ty6t3EgfA91puCuAwKIazbQlci+ENb/UU9A3xG5lutjUIiXCIn1CY5L15r9LimiJyrSA==", + "dev": true, + "dependencies": { + "@babel/compat-data": "^7.13.11", + "@babel/helper-define-polyfill-provider": "^0.3.0", + "semver": "^6.1.1" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.4.0.tgz", + "integrity": "sha512-YxFreYwUfglYKdLUGvIF2nJEsGwj+RhWSX/ije3D2vQPOXuyMLMtg/cCGMDpOA7Nd+MwlNdnGODbd2EwUZPlsw==", + "dev": true, + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.3.0", + "core-js-compat": "^3.18.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/babel-plugin-polyfill-regenerator": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.0.tgz", + "integrity": "sha512-dhAPTDLGoMW5/84wkgwiLRwMnio2i1fUe53EuvtKMv0pn2p3S8OCoV1xAzfJPl0KOX7IB89s2ib85vbYiea3jg==", + "dev": true, + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.3.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "dependencies": { + "fill-range": "^7.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "node_modules/browserslist": { + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", + "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", + "dev": true, + "dependencies": { + "caniuse-lite": "^1.0.30001286", + "electron-to-chromium": "^1.4.17", + "escalade": "^3.1.1", + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, + "node_modules/buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "node_modules/c8": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/c8/-/c8-7.10.0.tgz", + "integrity": "sha512-OAwfC5+emvA6R7pkYFVBTOtI5ruf9DahffGmIqUc9l6wEh0h7iAFP6dt/V9Ioqlr2zW5avX9U9/w1I4alTRHkA==", + "dev": true, + "dependencies": { + "@bcoe/v8-coverage": "^0.2.3", + "@istanbuljs/schema": "^0.1.2", + "find-up": "^5.0.0", + "foreground-child": "^2.0.0", + "istanbul-lib-coverage": "^3.0.1", + "istanbul-lib-report": "^3.0.0", + "istanbul-reports": "^3.0.2", + "rimraf": "^3.0.0", + "test-exclude": "^6.0.0", + "v8-to-istanbul": "^8.0.0", + "yargs": "^16.2.0", + "yargs-parser": "^20.2.7" + }, + "bin": { + "c8": "bin/c8.js" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/camelcase": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.1.tgz", + "integrity": "sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001292", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001292.tgz", + "integrity": "sha512-jnT4Tq0Q4ma+6nncYQVe7d73kmDmE9C3OGTx3MvW7lBM/eY1S1DZTMBON7dqV481RhNiS5OxD7k9JQvmDOTirw==", + "dev": true, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + } + }, + "node_modules/chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", + "dev": true, + "dependencies": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/chokidar": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", + "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "dev": true, + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/clear-module": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/clear-module/-/clear-module-4.1.2.tgz", + "integrity": "sha512-LWAxzHqdHsAZlPlEyJ2Poz6AIs384mPeqLVCru2p0BrP9G/kVGuhNyZYClLO6cXlnuJjzC8xtsJIuMjKqLXoAw==", + "dev": true, + "dependencies": { + "parent-module": "^2.0.0", + "resolve-from": "^5.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "node_modules/clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "dependencies": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "node_modules/commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true, + "engines": { + "node": ">= 12" + } + }, + "node_modules/comment-json": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/comment-json/-/comment-json-4.1.1.tgz", + "integrity": "sha512-v8gmtPvxhBlhdRBLwdHSjGy9BgA23t9H1FctdQKyUrErPjSrJcdDMqBq9B4Irtm7w3TNYLQJNH6ARKnpyag1sA==", + "dev": true, + "dependencies": { + "array-timsort": "^1.0.3", + "core-util-is": "^1.0.2", + "esprima": "^4.0.1", + "has-own-prop": "^2.0.0", + "repeat-string": "^1.6.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "node_modules/configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "dependencies": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/configstore/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "dependencies": { + "safe-buffer": "~5.1.1" + } + }, + "node_modules/core-js-compat": { + "version": "3.20.1", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.20.1.tgz", + "integrity": "sha512-AVhKZNpqMV3Jz8hU0YEXXE06qoxtQGsAqU0u1neUngz5IusDJRX/ZJ6t3i7mS7QxNyEONbCo14GprkBrxPlTZA==", + "dev": true, + "dependencies": { + "browserslist": "^4.19.1", + "semver": "7.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/core-js" + } + }, + "node_modules/core-js-compat/node_modules/semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, + "node_modules/cosmiconfig": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", + "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "dev": true, + "dependencies": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cspell": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/cspell/-/cspell-5.13.4.tgz", + "integrity": "sha512-T/AMylb/CY0af8Oc1/Nv79Mqe852ga4AOAY0m8eYG8A5zahDpL2EC6PN5yK8KFn0UPMWMB8B2atZf6/U5RWdaQ==", + "dev": true, + "dependencies": { + "chalk": "^4.1.2", + "commander": "^8.3.0", + "comment-json": "^4.1.1", + "cspell-gitignore": "^5.13.4", + "cspell-glob": "^5.13.4", + "cspell-lib": "^5.13.4", + "fast-json-stable-stringify": "^2.1.0", + "file-entry-cache": "^6.0.1", + "fs-extra": "^10.0.0", + "get-stdin": "^8.0.0", + "glob": "^7.2.0", + "imurmurhash": "^0.1.4", + "semver": "^7.3.5", + "strip-ansi": "^6.0.1", + "vscode-uri": "^3.0.2" + }, + "bin": { + "cspell": "bin.js" + }, + "engines": { + "node": ">=12.13.0" + }, + "funding": { + "url": "https://github.com/streetsidesoftware/cspell?sponsor=1" + } + }, + "node_modules/cspell-gitignore": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/cspell-gitignore/-/cspell-gitignore-5.13.4.tgz", + "integrity": "sha512-Md2V+EyILAavxO6CJ/Y/l8/p2nBFA0p1sMrjCEBtBuF3BL7A/A2LGaK4Tb+trVONFAKQ5cZo84WbyvSYWUqvpw==", + "dev": true, + "dependencies": { + "cspell-glob": "^5.13.4", + "find-up": "^5.0.0" + }, + "bin": { + "cspell-gitignore": "bin.js" + }, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/cspell-glob": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/cspell-glob/-/cspell-glob-5.13.4.tgz", + "integrity": "sha512-uKkibBe41Tr609mNBOairsyuNhPo+kqMVw2JeobfgN71GESQLjU7hr6VpKaUKGZyJpaicP606LB0gZBM38IOvw==", + "dev": true, + "dependencies": { + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/cspell-io": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/cspell-io/-/cspell-io-5.13.4.tgz", + "integrity": "sha512-THe0R5CAv2h5yvrF3dtvigY73mnfFlfTJFWoSgGsafKq5nmR8jgKpbjQgK93zL0JC//BgdK0extfrSLsW2D4mw==", + "dev": true, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/cspell-lib": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/cspell-lib/-/cspell-lib-5.13.4.tgz", + "integrity": "sha512-kKGqAMXKdj8l3sgjoJuuQKTuwLz/33c3YFM/d3lYzcP3mo7C4v/M04Dm4mlTdWA0l4WYlzuSqxDmj32SsHMbNA==", + "dev": true, + "dependencies": { + "@cspell/cspell-bundled-dicts": "^5.13.4", + "@cspell/cspell-types": "^5.13.4", + "clear-module": "^4.1.2", + "comment-json": "^4.1.1", + "configstore": "^5.0.1", + "cosmiconfig": "^7.0.1", + "cspell-glob": "^5.13.4", + "cspell-io": "^5.13.4", + "cspell-trie-lib": "^5.13.4", + "find-up": "^5.0.0", + "fs-extra": "^10.0.0", + "gensequence": "^3.1.1", + "import-fresh": "^3.3.0", + "resolve-from": "^5.0.0", + "resolve-global": "^1.0.0", + "vscode-uri": "^3.0.2" + }, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/cspell-trie-lib": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/cspell-trie-lib/-/cspell-trie-lib-5.13.4.tgz", + "integrity": "sha512-e5fKOOioJlJJ+DcLVIkuy+7FI/YmUojhfzdUjTvLDn5EJFL3/oiP5AvDXGV3bMqYzlbRQKD6FpC61KVIkNMbEw==", + "dev": true, + "dependencies": { + "fs-extra": "^10.0.0", + "gensequence": "^3.1.1" + }, + "engines": { + "node": ">=12.13.0" + } + }, + "node_modules/cspell/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/cspell/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/cspell/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/cspell/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/cspell/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/cspell/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/cspell/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "dependencies": { + "type-detect": "^4.0.0" + }, + "engines": { + "node": ">=0.12" + } + }, + "node_modules/deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "node_modules/define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "dependencies": { + "object-keys": "^1.0.12" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true, + "engines": { + "node": ">=0.3.1" + } + }, + "node_modules/dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "dependencies": { + "path-type": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.4.28", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.28.tgz", + "integrity": "sha512-Gzbf0wUtKfyPaqf0Plz+Ctinf9eQIzxEqBHwSvbGfeOm9GMNdLxyu1dNiCUfM+x6r4BE0xUJNh3Nmg9gfAtTmg==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "dependencies": { + "ansi-colors": "^4.1.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "dependencies": { + "is-arrayish": "^0.2.1" + } + }, + "node_modules/es-abstract": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", + "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-symbols": "^1.0.2", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.1", + "object-inspect": "^1.11.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "dependencies": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/eslint": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.5.0.tgz", + "integrity": "sha512-tVGSkgNbOfiHyVte8bCM8OmX+xG9PzVG/B4UCF60zx7j61WIVY/AqJECDgpLD4DbbESD0e174gOg3ZlrX15GDg==", + "dev": true, + "dependencies": { + "@eslint/eslintrc": "^1.0.5", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.0", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.1.0", + "espree": "^9.2.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.2.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "bin": { + "eslint": "bin/eslint.js" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, + "node_modules/eslint-import-resolver-node": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", + "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "resolve": "^1.20.0" + } + }, + "node_modules/eslint-import-resolver-node/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.1.tgz", + "integrity": "sha512-fjoetBXQZq2tSTWZ9yWVl2KuFrTZZH3V+9iD1V1RfpDgxzJR+mPd/KZmMiA8gbPqdBzpNiEHOuT7IYEWxrH0zQ==", + "dev": true, + "dependencies": { + "debug": "^3.2.7", + "find-up": "^2.1.0", + "pkg-dir": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "dependencies": { + "ms": "^2.1.1" + } + }, + "node_modules/eslint-module-utils/node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-module-utils/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-plugin-es": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", + "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "dev": true, + "dependencies": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "engines": { + "node": ">=8.10.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=4.19.1" + } + }, + "node_modules/eslint-plugin-es/node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-plugin-es/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-plugin-import": { + "version": "2.25.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.25.3.tgz", + "integrity": "sha512-RzAVbby+72IB3iOEL8clzPLzL3wpDrlwjsTBAQXgyp5SeTqqY+0bFubwuo+y/HLhNZcXV4XqTBO4LGsfyHIDXg==", + "dev": true, + "dependencies": { + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", + "debug": "^2.6.9", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.1", + "has": "^1.0.3", + "is-core-module": "^2.8.0", + "is-glob": "^4.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.5", + "resolve": "^1.20.0", + "tsconfig-paths": "^3.11.0" + }, + "engines": { + "node": ">=4" + }, + "peerDependencies": { + "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" + } + }, + "node_modules/eslint-plugin-import/node_modules/debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "dependencies": { + "ms": "2.0.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "dependencies": { + "esutils": "^2.0.2" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/eslint-plugin-import/node_modules/ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node_modules/eslint-plugin-internal-rules": { + "resolved": "resources/eslint-internal-rules", + "link": true + }, + "node_modules/eslint-plugin-node": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", + "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "dev": true, + "dependencies": { + "eslint-plugin-es": "^3.0.0", + "eslint-utils": "^2.0.0", + "ignore": "^5.1.1", + "minimatch": "^3.0.4", + "resolve": "^1.10.1", + "semver": "^6.1.0" + }, + "engines": { + "node": ">=8.10.0" + }, + "peerDependencies": { + "eslint": ">=5.16.0" + } + }, + "node_modules/eslint-plugin-node/node_modules/eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^1.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/eslint-plugin-node/node_modules/eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/eslint-plugin-simple-import-sort": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz", + "integrity": "sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw==", + "dev": true, + "peerDependencies": { + "eslint": ">=5.0.0" + } + }, + "node_modules/eslint-plugin-tsdoc": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.14.tgz", + "integrity": "sha512-fJ3fnZRsdIoBZgzkQjv8vAj6NeeOoFkTfgosj6mKsFjX70QV256sA/wq+y/R2+OL4L8E79VVaVWrPeZnKNe8Ng==", + "dev": true, + "dependencies": { + "@microsoft/tsdoc": "0.13.2", + "@microsoft/tsdoc-config": "0.15.2" + } + }, + "node_modules/eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "dependencies": { + "eslint-visitor-keys": "^2.0.0" + }, + "engines": { + "node": "^10.0.0 || ^12.0.0 || >= 14.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + }, + "peerDependencies": { + "eslint": ">=5" + } + }, + "node_modules/eslint-utils/node_modules/eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint-visitor-keys": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz", + "integrity": "sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA==", + "dev": true, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/eslint/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/eslint/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/eslint/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/eslint/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/eslint-scope": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.0.tgz", + "integrity": "sha512-aWwkhnS0qAXqNOgKOK0dJ2nvzEbhEvpy8OlJ9kZ0FeZnA6zpjv1/Vei+puGFFX7zkPCkHHXb7IDX3A+7yPrRWg==", + "dev": true, + "dependencies": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/eslint/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/eslint/node_modules/globals": { + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", + "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", + "dev": true, + "dependencies": { + "type-fest": "^0.20.2" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/eslint/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/eslint/node_modules/ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/eslint/node_modules/semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/eslint/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/espree": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.2.0.tgz", + "integrity": "sha512-oP3utRkynpZWF/F2x/HZJ+AGtnIclaR7z1pYPxy7NYM2fSO6LgK/Rkny8anRSPK/VwEA1eqm2squui0T7ZMOBg==", + "dev": true, + "dependencies": { + "acorn": "^8.6.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^3.1.0" + }, + "engines": { + "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + } + }, + "node_modules/esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true, + "bin": { + "esparse": "bin/esparse.js", + "esvalidate": "bin/esvalidate.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "dependencies": { + "estraverse": "^5.1.0" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/esquery/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "dependencies": { + "estraverse": "^5.2.0" + }, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esrecurse/node_modules/estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true, + "engines": { + "node": ">=4.0" + } + }, + "node_modules/esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "node_modules/fast-glob": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "dev": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "node_modules/fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "node_modules/fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "dependencies": { + "flat-cache": "^3.0.4" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "dependencies": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/find-cache-dir/node_modules/find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "dependencies": { + "locate-path": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/find-cache-dir/node_modules/locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "dependencies": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/find-cache-dir/node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-cache-dir/node_modules/p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "dependencies": { + "p-limit": "^2.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/find-cache-dir/node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/find-cache-dir/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/find-cache-dir/node_modules/pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "dependencies": { + "find-up": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "dependencies": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true, + "bin": { + "flat": "cli.js" + } + }, + "node_modules/flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "dependencies": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + }, + "engines": { + "node": "^10.12.0 || >=12.0.0" + } + }, + "node_modules/flatted": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.4.tgz", + "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", + "dev": true + }, + "node_modules/foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/fs-extra": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "dev": true, + "dependencies": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "node_modules/functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "node_modules/gensequence": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/gensequence/-/gensequence-3.1.1.tgz", + "integrity": "sha512-ys3h0hiteRwmY6BsvSttPmkhC0vEQHPJduANBRtH/dlDPZ0UBIb/dXy80IcckXyuQ6LKg+PloRqvGER9IS7F7g==", + "dev": true, + "engines": { + "node": ">=10.0.0" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-stdin": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", + "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/global-dirs": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", + "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", + "dev": true, + "dependencies": { + "ini": "^1.3.4" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/globby": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", + "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "dev": true, + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/graceful-fs": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", + "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", + "dev": true + }, + "node_modules/growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true, + "engines": { + "node": ">=4.x" + } + }, + "node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/has-own-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-own-prop/-/has-own-prop-2.0.0.tgz", + "integrity": "sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true, + "bin": { + "he": "bin/he" + } + }, + "node_modules/html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "node_modules/ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true, + "engines": { + "node": ">= 4" + } + }, + "node_modules/import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "dependencies": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/import-fresh/node_modules/parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "dependencies": { + "callsites": "^3.0.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/import-fresh/node_modules/resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true, + "engines": { + "node": ">=0.8.19" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "node_modules/internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dev": true, + "dependencies": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "node_modules/is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "dependencies": { + "has-bigints": "^1.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-callable": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-core-module": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", + "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", + "dev": true, + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "dev": true, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/is-number-object": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", + "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": "^3.0.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-shared-array-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", + "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "dependencies": { + "has-symbols": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "node_modules/is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "node_modules/isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "dependencies": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-lib-report/node_modules/make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "dependencies": { + "semver": "^6.0.0" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/istanbul-lib-report/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/istanbul-reports": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.2.tgz", + "integrity": "sha512-0gHxuT1NNC0aEIL1zbJ+MTgPbbHhU77eJPuU35WKA7TgXiSNlCAx4PENoMrH0Or6M2H80TaZcWKhM0IK6V8gRw==", + "dev": true, + "dependencies": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha1-o6vicYryQaKykE+EpiWXDzia4yo=", + "dev": true + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "node_modules/js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "dependencies": { + "argparse": "^2.0.1" + }, + "bin": { + "js-yaml": "bin/js-yaml.js" + } + }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "node_modules/json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "node_modules/json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "node_modules/json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "dev": true, + "dependencies": { + "minimist": "^1.2.5" + }, + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "dependencies": { + "universalify": "^2.0.0" + }, + "optionalDependencies": { + "graceful-fs": "^4.1.6" + } + }, + "node_modules/kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "node_modules/locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "dependencies": { + "p-locate": "^5.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, + "node_modules/lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "node_modules/log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "dependencies": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/log-symbols/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/log-symbols/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/log-symbols/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/log-symbols/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/log-symbols/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/log-symbols/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "dependencies": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/make-dir/node_modules/semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true, + "bin": { + "semver": "bin/semver" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dev": true, + "dependencies": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "node_modules/mocha": { + "version": "9.1.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.3.tgz", + "integrity": "sha512-Xcpl9FqXOAYqI3j79pEtHBBnQgVXIhpULjGQa7DVb0Po+VzmSIK9kanAiWLHoRR/dbZ2qpdPshuXr8l1VaHCzw==", + "dev": true, + "dependencies": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.2", + "debug": "4.3.2", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.7", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.25", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "workerpool": "6.1.5", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "bin": { + "_mocha": "bin/_mocha", + "mocha": "bin/mocha" + }, + "engines": { + "node": ">= 12.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/mochajs" + } + }, + "node_modules/mocha/node_modules/escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mocha/node_modules/glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/mocha/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/mocha/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "node_modules/mocha/node_modules/supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/supports-color?sponsor=1" + } + }, + "node_modules/mocha/node_modules/yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "node_modules/nanoid": { + "version": "3.1.25", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", + "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==", + "dev": true, + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node_modules/node-releases": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", + "dev": true + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object.values": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", + "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "dependencies": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "dependencies": { + "yocto-queue": "^0.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "dependencies": { + "p-limit": "^3.0.2" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/parent-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-2.0.0.tgz", + "integrity": "sha512-uo0Z9JJeWzv8BG+tRcapBKNJ0dro9cLyczGzulS6EfeyAdeC9sbojtW6XwvYxJkEne9En+J2XEl4zyglVeIwFg==", + "dev": true, + "dependencies": { + "callsites": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "node_modules/path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true, + "engines": { + "node": "*" + } + }, + "node_modules/picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "node_modules/picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "dev": true, + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/pirates": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.4.tgz", + "integrity": "sha512-ZIrVPH+A52Dw84R0L3/VS9Op04PuQ2SEoJL6bkshmiTic/HldyW9Tf7oH5mhJZBK7NmDx27vSMrYEXPXclpDKw==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "dependencies": { + "find-up": "^2.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-dir/node_modules/find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "dependencies": { + "locate-path": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-dir/node_modules/locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "dependencies": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-dir/node_modules/p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "dependencies": { + "p-try": "^1.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-dir/node_modules/p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "dependencies": { + "p-limit": "^1.1.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/pkg-dir/node_modules/path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/prettier": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", + "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", + "dev": true, + "bin": { + "prettier": "bin-prettier.js" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true, + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "dependencies": { + "safe-buffer": "^5.1.0" + } + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true + }, + "node_modules/regenerate-unicode-properties": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-9.0.0.tgz", + "integrity": "sha512-3E12UeNSPfjrgwjkR81m5J7Aw/T55Tu7nUyZVQYCKEOs+2dkxEY+DpPtZzO4YruuiPb7NkYLVcyJC4+zCbk5pA==", + "dev": true, + "dependencies": { + "regenerate": "^1.4.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==", + "dev": true + }, + "node_modules/regenerator-transform": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.5.tgz", + "integrity": "sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.8.4" + } + }, + "node_modules/regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/mysticatea" + } + }, + "node_modules/regexpu-core": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.8.0.tgz", + "integrity": "sha512-1F6bYsoYiz6is+oz70NWur2Vlh9KWtswuRuzJOfeYUrfPX2o8n74AnUVaOGDbUqVGO9fNHu48/pjJO4sNVwsOg==", + "dev": true, + "dependencies": { + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^9.0.0", + "regjsgen": "^0.5.2", + "regjsparser": "^0.7.0", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/regjsgen": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", + "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", + "dev": true + }, + "node_modules/regjsparser": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.7.0.tgz", + "integrity": "sha512-A4pcaORqmNMDVwUjWoTzuhwMGpP+NykpfqAsEgI1FSH/EzC7lrN5TMd+kN8YCovX+jMpu8eaqXgXPCa0g8FQNQ==", + "dev": true, + "dependencies": { + "jsesc": "~0.5.0" + }, + "bin": { + "regjsparser": "bin/parser" + } + }, + "node_modules/regjsparser/node_modules/jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + } + }, + "node_modules/repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "dependencies": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/resolve-global": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-global/-/resolve-global-1.0.0.tgz", + "integrity": "sha512-zFa12V4OLtT5XUX/Q4VLvTfBf+Ok0SPc1FNGM/z9ctUdiU618qwKpWnd0CHs3+RqROfyEg/DhuHbMWYqcgljEw==", + "dev": true, + "dependencies": { + "global-dirs": "^0.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true, + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "node_modules/semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true, + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "dependencies": { + "randombytes": "^2.1.0" + } + }, + "node_modules/shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "dependencies": { + "kind-of": "^6.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/signal-exit": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", + "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==", + "dev": true + }, + "node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "dependencies": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + } + }, + "node_modules/source-map-support/node_modules/source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/string.prototype.trimend": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/string.prototype.trimstart": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "dependencies": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/tsconfig-paths": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz", + "integrity": "sha512-e5adrnOYT6zqVnWqZu7i/BQ3BnhzvGbjEjejFXO20lKIKpwTaupkCPgEfv4GZK1IBciJUEhYs3J3p75FdaTFVg==", + "dev": true, + "dependencies": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + } + }, + "node_modules/tsconfig-paths/node_modules/json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "dependencies": { + "minimist": "^1.2.0" + }, + "bin": { + "json5": "lib/cli.js" + } + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "dependencies": { + "tslib": "^1.8.1" + }, + "engines": { + "node": ">= 6" + }, + "peerDependencies": { + "typescript": ">=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta" + } + }, + "node_modules/type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "dependencies": { + "prelude-ls": "^1.2.1" + }, + "engines": { + "node": ">= 0.8.0" + } + }, + "node_modules/type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "dependencies": { + "is-typedarray": "^1.0.0" + } + }, + "node_modules/typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/unbox-primitive": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", + "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "dev": true, + "dependencies": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/unicode-canonical-property-names-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", + "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "dev": true, + "dependencies": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-match-property-value-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", + "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unicode-property-aliases-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz", + "integrity": "sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "dependencies": { + "crypto-random-string": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "dependencies": { + "punycode": "^2.1.0" + } + }, + "node_modules/v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "node_modules/v8-to-istanbul": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.0.tgz", + "integrity": "sha512-/PRhfd8aTNp9Ggr62HPzXg2XasNFGy5PBt0Rp04du7/8GNNSgxFL6WBTkgMKSL9bFjH+8kKEG3f37FmxiTqUUA==", + "dev": true, + "dependencies": { + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0", + "source-map": "^0.7.3" + }, + "engines": { + "node": ">=10.12.0" + } + }, + "node_modules/v8-to-istanbul/node_modules/source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true, + "engines": { + "node": ">= 8" + } + }, + "node_modules/vscode-uri": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.3.tgz", + "integrity": "sha512-EcswR2S8bpR7fD0YPeS7r2xXExrScVMxg4MedACaWHEtx9ftCF/qHG1xGkolzTPcEmjTavCQgbVzHUIdTMzFGA==", + "dev": true + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "dependencies": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/workerpool": { + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.5.tgz", + "integrity": "sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/wrap-ansi/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/wrap-ansi/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "node_modules/write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "dependencies": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "node_modules/xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "node_modules/yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true, + "engines": { + "node": ">= 6" + } + }, + "node_modules/yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "dependencies": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true, + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "dependencies": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "resources/eslint-internal-rules": { + "name": "eslint-plugin-graphql-internal", + "version": "0.0.0", + "dev": true, + "engines": { + "node": ">= 14.0.0" + } + } + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.0.tgz", + "integrity": "sha512-IF4EOMEV+bfYwOmNxGzSnjR2EmQod7f1UXOpZM3l4i4o4QNwzjtJAu/HxdjHq0aYBvdqMuQEY1eg0nqW9ZPORA==", + "dev": true, + "requires": { + "@babel/highlight": "^7.16.0" + } + }, + "@babel/compat-data": { + "version": "7.16.4", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.16.4.tgz", + "integrity": "sha512-1o/jo7D+kC9ZjHX5v+EHrdjl3PhxMrLSOTGsOdHJ+KL8HCaEK6ehrVL2RS6oHDZp+L7xLirLrPmQtEng769J/Q==", + "dev": true + }, + "@babel/core": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.16.5.tgz", + "integrity": "sha512-wUcenlLzuWMZ9Zt8S0KmFwGlH6QKRh3vsm/dhDA3CHkiTA45YuG1XkHRcNRl73EFPXDp/d5kVOU0/y7x2w6OaQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.0", + "@babel/generator": "^7.16.5", + "@babel/helper-compilation-targets": "^7.16.3", + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helpers": "^7.16.5", + "@babel/parser": "^7.16.5", + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0", + "convert-source-map": "^1.7.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.1.2", + "semver": "^6.3.0", + "source-map": "^0.5.0" + } + }, + "@babel/generator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.16.5.tgz", + "integrity": "sha512-kIvCdjZqcdKqoDbVVdt5R99icaRtrtYhYK/xux5qiWCBmfdvEYMFZ68QCrpE5cbFM1JsuArUNs1ZkuKtTtUcZA==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0", + "jsesc": "^2.5.1", + "source-map": "^0.5.0" + } + }, + "@babel/helper-annotate-as-pure": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-annotate-as-pure/-/helper-annotate-as-pure-7.16.0.tgz", + "integrity": "sha512-ItmYF9vR4zA8cByDocY05o0LGUkp1zhbTQOH1NFyl5xXEqlTJQCEJjieriw+aFpxo16swMxUnUiKS7a/r4vtHg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-builder-binary-assignment-operator-visitor": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-builder-binary-assignment-operator-visitor/-/helper-builder-binary-assignment-operator-visitor-7.16.5.tgz", + "integrity": "sha512-3JEA9G5dmmnIWdzaT9d0NmFRgYnWUThLsDaL7982H0XqqWr56lRrsmwheXFMjR+TMl7QMBb6mzy9kvgr1lRLUA==", + "dev": true, + "requires": { + "@babel/helper-explode-assignable-expression": "^7.16.0", + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-compilation-targets": { + "version": "7.16.3", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.16.3.tgz", + "integrity": "sha512-vKsoSQAyBmxS35JUOOt+07cLc6Nk/2ljLIHwmq2/NM6hdioUaqEXq/S+nXvbvXbZkNDlWOymPanJGOc4CBjSJA==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.16.0", + "@babel/helper-validator-option": "^7.14.5", + "browserslist": "^4.17.5", + "semver": "^6.3.0" + } + }, + "@babel/helper-create-class-features-plugin": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-create-class-features-plugin/-/helper-create-class-features-plugin-7.16.5.tgz", + "integrity": "sha512-NEohnYA7mkB8L5JhU7BLwcBdU3j83IziR9aseMueWGeAjblbul3zzb8UvJ3a1zuBiqCMObzCJHFqKIQE6hTVmg==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-member-expression-to-functions": "^7.16.5", + "@babel/helper-optimise-call-expression": "^7.16.0", + "@babel/helper-replace-supers": "^7.16.5", + "@babel/helper-split-export-declaration": "^7.16.0" + } + }, + "@babel/helper-create-regexp-features-plugin": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-create-regexp-features-plugin/-/helper-create-regexp-features-plugin-7.16.0.tgz", + "integrity": "sha512-3DyG0zAFAZKcOp7aVr33ddwkxJ0Z0Jr5V99y3I690eYLpukJsJvAbzTy1ewoCqsML8SbIrjH14Jc/nSQ4TvNPA==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "regexpu-core": "^4.7.1" + } + }, + "@babel/helper-define-polyfill-provider": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.0.tgz", + "integrity": "sha512-7hfT8lUljl/tM3h+izTX/pO3W3frz2ok6Pk+gzys8iJqDfZrZy2pXjRTZAvG2YmfHun1X4q8/UZRLatMfqc5Tg==", + "dev": true, + "requires": { + "@babel/helper-compilation-targets": "^7.13.0", + "@babel/helper-module-imports": "^7.12.13", + "@babel/helper-plugin-utils": "^7.13.0", + "@babel/traverse": "^7.13.0", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2", + "semver": "^6.1.2" + } + }, + "@babel/helper-environment-visitor": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.16.5.tgz", + "integrity": "sha512-ODQyc5AnxmZWm/R2W7fzhamOk1ey8gSguo5SGvF0zcB3uUzRpTRmM/jmLSm9bDMyPlvbyJ+PwPEK0BWIoZ9wjg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-explode-assignable-expression": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-explode-assignable-expression/-/helper-explode-assignable-expression-7.16.0.tgz", + "integrity": "sha512-Hk2SLxC9ZbcOhLpg/yMznzJ11W++lg5GMbxt1ev6TXUiJB0N42KPC+7w8a+eWGuqDnUYuwStJoZHM7RgmIOaGQ==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-function-name": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.16.0.tgz", + "integrity": "sha512-BZh4mEk1xi2h4HFjWUXRQX5AEx4rvaZxHgax9gcjdLWdkjsY7MKt5p0otjsg5noXw+pB+clMCjw+aEVYADMjog==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "^7.16.0", + "@babel/template": "^7.16.0", + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.0.tgz", + "integrity": "sha512-ASCquNcywC1NkYh/z7Cgp3w31YW8aojjYIlNg4VeJiHkqyP4AzIvr4qx7pYDb4/s8YcsZWqqOSxgkvjUz1kpDQ==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.16.0.tgz", + "integrity": "sha512-1AZlpazjUR0EQZQv3sgRNfM9mEVWPK3M6vlalczA+EECcPz3XPh6VplbErL5UoMpChhSck5wAJHthlj1bYpcmg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-member-expression-to-functions": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-member-expression-to-functions/-/helper-member-expression-to-functions-7.16.5.tgz", + "integrity": "sha512-7fecSXq7ZrLE+TWshbGT+HyCLkxloWNhTbU2QM1NTI/tDqyf0oZiMcEfYtDuUDCo528EOlt39G1rftea4bRZIw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-module-imports": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.16.0.tgz", + "integrity": "sha512-kkH7sWzKPq0xt3H1n+ghb4xEMP8k0U7XV3kkB+ZGy69kDk2ySFW1qPi06sjKzFY3t1j6XbJSqr4mF9L7CYVyhg==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-module-transforms": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.16.5.tgz", + "integrity": "sha512-CkvMxgV4ZyyioElFwcuWnDCcNIeyqTkCm9BxXZi73RR1ozqlpboqsbGUNvRTflgZtFbbJ1v5Emvm+lkjMYY/LQ==", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-module-imports": "^7.16.0", + "@babel/helper-simple-access": "^7.16.0", + "@babel/helper-split-export-declaration": "^7.16.0", + "@babel/helper-validator-identifier": "^7.15.7", + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-optimise-call-expression": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-optimise-call-expression/-/helper-optimise-call-expression-7.16.0.tgz", + "integrity": "sha512-SuI467Gi2V8fkofm2JPnZzB/SUuXoJA5zXe/xzyPP2M04686RzFKFHPK6HDVN6JvWBIEW8tt9hPR7fXdn2Lgpw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-plugin-utils": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.16.5.tgz", + "integrity": "sha512-59KHWHXxVA9K4HNF4sbHCf+eJeFe0Te/ZFGqBT4OjXhrwvA04sGfaEGsVTdsjoszq0YTP49RC9UKe5g8uN2RwQ==", + "dev": true + }, + "@babel/helper-remap-async-to-generator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-remap-async-to-generator/-/helper-remap-async-to-generator-7.16.5.tgz", + "integrity": "sha512-X+aAJldyxrOmN9v3FKp+Hu1NO69VWgYgDGq6YDykwRPzxs5f2N+X988CBXS7EQahDU+Vpet5QYMqLk+nsp+Qxw==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "@babel/helper-wrap-function": "^7.16.5", + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-replace-supers": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-replace-supers/-/helper-replace-supers-7.16.5.tgz", + "integrity": "sha512-ao3seGVa/FZCMCCNDuBcqnBFSbdr8N2EW35mzojx3TwfIbdPmNK+JV6+2d5bR0Z71W5ocLnQp9en/cTF7pBJiQ==", + "dev": true, + "requires": { + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-member-expression-to-functions": "^7.16.5", + "@babel/helper-optimise-call-expression": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-simple-access": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.16.0.tgz", + "integrity": "sha512-o1rjBT/gppAqKsYfUdfHq5Rk03lMQrkPHG1OWzHWpLgVXRH4HnMM9Et9CVdIqwkCQlobnGHEJMsgWP/jE1zUiw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-skip-transparent-expression-wrappers": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-skip-transparent-expression-wrappers/-/helper-skip-transparent-expression-wrappers-7.16.0.tgz", + "integrity": "sha512-+il1gTy0oHwUsBQZyJvukbB4vPMdcYBrFHa0Uc4AizLxbq6BOYC51Rv4tWocX9BLBDLZ4kc6qUFpQ6HRgL+3zw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.16.0.tgz", + "integrity": "sha512-0YMMRpuDFNGTHNRiiqJX19GjNXA4H0E8jZ2ibccfSxaCogbm3am5WN/2nQNj0YnQwGWM1J06GOcQ2qnh3+0paw==", + "dev": true, + "requires": { + "@babel/types": "^7.16.0" + } + }, + "@babel/helper-validator-identifier": { + "version": "7.15.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.15.7.tgz", + "integrity": "sha512-K4JvCtQqad9OY2+yTU8w+E82ywk/fe+ELNlt1G8z3bVGlZfn/hOcQQsUhGhW/N+tb3fxK800wLtKOE/aM0m72w==", + "dev": true + }, + "@babel/helper-validator-option": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz", + "integrity": "sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow==", + "dev": true + }, + "@babel/helper-wrap-function": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helper-wrap-function/-/helper-wrap-function-7.16.5.tgz", + "integrity": "sha512-2J2pmLBqUqVdJw78U0KPNdeE2qeuIyKoG4mKV7wAq3mc4jJG282UgjZw4ZYDnqiWQuS3Y3IYdF/AQ6CpyBV3VA==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.16.0", + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0" + } + }, + "@babel/helpers": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.16.5.tgz", + "integrity": "sha512-TLgi6Lh71vvMZGEkFuIxzaPsyeYCHQ5jJOOX1f0xXn0uciFuE8cEk0wyBquMcCxBXZ5BJhE2aUB7pnWTD150Tw==", + "dev": true, + "requires": { + "@babel/template": "^7.16.0", + "@babel/traverse": "^7.16.5", + "@babel/types": "^7.16.0" + } + }, + "@babel/highlight": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.0.tgz", + "integrity": "sha512-t8MH41kUQylBtu2+4IQA3atqevA2lRgqA2wyVB/YiWmsDSuylZZuXOUy9ric30hfzauEFfdsuk/eXTRrGrfd0g==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.15.7", + "chalk": "^2.0.0", + "js-tokens": "^4.0.0" + } + }, + "@babel/parser": { + "version": "7.16.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.16.6.tgz", + "integrity": "sha512-Gr86ujcNuPDnNOY8mi383Hvi8IYrJVJYuf3XcuBM/Dgd+bINn/7tHqsj+tKkoreMbmGsFLsltI/JJd8fOFWGDQ==", + "dev": true + }, + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": { + "version": "7.16.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression/-/plugin-bugfix-safari-id-destructuring-collision-in-function-expression-7.16.2.tgz", + "integrity": "sha512-h37CvpLSf8gb2lIJ2CgC3t+EjFbi0t8qS7LCS1xcJIlEXE4czlofwaW7W1HA8zpgOCzI9C1nmoqNR1zWkk0pQg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining/-/plugin-bugfix-v8-spread-parameters-in-optional-chaining-7.16.0.tgz", + "integrity": "sha512-4tcFwwicpWTrpl9qjf7UsoosaArgImF85AxqCRZlgc3IQDvkUHjJpruXAL58Wmj+T6fypWTC/BakfEkwIL/pwA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", + "@babel/plugin-proposal-optional-chaining": "^7.16.0" + } + }, + "@babel/plugin-proposal-async-generator-functions": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-async-generator-functions/-/plugin-proposal-async-generator-functions-7.16.5.tgz", + "integrity": "sha512-C/FX+3HNLV6sz7AqbTQqEo1L9/kfrKjxcVtgyBCmvIgOjvuBVUWooDoi7trsLxOzCEo5FccjRvKHkfDsJFZlfA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-remap-async-to-generator": "^7.16.5", + "@babel/plugin-syntax-async-generators": "^7.8.4" + } + }, + "@babel/plugin-proposal-class-properties": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.5.tgz", + "integrity": "sha512-pJD3HjgRv83s5dv1sTnDbZOaTjghKEz8KUn1Kbh2eAIRhGuyQ1XSeI4xVXU3UlIEVA3DAyIdxqT1eRn7Wcn55A==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-proposal-class-static-block": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-static-block/-/plugin-proposal-class-static-block-7.16.5.tgz", + "integrity": "sha512-EEFzuLZcm/rNJ8Q5krK+FRKdVkd6FjfzT9tuSZql9sQn64K0hHA2KLJ0DqVot9/iV6+SsuadC5yI39zWnm+nmQ==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-class-static-block": "^7.14.5" + } + }, + "@babel/plugin-proposal-dynamic-import": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-dynamic-import/-/plugin-proposal-dynamic-import-7.16.5.tgz", + "integrity": "sha512-P05/SJZTTvHz79LNYTF8ff5xXge0kk5sIIWAypcWgX4BTRUgyHc8wRxJ/Hk+mU0KXldgOOslKaeqnhthcDJCJQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3" + } + }, + "@babel/plugin-proposal-export-namespace-from": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-export-namespace-from/-/plugin-proposal-export-namespace-from-7.16.5.tgz", + "integrity": "sha512-i+sltzEShH1vsVydvNaTRsgvq2vZsfyrd7K7vPLUU/KgS0D5yZMe6uipM0+izminnkKrEfdUnz7CxMRb6oHZWw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3" + } + }, + "@babel/plugin-proposal-json-strings": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-json-strings/-/plugin-proposal-json-strings-7.16.5.tgz", + "integrity": "sha512-QQJueTFa0y9E4qHANqIvMsuxM/qcLQmKttBACtPCQzGUEizsXDACGonlPiSwynHfOa3vNw0FPMVvQzbuXwh4SQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-json-strings": "^7.8.3" + } + }, + "@babel/plugin-proposal-logical-assignment-operators": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-logical-assignment-operators/-/plugin-proposal-logical-assignment-operators-7.16.5.tgz", + "integrity": "sha512-xqibl7ISO2vjuQM+MzR3rkd0zfNWltk7n9QhaD8ghMmMceVguYrNDt7MikRyj4J4v3QehpnrU8RYLnC7z/gZLA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4" + } + }, + "@babel/plugin-proposal-nullish-coalescing-operator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.16.5.tgz", + "integrity": "sha512-YwMsTp/oOviSBhrjwi0vzCUycseCYwoXnLiXIL3YNjHSMBHicGTz7GjVU/IGgz4DtOEXBdCNG72pvCX22ehfqg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" + } + }, + "@babel/plugin-proposal-numeric-separator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.16.5.tgz", + "integrity": "sha512-DvB9l/TcsCRvsIV9v4jxR/jVP45cslTVC0PMVHvaJhhNuhn2Y1SOhCSFlPK777qLB5wb8rVDaNoqMTyOqtY5Iw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-numeric-separator": "^7.10.4" + } + }, + "@babel/plugin-proposal-object-rest-spread": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.16.5.tgz", + "integrity": "sha512-UEd6KpChoyPhCoE840KRHOlGhEZFutdPDMGj+0I56yuTTOaT51GzmnEl/0uT41fB/vD2nT+Pci2KjezyE3HmUw==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-compilation-targets": "^7.16.3", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-transform-parameters": "^7.16.5" + } + }, + "@babel/plugin-proposal-optional-catch-binding": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-catch-binding/-/plugin-proposal-optional-catch-binding-7.16.5.tgz", + "integrity": "sha512-ihCMxY1Iljmx4bWy/PIMJGXN4NS4oUj1MKynwO07kiKms23pNvIn1DMB92DNB2R0EA882sw0VXIelYGdtF7xEQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3" + } + }, + "@babel/plugin-proposal-optional-chaining": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.16.5.tgz", + "integrity": "sha512-kzdHgnaXRonttiTfKYnSVafbWngPPr2qKw9BWYBESl91W54e+9R5pP70LtWxV56g0f05f/SQrwHYkfvbwcdQ/A==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0", + "@babel/plugin-syntax-optional-chaining": "^7.8.3" + } + }, + "@babel/plugin-proposal-private-methods": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.16.5.tgz", + "integrity": "sha512-+yFMO4BGT3sgzXo+lrq7orX5mAZt57DwUK6seqII6AcJnJOIhBJ8pzKH47/ql/d426uQ7YhN8DpUFirQzqYSUA==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-proposal-private-property-in-object": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.16.5.tgz", + "integrity": "sha512-+YGh5Wbw0NH3y/E5YMu6ci5qTDmAEVNoZ3I54aB6nVEOZ5BQ7QJlwKq5pYVucQilMByGn/bvX0af+uNaPRCabA==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "@babel/helper-create-class-features-plugin": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + } + }, + "@babel/plugin-proposal-unicode-property-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.16.5.tgz", + "integrity": "sha512-s5sKtlKQyFSatt781HQwv1hoM5BQ9qRH30r+dK56OLDsHmV74mzwJNX7R1yMuE7VZKG5O6q/gmOGSAO6ikTudg==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-class-static-block": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-static-block/-/plugin-syntax-class-static-block-7.14.5.tgz", + "integrity": "sha512-b+YyPmr6ldyNnM6sqYeMWE+bgJcJpO6yS4QD7ymxgH34GBPNDM/THBh8iunyvKIZztiwLH4CJZ0RxTk9emgpjw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-dynamic-import": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", + "integrity": "sha512-5gdGbFon+PszYzqs83S3E5mpi7/y/8M9eC90MRTZfduQOYW76ig6SOSPNe41IG5LoP3FGBn2N0RjVDSQiS94kQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-export-namespace-from": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-export-namespace-from/-/plugin-syntax-export-namespace-from-7.8.3.tgz", + "integrity": "sha512-MXf5laXo6c1IbEbegDmzGPwGNTsHZmEy6QGznu5Sh2UCWvueywb2ee+CCE4zQiZstxU9BMoQO9i6zUFSY0Kj0Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.3" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-private-property-in-object": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-private-property-in-object/-/plugin-syntax-private-property-in-object-7.14.5.tgz", + "integrity": "sha512-0wVnp9dxJ72ZUJDV27ZfbSj6iHLoytYZmh3rFcxNnvsJF3ktkzLDZPy/mA17HGsaQT3/DQsWYX1f1QGWkCoVUg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-typescript": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.16.5.tgz", + "integrity": "sha512-/d4//lZ1Vqb4mZ5xTep3dDK888j7BGM/iKqBmndBaoYAFPlPKrGU608VVBz5JeyAb6YQDjRu1UKqj86UhwWVgw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-arrow-functions": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-arrow-functions/-/plugin-transform-arrow-functions-7.16.5.tgz", + "integrity": "sha512-8bTHiiZyMOyfZFULjsCnYOWG059FVMes0iljEHSfARhNgFfpsqE92OrCffv3veSw9rwMkYcFe9bj0ZoXU2IGtQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-async-to-generator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-async-to-generator/-/plugin-transform-async-to-generator-7.16.5.tgz", + "integrity": "sha512-TMXgfioJnkXU+XRoj7P2ED7rUm5jbnDWwlCuFVTpQboMfbSya5WrmubNBAMlk7KXvywpo8rd8WuYZkis1o2H8w==", + "dev": true, + "requires": { + "@babel/helper-module-imports": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-remap-async-to-generator": "^7.16.5" + } + }, + "@babel/plugin-transform-block-scoped-functions": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoped-functions/-/plugin-transform-block-scoped-functions-7.16.5.tgz", + "integrity": "sha512-BxmIyKLjUGksJ99+hJyL/HIxLIGnLKtw772zYDER7UuycDZ+Xvzs98ZQw6NGgM2ss4/hlFAaGiZmMNKvValEjw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-block-scoping": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.16.5.tgz", + "integrity": "sha512-JxjSPNZSiOtmxjX7PBRBeRJTUKTyJ607YUYeT0QJCNdsedOe+/rXITjP08eG8xUpsLfPirgzdCFN+h0w6RI+pQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-classes": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-classes/-/plugin-transform-classes-7.16.5.tgz", + "integrity": "sha512-DzJ1vYf/7TaCYy57J3SJ9rV+JEuvmlnvvyvYKFbk5u46oQbBvuB9/0w+YsVsxkOv8zVWKpDmUoj4T5ILHoXevA==", + "dev": true, + "requires": { + "@babel/helper-annotate-as-pure": "^7.16.0", + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-optimise-call-expression": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-replace-supers": "^7.16.5", + "@babel/helper-split-export-declaration": "^7.16.0", + "globals": "^11.1.0" + } + }, + "@babel/plugin-transform-computed-properties": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-computed-properties/-/plugin-transform-computed-properties-7.16.5.tgz", + "integrity": "sha512-n1+O7xtU5lSLraRzX88CNcpl7vtGdPakKzww74bVwpAIRgz9JVLJJpOLb0uYqcOaXVM0TL6X0RVeIJGD2CnCkg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-destructuring": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.16.5.tgz", + "integrity": "sha512-GuRVAsjq+c9YPK6NeTkRLWyQskDC099XkBSVO+6QzbnOnH2d/4mBVXYStaPrZD3dFRfg00I6BFJ9Atsjfs8mlg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-dotall-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.16.5.tgz", + "integrity": "sha512-iQiEMt8Q4/5aRGHpGVK2Zc7a6mx7qEAO7qehgSug3SDImnuMzgmm/wtJALXaz25zUj1PmnNHtShjFgk4PDx4nw==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-duplicate-keys": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-duplicate-keys/-/plugin-transform-duplicate-keys-7.16.5.tgz", + "integrity": "sha512-81tijpDg2a6I1Yhj4aWY1l3O1J4Cg/Pd7LfvuaH2VVInAkXtzibz9+zSPdUM1WvuUi128ksstAP0hM5w48vQgg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-exponentiation-operator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-exponentiation-operator/-/plugin-transform-exponentiation-operator-7.16.5.tgz", + "integrity": "sha512-12rba2HwemQPa7BLIKCzm1pT2/RuQHtSFHdNl41cFiC6oi4tcrp7gjB07pxQvFpcADojQywSjblQth6gJyE6CA==", + "dev": true, + "requires": { + "@babel/helper-builder-binary-assignment-operator-visitor": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-for-of": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.16.5.tgz", + "integrity": "sha512-+DpCAJFPAvViR17PIMi9x2AE34dll5wNlXO43wagAX2YcRGgEVHCNFC4azG85b4YyyFarvkc/iD5NPrz4Oneqw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-function-name": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-function-name/-/plugin-transform-function-name-7.16.5.tgz", + "integrity": "sha512-Fuec/KPSpVLbGo6z1RPw4EE1X+z9gZk1uQmnYy7v4xr4TO9p41v1AoUuXEtyqAI7H+xNJYSICzRqZBhDEkd3kQ==", + "dev": true, + "requires": { + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-literals": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-literals/-/plugin-transform-literals-7.16.5.tgz", + "integrity": "sha512-B1j9C/IfvshnPcklsc93AVLTrNVa69iSqztylZH6qnmiAsDDOmmjEYqOm3Ts2lGSgTSywnBNiqC949VdD0/gfw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-member-expression-literals": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-member-expression-literals/-/plugin-transform-member-expression-literals-7.16.5.tgz", + "integrity": "sha512-d57i3vPHWgIde/9Y8W/xSFUndhvhZN5Wu2TjRrN1MVz5KzdUihKnfDVlfP1U7mS5DNj/WHHhaE4/tTi4hIyHwQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-modules-amd": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-amd/-/plugin-transform-modules-amd-7.16.5.tgz", + "integrity": "sha512-oHI15S/hdJuSCfnwIz+4lm6wu/wBn7oJ8+QrkzPPwSFGXk8kgdI/AIKcbR/XnD1nQVMg/i6eNaXpszbGuwYDRQ==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-commonjs": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.16.5.tgz", + "integrity": "sha512-ABhUkxvoQyqhCWyb8xXtfwqNMJD7tx+irIRnUh6lmyFud7Jln1WzONXKlax1fg/ey178EXbs4bSGNd6PngO+SQ==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-simple-access": "^7.16.0", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-systemjs": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-systemjs/-/plugin-transform-modules-systemjs-7.16.5.tgz", + "integrity": "sha512-53gmLdScNN28XpjEVIm7LbWnD/b/TpbwKbLk6KV4KqC9WyU6rq1jnNmVG6UgAdQZVVGZVoik3DqHNxk4/EvrjA==", + "dev": true, + "requires": { + "@babel/helper-hoist-variables": "^7.16.0", + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-validator-identifier": "^7.15.7", + "babel-plugin-dynamic-import-node": "^2.3.3" + } + }, + "@babel/plugin-transform-modules-umd": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-umd/-/plugin-transform-modules-umd-7.16.5.tgz", + "integrity": "sha512-qTFnpxHMoenNHkS3VoWRdwrcJ3FhX567GvDA3hRZKF0Dj8Fmg0UzySZp3AP2mShl/bzcywb/UWAMQIjA1bhXvw==", + "dev": true, + "requires": { + "@babel/helper-module-transforms": "^7.16.5", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-named-capturing-groups-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.16.5.tgz", + "integrity": "sha512-/wqGDgvFUeKELW6ex6QB7dLVRkd5ehjw34tpXu1nhKC0sFfmaLabIswnpf8JgDyV2NeDmZiwoOb0rAmxciNfjA==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.0" + } + }, + "@babel/plugin-transform-new-target": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-new-target/-/plugin-transform-new-target-7.16.5.tgz", + "integrity": "sha512-ZaIrnXF08ZC8jnKR4/5g7YakGVL6go6V9ql6Jl3ecO8PQaQqFE74CuM384kezju7Z9nGCCA20BqZaR1tJ/WvHg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-object-super": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-object-super/-/plugin-transform-object-super-7.16.5.tgz", + "integrity": "sha512-tded+yZEXuxt9Jdtkc1RraW1zMF/GalVxaVVxh41IYwirdRgyAxxxCKZ9XB7LxZqmsjfjALxupNE1MIz9KH+Zg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-replace-supers": "^7.16.5" + } + }, + "@babel/plugin-transform-parameters": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-parameters/-/plugin-transform-parameters-7.16.5.tgz", + "integrity": "sha512-B3O6AL5oPop1jAVg8CV+haeUte9oFuY85zu0jwnRNZZi3tVAbJriu5tag/oaO2kGaQM/7q7aGPBlTI5/sr9enA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-property-literals": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-property-literals/-/plugin-transform-property-literals-7.16.5.tgz", + "integrity": "sha512-+IRcVW71VdF9pEH/2R/Apab4a19LVvdVsr/gEeotH00vSDVlKD+XgfSIw+cgGWsjDB/ziqGv/pGoQZBIiQVXHg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-regenerator": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.16.5.tgz", + "integrity": "sha512-2z+it2eVWU8TtQQRauvGUqZwLy4+7rTfo6wO4npr+fvvN1SW30ZF3O/ZRCNmTuu4F5MIP8OJhXAhRV5QMJOuYg==", + "dev": true, + "requires": { + "regenerator-transform": "^0.14.2" + } + }, + "@babel/plugin-transform-reserved-words": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-reserved-words/-/plugin-transform-reserved-words-7.16.5.tgz", + "integrity": "sha512-aIB16u8lNcf7drkhXJRoggOxSTUAuihTSTfAcpynowGJOZiGf+Yvi7RuTwFzVYSYPmWyARsPqUGoZWWWxLiknw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-shorthand-properties": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.16.5.tgz", + "integrity": "sha512-ZbuWVcY+MAXJuuW7qDoCwoxDUNClfZxoo7/4swVbOW1s/qYLOMHlm9YRWMsxMFuLs44eXsv4op1vAaBaBaDMVg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-spread": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.16.5.tgz", + "integrity": "sha512-5d6l/cnG7Lw4tGHEoga4xSkYp1euP7LAtrah1h1PgJ3JY7yNsjybsxQAnVK4JbtReZ/8z6ASVmd3QhYYKLaKZw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-skip-transparent-expression-wrappers": "^7.16.0" + } + }, + "@babel/plugin-transform-sticky-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-sticky-regex/-/plugin-transform-sticky-regex-7.16.5.tgz", + "integrity": "sha512-usYsuO1ID2LXxzuUxifgWtJemP7wL2uZtyrTVM4PKqsmJycdS4U4mGovL5xXkfUheds10Dd2PjoQLXw6zCsCbg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-template-literals": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-template-literals/-/plugin-transform-template-literals-7.16.5.tgz", + "integrity": "sha512-gnyKy9RyFhkovex4BjKWL3BVYzUDG6zC0gba7VMLbQoDuqMfJ1SDXs8k/XK41Mmt1Hyp4qNAvGFb9hKzdCqBRQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-typeof-symbol": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typeof-symbol/-/plugin-transform-typeof-symbol-7.16.5.tgz", + "integrity": "sha512-ldxCkW180qbrvyCVDzAUZqB0TAeF8W/vGJoRcaf75awm6By+PxfJKvuqVAnq8N9wz5Xa6mSpM19OfVKKVmGHSQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-typescript": { + "version": "7.16.1", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.16.1.tgz", + "integrity": "sha512-NO4XoryBng06jjw/qWEU2LhcLJr1tWkhpMam/H4eas/CDKMX/b2/Ylb6EI256Y7+FVPCawwSM1rrJNOpDiz+Lg==", + "dev": true, + "requires": { + "@babel/helper-create-class-features-plugin": "^7.16.0", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/plugin-syntax-typescript": "^7.16.0" + } + }, + "@babel/plugin-transform-unicode-escapes": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.16.5.tgz", + "integrity": "sha512-shiCBHTIIChGLdyojsKQjoAyB8MBwat25lKM7MJjbe1hE0bgIppD+LX9afr41lLHOhqceqeWl4FkLp+Bgn9o1Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/plugin-transform-unicode-regex": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.16.5.tgz", + "integrity": "sha512-GTJ4IW012tiPEMMubd7sD07iU9O/LOo8Q/oU4xNhcaq0Xn8+6TcUQaHtC8YxySo1T+ErQ8RaWogIEeFhKGNPzw==", + "dev": true, + "requires": { + "@babel/helper-create-regexp-features-plugin": "^7.16.0", + "@babel/helper-plugin-utils": "^7.16.5" + } + }, + "@babel/preset-env": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.5.tgz", + "integrity": "sha512-MiJJW5pwsktG61NDxpZ4oJ1CKxM1ncam9bzRtx9g40/WkLRkxFP6mhpkYV0/DxcciqoiHicx291+eUQrXb/SfQ==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-compilation-targets": "^7.16.3", + "@babel/helper-plugin-utils": "^7.16.5", + "@babel/helper-validator-option": "^7.14.5", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.16.2", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.16.0", + "@babel/plugin-proposal-async-generator-functions": "^7.16.5", + "@babel/plugin-proposal-class-properties": "^7.16.5", + "@babel/plugin-proposal-class-static-block": "^7.16.5", + "@babel/plugin-proposal-dynamic-import": "^7.16.5", + "@babel/plugin-proposal-export-namespace-from": "^7.16.5", + "@babel/plugin-proposal-json-strings": "^7.16.5", + "@babel/plugin-proposal-logical-assignment-operators": "^7.16.5", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.5", + "@babel/plugin-proposal-numeric-separator": "^7.16.5", + "@babel/plugin-proposal-object-rest-spread": "^7.16.5", + "@babel/plugin-proposal-optional-catch-binding": "^7.16.5", + "@babel/plugin-proposal-optional-chaining": "^7.16.5", + "@babel/plugin-proposal-private-methods": "^7.16.5", + "@babel/plugin-proposal-private-property-in-object": "^7.16.5", + "@babel/plugin-proposal-unicode-property-regex": "^7.16.5", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-transform-arrow-functions": "^7.16.5", + "@babel/plugin-transform-async-to-generator": "^7.16.5", + "@babel/plugin-transform-block-scoped-functions": "^7.16.5", + "@babel/plugin-transform-block-scoping": "^7.16.5", + "@babel/plugin-transform-classes": "^7.16.5", + "@babel/plugin-transform-computed-properties": "^7.16.5", + "@babel/plugin-transform-destructuring": "^7.16.5", + "@babel/plugin-transform-dotall-regex": "^7.16.5", + "@babel/plugin-transform-duplicate-keys": "^7.16.5", + "@babel/plugin-transform-exponentiation-operator": "^7.16.5", + "@babel/plugin-transform-for-of": "^7.16.5", + "@babel/plugin-transform-function-name": "^7.16.5", + "@babel/plugin-transform-literals": "^7.16.5", + "@babel/plugin-transform-member-expression-literals": "^7.16.5", + "@babel/plugin-transform-modules-amd": "^7.16.5", + "@babel/plugin-transform-modules-commonjs": "^7.16.5", + "@babel/plugin-transform-modules-systemjs": "^7.16.5", + "@babel/plugin-transform-modules-umd": "^7.16.5", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.16.5", + "@babel/plugin-transform-new-target": "^7.16.5", + "@babel/plugin-transform-object-super": "^7.16.5", + "@babel/plugin-transform-parameters": "^7.16.5", + "@babel/plugin-transform-property-literals": "^7.16.5", + "@babel/plugin-transform-regenerator": "^7.16.5", + "@babel/plugin-transform-reserved-words": "^7.16.5", + "@babel/plugin-transform-shorthand-properties": "^7.16.5", + "@babel/plugin-transform-spread": "^7.16.5", + "@babel/plugin-transform-sticky-regex": "^7.16.5", + "@babel/plugin-transform-template-literals": "^7.16.5", + "@babel/plugin-transform-typeof-symbol": "^7.16.5", + "@babel/plugin-transform-unicode-escapes": "^7.16.5", + "@babel/plugin-transform-unicode-regex": "^7.16.5", + "@babel/preset-modules": "^0.1.5", + "@babel/types": "^7.16.0", + "babel-plugin-polyfill-corejs2": "^0.3.0", + "babel-plugin-polyfill-corejs3": "^0.4.0", + "babel-plugin-polyfill-regenerator": "^0.3.0", + "core-js-compat": "^3.19.1", + "semver": "^6.3.0" + } + }, + "@babel/preset-modules": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.5.tgz", + "integrity": "sha512-A57th6YRG7oR3cq/yt/Y84MvGgE0eJG2F1JLhKuyG+jFxEgrd/HAMJatiFtmOiZurz+0DkrvbheCLaV5f2JfjA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + } + }, + "@babel/register": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.16.5.tgz", + "integrity": "sha512-NpluD+cToBiZiDsG3y9rtIcqDyivsahpaM9csfyfiq1qQWduSmihUZ+ruIqqSDGjZKZMJfgAElo9x2YWlOQuRw==", + "dev": true, + "requires": { + "clone-deep": "^4.0.1", + "find-cache-dir": "^2.0.0", + "make-dir": "^2.1.0", + "pirates": "^4.0.0", + "source-map-support": "^0.5.16" + } + }, + "@babel/runtime": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.5.tgz", + "integrity": "sha512-TXWihFIS3Pyv5hzR7j6ihmeLkZfrXGxAr5UfSl8CHf+6q/wpiYDkUau0czckpYG8QmnCIuPpdLtuA9VmuGGyMA==", + "dev": true, + "requires": { + "regenerator-runtime": "^0.13.4" + } + }, + "@babel/template": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.16.0.tgz", + "integrity": "sha512-MnZdpFD/ZdYhXwiunMqqgyZyucaYsbL0IrjoGjaVhGilz+x8YB++kRfygSOIj1yOtWKPlx7NBp+9I1RQSgsd5A==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.0", + "@babel/parser": "^7.16.0", + "@babel/types": "^7.16.0" + } + }, + "@babel/traverse": { + "version": "7.16.5", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.16.5.tgz", + "integrity": "sha512-FOCODAzqUMROikDYLYxl4nmwiLlu85rNqBML/A5hKRVXG2LV8d0iMqgPzdYTcIpjZEBB7D6UDU9vxRZiriASdQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.16.0", + "@babel/generator": "^7.16.5", + "@babel/helper-environment-visitor": "^7.16.5", + "@babel/helper-function-name": "^7.16.0", + "@babel/helper-hoist-variables": "^7.16.0", + "@babel/helper-split-export-declaration": "^7.16.0", + "@babel/parser": "^7.16.5", + "@babel/types": "^7.16.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + } + }, + "@babel/types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.16.0.tgz", + "integrity": "sha512-PJgg/k3SdLsGb3hhisFvtLOw5ts113klrpLuIPtCJIU+BB24fqq6lf8RWqKJEjzqXR9AEH1rIb5XTqwBHB+kQg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.15.7", + "to-fast-properties": "^2.0.0" + } + }, + "@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "@cspell/cspell-bundled-dicts": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/@cspell/cspell-bundled-dicts/-/cspell-bundled-dicts-5.13.4.tgz", + "integrity": "sha512-D88zFAcEbUJiM03cY1U4Fb1c9BcECi6RvSwwJG/Ayc4lLO9uZgFyKlzQwjSEgTzuCME9A0Nn2hXrD+aWol85Mg==", + "dev": true, + "requires": { + "@cspell/dict-ada": "^1.1.2", + "@cspell/dict-aws": "^1.0.14", + "@cspell/dict-bash": "^1.0.17", + "@cspell/dict-companies": "^2.0.2", + "@cspell/dict-cpp": "^1.1.40", + "@cspell/dict-cryptocurrencies": "^1.0.10", + "@cspell/dict-csharp": "^2.0.1", + "@cspell/dict-css": "^1.0.12", + "@cspell/dict-django": "^1.0.26", + "@cspell/dict-dotnet": "^1.0.32", + "@cspell/dict-elixir": "^1.0.26", + "@cspell/dict-en_us": "^2.1.4", + "@cspell/dict-en-gb": "^1.1.33", + "@cspell/dict-filetypes": "^2.0.1", + "@cspell/dict-fonts": "^1.0.14", + "@cspell/dict-fullstack": "^2.0.4", + "@cspell/dict-golang": "^1.1.24", + "@cspell/dict-haskell": "^1.0.13", + "@cspell/dict-html": "^1.1.9", + "@cspell/dict-html-symbol-entities": "^1.0.23", + "@cspell/dict-java": "^1.0.23", + "@cspell/dict-latex": "^1.0.25", + "@cspell/dict-lorem-ipsum": "^1.0.22", + "@cspell/dict-lua": "^1.0.16", + "@cspell/dict-node": "^1.0.12", + "@cspell/dict-npm": "^1.0.16", + "@cspell/dict-php": "^1.0.25", + "@cspell/dict-powershell": "^1.0.19", + "@cspell/dict-public-licenses": "^1.0.4", + "@cspell/dict-python": "^2.0.5", + "@cspell/dict-ruby": "^1.0.15", + "@cspell/dict-rust": "^1.0.23", + "@cspell/dict-scala": "^1.0.21", + "@cspell/dict-software-terms": "^2.0.11", + "@cspell/dict-swift": "^1.0.1", + "@cspell/dict-typescript": "^1.0.19", + "@cspell/dict-vue": "^2.0.1" + } + }, + "@cspell/cspell-types": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/@cspell/cspell-types/-/cspell-types-5.13.4.tgz", + "integrity": "sha512-OH3aqFfmRNOSO0K0h5JNm84I5RLDgngp1Qa9YeEm9oj1U/qjrm2bOwOGGh9XU/ZjLl56JMbtbnfSpHpT7tLc+A==", + "dev": true + }, + "@cspell/dict-ada": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@cspell/dict-ada/-/dict-ada-1.1.2.tgz", + "integrity": "sha512-UDrcYcKIVyXDz5mInJabRNQpJoehjBFvja5W+GQyu9pGcx3BS3cAU8mWENstGR0Qc/iFTxB010qwF8F3cHA/aA==", + "dev": true + }, + "@cspell/dict-aws": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/@cspell/dict-aws/-/dict-aws-1.0.14.tgz", + "integrity": "sha512-K21CfB4ZpKYwwDQiPfic2zJA/uxkbsd4IQGejEvDAhE3z8wBs6g6BwwqdVO767M9NgZqc021yAVpr79N5pWe3w==", + "dev": true + }, + "@cspell/dict-bash": { + "version": "1.0.17", + "resolved": "https://registry.npmjs.org/@cspell/dict-bash/-/dict-bash-1.0.17.tgz", + "integrity": "sha512-BlX+pnDlLmIf776C9d71QjXl4NOIz+yloeixx1ZZjrwvKPLF+ffE/Ez13eV+D9R2Ps1rW10UvW8u3Hbmwme+Fw==", + "dev": true + }, + "@cspell/dict-companies": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/@cspell/dict-companies/-/dict-companies-2.0.2.tgz", + "integrity": "sha512-LPKwBMAWRz+p1R8q+TV6E1sGOOTvxJOaJeXNN++CZQ7i6JMn5Rf+BSxagwkeK6z3o9vIC5ZE4AcQ5BMkvyjqGw==", + "dev": true + }, + "@cspell/dict-cpp": { + "version": "1.1.40", + "resolved": "https://registry.npmjs.org/@cspell/dict-cpp/-/dict-cpp-1.1.40.tgz", + "integrity": "sha512-sscfB3woNDNj60/yGXAdwNtIRWZ89y35xnIaJVDMk5TPMMpaDvuk0a34iOPIq0g4V+Y8e3RyAg71SH6ADwSjGw==", + "dev": true + }, + "@cspell/dict-cryptocurrencies": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/@cspell/dict-cryptocurrencies/-/dict-cryptocurrencies-1.0.10.tgz", + "integrity": "sha512-47ABvDJOkaST/rXipNMfNvneHUzASvmL6K/CbOFpYKfsd0x23Jc9k1yaOC7JAm82XSC/8a7+3Yu+Fk2jVJNnsA==", + "dev": true + }, + "@cspell/dict-csharp": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@cspell/dict-csharp/-/dict-csharp-2.0.1.tgz", + "integrity": "sha512-ZzAr+WRP2FUtXHZtfhe8f3j9vPjH+5i44Hcr5JqbWxmqciGoTbWBPQXwu9y+J4mbdC69HSWRrVGkNJ8rQk8pSw==", + "dev": true + }, + "@cspell/dict-css": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@cspell/dict-css/-/dict-css-1.0.12.tgz", + "integrity": "sha512-K6yuxej7n454O7dwKG6lHacHrAOMZ0PhMEbmV6qH2JH0U4TtWXfBASYugHvXZCDDx1UObpiJP+3tQJiBqfGpHA==", + "dev": true + }, + "@cspell/dict-django": { + "version": "1.0.26", + "resolved": "https://registry.npmjs.org/@cspell/dict-django/-/dict-django-1.0.26.tgz", + "integrity": "sha512-mn9bd7Et1L2zuibc08GVHTiD2Go3/hdjyX5KLukXDklBkq06r+tb0OtKtf1zKodtFDTIaYekGADhNhA6AnKLkg==", + "dev": true + }, + "@cspell/dict-dotnet": { + "version": "1.0.32", + "resolved": "https://registry.npmjs.org/@cspell/dict-dotnet/-/dict-dotnet-1.0.32.tgz", + "integrity": "sha512-9H9vXrgJB4KF8xsyTToXO53cXD33iyfrpT4mhCds+YLUw3P3x3E9myszgJzshnrxYBvQZ+QMII57Qr6SjZVk4Q==", + "dev": true + }, + "@cspell/dict-elixir": { + "version": "1.0.26", + "resolved": "https://registry.npmjs.org/@cspell/dict-elixir/-/dict-elixir-1.0.26.tgz", + "integrity": "sha512-hz1yETUiRJM7yjN3mITSnxcmZaEyaBbyJhpZPpg+cKUil+xhHeZ2wwfbRc83QHGmlqEuDWbdCFqKSpCDJYpYhg==", + "dev": true + }, + "@cspell/dict-en_us": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/@cspell/dict-en_us/-/dict-en_us-2.1.4.tgz", + "integrity": "sha512-W4b+aIvZ637FqtTmrTe/T9i9748cuTQf82eWUgV9O296WzZj7rCxm+rzOrmRTAcCmU+9+6Cdsr0unETFQfuxww==", + "dev": true + }, + "@cspell/dict-en-gb": { + "version": "1.1.33", + "resolved": "https://registry.npmjs.org/@cspell/dict-en-gb/-/dict-en-gb-1.1.33.tgz", + "integrity": "sha512-tKSSUf9BJEV+GJQAYGw5e+ouhEe2ZXE620S7BLKe3ZmpnjlNG9JqlnaBhkIMxKnNFkLY2BP/EARzw31AZnOv4g==", + "dev": true + }, + "@cspell/dict-filetypes": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@cspell/dict-filetypes/-/dict-filetypes-2.0.1.tgz", + "integrity": "sha512-bQ7K3U/3hKO2lpQjObf0veNP/n50qk5CVezSwApMBckf/sAVvDTR1RGAvYdr+vdQnkdQrk6wYmhbshXi0sLDVg==", + "dev": true + }, + "@cspell/dict-fonts": { + "version": "1.0.14", + "resolved": "https://registry.npmjs.org/@cspell/dict-fonts/-/dict-fonts-1.0.14.tgz", + "integrity": "sha512-VhIX+FVYAnqQrOuoFEtya6+H72J82cIicz9QddgknsTqZQ3dvgp6lmVnsQXPM3EnzA8n1peTGpLDwHzT7ociLA==", + "dev": true + }, + "@cspell/dict-fullstack": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@cspell/dict-fullstack/-/dict-fullstack-2.0.4.tgz", + "integrity": "sha512-+JtYO58QAXnetRN+MGVzI8YbkbFTLpYfl/Cw/tmNqy7U1IDVC4sTXQ2pZvbbeKQWFHBqYvBs0YASV+mTouXYBw==", + "dev": true + }, + "@cspell/dict-golang": { + "version": "1.1.24", + "resolved": "https://registry.npmjs.org/@cspell/dict-golang/-/dict-golang-1.1.24.tgz", + "integrity": "sha512-qq3Cjnx2U1jpeWAGJL1GL0ylEhUMqyaR36Xij6Y6Aq4bViCRp+HRRqk0x5/IHHbOrti45h3yy7ii1itRFo+Xkg==", + "dev": true + }, + "@cspell/dict-haskell": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@cspell/dict-haskell/-/dict-haskell-1.0.13.tgz", + "integrity": "sha512-kvl8T84cnYRPpND/P3D86P6WRSqebsbk0FnMfy27zo15L5MLAb3d3MOiT1kW3vEWfQgzUD7uddX/vUiuroQ8TA==", + "dev": true + }, + "@cspell/dict-html": { + "version": "1.1.9", + "resolved": "https://registry.npmjs.org/@cspell/dict-html/-/dict-html-1.1.9.tgz", + "integrity": "sha512-vvnYia0tyIS5Fdoz+gEQm77MGZZE66kOJjuNpIYyRHCXFAhWdYz3SmkRm6YKJSWSvuO+WBJYTKDvkOxSh3Fx/w==", + "dev": true + }, + "@cspell/dict-html-symbol-entities": { + "version": "1.0.23", + "resolved": "https://registry.npmjs.org/@cspell/dict-html-symbol-entities/-/dict-html-symbol-entities-1.0.23.tgz", + "integrity": "sha512-PV0UBgcBFbBLf/m1wfkVMM8w96kvfHoiCGLWO6BR3Q9v70IXoE4ae0+T+f0CkxcEkacMqEQk/I7vuE9MzrjaNw==", + "dev": true + }, + "@cspell/dict-java": { + "version": "1.0.23", + "resolved": "https://registry.npmjs.org/@cspell/dict-java/-/dict-java-1.0.23.tgz", + "integrity": "sha512-LcOg9srYLDoNGd8n3kbfDBlZD+LOC9IVcnFCdua1b/luCHNVmlgBx7e677qPu7olpMYOD5TQIVW2OmM1+/6MFA==", + "dev": true + }, + "@cspell/dict-latex": { + "version": "1.0.25", + "resolved": "https://registry.npmjs.org/@cspell/dict-latex/-/dict-latex-1.0.25.tgz", + "integrity": "sha512-cEgg91Migqcp1SdVV7dUeMxbPDhxdNo6Fgq2eygAXQjIOFK520FFvh/qxyBvW90qdZbIRoU2AJpchyHfGuwZFA==", + "dev": true + }, + "@cspell/dict-lorem-ipsum": { + "version": "1.0.22", + "resolved": "https://registry.npmjs.org/@cspell/dict-lorem-ipsum/-/dict-lorem-ipsum-1.0.22.tgz", + "integrity": "sha512-yqzspR+2ADeAGUxLTfZ4pXvPl7FmkENMRcGDECmddkOiuEwBCWMZdMP5fng9B0Q6j91hQ8w9CLvJKBz10TqNYg==", + "dev": true + }, + "@cspell/dict-lua": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/@cspell/dict-lua/-/dict-lua-1.0.16.tgz", + "integrity": "sha512-YiHDt8kmHJ8nSBy0tHzaxiuitYp+oJ66ffCYuFWTNB3//Y0SI4OGHU3omLsQVeXIfCeVrO4DrVvRDoCls9B5zQ==", + "dev": true + }, + "@cspell/dict-node": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/@cspell/dict-node/-/dict-node-1.0.12.tgz", + "integrity": "sha512-RPNn/7CSkflAWk0sbSoOkg0ORrgBARUjOW3QjB11KwV1gSu8f5W/ij/S50uIXtlrfoBLqd4OyE04jyON+g/Xfg==", + "dev": true + }, + "@cspell/dict-npm": { + "version": "1.0.16", + "resolved": "https://registry.npmjs.org/@cspell/dict-npm/-/dict-npm-1.0.16.tgz", + "integrity": "sha512-RwkuZGcYBxL3Yux3cSG/IOWGlQ1e9HLCpHeyMtTVGYKAIkFAVUnGrz20l16/Q7zUG7IEktBz5O42kAozrEnqMQ==", + "dev": true + }, + "@cspell/dict-php": { + "version": "1.0.25", + "resolved": "https://registry.npmjs.org/@cspell/dict-php/-/dict-php-1.0.25.tgz", + "integrity": "sha512-RoBIP5MRdByyPaXcznZMfOY1JdCMYPPLua5E9gkq0TJO7bX5mC9hyAKfYBSWVQunZydd82HZixjb5MPkDFU1uw==", + "dev": true + }, + "@cspell/dict-powershell": { + "version": "1.0.19", + "resolved": "https://registry.npmjs.org/@cspell/dict-powershell/-/dict-powershell-1.0.19.tgz", + "integrity": "sha512-zF/raM/lkhXeHf4I43OtK0gP9rBeEJFArscTVwLWOCIvNk21MJcNoTYoaGw+c056+Q+hJL0psGLO7QN+mxYH1A==", + "dev": true + }, + "@cspell/dict-public-licenses": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@cspell/dict-public-licenses/-/dict-public-licenses-1.0.4.tgz", + "integrity": "sha512-h4xULfVEDUeWyvp1OO19pcGDqWcBEQ7WGMp3QBHyYpjsamlzsyYYjCRSY2ZvpM7wruDmywSRFmRHJ/+uNFT7nA==", + "dev": true + }, + "@cspell/dict-python": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@cspell/dict-python/-/dict-python-2.0.5.tgz", + "integrity": "sha512-WkyGYtNmUsOHsWixck7AxNvveDgVPqw0H51hzIY+/5u3c94wZUweIj0vfFOGIfOBq8e1ZxpjumKBxVDGXTmQkw==", + "dev": true + }, + "@cspell/dict-ruby": { + "version": "1.0.15", + "resolved": "https://registry.npmjs.org/@cspell/dict-ruby/-/dict-ruby-1.0.15.tgz", + "integrity": "sha512-I76hJA///lc1pgmDTGUFHN/O8KLIZIU/8TgIYIGI6Ix/YzSEvWNdQYbANn6JbCynS0X+7IbZ2Ft+QqvmGtIWuA==", + "dev": true + }, + "@cspell/dict-rust": { + "version": "1.0.23", + "resolved": "https://registry.npmjs.org/@cspell/dict-rust/-/dict-rust-1.0.23.tgz", + "integrity": "sha512-lR4boDzs79YD6+30mmiSGAMMdwh7HTBAPUFSB0obR3Kidibfc3GZ+MHWZXay5dxZ4nBKM06vyjtanF9VJ8q1Iw==", + "dev": true + }, + "@cspell/dict-scala": { + "version": "1.0.21", + "resolved": "https://registry.npmjs.org/@cspell/dict-scala/-/dict-scala-1.0.21.tgz", + "integrity": "sha512-5V/R7PRbbminTpPS3ywgdAalI9BHzcEjEj9ug4kWYvBIGwSnS7T6QCFCiu+e9LvEGUqQC+NHgLY4zs1NaBj2vA==", + "dev": true + }, + "@cspell/dict-software-terms": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/@cspell/dict-software-terms/-/dict-software-terms-2.0.11.tgz", + "integrity": "sha512-ix5k4m9Y5ZcozgE8QdEhiMIksreGozBETsCo5tGKAs4xDDkS4G07lOMFbek6m5poJ5qk5My0A/iz1j9f3L3aOg==", + "dev": true + }, + "@cspell/dict-swift": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/@cspell/dict-swift/-/dict-swift-1.0.1.tgz", + "integrity": "sha512-M4onLt10Ptld8Q1BwBit8BBYVZ0d2ZEiBTW1AXekIVPQkPKkwa/RkGlR0GESWNTC2Zbmt/qge7trksVdaYVWFQ==", + "dev": true + }, + "@cspell/dict-typescript": { + "version": "1.0.19", + "resolved": "https://registry.npmjs.org/@cspell/dict-typescript/-/dict-typescript-1.0.19.tgz", + "integrity": "sha512-qmJApzoVskDeJnLZzZMaafEDGbEg5Elt4c3Mpg49SWzIHm1N4VXCp5CcFfHsOinJ30dGrs3ARAJGJZIw56kK6A==", + "dev": true + }, + "@cspell/dict-vue": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@cspell/dict-vue/-/dict-vue-2.0.1.tgz", + "integrity": "sha512-n9So2C2Zw+uSDRzb2h9wq3PjZBqoHx+vBvu6a34H2qpumNjZ6HaEronrzX5tXJJXzOtocIQYrLxdd128TAU3+g==", + "dev": true + }, + "@eslint/eslintrc": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/@eslint/eslintrc/-/eslintrc-1.0.5.tgz", + "integrity": "sha512-BLxsnmK3KyPunz5wmCCpqy0YelEoxxGmH73Is+Z74oOTMtExcjkr3dDR6quwrjh1YspA8DH9gnX1o069KiS9AQ==", + "dev": true, + "requires": { + "ajv": "^6.12.4", + "debug": "^4.3.2", + "espree": "^9.2.0", + "globals": "^13.9.0", + "ignore": "^4.0.6", + "import-fresh": "^3.2.1", + "js-yaml": "^4.1.0", + "minimatch": "^3.0.4", + "strip-json-comments": "^3.1.1" + }, + "dependencies": { + "globals": { + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", + "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + } + } + }, + "@humanwhocodes/config-array": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.9.2.tgz", + "integrity": "sha512-UXOuFCGcwciWckOpmfKDq/GyhlTf9pN/BzG//x8p8zTOFEcGuA68ANXheFS0AGvy3qgZqLBUkMs7hqzqCKOVwA==", + "dev": true, + "requires": { + "@humanwhocodes/object-schema": "^1.2.1", + "debug": "^4.1.1", + "minimatch": "^3.0.4" + } + }, + "@humanwhocodes/object-schema": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz", + "integrity": "sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==", + "dev": true + }, + "@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", + "dev": true + }, + "@microsoft/tsdoc": { + "version": "0.13.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc/-/tsdoc-0.13.2.tgz", + "integrity": "sha512-WrHvO8PDL8wd8T2+zBGKrMwVL5IyzR3ryWUsl0PXgEV0QHup4mTLi0QcATefGI6Gx9Anu7vthPyyyLpY0EpiQg==", + "dev": true + }, + "@microsoft/tsdoc-config": { + "version": "0.15.2", + "resolved": "https://registry.npmjs.org/@microsoft/tsdoc-config/-/tsdoc-config-0.15.2.tgz", + "integrity": "sha512-mK19b2wJHSdNf8znXSMYVShAHktVr/ib0Ck2FA3lsVBSEhSI/TfXT7DJQkAYgcztTuwazGcg58ZjYdk0hTCVrA==", + "dev": true, + "requires": { + "@microsoft/tsdoc": "0.13.2", + "ajv": "~6.12.6", + "jju": "~1.4.0", + "resolve": "~1.19.0" + }, + "dependencies": { + "resolve": { + "version": "1.19.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.19.0.tgz", + "integrity": "sha512-rArEXAgsBG4UgRGcynxWIWKFvh/XZCcS8UJdHhwy91zwAvCZIbcs+vAbflgBnNjYMs/i/i+/Ux6IZhML1yPvxg==", + "dev": true, + "requires": { + "is-core-module": "^2.1.0", + "path-parse": "^1.0.6" + } + } + } + }, + "@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + } + }, + "@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true + }, + "@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "requires": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + } + }, + "@types/chai": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", + "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", + "dev": true + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz", + "integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==", + "dev": true + }, + "@types/json-schema": { + "version": "7.0.9", + "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.9.tgz", + "integrity": "sha512-qcUXuemtEu+E5wZSJHNxUXeCZhAfXKQ41D+duX+VYPde7xyEVZci+/oXKJL13tnRs9lR2pr4fod59GT6/X1/yQ==", + "dev": true + }, + "@types/json5": { + "version": "0.0.29", + "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", + "integrity": "sha1-7ihweulOEdK4J7y+UnC86n8+ce4=", + "dev": true + }, + "@types/mocha": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.0.0.tgz", + "integrity": "sha512-scN0hAWyLVAvLR9AyW7HoFF5sJZglyBsbPuHO4fv7JRvfmPBMfp1ozWqOf/e4wwPNxezBZXRfWzMb6iFLgEVRA==", + "dev": true + }, + "@types/node": { + "version": "17.0.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.5.tgz", + "integrity": "sha512-w3mrvNXLeDYV1GKTZorGJQivK6XLCoGwpnyJFbJVK/aTBQUxOCaa/GlFAAN3OTDFcb7h5tiFG+YXCO2By+riZw==", + "dev": true + }, + "@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, + "@typescript-eslint/eslint-plugin": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.8.0.tgz", + "integrity": "sha512-spu1UW7QuBn0nJ6+psnfCc3iVoQAifjKORgBngKOmC8U/1tbe2YJMzYQqDGYB4JCss7L8+RM2kKLb1B1Aw9BNA==", + "dev": true, + "requires": { + "@typescript-eslint/experimental-utils": "5.8.0", + "@typescript-eslint/scope-manager": "5.8.0", + "debug": "^4.3.2", + "functional-red-black-tree": "^1.0.1", + "ignore": "^5.1.8", + "regexpp": "^3.2.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "@typescript-eslint/experimental-utils": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.8.0.tgz", + "integrity": "sha512-KN5FvNH71bhZ8fKtL+lhW7bjm7cxs1nt+hrDZWIqb6ViCffQcWyLunGrgvISgkRojIDcXIsH+xlFfI4RCDA0xA==", + "dev": true, + "requires": { + "@types/json-schema": "^7.0.9", + "@typescript-eslint/scope-manager": "5.8.0", + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/typescript-estree": "5.8.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + } + }, + "@typescript-eslint/parser": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.8.0.tgz", + "integrity": "sha512-Gleacp/ZhRtJRYs5/T8KQR3pAQjQI89Dn/k+OzyCKOsLiZH2/Vh60cFBTnFsHNI6WAD+lNUo/xGZ4NeA5u0Ipw==", + "dev": true, + "requires": { + "@typescript-eslint/scope-manager": "5.8.0", + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/typescript-estree": "5.8.0", + "debug": "^4.3.2" + } + }, + "@typescript-eslint/scope-manager": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.8.0.tgz", + "integrity": "sha512-x82CYJsLOjPCDuFFEbS6e7K1QEWj7u5Wk1alw8A+gnJiYwNnDJk0ib6PCegbaPMjrfBvFKa7SxE3EOnnIQz2Gg==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/visitor-keys": "5.8.0" + } + }, + "@typescript-eslint/types": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.8.0.tgz", + "integrity": "sha512-LdCYOqeqZWqCMOmwFnum6YfW9F3nKuxJiR84CdIRN5nfHJ7gyvGpXWqL/AaW0k3Po0+wm93ARAsOdzlZDPCcXg==", + "dev": true + }, + "@typescript-eslint/typescript-estree": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-5.8.0.tgz", + "integrity": "sha512-srfeZ3URdEcUsSLbkOFqS7WoxOqn8JNil2NSLO9O+I2/Uyc85+UlfpEvQHIpj5dVts7KKOZnftoJD/Fdv0L7nQ==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.8.0", + "@typescript-eslint/visitor-keys": "5.8.0", + "debug": "^4.3.2", + "globby": "^11.0.4", + "is-glob": "^4.0.3", + "semver": "^7.3.5", + "tsutils": "^3.21.0" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "@typescript-eslint/visitor-keys": { + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-5.8.0.tgz", + "integrity": "sha512-+HDIGOEMnqbxdAHegxvnOqESUH6RWFRR2b8qxP1W9CZnnYh4Usz6MBL+2KMAgPk/P0o9c1HqnYtwzVH6GTIqug==", + "dev": true, + "requires": { + "@typescript-eslint/types": "5.8.0", + "eslint-visitor-keys": "^3.0.0" + } + }, + "@ungap/promise-all-settled": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", + "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "dev": true + }, + "acorn": { + "version": "8.6.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.6.0.tgz", + "integrity": "sha512-U1riIR+lBSNi3IbxtaHOIKdH8sLFv3NYfNv8sg7ZsNhcfl4HF2++BfqqrNAxoCLQW1iiylOj76ecnaUxz+z9yw==", + "dev": true + }, + "acorn-jsx": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", + "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", + "dev": true, + "requires": {} + }, + "ajv": { + "version": "6.12.6", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", + "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, + "requires": { + "fast-deep-equal": "^3.1.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ansi-colors": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", + "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", + "dev": true + }, + "ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "anymatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", + "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "dev": true, + "requires": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + } + }, + "argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "array-includes": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.4.tgz", + "integrity": "sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1", + "get-intrinsic": "^1.1.1", + "is-string": "^1.0.7" + } + }, + "array-timsort": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-timsort/-/array-timsort-1.0.3.tgz", + "integrity": "sha512-/+3GRL7dDAGEfM6TseQk/U+mi18TU2Ms9I3UlLdUMhz2hbvGNTKdj9xniwXfUqgYhHxRx0+8UnKkvlNwVU+cWQ==", + "dev": true + }, + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + }, + "array.prototype.flat": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.2.5.tgz", + "integrity": "sha512-KaYU+S+ndVqyUnignHftkwc58o3uVU1jzczILJ1tN2YaIZpFIKBiP/x/j97E5MVPsaCloPbqWLB/8qCTVvT2qg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.0" + } + }, + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true + }, + "babel-plugin-dynamic-import-node": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.3.tgz", + "integrity": "sha512-jZVI+s9Zg3IqA/kdi0i6UDCybUI3aSBLnglhYbSSjKlV7yF1F/5LWv8MakQmvYpnbJDS6fcBL2KzHSxNCMtWSQ==", + "dev": true, + "requires": { + "object.assign": "^4.1.0" + } + }, + "babel-plugin-polyfill-corejs2": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.0.tgz", + "integrity": "sha512-wMDoBJ6uG4u4PNFh72Ty6t3EgfA91puCuAwKIazbQlci+ENb/UU9A3xG5lutjUIiXCIn1CY5L15r9LimiJyrSA==", + "dev": true, + "requires": { + "@babel/compat-data": "^7.13.11", + "@babel/helper-define-polyfill-provider": "^0.3.0", + "semver": "^6.1.1" + } + }, + "babel-plugin-polyfill-corejs3": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.4.0.tgz", + "integrity": "sha512-YxFreYwUfglYKdLUGvIF2nJEsGwj+RhWSX/ije3D2vQPOXuyMLMtg/cCGMDpOA7Nd+MwlNdnGODbd2EwUZPlsw==", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.3.0", + "core-js-compat": "^3.18.0" + } + }, + "babel-plugin-polyfill-regenerator": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.0.tgz", + "integrity": "sha512-dhAPTDLGoMW5/84wkgwiLRwMnio2i1fUe53EuvtKMv0pn2p3S8OCoV1xAzfJPl0KOX7IB89s2ib85vbYiea3jg==", + "dev": true, + "requires": { + "@babel/helper-define-polyfill-provider": "^0.3.0" + } + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "binary-extensions": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", + "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "braces": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", + "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "dev": true, + "requires": { + "fill-range": "^7.0.1" + } + }, + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "dev": true + }, + "browserslist": { + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.19.1.tgz", + "integrity": "sha512-u2tbbG5PdKRTUoctO3NBD8FQ5HdPh1ZXPHzp1rwaa5jTc+RV9/+RlWiAIKmjRPQF+xbGM9Kklj5bZQFa2s/38A==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001286", + "electron-to-chromium": "^1.4.17", + "escalade": "^3.1.1", + "node-releases": "^2.0.1", + "picocolors": "^1.0.0" + } + }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "c8": { + "version": "7.10.0", + "resolved": "https://registry.npmjs.org/c8/-/c8-7.10.0.tgz", + "integrity": "sha512-OAwfC5+emvA6R7pkYFVBTOtI5ruf9DahffGmIqUc9l6wEh0h7iAFP6dt/V9Ioqlr2zW5avX9U9/w1I4alTRHkA==", + "dev": true, + "requires": { + "@bcoe/v8-coverage": "^0.2.3", + "@istanbuljs/schema": "^0.1.2", + "find-up": "^5.0.0", + "foreground-child": "^2.0.0", + "istanbul-lib-coverage": "^3.0.1", + "istanbul-lib-report": "^3.0.0", + "istanbul-reports": "^3.0.2", + "rimraf": "^3.0.0", + "test-exclude": "^6.0.0", + "v8-to-istanbul": "^8.0.0", + "yargs": "^16.2.0", + "yargs-parser": "^20.2.7" + } + }, + "call-bind": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", + "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "get-intrinsic": "^1.0.2" + } + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.2.1.tgz", + "integrity": "sha512-tVI4q5jjFV5CavAU8DXfza/TJcZutVKo/5Foskmsqcm0MsL91moHvwiGNnqaa2o6PF/7yT5ikDRcVcl8Rj6LCA==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001292", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001292.tgz", + "integrity": "sha512-jnT4Tq0Q4ma+6nncYQVe7d73kmDmE9C3OGTx3MvW7lBM/eY1S1DZTMBON7dqV481RhNiS5OxD7k9JQvmDOTirw==", + "dev": true + }, + "chai": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.4.tgz", + "integrity": "sha512-yS5H68VYOCtN1cjfwumDSuzn/9c+yza4f3reKXlE5rUg7SFcCEy90gJvydNgOYtblyf4Zi6jIWRnXOgErta0KA==", + "dev": true, + "requires": { + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.1", + "type-detect": "^4.0.5" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "chokidar": { + "version": "3.5.2", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.2.tgz", + "integrity": "sha512-ekGhOnNVPgT77r4K/U3GDhu+FQ2S8TnK/s2KbIGXi0SZWuwkZ2QNyfWdZW+TVfn84DpEP7rLeCt2UI6bJ8GwbQ==", + "dev": true, + "requires": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "fsevents": "~2.3.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } + } + }, + "clear-module": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/clear-module/-/clear-module-4.1.2.tgz", + "integrity": "sha512-LWAxzHqdHsAZlPlEyJ2Poz6AIs384mPeqLVCru2p0BrP9G/kVGuhNyZYClLO6cXlnuJjzC8xtsJIuMjKqLXoAw==", + "dev": true, + "requires": { + "parent-module": "^2.0.0", + "resolve-from": "^5.0.0" + } + }, + "cliui": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", + "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "dev": true, + "requires": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^7.0.0" + } + }, + "clone-deep": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz", + "integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==", + "dev": true, + "requires": { + "is-plain-object": "^2.0.4", + "kind-of": "^6.0.2", + "shallow-clone": "^3.0.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "commander": { + "version": "8.3.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-8.3.0.tgz", + "integrity": "sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww==", + "dev": true + }, + "comment-json": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/comment-json/-/comment-json-4.1.1.tgz", + "integrity": "sha512-v8gmtPvxhBlhdRBLwdHSjGy9BgA23t9H1FctdQKyUrErPjSrJcdDMqBq9B4Irtm7w3TNYLQJNH6ARKnpyag1sA==", + "dev": true, + "requires": { + "array-timsort": "^1.0.3", + "core-util-is": "^1.0.2", + "esprima": "^4.0.1", + "has-own-prop": "^2.0.0", + "repeat-string": "^1.6.1" + } + }, + "commondir": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", + "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "configstore": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/configstore/-/configstore-5.0.1.tgz", + "integrity": "sha512-aMKprgk5YhBNyH25hj8wGt2+D52Sw1DRRIzqBwLp2Ya9mFmY8KPvvtvmna8SxVR9JMZ4kzMD68N22vlaRpkeFA==", + "dev": true, + "requires": { + "dot-prop": "^5.2.0", + "graceful-fs": "^4.1.2", + "make-dir": "^3.0.0", + "unique-string": "^2.0.0", + "write-file-atomic": "^3.0.0", + "xdg-basedir": "^4.0.0" + }, + "dependencies": { + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + } + } + }, + "convert-source-map": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.8.0.tgz", + "integrity": "sha512-+OQdjP49zViI/6i7nIJpA8rAl4sV/JdPfU9nZs3VqOwGIgizICvuN2ru6fMd+4llL0tar18UYJXfZ/TWtmhUjA==", + "dev": true, + "requires": { + "safe-buffer": "~5.1.1" + } + }, + "core-js-compat": { + "version": "3.20.1", + "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.20.1.tgz", + "integrity": "sha512-AVhKZNpqMV3Jz8hU0YEXXE06qoxtQGsAqU0u1neUngz5IusDJRX/ZJ6t3i7mS7QxNyEONbCo14GprkBrxPlTZA==", + "dev": true, + "requires": { + "browserslist": "^4.19.1", + "semver": "7.0.0" + }, + "dependencies": { + "semver": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.0.0.tgz", + "integrity": "sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A==", + "dev": true + } + } + }, + "core-util-is": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.3.tgz", + "integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==", + "dev": true + }, + "cosmiconfig": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.0.1.tgz", + "integrity": "sha512-a1YWNUV2HwGimB7dU2s1wUMurNKjpx60HxBB6xUM8Re+2s1g1IIfJvFR0/iCF+XHdE0GMTKTuLR32UQff4TEyQ==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.2.1", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.10.0" + } + }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "crypto-random-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", + "integrity": "sha512-v1plID3y9r/lPhviJ1wrXpLeyUIGAZ2SHNYTEapm7/8A9nLPoyvVp3RK/EPFqn5kEznyWgYZNsRtYYIWbuG8KA==", + "dev": true + }, + "cspell": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/cspell/-/cspell-5.13.4.tgz", + "integrity": "sha512-T/AMylb/CY0af8Oc1/Nv79Mqe852ga4AOAY0m8eYG8A5zahDpL2EC6PN5yK8KFn0UPMWMB8B2atZf6/U5RWdaQ==", + "dev": true, + "requires": { + "chalk": "^4.1.2", + "commander": "^8.3.0", + "comment-json": "^4.1.1", + "cspell-gitignore": "^5.13.4", + "cspell-glob": "^5.13.4", + "cspell-lib": "^5.13.4", + "fast-json-stable-stringify": "^2.1.0", + "file-entry-cache": "^6.0.1", + "fs-extra": "^10.0.0", + "get-stdin": "^8.0.0", + "glob": "^7.2.0", + "imurmurhash": "^0.1.4", + "semver": "^7.3.5", + "strip-ansi": "^6.0.1", + "vscode-uri": "^3.0.2" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "cspell-gitignore": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/cspell-gitignore/-/cspell-gitignore-5.13.4.tgz", + "integrity": "sha512-Md2V+EyILAavxO6CJ/Y/l8/p2nBFA0p1sMrjCEBtBuF3BL7A/A2LGaK4Tb+trVONFAKQ5cZo84WbyvSYWUqvpw==", + "dev": true, + "requires": { + "cspell-glob": "^5.13.4", + "find-up": "^5.0.0" + } + }, + "cspell-glob": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/cspell-glob/-/cspell-glob-5.13.4.tgz", + "integrity": "sha512-uKkibBe41Tr609mNBOairsyuNhPo+kqMVw2JeobfgN71GESQLjU7hr6VpKaUKGZyJpaicP606LB0gZBM38IOvw==", + "dev": true, + "requires": { + "micromatch": "^4.0.4" + } + }, + "cspell-io": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/cspell-io/-/cspell-io-5.13.4.tgz", + "integrity": "sha512-THe0R5CAv2h5yvrF3dtvigY73mnfFlfTJFWoSgGsafKq5nmR8jgKpbjQgK93zL0JC//BgdK0extfrSLsW2D4mw==", + "dev": true + }, + "cspell-lib": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/cspell-lib/-/cspell-lib-5.13.4.tgz", + "integrity": "sha512-kKGqAMXKdj8l3sgjoJuuQKTuwLz/33c3YFM/d3lYzcP3mo7C4v/M04Dm4mlTdWA0l4WYlzuSqxDmj32SsHMbNA==", + "dev": true, + "requires": { + "@cspell/cspell-bundled-dicts": "^5.13.4", + "@cspell/cspell-types": "^5.13.4", + "clear-module": "^4.1.2", + "comment-json": "^4.1.1", + "configstore": "^5.0.1", + "cosmiconfig": "^7.0.1", + "cspell-glob": "^5.13.4", + "cspell-io": "^5.13.4", + "cspell-trie-lib": "^5.13.4", + "find-up": "^5.0.0", + "fs-extra": "^10.0.0", + "gensequence": "^3.1.1", + "import-fresh": "^3.3.0", + "resolve-from": "^5.0.0", + "resolve-global": "^1.0.0", + "vscode-uri": "^3.0.2" + } + }, + "cspell-trie-lib": { + "version": "5.13.4", + "resolved": "https://registry.npmjs.org/cspell-trie-lib/-/cspell-trie-lib-5.13.4.tgz", + "integrity": "sha512-e5fKOOioJlJJ+DcLVIkuy+7FI/YmUojhfzdUjTvLDn5EJFL3/oiP5AvDXGV3bMqYzlbRQKD6FpC61KVIkNMbEw==", + "dev": true, + "requires": { + "fs-extra": "^10.0.0", + "gensequence": "^3.1.1" + } + }, + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "decamelize": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", + "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dev": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true, + "requires": { + "type-detect": "^4.0.0" + } + }, + "deep-is": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz", + "integrity": "sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==", + "dev": true + }, + "define-properties": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", + "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", + "dev": true, + "requires": { + "object-keys": "^1.0.12" + } + }, + "diff": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", + "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "dev": true + }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, + "doctrine": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", + "integrity": "sha512-yS+Q5i3hBf7GBkd4KG8a7eBNNWNGLTaEwwYWUijIYM7zrlYDM0BFXHjjPWlWZ1Rg7UaddZeIDmi9jF3HmqiQ2w==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "dot-prop": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-5.3.0.tgz", + "integrity": "sha512-QM8q3zDe58hqUqjraQOmzZ1LIH9SWQJTlEKCH4kJ2oQvLZk7RbQXvtDM2XEq3fwkV9CCvvH4LA0AV+ogFsBM2Q==", + "dev": true, + "requires": { + "is-obj": "^2.0.0" + } + }, + "electron-to-chromium": { + "version": "1.4.28", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.28.tgz", + "integrity": "sha512-Gzbf0wUtKfyPaqf0Plz+Ctinf9eQIzxEqBHwSvbGfeOm9GMNdLxyu1dNiCUfM+x6r4BE0xUJNh3Nmg9gfAtTmg==", + "dev": true + }, + "emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "enquirer": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.3.6.tgz", + "integrity": "sha512-yjNnPr315/FjS4zIsUxYguYUPP2e1NK4d7E7ZOLiyYCcbFBiTMyID+2wvm2w6+pZ/odMA7cRkjhsPbltwBOrLg==", + "dev": true, + "requires": { + "ansi-colors": "^4.1.1" + } + }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, + "es-abstract": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.19.1.tgz", + "integrity": "sha512-2vJ6tjA/UfqLm2MPs7jxVybLoB8i1t1Jd9R3kISld20sIxPcTbLuggQOUxeWeAvIUkduv/CfMjuh4WmiXr2v9w==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "es-to-primitive": "^1.2.1", + "function-bind": "^1.1.1", + "get-intrinsic": "^1.1.1", + "get-symbol-description": "^1.0.0", + "has": "^1.0.3", + "has-symbols": "^1.0.2", + "internal-slot": "^1.0.3", + "is-callable": "^1.2.4", + "is-negative-zero": "^2.0.1", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.1", + "is-string": "^1.0.7", + "is-weakref": "^1.0.1", + "object-inspect": "^1.11.0", + "object-keys": "^1.1.1", + "object.assign": "^4.1.2", + "string.prototype.trimend": "^1.0.4", + "string.prototype.trimstart": "^1.0.4", + "unbox-primitive": "^1.0.1" + } + }, + "es-to-primitive": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", + "integrity": "sha512-QCOllgZJtaUo9miYBcLChTUaHNjJF3PYs1VidD7AwiEj1kYxKeQTctLAezAOH5ZKRH0g2IgPn6KwB4IT8iRpvA==", + "dev": true, + "requires": { + "is-callable": "^1.1.4", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.2" + } + }, + "escalade": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", + "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "eslint": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.5.0.tgz", + "integrity": "sha512-tVGSkgNbOfiHyVte8bCM8OmX+xG9PzVG/B4UCF60zx7j61WIVY/AqJECDgpLD4DbbESD0e174gOg3ZlrX15GDg==", + "dev": true, + "requires": { + "@eslint/eslintrc": "^1.0.5", + "@humanwhocodes/config-array": "^0.9.2", + "ajv": "^6.10.0", + "chalk": "^4.0.0", + "cross-spawn": "^7.0.2", + "debug": "^4.3.2", + "doctrine": "^3.0.0", + "enquirer": "^2.3.5", + "escape-string-regexp": "^4.0.0", + "eslint-scope": "^7.1.0", + "eslint-utils": "^3.0.0", + "eslint-visitor-keys": "^3.1.0", + "espree": "^9.2.0", + "esquery": "^1.4.0", + "esutils": "^2.0.2", + "fast-deep-equal": "^3.1.3", + "file-entry-cache": "^6.0.1", + "functional-red-black-tree": "^1.0.1", + "glob-parent": "^6.0.1", + "globals": "^13.6.0", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", + "imurmurhash": "^0.1.4", + "is-glob": "^4.0.0", + "js-yaml": "^4.1.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.4.1", + "lodash.merge": "^4.6.2", + "minimatch": "^3.0.4", + "natural-compare": "^1.4.0", + "optionator": "^0.9.1", + "progress": "^2.0.0", + "regexpp": "^3.2.0", + "semver": "^7.2.1", + "strip-ansi": "^6.0.1", + "strip-json-comments": "^3.1.0", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "eslint-scope": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-7.1.0.tgz", + "integrity": "sha512-aWwkhnS0qAXqNOgKOK0dJ2nvzEbhEvpy8OlJ9kZ0FeZnA6zpjv1/Vei+puGFFX7zkPCkHHXb7IDX3A+7yPrRWg==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^5.2.0" + } + }, + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + }, + "globals": { + "version": "13.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-13.12.0.tgz", + "integrity": "sha512-uS8X6lSKN2JumVoXrbUz+uG4BYG+eiawqm3qFcT7ammfbUHeCBoJMlHcec/S3krSk73/AE/f0szYFmgAA3kYZg==", + "dev": true, + "requires": { + "type-fest": "^0.20.2" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "dev": true + }, + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "eslint-import-resolver-node": { + "version": "0.3.6", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.6.tgz", + "integrity": "sha512-0En0w03NRVMn9Uiyn8YRPDKvWjxCWkslUEhGNTdGx15RvPJYQ+lbOlqrlNI2vEAs4pDYK4f/HN2TbDmk5TP0iw==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "resolve": "^1.20.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + } + } + }, + "eslint-module-utils": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.7.1.tgz", + "integrity": "sha512-fjoetBXQZq2tSTWZ9yWVl2KuFrTZZH3V+9iD1V1RfpDgxzJR+mPd/KZmMiA8gbPqdBzpNiEHOuT7IYEWxrH0zQ==", + "dev": true, + "requires": { + "debug": "^3.2.7", + "find-up": "^2.1.0", + "pkg-dir": "^2.0.0" + }, + "dependencies": { + "debug": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", + "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, + "eslint-plugin-es": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-3.0.1.tgz", + "integrity": "sha512-GUmAsJaN4Fc7Gbtl8uOBlayo2DqhwWvEzykMHSCZHU3XdJ+NSzzZcVhXh3VxX5icqQ+oQdIEawXX8xkR3mIFmQ==", + "dev": true, + "requires": { + "eslint-utils": "^2.0.0", + "regexpp": "^3.0.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-plugin-import": { + "version": "2.25.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.25.3.tgz", + "integrity": "sha512-RzAVbby+72IB3iOEL8clzPLzL3wpDrlwjsTBAQXgyp5SeTqqY+0bFubwuo+y/HLhNZcXV4XqTBO4LGsfyHIDXg==", + "dev": true, + "requires": { + "array-includes": "^3.1.4", + "array.prototype.flat": "^1.2.5", + "debug": "^2.6.9", + "doctrine": "^2.1.0", + "eslint-import-resolver-node": "^0.3.6", + "eslint-module-utils": "^2.7.1", + "has": "^1.0.3", + "is-core-module": "^2.8.0", + "is-glob": "^4.0.3", + "minimatch": "^3.0.4", + "object.values": "^1.1.5", + "resolve": "^1.20.0", + "tsconfig-paths": "^3.11.0" + }, + "dependencies": { + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + } + } + }, + "eslint-plugin-internal-rules": { + "version": "file:resources/eslint-internal-rules" + }, + "eslint-plugin-node": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-11.1.0.tgz", + "integrity": "sha512-oUwtPJ1W0SKD0Tr+wqu92c5xuCeQqB3hSCHasn/ZgjFdA9iDGNkNf2Zi9ztY7X+hNuMib23LNGRm6+uN+KLE3g==", + "dev": true, + "requires": { + "eslint-plugin-es": "^3.0.0", + "eslint-utils": "^2.0.0", + "ignore": "^5.1.1", + "minimatch": "^3.0.4", + "resolve": "^1.10.1", + "semver": "^6.1.0" + }, + "dependencies": { + "eslint-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz", + "integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^1.1.0" + } + }, + "eslint-visitor-keys": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz", + "integrity": "sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ==", + "dev": true + } + } + }, + "eslint-plugin-simple-import-sort": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz", + "integrity": "sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw==", + "dev": true, + "requires": {} + }, + "eslint-plugin-tsdoc": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/eslint-plugin-tsdoc/-/eslint-plugin-tsdoc-0.2.14.tgz", + "integrity": "sha512-fJ3fnZRsdIoBZgzkQjv8vAj6NeeOoFkTfgosj6mKsFjX70QV256sA/wq+y/R2+OL4L8E79VVaVWrPeZnKNe8Ng==", + "dev": true, + "requires": { + "@microsoft/tsdoc": "0.13.2", + "@microsoft/tsdoc-config": "0.15.2" + } + }, + "eslint-scope": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", + "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", + "dev": true, + "requires": { + "esrecurse": "^4.3.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + } + } + }, + "eslint-visitor-keys": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-3.1.0.tgz", + "integrity": "sha512-yWJFpu4DtjsWKkt5GeNBBuZMlNcYVs6vRCLoCVEJrTjaSB6LC98gFipNK/erM2Heg/E8mIK+hXG/pJMLK+eRZA==", + "dev": true + }, + "espree": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-9.2.0.tgz", + "integrity": "sha512-oP3utRkynpZWF/F2x/HZJ+AGtnIclaR7z1pYPxy7NYM2fSO6LgK/Rkny8anRSPK/VwEA1eqm2squui0T7ZMOBg==", + "dev": true, + "requires": { + "acorn": "^8.6.0", + "acorn-jsx": "^5.3.1", + "eslint-visitor-keys": "^3.1.0" + } + }, + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true + }, + "esquery": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.4.0.tgz", + "integrity": "sha512-cCDispWt5vHHtwMY2YrAQ4ibFkAL8RbH5YGBnZBc90MolvvfkkQcJro/aZiAQUlQ3qgrYS6D6v8Gc5G5CQsc9w==", + "dev": true, + "requires": { + "estraverse": "^5.1.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "esrecurse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.3.0.tgz", + "integrity": "sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==", + "dev": true, + "requires": { + "estraverse": "^5.2.0" + }, + "dependencies": { + "estraverse": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-5.3.0.tgz", + "integrity": "sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==", + "dev": true + } + } + }, + "estraverse": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", + "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", + "dev": true + }, + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true + }, + "fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true + }, + "fast-glob": { + "version": "3.2.7", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", + "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", + "dev": true, + "requires": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "dependencies": { + "glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "requires": { + "is-glob": "^4.0.1" + } + } + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, + "fastq": { + "version": "1.13.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.13.0.tgz", + "integrity": "sha512-YpkpUnK8od0o1hmeSc7UUs/eB/vIPWJYjKck2QKIzAf71Vm1AAQ3EbuZB3g2JIy+pg+ERD0vqI79KyZiB2e2Nw==", + "dev": true, + "requires": { + "reusify": "^1.0.4" + } + }, + "file-entry-cache": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-6.0.1.tgz", + "integrity": "sha512-7Gps/XWymbLk2QLYK4NzpMOrYjMhdIxXuIvy2QBsLE6ljuodKvdkWs/cpyJJ3CVIVpH0Oi1Hvg1ovbMzLdFBBg==", + "dev": true, + "requires": { + "flat-cache": "^3.0.4" + } + }, + "fill-range": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", + "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "dev": true, + "requires": { + "to-regex-range": "^5.0.1" + } + }, + "find-cache-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", + "integrity": "sha512-Tq6PixE0w/VMFfCgbONnkiQIVol/JJL7nRMi20fqzA4NRs9AfeqMGeRdPi3wIhYkxjeBaWh2rxwapn5Tu3IqOQ==", + "dev": true, + "requires": { + "commondir": "^1.0.1", + "make-dir": "^2.0.0", + "pkg-dir": "^3.0.0" + }, + "dependencies": { + "find-up": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", + "dev": true, + "requires": { + "locate-path": "^3.0.0" + } + }, + "locate-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz", + "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==", + "dev": true, + "requires": { + "p-locate": "^3.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz", + "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==", + "dev": true, + "requires": { + "p-limit": "^2.0.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "pkg-dir": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-3.0.0.tgz", + "integrity": "sha512-/E57AYkoeQ25qkxMj5PBOVgF8Kiu/h7cYS30Z5+R7WaiCCBfLq58ZI/dSeaEKb9WVJV5n/03QwrN3IeWIFllvw==", + "dev": true, + "requires": { + "find-up": "^3.0.0" + } + } + } + }, + "find-up": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", + "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "dev": true, + "requires": { + "locate-path": "^6.0.0", + "path-exists": "^4.0.0" + } + }, + "flat": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", + "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", + "dev": true + }, + "flat-cache": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", + "integrity": "sha512-dm9s5Pw7Jc0GvMYbshN6zchCA9RgQlzzEZX3vylR9IqFfS8XciblUXOKfW6SiuJ0e13eDYZoZV5wdrev7P3Nwg==", + "dev": true, + "requires": { + "flatted": "^3.1.0", + "rimraf": "^3.0.2" + } + }, + "flatted": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/flatted/-/flatted-3.2.4.tgz", + "integrity": "sha512-8/sOawo8tJ4QOBX8YlQBMxL8+RLZfxMQOif9o0KUKTNTjMYElWPE0r/m5VNFxTRd0NSw8qSy8dajrwX4RYI1Hw==", + "dev": true + }, + "foreground-child": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-2.0.0.tgz", + "integrity": "sha512-dCIq9FpEcyQyXKCkyzmlPTFNgrCzPudOe+mhvJU5zAtlBnGVy2yKxtfsxK2tQBThwq225jcvBjpw1Gr40uzZCA==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "signal-exit": "^3.0.2" + } + }, + "fs-extra": { + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + } + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, + "gensequence": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/gensequence/-/gensequence-3.1.1.tgz", + "integrity": "sha512-ys3h0hiteRwmY6BsvSttPmkhC0vEQHPJduANBRtH/dlDPZ0UBIb/dXy80IcckXyuQ6LKg+PloRqvGER9IS7F7g==", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true + }, + "get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "get-intrinsic": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.1.1.tgz", + "integrity": "sha512-kWZrnVM42QCiEA2Ig1bG8zjoIMOgxWwYCEeNdwY6Tv/cOSeGpcoX4pXHfKUxNKVoArnrEr2e9srnAxxGIraS9Q==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has": "^1.0.3", + "has-symbols": "^1.0.1" + } + }, + "get-stdin": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-8.0.0.tgz", + "integrity": "sha512-sY22aA6xchAzprjyqmSEQv4UbAAzRN0L2dQB0NlN5acTTK9Don6nhoc3eAbUnpZiCANAMfd/+40kVdKfFygohg==", + "dev": true + }, + "get-symbol-description": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/get-symbol-description/-/get-symbol-description-1.0.0.tgz", + "integrity": "sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + } + }, + "glob": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", + "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "requires": { + "is-glob": "^4.0.3" + } + }, + "global-dirs": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", + "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", + "dev": true, + "requires": { + "ini": "^1.3.4" + } + }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, + "globby": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", + "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + }, + "graceful-fs": { + "version": "4.2.8", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.8.tgz", + "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", + "dev": true + }, + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "dev": true + }, + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1" + } + }, + "has-bigints": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has-bigints/-/has-bigints-1.0.1.tgz", + "integrity": "sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "has-own-prop": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-own-prop/-/has-own-prop-2.0.0.tgz", + "integrity": "sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ==", + "dev": true + }, + "has-symbols": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.2.tgz", + "integrity": "sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw==", + "dev": true + }, + "has-tostringtag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", + "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "he": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", + "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "dev": true + }, + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", + "dev": true + }, + "ignore": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz", + "integrity": "sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ==", + "dev": true + }, + "import-fresh": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.3.0.tgz", + "integrity": "sha512-veYYhQa+D1QBKznvhUHxb8faxlrwUnxseDAbAp457E0wLNio2bOSKnjYDhMj+YiAq61xrMGhQk9iXVk5FzgQMw==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + }, + "dependencies": { + "parent-module": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", + "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", + "dev": true, + "requires": { + "callsites": "^3.0.0" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + } + } + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "ini": { + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.8.tgz", + "integrity": "sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew==", + "dev": true + }, + "internal-slot": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.3.tgz", + "integrity": "sha512-O0DB1JC/sPyZl7cIo78n5dR7eUSwwpYPiXRhTzNxZVAMUuB8vlnRFyLxdrVToks6XPLVnFfbzaVd5WLjhgg+vA==", + "dev": true, + "requires": { + "get-intrinsic": "^1.1.0", + "has": "^1.0.3", + "side-channel": "^1.0.4" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-bigint": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", + "integrity": "sha512-zB9CruMamjym81i2JZ3UMn54PKGsQzsJeo6xvN3HJJ4CAsQNB6iRutp2To77OfCNuoxspsIhzaPoO1zyCEhFOg==", + "dev": true, + "requires": { + "has-bigints": "^1.0.1" + } + }, + "is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "requires": { + "binary-extensions": "^2.0.0" + } + }, + "is-boolean-object": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/is-boolean-object/-/is-boolean-object-1.1.2.tgz", + "integrity": "sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-callable": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.4.tgz", + "integrity": "sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w==", + "dev": true + }, + "is-core-module": { + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.0.tgz", + "integrity": "sha512-vd15qHsaqrRL7dtH6QNuy0ndJmRDrS9HAM1CAiSifNUFv4x1a0CCVsj18hJ1mShxIG6T2i1sO78MkP56r0nYRw==", + "dev": true, + "requires": { + "has": "^1.0.3" + } + }, + "is-date-object": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.5.tgz", + "integrity": "sha512-9YQaSxsAiSwcvS33MBk3wTCVnWK+HhF8VZR2jRxehM16QcVOdHqPn4VPHmRK4lSr38n9JriurInLcP90xsYNfQ==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true + }, + "is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "requires": { + "is-extglob": "^2.1.1" + } + }, + "is-negative-zero": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", + "integrity": "sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==", + "dev": true + }, + "is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true + }, + "is-number-object": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/is-number-object/-/is-number-object-1.0.6.tgz", + "integrity": "sha512-bEVOqiRcvo3zO1+G2lVMy+gkkEm9Yh7cDMRusKKu5ZJKPUYSJwICTKZrNKHA2EbSP0Tu0+6B/emsYNHZyn6K8g==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "dev": true + }, + "is-plain-obj": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", + "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", + "dev": true + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "requires": { + "isobject": "^3.0.1" + } + }, + "is-regex": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", + "integrity": "sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + } + }, + "is-shared-array-buffer": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz", + "integrity": "sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA==", + "dev": true + }, + "is-string": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-string/-/is-string-1.0.7.tgz", + "integrity": "sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==", + "dev": true, + "requires": { + "has-tostringtag": "^1.0.0" + } + }, + "is-symbol": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.4.tgz", + "integrity": "sha512-C/CPBqKWnvdcxqIARxyOh4v1UUEOCHpgDa0WYgpKDFMszcrPcffg5uhwSgPCLD2WWxmq6isisz87tzT01tuGhg==", + "dev": true, + "requires": { + "has-symbols": "^1.0.2" + } + }, + "is-typedarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "dev": true + }, + "is-unicode-supported": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", + "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "dev": true + }, + "is-weakref": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", + "integrity": "sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.2" + } + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", + "integrity": "sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==", + "dev": true + }, + "istanbul-lib-report": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", + "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^3.0.0", + "supports-color": "^7.1.0" + }, + "dependencies": { + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "make-dir": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", + "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "dev": true, + "requires": { + "semver": "^6.0.0" + } + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "istanbul-reports": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.2.tgz", + "integrity": "sha512-0gHxuT1NNC0aEIL1zbJ+MTgPbbHhU77eJPuU35WKA7TgXiSNlCAx4PENoMrH0Or6M2H80TaZcWKhM0IK6V8gRw==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "jju": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/jju/-/jju-1.4.0.tgz", + "integrity": "sha1-o6vicYryQaKykE+EpiWXDzia4yo=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", + "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "dev": true, + "requires": { + "argparse": "^2.0.1" + } + }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, + "json5": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.0.tgz", + "integrity": "sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA==", + "dev": true, + "requires": { + "minimist": "^1.2.5" + } + }, + "jsonfile": { + "version": "6.1.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", + "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", + "dev": true, + "requires": { + "graceful-fs": "^4.1.6", + "universalify": "^2.0.0" + } + }, + "kind-of": { + "version": "6.0.3", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", + "integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==", + "dev": true + }, + "levn": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.4.1.tgz", + "integrity": "sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1", + "type-check": "~0.4.0" + } + }, + "lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, + "locate-path": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", + "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "dev": true, + "requires": { + "p-locate": "^5.0.0" + } + }, + "lodash.debounce": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", + "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", + "dev": true + }, + "lodash.merge": { + "version": "4.6.2", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.2.tgz", + "integrity": "sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==", + "dev": true + }, + "log-symbols": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", + "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "dev": true, + "requires": { + "chalk": "^4.1.0", + "is-unicode-supported": "^0.1.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "make-dir": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-2.1.0.tgz", + "integrity": "sha512-LS9X+dc8KLxXCb8dni79fLIIUA5VyZoyjSMCwTluaXA0o27cCK0bhXkpgw+sTXVpPy/lSO57ilRixqk0vDmtRA==", + "dev": true, + "requires": { + "pify": "^4.0.1", + "semver": "^5.6.0" + }, + "dependencies": { + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + } + } + }, + "merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true + }, + "micromatch": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.4.tgz", + "integrity": "sha512-pRmzw/XUcwXGpD9aI9q/0XOwLNygjETJ8y0ao0wdqprrzDa4YnxLcz7fQRZr8voh8V10kGhABbNcHVk5wHgWwg==", + "dev": true, + "requires": { + "braces": "^3.0.1", + "picomatch": "^2.2.3" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", + "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "dev": true + }, + "mocha": { + "version": "9.1.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.3.tgz", + "integrity": "sha512-Xcpl9FqXOAYqI3j79pEtHBBnQgVXIhpULjGQa7DVb0Po+VzmSIK9kanAiWLHoRR/dbZ2qpdPshuXr8l1VaHCzw==", + "dev": true, + "requires": { + "@ungap/promise-all-settled": "1.1.2", + "ansi-colors": "4.1.1", + "browser-stdout": "1.3.1", + "chokidar": "3.5.2", + "debug": "4.3.2", + "diff": "5.0.0", + "escape-string-regexp": "4.0.0", + "find-up": "5.0.0", + "glob": "7.1.7", + "growl": "1.10.5", + "he": "1.2.0", + "js-yaml": "4.1.0", + "log-symbols": "4.1.0", + "minimatch": "3.0.4", + "ms": "2.1.3", + "nanoid": "3.1.25", + "serialize-javascript": "6.0.0", + "strip-json-comments": "3.1.1", + "supports-color": "8.1.1", + "which": "2.0.2", + "workerpool": "6.1.5", + "yargs": "16.2.0", + "yargs-parser": "20.2.4", + "yargs-unparser": "2.0.0" + }, + "dependencies": { + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true + }, + "glob": { + "version": "7.1.7", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.7.tgz", + "integrity": "sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true + }, + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + }, + "yargs-parser": { + "version": "20.2.4", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", + "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "dev": true + } + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + }, + "nanoid": { + "version": "3.1.25", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.1.25.tgz", + "integrity": "sha512-rdwtIXaXCLFAQbnfqDRnI6jaRHp9fTcYBjtFKE8eezcZ7LuLjhUaQGNeMXf1HmRoCH32CLz6XwX0TtxEOS/A3Q==", + "dev": true + }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, + "node-releases": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", + "dev": true + }, + "normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true + }, + "object-inspect": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.0.tgz", + "integrity": "sha512-Ho2z80bVIvJloH+YzRmpZVQe87+qASmBUKZDWgx9cu+KDrX2ZDH/3tMy+gXbZETVGs2M8YdxObOh7XAtim9Y0g==", + "dev": true + }, + "object-keys": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", + "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true + }, + "object.assign": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.2.tgz", + "integrity": "sha512-ixT2L5THXsApyiUPYKmW+2EHpXXe5Ii3M+f4e+aJFAHao5amFRW6J0OO6c/LU8Be47utCx2GL89hxGB6XSmKuQ==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3", + "has-symbols": "^1.0.1", + "object-keys": "^1.1.1" + } + }, + "object.values": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.5.tgz", + "integrity": "sha512-QUZRW0ilQ3PnPpbNtgdNV1PDbEqLIiSFB3l+EnGtBQ/8SUTLj1PZwtQHABZtLgwpJZTSZhuGLOGk57Drx2IvYg==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3", + "es-abstract": "^1.19.1" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "optionator": { + "version": "0.9.1", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.9.1.tgz", + "integrity": "sha512-74RlY5FCnhq4jRxVUPKDaRwrVNXMqsGsiW6AJw4XK8hmtm10wC0ypZBLw5IIp85NZMr91+qd1RvvENwg7jjRFw==", + "dev": true, + "requires": { + "deep-is": "^0.1.3", + "fast-levenshtein": "^2.0.6", + "levn": "^0.4.1", + "prelude-ls": "^1.2.1", + "type-check": "^0.4.0", + "word-wrap": "^1.2.3" + } + }, + "p-limit": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", + "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", + "dev": true, + "requires": { + "yocto-queue": "^0.1.0" + } + }, + "p-locate": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", + "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "dev": true, + "requires": { + "p-limit": "^3.0.2" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, + "parent-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-2.0.0.tgz", + "integrity": "sha512-uo0Z9JJeWzv8BG+tRcapBKNJ0dro9cLyczGzulS6EfeyAdeC9sbojtW6XwvYxJkEne9En+J2XEl4zyglVeIwFg==", + "dev": true, + "requires": { + "callsites": "^3.1.0" + } + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" + } + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "pathval": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", + "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "dev": true + }, + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", + "dev": true + }, + "picomatch": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.0.tgz", + "integrity": "sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw==", + "dev": true + }, + "pify": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", + "dev": true + }, + "pirates": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.4.tgz", + "integrity": "sha512-ZIrVPH+A52Dw84R0L3/VS9Op04PuQ2SEoJL6bkshmiTic/HldyW9Tf7oH5mhJZBK7NmDx27vSMrYEXPXclpDKw==", + "dev": true + }, + "pkg-dir": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", + "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", + "dev": true, + "requires": { + "find-up": "^2.1.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "^2.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "^2.0.0", + "path-exists": "^3.0.0" + } + }, + "p-limit": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", + "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", + "dev": true, + "requires": { + "p-try": "^1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "^1.1.0" + } + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, + "prelude-ls": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", + "integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==", + "dev": true + }, + "prettier": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", + "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", + "dev": true + }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true + }, + "randombytes": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", + "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "dev": true, + "requires": { + "safe-buffer": "^5.1.0" + } + }, + "readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "requires": { + "picomatch": "^2.2.1" + } + }, + "regenerate": { + "version": "1.4.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", + "integrity": "sha512-zrceR/XhGYU/d/opr2EKO7aRHUeiBI8qjtfHqADTwZd6Szfy16la6kqD0MIUs5z5hx6AaKa+PixpPrR289+I0A==", + "dev": true + }, + "regenerate-unicode-properties": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/regenerate-unicode-properties/-/regenerate-unicode-properties-9.0.0.tgz", + "integrity": "sha512-3E12UeNSPfjrgwjkR81m5J7Aw/T55Tu7nUyZVQYCKEOs+2dkxEY+DpPtZzO4YruuiPb7NkYLVcyJC4+zCbk5pA==", + "dev": true, + "requires": { + "regenerate": "^1.4.2" + } + }, + "regenerator-runtime": { + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==", + "dev": true + }, + "regenerator-transform": { + "version": "0.14.5", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.14.5.tgz", + "integrity": "sha512-eOf6vka5IO151Jfsw2NO9WpGX58W6wWmefK3I1zEGr0lOD0u8rwPaNqQL1aRxUaxLeKO3ArNh3VYg1KbaD+FFw==", + "dev": true, + "requires": { + "@babel/runtime": "^7.8.4" + } + }, + "regexpp": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.2.0.tgz", + "integrity": "sha512-pq2bWo9mVD43nbts2wGv17XLiNLya+GklZ8kaDLV2Z08gDCsGpnKn9BFMepvWuHCbyVvY7J5o5+BVvoQbmlJLg==", + "dev": true + }, + "regexpu-core": { + "version": "4.8.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.8.0.tgz", + "integrity": "sha512-1F6bYsoYiz6is+oz70NWur2Vlh9KWtswuRuzJOfeYUrfPX2o8n74AnUVaOGDbUqVGO9fNHu48/pjJO4sNVwsOg==", + "dev": true, + "requires": { + "regenerate": "^1.4.2", + "regenerate-unicode-properties": "^9.0.0", + "regjsgen": "^0.5.2", + "regjsparser": "^0.7.0", + "unicode-match-property-ecmascript": "^2.0.0", + "unicode-match-property-value-ecmascript": "^2.0.0" + } + }, + "regjsgen": { + "version": "0.5.2", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.5.2.tgz", + "integrity": "sha512-OFFT3MfrH90xIW8OOSyUrk6QHD5E9JOTeGodiJeBS3J6IwlgzJMNE/1bZklWz5oTg+9dCMyEetclvCVXOPoN3A==", + "dev": true + }, + "regjsparser": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.7.0.tgz", + "integrity": "sha512-A4pcaORqmNMDVwUjWoTzuhwMGpP+NykpfqAsEgI1FSH/EzC7lrN5TMd+kN8YCovX+jMpu8eaqXgXPCa0g8FQNQ==", + "dev": true, + "requires": { + "jsesc": "~0.5.0" + }, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "resolve": { + "version": "1.20.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.20.0.tgz", + "integrity": "sha512-wENBPt4ySzg4ybFQW2TT1zMQucPK95HSh/nq2CFTZVOGut2+pQvSsgtda4d26YrYcr067wjbmzOG8byDPBX63A==", + "dev": true, + "requires": { + "is-core-module": "^2.2.0", + "path-parse": "^1.0.6" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", + "dev": true + }, + "resolve-global": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-global/-/resolve-global-1.0.0.tgz", + "integrity": "sha512-zFa12V4OLtT5XUX/Q4VLvTfBf+Ok0SPc1FNGM/z9ctUdiU618qwKpWnd0CHs3+RqROfyEg/DhuHbMWYqcgljEw==", + "dev": true, + "requires": { + "global-dirs": "^0.1.1" + } + }, + "reusify": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "requires": { + "queue-microtask": "^1.2.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "serialize-javascript": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "dev": true, + "requires": { + "randombytes": "^2.1.0" + } + }, + "shallow-clone": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz", + "integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==", + "dev": true, + "requires": { + "kind-of": "^6.0.2" + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "side-channel": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", + "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", + "dev": true, + "requires": { + "call-bind": "^1.0.0", + "get-intrinsic": "^1.0.2", + "object-inspect": "^1.9.0" + } + }, + "signal-exit": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", + "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-support": { + "version": "0.5.21", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", + "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==", + "dev": true, + "requires": { + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" + }, + "dependencies": { + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + } + } + }, + "string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "requires": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + } + }, + "string.prototype.trimend": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz", + "integrity": "sha512-y9xCjw1P23Awk8EvTpcyL2NIr1j7wJ39f+k6lvRnSMz+mz9CGz9NYPelDk42kOz6+ql8xjfK8oYzy3jAP5QU5A==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "string.prototype.trimstart": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz", + "integrity": "sha512-jh6e984OBfvxS50tdY2nRZnoC5/mLFKOREQfw8t5yytkoUsJRNxvI/E39qu1sD0OtWI3OC0XgKSmcWwziwYuZw==", + "dev": true, + "requires": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + } + }, + "strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "requires": { + "ansi-regex": "^5.0.1" + } + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-json-comments": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", + "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", + "dev": true, + "requires": { + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, + "to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "requires": { + "is-number": "^7.0.0" + } + }, + "tsconfig-paths": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.12.0.tgz", + "integrity": "sha512-e5adrnOYT6zqVnWqZu7i/BQ3BnhzvGbjEjejFXO20lKIKpwTaupkCPgEfv4GZK1IBciJUEhYs3J3p75FdaTFVg==", + "dev": true, + "requires": { + "@types/json5": "^0.0.29", + "json5": "^1.0.1", + "minimist": "^1.2.0", + "strip-bom": "^3.0.0" + }, + "dependencies": { + "json5": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.1.tgz", + "integrity": "sha512-aKS4WQjPenRxiQsC93MNfjx+nbF4PAdYzmd/1JIj8HYzqfbu86beTuNgXDzPknWk0n0uARlyewZo4s++ES36Ow==", + "dev": true, + "requires": { + "minimist": "^1.2.0" + } + } + } + }, + "tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "tsutils": { + "version": "3.21.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.21.0.tgz", + "integrity": "sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==", + "dev": true, + "requires": { + "tslib": "^1.8.1" + } + }, + "type-check": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", + "integrity": "sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==", + "dev": true, + "requires": { + "prelude-ls": "^1.2.1" + } + }, + "type-detect": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "dev": true + }, + "type-fest": { + "version": "0.20.2", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.20.2.tgz", + "integrity": "sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ==", + "dev": true + }, + "typedarray-to-buffer": { + "version": "3.1.5", + "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", + "integrity": "sha512-zdu8XMNEDepKKR+XYOXAVPtWui0ly0NtohUscw+UmaHiAWT8hrV1rr//H6V+0DvJ3OQ19S979M0laLfX8rm82Q==", + "dev": true, + "requires": { + "is-typedarray": "^1.0.0" + } + }, + "typescript": { + "version": "4.5.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.4.tgz", + "integrity": "sha512-VgYs2A2QIRuGphtzFV7aQJduJ2gyfTljngLzjpfW9FoYZF6xuw1W0vW9ghCKLfcWrCFxK81CSGRAvS1pn4fIUg==", + "dev": true + }, + "unbox-primitive": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/unbox-primitive/-/unbox-primitive-1.0.1.tgz", + "integrity": "sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw==", + "dev": true, + "requires": { + "function-bind": "^1.1.1", + "has-bigints": "^1.0.1", + "has-symbols": "^1.0.2", + "which-boxed-primitive": "^1.0.2" + } + }, + "unicode-canonical-property-names-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-2.0.0.tgz", + "integrity": "sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==", + "dev": true + }, + "unicode-match-property-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-ecmascript/-/unicode-match-property-ecmascript-2.0.0.tgz", + "integrity": "sha512-5kaZCrbp5mmbz5ulBkDkbY0SsPOjKqVS35VpL9ulMPfSl0J0Xsm+9Evphv9CoIZFwre7aJoa94AY6seMKGVN5Q==", + "dev": true, + "requires": { + "unicode-canonical-property-names-ecmascript": "^2.0.0", + "unicode-property-aliases-ecmascript": "^2.0.0" + } + }, + "unicode-match-property-value-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-match-property-value-ecmascript/-/unicode-match-property-value-ecmascript-2.0.0.tgz", + "integrity": "sha512-7Yhkc0Ye+t4PNYzOGKedDhXbYIBe1XEQYQxOPyhcXNMJ0WCABqqj6ckydd6pWRZTHV4GuCPKdBAUiMc60tsKVw==", + "dev": true + }, + "unicode-property-aliases-ecmascript": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unicode-property-aliases-ecmascript/-/unicode-property-aliases-ecmascript-2.0.0.tgz", + "integrity": "sha512-5Zfuy9q/DFr4tfO7ZPeVXb1aPoeQSdeFMLpYuFebehDAhbuevLs5yxSZmIFN1tP5F9Wl4IpJrYojg85/zgyZHQ==", + "dev": true + }, + "unique-string": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/unique-string/-/unique-string-2.0.0.tgz", + "integrity": "sha512-uNaeirEPvpZWSgzwsPGtU2zVSTrn/8L5q/IexZmH0eH6SA73CmAA5U4GwORTxQAZs95TAXLNqeLoPPNO5gZfWg==", + "dev": true, + "requires": { + "crypto-random-string": "^2.0.0" + } + }, + "universalify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", + "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", + "dev": true + }, + "uri-js": { + "version": "4.4.1", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", + "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, + "v8-compile-cache": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz", + "integrity": "sha512-l8lCEmLcLYZh4nbunNZvQCJc5pv7+RCwa8q/LdUx8u7lsWvPDKmpodJAJNwkAhJC//dFY48KuIEmjtd4RViDrA==", + "dev": true + }, + "v8-to-istanbul": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-8.1.0.tgz", + "integrity": "sha512-/PRhfd8aTNp9Ggr62HPzXg2XasNFGy5PBt0Rp04du7/8GNNSgxFL6WBTkgMKSL9bFjH+8kKEG3f37FmxiTqUUA==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^1.6.0", + "source-map": "^0.7.3" + }, + "dependencies": { + "source-map": { + "version": "0.7.3", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.7.3.tgz", + "integrity": "sha512-CkCj6giN3S+n9qrYiBTX5gystlENnRW5jZeNLHpe6aue+SrHcG5VYwujhW9s4dY31mEGsxBDrHR6oI69fTXsaQ==", + "dev": true + } + } + }, + "vscode-uri": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/vscode-uri/-/vscode-uri-3.0.3.tgz", + "integrity": "sha512-EcswR2S8bpR7fD0YPeS7r2xXExrScVMxg4MedACaWHEtx9ftCF/qHG1xGkolzTPcEmjTavCQgbVzHUIdTMzFGA==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + }, + "which-boxed-primitive": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/which-boxed-primitive/-/which-boxed-primitive-1.0.2.tgz", + "integrity": "sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==", + "dev": true, + "requires": { + "is-bigint": "^1.0.1", + "is-boolean-object": "^1.1.0", + "is-number-object": "^1.0.4", + "is-string": "^1.0.5", + "is-symbol": "^1.0.3" + } + }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, + "workerpool": { + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.1.5.tgz", + "integrity": "sha512-XdKkCK0Zqc6w3iTxLckiuJ81tiD/o5rBE/m+nXpRCB+/Sq4DqkfXZ/x0jW02DG1tGsfUGXbTJyZDP+eu67haSw==", + "dev": true + }, + "wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "requires": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "requires": { + "color-convert": "^2.0.1" + } + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-3.0.3.tgz", + "integrity": "sha512-AvHcyZ5JnSfq3ioSyjrBkH9yW4m7Ayk8/9My/DD9onKeu/94fwrMocemO2QAJFAlnnDN+ZDS+ZjAR5ua1/PV/Q==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "is-typedarray": "^1.0.0", + "signal-exit": "^3.0.2", + "typedarray-to-buffer": "^3.1.5" + } + }, + "xdg-basedir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-4.0.0.tgz", + "integrity": "sha512-PSNhEJDejZYV7h50BohL09Er9VaIefr2LMAf3OEmpCkjOi34eYyQYAXUTjEQtZJTKcF0E2UKTh+osDLsgNim9Q==", + "dev": true + }, + "y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "dev": true + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + }, + "yaml": { + "version": "1.10.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", + "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", + "dev": true + }, + "yargs": { + "version": "16.2.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", + "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "dev": true, + "requires": { + "cliui": "^7.0.2", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.0", + "y18n": "^5.0.5", + "yargs-parser": "^20.2.2" + } + }, + "yargs-parser": { + "version": "20.2.9", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.9.tgz", + "integrity": "sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w==", + "dev": true + }, + "yargs-unparser": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", + "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", + "dev": true, + "requires": { + "camelcase": "^6.0.0", + "decamelize": "^4.0.0", + "flat": "^5.0.2", + "is-plain-obj": "^2.1.0" + } + }, + "yocto-queue": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", + "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", + "dev": true + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 00000000..6a870cc8 --- /dev/null +++ b/package.json @@ -0,0 +1,79 @@ +{ + "name": "graphql", + "version": "16.2.0", + "description": "A Query Language and Runtime which can target any service.", + "license": "MIT", + "private": true, + "main": "index", + "module": "index.mjs", + "typesVersions": { + ">=4.1.0": { + "*": [ + "*" + ] + } + }, + "sideEffects": false, + "homepage": "https://github.com/graphql/graphql-js", + "bugs": { + "url": "https://github.com/graphql/graphql-js/issues" + }, + "repository": { + "type": "git", + "url": "https://github.com/graphql/graphql-js.git" + }, + "keywords": [ + "graphql", + "graphql-js" + ], + "engines": { + "node": "^12.22.0 || ^14.16.0 || >=16.0.0" + }, + "scripts": { + "preversion": ". ./resources/checkgit.sh && npm ci --ignore-scripts", + "version": "node resources/gen-version.js && npm test && git add src/version.ts", + "fuzzonly": "mocha --full-trace src/**/__tests__/**/*-fuzz.ts", + "changelog": "node resources/gen-changelog.js", + "benchmark": "node benchmark/benchmark.js", + "test": "npm run lint && npm run check && npm run testonly && npm run prettier:check && npm run check:spelling && npm run check:integrations", + "lint": "eslint --cache --max-warnings 0 .", + "check": "tsc --pretty", + "testonly": "mocha --full-trace src/**/__tests__/**/*-test.ts", + "testonly:cover": "c8 npm run testonly", + "prettier": "prettier --write --list-different .", + "prettier:check": "prettier --check .", + "check:spelling": "cspell --cache --no-progress '**/*'", + "check:integrations": "npm run build:npm && npm run build:deno && mocha --full-trace integrationTests/*-test.js", + "build:npm": "node resources/build-npm.js", + "build:deno": "node resources/build-deno.js", + "gitpublish:npm": "bash ./resources/gitpublish.sh npm npmDist", + "gitpublish:deno": "bash ./resources/gitpublish.sh deno denoDist" + }, + "devDependencies": { + "@babel/core": "7.16.5", + "@babel/plugin-syntax-typescript": "7.16.5", + "@babel/plugin-transform-typescript": "7.16.1", + "@babel/preset-env": "7.16.5", + "@babel/register": "7.16.5", + "@types/chai": "4.3.0", + "@types/mocha": "9.0.0", + "@types/node": "17.0.5", + "@typescript-eslint/eslint-plugin": "5.8.0", + "@typescript-eslint/parser": "5.8.0", + "c8": "7.10.0", + "chai": "4.3.4", + "cspell": "5.13.4", + "eslint": "8.5.0", + "eslint-plugin-import": "2.25.3", + "eslint-plugin-internal-rules": "file:./resources/eslint-internal-rules", + "eslint-plugin-node": "11.1.0", + "eslint-plugin-simple-import-sort": "7.0.0", + "eslint-plugin-tsdoc": "0.2.14", + "mocha": "9.1.3", + "prettier": "2.5.1", + "typescript": "4.5.4" + }, + "publishConfig": { + "tag": "latest" + } +} diff --git a/resources/add-extension-to-import-paths.js b/resources/add-extension-to-import-paths.js new file mode 100644 index 00000000..3ec22d9d --- /dev/null +++ b/resources/add-extension-to-import-paths.js @@ -0,0 +1,39 @@ +'use strict'; + +/** + * Adds extension to all paths imported inside MJS files + * + * Transforms: + * + * import { foo } from './bar'; + * export { foo } from './bar'; + * + * to: + * + * import { foo } from './bar.mjs'; + * export { foo } from './bar.mjs'; + * + */ +module.exports = function addExtensionToImportPaths(context, { extension }) { + const { types } = context; + + return { + visitor: { + ImportDeclaration: replaceImportPath, + ExportNamedDeclaration: replaceImportPath, + }, + }; + + function replaceImportPath(path) { + // bail if the declaration doesn't have a source, e.g. "export { foo };" + if (!path.node.source) { + return; + } + + const source = path.node.source.value; + if (source.startsWith('./') || source.startsWith('../')) { + const newSourceNode = types.stringLiteral(source + '.' + extension); + path.get('source').replaceWith(newSourceNode); + } + } +}; diff --git a/resources/build-deno.js b/resources/build-deno.js new file mode 100644 index 00000000..f0479a85 --- /dev/null +++ b/resources/build-deno.js @@ -0,0 +1,35 @@ +'use strict'; + +const fs = require('fs'); +const path = require('path'); + +const babel = require('@babel/core'); + +const { + writeGeneratedFile, + readdirRecursive, + showDirStats, +} = require('./utils.js'); + +if (require.main === module) { + fs.rmSync('./denoDist', { recursive: true, force: true }); + fs.mkdirSync('./denoDist'); + + const srcFiles = readdirRecursive('./src', { ignoreDir: /^__.*__$/ }); + for (const filepath of srcFiles) { + const srcPath = path.join('./src', filepath); + const destPath = path.join('./denoDist', filepath); + + fs.mkdirSync(path.dirname(destPath), { recursive: true }); + if (filepath.endsWith('.ts')) { + const options = { babelrc: false, configFile: './.babelrc-deno.json' }; + const output = babel.transformFileSync(srcPath, options).code + '\n'; + writeGeneratedFile(destPath, output); + } + } + + fs.copyFileSync('./LICENSE', './denoDist/LICENSE'); + fs.copyFileSync('./README.md', './denoDist/README.md'); + + showDirStats('./denoDist'); +} diff --git a/resources/build-npm.js b/resources/build-npm.js new file mode 100644 index 00000000..7ff0cf07 --- /dev/null +++ b/resources/build-npm.js @@ -0,0 +1,139 @@ +'use strict'; + +const fs = require('fs'); +const path = require('path'); +const assert = require('assert'); + +const ts = require('typescript'); +const babel = require('@babel/core'); + +const { + writeGeneratedFile, + readdirRecursive, + showDirStats, +} = require('./utils.js'); + +if (require.main === module) { + fs.rmSync('./npmDist', { recursive: true, force: true }); + fs.mkdirSync('./npmDist'); + + const packageJSON = buildPackageJSON(); + + const srcFiles = readdirRecursive('./src', { ignoreDir: /^__.*__$/ }); + for (const filepath of srcFiles) { + const srcPath = path.join('./src', filepath); + const destPath = path.join('./npmDist', filepath); + + fs.mkdirSync(path.dirname(destPath), { recursive: true }); + if (filepath.endsWith('.ts')) { + const cjs = babelBuild(srcPath, { envName: 'cjs' }); + writeGeneratedFile(destPath.replace(/\.ts$/, '.js'), cjs); + + const mjs = babelBuild(srcPath, { envName: 'mjs' }); + writeGeneratedFile(destPath.replace(/\.ts$/, '.mjs'), mjs); + } + } + + // Based on https://github.com/Microsoft/TypeScript/wiki/Using-the-Compiler-API#getting-the-dts-from-a-javascript-file + const tsConfig = JSON.parse( + fs.readFileSync(require.resolve('../tsconfig.json'), 'utf-8'), + ); + assert( + tsConfig.compilerOptions, + '"tsconfig.json" should have `compilerOptions`', + ); + const tsOptions = { + ...tsConfig.compilerOptions, + noEmit: false, + declaration: true, + declarationDir: './npmDist', + emitDeclarationOnly: true, + }; + + const tsHost = ts.createCompilerHost(tsOptions); + tsHost.writeFile = (filepath, body) => { + writeGeneratedFile(filepath, body); + }; + + const tsProgram = ts.createProgram(['src/index.ts'], tsOptions, tsHost); + const tsResult = tsProgram.emit(); + assert( + !tsResult.emitSkipped, + 'Fail to generate `*.d.ts` files, please run `npm run check`', + ); + + assert(packageJSON.types === undefined, 'Unexpected "types" in package.json'); + const supportedTSVersions = Object.keys(packageJSON.typesVersions); + assert( + supportedTSVersions.length === 1, + 'Property "typesVersions" should have exactly one key.', + ); + // TODO: revisit once TS implements https://github.com/microsoft/TypeScript/issues/32166 + const notSupportedTSVersionFile = 'NotSupportedTSVersion.d.ts'; + fs.writeFileSync( + path.join('./npmDist', notSupportedTSVersionFile), + // Provoke syntax error to show this message + `"Package 'graphql' support only TS versions that are ${supportedTSVersions[0]}".`, + ); + packageJSON.typesVersions = { + ...packageJSON.typesVersions, + '*': { '*': [notSupportedTSVersionFile] }, + }; + + fs.copyFileSync('./LICENSE', './npmDist/LICENSE'); + fs.copyFileSync('./README.md', './npmDist/README.md'); + + // Should be done as the last step so only valid packages can be published + writeGeneratedFile('./npmDist/package.json', JSON.stringify(packageJSON)); + + showDirStats('./npmDist'); +} + +function babelBuild(srcPath, options) { + const { code } = babel.transformFileSync(srcPath, { + babelrc: false, + configFile: './.babelrc-npm.json', + ...options, + }); + return code + '\n'; +} + +function buildPackageJSON() { + const packageJSON = JSON.parse( + fs.readFileSync(require.resolve('../package.json'), 'utf-8'), + ); + + delete packageJSON.private; + delete packageJSON.scripts; + delete packageJSON.devDependencies; + + // TODO: move to integration tests + const publishTag = packageJSON.publishConfig?.tag; + assert(publishTag != null, 'Should have packageJSON.publishConfig defined!'); + + const { version } = packageJSON; + const versionMatch = /^\d+\.\d+\.\d+-?(?.*)?$/.exec(version); + if (!versionMatch) { + throw new Error('Version does not match semver spec: ' + version); + } + + const { preReleaseTag } = versionMatch.groups; + + if (preReleaseTag != null) { + const splittedTag = preReleaseTag.split('.'); + // Note: `experimental-*` take precedence over `alpha`, `beta` or `rc`. + const versionTag = splittedTag[2] ?? splittedTag[0]; + assert( + ['alpha', 'beta', 'rc'].includes(versionTag) || + versionTag.startsWith('experimental-'), + `"${versionTag}" tag is not supported.`, + ); + assert.equal( + versionTag, + publishTag, + 'Publish tag and version tag should match!', + ); + } + + return packageJSON; +} diff --git a/resources/checkgit.sh b/resources/checkgit.sh new file mode 100644 index 00000000..49449ecd --- /dev/null +++ b/resources/checkgit.sh @@ -0,0 +1,38 @@ +# Exit immediately if any subcommand terminated +trap "exit 1" ERR + +# +# This script determines if current git state is the up to date main. If so +# it exits normally. If not it prompts for an explicit continue. This script +# intends to protect from versioning for NPM without first pushing changes +# and including any changes on main. +# + +# Check that local copy has no modifications +GIT_MODIFIED_FILES=$(git ls-files -dm 2> /dev/null); +GIT_STAGED_FILES=$(git diff --cached --name-only 2> /dev/null); +if [ "$GIT_MODIFIED_FILES" != "" -o "$GIT_STAGED_FILES" != "" ]; then + read -p "Git has local modifications. Continue? (y|N) " yn; + if [ "$yn" != "y" ]; then exit 1; fi; +fi; + +# First fetch to ensure git is up to date. Fail-fast if this fails. +git fetch; +if [[ $? -ne 0 ]]; then exit 1; fi; + +# Extract useful information. +GIT_BRANCH=$(git branch -v 2> /dev/null | sed '/^[^*]/d'); +GIT_BRANCH_NAME=$(echo "$GIT_BRANCH" | sed 's/* \([A-Za-z0-9_\-]*\).*/\1/'); +GIT_BRANCH_SYNC=$(echo "$GIT_BRANCH" | sed 's/* [^[]*.\([^]]*\).*/\1/'); + +# Check if main is checked out +if [ "$GIT_BRANCH_NAME" != "main" ]; then + read -p "Git not on main but $GIT_BRANCH_NAME. Continue? (y|N) " yn; + if [ "$yn" != "y" ]; then exit 1; fi; +fi; + +# Check if branch is synced with remote +if [ "$GIT_BRANCH_SYNC" != "" ]; then + read -p "Git not up to date but $GIT_BRANCH_SYNC. Continue? (y|N) " yn; + if [ "$yn" != "y" ]; then exit 1; fi; +fi; diff --git a/resources/diff-npm-package.js b/resources/diff-npm-package.js new file mode 100644 index 00000000..c0d8d8c9 --- /dev/null +++ b/resources/diff-npm-package.js @@ -0,0 +1,104 @@ +'use strict'; + +const os = require('os'); +const fs = require('fs'); +const path = require('path'); +const cp = require('child_process'); + +const LOCAL = 'local'; +const localRepoDir = path.join(__dirname, '..'); +const tmpDir = path.join(os.tmpdir(), 'graphql-js-npm-diff'); +fs.rmSync(tmpDir, { recursive: true, force: true }); +fs.mkdirSync(tmpDir); + +const args = process.argv.slice(2); +let [fromRevision, toRevision] = args; +if (args.length < 2) { + fromRevision = fromRevision ?? 'HEAD'; + toRevision = toRevision ?? LOCAL; + console.warn( + `Assuming you meant: diff-npm-package ${fromRevision} ${toRevision}`, + ); +} + +console.log(`📦 Building NPM package for ${fromRevision}...`); +const fromPackage = prepareNPMPackage(fromRevision); + +console.log(`📦 Building NPM package for ${toRevision}...`); +const toPackage = prepareNPMPackage(toRevision); + +console.log('➖➕ Generating diff...'); +const diff = exec(`npm diff --diff=${fromPackage} --diff=${toPackage}`); + +if (diff === '') { + console.log('No changes found!'); +} else { + const reportPath = path.join(localRepoDir, 'npm-dist-diff.html'); + fs.writeFileSync(reportPath, generateReport(diff), 'utf-8'); + console.log('Report saved to: ', reportPath); +} + +function generateReport(diffString) { + return ` + + + + + + + + + + + +
+ + + `; +} +function prepareNPMPackage(revision) { + if (revision === LOCAL) { + exec('npm --quiet run build:npm', { cwd: localRepoDir }); + return path.join(localRepoDir, 'npmDist'); + } + + // Returns the complete git hash for a given git revision reference. + const hash = exec(`git rev-parse "${revision}"`); + + const repoDir = path.join(tmpDir, hash); + fs.rmSync(repoDir, { recursive: true, force: true }); + fs.mkdirSync(repoDir); + exec(`git archive "${hash}" | tar -xC "${repoDir}"`); + exec('npm --quiet ci --ignore-scripts', { cwd: repoDir }); + exec('npm --quiet run build:npm', { cwd: repoDir }); + return path.join(repoDir, 'npmDist'); +} + +function exec(command, options = {}) { + const result = cp.execSync(command, { + encoding: 'utf-8', + stdio: ['inherit', 'pipe', 'inherit'], + ...options, + }); + return result?.trimEnd(); +} diff --git a/resources/eslint-internal-rules/README.md b/resources/eslint-internal-rules/README.md new file mode 100644 index 00000000..cec9e87c --- /dev/null +++ b/resources/eslint-internal-rules/README.md @@ -0,0 +1,6 @@ +# Custom ESLint Rules + +This is a dummy npm package that allows us to treat it as an `eslint-plugin-graphql-internal`. +It's not actually published, nor are the rules here useful for users of graphql. + +**If you modify this rule, you must re-run `npm install` for it to take effect.** diff --git a/resources/eslint-internal-rules/index.js b/resources/eslint-internal-rules/index.js new file mode 100644 index 00000000..4acc530f --- /dev/null +++ b/resources/eslint-internal-rules/index.js @@ -0,0 +1,13 @@ +'use strict'; + +const onlyASCII = require('./only-ascii.js'); +const noDirImport = require('./no-dir-import.js'); +const requireToStringTag = require('./require-to-string-tag.js'); + +module.exports = { + rules: { + 'only-ascii': onlyASCII, + 'no-dir-import': noDirImport, + 'require-to-string-tag': requireToStringTag, + }, +}; diff --git a/resources/eslint-internal-rules/no-dir-import.js b/resources/eslint-internal-rules/no-dir-import.js new file mode 100644 index 00000000..53220398 --- /dev/null +++ b/resources/eslint-internal-rules/no-dir-import.js @@ -0,0 +1,36 @@ +'use strict'; + +const fs = require('fs'); +const path = require('path'); + +module.exports = function noDirImportRule(context) { + return { + ImportDeclaration: checkImportPath, + ExportNamedDeclaration: checkImportPath, + }; + + function checkImportPath(node) { + const { source } = node; + + // bail if the declaration doesn't have a source, e.g. "export { foo };" + if (!source) { + return; + } + + const importPath = source.value; + if (importPath.startsWith('./') || importPath.startsWith('../')) { + const baseDir = path.dirname(context.getFilename()); + const resolvedPath = path.resolve(baseDir, importPath); + + if ( + fs.existsSync(resolvedPath) && + fs.statSync(resolvedPath).isDirectory() + ) { + context.report({ + node: source, + message: 'It is not allowed to import from directory', + }); + } + } + } +}; diff --git a/resources/eslint-internal-rules/only-ascii.js b/resources/eslint-internal-rules/only-ascii.js new file mode 100644 index 00000000..f5ddbe1b --- /dev/null +++ b/resources/eslint-internal-rules/only-ascii.js @@ -0,0 +1,39 @@ +'use strict'; + +module.exports = { + meta: { + schema: [ + { + type: 'object', + properties: { + allowEmoji: { + type: 'boolean', + }, + }, + additionalProperties: false, + }, + ], + }, + create: onlyASCII, +}; + +function onlyASCII(context) { + const regExp = + context.options[0]?.allowEmoji === true + ? /[^\p{ASCII}\p{Emoji}]+/gu + : /\P{ASCII}+/gu; + + return { + Program() { + const sourceCode = context.getSourceCode(); + const text = sourceCode.getText(); + + for (const match of text.matchAll(regExp)) { + context.report({ + loc: sourceCode.getLocFromIndex(match.index), + message: `Non-ASCII character "${match[0]}" found.`, + }); + } + }, + }; +} diff --git a/resources/eslint-internal-rules/package.json b/resources/eslint-internal-rules/package.json new file mode 100644 index 00000000..5912b145 --- /dev/null +++ b/resources/eslint-internal-rules/package.json @@ -0,0 +1,8 @@ +{ + "name": "eslint-plugin-graphql-internal", + "version": "0.0.0", + "private": true, + "engines": { + "node": ">= 14.0.0" + } +} diff --git a/resources/eslint-internal-rules/require-to-string-tag.js b/resources/eslint-internal-rules/require-to-string-tag.js new file mode 100644 index 00000000..517fd07e --- /dev/null +++ b/resources/eslint-internal-rules/require-to-string-tag.js @@ -0,0 +1,37 @@ +'use strict'; + +module.exports = function requireToStringTag(context) { + const sourceCode = context.getSourceCode(); + + return { + 'ExportNamedDeclaration > ClassDeclaration': (classNode) => { + const properties = classNode.body.body; + if (properties.some(isToStringTagProperty)) { + return; + } + + const jsDoc = context.getJSDocComment(classNode)?.value; + // FIXME: use proper TSDoc parser instead of includes once we fix TSDoc comments + if (jsDoc?.includes('@internal') === true) { + return; + } + + context.report({ + node: classNode, + message: + 'All classes in public API required to have [Symbol.toStringTag] method', + }); + }, + }; + + function isToStringTagProperty(propertyNode) { + if ( + propertyNode.type !== 'MethodDefinition' || + propertyNode.kind !== 'get' + ) { + return false; + } + const keyText = sourceCode.getText(propertyNode.key); + return keyText === 'Symbol.toStringTag'; + } +}; diff --git a/resources/gen-changelog.js b/resources/gen-changelog.js new file mode 100644 index 00000000..02bb6340 --- /dev/null +++ b/resources/gen-changelog.js @@ -0,0 +1,323 @@ +'use strict'; + +const util = require('util'); +const https = require('https'); + +const packageJSON = require('../package.json'); + +const { exec } = require('./utils.js'); + +const graphqlRequest = util.promisify(graphqlRequestImpl); +const labelsConfig = { + 'PR: breaking change 💥': { + section: 'Breaking Change 💥', + }, + 'PR: deprecation ⚠': { + section: 'Deprecation ⚠', + }, + 'PR: feature 🚀': { + section: 'New Feature 🚀', + }, + 'PR: bug fix 🐞': { + section: 'Bug Fix 🐞', + }, + 'PR: docs 📝': { + section: 'Docs 📝', + fold: true, + }, + 'PR: polish 💅': { + section: 'Polish 💅', + fold: true, + }, + 'PR: internal 🏠': { + section: 'Internal 🏠', + fold: true, + }, + 'PR: dependency 📦': { + section: 'Dependency 📦', + fold: true, + }, +}; +const { GH_TOKEN } = process.env; + +if (!GH_TOKEN) { + console.error('Must provide GH_TOKEN as environment variable!'); + process.exit(1); +} + +if (!packageJSON.repository || typeof packageJSON.repository.url !== 'string') { + console.error('package.json is missing repository.url string!'); + process.exit(1); +} + +const repoURLMatch = + /https:\/\/github.com\/(?[^/]+)\/(?[^/]+).git/.exec( + packageJSON.repository.url, + ); +if (repoURLMatch == null) { + console.error('Cannot extract organization and repo name from repo URL!'); + process.exit(1); +} +const { githubOrg, githubRepo } = repoURLMatch.groups; + +getChangeLog() + .then((changelog) => process.stdout.write(changelog)) + .catch((error) => { + console.error(error); + process.exit(1); + }); + +function getChangeLog() { + const { version } = packageJSON; + + let tag = null; + let commitsList = exec(`git rev-list --reverse v${version}..`); + if (commitsList === '') { + const parentPackageJSON = exec('git cat-file blob HEAD~1:package.json'); + const parentVersion = JSON.parse(parentPackageJSON).version; + commitsList = exec(`git rev-list --reverse v${parentVersion}..HEAD~1`); + tag = `v${version}`; + } + + const date = exec('git log -1 --format=%cd --date=short'); + return getCommitsInfo(commitsList.split('\n')) + .then((commitsInfo) => getPRsInfo(commitsInfoToPRs(commitsInfo))) + .then((prsInfo) => genChangeLog(tag, date, prsInfo)); +} + +function genChangeLog(tag, date, allPRs) { + const byLabel = {}; + const committersByLogin = {}; + + for (const pr of allPRs) { + const labels = pr.labels.nodes + .map((label) => label.name) + .filter((label) => label.startsWith('PR: ')); + + if (labels.length === 0) { + throw new Error(`PR is missing label. See ${pr.url}`); + } + if (labels.length > 1) { + throw new Error( + `PR has conflicting labels: ${labels.join('\n')}\nSee ${pr.url}`, + ); + } + + const label = labels[0]; + if (!labelsConfig[label]) { + throw new Error(`Unknown label: ${label}. See ${pr.url}`); + } + byLabel[label] = byLabel[label] || []; + byLabel[label].push(pr); + committersByLogin[pr.author.login] = pr.author; + } + + let changelog = `## ${tag || 'Unreleased'} (${date})\n`; + for (const [label, config] of Object.entries(labelsConfig)) { + const prs = byLabel[label]; + if (prs) { + const shouldFold = config.fold && prs.length > 1; + + changelog += `\n#### ${config.section}\n`; + if (shouldFold) { + changelog += '
\n'; + changelog += ` ${prs.length} PRs were merged \n\n`; + } + + for (const pr of prs) { + const { number, url, author } = pr; + changelog += `* [#${number}](${url}) ${pr.title} ([@${author.login}](${author.url}))\n`; + } + + if (shouldFold) { + changelog += '
\n'; + } + } + } + + const committers = Object.values(committersByLogin).sort((a, b) => + (a.name || a.login).localeCompare(b.name || b.login), + ); + changelog += `\n#### Committers: ${committers.length}\n`; + for (const committer of committers) { + changelog += `* ${committer.name}([@${committer.login}](${committer.url}))\n`; + } + + return changelog; +} + +function graphqlRequestImpl(query, variables, cb) { + const resultCB = typeof variables === 'function' ? variables : cb; + + const req = https.request('https://api.github.com/graphql', { + method: 'POST', + headers: { + Authorization: 'bearer ' + GH_TOKEN, + 'Content-Type': 'application/json', + 'User-Agent': 'gen-changelog', + }, + }); + + req.on('response', (res) => { + let responseBody = ''; + + res.setEncoding('utf8'); + res.on('data', (d) => (responseBody += d)); + res.on('error', (error) => resultCB(error)); + + res.on('end', () => { + if (res.statusCode !== 200) { + return resultCB( + new Error( + `GitHub responded with ${res.statusCode}: ${res.statusMessage}\n` + + responseBody, + ), + ); + } + + let json; + try { + json = JSON.parse(responseBody); + } catch (error) { + return resultCB(error); + } + + if (json.errors) { + return resultCB( + new Error('Errors: ' + JSON.stringify(json.errors, null, 2)), + ); + } + + resultCB(undefined, json.data); + }); + }); + + req.on('error', (error) => resultCB(error)); + req.write(JSON.stringify({ query, variables })); + req.end(); +} + +async function batchCommitInfo(commits) { + let commitsSubQuery = ''; + for (const oid of commits) { + commitsSubQuery += ` + commit_${oid}: object(oid: "${oid}") { + ... on Commit { + oid + message + associatedPullRequests(first: 10) { + nodes { + number + repository { + nameWithOwner + } + } + } + } + } + `; + } + + const response = await graphqlRequest(` + { + repository(owner: "${githubOrg}", name: "${githubRepo}") { + ${commitsSubQuery} + } + } + `); + + const commitsInfo = []; + for (const oid of commits) { + commitsInfo.push(response.repository['commit_' + oid]); + } + return commitsInfo; +} + +async function batchPRInfo(prs) { + let prsSubQuery = ''; + for (const number of prs) { + prsSubQuery += ` + pr_${number}: pullRequest(number: ${number}) { + number + title + url + author { + login + url + ... on User { + name + } + } + labels(first: 10) { + nodes { + name + } + } + } + `; + } + + const response = await graphqlRequest(` + { + repository(owner: "${githubOrg}", name: "${githubRepo}") { + ${prsSubQuery} + } + } + `); + + const prsInfo = []; + for (const number of prs) { + prsInfo.push(response.repository['pr_' + number]); + } + return prsInfo; +} + +function commitsInfoToPRs(commits) { + const prs = {}; + for (const commit of commits) { + const associatedPRs = commit.associatedPullRequests.nodes.filter( + (pr) => pr.repository.nameWithOwner === `${githubOrg}/${githubRepo}`, + ); + if (associatedPRs.length === 0) { + const match = / \(#(?[0-9]+)\)$/m.exec(commit.message); + if (match) { + prs[parseInt(match.groups.prNumber, 10)] = true; + continue; + } + throw new Error( + `Commit ${commit.oid} has no associated PR: ${commit.message}`, + ); + } + if (associatedPRs.length > 1) { + throw new Error( + `Commit ${commit.oid} is associated with multiple PRs: ${commit.message}`, + ); + } + + prs[associatedPRs[0].number] = true; + } + + return Object.keys(prs); +} + +async function getPRsInfo(commits) { + // Split pr into batches of 50 to prevent timeouts + const prInfoPromises = []; + for (let i = 0; i < commits.length; i += 50) { + const batch = commits.slice(i, i + 50); + prInfoPromises.push(batchPRInfo(batch)); + } + + return (await Promise.all(prInfoPromises)).flat(); +} + +async function getCommitsInfo(commits) { + // Split commits into batches of 50 to prevent timeouts + const commitInfoPromises = []; + for (let i = 0; i < commits.length; i += 50) { + const batch = commits.slice(i, i + 50); + commitInfoPromises.push(batchCommitInfo(batch)); + } + + return (await Promise.all(commitInfoPromises)).flat(); +} diff --git a/resources/gen-version.js b/resources/gen-version.js new file mode 100644 index 00000000..b73621bc --- /dev/null +++ b/resources/gen-version.js @@ -0,0 +1,38 @@ +'use strict'; + +const { version } = require('../package.json'); + +const { writeGeneratedFile } = require('./utils.js'); + +const versionMatch = /^(\d+)\.(\d+)\.(\d+)-?(.*)?$/.exec(version); +if (!versionMatch) { + throw new Error('Version does not match semver spec: ' + version); +} + +const [, major, minor, patch, preReleaseTag] = versionMatch; + +const body = ` +// Note: This file is autogenerated using "resources/gen-version.js" script and +// automatically updated by "npm version" command. + +/** + * A string containing the version of the GraphQL.js library + */ +export const version = '${version}' as string; + +/** + * An object containing the components of the GraphQL.js version string + */ +export const versionInfo = Object.freeze({ + major: ${major} as number, + minor: ${minor} as number, + patch: ${patch} as number, + preReleaseTag: ${ + preReleaseTag ? `'${preReleaseTag}'` : 'null' + } as string | null, +}); +`; + +if (require.main === module) { + writeGeneratedFile('./src/version.ts', body); +} diff --git a/resources/inline-invariant.js b/resources/inline-invariant.js new file mode 100644 index 00000000..d3f5a1b6 --- /dev/null +++ b/resources/inline-invariant.js @@ -0,0 +1,48 @@ +'use strict'; + +/** + * Eliminates function call to `invariant` if the condition is met. + * + * Transforms: + * + * invariant(, ...) + * + * to: + * + * () || invariant(false ...) + */ +module.exports = function inlineInvariant(context) { + const invariantTemplate = context.template(` + (%%cond%%) || invariant(false, %%args%%) + `); + const assertTemplate = context.template(` + (%%cond%%) || devAssert(false, %%args%%) + `); + + return { + visitor: { + CallExpression(path) { + const node = path.node; + const parent = path.parent; + + if ( + parent.type !== 'ExpressionStatement' || + node.callee.type !== 'Identifier' || + node.arguments.length === 0 + ) { + return; + } + + const calleeName = node.callee.name; + if (calleeName === 'invariant') { + const [cond, args] = node.arguments; + + path.replaceWith(invariantTemplate({ cond, args })); + } else if (calleeName === 'devAssert') { + const [cond, args] = node.arguments; + path.replaceWith(assertTemplate({ cond, args })); + } + }, + }, + }; +}; diff --git a/resources/ts-register.js b/resources/ts-register.js new file mode 100644 index 00000000..649eb5fd --- /dev/null +++ b/resources/ts-register.js @@ -0,0 +1,3 @@ +'use strict'; + +require('@babel/register')({ extensions: ['.ts'] }); diff --git a/resources/utils.js b/resources/utils.js new file mode 100644 index 00000000..37cd83e8 --- /dev/null +++ b/resources/utils.js @@ -0,0 +1,99 @@ +'use strict'; + +const fs = require('fs'); +const path = require('path'); +const childProcess = require('child_process'); + +const prettier = require('prettier'); + +function exec(command, options) { + const output = childProcess.execSync(command, { + maxBuffer: 10 * 1024 * 1024, // 10MB + encoding: 'utf-8', + ...options, + }); + return output && output.trimEnd(); +} + +function readdirRecursive(dirPath, opts = {}) { + const { ignoreDir } = opts; + const result = []; + for (const dirent of fs.readdirSync(dirPath, { withFileTypes: true })) { + const name = dirent.name; + if (!dirent.isDirectory()) { + result.push(dirent.name); + continue; + } + + if (ignoreDir && ignoreDir.test(name)) { + continue; + } + const list = readdirRecursive(path.join(dirPath, name), opts).map((f) => + path.join(name, f), + ); + result.push(...list); + } + return result; +} + +function showDirStats(dirPath) { + const fileTypes = {}; + let totalSize = 0; + + for (const filepath of readdirRecursive(dirPath)) { + const name = filepath.split(path.sep).pop(); + const [base, ...splitExt] = name.split('.'); + const ext = splitExt.join('.'); + + const filetype = ext ? '*.' + ext : base; + fileTypes[filetype] = fileTypes[filetype] || { filepaths: [], size: 0 }; + + const { size } = fs.lstatSync(path.join(dirPath, filepath)); + totalSize += size; + fileTypes[filetype].size += size; + fileTypes[filetype].filepaths.push(filepath); + } + + let stats = []; + for (const [filetype, typeStats] of Object.entries(fileTypes)) { + const numFiles = typeStats.filepaths.length; + + if (numFiles > 1) { + stats.push([filetype + ' x' + numFiles, typeStats.size]); + } else { + stats.push([typeStats.filepaths[0], typeStats.size]); + } + } + stats.sort((a, b) => b[1] - a[1]); + stats = stats.map(([type, size]) => [type, (size / 1024).toFixed(2) + ' KB']); + + const typeMaxLength = Math.max(...stats.map((x) => x[0].length)); + const sizeMaxLength = Math.max(...stats.map((x) => x[1].length)); + for (const [type, size] of stats) { + console.log( + type.padStart(typeMaxLength) + ' | ' + size.padStart(sizeMaxLength), + ); + } + + console.log('-'.repeat(typeMaxLength + 3 + sizeMaxLength)); + const totalMB = (totalSize / 1024 / 1024).toFixed(2) + ' MB'; + console.log( + 'Total'.padStart(typeMaxLength) + ' | ' + totalMB.padStart(sizeMaxLength), + ); +} + +const prettierConfig = JSON.parse( + fs.readFileSync(require.resolve('../.prettierrc'), 'utf-8'), +); + +function writeGeneratedFile(filepath, body) { + const formatted = prettier.format(body, { filepath, ...prettierConfig }); + fs.writeFileSync(filepath, formatted); +} + +module.exports = { + exec, + readdirRecursive, + showDirStats, + writeGeneratedFile, +}; diff --git a/src/README.md b/src/README.md new file mode 100644 index 00000000..7a67bcb5 --- /dev/null +++ b/src/README.md @@ -0,0 +1,23 @@ +## GraphQL JS + +The primary `graphql` module includes everything you need to define a GraphQL +schema and fulfill GraphQL requests. + +```js +import { ... } from 'graphql'; // ES6 +var GraphQL = require('graphql'); // CommonJS +``` + +Each sub directory within is a sub-module of graphql-js: + +- [`graphql/language`](language/README.md): Parse and operate on the GraphQL + language. +- [`graphql/type`](type/README.md): Define GraphQL types and schema. +- [`graphql/validation`](validation/README.md): The Validation phase of + fulfilling a GraphQL result. +- [`graphql/execution`](execution/README.md): The Execution phase of fulfilling + a GraphQL request. +- [`graphql/error`](error/README.md): Creating and formatting GraphQL errors. +- [`graphql/utilities`](utilities/README.md): Common useful computations upon + the GraphQL language and type objects. +- [`graphql/subscription`](subscription/README.md): Subscribe to data updates. diff --git a/src/__testUtils__/__tests__/dedent-test.ts b/src/__testUtils__/__tests__/dedent-test.ts new file mode 100644 index 00000000..dfaf28e9 --- /dev/null +++ b/src/__testUtils__/__tests__/dedent-test.ts @@ -0,0 +1,131 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent, dedentString } from '../dedent'; + +describe('dedentString', () => { + it('removes indentation in typical usage', () => { + const output = dedentString(` + type Query { + me: User + } + + type User { + id: ID + name: String + } + `); + expect(output).to.equal( + [ + 'type Query {', + ' me: User', + '}', + '', + 'type User {', + ' id: ID', + ' name: String', + '}', + ].join('\n'), + ); + }); + + it('removes only the first level of indentation', () => { + const output = dedentString(` + first + second + third + fourth + `); + expect(output).to.equal( + ['first', ' second', ' third', ' fourth'].join('\n'), + ); + }); + + it('does not escape special characters', () => { + const output = dedentString(` + type Root { + field(arg: String = "wi\th de\fault"): String + } + `); + expect(output).to.equal( + [ + 'type Root {', + ' field(arg: String = "wi\th de\fault"): String', + '}', + ].join('\n'), + ); + }); + + it('also removes indentation using tabs', () => { + const output = dedentString(` + \t\t type Query { + \t\t me: User + \t\t } + `); + expect(output).to.equal(['type Query {', ' me: User', '}'].join('\n')); + }); + + it('removes leading and trailing newlines', () => { + const output = dedentString(` + + + type Query { + me: User + } + + + `); + expect(output).to.equal(['type Query {', ' me: User', '}'].join('\n')); + }); + + it('removes all trailing spaces and tabs', () => { + const output = dedentString(` + type Query { + me: User + } + \t\t \t `); + expect(output).to.equal(['type Query {', ' me: User', '}'].join('\n')); + }); + + it('works on text without leading newline', () => { + const output = dedentString(` type Query { + me: User + } + `); + expect(output).to.equal(['type Query {', ' me: User', '}'].join('\n')); + }); +}); + +describe('dedent', () => { + it('removes indentation in typical usage', () => { + const output = dedent` + type Query { + me: User + } + `; + expect(output).to.equal(['type Query {', ' me: User', '}'].join('\n')); + }); + + it('supports expression interpolation', () => { + const name = 'John'; + const surname = 'Doe'; + const output = dedent` + { + "me": { + "name": "${name}", + "surname": "${surname}" + } + } + `; + expect(output).to.equal( + [ + '{', + ' "me": {', + ' "name": "John",', + ' "surname": "Doe"', + ' }', + '}', + ].join('\n'), + ); + }); +}); diff --git a/src/__testUtils__/__tests__/genFuzzStrings-test.ts b/src/__testUtils__/__tests__/genFuzzStrings-test.ts new file mode 100644 index 00000000..516ed00f --- /dev/null +++ b/src/__testUtils__/__tests__/genFuzzStrings-test.ts @@ -0,0 +1,83 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { genFuzzStrings } from '../genFuzzStrings'; + +function expectFuzzStrings(options: { + allowedChars: ReadonlyArray; + maxLength: number; +}) { + return expect([...genFuzzStrings(options)]); +} + +describe('genFuzzStrings', () => { + it('always provide empty string', () => { + expectFuzzStrings({ allowedChars: [], maxLength: 0 }).to.deep.equal(['']); + expectFuzzStrings({ allowedChars: [], maxLength: 1 }).to.deep.equal(['']); + expectFuzzStrings({ allowedChars: ['a'], maxLength: 0 }).to.deep.equal([ + '', + ]); + }); + + it('generate strings with single character', () => { + expectFuzzStrings({ allowedChars: ['a'], maxLength: 1 }).to.deep.equal([ + '', + 'a', + ]); + + expectFuzzStrings({ + allowedChars: ['a', 'b', 'c'], + maxLength: 1, + }).to.deep.equal(['', 'a', 'b', 'c']); + }); + + it('generate strings with multiple character', () => { + expectFuzzStrings({ allowedChars: ['a'], maxLength: 2 }).to.deep.equal([ + '', + 'a', + 'aa', + ]); + + expectFuzzStrings({ + allowedChars: ['a', 'b', 'c'], + maxLength: 2, + }).to.deep.equal([ + '', + 'a', + 'b', + 'c', + 'aa', + 'ab', + 'ac', + 'ba', + 'bb', + 'bc', + 'ca', + 'cb', + 'cc', + ]); + }); + + it('generate strings longer than possible number of characters', () => { + expectFuzzStrings({ + allowedChars: ['a', 'b'], + maxLength: 3, + }).to.deep.equal([ + '', + 'a', + 'b', + 'aa', + 'ab', + 'ba', + 'bb', + 'aaa', + 'aab', + 'aba', + 'abb', + 'baa', + 'bab', + 'bba', + 'bbb', + ]); + }); +}); diff --git a/src/__testUtils__/__tests__/inspectStr-test.ts b/src/__testUtils__/__tests__/inspectStr-test.ts new file mode 100644 index 00000000..9c3eba3a --- /dev/null +++ b/src/__testUtils__/__tests__/inspectStr-test.ts @@ -0,0 +1,19 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { inspectStr } from '../inspectStr'; + +describe('inspectStr', () => { + it('handles null and undefined values', () => { + expect(inspectStr(null)).to.equal('null'); + expect(inspectStr(undefined)).to.equal('null'); + }); + + it('correctly print various strings', () => { + expect(inspectStr('')).to.equal('``'); + expect(inspectStr('a')).to.equal('`a`'); + expect(inspectStr('"')).to.equal('`"`'); + expect(inspectStr("'")).to.equal("`'`"); + expect(inspectStr('\\"')).to.equal('`\\"`'); + }); +}); diff --git a/src/__testUtils__/__tests__/resolveOnNextTick-test.ts b/src/__testUtils__/__tests__/resolveOnNextTick-test.ts new file mode 100644 index 00000000..0916b44a --- /dev/null +++ b/src/__testUtils__/__tests__/resolveOnNextTick-test.ts @@ -0,0 +1,21 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { resolveOnNextTick } from '../resolveOnNextTick'; + +describe('resolveOnNextTick', () => { + it('resolves promise on the next tick', async () => { + const output = []; + + const promise1 = resolveOnNextTick().then(() => { + output.push('second'); + }); + const promise2 = resolveOnNextTick().then(() => { + output.push('third'); + }); + output.push('first'); + + await Promise.all([promise1, promise2]); + expect(output).to.deep.equal(['first', 'second', 'third']); + }); +}); diff --git a/src/__testUtils__/dedent.ts b/src/__testUtils__/dedent.ts new file mode 100644 index 00000000..7fc6b463 --- /dev/null +++ b/src/__testUtils__/dedent.ts @@ -0,0 +1,41 @@ +export function dedentString(string: string): string { + const trimmedStr = string + .replace(/^\n*/m, '') // remove leading newline + .replace(/[ \t\n]*$/, ''); // remove trailing spaces and tabs + + // fixes indentation by removing leading spaces and tabs from each line + let indent = ''; + for (const char of trimmedStr) { + if (char !== ' ' && char !== '\t') { + break; + } + indent += char; + } + + return trimmedStr.replace(RegExp('^' + indent, 'mg'), ''); // remove indent +} + +/** + * An ES6 string tag that fixes indentation and also trims string. + * + * Example usage: + * ```ts + * const str = dedent` + * { + * test + * } + * `; + * str === "{\n test\n}"; + * ``` + */ +export function dedent( + strings: ReadonlyArray, + ...values: ReadonlyArray +): string { + let str = strings[0]; + + for (let i = 1; i < strings.length; ++i) { + str += values[i - 1] + strings[i]; // interpolation + } + return dedentString(str); +} diff --git a/src/__testUtils__/expectJSON.ts b/src/__testUtils__/expectJSON.ts new file mode 100644 index 00000000..64e2ba5d --- /dev/null +++ b/src/__testUtils__/expectJSON.ts @@ -0,0 +1,51 @@ +import { expect } from 'chai'; + +import { isObjectLike } from '../jsutils/isObjectLike'; +import { mapValue } from '../jsutils/mapValue'; + +/** + * Deeply transforms an arbitrary value to a JSON-safe value by calling toJSON + * on any nested value which defines it. + */ +function toJSONDeep(value: unknown): unknown { + if (!isObjectLike(value)) { + return value; + } + + if (typeof value.toJSON === 'function') { + return value.toJSON(); + } + + if (Array.isArray(value)) { + return value.map(toJSONDeep); + } + + return mapValue(value, toJSONDeep); +} + +export function expectJSON(actual: unknown) { + const actualJSON = toJSONDeep(actual); + + return { + toDeepEqual(expected: unknown) { + const expectedJSON = toJSONDeep(expected); + expect(actualJSON).to.deep.equal(expectedJSON); + }, + toDeepNestedProperty(path: string, expected: unknown) { + const expectedJSON = toJSONDeep(expected); + expect(actualJSON).to.deep.nested.property(path, expectedJSON); + }, + }; +} + +export function expectToThrowJSON(fn: () => unknown) { + function mapException(): unknown { + try { + return fn(); + } catch (error) { + throw toJSONDeep(error); + } + } + + return expect(mapException).to.throw(); +} diff --git a/src/__testUtils__/genFuzzStrings.ts b/src/__testUtils__/genFuzzStrings.ts new file mode 100644 index 00000000..f29e1bb8 --- /dev/null +++ b/src/__testUtils__/genFuzzStrings.ts @@ -0,0 +1,29 @@ +/** + * Generator that produces all possible combinations of allowed characters. + */ +export function* genFuzzStrings(options: { + allowedChars: ReadonlyArray; + maxLength: number; +}): Generator { + const { allowedChars, maxLength } = options; + const numAllowedChars = allowedChars.length; + + let numCombinations = 0; + for (let length = 1; length <= maxLength; ++length) { + numCombinations += numAllowedChars ** length; + } + + yield ''; // special case for empty string + for (let combination = 0; combination < numCombinations; ++combination) { + let permutation = ''; + + let leftOver = combination; + while (leftOver >= 0) { + const reminder = leftOver % numAllowedChars; + permutation = allowedChars[reminder] + permutation; + leftOver = (leftOver - reminder) / numAllowedChars - 1; + } + + yield permutation; + } +} diff --git a/src/__testUtils__/inspectStr.ts b/src/__testUtils__/inspectStr.ts new file mode 100644 index 00000000..721d6e67 --- /dev/null +++ b/src/__testUtils__/inspectStr.ts @@ -0,0 +1,14 @@ +import type { Maybe } from '../jsutils/Maybe'; + +/** + * Special inspect function to produce readable string literal for error messages in tests + */ +export function inspectStr(str: Maybe): string { + if (str == null) { + return 'null'; + } + return JSON.stringify(str) + .replace(/^"|"$/g, '`') + .replace(/\\"/g, '"') + .replace(/\\\\/g, '\\'); +} diff --git a/src/__testUtils__/kitchenSinkQuery.ts b/src/__testUtils__/kitchenSinkQuery.ts new file mode 100644 index 00000000..9ed9a7e9 --- /dev/null +++ b/src/__testUtils__/kitchenSinkQuery.ts @@ -0,0 +1,68 @@ +export const kitchenSinkQuery: string = String.raw` +query queryName($foo: ComplexType, $site: Site = MOBILE) @onQuery { + whoever123is: node(id: [123, 456]) { + id + ... on User @onInlineFragment { + field2 { + id + alias: field1(first: 10, after: $foo) @include(if: $foo) { + id + ...frag @onFragmentSpread + } + } + } + ... @skip(unless: $foo) { + id + } + ... { + id + } + } +} + +mutation likeStory @onMutation { + like(story: 123) @onField { + story { + id @onField + } + } +} + +subscription StoryLikeSubscription( + $input: StoryLikeSubscribeInput @onVariableDefinition +) + @onSubscription { + storyLikeSubscribe(input: $input) { + story { + likers { + count + } + likeSentence { + text + } + } + } +} + +fragment frag on Friend @onFragmentDefinition { + foo( + size: $size + bar: $b + obj: { + key: "value" + block: """ + block string uses \""" + """ + } + ) +} + +{ + unnamed(truthy: true, falsy: false, nullish: null) + query +} + +query { + __typename +} +`; diff --git a/src/__testUtils__/kitchenSinkSDL.ts b/src/__testUtils__/kitchenSinkSDL.ts new file mode 100644 index 00000000..cdf2f9af --- /dev/null +++ b/src/__testUtils__/kitchenSinkSDL.ts @@ -0,0 +1,158 @@ +export const kitchenSinkSDL = ` +"""This is a description of the schema as a whole.""" +schema { + query: QueryType + mutation: MutationType +} + +""" +This is a description +of the \`Foo\` type. +""" +type Foo implements Bar & Baz & Two { + "Description of the \`one\` field." + one: Type + """ + This is a description of the \`two\` field. + """ + two( + """ + This is a description of the \`argument\` argument. + """ + argument: InputType! + ): Type + """This is a description of the \`three\` field.""" + three(argument: InputType, other: String): Int + four(argument: String = "string"): String + five(argument: [String] = ["string", "string"]): String + six(argument: InputType = {key: "value"}): Type + seven(argument: Int = null): Type +} + +type AnnotatedObject @onObject(arg: "value") { + annotatedField(arg: Type = "default" @onArgumentDefinition): Type @onField +} + +type UndefinedType + +extend type Foo { + seven(argument: [String]): Type +} + +extend type Foo @onType + +interface Bar { + one: Type + four(argument: String = "string"): String +} + +interface AnnotatedInterface @onInterface { + annotatedField(arg: Type @onArgumentDefinition): Type @onField +} + +interface UndefinedInterface + +extend interface Bar implements Two { + two(argument: InputType!): Type +} + +extend interface Bar @onInterface + +interface Baz implements Bar & Two { + one: Type + two(argument: InputType!): Type + four(argument: String = "string"): String +} + +union Feed = + | Story + | Article + | Advert + +union AnnotatedUnion @onUnion = A | B + +union AnnotatedUnionTwo @onUnion = | A | B + +union UndefinedUnion + +extend union Feed = Photo | Video + +extend union Feed @onUnion + +scalar CustomScalar + +scalar AnnotatedScalar @onScalar + +extend scalar CustomScalar @onScalar + +enum Site { + """ + This is a description of the \`DESKTOP\` value + """ + DESKTOP + + """This is a description of the \`MOBILE\` value""" + MOBILE + + "This is a description of the \`WEB\` value" + WEB +} + +enum AnnotatedEnum @onEnum { + ANNOTATED_VALUE @onEnumValue + OTHER_VALUE +} + +enum UndefinedEnum + +extend enum Site { + VR +} + +extend enum Site @onEnum + +input InputType { + key: String! + answer: Int = 42 +} + +input AnnotatedInput @onInputObject { + annotatedField: Type @onInputFieldDefinition +} + +input UndefinedInput + +extend input InputType { + other: Float = 1.23e4 @onInputFieldDefinition +} + +extend input InputType @onInputObject + +""" +This is a description of the \`@skip\` directive +""" +directive @skip( + """This is a description of the \`if\` argument""" + if: Boolean! @onArgumentDefinition +) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + +directive @include(if: Boolean!) + on FIELD + | FRAGMENT_SPREAD + | INLINE_FRAGMENT + +directive @include2(if: Boolean!) on + | FIELD + | FRAGMENT_SPREAD + | INLINE_FRAGMENT + +directive @myRepeatableDir(name: String!) repeatable on + | OBJECT + | INTERFACE + +extend schema @onSchema + +extend schema @onSchema { + subscription: SubscriptionType +} +`; diff --git a/src/__testUtils__/resolveOnNextTick.ts b/src/__testUtils__/resolveOnNextTick.ts new file mode 100644 index 00000000..6dd50b39 --- /dev/null +++ b/src/__testUtils__/resolveOnNextTick.ts @@ -0,0 +1,3 @@ +export function resolveOnNextTick(): Promise { + return Promise.resolve(undefined); +} diff --git a/src/__tests__/starWarsData.ts b/src/__tests__/starWarsData.ts new file mode 100644 index 00000000..60c4331b --- /dev/null +++ b/src/__tests__/starWarsData.ts @@ -0,0 +1,154 @@ +/** + * These are types which correspond to the schema. + * They represent the shape of the data visited during field resolution. + */ +export interface Character { + id: string; + name: string; + friends: ReadonlyArray; + appearsIn: ReadonlyArray; +} + +export interface Human { + type: 'Human'; + id: string; + name: string; + friends: ReadonlyArray; + appearsIn: ReadonlyArray; + homePlanet?: string; +} + +export interface Droid { + type: 'Droid'; + id: string; + name: string; + friends: ReadonlyArray; + appearsIn: ReadonlyArray; + primaryFunction: string; +} + +/** + * This defines a basic set of data for our Star Wars Schema. + * + * This data is hard coded for the sake of the demo, but you could imagine + * fetching this data from a backend service rather than from hardcoded + * JSON objects in a more complex demo. + */ + +const luke: Human = { + type: 'Human', + id: '1000', + name: 'Luke Skywalker', + friends: ['1002', '1003', '2000', '2001'], + appearsIn: [4, 5, 6], + homePlanet: 'Tatooine', +}; + +const vader: Human = { + type: 'Human', + id: '1001', + name: 'Darth Vader', + friends: ['1004'], + appearsIn: [4, 5, 6], + homePlanet: 'Tatooine', +}; + +const han: Human = { + type: 'Human', + id: '1002', + name: 'Han Solo', + friends: ['1000', '1003', '2001'], + appearsIn: [4, 5, 6], +}; + +const leia: Human = { + type: 'Human', + id: '1003', + name: 'Leia Organa', + friends: ['1000', '1002', '2000', '2001'], + appearsIn: [4, 5, 6], + homePlanet: 'Alderaan', +}; + +const tarkin: Human = { + type: 'Human', + id: '1004', + name: 'Wilhuff Tarkin', + friends: ['1001'], + appearsIn: [4], +}; + +const humanData: { [id: string]: Human } = { + [luke.id]: luke, + [vader.id]: vader, + [han.id]: han, + [leia.id]: leia, + [tarkin.id]: tarkin, +}; + +const threepio: Droid = { + type: 'Droid', + id: '2000', + name: 'C-3PO', + friends: ['1000', '1002', '1003', '2001'], + appearsIn: [4, 5, 6], + primaryFunction: 'Protocol', +}; + +const artoo: Droid = { + type: 'Droid', + id: '2001', + name: 'R2-D2', + friends: ['1000', '1002', '1003'], + appearsIn: [4, 5, 6], + primaryFunction: 'Astromech', +}; + +const droidData: { [id: string]: Droid } = { + [threepio.id]: threepio, + [artoo.id]: artoo, +}; + +/** + * Helper function to get a character by ID. + */ +function getCharacter(id: string): Promise { + // Returning a promise just to illustrate that GraphQL.js supports it. + return Promise.resolve(humanData[id] ?? droidData[id]); +} + +/** + * Allows us to query for a character's friends. + */ +export function getFriends( + character: Character, +): Array> { + // Notice that GraphQL accepts Arrays of Promises. + return character.friends.map((id) => getCharacter(id)); +} + +/** + * Allows us to fetch the undisputed hero of the Star Wars trilogy, R2-D2. + */ +export function getHero(episode: number): Character { + if (episode === 5) { + // Luke is the hero of Episode V. + return luke; + } + // Artoo is the hero otherwise. + return artoo; +} + +/** + * Allows us to query for the human with the given id. + */ +export function getHuman(id: string): Human | null { + return humanData[id]; +} + +/** + * Allows us to query for the droid with the given id. + */ +export function getDroid(id: string): Droid | null { + return droidData[id]; +} diff --git a/src/__tests__/starWarsIntrospection-test.ts b/src/__tests__/starWarsIntrospection-test.ts new file mode 100644 index 00000000..d637787c --- /dev/null +++ b/src/__tests__/starWarsIntrospection-test.ts @@ -0,0 +1,366 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { graphqlSync } from '../graphql'; + +import { StarWarsSchema } from './starWarsSchema'; + +function queryStarWars(source: string) { + const result = graphqlSync({ schema: StarWarsSchema, source }); + expect(Object.keys(result)).to.deep.equal(['data']); + return result.data; +} + +describe('Star Wars Introspection Tests', () => { + describe('Basic Introspection', () => { + it('Allows querying the schema for types', () => { + const data = queryStarWars(` + { + __schema { + types { + name + } + } + } + `); + + // Include all types used by StarWars schema, introspection types and + // standard directives. For example, `Boolean` is used in `@skip`, + // `@include` and also inside introspection types. + expect(data).to.deep.equal({ + __schema: { + types: [ + { name: 'Human' }, + { name: 'Character' }, + { name: 'String' }, + { name: 'Episode' }, + { name: 'Droid' }, + { name: 'Query' }, + { name: 'Boolean' }, + { name: '__Schema' }, + { name: '__Type' }, + { name: '__TypeKind' }, + { name: '__Field' }, + { name: '__InputValue' }, + { name: '__EnumValue' }, + { name: '__Directive' }, + { name: '__DirectiveLocation' }, + ], + }, + }); + }); + + it('Allows querying the schema for query type', () => { + const data = queryStarWars(` + { + __schema { + queryType { + name + } + } + } + `); + + expect(data).to.deep.equal({ + __schema: { + queryType: { + name: 'Query', + }, + }, + }); + }); + + it('Allows querying the schema for a specific type', () => { + const data = queryStarWars(` + { + __type(name: "Droid") { + name + } + } + `); + + expect(data).to.deep.equal({ + __type: { + name: 'Droid', + }, + }); + }); + + it('Allows querying the schema for an object kind', () => { + const data = queryStarWars(` + { + __type(name: "Droid") { + name + kind + } + } + `); + + expect(data).to.deep.equal({ + __type: { + name: 'Droid', + kind: 'OBJECT', + }, + }); + }); + + it('Allows querying the schema for an interface kind', () => { + const data = queryStarWars(` + { + __type(name: "Character") { + name + kind + } + } + `); + + expect(data).to.deep.equal({ + __type: { + name: 'Character', + kind: 'INTERFACE', + }, + }); + }); + + it('Allows querying the schema for object fields', () => { + const data = queryStarWars(` + { + __type(name: "Droid") { + name + fields { + name + type { + name + kind + } + } + } + } + `); + + expect(data).to.deep.equal({ + __type: { + name: 'Droid', + fields: [ + { + name: 'id', + type: { name: null, kind: 'NON_NULL' }, + }, + { + name: 'name', + type: { name: 'String', kind: 'SCALAR' }, + }, + { + name: 'friends', + type: { name: null, kind: 'LIST' }, + }, + { + name: 'appearsIn', + type: { name: null, kind: 'LIST' }, + }, + { + name: 'secretBackstory', + type: { name: 'String', kind: 'SCALAR' }, + }, + { + name: 'primaryFunction', + type: { name: 'String', kind: 'SCALAR' }, + }, + ], + }, + }); + }); + + it('Allows querying the schema for nested object fields', () => { + const data = queryStarWars(` + { + __type(name: "Droid") { + name + fields { + name + type { + name + kind + ofType { + name + kind + } + } + } + } + } + `); + + expect(data).to.deep.equal({ + __type: { + name: 'Droid', + fields: [ + { + name: 'id', + type: { + name: null, + kind: 'NON_NULL', + ofType: { + name: 'String', + kind: 'SCALAR', + }, + }, + }, + { + name: 'name', + type: { + name: 'String', + kind: 'SCALAR', + ofType: null, + }, + }, + { + name: 'friends', + type: { + name: null, + kind: 'LIST', + ofType: { + name: 'Character', + kind: 'INTERFACE', + }, + }, + }, + { + name: 'appearsIn', + type: { + name: null, + kind: 'LIST', + ofType: { + name: 'Episode', + kind: 'ENUM', + }, + }, + }, + { + name: 'secretBackstory', + type: { + name: 'String', + kind: 'SCALAR', + ofType: null, + }, + }, + { + name: 'primaryFunction', + type: { + name: 'String', + kind: 'SCALAR', + ofType: null, + }, + }, + ], + }, + }); + }); + + it('Allows querying the schema for field args', () => { + const data = queryStarWars(` + { + __schema { + queryType { + fields { + name + args { + name + description + type { + name + kind + ofType { + name + kind + } + } + defaultValue + } + } + } + } + } + `); + + expect(data).to.deep.equal({ + __schema: { + queryType: { + fields: [ + { + name: 'hero', + args: [ + { + defaultValue: null, + description: + 'If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode.', + name: 'episode', + type: { + kind: 'ENUM', + name: 'Episode', + ofType: null, + }, + }, + ], + }, + { + name: 'human', + args: [ + { + name: 'id', + description: 'id of the human', + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'String', + }, + }, + defaultValue: null, + }, + ], + }, + { + name: 'droid', + args: [ + { + name: 'id', + description: 'id of the droid', + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'String', + }, + }, + defaultValue: null, + }, + ], + }, + ], + }, + }, + }); + }); + + it('Allows querying the schema for documentation', () => { + const data = queryStarWars(` + { + __type(name: "Droid") { + name + description + } + } + `); + + expect(data).to.deep.equal({ + __type: { + name: 'Droid', + description: 'A mechanical creature in the Star Wars universe.', + }, + }); + }); + }); +}); diff --git a/src/__tests__/starWarsQuery-test.ts b/src/__tests__/starWarsQuery-test.ts new file mode 100644 index 00000000..2662079d --- /dev/null +++ b/src/__tests__/starWarsQuery-test.ts @@ -0,0 +1,497 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../__testUtils__/expectJSON'; + +import { graphql } from '../graphql'; + +import { StarWarsSchema as schema } from './starWarsSchema'; + +describe('Star Wars Query Tests', () => { + describe('Basic Queries', () => { + it('Correctly identifies R2-D2 as the hero of the Star Wars Saga', async () => { + const source = ` + query HeroNameQuery { + hero { + name + } + } + `; + + const result = await graphql({ schema, source }); + expect(result).to.deep.equal({ + data: { + hero: { + name: 'R2-D2', + }, + }, + }); + }); + + it('Allows us to query for the ID and friends of R2-D2', async () => { + const source = ` + query HeroNameAndFriendsQuery { + hero { + id + name + friends { + name + } + } + } + `; + + const result = await graphql({ schema, source }); + expect(result).to.deep.equal({ + data: { + hero: { + id: '2001', + name: 'R2-D2', + friends: [ + { + name: 'Luke Skywalker', + }, + { + name: 'Han Solo', + }, + { + name: 'Leia Organa', + }, + ], + }, + }, + }); + }); + }); + + describe('Nested Queries', () => { + it('Allows us to query for the friends of friends of R2-D2', async () => { + const source = ` + query NestedQuery { + hero { + name + friends { + name + appearsIn + friends { + name + } + } + } + } + `; + + const result = await graphql({ schema, source }); + expect(result).to.deep.equal({ + data: { + hero: { + name: 'R2-D2', + friends: [ + { + name: 'Luke Skywalker', + appearsIn: ['NEW_HOPE', 'EMPIRE', 'JEDI'], + friends: [ + { + name: 'Han Solo', + }, + { + name: 'Leia Organa', + }, + { + name: 'C-3PO', + }, + { + name: 'R2-D2', + }, + ], + }, + { + name: 'Han Solo', + appearsIn: ['NEW_HOPE', 'EMPIRE', 'JEDI'], + friends: [ + { + name: 'Luke Skywalker', + }, + { + name: 'Leia Organa', + }, + { + name: 'R2-D2', + }, + ], + }, + { + name: 'Leia Organa', + appearsIn: ['NEW_HOPE', 'EMPIRE', 'JEDI'], + friends: [ + { + name: 'Luke Skywalker', + }, + { + name: 'Han Solo', + }, + { + name: 'C-3PO', + }, + { + name: 'R2-D2', + }, + ], + }, + ], + }, + }, + }); + }); + }); + + describe('Using IDs and query parameters to refetch objects', () => { + it('Allows us to query characters directly, using their IDs', async () => { + const source = ` + query FetchLukeAndC3POQuery { + human(id: "1000") { + name + } + droid(id: "2000") { + name + } + } + `; + + const result = await graphql({ schema, source }); + expect(result).to.deep.equal({ + data: { + human: { + name: 'Luke Skywalker', + }, + droid: { + name: 'C-3PO', + }, + }, + }); + }); + + it('Allows us to create a generic query, then use it to fetch Luke Skywalker using his ID', async () => { + const source = ` + query FetchSomeIDQuery($someId: String!) { + human(id: $someId) { + name + } + } + `; + const variableValues = { someId: '1000' }; + + const result = await graphql({ schema, source, variableValues }); + expect(result).to.deep.equal({ + data: { + human: { + name: 'Luke Skywalker', + }, + }, + }); + }); + + it('Allows us to create a generic query, then use it to fetch Han Solo using his ID', async () => { + const source = ` + query FetchSomeIDQuery($someId: String!) { + human(id: $someId) { + name + } + } + `; + const variableValues = { someId: '1002' }; + + const result = await graphql({ schema, source, variableValues }); + expect(result).to.deep.equal({ + data: { + human: { + name: 'Han Solo', + }, + }, + }); + }); + + it('Allows us to create a generic query, then pass an invalid ID to get null back', async () => { + const source = ` + query humanQuery($id: String!) { + human(id: $id) { + name + } + } + `; + const variableValues = { id: 'not a valid id' }; + + const result = await graphql({ schema, source, variableValues }); + expect(result).to.deep.equal({ + data: { + human: null, + }, + }); + }); + }); + + describe('Using aliases to change the key in the response', () => { + it('Allows us to query for Luke, changing his key with an alias', async () => { + const source = ` + query FetchLukeAliased { + luke: human(id: "1000") { + name + } + } + `; + + const result = await graphql({ schema, source }); + expect(result).to.deep.equal({ + data: { + luke: { + name: 'Luke Skywalker', + }, + }, + }); + }); + + it('Allows us to query for both Luke and Leia, using two root fields and an alias', async () => { + const source = ` + query FetchLukeAndLeiaAliased { + luke: human(id: "1000") { + name + } + leia: human(id: "1003") { + name + } + } + `; + + const result = await graphql({ schema, source }); + expect(result).to.deep.equal({ + data: { + luke: { + name: 'Luke Skywalker', + }, + leia: { + name: 'Leia Organa', + }, + }, + }); + }); + }); + + describe('Uses fragments to express more complex queries', () => { + it('Allows us to query using duplicated content', async () => { + const source = ` + query DuplicateFields { + luke: human(id: "1000") { + name + homePlanet + } + leia: human(id: "1003") { + name + homePlanet + } + } + `; + + const result = await graphql({ schema, source }); + expect(result).to.deep.equal({ + data: { + luke: { + name: 'Luke Skywalker', + homePlanet: 'Tatooine', + }, + leia: { + name: 'Leia Organa', + homePlanet: 'Alderaan', + }, + }, + }); + }); + + it('Allows us to use a fragment to avoid duplicating content', async () => { + const source = ` + query UseFragment { + luke: human(id: "1000") { + ...HumanFragment + } + leia: human(id: "1003") { + ...HumanFragment + } + } + + fragment HumanFragment on Human { + name + homePlanet + } + `; + + const result = await graphql({ schema, source }); + expect(result).to.deep.equal({ + data: { + luke: { + name: 'Luke Skywalker', + homePlanet: 'Tatooine', + }, + leia: { + name: 'Leia Organa', + homePlanet: 'Alderaan', + }, + }, + }); + }); + }); + + describe('Using __typename to find the type of an object', () => { + it('Allows us to verify that R2-D2 is a droid', async () => { + const source = ` + query CheckTypeOfR2 { + hero { + __typename + name + } + } + `; + + const result = await graphql({ schema, source }); + expect(result).to.deep.equal({ + data: { + hero: { + __typename: 'Droid', + name: 'R2-D2', + }, + }, + }); + }); + + it('Allows us to verify that Luke is a human', async () => { + const source = ` + query CheckTypeOfLuke { + hero(episode: EMPIRE) { + __typename + name + } + } + `; + + const result = await graphql({ schema, source }); + expect(result).to.deep.equal({ + data: { + hero: { + __typename: 'Human', + name: 'Luke Skywalker', + }, + }, + }); + }); + }); + + describe('Reporting errors raised in resolvers', () => { + it('Correctly reports error on accessing secretBackstory', async () => { + const source = ` + query HeroNameQuery { + hero { + name + secretBackstory + } + } + `; + + const result = await graphql({ schema, source }); + expectJSON(result).toDeepEqual({ + data: { + hero: { + name: 'R2-D2', + secretBackstory: null, + }, + }, + errors: [ + { + message: 'secretBackstory is secret.', + locations: [{ line: 5, column: 13 }], + path: ['hero', 'secretBackstory'], + }, + ], + }); + }); + + it('Correctly reports error on accessing secretBackstory in a list', async () => { + const source = ` + query HeroNameQuery { + hero { + name + friends { + name + secretBackstory + } + } + } + `; + + const result = await graphql({ schema, source }); + expectJSON(result).toDeepEqual({ + data: { + hero: { + name: 'R2-D2', + friends: [ + { + name: 'Luke Skywalker', + secretBackstory: null, + }, + { + name: 'Han Solo', + secretBackstory: null, + }, + { + name: 'Leia Organa', + secretBackstory: null, + }, + ], + }, + }, + errors: [ + { + message: 'secretBackstory is secret.', + locations: [{ line: 7, column: 15 }], + path: ['hero', 'friends', 0, 'secretBackstory'], + }, + { + message: 'secretBackstory is secret.', + locations: [{ line: 7, column: 15 }], + path: ['hero', 'friends', 1, 'secretBackstory'], + }, + { + message: 'secretBackstory is secret.', + locations: [{ line: 7, column: 15 }], + path: ['hero', 'friends', 2, 'secretBackstory'], + }, + ], + }); + }); + + it('Correctly reports error on accessing through an alias', async () => { + const source = ` + query HeroNameQuery { + mainHero: hero { + name + story: secretBackstory + } + } + `; + + const result = await graphql({ schema, source }); + expectJSON(result).toDeepEqual({ + data: { + mainHero: { + name: 'R2-D2', + story: null, + }, + }, + errors: [ + { + message: 'secretBackstory is secret.', + locations: [{ line: 5, column: 13 }], + path: ['mainHero', 'story'], + }, + ], + }); + }); + }); +}); diff --git a/src/__tests__/starWarsSchema.ts b/src/__tests__/starWarsSchema.ts new file mode 100644 index 00000000..c646c8ae --- /dev/null +++ b/src/__tests__/starWarsSchema.ts @@ -0,0 +1,303 @@ +import { + GraphQLEnumType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, +} from '../type/definition'; +import { GraphQLString } from '../type/scalars'; +import { GraphQLSchema } from '../type/schema'; + +import { getDroid, getFriends, getHero, getHuman } from './starWarsData'; + +/** + * This is designed to be an end-to-end test, demonstrating + * the full GraphQL stack. + * + * We will create a GraphQL schema that describes the major + * characters in the original Star Wars trilogy. + * + * NOTE: This may contain spoilers for the original Star + * Wars trilogy. + */ + +/** + * Using our shorthand to describe type systems, the type system for our + * Star Wars example is: + * + * ```graphql + * enum Episode { NEW_HOPE, EMPIRE, JEDI } + * + * interface Character { + * id: String! + * name: String + * friends: [Character] + * appearsIn: [Episode] + * } + * + * type Human implements Character { + * id: String! + * name: String + * friends: [Character] + * appearsIn: [Episode] + * homePlanet: String + * } + * + * type Droid implements Character { + * id: String! + * name: String + * friends: [Character] + * appearsIn: [Episode] + * primaryFunction: String + * } + * + * type Query { + * hero(episode: Episode): Character + * human(id: String!): Human + * droid(id: String!): Droid + * } + * ``` + * + * We begin by setting up our schema. + */ + +/** + * The original trilogy consists of three movies. + * + * This implements the following type system shorthand: + * ```graphql + * enum Episode { NEW_HOPE, EMPIRE, JEDI } + * ``` + */ +const episodeEnum = new GraphQLEnumType({ + name: 'Episode', + description: 'One of the films in the Star Wars Trilogy', + values: { + NEW_HOPE: { + value: 4, + description: 'Released in 1977.', + }, + EMPIRE: { + value: 5, + description: 'Released in 1980.', + }, + JEDI: { + value: 6, + description: 'Released in 1983.', + }, + }, +}); + +/** + * Characters in the Star Wars trilogy are either humans or droids. + * + * This implements the following type system shorthand: + * ```graphql + * interface Character { + * id: String! + * name: String + * friends: [Character] + * appearsIn: [Episode] + * secretBackstory: String + * } + * ``` + */ +const characterInterface: GraphQLInterfaceType = new GraphQLInterfaceType({ + name: 'Character', + description: 'A character in the Star Wars Trilogy', + fields: () => ({ + id: { + type: new GraphQLNonNull(GraphQLString), + description: 'The id of the character.', + }, + name: { + type: GraphQLString, + description: 'The name of the character.', + }, + friends: { + type: new GraphQLList(characterInterface), + description: + 'The friends of the character, or an empty list if they have none.', + }, + appearsIn: { + type: new GraphQLList(episodeEnum), + description: 'Which movies they appear in.', + }, + secretBackstory: { + type: GraphQLString, + description: 'All secrets about their past.', + }, + }), + resolveType(character) { + switch (character.type) { + case 'Human': + return humanType.name; + case 'Droid': + return droidType.name; + } + }, +}); + +/** + * We define our human type, which implements the character interface. + * + * This implements the following type system shorthand: + * ```graphql + * type Human : Character { + * id: String! + * name: String + * friends: [Character] + * appearsIn: [Episode] + * secretBackstory: String + * } + * ``` + */ +const humanType = new GraphQLObjectType({ + name: 'Human', + description: 'A humanoid creature in the Star Wars universe.', + fields: () => ({ + id: { + type: new GraphQLNonNull(GraphQLString), + description: 'The id of the human.', + }, + name: { + type: GraphQLString, + description: 'The name of the human.', + }, + friends: { + type: new GraphQLList(characterInterface), + description: + 'The friends of the human, or an empty list if they have none.', + resolve: (human) => getFriends(human), + }, + appearsIn: { + type: new GraphQLList(episodeEnum), + description: 'Which movies they appear in.', + }, + homePlanet: { + type: GraphQLString, + description: 'The home planet of the human, or null if unknown.', + }, + secretBackstory: { + type: GraphQLString, + description: 'Where are they from and how they came to be who they are.', + resolve() { + throw new Error('secretBackstory is secret.'); + }, + }, + }), + interfaces: [characterInterface], +}); + +/** + * The other type of character in Star Wars is a droid. + * + * This implements the following type system shorthand: + * ```graphql + * type Droid : Character { + * id: String! + * name: String + * friends: [Character] + * appearsIn: [Episode] + * secretBackstory: String + * primaryFunction: String + * } + * ``` + */ +const droidType = new GraphQLObjectType({ + name: 'Droid', + description: 'A mechanical creature in the Star Wars universe.', + fields: () => ({ + id: { + type: new GraphQLNonNull(GraphQLString), + description: 'The id of the droid.', + }, + name: { + type: GraphQLString, + description: 'The name of the droid.', + }, + friends: { + type: new GraphQLList(characterInterface), + description: + 'The friends of the droid, or an empty list if they have none.', + resolve: (droid) => getFriends(droid), + }, + appearsIn: { + type: new GraphQLList(episodeEnum), + description: 'Which movies they appear in.', + }, + secretBackstory: { + type: GraphQLString, + description: 'Construction date and the name of the designer.', + resolve() { + throw new Error('secretBackstory is secret.'); + }, + }, + primaryFunction: { + type: GraphQLString, + description: 'The primary function of the droid.', + }, + }), + interfaces: [characterInterface], +}); + +/** + * This is the type that will be the root of our query, and the + * entry point into our schema. It gives us the ability to fetch + * objects by their IDs, as well as to fetch the undisputed hero + * of the Star Wars trilogy, R2-D2, directly. + * + * This implements the following type system shorthand: + * ```graphql + * type Query { + * hero(episode: Episode): Character + * human(id: String!): Human + * droid(id: String!): Droid + * } + * ``` + */ +const queryType = new GraphQLObjectType({ + name: 'Query', + fields: () => ({ + hero: { + type: characterInterface, + args: { + episode: { + description: + 'If omitted, returns the hero of the whole saga. If provided, returns the hero of that particular episode.', + type: episodeEnum, + }, + }, + resolve: (_source, { episode }) => getHero(episode), + }, + human: { + type: humanType, + args: { + id: { + description: 'id of the human', + type: new GraphQLNonNull(GraphQLString), + }, + }, + resolve: (_source, { id }) => getHuman(id), + }, + droid: { + type: droidType, + args: { + id: { + description: 'id of the droid', + type: new GraphQLNonNull(GraphQLString), + }, + }, + resolve: (_source, { id }) => getDroid(id), + }, + }), +}); + +/** + * Finally, we construct our schema (whose starting query type is the query + * type we defined above) and export it. + */ +export const StarWarsSchema: GraphQLSchema = new GraphQLSchema({ + query: queryType, + types: [humanType, droidType], +}); diff --git a/src/__tests__/starWarsValidation-test.ts b/src/__tests__/starWarsValidation-test.ts new file mode 100644 index 00000000..65e6c7f6 --- /dev/null +++ b/src/__tests__/starWarsValidation-test.ts @@ -0,0 +1,119 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { parse } from '../language/parser'; +import { Source } from '../language/source'; + +import { validate } from '../validation/validate'; + +import { StarWarsSchema } from './starWarsSchema'; + +/** + * Helper function to test a query and the expected response. + */ +function validationErrors(query: string) { + const source = new Source(query, 'StarWars.graphql'); + const ast = parse(source); + return validate(StarWarsSchema, ast); +} + +describe('Star Wars Validation Tests', () => { + describe('Basic Queries', () => { + it('Validates a complex but valid query', () => { + const query = ` + query NestedQueryWithFragment { + hero { + ...NameAndAppearances + friends { + ...NameAndAppearances + friends { + ...NameAndAppearances + } + } + } + } + + fragment NameAndAppearances on Character { + name + appearsIn + } + `; + return expect(validationErrors(query)).to.be.empty; + }); + + it('Notes that non-existent fields are invalid', () => { + const query = ` + query HeroSpaceshipQuery { + hero { + favoriteSpaceship + } + } + `; + return expect(validationErrors(query)).to.not.be.empty; + }); + + it('Requires fields on objects', () => { + const query = ` + query HeroNoFieldsQuery { + hero + } + `; + return expect(validationErrors(query)).to.not.be.empty; + }); + + it('Disallows fields on scalars', () => { + const query = ` + query HeroFieldsOnScalarQuery { + hero { + name { + firstCharacterOfName + } + } + } + `; + return expect(validationErrors(query)).to.not.be.empty; + }); + + it('Disallows object fields on interfaces', () => { + const query = ` + query DroidFieldOnCharacter { + hero { + name + primaryFunction + } + } + `; + return expect(validationErrors(query)).to.not.be.empty; + }); + + it('Allows object fields in fragments', () => { + const query = ` + query DroidFieldInFragment { + hero { + name + ...DroidFields + } + } + + fragment DroidFields on Droid { + primaryFunction + } + `; + return expect(validationErrors(query)).to.be.empty; + }); + + it('Allows object fields in inline fragments', () => { + const query = ` + query DroidFieldInFragment { + hero { + name + ... on Droid { + primaryFunction + } + } + } + `; + return expect(validationErrors(query)).to.be.empty; + }); + }); +}); diff --git a/src/__tests__/version-test.ts b/src/__tests__/version-test.ts new file mode 100644 index 00000000..3680512d --- /dev/null +++ b/src/__tests__/version-test.ts @@ -0,0 +1,54 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { version, versionInfo } from '../version'; + +describe('Version', () => { + it('versionInfo', () => { + expect(versionInfo).to.be.an('object'); + expect(versionInfo).to.have.all.keys( + 'major', + 'minor', + 'patch', + 'preReleaseTag', + ); + + const { major, minor, patch, preReleaseTag } = versionInfo; + expect(major).to.be.a('number').at.least(0); + expect(minor).to.be.a('number').at.least(0); + expect(patch).to.be.a('number').at.least(0); + + // Can't be verified on all versions + /* c8 ignore start */ + switch (preReleaseTag?.split('.').length) { + case undefined: + break; + case 2: + expect(preReleaseTag).to.match( + /^(alpha|beta|rc|experimental-[\w-]+)\.\d+/, + ); + break; + case 4: + expect(preReleaseTag).to.match( + /^(alpha|beta|rc)\.\d+.experimental-[\w-]+\.\d+/, + ); + break; + default: + expect.fail('Invalid pre-release tag: ' + preReleaseTag); + } + /* c8 ignore stop */ + }); + + it('version', () => { + expect(version).to.be.a('string'); + + const { major, minor, patch, preReleaseTag } = versionInfo; + expect(version).to.equal( + // Can't be verified on all versions + /* c8 ignore next 3 */ + preReleaseTag === null + ? `${major}.${minor}.${patch}` + : `${major}.${minor}.${patch}-${preReleaseTag}`, + ); + }); +}); diff --git a/src/error/GraphQLError.ts b/src/error/GraphQLError.ts new file mode 100644 index 00000000..6d6677fa --- /dev/null +++ b/src/error/GraphQLError.ts @@ -0,0 +1,255 @@ +import { isObjectLike } from '../jsutils/isObjectLike'; +import type { Maybe } from '../jsutils/Maybe'; + +import type { ASTNode, Location } from '../language/ast'; +import type { SourceLocation } from '../language/location'; +import { getLocation } from '../language/location'; +import { printLocation, printSourceLocation } from '../language/printLocation'; +import type { Source } from '../language/source'; + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLErrorExtensions { + [attributeName: string]: unknown; +} + +/** + * A GraphQLError describes an Error found during the parse, validate, or + * execute phases of performing a GraphQL operation. In addition to a message + * and stack trace, it also includes information about the locations in a + * GraphQL document and/or execution result that correspond to the Error. + */ +export class GraphQLError extends Error { + /** + * An array of `{ line, column }` locations within the source GraphQL document + * which correspond to this error. + * + * Errors during validation often contain multiple locations, for example to + * point out two things with the same name. Errors during execution include a + * single location, the field which produced the error. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + readonly locations: ReadonlyArray | undefined; + + /** + * An array describing the JSON-path into the execution response which + * corresponds to this error. Only included for errors during execution. + * + * Enumerable, and appears in the result of JSON.stringify(). + */ + readonly path: ReadonlyArray | undefined; + + /** + * An array of GraphQL AST Nodes corresponding to this error. + */ + readonly nodes: ReadonlyArray | undefined; + + /** + * The source GraphQL document for the first location of this error. + * + * Note that if this Error represents more than one node, the source may not + * represent nodes after the first node. + */ + readonly source: Source | undefined; + + /** + * An array of character offsets within the source GraphQL document + * which correspond to this error. + */ + readonly positions: ReadonlyArray | undefined; + + /** + * The original error thrown from a field resolver during execution. + */ + readonly originalError: Error | undefined; + + /** + * Extension fields to add to the formatted error. + */ + readonly extensions: GraphQLErrorExtensions; + + constructor( + message: string, + nodes?: ReadonlyArray | ASTNode | null, + source?: Maybe, + positions?: Maybe>, + path?: Maybe>, + originalError?: Maybe, + extensions?: Maybe, + ) { + super(message); + + this.name = 'GraphQLError'; + this.path = path ?? undefined; + this.originalError = originalError ?? undefined; + + // Compute list of blame nodes. + this.nodes = undefinedIfEmpty( + Array.isArray(nodes) ? nodes : nodes ? [nodes] : undefined, + ); + + const nodeLocations = undefinedIfEmpty( + this.nodes + ?.map((node) => node.loc) + .filter((loc): loc is Location => loc != null), + ); + + // Compute locations in the source for the given nodes/positions. + this.source = source ?? nodeLocations?.[0]?.source; + + this.positions = positions ?? nodeLocations?.map((loc) => loc.start); + + this.locations = + positions && source + ? positions.map((pos) => getLocation(source, pos)) + : nodeLocations?.map((loc) => getLocation(loc.source, loc.start)); + + const originalExtensions = isObjectLike(originalError?.extensions) + ? originalError?.extensions + : undefined; + this.extensions = extensions ?? originalExtensions ?? Object.create(null); + + // Only properties prescribed by the spec should be enumerable. + // Keep the rest as non-enumerable. + Object.defineProperties(this, { + message: { + writable: true, + enumerable: true, + }, + name: { enumerable: false }, + nodes: { enumerable: false }, + source: { enumerable: false }, + positions: { enumerable: false }, + originalError: { enumerable: false }, + }); + + // Include (non-enumerable) stack trace. + /* c8 ignore start */ + // FIXME: https://github.com/graphql/graphql-js/issues/2317 + if (originalError?.stack) { + Object.defineProperty(this, 'stack', { + value: originalError.stack, + writable: true, + configurable: true, + }); + } else if (Error.captureStackTrace) { + Error.captureStackTrace(this, GraphQLError); + } else { + Object.defineProperty(this, 'stack', { + value: Error().stack, + writable: true, + configurable: true, + }); + } + /* c8 ignore stop */ + } + + get [Symbol.toStringTag](): string { + return 'GraphQLError'; + } + + toString(): string { + let output = this.message; + + if (this.nodes) { + for (const node of this.nodes) { + if (node.loc) { + output += '\n\n' + printLocation(node.loc); + } + } + } else if (this.source && this.locations) { + for (const location of this.locations) { + output += '\n\n' + printSourceLocation(this.source, location); + } + } + + return output; + } + + toJSON(): GraphQLFormattedError { + type WritableFormattedError = { + -readonly [P in keyof GraphQLFormattedError]: GraphQLFormattedError[P]; + }; + + const formattedError: WritableFormattedError = { + message: this.message, + }; + + if (this.locations != null) { + formattedError.locations = this.locations; + } + + if (this.path != null) { + formattedError.path = this.path; + } + + if (this.extensions != null && Object.keys(this.extensions).length > 0) { + formattedError.extensions = this.extensions; + } + + return formattedError; + } +} + +function undefinedIfEmpty( + array: Array | undefined, +): Array | undefined { + return array === undefined || array.length === 0 ? undefined : array; +} + +/** + * See: https://spec.graphql.org/draft/#sec-Errors + */ +export interface GraphQLFormattedError { + /** + * A short, human-readable summary of the problem that **SHOULD NOT** change + * from occurrence to occurrence of the problem, except for purposes of + * localization. + */ + readonly message: string; + /** + * If an error can be associated to a particular point in the requested + * GraphQL document, it should contain a list of locations. + */ + readonly locations?: ReadonlyArray; + /** + * If an error can be associated to a particular field in the GraphQL result, + * it _must_ contain an entry with the key `path` that details the path of + * the response field which experienced the error. This allows clients to + * identify whether a null result is intentional or caused by a runtime error. + */ + readonly path?: ReadonlyArray; + /** + * Reserved for implementors to extend the protocol however they see fit, + * and hence there are no additional restrictions on its contents. + */ + readonly extensions?: { [key: string]: unknown }; +} + +/** + * Prints a GraphQLError to a string, representing useful location information + * about the error's position in the source. + * + * @deprecated Please use `error.toString` instead. Will be removed in v17 + */ +export function printError(error: GraphQLError): string { + return error.toString(); +} + +/** + * Given a GraphQLError, format it according to the rules described by the + * Response Format, Errors section of the GraphQL Specification. + * + * @deprecated Please use `error.toString` instead. Will be removed in v17 + */ +export function formatError(error: GraphQLError): GraphQLFormattedError { + return error.toJSON(); +} diff --git a/src/error/README.md b/src/error/README.md new file mode 100644 index 00000000..750c3510 --- /dev/null +++ b/src/error/README.md @@ -0,0 +1,9 @@ +## GraphQL Errors + +The `graphql/error` module is responsible for creating and formatting +GraphQL errors. + +```js +import { ... } from 'graphql/error'; // ES6 +var GraphQLError = require('graphql/error'); // CommonJS +``` diff --git a/src/error/__tests__/GraphQLError-test.ts b/src/error/__tests__/GraphQLError-test.ts new file mode 100644 index 00000000..21e1ab1f --- /dev/null +++ b/src/error/__tests__/GraphQLError-test.ts @@ -0,0 +1,356 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; + +import { invariant } from '../../jsutils/invariant'; + +import { Kind } from '../../language/kinds'; +import { parse } from '../../language/parser'; +import { Source } from '../../language/source'; + +import { formatError, GraphQLError, printError } from '../GraphQLError'; + +const source = new Source(dedent` + { + field + } +`); +const ast = parse(source); +const operationNode = ast.definitions[0]; +invariant(operationNode.kind === Kind.OPERATION_DEFINITION); +const fieldNode = operationNode.selectionSet.selections[0]; +invariant(fieldNode); + +describe('GraphQLError', () => { + it('is a class and is a subclass of Error', () => { + expect(new GraphQLError('str')).to.be.instanceof(Error); + expect(new GraphQLError('str')).to.be.instanceof(GraphQLError); + }); + + it('has a name, message, extensions, and stack trace', () => { + const e = new GraphQLError('msg'); + + expect(e).to.deep.include({ + name: 'GraphQLError', + message: 'msg', + extensions: {}, + }); + expect(e.stack).to.be.a('string'); + }); + + it('enumerate only properties prescribed by the spec', () => { + const e = new GraphQLError( + 'msg' /* message */, + [fieldNode] /* nodes */, + source /* source */, + [1, 2, 3] /* positions */, + ['a', 'b', 'c'] /* path */, + new Error('test') /* originalError */, + { foo: 'bar' } /* extensions */, + ); + + expect(Object.keys(e)).to.deep.equal([ + 'message', + 'path', + 'locations', + 'extensions', + ]); + }); + + it('uses the stack of an original error', () => { + const original = new Error('original'); + const e = new GraphQLError( + 'msg', + undefined, + undefined, + undefined, + undefined, + original, + ); + + expect(e).to.include({ + name: 'GraphQLError', + message: 'msg', + stack: original.stack, + originalError: original, + }); + }); + + it('creates new stack if original error has no stack', () => { + const original = new Error('original'); + const e = new GraphQLError('msg', null, null, null, null, original); + + expect(e).to.include({ + name: 'GraphQLError', + message: 'msg', + originalError: original, + }); + expect(e.stack).to.be.a('string'); + }); + + it('converts nodes to positions and locations', () => { + const e = new GraphQLError('msg', [fieldNode]); + expect(e).to.deep.include({ + source, + nodes: [fieldNode], + positions: [4], + locations: [{ line: 2, column: 3 }], + }); + }); + + it('converts single node to positions and locations', () => { + const e = new GraphQLError('msg', fieldNode); // Non-array value. + expect(e).to.deep.include({ + source, + nodes: [fieldNode], + positions: [4], + locations: [{ line: 2, column: 3 }], + }); + }); + + it('converts node with loc.start === 0 to positions and locations', () => { + const e = new GraphQLError('msg', operationNode); + expect(e).to.deep.include({ + source, + nodes: [operationNode], + positions: [0], + locations: [{ line: 1, column: 1 }], + }); + }); + + it('converts node without location to undefined source, positions and locations', () => { + const fieldNodeNoLocation = { + ...fieldNode, + loc: undefined, + }; + + const e = new GraphQLError('msg', fieldNodeNoLocation); + expect(e).to.deep.include({ + nodes: [fieldNodeNoLocation], + source: undefined, + positions: undefined, + locations: undefined, + }); + }); + + it('converts source and positions to locations', () => { + const e = new GraphQLError('msg', null, source, [6]); + expect(e).to.deep.include({ + source, + nodes: undefined, + positions: [6], + locations: [{ line: 2, column: 5 }], + }); + }); + + it('defaults to original error extension only if extensions argument is not passed', () => { + class ErrorWithExtensions extends Error { + extensions: unknown; + + constructor(message: string) { + super(message); + this.extensions = { original: 'extensions' }; + } + } + + const original = new ErrorWithExtensions('original'); + const inheritedExtensions = new GraphQLError( + 'InheritedExtensions', + undefined, + undefined, + undefined, + undefined, + original, + undefined, + ); + + expect(inheritedExtensions).to.deep.include({ + message: 'InheritedExtensions', + originalError: original, + extensions: { original: 'extensions' }, + }); + + const ownExtensions = new GraphQLError( + 'OwnExtensions', + undefined, + undefined, + undefined, + undefined, + original, + { own: 'extensions' }, + ); + + expect(ownExtensions).to.deep.include({ + message: 'OwnExtensions', + originalError: original, + extensions: { own: 'extensions' }, + }); + + const ownEmptyExtensions = new GraphQLError( + 'OwnEmptyExtensions', + undefined, + undefined, + undefined, + undefined, + original, + {}, + ); + + expect(ownEmptyExtensions).to.deep.include({ + message: 'OwnEmptyExtensions', + originalError: original, + extensions: {}, + }); + }); + + it('serializes to include all standard fields', () => { + const eShort = new GraphQLError('msg'); + expect(JSON.stringify(eShort, null, 2)).to.equal(dedent` + { + "message": "msg" + } + `); + + const path = ['path', 2, 'field']; + const extensions = { foo: 'bar' }; + const eFull = new GraphQLError( + 'msg', + fieldNode, + undefined, + undefined, + path, + undefined, + extensions, + ); + + // We should try to keep order of fields stable + // Changing it wouldn't be breaking change but will fail some tests in other libraries. + expect(JSON.stringify(eFull, null, 2)).to.equal(dedent` + { + "message": "msg", + "locations": [ + { + "line": 2, + "column": 3 + } + ], + "path": [ + "path", + 2, + "field" + ], + "extensions": { + "foo": "bar" + } + } + `); + }); +}); + +describe('toString', () => { + it('Deprecated: prints an error using printError', () => { + const error = new GraphQLError('Error'); + expect(printError(error)).to.equal('Error'); + }); + + it('prints an error without location', () => { + const error = new GraphQLError('Error without location'); + expect(error.toString()).to.equal('Error without location'); + }); + + it('prints an error using node without location', () => { + const error = new GraphQLError( + 'Error attached to node without location', + parse('{ foo }', { noLocation: true }), + ); + expect(error.toString()).to.equal( + 'Error attached to node without location', + ); + }); + + it('prints an error with nodes from different sources', () => { + const docA = parse( + new Source( + dedent` + type Foo { + field: String + } + `, + 'SourceA', + ), + ); + const opA = docA.definitions[0]; + invariant(opA.kind === Kind.OBJECT_TYPE_DEFINITION && opA.fields); + const fieldA = opA.fields[0]; + + const docB = parse( + new Source( + dedent` + type Foo { + field: Int + } + `, + 'SourceB', + ), + ); + const opB = docB.definitions[0]; + invariant(opB.kind === Kind.OBJECT_TYPE_DEFINITION && opB.fields); + const fieldB = opB.fields[0]; + + const error = new GraphQLError('Example error with two nodes', [ + fieldA.type, + fieldB.type, + ]); + + expect(error.toString()).to.equal(dedent` + Example error with two nodes + + SourceA:2:10 + 1 | type Foo { + 2 | field: String + | ^ + 3 | } + + SourceB:2:10 + 1 | type Foo { + 2 | field: Int + | ^ + 3 | } + `); + }); +}); + +describe('toJSON', () => { + it('Deprecated: format an error using formatError', () => { + const error = new GraphQLError('Example Error'); + expect(formatError(error)).to.deep.equal({ + message: 'Example Error', + }); + }); + + it('includes path', () => { + const error = new GraphQLError('msg', null, null, null, [ + 'path', + 3, + 'to', + 'field', + ]); + + expect(error.toJSON()).to.deep.equal({ + message: 'msg', + path: ['path', 3, 'to', 'field'], + }); + }); + + it('includes extension fields', () => { + const error = new GraphQLError('msg', null, null, null, null, null, { + foo: 'bar', + }); + + expect(error.toJSON()).to.deep.equal({ + message: 'msg', + extensions: { foo: 'bar' }, + }); + }); +}); diff --git a/src/error/__tests__/locatedError-test.ts b/src/error/__tests__/locatedError-test.ts new file mode 100644 index 00000000..2e35723a --- /dev/null +++ b/src/error/__tests__/locatedError-test.ts @@ -0,0 +1,54 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { GraphQLError } from '../GraphQLError'; +import { locatedError } from '../locatedError'; + +describe('locatedError', () => { + it('passes GraphQLError through', () => { + const e = new GraphQLError('msg', null, null, null, [ + 'path', + 3, + 'to', + 'field', + ]); + + expect(locatedError(e, [], [])).to.deep.equal(e); + }); + + it('wraps non-errors', () => { + const testObject = Object.freeze({}); + const error = locatedError(testObject, [], []); + + expect(error).to.be.instanceOf(GraphQLError); + expect(error.originalError).to.include({ + name: 'NonErrorThrown', + thrownValue: testObject, + }); + }); + + it('passes GraphQLError-ish through', () => { + const e = new Error(); + // @ts-expect-error + e.locations = []; + // @ts-expect-error + e.path = []; + // @ts-expect-error + e.nodes = []; + // @ts-expect-error + e.source = null; + // @ts-expect-error + e.positions = []; + e.name = 'GraphQLError'; + + expect(locatedError(e, [], [])).to.deep.equal(e); + }); + + it('does not pass through elasticsearch-like errors', () => { + const e = new Error('I am from elasticsearch'); + // @ts-expect-error + e.path = '/something/feed/_search'; + + expect(locatedError(e, [], [])).to.not.deep.equal(e); + }); +}); diff --git a/src/error/index.ts b/src/error/index.ts new file mode 100644 index 00000000..41ad0d6f --- /dev/null +++ b/src/error/index.ts @@ -0,0 +1,9 @@ +export { GraphQLError, printError, formatError } from './GraphQLError'; +export type { + GraphQLFormattedError, + GraphQLErrorExtensions, +} from './GraphQLError'; + +export { syntaxError } from './syntaxError'; + +export { locatedError } from './locatedError'; diff --git a/src/error/locatedError.ts b/src/error/locatedError.ts new file mode 100644 index 00000000..2fec3204 --- /dev/null +++ b/src/error/locatedError.ts @@ -0,0 +1,37 @@ +import type { Maybe } from '../jsutils/Maybe'; +import { toError } from '../jsutils/toError'; + +import type { ASTNode } from '../language/ast'; + +import { GraphQLError } from './GraphQLError'; + +/** + * Given an arbitrary value, presumably thrown while attempting to execute a + * GraphQL operation, produce a new GraphQLError aware of the location in the + * document responsible for the original Error. + */ +export function locatedError( + rawOriginalError: unknown, + nodes: ASTNode | ReadonlyArray | undefined | null, + path?: Maybe>, +): GraphQLError { + const originalError = toError(rawOriginalError); + + // Note: this uses a brand-check to support GraphQL errors originating from other contexts. + if (isLocatedGraphQLError(originalError)) { + return originalError; + } + + return new GraphQLError( + originalError.message, + (originalError as GraphQLError).nodes ?? nodes, + (originalError as GraphQLError).source, + (originalError as GraphQLError).positions, + path, + originalError, + ); +} + +function isLocatedGraphQLError(error: any): error is GraphQLError { + return Array.isArray(error.path); +} diff --git a/src/error/syntaxError.ts b/src/error/syntaxError.ts new file mode 100644 index 00000000..21a2dc18 --- /dev/null +++ b/src/error/syntaxError.ts @@ -0,0 +1,17 @@ +import type { Source } from '../language/source'; + +import { GraphQLError } from './GraphQLError'; + +/** + * Produces a GraphQLError representing a syntax error, containing useful + * descriptive information about the syntax error's position in the source. + */ +export function syntaxError( + source: Source, + position: number, + description: string, +): GraphQLError { + return new GraphQLError(`Syntax Error: ${description}`, undefined, source, [ + position, + ]); +} diff --git a/src/execution/README.md b/src/execution/README.md new file mode 100644 index 00000000..6540f323 --- /dev/null +++ b/src/execution/README.md @@ -0,0 +1,9 @@ +## GraphQL Execution + +The `graphql/execution` module is responsible for the execution phase of +fulfilling a GraphQL request. + +```js +import { execute } from 'graphql/execution'; // ES6 +var GraphQLExecution = require('graphql/execution'); // CommonJS +``` diff --git a/src/execution/__tests__/abstract-test.ts b/src/execution/__tests__/abstract-test.ts new file mode 100644 index 00000000..5253d0d9 --- /dev/null +++ b/src/execution/__tests__/abstract-test.ts @@ -0,0 +1,643 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../../__testUtils__/expectJSON'; + +import { parse } from '../../language/parser'; + +import { + assertInterfaceType, + GraphQLInterfaceType, + GraphQLList, + GraphQLObjectType, + GraphQLUnionType, +} from '../../type/definition'; +import { GraphQLBoolean, GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { execute, executeSync } from '../execute'; + +async function executeQuery(args: { + schema: GraphQLSchema; + query: string; + rootValue?: unknown; +}) { + const { schema, query, rootValue } = args; + const document = parse(query); + const result = executeSync({ + schema, + document, + rootValue, + contextValue: { async: false }, + }); + const asyncResult = await execute({ + schema, + document, + rootValue, + contextValue: { async: true }, + }); + + expectJSON(result).toDeepEqual(asyncResult); + return result; +} + +class Dog { + name: string; + woofs: boolean; + + constructor(name: string, woofs: boolean) { + this.name = name; + this.woofs = woofs; + } +} + +class Cat { + name: string; + meows: boolean; + + constructor(name: string, meows: boolean) { + this.name = name; + this.meows = meows; + } +} + +describe('Execute: Handles execution of abstract types', () => { + it('isTypeOf used to resolve runtime type for Interface', async () => { + const PetType = new GraphQLInterfaceType({ + name: 'Pet', + fields: { + name: { type: GraphQLString }, + }, + }); + + const DogType = new GraphQLObjectType({ + name: 'Dog', + interfaces: [PetType], + isTypeOf(obj, context) { + const isDog = obj instanceof Dog; + return context.async ? Promise.resolve(isDog) : isDog; + }, + fields: { + name: { type: GraphQLString }, + woofs: { type: GraphQLBoolean }, + }, + }); + + const CatType = new GraphQLObjectType({ + name: 'Cat', + interfaces: [PetType], + isTypeOf(obj, context) { + const isCat = obj instanceof Cat; + return context.async ? Promise.resolve(isCat) : isCat; + }, + fields: { + name: { type: GraphQLString }, + meows: { type: GraphQLBoolean }, + }, + }); + + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + pets: { + type: new GraphQLList(PetType), + resolve() { + return [new Dog('Odie', true), new Cat('Garfield', false)]; + }, + }, + }, + }), + types: [CatType, DogType], + }); + + const query = ` + { + pets { + name + ... on Dog { + woofs + } + ... on Cat { + meows + } + } + } + `; + + expect(await executeQuery({ schema, query })).to.deep.equal({ + data: { + pets: [ + { + name: 'Odie', + woofs: true, + }, + { + name: 'Garfield', + meows: false, + }, + ], + }, + }); + }); + + it('isTypeOf can throw', async () => { + const PetType = new GraphQLInterfaceType({ + name: 'Pet', + fields: { + name: { type: GraphQLString }, + }, + }); + + const DogType = new GraphQLObjectType({ + name: 'Dog', + interfaces: [PetType], + isTypeOf(_source, context) { + const error = new Error('We are testing this error'); + if (context.async) { + return Promise.reject(error); + } + throw error; + }, + fields: { + name: { type: GraphQLString }, + woofs: { type: GraphQLBoolean }, + }, + }); + + const CatType = new GraphQLObjectType({ + name: 'Cat', + interfaces: [PetType], + isTypeOf: undefined, + fields: { + name: { type: GraphQLString }, + meows: { type: GraphQLBoolean }, + }, + }); + + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + pets: { + type: new GraphQLList(PetType), + resolve() { + return [new Dog('Odie', true), new Cat('Garfield', false)]; + }, + }, + }, + }), + types: [DogType, CatType], + }); + + const query = ` + { + pets { + name + ... on Dog { + woofs + } + ... on Cat { + meows + } + } + } + `; + + expectJSON(await executeQuery({ schema, query })).toDeepEqual({ + data: { + pets: [null, null], + }, + errors: [ + { + message: 'We are testing this error', + locations: [{ line: 3, column: 9 }], + path: ['pets', 0], + }, + { + message: 'We are testing this error', + locations: [{ line: 3, column: 9 }], + path: ['pets', 1], + }, + ], + }); + }); + + it('isTypeOf can return false', async () => { + const PetType = new GraphQLInterfaceType({ + name: 'Pet', + fields: { + name: { type: GraphQLString }, + }, + }); + + const DogType = new GraphQLObjectType({ + name: 'Dog', + interfaces: [PetType], + isTypeOf(_source, context) { + return context.async ? Promise.resolve(false) : false; + }, + fields: { + name: { type: GraphQLString }, + woofs: { type: GraphQLBoolean }, + }, + }); + + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + pet: { + type: PetType, + resolve: () => ({}), + }, + }, + }), + types: [DogType], + }); + + const query = ` + { + pet { + name + } + } + `; + + expectJSON(await executeQuery({ schema, query })).toDeepEqual({ + data: { pet: null }, + errors: [ + { + message: + 'Abstract type "Pet" must resolve to an Object type at runtime for field "Query.pet". Either the "Pet" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.', + locations: [{ line: 3, column: 9 }], + path: ['pet'], + }, + ], + }); + }); + + it('isTypeOf used to resolve runtime type for Union', async () => { + const DogType = new GraphQLObjectType({ + name: 'Dog', + isTypeOf(obj, context) { + const isDog = obj instanceof Dog; + return context.async ? Promise.resolve(isDog) : isDog; + }, + fields: { + name: { type: GraphQLString }, + woofs: { type: GraphQLBoolean }, + }, + }); + + const CatType = new GraphQLObjectType({ + name: 'Cat', + isTypeOf(obj, context) { + const isCat = obj instanceof Cat; + return context.async ? Promise.resolve(isCat) : isCat; + }, + fields: { + name: { type: GraphQLString }, + meows: { type: GraphQLBoolean }, + }, + }); + + const PetType = new GraphQLUnionType({ + name: 'Pet', + types: [DogType, CatType], + }); + + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + pets: { + type: new GraphQLList(PetType), + resolve() { + return [new Dog('Odie', true), new Cat('Garfield', false)]; + }, + }, + }, + }), + }); + + const query = `{ + pets { + ... on Dog { + name + woofs + } + ... on Cat { + name + meows + } + } + }`; + + expect(await executeQuery({ schema, query })).to.deep.equal({ + data: { + pets: [ + { + name: 'Odie', + woofs: true, + }, + { + name: 'Garfield', + meows: false, + }, + ], + }, + }); + }); + + it('resolveType can throw', async () => { + const PetType = new GraphQLInterfaceType({ + name: 'Pet', + resolveType(_source, context) { + const error = new Error('We are testing this error'); + if (context.async) { + return Promise.reject(error); + } + throw error; + }, + fields: { + name: { type: GraphQLString }, + }, + }); + + const DogType = new GraphQLObjectType({ + name: 'Dog', + interfaces: [PetType], + fields: { + name: { type: GraphQLString }, + woofs: { type: GraphQLBoolean }, + }, + }); + + const CatType = new GraphQLObjectType({ + name: 'Cat', + interfaces: [PetType], + fields: { + name: { type: GraphQLString }, + meows: { type: GraphQLBoolean }, + }, + }); + + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + pets: { + type: new GraphQLList(PetType), + resolve() { + return [new Dog('Odie', true), new Cat('Garfield', false)]; + }, + }, + }, + }), + types: [CatType, DogType], + }); + + const query = ` + { + pets { + name + ... on Dog { + woofs + } + ... on Cat { + meows + } + } + } + `; + + expectJSON(await executeQuery({ schema, query })).toDeepEqual({ + data: { + pets: [null, null], + }, + errors: [ + { + message: 'We are testing this error', + locations: [{ line: 3, column: 9 }], + path: ['pets', 0], + }, + { + message: 'We are testing this error', + locations: [{ line: 3, column: 9 }], + path: ['pets', 1], + }, + ], + }); + }); + + it('resolve Union type using __typename on source object', async () => { + const schema = buildSchema(` + type Query { + pets: [Pet] + } + + union Pet = Cat | Dog + + type Cat { + name: String + meows: Boolean + } + + type Dog { + name: String + woofs: Boolean + } + `); + + const query = ` + { + pets { + name + ... on Dog { + woofs + } + ... on Cat { + meows + } + } + } + `; + + const rootValue = { + pets: [ + { + __typename: 'Dog', + name: 'Odie', + woofs: true, + }, + { + __typename: 'Cat', + name: 'Garfield', + meows: false, + }, + ], + }; + + expect(await executeQuery({ schema, query, rootValue })).to.deep.equal({ + data: { + pets: [ + { + name: 'Odie', + woofs: true, + }, + { + name: 'Garfield', + meows: false, + }, + ], + }, + }); + }); + + it('resolve Interface type using __typename on source object', async () => { + const schema = buildSchema(` + type Query { + pets: [Pet] + } + + interface Pet { + name: String + } + + type Cat implements Pet { + name: String + meows: Boolean + } + + type Dog implements Pet { + name: String + woofs: Boolean + } + `); + + const query = ` + { + pets { + name + ... on Dog { + woofs + } + ... on Cat { + meows + } + } + } + `; + + const rootValue = { + pets: [ + { + __typename: 'Dog', + name: 'Odie', + woofs: true, + }, + { + __typename: 'Cat', + name: 'Garfield', + meows: false, + }, + ], + }; + + expect(await executeQuery({ schema, query, rootValue })).to.deep.equal({ + data: { + pets: [ + { + name: 'Odie', + woofs: true, + }, + { + name: 'Garfield', + meows: false, + }, + ], + }, + }); + }); + + it('resolveType on Interface yields useful error', () => { + const schema = buildSchema(` + type Query { + pet: Pet + } + + interface Pet { + name: String + } + + type Cat implements Pet { + name: String + } + + type Dog implements Pet { + name: String + } + `); + + const document = parse(` + { + pet { + name + } + } + `); + + function expectError({ forTypeName }: { forTypeName: unknown }) { + const rootValue = { pet: { __typename: forTypeName } }; + const result = executeSync({ schema, document, rootValue }); + return { + toEqual(message: string) { + expectJSON(result).toDeepEqual({ + data: { pet: null }, + errors: [ + { + message, + locations: [{ line: 3, column: 9 }], + path: ['pet'], + }, + ], + }); + }, + }; + } + + expectError({ forTypeName: undefined }).toEqual( + 'Abstract type "Pet" must resolve to an Object type at runtime for field "Query.pet". Either the "Pet" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.', + ); + + expectError({ forTypeName: 'Human' }).toEqual( + 'Abstract type "Pet" was resolved to a type "Human" that does not exist inside the schema.', + ); + + expectError({ forTypeName: 'String' }).toEqual( + 'Abstract type "Pet" was resolved to a non-object type "String".', + ); + + expectError({ forTypeName: '__Schema' }).toEqual( + 'Runtime Object type "__Schema" is not a possible type for "Pet".', + ); + + // FIXME: workaround since we can't inject resolveType into SDL + // @ts-expect-error + assertInterfaceType(schema.getType('Pet')).resolveType = () => []; + expectError({ forTypeName: undefined }).toEqual( + 'Abstract type "Pet" must resolve to an Object type at runtime for field "Query.pet" with value { __typename: undefined }, received "[]".', + ); + + // FIXME: workaround since we can't inject resolveType into SDL + // @ts-expect-error + assertInterfaceType(schema.getType('Pet')).resolveType = () => + schema.getType('Cat'); + expectError({ forTypeName: undefined }).toEqual( + 'Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.', + ); + }); +}); diff --git a/src/execution/__tests__/directives-test.ts b/src/execution/__tests__/directives-test.ts new file mode 100644 index 00000000..0c85f5ca --- /dev/null +++ b/src/execution/__tests__/directives-test.ts @@ -0,0 +1,307 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { parse } from '../../language/parser'; + +import { GraphQLObjectType } from '../../type/definition'; +import { GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { executeSync } from '../execute'; + +const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'TestType', + fields: { + a: { type: GraphQLString }, + b: { type: GraphQLString }, + }, + }), +}); + +const rootValue = { + a() { + return 'a'; + }, + b() { + return 'b'; + }, +}; + +function executeTestQuery(query: string) { + const document = parse(query); + return executeSync({ schema, document, rootValue }); +} + +describe('Execute: handles directives', () => { + describe('works without directives', () => { + it('basic query works', () => { + const result = executeTestQuery('{ a, b }'); + + expect(result).to.deep.equal({ + data: { a: 'a', b: 'b' }, + }); + }); + }); + + describe('works on scalars', () => { + it('if true includes scalar', () => { + const result = executeTestQuery('{ a, b @include(if: true) }'); + + expect(result).to.deep.equal({ + data: { a: 'a', b: 'b' }, + }); + }); + + it('if false omits on scalar', () => { + const result = executeTestQuery('{ a, b @include(if: false) }'); + + expect(result).to.deep.equal({ + data: { a: 'a' }, + }); + }); + + it('unless false includes scalar', () => { + const result = executeTestQuery('{ a, b @skip(if: false) }'); + + expect(result).to.deep.equal({ + data: { a: 'a', b: 'b' }, + }); + }); + + it('unless true omits scalar', () => { + const result = executeTestQuery('{ a, b @skip(if: true) }'); + + expect(result).to.deep.equal({ + data: { a: 'a' }, + }); + }); + }); + + describe('works on fragment spreads', () => { + it('if false omits fragment spread', () => { + const result = executeTestQuery(` + query { + a + ...Frag @include(if: false) + } + fragment Frag on TestType { + b + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a' }, + }); + }); + + it('if true includes fragment spread', () => { + const result = executeTestQuery(` + query { + a + ...Frag @include(if: true) + } + fragment Frag on TestType { + b + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a', b: 'b' }, + }); + }); + + it('unless false includes fragment spread', () => { + const result = executeTestQuery(` + query { + a + ...Frag @skip(if: false) + } + fragment Frag on TestType { + b + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a', b: 'b' }, + }); + }); + + it('unless true omits fragment spread', () => { + const result = executeTestQuery(` + query { + a + ...Frag @skip(if: true) + } + fragment Frag on TestType { + b + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a' }, + }); + }); + }); + + describe('works on inline fragment', () => { + it('if false omits inline fragment', () => { + const result = executeTestQuery(` + query { + a + ... on TestType @include(if: false) { + b + } + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a' }, + }); + }); + + it('if true includes inline fragment', () => { + const result = executeTestQuery(` + query { + a + ... on TestType @include(if: true) { + b + } + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a', b: 'b' }, + }); + }); + it('unless false includes inline fragment', () => { + const result = executeTestQuery(` + query { + a + ... on TestType @skip(if: false) { + b + } + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a', b: 'b' }, + }); + }); + it('unless true includes inline fragment', () => { + const result = executeTestQuery(` + query { + a + ... on TestType @skip(if: true) { + b + } + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a' }, + }); + }); + }); + + describe('works on anonymous inline fragment', () => { + it('if false omits anonymous inline fragment', () => { + const result = executeTestQuery(` + query { + a + ... @include(if: false) { + b + } + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a' }, + }); + }); + + it('if true includes anonymous inline fragment', () => { + const result = executeTestQuery(` + query { + a + ... @include(if: true) { + b + } + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a', b: 'b' }, + }); + }); + it('unless false includes anonymous inline fragment', () => { + const result = executeTestQuery(` + query Q { + a + ... @skip(if: false) { + b + } + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a', b: 'b' }, + }); + }); + it('unless true includes anonymous inline fragment', () => { + const result = executeTestQuery(` + query { + a + ... @skip(if: true) { + b + } + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a' }, + }); + }); + }); + + describe('works with skip and include directives', () => { + it('include and no skip', () => { + const result = executeTestQuery(` + { + a + b @include(if: true) @skip(if: false) + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a', b: 'b' }, + }); + }); + + it('include and skip', () => { + const result = executeTestQuery(` + { + a + b @include(if: true) @skip(if: true) + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a' }, + }); + }); + + it('no include or skip', () => { + const result = executeTestQuery(` + { + a + b @include(if: false) @skip(if: false) + } + `); + + expect(result).to.deep.equal({ + data: { a: 'a' }, + }); + }); + }); +}); diff --git a/src/execution/__tests__/executor-test.ts b/src/execution/__tests__/executor-test.ts new file mode 100644 index 00000000..116334ad --- /dev/null +++ b/src/execution/__tests__/executor-test.ts @@ -0,0 +1,1272 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../../__testUtils__/expectJSON'; + +import { inspect } from '../../jsutils/inspect'; +import { invariant } from '../../jsutils/invariant'; + +import { Kind } from '../../language/kinds'; +import { parse } from '../../language/parser'; + +import { + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLScalarType, + GraphQLUnionType, +} from '../../type/definition'; +import { GraphQLBoolean, GraphQLInt, GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { execute, executeSync } from '../execute'; + +describe('Execute: Handles basic execution tasks', () => { + it('throws if no document is provided', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + a: { type: GraphQLString }, + }, + }), + }); + + // @ts-expect-error + expect(() => executeSync({ schema })).to.throw('Must provide document.'); + }); + + it('throws if no schema is provided', () => { + const document = parse('{ field }'); + + // @ts-expect-error + expect(() => executeSync({ document })).to.throw( + 'Expected undefined to be a GraphQL schema.', + ); + }); + + it('throws on invalid variables', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + fieldA: { + type: GraphQLString, + args: { argA: { type: GraphQLInt } }, + }, + }, + }), + }); + const document = parse(` + query ($a: Int) { + fieldA(argA: $a) + } + `); + const variableValues = '{ "a": 1 }'; + + // @ts-expect-error + expect(() => executeSync({ schema, document, variableValues })).to.throw( + 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.', + ); + }); + + it('executes arbitrary code', async () => { + const data = { + a: () => 'Apple', + b: () => 'Banana', + c: () => 'Cookie', + d: () => 'Donut', + e: () => 'Egg', + f: 'Fish', + // Called only by DataType::pic static resolver + pic: (size: number) => 'Pic of size: ' + size, + deep: () => deepData, + promise: promiseData, + }; + + const deepData = { + a: () => 'Already Been Done', + b: () => 'Boring', + c: () => ['Contrived', undefined, 'Confusing'], + deeper: () => [data, null, data], + }; + + function promiseData() { + return Promise.resolve(data); + } + + const DataType: GraphQLObjectType = new GraphQLObjectType({ + name: 'DataType', + fields: () => ({ + a: { type: GraphQLString }, + b: { type: GraphQLString }, + c: { type: GraphQLString }, + d: { type: GraphQLString }, + e: { type: GraphQLString }, + f: { type: GraphQLString }, + pic: { + args: { size: { type: GraphQLInt } }, + type: GraphQLString, + resolve: (obj, { size }) => obj.pic(size), + }, + deep: { type: DeepDataType }, + promise: { type: DataType }, + }), + }); + + const DeepDataType = new GraphQLObjectType({ + name: 'DeepDataType', + fields: { + a: { type: GraphQLString }, + b: { type: GraphQLString }, + c: { type: new GraphQLList(GraphQLString) }, + deeper: { type: new GraphQLList(DataType) }, + }, + }); + + const document = parse(` + query ($size: Int) { + a, + b, + x: c + ...c + f + ...on DataType { + pic(size: $size) + promise { + a + } + } + deep { + a + b + c + deeper { + a + b + } + } + } + + fragment c on DataType { + d + e + } + `); + + const result = await execute({ + schema: new GraphQLSchema({ query: DataType }), + document, + rootValue: data, + variableValues: { size: 100 }, + }); + + expect(result).to.deep.equal({ + data: { + a: 'Apple', + b: 'Banana', + x: 'Cookie', + d: 'Donut', + e: 'Egg', + f: 'Fish', + pic: 'Pic of size: 100', + promise: { a: 'Apple' }, + deep: { + a: 'Already Been Done', + b: 'Boring', + c: ['Contrived', null, 'Confusing'], + deeper: [ + { a: 'Apple', b: 'Banana' }, + null, + { a: 'Apple', b: 'Banana' }, + ], + }, + }, + }); + }); + + it('merges parallel fragments', () => { + const Type: GraphQLObjectType = new GraphQLObjectType({ + name: 'Type', + fields: () => ({ + a: { type: GraphQLString, resolve: () => 'Apple' }, + b: { type: GraphQLString, resolve: () => 'Banana' }, + c: { type: GraphQLString, resolve: () => 'Cherry' }, + deep: { type: Type, resolve: () => ({}) }, + }), + }); + const schema = new GraphQLSchema({ query: Type }); + + const document = parse(` + { a, ...FragOne, ...FragTwo } + + fragment FragOne on Type { + b + deep { b, deeper: deep { b } } + } + + fragment FragTwo on Type { + c + deep { c, deeper: deep { c } } + } + `); + + const result = executeSync({ schema, document }); + expect(result).to.deep.equal({ + data: { + a: 'Apple', + b: 'Banana', + c: 'Cherry', + deep: { + b: 'Banana', + c: 'Cherry', + deeper: { + b: 'Banana', + c: 'Cherry', + }, + }, + }, + }); + }); + + it('provides info about current execution state', () => { + let resolvedInfo; + const testType = new GraphQLObjectType({ + name: 'Test', + fields: { + test: { + type: GraphQLString, + resolve(_val, _args, _ctx, info) { + resolvedInfo = info; + }, + }, + }, + }); + const schema = new GraphQLSchema({ query: testType }); + + const document = parse('query ($var: String) { result: test }'); + const rootValue = { root: 'val' }; + const variableValues = { var: 'abc' }; + + executeSync({ schema, document, rootValue, variableValues }); + + expect(resolvedInfo).to.have.all.keys( + 'fieldName', + 'fieldNodes', + 'returnType', + 'parentType', + 'path', + 'schema', + 'fragments', + 'rootValue', + 'operation', + 'variableValues', + ); + + const operation = document.definitions[0]; + invariant(operation.kind === Kind.OPERATION_DEFINITION); + + expect(resolvedInfo).to.include({ + fieldName: 'test', + returnType: GraphQLString, + parentType: testType, + schema, + rootValue, + operation, + }); + + const field = operation.selectionSet.selections[0]; + expect(resolvedInfo).to.deep.include({ + fieldNodes: [field], + path: { prev: undefined, key: 'result', typename: 'Test' }, + variableValues: { var: 'abc' }, + }); + }); + + it('populates path correctly with complex types', () => { + let path; + const someObject = new GraphQLObjectType({ + name: 'SomeObject', + fields: { + test: { + type: GraphQLString, + resolve(_val, _args, _ctx, info) { + path = info.path; + }, + }, + }, + }); + const someUnion = new GraphQLUnionType({ + name: 'SomeUnion', + types: [someObject], + resolveType() { + return 'SomeObject'; + }, + }); + const testType = new GraphQLObjectType({ + name: 'SomeQuery', + fields: { + test: { + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(someUnion)), + ), + }, + }, + }); + const schema = new GraphQLSchema({ query: testType }); + const rootValue = { test: [{}] }; + const document = parse(` + query { + l1: test { + ... on SomeObject { + l2: test + } + } + } + `); + + executeSync({ schema, document, rootValue }); + + expect(path).to.deep.equal({ + key: 'l2', + typename: 'SomeObject', + prev: { + key: 0, + typename: undefined, + prev: { + key: 'l1', + typename: 'SomeQuery', + prev: undefined, + }, + }, + }); + }); + + it('threads root value context correctly', () => { + let resolvedRootValue; + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + a: { + type: GraphQLString, + resolve(rootValueArg) { + resolvedRootValue = rootValueArg; + }, + }, + }, + }), + }); + + const document = parse('query Example { a }'); + const rootValue = { contextThing: 'thing' }; + + executeSync({ schema, document, rootValue }); + expect(resolvedRootValue).to.equal(rootValue); + }); + + it('correctly threads arguments', () => { + let resolvedArgs; + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + b: { + args: { + numArg: { type: GraphQLInt }, + stringArg: { type: GraphQLString }, + }, + type: GraphQLString, + resolve(_, args) { + resolvedArgs = args; + }, + }, + }, + }), + }); + + const document = parse(` + query Example { + b(numArg: 123, stringArg: "foo") + } + `); + + executeSync({ schema, document }); + expect(resolvedArgs).to.deep.equal({ numArg: 123, stringArg: 'foo' }); + }); + + it('nulls out error subtrees', async () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + sync: { type: GraphQLString }, + syncError: { type: GraphQLString }, + syncRawError: { type: GraphQLString }, + syncReturnError: { type: GraphQLString }, + syncReturnErrorList: { type: new GraphQLList(GraphQLString) }, + async: { type: GraphQLString }, + asyncReject: { type: GraphQLString }, + asyncRejectWithExtensions: { type: GraphQLString }, + asyncRawReject: { type: GraphQLString }, + asyncEmptyReject: { type: GraphQLString }, + asyncError: { type: GraphQLString }, + asyncRawError: { type: GraphQLString }, + asyncReturnError: { type: GraphQLString }, + asyncReturnErrorWithExtensions: { type: GraphQLString }, + }, + }), + }); + + const document = parse(` + { + sync + syncError + syncRawError + syncReturnError + syncReturnErrorList + async + asyncReject + asyncRawReject + asyncEmptyReject + asyncError + asyncRawError + asyncReturnError + asyncReturnErrorWithExtensions + } + `); + + const rootValue = { + sync() { + return 'sync'; + }, + syncError() { + throw new Error('Error getting syncError'); + }, + syncRawError() { + // eslint-disable-next-line @typescript-eslint/no-throw-literal + throw 'Error getting syncRawError'; + }, + syncReturnError() { + return new Error('Error getting syncReturnError'); + }, + syncReturnErrorList() { + return [ + 'sync0', + new Error('Error getting syncReturnErrorList1'), + 'sync2', + new Error('Error getting syncReturnErrorList3'), + ]; + }, + async() { + return new Promise((resolve) => resolve('async')); + }, + asyncReject() { + return new Promise((_, reject) => + reject(new Error('Error getting asyncReject')), + ); + }, + asyncRawReject() { + // eslint-disable-next-line prefer-promise-reject-errors + return Promise.reject('Error getting asyncRawReject'); + }, + asyncEmptyReject() { + // eslint-disable-next-line prefer-promise-reject-errors + return Promise.reject(); + }, + asyncError() { + return new Promise(() => { + throw new Error('Error getting asyncError'); + }); + }, + asyncRawError() { + return new Promise(() => { + // eslint-disable-next-line @typescript-eslint/no-throw-literal + throw 'Error getting asyncRawError'; + }); + }, + asyncReturnError() { + return Promise.resolve(new Error('Error getting asyncReturnError')); + }, + asyncReturnErrorWithExtensions() { + const error = new Error('Error getting asyncReturnErrorWithExtensions'); + // @ts-expect-error + error.extensions = { foo: 'bar' }; + + return Promise.resolve(error); + }, + }; + + const result = await execute({ schema, document, rootValue }); + expectJSON(result).toDeepEqual({ + data: { + sync: 'sync', + syncError: null, + syncRawError: null, + syncReturnError: null, + syncReturnErrorList: ['sync0', null, 'sync2', null], + async: 'async', + asyncReject: null, + asyncRawReject: null, + asyncEmptyReject: null, + asyncError: null, + asyncRawError: null, + asyncReturnError: null, + asyncReturnErrorWithExtensions: null, + }, + errors: [ + { + message: 'Error getting syncError', + locations: [{ line: 4, column: 9 }], + path: ['syncError'], + }, + { + message: 'Unexpected error value: "Error getting syncRawError"', + locations: [{ line: 5, column: 9 }], + path: ['syncRawError'], + }, + { + message: 'Error getting syncReturnError', + locations: [{ line: 6, column: 9 }], + path: ['syncReturnError'], + }, + { + message: 'Error getting syncReturnErrorList1', + locations: [{ line: 7, column: 9 }], + path: ['syncReturnErrorList', 1], + }, + { + message: 'Error getting syncReturnErrorList3', + locations: [{ line: 7, column: 9 }], + path: ['syncReturnErrorList', 3], + }, + { + message: 'Error getting asyncReject', + locations: [{ line: 9, column: 9 }], + path: ['asyncReject'], + }, + { + message: 'Unexpected error value: "Error getting asyncRawReject"', + locations: [{ line: 10, column: 9 }], + path: ['asyncRawReject'], + }, + { + message: 'Unexpected error value: undefined', + locations: [{ line: 11, column: 9 }], + path: ['asyncEmptyReject'], + }, + { + message: 'Error getting asyncError', + locations: [{ line: 12, column: 9 }], + path: ['asyncError'], + }, + { + message: 'Unexpected error value: "Error getting asyncRawError"', + locations: [{ line: 13, column: 9 }], + path: ['asyncRawError'], + }, + { + message: 'Error getting asyncReturnError', + locations: [{ line: 14, column: 9 }], + path: ['asyncReturnError'], + }, + { + message: 'Error getting asyncReturnErrorWithExtensions', + locations: [{ line: 15, column: 9 }], + path: ['asyncReturnErrorWithExtensions'], + extensions: { foo: 'bar' }, + }, + ], + }); + }); + + it('nulls error subtree for promise rejection #1071', async () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + foods: { + type: new GraphQLList( + new GraphQLObjectType({ + name: 'Food', + fields: { + name: { type: GraphQLString }, + }, + }), + ), + resolve() { + return Promise.reject(new Error('Oops')); + }, + }, + }, + }), + }); + + const document = parse(` + query { + foods { + name + } + } + `); + + const result = await execute({ schema, document }); + + expectJSON(result).toDeepEqual({ + data: { foods: null }, + errors: [ + { + locations: [{ column: 9, line: 3 }], + message: 'Oops', + path: ['foods'], + }, + ], + }); + }); + + it('Full response path is included for non-nullable fields', () => { + const A: GraphQLObjectType = new GraphQLObjectType({ + name: 'A', + fields: () => ({ + nullableA: { + type: A, + resolve: () => ({}), + }, + nonNullA: { + type: new GraphQLNonNull(A), + resolve: () => ({}), + }, + throws: { + type: new GraphQLNonNull(GraphQLString), + resolve: () => { + throw new Error('Catch me if you can'); + }, + }, + }), + }); + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'query', + fields: () => ({ + nullableA: { + type: A, + resolve: () => ({}), + }, + }), + }), + }); + + const document = parse(` + query { + nullableA { + aliasedA: nullableA { + nonNullA { + anotherA: nonNullA { + throws + } + } + } + } + } + `); + + const result = executeSync({ schema, document }); + expectJSON(result).toDeepEqual({ + data: { + nullableA: { + aliasedA: null, + }, + }, + errors: [ + { + message: 'Catch me if you can', + locations: [{ line: 7, column: 17 }], + path: ['nullableA', 'aliasedA', 'nonNullA', 'anotherA', 'throws'], + }, + ], + }); + }); + + it('uses the inline operation if no operation name is provided', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + a: { type: GraphQLString }, + }, + }), + }); + const document = parse('{ a }'); + const rootValue = { a: 'b' }; + + const result = executeSync({ schema, document, rootValue }); + expect(result).to.deep.equal({ data: { a: 'b' } }); + }); + + it('uses the only operation if no operation name is provided', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + a: { type: GraphQLString }, + }, + }), + }); + const document = parse('query Example { a }'); + const rootValue = { a: 'b' }; + + const result = executeSync({ schema, document, rootValue }); + expect(result).to.deep.equal({ data: { a: 'b' } }); + }); + + it('uses the named operation if operation name is provided', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + a: { type: GraphQLString }, + }, + }), + }); + + const document = parse(` + query Example { first: a } + query OtherExample { second: a } + `); + const rootValue = { a: 'b' }; + const operationName = 'OtherExample'; + + const result = executeSync({ schema, document, rootValue, operationName }); + expect(result).to.deep.equal({ data: { second: 'b' } }); + }); + + it('provides error if no operation is provided', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + a: { type: GraphQLString }, + }, + }), + }); + const document = parse('fragment Example on Type { a }'); + const rootValue = { a: 'b' }; + + const result = executeSync({ schema, document, rootValue }); + expectJSON(result).toDeepEqual({ + errors: [{ message: 'Must provide an operation.' }], + }); + }); + + it('errors if no op name is provided with multiple operations', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + a: { type: GraphQLString }, + }, + }), + }); + const document = parse(` + query Example { a } + query OtherExample { a } + `); + + const result = executeSync({ schema, document }); + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Must provide operation name if query contains multiple operations.', + }, + ], + }); + }); + + it('errors if unknown operation name is provided', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + a: { type: GraphQLString }, + }, + }), + }); + const document = parse(` + query Example { a } + query OtherExample { a } + `); + const operationName = 'UnknownExample'; + + const result = executeSync({ schema, document, operationName }); + expectJSON(result).toDeepEqual({ + errors: [{ message: 'Unknown operation named "UnknownExample".' }], + }); + }); + + it('errors if empty string is provided as operation name', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + a: { type: GraphQLString }, + }, + }), + }); + const document = parse('{ a }'); + const operationName = ''; + + const result = executeSync({ schema, document, operationName }); + expectJSON(result).toDeepEqual({ + errors: [{ message: 'Unknown operation named "".' }], + }); + }); + + it('uses the query schema for queries', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Q', + fields: { + a: { type: GraphQLString }, + }, + }), + mutation: new GraphQLObjectType({ + name: 'M', + fields: { + c: { type: GraphQLString }, + }, + }), + subscription: new GraphQLObjectType({ + name: 'S', + fields: { + a: { type: GraphQLString }, + }, + }), + }); + const document = parse(` + query Q { a } + mutation M { c } + subscription S { a } + `); + const rootValue = { a: 'b', c: 'd' }; + const operationName = 'Q'; + + const result = executeSync({ schema, document, rootValue, operationName }); + expect(result).to.deep.equal({ data: { a: 'b' } }); + }); + + it('uses the mutation schema for mutations', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Q', + fields: { + a: { type: GraphQLString }, + }, + }), + mutation: new GraphQLObjectType({ + name: 'M', + fields: { + c: { type: GraphQLString }, + }, + }), + }); + const document = parse(` + query Q { a } + mutation M { c } + `); + const rootValue = { a: 'b', c: 'd' }; + const operationName = 'M'; + + const result = executeSync({ schema, document, rootValue, operationName }); + expect(result).to.deep.equal({ data: { c: 'd' } }); + }); + + it('uses the subscription schema for subscriptions', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Q', + fields: { + a: { type: GraphQLString }, + }, + }), + subscription: new GraphQLObjectType({ + name: 'S', + fields: { + a: { type: GraphQLString }, + }, + }), + }); + const document = parse(` + query Q { a } + subscription S { a } + `); + const rootValue = { a: 'b', c: 'd' }; + const operationName = 'S'; + + const result = executeSync({ schema, document, rootValue, operationName }); + expect(result).to.deep.equal({ data: { a: 'b' } }); + }); + + it('resolves to an error if schema does not support operation', () => { + const schema = new GraphQLSchema({ assumeValid: true }); + + const document = parse(` + query Q { __typename } + mutation M { __typename } + subscription S { __typename } + `); + + expectJSON( + executeSync({ schema, document, operationName: 'Q' }), + ).toDeepEqual({ + data: null, + errors: [ + { + message: 'Schema is not configured to execute query operation.', + locations: [{ line: 2, column: 7 }], + }, + ], + }); + + expectJSON( + executeSync({ schema, document, operationName: 'M' }), + ).toDeepEqual({ + data: null, + errors: [ + { + message: 'Schema is not configured to execute mutation operation.', + locations: [{ line: 3, column: 7 }], + }, + ], + }); + + expectJSON( + executeSync({ schema, document, operationName: 'S' }), + ).toDeepEqual({ + data: null, + errors: [ + { + message: + 'Schema is not configured to execute subscription operation.', + locations: [{ line: 4, column: 7 }], + }, + ], + }); + }); + + it('correct field ordering despite execution order', async () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + a: { type: GraphQLString }, + b: { type: GraphQLString }, + c: { type: GraphQLString }, + d: { type: GraphQLString }, + e: { type: GraphQLString }, + }, + }), + }); + const document = parse('{ a, b, c, d, e }'); + const rootValue = { + a: () => 'a', + b: () => new Promise((resolve) => resolve('b')), + c: () => 'c', + d: () => new Promise((resolve) => resolve('d')), + e: () => 'e', + }; + + const result = await execute({ schema, document, rootValue }); + expect(result).to.deep.equal({ + data: { a: 'a', b: 'b', c: 'c', d: 'd', e: 'e' }, + }); + }); + + it('Avoids recursion', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + a: { type: GraphQLString }, + }, + }), + }); + const document = parse(` + { + a + ...Frag + ...Frag + } + + fragment Frag on Type { + a, + ...Frag + } + `); + const rootValue = { a: 'b' }; + + const result = executeSync({ schema, document, rootValue }); + expect(result).to.deep.equal({ + data: { a: 'b' }, + }); + }); + + it('ignores missing sub selections on fields', () => { + const someType = new GraphQLObjectType({ + name: 'SomeType', + fields: { + b: { type: GraphQLString }, + }, + }); + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + a: { type: someType }, + }, + }), + }); + const document = parse('{ a }'); + const rootValue = { a: { b: 'c' } }; + + const result = executeSync({ schema, document, rootValue }); + expect(result).to.deep.equal({ + data: { a: {} }, + }); + }); + + it('does not include illegal fields in output', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Q', + fields: { + a: { type: GraphQLString }, + }, + }), + }); + const document = parse('{ thisIsIllegalDoNotIncludeMe }'); + + const result = executeSync({ schema, document }); + expect(result).to.deep.equal({ + data: {}, + }); + }); + + it('does not include arguments that were not set', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Type', + fields: { + field: { + type: GraphQLString, + resolve: (_source, args) => inspect(args), + args: { + a: { type: GraphQLBoolean }, + b: { type: GraphQLBoolean }, + c: { type: GraphQLBoolean }, + d: { type: GraphQLInt }, + e: { type: GraphQLInt }, + }, + }, + }, + }), + }); + const document = parse('{ field(a: true, c: false, e: 0) }'); + + const result = executeSync({ schema, document }); + expect(result).to.deep.equal({ + data: { + field: '{ a: true, c: false, e: 0 }', + }, + }); + }); + + it('fails when an isTypeOf check is not met', async () => { + class Special { + value: string; + + constructor(value: string) { + this.value = value; + } + } + + class NotSpecial { + value: string; + + constructor(value: string) { + this.value = value; + } + } + + const SpecialType = new GraphQLObjectType({ + name: 'SpecialType', + isTypeOf(obj, context) { + const result = obj instanceof Special; + return context?.async ? Promise.resolve(result) : result; + }, + fields: { value: { type: GraphQLString } }, + }); + + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + specials: { type: new GraphQLList(SpecialType) }, + }, + }), + }); + + const document = parse('{ specials { value } }'); + const rootValue = { + specials: [new Special('foo'), new NotSpecial('bar')], + }; + + const result = executeSync({ schema, document, rootValue }); + expectJSON(result).toDeepEqual({ + data: { + specials: [{ value: 'foo' }, null], + }, + errors: [ + { + message: + 'Expected value of type "SpecialType" but got: { value: "bar" }.', + locations: [{ line: 1, column: 3 }], + path: ['specials', 1], + }, + ], + }); + + const contextValue = { async: true }; + const asyncResult = await execute({ + schema, + document, + rootValue, + contextValue, + }); + expect(asyncResult).to.deep.equal(result); + }); + + it('fails when serialize of custom scalar does not return a value', () => { + const customScalar = new GraphQLScalarType({ + name: 'CustomScalar', + serialize() { + /* returns nothing */ + }, + }); + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + customScalar: { + type: customScalar, + resolve: () => 'CUSTOM_VALUE', + }, + }, + }), + }); + + const result = executeSync({ schema, document: parse('{ customScalar }') }); + expectJSON(result).toDeepEqual({ + data: { customScalar: null }, + errors: [ + { + message: + 'Expected `CustomScalar.serialize("CUSTOM_VALUE")` to return non-nullable value, returned: undefined', + locations: [{ line: 1, column: 3 }], + path: ['customScalar'], + }, + ], + }); + }); + + it('executes ignoring invalid non-executable definitions', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + foo: { type: GraphQLString }, + }, + }), + }); + + const document = parse(` + { foo } + + type Query { bar: String } + `); + + const result = executeSync({ schema, document }); + expect(result).to.deep.equal({ data: { foo: null } }); + }); + + it('uses a custom field resolver', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + foo: { type: GraphQLString }, + }, + }), + }); + const document = parse('{ foo }'); + + const result = executeSync({ + schema, + document, + fieldResolver(_source, _args, _context, info) { + // For the purposes of test, just return the name of the field! + return info.fieldName; + }, + }); + + expect(result).to.deep.equal({ data: { foo: 'foo' } }); + }); + + it('uses a custom type resolver', () => { + const document = parse('{ foo { bar } }'); + + const fooInterface = new GraphQLInterfaceType({ + name: 'FooInterface', + fields: { + bar: { type: GraphQLString }, + }, + }); + + const fooObject = new GraphQLObjectType({ + name: 'FooObject', + interfaces: [fooInterface], + fields: { + bar: { type: GraphQLString }, + }, + }); + + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + foo: { type: fooInterface }, + }, + }), + types: [fooObject], + }); + + const rootValue = { foo: { bar: 'bar' } }; + + let possibleTypes; + const result = executeSync({ + schema, + document, + rootValue, + typeResolver(_source, _context, info, abstractType) { + // Resolver should be able to figure out all possible types on its own + possibleTypes = info.schema.getPossibleTypes(abstractType); + + return 'FooObject'; + }, + }); + + expect(result).to.deep.equal({ data: { foo: { bar: 'bar' } } }); + expect(possibleTypes).to.deep.equal([fooObject]); + }); +}); diff --git a/src/execution/__tests__/lists-test.ts b/src/execution/__tests__/lists-test.ts new file mode 100644 index 00000000..ac6460d5 --- /dev/null +++ b/src/execution/__tests__/lists-test.ts @@ -0,0 +1,225 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../../__testUtils__/expectJSON'; + +import { parse } from '../../language/parser'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { execute, executeSync } from '../execute'; + +describe('Execute: Accepts any iterable as list value', () => { + function complete(rootValue: unknown) { + return executeSync({ + schema: buildSchema('type Query { listField: [String] }'), + document: parse('{ listField }'), + rootValue, + }); + } + + it('Accepts a Set as a List value', () => { + const listField = new Set(['apple', 'banana', 'apple', 'coconut']); + + expect(complete({ listField })).to.deep.equal({ + data: { listField: ['apple', 'banana', 'coconut'] }, + }); + }); + + it('Accepts an Generator function as a List value', () => { + function* listField() { + yield 'one'; + yield 2; + yield true; + } + + expect(complete({ listField })).to.deep.equal({ + data: { listField: ['one', '2', 'true'] }, + }); + }); + + it('Accepts function arguments as a List value', () => { + function getArgs(..._args: ReadonlyArray) { + return arguments; + } + const listField = getArgs('one', 'two'); + + expect(complete({ listField })).to.deep.equal({ + data: { listField: ['one', 'two'] }, + }); + }); + + it('Does not accept (Iterable) String-literal as a List value', () => { + const listField = 'Singular'; + + expectJSON(complete({ listField })).toDeepEqual({ + data: { listField: null }, + errors: [ + { + message: + 'Expected Iterable, but did not find one for field "Query.listField".', + locations: [{ line: 1, column: 3 }], + path: ['listField'], + }, + ], + }); + }); +}); + +describe('Execute: Handles list nullability', () => { + async function complete(args: { listField: unknown; as: string }) { + const { listField, as } = args; + const schema = buildSchema(`type Query { listField: ${as} }`); + const document = parse('{ listField }'); + + const result = await executeQuery(listField); + // Promise> === Array + expectJSON(await executeQuery(promisify(listField))).toDeepEqual(result); + if (Array.isArray(listField)) { + const listOfPromises = listField.map(promisify); + + // Array> === Array + expectJSON(await executeQuery(listOfPromises)).toDeepEqual(result); + // Promise>> === Array + expectJSON(await executeQuery(promisify(listOfPromises))).toDeepEqual( + result, + ); + } + return result; + + function executeQuery(listValue: unknown) { + return execute({ schema, document, rootValue: { listField: listValue } }); + } + + function promisify(value: unknown): Promise { + return value instanceof Error + ? Promise.reject(value) + : Promise.resolve(value); + } + } + + it('Contains values', async () => { + const listField = [1, 2]; + + expect(await complete({ listField, as: '[Int]' })).to.deep.equal({ + data: { listField: [1, 2] }, + }); + expect(await complete({ listField, as: '[Int]!' })).to.deep.equal({ + data: { listField: [1, 2] }, + }); + expect(await complete({ listField, as: '[Int!]' })).to.deep.equal({ + data: { listField: [1, 2] }, + }); + expect(await complete({ listField, as: '[Int!]!' })).to.deep.equal({ + data: { listField: [1, 2] }, + }); + }); + + it('Contains null', async () => { + const listField = [1, null, 2]; + const errors = [ + { + message: 'Cannot return null for non-nullable field Query.listField.', + locations: [{ line: 1, column: 3 }], + path: ['listField', 1], + }, + ]; + + expect(await complete({ listField, as: '[Int]' })).to.deep.equal({ + data: { listField: [1, null, 2] }, + }); + expect(await complete({ listField, as: '[Int]!' })).to.deep.equal({ + data: { listField: [1, null, 2] }, + }); + expectJSON(await complete({ listField, as: '[Int!]' })).toDeepEqual({ + data: { listField: null }, + errors, + }); + expectJSON(await complete({ listField, as: '[Int!]!' })).toDeepEqual({ + data: null, + errors, + }); + }); + + it('Returns null', async () => { + const listField = null; + const errors = [ + { + message: 'Cannot return null for non-nullable field Query.listField.', + locations: [{ line: 1, column: 3 }], + path: ['listField'], + }, + ]; + + expect(await complete({ listField, as: '[Int]' })).to.deep.equal({ + data: { listField: null }, + }); + expectJSON(await complete({ listField, as: '[Int]!' })).toDeepEqual({ + data: null, + errors, + }); + expect(await complete({ listField, as: '[Int!]' })).to.deep.equal({ + data: { listField: null }, + }); + expectJSON(await complete({ listField, as: '[Int!]!' })).toDeepEqual({ + data: null, + errors, + }); + }); + + it('Contains error', async () => { + const listField = [1, new Error('bad'), 2]; + const errors = [ + { + message: 'bad', + locations: [{ line: 1, column: 3 }], + path: ['listField', 1], + }, + ]; + + expectJSON(await complete({ listField, as: '[Int]' })).toDeepEqual({ + data: { listField: [1, null, 2] }, + errors, + }); + expectJSON(await complete({ listField, as: '[Int]!' })).toDeepEqual({ + data: { listField: [1, null, 2] }, + errors, + }); + expectJSON(await complete({ listField, as: '[Int!]' })).toDeepEqual({ + data: { listField: null }, + errors, + }); + expectJSON(await complete({ listField, as: '[Int!]!' })).toDeepEqual({ + data: null, + errors, + }); + }); + + it('Results in error', async () => { + const listField = new Error('bad'); + const errors = [ + { + message: 'bad', + locations: [{ line: 1, column: 3 }], + path: ['listField'], + }, + ]; + + expectJSON(await complete({ listField, as: '[Int]' })).toDeepEqual({ + data: { listField: null }, + errors, + }); + expectJSON(await complete({ listField, as: '[Int]!' })).toDeepEqual({ + data: null, + errors, + }); + expectJSON(await complete({ listField, as: '[Int!]' })).toDeepEqual({ + data: { listField: null }, + errors, + }); + expectJSON(await complete({ listField, as: '[Int!]!' })).toDeepEqual({ + data: null, + errors, + }); + }); +}); diff --git a/src/execution/__tests__/mapAsyncIterator-test.ts b/src/execution/__tests__/mapAsyncIterator-test.ts new file mode 100644 index 00000000..ec01634e --- /dev/null +++ b/src/execution/__tests__/mapAsyncIterator-test.ts @@ -0,0 +1,336 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { mapAsyncIterator } from '../mapAsyncIterator'; + +/* eslint-disable @typescript-eslint/require-await */ +describe('mapAsyncIterator', () => { + it('maps over async generator', async () => { + async function* source() { + yield 1; + yield 2; + yield 3; + } + + const doubles = mapAsyncIterator(source(), (x) => x + x); + + expect(await doubles.next()).to.deep.equal({ value: 2, done: false }); + expect(await doubles.next()).to.deep.equal({ value: 4, done: false }); + expect(await doubles.next()).to.deep.equal({ value: 6, done: false }); + expect(await doubles.next()).to.deep.equal({ + value: undefined, + done: true, + }); + }); + + it('maps over async iterable', async () => { + const items = [1, 2, 3]; + + const iterable = { + [Symbol.asyncIterator]() { + return this; + }, + + next(): Promise> { + if (items.length > 0) { + const value = items[0]; + items.shift(); + return Promise.resolve({ done: false, value }); + } + + return Promise.resolve({ done: true, value: undefined }); + }, + }; + + const doubles = mapAsyncIterator(iterable, (x) => x + x); + + expect(await doubles.next()).to.deep.equal({ value: 2, done: false }); + expect(await doubles.next()).to.deep.equal({ value: 4, done: false }); + expect(await doubles.next()).to.deep.equal({ value: 6, done: false }); + expect(await doubles.next()).to.deep.equal({ + value: undefined, + done: true, + }); + }); + + it('compatible with for-await-of', async () => { + async function* source() { + yield 1; + yield 2; + yield 3; + } + + const doubles = mapAsyncIterator(source(), (x) => x + x); + + const result = []; + for await (const x of doubles) { + result.push(x); + } + expect(result).to.deep.equal([2, 4, 6]); + }); + + it('maps over async values with async function', async () => { + async function* source() { + yield 1; + yield 2; + yield 3; + } + + const doubles = mapAsyncIterator(source(), (x) => Promise.resolve(x + x)); + + expect(await doubles.next()).to.deep.equal({ value: 2, done: false }); + expect(await doubles.next()).to.deep.equal({ value: 4, done: false }); + expect(await doubles.next()).to.deep.equal({ value: 6, done: false }); + expect(await doubles.next()).to.deep.equal({ + value: undefined, + done: true, + }); + }); + + it('allows returning early from mapped async generator', async () => { + async function* source() { + try { + yield 1; + /* c8 ignore next 2 */ + yield 2; + yield 3; // Shouldn't be reached. + } finally { + // eslint-disable-next-line no-unsafe-finally + return 'The End'; + } + } + + const doubles = mapAsyncIterator(source(), (x) => x + x); + + expect(await doubles.next()).to.deep.equal({ value: 2, done: false }); + expect(await doubles.next()).to.deep.equal({ value: 4, done: false }); + + // Early return + expect(await doubles.return('')).to.deep.equal({ + value: 'The End', + done: true, + }); + + // Subsequent next calls + expect(await doubles.next()).to.deep.equal({ + value: undefined, + done: true, + }); + expect(await doubles.next()).to.deep.equal({ + value: undefined, + done: true, + }); + }); + + it('allows returning early from mapped async iterable', async () => { + const items = [1, 2, 3]; + + const iterable = { + [Symbol.asyncIterator]() { + return this; + }, + next() { + const value = items[0]; + items.shift(); + return Promise.resolve({ + done: items.length === 0, + value, + }); + }, + }; + + const doubles = mapAsyncIterator(iterable, (x) => x + x); + + expect(await doubles.next()).to.deep.equal({ value: 2, done: false }); + expect(await doubles.next()).to.deep.equal({ value: 4, done: false }); + + // Early return + expect(await doubles.return(0)).to.deep.equal({ + value: undefined, + done: true, + }); + }); + + it('passes through early return from async values', async () => { + async function* source() { + try { + yield 'a'; + /* c8 ignore next 2 */ + yield 'b'; + yield 'c'; // Shouldn't be reached. + } finally { + yield 'Done'; + yield 'Last'; + } + } + + const doubles = mapAsyncIterator(source(), (x) => x + x); + + expect(await doubles.next()).to.deep.equal({ value: 'aa', done: false }); + expect(await doubles.next()).to.deep.equal({ value: 'bb', done: false }); + + // Early return + expect(await doubles.return()).to.deep.equal({ + value: 'DoneDone', + done: false, + }); + + // Subsequent next calls may yield from finally block + expect(await doubles.next()).to.deep.equal({ + value: 'LastLast', + done: false, + }); + expect(await doubles.next()).to.deep.equal({ + value: undefined, + done: true, + }); + }); + + it('allows throwing errors through async iterable', async () => { + const items = [1, 2, 3]; + + const iterable = { + [Symbol.asyncIterator]() { + return this; + }, + next() { + const value = items[0]; + items.shift(); + return Promise.resolve({ + done: items.length === 0, + value, + }); + }, + }; + + const doubles = mapAsyncIterator(iterable, (x) => x + x); + + expect(await doubles.next()).to.deep.equal({ value: 2, done: false }); + expect(await doubles.next()).to.deep.equal({ value: 4, done: false }); + + // Throw error + let caughtError; + try { + /* c8 ignore next */ + await doubles.throw('ouch'); + } catch (e) { + caughtError = e; + } + expect(caughtError).to.equal('ouch'); + }); + + it('passes through caught errors through async generators', async () => { + async function* source() { + try { + yield 1; + /* c8 ignore next 2 */ + yield 2; + yield 3; // Shouldn't be reached. + } catch (e) { + yield e; + } + } + + const doubles = mapAsyncIterator(source(), (x) => x + x); + + expect(await doubles.next()).to.deep.equal({ value: 2, done: false }); + expect(await doubles.next()).to.deep.equal({ value: 4, done: false }); + + // Throw error + expect(await doubles.throw('Ouch')).to.deep.equal({ + value: 'OuchOuch', + done: false, + }); + + expect(await doubles.next()).to.deep.equal({ + value: undefined, + done: true, + }); + expect(await doubles.next()).to.deep.equal({ + value: undefined, + done: true, + }); + }); + + it('does not normally map over thrown errors', async () => { + async function* source() { + yield 'Hello'; + throw new Error('Goodbye'); + } + + const doubles = mapAsyncIterator(source(), (x) => x + x); + + expect(await doubles.next()).to.deep.equal({ + value: 'HelloHello', + done: false, + }); + + let caughtError; + try { + /* c8 ignore next */ + await doubles.next(); + } catch (e) { + caughtError = e; + } + + expect(caughtError) + .to.be.an.instanceOf(Error) + .with.property('message', 'Goodbye'); + }); + + async function testClosesSourceWithMapper(mapper: (value: number) => T) { + let didVisitFinally = false; + + async function* source() { + try { + yield 1; + /* c8 ignore next 2 */ + yield 2; + yield 3; // Shouldn't be reached. + } finally { + didVisitFinally = true; + yield 1000; + } + } + + const throwOver1 = mapAsyncIterator(source(), mapper); + + expect(await throwOver1.next()).to.deep.equal({ value: 1, done: false }); + + let expectedError; + try { + /* c8 ignore next */ + await throwOver1.next(); + } catch (error) { + expectedError = error; + } + + expect(expectedError) + .to.be.an.instanceOf(Error) + .with.property('message', 'Cannot count to 2'); + + expect(await throwOver1.next()).to.deep.equal({ + value: undefined, + done: true, + }); + + expect(didVisitFinally).to.equal(true); + } + + it('closes source if mapper throws an error', async () => { + await testClosesSourceWithMapper((x) => { + if (x > 1) { + throw new Error('Cannot count to ' + x); + } + return x; + }); + }); + + it('closes source if mapper rejects', async () => { + await testClosesSourceWithMapper((x) => + x > 1 + ? Promise.reject(new Error('Cannot count to ' + x)) + : Promise.resolve(x), + ); + }); +}); diff --git a/src/execution/__tests__/mutations-test.ts b/src/execution/__tests__/mutations-test.ts new file mode 100644 index 00000000..0f0ad1cb --- /dev/null +++ b/src/execution/__tests__/mutations-test.ts @@ -0,0 +1,194 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../../__testUtils__/expectJSON'; +import { resolveOnNextTick } from '../../__testUtils__/resolveOnNextTick'; + +import { parse } from '../../language/parser'; + +import { GraphQLObjectType } from '../../type/definition'; +import { GraphQLInt } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { execute, executeSync } from '../execute'; + +class NumberHolder { + theNumber: number; + + constructor(originalNumber: number) { + this.theNumber = originalNumber; + } +} + +class Root { + numberHolder: NumberHolder; + + constructor(originalNumber: number) { + this.numberHolder = new NumberHolder(originalNumber); + } + + immediatelyChangeTheNumber(newNumber: number): NumberHolder { + this.numberHolder.theNumber = newNumber; + return this.numberHolder; + } + + async promiseToChangeTheNumber(newNumber: number): Promise { + await resolveOnNextTick(); + return this.immediatelyChangeTheNumber(newNumber); + } + + failToChangeTheNumber(): NumberHolder { + throw new Error('Cannot change the number'); + } + + async promiseAndFailToChangeTheNumber(): Promise { + await resolveOnNextTick(); + throw new Error('Cannot change the number'); + } +} + +const numberHolderType = new GraphQLObjectType({ + fields: { + theNumber: { type: GraphQLInt }, + }, + name: 'NumberHolder', +}); + +const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + fields: { + numberHolder: { type: numberHolderType }, + }, + name: 'Query', + }), + mutation: new GraphQLObjectType({ + fields: { + immediatelyChangeTheNumber: { + type: numberHolderType, + args: { newNumber: { type: GraphQLInt } }, + resolve(obj, { newNumber }) { + return obj.immediatelyChangeTheNumber(newNumber); + }, + }, + promiseToChangeTheNumber: { + type: numberHolderType, + args: { newNumber: { type: GraphQLInt } }, + resolve(obj, { newNumber }) { + return obj.promiseToChangeTheNumber(newNumber); + }, + }, + failToChangeTheNumber: { + type: numberHolderType, + args: { newNumber: { type: GraphQLInt } }, + resolve(obj, { newNumber }) { + return obj.failToChangeTheNumber(newNumber); + }, + }, + promiseAndFailToChangeTheNumber: { + type: numberHolderType, + args: { newNumber: { type: GraphQLInt } }, + resolve(obj, { newNumber }) { + return obj.promiseAndFailToChangeTheNumber(newNumber); + }, + }, + }, + name: 'Mutation', + }), +}); + +describe('Execute: Handles mutation execution ordering', () => { + it('evaluates mutations serially', async () => { + const document = parse(` + mutation M { + first: immediatelyChangeTheNumber(newNumber: 1) { + theNumber + }, + second: promiseToChangeTheNumber(newNumber: 2) { + theNumber + }, + third: immediatelyChangeTheNumber(newNumber: 3) { + theNumber + } + fourth: promiseToChangeTheNumber(newNumber: 4) { + theNumber + }, + fifth: immediatelyChangeTheNumber(newNumber: 5) { + theNumber + } + } + `); + + const rootValue = new Root(6); + const mutationResult = await execute({ schema, document, rootValue }); + + expect(mutationResult).to.deep.equal({ + data: { + first: { theNumber: 1 }, + second: { theNumber: 2 }, + third: { theNumber: 3 }, + fourth: { theNumber: 4 }, + fifth: { theNumber: 5 }, + }, + }); + }); + + it('does not include illegal mutation fields in output', () => { + const document = parse('mutation { thisIsIllegalDoNotIncludeMe }'); + + const result = executeSync({ schema, document }); + expect(result).to.deep.equal({ + data: {}, + }); + }); + + it('evaluates mutations correctly in the presence of a failed mutation', async () => { + const document = parse(` + mutation M { + first: immediatelyChangeTheNumber(newNumber: 1) { + theNumber + }, + second: promiseToChangeTheNumber(newNumber: 2) { + theNumber + }, + third: failToChangeTheNumber(newNumber: 3) { + theNumber + } + fourth: promiseToChangeTheNumber(newNumber: 4) { + theNumber + }, + fifth: immediatelyChangeTheNumber(newNumber: 5) { + theNumber + } + sixth: promiseAndFailToChangeTheNumber(newNumber: 6) { + theNumber + } + } + `); + + const rootValue = new Root(6); + const result = await execute({ schema, document, rootValue }); + + expectJSON(result).toDeepEqual({ + data: { + first: { theNumber: 1 }, + second: { theNumber: 2 }, + third: null, + fourth: { theNumber: 4 }, + fifth: { theNumber: 5 }, + sixth: null, + }, + errors: [ + { + message: 'Cannot change the number', + locations: [{ line: 9, column: 9 }], + path: ['third'], + }, + { + message: 'Cannot change the number', + locations: [{ line: 18, column: 9 }], + path: ['sixth'], + }, + ], + }); + }); +}); diff --git a/src/execution/__tests__/nonnull-test.ts b/src/execution/__tests__/nonnull-test.ts new file mode 100644 index 00000000..427f2a64 --- /dev/null +++ b/src/execution/__tests__/nonnull-test.ts @@ -0,0 +1,714 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../../__testUtils__/expectJSON'; + +import { parse } from '../../language/parser'; + +import { GraphQLNonNull, GraphQLObjectType } from '../../type/definition'; +import { GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import type { ExecutionResult } from '../execute'; +import { execute, executeSync } from '../execute'; + +const syncError = new Error('sync'); +const syncNonNullError = new Error('syncNonNull'); +const promiseError = new Error('promise'); +const promiseNonNullError = new Error('promiseNonNull'); + +const throwingData = { + sync() { + throw syncError; + }, + syncNonNull() { + throw syncNonNullError; + }, + promise() { + return new Promise(() => { + throw promiseError; + }); + }, + promiseNonNull() { + return new Promise(() => { + throw promiseNonNullError; + }); + }, + syncNest() { + return throwingData; + }, + syncNonNullNest() { + return throwingData; + }, + promiseNest() { + return new Promise((resolve) => { + resolve(throwingData); + }); + }, + promiseNonNullNest() { + return new Promise((resolve) => { + resolve(throwingData); + }); + }, +}; + +const nullingData = { + sync() { + return null; + }, + syncNonNull() { + return null; + }, + promise() { + return new Promise((resolve) => { + resolve(null); + }); + }, + promiseNonNull() { + return new Promise((resolve) => { + resolve(null); + }); + }, + syncNest() { + return nullingData; + }, + syncNonNullNest() { + return nullingData; + }, + promiseNest() { + return new Promise((resolve) => { + resolve(nullingData); + }); + }, + promiseNonNullNest() { + return new Promise((resolve) => { + resolve(nullingData); + }); + }, +}; + +const schema = buildSchema(` + type DataType { + sync: String + syncNonNull: String! + promise: String + promiseNonNull: String! + syncNest: DataType + syncNonNullNest: DataType! + promiseNest: DataType + promiseNonNullNest: DataType! + } + + schema { + query: DataType + } +`); + +function executeQuery( + query: string, + rootValue: unknown, +): ExecutionResult | Promise { + return execute({ schema, document: parse(query), rootValue }); +} + +function patch(str: string): string { + return str + .replace(/\bsync\b/g, 'promise') + .replace(/\bsyncNonNull\b/g, 'promiseNonNull'); +} + +// avoids also doing any nests +function patchData(data: ExecutionResult): ExecutionResult { + return JSON.parse(patch(JSON.stringify(data))); +} + +async function executeSyncAndAsync(query: string, rootValue: unknown) { + const syncResult = executeSync({ schema, document: parse(query), rootValue }); + const asyncResult = await execute({ + schema, + document: parse(patch(query)), + rootValue, + }); + + expectJSON(asyncResult).toDeepEqual(patchData(syncResult)); + return syncResult; +} + +describe('Execute: handles non-nullable types', () => { + describe('nulls a nullable field', () => { + const query = ` + { + sync + } + `; + + it('that returns null', async () => { + const result = await executeSyncAndAsync(query, nullingData); + expect(result).to.deep.equal({ + data: { sync: null }, + }); + }); + + it('that throws', async () => { + const result = await executeSyncAndAsync(query, throwingData); + expectJSON(result).toDeepEqual({ + data: { sync: null }, + errors: [ + { + message: syncError.message, + path: ['sync'], + locations: [{ line: 3, column: 9 }], + }, + ], + }); + }); + }); + + describe('nulls a returned object that contains a non-nullable field', () => { + const query = ` + { + syncNest { + syncNonNull, + } + } + `; + + it('that returns null', async () => { + const result = await executeSyncAndAsync(query, nullingData); + expectJSON(result).toDeepEqual({ + data: { syncNest: null }, + errors: [ + { + message: + 'Cannot return null for non-nullable field DataType.syncNonNull.', + path: ['syncNest', 'syncNonNull'], + locations: [{ line: 4, column: 11 }], + }, + ], + }); + }); + + it('that throws', async () => { + const result = await executeSyncAndAsync(query, throwingData); + expectJSON(result).toDeepEqual({ + data: { syncNest: null }, + errors: [ + { + message: syncNonNullError.message, + path: ['syncNest', 'syncNonNull'], + locations: [{ line: 4, column: 11 }], + }, + ], + }); + }); + }); + + describe('nulls a complex tree of nullable fields, each', () => { + const query = ` + { + syncNest { + sync + promise + syncNest { sync promise } + promiseNest { sync promise } + } + promiseNest { + sync + promise + syncNest { sync promise } + promiseNest { sync promise } + } + } + `; + const data = { + syncNest: { + sync: null, + promise: null, + syncNest: { sync: null, promise: null }, + promiseNest: { sync: null, promise: null }, + }, + promiseNest: { + sync: null, + promise: null, + syncNest: { sync: null, promise: null }, + promiseNest: { sync: null, promise: null }, + }, + }; + + it('that returns null', async () => { + const result = await executeQuery(query, nullingData); + expect(result).to.deep.equal({ data }); + }); + + it('that throws', async () => { + const result = await executeQuery(query, throwingData); + expectJSON(result).toDeepEqual({ + data, + errors: [ + { + message: syncError.message, + path: ['syncNest', 'sync'], + locations: [{ line: 4, column: 11 }], + }, + { + message: syncError.message, + path: ['syncNest', 'syncNest', 'sync'], + locations: [{ line: 6, column: 22 }], + }, + { + message: syncError.message, + path: ['syncNest', 'promiseNest', 'sync'], + locations: [{ line: 7, column: 25 }], + }, + { + message: syncError.message, + path: ['promiseNest', 'sync'], + locations: [{ line: 10, column: 11 }], + }, + { + message: syncError.message, + path: ['promiseNest', 'syncNest', 'sync'], + locations: [{ line: 12, column: 22 }], + }, + { + message: promiseError.message, + path: ['syncNest', 'promise'], + locations: [{ line: 5, column: 11 }], + }, + { + message: promiseError.message, + path: ['syncNest', 'syncNest', 'promise'], + locations: [{ line: 6, column: 27 }], + }, + { + message: syncError.message, + path: ['promiseNest', 'promiseNest', 'sync'], + locations: [{ line: 13, column: 25 }], + }, + { + message: promiseError.message, + path: ['syncNest', 'promiseNest', 'promise'], + locations: [{ line: 7, column: 30 }], + }, + { + message: promiseError.message, + path: ['promiseNest', 'promise'], + locations: [{ line: 11, column: 11 }], + }, + { + message: promiseError.message, + path: ['promiseNest', 'syncNest', 'promise'], + locations: [{ line: 12, column: 27 }], + }, + { + message: promiseError.message, + path: ['promiseNest', 'promiseNest', 'promise'], + locations: [{ line: 13, column: 30 }], + }, + ], + }); + }); + }); + + describe('nulls the first nullable object after a field in a long chain of non-null fields', () => { + const query = ` + { + syncNest { + syncNonNullNest { + promiseNonNullNest { + syncNonNullNest { + promiseNonNullNest { + syncNonNull + } + } + } + } + } + promiseNest { + syncNonNullNest { + promiseNonNullNest { + syncNonNullNest { + promiseNonNullNest { + syncNonNull + } + } + } + } + } + anotherNest: syncNest { + syncNonNullNest { + promiseNonNullNest { + syncNonNullNest { + promiseNonNullNest { + promiseNonNull + } + } + } + } + } + anotherPromiseNest: promiseNest { + syncNonNullNest { + promiseNonNullNest { + syncNonNullNest { + promiseNonNullNest { + promiseNonNull + } + } + } + } + } + } + `; + const data = { + syncNest: null, + promiseNest: null, + anotherNest: null, + anotherPromiseNest: null, + }; + + it('that returns null', async () => { + const result = await executeQuery(query, nullingData); + expectJSON(result).toDeepEqual({ + data, + errors: [ + { + message: + 'Cannot return null for non-nullable field DataType.syncNonNull.', + path: [ + 'syncNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'syncNonNull', + ], + locations: [{ line: 8, column: 19 }], + }, + { + message: + 'Cannot return null for non-nullable field DataType.syncNonNull.', + path: [ + 'promiseNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'syncNonNull', + ], + locations: [{ line: 19, column: 19 }], + }, + { + message: + 'Cannot return null for non-nullable field DataType.promiseNonNull.', + path: [ + 'anotherNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'promiseNonNull', + ], + locations: [{ line: 30, column: 19 }], + }, + { + message: + 'Cannot return null for non-nullable field DataType.promiseNonNull.', + path: [ + 'anotherPromiseNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'promiseNonNull', + ], + locations: [{ line: 41, column: 19 }], + }, + ], + }); + }); + + it('that throws', async () => { + const result = await executeQuery(query, throwingData); + expectJSON(result).toDeepEqual({ + data, + errors: [ + { + message: syncNonNullError.message, + path: [ + 'syncNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'syncNonNull', + ], + locations: [{ line: 8, column: 19 }], + }, + { + message: syncNonNullError.message, + path: [ + 'promiseNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'syncNonNull', + ], + locations: [{ line: 19, column: 19 }], + }, + { + message: promiseNonNullError.message, + path: [ + 'anotherNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'promiseNonNull', + ], + locations: [{ line: 30, column: 19 }], + }, + { + message: promiseNonNullError.message, + path: [ + 'anotherPromiseNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'syncNonNullNest', + 'promiseNonNullNest', + 'promiseNonNull', + ], + locations: [{ line: 41, column: 19 }], + }, + ], + }); + }); + }); + + describe('nulls the top level if non-nullable field', () => { + const query = ` + { + syncNonNull + } + `; + + it('that returns null', async () => { + const result = await executeSyncAndAsync(query, nullingData); + expectJSON(result).toDeepEqual({ + data: null, + errors: [ + { + message: + 'Cannot return null for non-nullable field DataType.syncNonNull.', + path: ['syncNonNull'], + locations: [{ line: 3, column: 9 }], + }, + ], + }); + }); + + it('that throws', async () => { + const result = await executeSyncAndAsync(query, throwingData); + expectJSON(result).toDeepEqual({ + data: null, + errors: [ + { + message: syncNonNullError.message, + path: ['syncNonNull'], + locations: [{ line: 3, column: 9 }], + }, + ], + }); + }); + }); + + describe('Handles non-null argument', () => { + const schemaWithNonNullArg = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + withNonNullArg: { + type: GraphQLString, + args: { + cannotBeNull: { + type: new GraphQLNonNull(GraphQLString), + }, + }, + resolve: (_, args) => 'Passed: ' + String(args.cannotBeNull), + }, + }, + }), + }); + + it('succeeds when passed non-null literal value', () => { + const result = executeSync({ + schema: schemaWithNonNullArg, + document: parse(` + query { + withNonNullArg (cannotBeNull: "literal value") + } + `), + }); + + expect(result).to.deep.equal({ + data: { + withNonNullArg: 'Passed: literal value', + }, + }); + }); + + it('succeeds when passed non-null variable value', () => { + const result = executeSync({ + schema: schemaWithNonNullArg, + document: parse(` + query ($testVar: String!) { + withNonNullArg (cannotBeNull: $testVar) + } + `), + variableValues: { + testVar: 'variable value', + }, + }); + + expect(result).to.deep.equal({ + data: { + withNonNullArg: 'Passed: variable value', + }, + }); + }); + + it('succeeds when missing variable has default value', () => { + const result = executeSync({ + schema: schemaWithNonNullArg, + document: parse(` + query ($testVar: String = "default value") { + withNonNullArg (cannotBeNull: $testVar) + } + `), + variableValues: { + // Intentionally missing variable + }, + }); + + expect(result).to.deep.equal({ + data: { + withNonNullArg: 'Passed: default value', + }, + }); + }); + + it('field error when missing non-null arg', () => { + // Note: validation should identify this issue first (missing args rule) + // however execution should still protect against this. + const result = executeSync({ + schema: schemaWithNonNullArg, + document: parse(` + query { + withNonNullArg + } + `), + }); + + expectJSON(result).toDeepEqual({ + data: { + withNonNullArg: null, + }, + errors: [ + { + message: + 'Argument "cannotBeNull" of required type "String!" was not provided.', + locations: [{ line: 3, column: 13 }], + path: ['withNonNullArg'], + }, + ], + }); + }); + + it('field error when non-null arg provided null', () => { + // Note: validation should identify this issue first (values of correct + // type rule) however execution should still protect against this. + const result = executeSync({ + schema: schemaWithNonNullArg, + document: parse(` + query { + withNonNullArg(cannotBeNull: null) + } + `), + }); + + expectJSON(result).toDeepEqual({ + data: { + withNonNullArg: null, + }, + errors: [ + { + message: + 'Argument "cannotBeNull" of non-null type "String!" must not be null.', + locations: [{ line: 3, column: 42 }], + path: ['withNonNullArg'], + }, + ], + }); + }); + + it('field error when non-null arg not provided variable value', () => { + // Note: validation should identify this issue first (variables in allowed + // position rule) however execution should still protect against this. + const result = executeSync({ + schema: schemaWithNonNullArg, + document: parse(` + query ($testVar: String) { + withNonNullArg(cannotBeNull: $testVar) + } + `), + variableValues: { + // Intentionally missing variable + }, + }); + + expectJSON(result).toDeepEqual({ + data: { + withNonNullArg: null, + }, + errors: [ + { + message: + 'Argument "cannotBeNull" of required type "String!" was provided the variable "$testVar" which was not provided a runtime value.', + locations: [{ line: 3, column: 42 }], + path: ['withNonNullArg'], + }, + ], + }); + }); + + it('field error when non-null arg provided variable with explicit null value', () => { + const result = executeSync({ + schema: schemaWithNonNullArg, + document: parse(` + query ($testVar: String = "default value") { + withNonNullArg (cannotBeNull: $testVar) + } + `), + variableValues: { + testVar: null, + }, + }); + + expectJSON(result).toDeepEqual({ + data: { + withNonNullArg: null, + }, + errors: [ + { + message: + 'Argument "cannotBeNull" of non-null type "String!" must not be null.', + locations: [{ line: 3, column: 43 }], + path: ['withNonNullArg'], + }, + ], + }); + }); + }); +}); diff --git a/src/execution/__tests__/resolve-test.ts b/src/execution/__tests__/resolve-test.ts new file mode 100644 index 00000000..a34da196 --- /dev/null +++ b/src/execution/__tests__/resolve-test.ts @@ -0,0 +1,129 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { parse } from '../../language/parser'; + +import type { GraphQLFieldConfig } from '../../type/definition'; +import { GraphQLObjectType } from '../../type/definition'; +import { GraphQLInt, GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { executeSync } from '../execute'; + +describe('Execute: resolve function', () => { + function testSchema(testField: GraphQLFieldConfig) { + return new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + test: testField, + }, + }), + }); + } + + it('default function accesses properties', () => { + const result = executeSync({ + schema: testSchema({ type: GraphQLString }), + document: parse('{ test }'), + rootValue: { test: 'testValue' }, + }); + + expect(result).to.deep.equal({ + data: { + test: 'testValue', + }, + }); + }); + + it('default function calls methods', () => { + const rootValue = { + _secret: 'secretValue', + test() { + return this._secret; + }, + }; + + const result = executeSync({ + schema: testSchema({ type: GraphQLString }), + document: parse('{ test }'), + rootValue, + }); + expect(result).to.deep.equal({ + data: { + test: 'secretValue', + }, + }); + }); + + it('default function passes args and context', () => { + class Adder { + _num: number; + + constructor(num: number) { + this._num = num; + } + + test(args: { addend1: number }, context: { addend2: number }) { + return this._num + args.addend1 + context.addend2; + } + } + const rootValue = new Adder(700); + + const schema = testSchema({ + type: GraphQLInt, + args: { + addend1: { type: GraphQLInt }, + }, + }); + const contextValue = { addend2: 9 }; + const document = parse('{ test(addend1: 80) }'); + + const result = executeSync({ schema, document, rootValue, contextValue }); + expect(result).to.deep.equal({ + data: { test: 789 }, + }); + }); + + it('uses provided resolve function', () => { + const schema = testSchema({ + type: GraphQLString, + args: { + aStr: { type: GraphQLString }, + aInt: { type: GraphQLInt }, + }, + resolve: (source, args) => JSON.stringify([source, args]), + }); + + function executeQuery(query: string, rootValue?: unknown) { + const document = parse(query); + return executeSync({ schema, document, rootValue }); + } + + expect(executeQuery('{ test }')).to.deep.equal({ + data: { + test: '[null,{}]', + }, + }); + + expect(executeQuery('{ test }', 'Source!')).to.deep.equal({ + data: { + test: '["Source!",{}]', + }, + }); + + expect(executeQuery('{ test(aStr: "String!") }', 'Source!')).to.deep.equal({ + data: { + test: '["Source!",{"aStr":"String!"}]', + }, + }); + + expect( + executeQuery('{ test(aInt: -123, aStr: "String!") }', 'Source!'), + ).to.deep.equal({ + data: { + test: '["Source!",{"aStr":"String!","aInt":-123}]', + }, + }); + }); +}); diff --git a/src/execution/__tests__/schema-test.ts b/src/execution/__tests__/schema-test.ts new file mode 100644 index 00000000..f9b4e474 --- /dev/null +++ b/src/execution/__tests__/schema-test.ts @@ -0,0 +1,188 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { parse } from '../../language/parser'; + +import { + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, +} from '../../type/definition'; +import { + GraphQLBoolean, + GraphQLID, + GraphQLInt, + GraphQLString, +} from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { executeSync } from '../execute'; + +describe('Execute: Handles execution with a complex schema', () => { + it('executes using a schema', () => { + const BlogImage = new GraphQLObjectType({ + name: 'Image', + fields: { + url: { type: GraphQLString }, + width: { type: GraphQLInt }, + height: { type: GraphQLInt }, + }, + }); + + const BlogAuthor: GraphQLObjectType = new GraphQLObjectType({ + name: 'Author', + fields: () => ({ + id: { type: GraphQLString }, + name: { type: GraphQLString }, + pic: { + args: { width: { type: GraphQLInt }, height: { type: GraphQLInt } }, + type: BlogImage, + resolve: (obj, { width, height }) => obj.pic(width, height), + }, + recentArticle: { type: BlogArticle }, + }), + }); + + const BlogArticle = new GraphQLObjectType({ + name: 'Article', + fields: { + id: { type: new GraphQLNonNull(GraphQLString) }, + isPublished: { type: GraphQLBoolean }, + author: { type: BlogAuthor }, + title: { type: GraphQLString }, + body: { type: GraphQLString }, + keywords: { type: new GraphQLList(GraphQLString) }, + }, + }); + + const BlogQuery = new GraphQLObjectType({ + name: 'Query', + fields: { + article: { + type: BlogArticle, + args: { id: { type: GraphQLID } }, + resolve: (_, { id }) => article(id), + }, + feed: { + type: new GraphQLList(BlogArticle), + resolve: () => [ + article(1), + article(2), + article(3), + article(4), + article(5), + article(6), + article(7), + article(8), + article(9), + article(10), + ], + }, + }, + }); + + const BlogSchema = new GraphQLSchema({ + query: BlogQuery, + }); + + function article(id: number) { + return { + id, + isPublished: true, + author: { + id: 123, + name: 'John Smith', + pic: (width: number, height: number) => getPic(123, width, height), + recentArticle: () => article(1), + }, + title: 'My Article ' + id, + body: 'This is a post', + hidden: 'This data is not exposed in the schema', + keywords: ['foo', 'bar', 1, true, null], + }; + } + + function getPic(uid: number, width: number, height: number) { + return { + url: `cdn://${uid}`, + width: `${width}`, + height: `${height}`, + }; + } + + const document = parse(` + { + feed { + id, + title + }, + article(id: "1") { + ...articleFields, + author { + id, + name, + pic(width: 640, height: 480) { + url, + width, + height + }, + recentArticle { + ...articleFields, + keywords + } + } + } + } + + fragment articleFields on Article { + id, + isPublished, + title, + body, + hidden, + notDefined + } + `); + + // Note: this is intentionally not validating to ensure appropriate + // behavior occurs when executing an invalid query. + expect(executeSync({ schema: BlogSchema, document })).to.deep.equal({ + data: { + feed: [ + { id: '1', title: 'My Article 1' }, + { id: '2', title: 'My Article 2' }, + { id: '3', title: 'My Article 3' }, + { id: '4', title: 'My Article 4' }, + { id: '5', title: 'My Article 5' }, + { id: '6', title: 'My Article 6' }, + { id: '7', title: 'My Article 7' }, + { id: '8', title: 'My Article 8' }, + { id: '9', title: 'My Article 9' }, + { id: '10', title: 'My Article 10' }, + ], + article: { + id: '1', + isPublished: true, + title: 'My Article 1', + body: 'This is a post', + author: { + id: '123', + name: 'John Smith', + pic: { + url: 'cdn://123', + width: 640, + height: 480, + }, + recentArticle: { + id: '1', + isPublished: true, + title: 'My Article 1', + body: 'This is a post', + keywords: ['foo', 'bar', '1', 'true', null], + }, + }, + }, + }, + }); + }); +}); diff --git a/src/execution/__tests__/simplePubSub-test.ts b/src/execution/__tests__/simplePubSub-test.ts new file mode 100644 index 00000000..e919d770 --- /dev/null +++ b/src/execution/__tests__/simplePubSub-test.ts @@ -0,0 +1,55 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { SimplePubSub } from './simplePubSub'; + +describe('SimplePubSub', () => { + it('subscribe async-iterator mock', async () => { + const pubsub = new SimplePubSub(); + const iterator = pubsub.getSubscriber((x) => x); + + // Queue up publishes + expect(pubsub.emit('Apple')).to.equal(true); + expect(pubsub.emit('Banana')).to.equal(true); + + // Read payloads + expect(await iterator.next()).to.deep.equal({ + done: false, + value: 'Apple', + }); + expect(await iterator.next()).to.deep.equal({ + done: false, + value: 'Banana', + }); + + // Read ahead + const i3 = iterator.next().then((x) => x); + const i4 = iterator.next().then((x) => x); + + // Publish + expect(pubsub.emit('Coconut')).to.equal(true); + expect(pubsub.emit('Durian')).to.equal(true); + + // Await out of order to get correct results + expect(await i4).to.deep.equal({ done: false, value: 'Durian' }); + expect(await i3).to.deep.equal({ done: false, value: 'Coconut' }); + + // Read ahead + const i5 = iterator.next().then((x) => x); + + // Terminate queue + await iterator.return(); + + // Publish is not caught after terminate + expect(pubsub.emit('Fig')).to.equal(false); + + // Find that cancelled read-ahead got a "done" result + expect(await i5).to.deep.equal({ done: true, value: undefined }); + + // And next returns empty completion value + expect(await iterator.next()).to.deep.equal({ + done: true, + value: undefined, + }); + }); +}); diff --git a/src/execution/__tests__/simplePubSub.ts b/src/execution/__tests__/simplePubSub.ts new file mode 100644 index 00000000..7efdf40e --- /dev/null +++ b/src/execution/__tests__/simplePubSub.ts @@ -0,0 +1,74 @@ +import { invariant } from '../../jsutils/invariant'; + +/** + * Create an AsyncIterator from an EventEmitter. Useful for mocking a + * PubSub system for tests. + */ +export class SimplePubSub { + private _subscribers: Set<(value: T) => void>; + + constructor() { + this._subscribers = new Set(); + } + + emit(event: T): boolean { + for (const subscriber of this._subscribers) { + subscriber(event); + } + return this._subscribers.size > 0; + } + + getSubscriber(transform: (value: T) => R): AsyncGenerator { + const pullQueue: Array<(result: IteratorResult) => void> = []; + const pushQueue: Array = []; + let listening = true; + this._subscribers.add(pushValue); + + const emptyQueue = () => { + listening = false; + this._subscribers.delete(pushValue); + for (const resolve of pullQueue) { + resolve({ value: undefined, done: true }); + } + pullQueue.length = 0; + pushQueue.length = 0; + }; + + return { + next(): Promise> { + if (!listening) { + return Promise.resolve({ value: undefined, done: true }); + } + + if (pushQueue.length > 0) { + const value = pushQueue[0]; + pushQueue.shift(); + return Promise.resolve({ value, done: false }); + } + return new Promise((resolve) => pullQueue.push(resolve)); + }, + return(): Promise> { + emptyQueue(); + return Promise.resolve({ value: undefined, done: true }); + }, + throw(error: unknown) { + emptyQueue(); + return Promise.reject(error); + }, + [Symbol.asyncIterator]() { + return this; + }, + }; + + function pushValue(event: T): void { + const value: R = transform(event); + if (pullQueue.length > 0) { + const receiver = pullQueue.shift(); + invariant(receiver); + receiver({ value, done: false }); + } else { + pushQueue.push(value); + } + } + } +} diff --git a/src/execution/__tests__/subscribe-test.ts b/src/execution/__tests__/subscribe-test.ts new file mode 100644 index 00000000..54c5019a --- /dev/null +++ b/src/execution/__tests__/subscribe-test.ts @@ -0,0 +1,1022 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../../__testUtils__/expectJSON'; +import { resolveOnNextTick } from '../../__testUtils__/resolveOnNextTick'; + +import { invariant } from '../../jsutils/invariant'; +import { isAsyncIterable } from '../../jsutils/isAsyncIterable'; + +import { parse } from '../../language/parser'; + +import { GraphQLList, GraphQLObjectType } from '../../type/definition'; +import { GraphQLBoolean, GraphQLInt, GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { createSourceEventStream, subscribe } from '../subscribe'; + +import { SimplePubSub } from './simplePubSub'; + +interface Email { + from: string; + subject: string; + message: string; + unread: boolean; +} + +const EmailType = new GraphQLObjectType({ + name: 'Email', + fields: { + from: { type: GraphQLString }, + subject: { type: GraphQLString }, + message: { type: GraphQLString }, + unread: { type: GraphQLBoolean }, + }, +}); + +const InboxType = new GraphQLObjectType({ + name: 'Inbox', + fields: { + total: { + type: GraphQLInt, + resolve: (inbox) => inbox.emails.length, + }, + unread: { + type: GraphQLInt, + resolve: (inbox) => + inbox.emails.filter((email: any) => email.unread).length, + }, + emails: { type: new GraphQLList(EmailType) }, + }, +}); + +const QueryType = new GraphQLObjectType({ + name: 'Query', + fields: { + inbox: { type: InboxType }, + }, +}); + +const EmailEventType = new GraphQLObjectType({ + name: 'EmailEvent', + fields: { + email: { type: EmailType }, + inbox: { type: InboxType }, + }, +}); + +const emailSchema = new GraphQLSchema({ + query: QueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + importantEmail: { + type: EmailEventType, + args: { + priority: { type: GraphQLInt }, + }, + }, + }, + }), +}); + +function createSubscription(pubsub: SimplePubSub) { + const document = parse(` + subscription ($priority: Int = 0) { + importantEmail(priority: $priority) { + email { + from + subject + } + inbox { + unread + total + } + } + } + `); + + const emails = [ + { + from: 'joe@graphql.org', + subject: 'Hello', + message: 'Hello World', + unread: false, + }, + ]; + + const data: any = { + inbox: { emails }, + // FIXME: we shouldn't use mapAsyncIterator here since it makes tests way more complex + importantEmail: pubsub.getSubscriber((newEmail) => { + emails.push(newEmail); + + return { + importantEmail: { + email: newEmail, + inbox: data.inbox, + }, + }; + }), + }; + + return subscribe({ schema: emailSchema, document, rootValue: data }); +} + +async function expectPromise(promise: Promise) { + let caughtError: Error; + + try { + /* c8 ignore next 2 */ + await promise; + expect.fail('promise should have thrown but did not'); + } catch (error) { + caughtError = error; + } + + return { + toReject() { + expect(caughtError).to.be.an.instanceOf(Error); + }, + toRejectWith(message: string) { + expect(caughtError).to.be.an.instanceOf(Error); + expect(caughtError).to.have.property('message', message); + }, + }; +} + +const DummyQueryType = new GraphQLObjectType({ + name: 'Query', + fields: { + dummy: { type: GraphQLString }, + }, +}); + +/* eslint-disable @typescript-eslint/require-await */ +// Check all error cases when initializing the subscription. +describe('Subscription Initialization Phase', () => { + it('accepts multiple subscription fields defined in schema', async () => { + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + foo: { type: GraphQLString }, + bar: { type: GraphQLString }, + }, + }), + }); + + async function* fooGenerator() { + yield { foo: 'FooValue' }; + } + + const subscription = await subscribe({ + schema, + document: parse('subscription { foo }'), + rootValue: { foo: fooGenerator }, + }); + invariant(isAsyncIterable(subscription)); + + expect(await subscription.next()).to.deep.equal({ + done: false, + value: { data: { foo: 'FooValue' } }, + }); + + expect(await subscription.next()).to.deep.equal({ + done: true, + value: undefined, + }); + }); + + it('accepts type definition with sync subscribe function', async () => { + async function* fooGenerator() { + yield { foo: 'FooValue' }; + } + + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + foo: { + type: GraphQLString, + subscribe: fooGenerator, + }, + }, + }), + }); + + const subscription = await subscribe({ + schema, + document: parse('subscription { foo }'), + }); + invariant(isAsyncIterable(subscription)); + + expect(await subscription.next()).to.deep.equal({ + done: false, + value: { data: { foo: 'FooValue' } }, + }); + + expect(await subscription.next()).to.deep.equal({ + done: true, + value: undefined, + }); + }); + + it('accepts type definition with async subscribe function', async () => { + async function* fooGenerator() { + yield { foo: 'FooValue' }; + } + + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + foo: { + type: GraphQLString, + async subscribe() { + await resolveOnNextTick(); + return fooGenerator(); + }, + }, + }, + }), + }); + + const subscription = await subscribe({ + schema, + document: parse('subscription { foo }'), + }); + invariant(isAsyncIterable(subscription)); + + expect(await subscription.next()).to.deep.equal({ + done: false, + value: { data: { foo: 'FooValue' } }, + }); + + expect(await subscription.next()).to.deep.equal({ + done: true, + value: undefined, + }); + }); + + it('uses a custom default subscribeFieldResolver', async () => { + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + foo: { type: GraphQLString }, + }, + }), + }); + + async function* fooGenerator() { + yield { foo: 'FooValue' }; + } + + const subscription = await subscribe({ + schema, + document: parse('subscription { foo }'), + rootValue: { customFoo: fooGenerator }, + subscribeFieldResolver: (root) => root.customFoo(), + }); + invariant(isAsyncIterable(subscription)); + + expect(await subscription.next()).to.deep.equal({ + done: false, + value: { data: { foo: 'FooValue' } }, + }); + + expect(await subscription.next()).to.deep.equal({ + done: true, + value: undefined, + }); + }); + + it('should only resolve the first field of invalid multi-field', async () => { + async function* fooGenerator() { + yield { foo: 'FooValue' }; + } + + let didResolveFoo = false; + let didResolveBar = false; + + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + foo: { + type: GraphQLString, + subscribe() { + didResolveFoo = true; + return fooGenerator(); + }, + }, + bar: { + type: GraphQLString, + /* c8 ignore next 3 */ + subscribe() { + didResolveBar = true; + }, + }, + }, + }), + }); + + const subscription = await subscribe({ + schema, + document: parse('subscription { foo bar }'), + }); + invariant(isAsyncIterable(subscription)); + + expect(didResolveFoo).to.equal(true); + expect(didResolveBar).to.equal(false); + + expect(await subscription.next()).to.have.property('done', false); + + expect(await subscription.next()).to.deep.equal({ + done: true, + value: undefined, + }); + }); + + it('throws an error if some of required arguments are missing', async () => { + const document = parse('subscription { foo }'); + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + foo: { type: GraphQLString }, + }, + }), + }); + + // @ts-expect-error (schema must not be null) + (await expectPromise(subscribe({ schema: null, document }))).toRejectWith( + 'Expected null to be a GraphQL schema.', + ); + + // @ts-expect-error + (await expectPromise(subscribe({ document }))).toRejectWith( + 'Expected undefined to be a GraphQL schema.', + ); + + // @ts-expect-error (document must not be null) + (await expectPromise(subscribe({ schema, document: null }))).toRejectWith( + 'Must provide document.', + ); + + // @ts-expect-error + (await expectPromise(subscribe({ schema }))).toRejectWith( + 'Must provide document.', + ); + }); + + it('resolves to an error if schema does not support subscriptions', async () => { + const schema = new GraphQLSchema({ query: DummyQueryType }); + const document = parse('subscription { unknownField }'); + + const result = await subscribe({ schema, document }); + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Schema is not configured to execute subscription operation.', + locations: [{ line: 1, column: 1 }], + }, + ], + }); + }); + + it('resolves to an error for unknown subscription field', async () => { + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + foo: { type: GraphQLString }, + }, + }), + }); + const document = parse('subscription { unknownField }'); + + const result = await subscribe({ schema, document }); + expectJSON(result).toDeepEqual({ + errors: [ + { + message: 'The subscription field "unknownField" is not defined.', + locations: [{ line: 1, column: 16 }], + }, + ], + }); + }); + + it('should pass through unexpected errors thrown in subscribe', async () => { + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + foo: { type: GraphQLString }, + }, + }), + }); + + // @ts-expect-error + (await expectPromise(subscribe({ schema, document: {} }))).toReject(); + }); + + it('throws an error if subscribe does not return an iterator', async () => { + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + foo: { + type: GraphQLString, + subscribe: () => 'test', + }, + }, + }), + }); + + const document = parse('subscription { foo }'); + + (await expectPromise(subscribe({ schema, document }))).toRejectWith( + 'Subscription field must return Async Iterable. Received: "test".', + ); + }); + + it('resolves to an error for subscription resolver errors', async () => { + async function subscribeWithFn(subscribeFn: () => unknown) { + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + foo: { type: GraphQLString, subscribe: subscribeFn }, + }, + }), + }); + const document = parse('subscription { foo }'); + const result = await subscribe({ schema, document }); + + expectJSON(await createSourceEventStream(schema, document)).toDeepEqual( + result, + ); + return result; + } + + const expectedResult = { + errors: [ + { + message: 'test error', + locations: [{ line: 1, column: 16 }], + path: ['foo'], + }, + ], + }; + + expectJSON( + // Returning an error + await subscribeWithFn(() => new Error('test error')), + ).toDeepEqual(expectedResult); + + expectJSON( + // Throwing an error + await subscribeWithFn(() => { + throw new Error('test error'); + }), + ).toDeepEqual(expectedResult); + + expectJSON( + // Resolving to an error + await subscribeWithFn(() => Promise.resolve(new Error('test error'))), + ).toDeepEqual(expectedResult); + + expectJSON( + // Rejecting with an error + await subscribeWithFn(() => Promise.reject(new Error('test error'))), + ).toDeepEqual(expectedResult); + }); + + it('resolves to an error if variables were wrong type', async () => { + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + foo: { + type: GraphQLString, + args: { arg: { type: GraphQLInt } }, + }, + }, + }), + }); + + const variableValues = { arg: 'meow' }; + const document = parse(` + subscription ($arg: Int) { + foo(arg: $arg) + } + `); + + // If we receive variables that cannot be coerced correctly, subscribe() will + // resolve to an ExecutionResult that contains an informative error description. + const result = await subscribe({ schema, document, variableValues }); + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$arg" got invalid value "meow"; Int cannot represent non-integer value: "meow"', + locations: [{ line: 2, column: 21 }], + }, + ], + }); + }); +}); + +// Once a subscription returns a valid AsyncIterator, it can still yield errors. +describe('Subscription Publish Phase', () => { + it('produces a payload for multiple subscribe in same subscription', async () => { + const pubsub = new SimplePubSub(); + + const subscription = await createSubscription(pubsub); + invariant(isAsyncIterable(subscription)); + + const secondSubscription = await createSubscription(pubsub); + invariant(isAsyncIterable(secondSubscription)); + + const payload1 = subscription.next(); + const payload2 = secondSubscription.next(); + + expect( + pubsub.emit({ + from: 'yuzhi@graphql.org', + subject: 'Alright', + message: 'Tests are good', + unread: true, + }), + ).to.equal(true); + + const expectedPayload = { + done: false, + value: { + data: { + importantEmail: { + email: { + from: 'yuzhi@graphql.org', + subject: 'Alright', + }, + inbox: { + unread: 1, + total: 2, + }, + }, + }, + }, + }; + + expect(await payload1).to.deep.equal(expectedPayload); + expect(await payload2).to.deep.equal(expectedPayload); + }); + + it('produces a payload per subscription event', async () => { + const pubsub = new SimplePubSub(); + const subscription = await createSubscription(pubsub); + invariant(isAsyncIterable(subscription)); + + // Wait for the next subscription payload. + const payload = subscription.next(); + + // A new email arrives! + expect( + pubsub.emit({ + from: 'yuzhi@graphql.org', + subject: 'Alright', + message: 'Tests are good', + unread: true, + }), + ).to.equal(true); + + // The previously waited on payload now has a value. + expect(await payload).to.deep.equal({ + done: false, + value: { + data: { + importantEmail: { + email: { + from: 'yuzhi@graphql.org', + subject: 'Alright', + }, + inbox: { + unread: 1, + total: 2, + }, + }, + }, + }, + }); + + // Another new email arrives, before subscription.next() is called. + expect( + pubsub.emit({ + from: 'hyo@graphql.org', + subject: 'Tools', + message: 'I <3 making things', + unread: true, + }), + ).to.equal(true); + + // The next waited on payload will have a value. + expect(await subscription.next()).to.deep.equal({ + done: false, + value: { + data: { + importantEmail: { + email: { + from: 'hyo@graphql.org', + subject: 'Tools', + }, + inbox: { + unread: 2, + total: 3, + }, + }, + }, + }, + }); + + // The client decides to disconnect. + expect(await subscription.return()).to.deep.equal({ + done: true, + value: undefined, + }); + + // Which may result in disconnecting upstream services as well. + expect( + pubsub.emit({ + from: 'adam@graphql.org', + subject: 'Important', + message: 'Read me please', + unread: true, + }), + ).to.equal(false); // No more listeners. + + // Awaiting a subscription after closing it results in completed results. + expect(await subscription.next()).to.deep.equal({ + done: true, + value: undefined, + }); + }); + + it('produces a payload when there are multiple events', async () => { + const pubsub = new SimplePubSub(); + const subscription = await createSubscription(pubsub); + invariant(isAsyncIterable(subscription)); + + let payload = subscription.next(); + + // A new email arrives! + expect( + pubsub.emit({ + from: 'yuzhi@graphql.org', + subject: 'Alright', + message: 'Tests are good', + unread: true, + }), + ).to.equal(true); + + expect(await payload).to.deep.equal({ + done: false, + value: { + data: { + importantEmail: { + email: { + from: 'yuzhi@graphql.org', + subject: 'Alright', + }, + inbox: { + unread: 1, + total: 2, + }, + }, + }, + }, + }); + + payload = subscription.next(); + + // A new email arrives! + expect( + pubsub.emit({ + from: 'yuzhi@graphql.org', + subject: 'Alright 2', + message: 'Tests are good 2', + unread: true, + }), + ).to.equal(true); + + expect(await payload).to.deep.equal({ + done: false, + value: { + data: { + importantEmail: { + email: { + from: 'yuzhi@graphql.org', + subject: 'Alright 2', + }, + inbox: { + unread: 2, + total: 3, + }, + }, + }, + }, + }); + }); + + it('should not trigger when subscription is already done', async () => { + const pubsub = new SimplePubSub(); + const subscription = await createSubscription(pubsub); + invariant(isAsyncIterable(subscription)); + + let payload = subscription.next(); + + // A new email arrives! + expect( + pubsub.emit({ + from: 'yuzhi@graphql.org', + subject: 'Alright', + message: 'Tests are good', + unread: true, + }), + ).to.equal(true); + + expect(await payload).to.deep.equal({ + done: false, + value: { + data: { + importantEmail: { + email: { + from: 'yuzhi@graphql.org', + subject: 'Alright', + }, + inbox: { + unread: 1, + total: 2, + }, + }, + }, + }, + }); + + payload = subscription.next(); + await subscription.return(); + + // A new email arrives! + expect( + pubsub.emit({ + from: 'yuzhi@graphql.org', + subject: 'Alright 2', + message: 'Tests are good 2', + unread: true, + }), + ).to.equal(false); + + expect(await payload).to.deep.equal({ + done: true, + value: undefined, + }); + }); + + it('should not trigger when subscription is thrown', async () => { + const pubsub = new SimplePubSub(); + const subscription = await createSubscription(pubsub); + invariant(isAsyncIterable(subscription)); + + let payload = subscription.next(); + + // A new email arrives! + expect( + pubsub.emit({ + from: 'yuzhi@graphql.org', + subject: 'Alright', + message: 'Tests are good', + unread: true, + }), + ).to.equal(true); + + expect(await payload).to.deep.equal({ + done: false, + value: { + data: { + importantEmail: { + email: { + from: 'yuzhi@graphql.org', + subject: 'Alright', + }, + inbox: { + unread: 1, + total: 2, + }, + }, + }, + }, + }); + + payload = subscription.next(); + + // Throw error + let caughtError; + try { + /* c8 ignore next */ + await subscription.throw('ouch'); + } catch (e) { + caughtError = e; + } + expect(caughtError).to.equal('ouch'); + + expect(await payload).to.deep.equal({ + done: true, + value: undefined, + }); + }); + + it('event order is correct for multiple publishes', async () => { + const pubsub = new SimplePubSub(); + const subscription = await createSubscription(pubsub); + invariant(isAsyncIterable(subscription)); + + let payload = subscription.next(); + + // A new email arrives! + expect( + pubsub.emit({ + from: 'yuzhi@graphql.org', + subject: 'Message', + message: 'Tests are good', + unread: true, + }), + ).to.equal(true); + + // A new email arrives! + expect( + pubsub.emit({ + from: 'yuzhi@graphql.org', + subject: 'Message 2', + message: 'Tests are good 2', + unread: true, + }), + ).to.equal(true); + + expect(await payload).to.deep.equal({ + done: false, + value: { + data: { + importantEmail: { + email: { + from: 'yuzhi@graphql.org', + subject: 'Message', + }, + inbox: { + unread: 2, + total: 3, + }, + }, + }, + }, + }); + + payload = subscription.next(); + + expect(await payload).to.deep.equal({ + done: false, + value: { + data: { + importantEmail: { + email: { + from: 'yuzhi@graphql.org', + subject: 'Message 2', + }, + inbox: { + unread: 2, + total: 3, + }, + }, + }, + }, + }); + }); + + it('should handle error during execution of source event', async () => { + async function* generateMessages() { + yield 'Hello'; + yield 'Goodbye'; + yield 'Bonjour'; + } + + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + newMessage: { + type: GraphQLString, + subscribe: generateMessages, + resolve(message) { + if (message === 'Goodbye') { + throw new Error('Never leave.'); + } + return message; + }, + }, + }, + }), + }); + + const document = parse('subscription { newMessage }'); + const subscription = await subscribe({ schema, document }); + invariant(isAsyncIterable(subscription)); + + expect(await subscription.next()).to.deep.equal({ + done: false, + value: { + data: { newMessage: 'Hello' }, + }, + }); + + // An error in execution is presented as such. + expectJSON(await subscription.next()).toDeepEqual({ + done: false, + value: { + data: { newMessage: null }, + errors: [ + { + message: 'Never leave.', + locations: [{ line: 1, column: 16 }], + path: ['newMessage'], + }, + ], + }, + }); + + // However that does not close the response event stream. + // Subsequent events are still executed. + expectJSON(await subscription.next()).toDeepEqual({ + done: false, + value: { + data: { newMessage: 'Bonjour' }, + }, + }); + + expectJSON(await subscription.next()).toDeepEqual({ + done: true, + value: undefined, + }); + }); + + it('should pass through error thrown in source event stream', async () => { + async function* generateMessages() { + yield 'Hello'; + throw new Error('test error'); + } + + const schema = new GraphQLSchema({ + query: DummyQueryType, + subscription: new GraphQLObjectType({ + name: 'Subscription', + fields: { + newMessage: { + type: GraphQLString, + resolve: (message) => message, + subscribe: generateMessages, + }, + }, + }), + }); + + const document = parse('subscription { newMessage }'); + const subscription = await subscribe({ schema, document }); + invariant(isAsyncIterable(subscription)); + + expect(await subscription.next()).to.deep.equal({ + done: false, + value: { + data: { newMessage: 'Hello' }, + }, + }); + + (await expectPromise(subscription.next())).toRejectWith('test error'); + + expect(await subscription.next()).to.deep.equal({ + done: true, + value: undefined, + }); + }); +}); diff --git a/src/execution/__tests__/sync-test.ts b/src/execution/__tests__/sync-test.ts new file mode 100644 index 00000000..021f09fa --- /dev/null +++ b/src/execution/__tests__/sync-test.ts @@ -0,0 +1,177 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../../__testUtils__/expectJSON'; + +import { parse } from '../../language/parser'; + +import { GraphQLObjectType } from '../../type/definition'; +import { GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { validate } from '../../validation/validate'; + +import { graphqlSync } from '../../graphql'; + +import { execute, executeSync } from '../execute'; + +describe('Execute: synchronously when possible', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + syncField: { + type: GraphQLString, + resolve(rootValue) { + return rootValue; + }, + }, + asyncField: { + type: GraphQLString, + resolve(rootValue) { + return Promise.resolve(rootValue); + }, + }, + }, + }), + mutation: new GraphQLObjectType({ + name: 'Mutation', + fields: { + syncMutationField: { + type: GraphQLString, + resolve(rootValue) { + return rootValue; + }, + }, + }, + }), + }); + + it('does not return a Promise for initial errors', () => { + const doc = 'fragment Example on Query { syncField }'; + const result = execute({ + schema, + document: parse(doc), + rootValue: 'rootValue', + }); + expectJSON(result).toDeepEqual({ + errors: [{ message: 'Must provide an operation.' }], + }); + }); + + it('does not return a Promise if fields are all synchronous', () => { + const doc = 'query Example { syncField }'; + const result = execute({ + schema, + document: parse(doc), + rootValue: 'rootValue', + }); + expect(result).to.deep.equal({ data: { syncField: 'rootValue' } }); + }); + + it('does not return a Promise if mutation fields are all synchronous', () => { + const doc = 'mutation Example { syncMutationField }'; + const result = execute({ + schema, + document: parse(doc), + rootValue: 'rootValue', + }); + expect(result).to.deep.equal({ data: { syncMutationField: 'rootValue' } }); + }); + + it('returns a Promise if any field is asynchronous', async () => { + const doc = 'query Example { syncField, asyncField }'; + const result = execute({ + schema, + document: parse(doc), + rootValue: 'rootValue', + }); + expect(result).to.be.instanceOf(Promise); + expect(await result).to.deep.equal({ + data: { syncField: 'rootValue', asyncField: 'rootValue' }, + }); + }); + + describe('executeSync', () => { + it('does not return a Promise for sync execution', () => { + const doc = 'query Example { syncField }'; + const result = executeSync({ + schema, + document: parse(doc), + rootValue: 'rootValue', + }); + expect(result).to.deep.equal({ data: { syncField: 'rootValue' } }); + }); + + it('throws if encountering async execution', () => { + const doc = 'query Example { syncField, asyncField }'; + expect(() => { + executeSync({ + schema, + document: parse(doc), + rootValue: 'rootValue', + }); + }).to.throw('GraphQL execution failed to complete synchronously.'); + }); + }); + + describe('graphqlSync', () => { + it('report errors raised during schema validation', () => { + const badSchema = new GraphQLSchema({}); + const result = graphqlSync({ + schema: badSchema, + source: '{ __typename }', + }); + expectJSON(result).toDeepEqual({ + errors: [{ message: 'Query root type must be provided.' }], + }); + }); + + it('does not return a Promise for syntax errors', () => { + const doc = 'fragment Example on Query { { { syncField }'; + const result = graphqlSync({ + schema, + source: doc, + }); + expectJSON(result).toDeepEqual({ + errors: [ + { + message: 'Syntax Error: Expected Name, found "{".', + locations: [{ line: 1, column: 29 }], + }, + ], + }); + }); + + it('does not return a Promise for validation errors', () => { + const doc = 'fragment Example on Query { unknownField }'; + const validationErrors = validate(schema, parse(doc)); + const result = graphqlSync({ + schema, + source: doc, + }); + expect(result).to.deep.equal({ errors: validationErrors }); + }); + + it('does not return a Promise for sync execution', () => { + const doc = 'query Example { syncField }'; + const result = graphqlSync({ + schema, + source: doc, + rootValue: 'rootValue', + }); + expect(result).to.deep.equal({ data: { syncField: 'rootValue' } }); + }); + + it('throws if encountering async execution', () => { + const doc = 'query Example { syncField, asyncField }'; + expect(() => { + graphqlSync({ + schema, + source: doc, + rootValue: 'rootValue', + }); + }).to.throw('GraphQL execution failed to complete synchronously.'); + }); + }); +}); diff --git a/src/execution/__tests__/union-interface-test.ts b/src/execution/__tests__/union-interface-test.ts new file mode 100644 index 00000000..7ce9f8b3 --- /dev/null +++ b/src/execution/__tests__/union-interface-test.ts @@ -0,0 +1,548 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { parse } from '../../language/parser'; + +import { + GraphQLInterfaceType, + GraphQLList, + GraphQLObjectType, + GraphQLUnionType, +} from '../../type/definition'; +import { GraphQLBoolean, GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { executeSync } from '../execute'; + +class Dog { + name: string; + barks: boolean; + mother?: Dog; + father?: Dog; + progeny: ReadonlyArray; + + constructor(name: string, barks: boolean) { + this.name = name; + this.barks = barks; + this.progeny = []; + } +} + +class Cat { + name: string; + meows: boolean; + mother?: Cat; + father?: Cat; + progeny: ReadonlyArray; + + constructor(name: string, meows: boolean) { + this.name = name; + this.meows = meows; + this.progeny = []; + } +} + +class Person { + name: string; + pets?: ReadonlyArray; + friends?: ReadonlyArray; + + constructor( + name: string, + pets?: ReadonlyArray, + friends?: ReadonlyArray, + ) { + this.name = name; + this.pets = pets; + this.friends = friends; + } +} + +const NamedType = new GraphQLInterfaceType({ + name: 'Named', + fields: { + name: { type: GraphQLString }, + }, +}); + +const LifeType: GraphQLInterfaceType = new GraphQLInterfaceType({ + name: 'Life', + fields: () => ({ + progeny: { type: new GraphQLList(LifeType) }, + }), +}); + +const MammalType: GraphQLInterfaceType = new GraphQLInterfaceType({ + name: 'Mammal', + interfaces: [LifeType], + fields: () => ({ + progeny: { type: new GraphQLList(MammalType) }, + mother: { type: MammalType }, + father: { type: MammalType }, + }), +}); + +const DogType: GraphQLObjectType = new GraphQLObjectType({ + name: 'Dog', + interfaces: [MammalType, LifeType, NamedType], + fields: () => ({ + name: { type: GraphQLString }, + barks: { type: GraphQLBoolean }, + progeny: { type: new GraphQLList(DogType) }, + mother: { type: DogType }, + father: { type: DogType }, + }), + isTypeOf: (value) => value instanceof Dog, +}); + +const CatType: GraphQLObjectType = new GraphQLObjectType({ + name: 'Cat', + interfaces: [MammalType, LifeType, NamedType], + fields: () => ({ + name: { type: GraphQLString }, + meows: { type: GraphQLBoolean }, + progeny: { type: new GraphQLList(CatType) }, + mother: { type: CatType }, + father: { type: CatType }, + }), + isTypeOf: (value) => value instanceof Cat, +}); + +const PetType = new GraphQLUnionType({ + name: 'Pet', + types: [DogType, CatType], + resolveType(value) { + if (value instanceof Dog) { + return DogType.name; + } + if (value instanceof Cat) { + return CatType.name; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + expect.fail('Not reachable'); + }, +}); + +const PersonType: GraphQLObjectType = new GraphQLObjectType({ + name: 'Person', + interfaces: [NamedType, MammalType, LifeType], + fields: () => ({ + name: { type: GraphQLString }, + pets: { type: new GraphQLList(PetType) }, + friends: { type: new GraphQLList(NamedType) }, + progeny: { type: new GraphQLList(PersonType) }, + mother: { type: PersonType }, + father: { type: PersonType }, + }), + isTypeOf: (value) => value instanceof Person, +}); + +const schema = new GraphQLSchema({ + query: PersonType, + types: [PetType], +}); + +const garfield = new Cat('Garfield', false); +garfield.mother = new Cat("Garfield's Mom", false); +garfield.mother.progeny = [garfield]; + +const odie = new Dog('Odie', true); +odie.mother = new Dog("Odie's Mom", true); +odie.mother.progeny = [odie]; + +const liz = new Person('Liz'); +const john = new Person('John', [garfield, odie], [liz, odie]); + +describe('Execute: Union and intersection types', () => { + it('can introspect on union and intersection types', () => { + const document = parse(` + { + Named: __type(name: "Named") { + kind + name + fields { name } + interfaces { name } + possibleTypes { name } + enumValues { name } + inputFields { name } + } + Mammal: __type(name: "Mammal") { + kind + name + fields { name } + interfaces { name } + possibleTypes { name } + enumValues { name } + inputFields { name } + } + Pet: __type(name: "Pet") { + kind + name + fields { name } + interfaces { name } + possibleTypes { name } + enumValues { name } + inputFields { name } + } + } + `); + + expect(executeSync({ schema, document })).to.deep.equal({ + data: { + Named: { + kind: 'INTERFACE', + name: 'Named', + fields: [{ name: 'name' }], + interfaces: [], + possibleTypes: [{ name: 'Dog' }, { name: 'Cat' }, { name: 'Person' }], + enumValues: null, + inputFields: null, + }, + Mammal: { + kind: 'INTERFACE', + name: 'Mammal', + fields: [{ name: 'progeny' }, { name: 'mother' }, { name: 'father' }], + interfaces: [{ name: 'Life' }], + possibleTypes: [{ name: 'Dog' }, { name: 'Cat' }, { name: 'Person' }], + enumValues: null, + inputFields: null, + }, + Pet: { + kind: 'UNION', + name: 'Pet', + fields: null, + interfaces: null, + possibleTypes: [{ name: 'Dog' }, { name: 'Cat' }], + enumValues: null, + inputFields: null, + }, + }, + }); + }); + + it('executes using union types', () => { + // NOTE: This is an *invalid* query, but it should be an *executable* query. + const document = parse(` + { + __typename + name + pets { + __typename + name + barks + meows + } + } + `); + + expect(executeSync({ schema, document, rootValue: john })).to.deep.equal({ + data: { + __typename: 'Person', + name: 'John', + pets: [ + { + __typename: 'Cat', + name: 'Garfield', + meows: false, + }, + { + __typename: 'Dog', + name: 'Odie', + barks: true, + }, + ], + }, + }); + }); + + it('executes union types with inline fragments', () => { + // This is the valid version of the query in the above test. + const document = parse(` + { + __typename + name + pets { + __typename + ... on Dog { + name + barks + } + ... on Cat { + name + meows + } + } + } + `); + + expect(executeSync({ schema, document, rootValue: john })).to.deep.equal({ + data: { + __typename: 'Person', + name: 'John', + pets: [ + { + __typename: 'Cat', + name: 'Garfield', + meows: false, + }, + { + __typename: 'Dog', + name: 'Odie', + barks: true, + }, + ], + }, + }); + }); + + it('executes using interface types', () => { + // NOTE: This is an *invalid* query, but it should be an *executable* query. + const document = parse(` + { + __typename + name + friends { + __typename + name + barks + meows + } + } + `); + + expect(executeSync({ schema, document, rootValue: john })).to.deep.equal({ + data: { + __typename: 'Person', + name: 'John', + friends: [ + { __typename: 'Person', name: 'Liz' }, + { __typename: 'Dog', name: 'Odie', barks: true }, + ], + }, + }); + }); + + it('executes interface types with inline fragments', () => { + // This is the valid version of the query in the above test. + const document = parse(` + { + __typename + name + friends { + __typename + name + ... on Dog { + barks + } + ... on Cat { + meows + } + + ... on Mammal { + mother { + __typename + ... on Dog { + name + barks + } + ... on Cat { + name + meows + } + } + } + } + } + `); + + expect(executeSync({ schema, document, rootValue: john })).to.deep.equal({ + data: { + __typename: 'Person', + name: 'John', + friends: [ + { + __typename: 'Person', + name: 'Liz', + mother: null, + }, + { + __typename: 'Dog', + name: 'Odie', + barks: true, + mother: { __typename: 'Dog', name: "Odie's Mom", barks: true }, + }, + ], + }, + }); + }); + + it('executes interface types with named fragments', () => { + const document = parse(` + { + __typename + name + friends { + __typename + name + ...DogBarks + ...CatMeows + } + } + + fragment DogBarks on Dog { + barks + } + + fragment CatMeows on Cat { + meows + } + `); + + expect(executeSync({ schema, document, rootValue: john })).to.deep.equal({ + data: { + __typename: 'Person', + name: 'John', + friends: [ + { + __typename: 'Person', + name: 'Liz', + }, + { + __typename: 'Dog', + name: 'Odie', + barks: true, + }, + ], + }, + }); + }); + + it('allows fragment conditions to be abstract types', () => { + const document = parse(` + { + __typename + name + pets { + ...PetFields, + ...on Mammal { + mother { + ...ProgenyFields + } + } + } + friends { ...FriendFields } + } + + fragment PetFields on Pet { + __typename + ... on Dog { + name + barks + } + ... on Cat { + name + meows + } + } + + fragment FriendFields on Named { + __typename + name + ... on Dog { + barks + } + ... on Cat { + meows + } + } + + fragment ProgenyFields on Life { + progeny { + __typename + } + } + `); + + expect(executeSync({ schema, document, rootValue: john })).to.deep.equal({ + data: { + __typename: 'Person', + name: 'John', + pets: [ + { + __typename: 'Cat', + name: 'Garfield', + meows: false, + mother: { progeny: [{ __typename: 'Cat' }] }, + }, + { + __typename: 'Dog', + name: 'Odie', + barks: true, + mother: { progeny: [{ __typename: 'Dog' }] }, + }, + ], + friends: [ + { + __typename: 'Person', + name: 'Liz', + }, + { + __typename: 'Dog', + name: 'Odie', + barks: true, + }, + ], + }, + }); + }); + + it('gets execution info in resolver', () => { + let encounteredContext; + let encounteredSchema; + let encounteredRootValue; + + const NamedType2: GraphQLInterfaceType = new GraphQLInterfaceType({ + name: 'Named', + fields: { + name: { type: GraphQLString }, + }, + resolveType(_source, context, info) { + encounteredContext = context; + encounteredSchema = info.schema; + encounteredRootValue = info.rootValue; + return PersonType2.name; + }, + }); + + const PersonType2: GraphQLObjectType = new GraphQLObjectType({ + name: 'Person', + interfaces: [NamedType2], + fields: { + name: { type: GraphQLString }, + friends: { type: new GraphQLList(NamedType2) }, + }, + }); + const schema2 = new GraphQLSchema({ query: PersonType2 }); + const document = parse('{ name, friends { name } }'); + const rootValue = new Person('John', [], [liz]); + const contextValue = { authToken: '123abc' }; + + const result = executeSync({ + schema: schema2, + document, + rootValue, + contextValue, + }); + expect(result).to.deep.equal({ + data: { + name: 'John', + friends: [{ name: 'Liz' }], + }, + }); + + expect(encounteredSchema).to.equal(schema2); + expect(encounteredRootValue).to.equal(rootValue); + expect(encounteredContext).to.equal(contextValue); + }); +}); diff --git a/src/execution/__tests__/variables-test.ts b/src/execution/__tests__/variables-test.ts new file mode 100644 index 00000000..786a4810 --- /dev/null +++ b/src/execution/__tests__/variables-test.ts @@ -0,0 +1,1080 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../../__testUtils__/expectJSON'; + +import { inspect } from '../../jsutils/inspect'; +import { invariant } from '../../jsutils/invariant'; + +import { Kind } from '../../language/kinds'; +import { parse } from '../../language/parser'; + +import type { + GraphQLArgumentConfig, + GraphQLFieldConfig, +} from '../../type/definition'; +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLScalarType, +} from '../../type/definition'; +import { GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { executeSync } from '../execute'; +import { getVariableValues } from '../values'; + +const TestComplexScalar = new GraphQLScalarType({ + name: 'ComplexScalar', + parseValue(value) { + expect(value).to.equal('SerializedValue'); + return 'DeserializedValue'; + }, + parseLiteral(ast) { + expect(ast).to.include({ kind: 'StringValue', value: 'SerializedValue' }); + return 'DeserializedValue'; + }, +}); + +const TestInputObject = new GraphQLInputObjectType({ + name: 'TestInputObject', + fields: { + a: { type: GraphQLString }, + b: { type: new GraphQLList(GraphQLString) }, + c: { type: new GraphQLNonNull(GraphQLString) }, + d: { type: TestComplexScalar }, + }, +}); + +const TestNestedInputObject = new GraphQLInputObjectType({ + name: 'TestNestedInputObject', + fields: { + na: { type: new GraphQLNonNull(TestInputObject) }, + nb: { type: new GraphQLNonNull(GraphQLString) }, + }, +}); + +const TestEnum = new GraphQLEnumType({ + name: 'TestEnum', + values: { + NULL: { value: null }, + UNDEFINED: { value: undefined }, + NAN: { value: NaN }, + FALSE: { value: false }, + CUSTOM: { value: 'custom value' }, + DEFAULT_VALUE: {}, + }, +}); + +function fieldWithInputArg( + inputArg: GraphQLArgumentConfig, +): GraphQLFieldConfig { + return { + type: GraphQLString, + args: { input: inputArg }, + resolve(_, args) { + if ('input' in args) { + return inspect(args.input); + } + }, + }; +} + +const TestType = new GraphQLObjectType({ + name: 'TestType', + fields: { + fieldWithEnumInput: fieldWithInputArg({ type: TestEnum }), + fieldWithNonNullableEnumInput: fieldWithInputArg({ + type: new GraphQLNonNull(TestEnum), + }), + fieldWithObjectInput: fieldWithInputArg({ type: TestInputObject }), + fieldWithNullableStringInput: fieldWithInputArg({ type: GraphQLString }), + fieldWithNonNullableStringInput: fieldWithInputArg({ + type: new GraphQLNonNull(GraphQLString), + }), + fieldWithDefaultArgumentValue: fieldWithInputArg({ + type: GraphQLString, + defaultValue: 'Hello World', + }), + fieldWithNonNullableStringInputAndDefaultArgumentValue: fieldWithInputArg({ + type: new GraphQLNonNull(GraphQLString), + defaultValue: 'Hello World', + }), + fieldWithNestedInputObject: fieldWithInputArg({ + type: TestNestedInputObject, + defaultValue: 'Hello World', + }), + list: fieldWithInputArg({ type: new GraphQLList(GraphQLString) }), + nnList: fieldWithInputArg({ + type: new GraphQLNonNull(new GraphQLList(GraphQLString)), + }), + listNN: fieldWithInputArg({ + type: new GraphQLList(new GraphQLNonNull(GraphQLString)), + }), + nnListNN: fieldWithInputArg({ + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(GraphQLString)), + ), + }), + }, +}); + +const schema = new GraphQLSchema({ query: TestType }); + +function executeQuery( + query: string, + variableValues?: { [variable: string]: unknown }, +) { + const document = parse(query); + return executeSync({ schema, document, variableValues }); +} + +describe('Execute: Handles inputs', () => { + describe('Handles objects and nullability', () => { + describe('using inline structs', () => { + it('executes with complex input', () => { + const result = executeQuery(` + { + fieldWithObjectInput(input: {a: "foo", b: ["bar"], c: "baz"}) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithObjectInput: '{ a: "foo", b: ["bar"], c: "baz" }', + }, + }); + }); + + it('properly parses single value to list', () => { + const result = executeQuery(` + { + fieldWithObjectInput(input: {a: "foo", b: "bar", c: "baz"}) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithObjectInput: '{ a: "foo", b: ["bar"], c: "baz" }', + }, + }); + }); + + it('properly parses null value to null', () => { + const result = executeQuery(` + { + fieldWithObjectInput(input: {a: null, b: null, c: "C", d: null}) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithObjectInput: '{ a: null, b: null, c: "C", d: null }', + }, + }); + }); + + it('properly parses null value in list', () => { + const result = executeQuery(` + { + fieldWithObjectInput(input: {b: ["A",null,"C"], c: "C"}) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithObjectInput: '{ b: ["A", null, "C"], c: "C" }', + }, + }); + }); + + it('does not use incorrect value', () => { + const result = executeQuery(` + { + fieldWithObjectInput(input: ["foo", "bar", "baz"]) + } + `); + + expectJSON(result).toDeepEqual({ + data: { + fieldWithObjectInput: null, + }, + errors: [ + { + message: + 'Argument "input" has invalid value ["foo", "bar", "baz"].', + path: ['fieldWithObjectInput'], + locations: [{ line: 3, column: 41 }], + }, + ], + }); + }); + + it('properly runs parseLiteral on complex scalar types', () => { + const result = executeQuery(` + { + fieldWithObjectInput(input: {c: "foo", d: "SerializedValue"}) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithObjectInput: '{ c: "foo", d: "DeserializedValue" }', + }, + }); + }); + }); + + describe('using variables', () => { + const doc = ` + query ($input: TestInputObject) { + fieldWithObjectInput(input: $input) + } + `; + + it('executes with complex input', () => { + const params = { input: { a: 'foo', b: ['bar'], c: 'baz' } }; + const result = executeQuery(doc, params); + + expect(result).to.deep.equal({ + data: { + fieldWithObjectInput: '{ a: "foo", b: ["bar"], c: "baz" }', + }, + }); + }); + + it('uses undefined when variable not provided', () => { + const result = executeQuery( + ` + query q($input: String) { + fieldWithNullableStringInput(input: $input) + }`, + { + // Intentionally missing variable values. + }, + ); + + expect(result).to.deep.equal({ + data: { + fieldWithNullableStringInput: null, + }, + }); + }); + + it('uses null when variable provided explicit null value', () => { + const result = executeQuery( + ` + query q($input: String) { + fieldWithNullableStringInput(input: $input) + }`, + { input: null }, + ); + + expect(result).to.deep.equal({ + data: { + fieldWithNullableStringInput: 'null', + }, + }); + }); + + it('uses default value when not provided', () => { + const result = executeQuery(` + query ($input: TestInputObject = {a: "foo", b: ["bar"], c: "baz"}) { + fieldWithObjectInput(input: $input) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithObjectInput: '{ a: "foo", b: ["bar"], c: "baz" }', + }, + }); + }); + + it('does not use default value when provided', () => { + const result = executeQuery( + ` + query q($input: String = "Default value") { + fieldWithNullableStringInput(input: $input) + } + `, + { input: 'Variable value' }, + ); + + expect(result).to.deep.equal({ + data: { + fieldWithNullableStringInput: '"Variable value"', + }, + }); + }); + + it('uses explicit null value instead of default value', () => { + const result = executeQuery( + ` + query q($input: String = "Default value") { + fieldWithNullableStringInput(input: $input) + }`, + { input: null }, + ); + + expect(result).to.deep.equal({ + data: { + fieldWithNullableStringInput: 'null', + }, + }); + }); + + it('uses null default value when not provided', () => { + const result = executeQuery( + ` + query q($input: String = null) { + fieldWithNullableStringInput(input: $input) + }`, + { + // Intentionally missing variable values. + }, + ); + + expect(result).to.deep.equal({ + data: { + fieldWithNullableStringInput: 'null', + }, + }); + }); + + it('properly parses single value to list', () => { + const params = { input: { a: 'foo', b: 'bar', c: 'baz' } }; + const result = executeQuery(doc, params); + + expect(result).to.deep.equal({ + data: { + fieldWithObjectInput: '{ a: "foo", b: ["bar"], c: "baz" }', + }, + }); + }); + + it('executes with complex scalar input', () => { + const params = { input: { c: 'foo', d: 'SerializedValue' } }; + const result = executeQuery(doc, params); + + expect(result).to.deep.equal({ + data: { + fieldWithObjectInput: '{ c: "foo", d: "DeserializedValue" }', + }, + }); + }); + + it('errors on null for nested non-null', () => { + const params = { input: { a: 'foo', b: 'bar', c: null } }; + const result = executeQuery(doc, params); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$input" got invalid value null at "input.c"; Expected non-nullable type "String!" not to be null.', + locations: [{ line: 2, column: 16 }], + }, + ], + }); + }); + + it('errors on incorrect type', () => { + const result = executeQuery(doc, { input: 'foo bar' }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$input" got invalid value "foo bar"; Expected type "TestInputObject" to be an object.', + locations: [{ line: 2, column: 16 }], + }, + ], + }); + }); + + it('errors on omission of nested non-null', () => { + const result = executeQuery(doc, { input: { a: 'foo', b: 'bar' } }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$input" got invalid value { a: "foo", b: "bar" }; Field "c" of required type "String!" was not provided.', + locations: [{ line: 2, column: 16 }], + }, + ], + }); + }); + + it('errors on deep nested errors and with many errors', () => { + const nestedDoc = ` + query ($input: TestNestedInputObject) { + fieldWithNestedObjectInput(input: $input) + } + `; + const result = executeQuery(nestedDoc, { input: { na: { a: 'foo' } } }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$input" got invalid value { a: "foo" } at "input.na"; Field "c" of required type "String!" was not provided.', + locations: [{ line: 2, column: 18 }], + }, + { + message: + 'Variable "$input" got invalid value { na: { a: "foo" } }; Field "nb" of required type "String!" was not provided.', + locations: [{ line: 2, column: 18 }], + }, + ], + }); + }); + + it('errors on addition of unknown input field', () => { + const params = { + input: { a: 'foo', b: 'bar', c: 'baz', extra: 'dog' }, + }; + const result = executeQuery(doc, params); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$input" got invalid value { a: "foo", b: "bar", c: "baz", extra: "dog" }; Field "extra" is not defined by type "TestInputObject".', + locations: [{ line: 2, column: 16 }], + }, + ], + }); + }); + }); + }); + + describe('Handles custom enum values', () => { + it('allows custom enum values as inputs', () => { + const result = executeQuery(` + { + null: fieldWithEnumInput(input: NULL) + NaN: fieldWithEnumInput(input: NAN) + false: fieldWithEnumInput(input: FALSE) + customValue: fieldWithEnumInput(input: CUSTOM) + defaultValue: fieldWithEnumInput(input: DEFAULT_VALUE) + } + `); + + expect(result).to.deep.equal({ + data: { + null: 'null', + NaN: 'NaN', + false: 'false', + customValue: '"custom value"', + defaultValue: '"DEFAULT_VALUE"', + }, + }); + }); + + it('allows non-nullable inputs to have null as enum custom value', () => { + const result = executeQuery(` + { + fieldWithNonNullableEnumInput(input: NULL) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithNonNullableEnumInput: 'null', + }, + }); + }); + }); + + describe('Handles nullable scalars', () => { + it('allows nullable inputs to be omitted', () => { + const result = executeQuery(` + { + fieldWithNullableStringInput + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithNullableStringInput: null, + }, + }); + }); + + it('allows nullable inputs to be omitted in a variable', () => { + const result = executeQuery(` + query ($value: String) { + fieldWithNullableStringInput(input: $value) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithNullableStringInput: null, + }, + }); + }); + + it('allows nullable inputs to be omitted in an unlisted variable', () => { + const result = executeQuery(` + query { + fieldWithNullableStringInput(input: $value) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithNullableStringInput: null, + }, + }); + }); + + it('allows nullable inputs to be set to null in a variable', () => { + const doc = ` + query ($value: String) { + fieldWithNullableStringInput(input: $value) + } + `; + const result = executeQuery(doc, { value: null }); + + expect(result).to.deep.equal({ + data: { + fieldWithNullableStringInput: 'null', + }, + }); + }); + + it('allows nullable inputs to be set to a value in a variable', () => { + const doc = ` + query ($value: String) { + fieldWithNullableStringInput(input: $value) + } + `; + const result = executeQuery(doc, { value: 'a' }); + + expect(result).to.deep.equal({ + data: { + fieldWithNullableStringInput: '"a"', + }, + }); + }); + + it('allows nullable inputs to be set to a value directly', () => { + const result = executeQuery(` + { + fieldWithNullableStringInput(input: "a") + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithNullableStringInput: '"a"', + }, + }); + }); + }); + + describe('Handles non-nullable scalars', () => { + it('allows non-nullable variable to be omitted given a default', () => { + const result = executeQuery(` + query ($value: String! = "default") { + fieldWithNullableStringInput(input: $value) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithNullableStringInput: '"default"', + }, + }); + }); + + it('allows non-nullable inputs to be omitted given a default', () => { + const result = executeQuery(` + query ($value: String = "default") { + fieldWithNonNullableStringInput(input: $value) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithNonNullableStringInput: '"default"', + }, + }); + }); + + it('does not allow non-nullable inputs to be omitted in a variable', () => { + const result = executeQuery(` + query ($value: String!) { + fieldWithNonNullableStringInput(input: $value) + } + `); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$value" of required type "String!" was not provided.', + locations: [{ line: 2, column: 16 }], + }, + ], + }); + }); + + it('does not allow non-nullable inputs to be set to null in a variable', () => { + const doc = ` + query ($value: String!) { + fieldWithNonNullableStringInput(input: $value) + } + `; + const result = executeQuery(doc, { value: null }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$value" of non-null type "String!" must not be null.', + locations: [{ line: 2, column: 16 }], + }, + ], + }); + }); + + it('allows non-nullable inputs to be set to a value in a variable', () => { + const doc = ` + query ($value: String!) { + fieldWithNonNullableStringInput(input: $value) + } + `; + const result = executeQuery(doc, { value: 'a' }); + + expect(result).to.deep.equal({ + data: { + fieldWithNonNullableStringInput: '"a"', + }, + }); + }); + + it('allows non-nullable inputs to be set to a value directly', () => { + const result = executeQuery(` + { + fieldWithNonNullableStringInput(input: "a") + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithNonNullableStringInput: '"a"', + }, + }); + }); + + it('reports error for missing non-nullable inputs', () => { + const result = executeQuery('{ fieldWithNonNullableStringInput }'); + + expectJSON(result).toDeepEqual({ + data: { + fieldWithNonNullableStringInput: null, + }, + errors: [ + { + message: + 'Argument "input" of required type "String!" was not provided.', + locations: [{ line: 1, column: 3 }], + path: ['fieldWithNonNullableStringInput'], + }, + ], + }); + }); + + it('reports error for array passed into string input', () => { + const doc = ` + query ($value: String!) { + fieldWithNonNullableStringInput(input: $value) + } + `; + const result = executeQuery(doc, { value: [1, 2, 3] }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$value" got invalid value [1, 2, 3]; String cannot represent a non string value: [1, 2, 3]', + locations: [{ line: 2, column: 16 }], + }, + ], + }); + + expect(result).to.have.nested.property('errors[0].originalError'); + }); + + it('reports error for non-provided variables for non-nullable inputs', () => { + // Note: this test would typically fail validation before encountering + // this execution error, however for queries which previously validated + // and are being run against a new schema which have introduced a breaking + // change to make a formerly non-required argument required, this asserts + // failure before allowing the underlying code to receive a non-null value. + const result = executeQuery(` + { + fieldWithNonNullableStringInput(input: $foo) + } + `); + + expectJSON(result).toDeepEqual({ + data: { + fieldWithNonNullableStringInput: null, + }, + errors: [ + { + message: + 'Argument "input" of required type "String!" was provided the variable "$foo" which was not provided a runtime value.', + locations: [{ line: 3, column: 50 }], + path: ['fieldWithNonNullableStringInput'], + }, + ], + }); + }); + }); + + describe('Handles lists and nullability', () => { + it('allows lists to be null', () => { + const doc = ` + query ($input: [String]) { + list(input: $input) + } + `; + const result = executeQuery(doc, { input: null }); + + expect(result).to.deep.equal({ data: { list: 'null' } }); + }); + + it('allows lists to contain values', () => { + const doc = ` + query ($input: [String]) { + list(input: $input) + } + `; + const result = executeQuery(doc, { input: ['A'] }); + + expect(result).to.deep.equal({ data: { list: '["A"]' } }); + }); + + it('allows lists to contain null', () => { + const doc = ` + query ($input: [String]) { + list(input: $input) + } + `; + const result = executeQuery(doc, { input: ['A', null, 'B'] }); + + expect(result).to.deep.equal({ data: { list: '["A", null, "B"]' } }); + }); + + it('does not allow non-null lists to be null', () => { + const doc = ` + query ($input: [String]!) { + nnList(input: $input) + } + `; + const result = executeQuery(doc, { input: null }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$input" of non-null type "[String]!" must not be null.', + locations: [{ line: 2, column: 16 }], + }, + ], + }); + }); + + it('allows non-null lists to contain values', () => { + const doc = ` + query ($input: [String]!) { + nnList(input: $input) + } + `; + const result = executeQuery(doc, { input: ['A'] }); + + expect(result).to.deep.equal({ data: { nnList: '["A"]' } }); + }); + + it('allows non-null lists to contain null', () => { + const doc = ` + query ($input: [String]!) { + nnList(input: $input) + } + `; + const result = executeQuery(doc, { input: ['A', null, 'B'] }); + + expect(result).to.deep.equal({ data: { nnList: '["A", null, "B"]' } }); + }); + + it('allows lists of non-nulls to be null', () => { + const doc = ` + query ($input: [String!]) { + listNN(input: $input) + } + `; + const result = executeQuery(doc, { input: null }); + + expect(result).to.deep.equal({ data: { listNN: 'null' } }); + }); + + it('allows lists of non-nulls to contain values', () => { + const doc = ` + query ($input: [String!]) { + listNN(input: $input) + } + `; + const result = executeQuery(doc, { input: ['A'] }); + + expect(result).to.deep.equal({ data: { listNN: '["A"]' } }); + }); + + it('does not allow lists of non-nulls to contain null', () => { + const doc = ` + query ($input: [String!]) { + listNN(input: $input) + } + `; + const result = executeQuery(doc, { input: ['A', null, 'B'] }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$input" got invalid value null at "input[1]"; Expected non-nullable type "String!" not to be null.', + locations: [{ line: 2, column: 16 }], + }, + ], + }); + }); + + it('does not allow non-null lists of non-nulls to be null', () => { + const doc = ` + query ($input: [String!]!) { + nnListNN(input: $input) + } + `; + const result = executeQuery(doc, { input: null }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$input" of non-null type "[String!]!" must not be null.', + locations: [{ line: 2, column: 16 }], + }, + ], + }); + }); + + it('allows non-null lists of non-nulls to contain values', () => { + const doc = ` + query ($input: [String!]!) { + nnListNN(input: $input) + } + `; + const result = executeQuery(doc, { input: ['A'] }); + + expect(result).to.deep.equal({ data: { nnListNN: '["A"]' } }); + }); + + it('does not allow non-null lists of non-nulls to contain null', () => { + const doc = ` + query ($input: [String!]!) { + nnListNN(input: $input) + } + `; + const result = executeQuery(doc, { input: ['A', null, 'B'] }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$input" got invalid value null at "input[1]"; Expected non-nullable type "String!" not to be null.', + locations: [{ line: 2, column: 16 }], + }, + ], + }); + }); + + it('does not allow invalid types to be used as values', () => { + const doc = ` + query ($input: TestType!) { + fieldWithObjectInput(input: $input) + } + `; + const result = executeQuery(doc, { input: { list: ['A', 'B'] } }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$input" expected value of type "TestType!" which cannot be used as an input type.', + locations: [{ line: 2, column: 24 }], + }, + ], + }); + }); + + it('does not allow unknown types to be used as values', () => { + const doc = ` + query ($input: UnknownType!) { + fieldWithObjectInput(input: $input) + } + `; + const result = executeQuery(doc, { input: 'WhoKnows' }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$input" expected value of type "UnknownType!" which cannot be used as an input type.', + locations: [{ line: 2, column: 24 }], + }, + ], + }); + }); + }); + + describe('Execute: Uses argument default values', () => { + it('when no argument provided', () => { + const result = executeQuery('{ fieldWithDefaultArgumentValue }'); + + expect(result).to.deep.equal({ + data: { + fieldWithDefaultArgumentValue: '"Hello World"', + }, + }); + }); + + it('when omitted variable provided', () => { + const result = executeQuery(` + query ($optional: String) { + fieldWithDefaultArgumentValue(input: $optional) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithDefaultArgumentValue: '"Hello World"', + }, + }); + }); + + it('not when argument cannot be coerced', () => { + const result = executeQuery(` + { + fieldWithDefaultArgumentValue(input: WRONG_TYPE) + } + `); + + expectJSON(result).toDeepEqual({ + data: { + fieldWithDefaultArgumentValue: null, + }, + errors: [ + { + message: 'Argument "input" has invalid value WRONG_TYPE.', + locations: [{ line: 3, column: 48 }], + path: ['fieldWithDefaultArgumentValue'], + }, + ], + }); + }); + + it('when no runtime value is provided to a non-null argument', () => { + const result = executeQuery(` + query optionalVariable($optional: String) { + fieldWithNonNullableStringInputAndDefaultArgumentValue(input: $optional) + } + `); + + expect(result).to.deep.equal({ + data: { + fieldWithNonNullableStringInputAndDefaultArgumentValue: + '"Hello World"', + }, + }); + }); + }); + + describe('getVariableValues: limit maximum number of coercion errors', () => { + const doc = parse(` + query ($input: [String!]) { + listNN(input: $input) + } + `); + + const operation = doc.definitions[0]; + invariant(operation.kind === Kind.OPERATION_DEFINITION); + const { variableDefinitions } = operation; + invariant(variableDefinitions != null); + + const inputValue = { input: [0, 1, 2] }; + + function invalidValueError(value: number, index: number) { + return { + message: `Variable "$input" got invalid value ${value} at "input[${index}]"; String cannot represent a non string value: ${value}`, + locations: [{ line: 2, column: 14 }], + }; + } + + it('return all errors by default', () => { + const result = getVariableValues(schema, variableDefinitions, inputValue); + + expectJSON(result).toDeepEqual({ + errors: [ + invalidValueError(0, 0), + invalidValueError(1, 1), + invalidValueError(2, 2), + ], + }); + }); + + it('when maxErrors is equal to number of errors', () => { + const result = getVariableValues( + schema, + variableDefinitions, + inputValue, + { maxErrors: 3 }, + ); + + expectJSON(result).toDeepEqual({ + errors: [ + invalidValueError(0, 0), + invalidValueError(1, 1), + invalidValueError(2, 2), + ], + }); + }); + + it('when maxErrors is less than number of errors', () => { + const result = getVariableValues( + schema, + variableDefinitions, + inputValue, + { maxErrors: 2 }, + ); + + expectJSON(result).toDeepEqual({ + errors: [ + invalidValueError(0, 0), + invalidValueError(1, 1), + { + message: + 'Too many errors processing variables, error limit reached. Execution aborted.', + }, + ], + }); + }); + }); +}); diff --git a/src/execution/collectFields.ts b/src/execution/collectFields.ts new file mode 100644 index 00000000..d0961bfa --- /dev/null +++ b/src/execution/collectFields.ts @@ -0,0 +1,212 @@ +import type { ObjMap } from '../jsutils/ObjMap'; + +import type { + FieldNode, + FragmentDefinitionNode, + FragmentSpreadNode, + InlineFragmentNode, + SelectionSetNode, +} from '../language/ast'; +import { Kind } from '../language/kinds'; + +import type { GraphQLObjectType } from '../type/definition'; +import { isAbstractType } from '../type/definition'; +import { + GraphQLIncludeDirective, + GraphQLSkipDirective, +} from '../type/directives'; +import type { GraphQLSchema } from '../type/schema'; + +import { typeFromAST } from '../utilities/typeFromAST'; + +import { getDirectiveValues } from './values'; + +/** + * Given a selectionSet, collects all of the fields and returns them. + * + * CollectFields requires the "runtime type" of an object. For a field that + * returns an Interface or Union type, the "runtime type" will be the actual + * object type returned by that field. + * + * @internal + */ +export function collectFields( + schema: GraphQLSchema, + fragments: ObjMap, + variableValues: { [variable: string]: unknown }, + runtimeType: GraphQLObjectType, + selectionSet: SelectionSetNode, +): Map> { + const fields = new Map(); + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selectionSet, + fields, + new Set(), + ); + return fields; +} + +/** + * Given an array of field nodes, collects all of the subfields of the passed + * in fields, and returns them at the end. + * + * CollectSubFields requires the "return type" of an object. For a field that + * returns an Interface or Union type, the "return type" will be the actual + * object type returned by that field. + * + * @internal + */ +export function collectSubfields( + schema: GraphQLSchema, + fragments: ObjMap, + variableValues: { [variable: string]: unknown }, + returnType: GraphQLObjectType, + fieldNodes: ReadonlyArray, +): Map> { + const subFieldNodes = new Map(); + const visitedFragmentNames = new Set(); + for (const node of fieldNodes) { + if (node.selectionSet) { + collectFieldsImpl( + schema, + fragments, + variableValues, + returnType, + node.selectionSet, + subFieldNodes, + visitedFragmentNames, + ); + } + } + return subFieldNodes; +} + +function collectFieldsImpl( + schema: GraphQLSchema, + fragments: ObjMap, + variableValues: { [variable: string]: unknown }, + runtimeType: GraphQLObjectType, + selectionSet: SelectionSetNode, + fields: Map>, + visitedFragmentNames: Set, +): void { + for (const selection of selectionSet.selections) { + switch (selection.kind) { + case Kind.FIELD: { + if (!shouldIncludeNode(variableValues, selection)) { + continue; + } + const name = getFieldEntryKey(selection); + const fieldList = fields.get(name); + if (fieldList !== undefined) { + fieldList.push(selection); + } else { + fields.set(name, [selection]); + } + break; + } + case Kind.INLINE_FRAGMENT: { + if ( + !shouldIncludeNode(variableValues, selection) || + !doesFragmentConditionMatch(schema, selection, runtimeType) + ) { + continue; + } + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + selection.selectionSet, + fields, + visitedFragmentNames, + ); + break; + } + case Kind.FRAGMENT_SPREAD: { + const fragName = selection.name.value; + if ( + visitedFragmentNames.has(fragName) || + !shouldIncludeNode(variableValues, selection) + ) { + continue; + } + visitedFragmentNames.add(fragName); + const fragment = fragments[fragName]; + if ( + !fragment || + !doesFragmentConditionMatch(schema, fragment, runtimeType) + ) { + continue; + } + collectFieldsImpl( + schema, + fragments, + variableValues, + runtimeType, + fragment.selectionSet, + fields, + visitedFragmentNames, + ); + break; + } + } + } +} + +/** + * Determines if a field should be included based on the `@include` and `@skip` + * directives, where `@skip` has higher precedence than `@include`. + */ +function shouldIncludeNode( + variableValues: { [variable: string]: unknown }, + node: FragmentSpreadNode | FieldNode | InlineFragmentNode, +): boolean { + const skip = getDirectiveValues(GraphQLSkipDirective, node, variableValues); + if (skip?.if === true) { + return false; + } + + const include = getDirectiveValues( + GraphQLIncludeDirective, + node, + variableValues, + ); + if (include?.if === false) { + return false; + } + return true; +} + +/** + * Determines if a fragment is applicable to the given type. + */ +function doesFragmentConditionMatch( + schema: GraphQLSchema, + fragment: FragmentDefinitionNode | InlineFragmentNode, + type: GraphQLObjectType, +): boolean { + const typeConditionNode = fragment.typeCondition; + if (!typeConditionNode) { + return true; + } + const conditionalType = typeFromAST(schema, typeConditionNode); + if (conditionalType === type) { + return true; + } + if (isAbstractType(conditionalType)) { + return schema.isSubType(conditionalType, type); + } + return false; +} + +/** + * Implements the logic to compute the key of a given field's entry + */ +function getFieldEntryKey(node: FieldNode): string { + return node.alias ? node.alias.value : node.name.value; +} diff --git a/src/execution/execute.ts b/src/execution/execute.ts new file mode 100644 index 00000000..d3c21385 --- /dev/null +++ b/src/execution/execute.ts @@ -0,0 +1,1055 @@ +import { devAssert } from '../jsutils/devAssert'; +import { inspect } from '../jsutils/inspect'; +import { invariant } from '../jsutils/invariant'; +import { isIterableObject } from '../jsutils/isIterableObject'; +import { isObjectLike } from '../jsutils/isObjectLike'; +import { isPromise } from '../jsutils/isPromise'; +import type { Maybe } from '../jsutils/Maybe'; +import { memoize3 } from '../jsutils/memoize3'; +import type { ObjMap } from '../jsutils/ObjMap'; +import type { Path } from '../jsutils/Path'; +import { addPath, pathToArray } from '../jsutils/Path'; +import { promiseForObject } from '../jsutils/promiseForObject'; +import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; +import { promiseReduce } from '../jsutils/promiseReduce'; + +import type { GraphQLFormattedError } from '../error/GraphQLError'; +import { GraphQLError } from '../error/GraphQLError'; +import { locatedError } from '../error/locatedError'; + +import type { + DocumentNode, + FieldNode, + FragmentDefinitionNode, + OperationDefinitionNode, +} from '../language/ast'; +import { OperationTypeNode } from '../language/ast'; +import { Kind } from '../language/kinds'; + +import type { + GraphQLAbstractType, + GraphQLField, + GraphQLFieldResolver, + GraphQLLeafType, + GraphQLList, + GraphQLObjectType, + GraphQLOutputType, + GraphQLResolveInfo, + GraphQLTypeResolver, +} from '../type/definition'; +import { + isAbstractType, + isLeafType, + isListType, + isNonNullType, + isObjectType, +} from '../type/definition'; +import { + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from '../type/introspection'; +import type { GraphQLSchema } from '../type/schema'; +import { assertValidSchema } from '../type/validate'; + +import { + collectFields, + collectSubfields as _collectSubfields, +} from './collectFields'; +import { getArgumentValues, getVariableValues } from './values'; + +/** + * A memoized collection of relevant subfields with regard to the return + * type. Memoizing ensures the subfields are not repeatedly calculated, which + * saves overhead when resolving lists of values. + */ +const collectSubfields = memoize3( + ( + exeContext: ExecutionContext, + returnType: GraphQLObjectType, + fieldNodes: ReadonlyArray, + ) => + _collectSubfields( + exeContext.schema, + exeContext.fragments, + exeContext.variableValues, + returnType, + fieldNodes, + ), +); + +/** + * Terminology + * + * "Definitions" are the generic name for top-level statements in the document. + * Examples of this include: + * 1) Operations (such as a query) + * 2) Fragments + * + * "Operations" are a generic name for requests in the document. + * Examples of this include: + * 1) query, + * 2) mutation + * + * "Selections" are the definitions that can appear legally and at + * single level of the query. These include: + * 1) field references e.g `a` + * 2) fragment "spreads" e.g. `...c` + * 3) inline fragment "spreads" e.g. `...on Type { a }` + */ + +/** + * Data that must be available at all points during query execution. + * + * Namely, schema of the type system that is currently executing, + * and the fragments defined in the query document + */ +export interface ExecutionContext { + schema: GraphQLSchema; + fragments: ObjMap; + rootValue: unknown; + contextValue: unknown; + operation: OperationDefinitionNode; + variableValues: { [variable: string]: unknown }; + fieldResolver: GraphQLFieldResolver; + typeResolver: GraphQLTypeResolver; + subscribeFieldResolver: GraphQLFieldResolver; + errors: Array; +} + +/** + * The result of GraphQL execution. + * + * - `errors` is included when any errors occurred as a non-empty array. + * - `data` is the result of a successful execution of the query. + * - `extensions` is reserved for adding non-standard properties. + */ +export interface ExecutionResult< + TData = ObjMap, + TExtensions = ObjMap, +> { + errors?: ReadonlyArray; + data?: TData | null; + extensions?: TExtensions; +} + +export interface FormattedExecutionResult< + TData = ObjMap, + TExtensions = ObjMap, +> { + errors?: ReadonlyArray; + data?: TData | null; + extensions?: TExtensions; +} + +export interface ExecutionArgs { + schema: GraphQLSchema; + document: DocumentNode; + rootValue?: unknown; + contextValue?: unknown; + variableValues?: Maybe<{ readonly [variable: string]: unknown }>; + operationName?: Maybe; + fieldResolver?: Maybe>; + typeResolver?: Maybe>; + subscribeFieldResolver?: Maybe>; +} + +/** + * Implements the "Executing requests" section of the GraphQL specification. + * + * Returns either a synchronous ExecutionResult (if all encountered resolvers + * are synchronous), or a Promise of an ExecutionResult that will eventually be + * resolved and never rejected. + * + * If the arguments to this function do not result in a legal execution context, + * a GraphQLError will be thrown immediately explaining the invalid input. + */ +export function execute(args: ExecutionArgs): PromiseOrValue { + // Temporary for v15 to v16 migration. Remove in v17 + devAssert( + arguments.length < 2, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + + const { schema, document, variableValues, rootValue } = args; + + // If arguments are missing or incorrect, throw an error. + assertValidExecutionArguments(schema, document, variableValues); + + // If a valid execution context cannot be created due to incorrect arguments, + // a "Response" with only errors is returned. + const exeContext = buildExecutionContext(args); + + // Return early errors if execution context failed. + if (!('schema' in exeContext)) { + return { errors: exeContext }; + } + + // Return a Promise that will eventually resolve to the data described by + // The "Response" section of the GraphQL specification. + // + // If errors are encountered while executing a GraphQL field, only that + // field and its descendants will be omitted, and sibling fields will still + // be executed. An execution which encounters errors will still result in a + // resolved Promise. + // + // Errors from sub-fields of a NonNull type may propagate to the top level, + // at which point we still log the error and null the parent field, which + // in this case is the entire response. + try { + const { operation } = exeContext; + const result = executeOperation(exeContext, operation, rootValue); + if (isPromise(result)) { + return result.then( + (data) => buildResponse(data, exeContext.errors), + (error) => { + exeContext.errors.push(error); + return buildResponse(null, exeContext.errors); + }, + ); + } + return buildResponse(result, exeContext.errors); + } catch (error) { + exeContext.errors.push(error); + return buildResponse(null, exeContext.errors); + } +} + +/** + * Also implements the "Executing requests" section of the GraphQL specification. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ +export function executeSync(args: ExecutionArgs): ExecutionResult { + const result = execute(args); + + // Assert that the execution was synchronous. + if (isPromise(result)) { + throw new Error('GraphQL execution failed to complete synchronously.'); + } + + return result; +} + +/** + * Given a completed execution context and data, build the `{ errors, data }` + * response defined by the "Response" section of the GraphQL specification. + */ +function buildResponse( + data: ObjMap | null, + errors: ReadonlyArray, +): ExecutionResult { + return errors.length === 0 ? { data } : { errors, data }; +} + +/** + * Essential assertions before executing to provide developer feedback for + * improper use of the GraphQL library. + * + * @internal + */ +export function assertValidExecutionArguments( + schema: GraphQLSchema, + document: DocumentNode, + rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>, +): void { + devAssert(document, 'Must provide document.'); + + // If the schema used for execution is invalid, throw an error. + assertValidSchema(schema); + + // Variables, if provided, must be an object. + devAssert( + rawVariableValues == null || isObjectLike(rawVariableValues), + 'Variables must be provided as an Object where each property is a variable value. Perhaps look to see if an unparsed JSON string was provided.', + ); +} + +/** + * Constructs a ExecutionContext object from the arguments passed to + * execute, which we will pass throughout the other execution methods. + * + * Throws a GraphQLError if a valid execution context cannot be created. + * + * @internal + */ +export function buildExecutionContext( + args: ExecutionArgs, +): ReadonlyArray | ExecutionContext { + const { + schema, + document, + rootValue, + contextValue, + variableValues: rawVariableValues, + operationName, + fieldResolver, + typeResolver, + subscribeFieldResolver, + } = args; + + let operation: OperationDefinitionNode | undefined; + const fragments: ObjMap = Object.create(null); + for (const definition of document.definitions) { + switch (definition.kind) { + case Kind.OPERATION_DEFINITION: + if (operationName == null) { + if (operation !== undefined) { + return [ + new GraphQLError( + 'Must provide operation name if query contains multiple operations.', + ), + ]; + } + operation = definition; + } else if (definition.name?.value === operationName) { + operation = definition; + } + break; + case Kind.FRAGMENT_DEFINITION: + fragments[definition.name.value] = definition; + break; + default: + // ignore non-executable definitions + } + } + + if (!operation) { + if (operationName != null) { + return [new GraphQLError(`Unknown operation named "${operationName}".`)]; + } + return [new GraphQLError('Must provide an operation.')]; + } + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const variableDefinitions = operation.variableDefinitions ?? []; + + const coercedVariableValues = getVariableValues( + schema, + variableDefinitions, + rawVariableValues ?? {}, + { maxErrors: 50 }, + ); + + if (coercedVariableValues.errors) { + return coercedVariableValues.errors; + } + + return { + schema, + fragments, + rootValue, + contextValue, + operation, + variableValues: coercedVariableValues.coerced, + fieldResolver: fieldResolver ?? defaultFieldResolver, + typeResolver: typeResolver ?? defaultTypeResolver, + subscribeFieldResolver: subscribeFieldResolver ?? defaultFieldResolver, + errors: [], + }; +} + +/** + * Implements the "Executing operations" section of the spec. + */ +function executeOperation( + exeContext: ExecutionContext, + operation: OperationDefinitionNode, + rootValue: unknown, +): PromiseOrValue | null> { + const rootType = exeContext.schema.getRootType(operation.operation); + if (rootType == null) { + throw new GraphQLError( + `Schema is not configured to execute ${operation.operation} operation.`, + operation, + ); + } + + const rootFields = collectFields( + exeContext.schema, + exeContext.fragments, + exeContext.variableValues, + rootType, + operation.selectionSet, + ); + const path = undefined; + + switch (operation.operation) { + case OperationTypeNode.QUERY: + return executeFields(exeContext, rootType, rootValue, path, rootFields); + case OperationTypeNode.MUTATION: + return executeFieldsSerially( + exeContext, + rootType, + rootValue, + path, + rootFields, + ); + case OperationTypeNode.SUBSCRIPTION: + // TODO: deprecate `subscribe` and move all logic here + // Temporary solution until we finish merging execute and subscribe together + return executeFields(exeContext, rootType, rootValue, path, rootFields); + } +} + +/** + * Implements the "Executing selection sets" section of the spec + * for fields that must be executed serially. + */ +function executeFieldsSerially( + exeContext: ExecutionContext, + parentType: GraphQLObjectType, + sourceValue: unknown, + path: Path | undefined, + fields: Map>, +): PromiseOrValue> { + return promiseReduce( + fields.entries(), + (results, [responseName, fieldNodes]) => { + const fieldPath = addPath(path, responseName, parentType.name); + const result = executeField( + exeContext, + parentType, + sourceValue, + fieldNodes, + fieldPath, + ); + if (result === undefined) { + return results; + } + if (isPromise(result)) { + return result.then((resolvedResult) => { + results[responseName] = resolvedResult; + return results; + }); + } + results[responseName] = result; + return results; + }, + Object.create(null), + ); +} + +/** + * Implements the "Executing selection sets" section of the spec + * for fields that may be executed in parallel. + */ +function executeFields( + exeContext: ExecutionContext, + parentType: GraphQLObjectType, + sourceValue: unknown, + path: Path | undefined, + fields: Map>, +): PromiseOrValue> { + const results = Object.create(null); + let containsPromise = false; + + for (const [responseName, fieldNodes] of fields.entries()) { + const fieldPath = addPath(path, responseName, parentType.name); + const result = executeField( + exeContext, + parentType, + sourceValue, + fieldNodes, + fieldPath, + ); + + if (result !== undefined) { + results[responseName] = result; + if (isPromise(result)) { + containsPromise = true; + } + } + } + + // If there are no promises, we can just return the object + if (!containsPromise) { + return results; + } + + // Otherwise, results is a map from field name to the result of resolving that + // field, which is possibly a promise. Return a promise that will return this + // same map, but with any promises replaced with the values they resolved to. + return promiseForObject(results); +} + +/** + * Implements the "Executing fields" section of the spec + * In particular, this function figures out the value that the field returns by + * calling its resolve function, then calls completeValue to complete promises, + * serialize scalars, or execute the sub-selection-set for objects. + */ +function executeField( + exeContext: ExecutionContext, + parentType: GraphQLObjectType, + source: unknown, + fieldNodes: ReadonlyArray, + path: Path, +): PromiseOrValue { + const fieldDef = getFieldDef(exeContext.schema, parentType, fieldNodes[0]); + if (!fieldDef) { + return; + } + + const returnType = fieldDef.type; + const resolveFn = fieldDef.resolve ?? exeContext.fieldResolver; + + const info = buildResolveInfo( + exeContext, + fieldDef, + fieldNodes, + parentType, + path, + ); + + // Get the resolve function, regardless of if its result is normal or abrupt (error). + try { + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + // TODO: find a way to memoize, in case this field is within a List type. + const args = getArgumentValues( + fieldDef, + fieldNodes[0], + exeContext.variableValues, + ); + + // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + const contextValue = exeContext.contextValue; + + const result = resolveFn(source, args, contextValue, info); + + let completed; + if (isPromise(result)) { + completed = result.then((resolved) => + completeValue(exeContext, returnType, fieldNodes, info, path, resolved), + ); + } else { + completed = completeValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } + + if (isPromise(completed)) { + // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + return completed.then(undefined, (rawError) => { + const error = locatedError(rawError, fieldNodes, pathToArray(path)); + return handleFieldError(error, returnType, exeContext); + }); + } + return completed; + } catch (rawError) { + const error = locatedError(rawError, fieldNodes, pathToArray(path)); + return handleFieldError(error, returnType, exeContext); + } +} + +/** + * @internal + */ +export function buildResolveInfo( + exeContext: ExecutionContext, + fieldDef: GraphQLField, + fieldNodes: ReadonlyArray, + parentType: GraphQLObjectType, + path: Path, +): GraphQLResolveInfo { + // The resolve function's optional fourth argument is a collection of + // information about the current execution state. + return { + fieldName: fieldDef.name, + fieldNodes, + returnType: fieldDef.type, + parentType, + path, + schema: exeContext.schema, + fragments: exeContext.fragments, + rootValue: exeContext.rootValue, + operation: exeContext.operation, + variableValues: exeContext.variableValues, + }; +} + +function handleFieldError( + error: GraphQLError, + returnType: GraphQLOutputType, + exeContext: ExecutionContext, +): null { + // If the field type is non-nullable, then it is resolved without any + // protection from errors, however it still properly locates the error. + if (isNonNullType(returnType)) { + throw error; + } + + // Otherwise, error protection is applied, logging the error and resolving + // a null value for this field if one is encountered. + exeContext.errors.push(error); + return null; +} + +/** + * Implements the instructions for completeValue as defined in the + * "Value Completion" section of the spec. + * + * If the field type is Non-Null, then this recursively completes the value + * for the inner type. It throws a field error if that completion returns null, + * as per the "Nullability" section of the spec. + * + * If the field type is a List, then this recursively completes the value + * for the inner type on each item in the list. + * + * If the field type is a Scalar or Enum, ensures the completed value is a legal + * value of the type by calling the `serialize` method of GraphQL type + * definition. + * + * If the field is an abstract type, determine the runtime type of the value + * and then complete based on that type + * + * Otherwise, the field type expects a sub-selection set, and will complete the + * value by executing all sub-selections. + */ +function completeValue( + exeContext: ExecutionContext, + returnType: GraphQLOutputType, + fieldNodes: ReadonlyArray, + info: GraphQLResolveInfo, + path: Path, + result: unknown, +): PromiseOrValue { + // If result is an Error, throw a located error. + if (result instanceof Error) { + throw result; + } + + // If field type is NonNull, complete for inner type, and throw field error + // if result is null. + if (isNonNullType(returnType)) { + const completed = completeValue( + exeContext, + returnType.ofType, + fieldNodes, + info, + path, + result, + ); + if (completed === null) { + throw new Error( + `Cannot return null for non-nullable field ${info.parentType.name}.${info.fieldName}.`, + ); + } + return completed; + } + + // If result value is null or undefined then return null. + if (result == null) { + return null; + } + + // If field type is List, complete each item in the list with the inner type + if (isListType(returnType)) { + return completeListValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } + + // If field type is a leaf type, Scalar or Enum, serialize to a valid value, + // returning null if serialization is not possible. + if (isLeafType(returnType)) { + return completeLeafValue(returnType, result); + } + + // If field type is an abstract type, Interface or Union, determine the + // runtime Object type and complete for that type. + if (isAbstractType(returnType)) { + return completeAbstractValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } + + // If field type is Object, execute and complete all sub-selections. + if (isObjectType(returnType)) { + return completeObjectValue( + exeContext, + returnType, + fieldNodes, + info, + path, + result, + ); + } + /* c8 ignore next 6 */ + // Not reachable, all possible output types have been considered. + invariant( + false, + 'Cannot complete value of unexpected output type: ' + inspect(returnType), + ); +} + +/** + * Complete a list value by completing each item in the list with the + * inner type + */ +function completeListValue( + exeContext: ExecutionContext, + returnType: GraphQLList, + fieldNodes: ReadonlyArray, + info: GraphQLResolveInfo, + path: Path, + result: unknown, +): PromiseOrValue> { + if (!isIterableObject(result)) { + throw new GraphQLError( + `Expected Iterable, but did not find one for field "${info.parentType.name}.${info.fieldName}".`, + ); + } + + // This is specified as a simple map, however we're optimizing the path + // where the list contains no Promises by avoiding creating another Promise. + const itemType = returnType.ofType; + let containsPromise = false; + const completedResults = Array.from(result, (item, index) => { + // No need to modify the info object containing the path, + // since from here on it is not ever accessed by resolver functions. + const itemPath = addPath(path, index, undefined); + try { + let completedItem; + if (isPromise(item)) { + completedItem = item.then((resolved) => + completeValue( + exeContext, + itemType, + fieldNodes, + info, + itemPath, + resolved, + ), + ); + } else { + completedItem = completeValue( + exeContext, + itemType, + fieldNodes, + info, + itemPath, + item, + ); + } + + if (isPromise(completedItem)) { + containsPromise = true; + // Note: we don't rely on a `catch` method, but we do expect "thenable" + // to take a second callback for the error case. + return completedItem.then(undefined, (rawError) => { + const error = locatedError( + rawError, + fieldNodes, + pathToArray(itemPath), + ); + return handleFieldError(error, itemType, exeContext); + }); + } + return completedItem; + } catch (rawError) { + const error = locatedError(rawError, fieldNodes, pathToArray(itemPath)); + return handleFieldError(error, itemType, exeContext); + } + }); + + return containsPromise ? Promise.all(completedResults) : completedResults; +} + +/** + * Complete a Scalar or Enum by serializing to a valid value, returning + * null if serialization is not possible. + */ +function completeLeafValue( + returnType: GraphQLLeafType, + result: unknown, +): unknown { + const serializedResult = returnType.serialize(result); + if (serializedResult == null) { + throw new Error( + `Expected \`${inspect(returnType)}.serialize(${inspect(result)})\` to ` + + `return non-nullable value, returned: ${inspect(serializedResult)}`, + ); + } + return serializedResult; +} + +/** + * Complete a value of an abstract type by determining the runtime object type + * of that value, then complete the value for that type. + */ +function completeAbstractValue( + exeContext: ExecutionContext, + returnType: GraphQLAbstractType, + fieldNodes: ReadonlyArray, + info: GraphQLResolveInfo, + path: Path, + result: unknown, +): PromiseOrValue> { + const resolveTypeFn = returnType.resolveType ?? exeContext.typeResolver; + const contextValue = exeContext.contextValue; + const runtimeType = resolveTypeFn(result, contextValue, info, returnType); + + if (isPromise(runtimeType)) { + return runtimeType.then((resolvedRuntimeType) => + completeObjectValue( + exeContext, + ensureValidRuntimeType( + resolvedRuntimeType, + exeContext, + returnType, + fieldNodes, + info, + result, + ), + fieldNodes, + info, + path, + result, + ), + ); + } + + return completeObjectValue( + exeContext, + ensureValidRuntimeType( + runtimeType, + exeContext, + returnType, + fieldNodes, + info, + result, + ), + fieldNodes, + info, + path, + result, + ); +} + +function ensureValidRuntimeType( + runtimeTypeName: unknown, + exeContext: ExecutionContext, + returnType: GraphQLAbstractType, + fieldNodes: ReadonlyArray, + info: GraphQLResolveInfo, + result: unknown, +): GraphQLObjectType { + if (runtimeTypeName == null) { + throw new GraphQLError( + `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}". Either the "${returnType.name}" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.`, + fieldNodes, + ); + } + + // releases before 16.0.0 supported returning `GraphQLObjectType` from `resolveType` + // TODO: remove in 17.0.0 release + if (isObjectType(runtimeTypeName)) { + throw new GraphQLError( + 'Support for returning GraphQLObjectType from resolveType was removed in graphql-js@16.0.0 please return type name instead.', + ); + } + + if (typeof runtimeTypeName !== 'string') { + throw new GraphQLError( + `Abstract type "${returnType.name}" must resolve to an Object type at runtime for field "${info.parentType.name}.${info.fieldName}" with ` + + `value ${inspect(result)}, received "${inspect(runtimeTypeName)}".`, + ); + } + + const runtimeType = exeContext.schema.getType(runtimeTypeName); + if (runtimeType == null) { + throw new GraphQLError( + `Abstract type "${returnType.name}" was resolved to a type "${runtimeTypeName}" that does not exist inside the schema.`, + fieldNodes, + ); + } + + if (!isObjectType(runtimeType)) { + throw new GraphQLError( + `Abstract type "${returnType.name}" was resolved to a non-object type "${runtimeTypeName}".`, + fieldNodes, + ); + } + + if (!exeContext.schema.isSubType(returnType, runtimeType)) { + throw new GraphQLError( + `Runtime Object type "${runtimeType.name}" is not a possible type for "${returnType.name}".`, + fieldNodes, + ); + } + + return runtimeType; +} + +/** + * Complete an Object value by executing all sub-selections. + */ +function completeObjectValue( + exeContext: ExecutionContext, + returnType: GraphQLObjectType, + fieldNodes: ReadonlyArray, + info: GraphQLResolveInfo, + path: Path, + result: unknown, +): PromiseOrValue> { + // Collect sub-fields to execute to complete this value. + const subFieldNodes = collectSubfields(exeContext, returnType, fieldNodes); + + // If there is an isTypeOf predicate function, call it with the + // current result. If isTypeOf returns false, then raise an error rather + // than continuing execution. + if (returnType.isTypeOf) { + const isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info); + + if (isPromise(isTypeOf)) { + return isTypeOf.then((resolvedIsTypeOf) => { + if (!resolvedIsTypeOf) { + throw invalidReturnTypeError(returnType, result, fieldNodes); + } + return executeFields( + exeContext, + returnType, + result, + path, + subFieldNodes, + ); + }); + } + + if (!isTypeOf) { + throw invalidReturnTypeError(returnType, result, fieldNodes); + } + } + + return executeFields(exeContext, returnType, result, path, subFieldNodes); +} + +function invalidReturnTypeError( + returnType: GraphQLObjectType, + result: unknown, + fieldNodes: ReadonlyArray, +): GraphQLError { + return new GraphQLError( + `Expected value of type "${returnType.name}" but got: ${inspect(result)}.`, + fieldNodes, + ); +} + +/** + * If a resolveType function is not given, then a default resolve behavior is + * used which attempts two strategies: + * + * First, See if the provided value has a `__typename` field defined, if so, use + * that value as name of the resolved type. + * + * Otherwise, test each possible type for the abstract type by calling + * isTypeOf for the object being coerced, returning the first type that matches. + */ +export const defaultTypeResolver: GraphQLTypeResolver = + function (value, contextValue, info, abstractType) { + // First, look for `__typename`. + if (isObjectLike(value) && typeof value.__typename === 'string') { + return value.__typename; + } + + // Otherwise, test each possible type. + const possibleTypes = info.schema.getPossibleTypes(abstractType); + const promisedIsTypeOfResults = []; + + for (let i = 0; i < possibleTypes.length; i++) { + const type = possibleTypes[i]; + + if (type.isTypeOf) { + const isTypeOfResult = type.isTypeOf(value, contextValue, info); + + if (isPromise(isTypeOfResult)) { + promisedIsTypeOfResults[i] = isTypeOfResult; + } else if (isTypeOfResult) { + return type.name; + } + } + } + + if (promisedIsTypeOfResults.length) { + return Promise.all(promisedIsTypeOfResults).then((isTypeOfResults) => { + for (let i = 0; i < isTypeOfResults.length; i++) { + if (isTypeOfResults[i]) { + return possibleTypes[i].name; + } + } + }); + } + }; + +/** + * If a resolve function is not given, then a default resolve behavior is used + * which takes the property of the source object of the same name as the field + * and returns it as the result, or if it's a function, returns the result + * of calling that function while passing along args and context value. + */ +export const defaultFieldResolver: GraphQLFieldResolver = + function (source: any, args, contextValue, info) { + // ensure source is a value for which property access is acceptable. + if (isObjectLike(source) || typeof source === 'function') { + const property = source[info.fieldName]; + if (typeof property === 'function') { + return source[info.fieldName](args, contextValue, info); + } + return property; + } + }; + +/** + * This method looks up the field on the given type definition. + * It has special casing for the three introspection fields, + * __schema, __type and __typename. __typename is special because + * it can always be queried as a field, even in situations where no + * other fields are allowed, like on a Union. __schema and __type + * could get automatically added to the query type, but that would + * require mutating type definitions, which would cause issues. + * + * @internal + */ +export function getFieldDef( + schema: GraphQLSchema, + parentType: GraphQLObjectType, + fieldNode: FieldNode, +): Maybe> { + const fieldName = fieldNode.name.value; + + if ( + fieldName === SchemaMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return SchemaMetaFieldDef; + } else if ( + fieldName === TypeMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return TypeMetaFieldDef; + } else if (fieldName === TypeNameMetaFieldDef.name) { + return TypeNameMetaFieldDef; + } + return parentType.getFields()[fieldName]; +} diff --git a/src/execution/index.ts b/src/execution/index.ts new file mode 100644 index 00000000..b5871d47 --- /dev/null +++ b/src/execution/index.ts @@ -0,0 +1,18 @@ +export { pathToArray as responsePathAsArray } from '../jsutils/Path'; + +export { + execute, + executeSync, + defaultFieldResolver, + defaultTypeResolver, +} from './execute'; + +export type { + ExecutionArgs, + ExecutionResult, + FormattedExecutionResult, +} from './execute'; + +export { subscribe, createSourceEventStream } from './subscribe'; + +export { getDirectiveValues } from './values'; diff --git a/src/execution/mapAsyncIterator.ts b/src/execution/mapAsyncIterator.ts new file mode 100644 index 00000000..82e863c6 --- /dev/null +++ b/src/execution/mapAsyncIterator.ts @@ -0,0 +1,57 @@ +import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; + +/** + * Given an AsyncIterable and a callback function, return an AsyncIterator + * which produces values mapped via calling the callback function. + */ +export function mapAsyncIterator( + iterable: AsyncGenerator | AsyncIterable, + callback: (value: T) => PromiseOrValue, +): AsyncGenerator { + const iterator = iterable[Symbol.asyncIterator](); + + async function mapResult( + result: IteratorResult, + ): Promise> { + if (result.done) { + return result; + } + + try { + return { value: await callback(result.value), done: false }; + } catch (error) { + /* c8 ignore start */ + // FIXME: add test case + if (typeof iterator.return === 'function') { + try { + await iterator.return(); + } catch (_e) { + /* ignore error */ + } + } + throw error; + /* c8 ignore stop */ + } + } + + return { + async next() { + return mapResult(await iterator.next()); + }, + async return(): Promise> { + // If iterator.return() does not exist, then type R must be undefined. + return typeof iterator.return === 'function' + ? mapResult(await iterator.return()) + : { value: undefined as any, done: true }; + }, + async throw(error?: unknown) { + if (typeof iterator.throw === 'function') { + return mapResult(await iterator.throw(error)); + } + throw error; + }, + [Symbol.asyncIterator]() { + return this; + }, + }; +} diff --git a/src/execution/subscribe.ts b/src/execution/subscribe.ts new file mode 100644 index 00000000..7ff57125 --- /dev/null +++ b/src/execution/subscribe.ts @@ -0,0 +1,253 @@ +import { devAssert } from '../jsutils/devAssert'; +import { inspect } from '../jsutils/inspect'; +import { isAsyncIterable } from '../jsutils/isAsyncIterable'; +import type { Maybe } from '../jsutils/Maybe'; +import { addPath, pathToArray } from '../jsutils/Path'; + +import { GraphQLError } from '../error/GraphQLError'; +import { locatedError } from '../error/locatedError'; + +import type { DocumentNode } from '../language/ast'; + +import type { GraphQLFieldResolver } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; + +import { collectFields } from './collectFields'; +import type { + ExecutionArgs, + ExecutionContext, + ExecutionResult, +} from './execute'; +import { + assertValidExecutionArguments, + buildExecutionContext, + buildResolveInfo, + execute, + getFieldDef, +} from './execute'; +import { mapAsyncIterator } from './mapAsyncIterator'; +import { getArgumentValues } from './values'; + +/** + * Implements the "Subscribe" algorithm described in the GraphQL specification. + * + * Returns a Promise which resolves to either an AsyncIterator (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to an AsyncIterator, which + * yields a stream of ExecutionResults representing the response stream. + * + * Accepts either an object with named arguments, or individual arguments. + */ +export async function subscribe( + args: ExecutionArgs, +): Promise | ExecutionResult> { + // Temporary for v15 to v16 migration. Remove in v17 + devAssert( + arguments.length < 2, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + + const { + schema, + document, + rootValue, + contextValue, + variableValues, + operationName, + fieldResolver, + subscribeFieldResolver, + } = args; + + const resultOrStream = await createSourceEventStream( + schema, + document, + rootValue, + contextValue, + variableValues, + operationName, + subscribeFieldResolver, + ); + + if (!isAsyncIterable(resultOrStream)) { + return resultOrStream; + } + + // For each payload yielded from a subscription, map it over the normal + // GraphQL `execute` function, with `payload` as the rootValue. + // This implements the "MapSourceToResponseEvent" algorithm described in + // the GraphQL specification. The `execute` function provides the + // "ExecuteSubscriptionEvent" algorithm, as it is nearly identical to the + // "ExecuteQuery" algorithm, for which `execute` is also used. + const mapSourceToResponse = (payload: unknown) => + execute({ + schema, + document, + rootValue: payload, + contextValue, + variableValues, + operationName, + fieldResolver, + }); + + // Map every source value to a ExecutionResult value as described above. + return mapAsyncIterator(resultOrStream, mapSourceToResponse); +} + +/** + * Implements the "CreateSourceEventStream" algorithm described in the + * GraphQL specification, resolving the subscription source event stream. + * + * Returns a Promise which resolves to either an AsyncIterable (if successful) + * or an ExecutionResult (error). The promise will be rejected if the schema or + * other arguments to this function are invalid, or if the resolved event stream + * is not an async iterable. + * + * If the client-provided arguments to this function do not result in a + * compliant subscription, a GraphQL Response (ExecutionResult) with + * descriptive errors and no data will be returned. + * + * If the the source stream could not be created due to faulty subscription + * resolver logic or underlying systems, the promise will resolve to a single + * ExecutionResult containing `errors` and no `data`. + * + * If the operation succeeded, the promise resolves to the AsyncIterable for the + * event stream returned by the resolver. + * + * A Source Event Stream represents a sequence of events, each of which triggers + * a GraphQL execution for that event. + * + * This may be useful when hosting the stateful subscription service in a + * different process or machine than the stateless GraphQL execution engine, + * or otherwise separating these two steps. For more on this, see the + * "Supporting Subscriptions at Scale" information in the GraphQL specification. + */ +export async function createSourceEventStream( + schema: GraphQLSchema, + document: DocumentNode, + rootValue?: unknown, + contextValue?: unknown, + variableValues?: Maybe<{ readonly [variable: string]: unknown }>, + operationName?: Maybe, + subscribeFieldResolver?: Maybe>, +): Promise | ExecutionResult> { + // If arguments are missing or incorrectly typed, this is an internal + // developer mistake which should throw an early error. + assertValidExecutionArguments(schema, document, variableValues); + + // If a valid execution context cannot be created due to incorrect arguments, + // a "Response" with only errors is returned. + const exeContext = buildExecutionContext({ + schema, + document, + rootValue, + contextValue, + variableValues, + operationName, + subscribeFieldResolver, + }); + + // Return early errors if execution context failed. + if (!('schema' in exeContext)) { + return { errors: exeContext }; + } + + try { + const eventStream = await executeSubscription(exeContext); + + // Assert field returned an event stream, otherwise yield an error. + if (!isAsyncIterable(eventStream)) { + throw new Error( + 'Subscription field must return Async Iterable. ' + + `Received: ${inspect(eventStream)}.`, + ); + } + + return eventStream; + } catch (error) { + // If it GraphQLError, report it as an ExecutionResult, containing only errors and no data. + // Otherwise treat the error as a system-class error and re-throw it. + if (error instanceof GraphQLError) { + return { errors: [error] }; + } + throw error; + } +} + +async function executeSubscription( + exeContext: ExecutionContext, +): Promise { + const { schema, fragments, operation, variableValues, rootValue } = + exeContext; + + const rootType = schema.getSubscriptionType(); + if (rootType == null) { + throw new GraphQLError( + 'Schema is not configured to execute subscription operation.', + operation, + ); + } + + const rootFields = collectFields( + schema, + fragments, + variableValues, + rootType, + operation.selectionSet, + ); + const [responseName, fieldNodes] = [...rootFields.entries()][0]; + const fieldDef = getFieldDef(schema, rootType, fieldNodes[0]); + + if (!fieldDef) { + const fieldName = fieldNodes[0].name.value; + throw new GraphQLError( + `The subscription field "${fieldName}" is not defined.`, + fieldNodes, + ); + } + + const path = addPath(undefined, responseName, rootType.name); + const info = buildResolveInfo( + exeContext, + fieldDef, + fieldNodes, + rootType, + path, + ); + + try { + // Implements the "ResolveFieldEventStream" algorithm from GraphQL specification. + // It differs from "ResolveFieldValue" due to providing a different `resolveFn`. + + // Build a JS object of arguments from the field.arguments AST, using the + // variables scope to fulfill any variable references. + const args = getArgumentValues(fieldDef, fieldNodes[0], variableValues); + + // The resolve function's optional third argument is a context value that + // is provided to every resolve function within an execution. It is commonly + // used to represent an authenticated user, or request-specific caches. + const contextValue = exeContext.contextValue; + + // Call the `subscribe()` resolver or the default resolver to produce an + // AsyncIterable yielding raw payloads. + const resolveFn = fieldDef.subscribe ?? exeContext.subscribeFieldResolver; + const eventStream = await resolveFn(rootValue, args, contextValue, info); + + if (eventStream instanceof Error) { + throw eventStream; + } + return eventStream; + } catch (error) { + throw locatedError(error, fieldNodes, pathToArray(path)); + } +} diff --git a/src/execution/values.ts b/src/execution/values.ts new file mode 100644 index 00000000..124319a6 --- /dev/null +++ b/src/execution/values.ts @@ -0,0 +1,263 @@ +import { inspect } from '../jsutils/inspect'; +import { keyMap } from '../jsutils/keyMap'; +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import { printPathArray } from '../jsutils/printPathArray'; + +import { GraphQLError } from '../error/GraphQLError'; + +import type { + DirectiveNode, + FieldNode, + VariableDefinitionNode, +} from '../language/ast'; +import { Kind } from '../language/kinds'; +import { print } from '../language/printer'; + +import type { GraphQLField } from '../type/definition'; +import { isInputType, isNonNullType } from '../type/definition'; +import type { GraphQLDirective } from '../type/directives'; +import type { GraphQLSchema } from '../type/schema'; + +import { coerceInputValue } from '../utilities/coerceInputValue'; +import { typeFromAST } from '../utilities/typeFromAST'; +import { valueFromAST } from '../utilities/valueFromAST'; + +type CoercedVariableValues = + | { errors: ReadonlyArray; coerced?: never } + | { coerced: { [variable: string]: unknown }; errors?: never }; + +/** + * Prepares an object map of variableValues of the correct type based on the + * provided variable definitions and arbitrary input. If the input cannot be + * parsed to match the variable definitions, a GraphQLError will be thrown. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + * + * @internal + */ +export function getVariableValues( + schema: GraphQLSchema, + varDefNodes: ReadonlyArray, + inputs: { readonly [variable: string]: unknown }, + options?: { maxErrors?: number }, +): CoercedVariableValues { + const errors = []; + const maxErrors = options?.maxErrors; + try { + const coerced = coerceVariableValues( + schema, + varDefNodes, + inputs, + (error) => { + if (maxErrors != null && errors.length >= maxErrors) { + throw new GraphQLError( + 'Too many errors processing variables, error limit reached. Execution aborted.', + ); + } + errors.push(error); + }, + ); + + if (errors.length === 0) { + return { coerced }; + } + } catch (error) { + errors.push(error); + } + + return { errors }; +} + +function coerceVariableValues( + schema: GraphQLSchema, + varDefNodes: ReadonlyArray, + inputs: { readonly [variable: string]: unknown }, + onError: (error: GraphQLError) => void, +): { [variable: string]: unknown } { + const coercedValues: { [variable: string]: unknown } = {}; + for (const varDefNode of varDefNodes) { + const varName = varDefNode.variable.name.value; + const varType = typeFromAST(schema, varDefNode.type); + if (!isInputType(varType)) { + // Must use input types for variables. This should be caught during + // validation, however is checked again here for safety. + const varTypeStr = print(varDefNode.type); + onError( + new GraphQLError( + `Variable "$${varName}" expected value of type "${varTypeStr}" which cannot be used as an input type.`, + varDefNode.type, + ), + ); + continue; + } + + if (!hasOwnProperty(inputs, varName)) { + if (varDefNode.defaultValue) { + coercedValues[varName] = valueFromAST(varDefNode.defaultValue, varType); + } else if (isNonNullType(varType)) { + const varTypeStr = inspect(varType); + onError( + new GraphQLError( + `Variable "$${varName}" of required type "${varTypeStr}" was not provided.`, + varDefNode, + ), + ); + } + continue; + } + + const value = inputs[varName]; + if (value === null && isNonNullType(varType)) { + const varTypeStr = inspect(varType); + onError( + new GraphQLError( + `Variable "$${varName}" of non-null type "${varTypeStr}" must not be null.`, + varDefNode, + ), + ); + continue; + } + + coercedValues[varName] = coerceInputValue( + value, + varType, + (path, invalidValue, error) => { + let prefix = + `Variable "$${varName}" got invalid value ` + inspect(invalidValue); + if (path.length > 0) { + prefix += ` at "${varName}${printPathArray(path)}"`; + } + onError( + new GraphQLError( + prefix + '; ' + error.message, + varDefNode, + undefined, + undefined, + undefined, + error.originalError, + ), + ); + }, + ); + } + + return coercedValues; +} + +/** + * Prepares an object map of argument values given a list of argument + * definitions and list of argument AST nodes. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + * + * @internal + */ +export function getArgumentValues( + def: GraphQLField | GraphQLDirective, + node: FieldNode | DirectiveNode, + variableValues?: Maybe>, +): { [argument: string]: unknown } { + const coercedValues: { [argument: string]: unknown } = {}; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const argumentNodes = node.arguments ?? []; + const argNodeMap = keyMap(argumentNodes, (arg) => arg.name.value); + + for (const argDef of def.args) { + const name = argDef.name; + const argType = argDef.type; + const argumentNode = argNodeMap[name]; + + if (!argumentNode) { + if (argDef.defaultValue !== undefined) { + coercedValues[name] = argDef.defaultValue; + } else if (isNonNullType(argType)) { + throw new GraphQLError( + `Argument "${name}" of required type "${inspect(argType)}" ` + + 'was not provided.', + node, + ); + } + continue; + } + + const valueNode = argumentNode.value; + let isNull = valueNode.kind === Kind.NULL; + + if (valueNode.kind === Kind.VARIABLE) { + const variableName = valueNode.name.value; + if ( + variableValues == null || + !hasOwnProperty(variableValues, variableName) + ) { + if (argDef.defaultValue !== undefined) { + coercedValues[name] = argDef.defaultValue; + } else if (isNonNullType(argType)) { + throw new GraphQLError( + `Argument "${name}" of required type "${inspect(argType)}" ` + + `was provided the variable "$${variableName}" which was not provided a runtime value.`, + valueNode, + ); + } + continue; + } + isNull = variableValues[variableName] == null; + } + + if (isNull && isNonNullType(argType)) { + throw new GraphQLError( + `Argument "${name}" of non-null type "${inspect(argType)}" ` + + 'must not be null.', + valueNode, + ); + } + + const coercedValue = valueFromAST(valueNode, argType, variableValues); + if (coercedValue === undefined) { + // Note: ValuesOfCorrectTypeRule validation should catch this before + // execution. This is a runtime check to ensure execution does not + // continue with an invalid argument value. + throw new GraphQLError( + `Argument "${name}" has invalid value ${print(valueNode)}.`, + valueNode, + ); + } + coercedValues[name] = coercedValue; + } + return coercedValues; +} + +/** + * Prepares an object map of argument values given a directive definition + * and a AST node which may contain directives. Optionally also accepts a map + * of variable values. + * + * If the directive does not exist on the node, returns undefined. + * + * Note: The returned value is a plain Object with a prototype, since it is + * exposed to user code. Care should be taken to not pull values from the + * Object prototype. + */ +export function getDirectiveValues( + directiveDef: GraphQLDirective, + node: { readonly directives?: ReadonlyArray }, + variableValues?: Maybe>, +): undefined | { [argument: string]: unknown } { + const directiveNode = node.directives?.find( + (directive) => directive.name.value === directiveDef.name, + ); + + if (directiveNode) { + return getArgumentValues(directiveDef, directiveNode, variableValues); + } +} + +function hasOwnProperty(obj: unknown, prop: string): boolean { + return Object.prototype.hasOwnProperty.call(obj, prop); +} diff --git a/src/graphql.ts b/src/graphql.ts new file mode 100644 index 00000000..bc6fb9bb --- /dev/null +++ b/src/graphql.ts @@ -0,0 +1,142 @@ +import { devAssert } from './jsutils/devAssert'; +import { isPromise } from './jsutils/isPromise'; +import type { Maybe } from './jsutils/Maybe'; +import type { PromiseOrValue } from './jsutils/PromiseOrValue'; + +import { parse } from './language/parser'; +import type { Source } from './language/source'; + +import type { + GraphQLFieldResolver, + GraphQLTypeResolver, +} from './type/definition'; +import type { GraphQLSchema } from './type/schema'; +import { validateSchema } from './type/validate'; + +import { validate } from './validation/validate'; + +import type { ExecutionResult } from './execution/execute'; +import { execute } from './execution/execute'; + +/** + * This is the primary entry point function for fulfilling GraphQL operations + * by parsing, validating, and executing a GraphQL document along side a + * GraphQL schema. + * + * More sophisticated GraphQL servers, such as those which persist queries, + * may wish to separate the validation and execution phases to a static time + * tooling step, and a server runtime step. + * + * Accepts either an object with named arguments, or individual arguments: + * + * schema: + * The GraphQL type system to use when validating and executing a query. + * source: + * A GraphQL language formatted string representing the requested operation. + * rootValue: + * The value provided as the first argument to resolver functions on the top + * level type (e.g. the query object type). + * contextValue: + * The context value is provided as an argument to resolver functions after + * field arguments. It is used to pass shared information useful at any point + * during executing this query, for example the currently logged in user and + * connections to databases or other services. + * variableValues: + * A mapping of variable name to runtime value to use for all variables + * defined in the requestString. + * operationName: + * The name of the operation to use if requestString contains multiple + * possible operations. Can be omitted if requestString contains only + * one operation. + * fieldResolver: + * A resolver function to use when one is not provided by the schema. + * If not provided, the default field resolver is used (which looks for a + * value or method on the source value with the field's name). + * typeResolver: + * A type resolver function to use when none is provided by the schema. + * If not provided, the default type resolver is used (which looks for a + * `__typename` field or alternatively calls the `isTypeOf` method). + */ +export interface GraphQLArgs { + schema: GraphQLSchema; + source: string | Source; + rootValue?: unknown; + contextValue?: unknown; + variableValues?: Maybe<{ readonly [variable: string]: unknown }>; + operationName?: Maybe; + fieldResolver?: Maybe>; + typeResolver?: Maybe>; +} + +export function graphql(args: GraphQLArgs): Promise { + // Always return a Promise for a consistent API. + return new Promise((resolve) => resolve(graphqlImpl(args))); +} + +/** + * The graphqlSync function also fulfills GraphQL operations by parsing, + * validating, and executing a GraphQL document along side a GraphQL schema. + * However, it guarantees to complete synchronously (or throw an error) assuming + * that all field resolvers are also synchronous. + */ +export function graphqlSync(args: GraphQLArgs): ExecutionResult { + const result = graphqlImpl(args); + + // Assert that the execution was synchronous. + if (isPromise(result)) { + throw new Error('GraphQL execution failed to complete synchronously.'); + } + + return result; +} + +function graphqlImpl(args: GraphQLArgs): PromiseOrValue { + // Temporary for v15 to v16 migration. Remove in v17 + devAssert( + arguments.length < 2, + 'graphql@16 dropped long-deprecated support for positional arguments, please pass an object instead.', + ); + + const { + schema, + source, + rootValue, + contextValue, + variableValues, + operationName, + fieldResolver, + typeResolver, + } = args; + + // Validate Schema + const schemaValidationErrors = validateSchema(schema); + if (schemaValidationErrors.length > 0) { + return { errors: schemaValidationErrors }; + } + + // Parse + let document; + try { + document = parse(source); + } catch (syntaxError) { + return { errors: [syntaxError] }; + } + + // Validate + const validationErrors = validate(schema, document); + if (validationErrors.length > 0) { + return { errors: validationErrors }; + } + + // Execute + return execute({ + schema, + document, + rootValue, + contextValue, + variableValues, + operationName, + fieldResolver, + typeResolver, + }); +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 00000000..bde23ad5 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,485 @@ +/** + * GraphQL.js provides a reference implementation for the GraphQL specification + * but is also a useful utility for operating on GraphQL files and building + * sophisticated tools. + * + * This primary module exports a general purpose function for fulfilling all + * steps of the GraphQL specification in a single operation, but also includes + * utilities for every part of the GraphQL specification: + * + * - Parsing the GraphQL language. + * - Building a GraphQL type schema. + * - Validating a GraphQL request against a type schema. + * - Executing a GraphQL request against a type schema. + * + * This also includes utility functions for operating on GraphQL types and + * GraphQL documents to facilitate building tools. + * + * You may also import from each sub-directory directly. For example, the + * following two import statements are equivalent: + * + * ```ts + * import { parse } from 'graphql'; + * import { parse } from 'graphql/language'; + * ``` + * + * @packageDocumentation + */ + +// The GraphQL.js version info. +export { version, versionInfo } from './version'; + +// The primary entry point into fulfilling a GraphQL request. +export type { GraphQLArgs } from './graphql'; +export { graphql, graphqlSync } from './graphql'; + +// Create and operate on GraphQL type definitions and schema. +export { + resolveObjMapThunk, + resolveReadonlyArrayThunk, + // Definitions + GraphQLSchema, + GraphQLDirective, + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, + // Standard GraphQL Scalars + specifiedScalarTypes, + GraphQLInt, + GraphQLFloat, + GraphQLString, + GraphQLBoolean, + GraphQLID, + // Int boundaries constants + GRAPHQL_MAX_INT, + GRAPHQL_MIN_INT, + // Built-in Directives defined by the Spec + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, + // "Enum" of Type Kinds + TypeKind, + // Constant Deprecation Reason + DEFAULT_DEPRECATION_REASON, + // GraphQL Types for introspection. + introspectionTypes, + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, + // Meta-field definitions. + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, + // Predicates + isSchema, + isDirective, + isType, + isScalarType, + isObjectType, + isInterfaceType, + isUnionType, + isEnumType, + isInputObjectType, + isListType, + isNonNullType, + isInputType, + isOutputType, + isLeafType, + isCompositeType, + isAbstractType, + isWrappingType, + isNullableType, + isNamedType, + isRequiredArgument, + isRequiredInputField, + isSpecifiedScalarType, + isIntrospectionType, + isSpecifiedDirective, + // Assertions + assertSchema, + assertDirective, + assertType, + assertScalarType, + assertObjectType, + assertInterfaceType, + assertUnionType, + assertEnumType, + assertInputObjectType, + assertListType, + assertNonNullType, + assertInputType, + assertOutputType, + assertLeafType, + assertCompositeType, + assertAbstractType, + assertWrappingType, + assertNullableType, + assertNamedType, + // Un-modifiers + getNullableType, + getNamedType, + // Validate GraphQL schema. + validateSchema, + assertValidSchema, + // Upholds the spec rules about naming. + assertName, + assertEnumValueName, +} from './type/index'; + +export type { + GraphQLType, + GraphQLInputType, + GraphQLOutputType, + GraphQLLeafType, + GraphQLCompositeType, + GraphQLAbstractType, + GraphQLWrappingType, + GraphQLNullableType, + GraphQLNamedType, + GraphQLNamedInputType, + GraphQLNamedOutputType, + ThunkReadonlyArray, + ThunkObjMap, + GraphQLSchemaConfig, + GraphQLSchemaExtensions, + GraphQLDirectiveConfig, + GraphQLDirectiveExtensions, + GraphQLArgument, + GraphQLArgumentConfig, + GraphQLArgumentExtensions, + GraphQLEnumTypeConfig, + GraphQLEnumTypeExtensions, + GraphQLEnumValue, + GraphQLEnumValueConfig, + GraphQLEnumValueConfigMap, + GraphQLEnumValueExtensions, + GraphQLField, + GraphQLFieldConfig, + GraphQLFieldConfigArgumentMap, + GraphQLFieldConfigMap, + GraphQLFieldExtensions, + GraphQLFieldMap, + GraphQLFieldResolver, + GraphQLInputField, + GraphQLInputFieldConfig, + GraphQLInputFieldConfigMap, + GraphQLInputFieldExtensions, + GraphQLInputFieldMap, + GraphQLInputObjectTypeConfig, + GraphQLInputObjectTypeExtensions, + GraphQLInterfaceTypeConfig, + GraphQLInterfaceTypeExtensions, + GraphQLIsTypeOfFn, + GraphQLObjectTypeConfig, + GraphQLObjectTypeExtensions, + GraphQLResolveInfo, + ResponsePath, + GraphQLScalarTypeConfig, + GraphQLScalarTypeExtensions, + GraphQLTypeResolver, + GraphQLUnionTypeConfig, + GraphQLUnionTypeExtensions, + GraphQLScalarSerializer, + GraphQLScalarValueParser, + GraphQLScalarLiteralParser, +} from './type/index'; + +// Parse and operate on GraphQL language source files. +export { + Token, + Source, + Location, + OperationTypeNode, + getLocation, + // Print source location. + printLocation, + printSourceLocation, + // Lex + Lexer, + TokenKind, + // Parse + parse, + parseValue, + parseConstValue, + parseType, + // Print + print, + // Visit + visit, + visitInParallel, + getVisitFn, + getEnterLeaveForKind, + BREAK, + Kind, + DirectiveLocation, + // Predicates + isDefinitionNode, + isExecutableDefinitionNode, + isSelectionNode, + isValueNode, + isConstValueNode, + isTypeNode, + isTypeSystemDefinitionNode, + isTypeDefinitionNode, + isTypeSystemExtensionNode, + isTypeExtensionNode, +} from './language/index'; + +export type { + ParseOptions, + SourceLocation, + TokenKindEnum, + KindEnum, + DirectiveLocationEnum, + // Visitor utilities + ASTVisitor, + ASTVisitFn, + ASTVisitorKeyMap, + // AST nodes + ASTNode, + ASTKindToNode, + // Each kind of AST node + NameNode, + DocumentNode, + DefinitionNode, + ExecutableDefinitionNode, + OperationDefinitionNode, + VariableDefinitionNode, + VariableNode, + SelectionSetNode, + SelectionNode, + FieldNode, + ArgumentNode, + ConstArgumentNode, + FragmentSpreadNode, + InlineFragmentNode, + FragmentDefinitionNode, + ValueNode, + ConstValueNode, + IntValueNode, + FloatValueNode, + StringValueNode, + BooleanValueNode, + NullValueNode, + EnumValueNode, + ListValueNode, + ConstListValueNode, + ObjectValueNode, + ConstObjectValueNode, + ObjectFieldNode, + ConstObjectFieldNode, + DirectiveNode, + ConstDirectiveNode, + TypeNode, + NamedTypeNode, + ListTypeNode, + NonNullTypeNode, + TypeSystemDefinitionNode, + SchemaDefinitionNode, + OperationTypeDefinitionNode, + TypeDefinitionNode, + ScalarTypeDefinitionNode, + ObjectTypeDefinitionNode, + FieldDefinitionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + UnionTypeDefinitionNode, + EnumTypeDefinitionNode, + EnumValueDefinitionNode, + InputObjectTypeDefinitionNode, + DirectiveDefinitionNode, + TypeSystemExtensionNode, + SchemaExtensionNode, + TypeExtensionNode, + ScalarTypeExtensionNode, + ObjectTypeExtensionNode, + InterfaceTypeExtensionNode, + UnionTypeExtensionNode, + EnumTypeExtensionNode, + InputObjectTypeExtensionNode, +} from './language/index'; + +// Execute GraphQL queries. +export { + execute, + executeSync, + defaultFieldResolver, + defaultTypeResolver, + responsePathAsArray, + getDirectiveValues, + subscribe, + createSourceEventStream, +} from './execution/index'; + +export type { + ExecutionArgs, + ExecutionResult, + FormattedExecutionResult, +} from './execution/index'; + +export type { SubscriptionArgs } from './subscription/index'; + +// Validate GraphQL documents. +export { + validate, + ValidationContext, + // All validation rules in the GraphQL Specification. + specifiedRules, + // Individual validation rules. + ExecutableDefinitionsRule, + FieldsOnCorrectTypeRule, + FragmentsOnCompositeTypesRule, + KnownArgumentNamesRule, + KnownDirectivesRule, + KnownFragmentNamesRule, + KnownTypeNamesRule, + LoneAnonymousOperationRule, + NoFragmentCyclesRule, + NoUndefinedVariablesRule, + NoUnusedFragmentsRule, + NoUnusedVariablesRule, + OverlappingFieldsCanBeMergedRule, + PossibleFragmentSpreadsRule, + ProvidedRequiredArgumentsRule, + ScalarLeafsRule, + SingleFieldSubscriptionsRule, + UniqueArgumentNamesRule, + UniqueDirectivesPerLocationRule, + UniqueFragmentNamesRule, + UniqueInputFieldNamesRule, + UniqueOperationNamesRule, + UniqueVariableNamesRule, + ValuesOfCorrectTypeRule, + VariablesAreInputTypesRule, + VariablesInAllowedPositionRule, + // SDL-specific validation rules + LoneSchemaDefinitionRule, + UniqueOperationTypesRule, + UniqueTypeNamesRule, + UniqueEnumValueNamesRule, + UniqueFieldDefinitionNamesRule, + UniqueArgumentDefinitionNamesRule, + UniqueDirectiveNamesRule, + PossibleTypeExtensionsRule, + // Custom validation rules + NoDeprecatedCustomRule, + NoSchemaIntrospectionCustomRule, +} from './validation/index'; + +export type { ValidationRule } from './validation/index'; + +// Create, format, and print GraphQL errors. +export { + GraphQLError, + syntaxError, + locatedError, + printError, + formatError, +} from './error/index'; + +export type { + GraphQLFormattedError, + GraphQLErrorExtensions, +} from './error/index'; + +// Utilities for operating on GraphQL type schema and parsed sources. +export { + // Produce the GraphQL query recommended for a full schema introspection. + // Accepts optional IntrospectionOptions. + getIntrospectionQuery, + // Gets the target Operation from a Document. + getOperationAST, + // Gets the Type for the target Operation AST. + getOperationRootType, + // Convert a GraphQLSchema to an IntrospectionQuery. + introspectionFromSchema, + // Build a GraphQLSchema from an introspection result. + buildClientSchema, + // Build a GraphQLSchema from a parsed GraphQL Schema language AST. + buildASTSchema, + // Build a GraphQLSchema from a GraphQL schema language document. + buildSchema, + // Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. + extendSchema, + // Sort a GraphQLSchema. + lexicographicSortSchema, + // Print a GraphQLSchema to GraphQL Schema language. + printSchema, + // Print a GraphQLType to GraphQL Schema language. + printType, + // Prints the built-in introspection schema in the Schema Language format. + printIntrospectionSchema, + // Create a GraphQLType from a GraphQL language AST. + typeFromAST, + // Create a JavaScript value from a GraphQL language AST with a Type. + valueFromAST, + // Create a JavaScript value from a GraphQL language AST without a Type. + valueFromASTUntyped, + // Create a GraphQL language AST from a JavaScript value. + astFromValue, + // A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system. + TypeInfo, + visitWithTypeInfo, + // Coerces a JavaScript value to a GraphQL type, or produces errors. + coerceInputValue, + // Concatenates multiple AST together. + concatAST, + // Separates an AST into an AST per Operation. + separateOperations, + // Strips characters that are not significant to the validity or execution of a GraphQL document. + stripIgnoredCharacters, + // Comparators for types + isEqualType, + isTypeSubTypeOf, + doTypesOverlap, + // Asserts a string is a valid GraphQL name. + assertValidName, + // Determine if a string is a valid GraphQL name. + isValidNameError, + // Compares two GraphQLSchemas and detects breaking changes. + BreakingChangeType, + DangerousChangeType, + findBreakingChanges, + findDangerousChanges, +} from './utilities/index'; + +export type { + IntrospectionOptions, + IntrospectionQuery, + IntrospectionSchema, + IntrospectionType, + IntrospectionInputType, + IntrospectionOutputType, + IntrospectionScalarType, + IntrospectionObjectType, + IntrospectionInterfaceType, + IntrospectionUnionType, + IntrospectionEnumType, + IntrospectionInputObjectType, + IntrospectionTypeRef, + IntrospectionInputTypeRef, + IntrospectionOutputTypeRef, + IntrospectionNamedTypeRef, + IntrospectionListTypeRef, + IntrospectionNonNullTypeRef, + IntrospectionField, + IntrospectionInputValue, + IntrospectionEnumValue, + IntrospectionDirective, + BuildSchemaOptions, + BreakingChange, + DangerousChange, + TypedQueryDocumentNode, +} from './utilities/index'; diff --git a/src/jsutils/Maybe.ts b/src/jsutils/Maybe.ts new file mode 100644 index 00000000..0ba64a4b --- /dev/null +++ b/src/jsutils/Maybe.ts @@ -0,0 +1,2 @@ +/** Conveniently represents flow's "Maybe" type https://flow.org/en/docs/types/maybe/ */ +export type Maybe = null | undefined | T; diff --git a/src/jsutils/ObjMap.ts b/src/jsutils/ObjMap.ts new file mode 100644 index 00000000..2c202821 --- /dev/null +++ b/src/jsutils/ObjMap.ts @@ -0,0 +1,13 @@ +export interface ObjMap { + [key: string]: T; +} + +export type ObjMapLike = ObjMap | { [key: string]: T }; + +export interface ReadOnlyObjMap { + readonly [key: string]: T; +} + +export type ReadOnlyObjMapLike = + | ReadOnlyObjMap + | { readonly [key: string]: T }; diff --git a/src/jsutils/Path.ts b/src/jsutils/Path.ts new file mode 100644 index 00000000..64f6c783 --- /dev/null +++ b/src/jsutils/Path.ts @@ -0,0 +1,33 @@ +import type { Maybe } from './Maybe'; + +export interface Path { + readonly prev: Path | undefined; + readonly key: string | number; + readonly typename: string | undefined; +} + +/** + * Given a Path and a key, return a new Path containing the new key. + */ +export function addPath( + prev: Readonly | undefined, + key: string | number, + typename: string | undefined, +): Path { + return { prev, key, typename }; +} + +/** + * Given a Path, return an Array of the path keys. + */ +export function pathToArray( + path: Maybe>, +): Array { + const flattened = []; + let curr = path; + while (curr) { + flattened.push(curr.key); + curr = curr.prev; + } + return flattened.reverse(); +} diff --git a/src/jsutils/PromiseOrValue.ts b/src/jsutils/PromiseOrValue.ts new file mode 100644 index 00000000..6b2517ee --- /dev/null +++ b/src/jsutils/PromiseOrValue.ts @@ -0,0 +1 @@ +export type PromiseOrValue = Promise | T; diff --git a/src/jsutils/README.md b/src/jsutils/README.md new file mode 100644 index 00000000..9eb96485 --- /dev/null +++ b/src/jsutils/README.md @@ -0,0 +1,8 @@ +## JavaScript Utils + +This directory contains dependency-free JavaScript utility functions used +throughout the codebase. + +Each utility should belong in its own file and be the default export. + +These functions are not part of the module interface and are subject to change. diff --git a/src/jsutils/__tests__/Path-test.ts b/src/jsutils/__tests__/Path-test.ts new file mode 100644 index 00000000..43bca192 --- /dev/null +++ b/src/jsutils/__tests__/Path-test.ts @@ -0,0 +1,36 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { addPath, pathToArray } from '../Path'; + +describe('Path', () => { + it('can create a Path', () => { + const first = addPath(undefined, 1, 'First'); + + expect(first).to.deep.equal({ + prev: undefined, + key: 1, + typename: 'First', + }); + }); + + it('can add a new key to an existing Path', () => { + const first = addPath(undefined, 1, 'First'); + const second = addPath(first, 'two', 'Second'); + + expect(second).to.deep.equal({ + prev: first, + key: 'two', + typename: 'Second', + }); + }); + + it('can convert a Path to an array of its keys', () => { + const root = addPath(undefined, 0, 'Root'); + const first = addPath(root, 'one', 'First'); + const second = addPath(first, 2, 'Second'); + + const path = pathToArray(second); + expect(path).to.deep.equal([0, 'one', 2]); + }); +}); diff --git a/src/jsutils/__tests__/didYouMean-test.ts b/src/jsutils/__tests__/didYouMean-test.ts new file mode 100644 index 00000000..bc01e180 --- /dev/null +++ b/src/jsutils/__tests__/didYouMean-test.ts @@ -0,0 +1,36 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { didYouMean } from '../didYouMean'; + +describe('didYouMean', () => { + it('Does accept an empty list', () => { + expect(didYouMean([])).to.equal(''); + }); + + it('Handles single suggestion', () => { + expect(didYouMean(['A'])).to.equal(' Did you mean "A"?'); + }); + + it('Handles two suggestions', () => { + expect(didYouMean(['A', 'B'])).to.equal(' Did you mean "A" or "B"?'); + }); + + it('Handles multiple suggestions', () => { + expect(didYouMean(['A', 'B', 'C'])).to.equal( + ' Did you mean "A", "B", or "C"?', + ); + }); + + it('Limits to five suggestions', () => { + expect(didYouMean(['A', 'B', 'C', 'D', 'E', 'F'])).to.equal( + ' Did you mean "A", "B", "C", "D", or "E"?', + ); + }); + + it('Adds sub-message', () => { + expect(didYouMean('the letter', ['A'])).to.equal( + ' Did you mean the letter "A"?', + ); + }); +}); diff --git a/src/jsutils/__tests__/identityFunc-test.ts b/src/jsutils/__tests__/identityFunc-test.ts new file mode 100644 index 00000000..97cc25eb --- /dev/null +++ b/src/jsutils/__tests__/identityFunc-test.ts @@ -0,0 +1,16 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { identityFunc } from '../identityFunc'; + +describe('identityFunc', () => { + it('returns the first argument it receives', () => { + // @ts-expect-error (Expects an argument) + expect(identityFunc()).to.equal(undefined); + expect(identityFunc(undefined)).to.equal(undefined); + expect(identityFunc(null)).to.equal(null); + + const obj = {}; + expect(identityFunc(obj)).to.equal(obj); + }); +}); diff --git a/src/jsutils/__tests__/inspect-test.ts b/src/jsutils/__tests__/inspect-test.ts new file mode 100644 index 00000000..d1ac1731 --- /dev/null +++ b/src/jsutils/__tests__/inspect-test.ts @@ -0,0 +1,187 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { inspect } from '../inspect'; + +describe('inspect', () => { + it('undefined', () => { + expect(inspect(undefined)).to.equal('undefined'); + }); + + it('null', () => { + expect(inspect(null)).to.equal('null'); + }); + + it('boolean', () => { + expect(inspect(true)).to.equal('true'); + expect(inspect(false)).to.equal('false'); + }); + + it('string', () => { + expect(inspect('')).to.equal('""'); + expect(inspect('abc')).to.equal('"abc"'); + expect(inspect('"')).to.equal('"\\""'); + }); + + it('number', () => { + expect(inspect(0.0)).to.equal('0'); + expect(inspect(3.14)).to.equal('3.14'); + expect(inspect(NaN)).to.equal('NaN'); + expect(inspect(Infinity)).to.equal('Infinity'); + expect(inspect(-Infinity)).to.equal('-Infinity'); + }); + + it('function', () => { + const unnamedFuncStr = inspect( + // Never called and used as a placeholder + /* c8 ignore next */ + () => expect.fail('Should not be called'), + ); + expect(unnamedFuncStr).to.equal('[function]'); + + // Never called and used as a placeholder + /* c8 ignore next 3 */ + function namedFunc() { + expect.fail('Should not be called'); + } + expect(inspect(namedFunc)).to.equal('[function namedFunc]'); + }); + + it('array', () => { + expect(inspect([])).to.equal('[]'); + expect(inspect([null])).to.equal('[null]'); + expect(inspect([1, NaN])).to.equal('[1, NaN]'); + expect(inspect([['a', 'b'], 'c'])).to.equal('[["a", "b"], "c"]'); + + expect(inspect([[[]]])).to.equal('[[[]]]'); + expect(inspect([[['a']]])).to.equal('[[[Array]]]'); + + expect(inspect([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])).to.equal( + '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]', + ); + + expect(inspect([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10])).to.equal( + '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ... 1 more item]', + ); + + expect(inspect([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])).to.equal( + '[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ... 2 more items]', + ); + }); + + it('object', () => { + expect(inspect({})).to.equal('{}'); + expect(inspect({ a: 1 })).to.equal('{ a: 1 }'); + expect(inspect({ a: 1, b: 2 })).to.equal('{ a: 1, b: 2 }'); + expect(inspect({ array: [null, 0] })).to.equal('{ array: [null, 0] }'); + + expect(inspect({ a: { b: {} } })).to.equal('{ a: { b: {} } }'); + expect(inspect({ a: { b: { c: 1 } } })).to.equal('{ a: { b: [Object] } }'); + + const map = Object.create(null); + map.a = true; + map.b = null; + expect(inspect(map)).to.equal('{ a: true, b: null }'); + }); + + it('use toJSON if provided', () => { + const object = { + toJSON() { + return ''; + }, + }; + + expect(inspect(object)).to.equal(''); + }); + + it('handles toJSON that return `this` should work', () => { + const object = { + toJSON() { + return this; + }, + }; + + expect(inspect(object)).to.equal('{ toJSON: [function toJSON] }'); + }); + + it('handles toJSON returning object values', () => { + const object = { + toJSON() { + return { json: 'value' }; + }, + }; + + expect(inspect(object)).to.equal('{ json: "value" }'); + }); + + it('handles toJSON function that uses this', () => { + const object = { + str: 'Hello World!', + toJSON() { + return this.str; + }, + }; + + expect(inspect(object)).to.equal('Hello World!'); + }); + + it('detect circular objects', () => { + const obj: { [name: string]: unknown } = {}; + obj.self = obj; + obj.deepSelf = { self: obj }; + + expect(inspect(obj)).to.equal( + '{ self: [Circular], deepSelf: { self: [Circular] } }', + ); + + const array: any = []; + array[0] = array; + array[1] = [array]; + + expect(inspect(array)).to.equal('[[Circular], [[Circular]]]'); + + const mixed: any = { array: [] }; + mixed.array[0] = mixed; + + expect(inspect(mixed)).to.equal('{ array: [[Circular]] }'); + + const customA = { + toJSON: () => customB, + }; + + const customB = { + toJSON: () => customA, + }; + + expect(inspect(customA)).to.equal('[Circular]'); + }); + + it('Use class names for the short form of an object', () => { + class Foo { + foo: string; + + constructor() { + this.foo = 'bar'; + } + } + + expect(inspect([[new Foo()]])).to.equal('[[[Foo]]]'); + + class Foo2 { + foo: string; + + [Symbol.toStringTag] = 'Bar'; + + constructor() { + this.foo = 'bar'; + } + } + expect(inspect([[new Foo2()]])).to.equal('[[[Bar]]]'); + + // eslint-disable-next-line func-names + const objectWithoutClassName = new (function (this: any) { + this.foo = 1; + } as any)(); + expect(inspect([[objectWithoutClassName]])).to.equal('[[[Object]]]'); + }); +}); diff --git a/src/jsutils/__tests__/instanceOf-test.ts b/src/jsutils/__tests__/instanceOf-test.ts new file mode 100644 index 00000000..cbd649bf --- /dev/null +++ b/src/jsutils/__tests__/instanceOf-test.ts @@ -0,0 +1,79 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { instanceOf } from '../instanceOf'; + +describe('instanceOf', () => { + it('do not throw on values without prototype', () => { + class Foo { + get [Symbol.toStringTag]() { + return 'Foo'; + } + } + + expect(instanceOf(true, Foo)).to.equal(false); + expect(instanceOf(null, Foo)).to.equal(false); + expect(instanceOf(Object.create(null), Foo)).to.equal(false); + }); + + it('detect name clashes with older versions of this lib', () => { + function oldVersion() { + class Foo {} + return Foo; + } + + function newVersion() { + class Foo { + get [Symbol.toStringTag]() { + return 'Foo'; + } + } + return Foo; + } + + const NewClass = newVersion(); + const OldClass = oldVersion(); + expect(instanceOf(new NewClass(), NewClass)).to.equal(true); + expect(() => instanceOf(new OldClass(), NewClass)).to.throw(); + }); + + it('allows instances to have share the same constructor name', () => { + function getMinifiedClass(tag: string) { + class SomeNameAfterMinification { + get [Symbol.toStringTag]() { + return tag; + } + } + return SomeNameAfterMinification; + } + + const Foo = getMinifiedClass('Foo'); + const Bar = getMinifiedClass('Bar'); + expect(instanceOf(new Foo(), Bar)).to.equal(false); + expect(instanceOf(new Bar(), Foo)).to.equal(false); + + const DuplicateOfFoo = getMinifiedClass('Foo'); + expect(() => instanceOf(new DuplicateOfFoo(), Foo)).to.throw(); + expect(() => instanceOf(new Foo(), DuplicateOfFoo)).to.throw(); + }); + + it('fails with descriptive error message', () => { + function getFoo() { + class Foo { + get [Symbol.toStringTag]() { + return 'Foo'; + } + } + return Foo; + } + const Foo1 = getFoo(); + const Foo2 = getFoo(); + + expect(() => instanceOf(new Foo1(), Foo2)).to.throw( + /^Cannot use Foo "{}" from another module or realm./m, + ); + expect(() => instanceOf(new Foo2(), Foo1)).to.throw( + /^Cannot use Foo "{}" from another module or realm./m, + ); + }); +}); diff --git a/src/jsutils/__tests__/invariant-test.ts b/src/jsutils/__tests__/invariant-test.ts new file mode 100644 index 00000000..2a438b69 --- /dev/null +++ b/src/jsutils/__tests__/invariant-test.ts @@ -0,0 +1,14 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { invariant } from '../invariant'; + +describe('invariant', () => { + it('throws on false conditions', () => { + expect(() => invariant(false, 'Oops!')).to.throw('Oops!'); + }); + + it('use default error message', () => { + expect(() => invariant(false)).to.throw('Unexpected invariant triggered.'); + }); +}); diff --git a/src/jsutils/__tests__/isAsyncIterable-test.ts b/src/jsutils/__tests__/isAsyncIterable-test.ts new file mode 100644 index 00000000..e62bb534 --- /dev/null +++ b/src/jsutils/__tests__/isAsyncIterable-test.ts @@ -0,0 +1,52 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { identityFunc } from '../identityFunc'; +import { isAsyncIterable } from '../isAsyncIterable'; + +describe('isAsyncIterable', () => { + it('should return `true` for AsyncIterable', () => { + const asyncIterable = { [Symbol.asyncIterator]: identityFunc }; + expect(isAsyncIterable(asyncIterable)).to.equal(true); + + async function* asyncGeneratorFunc() { + /* do nothing */ + } + + expect(isAsyncIterable(asyncGeneratorFunc())).to.equal(true); + + // But async generator function itself is not iterable + expect(isAsyncIterable(asyncGeneratorFunc)).to.equal(false); + }); + + it('should return `false` for all other values', () => { + expect(isAsyncIterable(null)).to.equal(false); + expect(isAsyncIterable(undefined)).to.equal(false); + + expect(isAsyncIterable('ABC')).to.equal(false); + expect(isAsyncIterable('0')).to.equal(false); + expect(isAsyncIterable('')).to.equal(false); + + expect(isAsyncIterable([])).to.equal(false); + expect(isAsyncIterable(new Int8Array(1))).to.equal(false); + + expect(isAsyncIterable({})).to.equal(false); + expect(isAsyncIterable({ iterable: true })).to.equal(false); + + const asyncIteratorWithoutSymbol = { next: identityFunc }; + expect(isAsyncIterable(asyncIteratorWithoutSymbol)).to.equal(false); + + const nonAsyncIterable = { [Symbol.iterator]: identityFunc }; + expect(isAsyncIterable(nonAsyncIterable)).to.equal(false); + + function* generatorFunc() { + /* do nothing */ + } + expect(isAsyncIterable(generatorFunc())).to.equal(false); + + const invalidAsyncIterable = { + [Symbol.asyncIterator]: { next: identityFunc }, + }; + expect(isAsyncIterable(invalidAsyncIterable)).to.equal(false); + }); +}); diff --git a/src/jsutils/__tests__/isIterableObject-test.ts b/src/jsutils/__tests__/isIterableObject-test.ts new file mode 100644 index 00000000..c631cb4b --- /dev/null +++ b/src/jsutils/__tests__/isIterableObject-test.ts @@ -0,0 +1,70 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { identityFunc } from '../identityFunc'; +import { isIterableObject } from '../isIterableObject'; + +describe('isIterableObject', () => { + it('should return `true` for collections', () => { + expect(isIterableObject([])).to.equal(true); + expect(isIterableObject(new Int8Array(1))).to.equal(true); + + // eslint-disable-next-line no-new-wrappers + expect(isIterableObject(new String('ABC'))).to.equal(true); + + function getArguments() { + return arguments; + } + expect(isIterableObject(getArguments())).to.equal(true); + + const iterable = { [Symbol.iterator]: identityFunc }; + expect(isIterableObject(iterable)).to.equal(true); + + function* generatorFunc() { + /* do nothing */ + } + expect(isIterableObject(generatorFunc())).to.equal(true); + + // But generator function itself is not iterable + expect(isIterableObject(generatorFunc)).to.equal(false); + }); + + it('should return `false` for non-collections', () => { + expect(isIterableObject(null)).to.equal(false); + expect(isIterableObject(undefined)).to.equal(false); + + expect(isIterableObject('ABC')).to.equal(false); + expect(isIterableObject('0')).to.equal(false); + expect(isIterableObject('')).to.equal(false); + + expect(isIterableObject(1)).to.equal(false); + expect(isIterableObject(0)).to.equal(false); + expect(isIterableObject(NaN)).to.equal(false); + // eslint-disable-next-line no-new-wrappers + expect(isIterableObject(new Number(123))).to.equal(false); + + expect(isIterableObject(true)).to.equal(false); + expect(isIterableObject(false)).to.equal(false); + // eslint-disable-next-line no-new-wrappers + expect(isIterableObject(new Boolean(true))).to.equal(false); + + expect(isIterableObject({})).to.equal(false); + expect(isIterableObject({ iterable: true })).to.equal(false); + + const iteratorWithoutSymbol = { next: identityFunc }; + expect(isIterableObject(iteratorWithoutSymbol)).to.equal(false); + + const invalidIterable = { + [Symbol.iterator]: { next: identityFunc }, + }; + expect(isIterableObject(invalidIterable)).to.equal(false); + + const arrayLike: { [key: string]: unknown } = {}; + arrayLike[0] = 'Alpha'; + arrayLike[1] = 'Bravo'; + arrayLike[2] = 'Charlie'; + arrayLike.length = 3; + + expect(isIterableObject(arrayLike)).to.equal(false); + }); +}); diff --git a/src/jsutils/__tests__/isObjectLike-test.ts b/src/jsutils/__tests__/isObjectLike-test.ts new file mode 100644 index 00000000..536ecb5f --- /dev/null +++ b/src/jsutils/__tests__/isObjectLike-test.ts @@ -0,0 +1,22 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { identityFunc } from '../identityFunc'; +import { isObjectLike } from '../isObjectLike'; + +describe('isObjectLike', () => { + it('should return `true` for objects', () => { + expect(isObjectLike({})).to.equal(true); + expect(isObjectLike(Object.create(null))).to.equal(true); + expect(isObjectLike(/a/)).to.equal(true); + expect(isObjectLike([])).to.equal(true); + }); + + it('should return `false` for non-objects', () => { + expect(isObjectLike(undefined)).to.equal(false); + expect(isObjectLike(null)).to.equal(false); + expect(isObjectLike(true)).to.equal(false); + expect(isObjectLike('')).to.equal(false); + expect(isObjectLike(identityFunc)).to.equal(false); + }); +}); diff --git a/src/jsutils/__tests__/naturalCompare-test.ts b/src/jsutils/__tests__/naturalCompare-test.ts new file mode 100644 index 00000000..4c5291e5 --- /dev/null +++ b/src/jsutils/__tests__/naturalCompare-test.ts @@ -0,0 +1,72 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { naturalCompare } from '../naturalCompare'; + +describe('naturalCompare', () => { + it('Handles empty strings', () => { + expect(naturalCompare('', '')).to.equal(0); + + expect(naturalCompare('', 'a')).to.equal(-1); + expect(naturalCompare('', '1')).to.equal(-1); + + expect(naturalCompare('a', '')).to.equal(1); + expect(naturalCompare('1', '')).to.equal(1); + }); + + it('Handles strings of different length', () => { + expect(naturalCompare('A', 'A')).to.equal(0); + expect(naturalCompare('A1', 'A1')).to.equal(0); + + expect(naturalCompare('A', 'AA')).to.equal(-1); + expect(naturalCompare('A1', 'A1A')).to.equal(-1); + + expect(naturalCompare('AA', 'A')).to.equal(1); + expect(naturalCompare('A1A', 'A1')).to.equal(1); + }); + + it('Handles numbers', () => { + expect(naturalCompare('0', '0')).to.equal(0); + expect(naturalCompare('1', '1')).to.equal(0); + + expect(naturalCompare('1', '2')).to.equal(-1); + expect(naturalCompare('2', '1')).to.equal(1); + + expect(naturalCompare('2', '11')).to.equal(-1); + expect(naturalCompare('11', '2')).to.equal(1); + }); + + it('Handles numbers with leading zeros', () => { + expect(naturalCompare('00', '00')).to.equal(0); + expect(naturalCompare('0', '00')).to.equal(-1); + expect(naturalCompare('00', '0')).to.equal(1); + + expect(naturalCompare('02', '11')).to.equal(-1); + expect(naturalCompare('11', '02')).to.equal(1); + + expect(naturalCompare('011', '200')).to.equal(-1); + expect(naturalCompare('200', '011')).to.equal(1); + }); + + it('Handles numbers embedded into names', () => { + expect(naturalCompare('a0a', 'a0a')).to.equal(0); + expect(naturalCompare('a0a', 'a9a')).to.equal(-1); + expect(naturalCompare('a9a', 'a0a')).to.equal(1); + + expect(naturalCompare('a00a', 'a00a')).to.equal(0); + expect(naturalCompare('a00a', 'a09a')).to.equal(-1); + expect(naturalCompare('a09a', 'a00a')).to.equal(1); + + expect(naturalCompare('a0a1', 'a0a1')).to.equal(0); + expect(naturalCompare('a0a1', 'a0a9')).to.equal(-1); + expect(naturalCompare('a0a9', 'a0a1')).to.equal(1); + + expect(naturalCompare('a10a11a', 'a10a11a')).to.equal(0); + expect(naturalCompare('a10a11a', 'a10a19a')).to.equal(-1); + expect(naturalCompare('a10a19a', 'a10a11a')).to.equal(1); + + expect(naturalCompare('a10a11a', 'a10a11a')).to.equal(0); + expect(naturalCompare('a10a11a', 'a10a11b')).to.equal(-1); + expect(naturalCompare('a10a11b', 'a10a11a')).to.equal(1); + }); +}); diff --git a/src/jsutils/__tests__/suggestionList-test.ts b/src/jsutils/__tests__/suggestionList-test.ts new file mode 100644 index 00000000..2b905248 --- /dev/null +++ b/src/jsutils/__tests__/suggestionList-test.ts @@ -0,0 +1,69 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { suggestionList } from '../suggestionList'; + +function expectSuggestions(input: string, options: ReadonlyArray) { + return expect(suggestionList(input, options)); +} + +describe('suggestionList', () => { + it('Returns results when input is empty', () => { + expectSuggestions('', ['a']).to.deep.equal(['a']); + }); + + it('Returns empty array when there are no options', () => { + expectSuggestions('input', []).to.deep.equal([]); + }); + + it('Returns options with small lexical distance', () => { + expectSuggestions('greenish', ['green']).to.deep.equal(['green']); + expectSuggestions('green', ['greenish']).to.deep.equal(['greenish']); + }); + + it('Rejects options with distance that exceeds threshold', () => { + // spell-checker:disable + expectSuggestions('aaaa', ['aaab']).to.deep.equal(['aaab']); + expectSuggestions('aaaa', ['aabb']).to.deep.equal(['aabb']); + expectSuggestions('aaaa', ['abbb']).to.deep.equal([]); + // spell-checker:enable + + expectSuggestions('ab', ['ca']).to.deep.equal([]); + }); + + it('Returns options with different case', () => { + // cSpell:ignore verylongstring + expectSuggestions('verylongstring', ['VERYLONGSTRING']).to.deep.equal([ + 'VERYLONGSTRING', + ]); + + expectSuggestions('VERYLONGSTRING', ['verylongstring']).to.deep.equal([ + 'verylongstring', + ]); + + expectSuggestions('VERYLONGSTRING', ['VeryLongString']).to.deep.equal([ + 'VeryLongString', + ]); + }); + + it('Returns options with transpositions', () => { + expectSuggestions('agr', ['arg']).to.deep.equal(['arg']); + expectSuggestions('214365879', ['123456789']).to.deep.equal(['123456789']); + }); + + it('Returns options sorted based on lexical distance', () => { + expectSuggestions('abc', ['a', 'ab', 'abc']).to.deep.equal([ + 'abc', + 'ab', + 'a', + ]); + }); + + it('Returns options with the same lexical distance sorted lexicographically', () => { + expectSuggestions('a', ['az', 'ax', 'ay']).to.deep.equal([ + 'ax', + 'ay', + 'az', + ]); + }); +}); diff --git a/src/jsutils/__tests__/toObjMap-test.ts b/src/jsutils/__tests__/toObjMap-test.ts new file mode 100644 index 00000000..f9136b87 --- /dev/null +++ b/src/jsutils/__tests__/toObjMap-test.ts @@ -0,0 +1,61 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import type { ObjMapLike } from '../ObjMap'; +import { toObjMap } from '../toObjMap'; + +// Workaround to make both ESLint happy +const __proto__ = '__proto__'; + +describe('toObjMap', () => { + it('convert undefined to ObjMap', () => { + const result = toObjMap(undefined); + expect(result).to.deep.equal({}); + expect(Object.getPrototypeOf(result)).to.equal(null); + }); + + it('convert null to ObjMap', () => { + const result = toObjMap(null); + expect(result).to.deep.equal({}); + expect(Object.getPrototypeOf(result)).to.equal(null); + }); + + it('convert empty object to ObjMap', () => { + const result = toObjMap({}); + expect(result).to.deep.equal({}); + expect(Object.getPrototypeOf(result)).to.equal(null); + }); + + it('convert object with own properties to ObjMap', () => { + const obj: ObjMapLike = Object.freeze({ foo: 'bar' }); + + const result = toObjMap(obj); + expect(result).to.deep.equal(obj); + expect(Object.getPrototypeOf(result)).to.equal(null); + }); + + it('convert object with __proto__ property to ObjMap', () => { + const protoObj = Object.freeze({ toString: false }); + const obj = Object.create(null); + obj[__proto__] = protoObj; + Object.freeze(obj); + + const result = toObjMap(obj); + expect(Object.keys(result)).to.deep.equal(['__proto__']); + expect(Object.getPrototypeOf(result)).to.equal(null); + expect(result[__proto__]).to.equal(protoObj); + }); + + it('passthrough empty ObjMap', () => { + const objMap = Object.create(null); + expect(toObjMap(objMap)).to.deep.equal(objMap); + }); + + it('passthrough ObjMap with properties', () => { + const objMap = Object.freeze({ + __proto__: null, + foo: 'bar', + }); + expect(toObjMap(objMap)).to.deep.equal(objMap); + }); +}); diff --git a/src/jsutils/devAssert.ts b/src/jsutils/devAssert.ts new file mode 100644 index 00000000..ff97228b --- /dev/null +++ b/src/jsutils/devAssert.ts @@ -0,0 +1,6 @@ +export function devAssert(condition: unknown, message: string): void { + const booleanCondition = Boolean(condition); + if (!booleanCondition) { + throw new Error(message); + } +} diff --git a/src/jsutils/didYouMean.ts b/src/jsutils/didYouMean.ts new file mode 100644 index 00000000..33e10a42 --- /dev/null +++ b/src/jsutils/didYouMean.ts @@ -0,0 +1,37 @@ +const MAX_SUGGESTIONS = 5; + +/** + * Given [ A, B, C ] return ' Did you mean A, B, or C?'. + */ +export function didYouMean(suggestions: ReadonlyArray): string; +export function didYouMean( + subMessage: string, + suggestions: ReadonlyArray, +): string; +export function didYouMean( + firstArg: string | ReadonlyArray, + secondArg?: ReadonlyArray, +) { + const [subMessage, suggestionsArg] = secondArg + ? [firstArg as string, secondArg] + : [undefined, firstArg as ReadonlyArray]; + + let message = ' Did you mean '; + if (subMessage) { + message += subMessage + ' '; + } + + const suggestions = suggestionsArg.map((x) => `"${x}"`); + switch (suggestions.length) { + case 0: + return ''; + case 1: + return message + suggestions[0] + '?'; + case 2: + return message + suggestions[0] + ' or ' + suggestions[1] + '?'; + } + + const selected = suggestions.slice(0, MAX_SUGGESTIONS); + const lastItem = selected.pop(); + return message + selected.join(', ') + ', or ' + lastItem + '?'; +} diff --git a/src/jsutils/groupBy.ts b/src/jsutils/groupBy.ts new file mode 100644 index 00000000..f3b0c076 --- /dev/null +++ b/src/jsutils/groupBy.ts @@ -0,0 +1,19 @@ +/** + * Groups array items into a Map, given a function to produce grouping key. + */ +export function groupBy( + list: ReadonlyArray, + keyFn: (item: T) => K, +): Map> { + const result = new Map>(); + for (const item of list) { + const key = keyFn(item); + const group = result.get(key); + if (group === undefined) { + result.set(key, [item]); + } else { + group.push(item); + } + } + return result; +} diff --git a/src/jsutils/identityFunc.ts b/src/jsutils/identityFunc.ts new file mode 100644 index 00000000..a249b51c --- /dev/null +++ b/src/jsutils/identityFunc.ts @@ -0,0 +1,6 @@ +/** + * Returns the first argument it receives. + */ +export function identityFunc(x: T): T { + return x; +} diff --git a/src/jsutils/inspect.ts b/src/jsutils/inspect.ts new file mode 100644 index 00000000..514cbaad --- /dev/null +++ b/src/jsutils/inspect.ts @@ -0,0 +1,123 @@ +const MAX_ARRAY_LENGTH = 10; +const MAX_RECURSIVE_DEPTH = 2; + +/** + * Used to print values in error messages. + */ +export function inspect(value: unknown): string { + return formatValue(value, []); +} + +function formatValue( + value: unknown, + seenValues: ReadonlyArray, +): string { + switch (typeof value) { + case 'string': + return JSON.stringify(value); + case 'function': + return value.name ? `[function ${value.name}]` : '[function]'; + case 'object': + return formatObjectValue(value, seenValues); + default: + return String(value); + } +} + +function formatObjectValue( + value: object | null, + previouslySeenValues: ReadonlyArray, +): string { + if (value === null) { + return 'null'; + } + + if (previouslySeenValues.includes(value)) { + return '[Circular]'; + } + + const seenValues = [...previouslySeenValues, value]; + + if (isJSONable(value)) { + const jsonValue = value.toJSON(); + + // check for infinite recursion + if (jsonValue !== value) { + return typeof jsonValue === 'string' + ? jsonValue + : formatValue(jsonValue, seenValues); + } + } else if (Array.isArray(value)) { + return formatArray(value, seenValues); + } + + return formatObject(value, seenValues); +} + +function isJSONable(value: any): value is { toJSON: () => unknown } { + return typeof value.toJSON === 'function'; +} + +function formatObject( + object: object, + seenValues: ReadonlyArray, +): string { + const entries = Object.entries(object); + if (entries.length === 0) { + return '{}'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[' + getObjectTag(object) + ']'; + } + + const properties = entries.map( + ([key, value]) => key + ': ' + formatValue(value, seenValues), + ); + return '{ ' + properties.join(', ') + ' }'; +} + +function formatArray( + array: ReadonlyArray, + seenValues: ReadonlyArray, +): string { + if (array.length === 0) { + return '[]'; + } + + if (seenValues.length > MAX_RECURSIVE_DEPTH) { + return '[Array]'; + } + + const len = Math.min(MAX_ARRAY_LENGTH, array.length); + const remaining = array.length - len; + const items = []; + + for (let i = 0; i < len; ++i) { + items.push(formatValue(array[i], seenValues)); + } + + if (remaining === 1) { + items.push('... 1 more item'); + } else if (remaining > 1) { + items.push(`... ${remaining} more items`); + } + + return '[' + items.join(', ') + ']'; +} + +function getObjectTag(object: object): string { + const tag = Object.prototype.toString + .call(object) + .replace(/^\[object /, '') + .replace(/]$/, ''); + + if (tag === 'Object' && typeof object.constructor === 'function') { + const name = object.constructor.name; + if (typeof name === 'string' && name !== '') { + return name; + } + } + + return tag; +} diff --git a/src/jsutils/instanceOf.ts b/src/jsutils/instanceOf.ts new file mode 100644 index 00000000..3f24a770 --- /dev/null +++ b/src/jsutils/instanceOf.ts @@ -0,0 +1,54 @@ +import { inspect } from './inspect'; + +/** + * A replacement for instanceof which includes an error warning when multi-realm + * constructors are detected. + * See: https://expressjs.com/en/advanced/best-practice-performance.html#set-node_env-to-production + * See: https://webpack.js.org/guides/production/ + */ +export const instanceOf: (value: unknown, constructor: Constructor) => boolean = + /* c8 ignore next 5 */ + // FIXME: https://github.com/graphql/graphql-js/issues/2317 + process.env.NODE_ENV === 'production' + ? function instanceOf(value: unknown, constructor: Constructor): boolean { + return value instanceof constructor; + } + : function instanceOf(value: unknown, constructor: Constructor): boolean { + if (value instanceof constructor) { + return true; + } + if (typeof value === 'object' && value !== null) { + // Prefer Symbol.toStringTag since it is immune to minification. + const className = constructor.prototype[Symbol.toStringTag]; + const valueClassName = + // We still need to support constructor's name to detect conflicts with older versions of this library. + Symbol.toStringTag in value + ? // @ts-expect-error TS bug see, https://github.com/microsoft/TypeScript/issues/38009 + value[Symbol.toStringTag] + : value.constructor?.name; + if (className === valueClassName) { + const stringifiedValue = inspect(value); + throw new Error( + `Cannot use ${className} "${stringifiedValue}" from another module or realm. + +Ensure that there is only one instance of "graphql" in the node_modules +directory. If different versions of "graphql" are the dependencies of other +relied on modules, use "resolutions" to ensure only one version is installed. + +https://yarnpkg.com/en/docs/selective-version-resolutions + +Duplicate "graphql" modules cannot be used at the same time since different +versions may have different capabilities and behavior. The data from one +version used in the function from another could produce confusing and +spurious results.`, + ); + } + } + return false; + }; + +interface Constructor extends Function { + prototype: { + [Symbol.toStringTag]: string; + }; +} diff --git a/src/jsutils/invariant.ts b/src/jsutils/invariant.ts new file mode 100644 index 00000000..f2c5d4c6 --- /dev/null +++ b/src/jsutils/invariant.ts @@ -0,0 +1,11 @@ +export function invariant( + condition: unknown, + message?: string, +): asserts condition { + const booleanCondition = Boolean(condition); + if (!booleanCondition) { + throw new Error( + message != null ? message : 'Unexpected invariant triggered.', + ); + } +} diff --git a/src/jsutils/isAsyncIterable.ts b/src/jsutils/isAsyncIterable.ts new file mode 100644 index 00000000..0eb4ab1d --- /dev/null +++ b/src/jsutils/isAsyncIterable.ts @@ -0,0 +1,9 @@ +/** + * Returns true if the provided object implements the AsyncIterator protocol via + * implementing a `Symbol.asyncIterator` method. + */ +export function isAsyncIterable( + maybeAsyncIterable: any, +): maybeAsyncIterable is AsyncIterable { + return typeof maybeAsyncIterable?.[Symbol.asyncIterator] === 'function'; +} diff --git a/src/jsutils/isIterableObject.ts b/src/jsutils/isIterableObject.ts new file mode 100644 index 00000000..5c9d6fb3 --- /dev/null +++ b/src/jsutils/isIterableObject.ts @@ -0,0 +1,25 @@ +/** + * Returns true if the provided object is an Object (i.e. not a string literal) + * and implements the Iterator protocol. + * + * This may be used in place of [Array.isArray()][isArray] to determine if + * an object should be iterated-over e.g. Array, Map, Set, Int8Array, + * TypedArray, etc. but excludes string literals. + * + * @example + * ```ts + * isIterableObject([ 1, 2, 3 ]) // true + * isIterableObject(new Map()) // true + * isIterableObject('ABC') // false + * isIterableObject({ key: 'value' }) // false + * isIterableObject({ length: 1, 0: 'Alpha' }) // false + * ``` + */ +export function isIterableObject( + maybeIterable: any, +): maybeIterable is Iterable { + return ( + typeof maybeIterable === 'object' && + typeof maybeIterable?.[Symbol.iterator] === 'function' + ); +} diff --git a/src/jsutils/isObjectLike.ts b/src/jsutils/isObjectLike.ts new file mode 100644 index 00000000..1d43e267 --- /dev/null +++ b/src/jsutils/isObjectLike.ts @@ -0,0 +1,9 @@ +/** + * Return true if `value` is object-like. A value is object-like if it's not + * `null` and has a `typeof` result of "object". + */ +export function isObjectLike( + value: unknown, +): value is { [key: string]: unknown } { + return typeof value == 'object' && value !== null; +} diff --git a/src/jsutils/isPromise.ts b/src/jsutils/isPromise.ts new file mode 100644 index 00000000..5fc3c104 --- /dev/null +++ b/src/jsutils/isPromise.ts @@ -0,0 +1,7 @@ +/** + * Returns true if the value acts like a Promise, i.e. has a "then" function, + * otherwise returns false. + */ +export function isPromise(value: any): value is Promise { + return typeof value?.then === 'function'; +} diff --git a/src/jsutils/keyMap.ts b/src/jsutils/keyMap.ts new file mode 100644 index 00000000..592a98c8 --- /dev/null +++ b/src/jsutils/keyMap.ts @@ -0,0 +1,39 @@ +import type { ObjMap } from './ObjMap'; + +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * for each value in the array. + * + * This provides a convenient lookup for the array items if the key function + * produces unique results. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * const entriesByName = keyMap( + * phoneBook, + * entry => entry.name + * ) + * + * // { + * // Jon: { name: 'Jon', num: '555-1234' }, + * // Jenny: { name: 'Jenny', num: '867-5309' } + * // } + * + * const jennyEntry = entriesByName['Jenny'] + * + * // { name: 'Jenny', num: '857-6309' } + * ``` + */ +export function keyMap( + list: ReadonlyArray, + keyFn: (item: T) => string, +): ObjMap { + const result = Object.create(null); + for (const item of list) { + result[keyFn(item)] = item; + } + return result; +} diff --git a/src/jsutils/keyValMap.ts b/src/jsutils/keyValMap.ts new file mode 100644 index 00000000..94d688c2 --- /dev/null +++ b/src/jsutils/keyValMap.ts @@ -0,0 +1,30 @@ +import type { ObjMap } from './ObjMap'; + +/** + * Creates a keyed JS object from an array, given a function to produce the keys + * and a function to produce the values from each item in the array. + * ```ts + * const phoneBook = [ + * { name: 'Jon', num: '555-1234' }, + * { name: 'Jenny', num: '867-5309' } + * ] + * + * // { Jon: '555-1234', Jenny: '867-5309' } + * const phonesByName = keyValMap( + * phoneBook, + * entry => entry.name, + * entry => entry.num + * ) + * ``` + */ +export function keyValMap( + list: ReadonlyArray, + keyFn: (item: T) => string, + valFn: (item: T) => V, +): ObjMap { + const result = Object.create(null); + for (const item of list) { + result[keyFn(item)] = valFn(item); + } + return result; +} diff --git a/src/jsutils/mapValue.ts b/src/jsutils/mapValue.ts new file mode 100644 index 00000000..32686a29 --- /dev/null +++ b/src/jsutils/mapValue.ts @@ -0,0 +1,17 @@ +import type { ObjMap, ReadOnlyObjMap } from './ObjMap'; + +/** + * Creates an object map with the same keys as `map` and values generated by + * running each value of `map` thru `fn`. + */ +export function mapValue( + map: ReadOnlyObjMap, + fn: (value: T, key: string) => V, +): ObjMap { + const result = Object.create(null); + + for (const key of Object.keys(map)) { + result[key] = fn(map[key], key); + } + return result; +} diff --git a/src/jsutils/memoize3.ts b/src/jsutils/memoize3.ts new file mode 100644 index 00000000..213cb95d --- /dev/null +++ b/src/jsutils/memoize3.ts @@ -0,0 +1,37 @@ +/** + * Memoizes the provided three-argument function. + */ +export function memoize3< + A1 extends object, + A2 extends object, + A3 extends object, + R, +>(fn: (a1: A1, a2: A2, a3: A3) => R): (a1: A1, a2: A2, a3: A3) => R { + let cache0: WeakMap>>; + + return function memoized(a1, a2, a3) { + if (cache0 === undefined) { + cache0 = new WeakMap(); + } + + let cache1 = cache0.get(a1); + if (cache1 === undefined) { + cache1 = new WeakMap(); + cache0.set(a1, cache1); + } + + let cache2 = cache1.get(a2); + if (cache2 === undefined) { + cache2 = new WeakMap(); + cache1.set(a2, cache2); + } + + let fnResult = cache2.get(a3); + if (fnResult === undefined) { + fnResult = fn(a1, a2, a3); + cache2.set(a3, fnResult); + } + + return fnResult; + }; +} diff --git a/src/jsutils/naturalCompare.ts b/src/jsutils/naturalCompare.ts new file mode 100644 index 00000000..7a562863 --- /dev/null +++ b/src/jsutils/naturalCompare.ts @@ -0,0 +1,58 @@ +/** + * Returns a number indicating whether a reference string comes before, or after, + * or is the same as the given string in natural sort order. + * + * See: https://en.wikipedia.org/wiki/Natural_sort_order + * + */ +export function naturalCompare(aStr: string, bStr: string): number { + let aIndex = 0; + let bIndex = 0; + + while (aIndex < aStr.length && bIndex < bStr.length) { + let aChar = aStr.charCodeAt(aIndex); + let bChar = bStr.charCodeAt(bIndex); + + if (isDigit(aChar) && isDigit(bChar)) { + let aNum = 0; + do { + ++aIndex; + aNum = aNum * 10 + aChar - DIGIT_0; + aChar = aStr.charCodeAt(aIndex); + } while (isDigit(aChar) && aNum > 0); + + let bNum = 0; + do { + ++bIndex; + bNum = bNum * 10 + bChar - DIGIT_0; + bChar = bStr.charCodeAt(bIndex); + } while (isDigit(bChar) && bNum > 0); + + if (aNum < bNum) { + return -1; + } + + if (aNum > bNum) { + return 1; + } + } else { + if (aChar < bChar) { + return -1; + } + if (aChar > bChar) { + return 1; + } + ++aIndex; + ++bIndex; + } + } + + return aStr.length - bStr.length; +} + +const DIGIT_0 = 48; +const DIGIT_9 = 57; + +function isDigit(code: number): boolean { + return !isNaN(code) && DIGIT_0 <= code && code <= DIGIT_9; +} diff --git a/src/jsutils/printPathArray.ts b/src/jsutils/printPathArray.ts new file mode 100644 index 00000000..0d9fcc2b --- /dev/null +++ b/src/jsutils/printPathArray.ts @@ -0,0 +1,10 @@ +/** + * Build a string describing the path. + */ +export function printPathArray(path: ReadonlyArray): string { + return path + .map((key) => + typeof key === 'number' ? '[' + key.toString() + ']' : '.' + key, + ) + .join(''); +} diff --git a/src/jsutils/promiseForObject.ts b/src/jsutils/promiseForObject.ts new file mode 100644 index 00000000..10746760 --- /dev/null +++ b/src/jsutils/promiseForObject.ts @@ -0,0 +1,20 @@ +import type { ObjMap } from './ObjMap'; + +/** + * This function transforms a JS object `ObjMap>` into + * a `Promise>` + * + * This is akin to bluebird's `Promise.props`, but implemented only using + * `Promise.all` so it will work with any implementation of ES6 promises. + */ +export function promiseForObject( + object: ObjMap>, +): Promise> { + return Promise.all(Object.values(object)).then((resolvedValues) => { + const resolvedObject = Object.create(null); + for (const [i, key] of Object.keys(object).entries()) { + resolvedObject[key] = resolvedValues[i]; + } + return resolvedObject; + }); +} diff --git a/src/jsutils/promiseReduce.ts b/src/jsutils/promiseReduce.ts new file mode 100644 index 00000000..58db2e85 --- /dev/null +++ b/src/jsutils/promiseReduce.ts @@ -0,0 +1,23 @@ +import { isPromise } from './isPromise'; +import type { PromiseOrValue } from './PromiseOrValue'; + +/** + * Similar to Array.prototype.reduce(), however the reducing callback may return + * a Promise, in which case reduction will continue after each promise resolves. + * + * If the callback does not return a Promise, then this function will also not + * return a Promise. + */ +export function promiseReduce( + values: Iterable, + callbackFn: (accumulator: U, currentValue: T) => PromiseOrValue, + initialValue: PromiseOrValue, +): PromiseOrValue { + let accumulator = initialValue; + for (const value of values) { + accumulator = isPromise(accumulator) + ? accumulator.then((resolved) => callbackFn(resolved, value)) + : callbackFn(accumulator, value); + } + return accumulator; +} diff --git a/src/jsutils/suggestionList.ts b/src/jsutils/suggestionList.ts new file mode 100644 index 00000000..53ad685c --- /dev/null +++ b/src/jsutils/suggestionList.ts @@ -0,0 +1,137 @@ +import { naturalCompare } from './naturalCompare'; + +/** + * Given an invalid input string and a list of valid options, returns a filtered + * list of valid options sorted based on their similarity with the input. + */ +export function suggestionList( + input: string, + options: ReadonlyArray, +): Array { + const optionsByDistance = Object.create(null); + const lexicalDistance = new LexicalDistance(input); + + const threshold = Math.floor(input.length * 0.4) + 1; + for (const option of options) { + const distance = lexicalDistance.measure(option, threshold); + if (distance !== undefined) { + optionsByDistance[option] = distance; + } + } + + return Object.keys(optionsByDistance).sort((a, b) => { + const distanceDiff = optionsByDistance[a] - optionsByDistance[b]; + return distanceDiff !== 0 ? distanceDiff : naturalCompare(a, b); + }); +} + +/** + * Computes the lexical distance between strings A and B. + * + * The "distance" between two strings is given by counting the minimum number + * of edits needed to transform string A into string B. An edit can be an + * insertion, deletion, or substitution of a single character, or a swap of two + * adjacent characters. + * + * Includes a custom alteration from Damerau-Levenshtein to treat case changes + * as a single edit which helps identify mis-cased values with an edit distance + * of 1. + * + * This distance can be useful for detecting typos in input or sorting + */ +class LexicalDistance { + _input: string; + _inputLowerCase: string; + _inputArray: Array; + _rows: [Array, Array, Array]; + + constructor(input: string) { + this._input = input; + this._inputLowerCase = input.toLowerCase(); + this._inputArray = stringToArray(this._inputLowerCase); + + this._rows = [ + new Array(input.length + 1).fill(0), + new Array(input.length + 1).fill(0), + new Array(input.length + 1).fill(0), + ]; + } + + measure(option: string, threshold: number): number | undefined { + if (this._input === option) { + return 0; + } + + const optionLowerCase = option.toLowerCase(); + + // Any case change counts as a single edit + if (this._inputLowerCase === optionLowerCase) { + return 1; + } + + let a = stringToArray(optionLowerCase); + let b = this._inputArray; + + if (a.length < b.length) { + const tmp = a; + a = b; + b = tmp; + } + const aLength = a.length; + const bLength = b.length; + + if (aLength - bLength > threshold) { + return undefined; + } + + const rows = this._rows; + for (let j = 0; j <= bLength; j++) { + rows[0][j] = j; + } + + for (let i = 1; i <= aLength; i++) { + const upRow = rows[(i - 1) % 3]; + const currentRow = rows[i % 3]; + + let smallestCell = (currentRow[0] = i); + for (let j = 1; j <= bLength; j++) { + const cost = a[i - 1] === b[j - 1] ? 0 : 1; + + let currentCell = Math.min( + upRow[j] + 1, // delete + currentRow[j - 1] + 1, // insert + upRow[j - 1] + cost, // substitute + ); + + if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) { + // transposition + const doubleDiagonalCell = rows[(i - 2) % 3][j - 2]; + currentCell = Math.min(currentCell, doubleDiagonalCell + 1); + } + + if (currentCell < smallestCell) { + smallestCell = currentCell; + } + + currentRow[j] = currentCell; + } + + // Early exit, since distance can't go smaller than smallest element of the previous row. + if (smallestCell > threshold) { + return undefined; + } + } + + const distance = rows[aLength % 3][bLength]; + return distance <= threshold ? distance : undefined; + } +} + +function stringToArray(str: string): Array { + const strLength = str.length; + const array = new Array(strLength); + for (let i = 0; i < strLength; ++i) { + array[i] = str.charCodeAt(i); + } + return array; +} diff --git a/src/jsutils/toError.ts b/src/jsutils/toError.ts new file mode 100644 index 00000000..8d562273 --- /dev/null +++ b/src/jsutils/toError.ts @@ -0,0 +1,20 @@ +import { inspect } from './inspect'; + +/** + * Sometimes a non-error is thrown, wrap it as an Error instance to ensure a consistent Error interface. + */ +export function toError(thrownValue: unknown): Error { + return thrownValue instanceof Error + ? thrownValue + : new NonErrorThrown(thrownValue); +} + +class NonErrorThrown extends Error { + thrownValue: unknown; + + constructor(thrownValue: unknown) { + super('Unexpected error value: ' + inspect(thrownValue)); + this.name = 'NonErrorThrown'; + this.thrownValue = thrownValue; + } +} diff --git a/src/jsutils/toObjMap.ts b/src/jsutils/toObjMap.ts new file mode 100644 index 00000000..6fe352db --- /dev/null +++ b/src/jsutils/toObjMap.ts @@ -0,0 +1,20 @@ +import type { Maybe } from './Maybe'; +import type { ReadOnlyObjMap, ReadOnlyObjMapLike } from './ObjMap'; + +export function toObjMap( + obj: Maybe>, +): ReadOnlyObjMap { + if (obj == null) { + return Object.create(null); + } + + if (Object.getPrototypeOf(obj) === null) { + return obj; + } + + const map = Object.create(null); + for (const [key, value] of Object.entries(obj)) { + map[key] = value; + } + return map; +} diff --git a/src/language/README.md b/src/language/README.md new file mode 100644 index 00000000..68cc9fd4 --- /dev/null +++ b/src/language/README.md @@ -0,0 +1,9 @@ +## GraphQL Language + +The `graphql/language` module is responsible for parsing and operating on the +GraphQL language. + +```js +import { ... } from 'graphql/language'; // ES6 +var GraphQLLanguage = require('graphql/language'); // CommonJS +``` diff --git a/src/language/__tests__/blockString-fuzz.ts b/src/language/__tests__/blockString-fuzz.ts new file mode 100644 index 00000000..4ed010cc --- /dev/null +++ b/src/language/__tests__/blockString-fuzz.ts @@ -0,0 +1,67 @@ +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; +import { genFuzzStrings } from '../../__testUtils__/genFuzzStrings'; +import { inspectStr } from '../../__testUtils__/inspectStr'; + +import { invariant } from '../../jsutils/invariant'; + +import { isPrintableAsBlockString, printBlockString } from '../blockString'; +import { Lexer } from '../lexer'; +import { Source } from '../source'; + +function lexValue(str: string): string { + const lexer = new Lexer(new Source(str)); + const value = lexer.advance().value; + + invariant(typeof value === 'string'); + invariant(lexer.advance().kind === '', 'Expected EOF'); + return value; +} + +function testPrintableBlockString( + testValue: string, + options?: { minimize: boolean }, +): void { + const blockString = printBlockString(testValue, options); + const printedValue = lexValue(blockString); + invariant( + testValue === printedValue, + dedent` + Expected lexValue(${inspectStr(blockString)}) + to equal ${inspectStr(testValue)} + but got ${inspectStr(printedValue)} + `, + ); +} + +function testNonPrintableBlockString(testValue: string): void { + const blockString = printBlockString(testValue); + const printedValue = lexValue(blockString); + invariant( + testValue !== printedValue, + dedent` + Expected lexValue(${inspectStr(blockString)}) + to not equal ${inspectStr(testValue)} + `, + ); +} + +describe('printBlockString', () => { + it('correctly print random strings', () => { + // Testing with length >7 is taking exponentially more time. However it is + // highly recommended to test with increased limit if you make any change. + for (const fuzzStr of genFuzzStrings({ + allowedChars: ['\n', '\t', ' ', '"', 'a', '\\'], + maxLength: 7, + })) { + if (!isPrintableAsBlockString(fuzzStr)) { + testNonPrintableBlockString(fuzzStr); + continue; + } + + testPrintableBlockString(fuzzStr); + testPrintableBlockString(fuzzStr, { minimize: true }); + } + }).timeout(20000); +}); diff --git a/src/language/__tests__/blockString-test.ts b/src/language/__tests__/blockString-test.ts new file mode 100644 index 00000000..a37858d3 --- /dev/null +++ b/src/language/__tests__/blockString-test.ts @@ -0,0 +1,294 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { + dedentBlockStringLines, + isPrintableAsBlockString, + printBlockString, +} from '../blockString'; + +function joinLines(...args: ReadonlyArray) { + return args.join('\n'); +} + +describe('dedentBlockStringLines', () => { + function expectDedent(lines: ReadonlyArray) { + return expect(dedentBlockStringLines(lines)); + } + + it('handles empty string', () => { + expectDedent(['']).to.deep.equal([]); + }); + + it('do not dedent first line', () => { + expectDedent([' a']).to.deep.equal([' a']); + expectDedent([' a', ' b']).to.deep.equal([' a', 'b']); + }); + + it('removes minimal indentation length', () => { + expectDedent(['', ' a', ' b']).to.deep.equal(['a', ' b']); + expectDedent(['', ' a', ' b']).to.deep.equal([' a', 'b']); + expectDedent(['', ' a', ' b', 'c']).to.deep.equal([' a', ' b', 'c']); + }); + + it('dedent both tab and space as single character', () => { + expectDedent(['', '\ta', ' b']).to.deep.equal(['a', ' b']); + expectDedent(['', '\t a', ' b']).to.deep.equal(['a', ' b']); + expectDedent(['', ' \t a', ' b']).to.deep.equal(['a', ' b']); + }); + + it('dedent do not take empty lines into account', () => { + expectDedent(['a', '', ' b']).to.deep.equal(['a', '', 'b']); + expectDedent(['a', ' ', ' b']).to.deep.equal(['a', '', 'b']); + }); + + it('removes uniform indentation from a string', () => { + const lines = [ + '', + ' Hello,', + ' World!', + '', + ' Yours,', + ' GraphQL.', + ]; + expectDedent(lines).to.deep.equal([ + 'Hello,', + ' World!', + '', + 'Yours,', + ' GraphQL.', + ]); + }); + + it('removes empty leading and trailing lines', () => { + const lines = [ + '', + '', + ' Hello,', + ' World!', + '', + ' Yours,', + ' GraphQL.', + '', + '', + ]; + expectDedent(lines).to.deep.equal([ + 'Hello,', + ' World!', + '', + 'Yours,', + ' GraphQL.', + ]); + }); + + it('removes blank leading and trailing lines', () => { + const lines = [ + ' ', + ' ', + ' Hello,', + ' World!', + '', + ' Yours,', + ' GraphQL.', + ' ', + ' ', + ]; + expectDedent(lines).to.deep.equal([ + 'Hello,', + ' World!', + '', + 'Yours,', + ' GraphQL.', + ]); + }); + + it('retains indentation from first line', () => { + const lines = [ + ' Hello,', + ' World!', + '', + ' Yours,', + ' GraphQL.', + ]; + expectDedent(lines).to.deep.equal([ + ' Hello,', + ' World!', + '', + 'Yours,', + ' GraphQL.', + ]); + }); + + it('does not alter trailing spaces', () => { + const lines = [ + ' ', + ' Hello, ', + ' World! ', + ' ', + ' Yours, ', + ' GraphQL. ', + ' ', + ]; + expectDedent(lines).to.deep.equal([ + 'Hello, ', + ' World! ', + ' ', + 'Yours, ', + ' GraphQL. ', + ]); + }); +}); + +describe('isPrintableAsBlockString', () => { + function expectPrintable(str: string) { + return expect(isPrintableAsBlockString(str)).to.equal(true); + } + + function expectNonPrintable(str: string) { + return expect(isPrintableAsBlockString(str)).to.equal(false); + } + + it('accepts valid strings', () => { + expectPrintable(''); + expectPrintable(' a'); + expectPrintable('\t"\n"'); + expectNonPrintable('\t"\n \n\t"'); + }); + + it('rejects strings with only whitespace', () => { + expectNonPrintable(' '); + expectNonPrintable('\t'); + expectNonPrintable('\t '); + expectNonPrintable(' \t'); + }); + + it('rejects strings with non-printable character', () => { + expectNonPrintable('\x00'); + expectNonPrintable('a\x00b'); + }); + + it('rejects strings with non-printable character', () => { + expectNonPrintable('\x00'); + expectNonPrintable('a\x00b'); + }); + + it('rejects strings with only empty lines', () => { + expectNonPrintable('\n'); + expectNonPrintable('\n\n'); + expectNonPrintable('\n\n\n'); + expectNonPrintable(' \n \n'); + expectNonPrintable('\t\n\t\t\n'); + }); + + it('rejects strings with carriage return', () => { + expectNonPrintable('\r'); + expectNonPrintable('\n\r'); + expectNonPrintable('\r\n'); + expectNonPrintable('a\rb'); + }); + + it('rejects strings with leading empty lines', () => { + expectNonPrintable('\na'); + expectNonPrintable(' \na'); + expectNonPrintable('\t\na'); + expectNonPrintable('\n\na'); + }); + + it('rejects strings with leading empty lines', () => { + expectNonPrintable('a\n'); + expectNonPrintable('a\n '); + expectNonPrintable('a\n\t'); + expectNonPrintable('a\n\n'); + }); +}); + +describe('printBlockString', () => { + function expectBlockString(str: string) { + return { + toEqual(expected: string | { readable: string; minimize: string }) { + const { readable, minimize } = + typeof expected === 'string' + ? { readable: expected, minimize: expected } + : expected; + + expect(printBlockString(str)).to.equal(readable); + expect(printBlockString(str, { minimize: true })).to.equal(minimize); + }, + }; + } + + it('do not escape characters', () => { + const str = '" \\ / \b \f \n \r \t'; + expectBlockString(str).toEqual({ + readable: '"""\n' + str + '\n"""', + minimize: '"""\n' + str + '"""', + }); + }); + + it('by default print block strings as single line', () => { + const str = 'one liner'; + expectBlockString(str).toEqual('"""one liner"""'); + }); + + it('by default print block strings ending with triple quotation as multi-line', () => { + const str = 'triple quotation """'; + expectBlockString(str).toEqual({ + readable: '"""\ntriple quotation \\"""\n"""', + minimize: '"""triple quotation \\""""""', + }); + }); + + it('correctly prints single-line with leading space', () => { + const str = ' space-led string'; + expectBlockString(str).toEqual('""" space-led string"""'); + }); + + it('correctly prints single-line with leading space and trailing quotation', () => { + const str = ' space-led value "quoted string"'; + expectBlockString(str).toEqual( + '""" space-led value "quoted string"\n"""', + ); + }); + + it('correctly prints single-line with trailing backslash', () => { + const str = 'backslash \\'; + expectBlockString(str).toEqual({ + readable: '"""\nbackslash \\\n"""', + minimize: '"""backslash \\\n"""', + }); + }); + + it('correctly prints multi-line with internal indent', () => { + const str = 'no indent\n with indent'; + expectBlockString(str).toEqual({ + readable: '"""\nno indent\n with indent\n"""', + minimize: '"""\nno indent\n with indent"""', + }); + }); + + it('correctly prints string with a first line indentation', () => { + const str = joinLines( + ' first ', + ' line ', + 'indentation', + ' string', + ); + + expectBlockString(str).toEqual({ + readable: joinLines( + '"""', + ' first ', + ' line ', + 'indentation', + ' string', + '"""', + ), + minimize: joinLines( + '""" first ', + ' line ', + 'indentation', + ' string"""', + ), + }); + }); +}); diff --git a/src/language/__tests__/lexer-test.ts b/src/language/__tests__/lexer-test.ts new file mode 100644 index 00000000..46bf971d --- /dev/null +++ b/src/language/__tests__/lexer-test.ts @@ -0,0 +1,1207 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; +import { expectToThrowJSON } from '../../__testUtils__/expectJSON'; + +import { inspect } from '../../jsutils/inspect'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { Token } from '../ast'; +import { isPunctuatorTokenKind, Lexer } from '../lexer'; +import { Source } from '../source'; +import { TokenKind } from '../tokenKind'; + +function lexOne(str: string) { + const lexer = new Lexer(new Source(str)); + return lexer.advance(); +} + +function lexSecond(str: string) { + const lexer = new Lexer(new Source(str)); + lexer.advance(); + return lexer.advance(); +} + +function expectSyntaxError(text: string) { + return expectToThrowJSON(() => lexSecond(text)); +} + +describe('Lexer', () => { + it('ignores BOM header', () => { + expect(lexOne('\uFEFF foo')).to.contain({ + kind: TokenKind.NAME, + start: 2, + end: 5, + value: 'foo', + }); + }); + + it('tracks line breaks', () => { + expect(lexOne('foo')).to.contain({ + kind: TokenKind.NAME, + start: 0, + end: 3, + line: 1, + column: 1, + value: 'foo', + }); + expect(lexOne('\nfoo')).to.contain({ + kind: TokenKind.NAME, + start: 1, + end: 4, + line: 2, + column: 1, + value: 'foo', + }); + expect(lexOne('\rfoo')).to.contain({ + kind: TokenKind.NAME, + start: 1, + end: 4, + line: 2, + column: 1, + value: 'foo', + }); + expect(lexOne('\r\nfoo')).to.contain({ + kind: TokenKind.NAME, + start: 2, + end: 5, + line: 2, + column: 1, + value: 'foo', + }); + expect(lexOne('\n\rfoo')).to.contain({ + kind: TokenKind.NAME, + start: 2, + end: 5, + line: 3, + column: 1, + value: 'foo', + }); + expect(lexOne('\r\r\n\nfoo')).to.contain({ + kind: TokenKind.NAME, + start: 4, + end: 7, + line: 4, + column: 1, + value: 'foo', + }); + expect(lexOne('\n\n\r\rfoo')).to.contain({ + kind: TokenKind.NAME, + start: 4, + end: 7, + line: 5, + column: 1, + value: 'foo', + }); + }); + + it('records line and column', () => { + expect(lexOne('\n \r\n \r foo\n')).to.contain({ + kind: TokenKind.NAME, + start: 8, + end: 11, + line: 4, + column: 3, + value: 'foo', + }); + }); + + it('can be Object.toStringified, JSON.stringified, or jsutils.inspected', () => { + const lexer = new Lexer(new Source('foo')); + const token = lexer.advance(); + + expect(Object.prototype.toString.call(lexer)).to.equal('[object Lexer]'); + + expect(Object.prototype.toString.call(token)).to.equal('[object Token]'); + expect(JSON.stringify(token)).to.equal( + '{"kind":"Name","value":"foo","line":1,"column":1}', + ); + expect(inspect(token)).to.equal( + '{ kind: "Name", value: "foo", line: 1, column: 1 }', + ); + }); + + it('skips whitespace and comments', () => { + expect( + lexOne(` + + foo + + +`), + ).to.contain({ + kind: TokenKind.NAME, + start: 6, + end: 9, + value: 'foo', + }); + + expect(lexOne('\t\tfoo\t\t')).to.contain({ + kind: TokenKind.NAME, + start: 2, + end: 5, + value: 'foo', + }); + + expect( + lexOne(` + #comment + foo#comment +`), + ).to.contain({ + kind: TokenKind.NAME, + start: 18, + end: 21, + value: 'foo', + }); + + expect(lexOne(',,,foo,,,')).to.contain({ + kind: TokenKind.NAME, + start: 3, + end: 6, + value: 'foo', + }); + }); + + it('errors respect whitespace', () => { + let caughtError; + try { + lexOne(['', '', ' ~', ''].join('\n')); + } catch (error) { + caughtError = error; + } + expect(String(caughtError)).to.equal(dedent` + Syntax Error: Unexpected character: "~". + + GraphQL request:3:2 + 2 | + 3 | ~ + | ^ + 4 | + `); + }); + + it('updates line numbers in error for file context', () => { + let caughtError; + try { + const str = ['', '', ' ~', ''].join('\n'); + const source = new Source(str, 'foo.js', { line: 11, column: 12 }); + new Lexer(source).advance(); + } catch (error) { + caughtError = error; + } + expect(String(caughtError)).to.equal(dedent` + Syntax Error: Unexpected character: "~". + + foo.js:13:6 + 12 | + 13 | ~ + | ^ + 14 | + `); + }); + + it('updates column numbers in error for file context', () => { + let caughtError; + try { + const source = new Source('~', 'foo.js', { line: 1, column: 5 }); + new Lexer(source).advance(); + } catch (error) { + caughtError = error; + } + expect(String(caughtError)).to.equal(dedent` + Syntax Error: Unexpected character: "~". + + foo.js:1:5 + 1 | ~ + | ^ + `); + }); + + it('lexes strings', () => { + expect(lexOne('""')).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 2, + value: '', + }); + + expect(lexOne('"simple"')).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 8, + value: 'simple', + }); + + expect(lexOne('" white space "')).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 15, + value: ' white space ', + }); + + expect(lexOne('"quote \\""')).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 10, + value: 'quote "', + }); + + expect(lexOne('"escaped \\n\\r\\b\\t\\f"')).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 20, + value: 'escaped \n\r\b\t\f', + }); + + expect(lexOne('"slashes \\\\ \\/"')).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 15, + value: 'slashes \\ /', + }); + + expect(lexOne('"unescaped unicode outside BMP \u{1f600}"')).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 34, + value: 'unescaped unicode outside BMP \u{1f600}', + }); + + expect( + lexOne('"unescaped maximal unicode outside BMP \u{10ffff}"'), + ).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 42, + value: 'unescaped maximal unicode outside BMP \u{10ffff}', + }); + + expect(lexOne('"unicode \\u1234\\u5678\\u90AB\\uCDEF"')).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 34, + value: 'unicode \u1234\u5678\u90AB\uCDEF', + }); + + expect(lexOne('"unicode \\u{1234}\\u{5678}\\u{90AB}\\u{CDEF}"')).to.contain( + { + kind: TokenKind.STRING, + start: 0, + end: 42, + value: 'unicode \u1234\u5678\u90AB\uCDEF', + }, + ); + + expect( + lexOne('"string with unicode escape outside BMP \\u{1F600}"'), + ).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 50, + value: 'string with unicode escape outside BMP \u{1f600}', + }); + + expect(lexOne('"string with minimal unicode escape \\u{0}"')).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 42, + value: 'string with minimal unicode escape \u{0}', + }); + + expect( + lexOne('"string with maximal unicode escape \\u{10FFFF}"'), + ).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 47, + value: 'string with maximal unicode escape \u{10FFFF}', + }); + + expect( + lexOne('"string with maximal minimal unicode escape \\u{00000000}"'), + ).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 57, + value: 'string with maximal minimal unicode escape \u{0}', + }); + + expect( + lexOne('"string with unicode surrogate pair escape \\uD83D\\uDE00"'), + ).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 56, + value: 'string with unicode surrogate pair escape \u{1f600}', + }); + + expect( + lexOne('"string with minimal surrogate pair escape \\uD800\\uDC00"'), + ).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 56, + value: 'string with minimal surrogate pair escape \u{10000}', + }); + + expect( + lexOne('"string with maximal surrogate pair escape \\uDBFF\\uDFFF"'), + ).to.contain({ + kind: TokenKind.STRING, + start: 0, + end: 56, + value: 'string with maximal surrogate pair escape \u{10FFFF}', + }); + }); + + it('lex reports useful string errors', () => { + expectSyntaxError('"').to.deep.equal({ + message: 'Syntax Error: Unterminated string.', + locations: [{ line: 1, column: 2 }], + }); + + expectSyntaxError('"""').to.deep.equal({ + message: 'Syntax Error: Unterminated string.', + locations: [{ line: 1, column: 4 }], + }); + + expectSyntaxError('""""').to.deep.equal({ + message: 'Syntax Error: Unterminated string.', + locations: [{ line: 1, column: 5 }], + }); + + expectSyntaxError('"no end quote').to.deep.equal({ + message: 'Syntax Error: Unterminated string.', + locations: [{ line: 1, column: 14 }], + }); + + expectSyntaxError("'single quotes'").to.deep.equal({ + message: + 'Syntax Error: Unexpected single quote character (\'), did you mean to use a double quote (")?', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('"bad surrogate \uDEAD"').to.deep.equal({ + message: 'Syntax Error: Invalid character within String: U+DEAD.', + locations: [{ line: 1, column: 16 }], + }); + + expectSyntaxError('"bad high surrogate pair \uDEAD\uDEAD"').to.deep.equal({ + message: 'Syntax Error: Invalid character within String: U+DEAD.', + locations: [{ line: 1, column: 26 }], + }); + + expectSyntaxError('"bad low surrogate pair \uD800\uD800"').to.deep.equal({ + message: 'Syntax Error: Invalid character within String: U+D800.', + locations: [{ line: 1, column: 25 }], + }); + + expectSyntaxError('"multi\nline"').to.deep.equal({ + message: 'Syntax Error: Unterminated string.', + locations: [{ line: 1, column: 7 }], + }); + + expectSyntaxError('"multi\rline"').to.deep.equal({ + message: 'Syntax Error: Unterminated string.', + locations: [{ line: 1, column: 7 }], + }); + + expectSyntaxError('"bad \\z esc"').to.deep.equal({ + message: 'Syntax Error: Invalid character escape sequence: "\\z".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('"bad \\x esc"').to.deep.equal({ + message: 'Syntax Error: Invalid character escape sequence: "\\x".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('"bad \\u1 esc"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\u1 es".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('"bad \\u0XX1 esc"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\u0XX1".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('"bad \\uXXXX esc"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\uXXXX".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('"bad \\uFXXX esc"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\uFXXX".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('"bad \\uXXXF esc"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\uXXXF".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('"bad \\u{} esc"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\u{}".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('"bad \\u{FXXX} esc"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\u{FX".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('"bad \\u{FFFF esc"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\u{FFFF ".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('"bad \\u{FFFF"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\u{FFFF"".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('"too high \\u{110000} esc"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\u{110000}".', + locations: [{ line: 1, column: 11 }], + }); + + expectSyntaxError('"way too high \\u{12345678} esc"').to.deep.equal({ + message: + 'Syntax Error: Invalid Unicode escape sequence: "\\u{12345678}".', + locations: [{ line: 1, column: 15 }], + }); + + expectSyntaxError('"too long \\u{000000000} esc"').to.deep.equal({ + message: + 'Syntax Error: Invalid Unicode escape sequence: "\\u{000000000".', + locations: [{ line: 1, column: 11 }], + }); + + expectSyntaxError('"bad surrogate \\uDEAD esc"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\uDEAD".', + locations: [{ line: 1, column: 16 }], + }); + + expectSyntaxError('"bad surrogate \\u{DEAD} esc"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\u{DEAD}".', + locations: [{ line: 1, column: 16 }], + }); + + expectSyntaxError( + '"cannot use braces for surrogate pair \\u{D83D}\\u{DE00} esc"', + ).to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\u{D83D}".', + locations: [{ line: 1, column: 39 }], + }); + + expectSyntaxError( + '"bad high surrogate pair \\uDEAD\\uDEAD esc"', + ).to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\uDEAD".', + locations: [{ line: 1, column: 26 }], + }); + + expectSyntaxError( + '"bad low surrogate pair \\uD800\\uD800 esc"', + ).to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\uD800".', + locations: [{ line: 1, column: 25 }], + }); + + expectSyntaxError( + '"cannot escape half a pair \uD83D\\uDE00 esc"', + ).to.deep.equal({ + message: 'Syntax Error: Invalid character within String: U+D83D.', + locations: [{ line: 1, column: 28 }], + }); + + expectSyntaxError( + '"cannot escape half a pair \\uD83D\uDE00 esc"', + ).to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\uD83D".', + locations: [{ line: 1, column: 28 }], + }); + + expectSyntaxError('"bad \\uD83D\\not an escape"').to.deep.equal({ + message: 'Syntax Error: Invalid Unicode escape sequence: "\\uD83D".', + locations: [{ line: 1, column: 6 }], + }); + }); + + it('lexes block strings', () => { + expect(lexOne('""""""')).to.contain({ + kind: TokenKind.BLOCK_STRING, + start: 0, + end: 6, + line: 1, + column: 1, + value: '', + }); + + expect(lexOne('"""simple"""')).to.contain({ + kind: TokenKind.BLOCK_STRING, + start: 0, + end: 12, + line: 1, + column: 1, + value: 'simple', + }); + + expect(lexOne('""" white space """')).to.contain({ + kind: TokenKind.BLOCK_STRING, + start: 0, + end: 19, + line: 1, + column: 1, + value: ' white space ', + }); + + expect(lexOne('"""contains " quote"""')).to.contain({ + kind: TokenKind.BLOCK_STRING, + start: 0, + end: 22, + line: 1, + column: 1, + value: 'contains " quote', + }); + + expect(lexOne('"""contains \\""" triple quote"""')).to.contain({ + kind: TokenKind.BLOCK_STRING, + start: 0, + end: 32, + line: 1, + column: 1, + value: 'contains """ triple quote', + }); + + expect(lexOne('"""multi\nline"""')).to.contain({ + kind: TokenKind.BLOCK_STRING, + start: 0, + end: 16, + line: 1, + column: 1, + value: 'multi\nline', + }); + + expect(lexOne('"""multi\rline\r\nnormalized"""')).to.contain({ + kind: TokenKind.BLOCK_STRING, + start: 0, + end: 28, + line: 1, + column: 1, + value: 'multi\nline\nnormalized', + }); + + expect(lexOne('"""unescaped \\n\\r\\b\\t\\f\\u1234"""')).to.contain({ + kind: TokenKind.BLOCK_STRING, + start: 0, + end: 32, + line: 1, + column: 1, + value: 'unescaped \\n\\r\\b\\t\\f\\u1234', + }); + + expect(lexOne('"""unescaped unicode outside BMP \u{1f600}"""')).to.contain({ + kind: TokenKind.BLOCK_STRING, + start: 0, + end: 38, + line: 1, + column: 1, + value: 'unescaped unicode outside BMP \u{1f600}', + }); + + expect(lexOne('"""slashes \\\\ \\/"""')).to.contain({ + kind: TokenKind.BLOCK_STRING, + start: 0, + end: 19, + line: 1, + column: 1, + value: 'slashes \\\\ \\/', + }); + + expect( + lexOne(`""" + + spans + multiple + lines + + """`), + ).to.contain({ + kind: TokenKind.BLOCK_STRING, + start: 0, + end: 68, + line: 1, + column: 1, + value: 'spans\n multiple\n lines', + }); + }); + + it('advance line after lexing multiline block string', () => { + expect( + lexSecond(`""" + + spans + multiple + lines + + \n """ second_token`), + ).to.contain({ + kind: TokenKind.NAME, + start: 71, + end: 83, + line: 8, + column: 6, + value: 'second_token', + }); + + expect( + lexSecond( + [ + '""" \n', + 'spans \r\n', + 'multiple \n\r', + 'lines \n\n', + '"""\n second_token', + ].join(''), + ), + ).to.contain({ + kind: TokenKind.NAME, + start: 37, + end: 49, + line: 8, + column: 2, + value: 'second_token', + }); + }); + + it('lex reports useful block string errors', () => { + expectSyntaxError('"""').to.deep.equal({ + message: 'Syntax Error: Unterminated string.', + locations: [{ line: 1, column: 4 }], + }); + + expectSyntaxError('"""no end quote').to.deep.equal({ + message: 'Syntax Error: Unterminated string.', + locations: [{ line: 1, column: 16 }], + }); + + expectSyntaxError('"""contains invalid surrogate \uDEAD"""').to.deep.equal({ + message: 'Syntax Error: Invalid character within String: U+DEAD.', + locations: [{ line: 1, column: 31 }], + }); + }); + + it('lexes numbers', () => { + expect(lexOne('4')).to.contain({ + kind: TokenKind.INT, + start: 0, + end: 1, + value: '4', + }); + + expect(lexOne('4.123')).to.contain({ + kind: TokenKind.FLOAT, + start: 0, + end: 5, + value: '4.123', + }); + + expect(lexOne('-4')).to.contain({ + kind: TokenKind.INT, + start: 0, + end: 2, + value: '-4', + }); + + expect(lexOne('9')).to.contain({ + kind: TokenKind.INT, + start: 0, + end: 1, + value: '9', + }); + + expect(lexOne('0')).to.contain({ + kind: TokenKind.INT, + start: 0, + end: 1, + value: '0', + }); + + expect(lexOne('-4.123')).to.contain({ + kind: TokenKind.FLOAT, + start: 0, + end: 6, + value: '-4.123', + }); + + expect(lexOne('0.123')).to.contain({ + kind: TokenKind.FLOAT, + start: 0, + end: 5, + value: '0.123', + }); + + expect(lexOne('123e4')).to.contain({ + kind: TokenKind.FLOAT, + start: 0, + end: 5, + value: '123e4', + }); + + expect(lexOne('123E4')).to.contain({ + kind: TokenKind.FLOAT, + start: 0, + end: 5, + value: '123E4', + }); + + expect(lexOne('123e-4')).to.contain({ + kind: TokenKind.FLOAT, + start: 0, + end: 6, + value: '123e-4', + }); + + expect(lexOne('123e+4')).to.contain({ + kind: TokenKind.FLOAT, + start: 0, + end: 6, + value: '123e+4', + }); + + expect(lexOne('-1.123e4')).to.contain({ + kind: TokenKind.FLOAT, + start: 0, + end: 8, + value: '-1.123e4', + }); + + expect(lexOne('-1.123E4')).to.contain({ + kind: TokenKind.FLOAT, + start: 0, + end: 8, + value: '-1.123E4', + }); + + expect(lexOne('-1.123e-4')).to.contain({ + kind: TokenKind.FLOAT, + start: 0, + end: 9, + value: '-1.123e-4', + }); + + expect(lexOne('-1.123e+4')).to.contain({ + kind: TokenKind.FLOAT, + start: 0, + end: 9, + value: '-1.123e+4', + }); + + expect(lexOne('-1.123e4567')).to.contain({ + kind: TokenKind.FLOAT, + start: 0, + end: 11, + value: '-1.123e4567', + }); + }); + + it('lex reports useful number errors', () => { + expectSyntaxError('00').to.deep.equal({ + message: 'Syntax Error: Invalid number, unexpected digit after 0: "0".', + locations: [{ line: 1, column: 2 }], + }); + + expectSyntaxError('01').to.deep.equal({ + message: 'Syntax Error: Invalid number, unexpected digit after 0: "1".', + locations: [{ line: 1, column: 2 }], + }); + + expectSyntaxError('01.23').to.deep.equal({ + message: 'Syntax Error: Invalid number, unexpected digit after 0: "1".', + locations: [{ line: 1, column: 2 }], + }); + + expectSyntaxError('+1').to.deep.equal({ + message: 'Syntax Error: Unexpected character: "+".', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('1.').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: .', + locations: [{ line: 1, column: 3 }], + }); + + expectSyntaxError('1e').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: .', + locations: [{ line: 1, column: 3 }], + }); + + expectSyntaxError('1E').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: .', + locations: [{ line: 1, column: 3 }], + }); + + expectSyntaxError('1.e1').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: "e".', + locations: [{ line: 1, column: 3 }], + }); + + expectSyntaxError('.123').to.deep.equal({ + message: 'Syntax Error: Unexpected character: ".".', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('1.A').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: "A".', + locations: [{ line: 1, column: 3 }], + }); + + expectSyntaxError('-A').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: "A".', + locations: [{ line: 1, column: 2 }], + }); + + expectSyntaxError('1.0e').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: .', + locations: [{ line: 1, column: 5 }], + }); + + expectSyntaxError('1.0eA').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: "A".', + locations: [{ line: 1, column: 5 }], + }); + + expectSyntaxError('1.0e"').to.deep.equal({ + message: "Syntax Error: Invalid number, expected digit but got: '\"'.", + locations: [{ line: 1, column: 5 }], + }); + + expectSyntaxError('1.2e3e').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: "e".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('1.2e3.4').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: ".".', + locations: [{ line: 1, column: 6 }], + }); + + expectSyntaxError('1.23.4').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: ".".', + locations: [{ line: 1, column: 5 }], + }); + }); + + it('lex does not allow name-start after a number', () => { + expectSyntaxError('0xF1').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: "x".', + locations: [{ line: 1, column: 2 }], + }); + expectSyntaxError('0b10').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: "b".', + locations: [{ line: 1, column: 2 }], + }); + expectSyntaxError('123abc').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: "a".', + locations: [{ line: 1, column: 4 }], + }); + expectSyntaxError('1_234').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: "_".', + locations: [{ line: 1, column: 2 }], + }); + expectSyntaxError('1\u00DF').to.deep.equal({ + message: 'Syntax Error: Unexpected character: U+00DF.', + locations: [{ line: 1, column: 2 }], + }); + expectSyntaxError('1.23f').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: "f".', + locations: [{ line: 1, column: 5 }], + }); + expectSyntaxError('1.234_5').to.deep.equal({ + message: 'Syntax Error: Invalid number, expected digit but got: "_".', + locations: [{ line: 1, column: 6 }], + }); + }); + + it('lexes punctuation', () => { + expect(lexOne('!')).to.contain({ + kind: TokenKind.BANG, + start: 0, + end: 1, + value: undefined, + }); + + expect(lexOne('$')).to.contain({ + kind: TokenKind.DOLLAR, + start: 0, + end: 1, + value: undefined, + }); + + expect(lexOne('(')).to.contain({ + kind: TokenKind.PAREN_L, + start: 0, + end: 1, + value: undefined, + }); + + expect(lexOne(')')).to.contain({ + kind: TokenKind.PAREN_R, + start: 0, + end: 1, + value: undefined, + }); + + expect(lexOne('...')).to.contain({ + kind: TokenKind.SPREAD, + start: 0, + end: 3, + value: undefined, + }); + + expect(lexOne(':')).to.contain({ + kind: TokenKind.COLON, + start: 0, + end: 1, + value: undefined, + }); + + expect(lexOne('=')).to.contain({ + kind: TokenKind.EQUALS, + start: 0, + end: 1, + value: undefined, + }); + + expect(lexOne('@')).to.contain({ + kind: TokenKind.AT, + start: 0, + end: 1, + value: undefined, + }); + + expect(lexOne('[')).to.contain({ + kind: TokenKind.BRACKET_L, + start: 0, + end: 1, + value: undefined, + }); + + expect(lexOne(']')).to.contain({ + kind: TokenKind.BRACKET_R, + start: 0, + end: 1, + value: undefined, + }); + + expect(lexOne('{')).to.contain({ + kind: TokenKind.BRACE_L, + start: 0, + end: 1, + value: undefined, + }); + + expect(lexOne('|')).to.contain({ + kind: TokenKind.PIPE, + start: 0, + end: 1, + value: undefined, + }); + + expect(lexOne('}')).to.contain({ + kind: TokenKind.BRACE_R, + start: 0, + end: 1, + value: undefined, + }); + }); + + it('lex reports useful unknown character error', () => { + expectSyntaxError('..').to.deep.equal({ + message: 'Syntax Error: Unexpected character: ".".', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('~').to.deep.equal({ + message: 'Syntax Error: Unexpected character: "~".', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('\x00').to.deep.equal({ + message: 'Syntax Error: Unexpected character: U+0000.', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('\b').to.deep.equal({ + message: 'Syntax Error: Unexpected character: U+0008.', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('\u00AA').to.deep.equal({ + message: 'Syntax Error: Unexpected character: U+00AA.', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('\u0AAA').to.deep.equal({ + message: 'Syntax Error: Unexpected character: U+0AAA.', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('\u203B').to.deep.equal({ + message: 'Syntax Error: Unexpected character: U+203B.', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('\u{1f600}').to.deep.equal({ + message: 'Syntax Error: Unexpected character: U+1F600.', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('\uD83D\uDE00').to.deep.equal({ + message: 'Syntax Error: Unexpected character: U+1F600.', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('\uD800\uDC00').to.deep.equal({ + message: 'Syntax Error: Unexpected character: U+10000.', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('\uDBFF\uDFFF').to.deep.equal({ + message: 'Syntax Error: Unexpected character: U+10FFFF.', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('\uDEAD').to.deep.equal({ + message: 'Syntax Error: Invalid character: U+DEAD.', + locations: [{ line: 1, column: 1 }], + }); + }); + + it('lex reports useful information for dashes in names', () => { + const source = new Source('a-b'); + const lexer = new Lexer(source); + const firstToken = lexer.advance(); + expect(firstToken).to.contain({ + kind: TokenKind.NAME, + start: 0, + end: 1, + value: 'a', + }); + + expect(() => lexer.advance()) + .throw(GraphQLError) + .that.deep.include({ + message: 'Syntax Error: Invalid number, expected digit but got: "b".', + locations: [{ line: 1, column: 3 }], + }); + }); + + it('produces double linked list of tokens, including comments', () => { + const source = new Source(` + { + #comment + field + } + `); + + const lexer = new Lexer(source); + const startToken = lexer.token; + let endToken; + do { + endToken = lexer.advance(); + // Lexer advances over ignored comment tokens to make writing parsers + // easier, but will include them in the linked list result. + expect(endToken.kind).to.not.equal(TokenKind.COMMENT); + } while (endToken.kind !== TokenKind.EOF); + + expect(startToken.prev).to.equal(null); + expect(endToken.next).to.equal(null); + + const tokens = []; + for (let tok: Token | null = startToken; tok; tok = tok.next) { + if (tokens.length) { + // Tokens are double-linked, prev should point to last seen token. + expect(tok.prev).to.equal(tokens[tokens.length - 1]); + } + tokens.push(tok); + } + + expect(tokens.map((tok) => tok.kind)).to.deep.equal([ + TokenKind.SOF, + TokenKind.BRACE_L, + TokenKind.COMMENT, + TokenKind.NAME, + TokenKind.BRACE_R, + TokenKind.EOF, + ]); + }); + + it('lexes comments', () => { + expect(lexOne('# Comment').prev).to.contain({ + kind: TokenKind.COMMENT, + start: 0, + end: 9, + value: ' Comment', + }); + expect(lexOne('# Comment\nAnother line').prev).to.contain({ + kind: TokenKind.COMMENT, + start: 0, + end: 9, + value: ' Comment', + }); + expect(lexOne('# Comment\r\nAnother line').prev).to.contain({ + kind: TokenKind.COMMENT, + start: 0, + end: 9, + value: ' Comment', + }); + expect(lexOne('# Comment \u{1f600}').prev).to.contain({ + kind: TokenKind.COMMENT, + start: 0, + end: 12, + value: ' Comment \u{1f600}', + }); + expectSyntaxError('# Invalid surrogate \uDEAD').to.deep.equal({ + message: 'Syntax Error: Invalid character: U+DEAD.', + locations: [{ line: 1, column: 21 }], + }); + }); +}); + +describe('isPunctuatorTokenKind', () => { + function isPunctuatorToken(text: string) { + return isPunctuatorTokenKind(lexOne(text).kind); + } + + it('returns true for punctuator tokens', () => { + expect(isPunctuatorToken('!')).to.equal(true); + expect(isPunctuatorToken('$')).to.equal(true); + expect(isPunctuatorToken('&')).to.equal(true); + expect(isPunctuatorToken('(')).to.equal(true); + expect(isPunctuatorToken(')')).to.equal(true); + expect(isPunctuatorToken('...')).to.equal(true); + expect(isPunctuatorToken(':')).to.equal(true); + expect(isPunctuatorToken('=')).to.equal(true); + expect(isPunctuatorToken('@')).to.equal(true); + expect(isPunctuatorToken('[')).to.equal(true); + expect(isPunctuatorToken(']')).to.equal(true); + expect(isPunctuatorToken('{')).to.equal(true); + expect(isPunctuatorToken('|')).to.equal(true); + expect(isPunctuatorToken('}')).to.equal(true); + }); + + it('returns false for non-punctuator tokens', () => { + expect(isPunctuatorToken('')).to.equal(false); + expect(isPunctuatorToken('name')).to.equal(false); + expect(isPunctuatorToken('1')).to.equal(false); + expect(isPunctuatorToken('3.14')).to.equal(false); + expect(isPunctuatorToken('"str"')).to.equal(false); + expect(isPunctuatorToken('"""str"""')).to.equal(false); + }); +}); diff --git a/src/language/__tests__/parser-test.ts b/src/language/__tests__/parser-test.ts new file mode 100644 index 00000000..3571b757 --- /dev/null +++ b/src/language/__tests__/parser-test.ts @@ -0,0 +1,642 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; +import { expectJSON, expectToThrowJSON } from '../../__testUtils__/expectJSON'; +import { kitchenSinkQuery } from '../../__testUtils__/kitchenSinkQuery'; + +import { inspect } from '../../jsutils/inspect'; + +import { Kind } from '../kinds'; +import { parse, parseConstValue, parseType, parseValue } from '../parser'; +import { Source } from '../source'; +import { TokenKind } from '../tokenKind'; + +function expectSyntaxError(text: string) { + return expectToThrowJSON(() => parse(text)); +} + +describe('Parser', () => { + it('parse provides useful errors', () => { + let caughtError; + try { + parse('{'); + } catch (error) { + caughtError = error; + } + + expect(caughtError).to.deep.contain({ + message: 'Syntax Error: Expected Name, found .', + positions: [1], + locations: [{ line: 1, column: 2 }], + }); + + expect(String(caughtError)).to.equal(dedent` + Syntax Error: Expected Name, found . + + GraphQL request:1:2 + 1 | { + | ^ + `); + + expectSyntaxError(` + { ...MissingOn } + fragment MissingOn Type + `).to.deep.include({ + message: 'Syntax Error: Expected "on", found Name "Type".', + locations: [{ line: 3, column: 26 }], + }); + + expectSyntaxError('{ field: {} }').to.deep.include({ + message: 'Syntax Error: Expected Name, found "{".', + locations: [{ line: 1, column: 10 }], + }); + + expectSyntaxError('notAnOperation Foo { field }').to.deep.include({ + message: 'Syntax Error: Unexpected Name "notAnOperation".', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('...').to.deep.include({ + message: 'Syntax Error: Unexpected "...".', + locations: [{ line: 1, column: 1 }], + }); + + expectSyntaxError('{ ""').to.deep.include({ + message: 'Syntax Error: Expected Name, found String "".', + locations: [{ line: 1, column: 3 }], + }); + }); + + it('parse provides useful error when using source', () => { + let caughtError; + try { + parse(new Source('query', 'MyQuery.graphql')); + } catch (error) { + caughtError = error; + } + expect(String(caughtError)).to.equal(dedent` + Syntax Error: Expected "{", found . + + MyQuery.graphql:1:6 + 1 | query + | ^ + `); + }); + + it('parses variable inline values', () => { + expect(() => + parse('{ field(complex: { a: { b: [ $var ] } }) }'), + ).to.not.throw(); + }); + + it('parses constant default values', () => { + expectSyntaxError( + 'query Foo($x: Complex = { a: { b: [ $var ] } }) { field }', + ).to.deep.equal({ + message: 'Syntax Error: Unexpected variable "$var" in constant value.', + locations: [{ line: 1, column: 37 }], + }); + }); + + it('parses variable definition directives', () => { + expect(() => + parse('query Foo($x: Boolean = false @bar) { field }'), + ).to.not.throw(); + }); + + it('does not accept fragments named "on"', () => { + expectSyntaxError('fragment on on on { on }').to.deep.equal({ + message: 'Syntax Error: Unexpected Name "on".', + locations: [{ line: 1, column: 10 }], + }); + }); + + it('does not accept fragments spread of "on"', () => { + expectSyntaxError('{ ...on }').to.deep.equal({ + message: 'Syntax Error: Expected Name, found "}".', + locations: [{ line: 1, column: 9 }], + }); + }); + + it('does not allow "true", "false", or "null" as enum value', () => { + expectSyntaxError('enum Test { VALID, true }').to.deep.equal({ + message: + 'Syntax Error: Name "true" is reserved and cannot be used for an enum value.', + locations: [{ line: 1, column: 20 }], + }); + + expectSyntaxError('enum Test { VALID, false }').to.deep.equal({ + message: + 'Syntax Error: Name "false" is reserved and cannot be used for an enum value.', + locations: [{ line: 1, column: 20 }], + }); + + expectSyntaxError('enum Test { VALID, null }').to.deep.equal({ + message: + 'Syntax Error: Name "null" is reserved and cannot be used for an enum value.', + locations: [{ line: 1, column: 20 }], + }); + }); + + it('parses multi-byte characters', () => { + // Note: \u0A0A could be naively interpreted as two line-feed chars. + const ast = parse(` + # This comment has a \u0A0A multi-byte character. + { field(arg: "Has a \u0A0A multi-byte character.") } + `); + + expect(ast).to.have.nested.property( + 'definitions[0].selectionSet.selections[0].arguments[0].value.value', + 'Has a \u0A0A multi-byte character.', + ); + }); + + it('parses kitchen sink', () => { + expect(() => parse(kitchenSinkQuery)).to.not.throw(); + }); + + it('allows non-keywords anywhere a Name is allowed', () => { + const nonKeywords = [ + 'on', + 'fragment', + 'query', + 'mutation', + 'subscription', + 'true', + 'false', + ]; + for (const keyword of nonKeywords) { + // You can't define or reference a fragment named `on`. + const fragmentName = keyword !== 'on' ? keyword : 'a'; + const document = ` + query ${keyword} { + ... ${fragmentName} + ... on ${keyword} { field } + } + fragment ${fragmentName} on Type { + ${keyword}(${keyword}: $${keyword}) + @${keyword}(${keyword}: ${keyword}) + } + `; + + expect(() => parse(document)).to.not.throw(); + } + }); + + it('parses anonymous mutation operations', () => { + expect(() => + parse(` + mutation { + mutationField + } + `), + ).to.not.throw(); + }); + + it('parses anonymous subscription operations', () => { + expect(() => + parse(` + subscription { + subscriptionField + } + `), + ).to.not.throw(); + }); + + it('parses named mutation operations', () => { + expect(() => + parse(` + mutation Foo { + mutationField + } + `), + ).to.not.throw(); + }); + + it('parses named subscription operations', () => { + expect(() => + parse(` + subscription Foo { + subscriptionField + } + `), + ).to.not.throw(); + }); + + it('creates ast', () => { + const result = parse(dedent` + { + node(id: 4) { + id, + name + } + } + `); + + expectJSON(result).toDeepEqual({ + kind: Kind.DOCUMENT, + loc: { start: 0, end: 40 }, + definitions: [ + { + kind: Kind.OPERATION_DEFINITION, + loc: { start: 0, end: 40 }, + operation: 'query', + name: undefined, + variableDefinitions: [], + directives: [], + selectionSet: { + kind: Kind.SELECTION_SET, + loc: { start: 0, end: 40 }, + selections: [ + { + kind: Kind.FIELD, + loc: { start: 4, end: 38 }, + alias: undefined, + name: { + kind: Kind.NAME, + loc: { start: 4, end: 8 }, + value: 'node', + }, + arguments: [ + { + kind: Kind.ARGUMENT, + name: { + kind: Kind.NAME, + loc: { start: 9, end: 11 }, + value: 'id', + }, + value: { + kind: Kind.INT, + loc: { start: 13, end: 14 }, + value: '4', + }, + loc: { start: 9, end: 14 }, + }, + ], + directives: [], + selectionSet: { + kind: Kind.SELECTION_SET, + loc: { start: 16, end: 38 }, + selections: [ + { + kind: Kind.FIELD, + loc: { start: 22, end: 24 }, + alias: undefined, + name: { + kind: Kind.NAME, + loc: { start: 22, end: 24 }, + value: 'id', + }, + arguments: [], + directives: [], + selectionSet: undefined, + }, + { + kind: Kind.FIELD, + loc: { start: 30, end: 34 }, + alias: undefined, + name: { + kind: Kind.NAME, + loc: { start: 30, end: 34 }, + value: 'name', + }, + arguments: [], + directives: [], + selectionSet: undefined, + }, + ], + }, + }, + ], + }, + }, + ], + }); + }); + + it('creates ast from nameless query without variables', () => { + const result = parse(dedent` + query { + node { + id + } + } + `); + + expectJSON(result).toDeepEqual({ + kind: Kind.DOCUMENT, + loc: { start: 0, end: 29 }, + definitions: [ + { + kind: Kind.OPERATION_DEFINITION, + loc: { start: 0, end: 29 }, + operation: 'query', + name: undefined, + variableDefinitions: [], + directives: [], + selectionSet: { + kind: Kind.SELECTION_SET, + loc: { start: 6, end: 29 }, + selections: [ + { + kind: Kind.FIELD, + loc: { start: 10, end: 27 }, + alias: undefined, + name: { + kind: Kind.NAME, + loc: { start: 10, end: 14 }, + value: 'node', + }, + arguments: [], + directives: [], + selectionSet: { + kind: Kind.SELECTION_SET, + loc: { start: 15, end: 27 }, + selections: [ + { + kind: Kind.FIELD, + loc: { start: 21, end: 23 }, + alias: undefined, + name: { + kind: Kind.NAME, + loc: { start: 21, end: 23 }, + value: 'id', + }, + arguments: [], + directives: [], + selectionSet: undefined, + }, + ], + }, + }, + ], + }, + }, + ], + }); + }); + + it('allows parsing without source location information', () => { + const result = parse('{ id }', { noLocation: true }); + expect('loc' in result).to.equal(false); + }); + + it('Legacy: allows parsing fragment defined variables', () => { + const document = 'fragment a($v: Boolean = false) on t { f(v: $v) }'; + + expect(() => + parse(document, { allowLegacyFragmentVariables: true }), + ).to.not.throw(); + expect(() => parse(document)).to.throw('Syntax Error'); + }); + + it('contains location that can be Object.toStringified, JSON.stringified, or jsutils.inspected', () => { + const { loc } = parse('{ id }'); + + expect(Object.prototype.toString.call(loc)).to.equal('[object Location]'); + expect(JSON.stringify(loc)).to.equal('{"start":0,"end":6}'); + expect(inspect(loc)).to.equal('{ start: 0, end: 6 }'); + }); + + it('contains references to source', () => { + const source = new Source('{ id }'); + const result = parse(source); + + expect(result).to.have.nested.property('loc.source', source); + }); + + it('contains references to start and end tokens', () => { + const result = parse('{ id }'); + + expect(result).to.have.nested.property( + 'loc.startToken.kind', + TokenKind.SOF, + ); + expect(result).to.have.nested.property('loc.endToken.kind', TokenKind.EOF); + }); + + describe('parseValue', () => { + it('parses null value', () => { + const result = parseValue('null'); + expectJSON(result).toDeepEqual({ + kind: Kind.NULL, + loc: { start: 0, end: 4 }, + }); + }); + + it('parses list values', () => { + const result = parseValue('[123 "abc"]'); + expectJSON(result).toDeepEqual({ + kind: Kind.LIST, + loc: { start: 0, end: 11 }, + values: [ + { + kind: Kind.INT, + loc: { start: 1, end: 4 }, + value: '123', + }, + { + kind: Kind.STRING, + loc: { start: 5, end: 10 }, + value: 'abc', + block: false, + }, + ], + }); + }); + + it('parses block strings', () => { + const result = parseValue('["""long""" "short"]'); + expectJSON(result).toDeepEqual({ + kind: Kind.LIST, + loc: { start: 0, end: 20 }, + values: [ + { + kind: Kind.STRING, + loc: { start: 1, end: 11 }, + value: 'long', + block: true, + }, + { + kind: Kind.STRING, + loc: { start: 12, end: 19 }, + value: 'short', + block: false, + }, + ], + }); + }); + + it('allows variables', () => { + const result = parseValue('{ field: $var }'); + expectJSON(result).toDeepEqual({ + kind: Kind.OBJECT, + loc: { start: 0, end: 15 }, + fields: [ + { + kind: Kind.OBJECT_FIELD, + loc: { start: 2, end: 13 }, + name: { + kind: Kind.NAME, + loc: { start: 2, end: 7 }, + value: 'field', + }, + value: { + kind: Kind.VARIABLE, + loc: { start: 9, end: 13 }, + name: { + kind: Kind.NAME, + loc: { start: 10, end: 13 }, + value: 'var', + }, + }, + }, + ], + }); + }); + + it('correct message for incomplete variable', () => { + expect(() => parseValue('$')) + .to.throw() + .to.deep.include({ + message: 'Syntax Error: Expected Name, found .', + locations: [{ line: 1, column: 2 }], + }); + }); + + it('correct message for unexpected token', () => { + expect(() => parseValue(':')) + .to.throw() + .to.deep.include({ + message: 'Syntax Error: Unexpected ":".', + locations: [{ line: 1, column: 1 }], + }); + }); + }); + + describe('parseConstValue', () => { + it('parses values', () => { + const result = parseConstValue('[123 "abc"]'); + expectJSON(result).toDeepEqual({ + kind: Kind.LIST, + loc: { start: 0, end: 11 }, + values: [ + { + kind: Kind.INT, + loc: { start: 1, end: 4 }, + value: '123', + }, + { + kind: Kind.STRING, + loc: { start: 5, end: 10 }, + value: 'abc', + block: false, + }, + ], + }); + }); + + it('does not allow variables', () => { + expect(() => parseConstValue('{ field: $var }')) + .to.throw() + .to.deep.include({ + message: + 'Syntax Error: Unexpected variable "$var" in constant value.', + locations: [{ line: 1, column: 10 }], + }); + }); + + it('correct message for unexpected token', () => { + expect(() => parseConstValue('$')) + .to.throw() + .to.deep.include({ + message: 'Syntax Error: Unexpected "$".', + locations: [{ line: 1, column: 1 }], + }); + }); + }); + + describe('parseType', () => { + it('parses well known types', () => { + const result = parseType('String'); + expectJSON(result).toDeepEqual({ + kind: Kind.NAMED_TYPE, + loc: { start: 0, end: 6 }, + name: { + kind: Kind.NAME, + loc: { start: 0, end: 6 }, + value: 'String', + }, + }); + }); + + it('parses custom types', () => { + const result = parseType('MyType'); + expectJSON(result).toDeepEqual({ + kind: Kind.NAMED_TYPE, + loc: { start: 0, end: 6 }, + name: { + kind: Kind.NAME, + loc: { start: 0, end: 6 }, + value: 'MyType', + }, + }); + }); + + it('parses list types', () => { + const result = parseType('[MyType]'); + expectJSON(result).toDeepEqual({ + kind: Kind.LIST_TYPE, + loc: { start: 0, end: 8 }, + type: { + kind: Kind.NAMED_TYPE, + loc: { start: 1, end: 7 }, + name: { + kind: Kind.NAME, + loc: { start: 1, end: 7 }, + value: 'MyType', + }, + }, + }); + }); + + it('parses non-null types', () => { + const result = parseType('MyType!'); + expectJSON(result).toDeepEqual({ + kind: Kind.NON_NULL_TYPE, + loc: { start: 0, end: 7 }, + type: { + kind: Kind.NAMED_TYPE, + loc: { start: 0, end: 6 }, + name: { + kind: Kind.NAME, + loc: { start: 0, end: 6 }, + value: 'MyType', + }, + }, + }); + }); + + it('parses nested types', () => { + const result = parseType('[MyType!]'); + expectJSON(result).toDeepEqual({ + kind: Kind.LIST_TYPE, + loc: { start: 0, end: 9 }, + type: { + kind: Kind.NON_NULL_TYPE, + loc: { start: 1, end: 8 }, + type: { + kind: Kind.NAMED_TYPE, + loc: { start: 1, end: 7 }, + name: { + kind: Kind.NAME, + loc: { start: 1, end: 7 }, + value: 'MyType', + }, + }, + }, + }); + }); + }); +}); diff --git a/src/language/__tests__/predicates-test.ts b/src/language/__tests__/predicates-test.ts new file mode 100644 index 00000000..13477f8d --- /dev/null +++ b/src/language/__tests__/predicates-test.ts @@ -0,0 +1,144 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import type { ASTNode } from '../ast'; +import { Kind } from '../kinds'; +import { parseValue } from '../parser'; +import { + isConstValueNode, + isDefinitionNode, + isExecutableDefinitionNode, + isSelectionNode, + isTypeDefinitionNode, + isTypeExtensionNode, + isTypeNode, + isTypeSystemDefinitionNode, + isTypeSystemExtensionNode, + isValueNode, +} from '../predicates'; + +function filterNodes(predicate: (node: ASTNode) => boolean): Array { + return Object.values(Kind).filter( + // @ts-expect-error create node only with kind + (kind) => predicate({ kind }), + ); +} + +describe('AST node predicates', () => { + it('isDefinitionNode', () => { + expect(filterNodes(isDefinitionNode)).to.deep.equal([ + 'OperationDefinition', + 'FragmentDefinition', + 'SchemaDefinition', + 'ScalarTypeDefinition', + 'ObjectTypeDefinition', + 'InterfaceTypeDefinition', + 'UnionTypeDefinition', + 'EnumTypeDefinition', + 'InputObjectTypeDefinition', + 'DirectiveDefinition', + 'SchemaExtension', + 'ScalarTypeExtension', + 'ObjectTypeExtension', + 'InterfaceTypeExtension', + 'UnionTypeExtension', + 'EnumTypeExtension', + 'InputObjectTypeExtension', + ]); + }); + + it('isExecutableDefinitionNode', () => { + expect(filterNodes(isExecutableDefinitionNode)).to.deep.equal([ + 'OperationDefinition', + 'FragmentDefinition', + ]); + }); + + it('isSelectionNode', () => { + expect(filterNodes(isSelectionNode)).to.deep.equal([ + 'Field', + 'FragmentSpread', + 'InlineFragment', + ]); + }); + + it('isValueNode', () => { + expect(filterNodes(isValueNode)).to.deep.equal([ + 'Variable', + 'IntValue', + 'FloatValue', + 'StringValue', + 'BooleanValue', + 'NullValue', + 'EnumValue', + 'ListValue', + 'ObjectValue', + ]); + }); + + it('isConstValueNode', () => { + expect(isConstValueNode(parseValue('"value"'))).to.equal(true); + expect(isConstValueNode(parseValue('$var'))).to.equal(false); + + expect(isConstValueNode(parseValue('{ field: "value" }'))).to.equal(true); + expect(isConstValueNode(parseValue('{ field: $var }'))).to.equal(false); + + expect(isConstValueNode(parseValue('[ "value" ]'))).to.equal(true); + expect(isConstValueNode(parseValue('[ $var ]'))).to.equal(false); + }); + + it('isTypeNode', () => { + expect(filterNodes(isTypeNode)).to.deep.equal([ + 'NamedType', + 'ListType', + 'NonNullType', + ]); + }); + + it('isTypeSystemDefinitionNode', () => { + expect(filterNodes(isTypeSystemDefinitionNode)).to.deep.equal([ + 'SchemaDefinition', + 'ScalarTypeDefinition', + 'ObjectTypeDefinition', + 'InterfaceTypeDefinition', + 'UnionTypeDefinition', + 'EnumTypeDefinition', + 'InputObjectTypeDefinition', + 'DirectiveDefinition', + ]); + }); + + it('isTypeDefinitionNode', () => { + expect(filterNodes(isTypeDefinitionNode)).to.deep.equal([ + 'ScalarTypeDefinition', + 'ObjectTypeDefinition', + 'InterfaceTypeDefinition', + 'UnionTypeDefinition', + 'EnumTypeDefinition', + 'InputObjectTypeDefinition', + ]); + }); + + it('isTypeSystemExtensionNode', () => { + expect(filterNodes(isTypeSystemExtensionNode)).to.deep.equal([ + 'SchemaExtension', + 'ScalarTypeExtension', + 'ObjectTypeExtension', + 'InterfaceTypeExtension', + 'UnionTypeExtension', + 'EnumTypeExtension', + 'InputObjectTypeExtension', + ]); + }); + + it('isTypeExtensionNode', () => { + expect(filterNodes(isTypeExtensionNode)).to.deep.equal([ + 'ScalarTypeExtension', + 'ObjectTypeExtension', + 'InterfaceTypeExtension', + 'UnionTypeExtension', + 'EnumTypeExtension', + 'InputObjectTypeExtension', + ]); + }); +}); diff --git a/src/language/__tests__/printLocation-test.ts b/src/language/__tests__/printLocation-test.ts new file mode 100644 index 00000000..c5eac8cc --- /dev/null +++ b/src/language/__tests__/printLocation-test.ts @@ -0,0 +1,77 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; + +import { printSourceLocation } from '../printLocation'; +import { Source } from '../source'; + +describe('printSourceLocation', () => { + it('prints minified documents', () => { + const minifiedSource = new Source( + 'query SomeMinifiedQueryWithErrorInside($foo:String!=FIRST_ERROR_HERE$bar:String){someField(foo:$foo bar:$bar baz:SECOND_ERROR_HERE){fieldA fieldB{fieldC fieldD...on THIRD_ERROR_HERE}}}', + ); + + const firstLocation = printSourceLocation(minifiedSource, { + line: 1, + column: minifiedSource.body.indexOf('FIRST_ERROR_HERE') + 1, + }); + expect(firstLocation).to.equal(dedent` + GraphQL request:1:53 + 1 | query SomeMinifiedQueryWithErrorInside($foo:String!=FIRST_ERROR_HERE$bar:String) + | ^ + | {someField(foo:$foo bar:$bar baz:SECOND_ERROR_HERE){fieldA fieldB{fieldC fieldD. + `); + + const secondLocation = printSourceLocation(minifiedSource, { + line: 1, + column: minifiedSource.body.indexOf('SECOND_ERROR_HERE') + 1, + }); + expect(secondLocation).to.equal(dedent` + GraphQL request:1:114 + 1 | query SomeMinifiedQueryWithErrorInside($foo:String!=FIRST_ERROR_HERE$bar:String) + | {someField(foo:$foo bar:$bar baz:SECOND_ERROR_HERE){fieldA fieldB{fieldC fieldD. + | ^ + | ..on THIRD_ERROR_HERE}}} + `); + + const thirdLocation = printSourceLocation(minifiedSource, { + line: 1, + column: minifiedSource.body.indexOf('THIRD_ERROR_HERE') + 1, + }); + expect(thirdLocation).to.equal(dedent` + GraphQL request:1:166 + 1 | query SomeMinifiedQueryWithErrorInside($foo:String!=FIRST_ERROR_HERE$bar:String) + | {someField(foo:$foo bar:$bar baz:SECOND_ERROR_HERE){fieldA fieldB{fieldC fieldD. + | ..on THIRD_ERROR_HERE}}} + | ^ + `); + }); + + it('prints single digit line number with no padding', () => { + const result = printSourceLocation( + new Source('*', 'Test', { line: 9, column: 1 }), + { line: 1, column: 1 }, + ); + + expect(result).to.equal(dedent` + Test:9:1 + 9 | * + | ^ + `); + }); + + it('prints an line numbers with correct padding', () => { + const result = printSourceLocation( + new Source('*\n', 'Test', { line: 9, column: 1 }), + { line: 1, column: 1 }, + ); + + expect(result).to.equal(dedent` + Test:9:1 + 9 | * + | ^ + 10 | + `); + }); +}); diff --git a/src/language/__tests__/printString-test.ts b/src/language/__tests__/printString-test.ts new file mode 100644 index 00000000..fff1bfee --- /dev/null +++ b/src/language/__tests__/printString-test.ts @@ -0,0 +1,82 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { printString } from '../printString'; + +describe('printString', () => { + it('prints a simple string', () => { + expect(printString('hello world')).to.equal('"hello world"'); + }); + + it('escapes quotes', () => { + expect(printString('"hello world"')).to.equal('"\\"hello world\\""'); + }); + + it('does not escape single quote', () => { + expect(printString("who's test")).to.equal('"who\'s test"'); + }); + + it('escapes backslashes', () => { + expect(printString('escape: \\')).to.equal('"escape: \\\\"'); + }); + + it('escapes well-known control chars', () => { + expect(printString('\b\f\n\r\t')).to.equal('"\\b\\f\\n\\r\\t"'); + }); + + it('escapes zero byte', () => { + expect(printString('\x00')).to.equal('"\\u0000"'); + }); + + it('does not escape space', () => { + expect(printString(' ')).to.equal('" "'); + }); + + it('does not escape non-ascii character', () => { + expect(printString('\u21BB')).to.equal('"\u21BB"'); + }); + + it('does not escape supplementary character', () => { + expect(printString('\u{1f600}')).to.equal('"\u{1f600}"'); + }); + + it('escapes all control chars', () => { + /* spellchecker:ignore abcdefghijklmnopqrstuvwxyz */ + expect( + printString( + '\u0000\u0001\u0002\u0003\u0004\u0005\u0006\u0007' + + '\u0008\u0009\u000A\u000B\u000C\u000D\u000E\u000F' + + '\u0010\u0011\u0012\u0013\u0014\u0015\u0016\u0017' + + '\u0018\u0019\u001A\u001B\u001C\u001D\u001E\u001F' + + '\u0020\u0021\u0022\u0023\u0024\u0025\u0026\u0027' + + '\u0028\u0029\u002A\u002B\u002C\u002D\u002E\u002F' + + '\u0030\u0031\u0032\u0033\u0034\u0035\u0036\u0037' + + '\u0038\u0039\u003A\u003B\u003C\u003D\u003E\u003F' + + '\u0040\u0041\u0042\u0043\u0044\u0045\u0046\u0047' + + '\u0048\u0049\u004A\u004B\u004C\u004D\u004E\u004F' + + '\u0050\u0051\u0052\u0053\u0054\u0055\u0056\u0057' + + '\u0058\u0059\u005A\u005B\u005C\u005D\u005E\u005F' + + '\u0060\u0061\u0062\u0063\u0064\u0065\u0066\u0067' + + '\u0068\u0069\u006A\u006B\u006C\u006D\u006E\u006F' + + '\u0070\u0071\u0072\u0073\u0074\u0075\u0076\u0077' + + '\u0078\u0079\u007A\u007B\u007C\u007D\u007E\u007F' + + '\u0080\u0081\u0082\u0083\u0084\u0085\u0086\u0087' + + '\u0088\u0089\u008A\u008B\u008C\u008D\u008E\u008F' + + '\u0090\u0091\u0092\u0093\u0094\u0095\u0096\u0097' + + '\u0098\u0099\u009A\u009B\u009C\u009D\u009E\u009F', + ), + ).to.equal( + '"\\u0000\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007' + + '\\b\\t\\n\\u000B\\f\\r\\u000E\\u000F' + + '\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\u0016\\u0017' + + '\\u0018\\u0019\\u001A\\u001B\\u001C\\u001D\\u001E\\u001F' + + ' !\\"#$%&\'()*+,-./0123456789:;<=>?' + + '@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_' + + '`abcdefghijklmnopqrstuvwxyz{|}~\\u007F' + + '\\u0080\\u0081\\u0082\\u0083\\u0084\\u0085\\u0086\\u0087' + + '\\u0088\\u0089\\u008A\\u008B\\u008C\\u008D\\u008E\\u008F' + + '\\u0090\\u0091\\u0092\\u0093\\u0094\\u0095\\u0096\\u0097' + + '\\u0098\\u0099\\u009A\\u009B\\u009C\\u009D\\u009E\\u009F"', + ); + }); +}); diff --git a/src/language/__tests__/printer-test.ts b/src/language/__tests__/printer-test.ts new file mode 100644 index 00000000..227e90dd --- /dev/null +++ b/src/language/__tests__/printer-test.ts @@ -0,0 +1,216 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent, dedentString } from '../../__testUtils__/dedent'; +import { kitchenSinkQuery } from '../../__testUtils__/kitchenSinkQuery'; + +import { Kind } from '../kinds'; +import { parse } from '../parser'; +import { print } from '../printer'; + +describe('Printer: Query document', () => { + it('prints minimal ast', () => { + const ast = { + kind: Kind.FIELD, + name: { kind: Kind.NAME, value: 'foo' }, + } as const; + expect(print(ast)).to.equal('foo'); + }); + + it('produces helpful error messages', () => { + const badAST = { random: 'Data' }; + + // @ts-expect-error + expect(() => print(badAST)).to.throw( + 'Invalid AST Node: { random: "Data" }.', + ); + }); + + it('correctly prints non-query operations without name', () => { + const queryASTShorthanded = parse('query { id, name }'); + expect(print(queryASTShorthanded)).to.equal(dedent` + { + id + name + } + `); + + const mutationAST = parse('mutation { id, name }'); + expect(print(mutationAST)).to.equal(dedent` + mutation { + id + name + } + `); + + const queryASTWithArtifacts = parse( + 'query ($foo: TestType) @testDirective { id, name }', + ); + expect(print(queryASTWithArtifacts)).to.equal(dedent` + query ($foo: TestType) @testDirective { + id + name + } + `); + + const mutationASTWithArtifacts = parse( + 'mutation ($foo: TestType) @testDirective { id, name }', + ); + expect(print(mutationASTWithArtifacts)).to.equal(dedent` + mutation ($foo: TestType) @testDirective { + id + name + } + `); + }); + + it('prints query with variable directives', () => { + const queryASTWithVariableDirective = parse( + 'query ($foo: TestType = {a: 123} @testDirective(if: true) @test) { id }', + ); + expect(print(queryASTWithVariableDirective)).to.equal(dedent` + query ($foo: TestType = {a: 123} @testDirective(if: true) @test) { + id + } + `); + }); + + it('keeps arguments on one line if line is short (<= 80 chars)', () => { + const printed = print( + parse('{trip(wheelchair:false arriveBy:false){dateTime}}'), + ); + + expect(printed).to.equal(dedent` + { + trip(wheelchair: false, arriveBy: false) { + dateTime + } + } + `); + }); + + it('puts arguments on multiple lines if line is long (> 80 chars)', () => { + const printed = print( + parse( + '{trip(wheelchair:false arriveBy:false includePlannedCancellations:true transitDistanceReluctance:2000){dateTime}}', + ), + ); + + expect(printed).to.equal(dedent` + { + trip( + wheelchair: false + arriveBy: false + includePlannedCancellations: true + transitDistanceReluctance: 2000 + ) { + dateTime + } + } + `); + }); + + it('Legacy: prints fragment with variable directives', () => { + const queryASTWithVariableDirective = parse( + 'fragment Foo($foo: TestType @test) on TestType @testDirective { id }', + { allowLegacyFragmentVariables: true }, + ); + expect(print(queryASTWithVariableDirective)).to.equal(dedent` + fragment Foo($foo: TestType @test) on TestType @testDirective { + id + } + `); + }); + + it('Legacy: correctly prints fragment defined variables', () => { + const fragmentWithVariable = parse( + ` + fragment Foo($a: ComplexType, $b: Boolean = false) on TestType { + id + } + `, + { allowLegacyFragmentVariables: true }, + ); + expect(print(fragmentWithVariable)).to.equal(dedent` + fragment Foo($a: ComplexType, $b: Boolean = false) on TestType { + id + } + `); + }); + + it('prints kitchen sink without altering ast', () => { + const ast = parse(kitchenSinkQuery, { noLocation: true }); + + const astBeforePrintCall = JSON.stringify(ast); + const printed = print(ast); + const printedAST = parse(printed, { noLocation: true }); + + expect(printedAST).to.deep.equal(ast); + expect(JSON.stringify(ast)).to.equal(astBeforePrintCall); + + expect(printed).to.equal( + dedentString(String.raw` + query queryName($foo: ComplexType, $site: Site = MOBILE) @onQuery { + whoever123is: node(id: [123, 456]) { + id + ... on User @onInlineFragment { + field2 { + id + alias: field1(first: 10, after: $foo) @include(if: $foo) { + id + ...frag @onFragmentSpread + } + } + } + ... @skip(unless: $foo) { + id + } + ... { + id + } + } + } + + mutation likeStory @onMutation { + like(story: 123) @onField { + story { + id @onField + } + } + } + + subscription StoryLikeSubscription($input: StoryLikeSubscribeInput @onVariableDefinition) @onSubscription { + storyLikeSubscribe(input: $input) { + story { + likers { + count + } + likeSentence { + text + } + } + } + } + + fragment frag on Friend @onFragmentDefinition { + foo( + size: $size + bar: $b + obj: {key: "value", block: """ + block string uses \""" + """} + ) + } + + { + unnamed(truthy: true, falsy: false, nullish: null) + query + } + + { + __typename + } + `), + ); + }); +}); diff --git a/src/language/__tests__/schema-parser-test.ts b/src/language/__tests__/schema-parser-test.ts new file mode 100644 index 00000000..cbb337c3 --- /dev/null +++ b/src/language/__tests__/schema-parser-test.ts @@ -0,0 +1,1106 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; +import { expectJSON, expectToThrowJSON } from '../../__testUtils__/expectJSON'; +import { kitchenSinkSDL } from '../../__testUtils__/kitchenSinkSDL'; + +import { parse } from '../parser'; + +function expectSyntaxError(text: string) { + return expectToThrowJSON(() => parse(text)); +} + +function typeNode(name: unknown, loc: unknown) { + return { + kind: 'NamedType', + name: nameNode(name, loc), + loc, + }; +} + +function nameNode(name: unknown, loc: unknown) { + return { + kind: 'Name', + value: name, + loc, + }; +} + +function fieldNode(name: unknown, type: unknown, loc: unknown) { + return fieldNodeWithArgs(name, type, [], loc); +} + +function fieldNodeWithArgs( + name: unknown, + type: unknown, + args: unknown, + loc: unknown, +) { + return { + kind: 'FieldDefinition', + description: undefined, + name, + arguments: args, + type, + directives: [], + loc, + }; +} + +function enumValueNode(name: unknown, loc: unknown) { + return { + kind: 'EnumValueDefinition', + name: nameNode(name, loc), + description: undefined, + directives: [], + loc, + }; +} + +function inputValueNode( + name: unknown, + type: unknown, + defaultValue: unknown, + loc: unknown, +) { + return { + kind: 'InputValueDefinition', + name, + description: undefined, + type, + defaultValue, + directives: [], + loc, + }; +} + +describe('Schema Parser', () => { + it('Simple type', () => { + const doc = parse(dedent` + type Hello { + world: String + } + `); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ObjectTypeDefinition', + name: nameNode('Hello', { start: 5, end: 10 }), + description: undefined, + interfaces: [], + directives: [], + fields: [ + fieldNode( + nameNode('world', { start: 15, end: 20 }), + typeNode('String', { start: 22, end: 28 }), + { start: 15, end: 28 }, + ), + ], + loc: { start: 0, end: 30 }, + }, + ], + loc: { start: 0, end: 30 }, + }); + }); + + it('parses type with description string', () => { + const doc = parse(dedent` + "Description" + type Hello { + world: String + } + `); + + expectJSON(doc).toDeepNestedProperty('definitions[0].description', { + kind: 'StringValue', + value: 'Description', + block: false, + loc: { start: 0, end: 13 }, + }); + }); + + it('parses type with description multi-line string', () => { + const doc = parse(dedent` + """ + Description + """ + # Even with comments between them + type Hello { + world: String + } + `); + + expectJSON(doc).toDeepNestedProperty('definitions[0].description', { + kind: 'StringValue', + value: 'Description', + block: true, + loc: { start: 0, end: 19 }, + }); + }); + + it('parses schema with description string', () => { + const doc = parse(dedent` + "Description" + schema { + query: Foo + } + `); + + expectJSON(doc).toDeepNestedProperty('definitions[0].description', { + kind: 'StringValue', + value: 'Description', + block: false, + loc: { start: 0, end: 13 }, + }); + }); + + it('Description followed by something other than type system definition throws', () => { + expectSyntaxError('"Description" 1').to.deep.equal({ + message: 'Syntax Error: Unexpected Int "1".', + locations: [{ line: 1, column: 15 }], + }); + }); + + it('Simple extension', () => { + const doc = parse(dedent` + extend type Hello { + world: String + } + `); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ObjectTypeExtension', + name: nameNode('Hello', { start: 12, end: 17 }), + interfaces: [], + directives: [], + fields: [ + fieldNode( + nameNode('world', { start: 22, end: 27 }), + typeNode('String', { start: 29, end: 35 }), + { start: 22, end: 35 }, + ), + ], + loc: { start: 0, end: 37 }, + }, + ], + loc: { start: 0, end: 37 }, + }); + }); + + it('Object extension without fields', () => { + const doc = parse('extend type Hello implements Greeting'); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ObjectTypeExtension', + name: nameNode('Hello', { start: 12, end: 17 }), + interfaces: [typeNode('Greeting', { start: 29, end: 37 })], + directives: [], + fields: [], + loc: { start: 0, end: 37 }, + }, + ], + loc: { start: 0, end: 37 }, + }); + }); + + it('Interface extension without fields', () => { + const doc = parse('extend interface Hello implements Greeting'); + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'InterfaceTypeExtension', + name: nameNode('Hello', { start: 17, end: 22 }), + interfaces: [typeNode('Greeting', { start: 34, end: 42 })], + directives: [], + fields: [], + loc: { start: 0, end: 42 }, + }, + ], + loc: { start: 0, end: 42 }, + }); + }); + + it('Object extension without fields followed by extension', () => { + const doc = parse(` + extend type Hello implements Greeting + + extend type Hello implements SecondGreeting + `); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ObjectTypeExtension', + name: nameNode('Hello', { start: 19, end: 24 }), + interfaces: [typeNode('Greeting', { start: 36, end: 44 })], + directives: [], + fields: [], + loc: { start: 7, end: 44 }, + }, + { + kind: 'ObjectTypeExtension', + name: nameNode('Hello', { start: 64, end: 69 }), + interfaces: [typeNode('SecondGreeting', { start: 81, end: 95 })], + directives: [], + fields: [], + loc: { start: 52, end: 95 }, + }, + ], + loc: { start: 0, end: 100 }, + }); + }); + + it('Extension without anything throws', () => { + expectSyntaxError('extend scalar Hello').to.deep.equal({ + message: 'Syntax Error: Unexpected .', + locations: [{ line: 1, column: 20 }], + }); + + expectSyntaxError('extend type Hello').to.deep.equal({ + message: 'Syntax Error: Unexpected .', + locations: [{ line: 1, column: 18 }], + }); + + expectSyntaxError('extend interface Hello').to.deep.equal({ + message: 'Syntax Error: Unexpected .', + locations: [{ line: 1, column: 23 }], + }); + + expectSyntaxError('extend union Hello').to.deep.equal({ + message: 'Syntax Error: Unexpected .', + locations: [{ line: 1, column: 19 }], + }); + + expectSyntaxError('extend enum Hello').to.deep.equal({ + message: 'Syntax Error: Unexpected .', + locations: [{ line: 1, column: 18 }], + }); + + expectSyntaxError('extend input Hello').to.deep.equal({ + message: 'Syntax Error: Unexpected .', + locations: [{ line: 1, column: 19 }], + }); + }); + + it('Interface extension without fields followed by extension', () => { + const doc = parse(` + extend interface Hello implements Greeting + + extend interface Hello implements SecondGreeting + `); + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'InterfaceTypeExtension', + name: nameNode('Hello', { start: 24, end: 29 }), + interfaces: [typeNode('Greeting', { start: 41, end: 49 })], + directives: [], + fields: [], + loc: { start: 7, end: 49 }, + }, + { + kind: 'InterfaceTypeExtension', + name: nameNode('Hello', { start: 74, end: 79 }), + interfaces: [typeNode('SecondGreeting', { start: 91, end: 105 })], + directives: [], + fields: [], + loc: { start: 57, end: 105 }, + }, + ], + loc: { start: 0, end: 110 }, + }); + }); + + it('Object extension do not include descriptions', () => { + expectSyntaxError(` + "Description" + extend type Hello { + world: String + } + `).to.deep.equal({ + message: + 'Syntax Error: Unexpected description, descriptions are supported only on type definitions.', + locations: [{ line: 2, column: 7 }], + }); + + expectSyntaxError(` + extend "Description" type Hello { + world: String + } + `).to.deep.equal({ + message: 'Syntax Error: Unexpected String "Description".', + locations: [{ line: 2, column: 14 }], + }); + }); + + it('Interface extension do not include descriptions', () => { + expectSyntaxError(` + "Description" + extend interface Hello { + world: String + } + `).to.deep.equal({ + message: + 'Syntax Error: Unexpected description, descriptions are supported only on type definitions.', + locations: [{ line: 2, column: 7 }], + }); + + expectSyntaxError(` + extend "Description" interface Hello { + world: String + } + `).to.deep.equal({ + message: 'Syntax Error: Unexpected String "Description".', + locations: [{ line: 2, column: 14 }], + }); + }); + + it('Schema extension', () => { + const body = ` + extend schema { + mutation: Mutation + }`; + const doc = parse(body); + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'SchemaExtension', + directives: [], + operationTypes: [ + { + kind: 'OperationTypeDefinition', + operation: 'mutation', + type: typeNode('Mutation', { start: 41, end: 49 }), + loc: { start: 31, end: 49 }, + }, + ], + loc: { start: 7, end: 57 }, + }, + ], + loc: { start: 0, end: 57 }, + }); + }); + + it('Schema extension with only directives', () => { + const body = 'extend schema @directive'; + const doc = parse(body); + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'SchemaExtension', + directives: [ + { + kind: 'Directive', + name: nameNode('directive', { start: 15, end: 24 }), + arguments: [], + loc: { start: 14, end: 24 }, + }, + ], + operationTypes: [], + loc: { start: 0, end: 24 }, + }, + ], + loc: { start: 0, end: 24 }, + }); + }); + + it('Schema extension without anything throws', () => { + expectSyntaxError('extend schema').to.deep.equal({ + message: 'Syntax Error: Unexpected .', + locations: [{ line: 1, column: 14 }], + }); + }); + + it('Schema extension with invalid operation type throws', () => { + expectSyntaxError('extend schema { unknown: SomeType }').to.deep.equal({ + message: 'Syntax Error: Unexpected Name "unknown".', + locations: [{ line: 1, column: 17 }], + }); + }); + + it('Simple non-null type', () => { + const doc = parse(dedent` + type Hello { + world: String! + } + `); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ObjectTypeDefinition', + name: nameNode('Hello', { start: 5, end: 10 }), + description: undefined, + interfaces: [], + directives: [], + fields: [ + fieldNode( + nameNode('world', { start: 15, end: 20 }), + { + kind: 'NonNullType', + type: typeNode('String', { start: 22, end: 28 }), + loc: { start: 22, end: 29 }, + }, + { start: 15, end: 29 }, + ), + ], + loc: { start: 0, end: 31 }, + }, + ], + loc: { start: 0, end: 31 }, + }); + }); + + it('Simple interface inheriting interface', () => { + const doc = parse('interface Hello implements World { field: String }'); + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'InterfaceTypeDefinition', + name: nameNode('Hello', { start: 10, end: 15 }), + description: undefined, + interfaces: [typeNode('World', { start: 27, end: 32 })], + directives: [], + fields: [ + fieldNode( + nameNode('field', { start: 35, end: 40 }), + typeNode('String', { start: 42, end: 48 }), + { start: 35, end: 48 }, + ), + ], + loc: { start: 0, end: 50 }, + }, + ], + loc: { start: 0, end: 50 }, + }); + }); + + it('Simple type inheriting interface', () => { + const doc = parse('type Hello implements World { field: String }'); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ObjectTypeDefinition', + name: nameNode('Hello', { start: 5, end: 10 }), + description: undefined, + interfaces: [typeNode('World', { start: 22, end: 27 })], + directives: [], + fields: [ + fieldNode( + nameNode('field', { start: 30, end: 35 }), + typeNode('String', { start: 37, end: 43 }), + { start: 30, end: 43 }, + ), + ], + loc: { start: 0, end: 45 }, + }, + ], + loc: { start: 0, end: 45 }, + }); + }); + + it('Simple type inheriting multiple interfaces', () => { + const doc = parse('type Hello implements Wo & rld { field: String }'); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ObjectTypeDefinition', + name: nameNode('Hello', { start: 5, end: 10 }), + description: undefined, + interfaces: [ + typeNode('Wo', { start: 22, end: 24 }), + typeNode('rld', { start: 27, end: 30 }), + ], + directives: [], + fields: [ + fieldNode( + nameNode('field', { start: 33, end: 38 }), + typeNode('String', { start: 40, end: 46 }), + { start: 33, end: 46 }, + ), + ], + loc: { start: 0, end: 48 }, + }, + ], + loc: { start: 0, end: 48 }, + }); + }); + + it('Simple interface inheriting multiple interfaces', () => { + const doc = parse('interface Hello implements Wo & rld { field: String }'); + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'InterfaceTypeDefinition', + name: nameNode('Hello', { start: 10, end: 15 }), + description: undefined, + interfaces: [ + typeNode('Wo', { start: 27, end: 29 }), + typeNode('rld', { start: 32, end: 35 }), + ], + directives: [], + fields: [ + fieldNode( + nameNode('field', { start: 38, end: 43 }), + typeNode('String', { start: 45, end: 51 }), + { start: 38, end: 51 }, + ), + ], + loc: { start: 0, end: 53 }, + }, + ], + loc: { start: 0, end: 53 }, + }); + }); + + it('Simple type inheriting multiple interfaces with leading ampersand', () => { + const doc = parse('type Hello implements & Wo & rld { field: String }'); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ObjectTypeDefinition', + name: nameNode('Hello', { start: 5, end: 10 }), + description: undefined, + interfaces: [ + typeNode('Wo', { start: 24, end: 26 }), + typeNode('rld', { start: 29, end: 32 }), + ], + directives: [], + fields: [ + fieldNode( + nameNode('field', { start: 35, end: 40 }), + typeNode('String', { start: 42, end: 48 }), + { start: 35, end: 48 }, + ), + ], + loc: { start: 0, end: 50 }, + }, + ], + loc: { start: 0, end: 50 }, + }); + }); + + it('Simple interface inheriting multiple interfaces with leading ampersand', () => { + const doc = parse( + 'interface Hello implements & Wo & rld { field: String }', + ); + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'InterfaceTypeDefinition', + name: nameNode('Hello', { start: 10, end: 15 }), + description: undefined, + interfaces: [ + typeNode('Wo', { start: 29, end: 31 }), + typeNode('rld', { start: 34, end: 37 }), + ], + directives: [], + fields: [ + fieldNode( + nameNode('field', { start: 40, end: 45 }), + typeNode('String', { start: 47, end: 53 }), + { start: 40, end: 53 }, + ), + ], + loc: { start: 0, end: 55 }, + }, + ], + loc: { start: 0, end: 55 }, + }); + }); + + it('Single value enum', () => { + const doc = parse('enum Hello { WORLD }'); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'EnumTypeDefinition', + name: nameNode('Hello', { start: 5, end: 10 }), + description: undefined, + directives: [], + values: [enumValueNode('WORLD', { start: 13, end: 18 })], + loc: { start: 0, end: 20 }, + }, + ], + loc: { start: 0, end: 20 }, + }); + }); + + it('Double value enum', () => { + const doc = parse('enum Hello { WO, RLD }'); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'EnumTypeDefinition', + name: nameNode('Hello', { start: 5, end: 10 }), + description: undefined, + directives: [], + values: [ + enumValueNode('WO', { start: 13, end: 15 }), + enumValueNode('RLD', { start: 17, end: 20 }), + ], + loc: { start: 0, end: 22 }, + }, + ], + loc: { start: 0, end: 22 }, + }); + }); + + it('Simple interface', () => { + const doc = parse(dedent` + interface Hello { + world: String + } + `); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'InterfaceTypeDefinition', + name: nameNode('Hello', { start: 10, end: 15 }), + description: undefined, + interfaces: [], + directives: [], + fields: [ + fieldNode( + nameNode('world', { start: 20, end: 25 }), + typeNode('String', { start: 27, end: 33 }), + { start: 20, end: 33 }, + ), + ], + loc: { start: 0, end: 35 }, + }, + ], + loc: { start: 0, end: 35 }, + }); + }); + + it('Simple field with arg', () => { + const doc = parse(dedent` + type Hello { + world(flag: Boolean): String + } + `); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ObjectTypeDefinition', + name: nameNode('Hello', { start: 5, end: 10 }), + description: undefined, + interfaces: [], + directives: [], + fields: [ + fieldNodeWithArgs( + nameNode('world', { start: 15, end: 20 }), + typeNode('String', { start: 37, end: 43 }), + [ + inputValueNode( + nameNode('flag', { start: 21, end: 25 }), + typeNode('Boolean', { start: 27, end: 34 }), + undefined, + { start: 21, end: 34 }, + ), + ], + { start: 15, end: 43 }, + ), + ], + loc: { start: 0, end: 45 }, + }, + ], + loc: { start: 0, end: 45 }, + }); + }); + + it('Simple field with arg with default value', () => { + const doc = parse(dedent` + type Hello { + world(flag: Boolean = true): String + } + `); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ObjectTypeDefinition', + name: nameNode('Hello', { start: 5, end: 10 }), + description: undefined, + interfaces: [], + directives: [], + fields: [ + fieldNodeWithArgs( + nameNode('world', { start: 15, end: 20 }), + typeNode('String', { start: 44, end: 50 }), + [ + inputValueNode( + nameNode('flag', { start: 21, end: 25 }), + typeNode('Boolean', { start: 27, end: 34 }), + { + kind: 'BooleanValue', + value: true, + loc: { start: 37, end: 41 }, + }, + { start: 21, end: 41 }, + ), + ], + { start: 15, end: 50 }, + ), + ], + loc: { start: 0, end: 52 }, + }, + ], + loc: { start: 0, end: 52 }, + }); + }); + + it('Simple field with list arg', () => { + const doc = parse(dedent` + type Hello { + world(things: [String]): String + } + `); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ObjectTypeDefinition', + name: nameNode('Hello', { start: 5, end: 10 }), + description: undefined, + interfaces: [], + directives: [], + fields: [ + fieldNodeWithArgs( + nameNode('world', { start: 15, end: 20 }), + typeNode('String', { start: 40, end: 46 }), + [ + inputValueNode( + nameNode('things', { start: 21, end: 27 }), + { + kind: 'ListType', + type: typeNode('String', { start: 30, end: 36 }), + loc: { start: 29, end: 37 }, + }, + undefined, + { start: 21, end: 37 }, + ), + ], + { start: 15, end: 46 }, + ), + ], + loc: { start: 0, end: 48 }, + }, + ], + loc: { start: 0, end: 48 }, + }); + }); + + it('Simple field with two args', () => { + const doc = parse(dedent` + type Hello { + world(argOne: Boolean, argTwo: Int): String + } + `); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ObjectTypeDefinition', + name: nameNode('Hello', { start: 5, end: 10 }), + description: undefined, + interfaces: [], + directives: [], + fields: [ + fieldNodeWithArgs( + nameNode('world', { start: 15, end: 20 }), + typeNode('String', { start: 52, end: 58 }), + [ + inputValueNode( + nameNode('argOne', { start: 21, end: 27 }), + typeNode('Boolean', { start: 29, end: 36 }), + undefined, + { start: 21, end: 36 }, + ), + inputValueNode( + nameNode('argTwo', { start: 38, end: 44 }), + typeNode('Int', { start: 46, end: 49 }), + undefined, + { start: 38, end: 49 }, + ), + ], + { start: 15, end: 58 }, + ), + ], + loc: { start: 0, end: 60 }, + }, + ], + loc: { start: 0, end: 60 }, + }); + }); + + it('Simple union', () => { + const doc = parse('union Hello = World'); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'UnionTypeDefinition', + name: nameNode('Hello', { start: 6, end: 11 }), + description: undefined, + directives: [], + types: [typeNode('World', { start: 14, end: 19 })], + loc: { start: 0, end: 19 }, + }, + ], + loc: { start: 0, end: 19 }, + }); + }); + + it('Union with two types', () => { + const doc = parse('union Hello = Wo | Rld'); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'UnionTypeDefinition', + name: nameNode('Hello', { start: 6, end: 11 }), + description: undefined, + directives: [], + types: [ + typeNode('Wo', { start: 14, end: 16 }), + typeNode('Rld', { start: 19, end: 22 }), + ], + loc: { start: 0, end: 22 }, + }, + ], + loc: { start: 0, end: 22 }, + }); + }); + + it('Union with two types and leading pipe', () => { + const doc = parse('union Hello = | Wo | Rld'); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'UnionTypeDefinition', + name: nameNode('Hello', { start: 6, end: 11 }), + description: undefined, + directives: [], + types: [ + typeNode('Wo', { start: 16, end: 18 }), + typeNode('Rld', { start: 21, end: 24 }), + ], + loc: { start: 0, end: 24 }, + }, + ], + loc: { start: 0, end: 24 }, + }); + }); + + it('Union fails with no types', () => { + expectSyntaxError('union Hello = |').to.deep.equal({ + message: 'Syntax Error: Expected Name, found .', + locations: [{ line: 1, column: 16 }], + }); + }); + + it('Union fails with leading double pipe', () => { + expectSyntaxError('union Hello = || Wo | Rld').to.deep.equal({ + message: 'Syntax Error: Expected Name, found "|".', + locations: [{ line: 1, column: 16 }], + }); + }); + + it('Union fails with double pipe', () => { + expectSyntaxError('union Hello = Wo || Rld').to.deep.equal({ + message: 'Syntax Error: Expected Name, found "|".', + locations: [{ line: 1, column: 19 }], + }); + }); + + it('Union fails with trailing pipe', () => { + expectSyntaxError('union Hello = | Wo | Rld |').to.deep.equal({ + message: 'Syntax Error: Expected Name, found .', + locations: [{ line: 1, column: 27 }], + }); + }); + + it('Scalar', () => { + const doc = parse('scalar Hello'); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'ScalarTypeDefinition', + name: nameNode('Hello', { start: 7, end: 12 }), + description: undefined, + directives: [], + loc: { start: 0, end: 12 }, + }, + ], + loc: { start: 0, end: 12 }, + }); + }); + + it('Simple input object', () => { + const doc = parse(` +input Hello { + world: String +}`); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'InputObjectTypeDefinition', + name: nameNode('Hello', { start: 7, end: 12 }), + description: undefined, + directives: [], + fields: [ + inputValueNode( + nameNode('world', { start: 17, end: 22 }), + typeNode('String', { start: 24, end: 30 }), + undefined, + { start: 17, end: 30 }, + ), + ], + loc: { start: 1, end: 32 }, + }, + ], + loc: { start: 0, end: 32 }, + }); + }); + + it('Simple input object with args should fail', () => { + expectSyntaxError(` + input Hello { + world(foo: Int): String + } + `).to.deep.equal({ + message: 'Syntax Error: Expected ":", found "(".', + locations: [{ line: 3, column: 14 }], + }); + }); + + it('Directive definition', () => { + const body = 'directive @foo on OBJECT | INTERFACE'; + const doc = parse(body); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'DirectiveDefinition', + description: undefined, + name: { + kind: 'Name', + value: 'foo', + loc: { start: 11, end: 14 }, + }, + arguments: [], + repeatable: false, + locations: [ + { + kind: 'Name', + value: 'OBJECT', + loc: { start: 18, end: 24 }, + }, + { + kind: 'Name', + value: 'INTERFACE', + loc: { start: 27, end: 36 }, + }, + ], + loc: { start: 0, end: 36 }, + }, + ], + loc: { start: 0, end: 36 }, + }); + }); + + it('Repeatable directive definition', () => { + const body = 'directive @foo repeatable on OBJECT | INTERFACE'; + const doc = parse(body); + + expectJSON(doc).toDeepEqual({ + kind: 'Document', + definitions: [ + { + kind: 'DirectiveDefinition', + description: undefined, + name: { + kind: 'Name', + value: 'foo', + loc: { start: 11, end: 14 }, + }, + arguments: [], + repeatable: true, + locations: [ + { + kind: 'Name', + value: 'OBJECT', + loc: { start: 29, end: 35 }, + }, + { + kind: 'Name', + value: 'INTERFACE', + loc: { start: 38, end: 47 }, + }, + ], + loc: { start: 0, end: 47 }, + }, + ], + loc: { start: 0, end: 47 }, + }); + }); + + it('Directive with incorrect locations', () => { + expectSyntaxError( + 'directive @foo on FIELD | INCORRECT_LOCATION', + ).to.deep.equal({ + message: 'Syntax Error: Unexpected Name "INCORRECT_LOCATION".', + locations: [{ line: 1, column: 27 }], + }); + }); + + it('parses kitchen sink schema', () => { + expect(() => parse(kitchenSinkSDL)).to.not.throw(); + }); +}); diff --git a/src/language/__tests__/schema-printer-test.ts b/src/language/__tests__/schema-printer-test.ts new file mode 100644 index 00000000..49a32693 --- /dev/null +++ b/src/language/__tests__/schema-printer-test.ts @@ -0,0 +1,177 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; +import { kitchenSinkSDL } from '../../__testUtils__/kitchenSinkSDL'; + +import { Kind } from '../kinds'; +import { parse } from '../parser'; +import { print } from '../printer'; + +describe('Printer: SDL document', () => { + it('prints minimal ast', () => { + const ast = { + kind: Kind.SCALAR_TYPE_DEFINITION, + name: { kind: Kind.NAME, value: 'foo' }, + } as const; + expect(print(ast)).to.equal('scalar foo'); + }); + + it('produces helpful error messages', () => { + const badAST = { random: 'Data' }; + + // @ts-expect-error + expect(() => print(badAST)).to.throw( + 'Invalid AST Node: { random: "Data" }.', + ); + }); + + it('prints kitchen sink without altering ast', () => { + const ast = parse(kitchenSinkSDL, { noLocation: true }); + + const astBeforePrintCall = JSON.stringify(ast); + const printed = print(ast); + const printedAST = parse(printed, { noLocation: true }); + + expect(printedAST).to.deep.equal(ast); + expect(JSON.stringify(ast)).to.equal(astBeforePrintCall); + + expect(printed).to.equal(dedent` + """This is a description of the schema as a whole.""" + schema { + query: QueryType + mutation: MutationType + } + + """ + This is a description + of the \`Foo\` type. + """ + type Foo implements Bar & Baz & Two { + "Description of the \`one\` field." + one: Type + """This is a description of the \`two\` field.""" + two( + """This is a description of the \`argument\` argument.""" + argument: InputType! + ): Type + """This is a description of the \`three\` field.""" + three(argument: InputType, other: String): Int + four(argument: String = "string"): String + five(argument: [String] = ["string", "string"]): String + six(argument: InputType = {key: "value"}): Type + seven(argument: Int = null): Type + } + + type AnnotatedObject @onObject(arg: "value") { + annotatedField(arg: Type = "default" @onArgumentDefinition): Type @onField + } + + type UndefinedType + + extend type Foo { + seven(argument: [String]): Type + } + + extend type Foo @onType + + interface Bar { + one: Type + four(argument: String = "string"): String + } + + interface AnnotatedInterface @onInterface { + annotatedField(arg: Type @onArgumentDefinition): Type @onField + } + + interface UndefinedInterface + + extend interface Bar implements Two { + two(argument: InputType!): Type + } + + extend interface Bar @onInterface + + interface Baz implements Bar & Two { + one: Type + two(argument: InputType!): Type + four(argument: String = "string"): String + } + + union Feed = Story | Article | Advert + + union AnnotatedUnion @onUnion = A | B + + union AnnotatedUnionTwo @onUnion = A | B + + union UndefinedUnion + + extend union Feed = Photo | Video + + extend union Feed @onUnion + + scalar CustomScalar + + scalar AnnotatedScalar @onScalar + + extend scalar CustomScalar @onScalar + + enum Site { + """This is a description of the \`DESKTOP\` value""" + DESKTOP + """This is a description of the \`MOBILE\` value""" + MOBILE + "This is a description of the \`WEB\` value" + WEB + } + + enum AnnotatedEnum @onEnum { + ANNOTATED_VALUE @onEnumValue + OTHER_VALUE + } + + enum UndefinedEnum + + extend enum Site { + VR + } + + extend enum Site @onEnum + + input InputType { + key: String! + answer: Int = 42 + } + + input AnnotatedInput @onInputObject { + annotatedField: Type @onInputFieldDefinition + } + + input UndefinedInput + + extend input InputType { + other: Float = 1.23e4 @onInputFieldDefinition + } + + extend input InputType @onInputObject + + """This is a description of the \`@skip\` directive""" + directive @skip( + """This is a description of the \`if\` argument""" + if: Boolean! @onArgumentDefinition + ) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @include2(if: Boolean!) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + directive @myRepeatableDir(name: String!) repeatable on OBJECT | INTERFACE + + extend schema @onSchema + + extend schema @onSchema { + subscription: SubscriptionType + } + `); + }); +}); diff --git a/src/language/__tests__/source-test.ts b/src/language/__tests__/source-test.ts new file mode 100644 index 00000000..6bf8a93e --- /dev/null +++ b/src/language/__tests__/source-test.ts @@ -0,0 +1,46 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { Source } from '../source'; + +describe('Source', () => { + it('asserts that a body was provided', () => { + // @ts-expect-error + expect(() => new Source()).to.throw( + 'Body must be a string. Received: undefined.', + ); + }); + + it('asserts that a valid body was provided', () => { + // @ts-expect-error + expect(() => new Source({})).to.throw( + 'Body must be a string. Received: {}.', + ); + }); + + it('can be Object.toStringified', () => { + const source = new Source(''); + + expect(Object.prototype.toString.call(source)).to.equal('[object Source]'); + }); + + it('rejects invalid locationOffset', () => { + function createSource(locationOffset: { line: number; column: number }) { + return new Source('', '', locationOffset); + } + + expect(() => createSource({ line: 0, column: 1 })).to.throw( + 'line in locationOffset is 1-indexed and must be positive.', + ); + expect(() => createSource({ line: -1, column: 1 })).to.throw( + 'line in locationOffset is 1-indexed and must be positive.', + ); + + expect(() => createSource({ line: 1, column: 0 })).to.throw( + 'column in locationOffset is 1-indexed and must be positive.', + ); + expect(() => createSource({ line: 1, column: -1 })).to.throw( + 'column in locationOffset is 1-indexed and must be positive.', + ); + }); +}); diff --git a/src/language/__tests__/visitor-test.ts b/src/language/__tests__/visitor-test.ts new file mode 100644 index 00000000..9149b103 --- /dev/null +++ b/src/language/__tests__/visitor-test.ts @@ -0,0 +1,1364 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { kitchenSinkQuery } from '../../__testUtils__/kitchenSinkQuery'; + +import type { ASTNode, SelectionSetNode } from '../ast'; +import { isNode } from '../ast'; +import { Kind } from '../kinds'; +import { parse } from '../parser'; +import type { ASTVisitor, ASTVisitorKeyMap } from '../visitor'; +import { BREAK, visit, visitInParallel } from '../visitor'; + +function checkVisitorFnArgs(ast: any, args: any, isEdited: boolean = false) { + const [node, key, parent, path, ancestors] = args; + + expect(node).to.be.an.instanceof(Object); + expect(node.kind).to.be.oneOf(Object.values(Kind)); + + const isRoot = key === undefined; + if (isRoot) { + if (!isEdited) { + expect(node).to.equal(ast); + } + expect(parent).to.equal(undefined); + expect(path).to.deep.equal([]); + expect(ancestors).to.deep.equal([]); + return; + } + + expect(typeof key).to.be.oneOf(['number', 'string']); + + expect(parent).to.have.property(key); + + expect(path).to.be.an.instanceof(Array); + expect(path[path.length - 1]).to.equal(key); + + expect(ancestors).to.be.an.instanceof(Array); + expect(ancestors.length).to.equal(path.length - 1); + + if (!isEdited) { + let currentNode = ast; + for (let i = 0; i < ancestors.length; ++i) { + expect(ancestors[i]).to.equal(currentNode); + + currentNode = currentNode[path[i]]; + expect(currentNode).to.not.equal(undefined); + } + + expect(parent).to.equal(currentNode); + expect(parent[key]).to.equal(node); + } +} + +function getValue(node: ASTNode) { + return 'value' in node ? node.value : undefined; +} + +describe('Visitor', () => { + it('handles empty visitor', () => { + const ast = parse('{ a }', { noLocation: true }); + expect(() => visit(ast, {})).to.not.throw(); + }); + + it('validates path argument', () => { + const visited: Array = []; + + const ast = parse('{ a }', { noLocation: true }); + + visit(ast, { + enter(_node, _key, _parent, path) { + checkVisitorFnArgs(ast, arguments); + visited.push(['enter', path.slice()]); + }, + leave(_node, _key, _parent, path) { + checkVisitorFnArgs(ast, arguments); + visited.push(['leave', path.slice()]); + }, + }); + + expect(visited).to.deep.equal([ + ['enter', []], + ['enter', ['definitions', 0]], + ['enter', ['definitions', 0, 'selectionSet']], + ['enter', ['definitions', 0, 'selectionSet', 'selections', 0]], + ['enter', ['definitions', 0, 'selectionSet', 'selections', 0, 'name']], + ['leave', ['definitions', 0, 'selectionSet', 'selections', 0, 'name']], + ['leave', ['definitions', 0, 'selectionSet', 'selections', 0]], + ['leave', ['definitions', 0, 'selectionSet']], + ['leave', ['definitions', 0]], + ['leave', []], + ]); + }); + + it('validates ancestors argument', () => { + const ast = parse('{ a }', { noLocation: true }); + const visitedNodes: Array = []; + + visit(ast, { + enter(node, key, parent, _path, ancestors) { + const inArray = typeof key === 'number'; + if (inArray) { + visitedNodes.push(parent); + } + visitedNodes.push(node); + + const expectedAncestors = visitedNodes.slice(0, -2); + expect(ancestors).to.deep.equal(expectedAncestors); + }, + leave(_node, key, _parent, _path, ancestors) { + const expectedAncestors = visitedNodes.slice(0, -2); + expect(ancestors).to.deep.equal(expectedAncestors); + + const inArray = typeof key === 'number'; + if (inArray) { + visitedNodes.pop(); + } + visitedNodes.pop(); + }, + }); + }); + + it('allows editing a node both on enter and on leave', () => { + const ast = parse('{ a, b, c { a, b, c } }', { noLocation: true }); + + let selectionSet: SelectionSetNode; + + const editedAST = visit(ast, { + OperationDefinition: { + enter(node) { + checkVisitorFnArgs(ast, arguments); + selectionSet = node.selectionSet; + return { + ...node, + selectionSet: { + kind: 'SelectionSet', + selections: [], + }, + didEnter: true, + }; + }, + leave(node) { + checkVisitorFnArgs(ast, arguments, /* isEdited */ true); + return { + ...node, + selectionSet, + didLeave: true, + }; + }, + }, + }); + + expect(editedAST).to.deep.equal({ + ...ast, + definitions: [ + { + ...ast.definitions[0], + didEnter: true, + didLeave: true, + }, + ], + }); + }); + + it('allows editing the root node on enter and on leave', () => { + const ast = parse('{ a, b, c { a, b, c } }', { noLocation: true }); + + const { definitions } = ast; + + const editedAST = visit(ast, { + Document: { + enter(node) { + checkVisitorFnArgs(ast, arguments); + return { + ...node, + definitions: [], + didEnter: true, + }; + }, + leave(node) { + checkVisitorFnArgs(ast, arguments, /* isEdited */ true); + return { + ...node, + definitions, + didLeave: true, + }; + }, + }, + }); + + expect(editedAST).to.deep.equal({ + ...ast, + didEnter: true, + didLeave: true, + }); + }); + + it('allows for editing on enter', () => { + const ast = parse('{ a, b, c { a, b, c } }', { noLocation: true }); + const editedAST = visit(ast, { + enter(node) { + checkVisitorFnArgs(ast, arguments); + if (node.kind === 'Field' && node.name.value === 'b') { + return null; + } + }, + }); + + expect(ast).to.deep.equal( + parse('{ a, b, c { a, b, c } }', { noLocation: true }), + ); + + expect(editedAST).to.deep.equal( + parse('{ a, c { a, c } }', { noLocation: true }), + ); + }); + + it('allows for editing on leave', () => { + const ast = parse('{ a, b, c { a, b, c } }', { noLocation: true }); + const editedAST = visit(ast, { + leave(node) { + checkVisitorFnArgs(ast, arguments, /* isEdited */ true); + if (node.kind === 'Field' && node.name.value === 'b') { + return null; + } + }, + }); + + expect(ast).to.deep.equal( + parse('{ a, b, c { a, b, c } }', { noLocation: true }), + ); + + expect(editedAST).to.deep.equal( + parse('{ a, c { a, c } }', { noLocation: true }), + ); + }); + + it('ignores false returned on leave', () => { + const ast = parse('{ a, b, c { a, b, c } }', { noLocation: true }); + const returnedAST = visit(ast, { + leave() { + return false; + }, + }); + + expect(returnedAST).to.deep.equal( + parse('{ a, b, c { a, b, c } }', { noLocation: true }), + ); + }); + + it('visits edited node', () => { + const addedField = { + kind: 'Field', + name: { + kind: 'Name', + value: '__typename', + }, + }; + + let didVisitAddedField; + + const ast = parse('{ a { x } }', { noLocation: true }); + visit(ast, { + enter(node) { + checkVisitorFnArgs(ast, arguments, /* isEdited */ true); + if (node.kind === 'Field' && node.name.value === 'a') { + return { + kind: 'Field', + selectionSet: [addedField, node.selectionSet], + }; + } + if (node === addedField) { + didVisitAddedField = true; + } + }, + }); + + expect(didVisitAddedField).to.equal(true); + }); + + it('allows skipping a sub-tree', () => { + const visited: Array = []; + + const ast = parse('{ a, b { x }, c }', { noLocation: true }); + visit(ast, { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['enter', node.kind, getValue(node)]); + if (node.kind === 'Field' && node.name.value === 'b') { + return false; + } + }, + + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['leave', node.kind, getValue(node)]); + }, + }); + + expect(visited).to.deep.equal([ + ['enter', 'Document', undefined], + ['enter', 'OperationDefinition', undefined], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'a'], + ['leave', 'Name', 'a'], + ['leave', 'Field', undefined], + ['enter', 'Field', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'c'], + ['leave', 'Name', 'c'], + ['leave', 'Field', undefined], + ['leave', 'SelectionSet', undefined], + ['leave', 'OperationDefinition', undefined], + ['leave', 'Document', undefined], + ]); + }); + + it('allows early exit while visiting', () => { + const visited: Array = []; + + const ast = parse('{ a, b { x }, c }', { noLocation: true }); + visit(ast, { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['enter', node.kind, getValue(node)]); + if (node.kind === 'Name' && node.value === 'x') { + return BREAK; + } + }, + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['leave', node.kind, getValue(node)]); + }, + }); + + expect(visited).to.deep.equal([ + ['enter', 'Document', undefined], + ['enter', 'OperationDefinition', undefined], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'a'], + ['leave', 'Name', 'a'], + ['leave', 'Field', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'b'], + ['leave', 'Name', 'b'], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'x'], + ]); + }); + + it('allows early exit while leaving', () => { + const visited: Array = []; + + const ast = parse('{ a, b { x }, c }', { noLocation: true }); + visit(ast, { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['enter', node.kind, getValue(node)]); + }, + + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['leave', node.kind, getValue(node)]); + if (node.kind === 'Name' && node.value === 'x') { + return BREAK; + } + }, + }); + + expect(visited).to.deep.equal([ + ['enter', 'Document', undefined], + ['enter', 'OperationDefinition', undefined], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'a'], + ['leave', 'Name', 'a'], + ['leave', 'Field', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'b'], + ['leave', 'Name', 'b'], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'x'], + ['leave', 'Name', 'x'], + ]); + }); + + it('allows a named functions visitor API', () => { + const visited: Array = []; + + const ast = parse('{ a, b { x }, c }', { noLocation: true }); + visit(ast, { + Name(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['enter', node.kind, getValue(node)]); + }, + SelectionSet: { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['enter', node.kind, getValue(node)]); + }, + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['leave', node.kind, getValue(node)]); + }, + }, + }); + + expect(visited).to.deep.equal([ + ['enter', 'SelectionSet', undefined], + ['enter', 'Name', 'a'], + ['enter', 'Name', 'b'], + ['enter', 'SelectionSet', undefined], + ['enter', 'Name', 'x'], + ['leave', 'SelectionSet', undefined], + ['enter', 'Name', 'c'], + ['leave', 'SelectionSet', undefined], + ]); + }); + + it('visits only the specified `Kind` in visitorKeyMap', () => { + const visited: Array = []; + + const visitorKeyMap: ASTVisitorKeyMap = { + Document: ['definitions'], + OperationDefinition: ['name'], + }; + + const visitor: ASTVisitor = { + enter(node) { + visited.push(['enter', node.kind, getValue(node)]); + }, + leave(node) { + visited.push(['leave', node.kind, getValue(node)]); + }, + }; + + const exampleDocumentAST = parse(` + query ExampleOperation { + someField + } + `); + + visit(exampleDocumentAST, visitor, visitorKeyMap); + + expect(visited).to.deep.equal([ + ['enter', 'Document', undefined], + ['enter', 'OperationDefinition', undefined], + ['enter', 'Name', 'ExampleOperation'], + ['leave', 'Name', 'ExampleOperation'], + ['leave', 'OperationDefinition', undefined], + ['leave', 'Document', undefined], + ]); + }); + + it('Legacy: visits variables defined in fragments', () => { + const ast = parse('fragment a($v: Boolean = false) on t { f }', { + noLocation: true, + allowLegacyFragmentVariables: true, + }); + const visited: Array = []; + + visit(ast, { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['enter', node.kind, getValue(node)]); + }, + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['leave', node.kind, getValue(node)]); + }, + }); + + expect(visited).to.deep.equal([ + ['enter', 'Document', undefined], + ['enter', 'FragmentDefinition', undefined], + ['enter', 'Name', 'a'], + ['leave', 'Name', 'a'], + ['enter', 'VariableDefinition', undefined], + ['enter', 'Variable', undefined], + ['enter', 'Name', 'v'], + ['leave', 'Name', 'v'], + ['leave', 'Variable', undefined], + ['enter', 'NamedType', undefined], + ['enter', 'Name', 'Boolean'], + ['leave', 'Name', 'Boolean'], + ['leave', 'NamedType', undefined], + ['enter', 'BooleanValue', false], + ['leave', 'BooleanValue', false], + ['leave', 'VariableDefinition', undefined], + ['enter', 'NamedType', undefined], + ['enter', 'Name', 't'], + ['leave', 'Name', 't'], + ['leave', 'NamedType', undefined], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'f'], + ['leave', 'Name', 'f'], + ['leave', 'Field', undefined], + ['leave', 'SelectionSet', undefined], + ['leave', 'FragmentDefinition', undefined], + ['leave', 'Document', undefined], + ]); + }); + + it('visits kitchen sink', () => { + const ast = parse(kitchenSinkQuery); + const visited: Array = []; + const argsStack: Array = []; + + visit(ast, { + enter(node, key, parent) { + visited.push([ + 'enter', + node.kind, + key, + isNode(parent) ? parent.kind : undefined, + ]); + + checkVisitorFnArgs(ast, arguments); + argsStack.push([...arguments]); + }, + + leave(node, key, parent) { + visited.push([ + 'leave', + node.kind, + key, + isNode(parent) ? parent.kind : undefined, + ]); + + expect(argsStack.pop()).to.deep.equal([...arguments]); + }, + }); + + expect(argsStack).to.deep.equal([]); + expect(visited).to.deep.equal([ + ['enter', 'Document', undefined, undefined], + ['enter', 'OperationDefinition', 0, undefined], + ['enter', 'Name', 'name', 'OperationDefinition'], + ['leave', 'Name', 'name', 'OperationDefinition'], + ['enter', 'VariableDefinition', 0, undefined], + ['enter', 'Variable', 'variable', 'VariableDefinition'], + ['enter', 'Name', 'name', 'Variable'], + ['leave', 'Name', 'name', 'Variable'], + ['leave', 'Variable', 'variable', 'VariableDefinition'], + ['enter', 'NamedType', 'type', 'VariableDefinition'], + ['enter', 'Name', 'name', 'NamedType'], + ['leave', 'Name', 'name', 'NamedType'], + ['leave', 'NamedType', 'type', 'VariableDefinition'], + ['leave', 'VariableDefinition', 0, undefined], + ['enter', 'VariableDefinition', 1, undefined], + ['enter', 'Variable', 'variable', 'VariableDefinition'], + ['enter', 'Name', 'name', 'Variable'], + ['leave', 'Name', 'name', 'Variable'], + ['leave', 'Variable', 'variable', 'VariableDefinition'], + ['enter', 'NamedType', 'type', 'VariableDefinition'], + ['enter', 'Name', 'name', 'NamedType'], + ['leave', 'Name', 'name', 'NamedType'], + ['leave', 'NamedType', 'type', 'VariableDefinition'], + ['enter', 'EnumValue', 'defaultValue', 'VariableDefinition'], + ['leave', 'EnumValue', 'defaultValue', 'VariableDefinition'], + ['leave', 'VariableDefinition', 1, undefined], + ['enter', 'Directive', 0, undefined], + ['enter', 'Name', 'name', 'Directive'], + ['leave', 'Name', 'name', 'Directive'], + ['leave', 'Directive', 0, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'OperationDefinition'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'alias', 'Field'], + ['leave', 'Name', 'alias', 'Field'], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['enter', 'Argument', 0, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'ListValue', 'value', 'Argument'], + ['enter', 'IntValue', 0, undefined], + ['leave', 'IntValue', 0, undefined], + ['enter', 'IntValue', 1, undefined], + ['leave', 'IntValue', 1, undefined], + ['leave', 'ListValue', 'value', 'Argument'], + ['leave', 'Argument', 0, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'Field'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['leave', 'Field', 0, undefined], + ['enter', 'InlineFragment', 1, undefined], + ['enter', 'NamedType', 'typeCondition', 'InlineFragment'], + ['enter', 'Name', 'name', 'NamedType'], + ['leave', 'Name', 'name', 'NamedType'], + ['leave', 'NamedType', 'typeCondition', 'InlineFragment'], + ['enter', 'Directive', 0, undefined], + ['enter', 'Name', 'name', 'Directive'], + ['leave', 'Name', 'name', 'Directive'], + ['leave', 'Directive', 0, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'InlineFragment'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['enter', 'SelectionSet', 'selectionSet', 'Field'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['leave', 'Field', 0, undefined], + ['enter', 'Field', 1, undefined], + ['enter', 'Name', 'alias', 'Field'], + ['leave', 'Name', 'alias', 'Field'], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['enter', 'Argument', 0, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'IntValue', 'value', 'Argument'], + ['leave', 'IntValue', 'value', 'Argument'], + ['leave', 'Argument', 0, undefined], + ['enter', 'Argument', 1, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'Variable', 'value', 'Argument'], + ['enter', 'Name', 'name', 'Variable'], + ['leave', 'Name', 'name', 'Variable'], + ['leave', 'Variable', 'value', 'Argument'], + ['leave', 'Argument', 1, undefined], + ['enter', 'Directive', 0, undefined], + ['enter', 'Name', 'name', 'Directive'], + ['leave', 'Name', 'name', 'Directive'], + ['enter', 'Argument', 0, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'Variable', 'value', 'Argument'], + ['enter', 'Name', 'name', 'Variable'], + ['leave', 'Name', 'name', 'Variable'], + ['leave', 'Variable', 'value', 'Argument'], + ['leave', 'Argument', 0, undefined], + ['leave', 'Directive', 0, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'Field'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['leave', 'Field', 0, undefined], + ['enter', 'FragmentSpread', 1, undefined], + ['enter', 'Name', 'name', 'FragmentSpread'], + ['leave', 'Name', 'name', 'FragmentSpread'], + ['enter', 'Directive', 0, undefined], + ['enter', 'Name', 'name', 'Directive'], + ['leave', 'Name', 'name', 'Directive'], + ['leave', 'Directive', 0, undefined], + ['leave', 'FragmentSpread', 1, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'Field'], + ['leave', 'Field', 1, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'Field'], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'InlineFragment'], + ['leave', 'InlineFragment', 1, undefined], + ['enter', 'InlineFragment', 2, undefined], + ['enter', 'Directive', 0, undefined], + ['enter', 'Name', 'name', 'Directive'], + ['leave', 'Name', 'name', 'Directive'], + ['enter', 'Argument', 0, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'Variable', 'value', 'Argument'], + ['enter', 'Name', 'name', 'Variable'], + ['leave', 'Name', 'name', 'Variable'], + ['leave', 'Variable', 'value', 'Argument'], + ['leave', 'Argument', 0, undefined], + ['leave', 'Directive', 0, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'InlineFragment'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'InlineFragment'], + ['leave', 'InlineFragment', 2, undefined], + ['enter', 'InlineFragment', 3, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'InlineFragment'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'InlineFragment'], + ['leave', 'InlineFragment', 3, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'Field'], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'OperationDefinition'], + ['leave', 'OperationDefinition', 0, undefined], + ['enter', 'OperationDefinition', 1, undefined], + ['enter', 'Name', 'name', 'OperationDefinition'], + ['leave', 'Name', 'name', 'OperationDefinition'], + ['enter', 'Directive', 0, undefined], + ['enter', 'Name', 'name', 'Directive'], + ['leave', 'Name', 'name', 'Directive'], + ['leave', 'Directive', 0, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'OperationDefinition'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['enter', 'Argument', 0, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'IntValue', 'value', 'Argument'], + ['leave', 'IntValue', 'value', 'Argument'], + ['leave', 'Argument', 0, undefined], + ['enter', 'Directive', 0, undefined], + ['enter', 'Name', 'name', 'Directive'], + ['leave', 'Name', 'name', 'Directive'], + ['leave', 'Directive', 0, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'Field'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['enter', 'SelectionSet', 'selectionSet', 'Field'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['enter', 'Directive', 0, undefined], + ['enter', 'Name', 'name', 'Directive'], + ['leave', 'Name', 'name', 'Directive'], + ['leave', 'Directive', 0, undefined], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'Field'], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'Field'], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'OperationDefinition'], + ['leave', 'OperationDefinition', 1, undefined], + ['enter', 'OperationDefinition', 2, undefined], + ['enter', 'Name', 'name', 'OperationDefinition'], + ['leave', 'Name', 'name', 'OperationDefinition'], + ['enter', 'VariableDefinition', 0, undefined], + ['enter', 'Variable', 'variable', 'VariableDefinition'], + ['enter', 'Name', 'name', 'Variable'], + ['leave', 'Name', 'name', 'Variable'], + ['leave', 'Variable', 'variable', 'VariableDefinition'], + ['enter', 'NamedType', 'type', 'VariableDefinition'], + ['enter', 'Name', 'name', 'NamedType'], + ['leave', 'Name', 'name', 'NamedType'], + ['leave', 'NamedType', 'type', 'VariableDefinition'], + ['enter', 'Directive', 0, undefined], + ['enter', 'Name', 'name', 'Directive'], + ['leave', 'Name', 'name', 'Directive'], + ['leave', 'Directive', 0, undefined], + ['leave', 'VariableDefinition', 0, undefined], + ['enter', 'Directive', 0, undefined], + ['enter', 'Name', 'name', 'Directive'], + ['leave', 'Name', 'name', 'Directive'], + ['leave', 'Directive', 0, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'OperationDefinition'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['enter', 'Argument', 0, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'Variable', 'value', 'Argument'], + ['enter', 'Name', 'name', 'Variable'], + ['leave', 'Name', 'name', 'Variable'], + ['leave', 'Variable', 'value', 'Argument'], + ['leave', 'Argument', 0, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'Field'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['enter', 'SelectionSet', 'selectionSet', 'Field'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['enter', 'SelectionSet', 'selectionSet', 'Field'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'Field'], + ['leave', 'Field', 0, undefined], + ['enter', 'Field', 1, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['enter', 'SelectionSet', 'selectionSet', 'Field'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'Field'], + ['leave', 'Field', 1, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'Field'], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'Field'], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'OperationDefinition'], + ['leave', 'OperationDefinition', 2, undefined], + ['enter', 'FragmentDefinition', 3, undefined], + ['enter', 'Name', 'name', 'FragmentDefinition'], + ['leave', 'Name', 'name', 'FragmentDefinition'], + ['enter', 'NamedType', 'typeCondition', 'FragmentDefinition'], + ['enter', 'Name', 'name', 'NamedType'], + ['leave', 'Name', 'name', 'NamedType'], + ['leave', 'NamedType', 'typeCondition', 'FragmentDefinition'], + ['enter', 'Directive', 0, undefined], + ['enter', 'Name', 'name', 'Directive'], + ['leave', 'Name', 'name', 'Directive'], + ['leave', 'Directive', 0, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'FragmentDefinition'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['enter', 'Argument', 0, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'Variable', 'value', 'Argument'], + ['enter', 'Name', 'name', 'Variable'], + ['leave', 'Name', 'name', 'Variable'], + ['leave', 'Variable', 'value', 'Argument'], + ['leave', 'Argument', 0, undefined], + ['enter', 'Argument', 1, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'Variable', 'value', 'Argument'], + ['enter', 'Name', 'name', 'Variable'], + ['leave', 'Name', 'name', 'Variable'], + ['leave', 'Variable', 'value', 'Argument'], + ['leave', 'Argument', 1, undefined], + ['enter', 'Argument', 2, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'ObjectValue', 'value', 'Argument'], + ['enter', 'ObjectField', 0, undefined], + ['enter', 'Name', 'name', 'ObjectField'], + ['leave', 'Name', 'name', 'ObjectField'], + ['enter', 'StringValue', 'value', 'ObjectField'], + ['leave', 'StringValue', 'value', 'ObjectField'], + ['leave', 'ObjectField', 0, undefined], + ['enter', 'ObjectField', 1, undefined], + ['enter', 'Name', 'name', 'ObjectField'], + ['leave', 'Name', 'name', 'ObjectField'], + ['enter', 'StringValue', 'value', 'ObjectField'], + ['leave', 'StringValue', 'value', 'ObjectField'], + ['leave', 'ObjectField', 1, undefined], + ['leave', 'ObjectValue', 'value', 'Argument'], + ['leave', 'Argument', 2, undefined], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'FragmentDefinition'], + ['leave', 'FragmentDefinition', 3, undefined], + ['enter', 'OperationDefinition', 4, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'OperationDefinition'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['enter', 'Argument', 0, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'BooleanValue', 'value', 'Argument'], + ['leave', 'BooleanValue', 'value', 'Argument'], + ['leave', 'Argument', 0, undefined], + ['enter', 'Argument', 1, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'BooleanValue', 'value', 'Argument'], + ['leave', 'BooleanValue', 'value', 'Argument'], + ['leave', 'Argument', 1, undefined], + ['enter', 'Argument', 2, undefined], + ['enter', 'Name', 'name', 'Argument'], + ['leave', 'Name', 'name', 'Argument'], + ['enter', 'NullValue', 'value', 'Argument'], + ['leave', 'NullValue', 'value', 'Argument'], + ['leave', 'Argument', 2, undefined], + ['leave', 'Field', 0, undefined], + ['enter', 'Field', 1, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['leave', 'Field', 1, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'OperationDefinition'], + ['leave', 'OperationDefinition', 4, undefined], + ['enter', 'OperationDefinition', 5, undefined], + ['enter', 'SelectionSet', 'selectionSet', 'OperationDefinition'], + ['enter', 'Field', 0, undefined], + ['enter', 'Name', 'name', 'Field'], + ['leave', 'Name', 'name', 'Field'], + ['leave', 'Field', 0, undefined], + ['leave', 'SelectionSet', 'selectionSet', 'OperationDefinition'], + ['leave', 'OperationDefinition', 5, undefined], + ['leave', 'Document', undefined, undefined], + ]); + }); + + describe('visitInParallel', () => { + // Note: nearly identical to the above test of the same test but + // using visitInParallel. + it('allows skipping a sub-tree', () => { + const visited: Array = []; + + const ast = parse('{ a, b { x }, c }'); + visit( + ast, + visitInParallel([ + { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['enter', node.kind, getValue(node)]); + if (node.kind === 'Field' && node.name.value === 'b') { + return false; + } + }, + + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['leave', node.kind, getValue(node)]); + }, + }, + ]), + ); + + expect(visited).to.deep.equal([ + ['enter', 'Document', undefined], + ['enter', 'OperationDefinition', undefined], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'a'], + ['leave', 'Name', 'a'], + ['leave', 'Field', undefined], + ['enter', 'Field', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'c'], + ['leave', 'Name', 'c'], + ['leave', 'Field', undefined], + ['leave', 'SelectionSet', undefined], + ['leave', 'OperationDefinition', undefined], + ['leave', 'Document', undefined], + ]); + }); + + it('allows skipping different sub-trees', () => { + const visited: Array = []; + + const ast = parse('{ a { x }, b { y} }'); + visit( + ast, + visitInParallel([ + { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['no-a', 'enter', node.kind, getValue(node)]); + if (node.kind === 'Field' && node.name.value === 'a') { + return false; + } + }, + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['no-a', 'leave', node.kind, getValue(node)]); + }, + }, + { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['no-b', 'enter', node.kind, getValue(node)]); + if (node.kind === 'Field' && node.name.value === 'b') { + return false; + } + }, + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['no-b', 'leave', node.kind, getValue(node)]); + }, + }, + ]), + ); + + expect(visited).to.deep.equal([ + ['no-a', 'enter', 'Document', undefined], + ['no-b', 'enter', 'Document', undefined], + ['no-a', 'enter', 'OperationDefinition', undefined], + ['no-b', 'enter', 'OperationDefinition', undefined], + ['no-a', 'enter', 'SelectionSet', undefined], + ['no-b', 'enter', 'SelectionSet', undefined], + ['no-a', 'enter', 'Field', undefined], + ['no-b', 'enter', 'Field', undefined], + ['no-b', 'enter', 'Name', 'a'], + ['no-b', 'leave', 'Name', 'a'], + ['no-b', 'enter', 'SelectionSet', undefined], + ['no-b', 'enter', 'Field', undefined], + ['no-b', 'enter', 'Name', 'x'], + ['no-b', 'leave', 'Name', 'x'], + ['no-b', 'leave', 'Field', undefined], + ['no-b', 'leave', 'SelectionSet', undefined], + ['no-b', 'leave', 'Field', undefined], + ['no-a', 'enter', 'Field', undefined], + ['no-b', 'enter', 'Field', undefined], + ['no-a', 'enter', 'Name', 'b'], + ['no-a', 'leave', 'Name', 'b'], + ['no-a', 'enter', 'SelectionSet', undefined], + ['no-a', 'enter', 'Field', undefined], + ['no-a', 'enter', 'Name', 'y'], + ['no-a', 'leave', 'Name', 'y'], + ['no-a', 'leave', 'Field', undefined], + ['no-a', 'leave', 'SelectionSet', undefined], + ['no-a', 'leave', 'Field', undefined], + ['no-a', 'leave', 'SelectionSet', undefined], + ['no-b', 'leave', 'SelectionSet', undefined], + ['no-a', 'leave', 'OperationDefinition', undefined], + ['no-b', 'leave', 'OperationDefinition', undefined], + ['no-a', 'leave', 'Document', undefined], + ['no-b', 'leave', 'Document', undefined], + ]); + }); + + // Note: nearly identical to the above test of the same test but + // using visitInParallel. + it('allows early exit while visiting', () => { + const visited: Array = []; + + const ast = parse('{ a, b { x }, c }'); + visit( + ast, + visitInParallel([ + { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['enter', node.kind, getValue(node)]); + if (node.kind === 'Name' && node.value === 'x') { + return BREAK; + } + }, + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['leave', node.kind, getValue(node)]); + }, + }, + ]), + ); + + expect(visited).to.deep.equal([ + ['enter', 'Document', undefined], + ['enter', 'OperationDefinition', undefined], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'a'], + ['leave', 'Name', 'a'], + ['leave', 'Field', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'b'], + ['leave', 'Name', 'b'], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'x'], + ]); + }); + + it('allows early exit from different points', () => { + const visited: Array = []; + + const ast = parse('{ a { y }, b { x } }'); + visit( + ast, + visitInParallel([ + { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['break-a', 'enter', node.kind, getValue(node)]); + if (node.kind === 'Name' && node.value === 'a') { + return BREAK; + } + }, + /* c8 ignore next 3 */ + leave() { + expect.fail('Should not be called'); + }, + }, + { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['break-b', 'enter', node.kind, getValue(node)]); + if (node.kind === 'Name' && node.value === 'b') { + return BREAK; + } + }, + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['break-b', 'leave', node.kind, getValue(node)]); + }, + }, + ]), + ); + + expect(visited).to.deep.equal([ + ['break-a', 'enter', 'Document', undefined], + ['break-b', 'enter', 'Document', undefined], + ['break-a', 'enter', 'OperationDefinition', undefined], + ['break-b', 'enter', 'OperationDefinition', undefined], + ['break-a', 'enter', 'SelectionSet', undefined], + ['break-b', 'enter', 'SelectionSet', undefined], + ['break-a', 'enter', 'Field', undefined], + ['break-b', 'enter', 'Field', undefined], + ['break-a', 'enter', 'Name', 'a'], + ['break-b', 'enter', 'Name', 'a'], + ['break-b', 'leave', 'Name', 'a'], + ['break-b', 'enter', 'SelectionSet', undefined], + ['break-b', 'enter', 'Field', undefined], + ['break-b', 'enter', 'Name', 'y'], + ['break-b', 'leave', 'Name', 'y'], + ['break-b', 'leave', 'Field', undefined], + ['break-b', 'leave', 'SelectionSet', undefined], + ['break-b', 'leave', 'Field', undefined], + ['break-b', 'enter', 'Field', undefined], + ['break-b', 'enter', 'Name', 'b'], + ]); + }); + + // Note: nearly identical to the above test of the same test but + // using visitInParallel. + it('allows early exit while leaving', () => { + const visited: Array = []; + + const ast = parse('{ a, b { x }, c }'); + visit( + ast, + visitInParallel([ + { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['enter', node.kind, getValue(node)]); + }, + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['leave', node.kind, getValue(node)]); + if (node.kind === 'Name' && node.value === 'x') { + return BREAK; + } + }, + }, + ]), + ); + + expect(visited).to.deep.equal([ + ['enter', 'Document', undefined], + ['enter', 'OperationDefinition', undefined], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'a'], + ['leave', 'Name', 'a'], + ['leave', 'Field', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'b'], + ['leave', 'Name', 'b'], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'x'], + ['leave', 'Name', 'x'], + ]); + }); + + it('allows early exit from leaving different points', () => { + const visited: Array = []; + + const ast = parse('{ a { y }, b { x } }'); + visit( + ast, + visitInParallel([ + { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['break-a', 'enter', node.kind, getValue(node)]); + }, + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['break-a', 'leave', node.kind, getValue(node)]); + if (node.kind === 'Field' && node.name.value === 'a') { + return BREAK; + } + }, + }, + { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['break-b', 'enter', node.kind, getValue(node)]); + }, + leave(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['break-b', 'leave', node.kind, getValue(node)]); + if (node.kind === 'Field' && node.name.value === 'b') { + return BREAK; + } + }, + }, + ]), + ); + + expect(visited).to.deep.equal([ + ['break-a', 'enter', 'Document', undefined], + ['break-b', 'enter', 'Document', undefined], + ['break-a', 'enter', 'OperationDefinition', undefined], + ['break-b', 'enter', 'OperationDefinition', undefined], + ['break-a', 'enter', 'SelectionSet', undefined], + ['break-b', 'enter', 'SelectionSet', undefined], + ['break-a', 'enter', 'Field', undefined], + ['break-b', 'enter', 'Field', undefined], + ['break-a', 'enter', 'Name', 'a'], + ['break-b', 'enter', 'Name', 'a'], + ['break-a', 'leave', 'Name', 'a'], + ['break-b', 'leave', 'Name', 'a'], + ['break-a', 'enter', 'SelectionSet', undefined], + ['break-b', 'enter', 'SelectionSet', undefined], + ['break-a', 'enter', 'Field', undefined], + ['break-b', 'enter', 'Field', undefined], + ['break-a', 'enter', 'Name', 'y'], + ['break-b', 'enter', 'Name', 'y'], + ['break-a', 'leave', 'Name', 'y'], + ['break-b', 'leave', 'Name', 'y'], + ['break-a', 'leave', 'Field', undefined], + ['break-b', 'leave', 'Field', undefined], + ['break-a', 'leave', 'SelectionSet', undefined], + ['break-b', 'leave', 'SelectionSet', undefined], + ['break-a', 'leave', 'Field', undefined], + ['break-b', 'leave', 'Field', undefined], + ['break-b', 'enter', 'Field', undefined], + ['break-b', 'enter', 'Name', 'b'], + ['break-b', 'leave', 'Name', 'b'], + ['break-b', 'enter', 'SelectionSet', undefined], + ['break-b', 'enter', 'Field', undefined], + ['break-b', 'enter', 'Name', 'x'], + ['break-b', 'leave', 'Name', 'x'], + ['break-b', 'leave', 'Field', undefined], + ['break-b', 'leave', 'SelectionSet', undefined], + ['break-b', 'leave', 'Field', undefined], + ]); + }); + + it('allows for editing on enter', () => { + const visited: Array = []; + + const ast = parse('{ a, b, c { a, b, c } }', { noLocation: true }); + const editedAST = visit( + ast, + visitInParallel([ + { + enter(node) { + checkVisitorFnArgs(ast, arguments); + if (node.kind === 'Field' && node.name.value === 'b') { + return null; + } + }, + }, + { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['enter', node.kind, getValue(node)]); + }, + leave(node) { + checkVisitorFnArgs(ast, arguments, /* isEdited */ true); + visited.push(['leave', node.kind, getValue(node)]); + }, + }, + ]), + ); + + expect(ast).to.deep.equal( + parse('{ a, b, c { a, b, c } }', { noLocation: true }), + ); + + expect(editedAST).to.deep.equal( + parse('{ a, c { a, c } }', { noLocation: true }), + ); + + expect(visited).to.deep.equal([ + ['enter', 'Document', undefined], + ['enter', 'OperationDefinition', undefined], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'a'], + ['leave', 'Name', 'a'], + ['leave', 'Field', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'c'], + ['leave', 'Name', 'c'], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'a'], + ['leave', 'Name', 'a'], + ['leave', 'Field', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'c'], + ['leave', 'Name', 'c'], + ['leave', 'Field', undefined], + ['leave', 'SelectionSet', undefined], + ['leave', 'Field', undefined], + ['leave', 'SelectionSet', undefined], + ['leave', 'OperationDefinition', undefined], + ['leave', 'Document', undefined], + ]); + }); + + it('allows for editing on leave', () => { + const visited: Array = []; + + const ast = parse('{ a, b, c { a, b, c } }', { noLocation: true }); + const editedAST = visit( + ast, + visitInParallel([ + { + leave(node) { + checkVisitorFnArgs(ast, arguments, /* isEdited */ true); + if (node.kind === 'Field' && node.name.value === 'b') { + return null; + } + }, + }, + { + enter(node) { + checkVisitorFnArgs(ast, arguments); + visited.push(['enter', node.kind, getValue(node)]); + }, + leave(node) { + checkVisitorFnArgs(ast, arguments, /* isEdited */ true); + visited.push(['leave', node.kind, getValue(node)]); + }, + }, + ]), + ); + + expect(ast).to.deep.equal( + parse('{ a, b, c { a, b, c } }', { noLocation: true }), + ); + + expect(editedAST).to.deep.equal( + parse('{ a, c { a, c } }', { noLocation: true }), + ); + + expect(visited).to.deep.equal([ + ['enter', 'Document', undefined], + ['enter', 'OperationDefinition', undefined], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'a'], + ['leave', 'Name', 'a'], + ['leave', 'Field', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'b'], + ['leave', 'Name', 'b'], + ['enter', 'Field', undefined], + ['enter', 'Name', 'c'], + ['leave', 'Name', 'c'], + ['enter', 'SelectionSet', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'a'], + ['leave', 'Name', 'a'], + ['leave', 'Field', undefined], + ['enter', 'Field', undefined], + ['enter', 'Name', 'b'], + ['leave', 'Name', 'b'], + ['enter', 'Field', undefined], + ['enter', 'Name', 'c'], + ['leave', 'Name', 'c'], + ['leave', 'Field', undefined], + ['leave', 'SelectionSet', undefined], + ['leave', 'Field', undefined], + ['leave', 'SelectionSet', undefined], + ['leave', 'OperationDefinition', undefined], + ['leave', 'Document', undefined], + ]); + }); + }); +}); diff --git a/src/language/ast.ts b/src/language/ast.ts new file mode 100644 index 00000000..0b30366d --- /dev/null +++ b/src/language/ast.ts @@ -0,0 +1,737 @@ +import type { Kind } from './kinds'; +import type { Source } from './source'; +import type { TokenKind } from './tokenKind'; + +/** + * Contains a range of UTF-8 character offsets and token references that + * identify the region of the source from which the AST derived. + */ +export class Location { + /** + * The character offset at which this Node begins. + */ + readonly start: number; + + /** + * The character offset at which this Node ends. + */ + readonly end: number; + + /** + * The Token at which this Node begins. + */ + readonly startToken: Token; + + /** + * The Token at which this Node ends. + */ + readonly endToken: Token; + + /** + * The Source document the AST represents. + */ + readonly source: Source; + + constructor(startToken: Token, endToken: Token, source: Source) { + this.start = startToken.start; + this.end = endToken.end; + this.startToken = startToken; + this.endToken = endToken; + this.source = source; + } + + get [Symbol.toStringTag]() { + return 'Location'; + } + + toJSON(): { start: number; end: number } { + return { start: this.start, end: this.end }; + } +} + +/** + * Represents a range of characters represented by a lexical token + * within a Source. + */ +export class Token { + /** + * The kind of Token. + */ + readonly kind: TokenKind; + + /** + * The character offset at which this Node begins. + */ + readonly start: number; + + /** + * The character offset at which this Node ends. + */ + readonly end: number; + + /** + * The 1-indexed line number on which this Token appears. + */ + readonly line: number; + + /** + * The 1-indexed column number at which this Token begins. + */ + readonly column: number; + + /** + * For non-punctuation tokens, represents the interpreted value of the token. + * + * Note: is undefined for punctuation tokens, but typed as string for + * convenience in the parser. + */ + readonly value: string; + + /** + * Tokens exist as nodes in a double-linked-list amongst all tokens + * including ignored tokens. is always the first node and + * the last. + */ + readonly prev: Token | null; + readonly next: Token | null; + + constructor( + kind: TokenKind, + start: number, + end: number, + line: number, + column: number, + value?: string, + ) { + this.kind = kind; + this.start = start; + this.end = end; + this.line = line; + this.column = column; + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + this.value = value!; + this.prev = null; + this.next = null; + } + + get [Symbol.toStringTag]() { + return 'Token'; + } + + toJSON(): { + kind: TokenKind; + value?: string; + line: number; + column: number; + } { + return { + kind: this.kind, + value: this.value, + line: this.line, + column: this.column, + }; + } +} + +/** + * The list of all possible AST node types. + */ +export type ASTNode = + | NameNode + | DocumentNode + | OperationDefinitionNode + | VariableDefinitionNode + | VariableNode + | SelectionSetNode + | FieldNode + | ArgumentNode + | FragmentSpreadNode + | InlineFragmentNode + | FragmentDefinitionNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode + | ObjectFieldNode + | DirectiveNode + | NamedTypeNode + | ListTypeNode + | NonNullTypeNode + | SchemaDefinitionNode + | OperationTypeDefinitionNode + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | FieldDefinitionNode + | InputValueDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | EnumValueDefinitionNode + | InputObjectTypeDefinitionNode + | DirectiveDefinitionNode + | SchemaExtensionNode + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode; + +/** + * Utility type listing all nodes indexed by their kind. + */ +export type ASTKindToNode = { + [NodeT in ASTNode as NodeT['kind']]: NodeT; +}; + +/** + * @internal + */ +export const QueryDocumentKeys: { + [NodeT in ASTNode as NodeT['kind']]: ReadonlyArray; +} = { + Name: [], + + Document: ['definitions'], + OperationDefinition: [ + 'name', + 'variableDefinitions', + 'directives', + 'selectionSet', + ], + VariableDefinition: ['variable', 'type', 'defaultValue', 'directives'], + Variable: ['name'], + SelectionSet: ['selections'], + Field: ['alias', 'name', 'arguments', 'directives', 'selectionSet'], + Argument: ['name', 'value'], + + FragmentSpread: ['name', 'directives'], + InlineFragment: ['typeCondition', 'directives', 'selectionSet'], + FragmentDefinition: [ + 'name', + // Note: fragment variable definitions are deprecated and will removed in v17.0.0 + 'variableDefinitions', + 'typeCondition', + 'directives', + 'selectionSet', + ], + + IntValue: [], + FloatValue: [], + StringValue: [], + BooleanValue: [], + NullValue: [], + EnumValue: [], + ListValue: ['values'], + ObjectValue: ['fields'], + ObjectField: ['name', 'value'], + + Directive: ['name', 'arguments'], + + NamedType: ['name'], + ListType: ['type'], + NonNullType: ['type'], + + SchemaDefinition: ['description', 'directives', 'operationTypes'], + OperationTypeDefinition: ['type'], + + ScalarTypeDefinition: ['description', 'name', 'directives'], + ObjectTypeDefinition: [ + 'description', + 'name', + 'interfaces', + 'directives', + 'fields', + ], + FieldDefinition: ['description', 'name', 'arguments', 'type', 'directives'], + InputValueDefinition: [ + 'description', + 'name', + 'type', + 'defaultValue', + 'directives', + ], + InterfaceTypeDefinition: [ + 'description', + 'name', + 'interfaces', + 'directives', + 'fields', + ], + UnionTypeDefinition: ['description', 'name', 'directives', 'types'], + EnumTypeDefinition: ['description', 'name', 'directives', 'values'], + EnumValueDefinition: ['description', 'name', 'directives'], + InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'], + + DirectiveDefinition: ['description', 'name', 'arguments', 'locations'], + + SchemaExtension: ['directives', 'operationTypes'], + + ScalarTypeExtension: ['name', 'directives'], + ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'], + InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'], + UnionTypeExtension: ['name', 'directives', 'types'], + EnumTypeExtension: ['name', 'directives', 'values'], + InputObjectTypeExtension: ['name', 'directives', 'fields'], +}; + +const kindValues = new Set(Object.keys(QueryDocumentKeys)); +/** + * @internal + */ +export function isNode(maybeNode: any): maybeNode is ASTNode { + const maybeKind = maybeNode?.kind; + return typeof maybeKind === 'string' && kindValues.has(maybeKind); +} + +/** Name */ + +export interface NameNode { + readonly kind: Kind.NAME; + readonly loc?: Location; + readonly value: string; +} + +/** Document */ + +export interface DocumentNode { + readonly kind: Kind.DOCUMENT; + readonly loc?: Location; + readonly definitions: ReadonlyArray; +} + +export type DefinitionNode = + | ExecutableDefinitionNode + | TypeSystemDefinitionNode + | TypeSystemExtensionNode; + +export type ExecutableDefinitionNode = + | OperationDefinitionNode + | FragmentDefinitionNode; + +export interface OperationDefinitionNode { + readonly kind: Kind.OPERATION_DEFINITION; + readonly loc?: Location; + readonly operation: OperationTypeNode; + readonly name?: NameNode; + readonly variableDefinitions?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly selectionSet: SelectionSetNode; +} + +export enum OperationTypeNode { + QUERY = 'query', + MUTATION = 'mutation', + SUBSCRIPTION = 'subscription', +} + +export interface VariableDefinitionNode { + readonly kind: Kind.VARIABLE_DEFINITION; + readonly loc?: Location; + readonly variable: VariableNode; + readonly type: TypeNode; + readonly defaultValue?: ConstValueNode; + readonly directives?: ReadonlyArray; +} + +export interface VariableNode { + readonly kind: Kind.VARIABLE; + readonly loc?: Location; + readonly name: NameNode; +} + +export interface SelectionSetNode { + kind: Kind.SELECTION_SET; + loc?: Location; + selections: ReadonlyArray; +} + +export type SelectionNode = FieldNode | FragmentSpreadNode | InlineFragmentNode; + +export interface FieldNode { + readonly kind: Kind.FIELD; + readonly loc?: Location; + readonly alias?: NameNode; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly selectionSet?: SelectionSetNode; +} + +export interface ArgumentNode { + readonly kind: Kind.ARGUMENT; + readonly loc?: Location; + readonly name: NameNode; + readonly value: ValueNode; +} + +export interface ConstArgumentNode { + readonly kind: Kind.ARGUMENT; + readonly loc?: Location; + readonly name: NameNode; + readonly value: ConstValueNode; +} + +/** Fragments */ + +export interface FragmentSpreadNode { + readonly kind: Kind.FRAGMENT_SPREAD; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; +} + +export interface InlineFragmentNode { + readonly kind: Kind.INLINE_FRAGMENT; + readonly loc?: Location; + readonly typeCondition?: NamedTypeNode; + readonly directives?: ReadonlyArray; + readonly selectionSet: SelectionSetNode; +} + +export interface FragmentDefinitionNode { + readonly kind: Kind.FRAGMENT_DEFINITION; + readonly loc?: Location; + readonly name: NameNode; + /** @deprecated variableDefinitions will be removed in v17.0.0 */ + readonly variableDefinitions?: ReadonlyArray; + readonly typeCondition: NamedTypeNode; + readonly directives?: ReadonlyArray; + readonly selectionSet: SelectionSetNode; +} + +/** Values */ + +export type ValueNode = + | VariableNode + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ListValueNode + | ObjectValueNode; + +export type ConstValueNode = + | IntValueNode + | FloatValueNode + | StringValueNode + | BooleanValueNode + | NullValueNode + | EnumValueNode + | ConstListValueNode + | ConstObjectValueNode; + +export interface IntValueNode { + readonly kind: Kind.INT; + readonly loc?: Location; + readonly value: string; +} + +export interface FloatValueNode { + readonly kind: Kind.FLOAT; + readonly loc?: Location; + readonly value: string; +} + +export interface StringValueNode { + readonly kind: Kind.STRING; + readonly loc?: Location; + readonly value: string; + readonly block?: boolean; +} + +export interface BooleanValueNode { + readonly kind: Kind.BOOLEAN; + readonly loc?: Location; + readonly value: boolean; +} + +export interface NullValueNode { + readonly kind: Kind.NULL; + readonly loc?: Location; +} + +export interface EnumValueNode { + readonly kind: Kind.ENUM; + readonly loc?: Location; + readonly value: string; +} + +export interface ListValueNode { + readonly kind: Kind.LIST; + readonly loc?: Location; + readonly values: ReadonlyArray; +} + +export interface ConstListValueNode { + readonly kind: Kind.LIST; + readonly loc?: Location; + readonly values: ReadonlyArray; +} + +export interface ObjectValueNode { + readonly kind: Kind.OBJECT; + readonly loc?: Location; + readonly fields: ReadonlyArray; +} + +export interface ConstObjectValueNode { + readonly kind: Kind.OBJECT; + readonly loc?: Location; + readonly fields: ReadonlyArray; +} + +export interface ObjectFieldNode { + readonly kind: Kind.OBJECT_FIELD; + readonly loc?: Location; + readonly name: NameNode; + readonly value: ValueNode; +} + +export interface ConstObjectFieldNode { + readonly kind: Kind.OBJECT_FIELD; + readonly loc?: Location; + readonly name: NameNode; + readonly value: ConstValueNode; +} + +/** Directives */ + +export interface DirectiveNode { + readonly kind: Kind.DIRECTIVE; + readonly loc?: Location; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; +} + +export interface ConstDirectiveNode { + readonly kind: Kind.DIRECTIVE; + readonly loc?: Location; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; +} + +/** Type Reference */ + +export type TypeNode = NamedTypeNode | ListTypeNode | NonNullTypeNode; + +export interface NamedTypeNode { + readonly kind: Kind.NAMED_TYPE; + readonly loc?: Location; + readonly name: NameNode; +} + +export interface ListTypeNode { + readonly kind: Kind.LIST_TYPE; + readonly loc?: Location; + readonly type: TypeNode; +} + +export interface NonNullTypeNode { + readonly kind: Kind.NON_NULL_TYPE; + readonly loc?: Location; + readonly type: NamedTypeNode | ListTypeNode; +} + +/** Type System Definition */ + +export type TypeSystemDefinitionNode = + | SchemaDefinitionNode + | TypeDefinitionNode + | DirectiveDefinitionNode; + +export interface SchemaDefinitionNode { + readonly kind: Kind.SCHEMA_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly directives?: ReadonlyArray; + readonly operationTypes: ReadonlyArray; +} + +export interface OperationTypeDefinitionNode { + readonly kind: Kind.OPERATION_TYPE_DEFINITION; + readonly loc?: Location; + readonly operation: OperationTypeNode; + readonly type: NamedTypeNode; +} + +/** Type Definition */ + +export type TypeDefinitionNode = + | ScalarTypeDefinitionNode + | ObjectTypeDefinitionNode + | InterfaceTypeDefinitionNode + | UnionTypeDefinitionNode + | EnumTypeDefinitionNode + | InputObjectTypeDefinitionNode; + +export interface ScalarTypeDefinitionNode { + readonly kind: Kind.SCALAR_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; +} + +export interface ObjectTypeDefinitionNode { + readonly kind: Kind.OBJECT_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly interfaces?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} + +export interface FieldDefinitionNode { + readonly kind: Kind.FIELD_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; + readonly type: TypeNode; + readonly directives?: ReadonlyArray; +} + +export interface InputValueDefinitionNode { + readonly kind: Kind.INPUT_VALUE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly type: TypeNode; + readonly defaultValue?: ConstValueNode; + readonly directives?: ReadonlyArray; +} + +export interface InterfaceTypeDefinitionNode { + readonly kind: Kind.INTERFACE_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly interfaces?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} + +export interface UnionTypeDefinitionNode { + readonly kind: Kind.UNION_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly types?: ReadonlyArray; +} + +export interface EnumTypeDefinitionNode { + readonly kind: Kind.ENUM_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly values?: ReadonlyArray; +} + +export interface EnumValueDefinitionNode { + readonly kind: Kind.ENUM_VALUE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; +} + +export interface InputObjectTypeDefinitionNode { + readonly kind: Kind.INPUT_OBJECT_TYPE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} + +/** Directive Definitions */ + +export interface DirectiveDefinitionNode { + readonly kind: Kind.DIRECTIVE_DEFINITION; + readonly loc?: Location; + readonly description?: StringValueNode; + readonly name: NameNode; + readonly arguments?: ReadonlyArray; + readonly repeatable: boolean; + readonly locations: ReadonlyArray; +} + +/** Type System Extensions */ + +export type TypeSystemExtensionNode = SchemaExtensionNode | TypeExtensionNode; + +export interface SchemaExtensionNode { + readonly kind: Kind.SCHEMA_EXTENSION; + readonly loc?: Location; + readonly directives?: ReadonlyArray; + readonly operationTypes?: ReadonlyArray; +} + +/** Type Extensions */ + +export type TypeExtensionNode = + | ScalarTypeExtensionNode + | ObjectTypeExtensionNode + | InterfaceTypeExtensionNode + | UnionTypeExtensionNode + | EnumTypeExtensionNode + | InputObjectTypeExtensionNode; + +export interface ScalarTypeExtensionNode { + readonly kind: Kind.SCALAR_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; +} + +export interface ObjectTypeExtensionNode { + readonly kind: Kind.OBJECT_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly interfaces?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} + +export interface InterfaceTypeExtensionNode { + readonly kind: Kind.INTERFACE_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly interfaces?: ReadonlyArray; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} + +export interface UnionTypeExtensionNode { + readonly kind: Kind.UNION_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly types?: ReadonlyArray; +} + +export interface EnumTypeExtensionNode { + readonly kind: Kind.ENUM_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly values?: ReadonlyArray; +} + +export interface InputObjectTypeExtensionNode { + readonly kind: Kind.INPUT_OBJECT_TYPE_EXTENSION; + readonly loc?: Location; + readonly name: NameNode; + readonly directives?: ReadonlyArray; + readonly fields?: ReadonlyArray; +} diff --git a/src/language/blockString.ts b/src/language/blockString.ts new file mode 100644 index 00000000..1c200c18 --- /dev/null +++ b/src/language/blockString.ts @@ -0,0 +1,169 @@ +import { isWhiteSpace } from './characterClasses'; + +/** + * Produces the value of a block string from its parsed raw value, similar to + * CoffeeScript's block string, Python's docstring trim or Ruby's strip_heredoc. + * + * This implements the GraphQL spec's BlockStringValue() static algorithm. + * + * @internal + */ +export function dedentBlockStringLines( + lines: ReadonlyArray, +): Array { + let commonIndent = Number.MAX_SAFE_INTEGER; + let firstNonEmptyLine = null; + let lastNonEmptyLine = -1; + + for (let i = 0; i < lines.length; ++i) { + const line = lines[i]; + const indent = leadingWhitespace(line); + + if (indent === line.length) { + continue; // skip empty lines + } + + firstNonEmptyLine = firstNonEmptyLine ?? i; + lastNonEmptyLine = i; + + if (i !== 0 && indent < commonIndent) { + commonIndent = indent; + } + } + + return ( + lines + // Remove common indentation from all lines but first. + .map((line, i) => (i === 0 ? line : line.slice(commonIndent))) + // Remove leading and trailing blank lines. + .slice(firstNonEmptyLine ?? 0, lastNonEmptyLine + 1) + ); +} + +function leadingWhitespace(str: string): number { + let i = 0; + while (i < str.length && isWhiteSpace(str.charCodeAt(i))) { + ++i; + } + return i; +} + +/** + * @internal + */ +export function isPrintableAsBlockString(value: string): boolean { + if (value === '') { + return true; // empty string is printable + } + + let isEmptyLine = true; + let hasIndent = false; + let hasCommonIndent = true; + let seenNonEmptyLine = false; + + for (let i = 0; i < value.length; ++i) { + switch (value.codePointAt(i)) { + case 0x0000: + case 0x0001: + case 0x0002: + case 0x0003: + case 0x0004: + case 0x0005: + case 0x0006: + case 0x0007: + case 0x0008: + case 0x000b: + case 0x000c: + case 0x000e: + case 0x000f: + return false; // Has non-printable characters + + case 0x000d: // \r + return false; // Has \r or \r\n which will be replaced as \n + + case 10: // \n + if (isEmptyLine && !seenNonEmptyLine) { + return false; // Has leading new line + } + seenNonEmptyLine = true; + + isEmptyLine = true; + hasIndent = false; + break; + case 9: // \t + case 32: // + hasIndent ||= isEmptyLine; + break; + default: + hasCommonIndent &&= hasIndent; + isEmptyLine = false; + } + } + + if (isEmptyLine) { + return false; // Has trailing empty lines + } + + if (hasCommonIndent && seenNonEmptyLine) { + return false; // Has internal indent + } + + return true; +} + +/** + * Print a block string in the indented block form by adding a leading and + * trailing blank line. However, if a block string starts with whitespace and is + * a single-line, adding a leading blank line would strip that whitespace. + * + * @internal + */ +export function printBlockString( + value: string, + options?: { minimize?: boolean }, +): string { + const escapedValue = value.replace(/"""/g, '\\"""'); + + // Expand a block string's raw value into independent lines. + const lines = escapedValue.split(/\r\n|[\n\r]/g); + const isSingleLine = lines.length === 1; + + // If common indentation is found we can fix some of those cases by adding leading new line + const forceLeadingNewLine = + lines.length > 1 && + lines + .slice(1) + .every((line) => line.length === 0 || isWhiteSpace(line.charCodeAt(0))); + + // Trailing triple quotes just looks confusing but doesn't force trailing new line + const hasTrailingTripleQuotes = escapedValue.endsWith('\\"""'); + + // Trailing quote (single or double) or slash forces trailing new line + const hasTrailingQuote = value.endsWith('"') && !hasTrailingTripleQuotes; + const hasTrailingSlash = value.endsWith('\\'); + const forceTrailingNewline = hasTrailingQuote || hasTrailingSlash; + + const printAsMultipleLines = + !options?.minimize && + // add leading and trailing new lines only if it improves readability + (!isSingleLine || + value.length > 70 || + forceTrailingNewline || + forceLeadingNewLine || + hasTrailingTripleQuotes); + + let result = ''; + + // Format a multi-line block quote to account for leading space. + const skipLeadingNewLine = isSingleLine && isWhiteSpace(value.charCodeAt(0)); + if ((printAsMultipleLines && !skipLeadingNewLine) || forceLeadingNewLine) { + result += '\n'; + } + + result += escapedValue; + if (printAsMultipleLines || forceTrailingNewline) { + result += '\n'; + } + + return '"""' + result + '"""'; +} diff --git a/src/language/characterClasses.ts b/src/language/characterClasses.ts new file mode 100644 index 00000000..c1182d10 --- /dev/null +++ b/src/language/characterClasses.ts @@ -0,0 +1,64 @@ +/** + * ``` + * WhiteSpace :: + * - "Horizontal Tab (U+0009)" + * - "Space (U+0020)" + * ``` + * @internal + */ +export function isWhiteSpace(code: number): boolean { + return code === 0x0009 || code === 0x0020; +} + +/** + * ``` + * Digit :: one of + * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + * ``` + * @internal + */ +export function isDigit(code: number): boolean { + return code >= 0x0030 && code <= 0x0039; +} + +/** + * ``` + * Letter :: one of + * - `A` `B` `C` `D` `E` `F` `G` `H` `I` `J` `K` `L` `M` + * - `N` `O` `P` `Q` `R` `S` `T` `U` `V` `W` `X` `Y` `Z` + * - `a` `b` `c` `d` `e` `f` `g` `h` `i` `j` `k` `l` `m` + * - `n` `o` `p` `q` `r` `s` `t` `u` `v` `w` `x` `y` `z` + * ``` + * @internal + */ +export function isLetter(code: number): boolean { + return ( + (code >= 0x0061 && code <= 0x007a) || // A-Z + (code >= 0x0041 && code <= 0x005a) // a-z + ); +} + +/** + * ``` + * NameStart :: + * - Letter + * - `_` + * ``` + * @internal + */ +export function isNameStart(code: number): boolean { + return isLetter(code) || code === 0x005f; +} + +/** + * ``` + * NameContinue :: + * - Letter + * - Digit + * - `_` + * ``` + * @internal + */ +export function isNameContinue(code: number): boolean { + return isLetter(code) || isDigit(code) || code === 0x005f; +} diff --git a/src/language/directiveLocation.ts b/src/language/directiveLocation.ts new file mode 100644 index 00000000..e98ddf6d --- /dev/null +++ b/src/language/directiveLocation.ts @@ -0,0 +1,33 @@ +/** + * The set of allowed directive location values. + */ +export enum DirectiveLocation { + /** Request Definitions */ + QUERY = 'QUERY', + MUTATION = 'MUTATION', + SUBSCRIPTION = 'SUBSCRIPTION', + FIELD = 'FIELD', + FRAGMENT_DEFINITION = 'FRAGMENT_DEFINITION', + FRAGMENT_SPREAD = 'FRAGMENT_SPREAD', + INLINE_FRAGMENT = 'INLINE_FRAGMENT', + VARIABLE_DEFINITION = 'VARIABLE_DEFINITION', + /** Type System Definitions */ + SCHEMA = 'SCHEMA', + SCALAR = 'SCALAR', + OBJECT = 'OBJECT', + FIELD_DEFINITION = 'FIELD_DEFINITION', + ARGUMENT_DEFINITION = 'ARGUMENT_DEFINITION', + INTERFACE = 'INTERFACE', + UNION = 'UNION', + ENUM = 'ENUM', + ENUM_VALUE = 'ENUM_VALUE', + INPUT_OBJECT = 'INPUT_OBJECT', + INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION', +} + +/** + * The enum type representing the directive location values. + * + * @deprecated Please use `DirectiveLocation`. Will be remove in v17. + */ +export type DirectiveLocationEnum = typeof DirectiveLocation; diff --git a/src/language/index.ts b/src/language/index.ts new file mode 100644 index 00000000..ec4d195e --- /dev/null +++ b/src/language/index.ts @@ -0,0 +1,109 @@ +export { Source } from './source'; + +export { getLocation } from './location'; +export type { SourceLocation } from './location'; + +export { printLocation, printSourceLocation } from './printLocation'; + +export { Kind } from './kinds'; +export type { KindEnum } from './kinds'; + +export { TokenKind } from './tokenKind'; +export type { TokenKindEnum } from './tokenKind'; + +export { Lexer } from './lexer'; + +export { parse, parseValue, parseConstValue, parseType } from './parser'; +export type { ParseOptions } from './parser'; + +export { print } from './printer'; + +export { + visit, + visitInParallel, + getVisitFn, + getEnterLeaveForKind, + BREAK, +} from './visitor'; +export type { ASTVisitor, ASTVisitFn, ASTVisitorKeyMap } from './visitor'; + +export { Location, Token, OperationTypeNode } from './ast'; +export type { + ASTNode, + ASTKindToNode, + // Each kind of AST node + NameNode, + DocumentNode, + DefinitionNode, + ExecutableDefinitionNode, + OperationDefinitionNode, + VariableDefinitionNode, + VariableNode, + SelectionSetNode, + SelectionNode, + FieldNode, + ArgumentNode, + ConstArgumentNode, + FragmentSpreadNode, + InlineFragmentNode, + FragmentDefinitionNode, + ValueNode, + ConstValueNode, + IntValueNode, + FloatValueNode, + StringValueNode, + BooleanValueNode, + NullValueNode, + EnumValueNode, + ListValueNode, + ConstListValueNode, + ObjectValueNode, + ConstObjectValueNode, + ObjectFieldNode, + ConstObjectFieldNode, + DirectiveNode, + ConstDirectiveNode, + TypeNode, + NamedTypeNode, + ListTypeNode, + NonNullTypeNode, + TypeSystemDefinitionNode, + SchemaDefinitionNode, + OperationTypeDefinitionNode, + TypeDefinitionNode, + ScalarTypeDefinitionNode, + ObjectTypeDefinitionNode, + FieldDefinitionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + UnionTypeDefinitionNode, + EnumTypeDefinitionNode, + EnumValueDefinitionNode, + InputObjectTypeDefinitionNode, + DirectiveDefinitionNode, + TypeSystemExtensionNode, + SchemaExtensionNode, + TypeExtensionNode, + ScalarTypeExtensionNode, + ObjectTypeExtensionNode, + InterfaceTypeExtensionNode, + UnionTypeExtensionNode, + EnumTypeExtensionNode, + InputObjectTypeExtensionNode, +} from './ast'; + +export { + isDefinitionNode, + isExecutableDefinitionNode, + isSelectionNode, + isValueNode, + isConstValueNode, + isTypeNode, + isTypeSystemDefinitionNode, + isTypeDefinitionNode, + isTypeSystemExtensionNode, + isTypeExtensionNode, +} from './predicates'; + +export { DirectiveLocation } from './directiveLocation'; +export type { DirectiveLocationEnum } from './directiveLocation'; diff --git a/src/language/kinds.ts b/src/language/kinds.ts new file mode 100644 index 00000000..39b2a8e6 --- /dev/null +++ b/src/language/kinds.ts @@ -0,0 +1,76 @@ +/** + * The set of allowed kind values for AST nodes. + */ +export enum Kind { + /** Name */ + NAME = 'Name', + + /** Document */ + DOCUMENT = 'Document', + OPERATION_DEFINITION = 'OperationDefinition', + VARIABLE_DEFINITION = 'VariableDefinition', + SELECTION_SET = 'SelectionSet', + FIELD = 'Field', + ARGUMENT = 'Argument', + + /** Fragments */ + FRAGMENT_SPREAD = 'FragmentSpread', + INLINE_FRAGMENT = 'InlineFragment', + FRAGMENT_DEFINITION = 'FragmentDefinition', + + /** Values */ + VARIABLE = 'Variable', + INT = 'IntValue', + FLOAT = 'FloatValue', + STRING = 'StringValue', + BOOLEAN = 'BooleanValue', + NULL = 'NullValue', + ENUM = 'EnumValue', + LIST = 'ListValue', + OBJECT = 'ObjectValue', + OBJECT_FIELD = 'ObjectField', + + /** Directives */ + DIRECTIVE = 'Directive', + + /** Types */ + NAMED_TYPE = 'NamedType', + LIST_TYPE = 'ListType', + NON_NULL_TYPE = 'NonNullType', + + /** Type System Definitions */ + SCHEMA_DEFINITION = 'SchemaDefinition', + OPERATION_TYPE_DEFINITION = 'OperationTypeDefinition', + + /** Type Definitions */ + SCALAR_TYPE_DEFINITION = 'ScalarTypeDefinition', + OBJECT_TYPE_DEFINITION = 'ObjectTypeDefinition', + FIELD_DEFINITION = 'FieldDefinition', + INPUT_VALUE_DEFINITION = 'InputValueDefinition', + INTERFACE_TYPE_DEFINITION = 'InterfaceTypeDefinition', + UNION_TYPE_DEFINITION = 'UnionTypeDefinition', + ENUM_TYPE_DEFINITION = 'EnumTypeDefinition', + ENUM_VALUE_DEFINITION = 'EnumValueDefinition', + INPUT_OBJECT_TYPE_DEFINITION = 'InputObjectTypeDefinition', + + /** Directive Definitions */ + DIRECTIVE_DEFINITION = 'DirectiveDefinition', + + /** Type System Extensions */ + SCHEMA_EXTENSION = 'SchemaExtension', + + /** Type Extensions */ + SCALAR_TYPE_EXTENSION = 'ScalarTypeExtension', + OBJECT_TYPE_EXTENSION = 'ObjectTypeExtension', + INTERFACE_TYPE_EXTENSION = 'InterfaceTypeExtension', + UNION_TYPE_EXTENSION = 'UnionTypeExtension', + ENUM_TYPE_EXTENSION = 'EnumTypeExtension', + INPUT_OBJECT_TYPE_EXTENSION = 'InputObjectTypeExtension', +} + +/** + * The enum type representing the possible kind values of AST nodes. + * + * @deprecated Please use `Kind`. Will be remove in v17. + */ +export type KindEnum = typeof Kind; diff --git a/src/language/lexer.ts b/src/language/lexer.ts new file mode 100644 index 00000000..818f81b2 --- /dev/null +++ b/src/language/lexer.ts @@ -0,0 +1,854 @@ +import { syntaxError } from '../error/syntaxError'; + +import { Token } from './ast'; +import { dedentBlockStringLines } from './blockString'; +import { isDigit, isNameContinue, isNameStart } from './characterClasses'; +import type { Source } from './source'; +import { TokenKind } from './tokenKind'; + +/** + * Given a Source object, creates a Lexer for that source. + * A Lexer is a stateful stream generator in that every time + * it is advanced, it returns the next token in the Source. Assuming the + * source lexes, the final Token emitted by the lexer will be of kind + * EOF, after which the lexer will repeatedly return the same EOF token + * whenever called. + */ +export class Lexer { + source: Source; + + /** + * The previously focused non-ignored token. + */ + lastToken: Token; + + /** + * The currently focused non-ignored token. + */ + token: Token; + + /** + * The (1-indexed) line containing the current token. + */ + line: number; + + /** + * The character offset at which the current line begins. + */ + lineStart: number; + + constructor(source: Source) { + const startOfFileToken = new Token(TokenKind.SOF, 0, 0, 0, 0); + + this.source = source; + this.lastToken = startOfFileToken; + this.token = startOfFileToken; + this.line = 1; + this.lineStart = 0; + } + + get [Symbol.toStringTag]() { + return 'Lexer'; + } + + /** + * Advances the token stream to the next non-ignored token. + */ + advance(): Token { + this.lastToken = this.token; + const token = (this.token = this.lookahead()); + return token; + } + + /** + * Looks ahead and returns the next non-ignored token, but does not change + * the state of Lexer. + */ + lookahead(): Token { + let token = this.token; + if (token.kind !== TokenKind.EOF) { + do { + if (token.next) { + token = token.next; + } else { + // Read the next token and form a link in the token linked-list. + const nextToken = readNextToken(this, token.end); + // @ts-expect-error next is only mutable during parsing. + token.next = nextToken; + // @ts-expect-error prev is only mutable during parsing. + nextToken.prev = token; + token = nextToken; + } + } while (token.kind === TokenKind.COMMENT); + } + return token; + } +} + +/** + * @internal + */ +export function isPunctuatorTokenKind(kind: TokenKind): boolean { + return ( + kind === TokenKind.BANG || + kind === TokenKind.DOLLAR || + kind === TokenKind.AMP || + kind === TokenKind.PAREN_L || + kind === TokenKind.PAREN_R || + kind === TokenKind.SPREAD || + kind === TokenKind.COLON || + kind === TokenKind.EQUALS || + kind === TokenKind.AT || + kind === TokenKind.BRACKET_L || + kind === TokenKind.BRACKET_R || + kind === TokenKind.BRACE_L || + kind === TokenKind.PIPE || + kind === TokenKind.BRACE_R + ); +} + +/** + * A Unicode scalar value is any Unicode code point except surrogate code + * points. In other words, the inclusive ranges of values 0x0000 to 0xD7FF and + * 0xE000 to 0x10FFFF. + * + * SourceCharacter :: + * - "Any Unicode scalar value" + */ +function isUnicodeScalarValue(code: number): boolean { + return ( + (code >= 0x0000 && code <= 0xd7ff) || (code >= 0xe000 && code <= 0x10ffff) + ); +} + +/** + * The GraphQL specification defines source text as a sequence of unicode scalar + * values (which Unicode defines to exclude surrogate code points). However + * JavaScript defines strings as a sequence of UTF-16 code units which may + * include surrogates. A surrogate pair is a valid source character as it + * encodes a supplementary code point (above U+FFFF), but unpaired surrogate + * code points are not valid source characters. + */ +function isSupplementaryCodePoint(body: string, location: number): boolean { + return ( + isLeadingSurrogate(body.charCodeAt(location)) && + isTrailingSurrogate(body.charCodeAt(location + 1)) + ); +} + +function isLeadingSurrogate(code: number): boolean { + return code >= 0xd800 && code <= 0xdbff; +} + +function isTrailingSurrogate(code: number): boolean { + return code >= 0xdc00 && code <= 0xdfff; +} + +/** + * Prints the code point (or end of file reference) at a given location in a + * source for use in error messages. + * + * Printable ASCII is printed quoted, while other points are printed in Unicode + * code point form (ie. U+1234). + */ +function printCodePointAt(lexer: Lexer, location: number): string { + const code = lexer.source.body.codePointAt(location); + + if (code === undefined) { + return TokenKind.EOF; + } else if (code >= 0x0020 && code <= 0x007e) { + // Printable ASCII + const char = String.fromCodePoint(code); + return char === '"' ? "'\"'" : `"${char}"`; + } + + // Unicode code point + return 'U+' + code.toString(16).toUpperCase().padStart(4, '0'); +} + +/** + * Create a token with line and column location information. + */ +function createToken( + lexer: Lexer, + kind: TokenKind, + start: number, + end: number, + value?: string, +): Token { + const line = lexer.line; + const col = 1 + start - lexer.lineStart; + return new Token(kind, start, end, line, col, value); +} + +/** + * Gets the next token from the source starting at the given position. + * + * This skips over whitespace until it finds the next lexable token, then lexes + * punctuators immediately or calls the appropriate helper function for more + * complicated tokens. + */ +function readNextToken(lexer: Lexer, start: number): Token { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start; + + while (position < bodyLength) { + const code = body.charCodeAt(position); + + // SourceCharacter + switch (code) { + // Ignored :: + // - UnicodeBOM + // - WhiteSpace + // - LineTerminator + // - Comment + // - Comma + // + // UnicodeBOM :: "Byte Order Mark (U+FEFF)" + // + // WhiteSpace :: + // - "Horizontal Tab (U+0009)" + // - "Space (U+0020)" + // + // Comma :: , + case 0xfeff: // + case 0x0009: // \t + case 0x0020: // + case 0x002c: // , + ++position; + continue; + // LineTerminator :: + // - "New Line (U+000A)" + // - "Carriage Return (U+000D)" [lookahead != "New Line (U+000A)"] + // - "Carriage Return (U+000D)" "New Line (U+000A)" + case 0x000a: // \n + ++position; + ++lexer.line; + lexer.lineStart = position; + continue; + case 0x000d: // \r + if (body.charCodeAt(position + 1) === 0x000a) { + position += 2; + } else { + ++position; + } + ++lexer.line; + lexer.lineStart = position; + continue; + // Comment + case 0x0023: // # + return readComment(lexer, position); + // Token :: + // - Punctuator + // - Name + // - IntValue + // - FloatValue + // - StringValue + // + // Punctuator :: one of ! $ & ( ) ... : = @ [ ] { | } + case 0x0021: // ! + return createToken(lexer, TokenKind.BANG, position, position + 1); + case 0x0024: // $ + return createToken(lexer, TokenKind.DOLLAR, position, position + 1); + case 0x0026: // & + return createToken(lexer, TokenKind.AMP, position, position + 1); + case 0x0028: // ( + return createToken(lexer, TokenKind.PAREN_L, position, position + 1); + case 0x0029: // ) + return createToken(lexer, TokenKind.PAREN_R, position, position + 1); + case 0x002e: // . + if ( + body.charCodeAt(position + 1) === 0x002e && + body.charCodeAt(position + 2) === 0x002e + ) { + return createToken(lexer, TokenKind.SPREAD, position, position + 3); + } + break; + case 0x003a: // : + return createToken(lexer, TokenKind.COLON, position, position + 1); + case 0x003d: // = + return createToken(lexer, TokenKind.EQUALS, position, position + 1); + case 0x0040: // @ + return createToken(lexer, TokenKind.AT, position, position + 1); + case 0x005b: // [ + return createToken(lexer, TokenKind.BRACKET_L, position, position + 1); + case 0x005d: // ] + return createToken(lexer, TokenKind.BRACKET_R, position, position + 1); + case 0x007b: // { + return createToken(lexer, TokenKind.BRACE_L, position, position + 1); + case 0x007c: // | + return createToken(lexer, TokenKind.PIPE, position, position + 1); + case 0x007d: // } + return createToken(lexer, TokenKind.BRACE_R, position, position + 1); + // StringValue + case 0x0022: // " + if ( + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 + ) { + return readBlockString(lexer, position); + } + return readString(lexer, position); + } + + // IntValue | FloatValue (Digit | -) + if (isDigit(code) || code === 0x002d) { + return readNumber(lexer, position, code); + } + + // Name + if (isNameStart(code)) { + return readName(lexer, position); + } + + throw syntaxError( + lexer.source, + position, + code === 0x0027 + ? 'Unexpected single quote character (\'), did you mean to use a double quote (")?' + : isUnicodeScalarValue(code) || isSupplementaryCodePoint(body, position) + ? `Unexpected character: ${printCodePointAt(lexer, position)}.` + : `Invalid character: ${printCodePointAt(lexer, position)}.`, + ); + } + + return createToken(lexer, TokenKind.EOF, bodyLength, bodyLength); +} + +/** + * Reads a comment token from the source file. + * + * ``` + * Comment :: # CommentChar* [lookahead != CommentChar] + * + * CommentChar :: SourceCharacter but not LineTerminator + * ``` + */ +function readComment(lexer: Lexer, start: number): Token { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + + while (position < bodyLength) { + const code = body.charCodeAt(position); + + // LineTerminator (\n | \r) + if (code === 0x000a || code === 0x000d) { + break; + } + + // SourceCharacter + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + break; + } + } + + return createToken( + lexer, + TokenKind.COMMENT, + start, + position, + body.slice(start + 1, position), + ); +} + +/** + * Reads a number token from the source file, either a FloatValue or an IntValue + * depending on whether a FractionalPart or ExponentPart is encountered. + * + * ``` + * IntValue :: IntegerPart [lookahead != {Digit, `.`, NameStart}] + * + * IntegerPart :: + * - NegativeSign? 0 + * - NegativeSign? NonZeroDigit Digit* + * + * NegativeSign :: - + * + * NonZeroDigit :: Digit but not `0` + * + * FloatValue :: + * - IntegerPart FractionalPart ExponentPart [lookahead != {Digit, `.`, NameStart}] + * - IntegerPart FractionalPart [lookahead != {Digit, `.`, NameStart}] + * - IntegerPart ExponentPart [lookahead != {Digit, `.`, NameStart}] + * + * FractionalPart :: . Digit+ + * + * ExponentPart :: ExponentIndicator Sign? Digit+ + * + * ExponentIndicator :: one of `e` `E` + * + * Sign :: one of + - + * ``` + */ +function readNumber(lexer: Lexer, start: number, firstCode: number): Token { + const body = lexer.source.body; + let position = start; + let code = firstCode; + let isFloat = false; + + // NegativeSign (-) + if (code === 0x002d) { + code = body.charCodeAt(++position); + } + + // Zero (0) + if (code === 0x0030) { + code = body.charCodeAt(++position); + if (isDigit(code)) { + throw syntaxError( + lexer.source, + position, + `Invalid number, unexpected digit after 0: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } else { + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } + + // Full stop (.) + if (code === 0x002e) { + isFloat = true; + + code = body.charCodeAt(++position); + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } + + // E e + if (code === 0x0045 || code === 0x0065) { + isFloat = true; + + code = body.charCodeAt(++position); + // + - + if (code === 0x002b || code === 0x002d) { + code = body.charCodeAt(++position); + } + position = readDigits(lexer, position, code); + code = body.charCodeAt(position); + } + + // Numbers cannot be followed by . or NameStart + if (code === 0x002e || isNameStart(code)) { + throw syntaxError( + lexer.source, + position, + `Invalid number, expected digit but got: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + + return createToken( + lexer, + isFloat ? TokenKind.FLOAT : TokenKind.INT, + start, + position, + body.slice(start, position), + ); +} + +/** + * Returns the new position in the source after reading one or more digits. + */ +function readDigits(lexer: Lexer, start: number, firstCode: number): number { + if (!isDigit(firstCode)) { + throw syntaxError( + lexer.source, + start, + `Invalid number, expected digit but got: ${printCodePointAt( + lexer, + start, + )}.`, + ); + } + + const body = lexer.source.body; + let position = start + 1; // +1 to skip first firstCode + + while (isDigit(body.charCodeAt(position))) { + ++position; + } + + return position; +} + +/** + * Reads a single-quote string token from the source file. + * + * ``` + * StringValue :: + * - `""` [lookahead != `"`] + * - `"` StringCharacter+ `"` + * + * StringCharacter :: + * - SourceCharacter but not `"` or `\` or LineTerminator + * - `\u` EscapedUnicode + * - `\` EscapedCharacter + * + * EscapedUnicode :: + * - `{` HexDigit+ `}` + * - HexDigit HexDigit HexDigit HexDigit + * + * EscapedCharacter :: one of `"` `\` `/` `b` `f` `n` `r` `t` + * ``` + */ +function readString(lexer: Lexer, start: number): Token { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + let chunkStart = position; + let value = ''; + + while (position < bodyLength) { + const code = body.charCodeAt(position); + + // Closing Quote (") + if (code === 0x0022) { + value += body.slice(chunkStart, position); + return createToken(lexer, TokenKind.STRING, start, position + 1, value); + } + + // Escape Sequence (\) + if (code === 0x005c) { + value += body.slice(chunkStart, position); + const escape = + body.charCodeAt(position + 1) === 0x0075 // u + ? body.charCodeAt(position + 2) === 0x007b // { + ? readEscapedUnicodeVariableWidth(lexer, position) + : readEscapedUnicodeFixedWidth(lexer, position) + : readEscapedCharacter(lexer, position); + value += escape.value; + position += escape.size; + chunkStart = position; + continue; + } + + // LineTerminator (\n | \r) + if (code === 0x000a || code === 0x000d) { + break; + } + + // SourceCharacter + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + throw syntaxError( + lexer.source, + position, + `Invalid character within String: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } + + throw syntaxError(lexer.source, position, 'Unterminated string.'); +} + +// The string value and lexed size of an escape sequence. +interface EscapeSequence { + value: string; + size: number; +} + +function readEscapedUnicodeVariableWidth( + lexer: Lexer, + position: number, +): EscapeSequence { + const body = lexer.source.body; + let point = 0; + let size = 3; + // Cannot be larger than 12 chars (\u{00000000}). + while (size < 12) { + const code = body.charCodeAt(position + size++); + // Closing Brace (}) + if (code === 0x007d) { + // Must be at least 5 chars (\u{0}) and encode a Unicode scalar value. + if (size < 5 || !isUnicodeScalarValue(point)) { + break; + } + return { value: String.fromCodePoint(point), size }; + } + // Append this hex digit to the code point. + point = (point << 4) | readHexDigit(code); + if (point < 0) { + break; + } + } + + throw syntaxError( + lexer.source, + position, + `Invalid Unicode escape sequence: "${body.slice( + position, + position + size, + )}".`, + ); +} + +function readEscapedUnicodeFixedWidth( + lexer: Lexer, + position: number, +): EscapeSequence { + const body = lexer.source.body; + const code = read16BitHexCode(body, position + 2); + + if (isUnicodeScalarValue(code)) { + return { value: String.fromCodePoint(code), size: 6 }; + } + + // GraphQL allows JSON-style surrogate pair escape sequences, but only when + // a valid pair is formed. + if (isLeadingSurrogate(code)) { + // \u + if ( + body.charCodeAt(position + 6) === 0x005c && + body.charCodeAt(position + 7) === 0x0075 + ) { + const trailingCode = read16BitHexCode(body, position + 8); + if (isTrailingSurrogate(trailingCode)) { + // JavaScript defines strings as a sequence of UTF-16 code units and + // encodes Unicode code points above U+FFFF using a surrogate pair of + // code units. Since this is a surrogate pair escape sequence, just + // include both codes into the JavaScript string value. Had JavaScript + // not been internally based on UTF-16, then this surrogate pair would + // be decoded to retrieve the supplementary code point. + return { value: String.fromCodePoint(code, trailingCode), size: 12 }; + } + } + } + + throw syntaxError( + lexer.source, + position, + `Invalid Unicode escape sequence: "${body.slice(position, position + 6)}".`, + ); +} + +/** + * Reads four hexadecimal characters and returns the positive integer that 16bit + * hexadecimal string represents. For example, "000f" will return 15, and "dead" + * will return 57005. + * + * Returns a negative number if any char was not a valid hexadecimal digit. + */ +function read16BitHexCode(body: string, position: number): number { + // readHexDigit() returns -1 on error. ORing a negative value with any other + // value always produces a negative value. + return ( + (readHexDigit(body.charCodeAt(position)) << 12) | + (readHexDigit(body.charCodeAt(position + 1)) << 8) | + (readHexDigit(body.charCodeAt(position + 2)) << 4) | + readHexDigit(body.charCodeAt(position + 3)) + ); +} + +/** + * Reads a hexadecimal character and returns its positive integer value (0-15). + * + * '0' becomes 0, '9' becomes 9 + * 'A' becomes 10, 'F' becomes 15 + * 'a' becomes 10, 'f' becomes 15 + * + * Returns -1 if the provided character code was not a valid hexadecimal digit. + * + * HexDigit :: one of + * - `0` `1` `2` `3` `4` `5` `6` `7` `8` `9` + * - `A` `B` `C` `D` `E` `F` + * - `a` `b` `c` `d` `e` `f` + */ +function readHexDigit(code: number): number { + return code >= 0x0030 && code <= 0x0039 // 0-9 + ? code - 0x0030 + : code >= 0x0041 && code <= 0x0046 // A-F + ? code - 0x0037 + : code >= 0x0061 && code <= 0x0066 // a-f + ? code - 0x0057 + : -1; +} + +/** + * | Escaped Character | Code Point | Character Name | + * | ----------------- | ---------- | ---------------------------- | + * | `"` | U+0022 | double quote | + * | `\` | U+005C | reverse solidus (back slash) | + * | `/` | U+002F | solidus (forward slash) | + * | `b` | U+0008 | backspace | + * | `f` | U+000C | form feed | + * | `n` | U+000A | line feed (new line) | + * | `r` | U+000D | carriage return | + * | `t` | U+0009 | horizontal tab | + */ +function readEscapedCharacter(lexer: Lexer, position: number): EscapeSequence { + const body = lexer.source.body; + const code = body.charCodeAt(position + 1); + switch (code) { + case 0x0022: // " + return { value: '\u0022', size: 2 }; + case 0x005c: // \ + return { value: '\u005c', size: 2 }; + case 0x002f: // / + return { value: '\u002f', size: 2 }; + case 0x0062: // b + return { value: '\u0008', size: 2 }; + case 0x0066: // f + return { value: '\u000c', size: 2 }; + case 0x006e: // n + return { value: '\u000a', size: 2 }; + case 0x0072: // r + return { value: '\u000d', size: 2 }; + case 0x0074: // t + return { value: '\u0009', size: 2 }; + } + throw syntaxError( + lexer.source, + position, + `Invalid character escape sequence: "${body.slice( + position, + position + 2, + )}".`, + ); +} + +/** + * Reads a block string token from the source file. + * + * ``` + * StringValue :: + * - `"""` BlockStringCharacter* `"""` + * + * BlockStringCharacter :: + * - SourceCharacter but not `"""` or `\"""` + * - `\"""` + * ``` + */ +function readBlockString(lexer: Lexer, start: number): Token { + const body = lexer.source.body; + const bodyLength = body.length; + let lineStart = lexer.lineStart; + + let position = start + 3; + let chunkStart = position; + let currentLine = ''; + + const blockLines = []; + while (position < bodyLength) { + const code = body.charCodeAt(position); + + // Closing Triple-Quote (""") + if ( + code === 0x0022 && + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 + ) { + currentLine += body.slice(chunkStart, position); + blockLines.push(currentLine); + + const token = createToken( + lexer, + TokenKind.BLOCK_STRING, + start, + position + 3, + // Return a string of the lines joined with U+000A. + dedentBlockStringLines(blockLines).join('\n'), + ); + + lexer.line += blockLines.length - 1; + lexer.lineStart = lineStart; + return token; + } + + // Escaped Triple-Quote (\""") + if ( + code === 0x005c && + body.charCodeAt(position + 1) === 0x0022 && + body.charCodeAt(position + 2) === 0x0022 && + body.charCodeAt(position + 3) === 0x0022 + ) { + currentLine += body.slice(chunkStart, position); + chunkStart = position + 1; // skip only slash + position += 4; + continue; + } + + // LineTerminator + if (code === 0x000a || code === 0x000d) { + currentLine += body.slice(chunkStart, position); + blockLines.push(currentLine); + + if (code === 0x000d && body.charCodeAt(position + 1) === 0x000a) { + position += 2; + } else { + ++position; + } + + currentLine = ''; + chunkStart = position; + lineStart = position; + continue; + } + + // SourceCharacter + if (isUnicodeScalarValue(code)) { + ++position; + } else if (isSupplementaryCodePoint(body, position)) { + position += 2; + } else { + throw syntaxError( + lexer.source, + position, + `Invalid character within String: ${printCodePointAt( + lexer, + position, + )}.`, + ); + } + } + + throw syntaxError(lexer.source, position, 'Unterminated string.'); +} + +/** + * Reads an alphanumeric + underscore name from the source. + * + * ``` + * Name :: + * - NameStart NameContinue* [lookahead != NameContinue] + * ``` + */ +function readName(lexer: Lexer, start: number): Token { + const body = lexer.source.body; + const bodyLength = body.length; + let position = start + 1; + + while (position < bodyLength) { + const code = body.charCodeAt(position); + if (isNameContinue(code)) { + ++position; + } else { + break; + } + } + + return createToken( + lexer, + TokenKind.NAME, + start, + position, + body.slice(start, position), + ); +} diff --git a/src/language/location.ts b/src/language/location.ts new file mode 100644 index 00000000..36d97f3c --- /dev/null +++ b/src/language/location.ts @@ -0,0 +1,33 @@ +import { invariant } from '../jsutils/invariant'; + +import type { Source } from './source'; + +const LineRegExp = /\r\n|[\n\r]/g; + +/** + * Represents a location in a Source. + */ +export interface SourceLocation { + readonly line: number; + readonly column: number; +} + +/** + * Takes a Source and a UTF-8 character offset, and returns the corresponding + * line and column as a SourceLocation. + */ +export function getLocation(source: Source, position: number): SourceLocation { + let lastLineStart = 0; + let line = 1; + + for (const match of source.body.matchAll(LineRegExp)) { + invariant(typeof match.index === 'number'); + if (match.index >= position) { + break; + } + lastLineStart = match.index + match[0].length; + line += 1; + } + + return { line, column: position + 1 - lastLineStart }; +} diff --git a/src/language/parser.ts b/src/language/parser.ts new file mode 100644 index 00000000..282ee168 --- /dev/null +++ b/src/language/parser.ts @@ -0,0 +1,1566 @@ +import type { Maybe } from '../jsutils/Maybe'; + +import type { GraphQLError } from '../error/GraphQLError'; +import { syntaxError } from '../error/syntaxError'; + +import type { + ArgumentNode, + BooleanValueNode, + ConstArgumentNode, + ConstDirectiveNode, + ConstListValueNode, + ConstObjectFieldNode, + ConstObjectValueNode, + ConstValueNode, + DefinitionNode, + DirectiveDefinitionNode, + DirectiveNode, + DocumentNode, + EnumTypeDefinitionNode, + EnumTypeExtensionNode, + EnumValueDefinitionNode, + EnumValueNode, + FieldDefinitionNode, + FieldNode, + FloatValueNode, + FragmentDefinitionNode, + FragmentSpreadNode, + InlineFragmentNode, + InputObjectTypeDefinitionNode, + InputObjectTypeExtensionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + InterfaceTypeExtensionNode, + IntValueNode, + ListTypeNode, + ListValueNode, + NamedTypeNode, + NameNode, + NonNullTypeNode, + NullValueNode, + ObjectFieldNode, + ObjectTypeDefinitionNode, + ObjectTypeExtensionNode, + ObjectValueNode, + OperationDefinitionNode, + OperationTypeDefinitionNode, + ScalarTypeDefinitionNode, + ScalarTypeExtensionNode, + SchemaDefinitionNode, + SchemaExtensionNode, + SelectionNode, + SelectionSetNode, + StringValueNode, + Token, + TypeNode, + TypeSystemExtensionNode, + UnionTypeDefinitionNode, + UnionTypeExtensionNode, + ValueNode, + VariableDefinitionNode, + VariableNode, +} from './ast'; +import { Location, OperationTypeNode } from './ast'; +import { DirectiveLocation } from './directiveLocation'; +import { Kind } from './kinds'; +import { isPunctuatorTokenKind, Lexer } from './lexer'; +import { isSource, Source } from './source'; +import { TokenKind } from './tokenKind'; + +/** + * Configuration options to control parser behavior + */ +export interface ParseOptions { + /** + * By default, the parser creates AST nodes that know the location + * in the source that they correspond to. This configuration flag + * disables that behavior for performance or testing. + */ + noLocation?: boolean; + + /** + * @deprecated will be removed in the v17.0.0 + * + * If enabled, the parser will understand and parse variable definitions + * contained in a fragment definition. They'll be represented in the + * `variableDefinitions` field of the FragmentDefinitionNode. + * + * The syntax is identical to normal, query-defined variables. For example: + * + * ```graphql + * fragment A($var: Boolean = false) on T { + * ... + * } + * ``` + */ + allowLegacyFragmentVariables?: boolean; +} + +/** + * Given a GraphQL source, parses it into a Document. + * Throws GraphQLError if a syntax error is encountered. + */ +export function parse( + source: string | Source, + options?: ParseOptions, +): DocumentNode { + const parser = new Parser(source, options); + return parser.parseDocument(); +} + +/** + * Given a string containing a GraphQL value (ex. `[42]`), parse the AST for + * that value. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Values directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: valueFromAST(). + */ +export function parseValue( + source: string | Source, + options?: ParseOptions, +): ValueNode { + const parser = new Parser(source, options); + parser.expectToken(TokenKind.SOF); + const value = parser.parseValueLiteral(false); + parser.expectToken(TokenKind.EOF); + return value; +} + +/** + * Similar to parseValue(), but raises a parse error if it encounters a + * variable. The return type will be a constant value. + */ +export function parseConstValue( + source: string | Source, + options?: ParseOptions, +): ConstValueNode { + const parser = new Parser(source, options); + parser.expectToken(TokenKind.SOF); + const value = parser.parseConstValueLiteral(); + parser.expectToken(TokenKind.EOF); + return value; +} + +/** + * Given a string containing a GraphQL Type (ex. `[Int!]`), parse the AST for + * that type. + * Throws GraphQLError if a syntax error is encountered. + * + * This is useful within tools that operate upon GraphQL Types directly and + * in isolation of complete GraphQL documents. + * + * Consider providing the results to the utility function: typeFromAST(). + */ +export function parseType( + source: string | Source, + options?: ParseOptions, +): TypeNode { + const parser = new Parser(source, options); + parser.expectToken(TokenKind.SOF); + const type = parser.parseTypeReference(); + parser.expectToken(TokenKind.EOF); + return type; +} + +/** + * This class is exported only to assist people in implementing their own parsers + * without duplicating too much code and should be used only as last resort for cases + * such as experimental syntax or if certain features could not be contributed upstream. + * + * It is still part of the internal API and is versioned, so any changes to it are never + * considered breaking changes. If you still need to support multiple versions of the + * library, please use the `versionInfo` variable for version detection. + * + * @internal + */ +export class Parser { + protected _options: Maybe; + protected _lexer: Lexer; + + constructor(source: string | Source, options?: ParseOptions) { + const sourceObj = isSource(source) ? source : new Source(source); + + this._lexer = new Lexer(sourceObj); + this._options = options; + } + + /** + * Converts a name lex token into a name parse node. + */ + parseName(): NameNode { + const token = this.expectToken(TokenKind.NAME); + return this.node(token, { + kind: Kind.NAME, + value: token.value, + }); + } + + // Implements the parsing rules in the Document section. + + /** + * Document : Definition+ + */ + parseDocument(): DocumentNode { + return this.node(this._lexer.token, { + kind: Kind.DOCUMENT, + definitions: this.many( + TokenKind.SOF, + this.parseDefinition, + TokenKind.EOF, + ), + }); + } + + /** + * Definition : + * - ExecutableDefinition + * - TypeSystemDefinition + * - TypeSystemExtension + * + * ExecutableDefinition : + * - OperationDefinition + * - FragmentDefinition + * + * TypeSystemDefinition : + * - SchemaDefinition + * - TypeDefinition + * - DirectiveDefinition + * + * TypeDefinition : + * - ScalarTypeDefinition + * - ObjectTypeDefinition + * - InterfaceTypeDefinition + * - UnionTypeDefinition + * - EnumTypeDefinition + * - InputObjectTypeDefinition + */ + parseDefinition(): DefinitionNode { + if (this.peek(TokenKind.BRACE_L)) { + return this.parseOperationDefinition(); + } + + // Many definitions begin with a description and require a lookahead. + const hasDescription = this.peekDescription(); + const keywordToken = hasDescription + ? this._lexer.lookahead() + : this._lexer.token; + + if (keywordToken.kind === TokenKind.NAME) { + switch (keywordToken.value) { + case 'schema': + return this.parseSchemaDefinition(); + case 'scalar': + return this.parseScalarTypeDefinition(); + case 'type': + return this.parseObjectTypeDefinition(); + case 'interface': + return this.parseInterfaceTypeDefinition(); + case 'union': + return this.parseUnionTypeDefinition(); + case 'enum': + return this.parseEnumTypeDefinition(); + case 'input': + return this.parseInputObjectTypeDefinition(); + case 'directive': + return this.parseDirectiveDefinition(); + } + + if (hasDescription) { + throw syntaxError( + this._lexer.source, + this._lexer.token.start, + 'Unexpected description, descriptions are supported only on type definitions.', + ); + } + + switch (keywordToken.value) { + case 'query': + case 'mutation': + case 'subscription': + return this.parseOperationDefinition(); + case 'fragment': + return this.parseFragmentDefinition(); + case 'extend': + return this.parseTypeSystemExtension(); + } + } + + throw this.unexpected(keywordToken); + } + + // Implements the parsing rules in the Operations section. + + /** + * OperationDefinition : + * - SelectionSet + * - OperationType Name? VariableDefinitions? Directives? SelectionSet + */ + parseOperationDefinition(): OperationDefinitionNode { + const start = this._lexer.token; + if (this.peek(TokenKind.BRACE_L)) { + return this.node(start, { + kind: Kind.OPERATION_DEFINITION, + operation: OperationTypeNode.QUERY, + name: undefined, + variableDefinitions: [], + directives: [], + selectionSet: this.parseSelectionSet(), + }); + } + const operation = this.parseOperationType(); + let name; + if (this.peek(TokenKind.NAME)) { + name = this.parseName(); + } + return this.node(start, { + kind: Kind.OPERATION_DEFINITION, + operation, + name, + variableDefinitions: this.parseVariableDefinitions(), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + + /** + * OperationType : one of query mutation subscription + */ + parseOperationType(): OperationTypeNode { + const operationToken = this.expectToken(TokenKind.NAME); + switch (operationToken.value) { + case 'query': + return OperationTypeNode.QUERY; + case 'mutation': + return OperationTypeNode.MUTATION; + case 'subscription': + return OperationTypeNode.SUBSCRIPTION; + } + + throw this.unexpected(operationToken); + } + + /** + * VariableDefinitions : ( VariableDefinition+ ) + */ + parseVariableDefinitions(): Array { + return this.optionalMany( + TokenKind.PAREN_L, + this.parseVariableDefinition, + TokenKind.PAREN_R, + ); + } + + /** + * VariableDefinition : Variable : Type DefaultValue? Directives[Const]? + */ + parseVariableDefinition(): VariableDefinitionNode { + return this.node(this._lexer.token, { + kind: Kind.VARIABLE_DEFINITION, + variable: this.parseVariable(), + type: (this.expectToken(TokenKind.COLON), this.parseTypeReference()), + defaultValue: this.expectOptionalToken(TokenKind.EQUALS) + ? this.parseConstValueLiteral() + : undefined, + directives: this.parseConstDirectives(), + }); + } + + /** + * Variable : $ Name + */ + parseVariable(): VariableNode { + const start = this._lexer.token; + this.expectToken(TokenKind.DOLLAR); + return this.node(start, { + kind: Kind.VARIABLE, + name: this.parseName(), + }); + } + + /** + * ``` + * SelectionSet : { Selection+ } + * ``` + */ + parseSelectionSet(): SelectionSetNode { + return this.node(this._lexer.token, { + kind: Kind.SELECTION_SET, + selections: this.many( + TokenKind.BRACE_L, + this.parseSelection, + TokenKind.BRACE_R, + ), + }); + } + + /** + * Selection : + * - Field + * - FragmentSpread + * - InlineFragment + */ + parseSelection(): SelectionNode { + return this.peek(TokenKind.SPREAD) + ? this.parseFragment() + : this.parseField(); + } + + /** + * Field : Alias? Name Arguments? Directives? SelectionSet? + * + * Alias : Name : + */ + parseField(): FieldNode { + const start = this._lexer.token; + + const nameOrAlias = this.parseName(); + let alias; + let name; + if (this.expectOptionalToken(TokenKind.COLON)) { + alias = nameOrAlias; + name = this.parseName(); + } else { + name = nameOrAlias; + } + + return this.node(start, { + kind: Kind.FIELD, + alias, + name, + arguments: this.parseArguments(false), + directives: this.parseDirectives(false), + selectionSet: this.peek(TokenKind.BRACE_L) + ? this.parseSelectionSet() + : undefined, + }); + } + + /** + * Arguments[Const] : ( Argument[?Const]+ ) + */ + parseArguments(isConst: true): Array; + parseArguments(isConst: boolean): Array; + parseArguments(isConst: boolean): Array { + const item = isConst ? this.parseConstArgument : this.parseArgument; + return this.optionalMany(TokenKind.PAREN_L, item, TokenKind.PAREN_R); + } + + /** + * Argument[Const] : Name : Value[?Const] + */ + parseArgument(isConst: true): ConstArgumentNode; + parseArgument(isConst?: boolean): ArgumentNode; + parseArgument(isConst: boolean = false): ArgumentNode { + const start = this._lexer.token; + const name = this.parseName(); + + this.expectToken(TokenKind.COLON); + return this.node(start, { + kind: Kind.ARGUMENT, + name, + value: this.parseValueLiteral(isConst), + }); + } + + parseConstArgument(): ConstArgumentNode { + return this.parseArgument(true); + } + + // Implements the parsing rules in the Fragments section. + + /** + * Corresponds to both FragmentSpread and InlineFragment in the spec. + * + * FragmentSpread : ... FragmentName Directives? + * + * InlineFragment : ... TypeCondition? Directives? SelectionSet + */ + parseFragment(): FragmentSpreadNode | InlineFragmentNode { + const start = this._lexer.token; + this.expectToken(TokenKind.SPREAD); + + const hasTypeCondition = this.expectOptionalKeyword('on'); + if (!hasTypeCondition && this.peek(TokenKind.NAME)) { + return this.node(start, { + kind: Kind.FRAGMENT_SPREAD, + name: this.parseFragmentName(), + directives: this.parseDirectives(false), + }); + } + return this.node(start, { + kind: Kind.INLINE_FRAGMENT, + typeCondition: hasTypeCondition ? this.parseNamedType() : undefined, + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + + /** + * FragmentDefinition : + * - fragment FragmentName on TypeCondition Directives? SelectionSet + * + * TypeCondition : NamedType + */ + parseFragmentDefinition(): FragmentDefinitionNode { + const start = this._lexer.token; + this.expectKeyword('fragment'); + // Legacy support for defining variables within fragments changes + // the grammar of FragmentDefinition: + // - fragment FragmentName VariableDefinitions? on TypeCondition Directives? SelectionSet + if (this._options?.allowLegacyFragmentVariables === true) { + return this.node(start, { + kind: Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + variableDefinitions: this.parseVariableDefinitions(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + return this.node(start, { + kind: Kind.FRAGMENT_DEFINITION, + name: this.parseFragmentName(), + typeCondition: (this.expectKeyword('on'), this.parseNamedType()), + directives: this.parseDirectives(false), + selectionSet: this.parseSelectionSet(), + }); + } + + /** + * FragmentName : Name but not `on` + */ + parseFragmentName(): NameNode { + if (this._lexer.token.value === 'on') { + throw this.unexpected(); + } + return this.parseName(); + } + + // Implements the parsing rules in the Values section. + + /** + * Value[Const] : + * - [~Const] Variable + * - IntValue + * - FloatValue + * - StringValue + * - BooleanValue + * - NullValue + * - EnumValue + * - ListValue[?Const] + * - ObjectValue[?Const] + * + * BooleanValue : one of `true` `false` + * + * NullValue : `null` + * + * EnumValue : Name but not `true`, `false` or `null` + */ + parseValueLiteral(isConst: true): ConstValueNode; + parseValueLiteral(isConst: boolean): ValueNode; + parseValueLiteral(isConst: boolean): ValueNode { + const token = this._lexer.token; + switch (token.kind) { + case TokenKind.BRACKET_L: + return this.parseList(isConst); + case TokenKind.BRACE_L: + return this.parseObject(isConst); + case TokenKind.INT: + this._lexer.advance(); + return this.node(token, { + kind: Kind.INT, + value: token.value, + }); + case TokenKind.FLOAT: + this._lexer.advance(); + return this.node(token, { + kind: Kind.FLOAT, + value: token.value, + }); + case TokenKind.STRING: + case TokenKind.BLOCK_STRING: + return this.parseStringLiteral(); + case TokenKind.NAME: + this._lexer.advance(); + switch (token.value) { + case 'true': + return this.node(token, { + kind: Kind.BOOLEAN, + value: true, + }); + case 'false': + return this.node(token, { + kind: Kind.BOOLEAN, + value: false, + }); + case 'null': + return this.node(token, { kind: Kind.NULL }); + default: + return this.node(token, { + kind: Kind.ENUM, + value: token.value, + }); + } + case TokenKind.DOLLAR: + if (isConst) { + this.expectToken(TokenKind.DOLLAR); + if (this._lexer.token.kind === TokenKind.NAME) { + const varName = this._lexer.token.value; + throw syntaxError( + this._lexer.source, + token.start, + `Unexpected variable "$${varName}" in constant value.`, + ); + } else { + throw this.unexpected(token); + } + } + return this.parseVariable(); + default: + throw this.unexpected(); + } + } + + parseConstValueLiteral(): ConstValueNode { + return this.parseValueLiteral(true); + } + + parseStringLiteral(): StringValueNode { + const token = this._lexer.token; + this._lexer.advance(); + return this.node(token, { + kind: Kind.STRING, + value: token.value, + block: token.kind === TokenKind.BLOCK_STRING, + }); + } + + /** + * ListValue[Const] : + * - [ ] + * - [ Value[?Const]+ ] + */ + parseList(isConst: true): ConstListValueNode; + parseList(isConst: boolean): ListValueNode; + parseList(isConst: boolean): ListValueNode { + const item = () => this.parseValueLiteral(isConst); + return this.node(this._lexer.token, { + kind: Kind.LIST, + values: this.any(TokenKind.BRACKET_L, item, TokenKind.BRACKET_R), + }); + } + + /** + * ``` + * ObjectValue[Const] : + * - { } + * - { ObjectField[?Const]+ } + * ``` + */ + parseObject(isConst: true): ConstObjectValueNode; + parseObject(isConst: boolean): ObjectValueNode; + parseObject(isConst: boolean): ObjectValueNode { + const item = () => this.parseObjectField(isConst); + return this.node(this._lexer.token, { + kind: Kind.OBJECT, + fields: this.any(TokenKind.BRACE_L, item, TokenKind.BRACE_R), + }); + } + + /** + * ObjectField[Const] : Name : Value[?Const] + */ + parseObjectField(isConst: true): ConstObjectFieldNode; + parseObjectField(isConst: boolean): ObjectFieldNode; + parseObjectField(isConst: boolean): ObjectFieldNode { + const start = this._lexer.token; + const name = this.parseName(); + this.expectToken(TokenKind.COLON); + return this.node(start, { + kind: Kind.OBJECT_FIELD, + name, + value: this.parseValueLiteral(isConst), + }); + } + + // Implements the parsing rules in the Directives section. + + /** + * Directives[Const] : Directive[?Const]+ + */ + parseDirectives(isConst: true): Array; + parseDirectives(isConst: boolean): Array; + parseDirectives(isConst: boolean): Array { + const directives = []; + while (this.peek(TokenKind.AT)) { + directives.push(this.parseDirective(isConst)); + } + return directives; + } + + parseConstDirectives(): Array { + return this.parseDirectives(true); + } + + /** + * ``` + * Directive[Const] : @ Name Arguments[?Const]? + * ``` + */ + parseDirective(isConst: true): ConstDirectiveNode; + parseDirective(isConst: boolean): DirectiveNode; + parseDirective(isConst: boolean): DirectiveNode { + const start = this._lexer.token; + this.expectToken(TokenKind.AT); + return this.node(start, { + kind: Kind.DIRECTIVE, + name: this.parseName(), + arguments: this.parseArguments(isConst), + }); + } + + // Implements the parsing rules in the Types section. + + /** + * Type : + * - NamedType + * - ListType + * - NonNullType + */ + parseTypeReference(): TypeNode { + const start = this._lexer.token; + let type; + if (this.expectOptionalToken(TokenKind.BRACKET_L)) { + const innerType = this.parseTypeReference(); + this.expectToken(TokenKind.BRACKET_R); + type = this.node(start, { + kind: Kind.LIST_TYPE, + type: innerType, + }); + } else { + type = this.parseNamedType(); + } + + if (this.expectOptionalToken(TokenKind.BANG)) { + return this.node(start, { + kind: Kind.NON_NULL_TYPE, + type, + }); + } + + return type; + } + + /** + * NamedType : Name + */ + parseNamedType(): NamedTypeNode { + return this.node(this._lexer.token, { + kind: Kind.NAMED_TYPE, + name: this.parseName(), + }); + } + + // Implements the parsing rules in the Type Definition section. + + peekDescription(): boolean { + return this.peek(TokenKind.STRING) || this.peek(TokenKind.BLOCK_STRING); + } + + /** + * Description : StringValue + */ + parseDescription(): undefined | StringValueNode { + if (this.peekDescription()) { + return this.parseStringLiteral(); + } + } + + /** + * ``` + * SchemaDefinition : Description? schema Directives[Const]? { OperationTypeDefinition+ } + * ``` + */ + parseSchemaDefinition(): SchemaDefinitionNode { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('schema'); + const directives = this.parseConstDirectives(); + const operationTypes = this.many( + TokenKind.BRACE_L, + this.parseOperationTypeDefinition, + TokenKind.BRACE_R, + ); + return this.node(start, { + kind: Kind.SCHEMA_DEFINITION, + description, + directives, + operationTypes, + }); + } + + /** + * OperationTypeDefinition : OperationType : NamedType + */ + parseOperationTypeDefinition(): OperationTypeDefinitionNode { + const start = this._lexer.token; + const operation = this.parseOperationType(); + this.expectToken(TokenKind.COLON); + const type = this.parseNamedType(); + return this.node(start, { + kind: Kind.OPERATION_TYPE_DEFINITION, + operation, + type, + }); + } + + /** + * ScalarTypeDefinition : Description? scalar Name Directives[Const]? + */ + parseScalarTypeDefinition(): ScalarTypeDefinitionNode { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('scalar'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: Kind.SCALAR_TYPE_DEFINITION, + description, + name, + directives, + }); + } + + /** + * ObjectTypeDefinition : + * Description? + * type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition? + */ + parseObjectTypeDefinition(): ObjectTypeDefinitionNode { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('type'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + return this.node(start, { + kind: Kind.OBJECT_TYPE_DEFINITION, + description, + name, + interfaces, + directives, + fields, + }); + } + + /** + * ImplementsInterfaces : + * - implements `&`? NamedType + * - ImplementsInterfaces & NamedType + */ + parseImplementsInterfaces(): Array { + return this.expectOptionalKeyword('implements') + ? this.delimitedMany(TokenKind.AMP, this.parseNamedType) + : []; + } + + /** + * ``` + * FieldsDefinition : { FieldDefinition+ } + * ``` + */ + parseFieldsDefinition(): Array { + return this.optionalMany( + TokenKind.BRACE_L, + this.parseFieldDefinition, + TokenKind.BRACE_R, + ); + } + + /** + * FieldDefinition : + * - Description? Name ArgumentsDefinition? : Type Directives[Const]? + */ + parseFieldDefinition(): FieldDefinitionNode { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseName(); + const args = this.parseArgumentDefs(); + this.expectToken(TokenKind.COLON); + const type = this.parseTypeReference(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: Kind.FIELD_DEFINITION, + description, + name, + arguments: args, + type, + directives, + }); + } + + /** + * ArgumentsDefinition : ( InputValueDefinition+ ) + */ + parseArgumentDefs(): Array { + return this.optionalMany( + TokenKind.PAREN_L, + this.parseInputValueDef, + TokenKind.PAREN_R, + ); + } + + /** + * InputValueDefinition : + * - Description? Name : Type DefaultValue? Directives[Const]? + */ + parseInputValueDef(): InputValueDefinitionNode { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseName(); + this.expectToken(TokenKind.COLON); + const type = this.parseTypeReference(); + let defaultValue; + if (this.expectOptionalToken(TokenKind.EQUALS)) { + defaultValue = this.parseConstValueLiteral(); + } + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: Kind.INPUT_VALUE_DEFINITION, + description, + name, + type, + defaultValue, + directives, + }); + } + + /** + * InterfaceTypeDefinition : + * - Description? interface Name Directives[Const]? FieldsDefinition? + */ + parseInterfaceTypeDefinition(): InterfaceTypeDefinitionNode { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('interface'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + return this.node(start, { + kind: Kind.INTERFACE_TYPE_DEFINITION, + description, + name, + interfaces, + directives, + fields, + }); + } + + /** + * UnionTypeDefinition : + * - Description? union Name Directives[Const]? UnionMemberTypes? + */ + parseUnionTypeDefinition(): UnionTypeDefinitionNode { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('union'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const types = this.parseUnionMemberTypes(); + return this.node(start, { + kind: Kind.UNION_TYPE_DEFINITION, + description, + name, + directives, + types, + }); + } + + /** + * UnionMemberTypes : + * - = `|`? NamedType + * - UnionMemberTypes | NamedType + */ + parseUnionMemberTypes(): Array { + return this.expectOptionalToken(TokenKind.EQUALS) + ? this.delimitedMany(TokenKind.PIPE, this.parseNamedType) + : []; + } + + /** + * EnumTypeDefinition : + * - Description? enum Name Directives[Const]? EnumValuesDefinition? + */ + parseEnumTypeDefinition(): EnumTypeDefinitionNode { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('enum'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const values = this.parseEnumValuesDefinition(); + return this.node(start, { + kind: Kind.ENUM_TYPE_DEFINITION, + description, + name, + directives, + values, + }); + } + + /** + * ``` + * EnumValuesDefinition : { EnumValueDefinition+ } + * ``` + */ + parseEnumValuesDefinition(): Array { + return this.optionalMany( + TokenKind.BRACE_L, + this.parseEnumValueDefinition, + TokenKind.BRACE_R, + ); + } + + /** + * EnumValueDefinition : Description? EnumValue Directives[Const]? + */ + parseEnumValueDefinition(): EnumValueDefinitionNode { + const start = this._lexer.token; + const description = this.parseDescription(); + const name = this.parseEnumValueName(); + const directives = this.parseConstDirectives(); + return this.node(start, { + kind: Kind.ENUM_VALUE_DEFINITION, + description, + name, + directives, + }); + } + + /** + * EnumValue : Name but not `true`, `false` or `null` + */ + parseEnumValueName(): NameNode { + if ( + this._lexer.token.value === 'true' || + this._lexer.token.value === 'false' || + this._lexer.token.value === 'null' + ) { + throw syntaxError( + this._lexer.source, + this._lexer.token.start, + `${getTokenDesc( + this._lexer.token, + )} is reserved and cannot be used for an enum value.`, + ); + } + return this.parseName(); + } + + /** + * InputObjectTypeDefinition : + * - Description? input Name Directives[Const]? InputFieldsDefinition? + */ + parseInputObjectTypeDefinition(): InputObjectTypeDefinitionNode { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('input'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const fields = this.parseInputFieldsDefinition(); + return this.node(start, { + kind: Kind.INPUT_OBJECT_TYPE_DEFINITION, + description, + name, + directives, + fields, + }); + } + + /** + * ``` + * InputFieldsDefinition : { InputValueDefinition+ } + * ``` + */ + parseInputFieldsDefinition(): Array { + return this.optionalMany( + TokenKind.BRACE_L, + this.parseInputValueDef, + TokenKind.BRACE_R, + ); + } + + /** + * TypeSystemExtension : + * - SchemaExtension + * - TypeExtension + * + * TypeExtension : + * - ScalarTypeExtension + * - ObjectTypeExtension + * - InterfaceTypeExtension + * - UnionTypeExtension + * - EnumTypeExtension + * - InputObjectTypeDefinition + */ + parseTypeSystemExtension(): TypeSystemExtensionNode { + const keywordToken = this._lexer.lookahead(); + + if (keywordToken.kind === TokenKind.NAME) { + switch (keywordToken.value) { + case 'schema': + return this.parseSchemaExtension(); + case 'scalar': + return this.parseScalarTypeExtension(); + case 'type': + return this.parseObjectTypeExtension(); + case 'interface': + return this.parseInterfaceTypeExtension(); + case 'union': + return this.parseUnionTypeExtension(); + case 'enum': + return this.parseEnumTypeExtension(); + case 'input': + return this.parseInputObjectTypeExtension(); + } + } + + throw this.unexpected(keywordToken); + } + + /** + * ``` + * SchemaExtension : + * - extend schema Directives[Const]? { OperationTypeDefinition+ } + * - extend schema Directives[Const] + * ``` + */ + parseSchemaExtension(): SchemaExtensionNode { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('schema'); + const directives = this.parseConstDirectives(); + const operationTypes = this.optionalMany( + TokenKind.BRACE_L, + this.parseOperationTypeDefinition, + TokenKind.BRACE_R, + ); + if (directives.length === 0 && operationTypes.length === 0) { + throw this.unexpected(); + } + return this.node(start, { + kind: Kind.SCHEMA_EXTENSION, + directives, + operationTypes, + }); + } + + /** + * ScalarTypeExtension : + * - extend scalar Name Directives[Const] + */ + parseScalarTypeExtension(): ScalarTypeExtensionNode { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('scalar'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + if (directives.length === 0) { + throw this.unexpected(); + } + return this.node(start, { + kind: Kind.SCALAR_TYPE_EXTENSION, + name, + directives, + }); + } + + /** + * ObjectTypeExtension : + * - extend type Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend type Name ImplementsInterfaces? Directives[Const] + * - extend type Name ImplementsInterfaces + */ + parseObjectTypeExtension(): ObjectTypeExtensionNode { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('type'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + if ( + interfaces.length === 0 && + directives.length === 0 && + fields.length === 0 + ) { + throw this.unexpected(); + } + return this.node(start, { + kind: Kind.OBJECT_TYPE_EXTENSION, + name, + interfaces, + directives, + fields, + }); + } + + /** + * InterfaceTypeExtension : + * - extend interface Name ImplementsInterfaces? Directives[Const]? FieldsDefinition + * - extend interface Name ImplementsInterfaces? Directives[Const] + * - extend interface Name ImplementsInterfaces + */ + parseInterfaceTypeExtension(): InterfaceTypeExtensionNode { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('interface'); + const name = this.parseName(); + const interfaces = this.parseImplementsInterfaces(); + const directives = this.parseConstDirectives(); + const fields = this.parseFieldsDefinition(); + if ( + interfaces.length === 0 && + directives.length === 0 && + fields.length === 0 + ) { + throw this.unexpected(); + } + return this.node(start, { + kind: Kind.INTERFACE_TYPE_EXTENSION, + name, + interfaces, + directives, + fields, + }); + } + + /** + * UnionTypeExtension : + * - extend union Name Directives[Const]? UnionMemberTypes + * - extend union Name Directives[Const] + */ + parseUnionTypeExtension(): UnionTypeExtensionNode { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('union'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const types = this.parseUnionMemberTypes(); + if (directives.length === 0 && types.length === 0) { + throw this.unexpected(); + } + return this.node(start, { + kind: Kind.UNION_TYPE_EXTENSION, + name, + directives, + types, + }); + } + + /** + * EnumTypeExtension : + * - extend enum Name Directives[Const]? EnumValuesDefinition + * - extend enum Name Directives[Const] + */ + parseEnumTypeExtension(): EnumTypeExtensionNode { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('enum'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const values = this.parseEnumValuesDefinition(); + if (directives.length === 0 && values.length === 0) { + throw this.unexpected(); + } + return this.node(start, { + kind: Kind.ENUM_TYPE_EXTENSION, + name, + directives, + values, + }); + } + + /** + * InputObjectTypeExtension : + * - extend input Name Directives[Const]? InputFieldsDefinition + * - extend input Name Directives[Const] + */ + parseInputObjectTypeExtension(): InputObjectTypeExtensionNode { + const start = this._lexer.token; + this.expectKeyword('extend'); + this.expectKeyword('input'); + const name = this.parseName(); + const directives = this.parseConstDirectives(); + const fields = this.parseInputFieldsDefinition(); + if (directives.length === 0 && fields.length === 0) { + throw this.unexpected(); + } + return this.node(start, { + kind: Kind.INPUT_OBJECT_TYPE_EXTENSION, + name, + directives, + fields, + }); + } + + /** + * ``` + * DirectiveDefinition : + * - Description? directive @ Name ArgumentsDefinition? `repeatable`? on DirectiveLocations + * ``` + */ + parseDirectiveDefinition(): DirectiveDefinitionNode { + const start = this._lexer.token; + const description = this.parseDescription(); + this.expectKeyword('directive'); + this.expectToken(TokenKind.AT); + const name = this.parseName(); + const args = this.parseArgumentDefs(); + const repeatable = this.expectOptionalKeyword('repeatable'); + this.expectKeyword('on'); + const locations = this.parseDirectiveLocations(); + return this.node(start, { + kind: Kind.DIRECTIVE_DEFINITION, + description, + name, + arguments: args, + repeatable, + locations, + }); + } + + /** + * DirectiveLocations : + * - `|`? DirectiveLocation + * - DirectiveLocations | DirectiveLocation + */ + parseDirectiveLocations(): Array { + return this.delimitedMany(TokenKind.PIPE, this.parseDirectiveLocation); + } + + /* + * DirectiveLocation : + * - ExecutableDirectiveLocation + * - TypeSystemDirectiveLocation + * + * ExecutableDirectiveLocation : one of + * `QUERY` + * `MUTATION` + * `SUBSCRIPTION` + * `FIELD` + * `FRAGMENT_DEFINITION` + * `FRAGMENT_SPREAD` + * `INLINE_FRAGMENT` + * + * TypeSystemDirectiveLocation : one of + * `SCHEMA` + * `SCALAR` + * `OBJECT` + * `FIELD_DEFINITION` + * `ARGUMENT_DEFINITION` + * `INTERFACE` + * `UNION` + * `ENUM` + * `ENUM_VALUE` + * `INPUT_OBJECT` + * `INPUT_FIELD_DEFINITION` + */ + parseDirectiveLocation(): NameNode { + const start = this._lexer.token; + const name = this.parseName(); + if (Object.prototype.hasOwnProperty.call(DirectiveLocation, name.value)) { + return name; + } + throw this.unexpected(start); + } + + // Core parsing utility functions + + /** + * Returns a node that, if configured to do so, sets a "loc" field as a + * location object, used to identify the place in the source that created a + * given parsed object. + */ + node(startToken: Token, node: T): T { + if (this._options?.noLocation !== true) { + node.loc = new Location( + startToken, + this._lexer.lastToken, + this._lexer.source, + ); + } + return node; + } + + /** + * Determines if the next token is of a given kind + */ + peek(kind: TokenKind): boolean { + return this._lexer.token.kind === kind; + } + + /** + * If the next token is of the given kind, return that token after advancing the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + expectToken(kind: TokenKind): Token { + const token = this._lexer.token; + if (token.kind === kind) { + this._lexer.advance(); + return token; + } + + throw syntaxError( + this._lexer.source, + token.start, + `Expected ${getTokenKindDesc(kind)}, found ${getTokenDesc(token)}.`, + ); + } + + /** + * If the next token is of the given kind, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + expectOptionalToken(kind: TokenKind): boolean { + const token = this._lexer.token; + if (token.kind === kind) { + this._lexer.advance(); + return true; + } + return false; + } + + /** + * If the next token is a given keyword, advance the lexer. + * Otherwise, do not change the parser state and throw an error. + */ + expectKeyword(value: string): void { + const token = this._lexer.token; + if (token.kind === TokenKind.NAME && token.value === value) { + this._lexer.advance(); + } else { + throw syntaxError( + this._lexer.source, + token.start, + `Expected "${value}", found ${getTokenDesc(token)}.`, + ); + } + } + + /** + * If the next token is a given keyword, return "true" after advancing the lexer. + * Otherwise, do not change the parser state and return "false". + */ + expectOptionalKeyword(value: string): boolean { + const token = this._lexer.token; + if (token.kind === TokenKind.NAME && token.value === value) { + this._lexer.advance(); + return true; + } + return false; + } + + /** + * Helper function for creating an error when an unexpected lexed token is encountered. + */ + unexpected(atToken?: Maybe): GraphQLError { + const token = atToken ?? this._lexer.token; + return syntaxError( + this._lexer.source, + token.start, + `Unexpected ${getTokenDesc(token)}.`, + ); + } + + /** + * Returns a possibly empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + any( + openKind: TokenKind, + parseFn: () => T, + closeKind: TokenKind, + ): Array { + this.expectToken(openKind); + const nodes = []; + while (!this.expectOptionalToken(closeKind)) { + nodes.push(parseFn.call(this)); + } + return nodes; + } + + /** + * Returns a list of parse nodes, determined by the parseFn. + * It can be empty only if open token is missing otherwise it will always return non-empty list + * that begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + optionalMany( + openKind: TokenKind, + parseFn: () => T, + closeKind: TokenKind, + ): Array { + if (this.expectOptionalToken(openKind)) { + const nodes = []; + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + return nodes; + } + return []; + } + + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list begins with a lex token of openKind and ends with a lex token of closeKind. + * Advances the parser to the next lex token after the closing token. + */ + many( + openKind: TokenKind, + parseFn: () => T, + closeKind: TokenKind, + ): Array { + this.expectToken(openKind); + const nodes = []; + do { + nodes.push(parseFn.call(this)); + } while (!this.expectOptionalToken(closeKind)); + return nodes; + } + + /** + * Returns a non-empty list of parse nodes, determined by the parseFn. + * This list may begin with a lex token of delimiterKind followed by items separated by lex tokens of tokenKind. + * Advances the parser to the next lex token after last item in the list. + */ + delimitedMany(delimiterKind: TokenKind, parseFn: () => T): Array { + this.expectOptionalToken(delimiterKind); + + const nodes = []; + do { + nodes.push(parseFn.call(this)); + } while (this.expectOptionalToken(delimiterKind)); + return nodes; + } +} + +/** + * A helper function to describe a token as a string for debugging. + */ +function getTokenDesc(token: Token): string { + const value = token.value; + return getTokenKindDesc(token.kind) + (value != null ? ` "${value}"` : ''); +} + +/** + * A helper function to describe a token kind as a string for debugging. + */ +function getTokenKindDesc(kind: TokenKind): string { + return isPunctuatorTokenKind(kind) ? `"${kind}"` : kind; +} diff --git a/src/language/predicates.ts b/src/language/predicates.ts new file mode 100644 index 00000000..a390f4ee --- /dev/null +++ b/src/language/predicates.ts @@ -0,0 +1,112 @@ +import type { + ASTNode, + ConstValueNode, + DefinitionNode, + ExecutableDefinitionNode, + SelectionNode, + TypeDefinitionNode, + TypeExtensionNode, + TypeNode, + TypeSystemDefinitionNode, + TypeSystemExtensionNode, + ValueNode, +} from './ast'; +import { Kind } from './kinds'; + +export function isDefinitionNode(node: ASTNode): node is DefinitionNode { + return ( + isExecutableDefinitionNode(node) || + isTypeSystemDefinitionNode(node) || + isTypeSystemExtensionNode(node) + ); +} + +export function isExecutableDefinitionNode( + node: ASTNode, +): node is ExecutableDefinitionNode { + return ( + node.kind === Kind.OPERATION_DEFINITION || + node.kind === Kind.FRAGMENT_DEFINITION + ); +} + +export function isSelectionNode(node: ASTNode): node is SelectionNode { + return ( + node.kind === Kind.FIELD || + node.kind === Kind.FRAGMENT_SPREAD || + node.kind === Kind.INLINE_FRAGMENT + ); +} + +export function isValueNode(node: ASTNode): node is ValueNode { + return ( + node.kind === Kind.VARIABLE || + node.kind === Kind.INT || + node.kind === Kind.FLOAT || + node.kind === Kind.STRING || + node.kind === Kind.BOOLEAN || + node.kind === Kind.NULL || + node.kind === Kind.ENUM || + node.kind === Kind.LIST || + node.kind === Kind.OBJECT + ); +} + +export function isConstValueNode(node: ASTNode): node is ConstValueNode { + return ( + isValueNode(node) && + (node.kind === Kind.LIST + ? node.values.some(isConstValueNode) + : node.kind === Kind.OBJECT + ? node.fields.some((field) => isConstValueNode(field.value)) + : node.kind !== Kind.VARIABLE) + ); +} + +export function isTypeNode(node: ASTNode): node is TypeNode { + return ( + node.kind === Kind.NAMED_TYPE || + node.kind === Kind.LIST_TYPE || + node.kind === Kind.NON_NULL_TYPE + ); +} + +export function isTypeSystemDefinitionNode( + node: ASTNode, +): node is TypeSystemDefinitionNode { + return ( + node.kind === Kind.SCHEMA_DEFINITION || + isTypeDefinitionNode(node) || + node.kind === Kind.DIRECTIVE_DEFINITION + ); +} + +export function isTypeDefinitionNode( + node: ASTNode, +): node is TypeDefinitionNode { + return ( + node.kind === Kind.SCALAR_TYPE_DEFINITION || + node.kind === Kind.OBJECT_TYPE_DEFINITION || + node.kind === Kind.INTERFACE_TYPE_DEFINITION || + node.kind === Kind.UNION_TYPE_DEFINITION || + node.kind === Kind.ENUM_TYPE_DEFINITION || + node.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION + ); +} + +export function isTypeSystemExtensionNode( + node: ASTNode, +): node is TypeSystemExtensionNode { + return node.kind === Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node); +} + +export function isTypeExtensionNode(node: ASTNode): node is TypeExtensionNode { + return ( + node.kind === Kind.SCALAR_TYPE_EXTENSION || + node.kind === Kind.OBJECT_TYPE_EXTENSION || + node.kind === Kind.INTERFACE_TYPE_EXTENSION || + node.kind === Kind.UNION_TYPE_EXTENSION || + node.kind === Kind.ENUM_TYPE_EXTENSION || + node.kind === Kind.INPUT_OBJECT_TYPE_EXTENSION + ); +} diff --git a/src/language/printLocation.ts b/src/language/printLocation.ts new file mode 100644 index 00000000..3d44f5ce --- /dev/null +++ b/src/language/printLocation.ts @@ -0,0 +1,80 @@ +import type { Location } from './ast'; +import type { SourceLocation } from './location'; +import { getLocation } from './location'; +import type { Source } from './source'; + +/** + * Render a helpful description of the location in the GraphQL Source document. + */ +export function printLocation(location: Location): string { + return printSourceLocation( + location.source, + getLocation(location.source, location.start), + ); +} + +/** + * Render a helpful description of the location in the GraphQL Source document. + */ +export function printSourceLocation( + source: Source, + sourceLocation: SourceLocation, +): string { + const firstLineColumnOffset = source.locationOffset.column - 1; + const body = ''.padStart(firstLineColumnOffset) + source.body; + + const lineIndex = sourceLocation.line - 1; + const lineOffset = source.locationOffset.line - 1; + const lineNum = sourceLocation.line + lineOffset; + + const columnOffset = sourceLocation.line === 1 ? firstLineColumnOffset : 0; + const columnNum = sourceLocation.column + columnOffset; + const locationStr = `${source.name}:${lineNum}:${columnNum}\n`; + + const lines = body.split(/\r\n|[\n\r]/g); + const locationLine = lines[lineIndex]; + + // Special case for minified documents + if (locationLine.length > 120) { + const subLineIndex = Math.floor(columnNum / 80); + const subLineColumnNum = columnNum % 80; + const subLines: Array = []; + for (let i = 0; i < locationLine.length; i += 80) { + subLines.push(locationLine.slice(i, i + 80)); + } + + return ( + locationStr + + printPrefixedLines([ + [`${lineNum} |`, subLines[0]], + ...subLines + .slice(1, subLineIndex + 1) + .map((subLine) => ['|', subLine] as const), + ['|', '^'.padStart(subLineColumnNum)], + ['|', subLines[subLineIndex + 1]], + ]) + ); + } + + return ( + locationStr + + printPrefixedLines([ + // Lines specified like this: ["prefix", "string"], + [`${lineNum - 1} |`, lines[lineIndex - 1]], + [`${lineNum} |`, locationLine], + ['|', '^'.padStart(columnNum)], + [`${lineNum + 1} |`, lines[lineIndex + 1]], + ]) + ); +} + +function printPrefixedLines( + lines: ReadonlyArray, +): string { + const existingLines = lines.filter(([_, line]) => line !== undefined); + + const padLen = Math.max(...existingLines.map(([prefix]) => prefix.length)); + return existingLines + .map(([prefix, line]) => prefix.padStart(padLen) + (line ? ' ' + line : '')) + .join('\n'); +} diff --git a/src/language/printString.ts b/src/language/printString.ts new file mode 100644 index 00000000..b091bcc2 --- /dev/null +++ b/src/language/printString.ts @@ -0,0 +1,38 @@ +/** + * Prints a string as a GraphQL StringValue literal. Replaces control characters + * and excluded characters (" U+0022 and \\ U+005C) with escape sequences. + */ +export function printString(str: string): string { + return `"${str.replace(escapedRegExp, escapedReplacer)}"`; +} + +// eslint-disable-next-line no-control-regex +const escapedRegExp = /[\x00-\x1f\x22\x5c\x7f-\x9f]/g; + +function escapedReplacer(str: string): string { + return escapeSequences[str.charCodeAt(0)]; +} + +// prettier-ignore +const escapeSequences = [ + '\\u0000', '\\u0001', '\\u0002', '\\u0003', '\\u0004', '\\u0005', '\\u0006', '\\u0007', + '\\b', '\\t', '\\n', '\\u000B', '\\f', '\\r', '\\u000E', '\\u000F', + '\\u0010', '\\u0011', '\\u0012', '\\u0013', '\\u0014', '\\u0015', '\\u0016', '\\u0017', + '\\u0018', '\\u0019', '\\u001A', '\\u001B', '\\u001C', '\\u001D', '\\u001E', '\\u001F', + '', '', '\\"', '', '', '', '', '', + '', '', '', '', '', '', '', '', // 2F + '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', // 3F + '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', // 4F + '', '', '', '', '', '', '', '', + '', '', '', '', '\\\\', '', '', '', // 5F + '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '', // 6F + '', '', '', '', '', '', '', '', + '', '', '', '', '', '', '', '\\u007F', + '\\u0080', '\\u0081', '\\u0082', '\\u0083', '\\u0084', '\\u0085', '\\u0086', '\\u0087', + '\\u0088', '\\u0089', '\\u008A', '\\u008B', '\\u008C', '\\u008D', '\\u008E', '\\u008F', + '\\u0090', '\\u0091', '\\u0092', '\\u0093', '\\u0094', '\\u0095', '\\u0096', '\\u0097', + '\\u0098', '\\u0099', '\\u009A', '\\u009B', '\\u009C', '\\u009D', '\\u009E', '\\u009F', +]; diff --git a/src/language/printer.ts b/src/language/printer.ts new file mode 100644 index 00000000..e95c118d --- /dev/null +++ b/src/language/printer.ts @@ -0,0 +1,347 @@ +import type { Maybe } from '../jsutils/Maybe'; + +import type { ASTNode } from './ast'; +import { printBlockString } from './blockString'; +import { printString } from './printString'; +import type { ASTReducer } from './visitor'; +import { visit } from './visitor'; + +/** + * Converts an AST into a string, using one set of reasonable + * formatting rules. + */ +export function print(ast: ASTNode): string { + return visit(ast, printDocASTReducer); +} + +const MAX_LINE_LENGTH = 80; + +const printDocASTReducer: ASTReducer = { + Name: { leave: (node) => node.value }, + Variable: { leave: (node) => '$' + node.name }, + + // Document + + Document: { + leave: (node) => join(node.definitions, '\n\n'), + }, + + OperationDefinition: { + leave(node) { + const varDefs = wrap('(', join(node.variableDefinitions, ', '), ')'); + const prefix = join( + [ + node.operation, + join([node.name, varDefs]), + join(node.directives, ' '), + ], + ' ', + ); + + // Anonymous queries with no directives or variable definitions can use + // the query short form. + return (prefix === 'query' ? '' : prefix + ' ') + node.selectionSet; + }, + }, + + VariableDefinition: { + leave: ({ variable, type, defaultValue, directives }) => + variable + + ': ' + + type + + wrap(' = ', defaultValue) + + wrap(' ', join(directives, ' ')), + }, + SelectionSet: { leave: ({ selections }) => block(selections) }, + + Field: { + leave({ alias, name, arguments: args, directives, selectionSet }) { + const prefix = wrap('', alias, ': ') + name; + let argsLine = prefix + wrap('(', join(args, ', '), ')'); + + if (argsLine.length > MAX_LINE_LENGTH) { + argsLine = prefix + wrap('(\n', indent(join(args, '\n')), '\n)'); + } + + return join([argsLine, join(directives, ' '), selectionSet], ' '); + }, + }, + + Argument: { leave: ({ name, value }) => name + ': ' + value }, + + // Fragments + + FragmentSpread: { + leave: ({ name, directives }) => + '...' + name + wrap(' ', join(directives, ' ')), + }, + + InlineFragment: { + leave: ({ typeCondition, directives, selectionSet }) => + join( + [ + '...', + wrap('on ', typeCondition), + join(directives, ' '), + selectionSet, + ], + ' ', + ), + }, + + FragmentDefinition: { + leave: ({ + name, + typeCondition, + variableDefinitions, + directives, + selectionSet, + }) => + // Note: fragment variable definitions are experimental and may be changed + // or removed in the future. + `fragment ${name}${wrap('(', join(variableDefinitions, ', '), ')')} ` + + `on ${typeCondition} ${wrap('', join(directives, ' '), ' ')}` + + selectionSet, + }, + + // Value + + IntValue: { leave: ({ value }) => value }, + FloatValue: { leave: ({ value }) => value }, + StringValue: { + leave: ({ value, block: isBlockString }) => + isBlockString ? printBlockString(value) : printString(value), + }, + BooleanValue: { leave: ({ value }) => (value ? 'true' : 'false') }, + NullValue: { leave: () => 'null' }, + EnumValue: { leave: ({ value }) => value }, + ListValue: { leave: ({ values }) => '[' + join(values, ', ') + ']' }, + ObjectValue: { leave: ({ fields }) => '{' + join(fields, ', ') + '}' }, + ObjectField: { leave: ({ name, value }) => name + ': ' + value }, + + // Directive + + Directive: { + leave: ({ name, arguments: args }) => + '@' + name + wrap('(', join(args, ', '), ')'), + }, + + // Type + + NamedType: { leave: ({ name }) => name }, + ListType: { leave: ({ type }) => '[' + type + ']' }, + NonNullType: { leave: ({ type }) => type + '!' }, + + // Type System Definitions + + SchemaDefinition: { + leave: ({ description, directives, operationTypes }) => + wrap('', description, '\n') + + join(['schema', join(directives, ' '), block(operationTypes)], ' '), + }, + + OperationTypeDefinition: { + leave: ({ operation, type }) => operation + ': ' + type, + }, + + ScalarTypeDefinition: { + leave: ({ description, name, directives }) => + wrap('', description, '\n') + + join(['scalar', name, join(directives, ' ')], ' '), + }, + + ObjectTypeDefinition: { + leave: ({ description, name, interfaces, directives, fields }) => + wrap('', description, '\n') + + join( + [ + 'type', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + + FieldDefinition: { + leave: ({ description, name, arguments: args, type, directives }) => + wrap('', description, '\n') + + name + + (hasMultilineItems(args) + ? wrap('(\n', indent(join(args, '\n')), '\n)') + : wrap('(', join(args, ', '), ')')) + + ': ' + + type + + wrap(' ', join(directives, ' ')), + }, + + InputValueDefinition: { + leave: ({ description, name, type, defaultValue, directives }) => + wrap('', description, '\n') + + join( + [name + ': ' + type, wrap('= ', defaultValue), join(directives, ' ')], + ' ', + ), + }, + + InterfaceTypeDefinition: { + leave: ({ description, name, interfaces, directives, fields }) => + wrap('', description, '\n') + + join( + [ + 'interface', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + + UnionTypeDefinition: { + leave: ({ description, name, directives, types }) => + wrap('', description, '\n') + + join( + ['union', name, join(directives, ' '), wrap('= ', join(types, ' | '))], + ' ', + ), + }, + + EnumTypeDefinition: { + leave: ({ description, name, directives, values }) => + wrap('', description, '\n') + + join(['enum', name, join(directives, ' '), block(values)], ' '), + }, + + EnumValueDefinition: { + leave: ({ description, name, directives }) => + wrap('', description, '\n') + join([name, join(directives, ' ')], ' '), + }, + + InputObjectTypeDefinition: { + leave: ({ description, name, directives, fields }) => + wrap('', description, '\n') + + join(['input', name, join(directives, ' '), block(fields)], ' '), + }, + + DirectiveDefinition: { + leave: ({ description, name, arguments: args, repeatable, locations }) => + wrap('', description, '\n') + + 'directive @' + + name + + (hasMultilineItems(args) + ? wrap('(\n', indent(join(args, '\n')), '\n)') + : wrap('(', join(args, ', '), ')')) + + (repeatable ? ' repeatable' : '') + + ' on ' + + join(locations, ' | '), + }, + + SchemaExtension: { + leave: ({ directives, operationTypes }) => + join( + ['extend schema', join(directives, ' '), block(operationTypes)], + ' ', + ), + }, + + ScalarTypeExtension: { + leave: ({ name, directives }) => + join(['extend scalar', name, join(directives, ' ')], ' '), + }, + + ObjectTypeExtension: { + leave: ({ name, interfaces, directives, fields }) => + join( + [ + 'extend type', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + + InterfaceTypeExtension: { + leave: ({ name, interfaces, directives, fields }) => + join( + [ + 'extend interface', + name, + wrap('implements ', join(interfaces, ' & ')), + join(directives, ' '), + block(fields), + ], + ' ', + ), + }, + + UnionTypeExtension: { + leave: ({ name, directives, types }) => + join( + [ + 'extend union', + name, + join(directives, ' '), + wrap('= ', join(types, ' | ')), + ], + ' ', + ), + }, + + EnumTypeExtension: { + leave: ({ name, directives, values }) => + join(['extend enum', name, join(directives, ' '), block(values)], ' '), + }, + + InputObjectTypeExtension: { + leave: ({ name, directives, fields }) => + join(['extend input', name, join(directives, ' '), block(fields)], ' '), + }, +}; + +/** + * Given maybeArray, print an empty string if it is null or empty, otherwise + * print all items together separated by separator if provided + */ +function join( + maybeArray: Maybe>, + separator = '', +): string { + return maybeArray?.filter((x) => x).join(separator) ?? ''; +} + +/** + * Given array, print each item on its own line, wrapped in an indented `{ }` block. + */ +function block(array: Maybe>): string { + return wrap('{\n', indent(join(array, '\n')), '\n}'); +} + +/** + * If maybeString is not null or empty, then wrap with start and end, otherwise print an empty string. + */ +function wrap( + start: string, + maybeString: Maybe, + end: string = '', +): string { + return maybeString != null && maybeString !== '' + ? start + maybeString + end + : ''; +} + +function indent(str: string): string { + return wrap(' ', str.replace(/\n/g, '\n ')); +} + +function hasMultilineItems(maybeArray: Maybe>): boolean { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + return maybeArray?.some((str) => str.includes('\n')) ?? false; +} diff --git a/src/language/source.ts b/src/language/source.ts new file mode 100644 index 00000000..15f65fce --- /dev/null +++ b/src/language/source.ts @@ -0,0 +1,57 @@ +import { devAssert } from '../jsutils/devAssert'; +import { inspect } from '../jsutils/inspect'; +import { instanceOf } from '../jsutils/instanceOf'; + +interface Location { + line: number; + column: number; +} + +/** + * A representation of source input to GraphQL. The `name` and `locationOffset` parameters are + * optional, but they are useful for clients who store GraphQL documents in source files. + * For example, if the GraphQL input starts at line 40 in a file named `Foo.graphql`, it might + * be useful for `name` to be `"Foo.graphql"` and location to be `{ line: 40, column: 1 }`. + * The `line` and `column` properties in `locationOffset` are 1-indexed. + */ +export class Source { + body: string; + name: string; + locationOffset: Location; + + constructor( + body: string, + name: string = 'GraphQL request', + locationOffset: Location = { line: 1, column: 1 }, + ) { + devAssert( + typeof body === 'string', + `Body must be a string. Received: ${inspect(body)}.`, + ); + + this.body = body; + this.name = name; + this.locationOffset = locationOffset; + devAssert( + this.locationOffset.line > 0, + 'line in locationOffset is 1-indexed and must be positive.', + ); + devAssert( + this.locationOffset.column > 0, + 'column in locationOffset is 1-indexed and must be positive.', + ); + } + + get [Symbol.toStringTag]() { + return 'Source'; + } +} + +/** + * Test if the given value is a Source object. + * + * @internal + */ +export function isSource(source: unknown): source is Source { + return instanceOf(source, Source); +} diff --git a/src/language/tokenKind.ts b/src/language/tokenKind.ts new file mode 100644 index 00000000..4878d697 --- /dev/null +++ b/src/language/tokenKind.ts @@ -0,0 +1,35 @@ +/** + * An exported enum describing the different kinds of tokens that the + * lexer emits. + */ +export enum TokenKind { + SOF = '', + EOF = '', + BANG = '!', + DOLLAR = '$', + AMP = '&', + PAREN_L = '(', + PAREN_R = ')', + SPREAD = '...', + COLON = ':', + EQUALS = '=', + AT = '@', + BRACKET_L = '[', + BRACKET_R = ']', + BRACE_L = '{', + PIPE = '|', + BRACE_R = '}', + NAME = 'Name', + INT = 'Int', + FLOAT = 'Float', + STRING = 'String', + BLOCK_STRING = 'BlockString', + COMMENT = 'Comment', +} + +/** + * The enum type representing the token kinds values. + * + * @deprecated Please use `TokenKind`. Will be remove in v17. + */ +export type TokenKindEnum = typeof TokenKind; diff --git a/src/language/visitor.ts b/src/language/visitor.ts new file mode 100644 index 00000000..821c9cb3 --- /dev/null +++ b/src/language/visitor.ts @@ -0,0 +1,414 @@ +import { devAssert } from '../jsutils/devAssert'; +import { inspect } from '../jsutils/inspect'; + +import type { ASTNode } from './ast'; +import { isNode, QueryDocumentKeys } from './ast'; +import { Kind } from './kinds'; + +/** + * A visitor is provided to visit, it contains the collection of + * relevant functions to be called during the visitor's traversal. + */ +export type ASTVisitor = EnterLeaveVisitor | KindVisitor; + +type KindVisitor = { + readonly [NodeT in ASTNode as NodeT['kind']]?: + | ASTVisitFn + | EnterLeaveVisitor; +}; + +interface EnterLeaveVisitor { + readonly enter?: ASTVisitFn; + readonly leave?: ASTVisitFn; +} + +/** + * A visitor is comprised of visit functions, which are called on each node + * during the visitor's traversal. + */ +export type ASTVisitFn = ( + /** The current node being visiting. */ + node: TVisitedNode, + /** The index or key to this node from the parent node or Array. */ + key: string | number | undefined, + /** The parent immediately above this node, which may be an Array. */ + parent: ASTNode | ReadonlyArray | undefined, + /** The key path to get to this node from the root node. */ + path: ReadonlyArray, + /** + * All nodes and Arrays visited before reaching parent of this node. + * These correspond to array indices in `path`. + * Note: ancestors includes arrays which contain the parent of visited node. + */ + ancestors: ReadonlyArray>, +) => any; + +/** + * A reducer is comprised of reducer functions which convert AST nodes into + * another form. + */ +export type ASTReducer = { + readonly [NodeT in ASTNode as NodeT['kind']]?: { + readonly enter?: ASTVisitFn; + readonly leave: ASTReducerFn; + }; +}; + +type ASTReducerFn = ( + /** The current node being visiting. */ + node: { [K in keyof TReducedNode]: ReducedField }, + /** The index or key to this node from the parent node or Array. */ + key: string | number | undefined, + /** The parent immediately above this node, which may be an Array. */ + parent: ASTNode | ReadonlyArray | undefined, + /** The key path to get to this node from the root node. */ + path: ReadonlyArray, + /** + * All nodes and Arrays visited before reaching parent of this node. + * These correspond to array indices in `path`. + * Note: ancestors includes arrays which contain the parent of visited node. + */ + ancestors: ReadonlyArray>, +) => R; + +type ReducedField = T extends null | undefined + ? T + : T extends ReadonlyArray + ? ReadonlyArray + : R; + +/** + * A KeyMap describes each the traversable properties of each kind of node. + * + * @deprecated Please inline it. Will be removed in v17 + */ +export type ASTVisitorKeyMap = { + [NodeT in ASTNode as NodeT['kind']]?: ReadonlyArray; +}; + +export const BREAK: unknown = Object.freeze({}); + +/** + * visit() will walk through an AST using a depth-first traversal, calling + * the visitor's enter function at each node in the traversal, and calling the + * leave function after visiting that node and all of its child nodes. + * + * By returning different values from the enter and leave functions, the + * behavior of the visitor can be altered, including skipping over a sub-tree of + * the AST (by returning false), editing the AST by returning a value or null + * to remove the value, or to stop the whole traversal by returning BREAK. + * + * When using visit() to edit an AST, the original AST will not be modified, and + * a new version of the AST with the changes applied will be returned from the + * visit function. + * + * ```ts + * const editedAST = visit(ast, { + * enter(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: skip visiting this node + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * }, + * leave(node, key, parent, path, ancestors) { + * // @return + * // undefined: no action + * // false: no action + * // visitor.BREAK: stop visiting altogether + * // null: delete this node + * // any value: replace this node with the returned value + * } + * }); + * ``` + * + * Alternatively to providing enter() and leave() functions, a visitor can + * instead provide functions named the same as the kinds of AST nodes, or + * enter/leave visitors at a named key, leading to three permutations of the + * visitor API: + * + * 1) Named visitors triggered when entering a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind(node) { + * // enter the "Kind" node + * } + * }) + * ``` + * + * 2) Named visitors that trigger upon entering and leaving a node of a specific kind. + * + * ```ts + * visit(ast, { + * Kind: { + * enter(node) { + * // enter the "Kind" node + * } + * leave(node) { + * // leave the "Kind" node + * } + * } + * }) + * ``` + * + * 3) Generic visitors that trigger upon entering and leaving any node. + * + * ```ts + * visit(ast, { + * enter(node) { + * // enter any node + * }, + * leave(node) { + * // leave any node + * } + * }) + * ``` + */ +export function visit( + root: N, + visitor: ASTVisitor, + visitorKeys?: ASTVisitorKeyMap, +): N; +export function visit( + root: ASTNode, + visitor: ASTReducer, + visitorKeys?: ASTVisitorKeyMap, +): R; +export function visit( + root: ASTNode, + visitor: ASTVisitor | ASTReducer, + visitorKeys: ASTVisitorKeyMap = QueryDocumentKeys, +): any { + const enterLeaveMap = new Map>(); + for (const kind of Object.values(Kind)) { + enterLeaveMap.set(kind, getEnterLeaveForKind(visitor, kind)); + } + + /* eslint-disable no-undef-init */ + let stack: any = undefined; + let inArray = Array.isArray(root); + let keys: any = [root]; + let index = -1; + let edits = []; + let node: any = undefined; + let key: any = undefined; + let parent: any = undefined; + const path: any = []; + const ancestors = []; + let newRoot = root; + /* eslint-enable no-undef-init */ + + do { + index++; + const isLeaving = index === keys.length; + const isEdited = isLeaving && edits.length !== 0; + if (isLeaving) { + key = ancestors.length === 0 ? undefined : path[path.length - 1]; + node = parent; + parent = ancestors.pop(); + if (isEdited) { + if (inArray) { + node = node.slice(); + + let editOffset = 0; + for (const [editKey, editValue] of edits) { + const arrayKey = editKey - editOffset; + if (editValue === null) { + node.splice(arrayKey, 1); + editOffset++; + } else { + node[arrayKey] = editValue; + } + } + } else { + node = Object.defineProperties( + {}, + Object.getOwnPropertyDescriptors(node), + ); + for (const [editKey, editValue] of edits) { + node[editKey] = editValue; + } + } + } + index = stack.index; + keys = stack.keys; + edits = stack.edits; + inArray = stack.inArray; + stack = stack.prev; + } else { + key = parent ? (inArray ? index : keys[index]) : undefined; + node = parent ? parent[key] : newRoot; + if (node === null || node === undefined) { + continue; + } + if (parent) { + path.push(key); + } + } + + let result; + if (!Array.isArray(node)) { + devAssert(isNode(node), `Invalid AST Node: ${inspect(node)}.`); + + const visitFn = isLeaving + ? enterLeaveMap.get(node.kind)?.leave + : enterLeaveMap.get(node.kind)?.enter; + + result = visitFn?.call(visitor, node, key, parent, path, ancestors); + + if (result === BREAK) { + break; + } + + if (result === false) { + if (!isLeaving) { + path.pop(); + continue; + } + } else if (result !== undefined) { + edits.push([key, result]); + if (!isLeaving) { + if (isNode(result)) { + node = result; + } else { + path.pop(); + continue; + } + } + } + } + + if (result === undefined && isEdited) { + edits.push([key, node]); + } + + if (isLeaving) { + path.pop(); + } else { + stack = { inArray, index, keys, edits, prev: stack }; + inArray = Array.isArray(node); + keys = inArray ? node : (visitorKeys as any)[node.kind] ?? []; + index = -1; + edits = []; + if (parent) { + ancestors.push(parent); + } + parent = node; + } + } while (stack !== undefined); + + if (edits.length !== 0) { + newRoot = edits[edits.length - 1][1]; + } + + return newRoot; +} + +/** + * Creates a new visitor instance which delegates to many visitors to run in + * parallel. Each visitor will be visited for each node before moving on. + * + * If a prior visitor edits a node, no following visitors will see that node. + */ +export function visitInParallel( + visitors: ReadonlyArray, +): ASTVisitor { + const skipping = new Array(visitors.length).fill(null); + const mergedVisitor = Object.create(null); + + for (const kind of Object.values(Kind)) { + let hasVisitor = false; + const enterList = new Array(visitors.length).fill(undefined); + const leaveList = new Array(visitors.length).fill(undefined); + + for (let i = 0; i < visitors.length; ++i) { + const { enter, leave } = getEnterLeaveForKind(visitors[i], kind); + hasVisitor ||= enter != null || leave != null; + enterList[i] = enter; + leaveList[i] = leave; + } + + if (!hasVisitor) { + continue; + } + + const mergedEnterLeave: EnterLeaveVisitor = { + enter(...args) { + const node = args[0]; + for (let i = 0; i < visitors.length; i++) { + if (skipping[i] === null) { + const result = enterList[i]?.apply(visitors[i], args); + if (result === false) { + skipping[i] = node; + } else if (result === BREAK) { + skipping[i] = BREAK; + } else if (result !== undefined) { + return result; + } + } + } + }, + leave(...args) { + const node = args[0]; + for (let i = 0; i < visitors.length; i++) { + if (skipping[i] === null) { + const result = leaveList[i]?.apply(visitors[i], args); + if (result === BREAK) { + skipping[i] = BREAK; + } else if (result !== undefined && result !== false) { + return result; + } + } else if (skipping[i] === node) { + skipping[i] = null; + } + } + }, + }; + + mergedVisitor[kind] = mergedEnterLeave; + } + + return mergedVisitor; +} + +/** + * Given a visitor instance and a node kind, return EnterLeaveVisitor for that kind. + */ +export function getEnterLeaveForKind( + visitor: ASTVisitor, + kind: Kind, +): EnterLeaveVisitor { + const kindVisitor: + | ASTVisitFn + | EnterLeaveVisitor + | undefined = (visitor as any)[kind]; + + if (typeof kindVisitor === 'object') { + // { Kind: { enter() {}, leave() {} } } + return kindVisitor; + } else if (typeof kindVisitor === 'function') { + // { Kind() {} } + return { enter: kindVisitor, leave: undefined }; + } + + // { enter() {}, leave() {} } + return { enter: (visitor as any).enter, leave: (visitor as any).leave }; +} + +/** + * Given a visitor instance, if it is leaving or not, and a node kind, return + * the function the visitor runtime should call. + * + * @deprecated Please use `getEnterLeaveForKind` instead. Will be removed in v17 + */ +/* c8 ignore next 8 */ +export function getVisitFn( + visitor: ASTVisitor, + kind: Kind, + isLeaving: boolean, +): ASTVisitFn | undefined { + const { enter, leave } = getEnterLeaveForKind(visitor, kind); + return isLeaving ? leave : enter; +} diff --git a/src/subscription/README.md b/src/subscription/README.md new file mode 100644 index 00000000..7e099d2c --- /dev/null +++ b/src/subscription/README.md @@ -0,0 +1,10 @@ +## GraphQL Subscription + +NOTE: the `graphql/subscription` module has been deprecated with its exported functions integrated into the `graphql/execution` module, to better conform with the terminology of the GraphQL specification. For backwards compatibility, the `graphql/subscription` module currently re-exports the moved functions from the `graphql/execution` module. In the next major release, the `graphql/subscription` module will be dropped entirely. + +The `graphql/subscription` module is responsible for subscribing to updates on specific data. + +```js +import { subscribe, createSourceEventStream } from 'graphql/subscription'; // ES6 +var GraphQLSubscription = require('graphql/subscription'); // CommonJS +``` diff --git a/src/subscription/index.ts b/src/subscription/index.ts new file mode 100644 index 00000000..9de1b869 --- /dev/null +++ b/src/subscription/index.ts @@ -0,0 +1,23 @@ +/** + * NOTE: the `graphql/subscription` module has been deprecated with its + * exported functions integrated into the `graphql/execution` module, to + * better conform with the terminology of the GraphQL specification. + * + * For backwards compatibility, the `graphql/subscription` module + * currently re-exports the moved functions from the `graphql/execution` + * module. In the next major release, the `graphql/subscription` module + * will be dropped entirely. + */ + +import type { ExecutionArgs } from '../execution/execute'; + +/** + * @deprecated use ExecutionArgs instead. Will be removed in v17 + * + * ExecutionArgs has been broadened to include all properties within SubscriptionArgs. + * The SubscriptionArgs type is retained for backwards compatibility. + */ +// eslint-disable-next-line @typescript-eslint/no-empty-interface +export interface SubscriptionArgs extends ExecutionArgs {} + +export { subscribe, createSourceEventStream } from '../execution/subscribe'; diff --git a/src/type/README.md b/src/type/README.md new file mode 100644 index 00000000..1c03491a --- /dev/null +++ b/src/type/README.md @@ -0,0 +1,8 @@ +## GraphQL Type System + +The `graphql/type` module is responsible for defining GraphQL types and schema. + +```js +import { ... } from 'graphql/type'; // ES6 +var GraphQLType = require('graphql/type'); // CommonJS +``` diff --git a/src/type/__tests__/assertName-test.ts b/src/type/__tests__/assertName-test.ts new file mode 100644 index 00000000..268b1c6e --- /dev/null +++ b/src/type/__tests__/assertName-test.ts @@ -0,0 +1,69 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { assertEnumValueName, assertName } from '../assertName'; + +describe('assertName', () => { + it('passthrough valid name', () => { + expect(assertName('_ValidName123')).to.equal('_ValidName123'); + }); + + it('throws for non-strings', () => { + // @ts-expect-error + expect(() => assertName({})).to.throw('Expected name to be a string.'); + }); + + it('throws on empty strings', () => { + expect(() => assertName('')).to.throw( + 'Expected name to be a non-empty string.', + ); + }); + + it('throws for names with invalid characters', () => { + expect(() => assertName('>--()-->')).to.throw( + 'Names must only contain [_a-zA-Z0-9] but ">--()-->" does not.', + ); + }); + + it('throws for names starting with invalid characters', () => { + expect(() => assertName('42MeaningsOfLife')).to.throw( + 'Names must start with [_a-zA-Z] but "42MeaningsOfLife" does not.', + ); + }); +}); + +describe('assertEnumValueName', () => { + it('passthrough valid name', () => { + expect(assertEnumValueName('_ValidName123')).to.equal('_ValidName123'); + }); + + it('throws on empty strings', () => { + expect(() => assertEnumValueName('')).to.throw( + 'Expected name to be a non-empty string.', + ); + }); + + it('throws for names with invalid characters', () => { + expect(() => assertEnumValueName('>--()-->')).to.throw( + 'Names must only contain [_a-zA-Z0-9] but ">--()-->" does not.', + ); + }); + + it('throws for names starting with invalid characters', () => { + expect(() => assertEnumValueName('42MeaningsOfLife')).to.throw( + 'Names must start with [_a-zA-Z] but "42MeaningsOfLife" does not.', + ); + }); + + it('throws for restricted names', () => { + expect(() => assertEnumValueName('true')).to.throw( + 'Enum values cannot be named: true', + ); + expect(() => assertEnumValueName('false')).to.throw( + 'Enum values cannot be named: false', + ); + expect(() => assertEnumValueName('null')).to.throw( + 'Enum values cannot be named: null', + ); + }); +}); diff --git a/src/type/__tests__/definition-test.ts b/src/type/__tests__/definition-test.ts new file mode 100644 index 00000000..19d48291 --- /dev/null +++ b/src/type/__tests__/definition-test.ts @@ -0,0 +1,1009 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { identityFunc } from '../../jsutils/identityFunc'; +import { inspect } from '../../jsutils/inspect'; + +import { parseValue } from '../../language/parser'; + +import type { GraphQLNullableType, GraphQLType } from '../definition'; +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLScalarType, + GraphQLUnionType, +} from '../definition'; + +const ScalarType = new GraphQLScalarType({ name: 'Scalar' }); +const ObjectType = new GraphQLObjectType({ name: 'Object', fields: {} }); +const InterfaceType = new GraphQLInterfaceType({ + name: 'Interface', + fields: {}, +}); +const UnionType = new GraphQLUnionType({ name: 'Union', types: [ObjectType] }); +const EnumType = new GraphQLEnumType({ name: 'Enum', values: { foo: {} } }); +const InputObjectType = new GraphQLInputObjectType({ + name: 'InputObject', + fields: {}, +}); + +const ListOfScalarsType = new GraphQLList(ScalarType); +const NonNullScalarType = new GraphQLNonNull(ScalarType); +const ListOfNonNullScalarsType = new GraphQLList(NonNullScalarType); +const NonNullListOfScalars = new GraphQLNonNull(ListOfScalarsType); + +/* c8 ignore next */ +const dummyFunc = () => expect.fail('Never called and used as a placeholder'); + +describe('Type System: Scalars', () => { + it('accepts a Scalar type defining serialize', () => { + expect(() => new GraphQLScalarType({ name: 'SomeScalar' })).to.not.throw(); + }); + + it('accepts a Scalar type defining specifiedByURL', () => { + expect( + () => + new GraphQLScalarType({ + name: 'SomeScalar', + specifiedByURL: 'https://example.com/foo_spec', + }), + ).not.to.throw(); + }); + + it('accepts a Scalar type defining parseValue and parseLiteral', () => { + expect( + () => + new GraphQLScalarType({ + name: 'SomeScalar', + parseValue: dummyFunc, + parseLiteral: dummyFunc, + }), + ).to.not.throw(); + }); + + it('provides default methods if omitted', () => { + const scalar = new GraphQLScalarType({ name: 'Foo' }); + + expect(scalar.serialize).to.equal(identityFunc); + expect(scalar.parseValue).to.equal(identityFunc); + expect(scalar.parseLiteral).to.be.a('function'); + }); + + it('use parseValue for parsing literals if parseLiteral omitted', () => { + const scalar = new GraphQLScalarType({ + name: 'Foo', + parseValue(value) { + return 'parseValue: ' + inspect(value); + }, + }); + + expect(scalar.parseLiteral(parseValue('null'))).to.equal( + 'parseValue: null', + ); + expect(scalar.parseLiteral(parseValue('{ foo: "bar" }'))).to.equal( + 'parseValue: { foo: "bar" }', + ); + expect( + scalar.parseLiteral(parseValue('{ foo: { bar: $var } }'), { var: 'baz' }), + ).to.equal('parseValue: { foo: { bar: "baz" } }'); + }); + + it('rejects a Scalar type without name', () => { + // @ts-expect-error + expect(() => new GraphQLScalarType({})).to.throw('Must provide name.'); + }); + + it('rejects a Scalar type defining serialize with an incorrect type', () => { + expect( + () => + new GraphQLScalarType({ + name: 'SomeScalar', + // @ts-expect-error + serialize: {}, + }), + ).to.throw( + 'SomeScalar must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.', + ); + }); + + it('rejects a Scalar type defining parseLiteral but not parseValue', () => { + expect( + () => + new GraphQLScalarType({ + name: 'SomeScalar', + parseLiteral: dummyFunc, + }), + ).to.throw( + 'SomeScalar must provide both "parseValue" and "parseLiteral" functions.', + ); + }); + + it('rejects a Scalar type defining parseValue and parseLiteral with an incorrect type', () => { + expect( + () => + new GraphQLScalarType({ + name: 'SomeScalar', + // @ts-expect-error + parseValue: {}, + // @ts-expect-error + parseLiteral: {}, + }), + ).to.throw( + 'SomeScalar must provide both "parseValue" and "parseLiteral" functions.', + ); + }); + + it('rejects a Scalar type defining specifiedByURL with an incorrect type', () => { + expect( + () => + new GraphQLScalarType({ + name: 'SomeScalar', + // @ts-expect-error + specifiedByURL: {}, + }), + ).to.throw( + 'SomeScalar must provide "specifiedByURL" as a string, but got: {}.', + ); + }); +}); + +describe('Type System: Objects', () => { + it('does not mutate passed field definitions', () => { + const outputFields = { + field1: { type: ScalarType }, + field2: { + type: ScalarType, + args: { + id: { type: ScalarType }, + }, + }, + }; + const testObject1 = new GraphQLObjectType({ + name: 'Test1', + fields: outputFields, + }); + const testObject2 = new GraphQLObjectType({ + name: 'Test2', + fields: outputFields, + }); + + expect(testObject1.getFields()).to.deep.equal(testObject2.getFields()); + expect(outputFields).to.deep.equal({ + field1: { + type: ScalarType, + }, + field2: { + type: ScalarType, + args: { + id: { type: ScalarType }, + }, + }, + }); + + const inputFields = { + field1: { type: ScalarType }, + field2: { type: ScalarType }, + }; + const testInputObject1 = new GraphQLInputObjectType({ + name: 'Test1', + fields: inputFields, + }); + const testInputObject2 = new GraphQLInputObjectType({ + name: 'Test2', + fields: inputFields, + }); + + expect(testInputObject1.getFields()).to.deep.equal( + testInputObject2.getFields(), + ); + expect(inputFields).to.deep.equal({ + field1: { type: ScalarType }, + field2: { type: ScalarType }, + }); + }); + + it('defines an object type with deprecated field', () => { + const TypeWithDeprecatedField = new GraphQLObjectType({ + name: 'foo', + fields: { + bar: { + type: ScalarType, + deprecationReason: 'A terrible reason', + }, + baz: { + type: ScalarType, + deprecationReason: '', + }, + }, + }); + + expect(TypeWithDeprecatedField.getFields().bar).to.include({ + name: 'bar', + deprecationReason: 'A terrible reason', + }); + + expect(TypeWithDeprecatedField.getFields().baz).to.include({ + name: 'baz', + deprecationReason: '', + }); + }); + + it('accepts an Object type with a field function', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: () => ({ + f: { type: ScalarType }, + }), + }); + expect(objType.getFields()).to.deep.equal({ + f: { + name: 'f', + description: undefined, + type: ScalarType, + args: [], + resolve: undefined, + subscribe: undefined, + deprecationReason: undefined, + extensions: {}, + astNode: undefined, + }, + }); + }); + + it('accepts an Object type with field args', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: { + f: { + type: ScalarType, + args: { + arg: { type: ScalarType }, + }, + }, + }, + }); + expect(objType.getFields()).to.deep.equal({ + f: { + name: 'f', + description: undefined, + type: ScalarType, + args: [ + { + name: 'arg', + description: undefined, + type: ScalarType, + defaultValue: undefined, + deprecationReason: undefined, + extensions: {}, + astNode: undefined, + }, + ], + resolve: undefined, + subscribe: undefined, + deprecationReason: undefined, + extensions: {}, + astNode: undefined, + }, + }); + }); + + it('accepts an Object type with array interfaces', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: {}, + interfaces: [InterfaceType], + }); + expect(objType.getInterfaces()).to.deep.equal([InterfaceType]); + }); + + it('accepts an Object type with interfaces as a function returning an array', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: {}, + interfaces: () => [InterfaceType], + }); + expect(objType.getInterfaces()).to.deep.equal([InterfaceType]); + }); + + it('accepts a lambda as an Object field resolver', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: { + f: { + type: ScalarType, + resolve: dummyFunc, + }, + }, + }); + expect(() => objType.getFields()).to.not.throw(); + }); + + it('rejects an Object type with invalid name', () => { + expect( + () => new GraphQLObjectType({ name: 'bad-name', fields: {} }), + ).to.throw('Names must only contain [_a-zA-Z0-9] but "bad-name" does not.'); + }); + + it('rejects an Object type field with undefined config', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: { + // @ts-expect-error (must not be undefined) + f: undefined, + }, + }); + expect(() => objType.getFields()).to.throw( + 'SomeObject.f field config must be an object.', + ); + }); + + it('rejects an Object type with incorrectly typed fields', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + // @ts-expect-error + fields: [{ field: ScalarType }], + }); + expect(() => objType.getFields()).to.throw( + 'SomeObject fields must be an object with field names as keys or a function which returns such an object.', + ); + }); + + it('rejects an Object type with incorrectly named fields', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: { + 'bad-name': { type: ScalarType }, + }, + }); + expect(() => objType.getFields()).to.throw( + 'Names must only contain [_a-zA-Z0-9] but "bad-name" does not.', + ); + }); + + it('rejects an Object type with a field function that returns incorrect type', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + // @ts-expect-error (Wrong type of return) + fields() { + return [{ field: ScalarType }]; + }, + }); + expect(() => objType.getFields()).to.throw(); + }); + + it('rejects an Object type with incorrectly typed field args', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: { + badField: { + type: ScalarType, + // @ts-expect-error + args: [{ badArg: ScalarType }], + }, + }, + }); + expect(() => objType.getFields()).to.throw( + 'SomeObject.badField args must be an object with argument names as keys.', + ); + }); + + it('rejects an Object type with incorrectly named field args', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: { + badField: { + type: ScalarType, + args: { + 'bad-name': { type: ScalarType }, + }, + }, + }, + }); + expect(() => objType.getFields()).to.throw( + 'Names must only contain [_a-zA-Z0-9] but "bad-name" does not.', + ); + }); + + it('rejects an Object type with incorrectly typed interfaces', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: {}, + // @ts-expect-error + interfaces: {}, + }); + expect(() => objType.getInterfaces()).to.throw( + 'SomeObject interfaces must be an Array or a function which returns an Array.', + ); + }); + + it('rejects an Object type with interfaces as a function returning an incorrect type', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: {}, + // @ts-expect-error (Expected interfaces to return array) + interfaces() { + return {}; + }, + }); + expect(() => objType.getInterfaces()).to.throw( + 'SomeObject interfaces must be an Array or a function which returns an Array.', + ); + }); + + it('rejects an empty Object field resolver', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: { + // @ts-expect-error (Expected resolve to be a function) + field: { type: ScalarType, resolve: {} }, + }, + }); + + expect(() => objType.getFields()).to.throw( + 'SomeObject.field field resolver must be a function if provided, but got: {}.', + ); + }); + + it('rejects a constant scalar value resolver', () => { + const objType = new GraphQLObjectType({ + name: 'SomeObject', + fields: { + // @ts-expect-error (Expected resolve to be a function) + field: { type: ScalarType, resolve: 0 }, + }, + }); + + expect(() => objType.getFields()).to.throw( + 'SomeObject.field field resolver must be a function if provided, but got: 0.', + ); + }); + + it('rejects an Object type with an incorrect type for isTypeOf', () => { + expect( + () => + new GraphQLObjectType({ + name: 'AnotherObject', + fields: {}, + // @ts-expect-error + isTypeOf: {}, + }), + ).to.throw( + 'AnotherObject must provide "isTypeOf" as a function, but got: {}.', + ); + }); +}); + +describe('Type System: Interfaces', () => { + it('accepts an Interface type defining resolveType', () => { + expect( + () => + new GraphQLInterfaceType({ + name: 'AnotherInterface', + fields: { f: { type: ScalarType } }, + }), + ).to.not.throw(); + }); + + it('accepts an Interface type with an array of interfaces', () => { + const implementing = new GraphQLInterfaceType({ + name: 'AnotherInterface', + fields: {}, + interfaces: [InterfaceType], + }); + expect(implementing.getInterfaces()).to.deep.equal([InterfaceType]); + }); + + it('accepts an Interface type with interfaces as a function returning an array', () => { + const implementing = new GraphQLInterfaceType({ + name: 'AnotherInterface', + fields: {}, + interfaces: () => [InterfaceType], + }); + expect(implementing.getInterfaces()).to.deep.equal([InterfaceType]); + }); + + it('rejects an Interface type with invalid name', () => { + expect( + () => new GraphQLInterfaceType({ name: 'bad-name', fields: {} }), + ).to.throw('Names must only contain [_a-zA-Z0-9] but "bad-name" does not.'); + }); + + it('rejects an Interface type with incorrectly typed interfaces', () => { + const objType = new GraphQLInterfaceType({ + name: 'AnotherInterface', + fields: {}, + // @ts-expect-error + interfaces: {}, + }); + expect(() => objType.getInterfaces()).to.throw( + 'AnotherInterface interfaces must be an Array or a function which returns an Array.', + ); + }); + + it('rejects an Interface type with interfaces as a function returning an incorrect type', () => { + const objType = new GraphQLInterfaceType({ + name: 'AnotherInterface', + fields: {}, + // @ts-expect-error (Expected Array return) + interfaces() { + return {}; + }, + }); + expect(() => objType.getInterfaces()).to.throw( + 'AnotherInterface interfaces must be an Array or a function which returns an Array.', + ); + }); + + it('rejects an Interface type with an incorrect type for resolveType', () => { + expect( + () => + new GraphQLInterfaceType({ + name: 'AnotherInterface', + fields: {}, + // @ts-expect-error + resolveType: {}, + }), + ).to.throw( + 'AnotherInterface must provide "resolveType" as a function, but got: {}.', + ); + }); +}); + +describe('Type System: Unions', () => { + it('accepts a Union type defining resolveType', () => { + expect( + () => + new GraphQLUnionType({ + name: 'SomeUnion', + types: [ObjectType], + }), + ).to.not.throw(); + }); + + it('accepts a Union type with array types', () => { + const unionType = new GraphQLUnionType({ + name: 'SomeUnion', + types: [ObjectType], + }); + expect(unionType.getTypes()).to.deep.equal([ObjectType]); + }); + + it('accepts a Union type with function returning an array of types', () => { + const unionType = new GraphQLUnionType({ + name: 'SomeUnion', + types: () => [ObjectType], + }); + expect(unionType.getTypes()).to.deep.equal([ObjectType]); + }); + + it('accepts a Union type without types', () => { + const unionType = new GraphQLUnionType({ + name: 'SomeUnion', + types: [], + }); + expect(unionType.getTypes()).to.deep.equal([]); + }); + + it('rejects an Union type with invalid name', () => { + expect( + () => new GraphQLUnionType({ name: 'bad-name', types: [] }), + ).to.throw('Names must only contain [_a-zA-Z0-9] but "bad-name" does not.'); + }); + + it('rejects an Union type with an incorrect type for resolveType', () => { + expect( + () => + new GraphQLUnionType({ + name: 'SomeUnion', + types: [], + // @ts-expect-error + resolveType: {}, + }), + ).to.throw( + 'SomeUnion must provide "resolveType" as a function, but got: {}.', + ); + }); + + it('rejects a Union type with incorrectly typed types', () => { + const unionType = new GraphQLUnionType({ + name: 'SomeUnion', + // @ts-expect-error + types: { ObjectType }, + }); + + expect(() => unionType.getTypes()).to.throw( + 'Must provide Array of types or a function which returns such an array for Union SomeUnion.', + ); + }); +}); + +describe('Type System: Enums', () => { + it('defines an enum type with deprecated value', () => { + const EnumTypeWithDeprecatedValue = new GraphQLEnumType({ + name: 'EnumWithDeprecatedValue', + values: { + foo: { deprecationReason: 'Just because' }, + bar: { deprecationReason: '' }, + }, + }); + + expect(EnumTypeWithDeprecatedValue.getValues()[0]).to.include({ + name: 'foo', + deprecationReason: 'Just because', + }); + + expect(EnumTypeWithDeprecatedValue.getValues()[1]).to.include({ + name: 'bar', + deprecationReason: '', + }); + }); + + it('defines an enum type with a value of `null` and `undefined`', () => { + const EnumTypeWithNullishValue = new GraphQLEnumType({ + name: 'EnumWithNullishValue', + values: { + NULL: { value: null }, + NAN: { value: NaN }, + NO_CUSTOM_VALUE: { value: undefined }, + }, + }); + + expect(EnumTypeWithNullishValue.getValues()).to.deep.equal([ + { + name: 'NULL', + description: undefined, + value: null, + deprecationReason: undefined, + extensions: {}, + astNode: undefined, + }, + { + name: 'NAN', + description: undefined, + value: NaN, + deprecationReason: undefined, + extensions: {}, + astNode: undefined, + }, + { + name: 'NO_CUSTOM_VALUE', + description: undefined, + value: 'NO_CUSTOM_VALUE', + deprecationReason: undefined, + extensions: {}, + astNode: undefined, + }, + ]); + }); + + it('accepts a well defined Enum type with empty value definition', () => { + const enumType = new GraphQLEnumType({ + name: 'SomeEnum', + values: { + FOO: {}, + BAR: {}, + }, + }); + expect(enumType.getValue('FOO')).has.property('value', 'FOO'); + expect(enumType.getValue('BAR')).has.property('value', 'BAR'); + }); + + it('accepts a well defined Enum type with internal value definition', () => { + const enumType = new GraphQLEnumType({ + name: 'SomeEnum', + values: { + FOO: { value: 10 }, + BAR: { value: 20 }, + }, + }); + expect(enumType.getValue('FOO')).has.property('value', 10); + expect(enumType.getValue('BAR')).has.property('value', 20); + }); + + it('rejects an Enum type with invalid name', () => { + expect( + () => new GraphQLEnumType({ name: 'bad-name', values: {} }), + ).to.throw('Names must only contain [_a-zA-Z0-9] but "bad-name" does not.'); + }); + + it('rejects an Enum type with incorrectly typed values', () => { + expect( + () => + new GraphQLEnumType({ + name: 'SomeEnum', + // @ts-expect-error + values: [{ FOO: 10 }], + }), + ).to.throw('SomeEnum values must be an object with value names as keys.'); + }); + + it('rejects an Enum type with incorrectly named values', () => { + expect( + () => + new GraphQLEnumType({ + name: 'SomeEnum', + values: { + 'bad-name': {}, + }, + }), + ).to.throw('Names must only contain [_a-zA-Z0-9] but "bad-name" does not.'); + }); + + it('rejects an Enum type with missing value definition', () => { + expect( + () => + new GraphQLEnumType({ + name: 'SomeEnum', + // @ts-expect-error (must not be null) + values: { FOO: null }, + }), + ).to.throw( + 'SomeEnum.FOO must refer to an object with a "value" key representing an internal value but got: null.', + ); + }); + + it('rejects an Enum type with incorrectly typed value definition', () => { + expect( + () => + new GraphQLEnumType({ + name: 'SomeEnum', + // @ts-expect-error + values: { FOO: 10 }, + }), + ).to.throw( + 'SomeEnum.FOO must refer to an object with a "value" key representing an internal value but got: 10.', + ); + }); +}); + +describe('Type System: Input Objects', () => { + describe('Input Objects must have fields', () => { + it('accepts an Input Object type with fields', () => { + const inputObjType = new GraphQLInputObjectType({ + name: 'SomeInputObject', + fields: { + f: { type: ScalarType }, + }, + }); + expect(inputObjType.getFields()).to.deep.equal({ + f: { + name: 'f', + description: undefined, + type: ScalarType, + defaultValue: undefined, + deprecationReason: undefined, + extensions: {}, + astNode: undefined, + }, + }); + }); + + it('accepts an Input Object type with a field function', () => { + const inputObjType = new GraphQLInputObjectType({ + name: 'SomeInputObject', + fields: () => ({ + f: { type: ScalarType }, + }), + }); + expect(inputObjType.getFields()).to.deep.equal({ + f: { + name: 'f', + description: undefined, + type: ScalarType, + defaultValue: undefined, + extensions: {}, + deprecationReason: undefined, + astNode: undefined, + }, + }); + }); + + it('rejects an Input Object type with invalid name', () => { + expect( + () => new GraphQLInputObjectType({ name: 'bad-name', fields: {} }), + ).to.throw( + 'Names must only contain [_a-zA-Z0-9] but "bad-name" does not.', + ); + }); + + it('rejects an Input Object type with incorrect fields', () => { + const inputObjType = new GraphQLInputObjectType({ + name: 'SomeInputObject', + // @ts-expect-error + fields: [], + }); + expect(() => inputObjType.getFields()).to.throw( + 'SomeInputObject fields must be an object with field names as keys or a function which returns such an object.', + ); + }); + + it('rejects an Input Object type with fields function that returns incorrect type', () => { + const inputObjType = new GraphQLInputObjectType({ + name: 'SomeInputObject', + // @ts-expect-error + fields: () => [], + }); + expect(() => inputObjType.getFields()).to.throw( + 'SomeInputObject fields must be an object with field names as keys or a function which returns such an object.', + ); + }); + + it('rejects an Input Object type with incorrectly named fields', () => { + const inputObjType = new GraphQLInputObjectType({ + name: 'SomeInputObject', + fields: { + 'bad-name': { type: ScalarType }, + }, + }); + expect(() => inputObjType.getFields()).to.throw( + 'Names must only contain [_a-zA-Z0-9] but "bad-name" does not.', + ); + }); + }); + + describe('Input Object fields must not have resolvers', () => { + it('rejects an Input Object type with resolvers', () => { + const inputObjType = new GraphQLInputObjectType({ + name: 'SomeInputObject', + fields: { + // @ts-expect-error (Input fields cannot have resolvers) + f: { type: ScalarType, resolve: dummyFunc }, + }, + }); + expect(() => inputObjType.getFields()).to.throw( + 'SomeInputObject.f field has a resolve property, but Input Types cannot define resolvers.', + ); + }); + + it('rejects an Input Object type with resolver constant', () => { + const inputObjType = new GraphQLInputObjectType({ + name: 'SomeInputObject', + fields: { + // @ts-expect-error (Input fields cannot have resolvers) + f: { type: ScalarType, resolve: {} }, + }, + }); + expect(() => inputObjType.getFields()).to.throw( + 'SomeInputObject.f field has a resolve property, but Input Types cannot define resolvers.', + ); + }); + }); + + it('Deprecation reason is preserved on fields', () => { + const inputObjType = new GraphQLInputObjectType({ + name: 'SomeInputObject', + fields: { + deprecatedField: { + type: ScalarType, + deprecationReason: 'not used anymore', + }, + }, + }); + expect(inputObjType.toConfig()).to.have.nested.property( + 'fields.deprecatedField.deprecationReason', + 'not used anymore', + ); + }); +}); + +describe('Type System: List', () => { + function expectList(type: GraphQLType) { + return expect(() => new GraphQLList(type)); + } + + it('accepts an type as item type of list', () => { + expectList(ScalarType).to.not.throw(); + expectList(ObjectType).to.not.throw(); + expectList(UnionType).to.not.throw(); + expectList(InterfaceType).to.not.throw(); + expectList(EnumType).to.not.throw(); + expectList(InputObjectType).to.not.throw(); + expectList(ListOfScalarsType).to.not.throw(); + expectList(NonNullScalarType).to.not.throw(); + }); + + it('rejects a non-type as item type of list', () => { + // @ts-expect-error + expectList({}).to.throw('Expected {} to be a GraphQL type.'); + // @ts-expect-error + expectList(String).to.throw( + 'Expected [function String] to be a GraphQL type.', + ); + // @ts-expect-error (must provide type) + expectList(null).to.throw('Expected null to be a GraphQL type.'); + // @ts-expect-error (must provide type) + expectList(undefined).to.throw('Expected undefined to be a GraphQL type.'); + }); +}); + +describe('Type System: Non-Null', () => { + function expectNonNull(type: GraphQLNullableType) { + return expect(() => new GraphQLNonNull(type)); + } + + it('accepts an type as nullable type of non-null', () => { + expectNonNull(ScalarType).to.not.throw(); + expectNonNull(ObjectType).to.not.throw(); + expectNonNull(UnionType).to.not.throw(); + expectNonNull(InterfaceType).to.not.throw(); + expectNonNull(EnumType).to.not.throw(); + expectNonNull(InputObjectType).to.not.throw(); + expectNonNull(ListOfScalarsType).to.not.throw(); + expectNonNull(ListOfNonNullScalarsType).to.not.throw(); + }); + + it('rejects a non-type as nullable type of non-null', () => { + expectNonNull(NonNullScalarType).to.throw( + 'Expected Scalar! to be a GraphQL nullable type.', + ); + // @ts-expect-error + expectNonNull({}).to.throw('Expected {} to be a GraphQL nullable type.'); + // @ts-expect-error + expectNonNull(String).to.throw( + 'Expected [function String] to be a GraphQL nullable type.', + ); + // @ts-expect-error (must provide type) + expectNonNull(null).to.throw( + 'Expected null to be a GraphQL nullable type.', + ); + // @ts-expect-error (must provide type) + expectNonNull(undefined).to.throw( + 'Expected undefined to be a GraphQL nullable type.', + ); + }); +}); + +describe('Type System: test utility methods', () => { + it('stringifies types', () => { + expect(String(ScalarType)).to.equal('Scalar'); + expect(String(ObjectType)).to.equal('Object'); + expect(String(InterfaceType)).to.equal('Interface'); + expect(String(UnionType)).to.equal('Union'); + expect(String(EnumType)).to.equal('Enum'); + expect(String(InputObjectType)).to.equal('InputObject'); + + expect(String(NonNullScalarType)).to.equal('Scalar!'); + expect(String(ListOfScalarsType)).to.equal('[Scalar]'); + expect(String(NonNullListOfScalars)).to.equal('[Scalar]!'); + expect(String(ListOfNonNullScalarsType)).to.equal('[Scalar!]'); + expect(String(new GraphQLList(ListOfScalarsType))).to.equal('[[Scalar]]'); + }); + + it('JSON.stringifies types', () => { + expect(JSON.stringify(ScalarType)).to.equal('"Scalar"'); + expect(JSON.stringify(ObjectType)).to.equal('"Object"'); + expect(JSON.stringify(InterfaceType)).to.equal('"Interface"'); + expect(JSON.stringify(UnionType)).to.equal('"Union"'); + expect(JSON.stringify(EnumType)).to.equal('"Enum"'); + expect(JSON.stringify(InputObjectType)).to.equal('"InputObject"'); + + expect(JSON.stringify(NonNullScalarType)).to.equal('"Scalar!"'); + expect(JSON.stringify(ListOfScalarsType)).to.equal('"[Scalar]"'); + expect(JSON.stringify(NonNullListOfScalars)).to.equal('"[Scalar]!"'); + expect(JSON.stringify(ListOfNonNullScalarsType)).to.equal('"[Scalar!]"'); + expect(JSON.stringify(new GraphQLList(ListOfScalarsType))).to.equal( + '"[[Scalar]]"', + ); + }); + + it('Object.toStringifies types', () => { + function toString(obj: unknown): string { + return Object.prototype.toString.call(obj); + } + + expect(toString(ScalarType)).to.equal('[object GraphQLScalarType]'); + expect(toString(ObjectType)).to.equal('[object GraphQLObjectType]'); + expect(toString(InterfaceType)).to.equal('[object GraphQLInterfaceType]'); + expect(toString(UnionType)).to.equal('[object GraphQLUnionType]'); + expect(toString(EnumType)).to.equal('[object GraphQLEnumType]'); + expect(toString(InputObjectType)).to.equal( + '[object GraphQLInputObjectType]', + ); + expect(toString(NonNullScalarType)).to.equal('[object GraphQLNonNull]'); + expect(toString(ListOfScalarsType)).to.equal('[object GraphQLList]'); + }); +}); diff --git a/src/type/__tests__/directive-test.ts b/src/type/__tests__/directive-test.ts new file mode 100644 index 00000000..110a3cc9 --- /dev/null +++ b/src/type/__tests__/directive-test.ts @@ -0,0 +1,137 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { DirectiveLocation } from '../../language/directiveLocation'; + +import { GraphQLDirective } from '../directives'; +import { GraphQLInt, GraphQLString } from '../scalars'; + +describe('Type System: Directive', () => { + it('defines a directive with no args', () => { + const directive = new GraphQLDirective({ + name: 'Foo', + locations: [DirectiveLocation.QUERY], + }); + + expect(directive).to.deep.include({ + name: 'Foo', + args: [], + isRepeatable: false, + locations: ['QUERY'], + }); + }); + + it('defines a directive with multiple args', () => { + const directive = new GraphQLDirective({ + name: 'Foo', + args: { + foo: { type: GraphQLString }, + bar: { type: GraphQLInt }, + }, + locations: [DirectiveLocation.QUERY], + }); + + expect(directive).to.deep.include({ + name: 'Foo', + args: [ + { + name: 'foo', + description: undefined, + type: GraphQLString, + defaultValue: undefined, + deprecationReason: undefined, + extensions: {}, + astNode: undefined, + }, + { + name: 'bar', + description: undefined, + type: GraphQLInt, + defaultValue: undefined, + deprecationReason: undefined, + extensions: {}, + astNode: undefined, + }, + ], + isRepeatable: false, + locations: ['QUERY'], + }); + }); + + it('defines a repeatable directive', () => { + const directive = new GraphQLDirective({ + name: 'Foo', + isRepeatable: true, + locations: [DirectiveLocation.QUERY], + }); + + expect(directive).to.deep.include({ + name: 'Foo', + args: [], + isRepeatable: true, + locations: ['QUERY'], + }); + }); + + it('can be stringified, JSON.stringified and Object.toStringified', () => { + const directive = new GraphQLDirective({ + name: 'Foo', + locations: [DirectiveLocation.QUERY], + }); + + expect(String(directive)).to.equal('@Foo'); + expect(JSON.stringify(directive)).to.equal('"@Foo"'); + expect(Object.prototype.toString.call(directive)).to.equal( + '[object GraphQLDirective]', + ); + }); + + it('rejects a directive with invalid name', () => { + expect( + () => + new GraphQLDirective({ + name: 'bad-name', + locations: [DirectiveLocation.QUERY], + }), + ).to.throw('Names must only contain [_a-zA-Z0-9] but "bad-name" does not.'); + }); + + it('rejects a directive with incorrectly typed args', () => { + expect( + () => + new GraphQLDirective({ + name: 'Foo', + locations: [DirectiveLocation.QUERY], + // @ts-expect-error + args: [], + }), + ).to.throw('@Foo args must be an object with argument names as keys.'); + }); + + it('rejects a directive with incorrectly named arg', () => { + expect( + () => + new GraphQLDirective({ + name: 'Foo', + locations: [DirectiveLocation.QUERY], + args: { + 'bad-name': { type: GraphQLString }, + }, + }), + ).to.throw('Names must only contain [_a-zA-Z0-9] but "bad-name" does not.'); + }); + + it('rejects a directive with undefined locations', () => { + // @ts-expect-error + expect(() => new GraphQLDirective({ name: 'Foo' })).to.throw( + '@Foo locations must be an Array.', + ); + }); + + it('rejects a directive with incorrectly typed locations', () => { + // @ts-expect-error + expect(() => new GraphQLDirective({ name: 'Foo', locations: {} })).to.throw( + '@Foo locations must be an Array.', + ); + }); +}); diff --git a/src/type/__tests__/enumType-test.ts b/src/type/__tests__/enumType-test.ts new file mode 100644 index 00000000..35e9f94b --- /dev/null +++ b/src/type/__tests__/enumType-test.ts @@ -0,0 +1,406 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../../__testUtils__/expectJSON'; + +import { introspectionFromSchema } from '../../utilities/introspectionFromSchema'; + +import { graphqlSync } from '../../graphql'; + +import { GraphQLEnumType, GraphQLObjectType } from '../definition'; +import { GraphQLBoolean, GraphQLInt, GraphQLString } from '../scalars'; +import { GraphQLSchema } from '../schema'; + +const ColorType = new GraphQLEnumType({ + name: 'Color', + values: { + RED: { value: 0 }, + GREEN: { value: 1 }, + BLUE: { value: 2 }, + }, +}); + +const Complex1 = { someRandomObject: new Date() }; +const Complex2 = { someRandomValue: 123 }; + +const ComplexEnum = new GraphQLEnumType({ + name: 'Complex', + values: { + ONE: { value: Complex1 }, + TWO: { value: Complex2 }, + }, +}); + +const QueryType = new GraphQLObjectType({ + name: 'Query', + fields: { + colorEnum: { + type: ColorType, + args: { + fromEnum: { type: ColorType }, + fromInt: { type: GraphQLInt }, + fromString: { type: GraphQLString }, + }, + resolve(_source, { fromEnum, fromInt, fromString }) { + return fromInt !== undefined + ? fromInt + : fromString !== undefined + ? fromString + : fromEnum; + }, + }, + colorInt: { + type: GraphQLInt, + args: { + fromEnum: { type: ColorType }, + }, + resolve(_source, { fromEnum }) { + return fromEnum; + }, + }, + complexEnum: { + type: ComplexEnum, + args: { + fromEnum: { + type: ComplexEnum, + // Note: defaultValue is provided an *internal* representation for + // Enums, rather than the string name. + defaultValue: Complex1, + }, + provideGoodValue: { type: GraphQLBoolean }, + provideBadValue: { type: GraphQLBoolean }, + }, + resolve(_source, { fromEnum, provideGoodValue, provideBadValue }) { + if (provideGoodValue) { + // Note: this is one of the references of the internal values which + // ComplexEnum allows. + return Complex2; + } + if (provideBadValue) { + // Note: similar shape, but not the same *reference* + // as Complex2 above. Enum internal values require === equality. + return { someRandomValue: 123 }; + } + return fromEnum; + }, + }, + }, +}); + +const MutationType = new GraphQLObjectType({ + name: 'Mutation', + fields: { + favoriteEnum: { + type: ColorType, + args: { color: { type: ColorType } }, + resolve: (_source, { color }) => color, + }, + }, +}); + +const SubscriptionType = new GraphQLObjectType({ + name: 'Subscription', + fields: { + subscribeToEnum: { + type: ColorType, + args: { color: { type: ColorType } }, + resolve: (_source, { color }) => color, + }, + }, +}); + +const schema = new GraphQLSchema({ + query: QueryType, + mutation: MutationType, + subscription: SubscriptionType, +}); + +function executeQuery( + source: string, + variableValues?: { readonly [variable: string]: unknown }, +) { + return graphqlSync({ schema, source, variableValues }); +} + +describe('Type System: Enum Values', () => { + it('accepts enum literals as input', () => { + const result = executeQuery('{ colorInt(fromEnum: GREEN) }'); + + expect(result).to.deep.equal({ + data: { colorInt: 1 }, + }); + }); + + it('enum may be output type', () => { + const result = executeQuery('{ colorEnum(fromInt: 1) }'); + + expect(result).to.deep.equal({ + data: { colorEnum: 'GREEN' }, + }); + }); + + it('enum may be both input and output type', () => { + const result = executeQuery('{ colorEnum(fromEnum: GREEN) }'); + + expect(result).to.deep.equal({ + data: { colorEnum: 'GREEN' }, + }); + }); + + it('does not accept string literals', () => { + const result = executeQuery('{ colorEnum(fromEnum: "GREEN") }'); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Enum "Color" cannot represent non-enum value: "GREEN". Did you mean the enum value "GREEN"?', + locations: [{ line: 1, column: 23 }], + }, + ], + }); + }); + + it('does not accept values not in the enum', () => { + const result = executeQuery('{ colorEnum(fromEnum: GREENISH) }'); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Value "GREENISH" does not exist in "Color" enum. Did you mean the enum value "GREEN"?', + locations: [{ line: 1, column: 23 }], + }, + ], + }); + }); + + it('does not accept values with incorrect casing', () => { + const result = executeQuery('{ colorEnum(fromEnum: green) }'); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Value "green" does not exist in "Color" enum. Did you mean the enum value "GREEN" or "RED"?', + locations: [{ line: 1, column: 23 }], + }, + ], + }); + }); + + it('does not accept incorrect internal value', () => { + const result = executeQuery('{ colorEnum(fromString: "GREEN") }'); + + expectJSON(result).toDeepEqual({ + data: { colorEnum: null }, + errors: [ + { + message: 'Enum "Color" cannot represent value: "GREEN"', + locations: [{ line: 1, column: 3 }], + path: ['colorEnum'], + }, + ], + }); + }); + + it('does not accept internal value in place of enum literal', () => { + const result = executeQuery('{ colorEnum(fromEnum: 1) }'); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: 'Enum "Color" cannot represent non-enum value: 1.', + locations: [{ line: 1, column: 23 }], + }, + ], + }); + }); + + it('does not accept enum literal in place of int', () => { + const result = executeQuery('{ colorEnum(fromInt: GREEN) }'); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: 'Int cannot represent non-integer value: GREEN', + locations: [{ line: 1, column: 22 }], + }, + ], + }); + }); + + it('accepts JSON string as enum variable', () => { + const doc = 'query ($color: Color!) { colorEnum(fromEnum: $color) }'; + const result = executeQuery(doc, { color: 'BLUE' }); + + expect(result).to.deep.equal({ + data: { colorEnum: 'BLUE' }, + }); + }); + + it('accepts enum literals as input arguments to mutations', () => { + const doc = 'mutation ($color: Color!) { favoriteEnum(color: $color) }'; + const result = executeQuery(doc, { color: 'GREEN' }); + + expect(result).to.deep.equal({ + data: { favoriteEnum: 'GREEN' }, + }); + }); + + it('accepts enum literals as input arguments to subscriptions', () => { + const doc = + 'subscription ($color: Color!) { subscribeToEnum(color: $color) }'; + const result = executeQuery(doc, { color: 'GREEN' }); + + expect(result).to.deep.equal({ + data: { subscribeToEnum: 'GREEN' }, + }); + }); + + it('does not accept internal value as enum variable', () => { + const doc = 'query ($color: Color!) { colorEnum(fromEnum: $color) }'; + const result = executeQuery(doc, { color: 2 }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$color" got invalid value 2; Enum "Color" cannot represent non-string value: 2.', + locations: [{ line: 1, column: 8 }], + }, + ], + }); + }); + + it('does not accept string variables as enum input', () => { + const doc = 'query ($color: String!) { colorEnum(fromEnum: $color) }'; + const result = executeQuery(doc, { color: 'BLUE' }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$color" of type "String!" used in position expecting type "Color".', + locations: [ + { line: 1, column: 8 }, + { line: 1, column: 47 }, + ], + }, + ], + }); + }); + + it('does not accept internal value variable as enum input', () => { + const doc = 'query ($color: Int!) { colorEnum(fromEnum: $color) }'; + const result = executeQuery(doc, { color: 2 }); + + expectJSON(result).toDeepEqual({ + errors: [ + { + message: + 'Variable "$color" of type "Int!" used in position expecting type "Color".', + locations: [ + { line: 1, column: 8 }, + { line: 1, column: 44 }, + ], + }, + ], + }); + }); + + it('enum value may have an internal value of 0', () => { + const result = executeQuery(` + { + colorEnum(fromEnum: RED) + colorInt(fromEnum: RED) + } + `); + + expect(result).to.deep.equal({ + data: { + colorEnum: 'RED', + colorInt: 0, + }, + }); + }); + + it('enum inputs may be nullable', () => { + const result = executeQuery(` + { + colorEnum + colorInt + } + `); + + expect(result).to.deep.equal({ + data: { + colorEnum: null, + colorInt: null, + }, + }); + }); + + it('presents a getValues() API for complex enums', () => { + const values = ComplexEnum.getValues(); + expect(values).to.have.deep.ordered.members([ + { + name: 'ONE', + description: undefined, + value: Complex1, + deprecationReason: undefined, + extensions: {}, + astNode: undefined, + }, + { + name: 'TWO', + description: undefined, + value: Complex2, + deprecationReason: undefined, + extensions: {}, + astNode: undefined, + }, + ]); + }); + + it('presents a getValue() API for complex enums', () => { + const oneValue = ComplexEnum.getValue('ONE'); + expect(oneValue).to.include({ name: 'ONE', value: Complex1 }); + + // @ts-expect-error + const badUsage = ComplexEnum.getValue(Complex1); + expect(badUsage).to.equal(undefined); + }); + + it('may be internally represented with complex values', () => { + const result = executeQuery(` + { + first: complexEnum + second: complexEnum(fromEnum: TWO) + good: complexEnum(provideGoodValue: true) + bad: complexEnum(provideBadValue: true) + } + `); + + expectJSON(result).toDeepEqual({ + data: { + first: 'ONE', + second: 'TWO', + good: 'TWO', + bad: null, + }, + errors: [ + { + message: + 'Enum "Complex" cannot represent value: { someRandomValue: 123 }', + locations: [{ line: 6, column: 9 }], + path: ['bad'], + }, + ], + }); + }); + + it('can be introspected without error', () => { + expect(() => introspectionFromSchema(schema)).to.not.throw(); + }); +}); diff --git a/src/type/__tests__/extensions-test.ts b/src/type/__tests__/extensions-test.ts new file mode 100644 index 00000000..4fb08274 --- /dev/null +++ b/src/type/__tests__/extensions-test.ts @@ -0,0 +1,393 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { invariant } from '../../jsutils/invariant'; + +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLObjectType, + GraphQLScalarType, + GraphQLUnionType, +} from '../definition'; +import { GraphQLDirective } from '../directives'; +import { GraphQLSchema } from '../schema'; + +const dummyType = new GraphQLScalarType({ name: 'DummyScalar' }); + +function expectObjMap(value: unknown) { + invariant(value != null && typeof value === 'object'); + expect(Object.getPrototypeOf(value)).to.equal(null); + return expect(value); +} + +describe('Type System: Extensions', () => { + describe('GraphQLScalarType', () => { + it('without extensions', () => { + const someScalar = new GraphQLScalarType({ name: 'SomeScalar' }); + expect(someScalar.extensions).to.deep.equal({}); + + const config = someScalar.toConfig(); + expect(config.extensions).to.deep.equal({}); + }); + + it('with extensions', () => { + const scalarExtensions = Object.freeze({ SomeScalarExt: 'scalar' }); + const someScalar = new GraphQLScalarType({ + name: 'SomeScalar', + extensions: scalarExtensions, + }); + + expectObjMap(someScalar.extensions).to.deep.equal(scalarExtensions); + + const config = someScalar.toConfig(); + expectObjMap(config.extensions).to.deep.equal(scalarExtensions); + }); + }); + + describe('GraphQLObjectType', () => { + it('without extensions', () => { + const someObject = new GraphQLObjectType({ + name: 'SomeObject', + fields: { + someField: { + type: dummyType, + args: { + someArg: { + type: dummyType, + }, + }, + }, + }, + }); + + expect(someObject.extensions).to.deep.equal({}); + const someField = someObject.getFields().someField; + expect(someField.extensions).to.deep.equal({}); + const someArg = someField.args[0]; + expect(someArg.extensions).to.deep.equal({}); + + const config = someObject.toConfig(); + expect(config.extensions).to.deep.equal({}); + const someFieldConfig = config.fields.someField; + expect(someFieldConfig.extensions).to.deep.equal({}); + invariant(someFieldConfig.args); + const someArgConfig = someFieldConfig.args.someArg; + expect(someArgConfig.extensions).to.deep.equal({}); + }); + + it('with extensions', () => { + const objectExtensions = Object.freeze({ SomeObjectExt: 'object' }); + const fieldExtensions = Object.freeze({ SomeFieldExt: 'field' }); + const argExtensions = Object.freeze({ SomeArgExt: 'arg' }); + + const someObject = new GraphQLObjectType({ + name: 'SomeObject', + fields: { + someField: { + type: dummyType, + args: { + someArg: { + type: dummyType, + extensions: argExtensions, + }, + }, + extensions: fieldExtensions, + }, + }, + extensions: objectExtensions, + }); + + expectObjMap(someObject.extensions).to.deep.equal(objectExtensions); + const someField = someObject.getFields().someField; + expectObjMap(someField.extensions).to.deep.equal(fieldExtensions); + const someArg = someField.args[0]; + expectObjMap(someArg.extensions).to.deep.equal(argExtensions); + + const config = someObject.toConfig(); + expectObjMap(config.extensions).to.deep.equal(objectExtensions); + const someFieldConfig = config.fields.someField; + expectObjMap(someFieldConfig.extensions).to.deep.equal(fieldExtensions); + invariant(someFieldConfig.args); + const someArgConfig = someFieldConfig.args.someArg; + expectObjMap(someArgConfig.extensions).to.deep.equal(argExtensions); + }); + }); + + describe('GraphQLInterfaceType', () => { + it('without extensions', () => { + const someInterface = new GraphQLInterfaceType({ + name: 'SomeInterface', + fields: { + someField: { + type: dummyType, + args: { + someArg: { + type: dummyType, + }, + }, + }, + }, + }); + + expect(someInterface.extensions).to.deep.equal({}); + const someField = someInterface.getFields().someField; + expect(someField.extensions).to.deep.equal({}); + const someArg = someField.args[0]; + expect(someArg.extensions).to.deep.equal({}); + + const config = someInterface.toConfig(); + expect(config.extensions).to.deep.equal({}); + const someFieldConfig = config.fields.someField; + expect(someFieldConfig.extensions).to.deep.equal({}); + invariant(someFieldConfig.args); + const someArgConfig = someFieldConfig.args.someArg; + expect(someArgConfig.extensions).to.deep.equal({}); + }); + + it('with extensions', () => { + const interfaceExtensions = Object.freeze({ + SomeInterfaceExt: 'interface', + }); + const fieldExtensions = Object.freeze({ SomeFieldExt: 'field' }); + const argExtensions = Object.freeze({ SomeArgExt: 'arg' }); + + const someInterface = new GraphQLInterfaceType({ + name: 'SomeInterface', + fields: { + someField: { + type: dummyType, + args: { + someArg: { + type: dummyType, + extensions: argExtensions, + }, + }, + extensions: fieldExtensions, + }, + }, + extensions: interfaceExtensions, + }); + + expectObjMap(someInterface.extensions).to.deep.equal(interfaceExtensions); + const someField = someInterface.getFields().someField; + expectObjMap(someField.extensions).to.deep.equal(fieldExtensions); + const someArg = someField.args[0]; + expectObjMap(someArg.extensions).to.deep.equal(argExtensions); + + const config = someInterface.toConfig(); + expectObjMap(config.extensions).to.deep.equal(interfaceExtensions); + const someFieldConfig = config.fields.someField; + expectObjMap(someFieldConfig.extensions).to.deep.equal(fieldExtensions); + invariant(someFieldConfig.args); + const someArgConfig = someFieldConfig.args.someArg; + expectObjMap(someArgConfig.extensions).to.deep.equal(argExtensions); + }); + }); + + describe('GraphQLUnionType', () => { + it('without extensions', () => { + const someUnion = new GraphQLUnionType({ + name: 'SomeUnion', + types: [], + }); + + expect(someUnion.extensions).to.deep.equal({}); + + const config = someUnion.toConfig(); + expect(config.extensions).to.deep.equal({}); + }); + + it('with extensions', () => { + const unionExtensions = Object.freeze({ SomeUnionExt: 'union' }); + + const someUnion = new GraphQLUnionType({ + name: 'SomeUnion', + types: [], + extensions: unionExtensions, + }); + + expectObjMap(someUnion.extensions).to.deep.equal(unionExtensions); + + const config = someUnion.toConfig(); + expectObjMap(config.extensions).to.deep.equal(unionExtensions); + }); + }); + + describe('GraphQLEnumType', () => { + it('without extensions', () => { + const someEnum = new GraphQLEnumType({ + name: 'SomeEnum', + values: { + SOME_VALUE: {}, + }, + }); + + expect(someEnum.extensions).to.deep.equal({}); + const someValue = someEnum.getValues()[0]; + expect(someValue.extensions).to.deep.equal({}); + + const config = someEnum.toConfig(); + expect(config.extensions).to.deep.equal({}); + const someValueConfig = config.values.SOME_VALUE; + expect(someValueConfig.extensions).to.deep.equal({}); + }); + + it('with extensions', () => { + const enumExtensions = Object.freeze({ SomeEnumExt: 'enum' }); + const valueExtensions = Object.freeze({ SomeValueExt: 'value' }); + + const someEnum = new GraphQLEnumType({ + name: 'SomeEnum', + values: { + SOME_VALUE: { + extensions: valueExtensions, + }, + }, + extensions: enumExtensions, + }); + + expectObjMap(someEnum.extensions).to.deep.equal(enumExtensions); + const someValue = someEnum.getValues()[0]; + expectObjMap(someValue.extensions).to.deep.equal(valueExtensions); + + const config = someEnum.toConfig(); + expectObjMap(config.extensions).to.deep.equal(enumExtensions); + const someValueConfig = config.values.SOME_VALUE; + expectObjMap(someValueConfig.extensions).to.deep.equal(valueExtensions); + }); + }); + + describe('GraphQLInputObjectType', () => { + it('without extensions', () => { + const someInputObject = new GraphQLInputObjectType({ + name: 'SomeInputObject', + fields: { + someInputField: { + type: dummyType, + }, + }, + }); + + expect(someInputObject.extensions).to.deep.equal({}); + const someInputField = someInputObject.getFields().someInputField; + expect(someInputField.extensions).to.deep.equal({}); + + const config = someInputObject.toConfig(); + expect(config.extensions).to.deep.equal({}); + const someInputFieldConfig = config.fields.someInputField; + expect(someInputFieldConfig.extensions).to.deep.equal({}); + }); + + it('with extensions', () => { + const inputObjectExtensions = Object.freeze({ + SomeInputObjectExt: 'inputObject', + }); + const inputFieldExtensions = Object.freeze({ + SomeInputFieldExt: 'inputField', + }); + + const someInputObject = new GraphQLInputObjectType({ + name: 'SomeInputObject', + fields: { + someInputField: { + type: dummyType, + extensions: inputFieldExtensions, + }, + }, + extensions: inputObjectExtensions, + }); + + expectObjMap(someInputObject.extensions).to.deep.equal( + inputObjectExtensions, + ); + const someInputField = someInputObject.getFields().someInputField; + expectObjMap(someInputField.extensions).to.deep.equal( + inputFieldExtensions, + ); + + const config = someInputObject.toConfig(); + expectObjMap(config.extensions).to.deep.equal(inputObjectExtensions); + const someInputFieldConfig = config.fields.someInputField; + expectObjMap(someInputFieldConfig.extensions).to.deep.equal( + inputFieldExtensions, + ); + }); + }); + + describe('GraphQLDirective', () => { + it('without extensions', () => { + const someDirective = new GraphQLDirective({ + name: 'SomeDirective', + args: { + someArg: { + type: dummyType, + }, + }, + locations: [], + }); + + expect(someDirective.extensions).to.deep.equal({}); + const someArg = someDirective.args[0]; + expect(someArg.extensions).to.deep.equal({}); + + const config = someDirective.toConfig(); + expect(config.extensions).to.deep.equal({}); + const someArgConfig = config.args.someArg; + expect(someArgConfig.extensions).to.deep.equal({}); + }); + + it('with extensions', () => { + const directiveExtensions = Object.freeze({ + SomeDirectiveExt: 'directive', + }); + const argExtensions = Object.freeze({ SomeArgExt: 'arg' }); + + const someDirective = new GraphQLDirective({ + name: 'SomeDirective', + args: { + someArg: { + type: dummyType, + extensions: argExtensions, + }, + }, + locations: [], + extensions: directiveExtensions, + }); + + expectObjMap(someDirective.extensions).to.deep.equal(directiveExtensions); + const someArg = someDirective.args[0]; + expectObjMap(someArg.extensions).to.deep.equal(argExtensions); + + const config = someDirective.toConfig(); + expectObjMap(config.extensions).to.deep.equal(directiveExtensions); + const someArgConfig = config.args.someArg; + expectObjMap(someArgConfig.extensions).to.deep.equal(argExtensions); + }); + }); + + describe('GraphQLSchema', () => { + it('without extensions', () => { + const schema = new GraphQLSchema({}); + + expect(schema.extensions).to.deep.equal({}); + + const config = schema.toConfig(); + expect(config.extensions).to.deep.equal({}); + }); + + it('with extensions', () => { + const schemaExtensions = Object.freeze({ + schemaExtension: 'schema', + }); + + const schema = new GraphQLSchema({ extensions: schemaExtensions }); + + expectObjMap(schema.extensions).to.deep.equal(schemaExtensions); + + const config = schema.toConfig(); + expectObjMap(config.extensions).to.deep.equal(schemaExtensions); + }); + }); +}); diff --git a/src/type/__tests__/introspection-test.ts b/src/type/__tests__/introspection-test.ts new file mode 100644 index 00000000..741d9c00 --- /dev/null +++ b/src/type/__tests__/introspection-test.ts @@ -0,0 +1,1651 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../../__testUtils__/expectJSON'; + +import { buildSchema } from '../../utilities/buildASTSchema'; +import { getIntrospectionQuery } from '../../utilities/getIntrospectionQuery'; + +import { graphqlSync } from '../../graphql'; + +import type { GraphQLResolveInfo } from '../definition'; + +describe('Introspection', () => { + it('executes an introspection query', () => { + const schema = buildSchema(` + type SomeObject { + someField: String + } + + schema { + query: SomeObject + } + `); + + const source = getIntrospectionQuery({ + descriptions: false, + specifiedByUrl: true, + directiveIsRepeatable: true, + }); + + const result = graphqlSync({ schema, source }); + expect(result).to.deep.equal({ + data: { + __schema: { + queryType: { name: 'SomeObject' }, + mutationType: null, + subscriptionType: null, + types: [ + { + kind: 'OBJECT', + name: 'SomeObject', + specifiedByURL: null, + fields: [ + { + name: 'someField', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + ], + inputFields: null, + interfaces: [], + enumValues: null, + possibleTypes: null, + }, + { + kind: 'SCALAR', + name: 'String', + specifiedByURL: null, + fields: null, + inputFields: null, + interfaces: null, + enumValues: null, + possibleTypes: null, + }, + { + kind: 'SCALAR', + name: 'Boolean', + specifiedByURL: null, + fields: null, + inputFields: null, + interfaces: null, + enumValues: null, + possibleTypes: null, + }, + { + kind: 'OBJECT', + name: '__Schema', + specifiedByURL: null, + fields: [ + { + name: 'description', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'types', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'LIST', + name: null, + ofType: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'OBJECT', + name: '__Type', + ofType: null, + }, + }, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'queryType', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'OBJECT', + name: '__Type', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'mutationType', + args: [], + type: { + kind: 'OBJECT', + name: '__Type', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'subscriptionType', + args: [], + type: { + kind: 'OBJECT', + name: '__Type', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'directives', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'LIST', + name: null, + ofType: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'OBJECT', + name: '__Directive', + ofType: null, + }, + }, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + ], + inputFields: null, + interfaces: [], + enumValues: null, + possibleTypes: null, + }, + { + kind: 'OBJECT', + name: '__Type', + specifiedByURL: null, + fields: [ + { + name: 'kind', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'ENUM', + name: '__TypeKind', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'name', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'description', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'specifiedByURL', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'fields', + args: [ + { + name: 'includeDeprecated', + type: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, + defaultValue: 'false', + }, + ], + type: { + kind: 'LIST', + name: null, + ofType: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'OBJECT', + name: '__Field', + ofType: null, + }, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'interfaces', + args: [], + type: { + kind: 'LIST', + name: null, + ofType: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'OBJECT', + name: '__Type', + ofType: null, + }, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'possibleTypes', + args: [], + type: { + kind: 'LIST', + name: null, + ofType: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'OBJECT', + name: '__Type', + ofType: null, + }, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'enumValues', + args: [ + { + name: 'includeDeprecated', + type: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, + defaultValue: 'false', + }, + ], + type: { + kind: 'LIST', + name: null, + ofType: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'OBJECT', + name: '__EnumValue', + ofType: null, + }, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'inputFields', + args: [ + { + name: 'includeDeprecated', + type: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, + defaultValue: 'false', + }, + ], + type: { + kind: 'LIST', + name: null, + ofType: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'OBJECT', + name: '__InputValue', + ofType: null, + }, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'ofType', + args: [], + type: { + kind: 'OBJECT', + name: '__Type', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + ], + inputFields: null, + interfaces: [], + enumValues: null, + possibleTypes: null, + }, + { + kind: 'ENUM', + name: '__TypeKind', + specifiedByURL: null, + fields: null, + inputFields: null, + interfaces: null, + enumValues: [ + { + name: 'SCALAR', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'OBJECT', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'INTERFACE', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'UNION', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'ENUM', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'INPUT_OBJECT', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'LIST', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'NON_NULL', + isDeprecated: false, + deprecationReason: null, + }, + ], + possibleTypes: null, + }, + { + kind: 'OBJECT', + name: '__Field', + specifiedByURL: null, + fields: [ + { + name: 'name', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'description', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'args', + args: [ + { + name: 'includeDeprecated', + type: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, + defaultValue: 'false', + }, + ], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'LIST', + name: null, + ofType: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'OBJECT', + name: '__InputValue', + ofType: null, + }, + }, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'type', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'OBJECT', + name: '__Type', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'isDeprecated', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'deprecationReason', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + ], + inputFields: null, + interfaces: [], + enumValues: null, + possibleTypes: null, + }, + { + kind: 'OBJECT', + name: '__InputValue', + specifiedByURL: null, + fields: [ + { + name: 'name', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'description', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'type', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'OBJECT', + name: '__Type', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'defaultValue', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'isDeprecated', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'deprecationReason', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + ], + inputFields: null, + interfaces: [], + enumValues: null, + possibleTypes: null, + }, + { + kind: 'OBJECT', + name: '__EnumValue', + specifiedByURL: null, + fields: [ + { + name: 'name', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'description', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'isDeprecated', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'deprecationReason', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + ], + inputFields: null, + interfaces: [], + enumValues: null, + possibleTypes: null, + }, + { + kind: 'OBJECT', + name: '__Directive', + specifiedByURL: null, + fields: [ + { + name: 'name', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'description', + args: [], + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'isRepeatable', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'locations', + args: [], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'LIST', + name: null, + ofType: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'ENUM', + name: '__DirectiveLocation', + ofType: null, + }, + }, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'args', + args: [ + { + name: 'includeDeprecated', + type: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, + defaultValue: 'false', + }, + ], + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'LIST', + name: null, + ofType: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'OBJECT', + name: '__InputValue', + ofType: null, + }, + }, + }, + }, + isDeprecated: false, + deprecationReason: null, + }, + ], + inputFields: null, + interfaces: [], + enumValues: null, + possibleTypes: null, + }, + { + kind: 'ENUM', + name: '__DirectiveLocation', + specifiedByURL: null, + fields: null, + inputFields: null, + interfaces: null, + enumValues: [ + { + name: 'QUERY', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'MUTATION', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'SUBSCRIPTION', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'FIELD', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'FRAGMENT_DEFINITION', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'FRAGMENT_SPREAD', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'INLINE_FRAGMENT', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'VARIABLE_DEFINITION', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'SCHEMA', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'SCALAR', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'OBJECT', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'FIELD_DEFINITION', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'ARGUMENT_DEFINITION', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'INTERFACE', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'UNION', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'ENUM', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'ENUM_VALUE', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'INPUT_OBJECT', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'INPUT_FIELD_DEFINITION', + isDeprecated: false, + deprecationReason: null, + }, + ], + possibleTypes: null, + }, + ], + directives: [ + { + name: 'include', + isRepeatable: false, + locations: ['FIELD', 'FRAGMENT_SPREAD', 'INLINE_FRAGMENT'], + args: [ + { + defaultValue: null, + name: 'if', + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, + }, + }, + ], + }, + { + name: 'skip', + isRepeatable: false, + locations: ['FIELD', 'FRAGMENT_SPREAD', 'INLINE_FRAGMENT'], + args: [ + { + defaultValue: null, + name: 'if', + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'Boolean', + ofType: null, + }, + }, + }, + ], + }, + { + name: 'deprecated', + isRepeatable: false, + locations: [ + 'FIELD_DEFINITION', + 'ARGUMENT_DEFINITION', + 'INPUT_FIELD_DEFINITION', + 'ENUM_VALUE', + ], + args: [ + { + defaultValue: '"No longer supported"', + name: 'reason', + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + }, + ], + }, + { + name: 'specifiedBy', + isRepeatable: false, + locations: ['SCALAR'], + args: [ + { + defaultValue: null, + name: 'url', + type: { + kind: 'NON_NULL', + name: null, + ofType: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + }, + }, + ], + }, + ], + }, + }, + }); + }); + + it('introspects on input object', () => { + const schema = buildSchema(` + input SomeInputObject { + a: String = "tes\\t de\\fault" + b: [String] + c: String = null + } + + type Query { + someField(someArg: SomeInputObject): String + } + `); + + const source = ` + { + __type(name: "SomeInputObject") { + kind + name + inputFields { + name + type { ...TypeRef } + defaultValue + } + } + } + + fragment TypeRef on __Type { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + } + } + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + __type: { + kind: 'INPUT_OBJECT', + name: 'SomeInputObject', + inputFields: [ + { + name: 'a', + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + defaultValue: '"tes\\t de\\fault"', + }, + { + name: 'b', + type: { + kind: 'LIST', + name: null, + ofType: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + }, + defaultValue: null, + }, + { + name: 'c', + type: { + kind: 'SCALAR', + name: 'String', + ofType: null, + }, + defaultValue: 'null', + }, + ], + }, + }, + }); + }); + + it('introspects any default value', () => { + const schema = buildSchema(` + input InputObjectWithDefaultValues { + a: String = "Emoji: \\u{1F600}" + b: Complex = {x: ["abc"], y: 123} + } + + input Complex { + x: [String] + y: Int + } + + type Query { + someField(someArg: InputObjectWithDefaultValues): String + } + `); + + const source = ` + { + __type(name: "InputObjectWithDefaultValues") { + inputFields { + name + defaultValue + } + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + __type: { + inputFields: [ + { + name: 'a', + defaultValue: '"Emoji: \u{1F600}"', + }, + { + name: 'b', + defaultValue: '{x: ["abc"], y: 123}', + }, + ], + }, + }, + }); + }); + + it('supports the __type root field', () => { + const schema = buildSchema(` + type Query { + someField: String + } + `); + + const source = ` + { + __type(name: "Query") { + name + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + __type: { name: 'Query' }, + }, + }); + }); + + it('identifies deprecated fields', () => { + const schema = buildSchema(` + type Query { + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + deprecatedWithEmptyReason: String @deprecated(reason: "") + } + `); + + const source = ` + { + __type(name: "Query") { + fields(includeDeprecated: true) { + name + isDeprecated, + deprecationReason + } + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + __type: { + fields: [ + { + name: 'nonDeprecated', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'deprecated', + isDeprecated: true, + deprecationReason: 'Removed in 1.0', + }, + { + name: 'deprecatedWithEmptyReason', + isDeprecated: true, + deprecationReason: '', + }, + ], + }, + }, + }); + }); + + it('respects the includeDeprecated parameter for fields', () => { + const schema = buildSchema(` + type Query { + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + } + `); + + const source = ` + { + __type(name: "Query") { + trueFields: fields(includeDeprecated: true) { + name + } + falseFields: fields(includeDeprecated: false) { + name + } + omittedFields: fields { + name + } + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + __type: { + trueFields: [{ name: 'nonDeprecated' }, { name: 'deprecated' }], + falseFields: [{ name: 'nonDeprecated' }], + omittedFields: [{ name: 'nonDeprecated' }], + }, + }, + }); + }); + + it('identifies deprecated args', () => { + const schema = buildSchema(` + type Query { + someField( + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + deprecatedWithEmptyReason: String @deprecated(reason: "") + ): String + } + `); + + const source = ` + { + __type(name: "Query") { + fields { + args(includeDeprecated: true) { + name + isDeprecated, + deprecationReason + } + } + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + __type: { + fields: [ + { + args: [ + { + name: 'nonDeprecated', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'deprecated', + isDeprecated: true, + deprecationReason: 'Removed in 1.0', + }, + { + name: 'deprecatedWithEmptyReason', + isDeprecated: true, + deprecationReason: '', + }, + ], + }, + ], + }, + }, + }); + }); + + it('respects the includeDeprecated parameter for args', () => { + const schema = buildSchema(` + type Query { + someField( + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + ): String + } + `); + + const source = ` + { + __type(name: "Query") { + fields { + trueArgs: args(includeDeprecated: true) { + name + } + falseArgs: args(includeDeprecated: false) { + name + } + omittedArgs: args { + name + } + } + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + __type: { + fields: [ + { + trueArgs: [{ name: 'nonDeprecated' }, { name: 'deprecated' }], + falseArgs: [{ name: 'nonDeprecated' }], + omittedArgs: [{ name: 'nonDeprecated' }], + }, + ], + }, + }, + }); + }); + + it('identifies deprecated enum values', () => { + const schema = buildSchema(` + enum SomeEnum { + NON_DEPRECATED + DEPRECATED @deprecated(reason: "Removed in 1.0") + ALSO_NON_DEPRECATED + } + + type Query { + someField(someArg: SomeEnum): String + } + `); + + const source = ` + { + __type(name: "SomeEnum") { + enumValues(includeDeprecated: true) { + name + isDeprecated, + deprecationReason + } + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + __type: { + enumValues: [ + { + name: 'NON_DEPRECATED', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'DEPRECATED', + isDeprecated: true, + deprecationReason: 'Removed in 1.0', + }, + { + name: 'ALSO_NON_DEPRECATED', + isDeprecated: false, + deprecationReason: null, + }, + ], + }, + }, + }); + }); + + it('respects the includeDeprecated parameter for enum values', () => { + const schema = buildSchema(` + enum SomeEnum { + NON_DEPRECATED + DEPRECATED @deprecated(reason: "Removed in 1.0") + DEPRECATED_WITH_EMPTY_REASON @deprecated(reason: "") + ALSO_NON_DEPRECATED + } + + type Query { + someField(someArg: SomeEnum): String + } + `); + + const source = ` + { + __type(name: "SomeEnum") { + trueValues: enumValues(includeDeprecated: true) { + name + } + falseValues: enumValues(includeDeprecated: false) { + name + } + omittedValues: enumValues { + name + } + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + __type: { + trueValues: [ + { name: 'NON_DEPRECATED' }, + { name: 'DEPRECATED' }, + { name: 'DEPRECATED_WITH_EMPTY_REASON' }, + { name: 'ALSO_NON_DEPRECATED' }, + ], + falseValues: [ + { name: 'NON_DEPRECATED' }, + { name: 'ALSO_NON_DEPRECATED' }, + ], + omittedValues: [ + { name: 'NON_DEPRECATED' }, + { name: 'ALSO_NON_DEPRECATED' }, + ], + }, + }, + }); + }); + + it('identifies deprecated for input fields', () => { + const schema = buildSchema(` + input SomeInputObject { + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + deprecatedWithEmptyReason: String @deprecated(reason: "") + } + + type Query { + someField(someArg: SomeInputObject): String + } + `); + + const source = ` + { + __type(name: "SomeInputObject") { + inputFields(includeDeprecated: true) { + name + isDeprecated, + deprecationReason + } + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + __type: { + inputFields: [ + { + name: 'nonDeprecated', + isDeprecated: false, + deprecationReason: null, + }, + { + name: 'deprecated', + isDeprecated: true, + deprecationReason: 'Removed in 1.0', + }, + { + name: 'deprecatedWithEmptyReason', + isDeprecated: true, + deprecationReason: '', + }, + ], + }, + }, + }); + }); + + it('respects the includeDeprecated parameter for input fields', () => { + const schema = buildSchema(` + input SomeInputObject { + nonDeprecated: String + deprecated: String @deprecated(reason: "Removed in 1.0") + } + + type Query { + someField(someArg: SomeInputObject): String + } + `); + + const source = ` + { + __type(name: "SomeInputObject") { + trueFields: inputFields(includeDeprecated: true) { + name + } + falseFields: inputFields(includeDeprecated: false) { + name + } + omittedFields: inputFields { + name + } + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + __type: { + trueFields: [{ name: 'nonDeprecated' }, { name: 'deprecated' }], + falseFields: [{ name: 'nonDeprecated' }], + omittedFields: [{ name: 'nonDeprecated' }], + }, + }, + }); + }); + + it('fails as expected on the __type root field without an arg', () => { + const schema = buildSchema(` + type Query { + someField: String + } + `); + + const source = ` + { + __type { + name + } + } + `; + + expectJSON(graphqlSync({ schema, source })).toDeepEqual({ + errors: [ + { + message: + 'Field "__type" argument "name" of type "String!" is required, but it was not provided.', + locations: [{ line: 3, column: 9 }], + }, + ], + }); + }); + + it('exposes descriptions', () => { + const schema = buildSchema(` + """Enum description""" + enum SomeEnum { + """Value description""" + VALUE + } + + """Object description""" + type SomeObject { + """Field description""" + someField(arg: SomeEnum): String + } + + """Schema description""" + schema { + query: SomeObject + } + `); + + const source = ` + { + Schema: __schema { description } + SomeObject: __type(name: "SomeObject") { + description, + fields { + name + description + } + } + SomeEnum: __type(name: "SomeEnum") { + description + enumValues { + name + description + } + } + } + `; + + expect(graphqlSync({ schema, source })).to.deep.equal({ + data: { + Schema: { + description: 'Schema description', + }, + SomeEnum: { + description: 'Enum description', + enumValues: [ + { + name: 'VALUE', + description: 'Value description', + }, + ], + }, + SomeObject: { + description: 'Object description', + fields: [ + { + name: 'someField', + description: 'Field description', + }, + ], + }, + }, + }); + }); + + it('executes an introspection query without calling global resolvers', () => { + const schema = buildSchema(` + type Query { + someField: String + } + `); + + const source = getIntrospectionQuery({ + specifiedByUrl: true, + directiveIsRepeatable: true, + schemaDescription: true, + }); + + /* c8 ignore start */ + function fieldResolver( + _1: any, + _2: any, + _3: any, + info: GraphQLResolveInfo, + ): never { + expect.fail(`Called on ${info.parentType.name}::${info.fieldName}`); + } + + function typeResolver(_1: any, _2: any, info: GraphQLResolveInfo): never { + expect.fail(`Called on ${info.parentType.name}::${info.fieldName}`); + } + /* c8 ignore stop */ + + const result = graphqlSync({ + schema, + source, + fieldResolver, + typeResolver, + }); + expect(result).to.not.have.property('errors'); + }); +}); diff --git a/src/type/__tests__/predicate-test.ts b/src/type/__tests__/predicate-test.ts new file mode 100644 index 00000000..81e721e7 --- /dev/null +++ b/src/type/__tests__/predicate-test.ts @@ -0,0 +1,704 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { DirectiveLocation } from '../../language/directiveLocation'; + +import type { + GraphQLArgument, + GraphQLInputField, + GraphQLInputType, +} from '../definition'; +import { + assertAbstractType, + assertCompositeType, + assertEnumType, + assertInputObjectType, + assertInputType, + assertInterfaceType, + assertLeafType, + assertListType, + assertNamedType, + assertNonNullType, + assertNullableType, + assertObjectType, + assertOutputType, + assertScalarType, + assertType, + assertUnionType, + assertWrappingType, + getNamedType, + getNullableType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLScalarType, + GraphQLUnionType, + isAbstractType, + isCompositeType, + isEnumType, + isInputObjectType, + isInputType, + isInterfaceType, + isLeafType, + isListType, + isNamedType, + isNonNullType, + isNullableType, + isObjectType, + isOutputType, + isRequiredArgument, + isRequiredInputField, + isScalarType, + isType, + isUnionType, + isWrappingType, +} from '../definition'; +import { + assertDirective, + GraphQLDeprecatedDirective, + GraphQLDirective, + GraphQLIncludeDirective, + GraphQLSkipDirective, + isDirective, + isSpecifiedDirective, +} from '../directives'; +import { + GraphQLBoolean, + GraphQLFloat, + GraphQLID, + GraphQLInt, + GraphQLString, + isSpecifiedScalarType, +} from '../scalars'; + +const ObjectType = new GraphQLObjectType({ name: 'Object', fields: {} }); +const InterfaceType = new GraphQLInterfaceType({ + name: 'Interface', + fields: {}, +}); +const UnionType = new GraphQLUnionType({ name: 'Union', types: [ObjectType] }); +const EnumType = new GraphQLEnumType({ name: 'Enum', values: { foo: {} } }); +const InputObjectType = new GraphQLInputObjectType({ + name: 'InputObject', + fields: {}, +}); +const ScalarType = new GraphQLScalarType({ name: 'Scalar' }); +const Directive = new GraphQLDirective({ + name: 'Directive', + locations: [DirectiveLocation.QUERY], +}); + +describe('Type predicates', () => { + describe('isType', () => { + it('returns true for unwrapped types', () => { + expect(isType(GraphQLString)).to.equal(true); + expect(() => assertType(GraphQLString)).to.not.throw(); + expect(isType(ObjectType)).to.equal(true); + expect(() => assertType(ObjectType)).to.not.throw(); + }); + + it('returns true for wrapped types', () => { + expect(isType(new GraphQLNonNull(GraphQLString))).to.equal(true); + expect(() => + assertType(new GraphQLNonNull(GraphQLString)), + ).to.not.throw(); + }); + + it('returns false for type classes (rather than instances)', () => { + expect(isType(GraphQLObjectType)).to.equal(false); + expect(() => assertType(GraphQLObjectType)).to.throw(); + }); + + it('returns false for random garbage', () => { + expect(isType({ what: 'is this' })).to.equal(false); + expect(() => assertType({ what: 'is this' })).to.throw(); + }); + }); + + describe('isScalarType', () => { + it('returns true for spec defined scalar', () => { + expect(isScalarType(GraphQLString)).to.equal(true); + expect(() => assertScalarType(GraphQLString)).to.not.throw(); + }); + + it('returns true for custom scalar', () => { + expect(isScalarType(ScalarType)).to.equal(true); + expect(() => assertScalarType(ScalarType)).to.not.throw(); + }); + + it('returns false for scalar class (rather than instance)', () => { + expect(isScalarType(GraphQLScalarType)).to.equal(false); + expect(() => assertScalarType(GraphQLScalarType)).to.throw(); + }); + + it('returns false for wrapped scalar', () => { + expect(isScalarType(new GraphQLList(ScalarType))).to.equal(false); + expect(() => assertScalarType(new GraphQLList(ScalarType))).to.throw(); + }); + + it('returns false for non-scalar', () => { + expect(isScalarType(EnumType)).to.equal(false); + expect(() => assertScalarType(EnumType)).to.throw(); + expect(isScalarType(Directive)).to.equal(false); + expect(() => assertScalarType(Directive)).to.throw(); + }); + + it('returns false for random garbage', () => { + expect(isScalarType({ what: 'is this' })).to.equal(false); + expect(() => assertScalarType({ what: 'is this' })).to.throw(); + }); + }); + + describe('isSpecifiedScalarType', () => { + it('returns true for specified scalars', () => { + expect(isSpecifiedScalarType(GraphQLString)).to.equal(true); + expect(isSpecifiedScalarType(GraphQLInt)).to.equal(true); + expect(isSpecifiedScalarType(GraphQLFloat)).to.equal(true); + expect(isSpecifiedScalarType(GraphQLBoolean)).to.equal(true); + expect(isSpecifiedScalarType(GraphQLID)).to.equal(true); + }); + + it('returns false for custom scalar', () => { + expect(isSpecifiedScalarType(ScalarType)).to.equal(false); + }); + }); + + describe('isObjectType', () => { + it('returns true for object type', () => { + expect(isObjectType(ObjectType)).to.equal(true); + expect(() => assertObjectType(ObjectType)).to.not.throw(); + }); + + it('returns false for wrapped object type', () => { + expect(isObjectType(new GraphQLList(ObjectType))).to.equal(false); + expect(() => assertObjectType(new GraphQLList(ObjectType))).to.throw(); + }); + + it('returns false for non-object type', () => { + expect(isObjectType(InterfaceType)).to.equal(false); + expect(() => assertObjectType(InterfaceType)).to.throw(); + }); + }); + + describe('isInterfaceType', () => { + it('returns true for interface type', () => { + expect(isInterfaceType(InterfaceType)).to.equal(true); + expect(() => assertInterfaceType(InterfaceType)).to.not.throw(); + }); + + it('returns false for wrapped interface type', () => { + expect(isInterfaceType(new GraphQLList(InterfaceType))).to.equal(false); + expect(() => + assertInterfaceType(new GraphQLList(InterfaceType)), + ).to.throw(); + }); + + it('returns false for non-interface type', () => { + expect(isInterfaceType(ObjectType)).to.equal(false); + expect(() => assertInterfaceType(ObjectType)).to.throw(); + }); + }); + + describe('isUnionType', () => { + it('returns true for union type', () => { + expect(isUnionType(UnionType)).to.equal(true); + expect(() => assertUnionType(UnionType)).to.not.throw(); + }); + + it('returns false for wrapped union type', () => { + expect(isUnionType(new GraphQLList(UnionType))).to.equal(false); + expect(() => assertUnionType(new GraphQLList(UnionType))).to.throw(); + }); + + it('returns false for non-union type', () => { + expect(isUnionType(ObjectType)).to.equal(false); + expect(() => assertUnionType(ObjectType)).to.throw(); + }); + }); + + describe('isEnumType', () => { + it('returns true for enum type', () => { + expect(isEnumType(EnumType)).to.equal(true); + expect(() => assertEnumType(EnumType)).to.not.throw(); + }); + + it('returns false for wrapped enum type', () => { + expect(isEnumType(new GraphQLList(EnumType))).to.equal(false); + expect(() => assertEnumType(new GraphQLList(EnumType))).to.throw(); + }); + + it('returns false for non-enum type', () => { + expect(isEnumType(ScalarType)).to.equal(false); + expect(() => assertEnumType(ScalarType)).to.throw(); + }); + }); + + describe('isInputObjectType', () => { + it('returns true for input object type', () => { + expect(isInputObjectType(InputObjectType)).to.equal(true); + expect(() => assertInputObjectType(InputObjectType)).to.not.throw(); + }); + + it('returns false for wrapped input object type', () => { + expect(isInputObjectType(new GraphQLList(InputObjectType))).to.equal( + false, + ); + expect(() => + assertInputObjectType(new GraphQLList(InputObjectType)), + ).to.throw(); + }); + + it('returns false for non-input-object type', () => { + expect(isInputObjectType(ObjectType)).to.equal(false); + expect(() => assertInputObjectType(ObjectType)).to.throw(); + }); + }); + + describe('isListType', () => { + it('returns true for a list wrapped type', () => { + expect(isListType(new GraphQLList(ObjectType))).to.equal(true); + expect(() => assertListType(new GraphQLList(ObjectType))).to.not.throw(); + }); + + it('returns false for an unwrapped type', () => { + expect(isListType(ObjectType)).to.equal(false); + expect(() => assertListType(ObjectType)).to.throw(); + }); + + it('returns false for a non-list wrapped type', () => { + expect( + isListType(new GraphQLNonNull(new GraphQLList(ObjectType))), + ).to.equal(false); + expect(() => + assertListType(new GraphQLNonNull(new GraphQLList(ObjectType))), + ).to.throw(); + }); + }); + + describe('isNonNullType', () => { + it('returns true for a non-null wrapped type', () => { + expect(isNonNullType(new GraphQLNonNull(ObjectType))).to.equal(true); + expect(() => + assertNonNullType(new GraphQLNonNull(ObjectType)), + ).to.not.throw(); + }); + + it('returns false for an unwrapped type', () => { + expect(isNonNullType(ObjectType)).to.equal(false); + expect(() => assertNonNullType(ObjectType)).to.throw(); + }); + + it('returns false for a not non-null wrapped type', () => { + expect( + isNonNullType(new GraphQLList(new GraphQLNonNull(ObjectType))), + ).to.equal(false); + expect(() => + assertNonNullType(new GraphQLList(new GraphQLNonNull(ObjectType))), + ).to.throw(); + }); + }); + + describe('isInputType', () => { + function expectInputType(type: unknown) { + expect(isInputType(type)).to.equal(true); + expect(() => assertInputType(type)).to.not.throw(); + } + + it('returns true for an input type', () => { + expectInputType(GraphQLString); + expectInputType(EnumType); + expectInputType(InputObjectType); + }); + + it('returns true for a wrapped input type', () => { + expectInputType(new GraphQLList(GraphQLString)); + expectInputType(new GraphQLList(EnumType)); + expectInputType(new GraphQLList(InputObjectType)); + + expectInputType(new GraphQLNonNull(GraphQLString)); + expectInputType(new GraphQLNonNull(EnumType)); + expectInputType(new GraphQLNonNull(InputObjectType)); + }); + + function expectNonInputType(type: unknown) { + expect(isInputType(type)).to.equal(false); + expect(() => assertInputType(type)).to.throw(); + } + + it('returns false for an output type', () => { + expectNonInputType(ObjectType); + expectNonInputType(InterfaceType); + expectNonInputType(UnionType); + }); + + it('returns false for a wrapped output type', () => { + expectNonInputType(new GraphQLList(ObjectType)); + expectNonInputType(new GraphQLList(InterfaceType)); + expectNonInputType(new GraphQLList(UnionType)); + + expectNonInputType(new GraphQLNonNull(ObjectType)); + expectNonInputType(new GraphQLNonNull(InterfaceType)); + expectNonInputType(new GraphQLNonNull(UnionType)); + }); + }); + + describe('isOutputType', () => { + function expectOutputType(type: unknown) { + expect(isOutputType(type)).to.equal(true); + expect(() => assertOutputType(type)).to.not.throw(); + } + + it('returns true for an output type', () => { + expectOutputType(GraphQLString); + expectOutputType(ObjectType); + expectOutputType(InterfaceType); + expectOutputType(UnionType); + expectOutputType(EnumType); + }); + + it('returns true for a wrapped output type', () => { + expectOutputType(new GraphQLList(GraphQLString)); + expectOutputType(new GraphQLList(ObjectType)); + expectOutputType(new GraphQLList(InterfaceType)); + expectOutputType(new GraphQLList(UnionType)); + expectOutputType(new GraphQLList(EnumType)); + + expectOutputType(new GraphQLNonNull(GraphQLString)); + expectOutputType(new GraphQLNonNull(ObjectType)); + expectOutputType(new GraphQLNonNull(InterfaceType)); + expectOutputType(new GraphQLNonNull(UnionType)); + expectOutputType(new GraphQLNonNull(EnumType)); + }); + + function expectNonOutputType(type: unknown) { + expect(isOutputType(type)).to.equal(false); + expect(() => assertOutputType(type)).to.throw(); + } + + it('returns false for an input type', () => { + expectNonOutputType(InputObjectType); + }); + + it('returns false for a wrapped input type', () => { + expectNonOutputType(new GraphQLList(InputObjectType)); + expectNonOutputType(new GraphQLNonNull(InputObjectType)); + }); + }); + + describe('isLeafType', () => { + it('returns true for scalar and enum types', () => { + expect(isLeafType(ScalarType)).to.equal(true); + expect(() => assertLeafType(ScalarType)).to.not.throw(); + expect(isLeafType(EnumType)).to.equal(true); + expect(() => assertLeafType(EnumType)).to.not.throw(); + }); + + it('returns false for wrapped leaf type', () => { + expect(isLeafType(new GraphQLList(ScalarType))).to.equal(false); + expect(() => assertLeafType(new GraphQLList(ScalarType))).to.throw(); + }); + + it('returns false for non-leaf type', () => { + expect(isLeafType(ObjectType)).to.equal(false); + expect(() => assertLeafType(ObjectType)).to.throw(); + }); + + it('returns false for wrapped non-leaf type', () => { + expect(isLeafType(new GraphQLList(ObjectType))).to.equal(false); + expect(() => assertLeafType(new GraphQLList(ObjectType))).to.throw(); + }); + }); + + describe('isCompositeType', () => { + it('returns true for object, interface, and union types', () => { + expect(isCompositeType(ObjectType)).to.equal(true); + expect(() => assertCompositeType(ObjectType)).to.not.throw(); + expect(isCompositeType(InterfaceType)).to.equal(true); + expect(() => assertCompositeType(InterfaceType)).to.not.throw(); + expect(isCompositeType(UnionType)).to.equal(true); + expect(() => assertCompositeType(UnionType)).to.not.throw(); + }); + + it('returns false for wrapped composite type', () => { + expect(isCompositeType(new GraphQLList(ObjectType))).to.equal(false); + expect(() => assertCompositeType(new GraphQLList(ObjectType))).to.throw(); + }); + + it('returns false for non-composite type', () => { + expect(isCompositeType(InputObjectType)).to.equal(false); + expect(() => assertCompositeType(InputObjectType)).to.throw(); + }); + + it('returns false for wrapped non-composite type', () => { + expect(isCompositeType(new GraphQLList(InputObjectType))).to.equal(false); + expect(() => + assertCompositeType(new GraphQLList(InputObjectType)), + ).to.throw(); + }); + }); + + describe('isAbstractType', () => { + it('returns true for interface and union types', () => { + expect(isAbstractType(InterfaceType)).to.equal(true); + expect(() => assertAbstractType(InterfaceType)).to.not.throw(); + expect(isAbstractType(UnionType)).to.equal(true); + expect(() => assertAbstractType(UnionType)).to.not.throw(); + }); + + it('returns false for wrapped abstract type', () => { + expect(isAbstractType(new GraphQLList(InterfaceType))).to.equal(false); + expect(() => + assertAbstractType(new GraphQLList(InterfaceType)), + ).to.throw(); + }); + + it('returns false for non-abstract type', () => { + expect(isAbstractType(ObjectType)).to.equal(false); + expect(() => assertAbstractType(ObjectType)).to.throw(); + }); + + it('returns false for wrapped non-abstract type', () => { + expect(isAbstractType(new GraphQLList(ObjectType))).to.equal(false); + expect(() => assertAbstractType(new GraphQLList(ObjectType))).to.throw(); + }); + }); + + describe('isWrappingType', () => { + it('returns true for list and non-null types', () => { + expect(isWrappingType(new GraphQLList(ObjectType))).to.equal(true); + expect(() => + assertWrappingType(new GraphQLList(ObjectType)), + ).to.not.throw(); + expect(isWrappingType(new GraphQLNonNull(ObjectType))).to.equal(true); + expect(() => + assertWrappingType(new GraphQLNonNull(ObjectType)), + ).to.not.throw(); + }); + + it('returns false for unwrapped types', () => { + expect(isWrappingType(ObjectType)).to.equal(false); + expect(() => assertWrappingType(ObjectType)).to.throw(); + }); + }); + + describe('isNullableType', () => { + it('returns true for unwrapped types', () => { + expect(isNullableType(ObjectType)).to.equal(true); + expect(() => assertNullableType(ObjectType)).to.not.throw(); + }); + + it('returns true for list of non-null types', () => { + expect( + isNullableType(new GraphQLList(new GraphQLNonNull(ObjectType))), + ).to.equal(true); + expect(() => + assertNullableType(new GraphQLList(new GraphQLNonNull(ObjectType))), + ).to.not.throw(); + }); + + it('returns false for non-null types', () => { + expect(isNullableType(new GraphQLNonNull(ObjectType))).to.equal(false); + expect(() => + assertNullableType(new GraphQLNonNull(ObjectType)), + ).to.throw(); + }); + }); + + describe('getNullableType', () => { + it('returns undefined for no type', () => { + expect(getNullableType(undefined)).to.equal(undefined); + expect(getNullableType(null)).to.equal(undefined); + }); + + it('returns self for a nullable type', () => { + expect(getNullableType(ObjectType)).to.equal(ObjectType); + const listOfObj = new GraphQLList(ObjectType); + expect(getNullableType(listOfObj)).to.equal(listOfObj); + }); + + it('unwraps non-null type', () => { + expect(getNullableType(new GraphQLNonNull(ObjectType))).to.equal( + ObjectType, + ); + }); + }); + + describe('isNamedType', () => { + it('returns true for unwrapped types', () => { + expect(isNamedType(ObjectType)).to.equal(true); + expect(() => assertNamedType(ObjectType)).to.not.throw(); + }); + + it('returns false for list and non-null types', () => { + expect(isNamedType(new GraphQLList(ObjectType))).to.equal(false); + expect(() => assertNamedType(new GraphQLList(ObjectType))).to.throw(); + expect(isNamedType(new GraphQLNonNull(ObjectType))).to.equal(false); + expect(() => assertNamedType(new GraphQLNonNull(ObjectType))).to.throw(); + }); + }); + + describe('getNamedType', () => { + it('returns undefined for no type', () => { + expect(getNamedType(undefined)).to.equal(undefined); + expect(getNamedType(null)).to.equal(undefined); + }); + + it('returns self for a unwrapped type', () => { + expect(getNamedType(ObjectType)).to.equal(ObjectType); + }); + + it('unwraps wrapper types', () => { + expect(getNamedType(new GraphQLNonNull(ObjectType))).to.equal(ObjectType); + expect(getNamedType(new GraphQLList(ObjectType))).to.equal(ObjectType); + }); + + it('unwraps deeply wrapper types', () => { + expect( + getNamedType( + new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(ObjectType))), + ), + ).to.equal(ObjectType); + }); + }); + + describe('isRequiredArgument', () => { + function buildArg(config: { + type: GraphQLInputType; + defaultValue?: unknown; + }): GraphQLArgument { + return { + name: 'someArg', + type: config.type, + description: undefined, + defaultValue: config.defaultValue, + deprecationReason: null, + extensions: Object.create(null), + astNode: undefined, + }; + } + + it('returns true for required arguments', () => { + const requiredArg = buildArg({ + type: new GraphQLNonNull(GraphQLString), + }); + expect(isRequiredArgument(requiredArg)).to.equal(true); + }); + + it('returns false for optional arguments', () => { + const optArg1 = buildArg({ + type: GraphQLString, + }); + expect(isRequiredArgument(optArg1)).to.equal(false); + + const optArg2 = buildArg({ + type: GraphQLString, + defaultValue: null, + }); + expect(isRequiredArgument(optArg2)).to.equal(false); + + const optArg3 = buildArg({ + type: new GraphQLList(new GraphQLNonNull(GraphQLString)), + }); + expect(isRequiredArgument(optArg3)).to.equal(false); + + const optArg4 = buildArg({ + type: new GraphQLNonNull(GraphQLString), + defaultValue: 'default', + }); + expect(isRequiredArgument(optArg4)).to.equal(false); + }); + }); + + describe('isRequiredInputField', () => { + function buildInputField(config: { + type: GraphQLInputType; + defaultValue?: unknown; + }): GraphQLInputField { + return { + name: 'someInputField', + type: config.type, + description: undefined, + defaultValue: config.defaultValue, + deprecationReason: null, + extensions: Object.create(null), + astNode: undefined, + }; + } + + it('returns true for required input field', () => { + const requiredField = buildInputField({ + type: new GraphQLNonNull(GraphQLString), + }); + expect(isRequiredInputField(requiredField)).to.equal(true); + }); + + it('returns false for optional input field', () => { + const optField1 = buildInputField({ + type: GraphQLString, + }); + expect(isRequiredInputField(optField1)).to.equal(false); + + const optField2 = buildInputField({ + type: GraphQLString, + defaultValue: null, + }); + expect(isRequiredInputField(optField2)).to.equal(false); + + const optField3 = buildInputField({ + type: new GraphQLList(new GraphQLNonNull(GraphQLString)), + }); + expect(isRequiredInputField(optField3)).to.equal(false); + + const optField4 = buildInputField({ + type: new GraphQLNonNull(GraphQLString), + defaultValue: 'default', + }); + expect(isRequiredInputField(optField4)).to.equal(false); + }); + }); +}); + +describe('Directive predicates', () => { + describe('isDirective', () => { + it('returns true for spec defined directive', () => { + expect(isDirective(GraphQLSkipDirective)).to.equal(true); + expect(() => assertDirective(GraphQLSkipDirective)).to.not.throw(); + }); + + it('returns true for custom directive', () => { + expect(isDirective(Directive)).to.equal(true); + expect(() => assertDirective(Directive)).to.not.throw(); + }); + + it('returns false for directive class (rather than instance)', () => { + expect(isDirective(GraphQLDirective)).to.equal(false); + expect(() => assertDirective(GraphQLDirective)).to.throw(); + }); + + it('returns false for non-directive', () => { + expect(isDirective(EnumType)).to.equal(false); + expect(() => assertDirective(EnumType)).to.throw(); + expect(isDirective(ScalarType)).to.equal(false); + expect(() => assertDirective(ScalarType)).to.throw(); + }); + + it('returns false for random garbage', () => { + expect(isDirective({ what: 'is this' })).to.equal(false); + expect(() => assertDirective({ what: 'is this' })).to.throw(); + }); + }); + describe('isSpecifiedDirective', () => { + it('returns true for specified directives', () => { + expect(isSpecifiedDirective(GraphQLIncludeDirective)).to.equal(true); + expect(isSpecifiedDirective(GraphQLSkipDirective)).to.equal(true); + expect(isSpecifiedDirective(GraphQLDeprecatedDirective)).to.equal(true); + }); + + it('returns false for custom directive', () => { + expect(isSpecifiedDirective(Directive)).to.equal(false); + }); + }); +}); diff --git a/src/type/__tests__/scalars-test.ts b/src/type/__tests__/scalars-test.ts new file mode 100644 index 00000000..4d563aee --- /dev/null +++ b/src/type/__tests__/scalars-test.ts @@ -0,0 +1,654 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { parseValue as parseValueToAST } from '../../language/parser'; + +import { + GraphQLBoolean, + GraphQLFloat, + GraphQLID, + GraphQLInt, + GraphQLString, +} from '../scalars'; + +describe('Type System: Specified scalar types', () => { + describe('GraphQLInt', () => { + it('parseValue', () => { + function parseValue(value: unknown) { + return GraphQLInt.parseValue(value); + } + + expect(parseValue(1)).to.equal(1); + expect(parseValue(0)).to.equal(0); + expect(parseValue(-1)).to.equal(-1); + + expect(() => parseValue(9876504321)).to.throw( + 'Int cannot represent non 32-bit signed integer value: 9876504321', + ); + expect(() => parseValue(-9876504321)).to.throw( + 'Int cannot represent non 32-bit signed integer value: -9876504321', + ); + expect(() => parseValue(0.1)).to.throw( + 'Int cannot represent non-integer value: 0.1', + ); + expect(() => parseValue(NaN)).to.throw( + 'Int cannot represent non-integer value: NaN', + ); + expect(() => parseValue(Infinity)).to.throw( + 'Int cannot represent non-integer value: Infinity', + ); + + expect(() => parseValue(undefined)).to.throw( + 'Int cannot represent non-integer value: undefined', + ); + expect(() => parseValue(null)).to.throw( + 'Int cannot represent non-integer value: null', + ); + expect(() => parseValue('')).to.throw( + 'Int cannot represent non-integer value: ""', + ); + expect(() => parseValue('123')).to.throw( + 'Int cannot represent non-integer value: "123"', + ); + expect(() => parseValue(false)).to.throw( + 'Int cannot represent non-integer value: false', + ); + expect(() => parseValue(true)).to.throw( + 'Int cannot represent non-integer value: true', + ); + expect(() => parseValue([1])).to.throw( + 'Int cannot represent non-integer value: [1]', + ); + expect(() => parseValue({ value: 1 })).to.throw( + 'Int cannot represent non-integer value: { value: 1 }', + ); + }); + + it('parseLiteral', () => { + function parseLiteral(str: string) { + return GraphQLInt.parseLiteral(parseValueToAST(str), undefined); + } + + expect(parseLiteral('1')).to.equal(1); + expect(parseLiteral('0')).to.equal(0); + expect(parseLiteral('-1')).to.equal(-1); + + expect(() => parseLiteral('9876504321')).to.throw( + 'Int cannot represent non 32-bit signed integer value: 9876504321', + ); + expect(() => parseLiteral('-9876504321')).to.throw( + 'Int cannot represent non 32-bit signed integer value: -9876504321', + ); + + expect(() => parseLiteral('1.0')).to.throw( + 'Int cannot represent non-integer value: 1.0', + ); + expect(() => parseLiteral('null')).to.throw( + 'Int cannot represent non-integer value: null', + ); + expect(() => parseLiteral('""')).to.throw( + 'Int cannot represent non-integer value: ""', + ); + expect(() => parseLiteral('"123"')).to.throw( + 'Int cannot represent non-integer value: "123"', + ); + expect(() => parseLiteral('false')).to.throw( + 'Int cannot represent non-integer value: false', + ); + expect(() => parseLiteral('[1]')).to.throw( + 'Int cannot represent non-integer value: [1]', + ); + expect(() => parseLiteral('{ value: 1 }')).to.throw( + 'Int cannot represent non-integer value: {value: 1}', + ); + expect(() => parseLiteral('ENUM_VALUE')).to.throw( + 'Int cannot represent non-integer value: ENUM_VALUE', + ); + expect(() => parseLiteral('$var')).to.throw( + 'Int cannot represent non-integer value: $var', + ); + }); + + it('serialize', () => { + function serialize(value: unknown) { + return GraphQLInt.serialize(value); + } + + expect(serialize(1)).to.equal(1); + expect(serialize('123')).to.equal(123); + expect(serialize(0)).to.equal(0); + expect(serialize(-1)).to.equal(-1); + expect(serialize(1e5)).to.equal(100000); + expect(serialize(false)).to.equal(0); + expect(serialize(true)).to.equal(1); + + const customValueOfObj = { + value: 5, + valueOf() { + return this.value; + }, + }; + expect(serialize(customValueOfObj)).to.equal(5); + + // The GraphQL specification does not allow serializing non-integer values + // as Int to avoid accidental data loss. + expect(() => serialize(0.1)).to.throw( + 'Int cannot represent non-integer value: 0.1', + ); + expect(() => serialize(1.1)).to.throw( + 'Int cannot represent non-integer value: 1.1', + ); + expect(() => serialize(-1.1)).to.throw( + 'Int cannot represent non-integer value: -1.1', + ); + expect(() => serialize('-1.1')).to.throw( + 'Int cannot represent non-integer value: "-1.1"', + ); + + // Maybe a safe JavaScript int, but bigger than 2^32, so not + // representable as a GraphQL Int + expect(() => serialize(9876504321)).to.throw( + 'Int cannot represent non 32-bit signed integer value: 9876504321', + ); + expect(() => serialize(-9876504321)).to.throw( + 'Int cannot represent non 32-bit signed integer value: -9876504321', + ); + + // Too big to represent as an Int in JavaScript or GraphQL + expect(() => serialize(1e100)).to.throw( + 'Int cannot represent non 32-bit signed integer value: 1e+100', + ); + expect(() => serialize(-1e100)).to.throw( + 'Int cannot represent non 32-bit signed integer value: -1e+100', + ); + expect(() => serialize('one')).to.throw( + 'Int cannot represent non-integer value: "one"', + ); + + // Doesn't represent number + expect(() => serialize('')).to.throw( + 'Int cannot represent non-integer value: ""', + ); + expect(() => serialize(NaN)).to.throw( + 'Int cannot represent non-integer value: NaN', + ); + expect(() => serialize(Infinity)).to.throw( + 'Int cannot represent non-integer value: Infinity', + ); + expect(() => serialize([5])).to.throw( + 'Int cannot represent non-integer value: [5]', + ); + }); + }); + + describe('GraphQLFloat', () => { + it('parseValue', () => { + function parseValue(value: unknown) { + return GraphQLFloat.parseValue(value); + } + + expect(parseValue(1)).to.equal(1); + expect(parseValue(0)).to.equal(0); + expect(parseValue(-1)).to.equal(-1); + expect(parseValue(0.1)).to.equal(0.1); + expect(parseValue(Math.PI)).to.equal(Math.PI); + + expect(() => parseValue(NaN)).to.throw( + 'Float cannot represent non numeric value: NaN', + ); + expect(() => parseValue(Infinity)).to.throw( + 'Float cannot represent non numeric value: Infinity', + ); + + expect(() => parseValue(undefined)).to.throw( + 'Float cannot represent non numeric value: undefined', + ); + expect(() => parseValue(null)).to.throw( + 'Float cannot represent non numeric value: null', + ); + expect(() => parseValue('')).to.throw( + 'Float cannot represent non numeric value: ""', + ); + expect(() => parseValue('123')).to.throw( + 'Float cannot represent non numeric value: "123"', + ); + expect(() => parseValue('123.5')).to.throw( + 'Float cannot represent non numeric value: "123.5"', + ); + expect(() => parseValue(false)).to.throw( + 'Float cannot represent non numeric value: false', + ); + expect(() => parseValue(true)).to.throw( + 'Float cannot represent non numeric value: true', + ); + expect(() => parseValue([0.1])).to.throw( + 'Float cannot represent non numeric value: [0.1]', + ); + expect(() => parseValue({ value: 0.1 })).to.throw( + 'Float cannot represent non numeric value: { value: 0.1 }', + ); + }); + + it('parseLiteral', () => { + function parseLiteral(str: string) { + return GraphQLFloat.parseLiteral(parseValueToAST(str), undefined); + } + + expect(parseLiteral('1')).to.equal(1); + expect(parseLiteral('0')).to.equal(0); + expect(parseLiteral('-1')).to.equal(-1); + expect(parseLiteral('0.1')).to.equal(0.1); + expect(parseLiteral(Math.PI.toString())).to.equal(Math.PI); + + expect(() => parseLiteral('null')).to.throw( + 'Float cannot represent non numeric value: null', + ); + expect(() => parseLiteral('""')).to.throw( + 'Float cannot represent non numeric value: ""', + ); + expect(() => parseLiteral('"123"')).to.throw( + 'Float cannot represent non numeric value: "123"', + ); + expect(() => parseLiteral('"123.5"')).to.throw( + 'Float cannot represent non numeric value: "123.5"', + ); + expect(() => parseLiteral('false')).to.throw( + 'Float cannot represent non numeric value: false', + ); + expect(() => parseLiteral('[0.1]')).to.throw( + 'Float cannot represent non numeric value: [0.1]', + ); + expect(() => parseLiteral('{ value: 0.1 }')).to.throw( + 'Float cannot represent non numeric value: {value: 0.1}', + ); + expect(() => parseLiteral('ENUM_VALUE')).to.throw( + 'Float cannot represent non numeric value: ENUM_VALUE', + ); + expect(() => parseLiteral('$var')).to.throw( + 'Float cannot represent non numeric value: $var', + ); + }); + + it('serialize', () => { + function serialize(value: unknown) { + return GraphQLFloat.serialize(value); + } + + expect(serialize(1)).to.equal(1.0); + expect(serialize(0)).to.equal(0.0); + expect(serialize('123.5')).to.equal(123.5); + expect(serialize(-1)).to.equal(-1.0); + expect(serialize(0.1)).to.equal(0.1); + expect(serialize(1.1)).to.equal(1.1); + expect(serialize(-1.1)).to.equal(-1.1); + expect(serialize('-1.1')).to.equal(-1.1); + expect(serialize(false)).to.equal(0.0); + expect(serialize(true)).to.equal(1.0); + + const customValueOfObj = { + value: 5.5, + valueOf() { + return this.value; + }, + }; + expect(serialize(customValueOfObj)).to.equal(5.5); + + expect(() => serialize(NaN)).to.throw( + 'Float cannot represent non numeric value: NaN', + ); + expect(() => serialize(Infinity)).to.throw( + 'Float cannot represent non numeric value: Infinity', + ); + expect(() => serialize('one')).to.throw( + 'Float cannot represent non numeric value: "one"', + ); + expect(() => serialize('')).to.throw( + 'Float cannot represent non numeric value: ""', + ); + expect(() => serialize([5])).to.throw( + 'Float cannot represent non numeric value: [5]', + ); + }); + }); + + describe('GraphQLString', () => { + it('parseValue', () => { + function parseValue(value: unknown) { + return GraphQLString.parseValue(value); + } + + expect(parseValue('foo')).to.equal('foo'); + + expect(() => parseValue(undefined)).to.throw( + 'String cannot represent a non string value: undefined', + ); + expect(() => parseValue(null)).to.throw( + 'String cannot represent a non string value: null', + ); + expect(() => parseValue(1)).to.throw( + 'String cannot represent a non string value: 1', + ); + expect(() => parseValue(NaN)).to.throw( + 'String cannot represent a non string value: NaN', + ); + expect(() => parseValue(false)).to.throw( + 'String cannot represent a non string value: false', + ); + expect(() => parseValue(['foo'])).to.throw( + 'String cannot represent a non string value: ["foo"]', + ); + expect(() => parseValue({ value: 'foo' })).to.throw( + 'String cannot represent a non string value: { value: "foo" }', + ); + }); + + it('parseLiteral', () => { + function parseLiteral(str: string) { + return GraphQLString.parseLiteral(parseValueToAST(str), undefined); + } + + expect(parseLiteral('"foo"')).to.equal('foo'); + expect(parseLiteral('"""bar"""')).to.equal('bar'); + + expect(() => parseLiteral('null')).to.throw( + 'String cannot represent a non string value: null', + ); + expect(() => parseLiteral('1')).to.throw( + 'String cannot represent a non string value: 1', + ); + expect(() => parseLiteral('0.1')).to.throw( + 'String cannot represent a non string value: 0.1', + ); + expect(() => parseLiteral('false')).to.throw( + 'String cannot represent a non string value: false', + ); + expect(() => parseLiteral('["foo"]')).to.throw( + 'String cannot represent a non string value: ["foo"]', + ); + expect(() => parseLiteral('{ value: "foo" }')).to.throw( + 'String cannot represent a non string value: {value: "foo"}', + ); + expect(() => parseLiteral('ENUM_VALUE')).to.throw( + 'String cannot represent a non string value: ENUM_VALUE', + ); + expect(() => parseLiteral('$var')).to.throw( + 'String cannot represent a non string value: $var', + ); + }); + + it('serialize', () => { + function serialize(value: unknown) { + return GraphQLString.serialize(value); + } + + expect(serialize('string')).to.equal('string'); + expect(serialize(1)).to.equal('1'); + expect(serialize(-1.1)).to.equal('-1.1'); + expect(serialize(true)).to.equal('true'); + expect(serialize(false)).to.equal('false'); + + const valueOf = () => 'valueOf string'; + const toJSON = () => 'toJSON string'; + + const valueOfAndToJSONValue = { valueOf, toJSON }; + expect(serialize(valueOfAndToJSONValue)).to.equal('valueOf string'); + + const onlyToJSONValue = { toJSON }; + expect(serialize(onlyToJSONValue)).to.equal('toJSON string'); + + expect(() => serialize(NaN)).to.throw( + 'String cannot represent value: NaN', + ); + + expect(() => serialize([1])).to.throw( + 'String cannot represent value: [1]', + ); + + const badObjValue = {}; + expect(() => serialize(badObjValue)).to.throw( + 'String cannot represent value: {}', + ); + + const badValueOfObjValue = { valueOf: 'valueOf string' }; + expect(() => serialize(badValueOfObjValue)).to.throw( + 'String cannot represent value: { valueOf: "valueOf string" }', + ); + }); + }); + + describe('GraphQLBoolean', () => { + it('parseValue', () => { + function parseValue(value: unknown) { + return GraphQLBoolean.parseValue(value); + } + + expect(parseValue(true)).to.equal(true); + expect(parseValue(false)).to.equal(false); + + expect(() => parseValue(undefined)).to.throw( + 'Boolean cannot represent a non boolean value: undefined', + ); + expect(() => parseValue(null)).to.throw( + 'Boolean cannot represent a non boolean value: null', + ); + expect(() => parseValue(0)).to.throw( + 'Boolean cannot represent a non boolean value: 0', + ); + expect(() => parseValue(1)).to.throw( + 'Boolean cannot represent a non boolean value: 1', + ); + expect(() => parseValue(NaN)).to.throw( + 'Boolean cannot represent a non boolean value: NaN', + ); + expect(() => parseValue('')).to.throw( + 'Boolean cannot represent a non boolean value: ""', + ); + expect(() => parseValue('false')).to.throw( + 'Boolean cannot represent a non boolean value: "false"', + ); + expect(() => parseValue([false])).to.throw( + 'Boolean cannot represent a non boolean value: [false]', + ); + expect(() => parseValue({ value: false })).to.throw( + 'Boolean cannot represent a non boolean value: { value: false }', + ); + }); + + it('parseLiteral', () => { + function parseLiteral(str: string) { + return GraphQLBoolean.parseLiteral(parseValueToAST(str), undefined); + } + + expect(parseLiteral('true')).to.equal(true); + expect(parseLiteral('false')).to.equal(false); + + expect(() => parseLiteral('null')).to.throw( + 'Boolean cannot represent a non boolean value: null', + ); + expect(() => parseLiteral('0')).to.throw( + 'Boolean cannot represent a non boolean value: 0', + ); + expect(() => parseLiteral('1')).to.throw( + 'Boolean cannot represent a non boolean value: 1', + ); + expect(() => parseLiteral('0.1')).to.throw( + 'Boolean cannot represent a non boolean value: 0.1', + ); + expect(() => parseLiteral('""')).to.throw( + 'Boolean cannot represent a non boolean value: ""', + ); + expect(() => parseLiteral('"false"')).to.throw( + 'Boolean cannot represent a non boolean value: "false"', + ); + expect(() => parseLiteral('[false]')).to.throw( + 'Boolean cannot represent a non boolean value: [false]', + ); + expect(() => parseLiteral('{ value: false }')).to.throw( + 'Boolean cannot represent a non boolean value: {value: false}', + ); + expect(() => parseLiteral('ENUM_VALUE')).to.throw( + 'Boolean cannot represent a non boolean value: ENUM_VALUE', + ); + expect(() => parseLiteral('$var')).to.throw( + 'Boolean cannot represent a non boolean value: $var', + ); + }); + + it('serialize', () => { + function serialize(value: unknown) { + return GraphQLBoolean.serialize(value); + } + + expect(serialize(1)).to.equal(true); + expect(serialize(0)).to.equal(false); + expect(serialize(true)).to.equal(true); + expect(serialize(false)).to.equal(false); + expect( + serialize({ + value: true, + valueOf() { + return (this as { value: boolean }).value; + }, + }), + ).to.equal(true); + + expect(() => serialize(NaN)).to.throw( + 'Boolean cannot represent a non boolean value: NaN', + ); + expect(() => serialize('')).to.throw( + 'Boolean cannot represent a non boolean value: ""', + ); + expect(() => serialize('true')).to.throw( + 'Boolean cannot represent a non boolean value: "true"', + ); + expect(() => serialize([false])).to.throw( + 'Boolean cannot represent a non boolean value: [false]', + ); + expect(() => serialize({})).to.throw( + 'Boolean cannot represent a non boolean value: {}', + ); + }); + }); + + describe('GraphQLID', () => { + it('parseValue', () => { + function parseValue(value: unknown) { + return GraphQLID.parseValue(value); + } + + expect(parseValue('')).to.equal(''); + expect(parseValue('1')).to.equal('1'); + expect(parseValue('foo')).to.equal('foo'); + expect(parseValue(1)).to.equal('1'); + expect(parseValue(0)).to.equal('0'); + expect(parseValue(-1)).to.equal('-1'); + + // Maximum and minimum safe numbers in JS + expect(parseValue(9007199254740991)).to.equal('9007199254740991'); + expect(parseValue(-9007199254740991)).to.equal('-9007199254740991'); + + expect(() => parseValue(undefined)).to.throw( + 'ID cannot represent value: undefined', + ); + expect(() => parseValue(null)).to.throw( + 'ID cannot represent value: null', + ); + expect(() => parseValue(0.1)).to.throw('ID cannot represent value: 0.1'); + expect(() => parseValue(NaN)).to.throw('ID cannot represent value: NaN'); + expect(() => parseValue(Infinity)).to.throw( + 'ID cannot represent value: Inf', + ); + expect(() => parseValue(false)).to.throw( + 'ID cannot represent value: false', + ); + expect(() => GraphQLID.parseValue(['1'])).to.throw( + 'ID cannot represent value: ["1"]', + ); + expect(() => GraphQLID.parseValue({ value: '1' })).to.throw( + 'ID cannot represent value: { value: "1" }', + ); + }); + + it('parseLiteral', () => { + function parseLiteral(str: string) { + return GraphQLID.parseLiteral(parseValueToAST(str), undefined); + } + + expect(parseLiteral('""')).to.equal(''); + expect(parseLiteral('"1"')).to.equal('1'); + expect(parseLiteral('"foo"')).to.equal('foo'); + expect(parseLiteral('"""foo"""')).to.equal('foo'); + expect(parseLiteral('1')).to.equal('1'); + expect(parseLiteral('0')).to.equal('0'); + expect(parseLiteral('-1')).to.equal('-1'); + + // Support arbitrary long numbers even if they can't be represented in JS + expect(parseLiteral('90071992547409910')).to.equal('90071992547409910'); + expect(parseLiteral('-90071992547409910')).to.equal('-90071992547409910'); + + expect(() => parseLiteral('null')).to.throw( + 'ID cannot represent a non-string and non-integer value: null', + ); + expect(() => parseLiteral('0.1')).to.throw( + 'ID cannot represent a non-string and non-integer value: 0.1', + ); + expect(() => parseLiteral('false')).to.throw( + 'ID cannot represent a non-string and non-integer value: false', + ); + expect(() => parseLiteral('["1"]')).to.throw( + 'ID cannot represent a non-string and non-integer value: ["1"]', + ); + expect(() => parseLiteral('{ value: "1" }')).to.throw( + 'ID cannot represent a non-string and non-integer value: {value: "1"}', + ); + expect(() => parseLiteral('ENUM_VALUE')).to.throw( + 'ID cannot represent a non-string and non-integer value: ENUM_VALUE', + ); + expect(() => parseLiteral('$var')).to.throw( + 'ID cannot represent a non-string and non-integer value: $var', + ); + }); + + it('serialize', () => { + function serialize(value: unknown) { + return GraphQLID.serialize(value); + } + + expect(serialize('string')).to.equal('string'); + expect(serialize('false')).to.equal('false'); + expect(serialize('')).to.equal(''); + expect(serialize(123)).to.equal('123'); + expect(serialize(0)).to.equal('0'); + expect(serialize(-1)).to.equal('-1'); + + const valueOf = () => 'valueOf ID'; + const toJSON = () => 'toJSON ID'; + + const valueOfAndToJSONValue = { valueOf, toJSON }; + expect(serialize(valueOfAndToJSONValue)).to.equal('valueOf ID'); + + const onlyToJSONValue = { toJSON }; + expect(serialize(onlyToJSONValue)).to.equal('toJSON ID'); + + const badObjValue = { + _id: false, + valueOf() { + return this._id; + }, + }; + expect(() => serialize(badObjValue)).to.throw( + 'ID cannot represent value: { _id: false, valueOf: [function valueOf] }', + ); + + expect(() => serialize(true)).to.throw('ID cannot represent value: true'); + + expect(() => serialize(3.14)).to.throw('ID cannot represent value: 3.14'); + + expect(() => serialize({})).to.throw('ID cannot represent value: {}'); + + expect(() => serialize(['abc'])).to.throw( + 'ID cannot represent value: ["abc"]', + ); + }); + }); +}); diff --git a/src/type/__tests__/schema-test.ts b/src/type/__tests__/schema-test.ts new file mode 100644 index 00000000..8a31b50a --- /dev/null +++ b/src/type/__tests__/schema-test.ts @@ -0,0 +1,409 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; + +import { DirectiveLocation } from '../../language/directiveLocation'; + +import { printSchema } from '../../utilities/printSchema'; + +import { + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLObjectType, + GraphQLScalarType, +} from '../definition'; +import { GraphQLDirective } from '../directives'; +import { GraphQLBoolean, GraphQLInt, GraphQLString } from '../scalars'; +import { GraphQLSchema } from '../schema'; + +describe('Type System: Schema', () => { + it('Define sample schema', () => { + const BlogImage = new GraphQLObjectType({ + name: 'Image', + fields: { + url: { type: GraphQLString }, + width: { type: GraphQLInt }, + height: { type: GraphQLInt }, + }, + }); + + const BlogAuthor: GraphQLObjectType = new GraphQLObjectType({ + name: 'Author', + fields: () => ({ + id: { type: GraphQLString }, + name: { type: GraphQLString }, + pic: { + args: { width: { type: GraphQLInt }, height: { type: GraphQLInt } }, + type: BlogImage, + }, + recentArticle: { type: BlogArticle }, + }), + }); + + const BlogArticle: GraphQLObjectType = new GraphQLObjectType({ + name: 'Article', + fields: { + id: { type: GraphQLString }, + isPublished: { type: GraphQLBoolean }, + author: { type: BlogAuthor }, + title: { type: GraphQLString }, + body: { type: GraphQLString }, + }, + }); + + const BlogQuery = new GraphQLObjectType({ + name: 'Query', + fields: { + article: { + args: { id: { type: GraphQLString } }, + type: BlogArticle, + }, + feed: { + type: new GraphQLList(BlogArticle), + }, + }, + }); + + const BlogMutation = new GraphQLObjectType({ + name: 'Mutation', + fields: { + writeArticle: { + type: BlogArticle, + }, + }, + }); + + const BlogSubscription = new GraphQLObjectType({ + name: 'Subscription', + fields: { + articleSubscribe: { + args: { id: { type: GraphQLString } }, + type: BlogArticle, + }, + }, + }); + + const schema = new GraphQLSchema({ + description: 'Sample schema', + query: BlogQuery, + mutation: BlogMutation, + subscription: BlogSubscription, + }); + + expect(printSchema(schema)).to.equal(dedent` + """Sample schema""" + schema { + query: Query + mutation: Mutation + subscription: Subscription + } + + type Query { + article(id: String): Article + feed: [Article] + } + + type Article { + id: String + isPublished: Boolean + author: Author + title: String + body: String + } + + type Author { + id: String + name: String + pic(width: Int, height: Int): Image + recentArticle: Article + } + + type Image { + url: String + width: Int + height: Int + } + + type Mutation { + writeArticle: Article + } + + type Subscription { + articleSubscribe(id: String): Article + } + `); + }); + + describe('Root types', () => { + const testType = new GraphQLObjectType({ name: 'TestType', fields: {} }); + + it('defines a query root', () => { + const schema = new GraphQLSchema({ query: testType }); + expect(schema.getQueryType()).to.equal(testType); + expect(schema.getTypeMap()).to.include.keys('TestType'); + }); + + it('defines a mutation root', () => { + const schema = new GraphQLSchema({ mutation: testType }); + expect(schema.getMutationType()).to.equal(testType); + expect(schema.getTypeMap()).to.include.keys('TestType'); + }); + + it('defines a subscription root', () => { + const schema = new GraphQLSchema({ subscription: testType }); + expect(schema.getSubscriptionType()).to.equal(testType); + expect(schema.getTypeMap()).to.include.keys('TestType'); + }); + }); + + describe('Type Map', () => { + it('includes interface possible types in the type map', () => { + const SomeInterface = new GraphQLInterfaceType({ + name: 'SomeInterface', + fields: {}, + }); + + const SomeSubtype = new GraphQLObjectType({ + name: 'SomeSubtype', + fields: {}, + interfaces: [SomeInterface], + }); + + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + iface: { type: SomeInterface }, + }, + }), + types: [SomeSubtype], + }); + + expect(schema.getType('SomeInterface')).to.equal(SomeInterface); + expect(schema.getType('SomeSubtype')).to.equal(SomeSubtype); + + expect(schema.isSubType(SomeInterface, SomeSubtype)).to.equal(true); + }); + + it("includes interface's thunk subtypes in the type map", () => { + const SomeInterface = new GraphQLInterfaceType({ + name: 'SomeInterface', + fields: {}, + interfaces: () => [AnotherInterface], + }); + + const AnotherInterface = new GraphQLInterfaceType({ + name: 'AnotherInterface', + fields: {}, + }); + + const SomeSubtype = new GraphQLObjectType({ + name: 'SomeSubtype', + fields: {}, + interfaces: () => [SomeInterface], + }); + + const schema = new GraphQLSchema({ types: [SomeSubtype] }); + + expect(schema.getType('SomeInterface')).to.equal(SomeInterface); + expect(schema.getType('AnotherInterface')).to.equal(AnotherInterface); + expect(schema.getType('SomeSubtype')).to.equal(SomeSubtype); + }); + + it('includes nested input objects in the map', () => { + const NestedInputObject = new GraphQLInputObjectType({ + name: 'NestedInputObject', + fields: {}, + }); + + const SomeInputObject = new GraphQLInputObjectType({ + name: 'SomeInputObject', + fields: { nested: { type: NestedInputObject } }, + }); + + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + something: { + type: GraphQLString, + args: { input: { type: SomeInputObject } }, + }, + }, + }), + }); + + expect(schema.getType('SomeInputObject')).to.equal(SomeInputObject); + expect(schema.getType('NestedInputObject')).to.equal(NestedInputObject); + }); + + it('includes input types only used in directives', () => { + const directive = new GraphQLDirective({ + name: 'dir', + locations: [DirectiveLocation.OBJECT], + args: { + arg: { + type: new GraphQLInputObjectType({ name: 'Foo', fields: {} }), + }, + argList: { + type: new GraphQLList( + new GraphQLInputObjectType({ name: 'Bar', fields: {} }), + ), + }, + }, + }); + const schema = new GraphQLSchema({ directives: [directive] }); + + expect(schema.getTypeMap()).to.include.keys('Foo', 'Bar'); + }); + }); + + it('preserves the order of user provided types', () => { + const aType = new GraphQLObjectType({ + name: 'A', + fields: { + sub: { type: new GraphQLScalarType({ name: 'ASub' }) }, + }, + }); + const zType = new GraphQLObjectType({ + name: 'Z', + fields: { + sub: { type: new GraphQLScalarType({ name: 'ZSub' }) }, + }, + }); + const queryType = new GraphQLObjectType({ + name: 'Query', + fields: { + a: { type: aType }, + z: { type: zType }, + sub: { type: new GraphQLScalarType({ name: 'QuerySub' }) }, + }, + }); + const schema = new GraphQLSchema({ + types: [zType, queryType, aType], + query: queryType, + }); + + const typeNames = Object.keys(schema.getTypeMap()); + expect(typeNames).to.deep.equal([ + 'Z', + 'ZSub', + 'Query', + 'QuerySub', + 'A', + 'ASub', + 'Boolean', + 'String', + '__Schema', + '__Type', + '__TypeKind', + '__Field', + '__InputValue', + '__EnumValue', + '__Directive', + '__DirectiveLocation', + ]); + + // Also check that this order is stable + const copySchema = new GraphQLSchema(schema.toConfig()); + expect(Object.keys(copySchema.getTypeMap())).to.deep.equal(typeNames); + }); + + it('can be Object.toStringified', () => { + const schema = new GraphQLSchema({}); + + expect(Object.prototype.toString.call(schema)).to.equal( + '[object GraphQLSchema]', + ); + }); + + describe('Validity', () => { + describe('when not assumed valid', () => { + it('configures the schema to still needing validation', () => { + expect( + new GraphQLSchema({ + assumeValid: false, + }).__validationErrors, + ).to.equal(undefined); + }); + + it('checks the configuration for mistakes', () => { + // @ts-expect-error + expect(() => new GraphQLSchema(JSON.parse)).to.throw(); + // @ts-expect-error + expect(() => new GraphQLSchema({ types: {} })).to.throw(); + // @ts-expect-error + expect(() => new GraphQLSchema({ directives: {} })).to.throw(); + }); + }); + + describe('A Schema must contain uniquely named types', () => { + it('rejects a Schema which redefines a built-in type', () => { + const FakeString = new GraphQLScalarType({ name: 'String' }); + + const QueryType = new GraphQLObjectType({ + name: 'Query', + fields: { + normal: { type: GraphQLString }, + fake: { type: FakeString }, + }, + }); + + expect(() => new GraphQLSchema({ query: QueryType })).to.throw( + 'Schema must contain uniquely named types but contains multiple types named "String".', + ); + }); + + it('rejects a Schema when a provided type has no name', () => { + const query = new GraphQLObjectType({ + name: 'Query', + fields: { foo: { type: GraphQLString } }, + }); + const types = [{}, query, {}]; + + // @ts-expect-error + expect(() => new GraphQLSchema({ query, types })).to.throw( + 'One of the provided types for building the Schema is missing a name.', + ); + }); + + it('rejects a Schema which defines an object type twice', () => { + const types = [ + new GraphQLObjectType({ name: 'SameName', fields: {} }), + new GraphQLObjectType({ name: 'SameName', fields: {} }), + ]; + + expect(() => new GraphQLSchema({ types })).to.throw( + 'Schema must contain uniquely named types but contains multiple types named "SameName".', + ); + }); + + it('rejects a Schema which defines fields with conflicting types', () => { + const fields = {}; + const QueryType = new GraphQLObjectType({ + name: 'Query', + fields: { + a: { type: new GraphQLObjectType({ name: 'SameName', fields }) }, + b: { type: new GraphQLObjectType({ name: 'SameName', fields }) }, + }, + }); + + expect(() => new GraphQLSchema({ query: QueryType })).to.throw( + 'Schema must contain uniquely named types but contains multiple types named "SameName".', + ); + }); + }); + + describe('when assumed valid', () => { + it('configures the schema to have no errors', () => { + expect( + new GraphQLSchema({ + assumeValid: true, + }).__validationErrors, + ).to.deep.equal([]); + }); + }); + }); +}); diff --git a/src/type/__tests__/validation-test.ts b/src/type/__tests__/validation-test.ts new file mode 100644 index 00000000..e34abbe7 --- /dev/null +++ b/src/type/__tests__/validation-test.ts @@ -0,0 +1,2629 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; +import { expectJSON } from '../../__testUtils__/expectJSON'; + +import { inspect } from '../../jsutils/inspect'; + +import { DirectiveLocation } from '../../language/directiveLocation'; +import { parse } from '../../language/parser'; + +import { buildSchema } from '../../utilities/buildASTSchema'; +import { extendSchema } from '../../utilities/extendSchema'; + +import type { + GraphQLArgumentConfig, + GraphQLFieldConfig, + GraphQLInputFieldConfig, + GraphQLInputType, + GraphQLNamedType, + GraphQLOutputType, +} from '../definition'; +import { + assertEnumType, + assertInputObjectType, + assertInterfaceType, + assertObjectType, + assertScalarType, + assertUnionType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLUnionType, +} from '../definition'; +import { assertDirective, GraphQLDirective } from '../directives'; +import { GraphQLString } from '../scalars'; +import { GraphQLSchema } from '../schema'; +import { assertValidSchema, validateSchema } from '../validate'; + +const SomeSchema = buildSchema(` + scalar SomeScalar + + interface SomeInterface { f: SomeObject } + + type SomeObject implements SomeInterface { f: SomeObject } + + union SomeUnion = SomeObject + + enum SomeEnum { ONLY } + + input SomeInputObject { val: String = "hello" } + + directive @SomeDirective on QUERY +`); + +const SomeScalarType = assertScalarType(SomeSchema.getType('SomeScalar')); +const SomeInterfaceType = assertInterfaceType( + SomeSchema.getType('SomeInterface'), +); +const SomeObjectType = assertObjectType(SomeSchema.getType('SomeObject')); +const SomeUnionType = assertUnionType(SomeSchema.getType('SomeUnion')); +const SomeEnumType = assertEnumType(SomeSchema.getType('SomeEnum')); +const SomeInputObjectType = assertInputObjectType( + SomeSchema.getType('SomeInputObject'), +); + +const SomeDirective = assertDirective(SomeSchema.getDirective('SomeDirective')); + +function withModifiers( + type: T, +): Array | GraphQLNonNull>> { + return [ + type, + new GraphQLList(type), + new GraphQLNonNull(type), + new GraphQLNonNull(new GraphQLList(type)), + ]; +} + +const outputTypes: ReadonlyArray = [ + ...withModifiers(GraphQLString), + ...withModifiers(SomeScalarType), + ...withModifiers(SomeEnumType), + ...withModifiers(SomeObjectType), + ...withModifiers(SomeUnionType), + ...withModifiers(SomeInterfaceType), +]; + +const notOutputTypes: ReadonlyArray = [ + ...withModifiers(SomeInputObjectType), +]; + +const inputTypes: ReadonlyArray = [ + ...withModifiers(GraphQLString), + ...withModifiers(SomeScalarType), + ...withModifiers(SomeEnumType), + ...withModifiers(SomeInputObjectType), +]; + +const notInputTypes: ReadonlyArray = [ + ...withModifiers(SomeObjectType), + ...withModifiers(SomeUnionType), + ...withModifiers(SomeInterfaceType), +]; + +function schemaWithFieldType(type: GraphQLOutputType): GraphQLSchema { + return new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { f: { type } }, + }), + }); +} + +describe('Type System: A Schema must have Object root types', () => { + it('accepts a Schema whose query type is an object type', () => { + const schema = buildSchema(` + type Query { + test: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + + const schemaWithDef = buildSchema(` + schema { + query: QueryRoot + } + + type QueryRoot { + test: String + } + `); + expectJSON(validateSchema(schemaWithDef)).toDeepEqual([]); + }); + + it('accepts a Schema whose query and mutation types are object types', () => { + const schema = buildSchema(` + type Query { + test: String + } + + type Mutation { + test: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + + const schemaWithDef = buildSchema(` + schema { + query: QueryRoot + mutation: MutationRoot + } + + type QueryRoot { + test: String + } + + type MutationRoot { + test: String + } + `); + expectJSON(validateSchema(schemaWithDef)).toDeepEqual([]); + }); + + it('accepts a Schema whose query and subscription types are object types', () => { + const schema = buildSchema(` + type Query { + test: String + } + + type Subscription { + test: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + + const schemaWithDef = buildSchema(` + schema { + query: QueryRoot + subscription: SubscriptionRoot + } + + type QueryRoot { + test: String + } + + type SubscriptionRoot { + test: String + } + `); + expectJSON(validateSchema(schemaWithDef)).toDeepEqual([]); + }); + + it('rejects a Schema without a query type', () => { + const schema = buildSchema(` + type Mutation { + test: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: 'Query root type must be provided.', + }, + ]); + + const schemaWithDef = buildSchema(` + schema { + mutation: MutationRoot + } + + type MutationRoot { + test: String + } + `); + expectJSON(validateSchema(schemaWithDef)).toDeepEqual([ + { + message: 'Query root type must be provided.', + locations: [{ line: 2, column: 7 }], + }, + ]); + }); + + it('rejects a Schema whose query root type is not an Object type', () => { + const schema = buildSchema(` + input Query { + test: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: 'Query root type must be Object type, it cannot be Query.', + locations: [{ line: 2, column: 7 }], + }, + ]); + + const schemaWithDef = buildSchema(` + schema { + query: SomeInputObject + } + + input SomeInputObject { + test: String + } + `); + expectJSON(validateSchema(schemaWithDef)).toDeepEqual([ + { + message: + 'Query root type must be Object type, it cannot be SomeInputObject.', + locations: [{ line: 3, column: 16 }], + }, + ]); + }); + + it('rejects a Schema whose mutation type is an input type', () => { + const schema = buildSchema(` + type Query { + field: String + } + + input Mutation { + test: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Mutation root type must be Object type if provided, it cannot be Mutation.', + locations: [{ line: 6, column: 7 }], + }, + ]); + + const schemaWithDef = buildSchema(` + schema { + query: Query + mutation: SomeInputObject + } + + type Query { + field: String + } + + input SomeInputObject { + test: String + } + `); + expectJSON(validateSchema(schemaWithDef)).toDeepEqual([ + { + message: + 'Mutation root type must be Object type if provided, it cannot be SomeInputObject.', + locations: [{ line: 4, column: 19 }], + }, + ]); + }); + + it('rejects a Schema whose subscription type is an input type', () => { + const schema = buildSchema(` + type Query { + field: String + } + + input Subscription { + test: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Subscription root type must be Object type if provided, it cannot be Subscription.', + locations: [{ line: 6, column: 7 }], + }, + ]); + + const schemaWithDef = buildSchema(` + schema { + query: Query + subscription: SomeInputObject + } + + type Query { + field: String + } + + input SomeInputObject { + test: String + } + `); + expectJSON(validateSchema(schemaWithDef)).toDeepEqual([ + { + message: + 'Subscription root type must be Object type if provided, it cannot be SomeInputObject.', + locations: [{ line: 4, column: 23 }], + }, + ]); + }); + + it('rejects a schema extended with invalid root types', () => { + let schema = buildSchema(` + input SomeInputObject { + test: String + } + `); + + schema = extendSchema( + schema, + parse(` + extend schema { + query: SomeInputObject + } + `), + ); + + schema = extendSchema( + schema, + parse(` + extend schema { + mutation: SomeInputObject + } + `), + ); + + schema = extendSchema( + schema, + parse(` + extend schema { + subscription: SomeInputObject + } + `), + ); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Query root type must be Object type, it cannot be SomeInputObject.', + locations: [{ line: 3, column: 18 }], + }, + { + message: + 'Mutation root type must be Object type if provided, it cannot be SomeInputObject.', + locations: [{ line: 3, column: 21 }], + }, + { + message: + 'Subscription root type must be Object type if provided, it cannot be SomeInputObject.', + locations: [{ line: 3, column: 25 }], + }, + ]); + }); + + it('rejects a Schema whose types are incorrectly typed', () => { + const schema = new GraphQLSchema({ + query: SomeObjectType, + // @ts-expect-error + types: [{ name: 'SomeType' }, SomeDirective], + }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: 'Expected GraphQL named type but got: { name: "SomeType" }.', + }, + { + message: 'Expected GraphQL named type but got: @SomeDirective.', + locations: [{ line: 14, column: 3 }], + }, + ]); + }); + + it('rejects a Schema whose directives are incorrectly typed', () => { + const schema = new GraphQLSchema({ + query: SomeObjectType, + // @ts-expect-error + directives: [null, 'SomeDirective', SomeScalarType], + }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: 'Expected directive but got: null.', + }, + { + message: 'Expected directive but got: "SomeDirective".', + }, + { + message: 'Expected directive but got: SomeScalar.', + locations: [{ line: 2, column: 3 }], + }, + ]); + }); +}); + +describe('Type System: Objects must have fields', () => { + it('accepts an Object type with fields object', () => { + const schema = buildSchema(` + type Query { + field: SomeObject + } + + type SomeObject { + field: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects an Object type with missing fields', () => { + const schema = buildSchema(` + type Query { + test: IncompleteObject + } + + type IncompleteObject + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: 'Type IncompleteObject must define one or more fields.', + locations: [{ line: 6, column: 7 }], + }, + ]); + + const manualSchema = schemaWithFieldType( + new GraphQLObjectType({ + name: 'IncompleteObject', + fields: {}, + }), + ); + expectJSON(validateSchema(manualSchema)).toDeepEqual([ + { + message: 'Type IncompleteObject must define one or more fields.', + }, + ]); + + const manualSchema2 = schemaWithFieldType( + new GraphQLObjectType({ + name: 'IncompleteObject', + fields() { + return {}; + }, + }), + ); + expectJSON(validateSchema(manualSchema2)).toDeepEqual([ + { + message: 'Type IncompleteObject must define one or more fields.', + }, + ]); + }); + + it('rejects an Object type with incorrectly named fields', () => { + const schema = schemaWithFieldType( + new GraphQLObjectType({ + name: 'SomeObject', + fields: { + __badName: { type: GraphQLString }, + }, + }), + ); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Name "__badName" must not begin with "__", which is reserved by GraphQL introspection.', + }, + ]); + }); +}); + +describe('Type System: Fields args must be properly named', () => { + it('accepts field args with valid names', () => { + const schema = schemaWithFieldType( + new GraphQLObjectType({ + name: 'SomeObject', + fields: { + goodField: { + type: GraphQLString, + args: { + goodArg: { type: GraphQLString }, + }, + }, + }, + }), + ); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects field arg with invalid names', () => { + const schema = schemaWithFieldType( + new GraphQLObjectType({ + name: 'SomeObject', + fields: { + badField: { + type: GraphQLString, + args: { + __badName: { type: GraphQLString }, + }, + }, + }, + }), + ); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Name "__badName" must not begin with "__", which is reserved by GraphQL introspection.', + }, + ]); + }); +}); + +describe('Type System: Union types must be valid', () => { + it('accepts a Union type with member types', () => { + const schema = buildSchema(` + type Query { + test: GoodUnion + } + + type TypeA { + field: String + } + + type TypeB { + field: String + } + + union GoodUnion = + | TypeA + | TypeB + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects a Union type with empty types', () => { + let schema = buildSchema(` + type Query { + test: BadUnion + } + + union BadUnion + `); + + schema = extendSchema( + schema, + parse(` + directive @test on UNION + + extend union BadUnion @test + `), + ); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: 'Union type BadUnion must define one or more member types.', + locations: [ + { line: 6, column: 7 }, + { line: 4, column: 9 }, + ], + }, + ]); + }); + + it('rejects a Union type with duplicated member type', () => { + let schema = buildSchema(` + type Query { + test: BadUnion + } + + type TypeA { + field: String + } + + type TypeB { + field: String + } + + union BadUnion = + | TypeA + | TypeB + | TypeA + `); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: 'Union type BadUnion can only include type TypeA once.', + locations: [ + { line: 15, column: 11 }, + { line: 17, column: 11 }, + ], + }, + ]); + + schema = extendSchema(schema, parse('extend union BadUnion = TypeB')); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: 'Union type BadUnion can only include type TypeA once.', + locations: [ + { line: 15, column: 11 }, + { line: 17, column: 11 }, + ], + }, + { + message: 'Union type BadUnion can only include type TypeB once.', + locations: [ + { line: 16, column: 11 }, + { line: 1, column: 25 }, + ], + }, + ]); + }); + + it('rejects a Union type with non-Object members types', () => { + let schema = buildSchema(` + type Query { + test: BadUnion + } + + type TypeA { + field: String + } + + type TypeB { + field: String + } + + union BadUnion = + | TypeA + | String + | TypeB + `); + + schema = extendSchema(schema, parse('extend union BadUnion = Int')); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Union type BadUnion can only include Object types, it cannot include String.', + locations: [{ line: 16, column: 11 }], + }, + { + message: + 'Union type BadUnion can only include Object types, it cannot include Int.', + locations: [{ line: 1, column: 25 }], + }, + ]); + + const badUnionMemberTypes = [ + GraphQLString, + new GraphQLNonNull(SomeObjectType), + new GraphQLList(SomeObjectType), + SomeInterfaceType, + SomeUnionType, + SomeEnumType, + SomeInputObjectType, + ]; + for (const memberType of badUnionMemberTypes) { + const badUnion = new GraphQLUnionType({ + name: 'BadUnion', + // @ts-expect-error + types: [memberType], + }); + const badSchema = schemaWithFieldType(badUnion); + expectJSON(validateSchema(badSchema)).toDeepEqual([ + { + message: + 'Union type BadUnion can only include Object types, ' + + `it cannot include ${inspect(memberType)}.`, + }, + ]); + } + }); +}); + +describe('Type System: Input Objects must have fields', () => { + it('accepts an Input Object type with fields', () => { + const schema = buildSchema(` + type Query { + field(arg: SomeInputObject): String + } + + input SomeInputObject { + field: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects an Input Object type with missing fields', () => { + let schema = buildSchema(` + type Query { + field(arg: SomeInputObject): String + } + + input SomeInputObject + `); + + schema = extendSchema( + schema, + parse(` + directive @test on INPUT_OBJECT + + extend input SomeInputObject @test + `), + ); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Input Object type SomeInputObject must define one or more fields.', + locations: [ + { line: 6, column: 7 }, + { line: 4, column: 9 }, + ], + }, + ]); + }); + + it('accepts an Input Object with breakable circular reference', () => { + const schema = buildSchema(` + type Query { + field(arg: SomeInputObject): String + } + + input SomeInputObject { + self: SomeInputObject + arrayOfSelf: [SomeInputObject] + nonNullArrayOfSelf: [SomeInputObject]! + nonNullArrayOfNonNullSelf: [SomeInputObject!]! + intermediateSelf: AnotherInputObject + } + + input AnotherInputObject { + parent: SomeInputObject + } + `); + + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects an Input Object with non-breakable circular reference', () => { + const schema = buildSchema(` + type Query { + field(arg: SomeInputObject): String + } + + input SomeInputObject { + nonNullSelf: SomeInputObject! + } + `); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Cannot reference Input Object "SomeInputObject" within itself through a series of non-null fields: "nonNullSelf".', + locations: [{ line: 7, column: 9 }], + }, + ]); + }); + + it('rejects Input Objects with non-breakable circular reference spread across them', () => { + const schema = buildSchema(` + type Query { + field(arg: SomeInputObject): String + } + + input SomeInputObject { + startLoop: AnotherInputObject! + } + + input AnotherInputObject { + nextInLoop: YetAnotherInputObject! + } + + input YetAnotherInputObject { + closeLoop: SomeInputObject! + } + `); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Cannot reference Input Object "SomeInputObject" within itself through a series of non-null fields: "startLoop.nextInLoop.closeLoop".', + locations: [ + { line: 7, column: 9 }, + { line: 11, column: 9 }, + { line: 15, column: 9 }, + ], + }, + ]); + }); + + it('rejects Input Objects with multiple non-breakable circular reference', () => { + const schema = buildSchema(` + type Query { + field(arg: SomeInputObject): String + } + + input SomeInputObject { + startLoop: AnotherInputObject! + } + + input AnotherInputObject { + closeLoop: SomeInputObject! + startSecondLoop: YetAnotherInputObject! + } + + input YetAnotherInputObject { + closeSecondLoop: AnotherInputObject! + nonNullSelf: YetAnotherInputObject! + } + `); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Cannot reference Input Object "SomeInputObject" within itself through a series of non-null fields: "startLoop.closeLoop".', + locations: [ + { line: 7, column: 9 }, + { line: 11, column: 9 }, + ], + }, + { + message: + 'Cannot reference Input Object "AnotherInputObject" within itself through a series of non-null fields: "startSecondLoop.closeSecondLoop".', + locations: [ + { line: 12, column: 9 }, + { line: 16, column: 9 }, + ], + }, + { + message: + 'Cannot reference Input Object "YetAnotherInputObject" within itself through a series of non-null fields: "nonNullSelf".', + locations: [{ line: 17, column: 9 }], + }, + ]); + }); + + it('rejects an Input Object type with incorrectly typed fields', () => { + const schema = buildSchema(` + type Query { + field(arg: SomeInputObject): String + } + + type SomeObject { + field: String + } + + union SomeUnion = SomeObject + + input SomeInputObject { + badObject: SomeObject + badUnion: SomeUnion + goodInputObject: SomeInputObject + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of SomeInputObject.badObject must be Input Type but got: SomeObject.', + locations: [{ line: 13, column: 20 }], + }, + { + message: + 'The type of SomeInputObject.badUnion must be Input Type but got: SomeUnion.', + locations: [{ line: 14, column: 19 }], + }, + ]); + }); + + it('rejects an Input Object type with required argument that is deprecated', () => { + const schema = buildSchema(` + type Query { + field(arg: SomeInputObject): String + } + + input SomeInputObject { + badField: String! @deprecated + optionalField: String @deprecated + anotherOptionalField: String! = "" @deprecated + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Required input field SomeInputObject.badField cannot be deprecated.', + locations: [ + { line: 7, column: 27 }, + { line: 7, column: 19 }, + ], + }, + ]); + }); +}); + +describe('Type System: Enum types must be well defined', () => { + it('rejects an Enum type without values', () => { + let schema = buildSchema(` + type Query { + field: SomeEnum + } + + enum SomeEnum + `); + + schema = extendSchema( + schema, + parse(` + directive @test on ENUM + + extend enum SomeEnum @test + `), + ); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: 'Enum type SomeEnum must define one or more values.', + locations: [ + { line: 6, column: 7 }, + { line: 4, column: 9 }, + ], + }, + ]); + }); + + it('rejects an Enum type with incorrectly named values', () => { + const schema = schemaWithFieldType( + new GraphQLEnumType({ + name: 'SomeEnum', + values: { + __badName: {}, + }, + }), + ); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Name "__badName" must not begin with "__", which is reserved by GraphQL introspection.', + }, + ]); + }); +}); + +describe('Type System: Object fields must have output types', () => { + function schemaWithObjectField( + fieldConfig: GraphQLFieldConfig, + ): GraphQLSchema { + const BadObjectType = new GraphQLObjectType({ + name: 'BadObject', + fields: { + badField: fieldConfig, + }, + }); + + return new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + f: { type: BadObjectType }, + }, + }), + types: [SomeObjectType], + }); + } + + for (const type of outputTypes) { + const typeName = inspect(type); + it(`accepts an output type as an Object field type: ${typeName}`, () => { + const schema = schemaWithObjectField({ type }); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + } + + it('rejects an empty Object field type', () => { + // @ts-expect-error (type field must not be undefined) + const schema = schemaWithObjectField({ type: undefined }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of BadObject.badField must be Output Type but got: undefined.', + }, + ]); + }); + + for (const type of notOutputTypes) { + const typeStr = inspect(type); + it(`rejects a non-output type as an Object field type: ${typeStr}`, () => { + // @ts-expect-error + const schema = schemaWithObjectField({ type }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: `The type of BadObject.badField must be Output Type but got: ${typeStr}.`, + }, + ]); + }); + } + + it('rejects a non-type value as an Object field type', () => { + // @ts-expect-error + const schema = schemaWithObjectField({ type: Number }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of BadObject.badField must be Output Type but got: [function Number].', + }, + { + message: 'Expected GraphQL named type but got: [function Number].', + }, + ]); + }); + + it('rejects with relevant locations for a non-output type as an Object field type', () => { + const schema = buildSchema(` + type Query { + field: [SomeInputObject] + } + + input SomeInputObject { + field: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of Query.field must be Output Type but got: [SomeInputObject].', + locations: [{ line: 3, column: 16 }], + }, + ]); + }); +}); + +describe('Type System: Objects can only implement unique interfaces', () => { + it('rejects an Object implementing a non-type values', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'BadObject', + // @ts-expect-error (interfaces must not contain undefined) + interfaces: [undefined], + fields: { f: { type: GraphQLString } }, + }), + }); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Type BadObject must only implement Interface types, it cannot implement undefined.', + }, + ]); + }); + + it('rejects an Object implementing a non-Interface type', () => { + const schema = buildSchema(` + type Query { + test: BadObject + } + + input SomeInputObject { + field: String + } + + type BadObject implements SomeInputObject { + field: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Type BadObject must only implement Interface types, it cannot implement SomeInputObject.', + locations: [{ line: 10, column: 33 }], + }, + ]); + }); + + it('rejects an Object implementing the same interface twice', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field: String + } + + type AnotherObject implements AnotherInterface & AnotherInterface { + field: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: 'Type AnotherObject can only implement AnotherInterface once.', + locations: [ + { line: 10, column: 37 }, + { line: 10, column: 56 }, + ], + }, + ]); + }); + + it('rejects an Object implementing the same interface twice due to extension', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field: String + } + + type AnotherObject implements AnotherInterface { + field: String + } + `); + const extendedSchema = extendSchema( + schema, + parse('extend type AnotherObject implements AnotherInterface'), + ); + expectJSON(validateSchema(extendedSchema)).toDeepEqual([ + { + message: 'Type AnotherObject can only implement AnotherInterface once.', + locations: [ + { line: 10, column: 37 }, + { line: 1, column: 38 }, + ], + }, + ]); + }); +}); + +describe('Type System: Interface extensions should be valid', () => { + it('rejects an Object implementing the extended interface due to missing field', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field: String + } + + type AnotherObject implements AnotherInterface { + field: String + } + `); + const extendedSchema = extendSchema( + schema, + parse(` + extend interface AnotherInterface { + newField: String + } + + extend type AnotherObject { + differentNewField: String + } + `), + ); + expectJSON(validateSchema(extendedSchema)).toDeepEqual([ + { + message: + 'Interface field AnotherInterface.newField expected but AnotherObject does not provide it.', + locations: [ + { line: 3, column: 11 }, + { line: 10, column: 7 }, + { line: 6, column: 9 }, + ], + }, + ]); + }); + + it('rejects an Object implementing the extended interface due to missing field args', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field: String + } + + type AnotherObject implements AnotherInterface { + field: String + } + `); + const extendedSchema = extendSchema( + schema, + parse(` + extend interface AnotherInterface { + newField(test: Boolean): String + } + + extend type AnotherObject { + newField: String + } + `), + ); + expectJSON(validateSchema(extendedSchema)).toDeepEqual([ + { + message: + 'Interface field argument AnotherInterface.newField(test:) expected but AnotherObject.newField does not provide it.', + locations: [ + { line: 3, column: 20 }, + { line: 7, column: 11 }, + ], + }, + ]); + }); + + it('rejects Objects implementing the extended interface due to mismatching interface type', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field: String + } + + type AnotherObject implements AnotherInterface { + field: String + } + `); + const extendedSchema = extendSchema( + schema, + parse(` + extend interface AnotherInterface { + newInterfaceField: NewInterface + } + + interface NewInterface { + newField: String + } + + interface MismatchingInterface { + newField: String + } + + extend type AnotherObject { + newInterfaceField: MismatchingInterface + } + + # Required to prevent unused interface errors + type DummyObject implements NewInterface & MismatchingInterface { + newField: String + } + `), + ); + expectJSON(validateSchema(extendedSchema)).toDeepEqual([ + { + message: + 'Interface field AnotherInterface.newInterfaceField expects type NewInterface but AnotherObject.newInterfaceField is type MismatchingInterface.', + locations: [ + { line: 3, column: 30 }, + { line: 15, column: 30 }, + ], + }, + ]); + }); +}); + +describe('Type System: Interface fields must have output types', () => { + function schemaWithInterfaceField( + fieldConfig: GraphQLFieldConfig, + ): GraphQLSchema { + const fields = { badField: fieldConfig }; + + const BadInterfaceType = new GraphQLInterfaceType({ + name: 'BadInterface', + fields, + }); + + const BadImplementingType = new GraphQLObjectType({ + name: 'BadImplementing', + interfaces: [BadInterfaceType], + fields, + }); + + return new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + f: { type: BadInterfaceType }, + }, + }), + types: [BadImplementingType, SomeObjectType], + }); + } + + for (const type of outputTypes) { + const typeName = inspect(type); + it(`accepts an output type as an Interface field type: ${typeName}`, () => { + const schema = schemaWithInterfaceField({ type }); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + } + + it('rejects an empty Interface field type', () => { + // @ts-expect-error (type field must not be undefined) + const schema = schemaWithInterfaceField({ type: undefined }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of BadImplementing.badField must be Output Type but got: undefined.', + }, + { + message: + 'The type of BadInterface.badField must be Output Type but got: undefined.', + }, + ]); + }); + + for (const type of notOutputTypes) { + const typeStr = inspect(type); + it(`rejects a non-output type as an Interface field type: ${typeStr}`, () => { + // @ts-expect-error + const schema = schemaWithInterfaceField({ type }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: `The type of BadImplementing.badField must be Output Type but got: ${typeStr}.`, + }, + { + message: `The type of BadInterface.badField must be Output Type but got: ${typeStr}.`, + }, + ]); + }); + } + + it('rejects a non-type value as an Interface field type', () => { + // @ts-expect-error + const schema = schemaWithInterfaceField({ type: Number }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of BadImplementing.badField must be Output Type but got: [function Number].', + }, + { + message: + 'The type of BadInterface.badField must be Output Type but got: [function Number].', + }, + { + message: 'Expected GraphQL named type but got: [function Number].', + }, + ]); + }); + + it('rejects a non-output type as an Interface field type with locations', () => { + const schema = buildSchema(` + type Query { + test: SomeInterface + } + + interface SomeInterface { + field: SomeInputObject + } + + input SomeInputObject { + foo: String + } + + type SomeObject implements SomeInterface { + field: SomeInputObject + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of SomeInterface.field must be Output Type but got: SomeInputObject.', + locations: [{ line: 7, column: 16 }], + }, + { + message: + 'The type of SomeObject.field must be Output Type but got: SomeInputObject.', + locations: [{ line: 15, column: 16 }], + }, + ]); + }); + + it('accepts an interface not implemented by at least one object', () => { + const schema = buildSchema(` + type Query { + test: SomeInterface + } + + interface SomeInterface { + foo: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); +}); + +describe('Type System: Arguments must have input types', () => { + function schemaWithArg(argConfig: GraphQLArgumentConfig): GraphQLSchema { + const BadObjectType = new GraphQLObjectType({ + name: 'BadObject', + fields: { + badField: { + type: GraphQLString, + args: { + badArg: argConfig, + }, + }, + }, + }); + + return new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + f: { type: BadObjectType }, + }, + }), + directives: [ + new GraphQLDirective({ + name: 'BadDirective', + args: { + badArg: argConfig, + }, + locations: [DirectiveLocation.QUERY], + }), + ], + }); + } + + for (const type of inputTypes) { + const typeName = inspect(type); + it(`accepts an input type as a field arg type: ${typeName}`, () => { + const schema = schemaWithArg({ type }); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + } + + it('rejects an empty field arg type', () => { + // @ts-expect-error (type field must not be undefined) + const schema = schemaWithArg({ type: undefined }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of @BadDirective(badArg:) must be Input Type but got: undefined.', + }, + { + message: + 'The type of BadObject.badField(badArg:) must be Input Type but got: undefined.', + }, + ]); + }); + + for (const type of notInputTypes) { + const typeStr = inspect(type); + it(`rejects a non-input type as a field arg type: ${typeStr}`, () => { + // @ts-expect-error + const schema = schemaWithArg({ type }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: `The type of @BadDirective(badArg:) must be Input Type but got: ${typeStr}.`, + }, + { + message: `The type of BadObject.badField(badArg:) must be Input Type but got: ${typeStr}.`, + }, + ]); + }); + } + + it('rejects a non-type value as a field arg type', () => { + // @ts-expect-error + const schema = schemaWithArg({ type: Number }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of @BadDirective(badArg:) must be Input Type but got: [function Number].', + }, + { + message: + 'The type of BadObject.badField(badArg:) must be Input Type but got: [function Number].', + }, + { + message: 'Expected GraphQL named type but got: [function Number].', + }, + ]); + }); + + it('rejects an required argument that is deprecated', () => { + const schema = buildSchema(` + directive @BadDirective( + badArg: String! @deprecated + optionalArg: String @deprecated + anotherOptionalArg: String! = "" @deprecated + ) on FIELD + + type Query { + test( + badArg: String! @deprecated + optionalArg: String @deprecated + anotherOptionalArg: String! = "" @deprecated + ): String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Required argument @BadDirective(badArg:) cannot be deprecated.', + locations: [ + { line: 3, column: 25 }, + { line: 3, column: 17 }, + ], + }, + { + message: 'Required argument Query.test(badArg:) cannot be deprecated.', + locations: [ + { line: 10, column: 27 }, + { line: 10, column: 19 }, + ], + }, + ]); + }); + + it('rejects a non-input type as a field arg with locations', () => { + const schema = buildSchema(` + type Query { + test(arg: SomeObject): String + } + + type SomeObject { + foo: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of Query.test(arg:) must be Input Type but got: SomeObject.', + locations: [{ line: 3, column: 19 }], + }, + ]); + }); +}); + +describe('Type System: Input Object fields must have input types', () => { + function schemaWithInputField( + inputFieldConfig: GraphQLInputFieldConfig, + ): GraphQLSchema { + const BadInputObjectType = new GraphQLInputObjectType({ + name: 'BadInputObject', + fields: { + badField: inputFieldConfig, + }, + }); + + return new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + f: { + type: GraphQLString, + args: { + badArg: { type: BadInputObjectType }, + }, + }, + }, + }), + }); + } + + for (const type of inputTypes) { + const typeName = inspect(type); + it(`accepts an input type as an input field type: ${typeName}`, () => { + const schema = schemaWithInputField({ type }); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + } + + it('rejects an empty input field type', () => { + // @ts-expect-error (type field must not be undefined) + const schema = schemaWithInputField({ type: undefined }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of BadInputObject.badField must be Input Type but got: undefined.', + }, + ]); + }); + + for (const type of notInputTypes) { + const typeStr = inspect(type); + it(`rejects a non-input type as an input field type: ${typeStr}`, () => { + // @ts-expect-error + const schema = schemaWithInputField({ type }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: `The type of BadInputObject.badField must be Input Type but got: ${typeStr}.`, + }, + ]); + }); + } + + it('rejects a non-type value as an input field type', () => { + // @ts-expect-error + const schema = schemaWithInputField({ type: Number }); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of BadInputObject.badField must be Input Type but got: [function Number].', + }, + { + message: 'Expected GraphQL named type but got: [function Number].', + }, + ]); + }); + + it('rejects a non-input type as an input object field with locations', () => { + const schema = buildSchema(` + type Query { + test(arg: SomeInputObject): String + } + + input SomeInputObject { + foo: SomeObject + } + + type SomeObject { + bar: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'The type of SomeInputObject.foo must be Input Type but got: SomeObject.', + locations: [{ line: 7, column: 14 }], + }, + ]); + }); +}); + +describe('Objects must adhere to Interface they implement', () => { + it('accepts an Object which implements an Interface', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field(input: String): String + } + + type AnotherObject implements AnotherInterface { + field(input: String): String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('accepts an Object which implements an Interface along with more fields', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field(input: String): String + } + + type AnotherObject implements AnotherInterface { + field(input: String): String + anotherField: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('accepts an Object which implements an Interface field along with additional optional arguments', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field(input: String): String + } + + type AnotherObject implements AnotherInterface { + field(input: String, anotherInput: String): String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects an Object missing an Interface field', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field(input: String): String + } + + type AnotherObject implements AnotherInterface { + anotherField: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field AnotherInterface.field expected but AnotherObject does not provide it.', + locations: [ + { line: 7, column: 9 }, + { line: 10, column: 7 }, + ], + }, + ]); + }); + + it('rejects an Object with an incorrectly typed Interface field', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field(input: String): String + } + + type AnotherObject implements AnotherInterface { + field(input: String): Int + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field AnotherInterface.field expects type String but AnotherObject.field is type Int.', + locations: [ + { line: 7, column: 31 }, + { line: 11, column: 31 }, + ], + }, + ]); + }); + + it('rejects an Object with a differently typed Interface field', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + type A { foo: String } + type B { foo: String } + + interface AnotherInterface { + field: A + } + + type AnotherObject implements AnotherInterface { + field: B + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field AnotherInterface.field expects type A but AnotherObject.field is type B.', + locations: [ + { line: 10, column: 16 }, + { line: 14, column: 16 }, + ], + }, + ]); + }); + + it('accepts an Object with a subtyped Interface field (interface)', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field: AnotherInterface + } + + type AnotherObject implements AnotherInterface { + field: AnotherObject + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('accepts an Object with a subtyped Interface field (union)', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + type SomeObject { + field: String + } + + union SomeUnionType = SomeObject + + interface AnotherInterface { + field: SomeUnionType + } + + type AnotherObject implements AnotherInterface { + field: SomeObject + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects an Object missing an Interface argument', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field(input: String): String + } + + type AnotherObject implements AnotherInterface { + field: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field argument AnotherInterface.field(input:) expected but AnotherObject.field does not provide it.', + locations: [ + { line: 7, column: 15 }, + { line: 11, column: 9 }, + ], + }, + ]); + }); + + it('rejects an Object with an incorrectly typed Interface argument', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field(input: String): String + } + + type AnotherObject implements AnotherInterface { + field(input: Int): String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field argument AnotherInterface.field(input:) expects type String but AnotherObject.field(input:) is type Int.', + locations: [ + { line: 7, column: 22 }, + { line: 11, column: 22 }, + ], + }, + ]); + }); + + it('rejects an Object with both an incorrectly typed field and argument', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field(input: String): String + } + + type AnotherObject implements AnotherInterface { + field(input: Int): Int + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field AnotherInterface.field expects type String but AnotherObject.field is type Int.', + locations: [ + { line: 7, column: 31 }, + { line: 11, column: 28 }, + ], + }, + { + message: + 'Interface field argument AnotherInterface.field(input:) expects type String but AnotherObject.field(input:) is type Int.', + locations: [ + { line: 7, column: 22 }, + { line: 11, column: 22 }, + ], + }, + ]); + }); + + it('rejects an Object which implements an Interface field along with additional required arguments', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field(baseArg: String): String + } + + type AnotherObject implements AnotherInterface { + field( + baseArg: String, + requiredArg: String! + optionalArg1: String, + optionalArg2: String = "", + ): String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Object field AnotherObject.field includes required argument requiredArg that is missing from the Interface field AnotherInterface.field.', + locations: [ + { line: 13, column: 11 }, + { line: 7, column: 9 }, + ], + }, + ]); + }); + + it('accepts an Object with an equivalently wrapped Interface field type', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field: [String]! + } + + type AnotherObject implements AnotherInterface { + field: [String]! + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects an Object with a non-list Interface field list type', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field: [String] + } + + type AnotherObject implements AnotherInterface { + field: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field AnotherInterface.field expects type [String] but AnotherObject.field is type String.', + locations: [ + { line: 7, column: 16 }, + { line: 11, column: 16 }, + ], + }, + ]); + }); + + it('rejects an Object with a list Interface field non-list type', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field: String + } + + type AnotherObject implements AnotherInterface { + field: [String] + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field AnotherInterface.field expects type String but AnotherObject.field is type [String].', + locations: [ + { line: 7, column: 16 }, + { line: 11, column: 16 }, + ], + }, + ]); + }); + + it('accepts an Object with a subset non-null Interface field type', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field: String + } + + type AnotherObject implements AnotherInterface { + field: String! + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects an Object with a superset nullable Interface field type', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface AnotherInterface { + field: String! + } + + type AnotherObject implements AnotherInterface { + field: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field AnotherInterface.field expects type String! but AnotherObject.field is type String.', + locations: [ + { line: 7, column: 16 }, + { line: 11, column: 16 }, + ], + }, + ]); + }); + + it('rejects an Object missing a transitive interface', () => { + const schema = buildSchema(` + type Query { + test: AnotherObject + } + + interface SuperInterface { + field: String! + } + + interface AnotherInterface implements SuperInterface { + field: String! + } + + type AnotherObject implements AnotherInterface { + field: String! + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Type AnotherObject must implement SuperInterface because it is implemented by AnotherInterface.', + locations: [ + { line: 10, column: 45 }, + { line: 14, column: 37 }, + ], + }, + ]); + }); +}); + +describe('Interfaces must adhere to Interface they implement', () => { + it('accepts an Interface which implements an Interface', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field(input: String): String + } + + interface ChildInterface implements ParentInterface { + field(input: String): String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('accepts an Interface which implements an Interface along with more fields', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field(input: String): String + } + + interface ChildInterface implements ParentInterface { + field(input: String): String + anotherField: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('accepts an Interface which implements an Interface field along with additional optional arguments', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field(input: String): String + } + + interface ChildInterface implements ParentInterface { + field(input: String, anotherInput: String): String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects an Interface missing an Interface field', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field(input: String): String + } + + interface ChildInterface implements ParentInterface { + anotherField: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field ParentInterface.field expected but ChildInterface does not provide it.', + locations: [ + { line: 7, column: 9 }, + { line: 10, column: 7 }, + ], + }, + ]); + }); + + it('rejects an Interface with an incorrectly typed Interface field', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field(input: String): String + } + + interface ChildInterface implements ParentInterface { + field(input: String): Int + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field ParentInterface.field expects type String but ChildInterface.field is type Int.', + locations: [ + { line: 7, column: 31 }, + { line: 11, column: 31 }, + ], + }, + ]); + }); + + it('rejects an Interface with a differently typed Interface field', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + type A { foo: String } + type B { foo: String } + + interface ParentInterface { + field: A + } + + interface ChildInterface implements ParentInterface { + field: B + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field ParentInterface.field expects type A but ChildInterface.field is type B.', + locations: [ + { line: 10, column: 16 }, + { line: 14, column: 16 }, + ], + }, + ]); + }); + + it('accepts an Interface with a subtyped Interface field (interface)', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field: ParentInterface + } + + interface ChildInterface implements ParentInterface { + field: ChildInterface + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('accepts an Interface with a subtyped Interface field (union)', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + type SomeObject { + field: String + } + + union SomeUnionType = SomeObject + + interface ParentInterface { + field: SomeUnionType + } + + interface ChildInterface implements ParentInterface { + field: SomeObject + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects an Interface implementing a non-Interface type', () => { + const schema = buildSchema(` + type Query { + field: String + } + + input SomeInputObject { + field: String + } + + interface BadInterface implements SomeInputObject { + field: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Type BadInterface must only implement Interface types, it cannot implement SomeInputObject.', + locations: [{ line: 10, column: 41 }], + }, + ]); + }); + + it('rejects an Interface missing an Interface argument', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field(input: String): String + } + + interface ChildInterface implements ParentInterface { + field: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field argument ParentInterface.field(input:) expected but ChildInterface.field does not provide it.', + locations: [ + { line: 7, column: 15 }, + { line: 11, column: 9 }, + ], + }, + ]); + }); + + it('rejects an Interface with an incorrectly typed Interface argument', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field(input: String): String + } + + interface ChildInterface implements ParentInterface { + field(input: Int): String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field argument ParentInterface.field(input:) expects type String but ChildInterface.field(input:) is type Int.', + locations: [ + { line: 7, column: 22 }, + { line: 11, column: 22 }, + ], + }, + ]); + }); + + it('rejects an Interface with both an incorrectly typed field and argument', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field(input: String): String + } + + interface ChildInterface implements ParentInterface { + field(input: Int): Int + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field ParentInterface.field expects type String but ChildInterface.field is type Int.', + locations: [ + { line: 7, column: 31 }, + { line: 11, column: 28 }, + ], + }, + { + message: + 'Interface field argument ParentInterface.field(input:) expects type String but ChildInterface.field(input:) is type Int.', + locations: [ + { line: 7, column: 22 }, + { line: 11, column: 22 }, + ], + }, + ]); + }); + + it('rejects an Interface which implements an Interface field along with additional required arguments', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field(baseArg: String): String + } + + interface ChildInterface implements ParentInterface { + field( + baseArg: String, + requiredArg: String! + optionalArg1: String, + optionalArg2: String = "", + ): String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Object field ChildInterface.field includes required argument requiredArg that is missing from the Interface field ParentInterface.field.', + locations: [ + { line: 13, column: 11 }, + { line: 7, column: 9 }, + ], + }, + ]); + }); + + it('accepts an Interface with an equivalently wrapped Interface field type', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field: [String]! + } + + interface ChildInterface implements ParentInterface { + field: [String]! + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects an Interface with a non-list Interface field list type', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field: [String] + } + + interface ChildInterface implements ParentInterface { + field: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field ParentInterface.field expects type [String] but ChildInterface.field is type String.', + locations: [ + { line: 7, column: 16 }, + { line: 11, column: 16 }, + ], + }, + ]); + }); + + it('rejects an Interface with a list Interface field non-list type', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field: String + } + + interface ChildInterface implements ParentInterface { + field: [String] + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field ParentInterface.field expects type String but ChildInterface.field is type [String].', + locations: [ + { line: 7, column: 16 }, + { line: 11, column: 16 }, + ], + }, + ]); + }); + + it('accepts an Interface with a subset non-null Interface field type', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field: String + } + + interface ChildInterface implements ParentInterface { + field: String! + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([]); + }); + + it('rejects an Interface with a superset nullable Interface field type', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface ParentInterface { + field: String! + } + + interface ChildInterface implements ParentInterface { + field: String + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Interface field ParentInterface.field expects type String! but ChildInterface.field is type String.', + locations: [ + { line: 7, column: 16 }, + { line: 11, column: 16 }, + ], + }, + ]); + }); + + it('rejects an Object missing a transitive interface', () => { + const schema = buildSchema(` + type Query { + test: ChildInterface + } + + interface SuperInterface { + field: String! + } + + interface ParentInterface implements SuperInterface { + field: String! + } + + interface ChildInterface implements ParentInterface { + field: String! + } + `); + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Type ChildInterface must implement SuperInterface because it is implemented by ParentInterface.', + locations: [ + { line: 10, column: 44 }, + { line: 14, column: 43 }, + ], + }, + ]); + }); + + it('rejects a self reference interface', () => { + const schema = buildSchema(` + type Query { + test: FooInterface + } + + interface FooInterface implements FooInterface { + field: String + } + `); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Type FooInterface cannot implement itself because it would create a circular reference.', + locations: [{ line: 6, column: 41 }], + }, + ]); + }); + + it('rejects a circular Interface implementation', () => { + const schema = buildSchema(` + type Query { + test: FooInterface + } + + interface FooInterface implements BarInterface { + field: String + } + + interface BarInterface implements FooInterface { + field: String + } + `); + + expectJSON(validateSchema(schema)).toDeepEqual([ + { + message: + 'Type FooInterface cannot implement BarInterface because it would create a circular reference.', + locations: [ + { line: 10, column: 41 }, + { line: 6, column: 41 }, + ], + }, + { + message: + 'Type BarInterface cannot implement FooInterface because it would create a circular reference.', + locations: [ + { line: 6, column: 41 }, + { line: 10, column: 41 }, + ], + }, + ]); + }); +}); + +describe('assertValidSchema', () => { + it('do not throw on valid schemas', () => { + const schema = buildSchema(` + type Query { + foo: String + } + `); + expect(() => assertValidSchema(schema)).to.not.throw(); + }); + + it('include multiple errors into a description', () => { + const schema = buildSchema('type SomeType'); + expect(() => assertValidSchema(schema)).to.throw(dedent` + Query root type must be provided. + + Type SomeType must define one or more fields.`); + }); +}); diff --git a/src/type/assertName.ts b/src/type/assertName.ts new file mode 100644 index 00000000..f4f96fda --- /dev/null +++ b/src/type/assertName.ts @@ -0,0 +1,45 @@ +import { devAssert } from '../jsutils/devAssert'; + +import { GraphQLError } from '../error/GraphQLError'; + +import { isNameContinue, isNameStart } from '../language/characterClasses'; + +/** + * Upholds the spec rules about naming. + */ +export function assertName(name: string): string { + devAssert(name != null, 'Must provide name.'); + devAssert(typeof name === 'string', 'Expected name to be a string.'); + + if (name.length === 0) { + throw new GraphQLError('Expected name to be a non-empty string.'); + } + + for (let i = 1; i < name.length; ++i) { + if (!isNameContinue(name.charCodeAt(i))) { + throw new GraphQLError( + `Names must only contain [_a-zA-Z0-9] but "${name}" does not.`, + ); + } + } + + if (!isNameStart(name.charCodeAt(0))) { + throw new GraphQLError( + `Names must start with [_a-zA-Z] but "${name}" does not.`, + ); + } + + return name; +} + +/** + * Upholds the spec rules about naming enum values. + * + * @internal + */ +export function assertEnumValueName(name: string): string { + if (name === 'true' || name === 'false' || name === 'null') { + throw new GraphQLError(`Enum values cannot be named: ${name}`); + } + return assertName(name); +} diff --git a/src/type/definition.ts b/src/type/definition.ts new file mode 100644 index 00000000..090afa36 --- /dev/null +++ b/src/type/definition.ts @@ -0,0 +1,1741 @@ +import { devAssert } from '../jsutils/devAssert'; +import { didYouMean } from '../jsutils/didYouMean'; +import { identityFunc } from '../jsutils/identityFunc'; +import { inspect } from '../jsutils/inspect'; +import { instanceOf } from '../jsutils/instanceOf'; +import { isObjectLike } from '../jsutils/isObjectLike'; +import { keyMap } from '../jsutils/keyMap'; +import { keyValMap } from '../jsutils/keyValMap'; +import { mapValue } from '../jsutils/mapValue'; +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import type { Path } from '../jsutils/Path'; +import type { PromiseOrValue } from '../jsutils/PromiseOrValue'; +import { suggestionList } from '../jsutils/suggestionList'; +import { toObjMap } from '../jsutils/toObjMap'; + +import { GraphQLError } from '../error/GraphQLError'; + +import type { + EnumTypeDefinitionNode, + EnumTypeExtensionNode, + EnumValueDefinitionNode, + FieldDefinitionNode, + FieldNode, + FragmentDefinitionNode, + InputObjectTypeDefinitionNode, + InputObjectTypeExtensionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + InterfaceTypeExtensionNode, + ObjectTypeDefinitionNode, + ObjectTypeExtensionNode, + OperationDefinitionNode, + ScalarTypeDefinitionNode, + ScalarTypeExtensionNode, + UnionTypeDefinitionNode, + UnionTypeExtensionNode, + ValueNode, +} from '../language/ast'; +import { Kind } from '../language/kinds'; +import { print } from '../language/printer'; + +import { valueFromASTUntyped } from '../utilities/valueFromASTUntyped'; + +import { assertEnumValueName, assertName } from './assertName'; +import type { GraphQLSchema } from './schema'; + +// Predicates & Assertions + +/** + * These are all of the possible kinds of types. + */ +export type GraphQLType = + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + >; + +export function isType(type: unknown): type is GraphQLType { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + isInputObjectType(type) || + isListType(type) || + isNonNullType(type) + ); +} + +export function assertType(type: unknown): GraphQLType { + if (!isType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL type.`); + } + return type; +} + +/** + * There are predicates for each kind of GraphQL type. + */ +export function isScalarType(type: unknown): type is GraphQLScalarType { + return instanceOf(type, GraphQLScalarType); +} + +export function assertScalarType(type: unknown): GraphQLScalarType { + if (!isScalarType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Scalar type.`); + } + return type; +} + +export function isObjectType(type: unknown): type is GraphQLObjectType { + return instanceOf(type, GraphQLObjectType); +} + +export function assertObjectType(type: unknown): GraphQLObjectType { + if (!isObjectType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Object type.`); + } + return type; +} + +export function isInterfaceType(type: unknown): type is GraphQLInterfaceType { + return instanceOf(type, GraphQLInterfaceType); +} + +export function assertInterfaceType(type: unknown): GraphQLInterfaceType { + if (!isInterfaceType(type)) { + throw new Error( + `Expected ${inspect(type)} to be a GraphQL Interface type.`, + ); + } + return type; +} + +export function isUnionType(type: unknown): type is GraphQLUnionType { + return instanceOf(type, GraphQLUnionType); +} + +export function assertUnionType(type: unknown): GraphQLUnionType { + if (!isUnionType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Union type.`); + } + return type; +} + +export function isEnumType(type: unknown): type is GraphQLEnumType { + return instanceOf(type, GraphQLEnumType); +} + +export function assertEnumType(type: unknown): GraphQLEnumType { + if (!isEnumType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Enum type.`); + } + return type; +} + +export function isInputObjectType( + type: unknown, +): type is GraphQLInputObjectType { + return instanceOf(type, GraphQLInputObjectType); +} + +export function assertInputObjectType(type: unknown): GraphQLInputObjectType { + if (!isInputObjectType(type)) { + throw new Error( + `Expected ${inspect(type)} to be a GraphQL Input Object type.`, + ); + } + return type; +} + +export function isListType( + type: GraphQLInputType, +): type is GraphQLList; +export function isListType( + type: GraphQLOutputType, +): type is GraphQLList; +export function isListType(type: unknown): type is GraphQLList; +export function isListType(type: unknown): type is GraphQLList { + return instanceOf(type, GraphQLList); +} + +export function assertListType(type: unknown): GraphQLList { + if (!isListType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL List type.`); + } + return type; +} + +export function isNonNullType( + type: GraphQLInputType, +): type is GraphQLNonNull; +export function isNonNullType( + type: GraphQLOutputType, +): type is GraphQLNonNull; +export function isNonNullType( + type: unknown, +): type is GraphQLNonNull; +export function isNonNullType( + type: unknown, +): type is GraphQLNonNull { + return instanceOf(type, GraphQLNonNull); +} + +export function assertNonNullType(type: unknown): GraphQLNonNull { + if (!isNonNullType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL Non-Null type.`); + } + return type; +} + +/** + * These types may be used as input types for arguments and directives. + */ +export type GraphQLInputType = + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList + >; + +export function isInputType(type: unknown): type is GraphQLInputType { + return ( + isScalarType(type) || + isEnumType(type) || + isInputObjectType(type) || + (isWrappingType(type) && isInputType(type.ofType)) + ); +} + +export function assertInputType(type: unknown): GraphQLInputType { + if (!isInputType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL input type.`); + } + return type; +} + +/** + * These types may be used as output types as the result of fields. + */ +export type GraphQLOutputType = + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + | GraphQLNonNull< + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLList + >; + +export function isOutputType(type: unknown): type is GraphQLOutputType { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + (isWrappingType(type) && isOutputType(type.ofType)) + ); +} + +export function assertOutputType(type: unknown): GraphQLOutputType { + if (!isOutputType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL output type.`); + } + return type; +} + +/** + * These types may describe types which may be leaf values. + */ +export type GraphQLLeafType = GraphQLScalarType | GraphQLEnumType; + +export function isLeafType(type: unknown): type is GraphQLLeafType { + return isScalarType(type) || isEnumType(type); +} + +export function assertLeafType(type: unknown): GraphQLLeafType { + if (!isLeafType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL leaf type.`); + } + return type; +} + +/** + * These types may describe the parent context of a selection set. + */ +export type GraphQLCompositeType = + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType; + +export function isCompositeType(type: unknown): type is GraphQLCompositeType { + return isObjectType(type) || isInterfaceType(type) || isUnionType(type); +} + +export function assertCompositeType(type: unknown): GraphQLCompositeType { + if (!isCompositeType(type)) { + throw new Error( + `Expected ${inspect(type)} to be a GraphQL composite type.`, + ); + } + return type; +} + +/** + * These types may describe the parent context of a selection set. + */ +export type GraphQLAbstractType = GraphQLInterfaceType | GraphQLUnionType; + +export function isAbstractType(type: unknown): type is GraphQLAbstractType { + return isInterfaceType(type) || isUnionType(type); +} + +export function assertAbstractType(type: unknown): GraphQLAbstractType { + if (!isAbstractType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL abstract type.`); + } + return type; +} + +/** + * List Type Wrapper + * + * A list is a wrapping type which points to another type. + * Lists are often created within the context of defining the fields of + * an object type. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * parents: { type: new GraphQLList(PersonType) }, + * children: { type: new GraphQLList(PersonType) }, + * }) + * }) + * ``` + */ +export class GraphQLList { + readonly ofType: T; + + constructor(ofType: T) { + devAssert( + isType(ofType), + `Expected ${inspect(ofType)} to be a GraphQL type.`, + ); + + this.ofType = ofType; + } + + get [Symbol.toStringTag]() { + return 'GraphQLList'; + } + + toString(): string { + return '[' + String(this.ofType) + ']'; + } + + toJSON(): string { + return this.toString(); + } +} + +/** + * Non-Null Type Wrapper + * + * A non-null is a wrapping type which points to another type. + * Non-null types enforce that their values are never null and can ensure + * an error is raised if this ever occurs during a request. It is useful for + * fields which you can make a strong guarantee on non-nullability, for example + * usually the id field of a database row will never be null. + * + * Example: + * + * ```ts + * const RowType = new GraphQLObjectType({ + * name: 'Row', + * fields: () => ({ + * id: { type: new GraphQLNonNull(GraphQLString) }, + * }) + * }) + * ``` + * Note: the enforcement of non-nullability occurs within the executor. + */ +export class GraphQLNonNull { + readonly ofType: T; + + constructor(ofType: T) { + devAssert( + isNullableType(ofType), + `Expected ${inspect(ofType)} to be a GraphQL nullable type.`, + ); + + this.ofType = ofType; + } + + get [Symbol.toStringTag]() { + return 'GraphQLNonNull'; + } + + toString(): string { + return String(this.ofType) + '!'; + } + + toJSON(): string { + return this.toString(); + } +} + +/** + * These types wrap and modify other types + */ + +export type GraphQLWrappingType = + | GraphQLList + | GraphQLNonNull; + +export function isWrappingType(type: unknown): type is GraphQLWrappingType { + return isListType(type) || isNonNullType(type); +} + +export function assertWrappingType(type: unknown): GraphQLWrappingType { + if (!isWrappingType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL wrapping type.`); + } + return type; +} + +/** + * These types can all accept null as a value. + */ +export type GraphQLNullableType = + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType + | GraphQLInputObjectType + | GraphQLList; + +export function isNullableType(type: unknown): type is GraphQLNullableType { + return isType(type) && !isNonNullType(type); +} + +export function assertNullableType(type: unknown): GraphQLNullableType { + if (!isNullableType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL nullable type.`); + } + return type; +} + +export function getNullableType(type: undefined | null): void; +export function getNullableType( + type: T | GraphQLNonNull, +): T; +export function getNullableType( + type: Maybe, +): GraphQLNullableType | undefined; +export function getNullableType( + type: Maybe, +): GraphQLNullableType | undefined { + if (type) { + return isNonNullType(type) ? type.ofType : type; + } +} + +/** + * These named types do not include modifiers like List or NonNull. + */ +export type GraphQLNamedType = GraphQLNamedInputType | GraphQLNamedOutputType; + +export type GraphQLNamedInputType = + | GraphQLScalarType + | GraphQLEnumType + | GraphQLInputObjectType; + +export type GraphQLNamedOutputType = + | GraphQLScalarType + | GraphQLObjectType + | GraphQLInterfaceType + | GraphQLUnionType + | GraphQLEnumType; + +export function isNamedType(type: unknown): type is GraphQLNamedType { + return ( + isScalarType(type) || + isObjectType(type) || + isInterfaceType(type) || + isUnionType(type) || + isEnumType(type) || + isInputObjectType(type) + ); +} + +export function assertNamedType(type: unknown): GraphQLNamedType { + if (!isNamedType(type)) { + throw new Error(`Expected ${inspect(type)} to be a GraphQL named type.`); + } + return type; +} + +export function getNamedType(type: undefined | null): void; +export function getNamedType(type: GraphQLInputType): GraphQLNamedInputType; +export function getNamedType(type: GraphQLOutputType): GraphQLNamedOutputType; +export function getNamedType(type: GraphQLType): GraphQLNamedType; +export function getNamedType( + type: Maybe, +): GraphQLNamedType | undefined; +export function getNamedType( + type: Maybe, +): GraphQLNamedType | undefined { + if (type) { + let unwrappedType = type; + while (isWrappingType(unwrappedType)) { + unwrappedType = unwrappedType.ofType; + } + return unwrappedType; + } +} + +/** + * Used while defining GraphQL types to allow for circular references in + * otherwise immutable type definitions. + */ +export type ThunkReadonlyArray = (() => ReadonlyArray) | ReadonlyArray; +export type ThunkObjMap = (() => ObjMap) | ObjMap; + +export function resolveReadonlyArrayThunk( + thunk: ThunkReadonlyArray, +): ReadonlyArray { + return typeof thunk === 'function' ? thunk() : thunk; +} + +export function resolveObjMapThunk(thunk: ThunkObjMap): ObjMap { + return typeof thunk === 'function' ? thunk() : thunk; +} + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLScalarTypeExtensions { + [attributeName: string]: unknown; +} + +/** + * Scalar Type Definition + * + * The leaf values of any request and input values to arguments are + * Scalars (or Enums) and are defined with a name and a series of functions + * used to parse input from ast or variables and to ensure validity. + * + * If a type's serialize function does not return a value (i.e. it returns + * `undefined`) then an error will be raised and a `null` value will be returned + * in the response. If the serialize function returns `null`, then no error will + * be included in the response. + * + * Example: + * + * ```ts + * const OddType = new GraphQLScalarType({ + * name: 'Odd', + * serialize(value) { + * if (value % 2 === 1) { + * return value; + * } + * } + * }); + * ``` + */ +export class GraphQLScalarType { + name: string; + description: Maybe; + specifiedByURL: Maybe; + serialize: GraphQLScalarSerializer; + parseValue: GraphQLScalarValueParser; + parseLiteral: GraphQLScalarLiteralParser; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + + constructor(config: Readonly>) { + const parseValue = + config.parseValue ?? + (identityFunc as GraphQLScalarValueParser); + + this.name = assertName(config.name); + this.description = config.description; + this.specifiedByURL = config.specifiedByURL; + this.serialize = + config.serialize ?? (identityFunc as GraphQLScalarSerializer); + this.parseValue = parseValue; + this.parseLiteral = + config.parseLiteral ?? + ((node, variables) => parseValue(valueFromASTUntyped(node, variables))); + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = config.extensionASTNodes ?? []; + + devAssert( + config.specifiedByURL == null || + typeof config.specifiedByURL === 'string', + `${this.name} must provide "specifiedByURL" as a string, ` + + `but got: ${inspect(config.specifiedByURL)}.`, + ); + + devAssert( + config.serialize == null || typeof config.serialize === 'function', + `${this.name} must provide "serialize" function. If this custom Scalar is also used as an input type, ensure "parseValue" and "parseLiteral" functions are also provided.`, + ); + + if (config.parseLiteral) { + devAssert( + typeof config.parseValue === 'function' && + typeof config.parseLiteral === 'function', + `${this.name} must provide both "parseValue" and "parseLiteral" functions.`, + ); + } + } + + get [Symbol.toStringTag]() { + return 'GraphQLScalarType'; + } + + toConfig(): GraphQLScalarTypeNormalizedConfig { + return { + name: this.name, + description: this.description, + specifiedByURL: this.specifiedByURL, + serialize: this.serialize, + parseValue: this.parseValue, + parseLiteral: this.parseLiteral, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString(): string { + return this.name; + } + + toJSON(): string { + return this.toString(); + } +} + +export type GraphQLScalarSerializer = ( + outputValue: unknown, +) => TExternal; + +export type GraphQLScalarValueParser = ( + inputValue: unknown, +) => TInternal; + +export type GraphQLScalarLiteralParser = ( + valueNode: ValueNode, + variables?: Maybe>, +) => TInternal; + +export interface GraphQLScalarTypeConfig { + name: string; + description?: Maybe; + specifiedByURL?: Maybe; + /** Serializes an internal value to include in a response. */ + serialize?: GraphQLScalarSerializer; + /** Parses an externally provided value to use as an input. */ + parseValue?: GraphQLScalarValueParser; + /** Parses an externally provided literal value to use as an input. */ + parseLiteral?: GraphQLScalarLiteralParser; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} + +interface GraphQLScalarTypeNormalizedConfig + extends GraphQLScalarTypeConfig { + serialize: GraphQLScalarSerializer; + parseValue: GraphQLScalarValueParser; + parseLiteral: GraphQLScalarLiteralParser; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + * + * We've provided these template arguments because this is an open type and + * you may find them useful. + */ +export interface GraphQLObjectTypeExtensions<_TSource = any, _TContext = any> { + [attributeName: string]: unknown; +} + +/** + * Object Type Definition + * + * Almost all of the GraphQL types you define will be object types. Object types + * have a name, but most importantly describe their fields. + * + * Example: + * + * ```ts + * const AddressType = new GraphQLObjectType({ + * name: 'Address', + * fields: { + * street: { type: GraphQLString }, + * number: { type: GraphQLInt }, + * formatted: { + * type: GraphQLString, + * resolve(obj) { + * return obj.number + ' ' + obj.street + * } + * } + * } + * }); + * ``` + * + * When two types need to refer to each other, or a type needs to refer to + * itself in a field, you can use a function expression (aka a closure or a + * thunk) to supply the fields lazily. + * + * Example: + * + * ```ts + * const PersonType = new GraphQLObjectType({ + * name: 'Person', + * fields: () => ({ + * name: { type: GraphQLString }, + * bestFriend: { type: PersonType }, + * }) + * }); + * ``` + */ +export class GraphQLObjectType { + name: string; + description: Maybe; + isTypeOf: Maybe>; + extensions: Readonly>; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + + private _fields: ThunkObjMap>; + private _interfaces: ThunkReadonlyArray; + + constructor(config: Readonly>) { + this.name = assertName(config.name); + this.description = config.description; + this.isTypeOf = config.isTypeOf; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = config.extensionASTNodes ?? []; + + this._fields = () => defineFieldMap(config); + this._interfaces = () => defineInterfaces(config); + devAssert( + config.isTypeOf == null || typeof config.isTypeOf === 'function', + `${this.name} must provide "isTypeOf" as a function, ` + + `but got: ${inspect(config.isTypeOf)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLObjectType'; + } + + getFields(): GraphQLFieldMap { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + return this._fields; + } + + getInterfaces(): ReadonlyArray { + if (typeof this._interfaces === 'function') { + this._interfaces = this._interfaces(); + } + return this._interfaces; + } + + toConfig(): GraphQLObjectTypeNormalizedConfig { + return { + name: this.name, + description: this.description, + interfaces: this.getInterfaces(), + fields: fieldsToFieldsConfig(this.getFields()), + isTypeOf: this.isTypeOf, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString(): string { + return this.name; + } + + toJSON(): string { + return this.toString(); + } +} + +function defineInterfaces( + config: Readonly< + GraphQLObjectTypeConfig | GraphQLInterfaceTypeConfig + >, +): ReadonlyArray { + const interfaces = resolveReadonlyArrayThunk(config.interfaces ?? []); + devAssert( + Array.isArray(interfaces), + `${config.name} interfaces must be an Array or a function which returns an Array.`, + ); + return interfaces; +} + +function defineFieldMap( + config: Readonly< + | GraphQLObjectTypeConfig + | GraphQLInterfaceTypeConfig + >, +): GraphQLFieldMap { + const fieldMap = resolveObjMapThunk(config.fields); + devAssert( + isPlainObj(fieldMap), + `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, + ); + + return mapValue(fieldMap, (fieldConfig, fieldName) => { + devAssert( + isPlainObj(fieldConfig), + `${config.name}.${fieldName} field config must be an object.`, + ); + devAssert( + fieldConfig.resolve == null || typeof fieldConfig.resolve === 'function', + `${config.name}.${fieldName} field resolver must be a function if ` + + `provided, but got: ${inspect(fieldConfig.resolve)}.`, + ); + + const argsConfig = fieldConfig.args ?? {}; + devAssert( + isPlainObj(argsConfig), + `${config.name}.${fieldName} args must be an object with argument names as keys.`, + ); + + return { + name: assertName(fieldName), + description: fieldConfig.description, + type: fieldConfig.type, + args: defineArguments(argsConfig), + resolve: fieldConfig.resolve, + subscribe: fieldConfig.subscribe, + deprecationReason: fieldConfig.deprecationReason, + extensions: toObjMap(fieldConfig.extensions), + astNode: fieldConfig.astNode, + }; + }); +} + +export function defineArguments( + config: GraphQLFieldConfigArgumentMap, +): ReadonlyArray { + return Object.entries(config).map(([argName, argConfig]) => ({ + name: assertName(argName), + description: argConfig.description, + type: argConfig.type, + defaultValue: argConfig.defaultValue, + deprecationReason: argConfig.deprecationReason, + extensions: toObjMap(argConfig.extensions), + astNode: argConfig.astNode, + })); +} + +function isPlainObj(obj: unknown): boolean { + return isObjectLike(obj) && !Array.isArray(obj); +} + +function fieldsToFieldsConfig( + fields: GraphQLFieldMap, +): GraphQLFieldConfigMap { + return mapValue(fields, (field) => ({ + description: field.description, + type: field.type, + args: argsToArgsConfig(field.args), + resolve: field.resolve, + subscribe: field.subscribe, + deprecationReason: field.deprecationReason, + extensions: field.extensions, + astNode: field.astNode, + })); +} + +/** + * @internal + */ +export function argsToArgsConfig( + args: ReadonlyArray, +): GraphQLFieldConfigArgumentMap { + return keyValMap( + args, + (arg) => arg.name, + (arg) => ({ + description: arg.description, + type: arg.type, + defaultValue: arg.defaultValue, + deprecationReason: arg.deprecationReason, + extensions: arg.extensions, + astNode: arg.astNode, + }), + ); +} + +export interface GraphQLObjectTypeConfig { + name: string; + description?: Maybe; + interfaces?: ThunkReadonlyArray; + fields: ThunkObjMap>; + isTypeOf?: Maybe>; + extensions?: Maybe>>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} + +interface GraphQLObjectTypeNormalizedConfig + extends GraphQLObjectTypeConfig { + interfaces: ReadonlyArray; + fields: GraphQLFieldConfigMap; + extensions: Readonly>; + extensionASTNodes: ReadonlyArray; +} + +export type GraphQLTypeResolver = ( + value: TSource, + context: TContext, + info: GraphQLResolveInfo, + abstractType: GraphQLAbstractType, +) => PromiseOrValue; + +export type GraphQLIsTypeOfFn = ( + source: TSource, + context: TContext, + info: GraphQLResolveInfo, +) => PromiseOrValue; + +export type GraphQLFieldResolver< + TSource, + TContext, + TArgs = any, + TResult = unknown, +> = ( + source: TSource, + args: TArgs, + context: TContext, + info: GraphQLResolveInfo, +) => TResult; + +export interface GraphQLResolveInfo { + readonly fieldName: string; + readonly fieldNodes: ReadonlyArray; + readonly returnType: GraphQLOutputType; + readonly parentType: GraphQLObjectType; + readonly path: Path; + readonly schema: GraphQLSchema; + readonly fragments: ObjMap; + readonly rootValue: unknown; + readonly operation: OperationDefinitionNode; + readonly variableValues: { [variable: string]: unknown }; +} + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + * + * We've provided these template arguments because this is an open type and + * you may find them useful. + */ +export interface GraphQLFieldExtensions<_TSource, _TContext, _TArgs = any> { + [attributeName: string]: unknown; +} + +export interface GraphQLFieldConfig { + description?: Maybe; + type: GraphQLOutputType; + args?: GraphQLFieldConfigArgumentMap; + resolve?: GraphQLFieldResolver; + subscribe?: GraphQLFieldResolver; + deprecationReason?: Maybe; + extensions?: Maybe< + Readonly> + >; + astNode?: Maybe; +} + +export type GraphQLFieldConfigArgumentMap = ObjMap; + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLArgumentExtensions { + [attributeName: string]: unknown; +} + +export interface GraphQLArgumentConfig { + description?: Maybe; + type: GraphQLInputType; + defaultValue?: unknown; + deprecationReason?: Maybe; + extensions?: Maybe>; + astNode?: Maybe; +} + +export type GraphQLFieldConfigMap = ObjMap< + GraphQLFieldConfig +>; + +export interface GraphQLField { + name: string; + description: Maybe; + type: GraphQLOutputType; + args: ReadonlyArray; + resolve?: GraphQLFieldResolver; + subscribe?: GraphQLFieldResolver; + deprecationReason: Maybe; + extensions: Readonly>; + astNode: Maybe; +} + +export interface GraphQLArgument { + name: string; + description: Maybe; + type: GraphQLInputType; + defaultValue: unknown; + deprecationReason: Maybe; + extensions: Readonly; + astNode: Maybe; +} + +export function isRequiredArgument(arg: GraphQLArgument): boolean { + return isNonNullType(arg.type) && arg.defaultValue === undefined; +} + +export type GraphQLFieldMap = ObjMap< + GraphQLField +>; + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLInterfaceTypeExtensions { + [attributeName: string]: unknown; +} + +/** + * Interface Type Definition + * + * When a field can return one of a heterogeneous set of types, a Interface type + * is used to describe what types are possible, what fields are in common across + * all types, as well as a function to determine which type is actually used + * when the field is resolved. + * + * Example: + * + * ```ts + * const EntityType = new GraphQLInterfaceType({ + * name: 'Entity', + * fields: { + * name: { type: GraphQLString } + * } + * }); + * ``` + */ +export class GraphQLInterfaceType { + name: string; + description: Maybe; + resolveType: Maybe>; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + + private _fields: ThunkObjMap>; + private _interfaces: ThunkReadonlyArray; + + constructor(config: Readonly>) { + this.name = assertName(config.name); + this.description = config.description; + this.resolveType = config.resolveType; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = config.extensionASTNodes ?? []; + + this._fields = defineFieldMap.bind(undefined, config); + this._interfaces = defineInterfaces.bind(undefined, config); + devAssert( + config.resolveType == null || typeof config.resolveType === 'function', + `${this.name} must provide "resolveType" as a function, ` + + `but got: ${inspect(config.resolveType)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLInterfaceType'; + } + + getFields(): GraphQLFieldMap { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + return this._fields; + } + + getInterfaces(): ReadonlyArray { + if (typeof this._interfaces === 'function') { + this._interfaces = this._interfaces(); + } + return this._interfaces; + } + + toConfig(): GraphQLInterfaceTypeNormalizedConfig { + return { + name: this.name, + description: this.description, + interfaces: this.getInterfaces(), + fields: fieldsToFieldsConfig(this.getFields()), + resolveType: this.resolveType, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString(): string { + return this.name; + } + + toJSON(): string { + return this.toString(); + } +} + +export interface GraphQLInterfaceTypeConfig { + name: string; + description?: Maybe; + interfaces?: ThunkReadonlyArray; + fields: ThunkObjMap>; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: Maybe>; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} + +export interface GraphQLInterfaceTypeNormalizedConfig + extends GraphQLInterfaceTypeConfig { + interfaces: ReadonlyArray; + fields: GraphQLFieldConfigMap; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLUnionTypeExtensions { + [attributeName: string]: unknown; +} + +/** + * Union Type Definition + * + * When a field can return one of a heterogeneous set of types, a Union type + * is used to describe what types are possible as well as providing a function + * to determine which type is actually used when the field is resolved. + * + * Example: + * + * ```ts + * const PetType = new GraphQLUnionType({ + * name: 'Pet', + * types: [ DogType, CatType ], + * resolveType(value) { + * if (value instanceof Dog) { + * return DogType; + * } + * if (value instanceof Cat) { + * return CatType; + * } + * } + * }); + * ``` + */ +export class GraphQLUnionType { + name: string; + description: Maybe; + resolveType: Maybe>; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + + private _types: ThunkReadonlyArray; + + constructor(config: Readonly>) { + this.name = assertName(config.name); + this.description = config.description; + this.resolveType = config.resolveType; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = config.extensionASTNodes ?? []; + + this._types = defineTypes.bind(undefined, config); + devAssert( + config.resolveType == null || typeof config.resolveType === 'function', + `${this.name} must provide "resolveType" as a function, ` + + `but got: ${inspect(config.resolveType)}.`, + ); + } + + get [Symbol.toStringTag]() { + return 'GraphQLUnionType'; + } + + getTypes(): ReadonlyArray { + if (typeof this._types === 'function') { + this._types = this._types(); + } + return this._types; + } + + toConfig(): GraphQLUnionTypeNormalizedConfig { + return { + name: this.name, + description: this.description, + types: this.getTypes(), + resolveType: this.resolveType, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString(): string { + return this.name; + } + + toJSON(): string { + return this.toString(); + } +} + +function defineTypes( + config: Readonly>, +): ReadonlyArray { + const types = resolveReadonlyArrayThunk(config.types); + devAssert( + Array.isArray(types), + `Must provide Array of types or a function which returns such an array for Union ${config.name}.`, + ); + return types; +} + +export interface GraphQLUnionTypeConfig { + name: string; + description?: Maybe; + types: ThunkReadonlyArray; + /** + * Optionally provide a custom type resolver function. If one is not provided, + * the default implementation will call `isTypeOf` on each implementing + * Object type. + */ + resolveType?: Maybe>; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} + +interface GraphQLUnionTypeNormalizedConfig + extends GraphQLUnionTypeConfig { + types: ReadonlyArray; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLEnumTypeExtensions { + [attributeName: string]: unknown; +} + +/** + * Enum Type Definition + * + * Some leaf values of requests and input values are Enums. GraphQL serializes + * Enum values as strings, however internally Enums can be represented by any + * kind of type, often integers. + * + * Example: + * + * ```ts + * const RGBType = new GraphQLEnumType({ + * name: 'RGB', + * values: { + * RED: { value: 0 }, + * GREEN: { value: 1 }, + * BLUE: { value: 2 } + * } + * }); + * ``` + * + * Note: If a value is not provided in a definition, the name of the enum value + * will be used as its internal value. + */ +export class GraphQLEnumType /* */ { + name: string; + description: Maybe; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + + private _values: ReadonlyArray */>; + private _valueLookup: ReadonlyMap; + private _nameLookup: ObjMap; + + constructor(config: Readonly */>) { + this.name = assertName(config.name); + this.description = config.description; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = config.extensionASTNodes ?? []; + + this._values = defineEnumValues(this.name, config.values); + this._valueLookup = new Map( + this._values.map((enumValue) => [enumValue.value, enumValue]), + ); + this._nameLookup = keyMap(this._values, (value) => value.name); + } + + get [Symbol.toStringTag]() { + return 'GraphQLEnumType'; + } + + getValues(): ReadonlyArray */> { + return this._values; + } + + getValue(name: string): Maybe { + return this._nameLookup[name]; + } + + serialize(outputValue: unknown /* T */): Maybe { + const enumValue = this._valueLookup.get(outputValue); + if (enumValue === undefined) { + throw new GraphQLError( + `Enum "${this.name}" cannot represent value: ${inspect(outputValue)}`, + ); + } + return enumValue.name; + } + + parseValue(inputValue: unknown): Maybe /* T */ { + if (typeof inputValue !== 'string') { + const valueStr = inspect(inputValue); + throw new GraphQLError( + `Enum "${this.name}" cannot represent non-string value: ${valueStr}.` + + didYouMeanEnumValue(this, valueStr), + ); + } + + const enumValue = this.getValue(inputValue); + if (enumValue == null) { + throw new GraphQLError( + `Value "${inputValue}" does not exist in "${this.name}" enum.` + + didYouMeanEnumValue(this, inputValue), + ); + } + return enumValue.value; + } + + parseLiteral( + valueNode: ValueNode, + _variables: Maybe>, + ): Maybe /* T */ { + // Note: variables will be resolved to a value before calling this function. + if (valueNode.kind !== Kind.ENUM) { + const valueStr = print(valueNode); + throw new GraphQLError( + `Enum "${this.name}" cannot represent non-enum value: ${valueStr}.` + + didYouMeanEnumValue(this, valueStr), + valueNode, + ); + } + + const enumValue = this.getValue(valueNode.value); + if (enumValue == null) { + const valueStr = print(valueNode); + throw new GraphQLError( + `Value "${valueStr}" does not exist in "${this.name}" enum.` + + didYouMeanEnumValue(this, valueStr), + valueNode, + ); + } + return enumValue.value; + } + + toConfig(): GraphQLEnumTypeNormalizedConfig { + const values = keyValMap( + this.getValues(), + (value) => value.name, + (value) => ({ + description: value.description, + value: value.value, + deprecationReason: value.deprecationReason, + extensions: value.extensions, + astNode: value.astNode, + }), + ); + + return { + name: this.name, + description: this.description, + values, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString(): string { + return this.name; + } + + toJSON(): string { + return this.toString(); + } +} + +function didYouMeanEnumValue( + enumType: GraphQLEnumType, + unknownValueStr: string, +): string { + const allNames = enumType.getValues().map((value) => value.name); + const suggestedValues = suggestionList(unknownValueStr, allNames); + + return didYouMean('the enum value', suggestedValues); +} + +function defineEnumValues( + typeName: string, + valueMap: GraphQLEnumValueConfigMap /* */, +): ReadonlyArray */> { + devAssert( + isPlainObj(valueMap), + `${typeName} values must be an object with value names as keys.`, + ); + return Object.entries(valueMap).map(([valueName, valueConfig]) => { + devAssert( + isPlainObj(valueConfig), + `${typeName}.${valueName} must refer to an object with a "value" key ` + + `representing an internal value but got: ${inspect(valueConfig)}.`, + ); + return { + name: assertEnumValueName(valueName), + description: valueConfig.description, + value: valueConfig.value !== undefined ? valueConfig.value : valueName, + deprecationReason: valueConfig.deprecationReason, + extensions: toObjMap(valueConfig.extensions), + astNode: valueConfig.astNode, + }; + }); +} + +export interface GraphQLEnumTypeConfig { + name: string; + description?: Maybe; + values: GraphQLEnumValueConfigMap /* */; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} + +interface GraphQLEnumTypeNormalizedConfig extends GraphQLEnumTypeConfig { + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} + +export type GraphQLEnumValueConfigMap /* */ = + ObjMap */>; + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLEnumValueExtensions { + [attributeName: string]: unknown; +} + +export interface GraphQLEnumValueConfig { + description?: Maybe; + value?: any /* T */; + deprecationReason?: Maybe; + extensions?: Maybe>; + astNode?: Maybe; +} + +export interface GraphQLEnumValue { + name: string; + description: Maybe; + value: any /* T */; + deprecationReason: Maybe; + extensions: Readonly; + astNode: Maybe; +} + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLInputObjectTypeExtensions { + [attributeName: string]: unknown; +} + +/** + * Input Object Type Definition + * + * An input object defines a structured collection of fields which may be + * supplied to a field argument. + * + * Using `NonNull` will ensure that a value must be provided by the query + * + * Example: + * + * ```ts + * const GeoPoint = new GraphQLInputObjectType({ + * name: 'GeoPoint', + * fields: { + * lat: { type: new GraphQLNonNull(GraphQLFloat) }, + * lon: { type: new GraphQLNonNull(GraphQLFloat) }, + * alt: { type: GraphQLFloat, defaultValue: 0 }, + * } + * }); + * ``` + */ +export class GraphQLInputObjectType { + name: string; + description: Maybe; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + + private _fields: ThunkObjMap; + + constructor(config: Readonly) { + this.name = assertName(config.name); + this.description = config.description; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = config.extensionASTNodes ?? []; + + this._fields = defineInputFieldMap.bind(undefined, config); + } + + get [Symbol.toStringTag]() { + return 'GraphQLInputObjectType'; + } + + getFields(): GraphQLInputFieldMap { + if (typeof this._fields === 'function') { + this._fields = this._fields(); + } + return this._fields; + } + + toConfig(): GraphQLInputObjectTypeNormalizedConfig { + const fields = mapValue(this.getFields(), (field) => ({ + description: field.description, + type: field.type, + defaultValue: field.defaultValue, + deprecationReason: field.deprecationReason, + extensions: field.extensions, + astNode: field.astNode, + })); + + return { + name: this.name, + description: this.description, + fields, + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + }; + } + + toString(): string { + return this.name; + } + + toJSON(): string { + return this.toString(); + } +} + +function defineInputFieldMap( + config: Readonly, +): GraphQLInputFieldMap { + const fieldMap = resolveObjMapThunk(config.fields); + devAssert( + isPlainObj(fieldMap), + `${config.name} fields must be an object with field names as keys or a function which returns such an object.`, + ); + return mapValue(fieldMap, (fieldConfig, fieldName) => { + devAssert( + !('resolve' in fieldConfig), + `${config.name}.${fieldName} field has a resolve property, but Input Types cannot define resolvers.`, + ); + + return { + name: assertName(fieldName), + description: fieldConfig.description, + type: fieldConfig.type, + defaultValue: fieldConfig.defaultValue, + deprecationReason: fieldConfig.deprecationReason, + extensions: toObjMap(fieldConfig.extensions), + astNode: fieldConfig.astNode, + }; + }); +} + +export interface GraphQLInputObjectTypeConfig { + name: string; + description?: Maybe; + fields: ThunkObjMap; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} + +interface GraphQLInputObjectTypeNormalizedConfig + extends GraphQLInputObjectTypeConfig { + fields: GraphQLInputFieldConfigMap; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; +} + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLInputFieldExtensions { + [attributeName: string]: unknown; +} + +export interface GraphQLInputFieldConfig { + description?: Maybe; + type: GraphQLInputType; + defaultValue?: unknown; + deprecationReason?: Maybe; + extensions?: Maybe>; + astNode?: Maybe; +} + +export type GraphQLInputFieldConfigMap = ObjMap; + +export interface GraphQLInputField { + name: string; + description: Maybe; + type: GraphQLInputType; + defaultValue: unknown; + deprecationReason: Maybe; + extensions: Readonly; + astNode: Maybe; +} + +export function isRequiredInputField(field: GraphQLInputField): boolean { + return isNonNullType(field.type) && field.defaultValue === undefined; +} + +export type GraphQLInputFieldMap = ObjMap; diff --git a/src/type/directives.ts b/src/type/directives.ts new file mode 100644 index 00000000..bb3e441a --- /dev/null +++ b/src/type/directives.ts @@ -0,0 +1,225 @@ +import { devAssert } from '../jsutils/devAssert'; +import { inspect } from '../jsutils/inspect'; +import { instanceOf } from '../jsutils/instanceOf'; +import { isObjectLike } from '../jsutils/isObjectLike'; +import type { Maybe } from '../jsutils/Maybe'; +import { toObjMap } from '../jsutils/toObjMap'; + +import type { DirectiveDefinitionNode } from '../language/ast'; +import { DirectiveLocation } from '../language/directiveLocation'; + +import { assertName } from './assertName'; +import type { + GraphQLArgument, + GraphQLFieldConfigArgumentMap, +} from './definition'; +import { + argsToArgsConfig, + defineArguments, + GraphQLNonNull, +} from './definition'; +import { GraphQLBoolean, GraphQLString } from './scalars'; + +/** + * Test if the given value is a GraphQL directive. + */ +export function isDirective(directive: unknown): directive is GraphQLDirective { + return instanceOf(directive, GraphQLDirective); +} + +export function assertDirective(directive: unknown): GraphQLDirective { + if (!isDirective(directive)) { + throw new Error( + `Expected ${inspect(directive)} to be a GraphQL directive.`, + ); + } + return directive; +} + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLDirectiveExtensions { + [attributeName: string]: unknown; +} + +/** + * Directives are used by the GraphQL runtime as a way of modifying execution + * behavior. Type system creators will usually not create these directly. + */ +export class GraphQLDirective { + name: string; + description: Maybe; + locations: ReadonlyArray; + args: ReadonlyArray; + isRepeatable: boolean; + extensions: Readonly; + astNode: Maybe; + + constructor(config: Readonly) { + this.name = assertName(config.name); + this.description = config.description; + this.locations = config.locations; + this.isRepeatable = config.isRepeatable ?? false; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + + devAssert( + Array.isArray(config.locations), + `@${config.name} locations must be an Array.`, + ); + + const args = config.args ?? {}; + devAssert( + isObjectLike(args) && !Array.isArray(args), + `@${config.name} args must be an object with argument names as keys.`, + ); + + this.args = defineArguments(args); + } + + get [Symbol.toStringTag]() { + return 'GraphQLDirective'; + } + + toConfig(): GraphQLDirectiveNormalizedConfig { + return { + name: this.name, + description: this.description, + locations: this.locations, + args: argsToArgsConfig(this.args), + isRepeatable: this.isRepeatable, + extensions: this.extensions, + astNode: this.astNode, + }; + } + + toString(): string { + return '@' + this.name; + } + + toJSON(): string { + return this.toString(); + } +} + +export interface GraphQLDirectiveConfig { + name: string; + description?: Maybe; + locations: ReadonlyArray; + args?: Maybe; + isRepeatable?: Maybe; + extensions?: Maybe>; + astNode?: Maybe; +} + +interface GraphQLDirectiveNormalizedConfig extends GraphQLDirectiveConfig { + args: GraphQLFieldConfigArgumentMap; + isRepeatable: boolean; + extensions: Readonly; +} + +/** + * Used to conditionally include fields or fragments. + */ +export const GraphQLIncludeDirective: GraphQLDirective = new GraphQLDirective({ + name: 'include', + description: + 'Directs the executor to include this field or fragment only when the `if` argument is true.', + locations: [ + DirectiveLocation.FIELD, + DirectiveLocation.FRAGMENT_SPREAD, + DirectiveLocation.INLINE_FRAGMENT, + ], + args: { + if: { + type: new GraphQLNonNull(GraphQLBoolean), + description: 'Included when true.', + }, + }, +}); + +/** + * Used to conditionally skip (exclude) fields or fragments. + */ +export const GraphQLSkipDirective: GraphQLDirective = new GraphQLDirective({ + name: 'skip', + description: + 'Directs the executor to skip this field or fragment when the `if` argument is true.', + locations: [ + DirectiveLocation.FIELD, + DirectiveLocation.FRAGMENT_SPREAD, + DirectiveLocation.INLINE_FRAGMENT, + ], + args: { + if: { + type: new GraphQLNonNull(GraphQLBoolean), + description: 'Skipped when true.', + }, + }, +}); + +/** + * Constant string used for default reason for a deprecation. + */ +export const DEFAULT_DEPRECATION_REASON = 'No longer supported'; + +/** + * Used to declare element of a GraphQL schema as deprecated. + */ +export const GraphQLDeprecatedDirective: GraphQLDirective = + new GraphQLDirective({ + name: 'deprecated', + description: 'Marks an element of a GraphQL schema as no longer supported.', + locations: [ + DirectiveLocation.FIELD_DEFINITION, + DirectiveLocation.ARGUMENT_DEFINITION, + DirectiveLocation.INPUT_FIELD_DEFINITION, + DirectiveLocation.ENUM_VALUE, + ], + args: { + reason: { + type: GraphQLString, + description: + 'Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/).', + defaultValue: DEFAULT_DEPRECATION_REASON, + }, + }, + }); + +/** + * Used to provide a URL for specifying the behavior of custom scalar definitions. + */ +export const GraphQLSpecifiedByDirective: GraphQLDirective = + new GraphQLDirective({ + name: 'specifiedBy', + description: 'Exposes a URL that specifies the behavior of this scalar.', + locations: [DirectiveLocation.SCALAR], + args: { + url: { + type: new GraphQLNonNull(GraphQLString), + description: 'The URL that specifies the behavior of this scalar.', + }, + }, + }); + +/** + * The full list of specified directives. + */ +export const specifiedDirectives: ReadonlyArray = + Object.freeze([ + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, + ]); + +export function isSpecifiedDirective(directive: GraphQLDirective): boolean { + return specifiedDirectives.some(({ name }) => name === directive.name); +} diff --git a/src/type/index.ts b/src/type/index.ts new file mode 100644 index 00000000..270dd67d --- /dev/null +++ b/src/type/index.ts @@ -0,0 +1,186 @@ +export type { Path as ResponsePath } from '../jsutils/Path'; + +export { + // Predicate + isSchema, + // Assertion + assertSchema, + // GraphQL Schema definition + GraphQLSchema, +} from './schema'; +export type { GraphQLSchemaConfig, GraphQLSchemaExtensions } from './schema'; + +export { + resolveObjMapThunk, + resolveReadonlyArrayThunk, + // Predicates + isType, + isScalarType, + isObjectType, + isInterfaceType, + isUnionType, + isEnumType, + isInputObjectType, + isListType, + isNonNullType, + isInputType, + isOutputType, + isLeafType, + isCompositeType, + isAbstractType, + isWrappingType, + isNullableType, + isNamedType, + isRequiredArgument, + isRequiredInputField, + // Assertions + assertType, + assertScalarType, + assertObjectType, + assertInterfaceType, + assertUnionType, + assertEnumType, + assertInputObjectType, + assertListType, + assertNonNullType, + assertInputType, + assertOutputType, + assertLeafType, + assertCompositeType, + assertAbstractType, + assertWrappingType, + assertNullableType, + assertNamedType, + // Un-modifiers + getNullableType, + getNamedType, + // Definitions + GraphQLScalarType, + GraphQLObjectType, + GraphQLInterfaceType, + GraphQLUnionType, + GraphQLEnumType, + GraphQLInputObjectType, + // Type Wrappers + GraphQLList, + GraphQLNonNull, +} from './definition'; + +export type { + GraphQLType, + GraphQLInputType, + GraphQLOutputType, + GraphQLLeafType, + GraphQLCompositeType, + GraphQLAbstractType, + GraphQLWrappingType, + GraphQLNullableType, + GraphQLNamedType, + GraphQLNamedInputType, + GraphQLNamedOutputType, + ThunkReadonlyArray, + ThunkObjMap, + GraphQLArgument, + GraphQLArgumentConfig, + GraphQLArgumentExtensions, + GraphQLEnumTypeConfig, + GraphQLEnumTypeExtensions, + GraphQLEnumValue, + GraphQLEnumValueConfig, + GraphQLEnumValueConfigMap, + GraphQLEnumValueExtensions, + GraphQLField, + GraphQLFieldConfig, + GraphQLFieldConfigArgumentMap, + GraphQLFieldConfigMap, + GraphQLFieldExtensions, + GraphQLFieldMap, + GraphQLFieldResolver, + GraphQLInputField, + GraphQLInputFieldConfig, + GraphQLInputFieldConfigMap, + GraphQLInputFieldExtensions, + GraphQLInputFieldMap, + GraphQLInputObjectTypeConfig, + GraphQLInputObjectTypeExtensions, + GraphQLInterfaceTypeConfig, + GraphQLInterfaceTypeExtensions, + GraphQLIsTypeOfFn, + GraphQLObjectTypeConfig, + GraphQLObjectTypeExtensions, + GraphQLResolveInfo, + GraphQLScalarTypeConfig, + GraphQLScalarTypeExtensions, + GraphQLTypeResolver, + GraphQLUnionTypeConfig, + GraphQLUnionTypeExtensions, + GraphQLScalarSerializer, + GraphQLScalarValueParser, + GraphQLScalarLiteralParser, +} from './definition'; + +export { + // Predicate + isDirective, + // Assertion + assertDirective, + // Directives Definition + GraphQLDirective, + // Built-in Directives defined by the Spec + isSpecifiedDirective, + specifiedDirectives, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLDeprecatedDirective, + GraphQLSpecifiedByDirective, + // Constant Deprecation Reason + DEFAULT_DEPRECATION_REASON, +} from './directives'; + +export type { + GraphQLDirectiveConfig, + GraphQLDirectiveExtensions, +} from './directives'; + +// Common built-in scalar instances. +export { + // Predicate + isSpecifiedScalarType, + // Standard GraphQL Scalars + specifiedScalarTypes, + GraphQLInt, + GraphQLFloat, + GraphQLString, + GraphQLBoolean, + GraphQLID, + // Int boundaries constants + GRAPHQL_MAX_INT, + GRAPHQL_MIN_INT, +} from './scalars'; + +export { + // Predicate + isIntrospectionType, + // GraphQL Types for introspection. + introspectionTypes, + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, + // "Enum" of Type Kinds + TypeKind, + // Meta-field definitions. + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from './introspection'; + +// Validate GraphQL schema. +export { validateSchema, assertValidSchema } from './validate'; + +// Upholds the spec rules about naming. +export { assertName, assertEnumValueName } from './assertName'; diff --git a/src/type/introspection.ts b/src/type/introspection.ts new file mode 100644 index 00000000..e5fce6f2 --- /dev/null +++ b/src/type/introspection.ts @@ -0,0 +1,556 @@ +import { inspect } from '../jsutils/inspect'; +import { invariant } from '../jsutils/invariant'; + +import { DirectiveLocation } from '../language/directiveLocation'; +import { print } from '../language/printer'; + +import { astFromValue } from '../utilities/astFromValue'; + +import type { + GraphQLEnumValue, + GraphQLField, + GraphQLFieldConfigMap, + GraphQLInputField, + GraphQLNamedType, + GraphQLType, +} from './definition'; +import { + GraphQLEnumType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + isAbstractType, + isEnumType, + isInputObjectType, + isInterfaceType, + isListType, + isNonNullType, + isObjectType, + isScalarType, + isUnionType, +} from './definition'; +import type { GraphQLDirective } from './directives'; +import { GraphQLBoolean, GraphQLString } from './scalars'; +import type { GraphQLSchema } from './schema'; + +export const __Schema: GraphQLObjectType = new GraphQLObjectType({ + name: '__Schema', + description: + 'A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations.', + fields: () => + ({ + description: { + type: GraphQLString, + resolve: (schema) => schema.description, + }, + types: { + description: 'A list of all types supported by this server.', + type: new GraphQLNonNull(new GraphQLList(new GraphQLNonNull(__Type))), + resolve(schema) { + return Object.values(schema.getTypeMap()); + }, + }, + queryType: { + description: 'The type that query operations will be rooted at.', + type: new GraphQLNonNull(__Type), + resolve: (schema) => schema.getQueryType(), + }, + mutationType: { + description: + 'If this server supports mutation, the type that mutation operations will be rooted at.', + type: __Type, + resolve: (schema) => schema.getMutationType(), + }, + subscriptionType: { + description: + 'If this server support subscription, the type that subscription operations will be rooted at.', + type: __Type, + resolve: (schema) => schema.getSubscriptionType(), + }, + directives: { + description: 'A list of all directives supported by this server.', + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(__Directive)), + ), + resolve: (schema) => schema.getDirectives(), + }, + } as GraphQLFieldConfigMap), +}); + +export const __Directive: GraphQLObjectType = new GraphQLObjectType({ + name: '__Directive', + description: + "A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document.\n\nIn some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor.", + fields: () => + ({ + name: { + type: new GraphQLNonNull(GraphQLString), + resolve: (directive) => directive.name, + }, + description: { + type: GraphQLString, + resolve: (directive) => directive.description, + }, + isRepeatable: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (directive) => directive.isRepeatable, + }, + locations: { + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(__DirectiveLocation)), + ), + resolve: (directive) => directive.locations, + }, + args: { + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(__InputValue)), + ), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + resolve(field, { includeDeprecated }) { + return includeDeprecated + ? field.args + : field.args.filter((arg) => arg.deprecationReason == null); + }, + }, + } as GraphQLFieldConfigMap), +}); + +export const __DirectiveLocation: GraphQLEnumType = new GraphQLEnumType({ + name: '__DirectiveLocation', + description: + 'A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies.', + values: { + QUERY: { + value: DirectiveLocation.QUERY, + description: 'Location adjacent to a query operation.', + }, + MUTATION: { + value: DirectiveLocation.MUTATION, + description: 'Location adjacent to a mutation operation.', + }, + SUBSCRIPTION: { + value: DirectiveLocation.SUBSCRIPTION, + description: 'Location adjacent to a subscription operation.', + }, + FIELD: { + value: DirectiveLocation.FIELD, + description: 'Location adjacent to a field.', + }, + FRAGMENT_DEFINITION: { + value: DirectiveLocation.FRAGMENT_DEFINITION, + description: 'Location adjacent to a fragment definition.', + }, + FRAGMENT_SPREAD: { + value: DirectiveLocation.FRAGMENT_SPREAD, + description: 'Location adjacent to a fragment spread.', + }, + INLINE_FRAGMENT: { + value: DirectiveLocation.INLINE_FRAGMENT, + description: 'Location adjacent to an inline fragment.', + }, + VARIABLE_DEFINITION: { + value: DirectiveLocation.VARIABLE_DEFINITION, + description: 'Location adjacent to a variable definition.', + }, + SCHEMA: { + value: DirectiveLocation.SCHEMA, + description: 'Location adjacent to a schema definition.', + }, + SCALAR: { + value: DirectiveLocation.SCALAR, + description: 'Location adjacent to a scalar definition.', + }, + OBJECT: { + value: DirectiveLocation.OBJECT, + description: 'Location adjacent to an object type definition.', + }, + FIELD_DEFINITION: { + value: DirectiveLocation.FIELD_DEFINITION, + description: 'Location adjacent to a field definition.', + }, + ARGUMENT_DEFINITION: { + value: DirectiveLocation.ARGUMENT_DEFINITION, + description: 'Location adjacent to an argument definition.', + }, + INTERFACE: { + value: DirectiveLocation.INTERFACE, + description: 'Location adjacent to an interface definition.', + }, + UNION: { + value: DirectiveLocation.UNION, + description: 'Location adjacent to a union definition.', + }, + ENUM: { + value: DirectiveLocation.ENUM, + description: 'Location adjacent to an enum definition.', + }, + ENUM_VALUE: { + value: DirectiveLocation.ENUM_VALUE, + description: 'Location adjacent to an enum value definition.', + }, + INPUT_OBJECT: { + value: DirectiveLocation.INPUT_OBJECT, + description: 'Location adjacent to an input object type definition.', + }, + INPUT_FIELD_DEFINITION: { + value: DirectiveLocation.INPUT_FIELD_DEFINITION, + description: 'Location adjacent to an input object field definition.', + }, + }, +}); + +export const __Type: GraphQLObjectType = new GraphQLObjectType({ + name: '__Type', + description: + 'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.', + fields: () => + ({ + kind: { + type: new GraphQLNonNull(__TypeKind), + resolve(type) { + if (isScalarType(type)) { + return TypeKind.SCALAR; + } + if (isObjectType(type)) { + return TypeKind.OBJECT; + } + if (isInterfaceType(type)) { + return TypeKind.INTERFACE; + } + if (isUnionType(type)) { + return TypeKind.UNION; + } + if (isEnumType(type)) { + return TypeKind.ENUM; + } + if (isInputObjectType(type)) { + return TypeKind.INPUT_OBJECT; + } + if (isListType(type)) { + return TypeKind.LIST; + } + if (isNonNullType(type)) { + return TypeKind.NON_NULL; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered) + invariant(false, `Unexpected type: "${inspect(type)}".`); + }, + }, + name: { + type: GraphQLString, + resolve: (type) => ('name' in type ? type.name : undefined), + }, + description: { + type: GraphQLString, + resolve: (type) => + // FIXME: add test case + /* c8 ignore next */ + 'description' in type ? type.description : undefined, + }, + specifiedByURL: { + type: GraphQLString, + resolve: (obj) => + 'specifiedByURL' in obj ? obj.specifiedByURL : undefined, + }, + fields: { + type: new GraphQLList(new GraphQLNonNull(__Field)), + args: { + includeDeprecated: { type: GraphQLBoolean, defaultValue: false }, + }, + resolve(type, { includeDeprecated }) { + if (isObjectType(type) || isInterfaceType(type)) { + const fields = Object.values(type.getFields()); + return includeDeprecated + ? fields + : fields.filter((field) => field.deprecationReason == null); + } + }, + }, + interfaces: { + type: new GraphQLList(new GraphQLNonNull(__Type)), + resolve(type) { + if (isObjectType(type) || isInterfaceType(type)) { + return type.getInterfaces(); + } + }, + }, + possibleTypes: { + type: new GraphQLList(new GraphQLNonNull(__Type)), + resolve(type, _args, _context, { schema }) { + if (isAbstractType(type)) { + return schema.getPossibleTypes(type); + } + }, + }, + enumValues: { + type: new GraphQLList(new GraphQLNonNull(__EnumValue)), + args: { + includeDeprecated: { type: GraphQLBoolean, defaultValue: false }, + }, + resolve(type, { includeDeprecated }) { + if (isEnumType(type)) { + const values = type.getValues(); + return includeDeprecated + ? values + : values.filter((field) => field.deprecationReason == null); + } + }, + }, + inputFields: { + type: new GraphQLList(new GraphQLNonNull(__InputValue)), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + resolve(type, { includeDeprecated }) { + if (isInputObjectType(type)) { + const values = Object.values(type.getFields()); + return includeDeprecated + ? values + : values.filter((field) => field.deprecationReason == null); + } + }, + }, + ofType: { + type: __Type, + resolve: (type) => ('ofType' in type ? type.ofType : undefined), + }, + } as GraphQLFieldConfigMap), +}); + +export const __Field: GraphQLObjectType = new GraphQLObjectType({ + name: '__Field', + description: + 'Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type.', + fields: () => + ({ + name: { + type: new GraphQLNonNull(GraphQLString), + resolve: (field) => field.name, + }, + description: { + type: GraphQLString, + resolve: (field) => field.description, + }, + args: { + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(__InputValue)), + ), + args: { + includeDeprecated: { + type: GraphQLBoolean, + defaultValue: false, + }, + }, + resolve(field, { includeDeprecated }) { + return includeDeprecated + ? field.args + : field.args.filter((arg) => arg.deprecationReason == null); + }, + }, + type: { + type: new GraphQLNonNull(__Type), + resolve: (field) => field.type, + }, + isDeprecated: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (field) => field.deprecationReason != null, + }, + deprecationReason: { + type: GraphQLString, + resolve: (field) => field.deprecationReason, + }, + } as GraphQLFieldConfigMap, unknown>), +}); + +export const __InputValue: GraphQLObjectType = new GraphQLObjectType({ + name: '__InputValue', + description: + 'Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value.', + fields: () => + ({ + name: { + type: new GraphQLNonNull(GraphQLString), + resolve: (inputValue) => inputValue.name, + }, + description: { + type: GraphQLString, + resolve: (inputValue) => inputValue.description, + }, + type: { + type: new GraphQLNonNull(__Type), + resolve: (inputValue) => inputValue.type, + }, + defaultValue: { + type: GraphQLString, + description: + 'A GraphQL-formatted string representing the default value for this input value.', + resolve(inputValue) { + const { type, defaultValue } = inputValue; + const valueAST = astFromValue(defaultValue, type); + return valueAST ? print(valueAST) : null; + }, + }, + isDeprecated: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (field) => field.deprecationReason != null, + }, + deprecationReason: { + type: GraphQLString, + resolve: (obj) => obj.deprecationReason, + }, + } as GraphQLFieldConfigMap), +}); + +export const __EnumValue: GraphQLObjectType = new GraphQLObjectType({ + name: '__EnumValue', + description: + 'One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string.', + fields: () => + ({ + name: { + type: new GraphQLNonNull(GraphQLString), + resolve: (enumValue) => enumValue.name, + }, + description: { + type: GraphQLString, + resolve: (enumValue) => enumValue.description, + }, + isDeprecated: { + type: new GraphQLNonNull(GraphQLBoolean), + resolve: (enumValue) => enumValue.deprecationReason != null, + }, + deprecationReason: { + type: GraphQLString, + resolve: (enumValue) => enumValue.deprecationReason, + }, + } as GraphQLFieldConfigMap), +}); + +export enum TypeKind { + SCALAR = 'SCALAR', + OBJECT = 'OBJECT', + INTERFACE = 'INTERFACE', + UNION = 'UNION', + ENUM = 'ENUM', + INPUT_OBJECT = 'INPUT_OBJECT', + LIST = 'LIST', + NON_NULL = 'NON_NULL', +} + +export const __TypeKind: GraphQLEnumType = new GraphQLEnumType({ + name: '__TypeKind', + description: 'An enum describing what kind of type a given `__Type` is.', + values: { + SCALAR: { + value: TypeKind.SCALAR, + description: 'Indicates this type is a scalar.', + }, + OBJECT: { + value: TypeKind.OBJECT, + description: + 'Indicates this type is an object. `fields` and `interfaces` are valid fields.', + }, + INTERFACE: { + value: TypeKind.INTERFACE, + description: + 'Indicates this type is an interface. `fields`, `interfaces`, and `possibleTypes` are valid fields.', + }, + UNION: { + value: TypeKind.UNION, + description: + 'Indicates this type is a union. `possibleTypes` is a valid field.', + }, + ENUM: { + value: TypeKind.ENUM, + description: + 'Indicates this type is an enum. `enumValues` is a valid field.', + }, + INPUT_OBJECT: { + value: TypeKind.INPUT_OBJECT, + description: + 'Indicates this type is an input object. `inputFields` is a valid field.', + }, + LIST: { + value: TypeKind.LIST, + description: 'Indicates this type is a list. `ofType` is a valid field.', + }, + NON_NULL: { + value: TypeKind.NON_NULL, + description: + 'Indicates this type is a non-null. `ofType` is a valid field.', + }, + }, +}); + +/** + * Note that these are GraphQLField and not GraphQLFieldConfig, + * so the format for args is different. + */ + +export const SchemaMetaFieldDef: GraphQLField = { + name: '__schema', + type: new GraphQLNonNull(__Schema), + description: 'Access the current type schema of this server.', + args: [], + resolve: (_source, _args, _context, { schema }) => schema, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; + +export const TypeMetaFieldDef: GraphQLField = { + name: '__type', + type: __Type, + description: 'Request the type information of a single type.', + args: [ + { + name: 'name', + description: undefined, + type: new GraphQLNonNull(GraphQLString), + defaultValue: undefined, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, + }, + ], + resolve: (_source, { name }, _context, { schema }) => schema.getType(name), + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; + +export const TypeNameMetaFieldDef: GraphQLField = { + name: '__typename', + type: new GraphQLNonNull(GraphQLString), + description: 'The name of the current Object type at runtime.', + args: [], + resolve: (_source, _args, _context, { parentType }) => parentType.name, + deprecationReason: undefined, + extensions: Object.create(null), + astNode: undefined, +}; + +export const introspectionTypes: ReadonlyArray = + Object.freeze([ + __Schema, + __Directive, + __DirectiveLocation, + __Type, + __Field, + __InputValue, + __EnumValue, + __TypeKind, + ]); + +export function isIntrospectionType(type: GraphQLNamedType): boolean { + return introspectionTypes.some(({ name }) => type.name === name); +} diff --git a/src/type/scalars.ts b/src/type/scalars.ts new file mode 100644 index 00000000..de78e6b0 --- /dev/null +++ b/src/type/scalars.ts @@ -0,0 +1,284 @@ +import { inspect } from '../jsutils/inspect'; +import { isObjectLike } from '../jsutils/isObjectLike'; + +import { GraphQLError } from '../error/GraphQLError'; + +import { Kind } from '../language/kinds'; +import { print } from '../language/printer'; + +import type { GraphQLNamedType } from './definition'; +import { GraphQLScalarType } from './definition'; + +/** + * Maximum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe up-to 2^53 - 1 + * */ +export const GRAPHQL_MAX_INT = 2147483647; + +/** + * Minimum possible Int value as per GraphQL Spec (32-bit signed integer). + * n.b. This differs from JavaScript's numbers that are IEEE 754 doubles safe starting at -(2^53 - 1) + * */ +export const GRAPHQL_MIN_INT = -2147483648; + +export const GraphQLInt = new GraphQLScalarType({ + name: 'Int', + description: + 'The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 1 : 0; + } + + let num = coercedValue; + if (typeof coercedValue === 'string' && coercedValue !== '') { + num = Number(coercedValue); + } + + if (typeof num !== 'number' || !Number.isInteger(num)) { + throw new GraphQLError( + `Int cannot represent non-integer value: ${inspect(coercedValue)}`, + ); + } + if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) { + throw new GraphQLError( + 'Int cannot represent non 32-bit signed integer value: ' + + inspect(coercedValue), + ); + } + return num; + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'number' || !Number.isInteger(inputValue)) { + throw new GraphQLError( + `Int cannot represent non-integer value: ${inspect(inputValue)}`, + ); + } + if (inputValue > GRAPHQL_MAX_INT || inputValue < GRAPHQL_MIN_INT) { + throw new GraphQLError( + `Int cannot represent non 32-bit signed integer value: ${inputValue}`, + ); + } + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.INT) { + throw new GraphQLError( + `Int cannot represent non-integer value: ${print(valueNode)}`, + valueNode, + ); + } + const num = parseInt(valueNode.value, 10); + if (num > GRAPHQL_MAX_INT || num < GRAPHQL_MIN_INT) { + throw new GraphQLError( + `Int cannot represent non 32-bit signed integer value: ${valueNode.value}`, + valueNode, + ); + } + return num; + }, +}); + +export const GraphQLFloat = new GraphQLScalarType({ + name: 'Float', + description: + 'The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](https://en.wikipedia.org/wiki/IEEE_floating_point).', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue ? 1 : 0; + } + + let num = coercedValue; + if (typeof coercedValue === 'string' && coercedValue !== '') { + num = Number(coercedValue); + } + + if (typeof num !== 'number' || !Number.isFinite(num)) { + throw new GraphQLError( + `Float cannot represent non numeric value: ${inspect(coercedValue)}`, + ); + } + return num; + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'number' || !Number.isFinite(inputValue)) { + throw new GraphQLError( + `Float cannot represent non numeric value: ${inspect(inputValue)}`, + ); + } + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.FLOAT && valueNode.kind !== Kind.INT) { + throw new GraphQLError( + `Float cannot represent non numeric value: ${print(valueNode)}`, + valueNode, + ); + } + return parseFloat(valueNode.value); + }, +}); + +export const GraphQLString = new GraphQLScalarType({ + name: 'String', + description: + 'The `String` scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + // Serialize string, boolean and number values to a string, but do not + // attempt to coerce object, function, symbol, or other types as strings. + if (typeof coercedValue === 'string') { + return coercedValue; + } + if (typeof coercedValue === 'boolean') { + return coercedValue ? 'true' : 'false'; + } + if (typeof coercedValue === 'number' && Number.isFinite(coercedValue)) { + return coercedValue.toString(); + } + throw new GraphQLError( + `String cannot represent value: ${inspect(outputValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'string') { + throw new GraphQLError( + `String cannot represent a non string value: ${inspect(inputValue)}`, + ); + } + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.STRING) { + throw new GraphQLError( + `String cannot represent a non string value: ${print(valueNode)}`, + valueNode, + ); + } + return valueNode.value; + }, +}); + +export const GraphQLBoolean = new GraphQLScalarType({ + name: 'Boolean', + description: 'The `Boolean` scalar type represents `true` or `false`.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'boolean') { + return coercedValue; + } + if (Number.isFinite(coercedValue)) { + return coercedValue !== 0; + } + throw new GraphQLError( + `Boolean cannot represent a non boolean value: ${inspect(coercedValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue !== 'boolean') { + throw new GraphQLError( + `Boolean cannot represent a non boolean value: ${inspect(inputValue)}`, + ); + } + return inputValue; + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.BOOLEAN) { + throw new GraphQLError( + `Boolean cannot represent a non boolean value: ${print(valueNode)}`, + valueNode, + ); + } + return valueNode.value; + }, +}); + +export const GraphQLID = new GraphQLScalarType({ + name: 'ID', + description: + 'The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.', + + serialize(outputValue) { + const coercedValue = serializeObject(outputValue); + + if (typeof coercedValue === 'string') { + return coercedValue; + } + if (Number.isInteger(coercedValue)) { + return String(coercedValue); + } + throw new GraphQLError( + `ID cannot represent value: ${inspect(outputValue)}`, + ); + }, + + parseValue(inputValue) { + if (typeof inputValue === 'string') { + return inputValue; + } + if (typeof inputValue === 'number' && Number.isInteger(inputValue)) { + return inputValue.toString(); + } + throw new GraphQLError(`ID cannot represent value: ${inspect(inputValue)}`); + }, + + parseLiteral(valueNode) { + if (valueNode.kind !== Kind.STRING && valueNode.kind !== Kind.INT) { + throw new GraphQLError( + 'ID cannot represent a non-string and non-integer value: ' + + print(valueNode), + valueNode, + ); + } + return valueNode.value; + }, +}); + +export const specifiedScalarTypes: ReadonlyArray = + Object.freeze([ + GraphQLString, + GraphQLInt, + GraphQLFloat, + GraphQLBoolean, + GraphQLID, + ]); + +export function isSpecifiedScalarType(type: GraphQLNamedType): boolean { + return specifiedScalarTypes.some(({ name }) => type.name === name); +} + +// Support serializing objects with custom valueOf() or toJSON() functions - +// a common way to represent a complex value which can be represented as +// a string (ex: MongoDB id objects). +function serializeObject(outputValue: unknown): unknown { + if (isObjectLike(outputValue)) { + if (typeof outputValue.valueOf === 'function') { + const valueOfResult = outputValue.valueOf(); + if (!isObjectLike(valueOfResult)) { + return valueOfResult; + } + } + if (typeof outputValue.toJSON === 'function') { + return outputValue.toJSON(); + } + } + return outputValue; +} diff --git a/src/type/schema.ts b/src/type/schema.ts new file mode 100644 index 00000000..97c27821 --- /dev/null +++ b/src/type/schema.ts @@ -0,0 +1,437 @@ +import { devAssert } from '../jsutils/devAssert'; +import { inspect } from '../jsutils/inspect'; +import { instanceOf } from '../jsutils/instanceOf'; +import { isObjectLike } from '../jsutils/isObjectLike'; +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; +import { toObjMap } from '../jsutils/toObjMap'; + +import type { GraphQLError } from '../error/GraphQLError'; + +import type { + SchemaDefinitionNode, + SchemaExtensionNode, +} from '../language/ast'; +import { OperationTypeNode } from '../language/ast'; + +import type { + GraphQLAbstractType, + GraphQLInterfaceType, + GraphQLNamedType, + GraphQLObjectType, + GraphQLType, +} from './definition'; +import { + getNamedType, + isInputObjectType, + isInterfaceType, + isObjectType, + isUnionType, +} from './definition'; +import type { GraphQLDirective } from './directives'; +import { isDirective, specifiedDirectives } from './directives'; +import { __Schema } from './introspection'; + +/** + * Test if the given value is a GraphQL schema. + */ +export function isSchema(schema: unknown): schema is GraphQLSchema { + return instanceOf(schema, GraphQLSchema); +} + +export function assertSchema(schema: unknown): GraphQLSchema { + if (!isSchema(schema)) { + throw new Error(`Expected ${inspect(schema)} to be a GraphQL schema.`); + } + return schema; +} + +/** + * Custom extensions + * + * @remarks + * Use a unique identifier name for your extension, for example the name of + * your library or project. Do not use a shortened identifier as this increases + * the risk of conflicts. We recommend you add at most one extension field, + * an object which can contain all the values you need. + */ +export interface GraphQLSchemaExtensions { + [attributeName: string]: unknown; +} + +/** + * Schema Definition + * + * A Schema is created by supplying the root types of each type of operation, + * query and mutation (optional). A schema definition is then supplied to the + * validator and executor. + * + * Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * query: MyAppQueryRootType, + * mutation: MyAppMutationRootType, + * }) + * ``` + * + * Note: When the schema is constructed, by default only the types that are + * reachable by traversing the root types are included, other types must be + * explicitly referenced. + * + * Example: + * + * ```ts + * const characterInterface = new GraphQLInterfaceType({ + * name: 'Character', + * ... + * }); + * + * const humanType = new GraphQLObjectType({ + * name: 'Human', + * interfaces: [characterInterface], + * ... + * }); + * + * const droidType = new GraphQLObjectType({ + * name: 'Droid', + * interfaces: [characterInterface], + * ... + * }); + * + * const schema = new GraphQLSchema({ + * query: new GraphQLObjectType({ + * name: 'Query', + * fields: { + * hero: { type: characterInterface, ... }, + * } + * }), + * ... + * // Since this schema references only the `Character` interface it's + * // necessary to explicitly list the types that implement it if + * // you want them to be included in the final schema. + * types: [humanType, droidType], + * }) + * ``` + * + * Note: If an array of `directives` are provided to GraphQLSchema, that will be + * the exact list of directives represented and allowed. If `directives` is not + * provided then a default set of the specified directives (e.g. `@include` and + * `@skip`) will be used. If you wish to provide *additional* directives to these + * specified directives, you must explicitly declare them. Example: + * + * ```ts + * const MyAppSchema = new GraphQLSchema({ + * ... + * directives: specifiedDirectives.concat([ myCustomDirective ]), + * }) + * ``` + */ +export class GraphQLSchema { + description: Maybe; + extensions: Readonly; + astNode: Maybe; + extensionASTNodes: ReadonlyArray; + + // Used as a cache for validateSchema(). + __validationErrors: Maybe>; + + private _queryType: Maybe; + private _mutationType: Maybe; + private _subscriptionType: Maybe; + private _directives: ReadonlyArray; + private _typeMap: TypeMap; + private _subTypeMap: ObjMap>; + private _implementationsMap: ObjMap<{ + objects: Array; + interfaces: Array; + }>; + + constructor(config: Readonly) { + // If this schema was built from a source known to be valid, then it may be + // marked with assumeValid to avoid an additional type system validation. + this.__validationErrors = config.assumeValid === true ? [] : undefined; + + // Check for common mistakes during construction to produce early errors. + devAssert(isObjectLike(config), 'Must provide configuration object.'); + devAssert( + !config.types || Array.isArray(config.types), + `"types" must be Array if provided but got: ${inspect(config.types)}.`, + ); + devAssert( + !config.directives || Array.isArray(config.directives), + '"directives" must be Array if provided but got: ' + + `${inspect(config.directives)}.`, + ); + + this.description = config.description; + this.extensions = toObjMap(config.extensions); + this.astNode = config.astNode; + this.extensionASTNodes = config.extensionASTNodes ?? []; + + this._queryType = config.query; + this._mutationType = config.mutation; + this._subscriptionType = config.subscription; + // Provide specified directives (e.g. @include and @skip) by default. + this._directives = config.directives ?? specifiedDirectives; + + // To preserve order of user-provided types, we add first to add them to + // the set of "collected" types, so `collectReferencedTypes` ignore them. + const allReferencedTypes: Set = new Set(config.types); + if (config.types != null) { + for (const type of config.types) { + // When we ready to process this type, we remove it from "collected" types + // and then add it together with all dependent types in the correct position. + allReferencedTypes.delete(type); + collectReferencedTypes(type, allReferencedTypes); + } + } + + if (this._queryType != null) { + collectReferencedTypes(this._queryType, allReferencedTypes); + } + if (this._mutationType != null) { + collectReferencedTypes(this._mutationType, allReferencedTypes); + } + if (this._subscriptionType != null) { + collectReferencedTypes(this._subscriptionType, allReferencedTypes); + } + + for (const directive of this._directives) { + // Directives are not validated until validateSchema() is called. + if (isDirective(directive)) { + for (const arg of directive.args) { + collectReferencedTypes(arg.type, allReferencedTypes); + } + } + } + collectReferencedTypes(__Schema, allReferencedTypes); + + // Storing the resulting map for reference by the schema. + this._typeMap = Object.create(null); + this._subTypeMap = Object.create(null); + // Keep track of all implementations by interface name. + this._implementationsMap = Object.create(null); + + for (const namedType of allReferencedTypes) { + if (namedType == null) { + continue; + } + + const typeName = namedType.name; + devAssert( + typeName, + 'One of the provided types for building the Schema is missing a name.', + ); + if (this._typeMap[typeName] !== undefined) { + throw new Error( + `Schema must contain uniquely named types but contains multiple types named "${typeName}".`, + ); + } + this._typeMap[typeName] = namedType; + + if (isInterfaceType(namedType)) { + // Store implementations by interface. + for (const iface of namedType.getInterfaces()) { + if (isInterfaceType(iface)) { + let implementations = this._implementationsMap[iface.name]; + if (implementations === undefined) { + implementations = this._implementationsMap[iface.name] = { + objects: [], + interfaces: [], + }; + } + + implementations.interfaces.push(namedType); + } + } + } else if (isObjectType(namedType)) { + // Store implementations by objects. + for (const iface of namedType.getInterfaces()) { + if (isInterfaceType(iface)) { + let implementations = this._implementationsMap[iface.name]; + if (implementations === undefined) { + implementations = this._implementationsMap[iface.name] = { + objects: [], + interfaces: [], + }; + } + + implementations.objects.push(namedType); + } + } + } + } + } + + get [Symbol.toStringTag]() { + return 'GraphQLSchema'; + } + + getQueryType(): Maybe { + return this._queryType; + } + + getMutationType(): Maybe { + return this._mutationType; + } + + getSubscriptionType(): Maybe { + return this._subscriptionType; + } + + getRootType(operation: OperationTypeNode): Maybe { + switch (operation) { + case OperationTypeNode.QUERY: + return this.getQueryType(); + case OperationTypeNode.MUTATION: + return this.getMutationType(); + case OperationTypeNode.SUBSCRIPTION: + return this.getSubscriptionType(); + } + } + + getTypeMap(): TypeMap { + return this._typeMap; + } + + getType(name: string): GraphQLNamedType | undefined { + return this.getTypeMap()[name]; + } + + getPossibleTypes( + abstractType: GraphQLAbstractType, + ): ReadonlyArray { + return isUnionType(abstractType) + ? abstractType.getTypes() + : this.getImplementations(abstractType).objects; + } + + getImplementations(interfaceType: GraphQLInterfaceType): { + objects: ReadonlyArray; + interfaces: ReadonlyArray; + } { + const implementations = this._implementationsMap[interfaceType.name]; + return implementations ?? { objects: [], interfaces: [] }; + } + + isSubType( + abstractType: GraphQLAbstractType, + maybeSubType: GraphQLObjectType | GraphQLInterfaceType, + ): boolean { + let map = this._subTypeMap[abstractType.name]; + if (map === undefined) { + map = Object.create(null); + + if (isUnionType(abstractType)) { + for (const type of abstractType.getTypes()) { + map[type.name] = true; + } + } else { + const implementations = this.getImplementations(abstractType); + for (const type of implementations.objects) { + map[type.name] = true; + } + for (const type of implementations.interfaces) { + map[type.name] = true; + } + } + + this._subTypeMap[abstractType.name] = map; + } + return map[maybeSubType.name] !== undefined; + } + + getDirectives(): ReadonlyArray { + return this._directives; + } + + getDirective(name: string): Maybe { + return this.getDirectives().find((directive) => directive.name === name); + } + + toConfig(): GraphQLSchemaNormalizedConfig { + return { + description: this.description, + query: this.getQueryType(), + mutation: this.getMutationType(), + subscription: this.getSubscriptionType(), + types: Object.values(this.getTypeMap()), + directives: this.getDirectives(), + extensions: this.extensions, + astNode: this.astNode, + extensionASTNodes: this.extensionASTNodes, + assumeValid: this.__validationErrors !== undefined, + }; + } +} + +type TypeMap = ObjMap; + +export interface GraphQLSchemaValidationOptions { + /** + * When building a schema from a GraphQL service's introspection result, it + * might be safe to assume the schema is valid. Set to true to assume the + * produced schema is valid. + * + * Default: false + */ + assumeValid?: boolean; +} + +export interface GraphQLSchemaConfig extends GraphQLSchemaValidationOptions { + description?: Maybe; + query?: Maybe; + mutation?: Maybe; + subscription?: Maybe; + types?: Maybe>; + directives?: Maybe>; + extensions?: Maybe>; + astNode?: Maybe; + extensionASTNodes?: Maybe>; +} + +/** + * @internal + */ +export interface GraphQLSchemaNormalizedConfig extends GraphQLSchemaConfig { + description: Maybe; + types: ReadonlyArray; + directives: ReadonlyArray; + extensions: Readonly; + extensionASTNodes: ReadonlyArray; + assumeValid: boolean; +} + +function collectReferencedTypes( + type: GraphQLType, + typeSet: Set, +): Set { + const namedType = getNamedType(type); + + if (!typeSet.has(namedType)) { + typeSet.add(namedType); + if (isUnionType(namedType)) { + for (const memberType of namedType.getTypes()) { + collectReferencedTypes(memberType, typeSet); + } + } else if (isObjectType(namedType) || isInterfaceType(namedType)) { + for (const interfaceType of namedType.getInterfaces()) { + collectReferencedTypes(interfaceType, typeSet); + } + + for (const field of Object.values(namedType.getFields())) { + collectReferencedTypes(field.type, typeSet); + for (const arg of field.args) { + collectReferencedTypes(arg.type, typeSet); + } + } + } else if (isInputObjectType(namedType)) { + for (const field of Object.values(namedType.getFields())) { + collectReferencedTypes(field.type, typeSet); + } + } + } + + return typeSet; +} diff --git a/src/type/validate.ts b/src/type/validate.ts new file mode 100644 index 00000000..92f70787 --- /dev/null +++ b/src/type/validate.ts @@ -0,0 +1,627 @@ +import { inspect } from '../jsutils/inspect'; +import type { Maybe } from '../jsutils/Maybe'; + +import { GraphQLError } from '../error/GraphQLError'; + +import type { + ASTNode, + DirectiveNode, + InterfaceTypeDefinitionNode, + InterfaceTypeExtensionNode, + NamedTypeNode, + ObjectTypeDefinitionNode, + ObjectTypeExtensionNode, + UnionTypeDefinitionNode, + UnionTypeExtensionNode, +} from '../language/ast'; +import { OperationTypeNode } from '../language/ast'; + +import { isEqualType, isTypeSubTypeOf } from '../utilities/typeComparators'; + +import type { + GraphQLEnumType, + GraphQLInputField, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLObjectType, + GraphQLUnionType, +} from './definition'; +import { + isEnumType, + isInputObjectType, + isInputType, + isInterfaceType, + isNamedType, + isNonNullType, + isObjectType, + isOutputType, + isRequiredArgument, + isRequiredInputField, + isUnionType, +} from './definition'; +import { GraphQLDeprecatedDirective, isDirective } from './directives'; +import { isIntrospectionType } from './introspection'; +import type { GraphQLSchema } from './schema'; +import { assertSchema } from './schema'; + +/** + * Implements the "Type Validation" sub-sections of the specification's + * "Type System" section. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the Schema is valid. + */ +export function validateSchema( + schema: GraphQLSchema, +): ReadonlyArray { + // First check to ensure the provided value is in fact a GraphQLSchema. + assertSchema(schema); + + // If this Schema has already been validated, return the previous results. + if (schema.__validationErrors) { + return schema.__validationErrors; + } + + // Validate the schema, producing a list of errors. + const context = new SchemaValidationContext(schema); + validateRootTypes(context); + validateDirectives(context); + validateTypes(context); + + // Persist the results of validation before returning to ensure validation + // does not run multiple times for this schema. + const errors = context.getErrors(); + schema.__validationErrors = errors; + return errors; +} + +/** + * Utility function which asserts a schema is valid by throwing an error if + * it is invalid. + */ +export function assertValidSchema(schema: GraphQLSchema): void { + const errors = validateSchema(schema); + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} + +class SchemaValidationContext { + readonly _errors: Array; + readonly schema: GraphQLSchema; + + constructor(schema: GraphQLSchema) { + this._errors = []; + this.schema = schema; + } + + reportError( + message: string, + nodes?: ReadonlyArray> | Maybe, + ): void { + const _nodes = Array.isArray(nodes) + ? (nodes.filter(Boolean) as ReadonlyArray) + : (nodes as Maybe); + this._errors.push(new GraphQLError(message, _nodes)); + } + + getErrors(): ReadonlyArray { + return this._errors; + } +} + +function validateRootTypes(context: SchemaValidationContext): void { + const schema = context.schema; + const queryType = schema.getQueryType(); + if (!queryType) { + context.reportError('Query root type must be provided.', schema.astNode); + } else if (!isObjectType(queryType)) { + context.reportError( + `Query root type must be Object type, it cannot be ${inspect( + queryType, + )}.`, + getOperationTypeNode(schema, OperationTypeNode.QUERY) ?? + (queryType as any).astNode, + ); + } + + const mutationType = schema.getMutationType(); + if (mutationType && !isObjectType(mutationType)) { + context.reportError( + 'Mutation root type must be Object type if provided, it cannot be ' + + `${inspect(mutationType)}.`, + getOperationTypeNode(schema, OperationTypeNode.MUTATION) ?? + (mutationType as any).astNode, + ); + } + + const subscriptionType = schema.getSubscriptionType(); + if (subscriptionType && !isObjectType(subscriptionType)) { + context.reportError( + 'Subscription root type must be Object type if provided, it cannot be ' + + `${inspect(subscriptionType)}.`, + getOperationTypeNode(schema, OperationTypeNode.SUBSCRIPTION) ?? + (subscriptionType as any).astNode, + ); + } +} + +function getOperationTypeNode( + schema: GraphQLSchema, + operation: OperationTypeNode, +): Maybe { + return [schema.astNode, ...schema.extensionASTNodes] + .flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (schemaNode) => /* c8 ignore next */ schemaNode?.operationTypes ?? [], + ) + .find((operationNode) => operationNode.operation === operation)?.type; +} + +function validateDirectives(context: SchemaValidationContext): void { + for (const directive of context.schema.getDirectives()) { + // Ensure all directives are in fact GraphQL directives. + if (!isDirective(directive)) { + context.reportError( + `Expected directive but got: ${inspect(directive)}.`, + (directive as any)?.astNode, + ); + continue; + } + + // Ensure they are named correctly. + validateName(context, directive); + + // TODO: Ensure proper locations. + + // Ensure the arguments are valid. + for (const arg of directive.args) { + // Ensure they are named correctly. + validateName(context, arg); + + // Ensure the type is an input type. + if (!isInputType(arg.type)) { + context.reportError( + `The type of @${directive.name}(${arg.name}:) must be Input Type ` + + `but got: ${inspect(arg.type)}.`, + arg.astNode, + ); + } + + if (isRequiredArgument(arg) && arg.deprecationReason != null) { + context.reportError( + `Required argument @${directive.name}(${arg.name}:) cannot be deprecated.`, + [getDeprecatedDirectiveNode(arg.astNode), arg.astNode?.type], + ); + } + } + } +} + +function validateName( + context: SchemaValidationContext, + node: { readonly name: string; readonly astNode: Maybe }, +): void { + // Ensure names are valid, however introspection types opt out. + if (node.name.startsWith('__')) { + context.reportError( + `Name "${node.name}" must not begin with "__", which is reserved by GraphQL introspection.`, + node.astNode, + ); + } +} + +function validateTypes(context: SchemaValidationContext): void { + const validateInputObjectCircularRefs = + createInputObjectCircularRefsValidator(context); + const typeMap = context.schema.getTypeMap(); + for (const type of Object.values(typeMap)) { + // Ensure all provided types are in fact GraphQL type. + if (!isNamedType(type)) { + context.reportError( + `Expected GraphQL named type but got: ${inspect(type)}.`, + (type as any).astNode, + ); + continue; + } + + // Ensure it is named correctly (excluding introspection types). + if (!isIntrospectionType(type)) { + validateName(context, type); + } + + if (isObjectType(type)) { + // Ensure fields are valid + validateFields(context, type); + + // Ensure objects implement the interfaces they claim to. + validateInterfaces(context, type); + } else if (isInterfaceType(type)) { + // Ensure fields are valid. + validateFields(context, type); + + // Ensure interfaces implement the interfaces they claim to. + validateInterfaces(context, type); + } else if (isUnionType(type)) { + // Ensure Unions include valid member types. + validateUnionMembers(context, type); + } else if (isEnumType(type)) { + // Ensure Enums have valid values. + validateEnumValues(context, type); + } else if (isInputObjectType(type)) { + // Ensure Input Object fields are valid. + validateInputFields(context, type); + + // Ensure Input Objects do not contain non-nullable circular references + validateInputObjectCircularRefs(type); + } + } +} + +function validateFields( + context: SchemaValidationContext, + type: GraphQLObjectType | GraphQLInterfaceType, +): void { + const fields = Object.values(type.getFields()); + + // Objects and Interfaces both must define one or more fields. + if (fields.length === 0) { + context.reportError(`Type ${type.name} must define one or more fields.`, [ + type.astNode, + ...type.extensionASTNodes, + ]); + } + + for (const field of fields) { + // Ensure they are named correctly. + validateName(context, field); + + // Ensure the type is an output type + if (!isOutputType(field.type)) { + context.reportError( + `The type of ${type.name}.${field.name} must be Output Type ` + + `but got: ${inspect(field.type)}.`, + field.astNode?.type, + ); + } + + // Ensure the arguments are valid + for (const arg of field.args) { + const argName = arg.name; + + // Ensure they are named correctly. + validateName(context, arg); + + // Ensure the type is an input type + if (!isInputType(arg.type)) { + context.reportError( + `The type of ${type.name}.${field.name}(${argName}:) must be Input ` + + `Type but got: ${inspect(arg.type)}.`, + arg.astNode?.type, + ); + } + + if (isRequiredArgument(arg) && arg.deprecationReason != null) { + context.reportError( + `Required argument ${type.name}.${field.name}(${argName}:) cannot be deprecated.`, + [getDeprecatedDirectiveNode(arg.astNode), arg.astNode?.type], + ); + } + } + } +} + +function validateInterfaces( + context: SchemaValidationContext, + type: GraphQLObjectType | GraphQLInterfaceType, +): void { + const ifaceTypeNames = Object.create(null); + for (const iface of type.getInterfaces()) { + if (!isInterfaceType(iface)) { + context.reportError( + `Type ${inspect(type)} must only implement Interface types, ` + + `it cannot implement ${inspect(iface)}.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + if (type === iface) { + context.reportError( + `Type ${type.name} cannot implement itself because it would create a circular reference.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + if (ifaceTypeNames[iface.name]) { + context.reportError( + `Type ${type.name} can only implement ${iface.name} once.`, + getAllImplementsInterfaceNodes(type, iface), + ); + continue; + } + + ifaceTypeNames[iface.name] = true; + + validateTypeImplementsAncestors(context, type, iface); + validateTypeImplementsInterface(context, type, iface); + } +} + +function validateTypeImplementsInterface( + context: SchemaValidationContext, + type: GraphQLObjectType | GraphQLInterfaceType, + iface: GraphQLInterfaceType, +): void { + const typeFieldMap = type.getFields(); + + // Assert each interface field is implemented. + for (const ifaceField of Object.values(iface.getFields())) { + const fieldName = ifaceField.name; + const typeField = typeFieldMap[fieldName]; + + // Assert interface field exists on type. + if (!typeField) { + context.reportError( + `Interface field ${iface.name}.${fieldName} expected but ${type.name} does not provide it.`, + [ifaceField.astNode, type.astNode, ...type.extensionASTNodes], + ); + continue; + } + + // Assert interface field type is satisfied by type field type, by being + // a valid subtype. (covariant) + if (!isTypeSubTypeOf(context.schema, typeField.type, ifaceField.type)) { + context.reportError( + `Interface field ${iface.name}.${fieldName} expects type ` + + `${inspect(ifaceField.type)} but ${type.name}.${fieldName} ` + + `is type ${inspect(typeField.type)}.`, + [ifaceField.astNode?.type, typeField.astNode?.type], + ); + } + + // Assert each interface field arg is implemented. + for (const ifaceArg of ifaceField.args) { + const argName = ifaceArg.name; + const typeArg = typeField.args.find((arg) => arg.name === argName); + + // Assert interface field arg exists on object field. + if (!typeArg) { + context.reportError( + `Interface field argument ${iface.name}.${fieldName}(${argName}:) expected but ${type.name}.${fieldName} does not provide it.`, + [ifaceArg.astNode, typeField.astNode], + ); + continue; + } + + // Assert interface field arg type matches object field arg type. + // (invariant) + // TODO: change to contravariant? + if (!isEqualType(ifaceArg.type, typeArg.type)) { + context.reportError( + `Interface field argument ${iface.name}.${fieldName}(${argName}:) ` + + `expects type ${inspect(ifaceArg.type)} but ` + + `${type.name}.${fieldName}(${argName}:) is type ` + + `${inspect(typeArg.type)}.`, + [ifaceArg.astNode?.type, typeArg.astNode?.type], + ); + } + + // TODO: validate default values? + } + + // Assert additional arguments must not be required. + for (const typeArg of typeField.args) { + const argName = typeArg.name; + const ifaceArg = ifaceField.args.find((arg) => arg.name === argName); + if (!ifaceArg && isRequiredArgument(typeArg)) { + context.reportError( + `Object field ${type.name}.${fieldName} includes required argument ${argName} that is missing from the Interface field ${iface.name}.${fieldName}.`, + [typeArg.astNode, ifaceField.astNode], + ); + } + } + } +} + +function validateTypeImplementsAncestors( + context: SchemaValidationContext, + type: GraphQLObjectType | GraphQLInterfaceType, + iface: GraphQLInterfaceType, +): void { + const ifaceInterfaces = type.getInterfaces(); + for (const transitive of iface.getInterfaces()) { + if (!ifaceInterfaces.includes(transitive)) { + context.reportError( + transitive === type + ? `Type ${type.name} cannot implement ${iface.name} because it would create a circular reference.` + : `Type ${type.name} must implement ${transitive.name} because it is implemented by ${iface.name}.`, + [ + ...getAllImplementsInterfaceNodes(iface, transitive), + ...getAllImplementsInterfaceNodes(type, iface), + ], + ); + } + } +} + +function validateUnionMembers( + context: SchemaValidationContext, + union: GraphQLUnionType, +): void { + const memberTypes = union.getTypes(); + + if (memberTypes.length === 0) { + context.reportError( + `Union type ${union.name} must define one or more member types.`, + [union.astNode, ...union.extensionASTNodes], + ); + } + + const includedTypeNames = Object.create(null); + for (const memberType of memberTypes) { + if (includedTypeNames[memberType.name]) { + context.reportError( + `Union type ${union.name} can only include type ${memberType.name} once.`, + getUnionMemberTypeNodes(union, memberType.name), + ); + continue; + } + includedTypeNames[memberType.name] = true; + if (!isObjectType(memberType)) { + context.reportError( + `Union type ${union.name} can only include Object types, ` + + `it cannot include ${inspect(memberType)}.`, + getUnionMemberTypeNodes(union, String(memberType)), + ); + } + } +} + +function validateEnumValues( + context: SchemaValidationContext, + enumType: GraphQLEnumType, +): void { + const enumValues = enumType.getValues(); + + if (enumValues.length === 0) { + context.reportError( + `Enum type ${enumType.name} must define one or more values.`, + [enumType.astNode, ...enumType.extensionASTNodes], + ); + } + + for (const enumValue of enumValues) { + // Ensure valid name. + validateName(context, enumValue); + } +} + +function validateInputFields( + context: SchemaValidationContext, + inputObj: GraphQLInputObjectType, +): void { + const fields = Object.values(inputObj.getFields()); + + if (fields.length === 0) { + context.reportError( + `Input Object type ${inputObj.name} must define one or more fields.`, + [inputObj.astNode, ...inputObj.extensionASTNodes], + ); + } + + // Ensure the arguments are valid + for (const field of fields) { + // Ensure they are named correctly. + validateName(context, field); + + // Ensure the type is an input type + if (!isInputType(field.type)) { + context.reportError( + `The type of ${inputObj.name}.${field.name} must be Input Type ` + + `but got: ${inspect(field.type)}.`, + field.astNode?.type, + ); + } + + if (isRequiredInputField(field) && field.deprecationReason != null) { + context.reportError( + `Required input field ${inputObj.name}.${field.name} cannot be deprecated.`, + [getDeprecatedDirectiveNode(field.astNode), field.astNode?.type], + ); + } + } +} + +function createInputObjectCircularRefsValidator( + context: SchemaValidationContext, +): (inputObj: GraphQLInputObjectType) => void { + // Modified copy of algorithm from 'src/validation/rules/NoFragmentCycles.js'. + // Tracks already visited types to maintain O(N) and to ensure that cycles + // are not redundantly reported. + const visitedTypes = Object.create(null); + + // Array of types nodes used to produce meaningful errors + const fieldPath: Array = []; + + // Position in the type path + const fieldPathIndexByTypeName = Object.create(null); + + return detectCycleRecursive; + + // This does a straight-forward DFS to find cycles. + // It does not terminate when a cycle was found but continues to explore + // the graph to find all possible cycles. + function detectCycleRecursive(inputObj: GraphQLInputObjectType): void { + if (visitedTypes[inputObj.name]) { + return; + } + + visitedTypes[inputObj.name] = true; + fieldPathIndexByTypeName[inputObj.name] = fieldPath.length; + + const fields = Object.values(inputObj.getFields()); + for (const field of fields) { + if (isNonNullType(field.type) && isInputObjectType(field.type.ofType)) { + const fieldType = field.type.ofType; + const cycleIndex = fieldPathIndexByTypeName[fieldType.name]; + + fieldPath.push(field); + if (cycleIndex === undefined) { + detectCycleRecursive(fieldType); + } else { + const cyclePath = fieldPath.slice(cycleIndex); + const pathStr = cyclePath.map((fieldObj) => fieldObj.name).join('.'); + context.reportError( + `Cannot reference Input Object "${fieldType.name}" within itself through a series of non-null fields: "${pathStr}".`, + cyclePath.map((fieldObj) => fieldObj.astNode), + ); + } + fieldPath.pop(); + } + } + + fieldPathIndexByTypeName[inputObj.name] = undefined; + } +} + +function getAllImplementsInterfaceNodes( + type: GraphQLObjectType | GraphQLInterfaceType, + iface: GraphQLInterfaceType, +): ReadonlyArray { + const { astNode, extensionASTNodes } = type; + const nodes: ReadonlyArray< + | ObjectTypeDefinitionNode + | ObjectTypeExtensionNode + | InterfaceTypeDefinitionNode + | InterfaceTypeExtensionNode + > = astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + return nodes + .flatMap((typeNode) => /* c8 ignore next */ typeNode.interfaces ?? []) + .filter((ifaceNode) => ifaceNode.name.value === iface.name); +} + +function getUnionMemberTypeNodes( + union: GraphQLUnionType, + typeName: string, +): Maybe> { + const { astNode, extensionASTNodes } = union; + const nodes: ReadonlyArray = + astNode != null ? [astNode, ...extensionASTNodes] : extensionASTNodes; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + return nodes + .flatMap((unionNode) => /* c8 ignore next */ unionNode.types ?? []) + .filter((typeNode) => typeNode.name.value === typeName); +} + +function getDeprecatedDirectiveNode( + definitionNode: Maybe<{ readonly directives?: ReadonlyArray }>, +): Maybe { + return definitionNode?.directives?.find( + (node) => node.name.value === GraphQLDeprecatedDirective.name, + ); +} diff --git a/src/utilities/README.md b/src/utilities/README.md new file mode 100644 index 00000000..0e626e23 --- /dev/null +++ b/src/utilities/README.md @@ -0,0 +1,9 @@ +## GraphQL Utilities + +The `graphql/utilities` module contains common useful computations to use with +the GraphQL language and type objects. + +```js +import { ... } from 'graphql/utilities'; // ES6 +var GraphQLUtilities = require('graphql/utilities'); // CommonJS +``` diff --git a/src/utilities/TypeInfo.ts b/src/utilities/TypeInfo.ts new file mode 100644 index 00000000..e72dfb01 --- /dev/null +++ b/src/utilities/TypeInfo.ts @@ -0,0 +1,363 @@ +import type { Maybe } from '../jsutils/Maybe'; + +import type { ASTNode, FieldNode } from '../language/ast'; +import { isNode } from '../language/ast'; +import { Kind } from '../language/kinds'; +import type { ASTVisitor } from '../language/visitor'; +import { getEnterLeaveForKind } from '../language/visitor'; + +import type { + GraphQLArgument, + GraphQLCompositeType, + GraphQLEnumValue, + GraphQLField, + GraphQLInputField, + GraphQLInputType, + GraphQLOutputType, + GraphQLType, +} from '../type/definition'; +import { + getNamedType, + getNullableType, + isCompositeType, + isEnumType, + isInputObjectType, + isInputType, + isInterfaceType, + isListType, + isObjectType, + isOutputType, +} from '../type/definition'; +import type { GraphQLDirective } from '../type/directives'; +import { + SchemaMetaFieldDef, + TypeMetaFieldDef, + TypeNameMetaFieldDef, +} from '../type/introspection'; +import type { GraphQLSchema } from '../type/schema'; + +import { typeFromAST } from './typeFromAST'; + +/** + * TypeInfo is a utility class which, given a GraphQL schema, can keep track + * of the current field and type definitions at any point in a GraphQL document + * AST during a recursive descent by calling `enter(node)` and `leave(node)`. + */ +export class TypeInfo { + private _schema: GraphQLSchema; + private _typeStack: Array>; + private _parentTypeStack: Array>; + private _inputTypeStack: Array>; + private _fieldDefStack: Array>>; + private _defaultValueStack: Array>; + private _directive: Maybe; + private _argument: Maybe; + private _enumValue: Maybe; + private _getFieldDef: GetFieldDefFn; + + constructor( + schema: GraphQLSchema, + /** + * Initial type may be provided in rare cases to facilitate traversals + * beginning somewhere other than documents. + */ + initialType?: Maybe, + + /** @deprecated will be removed in 17.0.0 */ + getFieldDefFn?: GetFieldDefFn, + ) { + this._schema = schema; + this._typeStack = []; + this._parentTypeStack = []; + this._inputTypeStack = []; + this._fieldDefStack = []; + this._defaultValueStack = []; + this._directive = null; + this._argument = null; + this._enumValue = null; + this._getFieldDef = getFieldDefFn ?? getFieldDef; + if (initialType) { + if (isInputType(initialType)) { + this._inputTypeStack.push(initialType); + } + if (isCompositeType(initialType)) { + this._parentTypeStack.push(initialType); + } + if (isOutputType(initialType)) { + this._typeStack.push(initialType); + } + } + } + + get [Symbol.toStringTag]() { + return 'TypeInfo'; + } + + getType(): Maybe { + if (this._typeStack.length > 0) { + return this._typeStack[this._typeStack.length - 1]; + } + } + + getParentType(): Maybe { + if (this._parentTypeStack.length > 0) { + return this._parentTypeStack[this._parentTypeStack.length - 1]; + } + } + + getInputType(): Maybe { + if (this._inputTypeStack.length > 0) { + return this._inputTypeStack[this._inputTypeStack.length - 1]; + } + } + + getParentInputType(): Maybe { + if (this._inputTypeStack.length > 1) { + return this._inputTypeStack[this._inputTypeStack.length - 2]; + } + } + + getFieldDef(): Maybe> { + if (this._fieldDefStack.length > 0) { + return this._fieldDefStack[this._fieldDefStack.length - 1]; + } + } + + getDefaultValue(): Maybe { + if (this._defaultValueStack.length > 0) { + return this._defaultValueStack[this._defaultValueStack.length - 1]; + } + } + + getDirective(): Maybe { + return this._directive; + } + + getArgument(): Maybe { + return this._argument; + } + + getEnumValue(): Maybe { + return this._enumValue; + } + + enter(node: ASTNode) { + const schema = this._schema; + // Note: many of the types below are explicitly typed as "unknown" to drop + // any assumptions of a valid schema to ensure runtime types are properly + // checked before continuing since TypeInfo is used as part of validation + // which occurs before guarantees of schema and document validity. + switch (node.kind) { + case Kind.SELECTION_SET: { + const namedType: unknown = getNamedType(this.getType()); + this._parentTypeStack.push( + isCompositeType(namedType) ? namedType : undefined, + ); + break; + } + case Kind.FIELD: { + const parentType = this.getParentType(); + let fieldDef; + let fieldType: unknown; + if (parentType) { + fieldDef = this._getFieldDef(schema, parentType, node); + if (fieldDef) { + fieldType = fieldDef.type; + } + } + this._fieldDefStack.push(fieldDef); + this._typeStack.push(isOutputType(fieldType) ? fieldType : undefined); + break; + } + case Kind.DIRECTIVE: + this._directive = schema.getDirective(node.name.value); + break; + case Kind.OPERATION_DEFINITION: { + const rootType = schema.getRootType(node.operation); + this._typeStack.push(isObjectType(rootType) ? rootType : undefined); + break; + } + case Kind.INLINE_FRAGMENT: + case Kind.FRAGMENT_DEFINITION: { + const typeConditionAST = node.typeCondition; + const outputType: unknown = typeConditionAST + ? typeFromAST(schema, typeConditionAST) + : getNamedType(this.getType()); + this._typeStack.push(isOutputType(outputType) ? outputType : undefined); + break; + } + case Kind.VARIABLE_DEFINITION: { + const inputType: unknown = typeFromAST(schema, node.type); + this._inputTypeStack.push( + isInputType(inputType) ? inputType : undefined, + ); + break; + } + case Kind.ARGUMENT: { + let argDef; + let argType: unknown; + const fieldOrDirective = this.getDirective() ?? this.getFieldDef(); + if (fieldOrDirective) { + argDef = fieldOrDirective.args.find( + (arg) => arg.name === node.name.value, + ); + if (argDef) { + argType = argDef.type; + } + } + this._argument = argDef; + this._defaultValueStack.push(argDef ? argDef.defaultValue : undefined); + this._inputTypeStack.push(isInputType(argType) ? argType : undefined); + break; + } + case Kind.LIST: { + const listType: unknown = getNullableType(this.getInputType()); + const itemType: unknown = isListType(listType) + ? listType.ofType + : listType; + // List positions never have a default value. + this._defaultValueStack.push(undefined); + this._inputTypeStack.push(isInputType(itemType) ? itemType : undefined); + break; + } + case Kind.OBJECT_FIELD: { + const objectType: unknown = getNamedType(this.getInputType()); + let inputFieldType: GraphQLInputType | undefined; + let inputField: GraphQLInputField | undefined; + if (isInputObjectType(objectType)) { + inputField = objectType.getFields()[node.name.value]; + if (inputField) { + inputFieldType = inputField.type; + } + } + this._defaultValueStack.push( + inputField ? inputField.defaultValue : undefined, + ); + this._inputTypeStack.push( + isInputType(inputFieldType) ? inputFieldType : undefined, + ); + break; + } + case Kind.ENUM: { + const enumType: unknown = getNamedType(this.getInputType()); + let enumValue; + if (isEnumType(enumType)) { + enumValue = enumType.getValue(node.value); + } + this._enumValue = enumValue; + break; + } + default: + // Ignore other nodes + } + } + + leave(node: ASTNode) { + switch (node.kind) { + case Kind.SELECTION_SET: + this._parentTypeStack.pop(); + break; + case Kind.FIELD: + this._fieldDefStack.pop(); + this._typeStack.pop(); + break; + case Kind.DIRECTIVE: + this._directive = null; + break; + case Kind.OPERATION_DEFINITION: + case Kind.INLINE_FRAGMENT: + case Kind.FRAGMENT_DEFINITION: + this._typeStack.pop(); + break; + case Kind.VARIABLE_DEFINITION: + this._inputTypeStack.pop(); + break; + case Kind.ARGUMENT: + this._argument = null; + this._defaultValueStack.pop(); + this._inputTypeStack.pop(); + break; + case Kind.LIST: + case Kind.OBJECT_FIELD: + this._defaultValueStack.pop(); + this._inputTypeStack.pop(); + break; + case Kind.ENUM: + this._enumValue = null; + break; + default: + // Ignore other nodes + } + } +} + +type GetFieldDefFn = ( + schema: GraphQLSchema, + parentType: GraphQLType, + fieldNode: FieldNode, +) => Maybe>; + +/** + * Not exactly the same as the executor's definition of getFieldDef, in this + * statically evaluated environment we do not always have an Object type, + * and need to handle Interface and Union types. + */ +function getFieldDef( + schema: GraphQLSchema, + parentType: GraphQLType, + fieldNode: FieldNode, +): Maybe> { + const name = fieldNode.name.value; + if ( + name === SchemaMetaFieldDef.name && + schema.getQueryType() === parentType + ) { + return SchemaMetaFieldDef; + } + if (name === TypeMetaFieldDef.name && schema.getQueryType() === parentType) { + return TypeMetaFieldDef; + } + if (name === TypeNameMetaFieldDef.name && isCompositeType(parentType)) { + return TypeNameMetaFieldDef; + } + if (isObjectType(parentType) || isInterfaceType(parentType)) { + return parentType.getFields()[name]; + } +} + +/** + * Creates a new visitor instance which maintains a provided TypeInfo instance + * along with visiting visitor. + */ +export function visitWithTypeInfo( + typeInfo: TypeInfo, + visitor: ASTVisitor, +): ASTVisitor { + return { + enter(...args) { + const node = args[0]; + typeInfo.enter(node); + const fn = getEnterLeaveForKind(visitor, node.kind).enter; + if (fn) { + const result = fn.apply(visitor, args); + if (result !== undefined) { + typeInfo.leave(node); + if (isNode(result)) { + typeInfo.enter(result); + } + } + return result; + } + }, + leave(...args) { + const node = args[0]; + const fn = getEnterLeaveForKind(visitor, node.kind).leave; + let result; + if (fn) { + result = fn.apply(visitor, args); + } + typeInfo.leave(node); + return result; + }, + }; +} diff --git a/src/utilities/__tests__/TypeInfo-test.ts b/src/utilities/__tests__/TypeInfo-test.ts new file mode 100644 index 00000000..5c04458c --- /dev/null +++ b/src/utilities/__tests__/TypeInfo-test.ts @@ -0,0 +1,460 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { invariant } from '../../jsutils/invariant'; + +import { parse, parseValue } from '../../language/parser'; +import { print } from '../../language/printer'; +import { visit } from '../../language/visitor'; + +import { getNamedType, isCompositeType } from '../../type/definition'; +import { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../buildASTSchema'; +import { TypeInfo, visitWithTypeInfo } from '../TypeInfo'; + +const testSchema = buildSchema(` + interface Pet { + name: String + } + + type Dog implements Pet { + name: String + } + + type Cat implements Pet { + name: String + } + + type Human { + name: String + pets: [Pet] + } + + type Alien { + name(surname: Boolean): String + } + + type QueryRoot { + human(id: ID): Human + alien: Alien + } + + schema { + query: QueryRoot + } +`); + +describe('TypeInfo', () => { + const schema = new GraphQLSchema({}); + + it('can be Object.toStringified', () => { + const typeInfo = new TypeInfo(schema); + + expect(Object.prototype.toString.call(typeInfo)).to.equal( + '[object TypeInfo]', + ); + }); + + it('allow all methods to be called before entering any node', () => { + const typeInfo = new TypeInfo(schema); + + expect(typeInfo.getType()).to.equal(undefined); + expect(typeInfo.getParentType()).to.equal(undefined); + expect(typeInfo.getInputType()).to.equal(undefined); + expect(typeInfo.getParentInputType()).to.equal(undefined); + expect(typeInfo.getFieldDef()).to.equal(undefined); + expect(typeInfo.getDefaultValue()).to.equal(undefined); + expect(typeInfo.getDirective()).to.equal(null); + expect(typeInfo.getArgument()).to.equal(null); + expect(typeInfo.getEnumValue()).to.equal(null); + }); +}); + +describe('visitWithTypeInfo', () => { + it('supports different operation types', () => { + const schema = buildSchema(` + schema { + query: QueryRoot + mutation: MutationRoot + subscription: SubscriptionRoot + } + + type QueryRoot { + foo: String + } + + type MutationRoot { + bar: String + } + + type SubscriptionRoot { + baz: String + } + `); + const ast = parse(` + query { foo } + mutation { bar } + subscription { baz } + `); + const typeInfo = new TypeInfo(schema); + + const rootTypes: any = {}; + visit( + ast, + visitWithTypeInfo(typeInfo, { + OperationDefinition(node) { + rootTypes[node.operation] = String(typeInfo.getType()); + }, + }), + ); + + expect(rootTypes).to.deep.equal({ + query: 'QueryRoot', + mutation: 'MutationRoot', + subscription: 'SubscriptionRoot', + }); + }); + + it('provide exact same arguments to wrapped visitor', () => { + const ast = parse( + '{ human(id: 4) { name, pets { ... { name } }, unknown } }', + ); + + const visitorArgs: Array = []; + visit(ast, { + enter(...args) { + visitorArgs.push(['enter', ...args]); + }, + leave(...args) { + visitorArgs.push(['leave', ...args]); + }, + }); + + const wrappedVisitorArgs: Array = []; + const typeInfo = new TypeInfo(testSchema); + visit( + ast, + visitWithTypeInfo(typeInfo, { + enter(...args) { + wrappedVisitorArgs.push(['enter', ...args]); + }, + leave(...args) { + wrappedVisitorArgs.push(['leave', ...args]); + }, + }), + ); + + expect(visitorArgs).to.deep.equal(wrappedVisitorArgs); + }); + + it('maintains type info during visit', () => { + const visited: Array = []; + + const typeInfo = new TypeInfo(testSchema); + + const ast = parse( + '{ human(id: 4) { name, pets { ... { name } }, unknown } }', + ); + + visit( + ast, + visitWithTypeInfo(typeInfo, { + enter(node) { + const parentType = typeInfo.getParentType(); + const type = typeInfo.getType(); + const inputType = typeInfo.getInputType(); + visited.push([ + 'enter', + node.kind, + node.kind === 'Name' ? node.value : null, + parentType ? String(parentType) : null, + type ? String(type) : null, + inputType ? String(inputType) : null, + ]); + }, + leave(node) { + const parentType = typeInfo.getParentType(); + const type = typeInfo.getType(); + const inputType = typeInfo.getInputType(); + visited.push([ + 'leave', + node.kind, + node.kind === 'Name' ? node.value : null, + parentType ? String(parentType) : null, + type ? String(type) : null, + inputType ? String(inputType) : null, + ]); + }, + }), + ); + + expect(visited).to.deep.equal([ + ['enter', 'Document', null, null, null, null], + ['enter', 'OperationDefinition', null, null, 'QueryRoot', null], + ['enter', 'SelectionSet', null, 'QueryRoot', 'QueryRoot', null], + ['enter', 'Field', null, 'QueryRoot', 'Human', null], + ['enter', 'Name', 'human', 'QueryRoot', 'Human', null], + ['leave', 'Name', 'human', 'QueryRoot', 'Human', null], + ['enter', 'Argument', null, 'QueryRoot', 'Human', 'ID'], + ['enter', 'Name', 'id', 'QueryRoot', 'Human', 'ID'], + ['leave', 'Name', 'id', 'QueryRoot', 'Human', 'ID'], + ['enter', 'IntValue', null, 'QueryRoot', 'Human', 'ID'], + ['leave', 'IntValue', null, 'QueryRoot', 'Human', 'ID'], + ['leave', 'Argument', null, 'QueryRoot', 'Human', 'ID'], + ['enter', 'SelectionSet', null, 'Human', 'Human', null], + ['enter', 'Field', null, 'Human', 'String', null], + ['enter', 'Name', 'name', 'Human', 'String', null], + ['leave', 'Name', 'name', 'Human', 'String', null], + ['leave', 'Field', null, 'Human', 'String', null], + ['enter', 'Field', null, 'Human', '[Pet]', null], + ['enter', 'Name', 'pets', 'Human', '[Pet]', null], + ['leave', 'Name', 'pets', 'Human', '[Pet]', null], + ['enter', 'SelectionSet', null, 'Pet', '[Pet]', null], + ['enter', 'InlineFragment', null, 'Pet', 'Pet', null], + ['enter', 'SelectionSet', null, 'Pet', 'Pet', null], + ['enter', 'Field', null, 'Pet', 'String', null], + ['enter', 'Name', 'name', 'Pet', 'String', null], + ['leave', 'Name', 'name', 'Pet', 'String', null], + ['leave', 'Field', null, 'Pet', 'String', null], + ['leave', 'SelectionSet', null, 'Pet', 'Pet', null], + ['leave', 'InlineFragment', null, 'Pet', 'Pet', null], + ['leave', 'SelectionSet', null, 'Pet', '[Pet]', null], + ['leave', 'Field', null, 'Human', '[Pet]', null], + ['enter', 'Field', null, 'Human', null, null], + ['enter', 'Name', 'unknown', 'Human', null, null], + ['leave', 'Name', 'unknown', 'Human', null, null], + ['leave', 'Field', null, 'Human', null, null], + ['leave', 'SelectionSet', null, 'Human', 'Human', null], + ['leave', 'Field', null, 'QueryRoot', 'Human', null], + ['leave', 'SelectionSet', null, 'QueryRoot', 'QueryRoot', null], + ['leave', 'OperationDefinition', null, null, 'QueryRoot', null], + ['leave', 'Document', null, null, null, null], + ]); + }); + + it('maintains type info during edit', () => { + const visited: Array = []; + const typeInfo = new TypeInfo(testSchema); + + const ast = parse('{ human(id: 4) { name, pets }, alien }'); + const editedAST = visit( + ast, + visitWithTypeInfo(typeInfo, { + enter(node) { + const parentType = typeInfo.getParentType(); + const type = typeInfo.getType(); + const inputType = typeInfo.getInputType(); + visited.push([ + 'enter', + node.kind, + node.kind === 'Name' ? node.value : null, + parentType ? String(parentType) : null, + type ? String(type) : null, + inputType ? String(inputType) : null, + ]); + + // Make a query valid by adding missing selection sets. + if ( + node.kind === 'Field' && + !node.selectionSet && + isCompositeType(getNamedType(type)) + ) { + return { + ...node, + selectionSet: { + kind: 'SelectionSet', + selections: [ + { + kind: 'Field', + name: { kind: 'Name', value: '__typename' }, + }, + ], + }, + }; + } + }, + leave(node) { + const parentType = typeInfo.getParentType(); + const type = typeInfo.getType(); + const inputType = typeInfo.getInputType(); + visited.push([ + 'leave', + node.kind, + node.kind === 'Name' ? node.value : null, + parentType ? String(parentType) : null, + type ? String(type) : null, + inputType ? String(inputType) : null, + ]); + }, + }), + ); + + expect(print(ast)).to.deep.equal( + print(parse('{ human(id: 4) { name, pets }, alien }')), + ); + + expect(print(editedAST)).to.deep.equal( + print( + parse( + '{ human(id: 4) { name, pets { __typename } }, alien { __typename } }', + ), + ), + ); + + expect(visited).to.deep.equal([ + ['enter', 'Document', null, null, null, null], + ['enter', 'OperationDefinition', null, null, 'QueryRoot', null], + ['enter', 'SelectionSet', null, 'QueryRoot', 'QueryRoot', null], + ['enter', 'Field', null, 'QueryRoot', 'Human', null], + ['enter', 'Name', 'human', 'QueryRoot', 'Human', null], + ['leave', 'Name', 'human', 'QueryRoot', 'Human', null], + ['enter', 'Argument', null, 'QueryRoot', 'Human', 'ID'], + ['enter', 'Name', 'id', 'QueryRoot', 'Human', 'ID'], + ['leave', 'Name', 'id', 'QueryRoot', 'Human', 'ID'], + ['enter', 'IntValue', null, 'QueryRoot', 'Human', 'ID'], + ['leave', 'IntValue', null, 'QueryRoot', 'Human', 'ID'], + ['leave', 'Argument', null, 'QueryRoot', 'Human', 'ID'], + ['enter', 'SelectionSet', null, 'Human', 'Human', null], + ['enter', 'Field', null, 'Human', 'String', null], + ['enter', 'Name', 'name', 'Human', 'String', null], + ['leave', 'Name', 'name', 'Human', 'String', null], + ['leave', 'Field', null, 'Human', 'String', null], + ['enter', 'Field', null, 'Human', '[Pet]', null], + ['enter', 'Name', 'pets', 'Human', '[Pet]', null], + ['leave', 'Name', 'pets', 'Human', '[Pet]', null], + ['enter', 'SelectionSet', null, 'Pet', '[Pet]', null], + ['enter', 'Field', null, 'Pet', 'String!', null], + ['enter', 'Name', '__typename', 'Pet', 'String!', null], + ['leave', 'Name', '__typename', 'Pet', 'String!', null], + ['leave', 'Field', null, 'Pet', 'String!', null], + ['leave', 'SelectionSet', null, 'Pet', '[Pet]', null], + ['leave', 'Field', null, 'Human', '[Pet]', null], + ['leave', 'SelectionSet', null, 'Human', 'Human', null], + ['leave', 'Field', null, 'QueryRoot', 'Human', null], + ['enter', 'Field', null, 'QueryRoot', 'Alien', null], + ['enter', 'Name', 'alien', 'QueryRoot', 'Alien', null], + ['leave', 'Name', 'alien', 'QueryRoot', 'Alien', null], + ['enter', 'SelectionSet', null, 'Alien', 'Alien', null], + ['enter', 'Field', null, 'Alien', 'String!', null], + ['enter', 'Name', '__typename', 'Alien', 'String!', null], + ['leave', 'Name', '__typename', 'Alien', 'String!', null], + ['leave', 'Field', null, 'Alien', 'String!', null], + ['leave', 'SelectionSet', null, 'Alien', 'Alien', null], + ['leave', 'Field', null, 'QueryRoot', 'Alien', null], + ['leave', 'SelectionSet', null, 'QueryRoot', 'QueryRoot', null], + ['leave', 'OperationDefinition', null, null, 'QueryRoot', null], + ['leave', 'Document', null, null, null, null], + ]); + }); + + it('supports traversals of input values', () => { + const schema = buildSchema(` + input ComplexInput { + stringListField: [String] + } + `); + const ast = parseValue('{ stringListField: ["foo"] }'); + const complexInputType = schema.getType('ComplexInput'); + invariant(complexInputType != null); + + const typeInfo = new TypeInfo(schema, complexInputType); + + const visited: Array = []; + visit( + ast, + visitWithTypeInfo(typeInfo, { + enter(node) { + const type = typeInfo.getInputType(); + visited.push([ + 'enter', + node.kind, + node.kind === 'Name' ? node.value : null, + String(type), + ]); + }, + leave(node) { + const type = typeInfo.getInputType(); + visited.push([ + 'leave', + node.kind, + node.kind === 'Name' ? node.value : null, + String(type), + ]); + }, + }), + ); + + expect(visited).to.deep.equal([ + ['enter', 'ObjectValue', null, 'ComplexInput'], + ['enter', 'ObjectField', null, '[String]'], + ['enter', 'Name', 'stringListField', '[String]'], + ['leave', 'Name', 'stringListField', '[String]'], + ['enter', 'ListValue', null, 'String'], + ['enter', 'StringValue', null, 'String'], + ['leave', 'StringValue', null, 'String'], + ['leave', 'ListValue', null, 'String'], + ['leave', 'ObjectField', null, '[String]'], + ['leave', 'ObjectValue', null, 'ComplexInput'], + ]); + }); + + it('supports traversals of selection sets', () => { + const humanType = testSchema.getType('Human'); + invariant(humanType != null); + + const typeInfo = new TypeInfo(testSchema, humanType); + + const ast = parse('{ name, pets { name } }'); + const operationNode = ast.definitions[0]; + invariant(operationNode.kind === 'OperationDefinition'); + + const visited: Array = []; + visit( + operationNode.selectionSet, + visitWithTypeInfo(typeInfo, { + enter(node) { + const parentType = typeInfo.getParentType(); + const type = typeInfo.getType(); + visited.push([ + 'enter', + node.kind, + node.kind === 'Name' ? node.value : null, + String(parentType), + String(type), + ]); + }, + leave(node) { + const parentType = typeInfo.getParentType(); + const type = typeInfo.getType(); + visited.push([ + 'leave', + node.kind, + node.kind === 'Name' ? node.value : null, + String(parentType), + String(type), + ]); + }, + }), + ); + + expect(visited).to.deep.equal([ + ['enter', 'SelectionSet', null, 'Human', 'Human'], + ['enter', 'Field', null, 'Human', 'String'], + ['enter', 'Name', 'name', 'Human', 'String'], + ['leave', 'Name', 'name', 'Human', 'String'], + ['leave', 'Field', null, 'Human', 'String'], + ['enter', 'Field', null, 'Human', '[Pet]'], + ['enter', 'Name', 'pets', 'Human', '[Pet]'], + ['leave', 'Name', 'pets', 'Human', '[Pet]'], + ['enter', 'SelectionSet', null, 'Pet', '[Pet]'], + ['enter', 'Field', null, 'Pet', 'String'], + ['enter', 'Name', 'name', 'Pet', 'String'], + ['leave', 'Name', 'name', 'Pet', 'String'], + ['leave', 'Field', null, 'Pet', 'String'], + ['leave', 'SelectionSet', null, 'Pet', '[Pet]'], + ['leave', 'Field', null, 'Human', '[Pet]'], + ['leave', 'SelectionSet', null, 'Human', 'Human'], + ]); + }); +}); diff --git a/src/utilities/__tests__/astFromValue-test.ts b/src/utilities/__tests__/astFromValue-test.ts new file mode 100644 index 00000000..b8f2361b --- /dev/null +++ b/src/utilities/__tests__/astFromValue-test.ts @@ -0,0 +1,379 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, + GraphQLScalarType, +} from '../../type/definition'; +import { + GraphQLBoolean, + GraphQLFloat, + GraphQLID, + GraphQLInt, + GraphQLString, +} from '../../type/scalars'; + +import { astFromValue } from '../astFromValue'; + +describe('astFromValue', () => { + it('converts boolean values to ASTs', () => { + expect(astFromValue(true, GraphQLBoolean)).to.deep.equal({ + kind: 'BooleanValue', + value: true, + }); + + expect(astFromValue(false, GraphQLBoolean)).to.deep.equal({ + kind: 'BooleanValue', + value: false, + }); + + expect(astFromValue(undefined, GraphQLBoolean)).to.deep.equal(null); + + expect(astFromValue(null, GraphQLBoolean)).to.deep.equal({ + kind: 'NullValue', + }); + + expect(astFromValue(0, GraphQLBoolean)).to.deep.equal({ + kind: 'BooleanValue', + value: false, + }); + + expect(astFromValue(1, GraphQLBoolean)).to.deep.equal({ + kind: 'BooleanValue', + value: true, + }); + + const NonNullBoolean = new GraphQLNonNull(GraphQLBoolean); + expect(astFromValue(0, NonNullBoolean)).to.deep.equal({ + kind: 'BooleanValue', + value: false, + }); + }); + + it('converts Int values to Int ASTs', () => { + expect(astFromValue(-1, GraphQLInt)).to.deep.equal({ + kind: 'IntValue', + value: '-1', + }); + + expect(astFromValue(123.0, GraphQLInt)).to.deep.equal({ + kind: 'IntValue', + value: '123', + }); + + expect(astFromValue(1e4, GraphQLInt)).to.deep.equal({ + kind: 'IntValue', + value: '10000', + }); + + // GraphQL spec does not allow coercing non-integer values to Int to avoid + // accidental data loss. + expect(() => astFromValue(123.5, GraphQLInt)).to.throw( + 'Int cannot represent non-integer value: 123.5', + ); + + // Note: outside the bounds of 32bit signed int. + expect(() => astFromValue(1e40, GraphQLInt)).to.throw( + 'Int cannot represent non 32-bit signed integer value: 1e+40', + ); + + expect(() => astFromValue(NaN, GraphQLInt)).to.throw( + 'Int cannot represent non-integer value: NaN', + ); + }); + + it('converts Float values to Int/Float ASTs', () => { + expect(astFromValue(-1, GraphQLFloat)).to.deep.equal({ + kind: 'IntValue', + value: '-1', + }); + + expect(astFromValue(123.0, GraphQLFloat)).to.deep.equal({ + kind: 'IntValue', + value: '123', + }); + + expect(astFromValue(123.5, GraphQLFloat)).to.deep.equal({ + kind: 'FloatValue', + value: '123.5', + }); + + expect(astFromValue(1e4, GraphQLFloat)).to.deep.equal({ + kind: 'IntValue', + value: '10000', + }); + + expect(astFromValue(1e40, GraphQLFloat)).to.deep.equal({ + kind: 'FloatValue', + value: '1e+40', + }); + }); + + it('converts String values to String ASTs', () => { + expect(astFromValue('hello', GraphQLString)).to.deep.equal({ + kind: 'StringValue', + value: 'hello', + }); + + expect(astFromValue('VALUE', GraphQLString)).to.deep.equal({ + kind: 'StringValue', + value: 'VALUE', + }); + + expect(astFromValue('VA\nLUE', GraphQLString)).to.deep.equal({ + kind: 'StringValue', + value: 'VA\nLUE', + }); + + expect(astFromValue(123, GraphQLString)).to.deep.equal({ + kind: 'StringValue', + value: '123', + }); + + expect(astFromValue(false, GraphQLString)).to.deep.equal({ + kind: 'StringValue', + value: 'false', + }); + + expect(astFromValue(null, GraphQLString)).to.deep.equal({ + kind: 'NullValue', + }); + + expect(astFromValue(undefined, GraphQLString)).to.deep.equal(null); + }); + + it('converts ID values to Int/String ASTs', () => { + expect(astFromValue('hello', GraphQLID)).to.deep.equal({ + kind: 'StringValue', + value: 'hello', + }); + + expect(astFromValue('VALUE', GraphQLID)).to.deep.equal({ + kind: 'StringValue', + value: 'VALUE', + }); + + // Note: EnumValues cannot contain non-identifier characters + expect(astFromValue('VA\nLUE', GraphQLID)).to.deep.equal({ + kind: 'StringValue', + value: 'VA\nLUE', + }); + + // Note: IntValues are used when possible. + expect(astFromValue(-1, GraphQLID)).to.deep.equal({ + kind: 'IntValue', + value: '-1', + }); + + expect(astFromValue(123, GraphQLID)).to.deep.equal({ + kind: 'IntValue', + value: '123', + }); + + expect(astFromValue('123', GraphQLID)).to.deep.equal({ + kind: 'IntValue', + value: '123', + }); + + expect(astFromValue('01', GraphQLID)).to.deep.equal({ + kind: 'StringValue', + value: '01', + }); + + expect(() => astFromValue(false, GraphQLID)).to.throw( + 'ID cannot represent value: false', + ); + + expect(astFromValue(null, GraphQLID)).to.deep.equal({ kind: 'NullValue' }); + + expect(astFromValue(undefined, GraphQLID)).to.deep.equal(null); + }); + + it('converts using serialize from a custom scalar type', () => { + const passthroughScalar = new GraphQLScalarType({ + name: 'PassthroughScalar', + serialize(value) { + return value; + }, + }); + + expect(astFromValue('value', passthroughScalar)).to.deep.equal({ + kind: 'StringValue', + value: 'value', + }); + + expect(() => astFromValue(NaN, passthroughScalar)).to.throw( + 'Cannot convert value to AST: NaN.', + ); + expect(() => astFromValue(Infinity, passthroughScalar)).to.throw( + 'Cannot convert value to AST: Infinity.', + ); + + const returnNullScalar = new GraphQLScalarType({ + name: 'ReturnNullScalar', + serialize() { + return null; + }, + }); + + expect(astFromValue('value', returnNullScalar)).to.equal(null); + + class SomeClass {} + + const returnCustomClassScalar = new GraphQLScalarType({ + name: 'ReturnCustomClassScalar', + serialize() { + return new SomeClass(); + }, + }); + + expect(() => astFromValue('value', returnCustomClassScalar)).to.throw( + 'Cannot convert value to AST: {}.', + ); + }); + + it('does not converts NonNull values to NullValue', () => { + const NonNullBoolean = new GraphQLNonNull(GraphQLBoolean); + expect(astFromValue(null, NonNullBoolean)).to.deep.equal(null); + }); + + const complexValue = { someArbitrary: 'complexValue' }; + + const myEnum = new GraphQLEnumType({ + name: 'MyEnum', + values: { + HELLO: {}, + GOODBYE: {}, + COMPLEX: { value: complexValue }, + }, + }); + + it('converts string values to Enum ASTs if possible', () => { + expect(astFromValue('HELLO', myEnum)).to.deep.equal({ + kind: 'EnumValue', + value: 'HELLO', + }); + + expect(astFromValue(complexValue, myEnum)).to.deep.equal({ + kind: 'EnumValue', + value: 'COMPLEX', + }); + + // Note: case sensitive + expect(() => astFromValue('hello', myEnum)).to.throw( + 'Enum "MyEnum" cannot represent value: "hello"', + ); + + // Note: Not a valid enum value + expect(() => astFromValue('UNKNOWN_VALUE', myEnum)).to.throw( + 'Enum "MyEnum" cannot represent value: "UNKNOWN_VALUE"', + ); + }); + + it('converts array values to List ASTs', () => { + expect( + astFromValue(['FOO', 'BAR'], new GraphQLList(GraphQLString)), + ).to.deep.equal({ + kind: 'ListValue', + values: [ + { kind: 'StringValue', value: 'FOO' }, + { kind: 'StringValue', value: 'BAR' }, + ], + }); + + expect( + astFromValue(['HELLO', 'GOODBYE'], new GraphQLList(myEnum)), + ).to.deep.equal({ + kind: 'ListValue', + values: [ + { kind: 'EnumValue', value: 'HELLO' }, + { kind: 'EnumValue', value: 'GOODBYE' }, + ], + }); + + function* listGenerator() { + yield 1; + yield 2; + yield 3; + } + + expect( + astFromValue(listGenerator(), new GraphQLList(GraphQLInt)), + ).to.deep.equal({ + kind: 'ListValue', + values: [ + { kind: 'IntValue', value: '1' }, + { kind: 'IntValue', value: '2' }, + { kind: 'IntValue', value: '3' }, + ], + }); + }); + + it('converts list singletons', () => { + expect(astFromValue('FOO', new GraphQLList(GraphQLString))).to.deep.equal({ + kind: 'StringValue', + value: 'FOO', + }); + }); + + it('skip invalid list items', () => { + const ast = astFromValue( + ['FOO', null, 'BAR'], + new GraphQLList(new GraphQLNonNull(GraphQLString)), + ); + + expect(ast).to.deep.equal({ + kind: 'ListValue', + values: [ + { kind: 'StringValue', value: 'FOO' }, + { kind: 'StringValue', value: 'BAR' }, + ], + }); + }); + + const inputObj = new GraphQLInputObjectType({ + name: 'MyInputObj', + fields: { + foo: { type: GraphQLFloat }, + bar: { type: myEnum }, + }, + }); + + it('converts input objects', () => { + expect(astFromValue({ foo: 3, bar: 'HELLO' }, inputObj)).to.deep.equal({ + kind: 'ObjectValue', + fields: [ + { + kind: 'ObjectField', + name: { kind: 'Name', value: 'foo' }, + value: { kind: 'IntValue', value: '3' }, + }, + { + kind: 'ObjectField', + name: { kind: 'Name', value: 'bar' }, + value: { kind: 'EnumValue', value: 'HELLO' }, + }, + ], + }); + }); + + it('converts input objects with explicit nulls', () => { + expect(astFromValue({ foo: null }, inputObj)).to.deep.equal({ + kind: 'ObjectValue', + fields: [ + { + kind: 'ObjectField', + name: { kind: 'Name', value: 'foo' }, + value: { kind: 'NullValue' }, + }, + ], + }); + }); + + it('does not converts non-object values as input objects', () => { + expect(astFromValue(5, inputObj)).to.equal(null); + }); +}); diff --git a/src/utilities/__tests__/buildASTSchema-test.ts b/src/utilities/__tests__/buildASTSchema-test.ts new file mode 100644 index 00000000..7427ebb5 --- /dev/null +++ b/src/utilities/__tests__/buildASTSchema-test.ts @@ -0,0 +1,1108 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; + +import { invariant } from '../../jsutils/invariant'; +import type { Maybe } from '../../jsutils/Maybe'; + +import type { ASTNode } from '../../language/ast'; +import { Kind } from '../../language/kinds'; +import { parse } from '../../language/parser'; +import { print } from '../../language/printer'; + +import { + assertEnumType, + assertInputObjectType, + assertInterfaceType, + assertObjectType, + assertScalarType, + assertUnionType, +} from '../../type/definition'; +import { + assertDirective, + GraphQLDeprecatedDirective, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLSpecifiedByDirective, +} from '../../type/directives'; +import { __EnumValue, __Schema } from '../../type/introspection'; +import { + GraphQLBoolean, + GraphQLFloat, + GraphQLID, + GraphQLInt, + GraphQLString, +} from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; +import { validateSchema } from '../../type/validate'; + +import { graphqlSync } from '../../graphql'; + +import { buildASTSchema, buildSchema } from '../buildASTSchema'; +import { printSchema, printType } from '../printSchema'; + +/** + * This function does a full cycle of going from a string with the contents of + * the SDL, parsed in a schema AST, materializing that schema AST into an + * in-memory GraphQLSchema, and then finally printing that object into the SDL + */ +function cycleSDL(sdl: string): string { + return printSchema(buildSchema(sdl)); +} + +function expectASTNode(obj: Maybe<{ readonly astNode: Maybe }>) { + invariant(obj?.astNode != null); + return expect(print(obj.astNode)); +} + +function expectExtensionASTNodes(obj: { + readonly extensionASTNodes: ReadonlyArray; +}) { + return expect(obj.extensionASTNodes.map(print).join('\n\n')); +} + +describe('Schema Builder', () => { + it('can use built schema for limited execution', () => { + const schema = buildASTSchema( + parse(` + type Query { + str: String + } + `), + ); + + const result = graphqlSync({ + schema, + source: '{ str }', + rootValue: { str: 123 }, + }); + expect(result.data).to.deep.equal({ str: '123' }); + }); + + it('can build a schema directly from the source', () => { + const schema = buildSchema(` + type Query { + add(x: Int, y: Int): Int + } + `); + + const source = '{ add(x: 34, y: 55) }'; + const rootValue = { + add: ({ x, y }: { x: number; y: number }) => x + y, + }; + expect(graphqlSync({ schema, source, rootValue })).to.deep.equal({ + data: { add: 89 }, + }); + }); + + it('Ignores non-type system definitions', () => { + const sdl = ` + type Query { + str: String + } + + fragment SomeFragment on Query { + str + } + `; + expect(() => buildSchema(sdl)).to.not.throw(); + }); + + it('Match order of default types and directives', () => { + const schema = new GraphQLSchema({}); + const sdlSchema = buildASTSchema({ + kind: Kind.DOCUMENT, + definitions: [], + }); + + expect(sdlSchema.getDirectives()).to.deep.equal(schema.getDirectives()); + + expect(sdlSchema.getTypeMap()).to.deep.equal(schema.getTypeMap()); + expect(Object.keys(sdlSchema.getTypeMap())).to.deep.equal( + Object.keys(schema.getTypeMap()), + ); + }); + + it('Empty type', () => { + const sdl = dedent` + type EmptyType + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Simple type', () => { + const sdl = dedent` + type Query { + str: String + int: Int + float: Float + id: ID + bool: Boolean + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + + const schema = buildSchema(sdl); + // Built-ins are used + expect(schema.getType('Int')).to.equal(GraphQLInt); + expect(schema.getType('Float')).to.equal(GraphQLFloat); + expect(schema.getType('String')).to.equal(GraphQLString); + expect(schema.getType('Boolean')).to.equal(GraphQLBoolean); + expect(schema.getType('ID')).to.equal(GraphQLID); + }); + + it('include standard type only if it is used', () => { + const schema = buildSchema('type Query'); + + // String and Boolean are always included through introspection types + expect(schema.getType('Int')).to.equal(undefined); + expect(schema.getType('Float')).to.equal(undefined); + expect(schema.getType('ID')).to.equal(undefined); + }); + + it('With directives', () => { + const sdl = dedent` + directive @foo(arg: Int) on FIELD + + directive @repeatableFoo(arg: Int) repeatable on FIELD + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Supports descriptions', () => { + const sdl = dedent` + """Do you agree that this is the most creative schema ever?""" + schema { + query: Query + } + + """This is a directive""" + directive @foo( + """It has an argument""" + arg: Int + ) on FIELD + + """Who knows what inside this scalar?""" + scalar MysteryScalar + + """This is a input object type""" + input FooInput { + """It has a field""" + field: Int + } + + """This is a interface type""" + interface Energy { + """It also has a field""" + str: String + } + + """There is nothing inside!""" + union BlackHole + + """With an enum""" + enum Color { + RED + + """Not a creative color""" + GREEN + BLUE + } + + """What a great type""" + type Query { + """And a field to boot""" + str: String + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Maintains @include, @skip & @specifiedBy', () => { + const schema = buildSchema('type Query'); + + expect(schema.getDirectives()).to.have.lengthOf(4); + expect(schema.getDirective('skip')).to.equal(GraphQLSkipDirective); + expect(schema.getDirective('include')).to.equal(GraphQLIncludeDirective); + expect(schema.getDirective('deprecated')).to.equal( + GraphQLDeprecatedDirective, + ); + expect(schema.getDirective('specifiedBy')).to.equal( + GraphQLSpecifiedByDirective, + ); + }); + + it('Overriding directives excludes specified', () => { + const schema = buildSchema(` + directive @skip on FIELD + directive @include on FIELD + directive @deprecated on FIELD_DEFINITION + directive @specifiedBy on FIELD_DEFINITION + `); + + expect(schema.getDirectives()).to.have.lengthOf(4); + expect(schema.getDirective('skip')).to.not.equal(GraphQLSkipDirective); + expect(schema.getDirective('include')).to.not.equal( + GraphQLIncludeDirective, + ); + expect(schema.getDirective('deprecated')).to.not.equal( + GraphQLDeprecatedDirective, + ); + expect(schema.getDirective('specifiedBy')).to.not.equal( + GraphQLSpecifiedByDirective, + ); + }); + + it('Adding directives maintains @include, @skip & @specifiedBy', () => { + const schema = buildSchema(` + directive @foo(arg: Int) on FIELD + `); + + expect(schema.getDirectives()).to.have.lengthOf(5); + expect(schema.getDirective('skip')).to.not.equal(undefined); + expect(schema.getDirective('include')).to.not.equal(undefined); + expect(schema.getDirective('deprecated')).to.not.equal(undefined); + expect(schema.getDirective('specifiedBy')).to.not.equal(undefined); + }); + + it('Type modifiers', () => { + const sdl = dedent` + type Query { + nonNullStr: String! + listOfStrings: [String] + listOfNonNullStrings: [String!] + nonNullListOfStrings: [String]! + nonNullListOfNonNullStrings: [String!]! + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Recursive type', () => { + const sdl = dedent` + type Query { + str: String + recurse: Query + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Two types circular', () => { + const sdl = dedent` + type TypeOne { + str: String + typeTwo: TypeTwo + } + + type TypeTwo { + str: String + typeOne: TypeOne + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Single argument field', () => { + const sdl = dedent` + type Query { + str(int: Int): String + floatToStr(float: Float): String + idToStr(id: ID): String + booleanToStr(bool: Boolean): String + strToStr(bool: String): String + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Simple type with multiple arguments', () => { + const sdl = dedent` + type Query { + str(int: Int, bool: Boolean): String + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Empty interface', () => { + const sdl = dedent` + interface EmptyInterface + `; + + const definition = parse(sdl).definitions[0]; + expect( + definition.kind === 'InterfaceTypeDefinition' && definition.interfaces, + ).to.deep.equal([], 'The interfaces property must be an empty array.'); + + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Simple type with interface', () => { + const sdl = dedent` + type Query implements WorldInterface { + str: String + } + + interface WorldInterface { + str: String + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Simple interface hierarchy', () => { + const sdl = dedent` + schema { + query: Child + } + + interface Child implements Parent { + str: String + } + + type Hello implements Parent & Child { + str: String + } + + interface Parent { + str: String + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Empty enum', () => { + const sdl = dedent` + enum EmptyEnum + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Simple output enum', () => { + const sdl = dedent` + enum Hello { + WORLD + } + + type Query { + hello: Hello + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Simple input enum', () => { + const sdl = dedent` + enum Hello { + WORLD + } + + type Query { + str(hello: Hello): String + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Multiple value enum', () => { + const sdl = dedent` + enum Hello { + WO + RLD + } + + type Query { + hello: Hello + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Empty union', () => { + const sdl = dedent` + union EmptyUnion + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Simple Union', () => { + const sdl = dedent` + union Hello = World + + type Query { + hello: Hello + } + + type World { + str: String + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Multiple Union', () => { + const sdl = dedent` + union Hello = WorldOne | WorldTwo + + type Query { + hello: Hello + } + + type WorldOne { + str: String + } + + type WorldTwo { + str: String + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Can build recursive Union', () => { + const schema = buildSchema(` + union Hello = Hello + + type Query { + hello: Hello + } + `); + const errors = validateSchema(schema); + expect(errors).to.have.lengthOf.above(0); + }); + + it('Custom Scalar', () => { + const sdl = dedent` + scalar CustomScalar + + type Query { + customScalar: CustomScalar + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Empty Input Object', () => { + const sdl = dedent` + input EmptyInputObject + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Simple Input Object', () => { + const sdl = dedent` + input Input { + int: Int + } + + type Query { + field(in: Input): String + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Simple argument field with default', () => { + const sdl = dedent` + type Query { + str(int: Int = 2): String + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Custom scalar argument field with default', () => { + const sdl = dedent` + scalar CustomScalar + + type Query { + str(int: CustomScalar = 2): String + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Simple type with mutation', () => { + const sdl = dedent` + schema { + query: HelloScalars + mutation: Mutation + } + + type HelloScalars { + str: String + int: Int + bool: Boolean + } + + type Mutation { + addHelloScalars(str: String, int: Int, bool: Boolean): HelloScalars + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Simple type with subscription', () => { + const sdl = dedent` + schema { + query: HelloScalars + subscription: Subscription + } + + type HelloScalars { + str: String + int: Int + bool: Boolean + } + + type Subscription { + subscribeHelloScalars(str: String, int: Int, bool: Boolean): HelloScalars + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Unreferenced type implementing referenced interface', () => { + const sdl = dedent` + type Concrete implements Interface { + key: String + } + + interface Interface { + key: String + } + + type Query { + interface: Interface + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Unreferenced interface implementing referenced interface', () => { + const sdl = dedent` + interface Child implements Parent { + key: String + } + + interface Parent { + key: String + } + + type Query { + interfaceField: Parent + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Unreferenced type implementing referenced union', () => { + const sdl = dedent` + type Concrete { + key: String + } + + type Query { + union: Union + } + + union Union = Concrete + `; + expect(cycleSDL(sdl)).to.equal(sdl); + }); + + it('Supports @deprecated', () => { + const sdl = dedent` + enum MyEnum { + VALUE + OLD_VALUE @deprecated + OTHER_VALUE @deprecated(reason: "Terrible reasons") + } + + input MyInput { + oldInput: String @deprecated + otherInput: String @deprecated(reason: "Use newInput") + newInput: String + } + + type Query { + field1: String @deprecated + field2: Int @deprecated(reason: "Because I said so") + enum: MyEnum + field3(oldArg: String @deprecated, arg: String): String + field4(oldArg: String @deprecated(reason: "Why not?"), arg: String): String + field5(arg: MyInput): String + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + + const schema = buildSchema(sdl); + + const myEnum = assertEnumType(schema.getType('MyEnum')); + + const value = myEnum.getValue('VALUE'); + expect(value).to.include({ deprecationReason: undefined }); + + const oldValue = myEnum.getValue('OLD_VALUE'); + expect(oldValue).to.include({ + deprecationReason: 'No longer supported', + }); + + const otherValue = myEnum.getValue('OTHER_VALUE'); + expect(otherValue).to.include({ + deprecationReason: 'Terrible reasons', + }); + + const rootFields = assertObjectType(schema.getType('Query')).getFields(); + expect(rootFields.field1).to.include({ + deprecationReason: 'No longer supported', + }); + expect(rootFields.field2).to.include({ + deprecationReason: 'Because I said so', + }); + + const inputFields = assertInputObjectType( + schema.getType('MyInput'), + ).getFields(); + + const newInput = inputFields.newInput; + expect(newInput).to.include({ + deprecationReason: undefined, + }); + + const oldInput = inputFields.oldInput; + expect(oldInput).to.include({ + deprecationReason: 'No longer supported', + }); + + const otherInput = inputFields.otherInput; + expect(otherInput).to.include({ + deprecationReason: 'Use newInput', + }); + + const field3OldArg = rootFields.field3.args[0]; + expect(field3OldArg).to.include({ + deprecationReason: 'No longer supported', + }); + + const field4OldArg = rootFields.field4.args[0]; + expect(field4OldArg).to.include({ + deprecationReason: 'Why not?', + }); + }); + + it('Supports @specifiedBy', () => { + const sdl = dedent` + scalar Foo @specifiedBy(url: "https://example.com/foo_spec") + + type Query { + foo: Foo @deprecated + } + `; + expect(cycleSDL(sdl)).to.equal(sdl); + + const schema = buildSchema(sdl); + + expect(schema.getType('Foo')).to.include({ + specifiedByURL: 'https://example.com/foo_spec', + }); + }); + + it('Correctly extend scalar type', () => { + const schema = buildSchema(` + scalar SomeScalar + extend scalar SomeScalar @foo + extend scalar SomeScalar @bar + + directive @foo on SCALAR + directive @bar on SCALAR + `); + + const someScalar = assertScalarType(schema.getType('SomeScalar')); + expect(printType(someScalar)).to.equal(dedent` + scalar SomeScalar + `); + + expectASTNode(someScalar).to.equal('scalar SomeScalar'); + expectExtensionASTNodes(someScalar).to.equal(dedent` + extend scalar SomeScalar @foo + + extend scalar SomeScalar @bar + `); + }); + + it('Correctly extend object type', () => { + const schema = buildSchema(` + type SomeObject implements Foo { + first: String + } + + extend type SomeObject implements Bar { + second: Int + } + + extend type SomeObject implements Baz { + third: Float + } + + interface Foo + interface Bar + interface Baz + `); + + const someObject = assertObjectType(schema.getType('SomeObject')); + expect(printType(someObject)).to.equal(dedent` + type SomeObject implements Foo & Bar & Baz { + first: String + second: Int + third: Float + } + `); + + expectASTNode(someObject).to.equal(dedent` + type SomeObject implements Foo { + first: String + } + `); + expectExtensionASTNodes(someObject).to.equal(dedent` + extend type SomeObject implements Bar { + second: Int + } + + extend type SomeObject implements Baz { + third: Float + } + `); + }); + + it('Correctly extend interface type', () => { + const schema = buildSchema(dedent` + interface SomeInterface { + first: String + } + + extend interface SomeInterface { + second: Int + } + + extend interface SomeInterface { + third: Float + } + `); + + const someInterface = assertInterfaceType(schema.getType('SomeInterface')); + expect(printType(someInterface)).to.equal(dedent` + interface SomeInterface { + first: String + second: Int + third: Float + } + `); + + expectASTNode(someInterface).to.equal(dedent` + interface SomeInterface { + first: String + } + `); + expectExtensionASTNodes(someInterface).to.equal(dedent` + extend interface SomeInterface { + second: Int + } + + extend interface SomeInterface { + third: Float + } + `); + }); + + it('Correctly extend union type', () => { + const schema = buildSchema(` + union SomeUnion = FirstType + extend union SomeUnion = SecondType + extend union SomeUnion = ThirdType + + type FirstType + type SecondType + type ThirdType + `); + + const someUnion = assertUnionType(schema.getType('SomeUnion')); + expect(printType(someUnion)).to.equal(dedent` + union SomeUnion = FirstType | SecondType | ThirdType + `); + + expectASTNode(someUnion).to.equal('union SomeUnion = FirstType'); + expectExtensionASTNodes(someUnion).to.equal(dedent` + extend union SomeUnion = SecondType + + extend union SomeUnion = ThirdType + `); + }); + + it('Correctly extend enum type', () => { + const schema = buildSchema(dedent` + enum SomeEnum { + FIRST + } + + extend enum SomeEnum { + SECOND + } + + extend enum SomeEnum { + THIRD + } + `); + + const someEnum = assertEnumType(schema.getType('SomeEnum')); + expect(printType(someEnum)).to.equal(dedent` + enum SomeEnum { + FIRST + SECOND + THIRD + } + `); + + expectASTNode(someEnum).to.equal(dedent` + enum SomeEnum { + FIRST + } + `); + expectExtensionASTNodes(someEnum).to.equal(dedent` + extend enum SomeEnum { + SECOND + } + + extend enum SomeEnum { + THIRD + } + `); + }); + + it('Correctly extend input object type', () => { + const schema = buildSchema(dedent` + input SomeInput { + first: String + } + + extend input SomeInput { + second: Int + } + + extend input SomeInput { + third: Float + } + `); + + const someInput = assertInputObjectType(schema.getType('SomeInput')); + expect(printType(someInput)).to.equal(dedent` + input SomeInput { + first: String + second: Int + third: Float + } + `); + + expectASTNode(someInput).to.equal(dedent` + input SomeInput { + first: String + } + `); + expectExtensionASTNodes(someInput).to.equal(dedent` + extend input SomeInput { + second: Int + } + + extend input SomeInput { + third: Float + } + `); + }); + + it('Correctly assign AST nodes', () => { + const sdl = dedent` + schema { + query: Query + } + + type Query { + testField(testArg: TestInput): TestUnion + } + + input TestInput { + testInputField: TestEnum + } + + enum TestEnum { + TEST_VALUE + } + + union TestUnion = TestType + + interface TestInterface { + interfaceField: String + } + + type TestType implements TestInterface { + interfaceField: String + } + + scalar TestScalar + + directive @test(arg: TestScalar) on FIELD + `; + const ast = parse(sdl, { noLocation: true }); + + const schema = buildASTSchema(ast); + const query = assertObjectType(schema.getType('Query')); + const testInput = assertInputObjectType(schema.getType('TestInput')); + const testEnum = assertEnumType(schema.getType('TestEnum')); + const testUnion = assertUnionType(schema.getType('TestUnion')); + const testInterface = assertInterfaceType(schema.getType('TestInterface')); + const testType = assertObjectType(schema.getType('TestType')); + const testScalar = assertScalarType(schema.getType('TestScalar')); + const testDirective = assertDirective(schema.getDirective('test')); + + expect([ + schema.astNode, + query.astNode, + testInput.astNode, + testEnum.astNode, + testUnion.astNode, + testInterface.astNode, + testType.astNode, + testScalar.astNode, + testDirective.astNode, + ]).to.be.deep.equal(ast.definitions); + + const testField = query.getFields().testField; + expectASTNode(testField).to.equal( + 'testField(testArg: TestInput): TestUnion', + ); + expectASTNode(testField.args[0]).to.equal('testArg: TestInput'); + expectASTNode(testInput.getFields().testInputField).to.equal( + 'testInputField: TestEnum', + ); + + expectASTNode(testEnum.getValue('TEST_VALUE')).to.equal('TEST_VALUE'); + + expectASTNode(testInterface.getFields().interfaceField).to.equal( + 'interfaceField: String', + ); + expectASTNode(testType.getFields().interfaceField).to.equal( + 'interfaceField: String', + ); + expectASTNode(testDirective.args[0]).to.equal('arg: TestScalar'); + }); + + it('Root operation types with custom names', () => { + const schema = buildSchema(` + schema { + query: SomeQuery + mutation: SomeMutation + subscription: SomeSubscription + } + type SomeQuery + type SomeMutation + type SomeSubscription + `); + + expect(schema.getQueryType()).to.include({ name: 'SomeQuery' }); + expect(schema.getMutationType()).to.include({ name: 'SomeMutation' }); + expect(schema.getSubscriptionType()).to.include({ + name: 'SomeSubscription', + }); + }); + + it('Default root operation type names', () => { + const schema = buildSchema(` + type Query + type Mutation + type Subscription + `); + + expect(schema.getQueryType()).to.include({ name: 'Query' }); + expect(schema.getMutationType()).to.include({ name: 'Mutation' }); + expect(schema.getSubscriptionType()).to.include({ name: 'Subscription' }); + }); + + it('can build invalid schema', () => { + // Invalid schema, because it is missing query root type + const schema = buildSchema('type Mutation'); + const errors = validateSchema(schema); + expect(errors).to.have.lengthOf.above(0); + }); + + it('Do not override standard types', () => { + // NOTE: not sure it's desired behavior to just silently ignore override + // attempts so just documenting it here. + + const schema = buildSchema(` + scalar ID + + scalar __Schema + `); + + expect(schema.getType('ID')).to.equal(GraphQLID); + expect(schema.getType('__Schema')).to.equal(__Schema); + }); + + it('Allows to reference introspection types', () => { + const schema = buildSchema(` + type Query { + introspectionField: __EnumValue + } + `); + + const queryType = assertObjectType(schema.getType('Query')); + expect(queryType.getFields()).to.have.nested.property( + 'introspectionField.type', + __EnumValue, + ); + expect(schema.getType('__EnumValue')).to.equal(__EnumValue); + }); + + it('Rejects invalid SDL', () => { + const sdl = ` + type Query { + foo: String @unknown + } + `; + expect(() => buildSchema(sdl)).to.throw('Unknown directive "@unknown".'); + }); + + it('Allows to disable SDL validation', () => { + const sdl = ` + type Query { + foo: String @unknown + } + `; + buildSchema(sdl, { assumeValid: true }); + buildSchema(sdl, { assumeValidSDL: true }); + }); + + it('Throws on unknown types', () => { + const sdl = ` + type Query { + unknown: UnknownType + } + `; + expect(() => buildSchema(sdl, { assumeValidSDL: true })).to.throw( + 'Unknown type: "UnknownType".', + ); + }); + + it('Rejects invalid AST', () => { + // @ts-expect-error (First parameter expected to be DocumentNode) + expect(() => buildASTSchema(null)).to.throw( + 'Must provide valid Document AST', + ); + + // @ts-expect-error + expect(() => buildASTSchema({})).to.throw( + 'Must provide valid Document AST', + ); + }); +}); diff --git a/src/utilities/__tests__/buildClientSchema-test.ts b/src/utilities/__tests__/buildClientSchema-test.ts new file mode 100644 index 00000000..7d178115 --- /dev/null +++ b/src/utilities/__tests__/buildClientSchema-test.ts @@ -0,0 +1,971 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; + +import { invariant } from '../../jsutils/invariant'; + +import { + assertEnumType, + GraphQLEnumType, + GraphQLObjectType, +} from '../../type/definition'; +import { + GraphQLBoolean, + GraphQLFloat, + GraphQLID, + GraphQLInt, + GraphQLString, +} from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { graphqlSync } from '../../graphql'; + +import { buildSchema } from '../buildASTSchema'; +import { buildClientSchema } from '../buildClientSchema'; +import { introspectionFromSchema } from '../introspectionFromSchema'; +import { printSchema } from '../printSchema'; + +/** + * This function does a full cycle of going from a string with the contents of + * the SDL, build in-memory GraphQLSchema from it, produce a client-side + * representation of the schema by using "buildClientSchema" and then + * returns that schema printed as SDL. + */ +function cycleIntrospection(sdlString: string): string { + const serverSchema = buildSchema(sdlString); + const initialIntrospection = introspectionFromSchema(serverSchema); + const clientSchema = buildClientSchema(initialIntrospection); + const secondIntrospection = introspectionFromSchema(clientSchema); + + /** + * If the client then runs the introspection query against the client-side + * schema, it should get a result identical to what was returned by the server + */ + expect(secondIntrospection).to.deep.equal(initialIntrospection); + return printSchema(clientSchema); +} + +describe('Type System: build schema from introspection', () => { + it('builds a simple schema', () => { + const sdl = dedent` + """Simple schema""" + schema { + query: Simple + } + + """This is a simple type""" + type Simple { + """This is a string field""" + string: String + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema without the query type', () => { + const sdl = dedent` + type Query { + foo: String + } + `; + + const schema = buildSchema(sdl); + const introspection = introspectionFromSchema(schema); + + // @ts-expect-error + delete introspection.__schema.queryType; + + const clientSchema = buildClientSchema(introspection); + expect(clientSchema.getQueryType()).to.equal(null); + expect(printSchema(clientSchema)).to.equal(sdl); + }); + + it('builds a simple schema with all operation types', () => { + const sdl = dedent` + schema { + query: QueryType + mutation: MutationType + subscription: SubscriptionType + } + + """This is a simple mutation type""" + type MutationType { + """Set the string field""" + string: String + } + + """This is a simple query type""" + type QueryType { + """This is a string field""" + string: String + } + + """This is a simple subscription type""" + type SubscriptionType { + """This is a string field""" + string: String + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('uses built-in scalars when possible', () => { + const sdl = dedent` + scalar CustomScalar + + type Query { + int: Int + float: Float + string: String + boolean: Boolean + id: ID + custom: CustomScalar + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + + const schema = buildSchema(sdl); + const introspection = introspectionFromSchema(schema); + const clientSchema = buildClientSchema(introspection); + + // Built-ins are used + expect(clientSchema.getType('Int')).to.equal(GraphQLInt); + expect(clientSchema.getType('Float')).to.equal(GraphQLFloat); + expect(clientSchema.getType('String')).to.equal(GraphQLString); + expect(clientSchema.getType('Boolean')).to.equal(GraphQLBoolean); + expect(clientSchema.getType('ID')).to.equal(GraphQLID); + + // Custom are built + const customScalar = schema.getType('CustomScalar'); + expect(clientSchema.getType('CustomScalar')).to.not.equal(customScalar); + }); + + it('includes standard types only if they are used', () => { + const schema = buildSchema(` + type Query { + foo: String + } + `); + const introspection = introspectionFromSchema(schema); + const clientSchema = buildClientSchema(introspection); + + expect(clientSchema.getType('Int')).to.equal(undefined); + expect(clientSchema.getType('Float')).to.equal(undefined); + expect(clientSchema.getType('ID')).to.equal(undefined); + }); + + it('builds a schema with a recursive type reference', () => { + const sdl = dedent` + schema { + query: Recur + } + + type Recur { + recur: Recur + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with a circular type reference', () => { + const sdl = dedent` + type Dog { + bestFriend: Human + } + + type Human { + bestFriend: Dog + } + + type Query { + dog: Dog + human: Human + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with an interface', () => { + const sdl = dedent` + type Dog implements Friendly { + bestFriend: Friendly + } + + interface Friendly { + """The best friend of this friendly thing""" + bestFriend: Friendly + } + + type Human implements Friendly { + bestFriend: Friendly + } + + type Query { + friendly: Friendly + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with an interface hierarchy', () => { + const sdl = dedent` + type Dog implements Friendly & Named { + bestFriend: Friendly + name: String + } + + interface Friendly implements Named { + """The best friend of this friendly thing""" + bestFriend: Friendly + name: String + } + + type Human implements Friendly & Named { + bestFriend: Friendly + name: String + } + + interface Named { + name: String + } + + type Query { + friendly: Friendly + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with an implicit interface', () => { + const sdl = dedent` + type Dog implements Friendly { + bestFriend: Friendly + } + + interface Friendly { + """The best friend of this friendly thing""" + bestFriend: Friendly + } + + type Query { + dog: Dog + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with a union', () => { + const sdl = dedent` + type Dog { + bestFriend: Friendly + } + + union Friendly = Dog | Human + + type Human { + bestFriend: Friendly + } + + type Query { + friendly: Friendly + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with complex field values', () => { + const sdl = dedent` + type Query { + string: String + listOfString: [String] + nonNullString: String! + nonNullListOfString: [String]! + nonNullListOfNonNullString: [String!]! + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with field arguments', () => { + const sdl = dedent` + type Query { + """A field with a single arg""" + one( + """This is an int arg""" + intArg: Int + ): String + + """A field with a two args""" + two( + """This is an list of int arg""" + listArg: [Int] + + """This is a required arg""" + requiredArg: Boolean! + ): String + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with default value on custom scalar field', () => { + const sdl = dedent` + scalar CustomScalar + + type Query { + testField(testArg: CustomScalar = "default"): String + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with an enum', () => { + const foodEnum = new GraphQLEnumType({ + name: 'Food', + description: 'Varieties of food stuffs', + values: { + VEGETABLES: { + description: 'Foods that are vegetables.', + value: 1, + }, + FRUITS: { + value: 2, + }, + OILS: { + value: 3, + deprecationReason: 'Too fatty', + }, + }, + }); + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'EnumFields', + fields: { + food: { + description: 'Repeats the arg you give it', + type: foodEnum, + args: { + kind: { + description: 'what kind of food?', + type: foodEnum, + }, + }, + }, + }, + }), + }); + + const introspection = introspectionFromSchema(schema); + const clientSchema = buildClientSchema(introspection); + + const secondIntrospection = introspectionFromSchema(clientSchema); + expect(secondIntrospection).to.deep.equal(introspection); + + // It's also an Enum type on the client. + const clientFoodEnum = assertEnumType(clientSchema.getType('Food')); + + // Client types do not get server-only values, so `value` mirrors `name`, + // rather than using the integers defined in the "server" schema. + expect(clientFoodEnum.getValues()).to.deep.equal([ + { + name: 'VEGETABLES', + description: 'Foods that are vegetables.', + value: 'VEGETABLES', + deprecationReason: null, + extensions: {}, + astNode: undefined, + }, + { + name: 'FRUITS', + description: null, + value: 'FRUITS', + deprecationReason: null, + extensions: {}, + astNode: undefined, + }, + { + name: 'OILS', + description: null, + value: 'OILS', + deprecationReason: 'Too fatty', + extensions: {}, + astNode: undefined, + }, + ]); + }); + + it('builds a schema with an input object', () => { + const sdl = dedent` + """An input address""" + input Address { + """What street is this address?""" + street: String! + + """The city the address is within?""" + city: String! + + """The country (blank will assume USA).""" + country: String = "USA" + } + + type Query { + """Get a geocode from an address""" + geocode( + """The address to lookup""" + address: Address + ): String + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with field arguments with default values', () => { + const sdl = dedent` + input Geo { + lat: Float + lon: Float + } + + type Query { + defaultInt(intArg: Int = 30): String + defaultList(listArg: [Int] = [1, 2, 3]): String + defaultObject(objArg: Geo = {lat: 37.485, lon: -122.148}): String + defaultNull(intArg: Int = null): String + noDefault(intArg: Int): String + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with custom directives', () => { + const sdl = dedent` + """This is a custom directive""" + directive @customDirective repeatable on FIELD + + type Query { + string: String + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema without directives', () => { + const sdl = dedent` + type Query { + string: String + } + `; + + const schema = buildSchema(sdl); + const introspection = introspectionFromSchema(schema); + + // @ts-expect-error + delete introspection.__schema.directives; + + const clientSchema = buildClientSchema(introspection); + + expect(schema.getDirectives()).to.have.lengthOf.above(0); + expect(clientSchema.getDirectives()).to.deep.equal([]); + expect(printSchema(clientSchema)).to.equal(sdl); + }); + + it('builds a schema aware of deprecation', () => { + const sdl = dedent` + directive @someDirective( + """This is a shiny new argument""" + shinyArg: SomeInputObject + + """This was our design mistake :(""" + oldArg: String @deprecated(reason: "Use shinyArg") + ) on QUERY + + enum Color { + """So rosy""" + RED + + """So grassy""" + GREEN + + """So calming""" + BLUE + + """So sickening""" + MAUVE @deprecated(reason: "No longer in fashion") + } + + input SomeInputObject { + """Nothing special about it, just deprecated for some unknown reason""" + oldField: String @deprecated(reason: "Don't use it, use newField instead!") + + """Same field but with a new name""" + newField: String + } + + type Query { + """This is a shiny string field""" + shinyString: String + + """This is a deprecated string field""" + deprecatedString: String @deprecated(reason: "Use shinyString") + + """Color of a week""" + color: Color + + """Some random field""" + someField( + """This is a shiny new argument""" + shinyArg: SomeInputObject + + """This was our design mistake :(""" + oldArg: String @deprecated(reason: "Use shinyArg") + ): String + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with empty deprecation reasons', () => { + const sdl = dedent` + directive @someDirective(someArg: SomeInputObject @deprecated(reason: "")) on QUERY + + type Query { + someField(someArg: SomeInputObject @deprecated(reason: "")): SomeEnum @deprecated(reason: "") + } + + input SomeInputObject { + someInputField: String @deprecated(reason: "") + } + + enum SomeEnum { + SOME_VALUE @deprecated(reason: "") + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('builds a schema with specifiedBy url', () => { + const sdl = dedent` + scalar Foo @specifiedBy(url: "https://example.com/foo_spec") + + type Query { + foo: Foo + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + + it('can use client schema for limited execution', () => { + const schema = buildSchema(` + scalar CustomScalar + + type Query { + foo(custom1: CustomScalar, custom2: CustomScalar): String + } + `); + + const introspection = introspectionFromSchema(schema); + const clientSchema = buildClientSchema(introspection); + + const result = graphqlSync({ + schema: clientSchema, + source: + 'query Limited($v: CustomScalar) { foo(custom1: 123, custom2: $v) }', + rootValue: { foo: 'bar', unused: 'value' }, + variableValues: { v: 'baz' }, + }); + + expect(result.data).to.deep.equal({ foo: 'bar' }); + }); + + it('can build invalid schema', () => { + const schema = buildSchema('type Query', { assumeValid: true }); + + const introspection = introspectionFromSchema(schema); + const clientSchema = buildClientSchema(introspection, { + assumeValid: true, + }); + + expect(clientSchema.toConfig().assumeValid).to.equal(true); + }); + + describe('throws when given invalid introspection', () => { + const dummySchema = buildSchema(` + type Query { + foo(bar: String): String + } + + interface SomeInterface { + foo: String + } + + union SomeUnion = Query + + enum SomeEnum { FOO } + + input SomeInputObject { + foo: String + } + + directive @SomeDirective on QUERY + `); + + it('throws when introspection is missing __schema property', () => { + // @ts-expect-error (First parameter expected to be introspection results) + expect(() => buildClientSchema(null)).to.throw( + 'Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: null.', + ); + + // @ts-expect-error + expect(() => buildClientSchema({})).to.throw( + 'Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: {}.', + ); + }); + + it('throws when referenced unknown type', () => { + const introspection = introspectionFromSchema(dummySchema); + + // @ts-expect-error + introspection.__schema.types = introspection.__schema.types.filter( + ({ name }) => name !== 'Query', + ); + + expect(() => buildClientSchema(introspection)).to.throw( + 'Invalid or incomplete schema, unknown type: Query. Ensure that a full introspection query is used in order to build a client schema.', + ); + }); + + it('throws when missing definition for one of the standard scalars', () => { + const schema = buildSchema(` + type Query { + foo: Float + } + `); + const introspection = introspectionFromSchema(schema); + + // @ts-expect-error + introspection.__schema.types = introspection.__schema.types.filter( + ({ name }) => name !== 'Float', + ); + + expect(() => buildClientSchema(introspection)).to.throw( + 'Invalid or incomplete schema, unknown type: Float. Ensure that a full introspection query is used in order to build a client schema.', + ); + }); + + it('throws when type reference is missing name', () => { + const introspection = introspectionFromSchema(dummySchema); + + expect(introspection).to.have.nested.property('__schema.queryType.name'); + + // @ts-expect-error + delete introspection.__schema.queryType.name; + + expect(() => buildClientSchema(introspection)).to.throw( + 'Unknown type reference: {}.', + ); + }); + + it('throws when missing kind', () => { + const introspection = introspectionFromSchema(dummySchema); + const queryTypeIntrospection = introspection.__schema.types.find( + ({ name }) => name === 'Query', + ); + + invariant(queryTypeIntrospection?.kind === 'OBJECT'); + // @ts-expect-error + delete queryTypeIntrospection.kind; + + expect(() => buildClientSchema(introspection)).to.throw( + /Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: { name: "Query", .* }\./, + ); + }); + + it('throws when missing interfaces', () => { + const introspection = introspectionFromSchema(dummySchema); + const queryTypeIntrospection = introspection.__schema.types.find( + ({ name }) => name === 'Query', + ); + + expect(queryTypeIntrospection).to.have.property('interfaces'); + + invariant(queryTypeIntrospection?.kind === 'OBJECT'); + // @ts-expect-error + delete queryTypeIntrospection.interfaces; + + expect(() => buildClientSchema(introspection)).to.throw( + /Introspection result missing interfaces: { kind: "OBJECT", name: "Query", .* }\./, + ); + }); + + it('Legacy support for interfaces with null as interfaces field', () => { + const introspection = introspectionFromSchema(dummySchema); + const someInterfaceIntrospection = introspection.__schema.types.find( + ({ name }) => name === 'SomeInterface', + ); + + invariant(someInterfaceIntrospection?.kind === 'INTERFACE'); + // @ts-expect-error + someInterfaceIntrospection.interfaces = null; + + const clientSchema = buildClientSchema(introspection); + expect(printSchema(clientSchema)).to.equal(printSchema(dummySchema)); + }); + + it('throws when missing fields', () => { + const introspection = introspectionFromSchema(dummySchema); + const queryTypeIntrospection = introspection.__schema.types.find( + ({ name }) => name === 'Query', + ); + + invariant(queryTypeIntrospection?.kind === 'OBJECT'); + // @ts-expect-error + delete queryTypeIntrospection.fields; + + expect(() => buildClientSchema(introspection)).to.throw( + /Introspection result missing fields: { kind: "OBJECT", name: "Query", .* }\./, + ); + }); + + it('throws when missing field args', () => { + const introspection = introspectionFromSchema(dummySchema); + const queryTypeIntrospection = introspection.__schema.types.find( + ({ name }) => name === 'Query', + ); + + invariant(queryTypeIntrospection?.kind === 'OBJECT'); + // @ts-expect-error + delete queryTypeIntrospection.fields[0].args; + + expect(() => buildClientSchema(introspection)).to.throw( + /Introspection result missing field args: { name: "foo", .* }\./, + ); + }); + + it('throws when output type is used as an arg type', () => { + const introspection = introspectionFromSchema(dummySchema); + const queryTypeIntrospection = introspection.__schema.types.find( + ({ name }) => name === 'Query', + ); + + invariant(queryTypeIntrospection?.kind === 'OBJECT'); + const argType = queryTypeIntrospection.fields[0].args[0].type; + invariant(argType.kind === 'SCALAR'); + + expect(argType).to.have.property('name', 'String'); + // @ts-expect-error + argType.name = 'SomeUnion'; + + expect(() => buildClientSchema(introspection)).to.throw( + 'Introspection must provide input type for arguments, but received: SomeUnion.', + ); + }); + + it('throws when input type is used as a field type', () => { + const introspection = introspectionFromSchema(dummySchema); + const queryTypeIntrospection = introspection.__schema.types.find( + ({ name }) => name === 'Query', + ); + + invariant(queryTypeIntrospection?.kind === 'OBJECT'); + const fieldType = queryTypeIntrospection.fields[0].type; + invariant(fieldType.kind === 'SCALAR'); + + expect(fieldType).to.have.property('name', 'String'); + // @ts-expect-error + fieldType.name = 'SomeInputObject'; + + expect(() => buildClientSchema(introspection)).to.throw( + 'Introspection must provide output type for fields, but received: SomeInputObject.', + ); + }); + + it('throws when missing possibleTypes', () => { + const introspection = introspectionFromSchema(dummySchema); + const someUnionIntrospection = introspection.__schema.types.find( + ({ name }) => name === 'SomeUnion', + ); + + invariant(someUnionIntrospection?.kind === 'UNION'); + // @ts-expect-error + delete someUnionIntrospection.possibleTypes; + + expect(() => buildClientSchema(introspection)).to.throw( + /Introspection result missing possibleTypes: { kind: "UNION", name: "SomeUnion",.* }\./, + ); + }); + + it('throws when missing enumValues', () => { + const introspection = introspectionFromSchema(dummySchema); + const someEnumIntrospection = introspection.__schema.types.find( + ({ name }) => name === 'SomeEnum', + ); + + invariant(someEnumIntrospection?.kind === 'ENUM'); + // @ts-expect-error + delete someEnumIntrospection.enumValues; + + expect(() => buildClientSchema(introspection)).to.throw( + /Introspection result missing enumValues: { kind: "ENUM", name: "SomeEnum", .* }\./, + ); + }); + + it('throws when missing inputFields', () => { + const introspection = introspectionFromSchema(dummySchema); + const someInputObjectIntrospection = introspection.__schema.types.find( + ({ name }) => name === 'SomeInputObject', + ); + + invariant(someInputObjectIntrospection?.kind === 'INPUT_OBJECT'); + // @ts-expect-error + delete someInputObjectIntrospection.inputFields; + + expect(() => buildClientSchema(introspection)).to.throw( + /Introspection result missing inputFields: { kind: "INPUT_OBJECT", name: "SomeInputObject", .* }\./, + ); + }); + + it('throws when missing directive locations', () => { + const introspection = introspectionFromSchema(dummySchema); + + const someDirectiveIntrospection = introspection.__schema.directives[0]; + expect(someDirectiveIntrospection).to.deep.include({ + name: 'SomeDirective', + locations: ['QUERY'], + }); + + // @ts-expect-error + delete someDirectiveIntrospection.locations; + + expect(() => buildClientSchema(introspection)).to.throw( + /Introspection result missing directive locations: { name: "SomeDirective", .* }\./, + ); + }); + + it('throws when missing directive args', () => { + const introspection = introspectionFromSchema(dummySchema); + + const someDirectiveIntrospection = introspection.__schema.directives[0]; + expect(someDirectiveIntrospection).to.deep.include({ + name: 'SomeDirective', + args: [], + }); + + // @ts-expect-error + delete someDirectiveIntrospection.args; + + expect(() => buildClientSchema(introspection)).to.throw( + /Introspection result missing directive args: { name: "SomeDirective", .* }\./, + ); + }); + }); + + describe('very deep decorators are not supported', () => { + it('fails on very deep (> 7 levels) lists', () => { + const schema = buildSchema(` + type Query { + foo: [[[[[[[[String]]]]]]]] + } + `); + + const introspection = introspectionFromSchema(schema); + expect(() => buildClientSchema(introspection)).to.throw( + 'Decorated type deeper than introspection query.', + ); + }); + + it('fails on a very deep (> 7 levels) non-null', () => { + const schema = buildSchema(` + type Query { + foo: [[[[String!]!]!]!] + } + `); + + const introspection = introspectionFromSchema(schema); + expect(() => buildClientSchema(introspection)).to.throw( + 'Decorated type deeper than introspection query.', + ); + }); + + it('succeeds on deep (<= 7 levels) types', () => { + // e.g., fully non-null 3D matrix + const sdl = dedent` + type Query { + foo: [[[String!]!]!]! + } + `; + + expect(cycleIntrospection(sdl)).to.equal(sdl); + }); + }); + + describe('prevents infinite recursion on invalid introspection', () => { + it('recursive interfaces', () => { + const sdl = ` + type Query { + foo: Foo + } + + type Foo implements Foo { + foo: String + } + `; + const schema = buildSchema(sdl, { assumeValid: true }); + const introspection = introspectionFromSchema(schema); + + const fooIntrospection = introspection.__schema.types.find( + (type) => type.name === 'Foo', + ); + expect(fooIntrospection).to.deep.include({ + name: 'Foo', + interfaces: [{ kind: 'OBJECT', name: 'Foo', ofType: null }], + }); + + expect(() => buildClientSchema(introspection)).to.throw( + 'Expected Foo to be a GraphQL Interface type.', + ); + }); + + it('recursive union', () => { + const sdl = ` + type Query { + foo: Foo + } + + union Foo = Foo + `; + const schema = buildSchema(sdl, { assumeValid: true }); + const introspection = introspectionFromSchema(schema); + + const fooIntrospection = introspection.__schema.types.find( + (type) => type.name === 'Foo', + ); + expect(fooIntrospection).to.deep.include({ + name: 'Foo', + possibleTypes: [{ kind: 'UNION', name: 'Foo', ofType: null }], + }); + + expect(() => buildClientSchema(introspection)).to.throw( + 'Expected Foo to be a GraphQL Object type.', + ); + }); + }); +}); diff --git a/src/utilities/__tests__/coerceInputValue-test.ts b/src/utilities/__tests__/coerceInputValue-test.ts new file mode 100644 index 00000000..a73cdc61 --- /dev/null +++ b/src/utilities/__tests__/coerceInputValue-test.ts @@ -0,0 +1,429 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import type { GraphQLInputType } from '../../type/definition'; +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, + GraphQLScalarType, +} from '../../type/definition'; +import { GraphQLInt } from '../../type/scalars'; + +import { coerceInputValue } from '../coerceInputValue'; + +interface CoerceResult { + value: unknown; + errors: ReadonlyArray; +} + +interface CoerceError { + path: ReadonlyArray; + value: unknown; + error: string; +} + +function coerceValue( + inputValue: unknown, + type: GraphQLInputType, +): CoerceResult { + const errors: Array = []; + const value = coerceInputValue( + inputValue, + type, + (path, invalidValue, error) => { + errors.push({ path, value: invalidValue, error: error.message }); + }, + ); + + return { errors, value }; +} + +function expectValue(result: CoerceResult) { + expect(result.errors).to.deep.equal([]); + return expect(result.value); +} + +function expectErrors(result: CoerceResult) { + return expect(result.errors); +} + +describe('coerceInputValue', () => { + describe('for GraphQLNonNull', () => { + const TestNonNull = new GraphQLNonNull(GraphQLInt); + + it('returns no error for non-null value', () => { + const result = coerceValue(1, TestNonNull); + expectValue(result).to.equal(1); + }); + + it('returns an error for undefined value', () => { + const result = coerceValue(undefined, TestNonNull); + expectErrors(result).to.deep.equal([ + { + error: 'Expected non-nullable type "Int!" not to be null.', + path: [], + value: undefined, + }, + ]); + }); + + it('returns an error for null value', () => { + const result = coerceValue(null, TestNonNull); + expectErrors(result).to.deep.equal([ + { + error: 'Expected non-nullable type "Int!" not to be null.', + path: [], + value: null, + }, + ]); + }); + }); + + describe('for GraphQLScalar', () => { + const TestScalar = new GraphQLScalarType({ + name: 'TestScalar', + parseValue(input: any) { + if (input.error != null) { + throw new Error(input.error); + } + return input.value; + }, + }); + + it('returns no error for valid input', () => { + const result = coerceValue({ value: 1 }, TestScalar); + expectValue(result).to.equal(1); + }); + + it('returns no error for null result', () => { + const result = coerceValue({ value: null }, TestScalar); + expectValue(result).to.equal(null); + }); + + it('returns no error for NaN result', () => { + const result = coerceValue({ value: NaN }, TestScalar); + expectValue(result).to.satisfy(Number.isNaN); + }); + + it('returns an error for undefined result', () => { + const result = coerceValue({ value: undefined }, TestScalar); + expectErrors(result).to.deep.equal([ + { + error: 'Expected type "TestScalar".', + path: [], + value: { value: undefined }, + }, + ]); + }); + + it('returns an error for undefined result', () => { + const inputValue = { error: 'Some error message' }; + const result = coerceValue(inputValue, TestScalar); + expectErrors(result).to.deep.equal([ + { + error: 'Expected type "TestScalar". Some error message', + path: [], + value: { error: 'Some error message' }, + }, + ]); + }); + }); + + describe('for GraphQLEnum', () => { + const TestEnum = new GraphQLEnumType({ + name: 'TestEnum', + values: { + FOO: { value: 'InternalFoo' }, + BAR: { value: 123456789 }, + }, + }); + + it('returns no error for a known enum name', () => { + const fooResult = coerceValue('FOO', TestEnum); + expectValue(fooResult).to.equal('InternalFoo'); + + const barResult = coerceValue('BAR', TestEnum); + expectValue(barResult).to.equal(123456789); + }); + + it('returns an error for misspelled enum value', () => { + const result = coerceValue('foo', TestEnum); + expectErrors(result).to.deep.equal([ + { + error: + 'Value "foo" does not exist in "TestEnum" enum. Did you mean the enum value "FOO"?', + path: [], + value: 'foo', + }, + ]); + }); + + it('returns an error for incorrect value type', () => { + const result1 = coerceValue(123, TestEnum); + expectErrors(result1).to.deep.equal([ + { + error: 'Enum "TestEnum" cannot represent non-string value: 123.', + path: [], + value: 123, + }, + ]); + + const result2 = coerceValue({ field: 'value' }, TestEnum); + expectErrors(result2).to.deep.equal([ + { + error: + 'Enum "TestEnum" cannot represent non-string value: { field: "value" }.', + path: [], + value: { field: 'value' }, + }, + ]); + }); + }); + + describe('for GraphQLInputObject', () => { + const TestInputObject = new GraphQLInputObjectType({ + name: 'TestInputObject', + fields: { + foo: { type: new GraphQLNonNull(GraphQLInt) }, + bar: { type: GraphQLInt }, + }, + }); + + it('returns no error for a valid input', () => { + const result = coerceValue({ foo: 123 }, TestInputObject); + expectValue(result).to.deep.equal({ foo: 123 }); + }); + + it('returns an error for a non-object type', () => { + const result = coerceValue(123, TestInputObject); + expectErrors(result).to.deep.equal([ + { + error: 'Expected type "TestInputObject" to be an object.', + path: [], + value: 123, + }, + ]); + }); + + it('returns an error for an invalid field', () => { + const result = coerceValue({ foo: NaN }, TestInputObject); + expectErrors(result).to.deep.equal([ + { + error: 'Int cannot represent non-integer value: NaN', + path: ['foo'], + value: NaN, + }, + ]); + }); + + it('returns multiple errors for multiple invalid fields', () => { + const result = coerceValue({ foo: 'abc', bar: 'def' }, TestInputObject); + expectErrors(result).to.deep.equal([ + { + error: 'Int cannot represent non-integer value: "abc"', + path: ['foo'], + value: 'abc', + }, + { + error: 'Int cannot represent non-integer value: "def"', + path: ['bar'], + value: 'def', + }, + ]); + }); + + it('returns error for a missing required field', () => { + const result = coerceValue({ bar: 123 }, TestInputObject); + expectErrors(result).to.deep.equal([ + { + error: 'Field "foo" of required type "Int!" was not provided.', + path: [], + value: { bar: 123 }, + }, + ]); + }); + + it('returns error for an unknown field', () => { + const result = coerceValue( + { foo: 123, unknownField: 123 }, + TestInputObject, + ); + expectErrors(result).to.deep.equal([ + { + error: + 'Field "unknownField" is not defined by type "TestInputObject".', + path: [], + value: { foo: 123, unknownField: 123 }, + }, + ]); + }); + + it('returns error for a misspelled field', () => { + const result = coerceValue({ foo: 123, bart: 123 }, TestInputObject); + expectErrors(result).to.deep.equal([ + { + error: + 'Field "bart" is not defined by type "TestInputObject". Did you mean "bar"?', + path: [], + value: { foo: 123, bart: 123 }, + }, + ]); + }); + }); + + describe('for GraphQLInputObject with default value', () => { + const makeTestInputObject = (defaultValue: any) => + new GraphQLInputObjectType({ + name: 'TestInputObject', + fields: { + foo: { + type: new GraphQLScalarType({ name: 'TestScalar' }), + defaultValue, + }, + }, + }); + + it('returns no errors for valid input value', () => { + const result = coerceValue({ foo: 5 }, makeTestInputObject(7)); + expectValue(result).to.deep.equal({ foo: 5 }); + }); + + it('returns object with default value', () => { + const result = coerceValue({}, makeTestInputObject(7)); + expectValue(result).to.deep.equal({ foo: 7 }); + }); + + it('returns null as value', () => { + const result = coerceValue({}, makeTestInputObject(null)); + expectValue(result).to.deep.equal({ foo: null }); + }); + + it('returns NaN as value', () => { + const result = coerceValue({}, makeTestInputObject(NaN)); + expectValue(result).to.have.property('foo').that.satisfy(Number.isNaN); + }); + }); + + describe('for GraphQLList', () => { + const TestList = new GraphQLList(GraphQLInt); + + it('returns no error for a valid input', () => { + const result = coerceValue([1, 2, 3], TestList); + expectValue(result).to.deep.equal([1, 2, 3]); + }); + + it('returns no error for a valid iterable input', () => { + function* listGenerator() { + yield 1; + yield 2; + yield 3; + } + + const result = coerceValue(listGenerator(), TestList); + expectValue(result).to.deep.equal([1, 2, 3]); + }); + + it('returns an error for an invalid input', () => { + const result = coerceValue([1, 'b', true, 4], TestList); + expectErrors(result).to.deep.equal([ + { + error: 'Int cannot represent non-integer value: "b"', + path: [1], + value: 'b', + }, + { + error: 'Int cannot represent non-integer value: true', + path: [2], + value: true, + }, + ]); + }); + + it('returns a list for a non-list value', () => { + const result = coerceValue(42, TestList); + expectValue(result).to.deep.equal([42]); + }); + + it('returns a list for a non-list object value', () => { + const TestListOfObjects = new GraphQLList( + new GraphQLInputObjectType({ + name: 'TestObject', + fields: { + length: { type: GraphQLInt }, + }, + }), + ); + + const result = coerceValue({ length: 100500 }, TestListOfObjects); + expectValue(result).to.deep.equal([{ length: 100500 }]); + }); + + it('returns an error for a non-list invalid value', () => { + const result = coerceValue('INVALID', TestList); + expectErrors(result).to.deep.equal([ + { + error: 'Int cannot represent non-integer value: "INVALID"', + path: [], + value: 'INVALID', + }, + ]); + }); + + it('returns null for a null value', () => { + const result = coerceValue(null, TestList); + expectValue(result).to.deep.equal(null); + }); + }); + + describe('for nested GraphQLList', () => { + const TestNestedList = new GraphQLList(new GraphQLList(GraphQLInt)); + + it('returns no error for a valid input', () => { + const result = coerceValue([[1], [2, 3]], TestNestedList); + expectValue(result).to.deep.equal([[1], [2, 3]]); + }); + + it('returns a list for a non-list value', () => { + const result = coerceValue(42, TestNestedList); + expectValue(result).to.deep.equal([[42]]); + }); + + it('returns null for a null value', () => { + const result = coerceValue(null, TestNestedList); + expectValue(result).to.deep.equal(null); + }); + + it('returns nested lists for nested non-list values', () => { + const result = coerceValue([1, 2, 3], TestNestedList); + expectValue(result).to.deep.equal([[1], [2], [3]]); + }); + + it('returns nested null for nested null values', () => { + const result = coerceValue([42, [null], null], TestNestedList); + expectValue(result).to.deep.equal([[42], [null], null]); + }); + }); + + describe('with default onError', () => { + it('throw error without path', () => { + expect(() => + coerceInputValue(null, new GraphQLNonNull(GraphQLInt)), + ).to.throw( + 'Invalid value null: Expected non-nullable type "Int!" not to be null.', + ); + }); + + it('throw error with path', () => { + expect(() => + coerceInputValue( + [null], + new GraphQLList(new GraphQLNonNull(GraphQLInt)), + ), + ).to.throw( + 'Invalid value null at "value[0]": Expected non-nullable type "Int!" not to be null.', + ); + }); + }); +}); diff --git a/src/utilities/__tests__/concatAST-test.ts b/src/utilities/__tests__/concatAST-test.ts new file mode 100644 index 00000000..622abd6b --- /dev/null +++ b/src/utilities/__tests__/concatAST-test.ts @@ -0,0 +1,40 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; + +import { parse } from '../../language/parser'; +import { print } from '../../language/printer'; +import { Source } from '../../language/source'; + +import { concatAST } from '../concatAST'; + +describe('concatAST', () => { + it('concatenates two ASTs together', () => { + const sourceA = new Source(` + { a, b, ...Frag } + `); + + const sourceB = new Source(` + fragment Frag on T { + c + } + `); + + const astA = parse(sourceA); + const astB = parse(sourceB); + const astC = concatAST([astA, astB]); + + expect(print(astC)).to.equal(dedent` + { + a + b + ...Frag + } + + fragment Frag on T { + c + } + `); + }); +}); diff --git a/src/utilities/__tests__/extendSchema-test.ts b/src/utilities/__tests__/extendSchema-test.ts new file mode 100644 index 00000000..86baf0e6 --- /dev/null +++ b/src/utilities/__tests__/extendSchema-test.ts @@ -0,0 +1,1322 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; + +import { invariant } from '../../jsutils/invariant'; +import type { Maybe } from '../../jsutils/Maybe'; + +import type { ASTNode } from '../../language/ast'; +import { parse } from '../../language/parser'; +import { print } from '../../language/printer'; + +import { + assertEnumType, + assertInputObjectType, + assertInterfaceType, + assertObjectType, + assertScalarType, + assertUnionType, +} from '../../type/definition'; +import { assertDirective } from '../../type/directives'; +import { + GraphQLBoolean, + GraphQLFloat, + GraphQLID, + GraphQLInt, + GraphQLString, +} from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; +import { validateSchema } from '../../type/validate'; + +import { graphqlSync } from '../../graphql'; + +import { buildSchema } from '../buildASTSchema'; +import { concatAST } from '../concatAST'; +import { extendSchema } from '../extendSchema'; +import { printSchema } from '../printSchema'; + +function expectExtensionASTNodes(obj: { + readonly extensionASTNodes: ReadonlyArray; +}) { + return expect(obj.extensionASTNodes.map(print).join('\n\n')); +} + +function expectASTNode(obj: Maybe<{ readonly astNode: Maybe }>) { + invariant(obj?.astNode != null); + return expect(print(obj.astNode)); +} + +function expectSchemaChanges( + schema: GraphQLSchema, + extendedSchema: GraphQLSchema, +) { + const schemaDefinitions = parse(printSchema(schema)).definitions.map(print); + return expect( + parse(printSchema(extendedSchema)) + .definitions.map(print) + .filter((def) => !schemaDefinitions.includes(def)) + .join('\n\n'), + ); +} + +describe('extendSchema', () => { + it('returns the original schema when there are no type definitions', () => { + const schema = buildSchema('type Query'); + const extendedSchema = extendSchema(schema, parse('{ field }')); + expect(extendedSchema).to.equal(schema); + }); + + it('can be used for limited execution', () => { + const schema = buildSchema('type Query'); + const extendAST = parse(` + extend type Query { + newField: String + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + const result = graphqlSync({ + schema: extendedSchema, + source: '{ newField }', + rootValue: { newField: 123 }, + }); + expect(result).to.deep.equal({ + data: { newField: '123' }, + }); + }); + + it('extends objects by adding new fields', () => { + const schema = buildSchema(` + type Query { + someObject: SomeObject + } + + type SomeObject implements AnotherInterface & SomeInterface { + self: SomeObject + tree: [SomeObject]! + """Old field description.""" + oldField: String + } + + interface SomeInterface { + self: SomeInterface + } + + interface AnotherInterface { + self: SomeObject + } + `); + const extensionSDL = dedent` + extend type SomeObject { + """New field description.""" + newField(arg: Boolean): String + } + `; + const extendedSchema = extendSchema(schema, parse(extensionSDL)); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + type SomeObject implements AnotherInterface & SomeInterface { + self: SomeObject + tree: [SomeObject]! + """Old field description.""" + oldField: String + """New field description.""" + newField(arg: Boolean): String + } + `); + }); + + it('extends objects with standard type fields', () => { + const schema = buildSchema('type Query'); + + // String and Boolean are always included through introspection types + expect(schema.getType('Int')).to.equal(undefined); + expect(schema.getType('Float')).to.equal(undefined); + expect(schema.getType('String')).to.equal(GraphQLString); + expect(schema.getType('Boolean')).to.equal(GraphQLBoolean); + expect(schema.getType('ID')).to.equal(undefined); + + const extendAST = parse(` + extend type Query { + bool: Boolean + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expect(extendedSchema.getType('Int')).to.equal(undefined); + expect(extendedSchema.getType('Float')).to.equal(undefined); + expect(extendedSchema.getType('String')).to.equal(GraphQLString); + expect(extendedSchema.getType('Boolean')).to.equal(GraphQLBoolean); + expect(extendedSchema.getType('ID')).to.equal(undefined); + + const extendTwiceAST = parse(` + extend type Query { + int: Int + float: Float + id: ID + } + `); + const extendedTwiceSchema = extendSchema(schema, extendTwiceAST); + + expect(validateSchema(extendedTwiceSchema)).to.deep.equal([]); + expect(extendedTwiceSchema.getType('Int')).to.equal(GraphQLInt); + expect(extendedTwiceSchema.getType('Float')).to.equal(GraphQLFloat); + expect(extendedTwiceSchema.getType('String')).to.equal(GraphQLString); + expect(extendedTwiceSchema.getType('Boolean')).to.equal(GraphQLBoolean); + expect(extendedTwiceSchema.getType('ID')).to.equal(GraphQLID); + }); + + it('extends enums by adding new values', () => { + const schema = buildSchema(` + type Query { + someEnum(arg: SomeEnum): SomeEnum + } + + directive @foo(arg: SomeEnum) on SCHEMA + + enum SomeEnum { + """Old value description.""" + OLD_VALUE + } + `); + const extendAST = parse(` + extend enum SomeEnum { + """New value description.""" + NEW_VALUE + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + enum SomeEnum { + """Old value description.""" + OLD_VALUE + """New value description.""" + NEW_VALUE + } + `); + }); + + it('extends unions by adding new types', () => { + const schema = buildSchema(` + type Query { + someUnion: SomeUnion + } + + union SomeUnion = Foo | Biz + + type Foo { foo: String } + type Biz { biz: String } + type Bar { bar: String } + `); + const extendAST = parse(` + extend union SomeUnion = Bar + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + union SomeUnion = Foo | Biz | Bar + `); + }); + + it('allows extension of union by adding itself', () => { + const schema = buildSchema(` + union SomeUnion + `); + const extendAST = parse(` + extend union SomeUnion = SomeUnion + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.have.lengthOf.above(0); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + union SomeUnion = SomeUnion + `); + }); + + it('extends inputs by adding new fields', () => { + const schema = buildSchema(` + type Query { + someInput(arg: SomeInput): String + } + + directive @foo(arg: SomeInput) on SCHEMA + + input SomeInput { + """Old field description.""" + oldField: String + } + `); + const extendAST = parse(` + extend input SomeInput { + """New field description.""" + newField: String + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + input SomeInput { + """Old field description.""" + oldField: String + """New field description.""" + newField: String + } + `); + }); + + it('extends scalars by adding new directives', () => { + const schema = buildSchema(` + type Query { + someScalar(arg: SomeScalar): SomeScalar + } + + directive @foo(arg: SomeScalar) on SCALAR + + input FooInput { + foo: SomeScalar + } + + scalar SomeScalar + `); + const extensionSDL = dedent` + extend scalar SomeScalar @foo + `; + const extendedSchema = extendSchema(schema, parse(extensionSDL)); + const someScalar = assertScalarType(extendedSchema.getType('SomeScalar')); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectExtensionASTNodes(someScalar).to.equal(extensionSDL); + }); + + it('extends scalars by adding specifiedBy directive', () => { + const schema = buildSchema(` + type Query { + foo: Foo + } + + scalar Foo + + directive @foo on SCALAR + `); + const extensionSDL = dedent` + extend scalar Foo @foo + + extend scalar Foo @specifiedBy(url: "https://example.com/foo_spec") + `; + + const extendedSchema = extendSchema(schema, parse(extensionSDL)); + const foo = assertScalarType(extendedSchema.getType('Foo')); + + expect(foo.specifiedByURL).to.equal('https://example.com/foo_spec'); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectExtensionASTNodes(foo).to.equal(extensionSDL); + }); + + it('correctly assign AST nodes to new and extended types', () => { + const schema = buildSchema(` + type Query + + scalar SomeScalar + enum SomeEnum + union SomeUnion + input SomeInput + type SomeObject + interface SomeInterface + + directive @foo on SCALAR + `); + const firstExtensionAST = parse(` + extend type Query { + newField(testArg: TestInput): TestEnum + } + + extend scalar SomeScalar @foo + + extend enum SomeEnum { + NEW_VALUE + } + + extend union SomeUnion = SomeObject + + extend input SomeInput { + newField: String + } + + extend interface SomeInterface { + newField: String + } + + enum TestEnum { + TEST_VALUE + } + + input TestInput { + testInputField: TestEnum + } + `); + const extendedSchema = extendSchema(schema, firstExtensionAST); + + const secondExtensionAST = parse(` + extend type Query { + oneMoreNewField: TestUnion + } + + extend scalar SomeScalar @test + + extend enum SomeEnum { + ONE_MORE_NEW_VALUE + } + + extend union SomeUnion = TestType + + extend input SomeInput { + oneMoreNewField: String + } + + extend interface SomeInterface { + oneMoreNewField: String + } + + union TestUnion = TestType + + interface TestInterface { + interfaceField: String + } + + type TestType implements TestInterface { + interfaceField: String + } + + directive @test(arg: Int) repeatable on FIELD | SCALAR + `); + const extendedTwiceSchema = extendSchema( + extendedSchema, + secondExtensionAST, + ); + + const extendedInOneGoSchema = extendSchema( + schema, + concatAST([firstExtensionAST, secondExtensionAST]), + ); + expect(printSchema(extendedInOneGoSchema)).to.equal( + printSchema(extendedTwiceSchema), + ); + + const query = assertObjectType(extendedTwiceSchema.getType('Query')); + const someEnum = assertEnumType(extendedTwiceSchema.getType('SomeEnum')); + const someUnion = assertUnionType(extendedTwiceSchema.getType('SomeUnion')); + const someScalar = assertScalarType( + extendedTwiceSchema.getType('SomeScalar'), + ); + const someInput = assertInputObjectType( + extendedTwiceSchema.getType('SomeInput'), + ); + const someInterface = assertInterfaceType( + extendedTwiceSchema.getType('SomeInterface'), + ); + + const testInput = assertInputObjectType( + extendedTwiceSchema.getType('TestInput'), + ); + const testEnum = assertEnumType(extendedTwiceSchema.getType('TestEnum')); + const testUnion = assertUnionType(extendedTwiceSchema.getType('TestUnion')); + const testType = assertObjectType(extendedTwiceSchema.getType('TestType')); + const testInterface = assertInterfaceType( + extendedTwiceSchema.getType('TestInterface'), + ); + const testDirective = assertDirective( + extendedTwiceSchema.getDirective('test'), + ); + + expect(testType.extensionASTNodes).to.deep.equal([]); + expect(testEnum.extensionASTNodes).to.deep.equal([]); + expect(testUnion.extensionASTNodes).to.deep.equal([]); + expect(testInput.extensionASTNodes).to.deep.equal([]); + expect(testInterface.extensionASTNodes).to.deep.equal([]); + + expect([ + testInput.astNode, + testEnum.astNode, + testUnion.astNode, + testInterface.astNode, + testType.astNode, + testDirective.astNode, + ...query.extensionASTNodes, + ...someScalar.extensionASTNodes, + ...someEnum.extensionASTNodes, + ...someUnion.extensionASTNodes, + ...someInput.extensionASTNodes, + ...someInterface.extensionASTNodes, + ]).to.have.members([ + ...firstExtensionAST.definitions, + ...secondExtensionAST.definitions, + ]); + + const newField = query.getFields().newField; + expectASTNode(newField).to.equal('newField(testArg: TestInput): TestEnum'); + expectASTNode(newField.args[0]).to.equal('testArg: TestInput'); + expectASTNode(query.getFields().oneMoreNewField).to.equal( + 'oneMoreNewField: TestUnion', + ); + + expectASTNode(someEnum.getValue('NEW_VALUE')).to.equal('NEW_VALUE'); + expectASTNode(someEnum.getValue('ONE_MORE_NEW_VALUE')).to.equal( + 'ONE_MORE_NEW_VALUE', + ); + + expectASTNode(someInput.getFields().newField).to.equal('newField: String'); + expectASTNode(someInput.getFields().oneMoreNewField).to.equal( + 'oneMoreNewField: String', + ); + expectASTNode(someInterface.getFields().newField).to.equal( + 'newField: String', + ); + expectASTNode(someInterface.getFields().oneMoreNewField).to.equal( + 'oneMoreNewField: String', + ); + + expectASTNode(testInput.getFields().testInputField).to.equal( + 'testInputField: TestEnum', + ); + + expectASTNode(testEnum.getValue('TEST_VALUE')).to.equal('TEST_VALUE'); + + expectASTNode(testInterface.getFields().interfaceField).to.equal( + 'interfaceField: String', + ); + expectASTNode(testType.getFields().interfaceField).to.equal( + 'interfaceField: String', + ); + expectASTNode(testDirective.args[0]).to.equal('arg: Int'); + }); + + it('builds types with deprecated fields/values', () => { + const schema = new GraphQLSchema({}); + const extendAST = parse(` + type SomeObject { + deprecatedField: String @deprecated(reason: "not used anymore") + } + + enum SomeEnum { + DEPRECATED_VALUE @deprecated(reason: "do not use") + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + const someType = assertObjectType(extendedSchema.getType('SomeObject')); + expect(someType.getFields().deprecatedField).to.include({ + deprecationReason: 'not used anymore', + }); + + const someEnum = assertEnumType(extendedSchema.getType('SomeEnum')); + expect(someEnum.getValue('DEPRECATED_VALUE')).to.include({ + deprecationReason: 'do not use', + }); + }); + + it('extends objects with deprecated fields', () => { + const schema = buildSchema('type SomeObject'); + const extendAST = parse(` + extend type SomeObject { + deprecatedField: String @deprecated(reason: "not used anymore") + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + const someType = assertObjectType(extendedSchema.getType('SomeObject')); + expect(someType.getFields().deprecatedField).to.include({ + deprecationReason: 'not used anymore', + }); + }); + + it('extends enums with deprecated values', () => { + const schema = buildSchema('enum SomeEnum'); + const extendAST = parse(` + extend enum SomeEnum { + DEPRECATED_VALUE @deprecated(reason: "do not use") + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + const someEnum = assertEnumType(extendedSchema.getType('SomeEnum')); + expect(someEnum.getValue('DEPRECATED_VALUE')).to.include({ + deprecationReason: 'do not use', + }); + }); + + it('adds new unused types', () => { + const schema = buildSchema(` + type Query { + dummy: String + } + `); + const extensionSDL = dedent` + type DummyUnionMember { + someField: String + } + + enum UnusedEnum { + SOME_VALUE + } + + input UnusedInput { + someField: String + } + + interface UnusedInterface { + someField: String + } + + type UnusedObject { + someField: String + } + + union UnusedUnion = DummyUnionMember + `; + const extendedSchema = extendSchema(schema, parse(extensionSDL)); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(extensionSDL); + }); + + it('extends objects by adding new fields with arguments', () => { + const schema = buildSchema(` + type SomeObject + + type Query { + someObject: SomeObject + } + `); + const extendAST = parse(` + input NewInputObj { + field1: Int + field2: [Float] + field3: String! + } + + extend type SomeObject { + newField(arg1: String, arg2: NewInputObj!): String + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + type SomeObject { + newField(arg1: String, arg2: NewInputObj!): String + } + + input NewInputObj { + field1: Int + field2: [Float] + field3: String! + } + `); + }); + + it('extends objects by adding new fields with existing types', () => { + const schema = buildSchema(` + type Query { + someObject: SomeObject + } + + type SomeObject + enum SomeEnum { VALUE } + `); + const extendAST = parse(` + extend type SomeObject { + newField(arg1: SomeEnum!): SomeEnum + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + type SomeObject { + newField(arg1: SomeEnum!): SomeEnum + } + `); + }); + + it('extends objects by adding implemented interfaces', () => { + const schema = buildSchema(` + type Query { + someObject: SomeObject + } + + type SomeObject { + foo: String + } + + interface SomeInterface { + foo: String + } + `); + const extendAST = parse(` + extend type SomeObject implements SomeInterface + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + type SomeObject implements SomeInterface { + foo: String + } + `); + }); + + it('extends objects by including new types', () => { + const schema = buildSchema(` + type Query { + someObject: SomeObject + } + + type SomeObject { + oldField: String + } + `); + const newTypesSDL = dedent` + enum NewEnum { + VALUE + } + + interface NewInterface { + baz: String + } + + type NewObject implements NewInterface { + baz: String + } + + scalar NewScalar + + union NewUnion = NewObject`; + const extendAST = parse(` + ${newTypesSDL} + extend type SomeObject { + newObject: NewObject + newInterface: NewInterface + newUnion: NewUnion + newScalar: NewScalar + newEnum: NewEnum + newTree: [SomeObject]! + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + type SomeObject { + oldField: String + newObject: NewObject + newInterface: NewInterface + newUnion: NewUnion + newScalar: NewScalar + newEnum: NewEnum + newTree: [SomeObject]! + } + + ${newTypesSDL} + `); + }); + + it('extends objects by adding implemented new interfaces', () => { + const schema = buildSchema(` + type Query { + someObject: SomeObject + } + + type SomeObject implements OldInterface { + oldField: String + } + + interface OldInterface { + oldField: String + } + `); + const extendAST = parse(` + extend type SomeObject implements NewInterface { + newField: String + } + + interface NewInterface { + newField: String + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + type SomeObject implements OldInterface & NewInterface { + oldField: String + newField: String + } + + interface NewInterface { + newField: String + } + `); + }); + + it('extends different types multiple times', () => { + const schema = buildSchema(` + type Query { + someScalar: SomeScalar + someObject(someInput: SomeInput): SomeObject + someInterface: SomeInterface + someEnum: SomeEnum + someUnion: SomeUnion + } + + scalar SomeScalar + + type SomeObject implements SomeInterface { + oldField: String + } + + interface SomeInterface { + oldField: String + } + + enum SomeEnum { + OLD_VALUE + } + + union SomeUnion = SomeObject + + input SomeInput { + oldField: String + } + `); + const newTypesSDL = dedent` + scalar NewScalar + + scalar AnotherNewScalar + + type NewObject { + foo: String + } + + type AnotherNewObject { + foo: String + } + + interface NewInterface { + newField: String + } + + interface AnotherNewInterface { + anotherNewField: String + } + `; + const schemaWithNewTypes = extendSchema(schema, parse(newTypesSDL)); + expectSchemaChanges(schema, schemaWithNewTypes).to.equal(newTypesSDL); + + const extendAST = parse(` + extend scalar SomeScalar @specifiedBy(url: "http://example.com/foo_spec") + + extend type SomeObject implements NewInterface { + newField: String + } + + extend type SomeObject implements AnotherNewInterface { + anotherNewField: String + } + + extend enum SomeEnum { + NEW_VALUE + } + + extend enum SomeEnum { + ANOTHER_NEW_VALUE + } + + extend union SomeUnion = NewObject + + extend union SomeUnion = AnotherNewObject + + extend input SomeInput { + newField: String + } + + extend input SomeInput { + anotherNewField: String + } + `); + const extendedSchema = extendSchema(schemaWithNewTypes, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + scalar SomeScalar @specifiedBy(url: "http://example.com/foo_spec") + + type SomeObject implements SomeInterface & NewInterface & AnotherNewInterface { + oldField: String + newField: String + anotherNewField: String + } + + enum SomeEnum { + OLD_VALUE + NEW_VALUE + ANOTHER_NEW_VALUE + } + + union SomeUnion = SomeObject | NewObject | AnotherNewObject + + input SomeInput { + oldField: String + newField: String + anotherNewField: String + } + + ${newTypesSDL} + `); + }); + + it('extends interfaces by adding new fields', () => { + const schema = buildSchema(` + interface SomeInterface { + oldField: String + } + + interface AnotherInterface implements SomeInterface { + oldField: String + } + + type SomeObject implements SomeInterface & AnotherInterface { + oldField: String + } + + type Query { + someInterface: SomeInterface + } + `); + const extendAST = parse(` + extend interface SomeInterface { + newField: String + } + + extend interface AnotherInterface { + newField: String + } + + extend type SomeObject { + newField: String + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + interface SomeInterface { + oldField: String + newField: String + } + + interface AnotherInterface implements SomeInterface { + oldField: String + newField: String + } + + type SomeObject implements SomeInterface & AnotherInterface { + oldField: String + newField: String + } + `); + }); + + it('extends interfaces by adding new implemented interfaces', () => { + const schema = buildSchema(` + interface SomeInterface { + oldField: String + } + + interface AnotherInterface implements SomeInterface { + oldField: String + } + + type SomeObject implements SomeInterface & AnotherInterface { + oldField: String + } + + type Query { + someInterface: SomeInterface + } + `); + const extendAST = parse(` + interface NewInterface { + newField: String + } + + extend interface AnotherInterface implements NewInterface { + newField: String + } + + extend type SomeObject implements NewInterface { + newField: String + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + interface AnotherInterface implements SomeInterface & NewInterface { + oldField: String + newField: String + } + + type SomeObject implements SomeInterface & AnotherInterface & NewInterface { + oldField: String + newField: String + } + + interface NewInterface { + newField: String + } + `); + }); + + it('allows extension of interface with missing Object fields', () => { + const schema = buildSchema(` + type Query { + someInterface: SomeInterface + } + + type SomeObject implements SomeInterface { + oldField: SomeInterface + } + + interface SomeInterface { + oldField: SomeInterface + } + `); + const extendAST = parse(` + extend interface SomeInterface { + newField: String + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.have.lengthOf.above(0); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + interface SomeInterface { + oldField: SomeInterface + newField: String + } + `); + }); + + it('extends interfaces multiple times', () => { + const schema = buildSchema(` + type Query { + someInterface: SomeInterface + } + + interface SomeInterface { + some: SomeInterface + } + `); + + const extendAST = parse(` + extend interface SomeInterface { + newFieldA: Int + } + + extend interface SomeInterface { + newFieldB(test: Boolean): String + } + `); + const extendedSchema = extendSchema(schema, extendAST); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(dedent` + interface SomeInterface { + some: SomeInterface + newFieldA: Int + newFieldB(test: Boolean): String + } + `); + }); + + it('may extend mutations and subscriptions', () => { + const mutationSchema = buildSchema(` + type Query { + queryField: String + } + + type Mutation { + mutationField: String + } + + type Subscription { + subscriptionField: String + } + `); + const ast = parse(` + extend type Query { + newQueryField: Int + } + + extend type Mutation { + newMutationField: Int + } + + extend type Subscription { + newSubscriptionField: Int + } + `); + const originalPrint = printSchema(mutationSchema); + const extendedSchema = extendSchema(mutationSchema, ast); + expect(extendedSchema).to.not.equal(mutationSchema); + expect(printSchema(mutationSchema)).to.equal(originalPrint); + expect(printSchema(extendedSchema)).to.equal(dedent` + type Query { + queryField: String + newQueryField: Int + } + + type Mutation { + mutationField: String + newMutationField: Int + } + + type Subscription { + subscriptionField: String + newSubscriptionField: Int + } + `); + }); + + it('may extend directives with new directive', () => { + const schema = buildSchema(` + type Query { + foo: String + } + `); + const extensionSDL = dedent` + """New directive.""" + directive @new(enable: Boolean!, tag: String) repeatable on QUERY | FIELD + `; + const extendedSchema = extendSchema(schema, parse(extensionSDL)); + + expect(validateSchema(extendedSchema)).to.deep.equal([]); + expectSchemaChanges(schema, extendedSchema).to.equal(extensionSDL); + }); + + it('Rejects invalid SDL', () => { + const schema = new GraphQLSchema({}); + const extendAST = parse('extend schema @unknown'); + + expect(() => extendSchema(schema, extendAST)).to.throw( + 'Unknown directive "@unknown".', + ); + }); + + it('Allows to disable SDL validation', () => { + const schema = new GraphQLSchema({}); + const extendAST = parse('extend schema @unknown'); + + extendSchema(schema, extendAST, { assumeValid: true }); + extendSchema(schema, extendAST, { assumeValidSDL: true }); + }); + + it('Throws on unknown types', () => { + const schema = new GraphQLSchema({}); + const ast = parse(` + type Query { + unknown: UnknownType + } + `); + expect(() => extendSchema(schema, ast, { assumeValidSDL: true })).to.throw( + 'Unknown type: "UnknownType".', + ); + }); + + it('Rejects invalid AST', () => { + const schema = new GraphQLSchema({}); + + // @ts-expect-error (Second argument expects DocumentNode) + expect(() => extendSchema(schema, null)).to.throw( + 'Must provide valid Document AST', + ); + + // @ts-expect-error + expect(() => extendSchema(schema, {})).to.throw( + 'Must provide valid Document AST', + ); + }); + + it('does not allow replacing a default directive', () => { + const schema = new GraphQLSchema({}); + const extendAST = parse(` + directive @include(if: Boolean!) on FIELD | FRAGMENT_SPREAD + `); + + expect(() => extendSchema(schema, extendAST)).to.throw( + 'Directive "@include" already exists in the schema. It cannot be redefined.', + ); + }); + + it('does not allow replacing an existing enum value', () => { + const schema = buildSchema(` + enum SomeEnum { + ONE + } + `); + const extendAST = parse(` + extend enum SomeEnum { + ONE + } + `); + + expect(() => extendSchema(schema, extendAST)).to.throw( + 'Enum value "SomeEnum.ONE" already exists in the schema. It cannot also be defined in this type extension.', + ); + }); + + describe('can add additional root operation types', () => { + it('does not automatically include common root type names', () => { + const schema = new GraphQLSchema({}); + const extendedSchema = extendSchema(schema, parse('type Mutation')); + + expect(extendedSchema.getType('Mutation')).to.not.equal(undefined); + expect(extendedSchema.getMutationType()).to.equal(undefined); + }); + + it('adds schema definition missing in the original schema', () => { + const schema = buildSchema(` + directive @foo on SCHEMA + type Foo + `); + expect(schema.getQueryType()).to.equal(undefined); + + const extensionSDL = dedent` + schema @foo { + query: Foo + } + `; + const extendedSchema = extendSchema(schema, parse(extensionSDL)); + + const queryType = extendedSchema.getQueryType(); + expect(queryType).to.include({ name: 'Foo' }); + expectASTNode(extendedSchema).to.equal(extensionSDL); + }); + + it('adds new root types via schema extension', () => { + const schema = buildSchema(` + type Query + type MutationRoot + `); + const extensionSDL = dedent` + extend schema { + mutation: MutationRoot + } + `; + const extendedSchema = extendSchema(schema, parse(extensionSDL)); + + const mutationType = extendedSchema.getMutationType(); + expect(mutationType).to.include({ name: 'MutationRoot' }); + expectExtensionASTNodes(extendedSchema).to.equal(extensionSDL); + }); + + it('adds directive via schema extension', () => { + const schema = buildSchema(` + type Query + + directive @foo on SCHEMA + `); + const extensionSDL = dedent` + extend schema @foo + `; + const extendedSchema = extendSchema(schema, parse(extensionSDL)); + + expectExtensionASTNodes(extendedSchema).to.equal(extensionSDL); + }); + + it('adds multiple new root types via schema extension', () => { + const schema = buildSchema('type Query'); + const extendAST = parse(` + extend schema { + mutation: Mutation + subscription: Subscription + } + + type Mutation + type Subscription + `); + const extendedSchema = extendSchema(schema, extendAST); + + const mutationType = extendedSchema.getMutationType(); + expect(mutationType).to.include({ name: 'Mutation' }); + + const subscriptionType = extendedSchema.getSubscriptionType(); + expect(subscriptionType).to.include({ name: 'Subscription' }); + }); + + it('applies multiple schema extensions', () => { + const schema = buildSchema('type Query'); + const extendAST = parse(` + extend schema { + mutation: Mutation + } + type Mutation + + extend schema { + subscription: Subscription + } + type Subscription + `); + const extendedSchema = extendSchema(schema, extendAST); + + const mutationType = extendedSchema.getMutationType(); + expect(mutationType).to.include({ name: 'Mutation' }); + + const subscriptionType = extendedSchema.getSubscriptionType(); + expect(subscriptionType).to.include({ name: 'Subscription' }); + }); + + it('schema extension AST are available from schema object', () => { + const schema = buildSchema(` + type Query + + directive @foo on SCHEMA + `); + + const extendAST = parse(` + extend schema { + mutation: Mutation + } + type Mutation + + extend schema { + subscription: Subscription + } + type Subscription + `); + const extendedSchema = extendSchema(schema, extendAST); + + const secondExtendAST = parse('extend schema @foo'); + const extendedTwiceSchema = extendSchema(extendedSchema, secondExtendAST); + + expectExtensionASTNodes(extendedTwiceSchema).to.equal(dedent` + extend schema { + mutation: Mutation + } + + extend schema { + subscription: Subscription + } + + extend schema @foo + `); + }); + }); +}); diff --git a/src/utilities/__tests__/findBreakingChanges-test.ts b/src/utilities/__tests__/findBreakingChanges-test.ts new file mode 100644 index 00000000..5a7956ae --- /dev/null +++ b/src/utilities/__tests__/findBreakingChanges-test.ts @@ -0,0 +1,1230 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { + GraphQLDeprecatedDirective, + GraphQLIncludeDirective, + GraphQLSkipDirective, + GraphQLSpecifiedByDirective, +} from '../../type/directives'; +import { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../buildASTSchema'; +import { + BreakingChangeType, + DangerousChangeType, + findBreakingChanges, + findDangerousChanges, +} from '../findBreakingChanges'; + +describe('findBreakingChanges', () => { + it('should detect if a type was removed or not', () => { + const oldSchema = buildSchema(` + type Type1 + type Type2 + `); + + const newSchema = buildSchema(` + type Type2 + `); + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.TYPE_REMOVED, + description: 'Type1 was removed.', + }, + ]); + expect(findBreakingChanges(oldSchema, oldSchema)).to.deep.equal([]); + }); + + it('should detect if a standard scalar was removed', () => { + const oldSchema = buildSchema(` + type Query { + foo: Float + } + `); + + const newSchema = buildSchema(` + type Query { + foo: String + } + `); + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.TYPE_REMOVED, + description: + 'Standard scalar Float was removed because it is not referenced anymore.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Query.foo changed type from Float to String.', + }, + ]); + expect(findBreakingChanges(oldSchema, oldSchema)).to.deep.equal([]); + }); + + it('should detect if a type changed its type', () => { + const oldSchema = buildSchema(` + scalar TypeWasScalarBecomesEnum + interface TypeWasInterfaceBecomesUnion + type TypeWasObjectBecomesInputObject + `); + + const newSchema = buildSchema(` + enum TypeWasScalarBecomesEnum + union TypeWasInterfaceBecomesUnion + input TypeWasObjectBecomesInputObject + `); + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.TYPE_CHANGED_KIND, + description: + 'TypeWasScalarBecomesEnum changed from a Scalar type to an Enum type.', + }, + { + type: BreakingChangeType.TYPE_CHANGED_KIND, + description: + 'TypeWasInterfaceBecomesUnion changed from an Interface type to a Union type.', + }, + { + type: BreakingChangeType.TYPE_CHANGED_KIND, + description: + 'TypeWasObjectBecomesInputObject changed from an Object type to an Input type.', + }, + ]); + }); + + it('should detect if a field on a type was deleted or changed type', () => { + const oldSchema = buildSchema(` + type TypeA + type TypeB + + interface Type1 { + field1: TypeA + field2: String + field3: String + field4: TypeA + field6: String + field7: [String] + field8: Int + field9: Int! + field10: [Int]! + field11: Int + field12: [Int] + field13: [Int!] + field14: [Int] + field15: [[Int]] + field16: Int! + field17: [Int] + field18: [[Int!]!] + } + `); + + const newSchema = buildSchema(` + type TypeA + type TypeB + + interface Type1 { + field1: TypeA + field3: Boolean + field4: TypeB + field5: String + field6: [String] + field7: String + field8: Int! + field9: Int + field10: [Int] + field11: [Int]! + field12: [Int!] + field13: [Int] + field14: [[Int]] + field15: [Int] + field16: [Int]! + field17: [Int]! + field18: [[Int!]] + } + `); + + const changes = findBreakingChanges(oldSchema, newSchema); + expect(changes).to.deep.equal([ + { + type: BreakingChangeType.FIELD_REMOVED, + description: 'Type1.field2 was removed.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Type1.field3 changed type from String to Boolean.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Type1.field4 changed type from TypeA to TypeB.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Type1.field6 changed type from String to [String].', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Type1.field7 changed type from [String] to String.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Type1.field9 changed type from Int! to Int.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Type1.field10 changed type from [Int]! to [Int].', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Type1.field11 changed type from Int to [Int]!.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Type1.field13 changed type from [Int!] to [Int].', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Type1.field14 changed type from [Int] to [[Int]].', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Type1.field15 changed type from [[Int]] to [Int].', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Type1.field16 changed type from Int! to [Int]!.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'Type1.field18 changed type from [[Int!]!] to [[Int!]].', + }, + ]); + }); + + it('should detect if fields on input types changed kind or were removed', () => { + const oldSchema = buildSchema(` + input InputType1 { + field1: String + field2: Boolean + field3: [String] + field4: String! + field5: String + field6: [Int] + field7: [Int]! + field8: Int + field9: [Int] + field10: [Int!] + field11: [Int] + field12: [[Int]] + field13: Int! + field14: [[Int]!] + field15: [[Int]!] + } + `); + + const newSchema = buildSchema(` + input InputType1 { + field1: Int + field3: String + field4: String + field5: String! + field6: [Int]! + field7: [Int] + field8: [Int]! + field9: [Int!] + field10: [Int] + field11: [[Int]] + field12: [Int] + field13: [Int]! + field14: [[Int]] + field15: [[Int!]!] + } + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.FIELD_REMOVED, + description: 'InputType1.field2 was removed.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'InputType1.field1 changed type from String to Int.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'InputType1.field3 changed type from [String] to String.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'InputType1.field5 changed type from String to String!.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'InputType1.field6 changed type from [Int] to [Int]!.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'InputType1.field8 changed type from Int to [Int]!.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'InputType1.field9 changed type from [Int] to [Int!].', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'InputType1.field11 changed type from [Int] to [[Int]].', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'InputType1.field12 changed type from [[Int]] to [Int].', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: 'InputType1.field13 changed type from Int! to [Int]!.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: + 'InputType1.field15 changed type from [[Int]!] to [[Int!]!].', + }, + ]); + }); + + it('should detect if a required field is added to an input type', () => { + const oldSchema = buildSchema(` + input InputType1 { + field1: String + } + `); + + const newSchema = buildSchema(` + input InputType1 { + field1: String + requiredField: Int! + optionalField1: Boolean + optionalField2: Boolean! = false + } + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED, + description: + 'A required field requiredField on input type InputType1 was added.', + }, + ]); + }); + + it('should detect if a type was removed from a union type', () => { + const oldSchema = buildSchema(` + type Type1 + type Type2 + type Type3 + + union UnionType1 = Type1 | Type2 + `); + const newSchema = buildSchema(` + type Type1 + type Type2 + type Type3 + + union UnionType1 = Type1 | Type3 + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, + description: 'Type2 was removed from union type UnionType1.', + }, + ]); + }); + + it('should detect if a value was removed from an enum type', () => { + const oldSchema = buildSchema(` + enum EnumType1 { + VALUE0 + VALUE1 + VALUE2 + } + `); + + const newSchema = buildSchema(` + enum EnumType1 { + VALUE0 + VALUE2 + VALUE3 + } + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, + description: 'VALUE1 was removed from enum type EnumType1.', + }, + ]); + }); + + it('should detect if a field argument was removed', () => { + const oldSchema = buildSchema(` + interface Interface1 { + field1(arg1: Boolean, objectArg: String): String + } + + type Type1 { + field1(name: String): String + } + `); + + const newSchema = buildSchema(` + interface Interface1 { + field1: String + } + + type Type1 { + field1: String + } + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.ARG_REMOVED, + description: 'Interface1.field1 arg arg1 was removed.', + }, + { + type: BreakingChangeType.ARG_REMOVED, + description: 'Interface1.field1 arg objectArg was removed.', + }, + { + type: BreakingChangeType.ARG_REMOVED, + description: 'Type1.field1 arg name was removed.', + }, + ]); + }); + + it('should detect if a field argument has changed type', () => { + const oldSchema = buildSchema(` + type Type1 { + field1( + arg1: String + arg2: String + arg3: [String] + arg4: String + arg5: String! + arg6: String! + arg7: [Int]! + arg8: Int + arg9: [Int] + arg10: [Int!] + arg11: [Int] + arg12: [[Int]] + arg13: Int! + arg14: [[Int]!] + arg15: [[Int]!] + ): String + } + `); + + const newSchema = buildSchema(` + type Type1 { + field1( + arg1: Int + arg2: [String] + arg3: String + arg4: String! + arg5: Int + arg6: Int! + arg7: [Int] + arg8: [Int]! + arg9: [Int!] + arg10: [Int] + arg11: [[Int]] + arg12: [Int] + arg13: [Int]! + arg14: [[Int]] + arg15: [[Int!]!] + ): String + } + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'Type1.field1 arg arg1 has changed type from String to Int.', + }, + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'Type1.field1 arg arg2 has changed type from String to [String].', + }, + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'Type1.field1 arg arg3 has changed type from [String] to String.', + }, + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'Type1.field1 arg arg4 has changed type from String to String!.', + }, + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'Type1.field1 arg arg5 has changed type from String! to Int.', + }, + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'Type1.field1 arg arg6 has changed type from String! to Int!.', + }, + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'Type1.field1 arg arg8 has changed type from Int to [Int]!.', + }, + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'Type1.field1 arg arg9 has changed type from [Int] to [Int!].', + }, + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'Type1.field1 arg arg11 has changed type from [Int] to [[Int]].', + }, + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'Type1.field1 arg arg12 has changed type from [[Int]] to [Int].', + }, + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'Type1.field1 arg arg13 has changed type from Int! to [Int]!.', + }, + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'Type1.field1 arg arg15 has changed type from [[Int]!] to [[Int!]!].', + }, + ]); + }); + + it('should detect if a required field argument was added', () => { + const oldSchema = buildSchema(` + type Type1 { + field1(arg1: String): String + } + `); + + const newSchema = buildSchema(` + type Type1 { + field1( + arg1: String, + newRequiredArg: String! + newOptionalArg1: Int + newOptionalArg2: Int! = 0 + ): String + } + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.REQUIRED_ARG_ADDED, + description: 'A required arg newRequiredArg on Type1.field1 was added.', + }, + ]); + }); + + it('should not flag args with the same type signature as breaking', () => { + const oldSchema = buildSchema(` + input InputType1 { + field1: String + } + + type Type1 { + field1(arg1: Int!, arg2: InputType1): Int + } + `); + + const newSchema = buildSchema(` + input InputType1 { + field1: String + } + + type Type1 { + field1(arg1: Int!, arg2: InputType1): Int + } + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([]); + }); + + it('should consider args that move away from NonNull as non-breaking', () => { + const oldSchema = buildSchema(` + type Type1 { + field1(name: String!): String + } + `); + + const newSchema = buildSchema(` + type Type1 { + field1(name: String): String + } + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([]); + }); + + it('should detect interfaces removed from types', () => { + const oldSchema = buildSchema(` + interface Interface1 + + type Type1 implements Interface1 + `); + + const newSchema = buildSchema(` + interface Interface1 + + type Type1 + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, + description: 'Type1 no longer implements interface Interface1.', + }, + ]); + }); + + it('should detect interfaces removed from interfaces', () => { + const oldSchema = buildSchema(` + interface Interface1 + + interface Interface2 implements Interface1 + `); + + const newSchema = buildSchema(` + interface Interface1 + + interface Interface2 + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, + description: 'Interface2 no longer implements interface Interface1.', + }, + ]); + }); + + it('should ignore changes in order of interfaces', () => { + const oldSchema = buildSchema(` + interface FirstInterface + interface SecondInterface + + type Type1 implements FirstInterface & SecondInterface + `); + + const newSchema = buildSchema(` + interface FirstInterface + interface SecondInterface + + type Type1 implements SecondInterface & FirstInterface + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([]); + }); + + it('should detect all breaking changes', () => { + const oldSchema = buildSchema(` + directive @DirectiveThatIsRemoved on FIELD_DEFINITION + + directive @DirectiveThatRemovesArg(arg1: String) on FIELD_DEFINITION + + directive @NonNullDirectiveAdded on FIELD_DEFINITION + + directive @DirectiveThatWasRepeatable repeatable on FIELD_DEFINITION + + directive @DirectiveName on FIELD_DEFINITION | QUERY + + type ArgThatChanges { + field1(id: Float): String + } + + enum EnumTypeThatLosesAValue { + VALUE0 + VALUE1 + VALUE2 + } + + interface Interface1 + type TypeThatLooseInterface1 implements Interface1 + + type TypeInUnion1 + type TypeInUnion2 + union UnionTypeThatLosesAType = TypeInUnion1 | TypeInUnion2 + + type TypeThatChangesType + + type TypeThatGetsRemoved + + interface TypeThatHasBreakingFieldChanges { + field1: String + field2: String + } + `); + + const newSchema = buildSchema(` + directive @DirectiveThatRemovesArg on FIELD_DEFINITION + + directive @NonNullDirectiveAdded(arg1: Boolean!) on FIELD_DEFINITION + + directive @DirectiveThatWasRepeatable on FIELD_DEFINITION + + directive @DirectiveName on FIELD_DEFINITION + + type ArgThatChanges { + field1(id: String): String + } + + enum EnumTypeThatLosesAValue { + VALUE1 + VALUE2 + } + + interface Interface1 + type TypeThatLooseInterface1 + + type TypeInUnion1 + type TypeInUnion2 + union UnionTypeThatLosesAType = TypeInUnion1 + + interface TypeThatChangesType + + interface TypeThatHasBreakingFieldChanges { + field2: Boolean + } + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.TYPE_REMOVED, + description: + 'Standard scalar Float was removed because it is not referenced anymore.', + }, + { + type: BreakingChangeType.TYPE_REMOVED, + description: 'TypeThatGetsRemoved was removed.', + }, + { + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + 'ArgThatChanges.field1 arg id has changed type from Float to String.', + }, + { + type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, + description: + 'VALUE0 was removed from enum type EnumTypeThatLosesAValue.', + }, + { + type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, + description: + 'TypeThatLooseInterface1 no longer implements interface Interface1.', + }, + { + type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, + description: + 'TypeInUnion2 was removed from union type UnionTypeThatLosesAType.', + }, + { + type: BreakingChangeType.TYPE_CHANGED_KIND, + description: + 'TypeThatChangesType changed from an Object type to an Interface type.', + }, + { + type: BreakingChangeType.FIELD_REMOVED, + description: 'TypeThatHasBreakingFieldChanges.field1 was removed.', + }, + { + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: + 'TypeThatHasBreakingFieldChanges.field2 changed type from String to Boolean.', + }, + { + type: BreakingChangeType.DIRECTIVE_REMOVED, + description: 'DirectiveThatIsRemoved was removed.', + }, + { + type: BreakingChangeType.DIRECTIVE_ARG_REMOVED, + description: 'arg1 was removed from DirectiveThatRemovesArg.', + }, + { + type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, + description: + 'A required arg arg1 on directive NonNullDirectiveAdded was added.', + }, + { + type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED, + description: + 'Repeatable flag was removed from DirectiveThatWasRepeatable.', + }, + { + type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED, + description: 'QUERY was removed from DirectiveName.', + }, + ]); + }); + + it('should detect if a directive was explicitly removed', () => { + const oldSchema = buildSchema(` + directive @DirectiveThatIsRemoved on FIELD_DEFINITION + directive @DirectiveThatStays on FIELD_DEFINITION + `); + + const newSchema = buildSchema(` + directive @DirectiveThatStays on FIELD_DEFINITION + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.DIRECTIVE_REMOVED, + description: 'DirectiveThatIsRemoved was removed.', + }, + ]); + }); + + it('should detect if a directive was implicitly removed', () => { + const oldSchema = new GraphQLSchema({}); + + const newSchema = new GraphQLSchema({ + directives: [ + GraphQLSkipDirective, + GraphQLIncludeDirective, + GraphQLSpecifiedByDirective, + ], + }); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.DIRECTIVE_REMOVED, + description: `${GraphQLDeprecatedDirective.name} was removed.`, + }, + ]); + }); + + it('should detect if a directive argument was removed', () => { + const oldSchema = buildSchema(` + directive @DirectiveWithArg(arg1: String) on FIELD_DEFINITION + `); + + const newSchema = buildSchema(` + directive @DirectiveWithArg on FIELD_DEFINITION + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.DIRECTIVE_ARG_REMOVED, + description: 'arg1 was removed from DirectiveWithArg.', + }, + ]); + }); + + it('should detect if an optional directive argument was added', () => { + const oldSchema = buildSchema(` + directive @DirectiveName on FIELD_DEFINITION + `); + + const newSchema = buildSchema(` + directive @DirectiveName( + newRequiredArg: String! + newOptionalArg1: Int + newOptionalArg2: Int! = 0 + ) on FIELD_DEFINITION + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, + description: + 'A required arg newRequiredArg on directive DirectiveName was added.', + }, + ]); + }); + + it('should detect removal of repeatable flag', () => { + const oldSchema = buildSchema(` + directive @DirectiveName repeatable on OBJECT + `); + + const newSchema = buildSchema(` + directive @DirectiveName on OBJECT + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED, + description: 'Repeatable flag was removed from DirectiveName.', + }, + ]); + }); + + it('should detect locations removed from a directive', () => { + const oldSchema = buildSchema(` + directive @DirectiveName on FIELD_DEFINITION | QUERY + `); + + const newSchema = buildSchema(` + directive @DirectiveName on FIELD_DEFINITION + `); + + expect(findBreakingChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED, + description: 'QUERY was removed from DirectiveName.', + }, + ]); + }); +}); + +describe('findDangerousChanges', () => { + it('should detect if a defaultValue changed on an argument', () => { + const oldSDL = ` + input Input1 { + innerInputArray: [Input2] + } + + input Input2 { + arrayField: [Int] + } + + type Type1 { + field1( + withDefaultValue: String = "TO BE DELETED" + stringArg: String = "test" + emptyArray: [Int!] = [] + valueArray: [[String]] = [["a", "b"], ["c"]] + complexObject: Input1 = { + innerInputArray: [{ arrayField: [1, 2, 3] }] + } + ): String + } + `; + + const oldSchema = buildSchema(oldSDL); + const copyOfOldSchema = buildSchema(oldSDL); + expect(findDangerousChanges(oldSchema, copyOfOldSchema)).to.deep.equal([]); + + const newSchema = buildSchema(` + input Input1 { + innerInputArray: [Input2] + } + + input Input2 { + arrayField: [Int] + } + + type Type1 { + field1( + withDefaultValue: String + stringArg: String = "Test" + emptyArray: [Int!] = [7] + valueArray: [[String]] = [["b", "a"], ["d"]] + complexObject: Input1 = { + innerInputArray: [{ arrayField: [3, 2, 1] }] + } + ): String + } + `); + + expect(findDangerousChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: + 'Type1.field1 arg withDefaultValue defaultValue was removed.', + }, + { + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: + 'Type1.field1 arg stringArg has changed defaultValue from "test" to "Test".', + }, + { + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: + 'Type1.field1 arg emptyArray has changed defaultValue from [] to [7].', + }, + { + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: + 'Type1.field1 arg valueArray has changed defaultValue from [["a", "b"], ["c"]] to [["b", "a"], ["d"]].', + }, + { + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: + 'Type1.field1 arg complexObject has changed defaultValue from {innerInputArray: [{arrayField: [1, 2, 3]}]} to {innerInputArray: [{arrayField: [3, 2, 1]}]}.', + }, + ]); + }); + + it('should ignore changes in field order of defaultValue', () => { + const oldSchema = buildSchema(` + input Input1 { + a: String + b: String + c: String + } + + type Type1 { + field1( + arg1: Input1 = { a: "a", b: "b", c: "c" } + ): String + } + `); + + const newSchema = buildSchema(` + input Input1 { + a: String + b: String + c: String + } + + type Type1 { + field1( + arg1: Input1 = { c: "c", b: "b", a: "a" } + ): String + } + `); + + expect(findDangerousChanges(oldSchema, newSchema)).to.deep.equal([]); + }); + + it('should ignore changes in field definitions order', () => { + const oldSchema = buildSchema(` + input Input1 { + a: String + b: String + c: String + } + + type Type1 { + field1( + arg1: Input1 = { a: "a", b: "b", c: "c" } + ): String + } + `); + + const newSchema = buildSchema(` + input Input1 { + c: String + b: String + a: String + } + + type Type1 { + field1( + arg1: Input1 = { a: "a", b: "b", c: "c" } + ): String + } + `); + + expect(findDangerousChanges(oldSchema, newSchema)).to.deep.equal([]); + }); + + it('should detect if a value was added to an enum type', () => { + const oldSchema = buildSchema(` + enum EnumType1 { + VALUE0 + VALUE1 + } + `); + + const newSchema = buildSchema(` + enum EnumType1 { + VALUE0 + VALUE1 + VALUE2 + } + `); + + expect(findDangerousChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: DangerousChangeType.VALUE_ADDED_TO_ENUM, + description: 'VALUE2 was added to enum type EnumType1.', + }, + ]); + }); + + it('should detect interfaces added to types', () => { + const oldSchema = buildSchema(` + interface OldInterface + interface NewInterface + + type Type1 implements OldInterface + `); + + const newSchema = buildSchema(` + interface OldInterface + interface NewInterface + + type Type1 implements OldInterface & NewInterface + `); + + expect(findDangerousChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, + description: 'NewInterface added to interfaces implemented by Type1.', + }, + ]); + }); + + it('should detect interfaces added to interfaces', () => { + const oldSchema = buildSchema(` + interface OldInterface + interface NewInterface + + interface Interface1 implements OldInterface + `); + + const newSchema = buildSchema(` + interface OldInterface + interface NewInterface + + interface Interface1 implements OldInterface & NewInterface + `); + + expect(findDangerousChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, + description: + 'NewInterface added to interfaces implemented by Interface1.', + }, + ]); + }); + + it('should detect if a type was added to a union type', () => { + const oldSchema = buildSchema(` + type Type1 + type Type2 + + union UnionType1 = Type1 + `); + + const newSchema = buildSchema(` + type Type1 + type Type2 + + union UnionType1 = Type1 | Type2 + `); + + expect(findDangerousChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: DangerousChangeType.TYPE_ADDED_TO_UNION, + description: 'Type2 was added to union type UnionType1.', + }, + ]); + }); + + it('should detect if an optional field was added to an input', () => { + const oldSchema = buildSchema(` + input InputType1 { + field1: String + } + `); + + const newSchema = buildSchema(` + input InputType1 { + field1: String + field2: Int + } + `); + + expect(findDangerousChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED, + description: + 'An optional field field2 on input type InputType1 was added.', + }, + ]); + }); + + it('should find all dangerous changes', () => { + const oldSchema = buildSchema(` + enum EnumType1 { + VALUE0 + VALUE1 + } + + type Type1 { + field1(argThatChangesDefaultValue: String = "test"): String + } + + interface Interface1 + type TypeThatGainsInterface1 + + type TypeInUnion1 + union UnionTypeThatGainsAType = TypeInUnion1 + `); + + const newSchema = buildSchema(` + enum EnumType1 { + VALUE0 + VALUE1 + VALUE2 + } + + type Type1 { + field1(argThatChangesDefaultValue: String = "Test"): String + } + + interface Interface1 + type TypeThatGainsInterface1 implements Interface1 + + type TypeInUnion1 + type TypeInUnion2 + union UnionTypeThatGainsAType = TypeInUnion1 | TypeInUnion2 + `); + + expect(findDangerousChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: DangerousChangeType.VALUE_ADDED_TO_ENUM, + description: 'VALUE2 was added to enum type EnumType1.', + }, + { + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: + 'Type1.field1 arg argThatChangesDefaultValue has changed defaultValue from "test" to "Test".', + }, + { + type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, + description: + 'Interface1 added to interfaces implemented by TypeThatGainsInterface1.', + }, + { + type: DangerousChangeType.TYPE_ADDED_TO_UNION, + description: + 'TypeInUnion2 was added to union type UnionTypeThatGainsAType.', + }, + ]); + }); + + it('should detect if an optional field argument was added', () => { + const oldSchema = buildSchema(` + type Type1 { + field1(arg1: String): String + } + `); + + const newSchema = buildSchema(` + type Type1 { + field1(arg1: String, arg2: String): String + } + `); + + expect(findDangerousChanges(oldSchema, newSchema)).to.deep.equal([ + { + type: DangerousChangeType.OPTIONAL_ARG_ADDED, + description: 'An optional arg arg2 on Type1.field1 was added.', + }, + ]); + }); +}); diff --git a/src/utilities/__tests__/getIntrospectionQuery-test.ts b/src/utilities/__tests__/getIntrospectionQuery-test.ts new file mode 100644 index 00000000..e2f5595b --- /dev/null +++ b/src/utilities/__tests__/getIntrospectionQuery-test.ts @@ -0,0 +1,133 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { parse } from '../../language/parser'; + +import { validate } from '../../validation/validate'; + +import { buildSchema } from '../buildASTSchema'; +import type { IntrospectionOptions } from '../getIntrospectionQuery'; +import { getIntrospectionQuery } from '../getIntrospectionQuery'; + +const dummySchema = buildSchema(` + type Query { + dummy: String + } +`); + +function expectIntrospectionQuery(options?: IntrospectionOptions) { + const query = getIntrospectionQuery(options); + + const validationErrors = validate(dummySchema, parse(query)); + expect(validationErrors).to.deep.equal([]); + + return { + toMatch(name: string, times: number = 1): void { + const pattern = toRegExp(name); + + expect(query).to.match(pattern); + expect(query.match(pattern)).to.have.lengthOf(times); + }, + toNotMatch(name: string): void { + expect(query).to.not.match(toRegExp(name)); + }, + }; + + function toRegExp(name: string): RegExp { + return new RegExp('\\b' + name + '\\b', 'g'); + } +} + +describe('getIntrospectionQuery', () => { + it('skip all "description" fields', () => { + expectIntrospectionQuery().toMatch('description', 5); + + expectIntrospectionQuery({ descriptions: true }).toMatch('description', 5); + + expectIntrospectionQuery({ descriptions: false }).toNotMatch('description'); + }); + + it('include "isRepeatable" field on directives', () => { + expectIntrospectionQuery().toNotMatch('isRepeatable'); + + expectIntrospectionQuery({ directiveIsRepeatable: true }).toMatch( + 'isRepeatable', + ); + + expectIntrospectionQuery({ directiveIsRepeatable: false }).toNotMatch( + 'isRepeatable', + ); + }); + + it('include "description" field on schema', () => { + expectIntrospectionQuery().toMatch('description', 5); + + expectIntrospectionQuery({ schemaDescription: false }).toMatch( + 'description', + 5, + ); + expectIntrospectionQuery({ schemaDescription: true }).toMatch( + 'description', + 6, + ); + + expectIntrospectionQuery({ + descriptions: false, + schemaDescription: true, + }).toNotMatch('description'); + }); + + it('include "specifiedBy" field', () => { + expectIntrospectionQuery().toNotMatch('specifiedByURL'); + + expectIntrospectionQuery({ specifiedByUrl: true }).toMatch( + 'specifiedByURL', + ); + + expectIntrospectionQuery({ specifiedByUrl: false }).toNotMatch( + 'specifiedByURL', + ); + }); + + it('include "isDeprecated" field on input values', () => { + expectIntrospectionQuery().toMatch('isDeprecated', 2); + + expectIntrospectionQuery({ inputValueDeprecation: true }).toMatch( + 'isDeprecated', + 3, + ); + + expectIntrospectionQuery({ inputValueDeprecation: false }).toMatch( + 'isDeprecated', + 2, + ); + }); + + it('include "deprecationReason" field on input values', () => { + expectIntrospectionQuery().toMatch('deprecationReason', 2); + + expectIntrospectionQuery({ inputValueDeprecation: true }).toMatch( + 'deprecationReason', + 3, + ); + + expectIntrospectionQuery({ inputValueDeprecation: false }).toMatch( + 'deprecationReason', + 2, + ); + }); + + it('include deprecated input field and args', () => { + expectIntrospectionQuery().toMatch('includeDeprecated: true', 2); + + expectIntrospectionQuery({ inputValueDeprecation: true }).toMatch( + 'includeDeprecated: true', + 5, + ); + + expectIntrospectionQuery({ inputValueDeprecation: false }).toMatch( + 'includeDeprecated: true', + 2, + ); + }); +}); diff --git a/src/utilities/__tests__/getOperationAST-test.ts b/src/utilities/__tests__/getOperationAST-test.ts new file mode 100644 index 00000000..029dd770 --- /dev/null +++ b/src/utilities/__tests__/getOperationAST-test.ts @@ -0,0 +1,68 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { parse } from '../../language/parser'; + +import { getOperationAST } from '../getOperationAST'; + +describe('getOperationAST', () => { + it('Gets an operation from a simple document', () => { + const doc = parse('{ field }'); + expect(getOperationAST(doc)).to.equal(doc.definitions[0]); + }); + + it('Gets an operation from a document with named op (mutation)', () => { + const doc = parse('mutation Test { field }'); + expect(getOperationAST(doc)).to.equal(doc.definitions[0]); + }); + + it('Gets an operation from a document with named op (subscription)', () => { + const doc = parse('subscription Test { field }'); + expect(getOperationAST(doc)).to.equal(doc.definitions[0]); + }); + + it('Does not get missing operation', () => { + const doc = parse('type Foo { field: String }'); + expect(getOperationAST(doc)).to.equal(null); + }); + + it('Does not get ambiguous unnamed operation', () => { + const doc = parse(` + { field } + mutation Test { field } + subscription TestSub { field } + `); + expect(getOperationAST(doc)).to.equal(null); + }); + + it('Does not get ambiguous named operation', () => { + const doc = parse(` + query TestQ { field } + mutation TestM { field } + subscription TestS { field } + `); + expect(getOperationAST(doc)).to.equal(null); + }); + + it('Does not get misnamed operation', () => { + const doc = parse(` + { field } + + query TestQ { field } + mutation TestM { field } + subscription TestS { field } + `); + expect(getOperationAST(doc, 'Unknown')).to.equal(null); + }); + + it('Gets named operation', () => { + const doc = parse(` + query TestQ { field } + mutation TestM { field } + subscription TestS { field } + `); + expect(getOperationAST(doc, 'TestQ')).to.equal(doc.definitions[0]); + expect(getOperationAST(doc, 'TestM')).to.equal(doc.definitions[1]); + expect(getOperationAST(doc, 'TestS')).to.equal(doc.definitions[2]); + }); +}); diff --git a/src/utilities/__tests__/getOperationRootType-test.ts b/src/utilities/__tests__/getOperationRootType-test.ts new file mode 100644 index 00000000..ce683a5a --- /dev/null +++ b/src/utilities/__tests__/getOperationRootType-test.ts @@ -0,0 +1,159 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { invariant } from '../../jsutils/invariant'; + +import type { DocumentNode, OperationDefinitionNode } from '../../language/ast'; +import { Kind } from '../../language/kinds'; +import { parse } from '../../language/parser'; + +import { GraphQLObjectType } from '../../type/definition'; +import { GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { getOperationRootType } from '../getOperationRootType'; + +const queryType = new GraphQLObjectType({ + name: 'FooQuery', + fields: () => ({ + field: { type: GraphQLString }, + }), +}); + +const mutationType = new GraphQLObjectType({ + name: 'FooMutation', + fields: () => ({ + field: { type: GraphQLString }, + }), +}); + +const subscriptionType = new GraphQLObjectType({ + name: 'FooSubscription', + fields: () => ({ + field: { type: GraphQLString }, + }), +}); + +function getOperationNode(doc: DocumentNode): OperationDefinitionNode { + const operationNode = doc.definitions[0]; + invariant(operationNode.kind === Kind.OPERATION_DEFINITION); + return operationNode; +} + +describe('Deprecated - getOperationRootType', () => { + it('Gets a Query type for an unnamed OperationDefinitionNode', () => { + const testSchema = new GraphQLSchema({ + query: queryType, + }); + const doc = parse('{ field }'); + const operationNode = getOperationNode(doc); + expect(getOperationRootType(testSchema, operationNode)).to.equal(queryType); + }); + + it('Gets a Query type for an named OperationDefinitionNode', () => { + const testSchema = new GraphQLSchema({ + query: queryType, + }); + + const doc = parse('query Q { field }'); + const operationNode = getOperationNode(doc); + expect(getOperationRootType(testSchema, operationNode)).to.equal(queryType); + }); + + it('Gets a type for OperationTypeDefinitionNodes', () => { + const testSchema = new GraphQLSchema({ + query: queryType, + mutation: mutationType, + subscription: subscriptionType, + }); + + const doc = parse(` + schema { + query: FooQuery + mutation: FooMutation + subscription: FooSubscription + } + `); + + const schemaNode = doc.definitions[0]; + invariant(schemaNode.kind === Kind.SCHEMA_DEFINITION); + const [queryNode, mutationNode, subscriptionNode] = + schemaNode.operationTypes; + + expect(getOperationRootType(testSchema, queryNode)).to.equal(queryType); + expect(getOperationRootType(testSchema, mutationNode)).to.equal( + mutationType, + ); + expect(getOperationRootType(testSchema, subscriptionNode)).to.equal( + subscriptionType, + ); + }); + + it('Gets a Mutation type for an OperationDefinitionNode', () => { + const testSchema = new GraphQLSchema({ + mutation: mutationType, + }); + + const doc = parse('mutation { field }'); + const operationNode = getOperationNode(doc); + expect(getOperationRootType(testSchema, operationNode)).to.equal( + mutationType, + ); + }); + + it('Gets a Subscription type for an OperationDefinitionNode', () => { + const testSchema = new GraphQLSchema({ + subscription: subscriptionType, + }); + + const doc = parse('subscription { field }'); + const operationNode = getOperationNode(doc); + expect(getOperationRootType(testSchema, operationNode)).to.equal( + subscriptionType, + ); + }); + + it('Throws when query type not defined in schema', () => { + const testSchema = new GraphQLSchema({}); + + const doc = parse('query { field }'); + const operationNode = getOperationNode(doc); + expect(() => getOperationRootType(testSchema, operationNode)).to.throw( + 'Schema does not define the required query root type.', + ); + }); + + it('Throws when mutation type not defined in schema', () => { + const testSchema = new GraphQLSchema({}); + + const doc = parse('mutation { field }'); + const operationNode = getOperationNode(doc); + expect(() => getOperationRootType(testSchema, operationNode)).to.throw( + 'Schema is not configured for mutations.', + ); + }); + + it('Throws when subscription type not defined in schema', () => { + const testSchema = new GraphQLSchema({}); + + const doc = parse('subscription { field }'); + const operationNode = getOperationNode(doc); + expect(() => getOperationRootType(testSchema, operationNode)).to.throw( + 'Schema is not configured for subscriptions.', + ); + }); + + it('Throws when operation not a valid operation kind', () => { + const testSchema = new GraphQLSchema({}); + const doc = parse('{ field }'); + const operationNode: OperationDefinitionNode = { + ...getOperationNode(doc), + // @ts-expect-error + operation: 'non_existent_operation', + }; + + expect(() => getOperationRootType(testSchema, operationNode)).to.throw( + 'Can only have query, mutation and subscription operations.', + ); + }); +}); diff --git a/src/utilities/__tests__/introspectionFromSchema-test.ts b/src/utilities/__tests__/introspectionFromSchema-test.ts new file mode 100644 index 00000000..2ba66348 --- /dev/null +++ b/src/utilities/__tests__/introspectionFromSchema-test.ts @@ -0,0 +1,66 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; + +import { GraphQLObjectType } from '../../type/definition'; +import { GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { buildClientSchema } from '../buildClientSchema'; +import type { IntrospectionQuery } from '../getIntrospectionQuery'; +import { introspectionFromSchema } from '../introspectionFromSchema'; +import { printSchema } from '../printSchema'; + +function introspectionToSDL(introspection: IntrospectionQuery): string { + return printSchema(buildClientSchema(introspection)); +} + +describe('introspectionFromSchema', () => { + const schema = new GraphQLSchema({ + description: 'This is a simple schema', + query: new GraphQLObjectType({ + name: 'Simple', + description: 'This is a simple type', + fields: { + string: { + type: GraphQLString, + description: 'This is a string field', + }, + }, + }), + }); + + it('converts a simple schema', () => { + const introspection = introspectionFromSchema(schema); + + expect(introspectionToSDL(introspection)).to.deep.equal(dedent` + """This is a simple schema""" + schema { + query: Simple + } + + """This is a simple type""" + type Simple { + """This is a string field""" + string: String + } + `); + }); + + it('converts a simple schema without descriptions', () => { + const introspection = introspectionFromSchema(schema, { + descriptions: false, + }); + + expect(introspectionToSDL(introspection)).to.deep.equal(dedent` + schema { + query: Simple + } + + type Simple { + string: String + } + `); + }); +}); diff --git a/src/utilities/__tests__/lexicographicSortSchema-test.ts b/src/utilities/__tests__/lexicographicSortSchema-test.ts new file mode 100644 index 00000000..bce12e3a --- /dev/null +++ b/src/utilities/__tests__/lexicographicSortSchema-test.ts @@ -0,0 +1,359 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; + +import { buildSchema } from '../buildASTSchema'; +import { lexicographicSortSchema } from '../lexicographicSortSchema'; +import { printSchema } from '../printSchema'; + +function sortSDL(sdl: string): string { + const schema = buildSchema(sdl); + return printSchema(lexicographicSortSchema(schema)); +} + +describe('lexicographicSortSchema', () => { + it('sort fields', () => { + const sorted = sortSDL(` + input Bar { + barB: String! + barA: String + barC: [String] + } + + interface FooInterface { + fooB: String! + fooA: String + fooC: [String] + } + + type FooType implements FooInterface { + fooC: [String] + fooA: String + fooB: String! + } + + type Query { + dummy(arg: Bar): FooType + } + `); + + expect(sorted).to.equal(dedent` + input Bar { + barA: String + barB: String! + barC: [String] + } + + interface FooInterface { + fooA: String + fooB: String! + fooC: [String] + } + + type FooType implements FooInterface { + fooA: String + fooB: String! + fooC: [String] + } + + type Query { + dummy(arg: Bar): FooType + } + `); + }); + + it('sort implemented interfaces', () => { + const sorted = sortSDL(` + interface FooA { + dummy: String + } + + interface FooB { + dummy: String + } + + interface FooC implements FooB & FooA { + dummy: String + } + + type Query implements FooB & FooA & FooC { + dummy: String + } + `); + + expect(sorted).to.equal(dedent` + interface FooA { + dummy: String + } + + interface FooB { + dummy: String + } + + interface FooC implements FooA & FooB { + dummy: String + } + + type Query implements FooA & FooB & FooC { + dummy: String + } + `); + }); + + it('sort types in union', () => { + const sorted = sortSDL(` + type FooA { + dummy: String + } + + type FooB { + dummy: String + } + + type FooC { + dummy: String + } + + union FooUnion = FooB | FooA | FooC + + type Query { + dummy: FooUnion + } + `); + + expect(sorted).to.equal(dedent` + type FooA { + dummy: String + } + + type FooB { + dummy: String + } + + type FooC { + dummy: String + } + + union FooUnion = FooA | FooB | FooC + + type Query { + dummy: FooUnion + } + `); + }); + + it('sort enum values', () => { + const sorted = sortSDL(` + enum Foo { + B + C + A + } + + type Query { + dummy: Foo + } + `); + + expect(sorted).to.equal(dedent` + enum Foo { + A + B + C + } + + type Query { + dummy: Foo + } + `); + }); + + it('sort field arguments', () => { + const sorted = sortSDL(` + type Query { + dummy(argB: Int!, argA: String, argC: [Float]): ID + } + `); + + expect(sorted).to.equal(dedent` + type Query { + dummy(argA: String, argB: Int!, argC: [Float]): ID + } + `); + }); + + it('sort types', () => { + const sorted = sortSDL(` + type Query { + dummy(arg1: FooF, arg2: FooA, arg3: FooG): FooD + } + + type FooC implements FooE { + dummy: String + } + + enum FooG { + enumValue + } + + scalar FooA + + input FooF { + dummy: String + } + + union FooD = FooC | FooB + + interface FooE { + dummy: String + } + + type FooB { + dummy: String + } + `); + + expect(sorted).to.equal(dedent` + scalar FooA + + type FooB { + dummy: String + } + + type FooC implements FooE { + dummy: String + } + + union FooD = FooB | FooC + + interface FooE { + dummy: String + } + + input FooF { + dummy: String + } + + enum FooG { + enumValue + } + + type Query { + dummy(arg1: FooF, arg2: FooA, arg3: FooG): FooD + } + `); + }); + + it('sort directive arguments', () => { + const sorted = sortSDL(` + directive @test(argC: Float, argA: String, argB: Int) on FIELD + + type Query { + dummy: String + } + `); + + expect(sorted).to.equal(dedent` + directive @test(argA: String, argB: Int, argC: Float) on FIELD + + type Query { + dummy: String + } + `); + }); + + it('sort directive locations', () => { + const sorted = sortSDL(` + directive @test(argC: Float, argA: String, argB: Int) on UNION | FIELD | ENUM + + type Query { + dummy: String + } + `); + + expect(sorted).to.equal(dedent` + directive @test(argA: String, argB: Int, argC: Float) on ENUM | FIELD | UNION + + type Query { + dummy: String + } + `); + }); + + it('sort directives', () => { + const sorted = sortSDL(` + directive @fooC on FIELD + + directive @fooB on UNION + + directive @fooA on ENUM + + type Query { + dummy: String + } + `); + + expect(sorted).to.equal(dedent` + directive @fooA on ENUM + + directive @fooB on UNION + + directive @fooC on FIELD + + type Query { + dummy: String + } + `); + }); + + it('sort recursive types', () => { + const sorted = sortSDL(` + interface FooC { + fooB: FooB + fooA: FooA + fooC: FooC + } + + type FooB implements FooC { + fooB: FooB + fooA: FooA + } + + type FooA implements FooC { + fooB: FooB + fooA: FooA + } + + type Query { + fooC: FooC + fooB: FooB + fooA: FooA + } + `); + + expect(sorted).to.equal(dedent` + type FooA implements FooC { + fooA: FooA + fooB: FooB + } + + type FooB implements FooC { + fooA: FooA + fooB: FooB + } + + interface FooC { + fooA: FooA + fooB: FooB + fooC: FooC + } + + type Query { + fooA: FooA + fooB: FooB + fooC: FooC + } + `); + }); +}); diff --git a/src/utilities/__tests__/printSchema-test.ts b/src/utilities/__tests__/printSchema-test.ts new file mode 100644 index 00000000..84f30fc0 --- /dev/null +++ b/src/utilities/__tests__/printSchema-test.ts @@ -0,0 +1,850 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent, dedentString } from '../../__testUtils__/dedent'; + +import { DirectiveLocation } from '../../language/directiveLocation'; + +import type { GraphQLFieldConfig } from '../../type/definition'; +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLScalarType, + GraphQLUnionType, +} from '../../type/definition'; +import { GraphQLDirective } from '../../type/directives'; +import { GraphQLBoolean, GraphQLInt, GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../buildASTSchema'; +import { printIntrospectionSchema, printSchema } from '../printSchema'; + +function expectPrintedSchema(schema: GraphQLSchema) { + const schemaText = printSchema(schema); + // keep printSchema and buildSchema in sync + expect(printSchema(buildSchema(schemaText))).to.equal(schemaText); + return expect(schemaText); +} + +function buildSingleFieldSchema( + fieldConfig: GraphQLFieldConfig, +) { + const Query = new GraphQLObjectType({ + name: 'Query', + fields: { singleField: fieldConfig }, + }); + return new GraphQLSchema({ query: Query }); +} + +describe('Type System Printer', () => { + it('Prints String Field', () => { + const schema = buildSingleFieldSchema({ type: GraphQLString }); + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField: String + } + `); + }); + + it('Prints [String] Field', () => { + const schema = buildSingleFieldSchema({ + type: new GraphQLList(GraphQLString), + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField: [String] + } + `); + }); + + it('Prints String! Field', () => { + const schema = buildSingleFieldSchema({ + type: new GraphQLNonNull(GraphQLString), + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField: String! + } + `); + }); + + it('Prints [String]! Field', () => { + const schema = buildSingleFieldSchema({ + type: new GraphQLNonNull(new GraphQLList(GraphQLString)), + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField: [String]! + } + `); + }); + + it('Prints [String!] Field', () => { + const schema = buildSingleFieldSchema({ + type: new GraphQLList(new GraphQLNonNull(GraphQLString)), + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField: [String!] + } + `); + }); + + it('Prints [String!]! Field', () => { + const schema = buildSingleFieldSchema({ + type: new GraphQLNonNull( + new GraphQLList(new GraphQLNonNull(GraphQLString)), + ), + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField: [String!]! + } + `); + }); + + it('Print Object Field', () => { + const FooType = new GraphQLObjectType({ + name: 'Foo', + fields: { str: { type: GraphQLString } }, + }); + const schema = new GraphQLSchema({ types: [FooType] }); + + expectPrintedSchema(schema).to.equal(dedent` + type Foo { + str: String + } + `); + }); + + it('Prints String Field With Int Arg', () => { + const schema = buildSingleFieldSchema({ + type: GraphQLString, + args: { argOne: { type: GraphQLInt } }, + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField(argOne: Int): String + } + `); + }); + + it('Prints String Field With Int Arg With Default', () => { + const schema = buildSingleFieldSchema({ + type: GraphQLString, + args: { argOne: { type: GraphQLInt, defaultValue: 2 } }, + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField(argOne: Int = 2): String + } + `); + }); + + it('Prints String Field With String Arg With Default', () => { + const schema = buildSingleFieldSchema({ + type: GraphQLString, + args: { argOne: { type: GraphQLString, defaultValue: 'tes\t de\fault' } }, + }); + + expectPrintedSchema(schema).to.equal( + dedentString(String.raw` + type Query { + singleField(argOne: String = "tes\t de\fault"): String + } + `), + ); + }); + + it('Prints String Field With Int Arg With Default Null', () => { + const schema = buildSingleFieldSchema({ + type: GraphQLString, + args: { argOne: { type: GraphQLInt, defaultValue: null } }, + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField(argOne: Int = null): String + } + `); + }); + + it('Prints String Field With Int! Arg', () => { + const schema = buildSingleFieldSchema({ + type: GraphQLString, + args: { argOne: { type: new GraphQLNonNull(GraphQLInt) } }, + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField(argOne: Int!): String + } + `); + }); + + it('Prints String Field With Multiple Args', () => { + const schema = buildSingleFieldSchema({ + type: GraphQLString, + args: { + argOne: { type: GraphQLInt }, + argTwo: { type: GraphQLString }, + }, + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField(argOne: Int, argTwo: String): String + } + `); + }); + + it('Prints String Field With Multiple Args, First is Default', () => { + const schema = buildSingleFieldSchema({ + type: GraphQLString, + args: { + argOne: { type: GraphQLInt, defaultValue: 1 }, + argTwo: { type: GraphQLString }, + argThree: { type: GraphQLBoolean }, + }, + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField(argOne: Int = 1, argTwo: String, argThree: Boolean): String + } + `); + }); + + it('Prints String Field With Multiple Args, Second is Default', () => { + const schema = buildSingleFieldSchema({ + type: GraphQLString, + args: { + argOne: { type: GraphQLInt }, + argTwo: { type: GraphQLString, defaultValue: 'foo' }, + argThree: { type: GraphQLBoolean }, + }, + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField(argOne: Int, argTwo: String = "foo", argThree: Boolean): String + } + `); + }); + + it('Prints String Field With Multiple Args, Last is Default', () => { + const schema = buildSingleFieldSchema({ + type: GraphQLString, + args: { + argOne: { type: GraphQLInt }, + argTwo: { type: GraphQLString }, + argThree: { type: GraphQLBoolean, defaultValue: false }, + }, + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + singleField(argOne: Int, argTwo: String, argThree: Boolean = false): String + } + `); + }); + + it('Prints schema with description', () => { + const schema = new GraphQLSchema({ + description: 'Schema description.', + query: new GraphQLObjectType({ name: 'Query', fields: {} }), + }); + + expectPrintedSchema(schema).to.equal(dedent` + """Schema description.""" + schema { + query: Query + } + + type Query + `); + }); + + it('Prints custom query root types', () => { + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ name: 'CustomType', fields: {} }), + }); + + expectPrintedSchema(schema).to.equal(dedent` + schema { + query: CustomType + } + + type CustomType + `); + }); + + it('Prints custom mutation root types', () => { + const schema = new GraphQLSchema({ + mutation: new GraphQLObjectType({ name: 'CustomType', fields: {} }), + }); + + expectPrintedSchema(schema).to.equal(dedent` + schema { + mutation: CustomType + } + + type CustomType + `); + }); + + it('Prints custom subscription root types', () => { + const schema = new GraphQLSchema({ + subscription: new GraphQLObjectType({ name: 'CustomType', fields: {} }), + }); + + expectPrintedSchema(schema).to.equal(dedent` + schema { + subscription: CustomType + } + + type CustomType + `); + }); + + it('Print Interface', () => { + const FooType = new GraphQLInterfaceType({ + name: 'Foo', + fields: { str: { type: GraphQLString } }, + }); + + const BarType = new GraphQLObjectType({ + name: 'Bar', + fields: { str: { type: GraphQLString } }, + interfaces: [FooType], + }); + + const schema = new GraphQLSchema({ types: [BarType] }); + expectPrintedSchema(schema).to.equal(dedent` + type Bar implements Foo { + str: String + } + + interface Foo { + str: String + } + `); + }); + + it('Print Multiple Interface', () => { + const FooType = new GraphQLInterfaceType({ + name: 'Foo', + fields: { str: { type: GraphQLString } }, + }); + + const BazType = new GraphQLInterfaceType({ + name: 'Baz', + fields: { int: { type: GraphQLInt } }, + }); + + const BarType = new GraphQLObjectType({ + name: 'Bar', + fields: { + str: { type: GraphQLString }, + int: { type: GraphQLInt }, + }, + interfaces: [FooType, BazType], + }); + + const schema = new GraphQLSchema({ types: [BarType] }); + expectPrintedSchema(schema).to.equal(dedent` + type Bar implements Foo & Baz { + str: String + int: Int + } + + interface Foo { + str: String + } + + interface Baz { + int: Int + } + `); + }); + + it('Print Hierarchical Interface', () => { + const FooType = new GraphQLInterfaceType({ + name: 'Foo', + fields: { str: { type: GraphQLString } }, + }); + + const BazType = new GraphQLInterfaceType({ + name: 'Baz', + interfaces: [FooType], + fields: { + int: { type: GraphQLInt }, + str: { type: GraphQLString }, + }, + }); + + const BarType = new GraphQLObjectType({ + name: 'Bar', + fields: { + str: { type: GraphQLString }, + int: { type: GraphQLInt }, + }, + interfaces: [FooType, BazType], + }); + + const Query = new GraphQLObjectType({ + name: 'Query', + fields: { bar: { type: BarType } }, + }); + + const schema = new GraphQLSchema({ query: Query, types: [BarType] }); + expectPrintedSchema(schema).to.equal(dedent` + type Bar implements Foo & Baz { + str: String + int: Int + } + + interface Foo { + str: String + } + + interface Baz implements Foo { + int: Int + str: String + } + + type Query { + bar: Bar + } + `); + }); + + it('Print Unions', () => { + const FooType = new GraphQLObjectType({ + name: 'Foo', + fields: { + bool: { type: GraphQLBoolean }, + }, + }); + + const BarType = new GraphQLObjectType({ + name: 'Bar', + fields: { + str: { type: GraphQLString }, + }, + }); + + const SingleUnion = new GraphQLUnionType({ + name: 'SingleUnion', + types: [FooType], + }); + + const MultipleUnion = new GraphQLUnionType({ + name: 'MultipleUnion', + types: [FooType, BarType], + }); + + const schema = new GraphQLSchema({ types: [SingleUnion, MultipleUnion] }); + expectPrintedSchema(schema).to.equal(dedent` + union SingleUnion = Foo + + type Foo { + bool: Boolean + } + + union MultipleUnion = Foo | Bar + + type Bar { + str: String + } + `); + }); + + it('Print Input Type', () => { + const InputType = new GraphQLInputObjectType({ + name: 'InputType', + fields: { + int: { type: GraphQLInt }, + }, + }); + + const schema = new GraphQLSchema({ types: [InputType] }); + expectPrintedSchema(schema).to.equal(dedent` + input InputType { + int: Int + } + `); + }); + + it('Custom Scalar', () => { + const OddType = new GraphQLScalarType({ name: 'Odd' }); + + const schema = new GraphQLSchema({ types: [OddType] }); + expectPrintedSchema(schema).to.equal(dedent` + scalar Odd + `); + }); + + it('Custom Scalar with specifiedByURL', () => { + const FooType = new GraphQLScalarType({ + name: 'Foo', + specifiedByURL: 'https://example.com/foo_spec', + }); + + const schema = new GraphQLSchema({ types: [FooType] }); + expectPrintedSchema(schema).to.equal(dedent` + scalar Foo @specifiedBy(url: "https://example.com/foo_spec") + `); + }); + + it('Enum', () => { + const RGBType = new GraphQLEnumType({ + name: 'RGB', + values: { + RED: {}, + GREEN: {}, + BLUE: {}, + }, + }); + + const schema = new GraphQLSchema({ types: [RGBType] }); + expectPrintedSchema(schema).to.equal(dedent` + enum RGB { + RED + GREEN + BLUE + } + `); + }); + + it('Prints empty types', () => { + const schema = new GraphQLSchema({ + types: [ + new GraphQLEnumType({ name: 'SomeEnum', values: {} }), + new GraphQLInputObjectType({ name: 'SomeInputObject', fields: {} }), + new GraphQLInterfaceType({ name: 'SomeInterface', fields: {} }), + new GraphQLObjectType({ name: 'SomeObject', fields: {} }), + new GraphQLUnionType({ name: 'SomeUnion', types: [] }), + ], + }); + + expectPrintedSchema(schema).to.equal(dedent` + enum SomeEnum + + input SomeInputObject + + interface SomeInterface + + type SomeObject + + union SomeUnion + `); + }); + + it('Prints custom directives', () => { + const SimpleDirective = new GraphQLDirective({ + name: 'simpleDirective', + locations: [DirectiveLocation.FIELD], + }); + const ComplexDirective = new GraphQLDirective({ + name: 'complexDirective', + description: 'Complex Directive', + args: { + stringArg: { type: GraphQLString }, + intArg: { type: GraphQLInt, defaultValue: -1 }, + }, + isRepeatable: true, + locations: [DirectiveLocation.FIELD, DirectiveLocation.QUERY], + }); + + const schema = new GraphQLSchema({ + directives: [SimpleDirective, ComplexDirective], + }); + expectPrintedSchema(schema).to.equal(dedent` + directive @simpleDirective on FIELD + + """Complex Directive""" + directive @complexDirective(stringArg: String, intArg: Int = -1) repeatable on FIELD | QUERY + `); + }); + + it('Prints an empty description', () => { + const schema = buildSingleFieldSchema({ + type: GraphQLString, + description: '', + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + """""" + singleField: String + } + `); + }); + + it('Prints an description with only whitespace', () => { + const schema = buildSingleFieldSchema({ + type: GraphQLString, + description: ' ', + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + " " + singleField: String + } + `); + }); + + it('One-line prints a short description', () => { + const schema = buildSingleFieldSchema({ + type: GraphQLString, + description: 'This field is awesome', + }); + + expectPrintedSchema(schema).to.equal(dedent` + type Query { + """This field is awesome""" + singleField: String + } + `); + }); + + it('Print Introspection Schema', () => { + const schema = new GraphQLSchema({}); + const output = printIntrospectionSchema(schema); + + expect(output).to.equal(dedent` + """ + Directs the executor to include this field or fragment only when the \`if\` argument is true. + """ + directive @include( + """Included when true.""" + if: Boolean! + ) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + """ + Directs the executor to skip this field or fragment when the \`if\` argument is true. + """ + directive @skip( + """Skipped when true.""" + if: Boolean! + ) on FIELD | FRAGMENT_SPREAD | INLINE_FRAGMENT + + """Marks an element of a GraphQL schema as no longer supported.""" + directive @deprecated( + """ + Explains why this element was deprecated, usually also including a suggestion for how to access supported similar data. Formatted using the Markdown syntax, as specified by [CommonMark](https://commonmark.org/). + """ + reason: String = "No longer supported" + ) on FIELD_DEFINITION | ARGUMENT_DEFINITION | INPUT_FIELD_DEFINITION | ENUM_VALUE + + """Exposes a URL that specifies the behavior of this scalar.""" + directive @specifiedBy( + """The URL that specifies the behavior of this scalar.""" + url: String! + ) on SCALAR + + """ + A GraphQL Schema defines the capabilities of a GraphQL server. It exposes all available types and directives on the server, as well as the entry points for query, mutation, and subscription operations. + """ + type __Schema { + description: String + + """A list of all types supported by this server.""" + types: [__Type!]! + + """The type that query operations will be rooted at.""" + queryType: __Type! + + """ + If this server supports mutation, the type that mutation operations will be rooted at. + """ + mutationType: __Type + + """ + If this server support subscription, the type that subscription operations will be rooted at. + """ + subscriptionType: __Type + + """A list of all directives supported by this server.""" + directives: [__Directive!]! + } + + """ + The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the \`__TypeKind\` enum. + + Depending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional \`specifiedByURL\`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types. + """ + type __Type { + kind: __TypeKind! + name: String + description: String + specifiedByURL: String + fields(includeDeprecated: Boolean = false): [__Field!] + interfaces: [__Type!] + possibleTypes: [__Type!] + enumValues(includeDeprecated: Boolean = false): [__EnumValue!] + inputFields(includeDeprecated: Boolean = false): [__InputValue!] + ofType: __Type + } + + """An enum describing what kind of type a given \`__Type\` is.""" + enum __TypeKind { + """Indicates this type is a scalar.""" + SCALAR + + """ + Indicates this type is an object. \`fields\` and \`interfaces\` are valid fields. + """ + OBJECT + + """ + Indicates this type is an interface. \`fields\`, \`interfaces\`, and \`possibleTypes\` are valid fields. + """ + INTERFACE + + """Indicates this type is a union. \`possibleTypes\` is a valid field.""" + UNION + + """Indicates this type is an enum. \`enumValues\` is a valid field.""" + ENUM + + """ + Indicates this type is an input object. \`inputFields\` is a valid field. + """ + INPUT_OBJECT + + """Indicates this type is a list. \`ofType\` is a valid field.""" + LIST + + """Indicates this type is a non-null. \`ofType\` is a valid field.""" + NON_NULL + } + + """ + Object and Interface types are described by a list of Fields, each of which has a name, potentially a list of arguments, and a return type. + """ + type __Field { + name: String! + description: String + args(includeDeprecated: Boolean = false): [__InputValue!]! + type: __Type! + isDeprecated: Boolean! + deprecationReason: String + } + + """ + Arguments provided to Fields or Directives and the input fields of an InputObject are represented as Input Values which describe their type and optionally a default value. + """ + type __InputValue { + name: String! + description: String + type: __Type! + + """ + A GraphQL-formatted string representing the default value for this input value. + """ + defaultValue: String + isDeprecated: Boolean! + deprecationReason: String + } + + """ + One possible value for a given Enum. Enum values are unique values, not a placeholder for a string or numeric value. However an Enum value is returned in a JSON response as a string. + """ + type __EnumValue { + name: String! + description: String + isDeprecated: Boolean! + deprecationReason: String + } + + """ + A Directive provides a way to describe alternate runtime execution and type validation behavior in a GraphQL document. + + In some cases, you need to provide options to alter GraphQL's execution behavior in ways field arguments will not suffice, such as conditionally including or skipping a field. Directives provide this by describing additional information to the executor. + """ + type __Directive { + name: String! + description: String + isRepeatable: Boolean! + locations: [__DirectiveLocation!]! + args(includeDeprecated: Boolean = false): [__InputValue!]! + } + + """ + A Directive can be adjacent to many parts of the GraphQL language, a __DirectiveLocation describes one such possible adjacencies. + """ + enum __DirectiveLocation { + """Location adjacent to a query operation.""" + QUERY + + """Location adjacent to a mutation operation.""" + MUTATION + + """Location adjacent to a subscription operation.""" + SUBSCRIPTION + + """Location adjacent to a field.""" + FIELD + + """Location adjacent to a fragment definition.""" + FRAGMENT_DEFINITION + + """Location adjacent to a fragment spread.""" + FRAGMENT_SPREAD + + """Location adjacent to an inline fragment.""" + INLINE_FRAGMENT + + """Location adjacent to a variable definition.""" + VARIABLE_DEFINITION + + """Location adjacent to a schema definition.""" + SCHEMA + + """Location adjacent to a scalar definition.""" + SCALAR + + """Location adjacent to an object type definition.""" + OBJECT + + """Location adjacent to a field definition.""" + FIELD_DEFINITION + + """Location adjacent to an argument definition.""" + ARGUMENT_DEFINITION + + """Location adjacent to an interface definition.""" + INTERFACE + + """Location adjacent to a union definition.""" + UNION + + """Location adjacent to an enum definition.""" + ENUM + + """Location adjacent to an enum value definition.""" + ENUM_VALUE + + """Location adjacent to an input object type definition.""" + INPUT_OBJECT + + """Location adjacent to an input object field definition.""" + INPUT_FIELD_DEFINITION + } + `); + }); +}); diff --git a/src/utilities/__tests__/separateOperations-test.ts b/src/utilities/__tests__/separateOperations-test.ts new file mode 100644 index 00000000..2f14bae9 --- /dev/null +++ b/src/utilities/__tests__/separateOperations-test.ts @@ -0,0 +1,258 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; + +import { mapValue } from '../../jsutils/mapValue'; + +import { parse } from '../../language/parser'; +import { print } from '../../language/printer'; + +import { separateOperations } from '../separateOperations'; + +describe('separateOperations', () => { + it('separates one AST into multiple, maintaining document order', () => { + const ast = parse(` + { + ...Y + ...X + } + + query One { + foo + bar + ...A + ...X + } + + fragment A on T { + field + ...B + } + + fragment X on T { + fieldX + } + + query Two { + ...A + ...Y + baz + } + + fragment Y on T { + fieldY + } + + fragment B on T { + something + } + `); + + const separatedASTs = mapValue(separateOperations(ast), print); + expect(separatedASTs).to.deep.equal({ + '': dedent` + { + ...Y + ...X + } + + fragment X on T { + fieldX + } + + fragment Y on T { + fieldY + } + `, + One: dedent` + query One { + foo + bar + ...A + ...X + } + + fragment A on T { + field + ...B + } + + fragment X on T { + fieldX + } + + fragment B on T { + something + } + `, + Two: dedent` + fragment A on T { + field + ...B + } + + query Two { + ...A + ...Y + baz + } + + fragment Y on T { + fieldY + } + + fragment B on T { + something + } + `, + }); + }); + + it('survives circular dependencies', () => { + const ast = parse(` + query One { + ...A + } + + fragment A on T { + ...B + } + + fragment B on T { + ...A + } + + query Two { + ...B + } + `); + + const separatedASTs = mapValue(separateOperations(ast), print); + expect(separatedASTs).to.deep.equal({ + One: dedent` + query One { + ...A + } + + fragment A on T { + ...B + } + + fragment B on T { + ...A + } + `, + Two: dedent` + fragment A on T { + ...B + } + + fragment B on T { + ...A + } + + query Two { + ...B + } + `, + }); + }); + + it('distinguish query and fragment names', () => { + const ast = parse(` + { + ...NameClash + } + + fragment NameClash on T { + oneField + } + + query NameClash { + ...ShouldBeSkippedInFirstQuery + } + + fragment ShouldBeSkippedInFirstQuery on T { + twoField + } + `); + + const separatedASTs = mapValue(separateOperations(ast), print); + expect(separatedASTs).to.deep.equal({ + '': dedent` + { + ...NameClash + } + + fragment NameClash on T { + oneField + } + `, + NameClash: dedent` + query NameClash { + ...ShouldBeSkippedInFirstQuery + } + + fragment ShouldBeSkippedInFirstQuery on T { + twoField + } + `, + }); + }); + + it('ignores type definitions', () => { + const ast = parse(` + query Foo { + ...Bar + } + + fragment Bar on T { + baz + } + + scalar Foo + type Bar + `); + + const separatedASTs = mapValue(separateOperations(ast), print); + expect(separatedASTs).to.deep.equal({ + Foo: dedent` + query Foo { + ...Bar + } + + fragment Bar on T { + baz + } + `, + }); + }); + + it('handles unknown fragments', () => { + const ast = parse(` + { + ...Unknown + ...Known + } + + fragment Known on T { + someField + } + `); + + const separatedASTs = mapValue(separateOperations(ast), print); + expect(separatedASTs).to.deep.equal({ + '': dedent` + { + ...Unknown + ...Known + } + + fragment Known on T { + someField + } + `, + }); + }); +}); diff --git a/src/utilities/__tests__/stripIgnoredCharacters-fuzz.ts b/src/utilities/__tests__/stripIgnoredCharacters-fuzz.ts new file mode 100644 index 00000000..29a22ed8 --- /dev/null +++ b/src/utilities/__tests__/stripIgnoredCharacters-fuzz.ts @@ -0,0 +1,51 @@ +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; +import { genFuzzStrings } from '../../__testUtils__/genFuzzStrings'; +import { inspectStr } from '../../__testUtils__/inspectStr'; + +import { invariant } from '../../jsutils/invariant'; + +import { Lexer } from '../../language/lexer'; +import { Source } from '../../language/source'; + +import { stripIgnoredCharacters } from '../stripIgnoredCharacters'; + +function lexValue(str: string) { + const lexer = new Lexer(new Source(str)); + const value = lexer.advance().value; + + invariant(lexer.advance().kind === '', 'Expected EOF'); + return value; +} + +describe('stripIgnoredCharacters', () => { + it('strips ignored characters inside random block strings', () => { + // Testing with length >7 is taking exponentially more time. However it is + // highly recommended to test with increased limit if you make any change. + for (const fuzzStr of genFuzzStrings({ + allowedChars: ['\n', '\t', ' ', '"', 'a', '\\'], + maxLength: 7, + })) { + const testStr = '"""' + fuzzStr + '"""'; + + let testValue; + try { + testValue = lexValue(testStr); + } catch (e) { + continue; // skip invalid values + } + + const strippedValue = lexValue(stripIgnoredCharacters(testStr)); + + invariant( + testValue === strippedValue, + dedent` + Expected lexValue(stripIgnoredCharacters(${inspectStr(testStr)})) + to equal ${inspectStr(testValue)} + but got ${inspectStr(strippedValue)} + `, + ); + } + }).timeout(20000); +}); diff --git a/src/utilities/__tests__/stripIgnoredCharacters-test.ts b/src/utilities/__tests__/stripIgnoredCharacters-test.ts new file mode 100644 index 00000000..4115742f --- /dev/null +++ b/src/utilities/__tests__/stripIgnoredCharacters-test.ts @@ -0,0 +1,446 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { dedent } from '../../__testUtils__/dedent'; +import { inspectStr } from '../../__testUtils__/inspectStr'; +import { kitchenSinkQuery } from '../../__testUtils__/kitchenSinkQuery'; +import { kitchenSinkSDL } from '../../__testUtils__/kitchenSinkSDL'; + +import { invariant } from '../../jsutils/invariant'; +import type { Maybe } from '../../jsutils/Maybe'; + +import { Lexer } from '../../language/lexer'; +import { parse } from '../../language/parser'; +import { Source } from '../../language/source'; + +import { stripIgnoredCharacters } from '../stripIgnoredCharacters'; + +const ignoredTokens = [ + // UnicodeBOM :: + '\uFEFF', // Byte Order Mark (U+FEFF) + + // WhiteSpace :: + '\t', // Horizontal Tab (U+0009) + ' ', // Space (U+0020) + + // LineTerminator :: + '\n', // "New Line (U+000A)" + '\r', // "Carriage Return (U+000D)" [ lookahead ! "New Line (U+000A)" ] + '\r\n', // "Carriage Return (U+000D)" "New Line (U+000A)" + + // Comment :: + '# "Comment" string\n', // `#` CommentChar* + + // Comma :: + ',', // , +]; + +const punctuatorTokens = [ + '!', + '$', + '(', + ')', + '...', + ':', + '=', + '@', + '[', + ']', + '{', + '|', + '}', +]; + +const nonPunctuatorTokens = [ + 'name_token', // Name + '1', // IntValue + '3.14', // FloatValue + '"some string value"', // StringValue + '"""block\nstring\nvalue"""', // StringValue(BlockString) +]; + +function lexValue(str: string): Maybe { + const lexer = new Lexer(new Source(str)); + const value = lexer.advance().value; + + invariant(lexer.advance().kind === '', 'Expected EOF'); + return value; +} + +function expectStripped(docString: string) { + return { + toEqual(expected: string): void { + const stripped = stripIgnoredCharacters(docString); + + invariant( + stripped === expected, + dedent` + Expected stripIgnoredCharacters(${inspectStr(docString)}) + to equal ${inspectStr(expected)} + but got ${inspectStr(stripped)} + `, + ); + + const strippedTwice = stripIgnoredCharacters(stripped); + + invariant( + stripped === strippedTwice, + dedent` + Expected stripIgnoredCharacters(${inspectStr(stripped)}) + to equal ${inspectStr(stripped)} + but got ${inspectStr(strippedTwice)} + `, + ); + }, + toStayTheSame(): void { + this.toEqual(docString); + }, + }; +} + +describe('stripIgnoredCharacters', () => { + it('strips ignored characters from GraphQL query document', () => { + const query = dedent` + query SomeQuery($foo: String!, $bar: String) { + someField(foo: $foo, bar: $bar) { + a + b { + c + d + } + } + } + `; + + expect(stripIgnoredCharacters(query)).to.equal( + 'query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}}', + ); + }); + + it('accepts Source object', () => { + expect(stripIgnoredCharacters(new Source('{ a }'))).to.equal('{a}'); + }); + + it('strips ignored characters from GraphQL SDL document', () => { + const sdl = dedent` + """ + Type description + """ + type Foo { + """ + Field description + """ + bar: String + } + `; + + expect(stripIgnoredCharacters(sdl)).to.equal( + '"""Type description""" type Foo{"""Field description""" bar:String}', + ); + }); + + it('report document with invalid token', () => { + let caughtError; + + try { + stripIgnoredCharacters('{ foo(arg: "\n"'); + } catch (e) { + caughtError = e; + } + + expect(String(caughtError)).to.equal(dedent` + Syntax Error: Unterminated string. + + GraphQL request:1:13 + 1 | { foo(arg: " + | ^ + 2 | " + `); + }); + + it('strips non-parsable document', () => { + expectStripped('{ foo(arg: "str"').toEqual('{foo(arg:"str"'); + }); + + it('strips documents with only ignored characters', () => { + expectStripped('\n').toEqual(''); + expectStripped(',').toEqual(''); + expectStripped(',,').toEqual(''); + expectStripped('#comment\n, \n').toEqual(''); + + for (const ignored of ignoredTokens) { + expectStripped(ignored).toEqual(''); + + for (const anotherIgnored of ignoredTokens) { + expectStripped(ignored + anotherIgnored).toEqual(''); + } + } + + expectStripped(ignoredTokens.join('')).toEqual(''); + }); + + it('strips leading and trailing ignored tokens', () => { + expectStripped('\n1').toEqual('1'); + expectStripped(',1').toEqual('1'); + expectStripped(',,1').toEqual('1'); + expectStripped('#comment\n, \n1').toEqual('1'); + + expectStripped('1\n').toEqual('1'); + expectStripped('1,').toEqual('1'); + expectStripped('1,,').toEqual('1'); + expectStripped('1#comment\n, \n').toEqual('1'); + + for (const token of [...punctuatorTokens, ...nonPunctuatorTokens]) { + for (const ignored of ignoredTokens) { + expectStripped(ignored + token).toEqual(token); + expectStripped(token + ignored).toEqual(token); + + for (const anotherIgnored of ignoredTokens) { + expectStripped(token + ignored + ignored).toEqual(token); + expectStripped(ignored + anotherIgnored + token).toEqual(token); + } + } + + expectStripped(ignoredTokens.join('') + token).toEqual(token); + expectStripped(token + ignoredTokens.join('')).toEqual(token); + } + }); + + it('strips ignored tokens between punctuator tokens', () => { + expectStripped('[,)').toEqual('[)'); + expectStripped('[\r)').toEqual('[)'); + expectStripped('[\r\r)').toEqual('[)'); + expectStripped('[\r,)').toEqual('[)'); + expectStripped('[,\n)').toEqual('[)'); + + for (const left of punctuatorTokens) { + for (const right of punctuatorTokens) { + for (const ignored of ignoredTokens) { + expectStripped(left + ignored + right).toEqual(left + right); + + for (const anotherIgnored of ignoredTokens) { + expectStripped(left + ignored + anotherIgnored + right).toEqual( + left + right, + ); + } + } + + expectStripped(left + ignoredTokens.join('') + right).toEqual( + left + right, + ); + } + } + }); + + it('strips ignored tokens between punctuator and non-punctuator tokens', () => { + expectStripped('[,1').toEqual('[1'); + expectStripped('[\r1').toEqual('[1'); + expectStripped('[\r\r1').toEqual('[1'); + expectStripped('[\r,1').toEqual('[1'); + expectStripped('[,\n1').toEqual('[1'); + + for (const nonPunctuator of nonPunctuatorTokens) { + for (const punctuator of punctuatorTokens) { + for (const ignored of ignoredTokens) { + expectStripped(punctuator + ignored + nonPunctuator).toEqual( + punctuator + nonPunctuator, + ); + + for (const anotherIgnored of ignoredTokens) { + expectStripped( + punctuator + ignored + anotherIgnored + nonPunctuator, + ).toEqual(punctuator + nonPunctuator); + } + } + + expectStripped( + punctuator + ignoredTokens.join('') + nonPunctuator, + ).toEqual(punctuator + nonPunctuator); + } + } + }); + + it('strips ignored tokens between non-punctuator and punctuator tokens', () => { + expectStripped('1,[').toEqual('1['); + expectStripped('1\r[').toEqual('1['); + expectStripped('1\r\r[').toEqual('1['); + expectStripped('1\r,[').toEqual('1['); + expectStripped('1,\n[').toEqual('1['); + + for (const nonPunctuator of nonPunctuatorTokens) { + for (const punctuator of punctuatorTokens) { + // Special case for that is handled in the below test + if (punctuator === '...') { + continue; + } + + for (const ignored of ignoredTokens) { + expectStripped(nonPunctuator + ignored + punctuator).toEqual( + nonPunctuator + punctuator, + ); + + for (const anotherIgnored of ignoredTokens) { + expectStripped( + nonPunctuator + ignored + anotherIgnored + punctuator, + ).toEqual(nonPunctuator + punctuator); + } + } + + expectStripped( + nonPunctuator + ignoredTokens.join('') + punctuator, + ).toEqual(nonPunctuator + punctuator); + } + } + }); + + it('replace ignored tokens between non-punctuator tokens and spread with space', () => { + expectStripped('a ...').toEqual('a ...'); + expectStripped('1 ...').toEqual('1 ...'); + expectStripped('1 ... ...').toEqual('1 ......'); + + for (const nonPunctuator of nonPunctuatorTokens) { + for (const ignored of ignoredTokens) { + expectStripped(nonPunctuator + ignored + '...').toEqual( + nonPunctuator + ' ...', + ); + + for (const anotherIgnored of ignoredTokens) { + expectStripped( + nonPunctuator + ignored + anotherIgnored + ' ...', + ).toEqual(nonPunctuator + ' ...'); + } + } + + expectStripped(nonPunctuator + ignoredTokens.join('') + '...').toEqual( + nonPunctuator + ' ...', + ); + } + }); + + it('replace ignored tokens between non-punctuator tokens with space', () => { + expectStripped('1 2').toStayTheSame(); + expectStripped('"" ""').toStayTheSame(); + expectStripped('a b').toStayTheSame(); + + expectStripped('a,1').toEqual('a 1'); + expectStripped('a,,1').toEqual('a 1'); + expectStripped('a 1').toEqual('a 1'); + expectStripped('a \t 1').toEqual('a 1'); + + for (const left of nonPunctuatorTokens) { + for (const right of nonPunctuatorTokens) { + for (const ignored of ignoredTokens) { + expectStripped(left + ignored + right).toEqual(left + ' ' + right); + + for (const anotherIgnored of ignoredTokens) { + expectStripped(left + ignored + anotherIgnored + right).toEqual( + left + ' ' + right, + ); + } + } + + expectStripped(left + ignoredTokens.join('') + right).toEqual( + left + ' ' + right, + ); + } + } + }); + + it('does not strip ignored tokens embedded in the string', () => { + expectStripped('" "').toStayTheSame(); + expectStripped('","').toStayTheSame(); + expectStripped('",,"').toStayTheSame(); + expectStripped('",|"').toStayTheSame(); + + for (const ignored of ignoredTokens) { + expectStripped(JSON.stringify(ignored)).toStayTheSame(); + + for (const anotherIgnored of ignoredTokens) { + expectStripped( + JSON.stringify(ignored + anotherIgnored), + ).toStayTheSame(); + } + } + + expectStripped(JSON.stringify(ignoredTokens.join(''))).toStayTheSame(); + }); + + it('does not strip ignored tokens embedded in the block string', () => { + expectStripped('""","""').toStayTheSame(); + expectStripped('""",,"""').toStayTheSame(); + expectStripped('""",|"""').toStayTheSame(); + + const ignoredTokensWithoutFormatting = ignoredTokens.filter( + (token) => !['\n', '\r', '\r\n', '\t', ' '].includes(token), + ); + for (const ignored of ignoredTokensWithoutFormatting) { + expectStripped('"""|' + ignored + '|"""').toStayTheSame(); + + for (const anotherIgnored of ignoredTokensWithoutFormatting) { + expectStripped( + '"""|' + ignored + anotherIgnored + '|"""', + ).toStayTheSame(); + } + } + + expectStripped( + '"""|' + ignoredTokensWithoutFormatting.join('') + '|"""', + ).toStayTheSame(); + }); + + it('strips ignored characters inside block strings', () => { + function expectStrippedString(blockStr: string) { + const originalValue = lexValue(blockStr); + const strippedValue = lexValue(stripIgnoredCharacters(blockStr)); + + invariant( + originalValue === strippedValue, + dedent` + Expected lexValue(stripIgnoredCharacters(${inspectStr(blockStr)})) + to equal ${inspectStr(originalValue)} + but got ${inspectStr(strippedValue)} + `, + ); + return expectStripped(blockStr); + } + + expectStrippedString('""""""').toStayTheSame(); + expectStrippedString('""" """').toEqual('""""""'); + + expectStrippedString('"""a"""').toStayTheSame(); + expectStrippedString('""" a"""').toEqual('""" a"""'); + expectStrippedString('""" a """').toEqual('""" a """'); + + expectStrippedString('"""\n"""').toEqual('""""""'); + expectStrippedString('"""a\nb"""').toEqual('"""a\nb"""'); + expectStrippedString('"""a\rb"""').toEqual('"""a\nb"""'); + expectStrippedString('"""a\r\nb"""').toEqual('"""a\nb"""'); + expectStrippedString('"""a\r\n\nb"""').toEqual('"""a\n\nb"""'); + + expectStrippedString('"""\\\n"""').toStayTheSame(); + expectStrippedString('""""\n"""').toStayTheSame(); + expectStrippedString('"""\\"""\n"""').toEqual('"""\\""""""'); + + expectStrippedString('"""\na\n b"""').toStayTheSame(); + expectStrippedString('"""\n a\n b"""').toEqual('"""a\nb"""'); + expectStrippedString('"""\na\n b\nc"""').toEqual('"""a\n b\nc"""'); + }); + + it('strips kitchen sink query but maintains the exact same AST', () => { + const strippedQuery = stripIgnoredCharacters(kitchenSinkQuery); + expect(stripIgnoredCharacters(strippedQuery)).to.equal(strippedQuery); + + const queryAST = parse(kitchenSinkQuery, { noLocation: true }); + const strippedAST = parse(strippedQuery, { noLocation: true }); + expect(strippedAST).to.deep.equal(queryAST); + }); + + it('strips kitchen sink SDL but maintains the exact same AST', () => { + const strippedSDL = stripIgnoredCharacters(kitchenSinkSDL); + expect(stripIgnoredCharacters(strippedSDL)).to.equal(strippedSDL); + + const sdlAST = parse(kitchenSinkSDL, { noLocation: true }); + const strippedAST = parse(strippedSDL, { noLocation: true }); + expect(strippedAST).to.deep.equal(sdlAST); + }); +}); diff --git a/src/utilities/__tests__/typeComparators-test.ts b/src/utilities/__tests__/typeComparators-test.ts new file mode 100644 index 00000000..f2709bf7 --- /dev/null +++ b/src/utilities/__tests__/typeComparators-test.ts @@ -0,0 +1,160 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import type { GraphQLFieldConfigMap } from '../../type/definition'; +import { + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLUnionType, +} from '../../type/definition'; +import { GraphQLFloat, GraphQLInt, GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { isEqualType, isTypeSubTypeOf } from '../typeComparators'; + +describe('typeComparators', () => { + describe('isEqualType', () => { + it('same reference are equal', () => { + expect(isEqualType(GraphQLString, GraphQLString)).to.equal(true); + }); + + it('int and float are not equal', () => { + expect(isEqualType(GraphQLInt, GraphQLFloat)).to.equal(false); + }); + + it('lists of same type are equal', () => { + expect( + isEqualType(new GraphQLList(GraphQLInt), new GraphQLList(GraphQLInt)), + ).to.equal(true); + }); + + it('lists is not equal to item', () => { + expect(isEqualType(new GraphQLList(GraphQLInt), GraphQLInt)).to.equal( + false, + ); + }); + + it('non-null of same type are equal', () => { + expect( + isEqualType( + new GraphQLNonNull(GraphQLInt), + new GraphQLNonNull(GraphQLInt), + ), + ).to.equal(true); + }); + + it('non-null is not equal to nullable', () => { + expect(isEqualType(new GraphQLNonNull(GraphQLInt), GraphQLInt)).to.equal( + false, + ); + }); + }); + + describe('isTypeSubTypeOf', () => { + function testSchema(fields: GraphQLFieldConfigMap) { + return new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields, + }), + }); + } + + it('same reference is subtype', () => { + const schema = testSchema({ field: { type: GraphQLString } }); + expect(isTypeSubTypeOf(schema, GraphQLString, GraphQLString)).to.equal( + true, + ); + }); + + it('int is not subtype of float', () => { + const schema = testSchema({ field: { type: GraphQLString } }); + expect(isTypeSubTypeOf(schema, GraphQLInt, GraphQLFloat)).to.equal(false); + }); + + it('non-null is subtype of nullable', () => { + const schema = testSchema({ field: { type: GraphQLString } }); + expect( + isTypeSubTypeOf(schema, new GraphQLNonNull(GraphQLInt), GraphQLInt), + ).to.equal(true); + }); + + it('nullable is not subtype of non-null', () => { + const schema = testSchema({ field: { type: GraphQLString } }); + expect( + isTypeSubTypeOf(schema, GraphQLInt, new GraphQLNonNull(GraphQLInt)), + ).to.equal(false); + }); + + it('item is not subtype of list', () => { + const schema = testSchema({ field: { type: GraphQLString } }); + expect( + isTypeSubTypeOf(schema, GraphQLInt, new GraphQLList(GraphQLInt)), + ).to.equal(false); + }); + + it('list is not subtype of item', () => { + const schema = testSchema({ field: { type: GraphQLString } }); + expect( + isTypeSubTypeOf(schema, new GraphQLList(GraphQLInt), GraphQLInt), + ).to.equal(false); + }); + + it('member is subtype of union', () => { + const member = new GraphQLObjectType({ + name: 'Object', + fields: { + field: { type: GraphQLString }, + }, + }); + const union = new GraphQLUnionType({ name: 'Union', types: [member] }); + const schema = testSchema({ field: { type: union } }); + expect(isTypeSubTypeOf(schema, member, union)).to.equal(true); + }); + + it('implementing object is subtype of interface', () => { + const iface = new GraphQLInterfaceType({ + name: 'Interface', + fields: { + field: { type: GraphQLString }, + }, + }); + const impl = new GraphQLObjectType({ + name: 'Object', + interfaces: [iface], + fields: { + field: { type: GraphQLString }, + }, + }); + const schema = testSchema({ field: { type: impl } }); + expect(isTypeSubTypeOf(schema, impl, iface)).to.equal(true); + }); + + it('implementing interface is subtype of interface', () => { + const iface = new GraphQLInterfaceType({ + name: 'Interface', + fields: { + field: { type: GraphQLString }, + }, + }); + const iface2 = new GraphQLInterfaceType({ + name: 'Interface2', + interfaces: [iface], + fields: { + field: { type: GraphQLString }, + }, + }); + const impl = new GraphQLObjectType({ + name: 'Object', + interfaces: [iface2, iface], + fields: { + field: { type: GraphQLString }, + }, + }); + const schema = testSchema({ field: { type: impl } }); + expect(isTypeSubTypeOf(schema, iface2, iface)).to.equal(true); + }); + }); +}); diff --git a/src/utilities/__tests__/valueFromAST-test.ts b/src/utilities/__tests__/valueFromAST-test.ts new file mode 100644 index 00000000..a01ed957 --- /dev/null +++ b/src/utilities/__tests__/valueFromAST-test.ts @@ -0,0 +1,265 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { identityFunc } from '../../jsutils/identityFunc'; +import { invariant } from '../../jsutils/invariant'; +import type { ObjMap } from '../../jsutils/ObjMap'; + +import { parseValue } from '../../language/parser'; + +import type { GraphQLInputType } from '../../type/definition'; +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLList, + GraphQLNonNull, + GraphQLScalarType, +} from '../../type/definition'; +import { + GraphQLBoolean, + GraphQLFloat, + GraphQLID, + GraphQLInt, + GraphQLString, +} from '../../type/scalars'; + +import { valueFromAST } from '../valueFromAST'; + +describe('valueFromAST', () => { + function expectValueFrom( + valueText: string, + type: GraphQLInputType, + variables?: ObjMap, + ) { + const ast = parseValue(valueText); + const value = valueFromAST(ast, type, variables); + return expect(value); + } + + it('rejects empty input', () => { + expect(valueFromAST(null, GraphQLBoolean)).to.deep.equal(undefined); + }); + + it('converts according to input coercion rules', () => { + expectValueFrom('true', GraphQLBoolean).to.equal(true); + expectValueFrom('false', GraphQLBoolean).to.equal(false); + expectValueFrom('123', GraphQLInt).to.equal(123); + expectValueFrom('123', GraphQLFloat).to.equal(123); + expectValueFrom('123.456', GraphQLFloat).to.equal(123.456); + expectValueFrom('"abc123"', GraphQLString).to.equal('abc123'); + expectValueFrom('123456', GraphQLID).to.equal('123456'); + expectValueFrom('"123456"', GraphQLID).to.equal('123456'); + }); + + it('does not convert when input coercion rules reject a value', () => { + expectValueFrom('123', GraphQLBoolean).to.equal(undefined); + expectValueFrom('123.456', GraphQLInt).to.equal(undefined); + expectValueFrom('true', GraphQLInt).to.equal(undefined); + expectValueFrom('"123"', GraphQLInt).to.equal(undefined); + expectValueFrom('"123"', GraphQLFloat).to.equal(undefined); + expectValueFrom('123', GraphQLString).to.equal(undefined); + expectValueFrom('true', GraphQLString).to.equal(undefined); + expectValueFrom('123.456', GraphQLString).to.equal(undefined); + }); + + it('convert using parseLiteral from a custom scalar type', () => { + const passthroughScalar = new GraphQLScalarType({ + name: 'PassthroughScalar', + parseLiteral(node) { + invariant(node.kind === 'StringValue'); + return node.value; + }, + parseValue: identityFunc, + }); + + expectValueFrom('"value"', passthroughScalar).to.equal('value'); + + const throwScalar = new GraphQLScalarType({ + name: 'ThrowScalar', + parseLiteral() { + throw new Error('Test'); + }, + parseValue: identityFunc, + }); + + expectValueFrom('value', throwScalar).to.equal(undefined); + + const returnUndefinedScalar = new GraphQLScalarType({ + name: 'ReturnUndefinedScalar', + parseLiteral() { + return undefined; + }, + parseValue: identityFunc, + }); + + expectValueFrom('value', returnUndefinedScalar).to.equal(undefined); + }); + + it('converts enum values according to input coercion rules', () => { + const testEnum = new GraphQLEnumType({ + name: 'TestColor', + values: { + RED: { value: 1 }, + GREEN: { value: 2 }, + BLUE: { value: 3 }, + NULL: { value: null }, + NAN: { value: NaN }, + NO_CUSTOM_VALUE: { value: undefined }, + }, + }); + + expectValueFrom('RED', testEnum).to.equal(1); + expectValueFrom('BLUE', testEnum).to.equal(3); + expectValueFrom('3', testEnum).to.equal(undefined); + expectValueFrom('"BLUE"', testEnum).to.equal(undefined); + expectValueFrom('null', testEnum).to.equal(null); + expectValueFrom('NULL', testEnum).to.equal(null); + expectValueFrom('NULL', new GraphQLNonNull(testEnum)).to.equal(null); + expectValueFrom('NAN', testEnum).to.deep.equal(NaN); + expectValueFrom('NO_CUSTOM_VALUE', testEnum).to.equal('NO_CUSTOM_VALUE'); + }); + + // Boolean! + const nonNullBool = new GraphQLNonNull(GraphQLBoolean); + // [Boolean] + const listOfBool = new GraphQLList(GraphQLBoolean); + // [Boolean!] + const listOfNonNullBool = new GraphQLList(nonNullBool); + // [Boolean]! + const nonNullListOfBool = new GraphQLNonNull(listOfBool); + // [Boolean!]! + const nonNullListOfNonNullBool = new GraphQLNonNull(listOfNonNullBool); + + it('coerces to null unless non-null', () => { + expectValueFrom('null', GraphQLBoolean).to.equal(null); + expectValueFrom('null', nonNullBool).to.equal(undefined); + }); + + it('coerces lists of values', () => { + expectValueFrom('true', listOfBool).to.deep.equal([true]); + expectValueFrom('123', listOfBool).to.equal(undefined); + expectValueFrom('null', listOfBool).to.equal(null); + expectValueFrom('[true, false]', listOfBool).to.deep.equal([true, false]); + expectValueFrom('[true, 123]', listOfBool).to.equal(undefined); + expectValueFrom('[true, null]', listOfBool).to.deep.equal([true, null]); + expectValueFrom('{ true: true }', listOfBool).to.equal(undefined); + }); + + it('coerces non-null lists of values', () => { + expectValueFrom('true', nonNullListOfBool).to.deep.equal([true]); + expectValueFrom('123', nonNullListOfBool).to.equal(undefined); + expectValueFrom('null', nonNullListOfBool).to.equal(undefined); + expectValueFrom('[true, false]', nonNullListOfBool).to.deep.equal([ + true, + false, + ]); + expectValueFrom('[true, 123]', nonNullListOfBool).to.equal(undefined); + expectValueFrom('[true, null]', nonNullListOfBool).to.deep.equal([ + true, + null, + ]); + }); + + it('coerces lists of non-null values', () => { + expectValueFrom('true', listOfNonNullBool).to.deep.equal([true]); + expectValueFrom('123', listOfNonNullBool).to.equal(undefined); + expectValueFrom('null', listOfNonNullBool).to.equal(null); + expectValueFrom('[true, false]', listOfNonNullBool).to.deep.equal([ + true, + false, + ]); + expectValueFrom('[true, 123]', listOfNonNullBool).to.equal(undefined); + expectValueFrom('[true, null]', listOfNonNullBool).to.equal(undefined); + }); + + it('coerces non-null lists of non-null values', () => { + expectValueFrom('true', nonNullListOfNonNullBool).to.deep.equal([true]); + expectValueFrom('123', nonNullListOfNonNullBool).to.equal(undefined); + expectValueFrom('null', nonNullListOfNonNullBool).to.equal(undefined); + expectValueFrom('[true, false]', nonNullListOfNonNullBool).to.deep.equal([ + true, + false, + ]); + expectValueFrom('[true, 123]', nonNullListOfNonNullBool).to.equal( + undefined, + ); + expectValueFrom('[true, null]', nonNullListOfNonNullBool).to.equal( + undefined, + ); + }); + + const testInputObj = new GraphQLInputObjectType({ + name: 'TestInput', + fields: { + int: { type: GraphQLInt, defaultValue: 42 }, + bool: { type: GraphQLBoolean }, + requiredBool: { type: nonNullBool }, + }, + }); + + it('coerces input objects according to input coercion rules', () => { + expectValueFrom('null', testInputObj).to.equal(null); + expectValueFrom('123', testInputObj).to.equal(undefined); + expectValueFrom('[]', testInputObj).to.equal(undefined); + expectValueFrom( + '{ int: 123, requiredBool: false }', + testInputObj, + ).to.deep.equal({ + int: 123, + requiredBool: false, + }); + expectValueFrom( + '{ bool: true, requiredBool: false }', + testInputObj, + ).to.deep.equal({ + int: 42, + bool: true, + requiredBool: false, + }); + expectValueFrom('{ int: true, requiredBool: true }', testInputObj).to.equal( + undefined, + ); + expectValueFrom('{ requiredBool: null }', testInputObj).to.equal(undefined); + expectValueFrom('{ bool: true }', testInputObj).to.equal(undefined); + }); + + it('accepts variable values assuming already coerced', () => { + expectValueFrom('$var', GraphQLBoolean, {}).to.equal(undefined); + expectValueFrom('$var', GraphQLBoolean, { var: true }).to.equal(true); + expectValueFrom('$var', GraphQLBoolean, { var: null }).to.equal(null); + expectValueFrom('$var', nonNullBool, { var: null }).to.equal(undefined); + }); + + it('asserts variables are provided as items in lists', () => { + expectValueFrom('[ $foo ]', listOfBool, {}).to.deep.equal([null]); + expectValueFrom('[ $foo ]', listOfNonNullBool, {}).to.equal(undefined); + expectValueFrom('[ $foo ]', listOfNonNullBool, { + foo: true, + }).to.deep.equal([true]); + // Note: variables are expected to have already been coerced, so we + // do not expect the singleton wrapping behavior for variables. + expectValueFrom('$foo', listOfNonNullBool, { foo: true }).to.equal(true); + expectValueFrom('$foo', listOfNonNullBool, { foo: [true] }).to.deep.equal([ + true, + ]); + }); + + it('omits input object fields for unprovided variables', () => { + expectValueFrom( + '{ int: $foo, bool: $foo, requiredBool: true }', + testInputObj, + {}, + ).to.deep.equal({ int: 42, requiredBool: true }); + + expectValueFrom('{ requiredBool: $foo }', testInputObj, {}).to.equal( + undefined, + ); + + expectValueFrom('{ requiredBool: $foo }', testInputObj, { + foo: true, + }).to.deep.equal({ + int: 42, + requiredBool: true, + }); + }); +}); diff --git a/src/utilities/__tests__/valueFromASTUntyped-test.ts b/src/utilities/__tests__/valueFromASTUntyped-test.ts new file mode 100644 index 00000000..9ad004c4 --- /dev/null +++ b/src/utilities/__tests__/valueFromASTUntyped-test.ts @@ -0,0 +1,67 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import type { Maybe } from '../../jsutils/Maybe'; +import type { ObjMap } from '../../jsutils/ObjMap'; + +import { parseValue } from '../../language/parser'; + +import { valueFromASTUntyped } from '../valueFromASTUntyped'; + +describe('valueFromASTUntyped', () => { + function expectValueFrom( + valueText: string, + variables?: Maybe>, + ) { + const ast = parseValue(valueText); + const value = valueFromASTUntyped(ast, variables); + return expect(value); + } + + it('parses simple values', () => { + expectValueFrom('null').to.equal(null); + expectValueFrom('true').to.equal(true); + expectValueFrom('false').to.equal(false); + expectValueFrom('123').to.equal(123); + expectValueFrom('123.456').to.equal(123.456); + expectValueFrom('"abc123"').to.equal('abc123'); + }); + + it('parses lists of values', () => { + expectValueFrom('[true, false]').to.deep.equal([true, false]); + expectValueFrom('[true, 123.45]').to.deep.equal([true, 123.45]); + expectValueFrom('[true, null]').to.deep.equal([true, null]); + expectValueFrom('[true, ["foo", 1.2]]').to.deep.equal([true, ['foo', 1.2]]); + }); + + it('parses input objects', () => { + expectValueFrom('{ int: 123, bool: false }').to.deep.equal({ + int: 123, + bool: false, + }); + expectValueFrom('{ foo: [ { bar: "baz"} ] }').to.deep.equal({ + foo: [{ bar: 'baz' }], + }); + }); + + it('parses enum values as plain strings', () => { + expectValueFrom('TEST_ENUM_VALUE').to.equal('TEST_ENUM_VALUE'); + expectValueFrom('[TEST_ENUM_VALUE]').to.deep.equal(['TEST_ENUM_VALUE']); + }); + + it('parses variables', () => { + expectValueFrom('$testVariable', { testVariable: 'foo' }).to.equal('foo'); + expectValueFrom('[$testVariable]', { testVariable: 'foo' }).to.deep.equal([ + 'foo', + ]); + expectValueFrom('{a:[$testVariable]}', { + testVariable: 'foo', + }).to.deep.equal({ a: ['foo'] }); + expectValueFrom('$testVariable', { testVariable: null }).to.equal(null); + expectValueFrom('$testVariable', { testVariable: NaN }).to.satisfy( + Number.isNaN, + ); + expectValueFrom('$testVariable', {}).to.equal(undefined); + expectValueFrom('$testVariable', null).to.equal(undefined); + }); +}); diff --git a/src/utilities/assertValidName.ts b/src/utilities/assertValidName.ts new file mode 100644 index 00000000..3e66461a --- /dev/null +++ b/src/utilities/assertValidName.ts @@ -0,0 +1,39 @@ +import { devAssert } from '../jsutils/devAssert'; + +import { GraphQLError } from '../error/GraphQLError'; + +import { assertName } from '../type/assertName'; + +/* c8 ignore start */ +/** + * Upholds the spec rules about naming. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ +export function assertValidName(name: string): string { + const error = isValidNameError(name); + if (error) { + throw error; + } + return name; +} + +/** + * Returns an Error if a name is invalid. + * @deprecated Please use `assertName` instead. Will be removed in v17 + */ +export function isValidNameError(name: string): GraphQLError | undefined { + devAssert(typeof name === 'string', 'Expected name to be a string.'); + + if (name.startsWith('__')) { + return new GraphQLError( + `Name "${name}" must not begin with "__", which is reserved by GraphQL introspection.`, + ); + } + + try { + assertName(name); + } catch (error) { + return error; + } +} +/* c8 ignore stop */ diff --git a/src/utilities/astFromValue.ts b/src/utilities/astFromValue.ts new file mode 100644 index 00000000..1a880449 --- /dev/null +++ b/src/utilities/astFromValue.ts @@ -0,0 +1,150 @@ +import { inspect } from '../jsutils/inspect'; +import { invariant } from '../jsutils/invariant'; +import { isIterableObject } from '../jsutils/isIterableObject'; +import { isObjectLike } from '../jsutils/isObjectLike'; +import type { Maybe } from '../jsutils/Maybe'; + +import type { ObjectFieldNode, ValueNode } from '../language/ast'; +import { Kind } from '../language/kinds'; + +import type { GraphQLInputType } from '../type/definition'; +import { + isEnumType, + isInputObjectType, + isLeafType, + isListType, + isNonNullType, +} from '../type/definition'; +import { GraphQLID } from '../type/scalars'; + +/** + * Produces a GraphQL Value AST given a JavaScript object. + * Function will match JavaScript/JSON values to GraphQL AST schema format + * by using suggested GraphQLInputType. For example: + * + * astFromValue("value", GraphQLString) + * + * A GraphQL type must be provided, which will be used to interpret different + * JavaScript values. + * + * | JSON Value | GraphQL Value | + * | ------------- | -------------------- | + * | Object | Input Object | + * | Array | List | + * | Boolean | Boolean | + * | String | String / Enum Value | + * | Number | Int / Float | + * | Unknown | Enum Value | + * | null | NullValue | + * + */ +export function astFromValue( + value: unknown, + type: GraphQLInputType, +): Maybe { + if (isNonNullType(type)) { + const astValue = astFromValue(value, type.ofType); + if (astValue?.kind === Kind.NULL) { + return null; + } + return astValue; + } + + // only explicit null, not undefined, NaN + if (value === null) { + return { kind: Kind.NULL }; + } + + // undefined + if (value === undefined) { + return null; + } + + // Convert JavaScript array to GraphQL list. If the GraphQLType is a list, but + // the value is not an array, convert the value using the list's item type. + if (isListType(type)) { + const itemType = type.ofType; + if (isIterableObject(value)) { + const valuesNodes = []; + for (const item of value) { + const itemNode = astFromValue(item, itemType); + if (itemNode != null) { + valuesNodes.push(itemNode); + } + } + return { kind: Kind.LIST, values: valuesNodes }; + } + return astFromValue(value, itemType); + } + + // Populate the fields of the input object by creating ASTs from each value + // in the JavaScript object according to the fields in the input type. + if (isInputObjectType(type)) { + if (!isObjectLike(value)) { + return null; + } + const fieldNodes: Array = []; + for (const field of Object.values(type.getFields())) { + const fieldValue = astFromValue(value[field.name], field.type); + if (fieldValue) { + fieldNodes.push({ + kind: Kind.OBJECT_FIELD, + name: { kind: Kind.NAME, value: field.name }, + value: fieldValue, + }); + } + } + return { kind: Kind.OBJECT, fields: fieldNodes }; + } + + if (isLeafType(type)) { + // Since value is an internally represented value, it must be serialized + // to an externally represented value before converting into an AST. + const serialized = type.serialize(value); + if (serialized == null) { + return null; + } + + // Others serialize based on their corresponding JavaScript scalar types. + if (typeof serialized === 'boolean') { + return { kind: Kind.BOOLEAN, value: serialized }; + } + + // JavaScript numbers can be Int or Float values. + if (typeof serialized === 'number' && Number.isFinite(serialized)) { + const stringNum = String(serialized); + return integerStringRegExp.test(stringNum) + ? { kind: Kind.INT, value: stringNum } + : { kind: Kind.FLOAT, value: stringNum }; + } + + if (typeof serialized === 'string') { + // Enum types use Enum literals. + if (isEnumType(type)) { + return { kind: Kind.ENUM, value: serialized }; + } + + // ID types can use Int literals. + if (type === GraphQLID && integerStringRegExp.test(serialized)) { + return { kind: Kind.INT, value: serialized }; + } + + return { + kind: Kind.STRING, + value: serialized, + }; + } + + throw new TypeError(`Cannot convert value to AST: ${inspect(serialized)}.`); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + invariant(false, 'Unexpected input type: ' + inspect(type)); +} + +/** + * IntValue: + * - NegativeSign? 0 + * - NegativeSign? NonZeroDigit ( Digit+ )? + */ +const integerStringRegExp = /^-?(?:0|[1-9][0-9]*)$/; diff --git a/src/utilities/buildASTSchema.ts b/src/utilities/buildASTSchema.ts new file mode 100644 index 00000000..eeff08e6 --- /dev/null +++ b/src/utilities/buildASTSchema.ts @@ -0,0 +1,111 @@ +import { devAssert } from '../jsutils/devAssert'; + +import type { DocumentNode } from '../language/ast'; +import { Kind } from '../language/kinds'; +import type { ParseOptions } from '../language/parser'; +import { parse } from '../language/parser'; +import type { Source } from '../language/source'; + +import { specifiedDirectives } from '../type/directives'; +import type { GraphQLSchemaValidationOptions } from '../type/schema'; +import { GraphQLSchema } from '../type/schema'; + +import { assertValidSDL } from '../validation/validate'; + +import { extendSchemaImpl } from './extendSchema'; + +export interface BuildSchemaOptions extends GraphQLSchemaValidationOptions { + /** + * Set to true to assume the SDL is valid. + * + * Default: false + */ + assumeValidSDL?: boolean; +} + +/** + * This takes the ast of a schema document produced by the parse function in + * src/language/parser.js. + * + * If no schema definition is provided, then it will look for types named Query, + * Mutation and Subscription. + * + * Given that AST it constructs a GraphQLSchema. The resulting schema + * has no resolve methods, so execution will use default resolvers. + */ +export function buildASTSchema( + documentAST: DocumentNode, + options?: BuildSchemaOptions, +): GraphQLSchema { + devAssert( + documentAST != null && documentAST.kind === Kind.DOCUMENT, + 'Must provide valid Document AST.', + ); + + if (options?.assumeValid !== true && options?.assumeValidSDL !== true) { + assertValidSDL(documentAST); + } + + const emptySchemaConfig = { + description: undefined, + types: [], + directives: [], + extensions: Object.create(null), + extensionASTNodes: [], + assumeValid: false, + }; + const config = extendSchemaImpl(emptySchemaConfig, documentAST, options); + + if (config.astNode == null) { + for (const type of config.types) { + switch (type.name) { + // Note: While this could make early assertions to get the correctly + // typed values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + case 'Query': + // @ts-expect-error validated in `validateSchema` + config.query = type; + break; + case 'Mutation': + // @ts-expect-error validated in `validateSchema` + config.mutation = type; + break; + case 'Subscription': + // @ts-expect-error validated in `validateSchema` + config.subscription = type; + break; + } + } + } + + const directives = [ + ...config.directives, + // If specified directives were not explicitly declared, add them. + ...specifiedDirectives.filter((stdDirective) => + config.directives.every( + (directive) => directive.name !== stdDirective.name, + ), + ), + ]; + + return new GraphQLSchema({ ...config, directives }); +} + +/** + * A helper function to build a GraphQLSchema directly from a source + * document. + */ +export function buildSchema( + source: string | Source, + options?: BuildSchemaOptions & ParseOptions, +): GraphQLSchema { + const document = parse(source, { + noLocation: options?.noLocation, + allowLegacyFragmentVariables: options?.allowLegacyFragmentVariables, + }); + + return buildASTSchema(document, { + assumeValidSDL: options?.assumeValidSDL, + assumeValid: options?.assumeValid, + }); +} diff --git a/src/utilities/buildClientSchema.ts b/src/utilities/buildClientSchema.ts new file mode 100644 index 00000000..18e6110b --- /dev/null +++ b/src/utilities/buildClientSchema.ts @@ -0,0 +1,406 @@ +import { devAssert } from '../jsutils/devAssert'; +import { inspect } from '../jsutils/inspect'; +import { isObjectLike } from '../jsutils/isObjectLike'; +import { keyValMap } from '../jsutils/keyValMap'; + +import { parseValue } from '../language/parser'; + +import type { + GraphQLFieldConfig, + GraphQLFieldConfigMap, + GraphQLNamedType, + GraphQLType, +} from '../type/definition'; +import { + assertInterfaceType, + assertNullableType, + assertObjectType, + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLScalarType, + GraphQLUnionType, + isInputType, + isOutputType, +} from '../type/definition'; +import { GraphQLDirective } from '../type/directives'; +import { introspectionTypes, TypeKind } from '../type/introspection'; +import { specifiedScalarTypes } from '../type/scalars'; +import type { GraphQLSchemaValidationOptions } from '../type/schema'; +import { GraphQLSchema } from '../type/schema'; + +import type { + IntrospectionDirective, + IntrospectionEnumType, + IntrospectionField, + IntrospectionInputObjectType, + IntrospectionInputValue, + IntrospectionInterfaceType, + IntrospectionNamedTypeRef, + IntrospectionObjectType, + IntrospectionQuery, + IntrospectionScalarType, + IntrospectionType, + IntrospectionTypeRef, + IntrospectionUnionType, +} from './getIntrospectionQuery'; +import { valueFromAST } from './valueFromAST'; + +/** + * Build a GraphQLSchema for use by client tools. + * + * Given the result of a client running the introspection query, creates and + * returns a GraphQLSchema instance which can be then used with all graphql-js + * tools, but cannot be used to execute a query, as introspection does not + * represent the "resolver", "parse" or "serialize" functions or any other + * server-internal mechanisms. + * + * This function expects a complete introspection result. Don't forget to check + * the "errors" field of a server response before calling this function. + */ +export function buildClientSchema( + introspection: IntrospectionQuery, + options?: GraphQLSchemaValidationOptions, +): GraphQLSchema { + devAssert( + isObjectLike(introspection) && isObjectLike(introspection.__schema), + `Invalid or incomplete introspection result. Ensure that you are passing "data" property of introspection response and no "errors" was returned alongside: ${inspect( + introspection, + )}.`, + ); + + // Get the schema from the introspection result. + const schemaIntrospection = introspection.__schema; + + // Iterate through all types, getting the type definition for each. + const typeMap = keyValMap( + schemaIntrospection.types, + (typeIntrospection) => typeIntrospection.name, + (typeIntrospection) => buildType(typeIntrospection), + ); + + // Include standard types only if they are used. + for (const stdType of [...specifiedScalarTypes, ...introspectionTypes]) { + if (typeMap[stdType.name]) { + typeMap[stdType.name] = stdType; + } + } + + // Get the root Query, Mutation, and Subscription types. + const queryType = schemaIntrospection.queryType + ? getObjectType(schemaIntrospection.queryType) + : null; + + const mutationType = schemaIntrospection.mutationType + ? getObjectType(schemaIntrospection.mutationType) + : null; + + const subscriptionType = schemaIntrospection.subscriptionType + ? getObjectType(schemaIntrospection.subscriptionType) + : null; + + // Get the directives supported by Introspection, assuming empty-set if + // directives were not queried for. + const directives = schemaIntrospection.directives + ? schemaIntrospection.directives.map(buildDirective) + : []; + + // Then produce and return a Schema with these types. + return new GraphQLSchema({ + description: schemaIntrospection.description, + query: queryType, + mutation: mutationType, + subscription: subscriptionType, + types: Object.values(typeMap), + directives, + assumeValid: options?.assumeValid, + }); + + // Given a type reference in introspection, return the GraphQLType instance. + // preferring cached instances before building new instances. + function getType(typeRef: IntrospectionTypeRef): GraphQLType { + if (typeRef.kind === TypeKind.LIST) { + const itemRef = typeRef.ofType; + if (!itemRef) { + throw new Error('Decorated type deeper than introspection query.'); + } + return new GraphQLList(getType(itemRef)); + } + if (typeRef.kind === TypeKind.NON_NULL) { + const nullableRef = typeRef.ofType; + if (!nullableRef) { + throw new Error('Decorated type deeper than introspection query.'); + } + const nullableType = getType(nullableRef); + return new GraphQLNonNull(assertNullableType(nullableType)); + } + return getNamedType(typeRef); + } + + function getNamedType(typeRef: IntrospectionNamedTypeRef): GraphQLNamedType { + const typeName = typeRef.name; + if (!typeName) { + throw new Error(`Unknown type reference: ${inspect(typeRef)}.`); + } + + const type = typeMap[typeName]; + if (!type) { + throw new Error( + `Invalid or incomplete schema, unknown type: ${typeName}. Ensure that a full introspection query is used in order to build a client schema.`, + ); + } + + return type; + } + + function getObjectType( + typeRef: IntrospectionNamedTypeRef, + ): GraphQLObjectType { + return assertObjectType(getNamedType(typeRef)); + } + + function getInterfaceType( + typeRef: IntrospectionNamedTypeRef, + ): GraphQLInterfaceType { + return assertInterfaceType(getNamedType(typeRef)); + } + + // Given a type's introspection result, construct the correct + // GraphQLType instance. + function buildType(type: IntrospectionType): GraphQLNamedType { + // eslint-disable-next-line @typescript-eslint/prefer-optional-chain + if (type != null && type.name != null && type.kind != null) { + // FIXME: Properly type IntrospectionType, it's a breaking change so fix in v17 + // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check + switch (type.kind) { + case TypeKind.SCALAR: + return buildScalarDef(type); + case TypeKind.OBJECT: + return buildObjectDef(type); + case TypeKind.INTERFACE: + return buildInterfaceDef(type); + case TypeKind.UNION: + return buildUnionDef(type); + case TypeKind.ENUM: + return buildEnumDef(type); + case TypeKind.INPUT_OBJECT: + return buildInputObjectDef(type); + } + } + const typeStr = inspect(type); + throw new Error( + `Invalid or incomplete introspection result. Ensure that a full introspection query is used in order to build a client schema: ${typeStr}.`, + ); + } + + function buildScalarDef( + scalarIntrospection: IntrospectionScalarType, + ): GraphQLScalarType { + return new GraphQLScalarType({ + name: scalarIntrospection.name, + description: scalarIntrospection.description, + specifiedByURL: scalarIntrospection.specifiedByURL, + }); + } + + function buildImplementationsList( + implementingIntrospection: + | IntrospectionObjectType + | IntrospectionInterfaceType, + ): Array { + // TODO: Temporary workaround until GraphQL ecosystem will fully support + // 'interfaces' on interface types. + if ( + implementingIntrospection.interfaces === null && + implementingIntrospection.kind === TypeKind.INTERFACE + ) { + return []; + } + + if (!implementingIntrospection.interfaces) { + const implementingIntrospectionStr = inspect(implementingIntrospection); + throw new Error( + `Introspection result missing interfaces: ${implementingIntrospectionStr}.`, + ); + } + + return implementingIntrospection.interfaces.map(getInterfaceType); + } + + function buildObjectDef( + objectIntrospection: IntrospectionObjectType, + ): GraphQLObjectType { + return new GraphQLObjectType({ + name: objectIntrospection.name, + description: objectIntrospection.description, + interfaces: () => buildImplementationsList(objectIntrospection), + fields: () => buildFieldDefMap(objectIntrospection), + }); + } + + function buildInterfaceDef( + interfaceIntrospection: IntrospectionInterfaceType, + ): GraphQLInterfaceType { + return new GraphQLInterfaceType({ + name: interfaceIntrospection.name, + description: interfaceIntrospection.description, + interfaces: () => buildImplementationsList(interfaceIntrospection), + fields: () => buildFieldDefMap(interfaceIntrospection), + }); + } + + function buildUnionDef( + unionIntrospection: IntrospectionUnionType, + ): GraphQLUnionType { + if (!unionIntrospection.possibleTypes) { + const unionIntrospectionStr = inspect(unionIntrospection); + throw new Error( + `Introspection result missing possibleTypes: ${unionIntrospectionStr}.`, + ); + } + return new GraphQLUnionType({ + name: unionIntrospection.name, + description: unionIntrospection.description, + types: () => unionIntrospection.possibleTypes.map(getObjectType), + }); + } + + function buildEnumDef( + enumIntrospection: IntrospectionEnumType, + ): GraphQLEnumType { + if (!enumIntrospection.enumValues) { + const enumIntrospectionStr = inspect(enumIntrospection); + throw new Error( + `Introspection result missing enumValues: ${enumIntrospectionStr}.`, + ); + } + return new GraphQLEnumType({ + name: enumIntrospection.name, + description: enumIntrospection.description, + values: keyValMap( + enumIntrospection.enumValues, + (valueIntrospection) => valueIntrospection.name, + (valueIntrospection) => ({ + description: valueIntrospection.description, + deprecationReason: valueIntrospection.deprecationReason, + }), + ), + }); + } + + function buildInputObjectDef( + inputObjectIntrospection: IntrospectionInputObjectType, + ): GraphQLInputObjectType { + if (!inputObjectIntrospection.inputFields) { + const inputObjectIntrospectionStr = inspect(inputObjectIntrospection); + throw new Error( + `Introspection result missing inputFields: ${inputObjectIntrospectionStr}.`, + ); + } + return new GraphQLInputObjectType({ + name: inputObjectIntrospection.name, + description: inputObjectIntrospection.description, + fields: () => buildInputValueDefMap(inputObjectIntrospection.inputFields), + }); + } + + function buildFieldDefMap( + typeIntrospection: IntrospectionObjectType | IntrospectionInterfaceType, + ): GraphQLFieldConfigMap { + if (!typeIntrospection.fields) { + throw new Error( + `Introspection result missing fields: ${inspect(typeIntrospection)}.`, + ); + } + + return keyValMap( + typeIntrospection.fields, + (fieldIntrospection) => fieldIntrospection.name, + buildField, + ); + } + + function buildField( + fieldIntrospection: IntrospectionField, + ): GraphQLFieldConfig { + const type = getType(fieldIntrospection.type); + if (!isOutputType(type)) { + const typeStr = inspect(type); + throw new Error( + `Introspection must provide output type for fields, but received: ${typeStr}.`, + ); + } + + if (!fieldIntrospection.args) { + const fieldIntrospectionStr = inspect(fieldIntrospection); + throw new Error( + `Introspection result missing field args: ${fieldIntrospectionStr}.`, + ); + } + + return { + description: fieldIntrospection.description, + deprecationReason: fieldIntrospection.deprecationReason, + type, + args: buildInputValueDefMap(fieldIntrospection.args), + }; + } + + function buildInputValueDefMap( + inputValueIntrospections: ReadonlyArray, + ) { + return keyValMap( + inputValueIntrospections, + (inputValue) => inputValue.name, + buildInputValue, + ); + } + + function buildInputValue(inputValueIntrospection: IntrospectionInputValue) { + const type = getType(inputValueIntrospection.type); + if (!isInputType(type)) { + const typeStr = inspect(type); + throw new Error( + `Introspection must provide input type for arguments, but received: ${typeStr}.`, + ); + } + + const defaultValue = + inputValueIntrospection.defaultValue != null + ? valueFromAST(parseValue(inputValueIntrospection.defaultValue), type) + : undefined; + return { + description: inputValueIntrospection.description, + type, + defaultValue, + deprecationReason: inputValueIntrospection.deprecationReason, + }; + } + + function buildDirective( + directiveIntrospection: IntrospectionDirective, + ): GraphQLDirective { + if (!directiveIntrospection.args) { + const directiveIntrospectionStr = inspect(directiveIntrospection); + throw new Error( + `Introspection result missing directive args: ${directiveIntrospectionStr}.`, + ); + } + if (!directiveIntrospection.locations) { + const directiveIntrospectionStr = inspect(directiveIntrospection); + throw new Error( + `Introspection result missing directive locations: ${directiveIntrospectionStr}.`, + ); + } + return new GraphQLDirective({ + name: directiveIntrospection.name, + description: directiveIntrospection.description, + isRepeatable: directiveIntrospection.isRepeatable, + locations: directiveIntrospection.locations.slice(), + args: buildInputValueDefMap(directiveIntrospection.args), + }); + } +} diff --git a/src/utilities/coerceInputValue.ts b/src/utilities/coerceInputValue.ts new file mode 100644 index 00000000..07883db8 --- /dev/null +++ b/src/utilities/coerceInputValue.ts @@ -0,0 +1,187 @@ +import { didYouMean } from '../jsutils/didYouMean'; +import { inspect } from '../jsutils/inspect'; +import { invariant } from '../jsutils/invariant'; +import { isIterableObject } from '../jsutils/isIterableObject'; +import { isObjectLike } from '../jsutils/isObjectLike'; +import type { Path } from '../jsutils/Path'; +import { addPath, pathToArray } from '../jsutils/Path'; +import { printPathArray } from '../jsutils/printPathArray'; +import { suggestionList } from '../jsutils/suggestionList'; + +import { GraphQLError } from '../error/GraphQLError'; + +import type { GraphQLInputType } from '../type/definition'; +import { + isInputObjectType, + isLeafType, + isListType, + isNonNullType, +} from '../type/definition'; + +type OnErrorCB = ( + path: ReadonlyArray, + invalidValue: unknown, + error: GraphQLError, +) => void; + +/** + * Coerces a JavaScript value given a GraphQL Input Type. + */ +export function coerceInputValue( + inputValue: unknown, + type: GraphQLInputType, + onError: OnErrorCB = defaultOnError, +): unknown { + return coerceInputValueImpl(inputValue, type, onError, undefined); +} + +function defaultOnError( + path: ReadonlyArray, + invalidValue: unknown, + error: GraphQLError, +): void { + let errorPrefix = 'Invalid value ' + inspect(invalidValue); + if (path.length > 0) { + errorPrefix += ` at "value${printPathArray(path)}"`; + } + error.message = errorPrefix + ': ' + error.message; + throw error; +} + +function coerceInputValueImpl( + inputValue: unknown, + type: GraphQLInputType, + onError: OnErrorCB, + path: Path | undefined, +): unknown { + if (isNonNullType(type)) { + if (inputValue != null) { + return coerceInputValueImpl(inputValue, type.ofType, onError, path); + } + onError( + pathToArray(path), + inputValue, + new GraphQLError( + `Expected non-nullable type "${inspect(type)}" not to be null.`, + ), + ); + return; + } + + if (inputValue == null) { + // Explicitly return the value null. + return null; + } + + if (isListType(type)) { + const itemType = type.ofType; + if (isIterableObject(inputValue)) { + return Array.from(inputValue, (itemValue, index) => { + const itemPath = addPath(path, index, undefined); + return coerceInputValueImpl(itemValue, itemType, onError, itemPath); + }); + } + // Lists accept a non-list value as a list of one. + return [coerceInputValueImpl(inputValue, itemType, onError, path)]; + } + + if (isInputObjectType(type)) { + if (!isObjectLike(inputValue)) { + onError( + pathToArray(path), + inputValue, + new GraphQLError(`Expected type "${type.name}" to be an object.`), + ); + return; + } + + const coercedValue: any = {}; + const fieldDefs = type.getFields(); + + for (const field of Object.values(fieldDefs)) { + const fieldValue = inputValue[field.name]; + + if (fieldValue === undefined) { + if (field.defaultValue !== undefined) { + coercedValue[field.name] = field.defaultValue; + } else if (isNonNullType(field.type)) { + const typeStr = inspect(field.type); + onError( + pathToArray(path), + inputValue, + new GraphQLError( + `Field "${field.name}" of required type "${typeStr}" was not provided.`, + ), + ); + } + continue; + } + + coercedValue[field.name] = coerceInputValueImpl( + fieldValue, + field.type, + onError, + addPath(path, field.name, type.name), + ); + } + + // Ensure every provided field is defined. + for (const fieldName of Object.keys(inputValue)) { + if (!fieldDefs[fieldName]) { + const suggestions = suggestionList( + fieldName, + Object.keys(type.getFields()), + ); + onError( + pathToArray(path), + inputValue, + new GraphQLError( + `Field "${fieldName}" is not defined by type "${type.name}".` + + didYouMean(suggestions), + ), + ); + } + } + return coercedValue; + } + + if (isLeafType(type)) { + let parseResult; + + // Scalars and Enums determine if a input value is valid via parseValue(), + // which can throw to indicate failure. If it throws, maintain a reference + // to the original error. + try { + parseResult = type.parseValue(inputValue); + } catch (error) { + if (error instanceof GraphQLError) { + onError(pathToArray(path), inputValue, error); + } else { + onError( + pathToArray(path), + inputValue, + new GraphQLError( + `Expected type "${type.name}". ` + error.message, + undefined, + undefined, + undefined, + undefined, + error, + ), + ); + } + return; + } + if (parseResult === undefined) { + onError( + pathToArray(path), + inputValue, + new GraphQLError(`Expected type "${type.name}".`), + ); + } + return parseResult; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + invariant(false, 'Unexpected input type: ' + inspect(type)); +} diff --git a/src/utilities/concatAST.ts b/src/utilities/concatAST.ts new file mode 100644 index 00000000..33062f61 --- /dev/null +++ b/src/utilities/concatAST.ts @@ -0,0 +1,17 @@ +import type { DefinitionNode, DocumentNode } from '../language/ast'; +import { Kind } from '../language/kinds'; + +/** + * Provided a collection of ASTs, presumably each from different files, + * concatenate the ASTs together into batched AST, useful for validating many + * GraphQL source files which together represent one conceptual application. + */ +export function concatAST( + documents: ReadonlyArray, +): DocumentNode { + const definitions: Array = []; + for (const doc of documents) { + definitions.push(...doc.definitions); + } + return { kind: Kind.DOCUMENT, definitions }; +} diff --git a/src/utilities/extendSchema.ts b/src/utilities/extendSchema.ts new file mode 100644 index 00000000..998847e9 --- /dev/null +++ b/src/utilities/extendSchema.ts @@ -0,0 +1,684 @@ +import { devAssert } from '../jsutils/devAssert'; +import { inspect } from '../jsutils/inspect'; +import { invariant } from '../jsutils/invariant'; +import { keyMap } from '../jsutils/keyMap'; +import { mapValue } from '../jsutils/mapValue'; +import type { Maybe } from '../jsutils/Maybe'; + +import type { + DirectiveDefinitionNode, + DocumentNode, + EnumTypeDefinitionNode, + EnumTypeExtensionNode, + EnumValueDefinitionNode, + FieldDefinitionNode, + InputObjectTypeDefinitionNode, + InputObjectTypeExtensionNode, + InputValueDefinitionNode, + InterfaceTypeDefinitionNode, + InterfaceTypeExtensionNode, + NamedTypeNode, + ObjectTypeDefinitionNode, + ObjectTypeExtensionNode, + ScalarTypeDefinitionNode, + ScalarTypeExtensionNode, + SchemaDefinitionNode, + SchemaExtensionNode, + TypeDefinitionNode, + TypeNode, + UnionTypeDefinitionNode, + UnionTypeExtensionNode, +} from '../language/ast'; +import { Kind } from '../language/kinds'; +import { + isTypeDefinitionNode, + isTypeExtensionNode, +} from '../language/predicates'; + +import type { + GraphQLArgumentConfig, + GraphQLEnumValueConfigMap, + GraphQLFieldConfig, + GraphQLFieldConfigArgumentMap, + GraphQLFieldConfigMap, + GraphQLInputFieldConfigMap, + GraphQLNamedType, + GraphQLType, +} from '../type/definition'; +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLScalarType, + GraphQLUnionType, + isEnumType, + isInputObjectType, + isInterfaceType, + isListType, + isNonNullType, + isObjectType, + isScalarType, + isUnionType, +} from '../type/definition'; +import { + GraphQLDeprecatedDirective, + GraphQLDirective, + GraphQLSpecifiedByDirective, +} from '../type/directives'; +import { introspectionTypes, isIntrospectionType } from '../type/introspection'; +import { isSpecifiedScalarType, specifiedScalarTypes } from '../type/scalars'; +import type { + GraphQLSchemaNormalizedConfig, + GraphQLSchemaValidationOptions, +} from '../type/schema'; +import { assertSchema, GraphQLSchema } from '../type/schema'; + +import { assertValidSDLExtension } from '../validation/validate'; + +import { getDirectiveValues } from '../execution/values'; + +import { valueFromAST } from './valueFromAST'; + +interface Options extends GraphQLSchemaValidationOptions { + /** + * Set to true to assume the SDL is valid. + * + * Default: false + */ + assumeValidSDL?: boolean; +} + +/** + * Produces a new schema given an existing schema and a document which may + * contain GraphQL type extensions and definitions. The original schema will + * remain unaltered. + * + * Because a schema represents a graph of references, a schema cannot be + * extended without effectively making an entire copy. We do not know until it's + * too late if subgraphs remain unchanged. + * + * This algorithm copies the provided schema, applying extensions while + * producing the copy. The original schema remains unaltered. + */ +export function extendSchema( + schema: GraphQLSchema, + documentAST: DocumentNode, + options?: Options, +): GraphQLSchema { + assertSchema(schema); + + devAssert( + documentAST != null && documentAST.kind === Kind.DOCUMENT, + 'Must provide valid Document AST.', + ); + + if (options?.assumeValid !== true && options?.assumeValidSDL !== true) { + assertValidSDLExtension(documentAST, schema); + } + + const schemaConfig = schema.toConfig(); + const extendedConfig = extendSchemaImpl(schemaConfig, documentAST, options); + return schemaConfig === extendedConfig + ? schema + : new GraphQLSchema(extendedConfig); +} + +/** + * @internal + */ +export function extendSchemaImpl( + schemaConfig: GraphQLSchemaNormalizedConfig, + documentAST: DocumentNode, + options?: Options, +): GraphQLSchemaNormalizedConfig { + // Collect the type definitions and extensions found in the document. + const typeDefs: Array = []; + const typeExtensionsMap = Object.create(null); + + // New directives and types are separate because a directives and types can + // have the same name. For example, a type named "skip". + const directiveDefs: Array = []; + + let schemaDef: Maybe; + // Schema extensions are collected which may add additional operation types. + const schemaExtensions: Array = []; + + for (const def of documentAST.definitions) { + if (def.kind === Kind.SCHEMA_DEFINITION) { + schemaDef = def; + } else if (def.kind === Kind.SCHEMA_EXTENSION) { + schemaExtensions.push(def); + } else if (isTypeDefinitionNode(def)) { + typeDefs.push(def); + } else if (isTypeExtensionNode(def)) { + const extendedTypeName = def.name.value; + const existingTypeExtensions = typeExtensionsMap[extendedTypeName]; + typeExtensionsMap[extendedTypeName] = existingTypeExtensions + ? existingTypeExtensions.concat([def]) + : [def]; + } else if (def.kind === Kind.DIRECTIVE_DEFINITION) { + directiveDefs.push(def); + } + } + + // If this document contains no new types, extensions, or directives then + // return the same unmodified GraphQLSchema instance. + if ( + Object.keys(typeExtensionsMap).length === 0 && + typeDefs.length === 0 && + directiveDefs.length === 0 && + schemaExtensions.length === 0 && + schemaDef == null + ) { + return schemaConfig; + } + + const typeMap = Object.create(null); + for (const existingType of schemaConfig.types) { + typeMap[existingType.name] = extendNamedType(existingType); + } + + for (const typeNode of typeDefs) { + const name = typeNode.name.value; + typeMap[name] = stdTypeMap[name] ?? buildType(typeNode); + } + + const operationTypes = { + // Get the extended root operation types. + query: schemaConfig.query && replaceNamedType(schemaConfig.query), + mutation: schemaConfig.mutation && replaceNamedType(schemaConfig.mutation), + subscription: + schemaConfig.subscription && replaceNamedType(schemaConfig.subscription), + // Then, incorporate schema definition and all schema extensions. + ...(schemaDef && getOperationTypes([schemaDef])), + ...getOperationTypes(schemaExtensions), + }; + + // Then produce and return a Schema config with these types. + return { + description: schemaDef?.description?.value, + ...operationTypes, + types: Object.values(typeMap), + directives: [ + ...schemaConfig.directives.map(replaceDirective), + ...directiveDefs.map(buildDirective), + ], + extensions: Object.create(null), + astNode: schemaDef ?? schemaConfig.astNode, + extensionASTNodes: schemaConfig.extensionASTNodes.concat(schemaExtensions), + assumeValid: options?.assumeValid ?? false, + }; + + // Below are functions used for producing this schema that have closed over + // this scope and have access to the schema, cache, and newly defined types. + + function replaceType(type: T): T { + if (isListType(type)) { + // @ts-expect-error + return new GraphQLList(replaceType(type.ofType)); + } + if (isNonNullType(type)) { + // @ts-expect-error + return new GraphQLNonNull(replaceType(type.ofType)); + } + // @ts-expect-error FIXME + return replaceNamedType(type); + } + + function replaceNamedType(type: T): T { + // Note: While this could make early assertions to get the correctly + // typed values, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + return typeMap[type.name]; + } + + function replaceDirective(directive: GraphQLDirective): GraphQLDirective { + const config = directive.toConfig(); + return new GraphQLDirective({ + ...config, + args: mapValue(config.args, extendArg), + }); + } + + function extendNamedType(type: GraphQLNamedType): GraphQLNamedType { + if (isIntrospectionType(type) || isSpecifiedScalarType(type)) { + // Builtin types are not extended. + return type; + } + if (isScalarType(type)) { + return extendScalarType(type); + } + if (isObjectType(type)) { + return extendObjectType(type); + } + if (isInterfaceType(type)) { + return extendInterfaceType(type); + } + if (isUnionType(type)) { + return extendUnionType(type); + } + if (isEnumType(type)) { + return extendEnumType(type); + } + if (isInputObjectType(type)) { + return extendInputObjectType(type); + } + /* c8 ignore next 3 */ + // Not reachable, all possible type definition nodes have been considered. + invariant(false, 'Unexpected type: ' + inspect(type)); + } + + function extendInputObjectType( + type: GraphQLInputObjectType, + ): GraphQLInputObjectType { + const config = type.toConfig(); + const extensions = typeExtensionsMap[config.name] ?? []; + + return new GraphQLInputObjectType({ + ...config, + fields: () => ({ + ...mapValue(config.fields, (field) => ({ + ...field, + type: replaceType(field.type), + })), + ...buildInputFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendEnumType(type: GraphQLEnumType): GraphQLEnumType { + const config = type.toConfig(); + const extensions = typeExtensionsMap[type.name] ?? []; + + return new GraphQLEnumType({ + ...config, + values: { + ...config.values, + ...buildEnumValueMap(extensions), + }, + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendScalarType(type: GraphQLScalarType): GraphQLScalarType { + const config = type.toConfig(); + const extensions = typeExtensionsMap[config.name] ?? []; + + let specifiedByURL = config.specifiedByURL; + for (const extensionNode of extensions) { + specifiedByURL = getSpecifiedByURL(extensionNode) ?? specifiedByURL; + } + + return new GraphQLScalarType({ + ...config, + specifiedByURL, + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendObjectType(type: GraphQLObjectType): GraphQLObjectType { + const config = type.toConfig(); + const extensions = typeExtensionsMap[config.name] ?? []; + + return new GraphQLObjectType({ + ...config, + interfaces: () => [ + ...type.getInterfaces().map(replaceNamedType), + ...buildInterfaces(extensions), + ], + fields: () => ({ + ...mapValue(config.fields, extendField), + ...buildFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendInterfaceType( + type: GraphQLInterfaceType, + ): GraphQLInterfaceType { + const config = type.toConfig(); + const extensions = typeExtensionsMap[config.name] ?? []; + + return new GraphQLInterfaceType({ + ...config, + interfaces: () => [ + ...type.getInterfaces().map(replaceNamedType), + ...buildInterfaces(extensions), + ], + fields: () => ({ + ...mapValue(config.fields, extendField), + ...buildFieldMap(extensions), + }), + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendUnionType(type: GraphQLUnionType): GraphQLUnionType { + const config = type.toConfig(); + const extensions = typeExtensionsMap[config.name] ?? []; + + return new GraphQLUnionType({ + ...config, + types: () => [ + ...type.getTypes().map(replaceNamedType), + ...buildUnionTypes(extensions), + ], + extensionASTNodes: config.extensionASTNodes.concat(extensions), + }); + } + + function extendField( + field: GraphQLFieldConfig, + ): GraphQLFieldConfig { + return { + ...field, + type: replaceType(field.type), + args: field.args && mapValue(field.args, extendArg), + }; + } + + function extendArg(arg: GraphQLArgumentConfig) { + return { + ...arg, + type: replaceType(arg.type), + }; + } + + function getOperationTypes( + nodes: ReadonlyArray, + ): { + query?: Maybe; + mutation?: Maybe; + subscription?: Maybe; + } { + const opTypes = {}; + for (const node of nodes) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const operationTypesNodes = + /* c8 ignore next */ node.operationTypes ?? []; + + for (const operationType of operationTypesNodes) { + // Note: While this could make early assertions to get the correctly + // typed values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + opTypes[operationType.operation] = getNamedType(operationType.type); + } + } + + return opTypes; + } + + function getNamedType(node: NamedTypeNode): GraphQLNamedType { + const name = node.name.value; + const type = stdTypeMap[name] ?? typeMap[name]; + + if (type === undefined) { + throw new Error(`Unknown type: "${name}".`); + } + return type; + } + + function getWrappedType(node: TypeNode): GraphQLType { + if (node.kind === Kind.LIST_TYPE) { + return new GraphQLList(getWrappedType(node.type)); + } + if (node.kind === Kind.NON_NULL_TYPE) { + return new GraphQLNonNull(getWrappedType(node.type)); + } + return getNamedType(node); + } + + function buildDirective(node: DirectiveDefinitionNode): GraphQLDirective { + return new GraphQLDirective({ + name: node.name.value, + description: node.description?.value, + // @ts-expect-error + locations: node.locations.map(({ value }) => value), + isRepeatable: node.repeatable, + args: buildArgumentMap(node.arguments), + astNode: node, + }); + } + + function buildFieldMap( + nodes: ReadonlyArray< + | InterfaceTypeDefinitionNode + | InterfaceTypeExtensionNode + | ObjectTypeDefinitionNode + | ObjectTypeExtensionNode + >, + ): GraphQLFieldConfigMap { + const fieldConfigMap = Object.create(null); + for (const node of nodes) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const nodeFields = /* c8 ignore next */ node.fields ?? []; + + for (const field of nodeFields) { + fieldConfigMap[field.name.value] = { + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + type: getWrappedType(field.type), + description: field.description?.value, + args: buildArgumentMap(field.arguments), + deprecationReason: getDeprecationReason(field), + astNode: field, + }; + } + } + return fieldConfigMap; + } + + function buildArgumentMap( + args: Maybe>, + ): GraphQLFieldConfigArgumentMap { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const argsNodes = /* c8 ignore next */ args ?? []; + + const argConfigMap = Object.create(null); + for (const arg of argsNodes) { + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + const type: any = getWrappedType(arg.type); + + argConfigMap[arg.name.value] = { + type, + description: arg.description?.value, + defaultValue: valueFromAST(arg.defaultValue, type), + deprecationReason: getDeprecationReason(arg), + astNode: arg, + }; + } + return argConfigMap; + } + + function buildInputFieldMap( + nodes: ReadonlyArray< + InputObjectTypeDefinitionNode | InputObjectTypeExtensionNode + >, + ): GraphQLInputFieldConfigMap { + const inputFieldMap = Object.create(null); + for (const node of nodes) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const fieldsNodes = /* c8 ignore next */ node.fields ?? []; + + for (const field of fieldsNodes) { + // Note: While this could make assertions to get the correctly typed + // value, that would throw immediately while type system validation + // with validateSchema() will produce more actionable results. + const type: any = getWrappedType(field.type); + + inputFieldMap[field.name.value] = { + type, + description: field.description?.value, + defaultValue: valueFromAST(field.defaultValue, type), + deprecationReason: getDeprecationReason(field), + astNode: field, + }; + } + } + return inputFieldMap; + } + + function buildEnumValueMap( + nodes: ReadonlyArray, + ): GraphQLEnumValueConfigMap { + const enumValueMap = Object.create(null); + for (const node of nodes) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + const valuesNodes = /* c8 ignore next */ node.values ?? []; + + for (const value of valuesNodes) { + enumValueMap[value.name.value] = { + description: value.description?.value, + deprecationReason: getDeprecationReason(value), + astNode: value, + }; + } + } + return enumValueMap; + } + + function buildInterfaces( + nodes: ReadonlyArray< + | InterfaceTypeDefinitionNode + | InterfaceTypeExtensionNode + | ObjectTypeDefinitionNode + | ObjectTypeExtensionNode + >, + ): Array { + // Note: While this could make assertions to get the correctly typed + // values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + return nodes.flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (node) => /* c8 ignore next */ node.interfaces?.map(getNamedType) ?? [], + ); + } + + function buildUnionTypes( + nodes: ReadonlyArray, + ): Array { + // Note: While this could make assertions to get the correctly typed + // values below, that would throw immediately while type system + // validation with validateSchema() will produce more actionable results. + // @ts-expect-error + return nodes.flatMap( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + (node) => /* c8 ignore next */ node.types?.map(getNamedType) ?? [], + ); + } + + function buildType(astNode: TypeDefinitionNode): GraphQLNamedType { + const name = astNode.name.value; + const extensionASTNodes = typeExtensionsMap[name] ?? []; + + switch (astNode.kind) { + case Kind.OBJECT_TYPE_DEFINITION: { + const allNodes = [astNode, ...extensionASTNodes]; + + return new GraphQLObjectType({ + name, + description: astNode.description?.value, + interfaces: () => buildInterfaces(allNodes), + fields: () => buildFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + case Kind.INTERFACE_TYPE_DEFINITION: { + const allNodes = [astNode, ...extensionASTNodes]; + + return new GraphQLInterfaceType({ + name, + description: astNode.description?.value, + interfaces: () => buildInterfaces(allNodes), + fields: () => buildFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + case Kind.ENUM_TYPE_DEFINITION: { + const allNodes = [astNode, ...extensionASTNodes]; + + return new GraphQLEnumType({ + name, + description: astNode.description?.value, + values: buildEnumValueMap(allNodes), + astNode, + extensionASTNodes, + }); + } + case Kind.UNION_TYPE_DEFINITION: { + const allNodes = [astNode, ...extensionASTNodes]; + + return new GraphQLUnionType({ + name, + description: astNode.description?.value, + types: () => buildUnionTypes(allNodes), + astNode, + extensionASTNodes, + }); + } + case Kind.SCALAR_TYPE_DEFINITION: { + return new GraphQLScalarType({ + name, + description: astNode.description?.value, + specifiedByURL: getSpecifiedByURL(astNode), + astNode, + extensionASTNodes, + }); + } + case Kind.INPUT_OBJECT_TYPE_DEFINITION: { + const allNodes = [astNode, ...extensionASTNodes]; + + return new GraphQLInputObjectType({ + name, + description: astNode.description?.value, + fields: () => buildInputFieldMap(allNodes), + astNode, + extensionASTNodes, + }); + } + } + } +} + +const stdTypeMap = keyMap( + [...specifiedScalarTypes, ...introspectionTypes], + (type) => type.name, +); + +/** + * Given a field or enum value node, returns the string value for the + * deprecation reason. + */ +function getDeprecationReason( + node: + | EnumValueDefinitionNode + | FieldDefinitionNode + | InputValueDefinitionNode, +): Maybe { + const deprecated = getDirectiveValues(GraphQLDeprecatedDirective, node); + // @ts-expect-error validated by `getDirectiveValues` + return deprecated?.reason; +} + +/** + * Given a scalar node, returns the string value for the specifiedByURL. + */ +function getSpecifiedByURL( + node: ScalarTypeDefinitionNode | ScalarTypeExtensionNode, +): Maybe { + const specifiedBy = getDirectiveValues(GraphQLSpecifiedByDirective, node); + // @ts-expect-error validated by `getDirectiveValues` + return specifiedBy?.url; +} diff --git a/src/utilities/findBreakingChanges.ts b/src/utilities/findBreakingChanges.ts new file mode 100644 index 00000000..b82901f9 --- /dev/null +++ b/src/utilities/findBreakingChanges.ts @@ -0,0 +1,586 @@ +import { inspect } from '../jsutils/inspect'; +import { invariant } from '../jsutils/invariant'; +import { keyMap } from '../jsutils/keyMap'; +import { naturalCompare } from '../jsutils/naturalCompare'; + +import { print } from '../language/printer'; +import { visit } from '../language/visitor'; + +import type { + GraphQLEnumType, + GraphQLField, + GraphQLInputObjectType, + GraphQLInputType, + GraphQLInterfaceType, + GraphQLNamedType, + GraphQLObjectType, + GraphQLType, + GraphQLUnionType, +} from '../type/definition'; +import { + isEnumType, + isInputObjectType, + isInterfaceType, + isListType, + isNamedType, + isNonNullType, + isObjectType, + isRequiredArgument, + isRequiredInputField, + isScalarType, + isUnionType, +} from '../type/definition'; +import { isSpecifiedScalarType } from '../type/scalars'; +import type { GraphQLSchema } from '../type/schema'; + +import { astFromValue } from './astFromValue'; + +export enum BreakingChangeType { + TYPE_REMOVED = 'TYPE_REMOVED', + TYPE_CHANGED_KIND = 'TYPE_CHANGED_KIND', + TYPE_REMOVED_FROM_UNION = 'TYPE_REMOVED_FROM_UNION', + VALUE_REMOVED_FROM_ENUM = 'VALUE_REMOVED_FROM_ENUM', + REQUIRED_INPUT_FIELD_ADDED = 'REQUIRED_INPUT_FIELD_ADDED', + IMPLEMENTED_INTERFACE_REMOVED = 'IMPLEMENTED_INTERFACE_REMOVED', + FIELD_REMOVED = 'FIELD_REMOVED', + FIELD_CHANGED_KIND = 'FIELD_CHANGED_KIND', + REQUIRED_ARG_ADDED = 'REQUIRED_ARG_ADDED', + ARG_REMOVED = 'ARG_REMOVED', + ARG_CHANGED_KIND = 'ARG_CHANGED_KIND', + DIRECTIVE_REMOVED = 'DIRECTIVE_REMOVED', + DIRECTIVE_ARG_REMOVED = 'DIRECTIVE_ARG_REMOVED', + REQUIRED_DIRECTIVE_ARG_ADDED = 'REQUIRED_DIRECTIVE_ARG_ADDED', + DIRECTIVE_REPEATABLE_REMOVED = 'DIRECTIVE_REPEATABLE_REMOVED', + DIRECTIVE_LOCATION_REMOVED = 'DIRECTIVE_LOCATION_REMOVED', +} + +export enum DangerousChangeType { + VALUE_ADDED_TO_ENUM = 'VALUE_ADDED_TO_ENUM', + TYPE_ADDED_TO_UNION = 'TYPE_ADDED_TO_UNION', + OPTIONAL_INPUT_FIELD_ADDED = 'OPTIONAL_INPUT_FIELD_ADDED', + OPTIONAL_ARG_ADDED = 'OPTIONAL_ARG_ADDED', + IMPLEMENTED_INTERFACE_ADDED = 'IMPLEMENTED_INTERFACE_ADDED', + ARG_DEFAULT_VALUE_CHANGE = 'ARG_DEFAULT_VALUE_CHANGE', +} + +export interface BreakingChange { + type: BreakingChangeType; + description: string; +} + +export interface DangerousChange { + type: DangerousChangeType; + description: string; +} + +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of breaking changes covered by the other functions down below. + */ +export function findBreakingChanges( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, +): Array { + // @ts-expect-error + return findSchemaChanges(oldSchema, newSchema).filter( + (change) => change.type in BreakingChangeType, + ); +} + +/** + * Given two schemas, returns an Array containing descriptions of all the types + * of potentially dangerous changes covered by the other functions down below. + */ +export function findDangerousChanges( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, +): Array { + // @ts-expect-error + return findSchemaChanges(oldSchema, newSchema).filter( + (change) => change.type in DangerousChangeType, + ); +} + +function findSchemaChanges( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, +): Array { + return [ + ...findTypeChanges(oldSchema, newSchema), + ...findDirectiveChanges(oldSchema, newSchema), + ]; +} + +function findDirectiveChanges( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, +): Array { + const schemaChanges = []; + + const directivesDiff = diff( + oldSchema.getDirectives(), + newSchema.getDirectives(), + ); + + for (const oldDirective of directivesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_REMOVED, + description: `${oldDirective.name} was removed.`, + }); + } + + for (const [oldDirective, newDirective] of directivesDiff.persisted) { + const argsDiff = diff(oldDirective.args, newDirective.args); + + for (const newArg of argsDiff.added) { + if (isRequiredArgument(newArg)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED, + description: `A required arg ${newArg.name} on directive ${oldDirective.name} was added.`, + }); + } + } + + for (const oldArg of argsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_ARG_REMOVED, + description: `${oldArg.name} was removed from ${oldDirective.name}.`, + }); + } + + if (oldDirective.isRepeatable && !newDirective.isRepeatable) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED, + description: `Repeatable flag was removed from ${oldDirective.name}.`, + }); + } + + for (const location of oldDirective.locations) { + if (!newDirective.locations.includes(location)) { + schemaChanges.push({ + type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED, + description: `${location} was removed from ${oldDirective.name}.`, + }); + } + } + } + + return schemaChanges; +} + +function findTypeChanges( + oldSchema: GraphQLSchema, + newSchema: GraphQLSchema, +): Array { + const schemaChanges = []; + + const typesDiff = diff( + Object.values(oldSchema.getTypeMap()), + Object.values(newSchema.getTypeMap()), + ); + + for (const oldType of typesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_REMOVED, + description: isSpecifiedScalarType(oldType) + ? `Standard scalar ${oldType.name} was removed because it is not referenced anymore.` + : `${oldType.name} was removed.`, + }); + } + + for (const [oldType, newType] of typesDiff.persisted) { + if (isEnumType(oldType) && isEnumType(newType)) { + schemaChanges.push(...findEnumTypeChanges(oldType, newType)); + } else if (isUnionType(oldType) && isUnionType(newType)) { + schemaChanges.push(...findUnionTypeChanges(oldType, newType)); + } else if (isInputObjectType(oldType) && isInputObjectType(newType)) { + schemaChanges.push(...findInputObjectTypeChanges(oldType, newType)); + } else if (isObjectType(oldType) && isObjectType(newType)) { + schemaChanges.push( + ...findFieldChanges(oldType, newType), + ...findImplementedInterfacesChanges(oldType, newType), + ); + } else if (isInterfaceType(oldType) && isInterfaceType(newType)) { + schemaChanges.push( + ...findFieldChanges(oldType, newType), + ...findImplementedInterfacesChanges(oldType, newType), + ); + } else if (oldType.constructor !== newType.constructor) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_CHANGED_KIND, + description: + `${oldType.name} changed from ` + + `${typeKindName(oldType)} to ${typeKindName(newType)}.`, + }); + } + } + + return schemaChanges; +} + +function findInputObjectTypeChanges( + oldType: GraphQLInputObjectType, + newType: GraphQLInputObjectType, +): Array { + const schemaChanges = []; + const fieldsDiff = diff( + Object.values(oldType.getFields()), + Object.values(newType.getFields()), + ); + + for (const newField of fieldsDiff.added) { + if (isRequiredInputField(newField)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED, + description: `A required field ${newField.name} on input type ${oldType.name} was added.`, + }); + } else { + schemaChanges.push({ + type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED, + description: `An optional field ${newField.name} on input type ${oldType.name} was added.`, + }); + } + } + + for (const oldField of fieldsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_REMOVED, + description: `${oldType.name}.${oldField.name} was removed.`, + }); + } + + for (const [oldField, newField] of fieldsDiff.persisted) { + const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( + oldField.type, + newField.type, + ); + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} changed type from ` + + `${String(oldField.type)} to ${String(newField.type)}.`, + }); + } + } + + return schemaChanges; +} + +function findUnionTypeChanges( + oldType: GraphQLUnionType, + newType: GraphQLUnionType, +): Array { + const schemaChanges = []; + const possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes()); + + for (const newPossibleType of possibleTypesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.TYPE_ADDED_TO_UNION, + description: `${newPossibleType.name} was added to union type ${oldType.name}.`, + }); + } + + for (const oldPossibleType of possibleTypesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.TYPE_REMOVED_FROM_UNION, + description: `${oldPossibleType.name} was removed from union type ${oldType.name}.`, + }); + } + + return schemaChanges; +} + +function findEnumTypeChanges( + oldType: GraphQLEnumType, + newType: GraphQLEnumType, +): Array { + const schemaChanges = []; + const valuesDiff = diff(oldType.getValues(), newType.getValues()); + + for (const newValue of valuesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.VALUE_ADDED_TO_ENUM, + description: `${newValue.name} was added to enum type ${oldType.name}.`, + }); + } + + for (const oldValue of valuesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM, + description: `${oldValue.name} was removed from enum type ${oldType.name}.`, + }); + } + + return schemaChanges; +} + +function findImplementedInterfacesChanges( + oldType: GraphQLObjectType | GraphQLInterfaceType, + newType: GraphQLObjectType | GraphQLInterfaceType, +): Array { + const schemaChanges = []; + const interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces()); + + for (const newInterface of interfacesDiff.added) { + schemaChanges.push({ + type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED, + description: `${newInterface.name} added to interfaces implemented by ${oldType.name}.`, + }); + } + + for (const oldInterface of interfacesDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED, + description: `${oldType.name} no longer implements interface ${oldInterface.name}.`, + }); + } + + return schemaChanges; +} + +function findFieldChanges( + oldType: GraphQLObjectType | GraphQLInterfaceType, + newType: GraphQLObjectType | GraphQLInterfaceType, +): Array { + const schemaChanges = []; + const fieldsDiff = diff( + Object.values(oldType.getFields()), + Object.values(newType.getFields()), + ); + + for (const oldField of fieldsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_REMOVED, + description: `${oldType.name}.${oldField.name} was removed.`, + }); + } + + for (const [oldField, newField] of fieldsDiff.persisted) { + schemaChanges.push(...findArgChanges(oldType, oldField, newField)); + + const isSafe = isChangeSafeForObjectOrInterfaceField( + oldField.type, + newField.type, + ); + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.FIELD_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} changed type from ` + + `${String(oldField.type)} to ${String(newField.type)}.`, + }); + } + } + + return schemaChanges; +} + +function findArgChanges( + oldType: GraphQLObjectType | GraphQLInterfaceType, + oldField: GraphQLField, + newField: GraphQLField, +): Array { + const schemaChanges = []; + const argsDiff = diff(oldField.args, newField.args); + + for (const oldArg of argsDiff.removed) { + schemaChanges.push({ + type: BreakingChangeType.ARG_REMOVED, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} was removed.`, + }); + } + + for (const [oldArg, newArg] of argsDiff.persisted) { + const isSafe = isChangeSafeForInputObjectFieldOrFieldArg( + oldArg.type, + newArg.type, + ); + if (!isSafe) { + schemaChanges.push({ + type: BreakingChangeType.ARG_CHANGED_KIND, + description: + `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed type from ` + + `${String(oldArg.type)} to ${String(newArg.type)}.`, + }); + } else if (oldArg.defaultValue !== undefined) { + if (newArg.defaultValue === undefined) { + schemaChanges.push({ + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} defaultValue was removed.`, + }); + } else { + // Since we looking only for client's observable changes we should + // compare default values in the same representation as they are + // represented inside introspection. + const oldValueStr = stringifyValue(oldArg.defaultValue, oldArg.type); + const newValueStr = stringifyValue(newArg.defaultValue, newArg.type); + + if (oldValueStr !== newValueStr) { + schemaChanges.push({ + type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE, + description: `${oldType.name}.${oldField.name} arg ${oldArg.name} has changed defaultValue from ${oldValueStr} to ${newValueStr}.`, + }); + } + } + } + } + + for (const newArg of argsDiff.added) { + if (isRequiredArgument(newArg)) { + schemaChanges.push({ + type: BreakingChangeType.REQUIRED_ARG_ADDED, + description: `A required arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, + }); + } else { + schemaChanges.push({ + type: DangerousChangeType.OPTIONAL_ARG_ADDED, + description: `An optional arg ${newArg.name} on ${oldType.name}.${oldField.name} was added.`, + }); + } + } + + return schemaChanges; +} + +function isChangeSafeForObjectOrInterfaceField( + oldType: GraphQLType, + newType: GraphQLType, +): boolean { + if (isListType(oldType)) { + return ( + // if they're both lists, make sure the underlying types are compatible + (isListType(newType) && + isChangeSafeForObjectOrInterfaceField( + oldType.ofType, + newType.ofType, + )) || + // moving from nullable to non-null of the same underlying type is safe + (isNonNullType(newType) && + isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)) + ); + } + + if (isNonNullType(oldType)) { + // if they're both non-null, make sure the underlying types are compatible + return ( + isNonNullType(newType) && + isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType) + ); + } + + return ( + // if they're both named types, see if their names are equivalent + (isNamedType(newType) && oldType.name === newType.name) || + // moving from nullable to non-null of the same underlying type is safe + (isNonNullType(newType) && + isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType)) + ); +} + +function isChangeSafeForInputObjectFieldOrFieldArg( + oldType: GraphQLType, + newType: GraphQLType, +): boolean { + if (isListType(oldType)) { + // if they're both lists, make sure the underlying types are compatible + return ( + isListType(newType) && + isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType) + ); + } + + if (isNonNullType(oldType)) { + return ( + // if they're both non-null, make sure the underlying types are + // compatible + (isNonNullType(newType) && + isChangeSafeForInputObjectFieldOrFieldArg( + oldType.ofType, + newType.ofType, + )) || + // moving from non-null to nullable of the same underlying type is safe + (!isNonNullType(newType) && + isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType)) + ); + } + + // if they're both named types, see if their names are equivalent + return isNamedType(newType) && oldType.name === newType.name; +} + +function typeKindName(type: GraphQLNamedType): string { + if (isScalarType(type)) { + return 'a Scalar type'; + } + if (isObjectType(type)) { + return 'an Object type'; + } + if (isInterfaceType(type)) { + return 'an Interface type'; + } + if (isUnionType(type)) { + return 'a Union type'; + } + if (isEnumType(type)) { + return 'an Enum type'; + } + if (isInputObjectType(type)) { + return 'an Input type'; + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + invariant(false, 'Unexpected type: ' + inspect(type)); +} + +function stringifyValue(value: unknown, type: GraphQLInputType): string { + const ast = astFromValue(value, type); + invariant(ast != null); + + const sortedAST = visit(ast, { + ObjectValue(objectNode) { + // Make a copy since sort mutates array + const fields = [...objectNode.fields]; + + fields.sort((fieldA, fieldB) => + naturalCompare(fieldA.name.value, fieldB.name.value), + ); + return { ...objectNode, fields }; + }, + }); + + return print(sortedAST); +} + +function diff( + oldArray: ReadonlyArray, + newArray: ReadonlyArray, +): { + added: ReadonlyArray; + removed: ReadonlyArray; + persisted: ReadonlyArray<[T, T]>; +} { + const added: Array = []; + const removed: Array = []; + const persisted: Array<[T, T]> = []; + + const oldMap = keyMap(oldArray, ({ name }) => name); + const newMap = keyMap(newArray, ({ name }) => name); + + for (const oldItem of oldArray) { + const newItem = newMap[oldItem.name]; + if (newItem === undefined) { + removed.push(oldItem); + } else { + persisted.push([oldItem, newItem]); + } + } + + for (const newItem of newArray) { + if (oldMap[newItem.name] === undefined) { + added.push(newItem); + } + } + + return { added, persisted, removed }; +} diff --git a/src/utilities/getIntrospectionQuery.ts b/src/utilities/getIntrospectionQuery.ts new file mode 100644 index 00000000..c21fe9a1 --- /dev/null +++ b/src/utilities/getIntrospectionQuery.ts @@ -0,0 +1,331 @@ +import type { Maybe } from '../jsutils/Maybe'; + +import type { DirectiveLocation } from '../language/directiveLocation'; + +export interface IntrospectionOptions { + /** + * Whether to include descriptions in the introspection result. + * Default: true + */ + descriptions?: boolean; + + /** + * Whether to include `specifiedByURL` in the introspection result. + * Default: false + */ + specifiedByUrl?: boolean; + + /** + * Whether to include `isRepeatable` flag on directives. + * Default: false + */ + directiveIsRepeatable?: boolean; + + /** + * Whether to include `description` field on schema. + * Default: false + */ + schemaDescription?: boolean; + + /** + * Whether target GraphQL server support deprecation of input values. + * Default: false + */ + inputValueDeprecation?: boolean; +} + +/** + * Produce the GraphQL query recommended for a full schema introspection. + * Accepts optional IntrospectionOptions. + */ +export function getIntrospectionQuery(options?: IntrospectionOptions): string { + const optionsWithDefault = { + descriptions: true, + specifiedByUrl: false, + directiveIsRepeatable: false, + schemaDescription: false, + inputValueDeprecation: false, + ...options, + }; + + const descriptions = optionsWithDefault.descriptions ? 'description' : ''; + const specifiedByUrl = optionsWithDefault.specifiedByUrl + ? 'specifiedByURL' + : ''; + const directiveIsRepeatable = optionsWithDefault.directiveIsRepeatable + ? 'isRepeatable' + : ''; + const schemaDescription = optionsWithDefault.schemaDescription + ? descriptions + : ''; + + function inputDeprecation(str: string) { + return optionsWithDefault.inputValueDeprecation ? str : ''; + } + + return ` + query IntrospectionQuery { + __schema { + ${schemaDescription} + queryType { name } + mutationType { name } + subscriptionType { name } + types { + ...FullType + } + directives { + name + ${descriptions} + ${directiveIsRepeatable} + locations + args${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + } + } + } + + fragment FullType on __Type { + kind + name + ${descriptions} + ${specifiedByUrl} + fields(includeDeprecated: true) { + name + ${descriptions} + args${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + type { + ...TypeRef + } + isDeprecated + deprecationReason + } + inputFields${inputDeprecation('(includeDeprecated: true)')} { + ...InputValue + } + interfaces { + ...TypeRef + } + enumValues(includeDeprecated: true) { + name + ${descriptions} + isDeprecated + deprecationReason + } + possibleTypes { + ...TypeRef + } + } + + fragment InputValue on __InputValue { + name + ${descriptions} + type { ...TypeRef } + defaultValue + ${inputDeprecation('isDeprecated')} + ${inputDeprecation('deprecationReason')} + } + + fragment TypeRef on __Type { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + ofType { + kind + name + } + } + } + } + } + } + } + } + `; +} + +export interface IntrospectionQuery { + readonly __schema: IntrospectionSchema; +} + +export interface IntrospectionSchema { + readonly description?: Maybe; + readonly queryType: IntrospectionNamedTypeRef; + readonly mutationType: Maybe< + IntrospectionNamedTypeRef + >; + readonly subscriptionType: Maybe< + IntrospectionNamedTypeRef + >; + readonly types: ReadonlyArray; + readonly directives: ReadonlyArray; +} + +export type IntrospectionType = + | IntrospectionScalarType + | IntrospectionObjectType + | IntrospectionInterfaceType + | IntrospectionUnionType + | IntrospectionEnumType + | IntrospectionInputObjectType; + +export type IntrospectionOutputType = + | IntrospectionScalarType + | IntrospectionObjectType + | IntrospectionInterfaceType + | IntrospectionUnionType + | IntrospectionEnumType; + +export type IntrospectionInputType = + | IntrospectionScalarType + | IntrospectionEnumType + | IntrospectionInputObjectType; + +export interface IntrospectionScalarType { + readonly kind: 'SCALAR'; + readonly name: string; + readonly description?: Maybe; + readonly specifiedByURL?: Maybe; +} + +export interface IntrospectionObjectType { + readonly kind: 'OBJECT'; + readonly name: string; + readonly description?: Maybe; + readonly fields: ReadonlyArray; + readonly interfaces: ReadonlyArray< + IntrospectionNamedTypeRef + >; +} + +export interface IntrospectionInterfaceType { + readonly kind: 'INTERFACE'; + readonly name: string; + readonly description?: Maybe; + readonly fields: ReadonlyArray; + readonly interfaces: ReadonlyArray< + IntrospectionNamedTypeRef + >; + readonly possibleTypes: ReadonlyArray< + IntrospectionNamedTypeRef + >; +} + +export interface IntrospectionUnionType { + readonly kind: 'UNION'; + readonly name: string; + readonly description?: Maybe; + readonly possibleTypes: ReadonlyArray< + IntrospectionNamedTypeRef + >; +} + +export interface IntrospectionEnumType { + readonly kind: 'ENUM'; + readonly name: string; + readonly description?: Maybe; + readonly enumValues: ReadonlyArray; +} + +export interface IntrospectionInputObjectType { + readonly kind: 'INPUT_OBJECT'; + readonly name: string; + readonly description?: Maybe; + readonly inputFields: ReadonlyArray; +} + +export interface IntrospectionListTypeRef< + T extends IntrospectionTypeRef = IntrospectionTypeRef, +> { + readonly kind: 'LIST'; + readonly ofType: T; +} + +export interface IntrospectionNonNullTypeRef< + T extends IntrospectionTypeRef = IntrospectionTypeRef, +> { + readonly kind: 'NON_NULL'; + readonly ofType: T; +} + +export type IntrospectionTypeRef = + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + | IntrospectionNonNullTypeRef< + IntrospectionNamedTypeRef | IntrospectionListTypeRef + >; + +export type IntrospectionOutputTypeRef = + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + | IntrospectionNonNullTypeRef< + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + >; + +export type IntrospectionInputTypeRef = + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + | IntrospectionNonNullTypeRef< + | IntrospectionNamedTypeRef + | IntrospectionListTypeRef + >; + +export interface IntrospectionNamedTypeRef< + T extends IntrospectionType = IntrospectionType, +> { + readonly kind: T['kind']; + readonly name: string; +} + +export interface IntrospectionField { + readonly name: string; + readonly description?: Maybe; + readonly args: ReadonlyArray; + readonly type: IntrospectionOutputTypeRef; + readonly isDeprecated: boolean; + readonly deprecationReason: Maybe; +} + +export interface IntrospectionInputValue { + readonly name: string; + readonly description?: Maybe; + readonly type: IntrospectionInputTypeRef; + readonly defaultValue: Maybe; + readonly isDeprecated?: boolean; + readonly deprecationReason?: Maybe; +} + +export interface IntrospectionEnumValue { + readonly name: string; + readonly description?: Maybe; + readonly isDeprecated: boolean; + readonly deprecationReason: Maybe; +} + +export interface IntrospectionDirective { + readonly name: string; + readonly description?: Maybe; + readonly isRepeatable?: boolean; + readonly locations: ReadonlyArray; + readonly args: ReadonlyArray; +} diff --git a/src/utilities/getOperationAST.ts b/src/utilities/getOperationAST.ts new file mode 100644 index 00000000..8decf943 --- /dev/null +++ b/src/utilities/getOperationAST.ts @@ -0,0 +1,32 @@ +import type { Maybe } from '../jsutils/Maybe'; + +import type { DocumentNode, OperationDefinitionNode } from '../language/ast'; +import { Kind } from '../language/kinds'; + +/** + * Returns an operation AST given a document AST and optionally an operation + * name. If a name is not provided, an operation is only returned if only one is + * provided in the document. + */ +export function getOperationAST( + documentAST: DocumentNode, + operationName?: Maybe, +): Maybe { + let operation = null; + for (const definition of documentAST.definitions) { + if (definition.kind === Kind.OPERATION_DEFINITION) { + if (operationName == null) { + // If no operation name was provided, only return an Operation if there + // is one defined in the document. Upon encountering the second, return + // null. + if (operation) { + return null; + } + operation = definition; + } else if (definition.name?.value === operationName) { + return definition; + } + } + } + return operation; +} diff --git a/src/utilities/getOperationRootType.ts b/src/utilities/getOperationRootType.ts new file mode 100644 index 00000000..86302be8 --- /dev/null +++ b/src/utilities/getOperationRootType.ts @@ -0,0 +1,57 @@ +import { GraphQLError } from '../error/GraphQLError'; + +import type { + OperationDefinitionNode, + OperationTypeDefinitionNode, +} from '../language/ast'; + +import type { GraphQLObjectType } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; + +/** + * Extracts the root type of the operation from the schema. + * + * @deprecated Please use `GraphQLSchema.getRootType` instead. Will be removed in v17 + */ +export function getOperationRootType( + schema: GraphQLSchema, + operation: OperationDefinitionNode | OperationTypeDefinitionNode, +): GraphQLObjectType { + if (operation.operation === 'query') { + const queryType = schema.getQueryType(); + if (!queryType) { + throw new GraphQLError( + 'Schema does not define the required query root type.', + operation, + ); + } + return queryType; + } + + if (operation.operation === 'mutation') { + const mutationType = schema.getMutationType(); + if (!mutationType) { + throw new GraphQLError( + 'Schema is not configured for mutations.', + operation, + ); + } + return mutationType; + } + + if (operation.operation === 'subscription') { + const subscriptionType = schema.getSubscriptionType(); + if (!subscriptionType) { + throw new GraphQLError( + 'Schema is not configured for subscriptions.', + operation, + ); + } + return subscriptionType; + } + + throw new GraphQLError( + 'Can only have query, mutation and subscription operations.', + operation, + ); +} diff --git a/src/utilities/index.ts b/src/utilities/index.ts new file mode 100644 index 00000000..452b9752 --- /dev/null +++ b/src/utilities/index.ts @@ -0,0 +1,105 @@ +// Produce the GraphQL query recommended for a full schema introspection. +export { getIntrospectionQuery } from './getIntrospectionQuery'; + +export type { + IntrospectionOptions, + IntrospectionQuery, + IntrospectionSchema, + IntrospectionType, + IntrospectionInputType, + IntrospectionOutputType, + IntrospectionScalarType, + IntrospectionObjectType, + IntrospectionInterfaceType, + IntrospectionUnionType, + IntrospectionEnumType, + IntrospectionInputObjectType, + IntrospectionTypeRef, + IntrospectionInputTypeRef, + IntrospectionOutputTypeRef, + IntrospectionNamedTypeRef, + IntrospectionListTypeRef, + IntrospectionNonNullTypeRef, + IntrospectionField, + IntrospectionInputValue, + IntrospectionEnumValue, + IntrospectionDirective, +} from './getIntrospectionQuery'; + +// Gets the target Operation from a Document. +export { getOperationAST } from './getOperationAST'; + +// Gets the Type for the target Operation AST. +export { getOperationRootType } from './getOperationRootType'; + +// Convert a GraphQLSchema to an IntrospectionQuery. +export { introspectionFromSchema } from './introspectionFromSchema'; + +// Build a GraphQLSchema from an introspection result. +export { buildClientSchema } from './buildClientSchema'; + +// Build a GraphQLSchema from GraphQL Schema language. +export { buildASTSchema, buildSchema } from './buildASTSchema'; +export type { BuildSchemaOptions } from './buildASTSchema'; + +// Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST. +export { extendSchema } from './extendSchema'; + +// Sort a GraphQLSchema. +export { lexicographicSortSchema } from './lexicographicSortSchema'; + +// Print a GraphQLSchema to GraphQL Schema language. +export { + printSchema, + printType, + printIntrospectionSchema, +} from './printSchema'; + +// Create a GraphQLType from a GraphQL language AST. +export { typeFromAST } from './typeFromAST'; + +// Create a JavaScript value from a GraphQL language AST with a type. +export { valueFromAST } from './valueFromAST'; + +// Create a JavaScript value from a GraphQL language AST without a type. +export { valueFromASTUntyped } from './valueFromASTUntyped'; + +// Create a GraphQL language AST from a JavaScript value. +export { astFromValue } from './astFromValue'; + +// A helper to use within recursive-descent visitors which need to be aware of the GraphQL type system. +export { TypeInfo, visitWithTypeInfo } from './TypeInfo'; + +// Coerces a JavaScript value to a GraphQL type, or produces errors. +export { coerceInputValue } from './coerceInputValue'; + +// Concatenates multiple AST together. +export { concatAST } from './concatAST'; + +// Separates an AST into an AST per Operation. +export { separateOperations } from './separateOperations'; + +// Strips characters that are not significant to the validity or execution of a GraphQL document. +export { stripIgnoredCharacters } from './stripIgnoredCharacters'; + +// Comparators for types +export { + isEqualType, + isTypeSubTypeOf, + doTypesOverlap, +} from './typeComparators'; + +// Asserts that a string is a valid GraphQL name +export { assertValidName, isValidNameError } from './assertValidName'; + +// Compares two GraphQLSchemas and detects breaking changes. +export { + BreakingChangeType, + DangerousChangeType, + findBreakingChanges, + findDangerousChanges, +} from './findBreakingChanges'; +export type { BreakingChange, DangerousChange } from './findBreakingChanges'; + +// Wrapper type that contains DocumentNode and types that can be deduced from it. +export type { TypedQueryDocumentNode } from './typedQueryDocumentNode'; diff --git a/src/utilities/introspectionFromSchema.ts b/src/utilities/introspectionFromSchema.ts new file mode 100644 index 00000000..5b933c21 --- /dev/null +++ b/src/utilities/introspectionFromSchema.ts @@ -0,0 +1,40 @@ +import { invariant } from '../jsutils/invariant'; + +import { parse } from '../language/parser'; + +import type { GraphQLSchema } from '../type/schema'; + +import { executeSync } from '../execution/execute'; + +import type { + IntrospectionOptions, + IntrospectionQuery, +} from './getIntrospectionQuery'; +import { getIntrospectionQuery } from './getIntrospectionQuery'; + +/** + * Build an IntrospectionQuery from a GraphQLSchema + * + * IntrospectionQuery is useful for utilities that care about type and field + * relationships, but do not need to traverse through those relationships. + * + * This is the inverse of buildClientSchema. The primary use case is outside + * of the server context, for instance when doing schema comparisons. + */ +export function introspectionFromSchema( + schema: GraphQLSchema, + options?: IntrospectionOptions, +): IntrospectionQuery { + const optionsWithDefaults = { + specifiedByUrl: true, + directiveIsRepeatable: true, + schemaDescription: true, + inputValueDeprecation: true, + ...options, + }; + + const document = parse(getIntrospectionQuery(optionsWithDefaults)); + const result = executeSync({ schema, document }); + invariant(!result.errors && result.data); + return result.data as any; +} diff --git a/src/utilities/lexicographicSortSchema.ts b/src/utilities/lexicographicSortSchema.ts new file mode 100644 index 00000000..26b6908c --- /dev/null +++ b/src/utilities/lexicographicSortSchema.ts @@ -0,0 +1,190 @@ +import { inspect } from '../jsutils/inspect'; +import { invariant } from '../jsutils/invariant'; +import { keyValMap } from '../jsutils/keyValMap'; +import type { Maybe } from '../jsutils/Maybe'; +import { naturalCompare } from '../jsutils/naturalCompare'; +import type { ObjMap } from '../jsutils/ObjMap'; + +import type { + GraphQLFieldConfigArgumentMap, + GraphQLFieldConfigMap, + GraphQLInputFieldConfigMap, + GraphQLNamedType, + GraphQLType, +} from '../type/definition'; +import { + GraphQLEnumType, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLList, + GraphQLNonNull, + GraphQLObjectType, + GraphQLUnionType, + isEnumType, + isInputObjectType, + isInterfaceType, + isListType, + isNonNullType, + isObjectType, + isScalarType, + isUnionType, +} from '../type/definition'; +import { GraphQLDirective } from '../type/directives'; +import { isIntrospectionType } from '../type/introspection'; +import { GraphQLSchema } from '../type/schema'; + +/** + * Sort GraphQLSchema. + * + * This function returns a sorted copy of the given GraphQLSchema. + */ +export function lexicographicSortSchema(schema: GraphQLSchema): GraphQLSchema { + const schemaConfig = schema.toConfig(); + const typeMap = keyValMap( + sortByName(schemaConfig.types), + (type) => type.name, + sortNamedType, + ); + + return new GraphQLSchema({ + ...schemaConfig, + types: Object.values(typeMap), + directives: sortByName(schemaConfig.directives).map(sortDirective), + query: replaceMaybeType(schemaConfig.query), + mutation: replaceMaybeType(schemaConfig.mutation), + subscription: replaceMaybeType(schemaConfig.subscription), + }); + + function replaceType(type: T): T { + if (isListType(type)) { + // @ts-expect-error + return new GraphQLList(replaceType(type.ofType)); + } else if (isNonNullType(type)) { + // @ts-expect-error + return new GraphQLNonNull(replaceType(type.ofType)); + } + // @ts-expect-error FIXME: TS Conversion + return replaceNamedType(type); + } + + function replaceNamedType(type: T): T { + return typeMap[type.name] as T; + } + + function replaceMaybeType( + maybeType: Maybe, + ): Maybe { + return maybeType && replaceNamedType(maybeType); + } + + function sortDirective(directive: GraphQLDirective) { + const config = directive.toConfig(); + return new GraphQLDirective({ + ...config, + locations: sortBy(config.locations, (x) => x), + args: sortArgs(config.args), + }); + } + + function sortArgs(args: GraphQLFieldConfigArgumentMap) { + return sortObjMap(args, (arg) => ({ + ...arg, + type: replaceType(arg.type), + })); + } + + function sortFields(fieldsMap: GraphQLFieldConfigMap) { + return sortObjMap(fieldsMap, (field) => ({ + ...field, + type: replaceType(field.type), + args: field.args && sortArgs(field.args), + })); + } + + function sortInputFields(fieldsMap: GraphQLInputFieldConfigMap) { + return sortObjMap(fieldsMap, (field) => ({ + ...field, + type: replaceType(field.type), + })); + } + + function sortTypes( + array: ReadonlyArray, + ): Array { + return sortByName(array).map(replaceNamedType); + } + + function sortNamedType(type: GraphQLNamedType): GraphQLNamedType { + if (isScalarType(type) || isIntrospectionType(type)) { + return type; + } + if (isObjectType(type)) { + const config = type.toConfig(); + return new GraphQLObjectType({ + ...config, + interfaces: () => sortTypes(config.interfaces), + fields: () => sortFields(config.fields), + }); + } + if (isInterfaceType(type)) { + const config = type.toConfig(); + return new GraphQLInterfaceType({ + ...config, + interfaces: () => sortTypes(config.interfaces), + fields: () => sortFields(config.fields), + }); + } + if (isUnionType(type)) { + const config = type.toConfig(); + return new GraphQLUnionType({ + ...config, + types: () => sortTypes(config.types), + }); + } + if (isEnumType(type)) { + const config = type.toConfig(); + return new GraphQLEnumType({ + ...config, + values: sortObjMap(config.values, (value) => value), + }); + } + if (isInputObjectType(type)) { + const config = type.toConfig(); + return new GraphQLInputObjectType({ + ...config, + fields: () => sortInputFields(config.fields), + }); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + invariant(false, 'Unexpected type: ' + inspect(type)); + } +} + +function sortObjMap( + map: ObjMap, + sortValueFn: (value: T) => R, +): ObjMap { + const sortedMap = Object.create(null); + for (const key of Object.keys(map).sort(naturalCompare)) { + sortedMap[key] = sortValueFn(map[key]); + } + return sortedMap; +} + +function sortByName( + array: ReadonlyArray, +): Array { + return sortBy(array, (obj) => obj.name); +} + +function sortBy( + array: ReadonlyArray, + mapToKey: (item: T) => string, +): Array { + return array.slice().sort((obj1, obj2) => { + const key1 = mapToKey(obj1); + const key2 = mapToKey(obj2); + return naturalCompare(key1, key2); + }); +} diff --git a/src/utilities/printSchema.ts b/src/utilities/printSchema.ts new file mode 100644 index 00000000..83859fee --- /dev/null +++ b/src/utilities/printSchema.ts @@ -0,0 +1,326 @@ +import { inspect } from '../jsutils/inspect'; +import { invariant } from '../jsutils/invariant'; +import type { Maybe } from '../jsutils/Maybe'; + +import { isPrintableAsBlockString } from '../language/blockString'; +import { Kind } from '../language/kinds'; +import { print } from '../language/printer'; + +import type { + GraphQLArgument, + GraphQLEnumType, + GraphQLInputField, + GraphQLInputObjectType, + GraphQLInterfaceType, + GraphQLNamedType, + GraphQLObjectType, + GraphQLScalarType, + GraphQLUnionType, +} from '../type/definition'; +import { + isEnumType, + isInputObjectType, + isInterfaceType, + isObjectType, + isScalarType, + isUnionType, +} from '../type/definition'; +import type { GraphQLDirective } from '../type/directives'; +import { + DEFAULT_DEPRECATION_REASON, + isSpecifiedDirective, +} from '../type/directives'; +import { isIntrospectionType } from '../type/introspection'; +import { isSpecifiedScalarType } from '../type/scalars'; +import type { GraphQLSchema } from '../type/schema'; + +import { astFromValue } from './astFromValue'; + +export function printSchema(schema: GraphQLSchema): string { + return printFilteredSchema( + schema, + (n) => !isSpecifiedDirective(n), + isDefinedType, + ); +} + +export function printIntrospectionSchema(schema: GraphQLSchema): string { + return printFilteredSchema(schema, isSpecifiedDirective, isIntrospectionType); +} + +function isDefinedType(type: GraphQLNamedType): boolean { + return !isSpecifiedScalarType(type) && !isIntrospectionType(type); +} + +function printFilteredSchema( + schema: GraphQLSchema, + directiveFilter: (type: GraphQLDirective) => boolean, + typeFilter: (type: GraphQLNamedType) => boolean, +): string { + const directives = schema.getDirectives().filter(directiveFilter); + const types = Object.values(schema.getTypeMap()).filter(typeFilter); + + return [ + printSchemaDefinition(schema), + ...directives.map((directive) => printDirective(directive)), + ...types.map((type) => printType(type)), + ] + .filter(Boolean) + .join('\n\n'); +} + +function printSchemaDefinition(schema: GraphQLSchema): Maybe { + if (schema.description == null && isSchemaOfCommonNames(schema)) { + return; + } + + const operationTypes = []; + + const queryType = schema.getQueryType(); + if (queryType) { + operationTypes.push(` query: ${queryType.name}`); + } + + const mutationType = schema.getMutationType(); + if (mutationType) { + operationTypes.push(` mutation: ${mutationType.name}`); + } + + const subscriptionType = schema.getSubscriptionType(); + if (subscriptionType) { + operationTypes.push(` subscription: ${subscriptionType.name}`); + } + + return printDescription(schema) + `schema {\n${operationTypes.join('\n')}\n}`; +} + +/** + * GraphQL schema define root types for each type of operation. These types are + * the same as any other type and can be named in any manner, however there is + * a common naming convention: + * + * ```graphql + * schema { + * query: Query + * mutation: Mutation + * subscription: Subscription + * } + * ``` + * + * When using this naming convention, the schema description can be omitted. + */ +function isSchemaOfCommonNames(schema: GraphQLSchema): boolean { + const queryType = schema.getQueryType(); + if (queryType && queryType.name !== 'Query') { + return false; + } + + const mutationType = schema.getMutationType(); + if (mutationType && mutationType.name !== 'Mutation') { + return false; + } + + const subscriptionType = schema.getSubscriptionType(); + if (subscriptionType && subscriptionType.name !== 'Subscription') { + return false; + } + + return true; +} + +export function printType(type: GraphQLNamedType): string { + if (isScalarType(type)) { + return printScalar(type); + } + if (isObjectType(type)) { + return printObject(type); + } + if (isInterfaceType(type)) { + return printInterface(type); + } + if (isUnionType(type)) { + return printUnion(type); + } + if (isEnumType(type)) { + return printEnum(type); + } + if (isInputObjectType(type)) { + return printInputObject(type); + } + /* c8 ignore next 3 */ + // Not reachable, all possible types have been considered. + invariant(false, 'Unexpected type: ' + inspect(type)); +} + +function printScalar(type: GraphQLScalarType): string { + return ( + printDescription(type) + `scalar ${type.name}` + printSpecifiedByURL(type) + ); +} + +function printImplementedInterfaces( + type: GraphQLObjectType | GraphQLInterfaceType, +): string { + const interfaces = type.getInterfaces(); + return interfaces.length + ? ' implements ' + interfaces.map((i) => i.name).join(' & ') + : ''; +} + +function printObject(type: GraphQLObjectType): string { + return ( + printDescription(type) + + `type ${type.name}` + + printImplementedInterfaces(type) + + printFields(type) + ); +} + +function printInterface(type: GraphQLInterfaceType): string { + return ( + printDescription(type) + + `interface ${type.name}` + + printImplementedInterfaces(type) + + printFields(type) + ); +} + +function printUnion(type: GraphQLUnionType): string { + const types = type.getTypes(); + const possibleTypes = types.length ? ' = ' + types.join(' | ') : ''; + return printDescription(type) + 'union ' + type.name + possibleTypes; +} + +function printEnum(type: GraphQLEnumType): string { + const values = type + .getValues() + .map( + (value, i) => + printDescription(value, ' ', !i) + + ' ' + + value.name + + printDeprecated(value.deprecationReason), + ); + + return printDescription(type) + `enum ${type.name}` + printBlock(values); +} + +function printInputObject(type: GraphQLInputObjectType): string { + const fields = Object.values(type.getFields()).map( + (f, i) => printDescription(f, ' ', !i) + ' ' + printInputValue(f), + ); + return printDescription(type) + `input ${type.name}` + printBlock(fields); +} + +function printFields(type: GraphQLObjectType | GraphQLInterfaceType): string { + const fields = Object.values(type.getFields()).map( + (f, i) => + printDescription(f, ' ', !i) + + ' ' + + f.name + + printArgs(f.args, ' ') + + ': ' + + String(f.type) + + printDeprecated(f.deprecationReason), + ); + return printBlock(fields); +} + +function printBlock(items: ReadonlyArray): string { + return items.length !== 0 ? ' {\n' + items.join('\n') + '\n}' : ''; +} + +function printArgs( + args: ReadonlyArray, + indentation: string = '', +): string { + if (args.length === 0) { + return ''; + } + + // If every arg does not have a description, print them on one line. + if (args.every((arg) => !arg.description)) { + return '(' + args.map(printInputValue).join(', ') + ')'; + } + + return ( + '(\n' + + args + .map( + (arg, i) => + printDescription(arg, ' ' + indentation, !i) + + ' ' + + indentation + + printInputValue(arg), + ) + .join('\n') + + '\n' + + indentation + + ')' + ); +} + +function printInputValue(arg: GraphQLInputField): string { + const defaultAST = astFromValue(arg.defaultValue, arg.type); + let argDecl = arg.name + ': ' + String(arg.type); + if (defaultAST) { + argDecl += ` = ${print(defaultAST)}`; + } + return argDecl + printDeprecated(arg.deprecationReason); +} + +function printDirective(directive: GraphQLDirective): string { + return ( + printDescription(directive) + + 'directive @' + + directive.name + + printArgs(directive.args) + + (directive.isRepeatable ? ' repeatable' : '') + + ' on ' + + directive.locations.join(' | ') + ); +} + +function printDeprecated(reason: Maybe): string { + if (reason == null) { + return ''; + } + if (reason !== DEFAULT_DEPRECATION_REASON) { + const astValue = print({ kind: Kind.STRING, value: reason }); + return ` @deprecated(reason: ${astValue})`; + } + return ' @deprecated'; +} + +function printSpecifiedByURL(scalar: GraphQLScalarType): string { + if (scalar.specifiedByURL == null) { + return ''; + } + const astValue = print({ + kind: Kind.STRING, + value: scalar.specifiedByURL, + }); + return ` @specifiedBy(url: ${astValue})`; +} + +function printDescription( + def: { readonly description: Maybe }, + indentation: string = '', + firstInBlock: boolean = true, +): string { + const { description } = def; + if (description == null) { + return ''; + } + + const blockString = print({ + kind: Kind.STRING, + value: description, + block: isPrintableAsBlockString(description), + }); + + const prefix = + indentation && !firstInBlock ? '\n' + indentation : indentation; + + return prefix + blockString.replace(/\n/g, '\n' + indentation) + '\n'; +} diff --git a/src/utilities/separateOperations.ts b/src/utilities/separateOperations.ts new file mode 100644 index 00000000..84a8b774 --- /dev/null +++ b/src/utilities/separateOperations.ts @@ -0,0 +1,98 @@ +import type { ObjMap } from '../jsutils/ObjMap'; + +import type { + DocumentNode, + OperationDefinitionNode, + SelectionSetNode, +} from '../language/ast'; +import { Kind } from '../language/kinds'; +import { visit } from '../language/visitor'; + +/** + * separateOperations accepts a single AST document which may contain many + * operations and fragments and returns a collection of AST documents each of + * which contains a single operation as well the fragment definitions it + * refers to. + */ +export function separateOperations( + documentAST: DocumentNode, +): ObjMap { + const operations: Array = []; + const depGraph: DepGraph = Object.create(null); + + // Populate metadata and build a dependency graph. + for (const definitionNode of documentAST.definitions) { + switch (definitionNode.kind) { + case Kind.OPERATION_DEFINITION: + operations.push(definitionNode); + break; + case Kind.FRAGMENT_DEFINITION: + depGraph[definitionNode.name.value] = collectDependencies( + definitionNode.selectionSet, + ); + break; + default: + // ignore non-executable definitions + } + } + + // For each operation, produce a new synthesized AST which includes only what + // is necessary for completing that operation. + const separatedDocumentASTs = Object.create(null); + for (const operation of operations) { + const dependencies = new Set(); + + for (const fragmentName of collectDependencies(operation.selectionSet)) { + collectTransitiveDependencies(dependencies, depGraph, fragmentName); + } + + // Provides the empty string for anonymous operations. + const operationName = operation.name ? operation.name.value : ''; + + // The list of definition nodes to be included for this operation, sorted + // to retain the same order as the original document. + separatedDocumentASTs[operationName] = { + kind: Kind.DOCUMENT, + definitions: documentAST.definitions.filter( + (node) => + node === operation || + (node.kind === Kind.FRAGMENT_DEFINITION && + dependencies.has(node.name.value)), + ), + }; + } + + return separatedDocumentASTs; +} + +type DepGraph = ObjMap>; + +// From a dependency graph, collects a list of transitive dependencies by +// recursing through a dependency graph. +function collectTransitiveDependencies( + collected: Set, + depGraph: DepGraph, + fromName: string, +): void { + if (!collected.has(fromName)) { + collected.add(fromName); + + const immediateDeps = depGraph[fromName]; + if (immediateDeps !== undefined) { + for (const toName of immediateDeps) { + collectTransitiveDependencies(collected, depGraph, toName); + } + } + } +} + +function collectDependencies(selectionSet: SelectionSetNode): Array { + const dependencies: Array = []; + + visit(selectionSet, { + FragmentSpread(node) { + dependencies.push(node.name.value); + }, + }); + return dependencies; +} diff --git a/src/utilities/stripIgnoredCharacters.ts b/src/utilities/stripIgnoredCharacters.ts new file mode 100644 index 00000000..5eb5c980 --- /dev/null +++ b/src/utilities/stripIgnoredCharacters.ts @@ -0,0 +1,101 @@ +import { printBlockString } from '../language/blockString'; +import { isPunctuatorTokenKind, Lexer } from '../language/lexer'; +import { isSource, Source } from '../language/source'; +import { TokenKind } from '../language/tokenKind'; + +/** + * Strips characters that are not significant to the validity or execution + * of a GraphQL document: + * - UnicodeBOM + * - WhiteSpace + * - LineTerminator + * - Comment + * - Comma + * - BlockString indentation + * + * Note: It is required to have a delimiter character between neighboring + * non-punctuator tokens and this function always uses single space as delimiter. + * + * It is guaranteed that both input and output documents if parsed would result + * in the exact same AST except for nodes location. + * + * Warning: It is guaranteed that this function will always produce stable results. + * However, it's not guaranteed that it will stay the same between different + * releases due to bugfixes or changes in the GraphQL specification. + * + * Query example: + * + * ```graphql + * query SomeQuery($foo: String!, $bar: String) { + * someField(foo: $foo, bar: $bar) { + * a + * b { + * c + * d + * } + * } + * } + * ``` + * + * Becomes: + * + * ```graphql + * query SomeQuery($foo:String!$bar:String){someField(foo:$foo bar:$bar){a b{c d}}} + * ``` + * + * SDL example: + * + * ```graphql + * """ + * Type description + * """ + * type Foo { + * """ + * Field description + * """ + * bar: String + * } + * ``` + * + * Becomes: + * + * ```graphql + * """Type description""" type Foo{"""Field description""" bar:String} + * ``` + */ +export function stripIgnoredCharacters(source: string | Source): string { + const sourceObj = isSource(source) ? source : new Source(source); + + const body = sourceObj.body; + const lexer = new Lexer(sourceObj); + let strippedBody = ''; + + let wasLastAddedTokenNonPunctuator = false; + while (lexer.advance().kind !== TokenKind.EOF) { + const currentToken = lexer.token; + const tokenKind = currentToken.kind; + + /** + * Every two non-punctuator tokens should have space between them. + * Also prevent case of non-punctuator token following by spread resulting + * in invalid token (e.g. `1...` is invalid Float token). + */ + const isNonPunctuator = !isPunctuatorTokenKind(currentToken.kind); + if (wasLastAddedTokenNonPunctuator) { + if (isNonPunctuator || currentToken.kind === TokenKind.SPREAD) { + strippedBody += ' '; + } + } + + const tokenBody = body.slice(currentToken.start, currentToken.end); + if (tokenKind === TokenKind.BLOCK_STRING) { + strippedBody += printBlockString(currentToken.value, { minimize: true }); + } else { + strippedBody += tokenBody; + } + + wasLastAddedTokenNonPunctuator = isNonPunctuator; + } + + return strippedBody; +} diff --git a/src/utilities/typeComparators.ts b/src/utilities/typeComparators.ts new file mode 100644 index 00000000..287be40b --- /dev/null +++ b/src/utilities/typeComparators.ts @@ -0,0 +1,119 @@ +import type { GraphQLCompositeType, GraphQLType } from '../type/definition'; +import { + isAbstractType, + isInterfaceType, + isListType, + isNonNullType, + isObjectType, +} from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; + +/** + * Provided two types, return true if the types are equal (invariant). + */ +export function isEqualType(typeA: GraphQLType, typeB: GraphQLType): boolean { + // Equivalent types are equal. + if (typeA === typeB) { + return true; + } + + // If either type is non-null, the other must also be non-null. + if (isNonNullType(typeA) && isNonNullType(typeB)) { + return isEqualType(typeA.ofType, typeB.ofType); + } + + // If either type is a list, the other must also be a list. + if (isListType(typeA) && isListType(typeB)) { + return isEqualType(typeA.ofType, typeB.ofType); + } + + // Otherwise the types are not equal. + return false; +} + +/** + * Provided a type and a super type, return true if the first type is either + * equal or a subset of the second super type (covariant). + */ +export function isTypeSubTypeOf( + schema: GraphQLSchema, + maybeSubType: GraphQLType, + superType: GraphQLType, +): boolean { + // Equivalent type is a valid subtype + if (maybeSubType === superType) { + return true; + } + + // If superType is non-null, maybeSubType must also be non-null. + if (isNonNullType(superType)) { + if (isNonNullType(maybeSubType)) { + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); + } + return false; + } + if (isNonNullType(maybeSubType)) { + // If superType is nullable, maybeSubType may be non-null or nullable. + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType); + } + + // If superType type is a list, maybeSubType type must also be a list. + if (isListType(superType)) { + if (isListType(maybeSubType)) { + return isTypeSubTypeOf(schema, maybeSubType.ofType, superType.ofType); + } + return false; + } + if (isListType(maybeSubType)) { + // If superType is not a list, maybeSubType must also be not a list. + return false; + } + + // If superType type is an abstract type, check if it is super type of maybeSubType. + // Otherwise, the child type is not a valid subtype of the parent type. + return ( + isAbstractType(superType) && + (isInterfaceType(maybeSubType) || isObjectType(maybeSubType)) && + schema.isSubType(superType, maybeSubType) + ); +} + +/** + * Provided two composite types, determine if they "overlap". Two composite + * types overlap when the Sets of possible concrete types for each intersect. + * + * This is often used to determine if a fragment of a given type could possibly + * be visited in a context of another type. + * + * This function is commutative. + */ +export function doTypesOverlap( + schema: GraphQLSchema, + typeA: GraphQLCompositeType, + typeB: GraphQLCompositeType, +): boolean { + // Equivalent types overlap + if (typeA === typeB) { + return true; + } + + if (isAbstractType(typeA)) { + if (isAbstractType(typeB)) { + // If both types are abstract, then determine if there is any intersection + // between possible concrete types of each. + return schema + .getPossibleTypes(typeA) + .some((type) => schema.isSubType(typeB, type)); + } + // Determine if the latter type is a possible concrete type of the former. + return schema.isSubType(typeA, typeB); + } + + if (isAbstractType(typeB)) { + // Determine if the former type is a possible concrete type of the latter. + return schema.isSubType(typeB, typeA); + } + + // Otherwise the types do not overlap. + return false; +} diff --git a/src/utilities/typeFromAST.ts b/src/utilities/typeFromAST.ts new file mode 100644 index 00000000..7510df10 --- /dev/null +++ b/src/utilities/typeFromAST.ts @@ -0,0 +1,52 @@ +import type { + ListTypeNode, + NamedTypeNode, + NonNullTypeNode, + TypeNode, +} from '../language/ast'; +import { Kind } from '../language/kinds'; + +import type { GraphQLNamedType, GraphQLType } from '../type/definition'; +import { GraphQLList, GraphQLNonNull } from '../type/definition'; +import type { GraphQLSchema } from '../type/schema'; + +/** + * Given a Schema and an AST node describing a type, return a GraphQLType + * definition which applies to that type. For example, if provided the parsed + * AST node for `[User]`, a GraphQLList instance will be returned, containing + * the type called "User" found in the schema. If a type called "User" is not + * found in the schema, then undefined will be returned. + */ +export function typeFromAST( + schema: GraphQLSchema, + typeNode: NamedTypeNode, +): GraphQLNamedType | undefined; +export function typeFromAST( + schema: GraphQLSchema, + typeNode: ListTypeNode, +): GraphQLList | undefined; +export function typeFromAST( + schema: GraphQLSchema, + typeNode: NonNullTypeNode, +): GraphQLNonNull | undefined; +export function typeFromAST( + schema: GraphQLSchema, + typeNode: TypeNode, +): GraphQLType | undefined; +export function typeFromAST( + schema: GraphQLSchema, + typeNode: TypeNode, +): GraphQLType | undefined { + switch (typeNode.kind) { + case Kind.LIST_TYPE: { + const innerType = typeFromAST(schema, typeNode.type); + return innerType && new GraphQLList(innerType); + } + case Kind.NON_NULL_TYPE: { + const innerType = typeFromAST(schema, typeNode.type); + return innerType && new GraphQLNonNull(innerType); + } + case Kind.NAMED_TYPE: + return schema.getType(typeNode.name.value); + } +} diff --git a/src/utilities/typedQueryDocumentNode.ts b/src/utilities/typedQueryDocumentNode.ts new file mode 100644 index 00000000..1bd5cf08 --- /dev/null +++ b/src/utilities/typedQueryDocumentNode.ts @@ -0,0 +1,19 @@ +import type { DocumentNode, ExecutableDefinitionNode } from '../language/ast'; +/** + * Wrapper type that contains DocumentNode and types that can be deduced from it. + */ +export interface TypedQueryDocumentNode< + TResponseData = { [key: string]: any }, + TRequestVariables = { [key: string]: any }, +> extends DocumentNode { + readonly definitions: ReadonlyArray; + // FIXME: remove once TS implements proper way to enforce nominal typing + /** + * This type is used to ensure that the variables you pass in to the query are assignable to Variables + * and that the Result is assignable to whatever you pass your result to. The method is never actually + * implemented, but the type is valid because we list it as optional + */ + __ensureTypesOfVariablesAndResultMatching?: ( + variables: TRequestVariables, + ) => TResponseData; +} diff --git a/src/utilities/valueFromAST.ts b/src/utilities/valueFromAST.ts new file mode 100644 index 00000000..4f0cee6b --- /dev/null +++ b/src/utilities/valueFromAST.ts @@ -0,0 +1,161 @@ +import { inspect } from '../jsutils/inspect'; +import { invariant } from '../jsutils/invariant'; +import { keyMap } from '../jsutils/keyMap'; +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; + +import type { ValueNode } from '../language/ast'; +import { Kind } from '../language/kinds'; + +import type { GraphQLInputType } from '../type/definition'; +import { + isInputObjectType, + isLeafType, + isListType, + isNonNullType, +} from '../type/definition'; + +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * A GraphQL type must be provided, which will be used to interpret different + * GraphQL Value literals. + * + * Returns `undefined` when the value could not be validly coerced according to + * the provided type. + * + * | GraphQL Value | JSON Value | + * | -------------------- | ------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String | String | + * | Int / Float | Number | + * | Enum Value | Unknown | + * | NullValue | null | + * + */ +export function valueFromAST( + valueNode: Maybe, + type: GraphQLInputType, + variables?: Maybe>, +): unknown { + if (!valueNode) { + // When there is no node, then there is also no value. + // Importantly, this is different from returning the value null. + return; + } + + if (valueNode.kind === Kind.VARIABLE) { + const variableName = valueNode.name.value; + if (variables == null || variables[variableName] === undefined) { + // No valid return value. + return; + } + const variableValue = variables[variableName]; + if (variableValue === null && isNonNullType(type)) { + return; // Invalid: intentionally return no value. + } + // Note: This does no further checking that this variable is correct. + // This assumes that this query has been validated and the variable + // usage here is of the correct type. + return variableValue; + } + + if (isNonNullType(type)) { + if (valueNode.kind === Kind.NULL) { + return; // Invalid: intentionally return no value. + } + return valueFromAST(valueNode, type.ofType, variables); + } + + if (valueNode.kind === Kind.NULL) { + // This is explicitly returning the value null. + return null; + } + + if (isListType(type)) { + const itemType = type.ofType; + if (valueNode.kind === Kind.LIST) { + const coercedValues = []; + for (const itemNode of valueNode.values) { + if (isMissingVariable(itemNode, variables)) { + // If an array contains a missing variable, it is either coerced to + // null or if the item type is non-null, it considered invalid. + if (isNonNullType(itemType)) { + return; // Invalid: intentionally return no value. + } + coercedValues.push(null); + } else { + const itemValue = valueFromAST(itemNode, itemType, variables); + if (itemValue === undefined) { + return; // Invalid: intentionally return no value. + } + coercedValues.push(itemValue); + } + } + return coercedValues; + } + const coercedValue = valueFromAST(valueNode, itemType, variables); + if (coercedValue === undefined) { + return; // Invalid: intentionally return no value. + } + return [coercedValue]; + } + + if (isInputObjectType(type)) { + if (valueNode.kind !== Kind.OBJECT) { + return; // Invalid: intentionally return no value. + } + const coercedObj = Object.create(null); + const fieldNodes = keyMap(valueNode.fields, (field) => field.name.value); + for (const field of Object.values(type.getFields())) { + const fieldNode = fieldNodes[field.name]; + if (!fieldNode || isMissingVariable(fieldNode.value, variables)) { + if (field.defaultValue !== undefined) { + coercedObj[field.name] = field.defaultValue; + } else if (isNonNullType(field.type)) { + return; // Invalid: intentionally return no value. + } + continue; + } + const fieldValue = valueFromAST(fieldNode.value, field.type, variables); + if (fieldValue === undefined) { + return; // Invalid: intentionally return no value. + } + coercedObj[field.name] = fieldValue; + } + return coercedObj; + } + + if (isLeafType(type)) { + // Scalars and Enums fulfill parsing a literal value via parseLiteral(). + // Invalid values represent a failure to parse correctly, in which case + // no value is returned. + let result; + try { + result = type.parseLiteral(valueNode, variables); + } catch (_error) { + return; // Invalid: intentionally return no value. + } + if (result === undefined) { + return; // Invalid: intentionally return no value. + } + return result; + } + /* c8 ignore next 3 */ + // Not reachable, all possible input types have been considered. + invariant(false, 'Unexpected input type: ' + inspect(type)); +} + +// Returns true if the provided valueNode is a variable which is not defined +// in the set of variables. +function isMissingVariable( + valueNode: ValueNode, + variables: Maybe>, +): boolean { + return ( + valueNode.kind === Kind.VARIABLE && + (variables == null || variables[valueNode.name.value] === undefined) + ); +} diff --git a/src/utilities/valueFromASTUntyped.ts b/src/utilities/valueFromASTUntyped.ts new file mode 100644 index 00000000..05540da3 --- /dev/null +++ b/src/utilities/valueFromASTUntyped.ts @@ -0,0 +1,52 @@ +import { keyValMap } from '../jsutils/keyValMap'; +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; + +import type { ValueNode } from '../language/ast'; +import { Kind } from '../language/kinds'; + +/** + * Produces a JavaScript value given a GraphQL Value AST. + * + * Unlike `valueFromAST()`, no type is provided. The resulting JavaScript value + * will reflect the provided GraphQL value AST. + * + * | GraphQL Value | JavaScript Value | + * | -------------------- | ---------------- | + * | Input Object | Object | + * | List | Array | + * | Boolean | Boolean | + * | String / Enum | String | + * | Int / Float | Number | + * | Null | null | + * + */ +export function valueFromASTUntyped( + valueNode: ValueNode, + variables?: Maybe>, +): unknown { + switch (valueNode.kind) { + case Kind.NULL: + return null; + case Kind.INT: + return parseInt(valueNode.value, 10); + case Kind.FLOAT: + return parseFloat(valueNode.value); + case Kind.STRING: + case Kind.ENUM: + case Kind.BOOLEAN: + return valueNode.value; + case Kind.LIST: + return valueNode.values.map((node) => + valueFromASTUntyped(node, variables), + ); + case Kind.OBJECT: + return keyValMap( + valueNode.fields, + (field) => field.name.value, + (field) => valueFromASTUntyped(field.value, variables), + ); + case Kind.VARIABLE: + return variables?.[valueNode.name.value]; + } +} diff --git a/src/validation/README.md b/src/validation/README.md new file mode 100644 index 00000000..8a4a1c85 --- /dev/null +++ b/src/validation/README.md @@ -0,0 +1,9 @@ +## GraphQL Validation + +The `graphql/validation` module fulfills the Validation phase of fulfilling a +GraphQL result. + +```js +import { validate } from 'graphql/validation'; // ES6 +var GraphQLValidator = require('graphql/validation'); // CommonJS +``` diff --git a/src/validation/ValidationContext.ts b/src/validation/ValidationContext.ts new file mode 100644 index 00000000..f6944a6e --- /dev/null +++ b/src/validation/ValidationContext.ts @@ -0,0 +1,269 @@ +import type { Maybe } from '../jsutils/Maybe'; +import type { ObjMap } from '../jsutils/ObjMap'; + +import type { GraphQLError } from '../error/GraphQLError'; + +import type { + DocumentNode, + FragmentDefinitionNode, + FragmentSpreadNode, + OperationDefinitionNode, + SelectionSetNode, + VariableNode, +} from '../language/ast'; +import { Kind } from '../language/kinds'; +import type { ASTVisitor } from '../language/visitor'; +import { visit } from '../language/visitor'; + +import type { + GraphQLArgument, + GraphQLCompositeType, + GraphQLEnumValue, + GraphQLField, + GraphQLInputType, + GraphQLOutputType, +} from '../type/definition'; +import type { GraphQLDirective } from '../type/directives'; +import type { GraphQLSchema } from '../type/schema'; + +import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo'; + +type NodeWithSelectionSet = OperationDefinitionNode | FragmentDefinitionNode; +interface VariableUsage { + readonly node: VariableNode; + readonly type: Maybe; + readonly defaultValue: Maybe; +} + +/** + * An instance of this class is passed as the "this" context to all validators, + * allowing access to commonly useful contextual information from within a + * validation rule. + */ +export class ASTValidationContext { + private _ast: DocumentNode; + private _onError: (error: GraphQLError) => void; + private _fragments: ObjMap | undefined; + private _fragmentSpreads: Map>; + private _recursivelyReferencedFragments: Map< + OperationDefinitionNode, + Array + >; + + constructor(ast: DocumentNode, onError: (error: GraphQLError) => void) { + this._ast = ast; + this._fragments = undefined; + this._fragmentSpreads = new Map(); + this._recursivelyReferencedFragments = new Map(); + this._onError = onError; + } + + get [Symbol.toStringTag]() { + return 'ASTValidationContext'; + } + + reportError(error: GraphQLError): void { + this._onError(error); + } + + getDocument(): DocumentNode { + return this._ast; + } + + getFragment(name: string): Maybe { + let fragments: ObjMap; + if (this._fragments) { + fragments = this._fragments; + } else { + fragments = Object.create(null); + for (const defNode of this.getDocument().definitions) { + if (defNode.kind === Kind.FRAGMENT_DEFINITION) { + fragments[defNode.name.value] = defNode; + } + } + this._fragments = fragments; + } + return fragments[name]; + } + + getFragmentSpreads( + node: SelectionSetNode, + ): ReadonlyArray { + let spreads = this._fragmentSpreads.get(node); + if (!spreads) { + spreads = []; + const setsToVisit: Array = [node]; + let set: SelectionSetNode | undefined; + while ((set = setsToVisit.pop())) { + for (const selection of set.selections) { + if (selection.kind === Kind.FRAGMENT_SPREAD) { + spreads.push(selection); + } else if (selection.selectionSet) { + setsToVisit.push(selection.selectionSet); + } + } + } + this._fragmentSpreads.set(node, spreads); + } + return spreads; + } + + getRecursivelyReferencedFragments( + operation: OperationDefinitionNode, + ): ReadonlyArray { + let fragments = this._recursivelyReferencedFragments.get(operation); + if (!fragments) { + fragments = []; + const collectedNames = Object.create(null); + const nodesToVisit: Array = [operation.selectionSet]; + let node: SelectionSetNode | undefined; + while ((node = nodesToVisit.pop())) { + for (const spread of this.getFragmentSpreads(node)) { + const fragName = spread.name.value; + if (collectedNames[fragName] !== true) { + collectedNames[fragName] = true; + const fragment = this.getFragment(fragName); + if (fragment) { + fragments.push(fragment); + nodesToVisit.push(fragment.selectionSet); + } + } + } + } + this._recursivelyReferencedFragments.set(operation, fragments); + } + return fragments; + } +} + +export type ASTValidationRule = (context: ASTValidationContext) => ASTVisitor; + +export class SDLValidationContext extends ASTValidationContext { + private _schema: Maybe; + + constructor( + ast: DocumentNode, + schema: Maybe, + onError: (error: GraphQLError) => void, + ) { + super(ast, onError); + this._schema = schema; + } + + get [Symbol.toStringTag]() { + return 'SDLValidationContext'; + } + + getSchema(): Maybe { + return this._schema; + } +} + +export type SDLValidationRule = (context: SDLValidationContext) => ASTVisitor; + +export class ValidationContext extends ASTValidationContext { + private _schema: GraphQLSchema; + private _typeInfo: TypeInfo; + private _variableUsages: Map< + NodeWithSelectionSet, + ReadonlyArray + >; + + private _recursiveVariableUsages: Map< + OperationDefinitionNode, + ReadonlyArray + >; + + constructor( + schema: GraphQLSchema, + ast: DocumentNode, + typeInfo: TypeInfo, + onError: (error: GraphQLError) => void, + ) { + super(ast, onError); + this._schema = schema; + this._typeInfo = typeInfo; + this._variableUsages = new Map(); + this._recursiveVariableUsages = new Map(); + } + + get [Symbol.toStringTag]() { + return 'ValidationContext'; + } + + getSchema(): GraphQLSchema { + return this._schema; + } + + getVariableUsages(node: NodeWithSelectionSet): ReadonlyArray { + let usages = this._variableUsages.get(node); + if (!usages) { + const newUsages: Array = []; + const typeInfo = new TypeInfo(this._schema); + visit( + node, + visitWithTypeInfo(typeInfo, { + VariableDefinition: () => false, + Variable(variable) { + newUsages.push({ + node: variable, + type: typeInfo.getInputType(), + defaultValue: typeInfo.getDefaultValue(), + }); + }, + }), + ); + usages = newUsages; + this._variableUsages.set(node, usages); + } + return usages; + } + + getRecursiveVariableUsages( + operation: OperationDefinitionNode, + ): ReadonlyArray { + let usages = this._recursiveVariableUsages.get(operation); + if (!usages) { + usages = this.getVariableUsages(operation); + for (const frag of this.getRecursivelyReferencedFragments(operation)) { + usages = usages.concat(this.getVariableUsages(frag)); + } + this._recursiveVariableUsages.set(operation, usages); + } + return usages; + } + + getType(): Maybe { + return this._typeInfo.getType(); + } + + getParentType(): Maybe { + return this._typeInfo.getParentType(); + } + + getInputType(): Maybe { + return this._typeInfo.getInputType(); + } + + getParentInputType(): Maybe { + return this._typeInfo.getParentInputType(); + } + + getFieldDef(): Maybe> { + return this._typeInfo.getFieldDef(); + } + + getDirective(): Maybe { + return this._typeInfo.getDirective(); + } + + getArgument(): Maybe { + return this._typeInfo.getArgument(); + } + + getEnumValue(): Maybe { + return this._typeInfo.getEnumValue(); + } +} + +export type ValidationRule = (context: ValidationContext) => ASTVisitor; diff --git a/src/validation/__tests__/ExecutableDefinitionsRule-test.ts b/src/validation/__tests__/ExecutableDefinitionsRule-test.ts new file mode 100644 index 00000000..ec3a1afe --- /dev/null +++ b/src/validation/__tests__/ExecutableDefinitionsRule-test.ts @@ -0,0 +1,94 @@ +import { describe, it } from 'mocha'; + +import { ExecutableDefinitionsRule } from '../rules/ExecutableDefinitionsRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(ExecutableDefinitionsRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: Executable definitions', () => { + it('with only operation', () => { + expectValid(` + query Foo { + dog { + name + } + } + `); + }); + + it('with operation and fragment', () => { + expectValid(` + query Foo { + dog { + name + ...Frag + } + } + + fragment Frag on Dog { + name + } + `); + }); + + it('with type definition', () => { + expectErrors(` + query Foo { + dog { + name + } + } + + type Cow { + name: String + } + + extend type Dog { + color: String + } + `).toDeepEqual([ + { + message: 'The "Cow" definition is not executable.', + locations: [{ line: 8, column: 7 }], + }, + { + message: 'The "Dog" definition is not executable.', + locations: [{ line: 12, column: 7 }], + }, + ]); + }); + + it('with schema definition', () => { + expectErrors(` + schema { + query: Query + } + + type Query { + test: String + } + + extend schema @directive + `).toDeepEqual([ + { + message: 'The schema definition is not executable.', + locations: [{ line: 2, column: 7 }], + }, + { + message: 'The "Query" definition is not executable.', + locations: [{ line: 6, column: 7 }], + }, + { + message: 'The schema definition is not executable.', + locations: [{ line: 10, column: 7 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/FieldsOnCorrectTypeRule-test.ts b/src/validation/__tests__/FieldsOnCorrectTypeRule-test.ts new file mode 100644 index 00000000..70473fa6 --- /dev/null +++ b/src/validation/__tests__/FieldsOnCorrectTypeRule-test.ts @@ -0,0 +1,447 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { parse } from '../../language/parser'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { FieldsOnCorrectTypeRule } from '../rules/FieldsOnCorrectTypeRule'; +import { validate } from '../validate'; + +import { expectValidationErrorsWithSchema } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrorsWithSchema( + testSchema, + FieldsOnCorrectTypeRule, + queryStr, + ); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +const testSchema = buildSchema(` + interface Pet { + name: String + } + + type Dog implements Pet { + name: String + nickname: String + barkVolume: Int + } + + type Cat implements Pet { + name: String + nickname: String + meowVolume: Int + } + + union CatOrDog = Cat | Dog + + type Human { + name: String + pets: [Pet] + } + + type Query { + human: Human + } +`); + +describe('Validate: Fields on correct type', () => { + it('Object field selection', () => { + expectValid(` + fragment objectFieldSelection on Dog { + __typename + name + } + `); + }); + + it('Aliased object field selection', () => { + expectValid(` + fragment aliasedObjectFieldSelection on Dog { + tn : __typename + otherName : name + } + `); + }); + + it('Interface field selection', () => { + expectValid(` + fragment interfaceFieldSelection on Pet { + __typename + name + } + `); + }); + + it('Aliased interface field selection', () => { + expectValid(` + fragment interfaceFieldSelection on Pet { + otherName : name + } + `); + }); + + it('Lying alias selection', () => { + expectValid(` + fragment lyingAliasSelection on Dog { + name : nickname + } + `); + }); + + it('Ignores fields on unknown type', () => { + expectValid(` + fragment unknownSelection on UnknownType { + unknownField + } + `); + }); + + it('reports errors when type is known again', () => { + expectErrors(` + fragment typeKnownAgain on Pet { + unknown_pet_field { + ... on Cat { + unknown_cat_field + } + } + } + `).toDeepEqual([ + { + message: 'Cannot query field "unknown_pet_field" on type "Pet".', + locations: [{ line: 3, column: 9 }], + }, + { + message: 'Cannot query field "unknown_cat_field" on type "Cat".', + locations: [{ line: 5, column: 13 }], + }, + ]); + }); + + it('Field not defined on fragment', () => { + expectErrors(` + fragment fieldNotDefined on Dog { + meowVolume + } + `).toDeepEqual([ + { + message: + 'Cannot query field "meowVolume" on type "Dog". Did you mean "barkVolume"?', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('Ignores deeply unknown field', () => { + expectErrors(` + fragment deepFieldNotDefined on Dog { + unknown_field { + deeper_unknown_field + } + } + `).toDeepEqual([ + { + message: 'Cannot query field "unknown_field" on type "Dog".', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('Sub-field not defined', () => { + expectErrors(` + fragment subFieldNotDefined on Human { + pets { + unknown_field + } + } + `).toDeepEqual([ + { + message: 'Cannot query field "unknown_field" on type "Pet".', + locations: [{ line: 4, column: 11 }], + }, + ]); + }); + + it('Field not defined on inline fragment', () => { + expectErrors(` + fragment fieldNotDefined on Pet { + ... on Dog { + meowVolume + } + } + `).toDeepEqual([ + { + message: + 'Cannot query field "meowVolume" on type "Dog". Did you mean "barkVolume"?', + locations: [{ line: 4, column: 11 }], + }, + ]); + }); + + it('Aliased field target not defined', () => { + expectErrors(` + fragment aliasedFieldTargetNotDefined on Dog { + volume : mooVolume + } + `).toDeepEqual([ + { + message: + 'Cannot query field "mooVolume" on type "Dog". Did you mean "barkVolume"?', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('Aliased lying field target not defined', () => { + expectErrors(` + fragment aliasedLyingFieldTargetNotDefined on Dog { + barkVolume : kawVolume + } + `).toDeepEqual([ + { + message: + 'Cannot query field "kawVolume" on type "Dog". Did you mean "barkVolume"?', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('Not defined on interface', () => { + expectErrors(` + fragment notDefinedOnInterface on Pet { + tailLength + } + `).toDeepEqual([ + { + message: 'Cannot query field "tailLength" on type "Pet".', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('Defined on implementors but not on interface', () => { + expectErrors(` + fragment definedOnImplementorsButNotInterface on Pet { + nickname + } + `).toDeepEqual([ + { + message: + 'Cannot query field "nickname" on type "Pet". Did you mean to use an inline fragment on "Cat" or "Dog"?', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('Meta field selection on union', () => { + expectValid(` + fragment directFieldSelectionOnUnion on CatOrDog { + __typename + } + `); + }); + + it('Direct field selection on union', () => { + expectErrors(` + fragment directFieldSelectionOnUnion on CatOrDog { + directField + } + `).toDeepEqual([ + { + message: 'Cannot query field "directField" on type "CatOrDog".', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('Defined on implementors queried on union', () => { + expectErrors(` + fragment definedOnImplementorsQueriedOnUnion on CatOrDog { + name + } + `).toDeepEqual([ + { + message: + 'Cannot query field "name" on type "CatOrDog". Did you mean to use an inline fragment on "Pet", "Cat", or "Dog"?', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('valid field in inline fragment', () => { + expectValid(` + fragment objectFieldSelection on Pet { + ... on Dog { + name + } + ... { + name + } + } + `); + }); + + describe('Fields on correct type error message', () => { + function expectErrorMessage(schema: GraphQLSchema, queryStr: string) { + const errors = validate(schema, parse(queryStr), [ + FieldsOnCorrectTypeRule, + ]); + expect(errors.length).to.equal(1); + return expect(errors[0].message); + } + + it('Works with no suggestions', () => { + const schema = buildSchema(` + type T { + fieldWithVeryLongNameThatWillNeverBeSuggested: String + } + type Query { t: T } + `); + + expectErrorMessage(schema, '{ t { f } }').to.equal( + 'Cannot query field "f" on type "T".', + ); + }); + + it('Works with no small numbers of type suggestions', () => { + const schema = buildSchema(` + union T = A | B + type Query { t: T } + + type A { f: String } + type B { f: String } + `); + + expectErrorMessage(schema, '{ t { f } }').to.equal( + 'Cannot query field "f" on type "T". Did you mean to use an inline fragment on "A" or "B"?', + ); + }); + + it('Works with no small numbers of field suggestions', () => { + const schema = buildSchema(` + type T { + y: String + z: String + } + type Query { t: T } + `); + + expectErrorMessage(schema, '{ t { f } }').to.equal( + 'Cannot query field "f" on type "T". Did you mean "y" or "z"?', + ); + }); + + it('Only shows one set of suggestions at a time, preferring types', () => { + const schema = buildSchema(` + interface T { + y: String + z: String + } + type Query { t: T } + + type A implements T { + f: String + y: String + z: String + } + type B implements T { + f: String + y: String + z: String + } + `); + + expectErrorMessage(schema, '{ t { f } }').to.equal( + 'Cannot query field "f" on type "T". Did you mean to use an inline fragment on "A" or "B"?', + ); + }); + + it('Sort type suggestions based on inheritance order', () => { + const interfaceSchema = buildSchema(` + interface T { bar: String } + type Query { t: T } + + interface Z implements T { + foo: String + bar: String + } + + interface Y implements Z & T { + foo: String + bar: String + } + + type X implements Y & Z & T { + foo: String + bar: String + } + `); + + expectErrorMessage(interfaceSchema, '{ t { foo } }').to.equal( + 'Cannot query field "foo" on type "T". Did you mean to use an inline fragment on "Z", "Y", or "X"?', + ); + + const unionSchema = buildSchema(` + interface Animal { name: String } + interface Mammal implements Animal { name: String } + + interface Canine implements Animal & Mammal { name: String } + type Dog implements Animal & Mammal & Canine { name: String } + + interface Feline implements Animal & Mammal { name: String } + type Cat implements Animal & Mammal & Feline { name: String } + + union CatOrDog = Cat | Dog + type Query { catOrDog: CatOrDog } + `); + + expectErrorMessage(unionSchema, '{ catOrDog { name } }').to.equal( + 'Cannot query field "name" on type "CatOrDog". Did you mean to use an inline fragment on "Animal", "Mammal", "Canine", "Dog", or "Feline"?', + ); + }); + + it('Limits lots of type suggestions', () => { + const schema = buildSchema(` + union T = A | B | C | D | E | F + type Query { t: T } + + type A { f: String } + type B { f: String } + type C { f: String } + type D { f: String } + type E { f: String } + type F { f: String } + `); + + expectErrorMessage(schema, '{ t { f } }').to.equal( + 'Cannot query field "f" on type "T". Did you mean to use an inline fragment on "A", "B", "C", "D", or "E"?', + ); + }); + + it('Limits lots of field suggestions', () => { + const schema = buildSchema(` + type T { + u: String + v: String + w: String + x: String + y: String + z: String + } + type Query { t: T } + `); + + expectErrorMessage(schema, '{ t { f } }').to.equal( + 'Cannot query field "f" on type "T". Did you mean "u", "v", "w", "x", or "y"?', + ); + }); + }); +}); diff --git a/src/validation/__tests__/FragmentsOnCompositeTypesRule-test.ts b/src/validation/__tests__/FragmentsOnCompositeTypesRule-test.ts new file mode 100644 index 00000000..dc1ed407 --- /dev/null +++ b/src/validation/__tests__/FragmentsOnCompositeTypesRule-test.ts @@ -0,0 +1,126 @@ +import { describe, it } from 'mocha'; + +import { FragmentsOnCompositeTypesRule } from '../rules/FragmentsOnCompositeTypesRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(FragmentsOnCompositeTypesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: Fragments on composite types', () => { + it('object is valid fragment type', () => { + expectValid(` + fragment validFragment on Dog { + barks + } + `); + }); + + it('interface is valid fragment type', () => { + expectValid(` + fragment validFragment on Pet { + name + } + `); + }); + + it('object is valid inline fragment type', () => { + expectValid(` + fragment validFragment on Pet { + ... on Dog { + barks + } + } + `); + }); + + it('interface is valid inline fragment type', () => { + expectValid(` + fragment validFragment on Mammal { + ... on Canine { + name + } + } + `); + }); + + it('inline fragment without type is valid', () => { + expectValid(` + fragment validFragment on Pet { + ... { + name + } + } + `); + }); + + it('union is valid fragment type', () => { + expectValid(` + fragment validFragment on CatOrDog { + __typename + } + `); + }); + + it('scalar is invalid fragment type', () => { + expectErrors(` + fragment scalarFragment on Boolean { + bad + } + `).toDeepEqual([ + { + message: + 'Fragment "scalarFragment" cannot condition on non composite type "Boolean".', + locations: [{ line: 2, column: 34 }], + }, + ]); + }); + + it('enum is invalid fragment type', () => { + expectErrors(` + fragment scalarFragment on FurColor { + bad + } + `).toDeepEqual([ + { + message: + 'Fragment "scalarFragment" cannot condition on non composite type "FurColor".', + locations: [{ line: 2, column: 34 }], + }, + ]); + }); + + it('input object is invalid fragment type', () => { + expectErrors(` + fragment inputFragment on ComplexInput { + stringField + } + `).toDeepEqual([ + { + message: + 'Fragment "inputFragment" cannot condition on non composite type "ComplexInput".', + locations: [{ line: 2, column: 33 }], + }, + ]); + }); + + it('scalar is invalid inline fragment type', () => { + expectErrors(` + fragment invalidFragment on Pet { + ... on String { + barks + } + } + `).toDeepEqual([ + { + message: 'Fragment cannot condition on non composite type "String".', + locations: [{ line: 3, column: 16 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/KnownArgumentNamesRule-test.ts b/src/validation/__tests__/KnownArgumentNamesRule-test.ts new file mode 100644 index 00000000..4ce5fd19 --- /dev/null +++ b/src/validation/__tests__/KnownArgumentNamesRule-test.ts @@ -0,0 +1,329 @@ +import { describe, it } from 'mocha'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { + KnownArgumentNamesOnDirectivesRule, + KnownArgumentNamesRule, +} from '../rules/KnownArgumentNamesRule'; + +import { expectSDLValidationErrors, expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(KnownArgumentNamesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { + return expectSDLValidationErrors( + schema, + KnownArgumentNamesOnDirectivesRule, + sdlStr, + ); +} + +function expectValidSDL(sdlStr: string) { + expectSDLErrors(sdlStr).toDeepEqual([]); +} + +describe('Validate: Known argument names', () => { + it('single arg is known', () => { + expectValid(` + fragment argOnRequiredArg on Dog { + doesKnowCommand(dogCommand: SIT) + } + `); + }); + + it('multiple args are known', () => { + expectValid(` + fragment multipleArgs on ComplicatedArgs { + multipleReqs(req1: 1, req2: 2) + } + `); + }); + + it('ignores args of unknown fields', () => { + expectValid(` + fragment argOnUnknownField on Dog { + unknownField(unknownArg: SIT) + } + `); + }); + + it('multiple args in reverse order are known', () => { + expectValid(` + fragment multipleArgsReverseOrder on ComplicatedArgs { + multipleReqs(req2: 2, req1: 1) + } + `); + }); + + it('no args on optional arg', () => { + expectValid(` + fragment noArgOnOptionalArg on Dog { + isHouseTrained + } + `); + }); + + it('args are known deeply', () => { + expectValid(` + { + dog { + doesKnowCommand(dogCommand: SIT) + } + human { + pet { + ... on Dog { + doesKnowCommand(dogCommand: SIT) + } + } + } + } + `); + }); + + it('directive args are known', () => { + expectValid(` + { + dog @skip(if: true) + } + `); + }); + + it('field args are invalid', () => { + expectErrors(` + { + dog @skip(unless: true) + } + `).toDeepEqual([ + { + message: 'Unknown argument "unless" on directive "@skip".', + locations: [{ line: 3, column: 19 }], + }, + ]); + }); + + it('directive without args is valid', () => { + expectValid(` + { + dog @onField + } + `); + }); + + it('arg passed to directive without arg is reported', () => { + expectErrors(` + { + dog @onField(if: true) + } + `).toDeepEqual([ + { + message: 'Unknown argument "if" on directive "@onField".', + locations: [{ line: 3, column: 22 }], + }, + ]); + }); + + it('misspelled directive args are reported', () => { + expectErrors(` + { + dog @skip(iff: true) + } + `).toDeepEqual([ + { + message: + 'Unknown argument "iff" on directive "@skip". Did you mean "if"?', + locations: [{ line: 3, column: 19 }], + }, + ]); + }); + + it('invalid arg name', () => { + expectErrors(` + fragment invalidArgName on Dog { + doesKnowCommand(unknown: true) + } + `).toDeepEqual([ + { + message: 'Unknown argument "unknown" on field "Dog.doesKnowCommand".', + locations: [{ line: 3, column: 25 }], + }, + ]); + }); + + it('misspelled arg name is reported', () => { + expectErrors(` + fragment invalidArgName on Dog { + doesKnowCommand(DogCommand: true) + } + `).toDeepEqual([ + { + message: + 'Unknown argument "DogCommand" on field "Dog.doesKnowCommand". Did you mean "dogCommand"?', + locations: [{ line: 3, column: 25 }], + }, + ]); + }); + + it('unknown args amongst known args', () => { + expectErrors(` + fragment oneGoodArgOneInvalidArg on Dog { + doesKnowCommand(whoKnows: 1, dogCommand: SIT, unknown: true) + } + `).toDeepEqual([ + { + message: 'Unknown argument "whoKnows" on field "Dog.doesKnowCommand".', + locations: [{ line: 3, column: 25 }], + }, + { + message: 'Unknown argument "unknown" on field "Dog.doesKnowCommand".', + locations: [{ line: 3, column: 55 }], + }, + ]); + }); + + it('unknown args deeply', () => { + expectErrors(` + { + dog { + doesKnowCommand(unknown: true) + } + human { + pet { + ... on Dog { + doesKnowCommand(unknown: true) + } + } + } + } + `).toDeepEqual([ + { + message: 'Unknown argument "unknown" on field "Dog.doesKnowCommand".', + locations: [{ line: 4, column: 27 }], + }, + { + message: 'Unknown argument "unknown" on field "Dog.doesKnowCommand".', + locations: [{ line: 9, column: 31 }], + }, + ]); + }); + + describe('within SDL', () => { + it('known arg on directive defined inside SDL', () => { + expectValidSDL(` + type Query { + foo: String @test(arg: "") + } + + directive @test(arg: String) on FIELD_DEFINITION + `); + }); + + it('unknown arg on directive defined inside SDL', () => { + expectSDLErrors(` + type Query { + foo: String @test(unknown: "") + } + + directive @test(arg: String) on FIELD_DEFINITION + `).toDeepEqual([ + { + message: 'Unknown argument "unknown" on directive "@test".', + locations: [{ line: 3, column: 29 }], + }, + ]); + }); + + it('misspelled arg name is reported on directive defined inside SDL', () => { + expectSDLErrors(` + type Query { + foo: String @test(agr: "") + } + + directive @test(arg: String) on FIELD_DEFINITION + `).toDeepEqual([ + { + message: + 'Unknown argument "agr" on directive "@test". Did you mean "arg"?', + locations: [{ line: 3, column: 29 }], + }, + ]); + }); + + it('unknown arg on standard directive', () => { + expectSDLErrors(` + type Query { + foo: String @deprecated(unknown: "") + } + `).toDeepEqual([ + { + message: 'Unknown argument "unknown" on directive "@deprecated".', + locations: [{ line: 3, column: 35 }], + }, + ]); + }); + + it('unknown arg on overridden standard directive', () => { + expectSDLErrors(` + type Query { + foo: String @deprecated(reason: "") + } + directive @deprecated(arg: String) on FIELD + `).toDeepEqual([ + { + message: 'Unknown argument "reason" on directive "@deprecated".', + locations: [{ line: 3, column: 35 }], + }, + ]); + }); + + it('unknown arg on directive defined in schema extension', () => { + const schema = buildSchema(` + type Query { + foo: String + } + `); + expectSDLErrors( + ` + directive @test(arg: String) on OBJECT + + extend type Query @test(unknown: "") + `, + schema, + ).toDeepEqual([ + { + message: 'Unknown argument "unknown" on directive "@test".', + locations: [{ line: 4, column: 36 }], + }, + ]); + }); + + it('unknown arg on directive used in schema extension', () => { + const schema = buildSchema(` + directive @test(arg: String) on OBJECT + + type Query { + foo: String + } + `); + expectSDLErrors( + ` + extend type Query @test(unknown: "") + `, + schema, + ).toDeepEqual([ + { + message: 'Unknown argument "unknown" on directive "@test".', + locations: [{ line: 2, column: 35 }], + }, + ]); + }); + }); +}); diff --git a/src/validation/__tests__/KnownDirectivesRule-test.ts b/src/validation/__tests__/KnownDirectivesRule-test.ts new file mode 100644 index 00000000..4cb6e225 --- /dev/null +++ b/src/validation/__tests__/KnownDirectivesRule-test.ts @@ -0,0 +1,452 @@ +import { describe, it } from 'mocha'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { KnownDirectivesRule } from '../rules/KnownDirectivesRule'; + +import { + expectSDLValidationErrors, + expectValidationErrorsWithSchema, +} from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrorsWithSchema( + schemaWithDirectives, + KnownDirectivesRule, + queryStr, + ); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { + return expectSDLValidationErrors(schema, KnownDirectivesRule, sdlStr); +} + +function expectValidSDL(sdlStr: string, schema?: GraphQLSchema) { + expectSDLErrors(sdlStr, schema).toDeepEqual([]); +} + +const schemaWithDirectives = buildSchema(` + type Query { + dummy: String + } + + directive @onQuery on QUERY + directive @onMutation on MUTATION + directive @onSubscription on SUBSCRIPTION + directive @onField on FIELD + directive @onFragmentDefinition on FRAGMENT_DEFINITION + directive @onFragmentSpread on FRAGMENT_SPREAD + directive @onInlineFragment on INLINE_FRAGMENT + directive @onVariableDefinition on VARIABLE_DEFINITION +`); + +const schemaWithSDLDirectives = buildSchema(` + directive @onSchema on SCHEMA + directive @onScalar on SCALAR + directive @onObject on OBJECT + directive @onFieldDefinition on FIELD_DEFINITION + directive @onArgumentDefinition on ARGUMENT_DEFINITION + directive @onInterface on INTERFACE + directive @onUnion on UNION + directive @onEnum on ENUM + directive @onEnumValue on ENUM_VALUE + directive @onInputObject on INPUT_OBJECT + directive @onInputFieldDefinition on INPUT_FIELD_DEFINITION +`); + +describe('Validate: Known directives', () => { + it('with no directives', () => { + expectValid(` + query Foo { + name + ...Frag + } + + fragment Frag on Dog { + name + } + `); + }); + + it('with standard directives', () => { + expectValid(` + { + human @skip(if: false) { + name + pets { + ... on Dog @include(if: true) { + name + } + } + } + } + `); + }); + + it('with unknown directive', () => { + expectErrors(` + { + human @unknown(directive: "value") { + name + } + } + `).toDeepEqual([ + { + message: 'Unknown directive "@unknown".', + locations: [{ line: 3, column: 15 }], + }, + ]); + }); + + it('with many unknown directives', () => { + expectErrors(` + { + __typename @unknown + human @unknown { + name + pets @unknown { + name + } + } + } + `).toDeepEqual([ + { + message: 'Unknown directive "@unknown".', + locations: [{ line: 3, column: 20 }], + }, + { + message: 'Unknown directive "@unknown".', + locations: [{ line: 4, column: 15 }], + }, + { + message: 'Unknown directive "@unknown".', + locations: [{ line: 6, column: 16 }], + }, + ]); + }); + + it('with well placed directives', () => { + expectValid(` + query ($var: Boolean @onVariableDefinition) @onQuery { + human @onField { + ...Frag @onFragmentSpread + ... @onInlineFragment { + name @onField + } + } + } + + mutation @onMutation { + someField @onField + } + + subscription @onSubscription { + someField @onField + } + + fragment Frag on Human @onFragmentDefinition { + name @onField + } + `); + }); + + it('with misplaced directives', () => { + expectErrors(` + query ($var: Boolean @onQuery) @onMutation { + human @onQuery { + ...Frag @onQuery + ... @onQuery { + name @onQuery + } + } + } + + mutation @onQuery { + someField @onQuery + } + + subscription @onQuery { + someField @onQuery + } + + fragment Frag on Human @onQuery { + name @onQuery + } + `).toDeepEqual([ + { + message: 'Directive "@onQuery" may not be used on VARIABLE_DEFINITION.', + locations: [{ line: 2, column: 28 }], + }, + { + message: 'Directive "@onMutation" may not be used on QUERY.', + locations: [{ line: 2, column: 38 }], + }, + { + message: 'Directive "@onQuery" may not be used on FIELD.', + locations: [{ line: 3, column: 15 }], + }, + { + message: 'Directive "@onQuery" may not be used on FRAGMENT_SPREAD.', + locations: [{ line: 4, column: 19 }], + }, + { + message: 'Directive "@onQuery" may not be used on INLINE_FRAGMENT.', + locations: [{ line: 5, column: 15 }], + }, + { + message: 'Directive "@onQuery" may not be used on FIELD.', + locations: [{ line: 6, column: 18 }], + }, + { + message: 'Directive "@onQuery" may not be used on MUTATION.', + locations: [{ line: 11, column: 16 }], + }, + { + message: 'Directive "@onQuery" may not be used on FIELD.', + locations: [{ column: 19, line: 12 }], + }, + { + message: 'Directive "@onQuery" may not be used on SUBSCRIPTION.', + locations: [{ column: 20, line: 15 }], + }, + { + message: 'Directive "@onQuery" may not be used on FIELD.', + locations: [{ column: 19, line: 16 }], + }, + { + message: 'Directive "@onQuery" may not be used on FRAGMENT_DEFINITION.', + locations: [{ column: 30, line: 19 }], + }, + { + message: 'Directive "@onQuery" may not be used on FIELD.', + locations: [{ column: 14, line: 20 }], + }, + ]); + }); + + describe('within SDL', () => { + it('with directive defined inside SDL', () => { + expectValidSDL(` + type Query { + foo: String @test + } + + directive @test on FIELD_DEFINITION + `); + }); + + it('with standard directive', () => { + expectValidSDL(` + type Query { + foo: String @deprecated + } + `); + }); + + it('with overridden standard directive', () => { + expectValidSDL(` + schema @deprecated { + query: Query + } + directive @deprecated on SCHEMA + `); + }); + + it('with directive defined in schema extension', () => { + const schema = buildSchema(` + type Query { + foo: String + } + `); + expectValidSDL( + ` + directive @test on OBJECT + + extend type Query @test + `, + schema, + ); + }); + + it('with directive used in schema extension', () => { + const schema = buildSchema(` + directive @test on OBJECT + + type Query { + foo: String + } + `); + expectValidSDL( + ` + extend type Query @test + `, + schema, + ); + }); + + it('with unknown directive in schema extension', () => { + const schema = buildSchema(` + type Query { + foo: String + } + `); + expectSDLErrors( + ` + extend type Query @unknown + `, + schema, + ).toDeepEqual([ + { + message: 'Unknown directive "@unknown".', + locations: [{ line: 2, column: 29 }], + }, + ]); + }); + + it('with well placed directives', () => { + expectValidSDL( + ` + type MyObj implements MyInterface @onObject { + myField(myArg: Int @onArgumentDefinition): String @onFieldDefinition + } + + extend type MyObj @onObject + + scalar MyScalar @onScalar + + extend scalar MyScalar @onScalar + + interface MyInterface @onInterface { + myField(myArg: Int @onArgumentDefinition): String @onFieldDefinition + } + + extend interface MyInterface @onInterface + + union MyUnion @onUnion = MyObj | Other + + extend union MyUnion @onUnion + + enum MyEnum @onEnum { + MY_VALUE @onEnumValue + } + + extend enum MyEnum @onEnum + + input MyInput @onInputObject { + myField: Int @onInputFieldDefinition + } + + extend input MyInput @onInputObject + + schema @onSchema { + query: MyQuery + } + + extend schema @onSchema + `, + schemaWithSDLDirectives, + ); + }); + + it('with misplaced directives', () => { + expectSDLErrors( + ` + type MyObj implements MyInterface @onInterface { + myField(myArg: Int @onInputFieldDefinition): String @onInputFieldDefinition + } + + scalar MyScalar @onEnum + + interface MyInterface @onObject { + myField(myArg: Int @onInputFieldDefinition): String @onInputFieldDefinition + } + + union MyUnion @onEnumValue = MyObj | Other + + enum MyEnum @onScalar { + MY_VALUE @onUnion + } + + input MyInput @onEnum { + myField: Int @onArgumentDefinition + } + + schema @onObject { + query: MyQuery + } + + extend schema @onObject + `, + schemaWithSDLDirectives, + ).toDeepEqual([ + { + message: 'Directive "@onInterface" may not be used on OBJECT.', + locations: [{ line: 2, column: 45 }], + }, + { + message: + 'Directive "@onInputFieldDefinition" may not be used on ARGUMENT_DEFINITION.', + locations: [{ line: 3, column: 32 }], + }, + { + message: + 'Directive "@onInputFieldDefinition" may not be used on FIELD_DEFINITION.', + locations: [{ line: 3, column: 65 }], + }, + { + message: 'Directive "@onEnum" may not be used on SCALAR.', + locations: [{ line: 6, column: 27 }], + }, + { + message: 'Directive "@onObject" may not be used on INTERFACE.', + locations: [{ line: 8, column: 33 }], + }, + { + message: + 'Directive "@onInputFieldDefinition" may not be used on ARGUMENT_DEFINITION.', + locations: [{ line: 9, column: 32 }], + }, + { + message: + 'Directive "@onInputFieldDefinition" may not be used on FIELD_DEFINITION.', + locations: [{ line: 9, column: 65 }], + }, + { + message: 'Directive "@onEnumValue" may not be used on UNION.', + locations: [{ line: 12, column: 25 }], + }, + { + message: 'Directive "@onScalar" may not be used on ENUM.', + locations: [{ line: 14, column: 23 }], + }, + { + message: 'Directive "@onUnion" may not be used on ENUM_VALUE.', + locations: [{ line: 15, column: 22 }], + }, + { + message: 'Directive "@onEnum" may not be used on INPUT_OBJECT.', + locations: [{ line: 18, column: 25 }], + }, + { + message: + 'Directive "@onArgumentDefinition" may not be used on INPUT_FIELD_DEFINITION.', + locations: [{ line: 19, column: 26 }], + }, + { + message: 'Directive "@onObject" may not be used on SCHEMA.', + locations: [{ line: 22, column: 18 }], + }, + { + message: 'Directive "@onObject" may not be used on SCHEMA.', + locations: [{ line: 26, column: 25 }], + }, + ]); + }); + }); +}); diff --git a/src/validation/__tests__/KnownFragmentNamesRule-test.ts b/src/validation/__tests__/KnownFragmentNamesRule-test.ts new file mode 100644 index 00000000..c4257678 --- /dev/null +++ b/src/validation/__tests__/KnownFragmentNamesRule-test.ts @@ -0,0 +1,71 @@ +import { describe, it } from 'mocha'; + +import { KnownFragmentNamesRule } from '../rules/KnownFragmentNamesRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(KnownFragmentNamesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: Known fragment names', () => { + it('known fragment names are valid', () => { + expectValid(` + { + human(id: 4) { + ...HumanFields1 + ... on Human { + ...HumanFields2 + } + ... { + name + } + } + } + fragment HumanFields1 on Human { + name + ...HumanFields3 + } + fragment HumanFields2 on Human { + name + } + fragment HumanFields3 on Human { + name + } + `); + }); + + it('unknown fragment names are invalid', () => { + expectErrors(` + { + human(id: 4) { + ...UnknownFragment1 + ... on Human { + ...UnknownFragment2 + } + } + } + fragment HumanFields on Human { + name + ...UnknownFragment3 + } + `).toDeepEqual([ + { + message: 'Unknown fragment "UnknownFragment1".', + locations: [{ line: 4, column: 14 }], + }, + { + message: 'Unknown fragment "UnknownFragment2".', + locations: [{ line: 6, column: 16 }], + }, + { + message: 'Unknown fragment "UnknownFragment3".', + locations: [{ line: 12, column: 12 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/KnownTypeNamesRule-test.ts b/src/validation/__tests__/KnownTypeNamesRule-test.ts new file mode 100644 index 00000000..34f0ca71 --- /dev/null +++ b/src/validation/__tests__/KnownTypeNamesRule-test.ts @@ -0,0 +1,362 @@ +import { describe, it } from 'mocha'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { KnownTypeNamesRule } from '../rules/KnownTypeNamesRule'; + +import { + expectSDLValidationErrors, + expectValidationErrors, + expectValidationErrorsWithSchema, +} from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(KnownTypeNamesRule, queryStr); +} + +function expectErrorsWithSchema(schema: GraphQLSchema, queryStr: string) { + return expectValidationErrorsWithSchema(schema, KnownTypeNamesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { + return expectSDLValidationErrors(schema, KnownTypeNamesRule, sdlStr); +} + +function expectValidSDL(sdlStr: string, schema?: GraphQLSchema) { + expectSDLErrors(sdlStr, schema).toDeepEqual([]); +} + +describe('Validate: Known type names', () => { + it('known type names are valid', () => { + expectValid(` + query Foo( + $var: String + $required: [Int!]! + $introspectionType: __EnumValue + ) { + user(id: 4) { + pets { ... on Pet { name }, ...PetFields, ... { name } } + } + } + + fragment PetFields on Pet { + name + } + `); + }); + + it('unknown type names are invalid', () => { + expectErrors(` + query Foo($var: [JumbledUpLetters!]!) { + user(id: 4) { + name + pets { ... on Badger { name }, ...PetFields } + } + } + fragment PetFields on Peat { + name + } + `).toDeepEqual([ + { + message: 'Unknown type "JumbledUpLetters".', + locations: [{ line: 2, column: 24 }], + }, + { + message: 'Unknown type "Badger".', + locations: [{ line: 5, column: 25 }], + }, + { + message: 'Unknown type "Peat". Did you mean "Pet" or "Cat"?', + locations: [{ line: 8, column: 29 }], + }, + ]); + }); + + it('references to standard scalars that are missing in schema', () => { + const schema = buildSchema('type Query { foo: String }'); + const query = ` + query ($id: ID, $float: Float, $int: Int) { + __typename + } + `; + expectErrorsWithSchema(schema, query).toDeepEqual([ + { + message: 'Unknown type "ID".', + locations: [{ line: 2, column: 19 }], + }, + { + message: 'Unknown type "Float".', + locations: [{ line: 2, column: 31 }], + }, + { + message: 'Unknown type "Int".', + locations: [{ line: 2, column: 44 }], + }, + ]); + }); + + describe('within SDL', () => { + it('use standard types', () => { + expectValidSDL(` + type Query { + string: String + int: Int + float: Float + boolean: Boolean + id: ID + introspectionType: __EnumValue + } + `); + }); + + it('reference types defined inside the same document', () => { + expectValidSDL(` + union SomeUnion = SomeObject | AnotherObject + + type SomeObject implements SomeInterface { + someScalar(arg: SomeInputObject): SomeScalar + } + + type AnotherObject { + foo(arg: SomeInputObject): String + } + + type SomeInterface { + someScalar(arg: SomeInputObject): SomeScalar + } + + input SomeInputObject { + someScalar: SomeScalar + } + + scalar SomeScalar + + type RootQuery { + someInterface: SomeInterface + someUnion: SomeUnion + someScalar: SomeScalar + someObject: SomeObject + } + + schema { + query: RootQuery + } + `); + }); + + it('unknown type references', () => { + expectSDLErrors(` + type A + type B + + type SomeObject implements C { + e(d: D): E + } + + union SomeUnion = F | G + + interface SomeInterface { + i(h: H): I + } + + input SomeInput { + j: J + } + + directive @SomeDirective(k: K) on QUERY + + schema { + query: L + mutation: M + subscription: N + } + `).toDeepEqual([ + { + message: 'Unknown type "C". Did you mean "A" or "B"?', + locations: [{ line: 5, column: 36 }], + }, + { + message: 'Unknown type "D". Did you mean "A", "B", or "ID"?', + locations: [{ line: 6, column: 16 }], + }, + { + message: 'Unknown type "E". Did you mean "A" or "B"?', + locations: [{ line: 6, column: 20 }], + }, + { + message: 'Unknown type "F". Did you mean "A" or "B"?', + locations: [{ line: 9, column: 27 }], + }, + { + message: 'Unknown type "G". Did you mean "A" or "B"?', + locations: [{ line: 9, column: 31 }], + }, + { + message: 'Unknown type "H". Did you mean "A" or "B"?', + locations: [{ line: 12, column: 16 }], + }, + { + message: 'Unknown type "I". Did you mean "A", "B", or "ID"?', + locations: [{ line: 12, column: 20 }], + }, + { + message: 'Unknown type "J". Did you mean "A" or "B"?', + locations: [{ line: 16, column: 14 }], + }, + { + message: 'Unknown type "K". Did you mean "A" or "B"?', + locations: [{ line: 19, column: 37 }], + }, + { + message: 'Unknown type "L". Did you mean "A" or "B"?', + locations: [{ line: 22, column: 18 }], + }, + { + message: 'Unknown type "M". Did you mean "A" or "B"?', + locations: [{ line: 23, column: 21 }], + }, + { + message: 'Unknown type "N". Did you mean "A" or "B"?', + locations: [{ line: 24, column: 25 }], + }, + ]); + }); + + it('does not consider non-type definitions', () => { + expectSDLErrors(` + query Foo { __typename } + fragment Foo on Query { __typename } + directive @Foo on QUERY + + type Query { + foo: Foo + } + `).toDeepEqual([ + { + message: 'Unknown type "Foo".', + locations: [{ line: 7, column: 16 }], + }, + ]); + }); + + it('reference standard types inside extension document', () => { + const schema = buildSchema('type Foo'); + const sdl = ` + type SomeType { + string: String + int: Int + float: Float + boolean: Boolean + id: ID + introspectionType: __EnumValue + } + `; + + expectValidSDL(sdl, schema); + }); + + it('reference types inside extension document', () => { + const schema = buildSchema('type Foo'); + const sdl = ` + type QueryRoot { + foo: Foo + bar: Bar + } + + scalar Bar + + schema { + query: QueryRoot + } + `; + + expectValidSDL(sdl, schema); + }); + + it('unknown type references inside extension document', () => { + const schema = buildSchema('type A'); + const sdl = ` + type B + + type SomeObject implements C { + e(d: D): E + } + + union SomeUnion = F | G + + interface SomeInterface { + i(h: H): I + } + + input SomeInput { + j: J + } + + directive @SomeDirective(k: K) on QUERY + + schema { + query: L + mutation: M + subscription: N + } + `; + + expectSDLErrors(sdl, schema).toDeepEqual([ + { + message: 'Unknown type "C". Did you mean "A" or "B"?', + locations: [{ line: 4, column: 36 }], + }, + { + message: 'Unknown type "D". Did you mean "A", "B", or "ID"?', + locations: [{ line: 5, column: 16 }], + }, + { + message: 'Unknown type "E". Did you mean "A" or "B"?', + locations: [{ line: 5, column: 20 }], + }, + { + message: 'Unknown type "F". Did you mean "A" or "B"?', + locations: [{ line: 8, column: 27 }], + }, + { + message: 'Unknown type "G". Did you mean "A" or "B"?', + locations: [{ line: 8, column: 31 }], + }, + { + message: 'Unknown type "H". Did you mean "A" or "B"?', + locations: [{ line: 11, column: 16 }], + }, + { + message: 'Unknown type "I". Did you mean "A", "B", or "ID"?', + locations: [{ line: 11, column: 20 }], + }, + { + message: 'Unknown type "J". Did you mean "A" or "B"?', + locations: [{ line: 15, column: 14 }], + }, + { + message: 'Unknown type "K". Did you mean "A" or "B"?', + locations: [{ line: 18, column: 37 }], + }, + { + message: 'Unknown type "L". Did you mean "A" or "B"?', + locations: [{ line: 21, column: 18 }], + }, + { + message: 'Unknown type "M". Did you mean "A" or "B"?', + locations: [{ line: 22, column: 21 }], + }, + { + message: 'Unknown type "N". Did you mean "A" or "B"?', + locations: [{ line: 23, column: 25 }], + }, + ]); + }); + }); +}); diff --git a/src/validation/__tests__/LoneAnonymousOperationRule-test.ts b/src/validation/__tests__/LoneAnonymousOperationRule-test.ts new file mode 100644 index 00000000..a50ef1bd --- /dev/null +++ b/src/validation/__tests__/LoneAnonymousOperationRule-test.ts @@ -0,0 +1,106 @@ +import { describe, it } from 'mocha'; + +import { LoneAnonymousOperationRule } from '../rules/LoneAnonymousOperationRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(LoneAnonymousOperationRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: Anonymous operation must be alone', () => { + it('no operations', () => { + expectValid(` + fragment fragA on Type { + field + } + `); + }); + + it('one anon operation', () => { + expectValid(` + { + field + } + `); + }); + + it('multiple named operations', () => { + expectValid(` + query Foo { + field + } + + query Bar { + field + } + `); + }); + + it('anon operation with fragment', () => { + expectValid(` + { + ...Foo + } + fragment Foo on Type { + field + } + `); + }); + + it('multiple anon operations', () => { + expectErrors(` + { + fieldA + } + { + fieldB + } + `).toDeepEqual([ + { + message: 'This anonymous operation must be the only defined operation.', + locations: [{ line: 2, column: 7 }], + }, + { + message: 'This anonymous operation must be the only defined operation.', + locations: [{ line: 5, column: 7 }], + }, + ]); + }); + + it('anon operation with a mutation', () => { + expectErrors(` + { + fieldA + } + mutation Foo { + fieldB + } + `).toDeepEqual([ + { + message: 'This anonymous operation must be the only defined operation.', + locations: [{ line: 2, column: 7 }], + }, + ]); + }); + + it('anon operation with a subscription', () => { + expectErrors(` + { + fieldA + } + subscription Foo { + fieldB + } + `).toDeepEqual([ + { + message: 'This anonymous operation must be the only defined operation.', + locations: [{ line: 2, column: 7 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/LoneSchemaDefinitionRule-test.ts b/src/validation/__tests__/LoneSchemaDefinitionRule-test.ts new file mode 100644 index 00000000..3f2ea895 --- /dev/null +++ b/src/validation/__tests__/LoneSchemaDefinitionRule-test.ts @@ -0,0 +1,158 @@ +import { describe, it } from 'mocha'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { LoneSchemaDefinitionRule } from '../rules/LoneSchemaDefinitionRule'; + +import { expectSDLValidationErrors } from './harness'; + +function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { + return expectSDLValidationErrors(schema, LoneSchemaDefinitionRule, sdlStr); +} + +function expectValidSDL(sdlStr: string, schema?: GraphQLSchema) { + expectSDLErrors(sdlStr, schema).toDeepEqual([]); +} + +describe('Validate: Schema definition should be alone', () => { + it('no schema', () => { + expectValidSDL(` + type Query { + foo: String + } + `); + }); + + it('one schema definition', () => { + expectValidSDL(` + schema { + query: Foo + } + + type Foo { + foo: String + } + `); + }); + + it('multiple schema definitions', () => { + expectSDLErrors(` + schema { + query: Foo + } + + type Foo { + foo: String + } + + schema { + mutation: Foo + } + + schema { + subscription: Foo + } + `).toDeepEqual([ + { + message: 'Must provide only one schema definition.', + locations: [{ line: 10, column: 7 }], + }, + { + message: 'Must provide only one schema definition.', + locations: [{ line: 14, column: 7 }], + }, + ]); + }); + + it('define schema in schema extension', () => { + const schema = buildSchema(` + type Foo { + foo: String + } + `); + + expectSDLErrors( + ` + schema { + query: Foo + } + `, + schema, + ).toDeepEqual([]); + }); + + it('redefine schema in schema extension', () => { + const schema = buildSchema(` + schema { + query: Foo + } + + type Foo { + foo: String + } + `); + + expectSDLErrors( + ` + schema { + mutation: Foo + } + `, + schema, + ).toDeepEqual([ + { + message: 'Cannot define a new schema within a schema extension.', + locations: [{ line: 2, column: 9 }], + }, + ]); + }); + + it('redefine implicit schema in schema extension', () => { + const schema = buildSchema(` + type Query { + fooField: Foo + } + + type Foo { + foo: String + } + `); + + expectSDLErrors( + ` + schema { + mutation: Foo + } + `, + schema, + ).toDeepEqual([ + { + message: 'Cannot define a new schema within a schema extension.', + locations: [{ line: 2, column: 9 }], + }, + ]); + }); + + it('extend schema in schema extension', () => { + const schema = buildSchema(` + type Query { + fooField: Foo + } + + type Foo { + foo: String + } + `); + + expectValidSDL( + ` + extend schema { + mutation: Foo + } + `, + schema, + ); + }); +}); diff --git a/src/validation/__tests__/NoDeprecatedCustomRule-test.ts b/src/validation/__tests__/NoDeprecatedCustomRule-test.ts new file mode 100644 index 00000000..512edb27 --- /dev/null +++ b/src/validation/__tests__/NoDeprecatedCustomRule-test.ts @@ -0,0 +1,272 @@ +import { describe, it } from 'mocha'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { NoDeprecatedCustomRule } from '../rules/custom/NoDeprecatedCustomRule'; + +import { expectValidationErrorsWithSchema } from './harness'; + +function buildAssertion(sdlStr: string) { + const schema = buildSchema(sdlStr); + return { expectErrors, expectValid }; + + function expectErrors(queryStr: string) { + return expectValidationErrorsWithSchema( + schema, + NoDeprecatedCustomRule, + queryStr, + ); + } + + function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); + } +} + +describe('Validate: no deprecated', () => { + describe('no deprecated fields', () => { + const { expectValid, expectErrors } = buildAssertion(` + type Query { + normalField: String + deprecatedField: String @deprecated(reason: "Some field reason.") + } + `); + + it('ignores fields that are not deprecated', () => { + expectValid(` + { + normalField + } + `); + }); + + it('ignores unknown fields', () => { + expectValid(` + { + unknownField + } + + fragment UnknownFragment on UnknownType { + deprecatedField + } + `); + }); + + it('reports error when a deprecated field is selected', () => { + const message = + 'The field Query.deprecatedField is deprecated. Some field reason.'; + + expectErrors(` + { + deprecatedField + } + + fragment QueryFragment on Query { + deprecatedField + } + `).toDeepEqual([ + { message, locations: [{ line: 3, column: 11 }] }, + { message, locations: [{ line: 7, column: 11 }] }, + ]); + }); + }); + + describe('no deprecated arguments on fields', () => { + const { expectValid, expectErrors } = buildAssertion(` + type Query { + someField( + normalArg: String, + deprecatedArg: String @deprecated(reason: "Some arg reason."), + ): String + } + `); + + it('ignores arguments that are not deprecated', () => { + expectValid(` + { + normalField(normalArg: "") + } + `); + }); + + it('ignores unknown arguments', () => { + expectValid(` + { + someField(unknownArg: "") + unknownField(deprecatedArg: "") + } + `); + }); + + it('reports error when a deprecated argument is used', () => { + expectErrors(` + { + someField(deprecatedArg: "") + } + `).toDeepEqual([ + { + message: + 'Field "Query.someField" argument "deprecatedArg" is deprecated. Some arg reason.', + locations: [{ line: 3, column: 21 }], + }, + ]); + }); + }); + + describe('no deprecated arguments on directives', () => { + const { expectValid, expectErrors } = buildAssertion(` + type Query { + someField: String + } + + directive @someDirective( + normalArg: String, + deprecatedArg: String @deprecated(reason: "Some arg reason."), + ) on FIELD + `); + + it('ignores arguments that are not deprecated', () => { + expectValid(` + { + someField @someDirective(normalArg: "") + } + `); + }); + + it('ignores unknown arguments', () => { + expectValid(` + { + someField @someDirective(unknownArg: "") + someField @unknownDirective(deprecatedArg: "") + } + `); + }); + + it('reports error when a deprecated argument is used', () => { + expectErrors(` + { + someField @someDirective(deprecatedArg: "") + } + `).toDeepEqual([ + { + message: + 'Directive "@someDirective" argument "deprecatedArg" is deprecated. Some arg reason.', + locations: [{ line: 3, column: 36 }], + }, + ]); + }); + }); + + describe('no deprecated input fields', () => { + const { expectValid, expectErrors } = buildAssertion(` + input InputType { + normalField: String + deprecatedField: String @deprecated(reason: "Some input field reason.") + } + + type Query { + someField(someArg: InputType): String + } + + directive @someDirective(someArg: InputType) on FIELD + `); + + it('ignores input fields that are not deprecated', () => { + expectValid(` + { + someField( + someArg: { normalField: "" } + ) @someDirective(someArg: { normalField: "" }) + } + `); + }); + + it('ignores unknown input fields', () => { + expectValid(` + { + someField( + someArg: { unknownField: "" } + ) + + someField( + unknownArg: { unknownField: "" } + ) + + unknownField( + unknownArg: { unknownField: "" } + ) + } + `); + }); + + it('reports error when a deprecated input field is used', () => { + const message = + 'The input field InputType.deprecatedField is deprecated. Some input field reason.'; + + expectErrors(` + { + someField( + someArg: { deprecatedField: "" } + ) @someDirective(someArg: { deprecatedField: "" }) + } + `).toDeepEqual([ + { message, locations: [{ line: 4, column: 24 }] }, + { message, locations: [{ line: 5, column: 39 }] }, + ]); + }); + }); + + describe('no deprecated enum values', () => { + const { expectValid, expectErrors } = buildAssertion(` + enum EnumType { + NORMAL_VALUE + DEPRECATED_VALUE @deprecated(reason: "Some enum reason.") + } + + type Query { + someField(enumArg: EnumType): String + } + `); + + it('ignores enum values that are not deprecated', () => { + expectValid(` + { + normalField(enumArg: NORMAL_VALUE) + } + `); + }); + + it('ignores unknown enum values', () => { + expectValid(` + query ( + $unknownValue: EnumType = UNKNOWN_VALUE + $unknownType: UnknownType = UNKNOWN_VALUE + ) { + someField(enumArg: UNKNOWN_VALUE) + someField(unknownArg: UNKNOWN_VALUE) + unknownField(unknownArg: UNKNOWN_VALUE) + } + + fragment SomeFragment on Query { + someField(enumArg: UNKNOWN_VALUE) + } + `); + }); + + it('reports error when a deprecated enum value is used', () => { + const message = + 'The enum value "EnumType.DEPRECATED_VALUE" is deprecated. Some enum reason.'; + + expectErrors(` + query ( + $variable: EnumType = DEPRECATED_VALUE + ) { + someField(enumArg: DEPRECATED_VALUE) + } + `).toDeepEqual([ + { message, locations: [{ line: 3, column: 33 }] }, + { message, locations: [{ line: 5, column: 30 }] }, + ]); + }); + }); +}); diff --git a/src/validation/__tests__/NoFragmentCyclesRule-test.ts b/src/validation/__tests__/NoFragmentCyclesRule-test.ts new file mode 100644 index 00000000..08ac4cb4 --- /dev/null +++ b/src/validation/__tests__/NoFragmentCyclesRule-test.ts @@ -0,0 +1,260 @@ +import { describe, it } from 'mocha'; + +import { NoFragmentCyclesRule } from '../rules/NoFragmentCyclesRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(NoFragmentCyclesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: No circular fragment spreads', () => { + it('single reference is valid', () => { + expectValid(` + fragment fragA on Dog { ...fragB } + fragment fragB on Dog { name } + `); + }); + + it('spreading twice is not circular', () => { + expectValid(` + fragment fragA on Dog { ...fragB, ...fragB } + fragment fragB on Dog { name } + `); + }); + + it('spreading twice indirectly is not circular', () => { + expectValid(` + fragment fragA on Dog { ...fragB, ...fragC } + fragment fragB on Dog { ...fragC } + fragment fragC on Dog { name } + `); + }); + + it('double spread within abstract types', () => { + expectValid(` + fragment nameFragment on Pet { + ... on Dog { name } + ... on Cat { name } + } + + fragment spreadsInAnon on Pet { + ... on Dog { ...nameFragment } + ... on Cat { ...nameFragment } + } + `); + }); + + it('does not false positive on unknown fragment', () => { + expectValid(` + fragment nameFragment on Pet { + ...UnknownFragment + } + `); + }); + + it('spreading recursively within field fails', () => { + expectErrors(` + fragment fragA on Human { relatives { ...fragA } }, + `).toDeepEqual([ + { + message: 'Cannot spread fragment "fragA" within itself.', + locations: [{ line: 2, column: 45 }], + }, + ]); + }); + + it('no spreading itself directly', () => { + expectErrors(` + fragment fragA on Dog { ...fragA } + `).toDeepEqual([ + { + message: 'Cannot spread fragment "fragA" within itself.', + locations: [{ line: 2, column: 31 }], + }, + ]); + }); + + it('no spreading itself directly within inline fragment', () => { + expectErrors(` + fragment fragA on Pet { + ... on Dog { + ...fragA + } + } + `).toDeepEqual([ + { + message: 'Cannot spread fragment "fragA" within itself.', + locations: [{ line: 4, column: 11 }], + }, + ]); + }); + + it('no spreading itself indirectly', () => { + expectErrors(` + fragment fragA on Dog { ...fragB } + fragment fragB on Dog { ...fragA } + `).toDeepEqual([ + { + message: 'Cannot spread fragment "fragA" within itself via "fragB".', + locations: [ + { line: 2, column: 31 }, + { line: 3, column: 31 }, + ], + }, + ]); + }); + + it('no spreading itself indirectly reports opposite order', () => { + expectErrors(` + fragment fragB on Dog { ...fragA } + fragment fragA on Dog { ...fragB } + `).toDeepEqual([ + { + message: 'Cannot spread fragment "fragB" within itself via "fragA".', + locations: [ + { line: 2, column: 31 }, + { line: 3, column: 31 }, + ], + }, + ]); + }); + + it('no spreading itself indirectly within inline fragment', () => { + expectErrors(` + fragment fragA on Pet { + ... on Dog { + ...fragB + } + } + fragment fragB on Pet { + ... on Dog { + ...fragA + } + } + `).toDeepEqual([ + { + message: 'Cannot spread fragment "fragA" within itself via "fragB".', + locations: [ + { line: 4, column: 11 }, + { line: 9, column: 11 }, + ], + }, + ]); + }); + + it('no spreading itself deeply', () => { + expectErrors(` + fragment fragA on Dog { ...fragB } + fragment fragB on Dog { ...fragC } + fragment fragC on Dog { ...fragO } + fragment fragX on Dog { ...fragY } + fragment fragY on Dog { ...fragZ } + fragment fragZ on Dog { ...fragO } + fragment fragO on Dog { ...fragP } + fragment fragP on Dog { ...fragA, ...fragX } + `).toDeepEqual([ + { + message: + 'Cannot spread fragment "fragA" within itself via "fragB", "fragC", "fragO", "fragP".', + locations: [ + { line: 2, column: 31 }, + { line: 3, column: 31 }, + { line: 4, column: 31 }, + { line: 8, column: 31 }, + { line: 9, column: 31 }, + ], + }, + { + message: + 'Cannot spread fragment "fragO" within itself via "fragP", "fragX", "fragY", "fragZ".', + locations: [ + { line: 8, column: 31 }, + { line: 9, column: 41 }, + { line: 5, column: 31 }, + { line: 6, column: 31 }, + { line: 7, column: 31 }, + ], + }, + ]); + }); + + it('no spreading itself deeply two paths', () => { + expectErrors(` + fragment fragA on Dog { ...fragB, ...fragC } + fragment fragB on Dog { ...fragA } + fragment fragC on Dog { ...fragA } + `).toDeepEqual([ + { + message: 'Cannot spread fragment "fragA" within itself via "fragB".', + locations: [ + { line: 2, column: 31 }, + { line: 3, column: 31 }, + ], + }, + { + message: 'Cannot spread fragment "fragA" within itself via "fragC".', + locations: [ + { line: 2, column: 41 }, + { line: 4, column: 31 }, + ], + }, + ]); + }); + + it('no spreading itself deeply two paths -- alt traverse order', () => { + expectErrors(` + fragment fragA on Dog { ...fragC } + fragment fragB on Dog { ...fragC } + fragment fragC on Dog { ...fragA, ...fragB } + `).toDeepEqual([ + { + message: 'Cannot spread fragment "fragA" within itself via "fragC".', + locations: [ + { line: 2, column: 31 }, + { line: 4, column: 31 }, + ], + }, + { + message: 'Cannot spread fragment "fragC" within itself via "fragB".', + locations: [ + { line: 4, column: 41 }, + { line: 3, column: 31 }, + ], + }, + ]); + }); + + it('no spreading itself deeply and immediately', () => { + expectErrors(` + fragment fragA on Dog { ...fragB } + fragment fragB on Dog { ...fragB, ...fragC } + fragment fragC on Dog { ...fragA, ...fragB } + `).toDeepEqual([ + { + message: 'Cannot spread fragment "fragB" within itself.', + locations: [{ line: 3, column: 31 }], + }, + { + message: + 'Cannot spread fragment "fragA" within itself via "fragB", "fragC".', + locations: [ + { line: 2, column: 31 }, + { line: 3, column: 41 }, + { line: 4, column: 31 }, + ], + }, + { + message: 'Cannot spread fragment "fragB" within itself via "fragC".', + locations: [ + { line: 3, column: 41 }, + { line: 4, column: 41 }, + ], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/NoSchemaIntrospectionCustomRule-test.ts b/src/validation/__tests__/NoSchemaIntrospectionCustomRule-test.ts new file mode 100644 index 00000000..cd681a7e --- /dev/null +++ b/src/validation/__tests__/NoSchemaIntrospectionCustomRule-test.ts @@ -0,0 +1,140 @@ +import { describe, it } from 'mocha'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { NoSchemaIntrospectionCustomRule } from '../rules/custom/NoSchemaIntrospectionCustomRule'; + +import { expectValidationErrorsWithSchema } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrorsWithSchema( + schema, + NoSchemaIntrospectionCustomRule, + queryStr, + ); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +const schema = buildSchema(` + type Query { + someQuery: SomeType + } + + type SomeType { + someField: String + introspectionField: __EnumValue + } +`); + +describe('Validate: Prohibit introspection queries', () => { + it('ignores valid fields including __typename', () => { + expectValid(` + { + someQuery { + __typename + someField + } + } + `); + }); + + it('ignores fields not in the schema', () => { + expectValid(` + { + __introspect + } + `); + }); + + it('reports error when a field with an introspection type is requested', () => { + expectErrors(` + { + __schema { + queryType { + name + } + } + } + `).toDeepEqual([ + { + message: + 'GraphQL introspection has been disabled, but the requested query contained the field "__schema".', + locations: [{ line: 3, column: 9 }], + }, + { + message: + 'GraphQL introspection has been disabled, but the requested query contained the field "queryType".', + locations: [{ line: 4, column: 11 }], + }, + ]); + }); + + it('reports error when a field with an introspection type is requested and aliased', () => { + expectErrors(` + { + s: __schema { + queryType { + name + } + } + } + `).toDeepEqual([ + { + message: + 'GraphQL introspection has been disabled, but the requested query contained the field "__schema".', + locations: [{ line: 3, column: 9 }], + }, + { + message: + 'GraphQL introspection has been disabled, but the requested query contained the field "queryType".', + locations: [{ line: 4, column: 11 }], + }, + ]); + }); + + it('reports error when using a fragment with a field with an introspection type', () => { + expectErrors(` + { + ...QueryFragment + } + + fragment QueryFragment on Query { + __schema { + queryType { + name + } + } + } + `).toDeepEqual([ + { + message: + 'GraphQL introspection has been disabled, but the requested query contained the field "__schema".', + locations: [{ line: 7, column: 9 }], + }, + { + message: + 'GraphQL introspection has been disabled, but the requested query contained the field "queryType".', + locations: [{ line: 8, column: 11 }], + }, + ]); + }); + + it('reports error for non-standard introspection fields', () => { + expectErrors(` + { + someQuery { + introspectionField + } + } + `).toDeepEqual([ + { + message: + 'GraphQL introspection has been disabled, but the requested query contained the field "introspectionField".', + locations: [{ line: 4, column: 11 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/NoUndefinedVariablesRule-test.ts b/src/validation/__tests__/NoUndefinedVariablesRule-test.ts new file mode 100644 index 00000000..e027d4a4 --- /dev/null +++ b/src/validation/__tests__/NoUndefinedVariablesRule-test.ts @@ -0,0 +1,407 @@ +import { describe, it } from 'mocha'; + +import { NoUndefinedVariablesRule } from '../rules/NoUndefinedVariablesRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(NoUndefinedVariablesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: No undefined variables', () => { + it('all variables defined', () => { + expectValid(` + query Foo($a: String, $b: String, $c: String) { + field(a: $a, b: $b, c: $c) + } + `); + }); + + it('all variables deeply defined', () => { + expectValid(` + query Foo($a: String, $b: String, $c: String) { + field(a: $a) { + field(b: $b) { + field(c: $c) + } + } + } + `); + }); + + it('all variables deeply in inline fragments defined', () => { + expectValid(` + query Foo($a: String, $b: String, $c: String) { + ... on Type { + field(a: $a) { + field(b: $b) { + ... on Type { + field(c: $c) + } + } + } + } + } + `); + }); + + it('all variables in fragments deeply defined', () => { + expectValid(` + query Foo($a: String, $b: String, $c: String) { + ...FragA + } + fragment FragA on Type { + field(a: $a) { + ...FragB + } + } + fragment FragB on Type { + field(b: $b) { + ...FragC + } + } + fragment FragC on Type { + field(c: $c) + } + `); + }); + + it('variable within single fragment defined in multiple operations', () => { + expectValid(` + query Foo($a: String) { + ...FragA + } + query Bar($a: String) { + ...FragA + } + fragment FragA on Type { + field(a: $a) + } + `); + }); + + it('variable within fragments defined in operations', () => { + expectValid(` + query Foo($a: String) { + ...FragA + } + query Bar($b: String) { + ...FragB + } + fragment FragA on Type { + field(a: $a) + } + fragment FragB on Type { + field(b: $b) + } + `); + }); + + it('variable within recursive fragment defined', () => { + expectValid(` + query Foo($a: String) { + ...FragA + } + fragment FragA on Type { + field(a: $a) { + ...FragA + } + } + `); + }); + + it('variable not defined', () => { + expectErrors(` + query Foo($a: String, $b: String, $c: String) { + field(a: $a, b: $b, c: $c, d: $d) + } + `).toDeepEqual([ + { + message: 'Variable "$d" is not defined by operation "Foo".', + locations: [ + { line: 3, column: 39 }, + { line: 2, column: 7 }, + ], + }, + ]); + }); + + it('variable not defined by un-named query', () => { + expectErrors(` + { + field(a: $a) + } + `).toDeepEqual([ + { + message: 'Variable "$a" is not defined.', + locations: [ + { line: 3, column: 18 }, + { line: 2, column: 7 }, + ], + }, + ]); + }); + + it('multiple variables not defined', () => { + expectErrors(` + query Foo($b: String) { + field(a: $a, b: $b, c: $c) + } + `).toDeepEqual([ + { + message: 'Variable "$a" is not defined by operation "Foo".', + locations: [ + { line: 3, column: 18 }, + { line: 2, column: 7 }, + ], + }, + { + message: 'Variable "$c" is not defined by operation "Foo".', + locations: [ + { line: 3, column: 32 }, + { line: 2, column: 7 }, + ], + }, + ]); + }); + + it('variable in fragment not defined by un-named query', () => { + expectErrors(` + { + ...FragA + } + fragment FragA on Type { + field(a: $a) + } + `).toDeepEqual([ + { + message: 'Variable "$a" is not defined.', + locations: [ + { line: 6, column: 18 }, + { line: 2, column: 7 }, + ], + }, + ]); + }); + + it('variable in fragment not defined by operation', () => { + expectErrors(` + query Foo($a: String, $b: String) { + ...FragA + } + fragment FragA on Type { + field(a: $a) { + ...FragB + } + } + fragment FragB on Type { + field(b: $b) { + ...FragC + } + } + fragment FragC on Type { + field(c: $c) + } + `).toDeepEqual([ + { + message: 'Variable "$c" is not defined by operation "Foo".', + locations: [ + { line: 16, column: 18 }, + { line: 2, column: 7 }, + ], + }, + ]); + }); + + it('multiple variables in fragments not defined', () => { + expectErrors(` + query Foo($b: String) { + ...FragA + } + fragment FragA on Type { + field(a: $a) { + ...FragB + } + } + fragment FragB on Type { + field(b: $b) { + ...FragC + } + } + fragment FragC on Type { + field(c: $c) + } + `).toDeepEqual([ + { + message: 'Variable "$a" is not defined by operation "Foo".', + locations: [ + { line: 6, column: 18 }, + { line: 2, column: 7 }, + ], + }, + { + message: 'Variable "$c" is not defined by operation "Foo".', + locations: [ + { line: 16, column: 18 }, + { line: 2, column: 7 }, + ], + }, + ]); + }); + + it('single variable in fragment not defined by multiple operations', () => { + expectErrors(` + query Foo($a: String) { + ...FragAB + } + query Bar($a: String) { + ...FragAB + } + fragment FragAB on Type { + field(a: $a, b: $b) + } + `).toDeepEqual([ + { + message: 'Variable "$b" is not defined by operation "Foo".', + locations: [ + { line: 9, column: 25 }, + { line: 2, column: 7 }, + ], + }, + { + message: 'Variable "$b" is not defined by operation "Bar".', + locations: [ + { line: 9, column: 25 }, + { line: 5, column: 7 }, + ], + }, + ]); + }); + + it('variables in fragment not defined by multiple operations', () => { + expectErrors(` + query Foo($b: String) { + ...FragAB + } + query Bar($a: String) { + ...FragAB + } + fragment FragAB on Type { + field(a: $a, b: $b) + } + `).toDeepEqual([ + { + message: 'Variable "$a" is not defined by operation "Foo".', + locations: [ + { line: 9, column: 18 }, + { line: 2, column: 7 }, + ], + }, + { + message: 'Variable "$b" is not defined by operation "Bar".', + locations: [ + { line: 9, column: 25 }, + { line: 5, column: 7 }, + ], + }, + ]); + }); + + it('variable in fragment used by other operation', () => { + expectErrors(` + query Foo($b: String) { + ...FragA + } + query Bar($a: String) { + ...FragB + } + fragment FragA on Type { + field(a: $a) + } + fragment FragB on Type { + field(b: $b) + } + `).toDeepEqual([ + { + message: 'Variable "$a" is not defined by operation "Foo".', + locations: [ + { line: 9, column: 18 }, + { line: 2, column: 7 }, + ], + }, + { + message: 'Variable "$b" is not defined by operation "Bar".', + locations: [ + { line: 12, column: 18 }, + { line: 5, column: 7 }, + ], + }, + ]); + }); + + it('multiple undefined variables produce multiple errors', () => { + expectErrors(` + query Foo($b: String) { + ...FragAB + } + query Bar($a: String) { + ...FragAB + } + fragment FragAB on Type { + field1(a: $a, b: $b) + ...FragC + field3(a: $a, b: $b) + } + fragment FragC on Type { + field2(c: $c) + } + `).toDeepEqual([ + { + message: 'Variable "$a" is not defined by operation "Foo".', + locations: [ + { line: 9, column: 19 }, + { line: 2, column: 7 }, + ], + }, + { + message: 'Variable "$a" is not defined by operation "Foo".', + locations: [ + { line: 11, column: 19 }, + { line: 2, column: 7 }, + ], + }, + { + message: 'Variable "$c" is not defined by operation "Foo".', + locations: [ + { line: 14, column: 19 }, + { line: 2, column: 7 }, + ], + }, + { + message: 'Variable "$b" is not defined by operation "Bar".', + locations: [ + { line: 9, column: 26 }, + { line: 5, column: 7 }, + ], + }, + { + message: 'Variable "$b" is not defined by operation "Bar".', + locations: [ + { line: 11, column: 26 }, + { line: 5, column: 7 }, + ], + }, + { + message: 'Variable "$c" is not defined by operation "Bar".', + locations: [ + { line: 14, column: 19 }, + { line: 5, column: 7 }, + ], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/NoUnusedFragmentsRule-test.ts b/src/validation/__tests__/NoUnusedFragmentsRule-test.ts new file mode 100644 index 00000000..abeee19e --- /dev/null +++ b/src/validation/__tests__/NoUnusedFragmentsRule-test.ts @@ -0,0 +1,163 @@ +import { describe, it } from 'mocha'; + +import { NoUnusedFragmentsRule } from '../rules/NoUnusedFragmentsRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(NoUnusedFragmentsRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: No unused fragments', () => { + it('all fragment names are used', () => { + expectValid(` + { + human(id: 4) { + ...HumanFields1 + ... on Human { + ...HumanFields2 + } + } + } + fragment HumanFields1 on Human { + name + ...HumanFields3 + } + fragment HumanFields2 on Human { + name + } + fragment HumanFields3 on Human { + name + } + `); + }); + + it('all fragment names are used by multiple operations', () => { + expectValid(` + query Foo { + human(id: 4) { + ...HumanFields1 + } + } + query Bar { + human(id: 4) { + ...HumanFields2 + } + } + fragment HumanFields1 on Human { + name + ...HumanFields3 + } + fragment HumanFields2 on Human { + name + } + fragment HumanFields3 on Human { + name + } + `); + }); + + it('contains unknown fragments', () => { + expectErrors(` + query Foo { + human(id: 4) { + ...HumanFields1 + } + } + query Bar { + human(id: 4) { + ...HumanFields2 + } + } + fragment HumanFields1 on Human { + name + ...HumanFields3 + } + fragment HumanFields2 on Human { + name + } + fragment HumanFields3 on Human { + name + } + fragment Unused1 on Human { + name + } + fragment Unused2 on Human { + name + } + `).toDeepEqual([ + { + message: 'Fragment "Unused1" is never used.', + locations: [{ line: 22, column: 7 }], + }, + { + message: 'Fragment "Unused2" is never used.', + locations: [{ line: 25, column: 7 }], + }, + ]); + }); + + it('contains unknown fragments with ref cycle', () => { + expectErrors(` + query Foo { + human(id: 4) { + ...HumanFields1 + } + } + query Bar { + human(id: 4) { + ...HumanFields2 + } + } + fragment HumanFields1 on Human { + name + ...HumanFields3 + } + fragment HumanFields2 on Human { + name + } + fragment HumanFields3 on Human { + name + } + fragment Unused1 on Human { + name + ...Unused2 + } + fragment Unused2 on Human { + name + ...Unused1 + } + `).toDeepEqual([ + { + message: 'Fragment "Unused1" is never used.', + locations: [{ line: 22, column: 7 }], + }, + { + message: 'Fragment "Unused2" is never used.', + locations: [{ line: 26, column: 7 }], + }, + ]); + }); + + it('contains unknown and undef fragments', () => { + expectErrors(` + query Foo { + human(id: 4) { + ...bar + } + } + fragment foo on Human { + name + } + `).toDeepEqual([ + { + message: 'Fragment "foo" is never used.', + locations: [{ line: 7, column: 7 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/NoUnusedVariablesRule-test.ts b/src/validation/__tests__/NoUnusedVariablesRule-test.ts new file mode 100644 index 00000000..6be63cd2 --- /dev/null +++ b/src/validation/__tests__/NoUnusedVariablesRule-test.ts @@ -0,0 +1,233 @@ +import { describe, it } from 'mocha'; + +import { NoUnusedVariablesRule } from '../rules/NoUnusedVariablesRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(NoUnusedVariablesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: No unused variables', () => { + it('uses all variables', () => { + expectValid(` + query ($a: String, $b: String, $c: String) { + field(a: $a, b: $b, c: $c) + } + `); + }); + + it('uses all variables deeply', () => { + expectValid(` + query Foo($a: String, $b: String, $c: String) { + field(a: $a) { + field(b: $b) { + field(c: $c) + } + } + } + `); + }); + + it('uses all variables deeply in inline fragments', () => { + expectValid(` + query Foo($a: String, $b: String, $c: String) { + ... on Type { + field(a: $a) { + field(b: $b) { + ... on Type { + field(c: $c) + } + } + } + } + } + `); + }); + + it('uses all variables in fragments', () => { + expectValid(` + query Foo($a: String, $b: String, $c: String) { + ...FragA + } + fragment FragA on Type { + field(a: $a) { + ...FragB + } + } + fragment FragB on Type { + field(b: $b) { + ...FragC + } + } + fragment FragC on Type { + field(c: $c) + } + `); + }); + + it('variable used by fragment in multiple operations', () => { + expectValid(` + query Foo($a: String) { + ...FragA + } + query Bar($b: String) { + ...FragB + } + fragment FragA on Type { + field(a: $a) + } + fragment FragB on Type { + field(b: $b) + } + `); + }); + + it('variable used by recursive fragment', () => { + expectValid(` + query Foo($a: String) { + ...FragA + } + fragment FragA on Type { + field(a: $a) { + ...FragA + } + } + `); + }); + + it('variable not used', () => { + expectErrors(` + query ($a: String, $b: String, $c: String) { + field(a: $a, b: $b) + } + `).toDeepEqual([ + { + message: 'Variable "$c" is never used.', + locations: [{ line: 2, column: 38 }], + }, + ]); + }); + + it('multiple variables not used', () => { + expectErrors(` + query Foo($a: String, $b: String, $c: String) { + field(b: $b) + } + `).toDeepEqual([ + { + message: 'Variable "$a" is never used in operation "Foo".', + locations: [{ line: 2, column: 17 }], + }, + { + message: 'Variable "$c" is never used in operation "Foo".', + locations: [{ line: 2, column: 41 }], + }, + ]); + }); + + it('variable not used in fragments', () => { + expectErrors(` + query Foo($a: String, $b: String, $c: String) { + ...FragA + } + fragment FragA on Type { + field(a: $a) { + ...FragB + } + } + fragment FragB on Type { + field(b: $b) { + ...FragC + } + } + fragment FragC on Type { + field + } + `).toDeepEqual([ + { + message: 'Variable "$c" is never used in operation "Foo".', + locations: [{ line: 2, column: 41 }], + }, + ]); + }); + + it('multiple variables not used in fragments', () => { + expectErrors(` + query Foo($a: String, $b: String, $c: String) { + ...FragA + } + fragment FragA on Type { + field { + ...FragB + } + } + fragment FragB on Type { + field(b: $b) { + ...FragC + } + } + fragment FragC on Type { + field + } + `).toDeepEqual([ + { + message: 'Variable "$a" is never used in operation "Foo".', + locations: [{ line: 2, column: 17 }], + }, + { + message: 'Variable "$c" is never used in operation "Foo".', + locations: [{ line: 2, column: 41 }], + }, + ]); + }); + + it('variable not used by unreferenced fragment', () => { + expectErrors(` + query Foo($b: String) { + ...FragA + } + fragment FragA on Type { + field(a: $a) + } + fragment FragB on Type { + field(b: $b) + } + `).toDeepEqual([ + { + message: 'Variable "$b" is never used in operation "Foo".', + locations: [{ line: 2, column: 17 }], + }, + ]); + }); + + it('variable not used by fragment used by other operation', () => { + expectErrors(` + query Foo($b: String) { + ...FragA + } + query Bar($a: String) { + ...FragB + } + fragment FragA on Type { + field(a: $a) + } + fragment FragB on Type { + field(b: $b) + } + `).toDeepEqual([ + { + message: 'Variable "$b" is never used in operation "Foo".', + locations: [{ line: 2, column: 17 }], + }, + { + message: 'Variable "$a" is never used in operation "Bar".', + locations: [{ line: 5, column: 17 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts b/src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts new file mode 100644 index 00000000..9d864902 --- /dev/null +++ b/src/validation/__tests__/OverlappingFieldsCanBeMergedRule-test.ts @@ -0,0 +1,1096 @@ +import { describe, it } from 'mocha'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { OverlappingFieldsCanBeMergedRule } from '../rules/OverlappingFieldsCanBeMergedRule'; + +import { + expectValidationErrors, + expectValidationErrorsWithSchema, +} from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(OverlappingFieldsCanBeMergedRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +function expectErrorsWithSchema(schema: GraphQLSchema, queryStr: string) { + return expectValidationErrorsWithSchema( + schema, + OverlappingFieldsCanBeMergedRule, + queryStr, + ); +} + +function expectValidWithSchema(schema: GraphQLSchema, queryStr: string) { + expectErrorsWithSchema(schema, queryStr).toDeepEqual([]); +} + +describe('Validate: Overlapping fields can be merged', () => { + it('unique fields', () => { + expectValid(` + fragment uniqueFields on Dog { + name + nickname + } + `); + }); + + it('identical fields', () => { + expectValid(` + fragment mergeIdenticalFields on Dog { + name + name + } + `); + }); + + it('identical fields with identical args', () => { + expectValid(` + fragment mergeIdenticalFieldsWithIdenticalArgs on Dog { + doesKnowCommand(dogCommand: SIT) + doesKnowCommand(dogCommand: SIT) + } + `); + }); + + it('identical fields with identical directives', () => { + expectValid(` + fragment mergeSameFieldsWithSameDirectives on Dog { + name @include(if: true) + name @include(if: true) + } + `); + }); + + it('different args with different aliases', () => { + expectValid(` + fragment differentArgsWithDifferentAliases on Dog { + knowsSit: doesKnowCommand(dogCommand: SIT) + knowsDown: doesKnowCommand(dogCommand: DOWN) + } + `); + }); + + it('different directives with different aliases', () => { + expectValid(` + fragment differentDirectivesWithDifferentAliases on Dog { + nameIfTrue: name @include(if: true) + nameIfFalse: name @include(if: false) + } + `); + }); + + it('different skip/include directives accepted', () => { + // Note: Differing skip/include directives don't create an ambiguous return + // value and are acceptable in conditions where differing runtime values + // may have the same desired effect of including or skipping a field. + expectValid(` + fragment differentDirectivesWithDifferentAliases on Dog { + name @include(if: true) + name @include(if: false) + } + `); + }); + + it('Same aliases with different field targets', () => { + expectErrors(` + fragment sameAliasesWithDifferentFieldTargets on Dog { + fido: name + fido: nickname + } + `).toDeepEqual([ + { + message: + 'Fields "fido" conflict because "name" and "nickname" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 3, column: 9 }, + { line: 4, column: 9 }, + ], + }, + ]); + }); + + it('Same aliases allowed on non-overlapping fields', () => { + // This is valid since no object can be both a "Dog" and a "Cat", thus + // these fields can never overlap. + expectValid(` + fragment sameAliasesWithDifferentFieldTargets on Pet { + ... on Dog { + name + } + ... on Cat { + name: nickname + } + } + `); + }); + + it('Alias masking direct field access', () => { + expectErrors(` + fragment aliasMaskingDirectFieldAccess on Dog { + name: nickname + name + } + `).toDeepEqual([ + { + message: + 'Fields "name" conflict because "nickname" and "name" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 3, column: 9 }, + { line: 4, column: 9 }, + ], + }, + ]); + }); + + it('different args, second adds an argument', () => { + expectErrors(` + fragment conflictingArgs on Dog { + doesKnowCommand + doesKnowCommand(dogCommand: HEEL) + } + `).toDeepEqual([ + { + message: + 'Fields "doesKnowCommand" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 3, column: 9 }, + { line: 4, column: 9 }, + ], + }, + ]); + }); + + it('different args, second missing an argument', () => { + expectErrors(` + fragment conflictingArgs on Dog { + doesKnowCommand(dogCommand: SIT) + doesKnowCommand + } + `).toDeepEqual([ + { + message: + 'Fields "doesKnowCommand" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 3, column: 9 }, + { line: 4, column: 9 }, + ], + }, + ]); + }); + + it('conflicting arg values', () => { + expectErrors(` + fragment conflictingArgs on Dog { + doesKnowCommand(dogCommand: SIT) + doesKnowCommand(dogCommand: HEEL) + } + `).toDeepEqual([ + { + message: + 'Fields "doesKnowCommand" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 3, column: 9 }, + { line: 4, column: 9 }, + ], + }, + ]); + }); + + it('conflicting arg names', () => { + expectErrors(` + fragment conflictingArgs on Dog { + isAtLocation(x: 0) + isAtLocation(y: 0) + } + `).toDeepEqual([ + { + message: + 'Fields "isAtLocation" conflict because they have differing arguments. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 3, column: 9 }, + { line: 4, column: 9 }, + ], + }, + ]); + }); + + it('allows different args where no conflict is possible', () => { + // This is valid since no object can be both a "Dog" and a "Cat", thus + // these fields can never overlap. + expectValid(` + fragment conflictingArgs on Pet { + ... on Dog { + name(surname: true) + } + ... on Cat { + name + } + } + `); + }); + + it('encounters conflict in fragments', () => { + expectErrors(` + { + ...A + ...B + } + fragment A on Type { + x: a + } + fragment B on Type { + x: b + } + `).toDeepEqual([ + { + message: + 'Fields "x" conflict because "a" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 7, column: 9 }, + { line: 10, column: 9 }, + ], + }, + ]); + }); + + it('reports each conflict once', () => { + expectErrors(` + { + f1 { + ...A + ...B + } + f2 { + ...B + ...A + } + f3 { + ...A + ...B + x: c + } + } + fragment A on Type { + x: a + } + fragment B on Type { + x: b + } + `).toDeepEqual([ + { + message: + 'Fields "x" conflict because "a" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 18, column: 9 }, + { line: 21, column: 9 }, + ], + }, + { + message: + 'Fields "x" conflict because "c" and "a" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 14, column: 11 }, + { line: 18, column: 9 }, + ], + }, + { + message: + 'Fields "x" conflict because "c" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 14, column: 11 }, + { line: 21, column: 9 }, + ], + }, + ]); + }); + + it('deep conflict', () => { + expectErrors(` + { + field { + x: a + }, + field { + x: b + } + } + `).toDeepEqual([ + { + message: + 'Fields "field" conflict because subfields "x" conflict because "a" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 3, column: 9 }, + { line: 4, column: 11 }, + { line: 6, column: 9 }, + { line: 7, column: 11 }, + ], + }, + ]); + }); + + it('deep conflict with multiple issues', () => { + expectErrors(` + { + field { + x: a + y: c + }, + field { + x: b + y: d + } + } + `).toDeepEqual([ + { + message: + 'Fields "field" conflict because subfields "x" conflict because "a" and "b" are different fields and subfields "y" conflict because "c" and "d" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 3, column: 9 }, + { line: 4, column: 11 }, + { line: 5, column: 11 }, + { line: 7, column: 9 }, + { line: 8, column: 11 }, + { line: 9, column: 11 }, + ], + }, + ]); + }); + + it('very deep conflict', () => { + expectErrors(` + { + field { + deepField { + x: a + } + }, + field { + deepField { + x: b + } + } + } + `).toDeepEqual([ + { + message: + 'Fields "field" conflict because subfields "deepField" conflict because subfields "x" conflict because "a" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 3, column: 9 }, + { line: 4, column: 11 }, + { line: 5, column: 13 }, + { line: 8, column: 9 }, + { line: 9, column: 11 }, + { line: 10, column: 13 }, + ], + }, + ]); + }); + + it('reports deep conflict to nearest common ancestor', () => { + expectErrors(` + { + field { + deepField { + x: a + } + deepField { + x: b + } + }, + field { + deepField { + y + } + } + } + `).toDeepEqual([ + { + message: + 'Fields "deepField" conflict because subfields "x" conflict because "a" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 4, column: 11 }, + { line: 5, column: 13 }, + { line: 7, column: 11 }, + { line: 8, column: 13 }, + ], + }, + ]); + }); + + it('reports deep conflict to nearest common ancestor in fragments', () => { + expectErrors(` + { + field { + ...F + } + field { + ...F + } + } + fragment F on T { + deepField { + deeperField { + x: a + } + deeperField { + x: b + } + }, + deepField { + deeperField { + y + } + } + } + `).toDeepEqual([ + { + message: + 'Fields "deeperField" conflict because subfields "x" conflict because "a" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 12, column: 11 }, + { line: 13, column: 13 }, + { line: 15, column: 11 }, + { line: 16, column: 13 }, + ], + }, + ]); + }); + + it('reports deep conflict in nested fragments', () => { + expectErrors(` + { + field { + ...F + } + field { + ...I + } + } + fragment F on T { + x: a + ...G + } + fragment G on T { + y: c + } + fragment I on T { + y: d + ...J + } + fragment J on T { + x: b + } + `).toDeepEqual([ + { + message: + 'Fields "field" conflict because subfields "x" conflict because "a" and "b" are different fields and subfields "y" conflict because "c" and "d" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 3, column: 9 }, + { line: 11, column: 9 }, + { line: 15, column: 9 }, + { line: 6, column: 9 }, + { line: 22, column: 9 }, + { line: 18, column: 9 }, + ], + }, + ]); + }); + + it('ignores unknown fragments', () => { + expectValid(` + { + field + ...Unknown + ...Known + } + + fragment Known on T { + field + ...OtherUnknown + } + `); + }); + + describe('return types must be unambiguous', () => { + const schema = buildSchema(` + interface SomeBox { + deepBox: SomeBox + unrelatedField: String + } + + type StringBox implements SomeBox { + scalar: String + deepBox: StringBox + unrelatedField: String + listStringBox: [StringBox] + stringBox: StringBox + intBox: IntBox + } + + type IntBox implements SomeBox { + scalar: Int + deepBox: IntBox + unrelatedField: String + listStringBox: [StringBox] + stringBox: StringBox + intBox: IntBox + } + + interface NonNullStringBox1 { + scalar: String! + } + + type NonNullStringBox1Impl implements SomeBox & NonNullStringBox1 { + scalar: String! + unrelatedField: String + deepBox: SomeBox + } + + interface NonNullStringBox2 { + scalar: String! + } + + type NonNullStringBox2Impl implements SomeBox & NonNullStringBox2 { + scalar: String! + unrelatedField: String + deepBox: SomeBox + } + + type Connection { + edges: [Edge] + } + + type Edge { + node: Node + } + + type Node { + id: ID + name: String + } + + type Query { + someBox: SomeBox + connection: Connection + } + `); + + it('conflicting return types which potentially overlap', () => { + // This is invalid since an object could potentially be both the Object + // type IntBox and the interface type NonNullStringBox1. While that + // condition does not exist in the current schema, the schema could + // expand in the future to allow this. Thus it is invalid. + expectErrorsWithSchema( + schema, + ` + { + someBox { + ...on IntBox { + scalar + } + ...on NonNullStringBox1 { + scalar + } + } + } + `, + ).toDeepEqual([ + { + message: + 'Fields "scalar" conflict because they return conflicting types "Int" and "String!". Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 5, column: 17 }, + { line: 8, column: 17 }, + ], + }, + ]); + }); + + it('compatible return shapes on different return types', () => { + // In this case `deepBox` returns `SomeBox` in the first usage, and + // `StringBox` in the second usage. These return types are not the same! + // however this is valid because the return *shapes* are compatible. + expectValidWithSchema( + schema, + ` + { + someBox { + ... on SomeBox { + deepBox { + unrelatedField + } + } + ... on StringBox { + deepBox { + unrelatedField + } + } + } + } + `, + ); + }); + + it('disallows differing return types despite no overlap', () => { + expectErrorsWithSchema( + schema, + ` + { + someBox { + ... on IntBox { + scalar + } + ... on StringBox { + scalar + } + } + } + `, + ).toDeepEqual([ + { + message: + 'Fields "scalar" conflict because they return conflicting types "Int" and "String". Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 5, column: 17 }, + { line: 8, column: 17 }, + ], + }, + ]); + }); + + it('reports correctly when a non-exclusive follows an exclusive', () => { + expectErrorsWithSchema( + schema, + ` + { + someBox { + ... on IntBox { + deepBox { + ...X + } + } + } + someBox { + ... on StringBox { + deepBox { + ...Y + } + } + } + memoed: someBox { + ... on IntBox { + deepBox { + ...X + } + } + } + memoed: someBox { + ... on StringBox { + deepBox { + ...Y + } + } + } + other: someBox { + ...X + } + other: someBox { + ...Y + } + } + fragment X on SomeBox { + scalar + } + fragment Y on SomeBox { + scalar: unrelatedField + } + `, + ).toDeepEqual([ + { + message: + 'Fields "other" conflict because subfields "scalar" conflict because "scalar" and "unrelatedField" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 31, column: 13 }, + { line: 39, column: 13 }, + { line: 34, column: 13 }, + { line: 42, column: 13 }, + ], + }, + ]); + }); + + it('disallows differing return type nullability despite no overlap', () => { + expectErrorsWithSchema( + schema, + ` + { + someBox { + ... on NonNullStringBox1 { + scalar + } + ... on StringBox { + scalar + } + } + } + `, + ).toDeepEqual([ + { + message: + 'Fields "scalar" conflict because they return conflicting types "String!" and "String". Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 5, column: 17 }, + { line: 8, column: 17 }, + ], + }, + ]); + }); + + it('disallows differing return type list despite no overlap', () => { + expectErrorsWithSchema( + schema, + ` + { + someBox { + ... on IntBox { + box: listStringBox { + scalar + } + } + ... on StringBox { + box: stringBox { + scalar + } + } + } + } + `, + ).toDeepEqual([ + { + message: + 'Fields "box" conflict because they return conflicting types "[StringBox]" and "StringBox". Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 5, column: 17 }, + { line: 10, column: 17 }, + ], + }, + ]); + + expectErrorsWithSchema( + schema, + ` + { + someBox { + ... on IntBox { + box: stringBox { + scalar + } + } + ... on StringBox { + box: listStringBox { + scalar + } + } + } + } + `, + ).toDeepEqual([ + { + message: + 'Fields "box" conflict because they return conflicting types "StringBox" and "[StringBox]". Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 5, column: 17 }, + { line: 10, column: 17 }, + ], + }, + ]); + }); + + it('disallows differing subfields', () => { + expectErrorsWithSchema( + schema, + ` + { + someBox { + ... on IntBox { + box: stringBox { + val: scalar + val: unrelatedField + } + } + ... on StringBox { + box: stringBox { + val: scalar + } + } + } + } + `, + ).toDeepEqual([ + { + message: + 'Fields "val" conflict because "scalar" and "unrelatedField" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 6, column: 19 }, + { line: 7, column: 19 }, + ], + }, + ]); + }); + + it('disallows differing deep return types despite no overlap', () => { + expectErrorsWithSchema( + schema, + ` + { + someBox { + ... on IntBox { + box: stringBox { + scalar + } + } + ... on StringBox { + box: intBox { + scalar + } + } + } + } + `, + ).toDeepEqual([ + { + message: + 'Fields "box" conflict because subfields "scalar" conflict because they return conflicting types "String" and "Int". Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 5, column: 17 }, + { line: 6, column: 19 }, + { line: 10, column: 17 }, + { line: 11, column: 19 }, + ], + }, + ]); + }); + + it('allows non-conflicting overlapping types', () => { + expectValidWithSchema( + schema, + ` + { + someBox { + ... on IntBox { + scalar: unrelatedField + } + ... on StringBox { + scalar + } + } + } + `, + ); + }); + + it('same wrapped scalar return types', () => { + expectValidWithSchema( + schema, + ` + { + someBox { + ...on NonNullStringBox1 { + scalar + } + ...on NonNullStringBox2 { + scalar + } + } + } + `, + ); + }); + + it('allows inline fragments without type condition', () => { + expectValidWithSchema( + schema, + ` + { + a + ... { + a + } + } + `, + ); + }); + + it('compares deep types including list', () => { + expectErrorsWithSchema( + schema, + ` + { + connection { + ...edgeID + edges { + node { + id: name + } + } + } + } + + fragment edgeID on Connection { + edges { + node { + id + } + } + } + `, + ).toDeepEqual([ + { + message: + 'Fields "edges" conflict because subfields "node" conflict because subfields "id" conflict because "name" and "id" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 5, column: 15 }, + { line: 6, column: 17 }, + { line: 7, column: 19 }, + { line: 14, column: 13 }, + { line: 15, column: 15 }, + { line: 16, column: 17 }, + ], + }, + ]); + }); + + it('ignores unknown types', () => { + expectValidWithSchema( + schema, + ` + { + someBox { + ...on UnknownType { + scalar + } + ...on NonNullStringBox2 { + scalar + } + } + } + `, + ); + }); + + it('works for field names that are JS keywords', () => { + const schemaWithKeywords = buildSchema(` + type Foo { + constructor: String + } + + type Query { + foo: Foo + } + `); + + expectValidWithSchema( + schemaWithKeywords, + ` + { + foo { + constructor + } + } + `, + ); + }); + }); + + it('does not infinite loop on recursive fragment', () => { + expectValid(` + { + ...fragA + } + + fragment fragA on Human { name, relatives { name, ...fragA } } + `); + }); + + it('does not infinite loop on immediately recursive fragment', () => { + expectValid(` + { + ...fragA + } + + fragment fragA on Human { name, ...fragA } + `); + }); + + it('does not infinite loop on recursive fragment with a field named after fragment', () => { + expectValid(` + { + ...fragA + fragA + } + + fragment fragA on Query { ...fragA } + `); + }); + + it('finds invalid cases even with field named after fragment', () => { + expectErrors(` + { + fragA + ...fragA + } + + fragment fragA on Type { + fragA: b + } + `).toDeepEqual([ + { + message: + 'Fields "fragA" conflict because "fragA" and "b" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 3, column: 9 }, + { line: 8, column: 9 }, + ], + }, + ]); + }); + + it('does not infinite loop on transitively recursive fragment', () => { + expectValid(` + { + ...fragA + fragB + } + + fragment fragA on Human { name, ...fragB } + fragment fragB on Human { name, ...fragC } + fragment fragC on Human { name, ...fragA } + `); + }); + + it('finds invalid case even with immediately recursive fragment', () => { + expectErrors(` + fragment sameAliasesWithDifferentFieldTargets on Dog { + ...sameAliasesWithDifferentFieldTargets + fido: name + fido: nickname + } + `).toDeepEqual([ + { + message: + 'Fields "fido" conflict because "name" and "nickname" are different fields. Use different aliases on the fields to fetch both if this was intentional.', + locations: [ + { line: 4, column: 9 }, + { line: 5, column: 9 }, + ], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/PossibleFragmentSpreadsRule-test.ts b/src/validation/__tests__/PossibleFragmentSpreadsRule-test.ts new file mode 100644 index 00000000..3e52f234 --- /dev/null +++ b/src/validation/__tests__/PossibleFragmentSpreadsRule-test.ts @@ -0,0 +1,303 @@ +import { describe, it } from 'mocha'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { PossibleFragmentSpreadsRule } from '../rules/PossibleFragmentSpreadsRule'; + +import { expectValidationErrorsWithSchema } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrorsWithSchema( + testSchema, + PossibleFragmentSpreadsRule, + queryStr, + ); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +const testSchema = buildSchema(` + interface Being { + name: String + } + + interface Pet implements Being { + name: String + } + + type Dog implements Being & Pet { + name: String + barkVolume: Int + } + + type Cat implements Being & Pet { + name: String + meowVolume: Int + } + + union CatOrDog = Cat | Dog + + interface Intelligent { + iq: Int + } + + type Human implements Being & Intelligent { + name: String + pets: [Pet] + iq: Int + } + + type Alien implements Being & Intelligent { + name: String + iq: Int + } + + union DogOrHuman = Dog | Human + + union HumanOrAlien = Human | Alien + + type Query { + catOrDog: CatOrDog + dogOrHuman: DogOrHuman + humanOrAlien: HumanOrAlien + } +`); + +describe('Validate: Possible fragment spreads', () => { + it('of the same object', () => { + expectValid(` + fragment objectWithinObject on Dog { ...dogFragment } + fragment dogFragment on Dog { barkVolume } + `); + }); + + it('of the same object with inline fragment', () => { + expectValid(` + fragment objectWithinObjectAnon on Dog { ... on Dog { barkVolume } } + `); + }); + + it('object into an implemented interface', () => { + expectValid(` + fragment objectWithinInterface on Pet { ...dogFragment } + fragment dogFragment on Dog { barkVolume } + `); + }); + + it('object into containing union', () => { + expectValid(` + fragment objectWithinUnion on CatOrDog { ...dogFragment } + fragment dogFragment on Dog { barkVolume } + `); + }); + + it('union into contained object', () => { + expectValid(` + fragment unionWithinObject on Dog { ...catOrDogFragment } + fragment catOrDogFragment on CatOrDog { __typename } + `); + }); + + it('union into overlapping interface', () => { + expectValid(` + fragment unionWithinInterface on Pet { ...catOrDogFragment } + fragment catOrDogFragment on CatOrDog { __typename } + `); + }); + + it('union into overlapping union', () => { + expectValid(` + fragment unionWithinUnion on DogOrHuman { ...catOrDogFragment } + fragment catOrDogFragment on CatOrDog { __typename } + `); + }); + + it('interface into implemented object', () => { + expectValid(` + fragment interfaceWithinObject on Dog { ...petFragment } + fragment petFragment on Pet { name } + `); + }); + + it('interface into overlapping interface', () => { + expectValid(` + fragment interfaceWithinInterface on Pet { ...beingFragment } + fragment beingFragment on Being { name } + `); + }); + + it('interface into overlapping interface in inline fragment', () => { + expectValid(` + fragment interfaceWithinInterface on Pet { ... on Being { name } } + `); + }); + + it('interface into overlapping union', () => { + expectValid(` + fragment interfaceWithinUnion on CatOrDog { ...petFragment } + fragment petFragment on Pet { name } + `); + }); + + it('ignores incorrect type (caught by FragmentsOnCompositeTypesRule)', () => { + expectValid(` + fragment petFragment on Pet { ...badInADifferentWay } + fragment badInADifferentWay on String { name } + `); + }); + + it('ignores unknown fragments (caught by KnownFragmentNamesRule)', () => { + expectValid(` + fragment petFragment on Pet { ...UnknownFragment } + `); + }); + + it('different object into object', () => { + expectErrors(` + fragment invalidObjectWithinObject on Cat { ...dogFragment } + fragment dogFragment on Dog { barkVolume } + `).toDeepEqual([ + { + message: + 'Fragment "dogFragment" cannot be spread here as objects of type "Cat" can never be of type "Dog".', + locations: [{ line: 2, column: 51 }], + }, + ]); + }); + + it('different object into object in inline fragment', () => { + expectErrors(` + fragment invalidObjectWithinObjectAnon on Cat { + ... on Dog { barkVolume } + } + `).toDeepEqual([ + { + message: + 'Fragment cannot be spread here as objects of type "Cat" can never be of type "Dog".', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('object into not implementing interface', () => { + expectErrors(` + fragment invalidObjectWithinInterface on Pet { ...humanFragment } + fragment humanFragment on Human { pets { name } } + `).toDeepEqual([ + { + message: + 'Fragment "humanFragment" cannot be spread here as objects of type "Pet" can never be of type "Human".', + locations: [{ line: 2, column: 54 }], + }, + ]); + }); + + it('object into not containing union', () => { + expectErrors(` + fragment invalidObjectWithinUnion on CatOrDog { ...humanFragment } + fragment humanFragment on Human { pets { name } } + `).toDeepEqual([ + { + message: + 'Fragment "humanFragment" cannot be spread here as objects of type "CatOrDog" can never be of type "Human".', + locations: [{ line: 2, column: 55 }], + }, + ]); + }); + + it('union into not contained object', () => { + expectErrors(` + fragment invalidUnionWithinObject on Human { ...catOrDogFragment } + fragment catOrDogFragment on CatOrDog { __typename } + `).toDeepEqual([ + { + message: + 'Fragment "catOrDogFragment" cannot be spread here as objects of type "Human" can never be of type "CatOrDog".', + locations: [{ line: 2, column: 52 }], + }, + ]); + }); + + it('union into non overlapping interface', () => { + expectErrors(` + fragment invalidUnionWithinInterface on Pet { ...humanOrAlienFragment } + fragment humanOrAlienFragment on HumanOrAlien { __typename } + `).toDeepEqual([ + { + message: + 'Fragment "humanOrAlienFragment" cannot be spread here as objects of type "Pet" can never be of type "HumanOrAlien".', + locations: [{ line: 2, column: 53 }], + }, + ]); + }); + + it('union into non overlapping union', () => { + expectErrors(` + fragment invalidUnionWithinUnion on CatOrDog { ...humanOrAlienFragment } + fragment humanOrAlienFragment on HumanOrAlien { __typename } + `).toDeepEqual([ + { + message: + 'Fragment "humanOrAlienFragment" cannot be spread here as objects of type "CatOrDog" can never be of type "HumanOrAlien".', + locations: [{ line: 2, column: 54 }], + }, + ]); + }); + + it('interface into non implementing object', () => { + expectErrors(` + fragment invalidInterfaceWithinObject on Cat { ...intelligentFragment } + fragment intelligentFragment on Intelligent { iq } + `).toDeepEqual([ + { + message: + 'Fragment "intelligentFragment" cannot be spread here as objects of type "Cat" can never be of type "Intelligent".', + locations: [{ line: 2, column: 54 }], + }, + ]); + }); + + it('interface into non overlapping interface', () => { + expectErrors(` + fragment invalidInterfaceWithinInterface on Pet { + ...intelligentFragment + } + fragment intelligentFragment on Intelligent { iq } + `).toDeepEqual([ + { + message: + 'Fragment "intelligentFragment" cannot be spread here as objects of type "Pet" can never be of type "Intelligent".', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('interface into non overlapping interface in inline fragment', () => { + expectErrors(` + fragment invalidInterfaceWithinInterfaceAnon on Pet { + ...on Intelligent { iq } + } + `).toDeepEqual([ + { + message: + 'Fragment cannot be spread here as objects of type "Pet" can never be of type "Intelligent".', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('interface into non overlapping union', () => { + expectErrors(` + fragment invalidInterfaceWithinUnion on HumanOrAlien { ...petFragment } + fragment petFragment on Pet { name } + `).toDeepEqual([ + { + message: + 'Fragment "petFragment" cannot be spread here as objects of type "HumanOrAlien" can never be of type "Pet".', + locations: [{ line: 2, column: 62 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/PossibleTypeExtensionsRule-test.ts b/src/validation/__tests__/PossibleTypeExtensionsRule-test.ts new file mode 100644 index 00000000..e29c097b --- /dev/null +++ b/src/validation/__tests__/PossibleTypeExtensionsRule-test.ts @@ -0,0 +1,271 @@ +import { describe, it } from 'mocha'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { PossibleTypeExtensionsRule } from '../rules/PossibleTypeExtensionsRule'; + +import { expectSDLValidationErrors } from './harness'; + +function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { + return expectSDLValidationErrors(schema, PossibleTypeExtensionsRule, sdlStr); +} + +function expectValidSDL(sdlStr: string, schema?: GraphQLSchema) { + expectSDLErrors(sdlStr, schema).toDeepEqual([]); +} + +describe('Validate: Possible type extensions', () => { + it('no extensions', () => { + expectValidSDL(` + scalar FooScalar + type FooObject + interface FooInterface + union FooUnion + enum FooEnum + input FooInputObject + `); + }); + + it('one extension per type', () => { + expectValidSDL(` + scalar FooScalar + type FooObject + interface FooInterface + union FooUnion + enum FooEnum + input FooInputObject + + extend scalar FooScalar @dummy + extend type FooObject @dummy + extend interface FooInterface @dummy + extend union FooUnion @dummy + extend enum FooEnum @dummy + extend input FooInputObject @dummy + `); + }); + + it('many extensions per type', () => { + expectValidSDL(` + scalar FooScalar + type FooObject + interface FooInterface + union FooUnion + enum FooEnum + input FooInputObject + + extend scalar FooScalar @dummy + extend type FooObject @dummy + extend interface FooInterface @dummy + extend union FooUnion @dummy + extend enum FooEnum @dummy + extend input FooInputObject @dummy + + extend scalar FooScalar @dummy + extend type FooObject @dummy + extend interface FooInterface @dummy + extend union FooUnion @dummy + extend enum FooEnum @dummy + extend input FooInputObject @dummy + `); + }); + + it('extending unknown type', () => { + const message = + 'Cannot extend type "Unknown" because it is not defined. Did you mean "Known"?'; + + expectSDLErrors(` + type Known + + extend scalar Unknown @dummy + extend type Unknown @dummy + extend interface Unknown @dummy + extend union Unknown @dummy + extend enum Unknown @dummy + extend input Unknown @dummy + `).toDeepEqual([ + { message, locations: [{ line: 4, column: 21 }] }, + { message, locations: [{ line: 5, column: 19 }] }, + { message, locations: [{ line: 6, column: 24 }] }, + { message, locations: [{ line: 7, column: 20 }] }, + { message, locations: [{ line: 8, column: 19 }] }, + { message, locations: [{ line: 9, column: 20 }] }, + ]); + }); + + it('does not consider non-type definitions', () => { + const message = 'Cannot extend type "Foo" because it is not defined.'; + + expectSDLErrors(` + query Foo { __typename } + fragment Foo on Query { __typename } + directive @Foo on SCHEMA + + extend scalar Foo @dummy + extend type Foo @dummy + extend interface Foo @dummy + extend union Foo @dummy + extend enum Foo @dummy + extend input Foo @dummy + `).toDeepEqual([ + { message, locations: [{ line: 6, column: 21 }] }, + { message, locations: [{ line: 7, column: 19 }] }, + { message, locations: [{ line: 8, column: 24 }] }, + { message, locations: [{ line: 9, column: 20 }] }, + { message, locations: [{ line: 10, column: 19 }] }, + { message, locations: [{ line: 11, column: 20 }] }, + ]); + }); + + it('extending with different kinds', () => { + expectSDLErrors(` + scalar FooScalar + type FooObject + interface FooInterface + union FooUnion + enum FooEnum + input FooInputObject + + extend type FooScalar @dummy + extend interface FooObject @dummy + extend union FooInterface @dummy + extend enum FooUnion @dummy + extend input FooEnum @dummy + extend scalar FooInputObject @dummy + `).toDeepEqual([ + { + message: 'Cannot extend non-object type "FooScalar".', + locations: [ + { line: 2, column: 7 }, + { line: 9, column: 7 }, + ], + }, + { + message: 'Cannot extend non-interface type "FooObject".', + locations: [ + { line: 3, column: 7 }, + { line: 10, column: 7 }, + ], + }, + { + message: 'Cannot extend non-union type "FooInterface".', + locations: [ + { line: 4, column: 7 }, + { line: 11, column: 7 }, + ], + }, + { + message: 'Cannot extend non-enum type "FooUnion".', + locations: [ + { line: 5, column: 7 }, + { line: 12, column: 7 }, + ], + }, + { + message: 'Cannot extend non-input object type "FooEnum".', + locations: [ + { line: 6, column: 7 }, + { line: 13, column: 7 }, + ], + }, + { + message: 'Cannot extend non-scalar type "FooInputObject".', + locations: [ + { line: 7, column: 7 }, + { line: 14, column: 7 }, + ], + }, + ]); + }); + + it('extending types within existing schema', () => { + const schema = buildSchema(` + scalar FooScalar + type FooObject + interface FooInterface + union FooUnion + enum FooEnum + input FooInputObject + `); + const sdl = ` + extend scalar FooScalar @dummy + extend type FooObject @dummy + extend interface FooInterface @dummy + extend union FooUnion @dummy + extend enum FooEnum @dummy + extend input FooInputObject @dummy + `; + + expectValidSDL(sdl, schema); + }); + + it('extending unknown types within existing schema', () => { + const schema = buildSchema('type Known'); + const sdl = ` + extend scalar Unknown @dummy + extend type Unknown @dummy + extend interface Unknown @dummy + extend union Unknown @dummy + extend enum Unknown @dummy + extend input Unknown @dummy + `; + + const message = + 'Cannot extend type "Unknown" because it is not defined. Did you mean "Known"?'; + expectSDLErrors(sdl, schema).toDeepEqual([ + { message, locations: [{ line: 2, column: 21 }] }, + { message, locations: [{ line: 3, column: 19 }] }, + { message, locations: [{ line: 4, column: 24 }] }, + { message, locations: [{ line: 5, column: 20 }] }, + { message, locations: [{ line: 6, column: 19 }] }, + { message, locations: [{ line: 7, column: 20 }] }, + ]); + }); + + it('extending types with different kinds within existing schema', () => { + const schema = buildSchema(` + scalar FooScalar + type FooObject + interface FooInterface + union FooUnion + enum FooEnum + input FooInputObject + `); + const sdl = ` + extend type FooScalar @dummy + extend interface FooObject @dummy + extend union FooInterface @dummy + extend enum FooUnion @dummy + extend input FooEnum @dummy + extend scalar FooInputObject @dummy + `; + + expectSDLErrors(sdl, schema).toDeepEqual([ + { + message: 'Cannot extend non-object type "FooScalar".', + locations: [{ line: 2, column: 7 }], + }, + { + message: 'Cannot extend non-interface type "FooObject".', + locations: [{ line: 3, column: 7 }], + }, + { + message: 'Cannot extend non-union type "FooInterface".', + locations: [{ line: 4, column: 7 }], + }, + { + message: 'Cannot extend non-enum type "FooUnion".', + locations: [{ line: 5, column: 7 }], + }, + { + message: 'Cannot extend non-input object type "FooEnum".', + locations: [{ line: 6, column: 7 }], + }, + { + message: 'Cannot extend non-scalar type "FooInputObject".', + locations: [{ line: 7, column: 7 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/ProvidedRequiredArgumentsRule-test.ts b/src/validation/__tests__/ProvidedRequiredArgumentsRule-test.ts new file mode 100644 index 00000000..23a27257 --- /dev/null +++ b/src/validation/__tests__/ProvidedRequiredArgumentsRule-test.ts @@ -0,0 +1,356 @@ +import { describe, it } from 'mocha'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { + ProvidedRequiredArgumentsOnDirectivesRule, + ProvidedRequiredArgumentsRule, +} from '../rules/ProvidedRequiredArgumentsRule'; + +import { expectSDLValidationErrors, expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(ProvidedRequiredArgumentsRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { + return expectSDLValidationErrors( + schema, + ProvidedRequiredArgumentsOnDirectivesRule, + sdlStr, + ); +} + +function expectValidSDL(sdlStr: string) { + expectSDLErrors(sdlStr).toDeepEqual([]); +} + +describe('Validate: Provided required arguments', () => { + it('ignores unknown arguments', () => { + expectValid(` + { + dog { + isHouseTrained(unknownArgument: true) + } + } + `); + }); + + describe('Valid non-nullable value', () => { + it('Arg on optional arg', () => { + expectValid(` + { + dog { + isHouseTrained(atOtherHomes: true) + } + } + `); + }); + + it('No Arg on optional arg', () => { + expectValid(` + { + dog { + isHouseTrained + } + } + `); + }); + + it('No arg on non-null field with default', () => { + expectValid(` + { + complicatedArgs { + nonNullFieldWithDefault + } + } + `); + }); + + it('Multiple args', () => { + expectValid(` + { + complicatedArgs { + multipleReqs(req1: 1, req2: 2) + } + } + `); + }); + + it('Multiple args reverse order', () => { + expectValid(` + { + complicatedArgs { + multipleReqs(req2: 2, req1: 1) + } + } + `); + }); + + it('No args on multiple optional', () => { + expectValid(` + { + complicatedArgs { + multipleOpts + } + } + `); + }); + + it('One arg on multiple optional', () => { + expectValid(` + { + complicatedArgs { + multipleOpts(opt1: 1) + } + } + `); + }); + + it('Second arg on multiple optional', () => { + expectValid(` + { + complicatedArgs { + multipleOpts(opt2: 1) + } + } + `); + }); + + it('Multiple required args on mixedList', () => { + expectValid(` + { + complicatedArgs { + multipleOptAndReq(req1: 3, req2: 4) + } + } + `); + }); + + it('Multiple required and one optional arg on mixedList', () => { + expectValid(` + { + complicatedArgs { + multipleOptAndReq(req1: 3, req2: 4, opt1: 5) + } + } + `); + }); + + it('All required and optional args on mixedList', () => { + expectValid(` + { + complicatedArgs { + multipleOptAndReq(req1: 3, req2: 4, opt1: 5, opt2: 6) + } + } + `); + }); + }); + + describe('Invalid non-nullable value', () => { + it('Missing one non-nullable argument', () => { + expectErrors(` + { + complicatedArgs { + multipleReqs(req2: 2) + } + } + `).toDeepEqual([ + { + message: + 'Field "multipleReqs" argument "req1" of type "Int!" is required, but it was not provided.', + locations: [{ line: 4, column: 13 }], + }, + ]); + }); + + it('Missing multiple non-nullable arguments', () => { + expectErrors(` + { + complicatedArgs { + multipleReqs + } + } + `).toDeepEqual([ + { + message: + 'Field "multipleReqs" argument "req1" of type "Int!" is required, but it was not provided.', + locations: [{ line: 4, column: 13 }], + }, + { + message: + 'Field "multipleReqs" argument "req2" of type "Int!" is required, but it was not provided.', + locations: [{ line: 4, column: 13 }], + }, + ]); + }); + + it('Incorrect value and missing argument', () => { + expectErrors(` + { + complicatedArgs { + multipleReqs(req1: "one") + } + } + `).toDeepEqual([ + { + message: + 'Field "multipleReqs" argument "req2" of type "Int!" is required, but it was not provided.', + locations: [{ line: 4, column: 13 }], + }, + ]); + }); + }); + + describe('Directive arguments', () => { + it('ignores unknown directives', () => { + expectValid(` + { + dog @unknown + } + `); + }); + + it('with directives of valid types', () => { + expectValid(` + { + dog @include(if: true) { + name + } + human @skip(if: false) { + name + } + } + `); + }); + + it('with directive with missing types', () => { + expectErrors(` + { + dog @include { + name @skip + } + } + `).toDeepEqual([ + { + message: + 'Directive "@include" argument "if" of type "Boolean!" is required, but it was not provided.', + locations: [{ line: 3, column: 15 }], + }, + { + message: + 'Directive "@skip" argument "if" of type "Boolean!" is required, but it was not provided.', + locations: [{ line: 4, column: 18 }], + }, + ]); + }); + }); + + describe('within SDL', () => { + it('Missing optional args on directive defined inside SDL', () => { + expectValidSDL(` + type Query { + foo: String @test + } + + directive @test(arg1: String, arg2: String! = "") on FIELD_DEFINITION + `); + }); + + it('Missing arg on directive defined inside SDL', () => { + expectSDLErrors(` + type Query { + foo: String @test + } + + directive @test(arg: String!) on FIELD_DEFINITION + `).toDeepEqual([ + { + message: + 'Directive "@test" argument "arg" of type "String!" is required, but it was not provided.', + locations: [{ line: 3, column: 23 }], + }, + ]); + }); + + it('Missing arg on standard directive', () => { + expectSDLErrors(` + type Query { + foo: String @include + } + `).toDeepEqual([ + { + message: + 'Directive "@include" argument "if" of type "Boolean!" is required, but it was not provided.', + locations: [{ line: 3, column: 23 }], + }, + ]); + }); + + it('Missing arg on overridden standard directive', () => { + expectSDLErrors(` + type Query { + foo: String @deprecated + } + directive @deprecated(reason: String!) on FIELD + `).toDeepEqual([ + { + message: + 'Directive "@deprecated" argument "reason" of type "String!" is required, but it was not provided.', + locations: [{ line: 3, column: 23 }], + }, + ]); + }); + + it('Missing arg on directive defined in schema extension', () => { + const schema = buildSchema(` + type Query { + foo: String + } + `); + expectSDLErrors( + ` + directive @test(arg: String!) on OBJECT + + extend type Query @test + `, + schema, + ).toDeepEqual([ + { + message: + 'Directive "@test" argument "arg" of type "String!" is required, but it was not provided.', + locations: [{ line: 4, column: 30 }], + }, + ]); + }); + + it('Missing arg on directive used in schema extension', () => { + const schema = buildSchema(` + directive @test(arg: String!) on OBJECT + + type Query { + foo: String + } + `); + expectSDLErrors( + ` + extend type Query @test + `, + schema, + ).toDeepEqual([ + { + message: + 'Directive "@test" argument "arg" of type "String!" is required, but it was not provided.', + locations: [{ line: 2, column: 29 }], + }, + ]); + }); + }); +}); diff --git a/src/validation/__tests__/ScalarLeafsRule-test.ts b/src/validation/__tests__/ScalarLeafsRule-test.ts new file mode 100644 index 00000000..b10cf01e --- /dev/null +++ b/src/validation/__tests__/ScalarLeafsRule-test.ts @@ -0,0 +1,129 @@ +import { describe, it } from 'mocha'; + +import { ScalarLeafsRule } from '../rules/ScalarLeafsRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(ScalarLeafsRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: Scalar leafs', () => { + it('valid scalar selection', () => { + expectValid(` + fragment scalarSelection on Dog { + barks + } + `); + }); + + it('object type missing selection', () => { + expectErrors(` + query directQueryOnObjectWithoutSubFields { + human + } + `).toDeepEqual([ + { + message: + 'Field "human" of type "Human" must have a selection of subfields. Did you mean "human { ... }"?', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('interface type missing selection', () => { + expectErrors(` + { + human { pets } + } + `).toDeepEqual([ + { + message: + 'Field "pets" of type "[Pet]" must have a selection of subfields. Did you mean "pets { ... }"?', + locations: [{ line: 3, column: 17 }], + }, + ]); + }); + + it('valid scalar selection with args', () => { + expectValid(` + fragment scalarSelectionWithArgs on Dog { + doesKnowCommand(dogCommand: SIT) + } + `); + }); + + it('scalar selection not allowed on Boolean', () => { + expectErrors(` + fragment scalarSelectionsNotAllowedOnBoolean on Dog { + barks { sinceWhen } + } + `).toDeepEqual([ + { + message: + 'Field "barks" must not have a selection since type "Boolean" has no subfields.', + locations: [{ line: 3, column: 15 }], + }, + ]); + }); + + it('scalar selection not allowed on Enum', () => { + expectErrors(` + fragment scalarSelectionsNotAllowedOnEnum on Cat { + furColor { inHexDec } + } + `).toDeepEqual([ + { + message: + 'Field "furColor" must not have a selection since type "FurColor" has no subfields.', + locations: [{ line: 3, column: 18 }], + }, + ]); + }); + + it('scalar selection not allowed with args', () => { + expectErrors(` + fragment scalarSelectionsNotAllowedWithArgs on Dog { + doesKnowCommand(dogCommand: SIT) { sinceWhen } + } + `).toDeepEqual([ + { + message: + 'Field "doesKnowCommand" must not have a selection since type "Boolean" has no subfields.', + locations: [{ line: 3, column: 42 }], + }, + ]); + }); + + it('Scalar selection not allowed with directives', () => { + expectErrors(` + fragment scalarSelectionsNotAllowedWithDirectives on Dog { + name @include(if: true) { isAlsoHumanName } + } + `).toDeepEqual([ + { + message: + 'Field "name" must not have a selection since type "String" has no subfields.', + locations: [{ line: 3, column: 33 }], + }, + ]); + }); + + it('Scalar selection not allowed with directives and args', () => { + expectErrors(` + fragment scalarSelectionsNotAllowedWithDirectivesAndArgs on Dog { + doesKnowCommand(dogCommand: SIT) @include(if: true) { sinceWhen } + } + `).toDeepEqual([ + { + message: + 'Field "doesKnowCommand" must not have a selection since type "Boolean" has no subfields.', + locations: [{ line: 3, column: 61 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/SingleFieldSubscriptionsRule-test.ts b/src/validation/__tests__/SingleFieldSubscriptionsRule-test.ts new file mode 100644 index 00000000..e0d37892 --- /dev/null +++ b/src/validation/__tests__/SingleFieldSubscriptionsRule-test.ts @@ -0,0 +1,306 @@ +import { describe, it } from 'mocha'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { SingleFieldSubscriptionsRule } from '../rules/SingleFieldSubscriptionsRule'; + +import { expectValidationErrorsWithSchema } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrorsWithSchema( + schema, + SingleFieldSubscriptionsRule, + queryStr, + ); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +const schema = buildSchema(` + type Message { + body: String + sender: String + } + + type SubscriptionRoot { + importantEmails: [String] + notImportantEmails: [String] + moreImportantEmails: [String] + spamEmails: [String] + deletedEmails: [String] + newMessage: Message + } + + type QueryRoot { + dummy: String + } + + schema { + query: QueryRoot + subscription: SubscriptionRoot + } +`); + +describe('Validate: Subscriptions with single field', () => { + it('valid subscription', () => { + expectValid(` + subscription ImportantEmails { + importantEmails + } + `); + }); + + it('valid subscription with fragment', () => { + // From https://spec.graphql.org/draft/#example-13061 + expectValid(` + subscription sub { + ...newMessageFields + } + + fragment newMessageFields on SubscriptionRoot { + newMessage { + body + sender + } + } + `); + }); + + it('valid subscription with fragment and field', () => { + // From https://spec.graphql.org/draft/#example-13061 + expectValid(` + subscription sub { + newMessage { + body + } + ...newMessageFields + } + + fragment newMessageFields on SubscriptionRoot { + newMessage { + body + sender + } + } + `); + }); + + it('fails with more than one root field', () => { + expectErrors(` + subscription ImportantEmails { + importantEmails + notImportantEmails + } + `).toDeepEqual([ + { + message: + 'Subscription "ImportantEmails" must select only one top level field.', + locations: [{ line: 4, column: 9 }], + }, + ]); + }); + + it('fails with more than one root field including introspection', () => { + expectErrors(` + subscription ImportantEmails { + importantEmails + __typename + } + `).toDeepEqual([ + { + message: + 'Subscription "ImportantEmails" must select only one top level field.', + locations: [{ line: 4, column: 9 }], + }, + { + message: + 'Subscription "ImportantEmails" must not select an introspection top level field.', + locations: [{ line: 4, column: 9 }], + }, + ]); + }); + + it('fails with more than one root field including aliased introspection via fragment', () => { + expectErrors(` + subscription ImportantEmails { + importantEmails + ...Introspection + } + fragment Introspection on SubscriptionRoot { + typename: __typename + } + `).toDeepEqual([ + { + message: + 'Subscription "ImportantEmails" must select only one top level field.', + locations: [{ line: 7, column: 9 }], + }, + { + message: + 'Subscription "ImportantEmails" must not select an introspection top level field.', + locations: [{ line: 7, column: 9 }], + }, + ]); + }); + + it('fails with many more than one root field', () => { + expectErrors(` + subscription ImportantEmails { + importantEmails + notImportantEmails + spamEmails + } + `).toDeepEqual([ + { + message: + 'Subscription "ImportantEmails" must select only one top level field.', + locations: [ + { line: 4, column: 9 }, + { line: 5, column: 9 }, + ], + }, + ]); + }); + + it('fails with many more than one root field via fragments', () => { + expectErrors(` + subscription ImportantEmails { + importantEmails + ... { + more: moreImportantEmails + } + ...NotImportantEmails + } + fragment NotImportantEmails on SubscriptionRoot { + notImportantEmails + deleted: deletedEmails + ...SpamEmails + } + fragment SpamEmails on SubscriptionRoot { + spamEmails + } + `).toDeepEqual([ + { + message: + 'Subscription "ImportantEmails" must select only one top level field.', + locations: [ + { line: 5, column: 11 }, + { line: 10, column: 9 }, + { line: 11, column: 9 }, + { line: 15, column: 9 }, + ], + }, + ]); + }); + + it('does not infinite loop on recursive fragments', () => { + expectErrors(` + subscription NoInfiniteLoop { + ...A + } + fragment A on SubscriptionRoot { + ...A + } + `).toDeepEqual([]); + }); + + it('fails with many more than one root field via fragments (anonymous)', () => { + expectErrors(` + subscription { + importantEmails + ... { + more: moreImportantEmails + ...NotImportantEmails + } + ...NotImportantEmails + } + fragment NotImportantEmails on SubscriptionRoot { + notImportantEmails + deleted: deletedEmails + ... { + ... { + archivedEmails + } + } + ...SpamEmails + } + fragment SpamEmails on SubscriptionRoot { + spamEmails + ...NonExistentFragment + } + `).toDeepEqual([ + { + message: 'Anonymous Subscription must select only one top level field.', + locations: [ + { line: 5, column: 11 }, + { line: 11, column: 9 }, + { line: 12, column: 9 }, + { line: 15, column: 13 }, + { line: 21, column: 9 }, + ], + }, + ]); + }); + + it('fails with more than one root field in anonymous subscriptions', () => { + expectErrors(` + subscription { + importantEmails + notImportantEmails + } + `).toDeepEqual([ + { + message: 'Anonymous Subscription must select only one top level field.', + locations: [{ line: 4, column: 9 }], + }, + ]); + }); + + it('fails with introspection field', () => { + expectErrors(` + subscription ImportantEmails { + __typename + } + `).toDeepEqual([ + { + message: + 'Subscription "ImportantEmails" must not select an introspection top level field.', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('fails with introspection field in anonymous subscription', () => { + expectErrors(` + subscription { + __typename + } + `).toDeepEqual([ + { + message: + 'Anonymous Subscription must not select an introspection top level field.', + locations: [{ line: 3, column: 9 }], + }, + ]); + }); + + it('skips if not subscription type', () => { + const emptySchema = buildSchema(` + type Query { + dummy: String + } + `); + + expectValidationErrorsWithSchema( + emptySchema, + SingleFieldSubscriptionsRule, + ` + subscription { + __typename + } + `, + ).toDeepEqual([]); + }); +}); diff --git a/src/validation/__tests__/UniqueArgumentDefinitionNamesRule-test.ts b/src/validation/__tests__/UniqueArgumentDefinitionNamesRule-test.ts new file mode 100644 index 00000000..cf63202b --- /dev/null +++ b/src/validation/__tests__/UniqueArgumentDefinitionNamesRule-test.ts @@ -0,0 +1,174 @@ +import { describe, it } from 'mocha'; + +import { UniqueArgumentDefinitionNamesRule } from '../rules/UniqueArgumentDefinitionNamesRule'; + +import { expectSDLValidationErrors } from './harness'; + +function expectSDLErrors(sdlStr: string) { + return expectSDLValidationErrors( + undefined, + UniqueArgumentDefinitionNamesRule, + sdlStr, + ); +} + +function expectValidSDL(sdlStr: string) { + expectSDLErrors(sdlStr).toDeepEqual([]); +} + +describe('Validate: Unique argument definition names', () => { + it('no args', () => { + expectValidSDL(` + type SomeObject { + someField: String + } + + interface SomeInterface { + someField: String + } + + directive @someDirective on QUERY + `); + }); + + it('one argument', () => { + expectValidSDL(` + type SomeObject { + someField(foo: String): String + } + + interface SomeInterface { + someField(foo: String): String + } + + extend type SomeObject { + anotherField(foo: String): String + } + + extend interface SomeInterface { + anotherField(foo: String): String + } + + directive @someDirective(foo: String) on QUERY + `); + }); + + it('multiple arguments', () => { + expectValidSDL(` + type SomeObject { + someField( + foo: String + bar: String + ): String + } + + interface SomeInterface { + someField( + foo: String + bar: String + ): String + } + + extend type SomeObject { + anotherField( + foo: String + bar: String + ): String + } + + extend interface SomeInterface { + anotherField( + foo: String + bar: String + ): String + } + + directive @someDirective( + foo: String + bar: String + ) on QUERY + `); + }); + + it('duplicating arguments', () => { + expectSDLErrors(` + type SomeObject { + someField( + foo: String + bar: String + foo: String + ): String + } + + interface SomeInterface { + someField( + foo: String + bar: String + foo: String + ): String + } + + extend type SomeObject { + anotherField( + foo: String + bar: String + bar: String + ): String + } + + extend interface SomeInterface { + anotherField( + bar: String + foo: String + foo: String + ): String + } + + directive @someDirective( + foo: String + bar: String + foo: String + ) on QUERY + `).toDeepEqual([ + { + message: + 'Argument "SomeObject.someField(foo:)" can only be defined once.', + locations: [ + { line: 4, column: 11 }, + { line: 6, column: 11 }, + ], + }, + { + message: + 'Argument "SomeInterface.someField(foo:)" can only be defined once.', + locations: [ + { line: 12, column: 11 }, + { line: 14, column: 11 }, + ], + }, + { + message: + 'Argument "SomeObject.anotherField(bar:)" can only be defined once.', + locations: [ + { line: 21, column: 11 }, + { line: 22, column: 11 }, + ], + }, + { + message: + 'Argument "SomeInterface.anotherField(foo:)" can only be defined once.', + locations: [ + { line: 29, column: 11 }, + { line: 30, column: 11 }, + ], + }, + { + message: 'Argument "@someDirective(foo:)" can only be defined once.', + locations: [ + { line: 35, column: 9 }, + { line: 37, column: 9 }, + ], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/UniqueArgumentNamesRule-test.ts b/src/validation/__tests__/UniqueArgumentNamesRule-test.ts new file mode 100644 index 00000000..f5709e32 --- /dev/null +++ b/src/validation/__tests__/UniqueArgumentNamesRule-test.ts @@ -0,0 +1,154 @@ +import { describe, it } from 'mocha'; + +import { UniqueArgumentNamesRule } from '../rules/UniqueArgumentNamesRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(UniqueArgumentNamesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: Unique argument names', () => { + it('no arguments on field', () => { + expectValid(` + { + field + } + `); + }); + + it('no arguments on directive', () => { + expectValid(` + { + field @directive + } + `); + }); + + it('argument on field', () => { + expectValid(` + { + field(arg: "value") + } + `); + }); + + it('argument on directive', () => { + expectValid(` + { + field @directive(arg: "value") + } + `); + }); + + it('same argument on two fields', () => { + expectValid(` + { + one: field(arg: "value") + two: field(arg: "value") + } + `); + }); + + it('same argument on field and directive', () => { + expectValid(` + { + field(arg: "value") @directive(arg: "value") + } + `); + }); + + it('same argument on two directives', () => { + expectValid(` + { + field @directive1(arg: "value") @directive2(arg: "value") + } + `); + }); + + it('multiple field arguments', () => { + expectValid(` + { + field(arg1: "value", arg2: "value", arg3: "value") + } + `); + }); + + it('multiple directive arguments', () => { + expectValid(` + { + field @directive(arg1: "value", arg2: "value", arg3: "value") + } + `); + }); + + it('duplicate field arguments', () => { + expectErrors(` + { + field(arg1: "value", arg1: "value") + } + `).toDeepEqual([ + { + message: 'There can be only one argument named "arg1".', + locations: [ + { line: 3, column: 15 }, + { line: 3, column: 30 }, + ], + }, + ]); + }); + + it('many duplicate field arguments', () => { + expectErrors(` + { + field(arg1: "value", arg1: "value", arg1: "value") + } + `).toDeepEqual([ + { + message: 'There can be only one argument named "arg1".', + locations: [ + { line: 3, column: 15 }, + { line: 3, column: 30 }, + { line: 3, column: 45 }, + ], + }, + ]); + }); + + it('duplicate directive arguments', () => { + expectErrors(` + { + field @directive(arg1: "value", arg1: "value") + } + `).toDeepEqual([ + { + message: 'There can be only one argument named "arg1".', + locations: [ + { line: 3, column: 26 }, + { line: 3, column: 41 }, + ], + }, + ]); + }); + + it('many duplicate directive arguments', () => { + expectErrors(` + { + field @directive(arg1: "value", arg1: "value", arg1: "value") + } + `).toDeepEqual([ + { + message: 'There can be only one argument named "arg1".', + locations: [ + { line: 3, column: 26 }, + { line: 3, column: 41 }, + { line: 3, column: 56 }, + ], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/UniqueDirectiveNamesRule-test.ts b/src/validation/__tests__/UniqueDirectiveNamesRule-test.ts new file mode 100644 index 00000000..a632af28 --- /dev/null +++ b/src/validation/__tests__/UniqueDirectiveNamesRule-test.ts @@ -0,0 +1,101 @@ +import { describe, it } from 'mocha'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { UniqueDirectiveNamesRule } from '../rules/UniqueDirectiveNamesRule'; + +import { expectSDLValidationErrors } from './harness'; + +function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { + return expectSDLValidationErrors(schema, UniqueDirectiveNamesRule, sdlStr); +} + +function expectValidSDL(sdlStr: string, schema?: GraphQLSchema) { + expectSDLErrors(sdlStr, schema).toDeepEqual([]); +} + +describe('Validate: Unique directive names', () => { + it('no directive', () => { + expectValidSDL(` + type Foo + `); + }); + + it('one directive', () => { + expectValidSDL(` + directive @foo on SCHEMA + `); + }); + + it('many directives', () => { + expectValidSDL(` + directive @foo on SCHEMA + directive @bar on SCHEMA + directive @baz on SCHEMA + `); + }); + + it('directive and non-directive definitions named the same', () => { + expectValidSDL(` + query foo { __typename } + fragment foo on foo { __typename } + type foo + + directive @foo on SCHEMA + `); + }); + + it('directives named the same', () => { + expectSDLErrors(` + directive @foo on SCHEMA + + directive @foo on SCHEMA + `).toDeepEqual([ + { + message: 'There can be only one directive named "@foo".', + locations: [ + { line: 2, column: 18 }, + { line: 4, column: 18 }, + ], + }, + ]); + }); + + it('adding new directive to existing schema', () => { + const schema = buildSchema('directive @foo on SCHEMA'); + + expectValidSDL('directive @bar on SCHEMA', schema); + }); + + it('adding new directive with standard name to existing schema', () => { + const schema = buildSchema('type foo'); + + expectSDLErrors('directive @skip on SCHEMA', schema).toDeepEqual([ + { + message: + 'Directive "@skip" already exists in the schema. It cannot be redefined.', + locations: [{ line: 1, column: 12 }], + }, + ]); + }); + + it('adding new directive to existing schema with same-named type', () => { + const schema = buildSchema('type foo'); + + expectValidSDL('directive @foo on SCHEMA', schema); + }); + + it('adding conflicting directives to existing schema', () => { + const schema = buildSchema('directive @foo on SCHEMA'); + + expectSDLErrors('directive @foo on SCHEMA', schema).toDeepEqual([ + { + message: + 'Directive "@foo" already exists in the schema. It cannot be redefined.', + locations: [{ line: 1, column: 12 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/UniqueDirectivesPerLocationRule-test.ts b/src/validation/__tests__/UniqueDirectivesPerLocationRule-test.ts new file mode 100644 index 00000000..d57a3df6 --- /dev/null +++ b/src/validation/__tests__/UniqueDirectivesPerLocationRule-test.ts @@ -0,0 +1,394 @@ +import { describe, it } from 'mocha'; + +import { parse } from '../../language/parser'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { extendSchema } from '../../utilities/extendSchema'; + +import { UniqueDirectivesPerLocationRule } from '../rules/UniqueDirectivesPerLocationRule'; + +import { + expectSDLValidationErrors, + expectValidationErrorsWithSchema, + testSchema, +} from './harness'; + +const extensionSDL = ` + directive @directive on FIELD | FRAGMENT_DEFINITION + directive @directiveA on FIELD | FRAGMENT_DEFINITION + directive @directiveB on FIELD | FRAGMENT_DEFINITION + directive @repeatable repeatable on FIELD | FRAGMENT_DEFINITION +`; +const schemaWithDirectives = extendSchema(testSchema, parse(extensionSDL)); + +function expectErrors(queryStr: string) { + return expectValidationErrorsWithSchema( + schemaWithDirectives, + UniqueDirectivesPerLocationRule, + queryStr, + ); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { + return expectSDLValidationErrors( + schema, + UniqueDirectivesPerLocationRule, + sdlStr, + ); +} + +describe('Validate: Directives Are Unique Per Location', () => { + it('no directives', () => { + expectValid(` + fragment Test on Type { + field + } + `); + }); + + it('unique directives in different locations', () => { + expectValid(` + fragment Test on Type @directiveA { + field @directiveB + } + `); + }); + + it('unique directives in same locations', () => { + expectValid(` + fragment Test on Type @directiveA @directiveB { + field @directiveA @directiveB + } + `); + }); + + it('same directives in different locations', () => { + expectValid(` + fragment Test on Type @directiveA { + field @directiveA + } + `); + }); + + it('same directives in similar locations', () => { + expectValid(` + fragment Test on Type { + field @directive + field @directive + } + `); + }); + + it('repeatable directives in same location', () => { + expectValid(` + fragment Test on Type @repeatable @repeatable { + field @repeatable @repeatable + } + `); + }); + + it('unknown directives must be ignored', () => { + expectValid(` + type Test @unknown @unknown { + field: String! @unknown @unknown + } + + extend type Test @unknown { + anotherField: String! + } + `); + }); + + it('duplicate directives in one location', () => { + expectErrors(` + fragment Test on Type { + field @directive @directive + } + `).toDeepEqual([ + { + message: + 'The directive "@directive" can only be used once at this location.', + locations: [ + { line: 3, column: 15 }, + { line: 3, column: 26 }, + ], + }, + ]); + }); + + it('many duplicate directives in one location', () => { + expectErrors(` + fragment Test on Type { + field @directive @directive @directive + } + `).toDeepEqual([ + { + message: + 'The directive "@directive" can only be used once at this location.', + locations: [ + { line: 3, column: 15 }, + { line: 3, column: 26 }, + ], + }, + { + message: + 'The directive "@directive" can only be used once at this location.', + locations: [ + { line: 3, column: 15 }, + { line: 3, column: 37 }, + ], + }, + ]); + }); + + it('different duplicate directives in one location', () => { + expectErrors(` + fragment Test on Type { + field @directiveA @directiveB @directiveA @directiveB + } + `).toDeepEqual([ + { + message: + 'The directive "@directiveA" can only be used once at this location.', + locations: [ + { line: 3, column: 15 }, + { line: 3, column: 39 }, + ], + }, + { + message: + 'The directive "@directiveB" can only be used once at this location.', + locations: [ + { line: 3, column: 27 }, + { line: 3, column: 51 }, + ], + }, + ]); + }); + + it('duplicate directives in many locations', () => { + expectErrors(` + fragment Test on Type @directive @directive { + field @directive @directive + } + `).toDeepEqual([ + { + message: + 'The directive "@directive" can only be used once at this location.', + locations: [ + { line: 2, column: 29 }, + { line: 2, column: 40 }, + ], + }, + { + message: + 'The directive "@directive" can only be used once at this location.', + locations: [ + { line: 3, column: 15 }, + { line: 3, column: 26 }, + ], + }, + ]); + }); + + it('duplicate directives on SDL definitions', () => { + expectSDLErrors(` + directive @nonRepeatable on + SCHEMA | SCALAR | OBJECT | INTERFACE | UNION | INPUT_OBJECT + + schema @nonRepeatable @nonRepeatable { query: Dummy } + + scalar TestScalar @nonRepeatable @nonRepeatable + type TestObject @nonRepeatable @nonRepeatable + interface TestInterface @nonRepeatable @nonRepeatable + union TestUnion @nonRepeatable @nonRepeatable + input TestInput @nonRepeatable @nonRepeatable + `).toDeepEqual([ + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 5, column: 14 }, + { line: 5, column: 29 }, + ], + }, + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 7, column: 25 }, + { line: 7, column: 40 }, + ], + }, + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 8, column: 23 }, + { line: 8, column: 38 }, + ], + }, + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 9, column: 31 }, + { line: 9, column: 46 }, + ], + }, + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 10, column: 23 }, + { line: 10, column: 38 }, + ], + }, + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 11, column: 23 }, + { line: 11, column: 38 }, + ], + }, + ]); + }); + + it('duplicate directives on SDL extensions', () => { + expectSDLErrors(` + directive @nonRepeatable on + SCHEMA | SCALAR | OBJECT | INTERFACE | UNION | INPUT_OBJECT + + extend schema @nonRepeatable @nonRepeatable + + extend scalar TestScalar @nonRepeatable @nonRepeatable + extend type TestObject @nonRepeatable @nonRepeatable + extend interface TestInterface @nonRepeatable @nonRepeatable + extend union TestUnion @nonRepeatable @nonRepeatable + extend input TestInput @nonRepeatable @nonRepeatable + `).toDeepEqual([ + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 5, column: 21 }, + { line: 5, column: 36 }, + ], + }, + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 7, column: 32 }, + { line: 7, column: 47 }, + ], + }, + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 8, column: 30 }, + { line: 8, column: 45 }, + ], + }, + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 9, column: 38 }, + { line: 9, column: 53 }, + ], + }, + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 10, column: 30 }, + { line: 10, column: 45 }, + ], + }, + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 11, column: 30 }, + { line: 11, column: 45 }, + ], + }, + ]); + }); + + it('duplicate directives between SDL definitions and extensions', () => { + expectSDLErrors(` + directive @nonRepeatable on SCHEMA + + schema @nonRepeatable { query: Dummy } + extend schema @nonRepeatable + `).toDeepEqual([ + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 4, column: 14 }, + { line: 5, column: 21 }, + ], + }, + ]); + + expectSDLErrors(` + directive @nonRepeatable on SCALAR + + scalar TestScalar @nonRepeatable + extend scalar TestScalar @nonRepeatable + scalar TestScalar @nonRepeatable + `).toDeepEqual([ + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 4, column: 25 }, + { line: 5, column: 32 }, + ], + }, + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 4, column: 25 }, + { line: 6, column: 25 }, + ], + }, + ]); + + expectSDLErrors(` + directive @nonRepeatable on OBJECT + + extend type TestObject @nonRepeatable + type TestObject @nonRepeatable + extend type TestObject @nonRepeatable + `).toDeepEqual([ + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 4, column: 30 }, + { line: 5, column: 23 }, + ], + }, + { + message: + 'The directive "@nonRepeatable" can only be used once at this location.', + locations: [ + { line: 4, column: 30 }, + { line: 6, column: 30 }, + ], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/UniqueEnumValueNamesRule-test.ts b/src/validation/__tests__/UniqueEnumValueNamesRule-test.ts new file mode 100644 index 00000000..17a71a6e --- /dev/null +++ b/src/validation/__tests__/UniqueEnumValueNamesRule-test.ts @@ -0,0 +1,194 @@ +import { describe, it } from 'mocha'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { UniqueEnumValueNamesRule } from '../rules/UniqueEnumValueNamesRule'; + +import { expectSDLValidationErrors } from './harness'; + +function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { + return expectSDLValidationErrors(schema, UniqueEnumValueNamesRule, sdlStr); +} + +function expectValidSDL(sdlStr: string, schema?: GraphQLSchema) { + expectSDLErrors(sdlStr, schema).toDeepEqual([]); +} + +describe('Validate: Unique enum value names', () => { + it('no values', () => { + expectValidSDL(` + enum SomeEnum + `); + }); + + it('one value', () => { + expectValidSDL(` + enum SomeEnum { + FOO + } + `); + }); + + it('multiple values', () => { + expectValidSDL(` + enum SomeEnum { + FOO + BAR + } + `); + }); + + it('duplicate values inside the same enum definition', () => { + expectSDLErrors(` + enum SomeEnum { + FOO + BAR + FOO + } + `).toDeepEqual([ + { + message: 'Enum value "SomeEnum.FOO" can only be defined once.', + locations: [ + { line: 3, column: 9 }, + { line: 5, column: 9 }, + ], + }, + ]); + }); + + it('extend enum with new value', () => { + expectValidSDL(` + enum SomeEnum { + FOO + } + extend enum SomeEnum { + BAR + } + extend enum SomeEnum { + BAZ + } + `); + }); + + it('extend enum with duplicate value', () => { + expectSDLErrors(` + extend enum SomeEnum { + FOO + } + enum SomeEnum { + FOO + } + `).toDeepEqual([ + { + message: 'Enum value "SomeEnum.FOO" can only be defined once.', + locations: [ + { line: 3, column: 9 }, + { line: 6, column: 9 }, + ], + }, + ]); + }); + + it('duplicate value inside extension', () => { + expectSDLErrors(` + enum SomeEnum + extend enum SomeEnum { + FOO + BAR + FOO + } + `).toDeepEqual([ + { + message: 'Enum value "SomeEnum.FOO" can only be defined once.', + locations: [ + { line: 4, column: 9 }, + { line: 6, column: 9 }, + ], + }, + ]); + }); + + it('duplicate value inside different extensions', () => { + expectSDLErrors(` + enum SomeEnum + extend enum SomeEnum { + FOO + } + extend enum SomeEnum { + FOO + } + `).toDeepEqual([ + { + message: 'Enum value "SomeEnum.FOO" can only be defined once.', + locations: [ + { line: 4, column: 9 }, + { line: 7, column: 9 }, + ], + }, + ]); + }); + + it('adding new value to the type inside existing schema', () => { + const schema = buildSchema('enum SomeEnum'); + const sdl = ` + extend enum SomeEnum { + FOO + } + `; + + expectValidSDL(sdl, schema); + }); + + it('adding conflicting value to existing schema twice', () => { + const schema = buildSchema(` + enum SomeEnum { + FOO + } + `); + const sdl = ` + extend enum SomeEnum { + FOO + } + extend enum SomeEnum { + FOO + } + `; + + expectSDLErrors(sdl, schema).toDeepEqual([ + { + message: + 'Enum value "SomeEnum.FOO" already exists in the schema. It cannot also be defined in this type extension.', + locations: [{ line: 3, column: 9 }], + }, + { + message: + 'Enum value "SomeEnum.FOO" already exists in the schema. It cannot also be defined in this type extension.', + locations: [{ line: 6, column: 9 }], + }, + ]); + }); + + it('adding enum values to existing schema twice', () => { + const schema = buildSchema('enum SomeEnum'); + const sdl = ` + extend enum SomeEnum { + FOO + } + extend enum SomeEnum { + FOO + } + `; + + expectSDLErrors(sdl, schema).toDeepEqual([ + { + message: 'Enum value "SomeEnum.FOO" can only be defined once.', + locations: [ + { line: 3, column: 9 }, + { line: 6, column: 9 }, + ], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/UniqueFieldDefinitionNamesRule-test.ts b/src/validation/__tests__/UniqueFieldDefinitionNamesRule-test.ts new file mode 100644 index 00000000..441e85d3 --- /dev/null +++ b/src/validation/__tests__/UniqueFieldDefinitionNamesRule-test.ts @@ -0,0 +1,435 @@ +import { describe, it } from 'mocha'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { UniqueFieldDefinitionNamesRule } from '../rules/UniqueFieldDefinitionNamesRule'; + +import { expectSDLValidationErrors } from './harness'; + +function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { + return expectSDLValidationErrors( + schema, + UniqueFieldDefinitionNamesRule, + sdlStr, + ); +} + +function expectValidSDL(sdlStr: string, schema?: GraphQLSchema) { + expectSDLErrors(sdlStr, schema).toDeepEqual([]); +} + +describe('Validate: Unique field definition names', () => { + it('no fields', () => { + expectValidSDL(` + type SomeObject + interface SomeInterface + input SomeInputObject + `); + }); + + it('one field', () => { + expectValidSDL(` + type SomeObject { + foo: String + } + + interface SomeInterface { + foo: String + } + + input SomeInputObject { + foo: String + } + `); + }); + + it('multiple fields', () => { + expectValidSDL(` + type SomeObject { + foo: String + bar: String + } + + interface SomeInterface { + foo: String + bar: String + } + + input SomeInputObject { + foo: String + bar: String + } + `); + }); + + it('duplicate fields inside the same type definition', () => { + expectSDLErrors(` + type SomeObject { + foo: String + bar: String + foo: String + } + + interface SomeInterface { + foo: String + bar: String + foo: String + } + + input SomeInputObject { + foo: String + bar: String + foo: String + } + `).toDeepEqual([ + { + message: 'Field "SomeObject.foo" can only be defined once.', + locations: [ + { line: 3, column: 9 }, + { line: 5, column: 9 }, + ], + }, + { + message: 'Field "SomeInterface.foo" can only be defined once.', + locations: [ + { line: 9, column: 9 }, + { line: 11, column: 9 }, + ], + }, + { + message: 'Field "SomeInputObject.foo" can only be defined once.', + locations: [ + { line: 15, column: 9 }, + { line: 17, column: 9 }, + ], + }, + ]); + }); + + it('extend type with new field', () => { + expectValidSDL(` + type SomeObject { + foo: String + } + extend type SomeObject { + bar: String + } + extend type SomeObject { + baz: String + } + + interface SomeInterface { + foo: String + } + extend interface SomeInterface { + bar: String + } + extend interface SomeInterface { + baz: String + } + + input SomeInputObject { + foo: String + } + extend input SomeInputObject { + bar: String + } + extend input SomeInputObject { + baz: String + } + `); + }); + + it('extend type with duplicate field', () => { + expectSDLErrors(` + extend type SomeObject { + foo: String + } + type SomeObject { + foo: String + } + + extend interface SomeInterface { + foo: String + } + interface SomeInterface { + foo: String + } + + extend input SomeInputObject { + foo: String + } + input SomeInputObject { + foo: String + } + `).toDeepEqual([ + { + message: 'Field "SomeObject.foo" can only be defined once.', + locations: [ + { line: 3, column: 9 }, + { line: 6, column: 9 }, + ], + }, + { + message: 'Field "SomeInterface.foo" can only be defined once.', + locations: [ + { line: 10, column: 9 }, + { line: 13, column: 9 }, + ], + }, + { + message: 'Field "SomeInputObject.foo" can only be defined once.', + locations: [ + { line: 17, column: 9 }, + { line: 20, column: 9 }, + ], + }, + ]); + }); + + it('duplicate field inside extension', () => { + expectSDLErrors(` + type SomeObject + extend type SomeObject { + foo: String + bar: String + foo: String + } + + interface SomeInterface + extend interface SomeInterface { + foo: String + bar: String + foo: String + } + + input SomeInputObject + extend input SomeInputObject { + foo: String + bar: String + foo: String + } + `).toDeepEqual([ + { + message: 'Field "SomeObject.foo" can only be defined once.', + locations: [ + { line: 4, column: 9 }, + { line: 6, column: 9 }, + ], + }, + { + message: 'Field "SomeInterface.foo" can only be defined once.', + locations: [ + { line: 11, column: 9 }, + { line: 13, column: 9 }, + ], + }, + { + message: 'Field "SomeInputObject.foo" can only be defined once.', + locations: [ + { line: 18, column: 9 }, + { line: 20, column: 9 }, + ], + }, + ]); + }); + + it('duplicate field inside different extensions', () => { + expectSDLErrors(` + type SomeObject + extend type SomeObject { + foo: String + } + extend type SomeObject { + foo: String + } + + interface SomeInterface + extend interface SomeInterface { + foo: String + } + extend interface SomeInterface { + foo: String + } + + input SomeInputObject + extend input SomeInputObject { + foo: String + } + extend input SomeInputObject { + foo: String + } + `).toDeepEqual([ + { + message: 'Field "SomeObject.foo" can only be defined once.', + locations: [ + { line: 4, column: 9 }, + { line: 7, column: 9 }, + ], + }, + { + message: 'Field "SomeInterface.foo" can only be defined once.', + locations: [ + { line: 12, column: 9 }, + { line: 15, column: 9 }, + ], + }, + { + message: 'Field "SomeInputObject.foo" can only be defined once.', + locations: [ + { line: 20, column: 9 }, + { line: 23, column: 9 }, + ], + }, + ]); + }); + + it('adding new field to the type inside existing schema', () => { + const schema = buildSchema(` + type SomeObject + interface SomeInterface + input SomeInputObject + `); + const sdl = ` + extend type SomeObject { + foo: String + } + + extend interface SomeInterface { + foo: String + } + + extend input SomeInputObject { + foo: String + } + `; + + expectValidSDL(sdl, schema); + }); + + it('adding conflicting fields to existing schema twice', () => { + const schema = buildSchema(` + type SomeObject { + foo: String + } + + interface SomeInterface { + foo: String + } + + input SomeInputObject { + foo: String + } + `); + const sdl = ` + extend type SomeObject { + foo: String + } + extend interface SomeInterface { + foo: String + } + extend input SomeInputObject { + foo: String + } + + extend type SomeObject { + foo: String + } + extend interface SomeInterface { + foo: String + } + extend input SomeInputObject { + foo: String + } + `; + + expectSDLErrors(sdl, schema).toDeepEqual([ + { + message: + 'Field "SomeObject.foo" already exists in the schema. It cannot also be defined in this type extension.', + locations: [{ line: 3, column: 9 }], + }, + { + message: + 'Field "SomeInterface.foo" already exists in the schema. It cannot also be defined in this type extension.', + locations: [{ line: 6, column: 9 }], + }, + { + message: + 'Field "SomeInputObject.foo" already exists in the schema. It cannot also be defined in this type extension.', + locations: [{ line: 9, column: 9 }], + }, + { + message: + 'Field "SomeObject.foo" already exists in the schema. It cannot also be defined in this type extension.', + locations: [{ line: 13, column: 9 }], + }, + { + message: + 'Field "SomeInterface.foo" already exists in the schema. It cannot also be defined in this type extension.', + locations: [{ line: 16, column: 9 }], + }, + { + message: + 'Field "SomeInputObject.foo" already exists in the schema. It cannot also be defined in this type extension.', + locations: [{ line: 19, column: 9 }], + }, + ]); + }); + + it('adding fields to existing schema twice', () => { + const schema = buildSchema(` + type SomeObject + interface SomeInterface + input SomeInputObject + `); + const sdl = ` + extend type SomeObject { + foo: String + } + extend type SomeObject { + foo: String + } + + extend interface SomeInterface { + foo: String + } + extend interface SomeInterface { + foo: String + } + + extend input SomeInputObject { + foo: String + } + extend input SomeInputObject { + foo: String + } + `; + + expectSDLErrors(sdl, schema).toDeepEqual([ + { + message: 'Field "SomeObject.foo" can only be defined once.', + locations: [ + { line: 3, column: 9 }, + { line: 6, column: 9 }, + ], + }, + { + message: 'Field "SomeInterface.foo" can only be defined once.', + locations: [ + { line: 10, column: 9 }, + { line: 13, column: 9 }, + ], + }, + { + message: 'Field "SomeInputObject.foo" can only be defined once.', + locations: [ + { line: 17, column: 9 }, + { line: 20, column: 9 }, + ], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/UniqueFragmentNamesRule-test.ts b/src/validation/__tests__/UniqueFragmentNamesRule-test.ts new file mode 100644 index 00000000..2a693a67 --- /dev/null +++ b/src/validation/__tests__/UniqueFragmentNamesRule-test.ts @@ -0,0 +1,119 @@ +import { describe, it } from 'mocha'; + +import { UniqueFragmentNamesRule } from '../rules/UniqueFragmentNamesRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(UniqueFragmentNamesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: Unique fragment names', () => { + it('no fragments', () => { + expectValid(` + { + field + } + `); + }); + + it('one fragment', () => { + expectValid(` + { + ...fragA + } + + fragment fragA on Type { + field + } + `); + }); + + it('many fragments', () => { + expectValid(` + { + ...fragA + ...fragB + ...fragC + } + fragment fragA on Type { + fieldA + } + fragment fragB on Type { + fieldB + } + fragment fragC on Type { + fieldC + } + `); + }); + + it('inline fragments are always unique', () => { + expectValid(` + { + ...on Type { + fieldA + } + ...on Type { + fieldB + } + } + `); + }); + + it('fragment and operation named the same', () => { + expectValid(` + query Foo { + ...Foo + } + fragment Foo on Type { + field + } + `); + }); + + it('fragments named the same', () => { + expectErrors(` + { + ...fragA + } + fragment fragA on Type { + fieldA + } + fragment fragA on Type { + fieldB + } + `).toDeepEqual([ + { + message: 'There can be only one fragment named "fragA".', + locations: [ + { line: 5, column: 16 }, + { line: 8, column: 16 }, + ], + }, + ]); + }); + + it('fragments named the same without being referenced', () => { + expectErrors(` + fragment fragA on Type { + fieldA + } + fragment fragA on Type { + fieldB + } + `).toDeepEqual([ + { + message: 'There can be only one fragment named "fragA".', + locations: [ + { line: 2, column: 16 }, + { line: 5, column: 16 }, + ], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/UniqueInputFieldNamesRule-test.ts b/src/validation/__tests__/UniqueInputFieldNamesRule-test.ts new file mode 100644 index 00000000..33e4a2db --- /dev/null +++ b/src/validation/__tests__/UniqueInputFieldNamesRule-test.ts @@ -0,0 +1,110 @@ +import { describe, it } from 'mocha'; + +import { UniqueInputFieldNamesRule } from '../rules/UniqueInputFieldNamesRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(UniqueInputFieldNamesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: Unique input field names', () => { + it('input object with fields', () => { + expectValid(` + { + field(arg: { f: true }) + } + `); + }); + + it('same input object within two args', () => { + expectValid(` + { + field(arg1: { f: true }, arg2: { f: true }) + } + `); + }); + + it('multiple input object fields', () => { + expectValid(` + { + field(arg: { f1: "value", f2: "value", f3: "value" }) + } + `); + }); + + it('allows for nested input objects with similar fields', () => { + expectValid(` + { + field(arg: { + deep: { + deep: { + id: 1 + } + id: 1 + } + id: 1 + }) + } + `); + }); + + it('duplicate input object fields', () => { + expectErrors(` + { + field(arg: { f1: "value", f1: "value" }) + } + `).toDeepEqual([ + { + message: 'There can be only one input field named "f1".', + locations: [ + { line: 3, column: 22 }, + { line: 3, column: 35 }, + ], + }, + ]); + }); + + it('many duplicate input object fields', () => { + expectErrors(` + { + field(arg: { f1: "value", f1: "value", f1: "value" }) + } + `).toDeepEqual([ + { + message: 'There can be only one input field named "f1".', + locations: [ + { line: 3, column: 22 }, + { line: 3, column: 35 }, + ], + }, + { + message: 'There can be only one input field named "f1".', + locations: [ + { line: 3, column: 22 }, + { line: 3, column: 48 }, + ], + }, + ]); + }); + + it('nested duplicate input object fields', () => { + expectErrors(` + { + field(arg: { f1: {f2: "value", f2: "value" }}) + } + `).toDeepEqual([ + { + message: 'There can be only one input field named "f2".', + locations: [ + { line: 3, column: 27 }, + { line: 3, column: 40 }, + ], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/UniqueOperationNamesRule-test.ts b/src/validation/__tests__/UniqueOperationNamesRule-test.ts new file mode 100644 index 00000000..f84abda6 --- /dev/null +++ b/src/validation/__tests__/UniqueOperationNamesRule-test.ts @@ -0,0 +1,135 @@ +import { describe, it } from 'mocha'; + +import { UniqueOperationNamesRule } from '../rules/UniqueOperationNamesRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(UniqueOperationNamesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: Unique operation names', () => { + it('no operations', () => { + expectValid(` + fragment fragA on Type { + field + } + `); + }); + + it('one anon operation', () => { + expectValid(` + { + field + } + `); + }); + + it('one named operation', () => { + expectValid(` + query Foo { + field + } + `); + }); + + it('multiple operations', () => { + expectValid(` + query Foo { + field + } + + query Bar { + field + } + `); + }); + + it('multiple operations of different types', () => { + expectValid(` + query Foo { + field + } + + mutation Bar { + field + } + + subscription Baz { + field + } + `); + }); + + it('fragment and operation named the same', () => { + expectValid(` + query Foo { + ...Foo + } + fragment Foo on Type { + field + } + `); + }); + + it('multiple operations of same name', () => { + expectErrors(` + query Foo { + fieldA + } + query Foo { + fieldB + } + `).toDeepEqual([ + { + message: 'There can be only one operation named "Foo".', + locations: [ + { line: 2, column: 13 }, + { line: 5, column: 13 }, + ], + }, + ]); + }); + + it('multiple ops of same name of different types (mutation)', () => { + expectErrors(` + query Foo { + fieldA + } + mutation Foo { + fieldB + } + `).toDeepEqual([ + { + message: 'There can be only one operation named "Foo".', + locations: [ + { line: 2, column: 13 }, + { line: 5, column: 16 }, + ], + }, + ]); + }); + + it('multiple ops of same name of different types (subscription)', () => { + expectErrors(` + query Foo { + fieldA + } + subscription Foo { + fieldB + } + `).toDeepEqual([ + { + message: 'There can be only one operation named "Foo".', + locations: [ + { line: 2, column: 13 }, + { line: 5, column: 20 }, + ], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/UniqueOperationTypesRule-test.ts b/src/validation/__tests__/UniqueOperationTypesRule-test.ts new file mode 100644 index 00000000..61e819b0 --- /dev/null +++ b/src/validation/__tests__/UniqueOperationTypesRule-test.ts @@ -0,0 +1,384 @@ +import { describe, it } from 'mocha'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { UniqueOperationTypesRule } from '../rules/UniqueOperationTypesRule'; + +import { expectSDLValidationErrors } from './harness'; + +function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { + return expectSDLValidationErrors(schema, UniqueOperationTypesRule, sdlStr); +} + +function expectValidSDL(sdlStr: string, schema?: GraphQLSchema) { + expectSDLErrors(sdlStr, schema).toDeepEqual([]); +} + +describe('Validate: Unique operation types', () => { + it('no schema definition', () => { + expectValidSDL(` + type Foo + `); + }); + + it('schema definition with all types', () => { + expectValidSDL(` + type Foo + + schema { + query: Foo + mutation: Foo + subscription: Foo + } + `); + }); + + it('schema definition with single extension', () => { + expectValidSDL(` + type Foo + + schema { query: Foo } + + extend schema { + mutation: Foo + subscription: Foo + } + `); + }); + + it('schema definition with separate extensions', () => { + expectValidSDL(` + type Foo + + schema { query: Foo } + extend schema { mutation: Foo } + extend schema { subscription: Foo } + `); + }); + + it('extend schema before definition', () => { + expectValidSDL(` + type Foo + + extend schema { mutation: Foo } + extend schema { subscription: Foo } + + schema { query: Foo } + `); + }); + + it('duplicate operation types inside single schema definition', () => { + expectSDLErrors(` + type Foo + + schema { + query: Foo + mutation: Foo + subscription: Foo + + query: Foo + mutation: Foo + subscription: Foo + } + `).toDeepEqual([ + { + message: 'There can be only one query type in schema.', + locations: [ + { line: 5, column: 9 }, + { line: 9, column: 9 }, + ], + }, + { + message: 'There can be only one mutation type in schema.', + locations: [ + { line: 6, column: 9 }, + { line: 10, column: 9 }, + ], + }, + { + message: 'There can be only one subscription type in schema.', + locations: [ + { line: 7, column: 9 }, + { line: 11, column: 9 }, + ], + }, + ]); + }); + + it('duplicate operation types inside schema extension', () => { + expectSDLErrors(` + type Foo + + schema { + query: Foo + mutation: Foo + subscription: Foo + } + + extend schema { + query: Foo + mutation: Foo + subscription: Foo + } + `).toDeepEqual([ + { + message: 'There can be only one query type in schema.', + locations: [ + { line: 5, column: 9 }, + { line: 11, column: 9 }, + ], + }, + { + message: 'There can be only one mutation type in schema.', + locations: [ + { line: 6, column: 9 }, + { line: 12, column: 9 }, + ], + }, + { + message: 'There can be only one subscription type in schema.', + locations: [ + { line: 7, column: 9 }, + { line: 13, column: 9 }, + ], + }, + ]); + }); + + it('duplicate operation types inside schema extension twice', () => { + expectSDLErrors(` + type Foo + + schema { + query: Foo + mutation: Foo + subscription: Foo + } + + extend schema { + query: Foo + mutation: Foo + subscription: Foo + } + + extend schema { + query: Foo + mutation: Foo + subscription: Foo + } + `).toDeepEqual([ + { + message: 'There can be only one query type in schema.', + locations: [ + { line: 5, column: 9 }, + { line: 11, column: 9 }, + ], + }, + { + message: 'There can be only one mutation type in schema.', + locations: [ + { line: 6, column: 9 }, + { line: 12, column: 9 }, + ], + }, + { + message: 'There can be only one subscription type in schema.', + locations: [ + { line: 7, column: 9 }, + { line: 13, column: 9 }, + ], + }, + { + message: 'There can be only one query type in schema.', + locations: [ + { line: 5, column: 9 }, + { line: 17, column: 9 }, + ], + }, + { + message: 'There can be only one mutation type in schema.', + locations: [ + { line: 6, column: 9 }, + { line: 18, column: 9 }, + ], + }, + { + message: 'There can be only one subscription type in schema.', + locations: [ + { line: 7, column: 9 }, + { line: 19, column: 9 }, + ], + }, + ]); + }); + + it('duplicate operation types inside second schema extension', () => { + expectSDLErrors(` + type Foo + + schema { + query: Foo + } + + extend schema { + mutation: Foo + subscription: Foo + } + + extend schema { + query: Foo + mutation: Foo + subscription: Foo + } + `).toDeepEqual([ + { + message: 'There can be only one query type in schema.', + locations: [ + { line: 5, column: 9 }, + { line: 14, column: 9 }, + ], + }, + { + message: 'There can be only one mutation type in schema.', + locations: [ + { line: 9, column: 9 }, + { line: 15, column: 9 }, + ], + }, + { + message: 'There can be only one subscription type in schema.', + locations: [ + { line: 10, column: 9 }, + { line: 16, column: 9 }, + ], + }, + ]); + }); + + it('define schema inside extension SDL', () => { + const schema = buildSchema('type Foo'); + const sdl = ` + schema { + query: Foo + mutation: Foo + subscription: Foo + } + `; + + expectValidSDL(sdl, schema); + }); + + it('define and extend schema inside extension SDL', () => { + const schema = buildSchema('type Foo'); + const sdl = ` + schema { query: Foo } + extend schema { mutation: Foo } + extend schema { subscription: Foo } + `; + + expectValidSDL(sdl, schema); + }); + + it('adding new operation types to existing schema', () => { + const schema = buildSchema('type Query'); + const sdl = ` + extend schema { mutation: Foo } + extend schema { subscription: Foo } + `; + + expectValidSDL(sdl, schema); + }); + + it('adding conflicting operation types to existing schema', () => { + const schema = buildSchema(` + type Query + type Mutation + type Subscription + + type Foo + `); + + const sdl = ` + extend schema { + query: Foo + mutation: Foo + subscription: Foo + } + `; + + expectSDLErrors(sdl, schema).toDeepEqual([ + { + message: + 'Type for query already defined in the schema. It cannot be redefined.', + locations: [{ line: 3, column: 9 }], + }, + { + message: + 'Type for mutation already defined in the schema. It cannot be redefined.', + locations: [{ line: 4, column: 9 }], + }, + { + message: + 'Type for subscription already defined in the schema. It cannot be redefined.', + locations: [{ line: 5, column: 9 }], + }, + ]); + }); + + it('adding conflicting operation types to existing schema twice', () => { + const schema = buildSchema(` + type Query + type Mutation + type Subscription + `); + + const sdl = ` + extend schema { + query: Foo + mutation: Foo + subscription: Foo + } + + extend schema { + query: Foo + mutation: Foo + subscription: Foo + } + `; + + expectSDLErrors(sdl, schema).toDeepEqual([ + { + message: + 'Type for query already defined in the schema. It cannot be redefined.', + locations: [{ line: 3, column: 9 }], + }, + { + message: + 'Type for mutation already defined in the schema. It cannot be redefined.', + locations: [{ line: 4, column: 9 }], + }, + { + message: + 'Type for subscription already defined in the schema. It cannot be redefined.', + locations: [{ line: 5, column: 9 }], + }, + { + message: + 'Type for query already defined in the schema. It cannot be redefined.', + locations: [{ line: 9, column: 9 }], + }, + { + message: + 'Type for mutation already defined in the schema. It cannot be redefined.', + locations: [{ line: 10, column: 9 }], + }, + { + message: + 'Type for subscription already defined in the schema. It cannot be redefined.', + locations: [{ line: 11, column: 9 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/UniqueTypeNamesRule-test.ts b/src/validation/__tests__/UniqueTypeNamesRule-test.ts new file mode 100644 index 00000000..5478467d --- /dev/null +++ b/src/validation/__tests__/UniqueTypeNamesRule-test.ts @@ -0,0 +1,162 @@ +import { describe, it } from 'mocha'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { UniqueTypeNamesRule } from '../rules/UniqueTypeNamesRule'; + +import { expectSDLValidationErrors } from './harness'; + +function expectSDLErrors(sdlStr: string, schema?: GraphQLSchema) { + return expectSDLValidationErrors(schema, UniqueTypeNamesRule, sdlStr); +} + +function expectValidSDL(sdlStr: string, schema?: GraphQLSchema) { + expectSDLErrors(sdlStr, schema).toDeepEqual([]); +} + +describe('Validate: Unique type names', () => { + it('no types', () => { + expectValidSDL(` + directive @test on SCHEMA + `); + }); + + it('one type', () => { + expectValidSDL(` + type Foo + `); + }); + + it('many types', () => { + expectValidSDL(` + type Foo + type Bar + type Baz + `); + }); + + it('type and non-type definitions named the same', () => { + expectValidSDL(` + query Foo { __typename } + fragment Foo on Query { __typename } + directive @Foo on SCHEMA + + type Foo + `); + }); + + it('types named the same', () => { + expectSDLErrors(` + type Foo + + scalar Foo + type Foo + interface Foo + union Foo + enum Foo + input Foo + `).toDeepEqual([ + { + message: 'There can be only one type named "Foo".', + locations: [ + { line: 2, column: 12 }, + { line: 4, column: 14 }, + ], + }, + { + message: 'There can be only one type named "Foo".', + locations: [ + { line: 2, column: 12 }, + { line: 5, column: 12 }, + ], + }, + { + message: 'There can be only one type named "Foo".', + locations: [ + { line: 2, column: 12 }, + { line: 6, column: 17 }, + ], + }, + { + message: 'There can be only one type named "Foo".', + locations: [ + { line: 2, column: 12 }, + { line: 7, column: 13 }, + ], + }, + { + message: 'There can be only one type named "Foo".', + locations: [ + { line: 2, column: 12 }, + { line: 8, column: 12 }, + ], + }, + { + message: 'There can be only one type named "Foo".', + locations: [ + { line: 2, column: 12 }, + { line: 9, column: 13 }, + ], + }, + ]); + }); + + it('adding new type to existing schema', () => { + const schema = buildSchema('type Foo'); + + expectValidSDL('type Bar', schema); + }); + + it('adding new type to existing schema with same-named directive', () => { + const schema = buildSchema('directive @Foo on SCHEMA'); + + expectValidSDL('type Foo', schema); + }); + + it('adding conflicting types to existing schema', () => { + const schema = buildSchema('type Foo'); + const sdl = ` + scalar Foo + type Foo + interface Foo + union Foo + enum Foo + input Foo + `; + + expectSDLErrors(sdl, schema).toDeepEqual([ + { + message: + 'Type "Foo" already exists in the schema. It cannot also be defined in this type definition.', + locations: [{ line: 2, column: 14 }], + }, + { + message: + 'Type "Foo" already exists in the schema. It cannot also be defined in this type definition.', + locations: [{ line: 3, column: 12 }], + }, + { + message: + 'Type "Foo" already exists in the schema. It cannot also be defined in this type definition.', + locations: [{ line: 4, column: 17 }], + }, + { + message: + 'Type "Foo" already exists in the schema. It cannot also be defined in this type definition.', + locations: [{ line: 5, column: 13 }], + }, + { + message: + 'Type "Foo" already exists in the schema. It cannot also be defined in this type definition.', + locations: [{ line: 6, column: 12 }], + }, + { + message: + 'Type "Foo" already exists in the schema. It cannot also be defined in this type definition.', + locations: [{ line: 7, column: 13 }], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/UniqueVariableNamesRule-test.ts b/src/validation/__tests__/UniqueVariableNamesRule-test.ts new file mode 100644 index 00000000..9d51b621 --- /dev/null +++ b/src/validation/__tests__/UniqueVariableNamesRule-test.ts @@ -0,0 +1,53 @@ +import { describe, it } from 'mocha'; + +import { UniqueVariableNamesRule } from '../rules/UniqueVariableNamesRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(UniqueVariableNamesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: Unique variable names', () => { + it('unique variable names', () => { + expectValid(` + query A($x: Int, $y: String) { __typename } + query B($x: String, $y: Int) { __typename } + `); + }); + + it('duplicate variable names', () => { + expectErrors(` + query A($x: Int, $x: Int, $x: String) { __typename } + query B($x: String, $x: Int) { __typename } + query C($x: Int, $x: Int) { __typename } + `).toDeepEqual([ + { + message: 'There can be only one variable named "$x".', + locations: [ + { line: 2, column: 16 }, + { line: 2, column: 25 }, + { line: 2, column: 34 }, + ], + }, + { + message: 'There can be only one variable named "$x".', + locations: [ + { line: 3, column: 16 }, + { line: 3, column: 28 }, + ], + }, + { + message: 'There can be only one variable named "$x".', + locations: [ + { line: 4, column: 16 }, + { line: 4, column: 25 }, + ], + }, + ]); + }); +}); diff --git a/src/validation/__tests__/ValidationContext-test.ts b/src/validation/__tests__/ValidationContext-test.ts new file mode 100644 index 00000000..159aa305 --- /dev/null +++ b/src/validation/__tests__/ValidationContext-test.ts @@ -0,0 +1,40 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { identityFunc } from '../../jsutils/identityFunc'; + +import { parse } from '../../language/parser'; + +import { GraphQLSchema } from '../../type/schema'; + +import { TypeInfo } from '../../utilities/TypeInfo'; + +import { + ASTValidationContext, + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; + +describe('ValidationContext', () => { + it('can be Object.toStringified', () => { + const schema = new GraphQLSchema({}); + const typeInfo = new TypeInfo(schema); + const ast = parse('{ foo }'); + const onError = identityFunc; + + const astContext = new ASTValidationContext(ast, onError); + expect(Object.prototype.toString.call(astContext)).to.equal( + '[object ASTValidationContext]', + ); + + const sdlContext = new SDLValidationContext(ast, schema, onError); + expect(Object.prototype.toString.call(sdlContext)).to.equal( + '[object SDLValidationContext]', + ); + + const context = new ValidationContext(schema, ast, typeInfo, onError); + expect(Object.prototype.toString.call(context)).to.equal( + '[object ValidationContext]', + ); + }); +}); diff --git a/src/validation/__tests__/ValuesOfCorrectTypeRule-test.ts b/src/validation/__tests__/ValuesOfCorrectTypeRule-test.ts new file mode 100644 index 00000000..76b03035 --- /dev/null +++ b/src/validation/__tests__/ValuesOfCorrectTypeRule-test.ts @@ -0,0 +1,1201 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../../__testUtils__/expectJSON'; + +import { inspect } from '../../jsutils/inspect'; + +import { parse } from '../../language/parser'; + +import { GraphQLObjectType, GraphQLScalarType } from '../../type/definition'; +import { GraphQLString } from '../../type/scalars'; +import { GraphQLSchema } from '../../type/schema'; + +import { ValuesOfCorrectTypeRule } from '../rules/ValuesOfCorrectTypeRule'; +import { validate } from '../validate'; + +import { + expectValidationErrors, + expectValidationErrorsWithSchema, +} from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(ValuesOfCorrectTypeRule, queryStr); +} + +function expectErrorsWithSchema(schema: GraphQLSchema, queryStr: string) { + return expectValidationErrorsWithSchema( + schema, + ValuesOfCorrectTypeRule, + queryStr, + ); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +function expectValidWithSchema(schema: GraphQLSchema, queryStr: string) { + expectErrorsWithSchema(schema, queryStr).toDeepEqual([]); +} + +describe('Validate: Values of correct type', () => { + describe('Valid values', () => { + it('Good int value', () => { + expectValid(` + { + complicatedArgs { + intArgField(intArg: 2) + } + } + `); + }); + + it('Good negative int value', () => { + expectValid(` + { + complicatedArgs { + intArgField(intArg: -2) + } + } + `); + }); + + it('Good boolean value', () => { + expectValid(` + { + complicatedArgs { + booleanArgField(booleanArg: true) + } + } + `); + }); + + it('Good string value', () => { + expectValid(` + { + complicatedArgs { + stringArgField(stringArg: "foo") + } + } + `); + }); + + it('Good float value', () => { + expectValid(` + { + complicatedArgs { + floatArgField(floatArg: 1.1) + } + } + `); + }); + + it('Good negative float value', () => { + expectValid(` + { + complicatedArgs { + floatArgField(floatArg: -1.1) + } + } + `); + }); + + it('Int into Float', () => { + expectValid(` + { + complicatedArgs { + floatArgField(floatArg: 1) + } + } + `); + }); + + it('Int into ID', () => { + expectValid(` + { + complicatedArgs { + idArgField(idArg: 1) + } + } + `); + }); + + it('String into ID', () => { + expectValid(` + { + complicatedArgs { + idArgField(idArg: "someIdString") + } + } + `); + }); + + it('Good enum value', () => { + expectValid(` + { + dog { + doesKnowCommand(dogCommand: SIT) + } + } + `); + }); + + it('Enum with undefined value', () => { + expectValid(` + { + complicatedArgs { + enumArgField(enumArg: UNKNOWN) + } + } + `); + }); + + it('Enum with null value', () => { + expectValid(` + { + complicatedArgs { + enumArgField(enumArg: NO_FUR) + } + } + `); + }); + + it('null into nullable type', () => { + expectValid(` + { + complicatedArgs { + intArgField(intArg: null) + } + } + `); + + expectValid(` + { + dog(a: null, b: null, c:{ requiredField: true, intField: null }) { + name + } + } + `); + }); + }); + + describe('Invalid String values', () => { + it('Int into String', () => { + expectErrors(` + { + complicatedArgs { + stringArgField(stringArg: 1) + } + } + `).toDeepEqual([ + { + message: 'String cannot represent a non string value: 1', + locations: [{ line: 4, column: 39 }], + }, + ]); + }); + + it('Float into String', () => { + expectErrors(` + { + complicatedArgs { + stringArgField(stringArg: 1.0) + } + } + `).toDeepEqual([ + { + message: 'String cannot represent a non string value: 1.0', + locations: [{ line: 4, column: 39 }], + }, + ]); + }); + + it('Boolean into String', () => { + expectErrors(` + { + complicatedArgs { + stringArgField(stringArg: true) + } + } + `).toDeepEqual([ + { + message: 'String cannot represent a non string value: true', + locations: [{ line: 4, column: 39 }], + }, + ]); + }); + + it('Unquoted String into String', () => { + expectErrors(` + { + complicatedArgs { + stringArgField(stringArg: BAR) + } + } + `).toDeepEqual([ + { + message: 'String cannot represent a non string value: BAR', + locations: [{ line: 4, column: 39 }], + }, + ]); + }); + }); + + describe('Invalid Int values', () => { + it('String into Int', () => { + expectErrors(` + { + complicatedArgs { + intArgField(intArg: "3") + } + } + `).toDeepEqual([ + { + message: 'Int cannot represent non-integer value: "3"', + locations: [{ line: 4, column: 33 }], + }, + ]); + }); + + it('Big Int into Int', () => { + expectErrors(` + { + complicatedArgs { + intArgField(intArg: 829384293849283498239482938) + } + } + `).toDeepEqual([ + { + message: + 'Int cannot represent non 32-bit signed integer value: 829384293849283498239482938', + locations: [{ line: 4, column: 33 }], + }, + ]); + }); + + it('Unquoted String into Int', () => { + expectErrors(` + { + complicatedArgs { + intArgField(intArg: FOO) + } + } + `).toDeepEqual([ + { + message: 'Int cannot represent non-integer value: FOO', + locations: [{ line: 4, column: 33 }], + }, + ]); + }); + + it('Simple Float into Int', () => { + expectErrors(` + { + complicatedArgs { + intArgField(intArg: 3.0) + } + } + `).toDeepEqual([ + { + message: 'Int cannot represent non-integer value: 3.0', + locations: [{ line: 4, column: 33 }], + }, + ]); + }); + + it('Float into Int', () => { + expectErrors(` + { + complicatedArgs { + intArgField(intArg: 3.333) + } + } + `).toDeepEqual([ + { + message: 'Int cannot represent non-integer value: 3.333', + locations: [{ line: 4, column: 33 }], + }, + ]); + }); + }); + + describe('Invalid Float values', () => { + it('String into Float', () => { + expectErrors(` + { + complicatedArgs { + floatArgField(floatArg: "3.333") + } + } + `).toDeepEqual([ + { + message: 'Float cannot represent non numeric value: "3.333"', + locations: [{ line: 4, column: 37 }], + }, + ]); + }); + + it('Boolean into Float', () => { + expectErrors(` + { + complicatedArgs { + floatArgField(floatArg: true) + } + } + `).toDeepEqual([ + { + message: 'Float cannot represent non numeric value: true', + locations: [{ line: 4, column: 37 }], + }, + ]); + }); + + it('Unquoted into Float', () => { + expectErrors(` + { + complicatedArgs { + floatArgField(floatArg: FOO) + } + } + `).toDeepEqual([ + { + message: 'Float cannot represent non numeric value: FOO', + locations: [{ line: 4, column: 37 }], + }, + ]); + }); + }); + + describe('Invalid Boolean value', () => { + it('Int into Boolean', () => { + expectErrors(` + { + complicatedArgs { + booleanArgField(booleanArg: 2) + } + } + `).toDeepEqual([ + { + message: 'Boolean cannot represent a non boolean value: 2', + locations: [{ line: 4, column: 41 }], + }, + ]); + }); + + it('Float into Boolean', () => { + expectErrors(` + { + complicatedArgs { + booleanArgField(booleanArg: 1.0) + } + } + `).toDeepEqual([ + { + message: 'Boolean cannot represent a non boolean value: 1.0', + locations: [{ line: 4, column: 41 }], + }, + ]); + }); + + it('String into Boolean', () => { + expectErrors(` + { + complicatedArgs { + booleanArgField(booleanArg: "true") + } + } + `).toDeepEqual([ + { + message: 'Boolean cannot represent a non boolean value: "true"', + locations: [{ line: 4, column: 41 }], + }, + ]); + }); + + it('Unquoted into Boolean', () => { + expectErrors(` + { + complicatedArgs { + booleanArgField(booleanArg: TRUE) + } + } + `).toDeepEqual([ + { + message: 'Boolean cannot represent a non boolean value: TRUE', + locations: [{ line: 4, column: 41 }], + }, + ]); + }); + }); + + describe('Invalid ID value', () => { + it('Float into ID', () => { + expectErrors(` + { + complicatedArgs { + idArgField(idArg: 1.0) + } + } + `).toDeepEqual([ + { + message: + 'ID cannot represent a non-string and non-integer value: 1.0', + locations: [{ line: 4, column: 31 }], + }, + ]); + }); + + it('Boolean into ID', () => { + expectErrors(` + { + complicatedArgs { + idArgField(idArg: true) + } + } + `).toDeepEqual([ + { + message: + 'ID cannot represent a non-string and non-integer value: true', + locations: [{ line: 4, column: 31 }], + }, + ]); + }); + + it('Unquoted into ID', () => { + expectErrors(` + { + complicatedArgs { + idArgField(idArg: SOMETHING) + } + } + `).toDeepEqual([ + { + message: + 'ID cannot represent a non-string and non-integer value: SOMETHING', + locations: [{ line: 4, column: 31 }], + }, + ]); + }); + }); + + describe('Invalid Enum value', () => { + it('Int into Enum', () => { + expectErrors(` + { + dog { + doesKnowCommand(dogCommand: 2) + } + } + `).toDeepEqual([ + { + message: 'Enum "DogCommand" cannot represent non-enum value: 2.', + locations: [{ line: 4, column: 41 }], + }, + ]); + }); + + it('Float into Enum', () => { + expectErrors(` + { + dog { + doesKnowCommand(dogCommand: 1.0) + } + } + `).toDeepEqual([ + { + message: 'Enum "DogCommand" cannot represent non-enum value: 1.0.', + locations: [{ line: 4, column: 41 }], + }, + ]); + }); + + it('String into Enum', () => { + expectErrors(` + { + dog { + doesKnowCommand(dogCommand: "SIT") + } + } + `).toDeepEqual([ + { + message: + 'Enum "DogCommand" cannot represent non-enum value: "SIT". Did you mean the enum value "SIT"?', + locations: [{ line: 4, column: 41 }], + }, + ]); + }); + + it('Boolean into Enum', () => { + expectErrors(` + { + dog { + doesKnowCommand(dogCommand: true) + } + } + `).toDeepEqual([ + { + message: 'Enum "DogCommand" cannot represent non-enum value: true.', + locations: [{ line: 4, column: 41 }], + }, + ]); + }); + + it('Unknown Enum Value into Enum', () => { + expectErrors(` + { + dog { + doesKnowCommand(dogCommand: JUGGLE) + } + } + `).toDeepEqual([ + { + message: 'Value "JUGGLE" does not exist in "DogCommand" enum.', + locations: [{ line: 4, column: 41 }], + }, + ]); + }); + + it('Different case Enum Value into Enum', () => { + expectErrors(` + { + dog { + doesKnowCommand(dogCommand: sit) + } + } + `).toDeepEqual([ + { + message: + 'Value "sit" does not exist in "DogCommand" enum. Did you mean the enum value "SIT"?', + locations: [{ line: 4, column: 41 }], + }, + ]); + }); + }); + + describe('Valid List value', () => { + it('Good list value', () => { + expectValid(` + { + complicatedArgs { + stringListArgField(stringListArg: ["one", null, "two"]) + } + } + `); + }); + + it('Empty list value', () => { + expectValid(` + { + complicatedArgs { + stringListArgField(stringListArg: []) + } + } + `); + }); + + it('Null value', () => { + expectValid(` + { + complicatedArgs { + stringListArgField(stringListArg: null) + } + } + `); + }); + + it('Single value into List', () => { + expectValid(` + { + complicatedArgs { + stringListArgField(stringListArg: "one") + } + } + `); + }); + }); + + describe('Invalid List value', () => { + it('Incorrect item type', () => { + expectErrors(` + { + complicatedArgs { + stringListArgField(stringListArg: ["one", 2]) + } + } + `).toDeepEqual([ + { + message: 'String cannot represent a non string value: 2', + locations: [{ line: 4, column: 55 }], + }, + ]); + }); + + it('Single value of incorrect type', () => { + expectErrors(` + { + complicatedArgs { + stringListArgField(stringListArg: 1) + } + } + `).toDeepEqual([ + { + message: 'String cannot represent a non string value: 1', + locations: [{ line: 4, column: 47 }], + }, + ]); + }); + }); + + describe('Valid non-nullable value', () => { + it('Arg on optional arg', () => { + expectValid(` + { + dog { + isHouseTrained(atOtherHomes: true) + } + } + `); + }); + + it('No Arg on optional arg', () => { + expectValid(` + { + dog { + isHouseTrained + } + } + `); + }); + + it('Multiple args', () => { + expectValid(` + { + complicatedArgs { + multipleReqs(req1: 1, req2: 2) + } + } + `); + }); + + it('Multiple args reverse order', () => { + expectValid(` + { + complicatedArgs { + multipleReqs(req2: 2, req1: 1) + } + } + `); + }); + + it('No args on multiple optional', () => { + expectValid(` + { + complicatedArgs { + multipleOpts + } + } + `); + }); + + it('One arg on multiple optional', () => { + expectValid(` + { + complicatedArgs { + multipleOpts(opt1: 1) + } + } + `); + }); + + it('Second arg on multiple optional', () => { + expectValid(` + { + complicatedArgs { + multipleOpts(opt2: 1) + } + } + `); + }); + + it('Multiple required args on mixedList', () => { + expectValid(` + { + complicatedArgs { + multipleOptAndReq(req1: 3, req2: 4) + } + } + `); + }); + + it('Multiple required and one optional arg on mixedList', () => { + expectValid(` + { + complicatedArgs { + multipleOptAndReq(req1: 3, req2: 4, opt1: 5) + } + } + `); + }); + + it('All required and optional args on mixedList', () => { + expectValid(` + { + complicatedArgs { + multipleOptAndReq(req1: 3, req2: 4, opt1: 5, opt2: 6) + } + } + `); + }); + }); + + describe('Invalid non-nullable value', () => { + it('Incorrect value type', () => { + expectErrors(` + { + complicatedArgs { + multipleReqs(req2: "two", req1: "one") + } + } + `).toDeepEqual([ + { + message: 'Int cannot represent non-integer value: "two"', + locations: [{ line: 4, column: 32 }], + }, + { + message: 'Int cannot represent non-integer value: "one"', + locations: [{ line: 4, column: 45 }], + }, + ]); + }); + + it('Incorrect value and missing argument (ProvidedRequiredArgumentsRule)', () => { + expectErrors(` + { + complicatedArgs { + multipleReqs(req1: "one") + } + } + `).toDeepEqual([ + { + message: 'Int cannot represent non-integer value: "one"', + locations: [{ line: 4, column: 32 }], + }, + ]); + }); + + it('Null value', () => { + expectErrors(` + { + complicatedArgs { + multipleReqs(req1: null) + } + } + `).toDeepEqual([ + { + message: 'Expected value of type "Int!", found null.', + locations: [{ line: 4, column: 32 }], + }, + ]); + }); + }); + + describe('Valid input object value', () => { + it('Optional arg, despite required field in type', () => { + expectValid(` + { + complicatedArgs { + complexArgField + } + } + `); + }); + + it('Partial object, only required', () => { + expectValid(` + { + complicatedArgs { + complexArgField(complexArg: { requiredField: true }) + } + } + `); + }); + + it('Partial object, required field can be falsy', () => { + expectValid(` + { + complicatedArgs { + complexArgField(complexArg: { requiredField: false }) + } + } + `); + }); + + it('Partial object, including required', () => { + expectValid(` + { + complicatedArgs { + complexArgField(complexArg: { requiredField: true, intField: 4 }) + } + } + `); + }); + + it('Full object', () => { + expectValid(` + { + complicatedArgs { + complexArgField(complexArg: { + requiredField: true, + intField: 4, + stringField: "foo", + booleanField: false, + stringListField: ["one", "two"] + }) + } + } + `); + }); + + it('Full object with fields in different order', () => { + expectValid(` + { + complicatedArgs { + complexArgField(complexArg: { + stringListField: ["one", "two"], + booleanField: false, + requiredField: true, + stringField: "foo", + intField: 4, + }) + } + } + `); + }); + }); + + describe('Invalid input object value', () => { + it('Partial object, missing required', () => { + expectErrors(` + { + complicatedArgs { + complexArgField(complexArg: { intField: 4 }) + } + } + `).toDeepEqual([ + { + message: + 'Field "ComplexInput.requiredField" of required type "Boolean!" was not provided.', + locations: [{ line: 4, column: 41 }], + }, + ]); + }); + + it('Partial object, invalid field type', () => { + expectErrors(` + { + complicatedArgs { + complexArgField(complexArg: { + stringListField: ["one", 2], + requiredField: true, + }) + } + } + `).toDeepEqual([ + { + message: 'String cannot represent a non string value: 2', + locations: [{ line: 5, column: 40 }], + }, + ]); + }); + + it('Partial object, null to non-null field', () => { + expectErrors(` + { + complicatedArgs { + complexArgField(complexArg: { + requiredField: true, + nonNullField: null, + }) + } + } + `).toDeepEqual([ + { + message: 'Expected value of type "Boolean!", found null.', + locations: [{ line: 6, column: 29 }], + }, + ]); + }); + + it('Partial object, unknown field arg', () => { + expectErrors(` + { + complicatedArgs { + complexArgField(complexArg: { + requiredField: true, + invalidField: "value" + }) + } + } + `).toDeepEqual([ + { + message: + 'Field "invalidField" is not defined by type "ComplexInput". Did you mean "intField"?', + locations: [{ line: 6, column: 15 }], + }, + ]); + }); + + it('reports original error for custom scalar which throws', () => { + const customScalar = new GraphQLScalarType({ + name: 'Invalid', + parseValue(value) { + throw new Error( + `Invalid scalar is always invalid: ${inspect(value)}`, + ); + }, + }); + + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + invalidArg: { + type: GraphQLString, + args: { arg: { type: customScalar } }, + }, + }, + }), + }); + + const doc = parse('{ invalidArg(arg: 123) }'); + const errors = validate(schema, doc, [ValuesOfCorrectTypeRule]); + + expectJSON(errors).toDeepEqual([ + { + message: + 'Expected value of type "Invalid", found 123; Invalid scalar is always invalid: 123', + locations: [{ line: 1, column: 19 }], + }, + ]); + + expect(errors[0]).to.have.nested.property( + 'originalError.message', + 'Invalid scalar is always invalid: 123', + ); + }); + + it('reports error for custom scalar that returns undefined', () => { + const customScalar = new GraphQLScalarType({ + name: 'CustomScalar', + parseValue() { + return undefined; + }, + }); + + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + invalidArg: { + type: GraphQLString, + args: { arg: { type: customScalar } }, + }, + }, + }), + }); + + expectErrorsWithSchema(schema, '{ invalidArg(arg: 123) }').toDeepEqual([ + { + message: 'Expected value of type "CustomScalar", found 123.', + locations: [{ line: 1, column: 19 }], + }, + ]); + }); + + it('allows custom scalar to accept complex literals', () => { + const customScalar = new GraphQLScalarType({ name: 'Any' }); + const schema = new GraphQLSchema({ + query: new GraphQLObjectType({ + name: 'Query', + fields: { + anyArg: { + type: GraphQLString, + args: { arg: { type: customScalar } }, + }, + }, + }), + }); + + expectValidWithSchema( + schema, + ` + { + test1: anyArg(arg: 123) + test2: anyArg(arg: "abc") + test3: anyArg(arg: [123, "abc"]) + test4: anyArg(arg: {deep: [123, "abc"]}) + } + `, + ); + }); + }); + + describe('Directive arguments', () => { + it('with directives of valid types', () => { + expectValid(` + { + dog @include(if: true) { + name + } + human @skip(if: false) { + name + } + } + `); + }); + + it('with directive with incorrect types', () => { + expectErrors(` + { + dog @include(if: "yes") { + name @skip(if: ENUM) + } + } + `).toDeepEqual([ + { + message: 'Boolean cannot represent a non boolean value: "yes"', + locations: [{ line: 3, column: 28 }], + }, + { + message: 'Boolean cannot represent a non boolean value: ENUM', + locations: [{ line: 4, column: 28 }], + }, + ]); + }); + }); + + describe('Variable default values', () => { + it('variables with valid default values', () => { + expectValid(` + query WithDefaultValues( + $a: Int = 1, + $b: String = "ok", + $c: ComplexInput = { requiredField: true, intField: 3 } + $d: Int! = 123 + ) { + dog { name } + } + `); + }); + + it('variables with valid default null values', () => { + expectValid(` + query WithDefaultValues( + $a: Int = null, + $b: String = null, + $c: ComplexInput = { requiredField: true, intField: null } + ) { + dog { name } + } + `); + }); + + it('variables with invalid default null values', () => { + expectErrors(` + query WithDefaultValues( + $a: Int! = null, + $b: String! = null, + $c: ComplexInput = { requiredField: null, intField: null } + ) { + dog { name } + } + `).toDeepEqual([ + { + message: 'Expected value of type "Int!", found null.', + locations: [{ line: 3, column: 22 }], + }, + { + message: 'Expected value of type "String!", found null.', + locations: [{ line: 4, column: 25 }], + }, + { + message: 'Expected value of type "Boolean!", found null.', + locations: [{ line: 5, column: 47 }], + }, + ]); + }); + + it('variables with invalid default values', () => { + expectErrors(` + query InvalidDefaultValues( + $a: Int = "one", + $b: String = 4, + $c: ComplexInput = "NotVeryComplex" + ) { + dog { name } + } + `).toDeepEqual([ + { + message: 'Int cannot represent non-integer value: "one"', + locations: [{ line: 3, column: 21 }], + }, + { + message: 'String cannot represent a non string value: 4', + locations: [{ line: 4, column: 24 }], + }, + { + message: + 'Expected value of type "ComplexInput", found "NotVeryComplex".', + locations: [{ line: 5, column: 30 }], + }, + ]); + }); + + it('variables with complex invalid default values', () => { + expectErrors(` + query WithDefaultValues( + $a: ComplexInput = { requiredField: 123, intField: "abc" } + ) { + dog { name } + } + `).toDeepEqual([ + { + message: 'Boolean cannot represent a non boolean value: 123', + locations: [{ line: 3, column: 47 }], + }, + { + message: 'Int cannot represent non-integer value: "abc"', + locations: [{ line: 3, column: 62 }], + }, + ]); + }); + + it('complex variables missing required field', () => { + expectErrors(` + query MissingRequiredField($a: ComplexInput = {intField: 3}) { + dog { name } + } + `).toDeepEqual([ + { + message: + 'Field "ComplexInput.requiredField" of required type "Boolean!" was not provided.', + locations: [{ line: 2, column: 55 }], + }, + ]); + }); + + it('list variables with invalid item', () => { + expectErrors(` + query InvalidItem($a: [String] = ["one", 2]) { + dog { name } + } + `).toDeepEqual([ + { + message: 'String cannot represent a non string value: 2', + locations: [{ line: 2, column: 50 }], + }, + ]); + }); + }); +}); diff --git a/src/validation/__tests__/VariablesAreInputTypesRule-test.ts b/src/validation/__tests__/VariablesAreInputTypesRule-test.ts new file mode 100644 index 00000000..7b754fd7 --- /dev/null +++ b/src/validation/__tests__/VariablesAreInputTypesRule-test.ts @@ -0,0 +1,52 @@ +import { describe, it } from 'mocha'; + +import { VariablesAreInputTypesRule } from '../rules/VariablesAreInputTypesRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(VariablesAreInputTypesRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: Variables are input types', () => { + it('unknown types are ignored', () => { + expectValid(` + query Foo($a: Unknown, $b: [[Unknown!]]!) { + field(a: $a, b: $b) + } + `); + }); + + it('input types are valid', () => { + expectValid(` + query Foo($a: String, $b: [Boolean!]!, $c: ComplexInput) { + field(a: $a, b: $b, c: $c) + } + `); + }); + + it('output types are invalid', () => { + expectErrors(` + query Foo($a: Dog, $b: [[CatOrDog!]]!, $c: Pet) { + field(a: $a, b: $b, c: $c) + } + `).toDeepEqual([ + { + locations: [{ line: 2, column: 21 }], + message: 'Variable "$a" cannot be non-input type "Dog".', + }, + { + locations: [{ line: 2, column: 30 }], + message: 'Variable "$b" cannot be non-input type "[[CatOrDog!]]!".', + }, + { + locations: [{ line: 2, column: 50 }], + message: 'Variable "$c" cannot be non-input type "Pet".', + }, + ]); + }); +}); diff --git a/src/validation/__tests__/VariablesInAllowedPositionRule-test.ts b/src/validation/__tests__/VariablesInAllowedPositionRule-test.ts new file mode 100644 index 00000000..090f1680 --- /dev/null +++ b/src/validation/__tests__/VariablesInAllowedPositionRule-test.ts @@ -0,0 +1,360 @@ +import { describe, it } from 'mocha'; + +import { VariablesInAllowedPositionRule } from '../rules/VariablesInAllowedPositionRule'; + +import { expectValidationErrors } from './harness'; + +function expectErrors(queryStr: string) { + return expectValidationErrors(VariablesInAllowedPositionRule, queryStr); +} + +function expectValid(queryStr: string) { + expectErrors(queryStr).toDeepEqual([]); +} + +describe('Validate: Variables are in allowed positions', () => { + it('Boolean => Boolean', () => { + expectValid(` + query Query($booleanArg: Boolean) + { + complicatedArgs { + booleanArgField(booleanArg: $booleanArg) + } + } + `); + }); + + it('Boolean => Boolean within fragment', () => { + expectValid(` + fragment booleanArgFrag on ComplicatedArgs { + booleanArgField(booleanArg: $booleanArg) + } + query Query($booleanArg: Boolean) + { + complicatedArgs { + ...booleanArgFrag + } + } + `); + + expectValid(` + query Query($booleanArg: Boolean) + { + complicatedArgs { + ...booleanArgFrag + } + } + fragment booleanArgFrag on ComplicatedArgs { + booleanArgField(booleanArg: $booleanArg) + } + `); + }); + + it('Boolean! => Boolean', () => { + expectValid(` + query Query($nonNullBooleanArg: Boolean!) + { + complicatedArgs { + booleanArgField(booleanArg: $nonNullBooleanArg) + } + } + `); + }); + + it('Boolean! => Boolean within fragment', () => { + expectValid(` + fragment booleanArgFrag on ComplicatedArgs { + booleanArgField(booleanArg: $nonNullBooleanArg) + } + + query Query($nonNullBooleanArg: Boolean!) + { + complicatedArgs { + ...booleanArgFrag + } + } + `); + }); + + it('[String] => [String]', () => { + expectValid(` + query Query($stringListVar: [String]) + { + complicatedArgs { + stringListArgField(stringListArg: $stringListVar) + } + } + `); + }); + + it('[String!] => [String]', () => { + expectValid(` + query Query($stringListVar: [String!]) + { + complicatedArgs { + stringListArgField(stringListArg: $stringListVar) + } + } + `); + }); + + it('String => [String] in item position', () => { + expectValid(` + query Query($stringVar: String) + { + complicatedArgs { + stringListArgField(stringListArg: [$stringVar]) + } + } + `); + }); + + it('String! => [String] in item position', () => { + expectValid(` + query Query($stringVar: String!) + { + complicatedArgs { + stringListArgField(stringListArg: [$stringVar]) + } + } + `); + }); + + it('ComplexInput => ComplexInput', () => { + expectValid(` + query Query($complexVar: ComplexInput) + { + complicatedArgs { + complexArgField(complexArg: $complexVar) + } + } + `); + }); + + it('ComplexInput => ComplexInput in field position', () => { + expectValid(` + query Query($boolVar: Boolean = false) + { + complicatedArgs { + complexArgField(complexArg: {requiredArg: $boolVar}) + } + } + `); + }); + + it('Boolean! => Boolean! in directive', () => { + expectValid(` + query Query($boolVar: Boolean!) + { + dog @include(if: $boolVar) + } + `); + }); + + it('Int => Int!', () => { + expectErrors(` + query Query($intArg: Int) { + complicatedArgs { + nonNullIntArgField(nonNullIntArg: $intArg) + } + } + `).toDeepEqual([ + { + message: + 'Variable "$intArg" of type "Int" used in position expecting type "Int!".', + locations: [ + { line: 2, column: 19 }, + { line: 4, column: 45 }, + ], + }, + ]); + }); + + it('Int => Int! within fragment', () => { + expectErrors(` + fragment nonNullIntArgFieldFrag on ComplicatedArgs { + nonNullIntArgField(nonNullIntArg: $intArg) + } + + query Query($intArg: Int) { + complicatedArgs { + ...nonNullIntArgFieldFrag + } + } + `).toDeepEqual([ + { + message: + 'Variable "$intArg" of type "Int" used in position expecting type "Int!".', + locations: [ + { line: 6, column: 19 }, + { line: 3, column: 43 }, + ], + }, + ]); + }); + + it('Int => Int! within nested fragment', () => { + expectErrors(` + fragment outerFrag on ComplicatedArgs { + ...nonNullIntArgFieldFrag + } + + fragment nonNullIntArgFieldFrag on ComplicatedArgs { + nonNullIntArgField(nonNullIntArg: $intArg) + } + + query Query($intArg: Int) { + complicatedArgs { + ...outerFrag + } + } + `).toDeepEqual([ + { + message: + 'Variable "$intArg" of type "Int" used in position expecting type "Int!".', + locations: [ + { line: 10, column: 19 }, + { line: 7, column: 43 }, + ], + }, + ]); + }); + + it('String over Boolean', () => { + expectErrors(` + query Query($stringVar: String) { + complicatedArgs { + booleanArgField(booleanArg: $stringVar) + } + } + `).toDeepEqual([ + { + message: + 'Variable "$stringVar" of type "String" used in position expecting type "Boolean".', + locations: [ + { line: 2, column: 19 }, + { line: 4, column: 39 }, + ], + }, + ]); + }); + + it('String => [String]', () => { + expectErrors(` + query Query($stringVar: String) { + complicatedArgs { + stringListArgField(stringListArg: $stringVar) + } + } + `).toDeepEqual([ + { + message: + 'Variable "$stringVar" of type "String" used in position expecting type "[String]".', + locations: [ + { line: 2, column: 19 }, + { line: 4, column: 45 }, + ], + }, + ]); + }); + + it('Boolean => Boolean! in directive', () => { + expectErrors(` + query Query($boolVar: Boolean) { + dog @include(if: $boolVar) + } + `).toDeepEqual([ + { + message: + 'Variable "$boolVar" of type "Boolean" used in position expecting type "Boolean!".', + locations: [ + { line: 2, column: 19 }, + { line: 3, column: 26 }, + ], + }, + ]); + }); + + it('String => Boolean! in directive', () => { + expectErrors(` + query Query($stringVar: String) { + dog @include(if: $stringVar) + } + `).toDeepEqual([ + { + message: + 'Variable "$stringVar" of type "String" used in position expecting type "Boolean!".', + locations: [ + { line: 2, column: 19 }, + { line: 3, column: 26 }, + ], + }, + ]); + }); + + it('[String] => [String!]', () => { + expectErrors(` + query Query($stringListVar: [String]) + { + complicatedArgs { + stringListNonNullArgField(stringListNonNullArg: $stringListVar) + } + } + `).toDeepEqual([ + { + message: + 'Variable "$stringListVar" of type "[String]" used in position expecting type "[String!]".', + locations: [ + { line: 2, column: 19 }, + { line: 5, column: 59 }, + ], + }, + ]); + }); + + describe('Allows optional (nullable) variables with default values', () => { + it('Int => Int! fails when variable provides null default value', () => { + expectErrors(` + query Query($intVar: Int = null) { + complicatedArgs { + nonNullIntArgField(nonNullIntArg: $intVar) + } + } + `).toDeepEqual([ + { + message: + 'Variable "$intVar" of type "Int" used in position expecting type "Int!".', + locations: [ + { line: 2, column: 21 }, + { line: 4, column: 47 }, + ], + }, + ]); + }); + + it('Int => Int! when variable provides non-null default value', () => { + expectValid(` + query Query($intVar: Int = 1) { + complicatedArgs { + nonNullIntArgField(nonNullIntArg: $intVar) + } + }`); + }); + + it('Int => Int! when optional argument provides default value', () => { + expectValid(` + query Query($intVar: Int) { + complicatedArgs { + nonNullFieldWithDefault(nonNullIntArg: $intVar) + } + }`); + }); + + it('Boolean => Boolean! in directive with default value with option', () => { + expectValid(` + query Query($boolVar: Boolean = false) { + dog @include(if: $boolVar) + }`); + }); + }); +}); diff --git a/src/validation/__tests__/harness.ts b/src/validation/__tests__/harness.ts new file mode 100644 index 00000000..661256c5 --- /dev/null +++ b/src/validation/__tests__/harness.ts @@ -0,0 +1,143 @@ +import { expectJSON } from '../../__testUtils__/expectJSON'; + +import type { Maybe } from '../../jsutils/Maybe'; + +import { parse } from '../../language/parser'; + +import type { GraphQLSchema } from '../../type/schema'; + +import { buildSchema } from '../../utilities/buildASTSchema'; + +import { validate, validateSDL } from '../validate'; +import type { SDLValidationRule, ValidationRule } from '../ValidationContext'; + +export const testSchema: GraphQLSchema = buildSchema(` + interface Mammal { + mother: Mammal + father: Mammal + } + + interface Pet { + name(surname: Boolean): String + } + + interface Canine implements Mammal { + name(surname: Boolean): String + mother: Canine + father: Canine + } + + enum DogCommand { + SIT + HEEL + DOWN + } + + type Dog implements Pet & Mammal & Canine { + name(surname: Boolean): String + nickname: String + barkVolume: Int + barks: Boolean + doesKnowCommand(dogCommand: DogCommand): Boolean + isHouseTrained(atOtherHomes: Boolean = true): Boolean + isAtLocation(x: Int, y: Int): Boolean + mother: Dog + father: Dog + } + + type Cat implements Pet { + name(surname: Boolean): String + nickname: String + meows: Boolean + meowsVolume: Int + furColor: FurColor + } + + union CatOrDog = Cat | Dog + + type Human { + name(surname: Boolean): String + pets: [Pet] + relatives: [Human] + } + + enum FurColor { + BROWN + BLACK + TAN + SPOTTED + NO_FUR + UNKNOWN + } + + input ComplexInput { + requiredField: Boolean! + nonNullField: Boolean! = false + intField: Int + stringField: String + booleanField: Boolean + stringListField: [String] + } + + type ComplicatedArgs { + # TODO List + # TODO Coercion + # TODO NotNulls + intArgField(intArg: Int): String + nonNullIntArgField(nonNullIntArg: Int!): String + stringArgField(stringArg: String): String + booleanArgField(booleanArg: Boolean): String + enumArgField(enumArg: FurColor): String + floatArgField(floatArg: Float): String + idArgField(idArg: ID): String + stringListArgField(stringListArg: [String]): String + stringListNonNullArgField(stringListNonNullArg: [String!]): String + complexArgField(complexArg: ComplexInput): String + multipleReqs(req1: Int!, req2: Int!): String + nonNullFieldWithDefault(arg: Int! = 0): String + multipleOpts(opt1: Int = 0, opt2: Int = 0): String + multipleOptAndReq(req1: Int!, req2: Int!, opt1: Int = 0, opt2: Int = 0): String + } + + type QueryRoot { + human(id: ID): Human + dog: Dog + cat: Cat + pet: Pet + catOrDog: CatOrDog + complicatedArgs: ComplicatedArgs + } + + schema { + query: QueryRoot + } + + directive @onField on FIELD +`); + +export function expectValidationErrorsWithSchema( + schema: GraphQLSchema, + rule: ValidationRule, + queryStr: string, +): any { + const doc = parse(queryStr); + const errors = validate(schema, doc, [rule]); + return expectJSON(errors); +} + +export function expectValidationErrors( + rule: ValidationRule, + queryStr: string, +): any { + return expectValidationErrorsWithSchema(testSchema, rule, queryStr); +} + +export function expectSDLValidationErrors( + schema: Maybe, + rule: SDLValidationRule, + sdlStr: string, +): any { + const doc = parse(sdlStr); + const errors = validateSDL(doc, schema, [rule]); + return expectJSON(errors); +} diff --git a/src/validation/__tests__/validation-test.ts b/src/validation/__tests__/validation-test.ts new file mode 100644 index 00000000..e5b13183 --- /dev/null +++ b/src/validation/__tests__/validation-test.ts @@ -0,0 +1,181 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import { expectJSON } from '../../__testUtils__/expectJSON'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { DirectiveNode } from '../../language/ast'; +import { parse } from '../../language/parser'; + +import { buildSchema } from '../../utilities/buildASTSchema'; +import { TypeInfo } from '../../utilities/TypeInfo'; + +import { validate } from '../validate'; +import type { ValidationContext } from '../ValidationContext'; + +import { testSchema } from './harness'; + +describe('Validate: Supports full validation', () => { + it('rejects invalid documents', () => { + // @ts-expect-error (expects a DocumentNode as a second parameter) + expect(() => validate(testSchema, null)).to.throw('Must provide document.'); + }); + + it('validates queries', () => { + const doc = parse(` + query { + human { + pets { + ... on Cat { + meowsVolume + } + ... on Dog { + barkVolume + } + } + } + } + `); + + const errors = validate(testSchema, doc); + expectJSON(errors).toDeepEqual([]); + }); + + it('detects unknown fields', () => { + const doc = parse(` + { + unknown + } + `); + + const errors = validate(testSchema, doc); + expectJSON(errors).toDeepEqual([ + { + locations: [{ line: 3, column: 9 }], + message: 'Cannot query field "unknown" on type "QueryRoot".', + }, + ]); + }); + + it('Deprecated: validates using a custom TypeInfo', () => { + // This TypeInfo will never return a valid field. + const typeInfo = new TypeInfo(testSchema, null, () => null); + + const doc = parse(` + query { + human { + pets { + ... on Cat { + meowsVolume + } + ... on Dog { + barkVolume + } + } + } + } + `); + + const errors = validate(testSchema, doc, undefined, undefined, typeInfo); + const errorMessages = errors.map((error) => error.message); + + expect(errorMessages).to.deep.equal([ + 'Cannot query field "human" on type "QueryRoot". Did you mean "human"?', + 'Cannot query field "meowsVolume" on type "Cat". Did you mean "meowsVolume"?', + 'Cannot query field "barkVolume" on type "Dog". Did you mean "barkVolume"?', + ]); + }); + + it('validates using a custom rule', () => { + const schema = buildSchema(` + directive @custom(arg: String) on FIELD + + type Query { + foo: String + } + `); + + const doc = parse(` + query { + name @custom + } + `); + + function customRule(context: ValidationContext) { + return { + Directive(node: DirectiveNode) { + const directiveDef = context.getDirective(); + const error = new GraphQLError( + 'Reporting directive: ' + String(directiveDef), + node, + ); + context.reportError(error); + }, + }; + } + + const errors = validate(schema, doc, [customRule]); + expectJSON(errors).toDeepEqual([ + { + message: 'Reporting directive: @custom', + locations: [{ line: 3, column: 14 }], + }, + ]); + }); +}); + +describe('Validate: Limit maximum number of validation errors', () => { + const query = ` + { + firstUnknownField + secondUnknownField + thirdUnknownField + } + `; + const doc = parse(query, { noLocation: true }); + + function validateDocument(options: { maxErrors?: number }) { + return validate(testSchema, doc, undefined, options); + } + + function invalidFieldError(fieldName: string) { + return { + message: `Cannot query field "${fieldName}" on type "QueryRoot".`, + }; + } + + it('when maxErrors is equal to number of errors', () => { + const errors = validateDocument({ maxErrors: 3 }); + expectJSON(errors).toDeepEqual([ + invalidFieldError('firstUnknownField'), + invalidFieldError('secondUnknownField'), + invalidFieldError('thirdUnknownField'), + ]); + }); + + it('when maxErrors is less than number of errors', () => { + const errors = validateDocument({ maxErrors: 2 }); + expectJSON(errors).toDeepEqual([ + invalidFieldError('firstUnknownField'), + invalidFieldError('secondUnknownField'), + { + message: + 'Too many validation errors, error limit reached. Validation aborted.', + }, + ]); + }); + + it('passthrough exceptions from rules', () => { + function customRule() { + return { + Field() { + throw new Error('Error from custom rule!'); + }, + }; + } + expect(() => + validate(testSchema, doc, [customRule], { maxErrors: 1 }), + ).to.throw(/^Error from custom rule!$/); + }); +}); diff --git a/src/validation/index.ts b/src/validation/index.ts new file mode 100644 index 00000000..58cc012e --- /dev/null +++ b/src/validation/index.ts @@ -0,0 +1,99 @@ +export { validate } from './validate'; + +export { ValidationContext } from './ValidationContext'; +export type { ValidationRule } from './ValidationContext'; + +// All validation rules in the GraphQL Specification. +export { specifiedRules } from './specifiedRules'; + +// Spec Section: "Executable Definitions" +export { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule'; + +// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" +export { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule'; + +// Spec Section: "Fragments on Composite Types" +export { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule'; + +// Spec Section: "Argument Names" +export { KnownArgumentNamesRule } from './rules/KnownArgumentNamesRule'; + +// Spec Section: "Directives Are Defined" +export { KnownDirectivesRule } from './rules/KnownDirectivesRule'; + +// Spec Section: "Fragment spread target defined" +export { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule'; + +// Spec Section: "Fragment Spread Type Existence" +export { KnownTypeNamesRule } from './rules/KnownTypeNamesRule'; + +// Spec Section: "Lone Anonymous Operation" +export { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule'; + +// Spec Section: "Fragments must not form cycles" +export { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule'; + +// Spec Section: "All Variable Used Defined" +export { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule'; + +// Spec Section: "Fragments must be used" +export { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule'; + +// Spec Section: "All Variables Used" +export { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule'; + +// Spec Section: "Field Selection Merging" +export { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule'; + +// Spec Section: "Fragment spread is possible" +export { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule'; + +// Spec Section: "Argument Optionality" +export { ProvidedRequiredArgumentsRule } from './rules/ProvidedRequiredArgumentsRule'; + +// Spec Section: "Leaf Field Selections" +export { ScalarLeafsRule } from './rules/ScalarLeafsRule'; + +// Spec Section: "Subscriptions with Single Root Field" +export { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule'; + +// Spec Section: "Argument Uniqueness" +export { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule'; + +// Spec Section: "Directives Are Unique Per Location" +export { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule'; + +// Spec Section: "Fragment Name Uniqueness" +export { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule'; + +// Spec Section: "Input Object Field Uniqueness" +export { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule'; + +// Spec Section: "Operation Name Uniqueness" +export { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule'; + +// Spec Section: "Variable Uniqueness" +export { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule'; + +// Spec Section: "Values Type Correctness" +export { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule'; + +// Spec Section: "Variables are Input Types" +export { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule'; + +// Spec Section: "All Variable Usages Are Allowed" +export { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule'; + +// SDL-specific validation rules +export { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule'; +export { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule'; +export { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule'; +export { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule'; +export { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule'; +export { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule'; +export { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule'; +export { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule'; + +// Optional rules not defined by the GraphQL Specification +export { NoDeprecatedCustomRule } from './rules/custom/NoDeprecatedCustomRule'; +export { NoSchemaIntrospectionCustomRule } from './rules/custom/NoSchemaIntrospectionCustomRule'; diff --git a/src/validation/rules/ExecutableDefinitionsRule.ts b/src/validation/rules/ExecutableDefinitionsRule.ts new file mode 100644 index 00000000..8c4ec3d8 --- /dev/null +++ b/src/validation/rules/ExecutableDefinitionsRule.ts @@ -0,0 +1,40 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import { Kind } from '../../language/kinds'; +import { isExecutableDefinitionNode } from '../../language/predicates'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { ASTValidationContext } from '../ValidationContext'; + +/** + * Executable definitions + * + * A GraphQL document is only valid for execution if all definitions are either + * operation or fragment definitions. + * + * See https://spec.graphql.org/draft/#sec-Executable-Definitions + */ +export function ExecutableDefinitionsRule( + context: ASTValidationContext, +): ASTVisitor { + return { + Document(node) { + for (const definition of node.definitions) { + if (!isExecutableDefinitionNode(definition)) { + const defName = + definition.kind === Kind.SCHEMA_DEFINITION || + definition.kind === Kind.SCHEMA_EXTENSION + ? 'schema' + : '"' + definition.name.value + '"'; + context.reportError( + new GraphQLError( + `The ${defName} definition is not executable.`, + definition, + ), + ); + } + } + return false; + }, + }; +} diff --git a/src/validation/rules/FieldsOnCorrectTypeRule.ts b/src/validation/rules/FieldsOnCorrectTypeRule.ts new file mode 100644 index 00000000..e9d220ef --- /dev/null +++ b/src/validation/rules/FieldsOnCorrectTypeRule.ts @@ -0,0 +1,144 @@ +import { didYouMean } from '../../jsutils/didYouMean'; +import { naturalCompare } from '../../jsutils/naturalCompare'; +import { suggestionList } from '../../jsutils/suggestionList'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { FieldNode } from '../../language/ast'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { + GraphQLInterfaceType, + GraphQLObjectType, + GraphQLOutputType, +} from '../../type/definition'; +import { + isAbstractType, + isInterfaceType, + isObjectType, +} from '../../type/definition'; +import type { GraphQLSchema } from '../../type/schema'; + +import type { ValidationContext } from '../ValidationContext'; + +/** + * Fields on correct type + * + * A GraphQL document is only valid if all fields selected are defined by the + * parent type, or are an allowed meta field such as __typename. + * + * See https://spec.graphql.org/draft/#sec-Field-Selections + */ +export function FieldsOnCorrectTypeRule( + context: ValidationContext, +): ASTVisitor { + return { + Field(node: FieldNode) { + const type = context.getParentType(); + if (type) { + const fieldDef = context.getFieldDef(); + if (!fieldDef) { + // This field doesn't exist, lets look for suggestions. + const schema = context.getSchema(); + const fieldName = node.name.value; + + // First determine if there are any suggested types to condition on. + let suggestion = didYouMean( + 'to use an inline fragment on', + getSuggestedTypeNames(schema, type, fieldName), + ); + + // If there are no suggested types, then perhaps this was a typo? + if (suggestion === '') { + suggestion = didYouMean(getSuggestedFieldNames(type, fieldName)); + } + + // Report an error, including helpful suggestions. + context.reportError( + new GraphQLError( + `Cannot query field "${fieldName}" on type "${type.name}".` + + suggestion, + node, + ), + ); + } + } + }, + }; +} + +/** + * Go through all of the implementations of type, as well as the interfaces that + * they implement. If any of those types include the provided field, suggest them, + * sorted by how often the type is referenced. + */ +function getSuggestedTypeNames( + schema: GraphQLSchema, + type: GraphQLOutputType, + fieldName: string, +): Array { + if (!isAbstractType(type)) { + // Must be an Object type, which does not have possible fields. + return []; + } + + const suggestedTypes: Set = + new Set(); + const usageCount = Object.create(null); + for (const possibleType of schema.getPossibleTypes(type)) { + if (!possibleType.getFields()[fieldName]) { + continue; + } + + // This object type defines this field. + suggestedTypes.add(possibleType); + usageCount[possibleType.name] = 1; + + for (const possibleInterface of possibleType.getInterfaces()) { + if (!possibleInterface.getFields()[fieldName]) { + continue; + } + + // This interface type defines this field. + suggestedTypes.add(possibleInterface); + usageCount[possibleInterface.name] = + (usageCount[possibleInterface.name] ?? 0) + 1; + } + } + + return [...suggestedTypes] + .sort((typeA, typeB) => { + // Suggest both interface and object types based on how common they are. + const usageCountDiff = usageCount[typeB.name] - usageCount[typeA.name]; + if (usageCountDiff !== 0) { + return usageCountDiff; + } + + // Suggest super types first followed by subtypes + if (isInterfaceType(typeA) && schema.isSubType(typeA, typeB)) { + return -1; + } + if (isInterfaceType(typeB) && schema.isSubType(typeB, typeA)) { + return 1; + } + + return naturalCompare(typeA.name, typeB.name); + }) + .map((x) => x.name); +} + +/** + * For the field name provided, determine if there are any similar field names + * that may be the result of a typo. + */ +function getSuggestedFieldNames( + type: GraphQLOutputType, + fieldName: string, +): Array { + if (isObjectType(type) || isInterfaceType(type)) { + const possibleFieldNames = Object.keys(type.getFields()); + return suggestionList(fieldName, possibleFieldNames); + } + // Otherwise, must be a Union type, which does not define fields. + return []; +} diff --git a/src/validation/rules/FragmentsOnCompositeTypesRule.ts b/src/validation/rules/FragmentsOnCompositeTypesRule.ts new file mode 100644 index 00000000..6fe51db9 --- /dev/null +++ b/src/validation/rules/FragmentsOnCompositeTypesRule.ts @@ -0,0 +1,53 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import { print } from '../../language/printer'; +import type { ASTVisitor } from '../../language/visitor'; + +import { isCompositeType } from '../../type/definition'; + +import { typeFromAST } from '../../utilities/typeFromAST'; + +import type { ValidationContext } from '../ValidationContext'; + +/** + * Fragments on composite type + * + * Fragments use a type condition to determine if they apply, since fragments + * can only be spread into a composite type (object, interface, or union), the + * type condition must also be a composite type. + * + * See https://spec.graphql.org/draft/#sec-Fragments-On-Composite-Types + */ +export function FragmentsOnCompositeTypesRule( + context: ValidationContext, +): ASTVisitor { + return { + InlineFragment(node) { + const typeCondition = node.typeCondition; + if (typeCondition) { + const type = typeFromAST(context.getSchema(), typeCondition); + if (type && !isCompositeType(type)) { + const typeStr = print(typeCondition); + context.reportError( + new GraphQLError( + `Fragment cannot condition on non composite type "${typeStr}".`, + typeCondition, + ), + ); + } + } + }, + FragmentDefinition(node) { + const type = typeFromAST(context.getSchema(), node.typeCondition); + if (type && !isCompositeType(type)) { + const typeStr = print(node.typeCondition); + context.reportError( + new GraphQLError( + `Fragment "${node.name.value}" cannot condition on non composite type "${typeStr}".`, + node.typeCondition, + ), + ); + } + }, + }; +} diff --git a/src/validation/rules/KnownArgumentNamesRule.ts b/src/validation/rules/KnownArgumentNamesRule.ts new file mode 100644 index 00000000..5f5c4c70 --- /dev/null +++ b/src/validation/rules/KnownArgumentNamesRule.ts @@ -0,0 +1,101 @@ +import { didYouMean } from '../../jsutils/didYouMean'; +import { suggestionList } from '../../jsutils/suggestionList'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import { Kind } from '../../language/kinds'; +import type { ASTVisitor } from '../../language/visitor'; + +import { specifiedDirectives } from '../../type/directives'; + +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; + +/** + * Known argument names + * + * A GraphQL field is only valid if all supplied arguments are defined by + * that field. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + * See https://spec.graphql.org/draft/#sec-Directives-Are-In-Valid-Locations + */ +export function KnownArgumentNamesRule(context: ValidationContext): ASTVisitor { + return { + // eslint-disable-next-line new-cap + ...KnownArgumentNamesOnDirectivesRule(context), + Argument(argNode) { + const argDef = context.getArgument(); + const fieldDef = context.getFieldDef(); + const parentType = context.getParentType(); + + if (!argDef && fieldDef && parentType) { + const argName = argNode.name.value; + const knownArgsNames = fieldDef.args.map((arg) => arg.name); + const suggestions = suggestionList(argName, knownArgsNames); + context.reportError( + new GraphQLError( + `Unknown argument "${argName}" on field "${parentType.name}.${fieldDef.name}".` + + didYouMean(suggestions), + argNode, + ), + ); + } + }, + }; +} + +/** + * @internal + */ +export function KnownArgumentNamesOnDirectivesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor { + const directiveArgs = Object.create(null); + + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : specifiedDirectives; + for (const directive of definedDirectives) { + directiveArgs[directive.name] = directive.args.map((arg) => arg.name); + } + + const astDefinitions = context.getDocument().definitions; + for (const def of astDefinitions) { + if (def.kind === Kind.DIRECTIVE_DEFINITION) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const argsNodes = def.arguments ?? []; + + directiveArgs[def.name.value] = argsNodes.map((arg) => arg.name.value); + } + } + + return { + Directive(directiveNode) { + const directiveName = directiveNode.name.value; + const knownArgs = directiveArgs[directiveName]; + + if (directiveNode.arguments && knownArgs) { + for (const argNode of directiveNode.arguments) { + const argName = argNode.name.value; + if (!knownArgs.includes(argName)) { + const suggestions = suggestionList(argName, knownArgs); + context.reportError( + new GraphQLError( + `Unknown argument "${argName}" on directive "@${directiveName}".` + + didYouMean(suggestions), + argNode, + ), + ); + } + } + } + + return false; + }, + }; +} diff --git a/src/validation/rules/KnownDirectivesRule.ts b/src/validation/rules/KnownDirectivesRule.ts new file mode 100644 index 00000000..2b5b4811 --- /dev/null +++ b/src/validation/rules/KnownDirectivesRule.ts @@ -0,0 +1,141 @@ +import { inspect } from '../../jsutils/inspect'; +import { invariant } from '../../jsutils/invariant'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ASTNode } from '../../language/ast'; +import { OperationTypeNode } from '../../language/ast'; +import { DirectiveLocation } from '../../language/directiveLocation'; +import { Kind } from '../../language/kinds'; +import type { ASTVisitor } from '../../language/visitor'; + +import { specifiedDirectives } from '../../type/directives'; + +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; + +/** + * Known directives + * + * A GraphQL document is only valid if all `@directives` are known by the + * schema and legally positioned. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Defined + */ +export function KnownDirectivesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor { + const locationsMap = Object.create(null); + + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : specifiedDirectives; + for (const directive of definedDirectives) { + locationsMap[directive.name] = directive.locations; + } + + const astDefinitions = context.getDocument().definitions; + for (const def of astDefinitions) { + if (def.kind === Kind.DIRECTIVE_DEFINITION) { + locationsMap[def.name.value] = def.locations.map((name) => name.value); + } + } + + return { + Directive(node, _key, _parent, _path, ancestors) { + const name = node.name.value; + const locations = locationsMap[name]; + + if (!locations) { + context.reportError( + new GraphQLError(`Unknown directive "@${name}".`, node), + ); + return; + } + + const candidateLocation = getDirectiveLocationForASTPath(ancestors); + if (candidateLocation && !locations.includes(candidateLocation)) { + context.reportError( + new GraphQLError( + `Directive "@${name}" may not be used on ${candidateLocation}.`, + node, + ), + ); + } + }, + }; +} + +function getDirectiveLocationForASTPath( + ancestors: ReadonlyArray>, +): DirectiveLocation | undefined { + const appliedTo = ancestors[ancestors.length - 1]; + invariant('kind' in appliedTo); + + switch (appliedTo.kind) { + case Kind.OPERATION_DEFINITION: + return getDirectiveLocationForOperation(appliedTo.operation); + case Kind.FIELD: + return DirectiveLocation.FIELD; + case Kind.FRAGMENT_SPREAD: + return DirectiveLocation.FRAGMENT_SPREAD; + case Kind.INLINE_FRAGMENT: + return DirectiveLocation.INLINE_FRAGMENT; + case Kind.FRAGMENT_DEFINITION: + return DirectiveLocation.FRAGMENT_DEFINITION; + case Kind.VARIABLE_DEFINITION: + return DirectiveLocation.VARIABLE_DEFINITION; + case Kind.SCHEMA_DEFINITION: + case Kind.SCHEMA_EXTENSION: + return DirectiveLocation.SCHEMA; + case Kind.SCALAR_TYPE_DEFINITION: + case Kind.SCALAR_TYPE_EXTENSION: + return DirectiveLocation.SCALAR; + case Kind.OBJECT_TYPE_DEFINITION: + case Kind.OBJECT_TYPE_EXTENSION: + return DirectiveLocation.OBJECT; + case Kind.FIELD_DEFINITION: + return DirectiveLocation.FIELD_DEFINITION; + case Kind.INTERFACE_TYPE_DEFINITION: + case Kind.INTERFACE_TYPE_EXTENSION: + return DirectiveLocation.INTERFACE; + case Kind.UNION_TYPE_DEFINITION: + case Kind.UNION_TYPE_EXTENSION: + return DirectiveLocation.UNION; + case Kind.ENUM_TYPE_DEFINITION: + case Kind.ENUM_TYPE_EXTENSION: + return DirectiveLocation.ENUM; + case Kind.ENUM_VALUE_DEFINITION: + return DirectiveLocation.ENUM_VALUE; + case Kind.INPUT_OBJECT_TYPE_DEFINITION: + case Kind.INPUT_OBJECT_TYPE_EXTENSION: + return DirectiveLocation.INPUT_OBJECT; + case Kind.INPUT_VALUE_DEFINITION: { + const parentNode = ancestors[ancestors.length - 3]; + invariant('kind' in parentNode); + return parentNode.kind === Kind.INPUT_OBJECT_TYPE_DEFINITION + ? DirectiveLocation.INPUT_FIELD_DEFINITION + : DirectiveLocation.ARGUMENT_DEFINITION; + } + // Not reachable, all possible types have been considered. + /* c8 ignore next */ + default: + invariant(false, 'Unexpected kind: ' + inspect(appliedTo.kind)); + } +} + +function getDirectiveLocationForOperation( + operation: OperationTypeNode, +): DirectiveLocation { + switch (operation) { + case OperationTypeNode.QUERY: + return DirectiveLocation.QUERY; + case OperationTypeNode.MUTATION: + return DirectiveLocation.MUTATION; + case OperationTypeNode.SUBSCRIPTION: + return DirectiveLocation.SUBSCRIPTION; + } +} diff --git a/src/validation/rules/KnownFragmentNamesRule.ts b/src/validation/rules/KnownFragmentNamesRule.ts new file mode 100644 index 00000000..78fb2446 --- /dev/null +++ b/src/validation/rules/KnownFragmentNamesRule.ts @@ -0,0 +1,27 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ASTVisitor } from '../../language/visitor'; + +import type { ValidationContext } from '../ValidationContext'; + +/** + * Known fragment names + * + * A GraphQL document is only valid if all `...Fragment` fragment spreads refer + * to fragments defined in the same document. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spread-target-defined + */ +export function KnownFragmentNamesRule(context: ValidationContext): ASTVisitor { + return { + FragmentSpread(node) { + const fragmentName = node.name.value; + const fragment = context.getFragment(fragmentName); + if (!fragment) { + context.reportError( + new GraphQLError(`Unknown fragment "${fragmentName}".`, node.name), + ); + } + }, + }; +} diff --git a/src/validation/rules/KnownTypeNamesRule.ts b/src/validation/rules/KnownTypeNamesRule.ts new file mode 100644 index 00000000..4802610a --- /dev/null +++ b/src/validation/rules/KnownTypeNamesRule.ts @@ -0,0 +1,82 @@ +import { didYouMean } from '../../jsutils/didYouMean'; +import { suggestionList } from '../../jsutils/suggestionList'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ASTNode } from '../../language/ast'; +import { + isTypeDefinitionNode, + isTypeSystemDefinitionNode, + isTypeSystemExtensionNode, +} from '../../language/predicates'; +import type { ASTVisitor } from '../../language/visitor'; + +import { introspectionTypes } from '../../type/introspection'; +import { specifiedScalarTypes } from '../../type/scalars'; + +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; + +/** + * Known type names + * + * A GraphQL document is only valid if referenced types (specifically + * variable definitions and fragment conditions) are defined by the type schema. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Spread-Type-Existence + */ +export function KnownTypeNamesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor { + const schema = context.getSchema(); + const existingTypesMap = schema ? schema.getTypeMap() : Object.create(null); + + const definedTypes = Object.create(null); + for (const def of context.getDocument().definitions) { + if (isTypeDefinitionNode(def)) { + definedTypes[def.name.value] = true; + } + } + + const typeNames = [ + ...Object.keys(existingTypesMap), + ...Object.keys(definedTypes), + ]; + + return { + NamedType(node, _1, parent, _2, ancestors) { + const typeName = node.name.value; + if (!existingTypesMap[typeName] && !definedTypes[typeName]) { + const definitionNode = ancestors[2] ?? parent; + const isSDL = definitionNode != null && isSDLNode(definitionNode); + if (isSDL && standardTypeNames.includes(typeName)) { + return; + } + + const suggestedTypes = suggestionList( + typeName, + isSDL ? standardTypeNames.concat(typeNames) : typeNames, + ); + context.reportError( + new GraphQLError( + `Unknown type "${typeName}".` + didYouMean(suggestedTypes), + node, + ), + ); + } + }, + }; +} + +const standardTypeNames = [...specifiedScalarTypes, ...introspectionTypes].map( + (type) => type.name, +); + +function isSDLNode(value: ASTNode | ReadonlyArray): boolean { + return ( + 'kind' in value && + (isTypeSystemDefinitionNode(value) || isTypeSystemExtensionNode(value)) + ); +} diff --git a/src/validation/rules/LoneAnonymousOperationRule.ts b/src/validation/rules/LoneAnonymousOperationRule.ts new file mode 100644 index 00000000..ddd537dd --- /dev/null +++ b/src/validation/rules/LoneAnonymousOperationRule.ts @@ -0,0 +1,37 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import { Kind } from '../../language/kinds'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { ASTValidationContext } from '../ValidationContext'; + +/** + * Lone anonymous operation + * + * A GraphQL document is only valid if when it contains an anonymous operation + * (the query short-hand) that it contains only that one operation definition. + * + * See https://spec.graphql.org/draft/#sec-Lone-Anonymous-Operation + */ +export function LoneAnonymousOperationRule( + context: ASTValidationContext, +): ASTVisitor { + let operationCount = 0; + return { + Document(node) { + operationCount = node.definitions.filter( + (definition) => definition.kind === Kind.OPERATION_DEFINITION, + ).length; + }, + OperationDefinition(node) { + if (!node.name && operationCount > 1) { + context.reportError( + new GraphQLError( + 'This anonymous operation must be the only defined operation.', + node, + ), + ); + } + }, + }; +} diff --git a/src/validation/rules/LoneSchemaDefinitionRule.ts b/src/validation/rules/LoneSchemaDefinitionRule.ts new file mode 100644 index 00000000..df962387 --- /dev/null +++ b/src/validation/rules/LoneSchemaDefinitionRule.ts @@ -0,0 +1,43 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ASTVisitor } from '../../language/visitor'; + +import type { SDLValidationContext } from '../ValidationContext'; + +/** + * Lone Schema definition + * + * A GraphQL document is only valid if it contains only one schema definition. + */ +export function LoneSchemaDefinitionRule( + context: SDLValidationContext, +): ASTVisitor { + const oldSchema = context.getSchema(); + const alreadyDefined = + oldSchema?.astNode ?? + oldSchema?.getQueryType() ?? + oldSchema?.getMutationType() ?? + oldSchema?.getSubscriptionType(); + + let schemaDefinitionsCount = 0; + return { + SchemaDefinition(node) { + if (alreadyDefined) { + context.reportError( + new GraphQLError( + 'Cannot define a new schema within a schema extension.', + node, + ), + ); + return; + } + + if (schemaDefinitionsCount > 0) { + context.reportError( + new GraphQLError('Must provide only one schema definition.', node), + ); + } + ++schemaDefinitionsCount; + }, + }; +} diff --git a/src/validation/rules/NoFragmentCyclesRule.ts b/src/validation/rules/NoFragmentCyclesRule.ts new file mode 100644 index 00000000..0a33f450 --- /dev/null +++ b/src/validation/rules/NoFragmentCyclesRule.ts @@ -0,0 +1,90 @@ +import type { ObjMap } from '../../jsutils/ObjMap'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { + FragmentDefinitionNode, + FragmentSpreadNode, +} from '../../language/ast'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { ASTValidationContext } from '../ValidationContext'; + +/** + * No fragment cycles + * + * The graph of fragment spreads must not form any cycles including spreading itself. + * Otherwise an operation could infinitely spread or infinitely execute on cycles in the underlying data. + * + * See https://spec.graphql.org/draft/#sec-Fragment-spreads-must-not-form-cycles + */ +export function NoFragmentCyclesRule( + context: ASTValidationContext, +): ASTVisitor { + // Tracks already visited fragments to maintain O(N) and to ensure that cycles + // are not redundantly reported. + const visitedFrags: ObjMap = Object.create(null); + + // Array of AST nodes used to produce meaningful errors + const spreadPath: Array = []; + + // Position in the spread path + const spreadPathIndexByName: ObjMap = Object.create(null); + + return { + OperationDefinition: () => false, + FragmentDefinition(node) { + detectCycleRecursive(node); + return false; + }, + }; + + // This does a straight-forward DFS to find cycles. + // It does not terminate when a cycle was found but continues to explore + // the graph to find all possible cycles. + function detectCycleRecursive(fragment: FragmentDefinitionNode): void { + if (visitedFrags[fragment.name.value]) { + return; + } + + const fragmentName = fragment.name.value; + visitedFrags[fragmentName] = true; + + const spreadNodes = context.getFragmentSpreads(fragment.selectionSet); + if (spreadNodes.length === 0) { + return; + } + + spreadPathIndexByName[fragmentName] = spreadPath.length; + + for (const spreadNode of spreadNodes) { + const spreadName = spreadNode.name.value; + const cycleIndex = spreadPathIndexByName[spreadName]; + + spreadPath.push(spreadNode); + if (cycleIndex === undefined) { + const spreadFragment = context.getFragment(spreadName); + if (spreadFragment) { + detectCycleRecursive(spreadFragment); + } + } else { + const cyclePath = spreadPath.slice(cycleIndex); + const viaPath = cyclePath + .slice(0, -1) + .map((s) => '"' + s.name.value + '"') + .join(', '); + + context.reportError( + new GraphQLError( + `Cannot spread fragment "${spreadName}" within itself` + + (viaPath !== '' ? ` via ${viaPath}.` : '.'), + cyclePath, + ), + ); + } + spreadPath.pop(); + } + + spreadPathIndexByName[fragmentName] = undefined; + } +} diff --git a/src/validation/rules/NoUndefinedVariablesRule.ts b/src/validation/rules/NoUndefinedVariablesRule.ts new file mode 100644 index 00000000..36bfe049 --- /dev/null +++ b/src/validation/rules/NoUndefinedVariablesRule.ts @@ -0,0 +1,47 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ASTVisitor } from '../../language/visitor'; + +import type { ValidationContext } from '../ValidationContext'; + +/** + * No undefined variables + * + * A GraphQL operation is only valid if all variables encountered, both directly + * and via fragment spreads, are defined by that operation. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Uses-Defined + */ +export function NoUndefinedVariablesRule( + context: ValidationContext, +): ASTVisitor { + let variableNameDefined = Object.create(null); + + return { + OperationDefinition: { + enter() { + variableNameDefined = Object.create(null); + }, + leave(operation) { + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node } of usages) { + const varName = node.name.value; + if (variableNameDefined[varName] !== true) { + context.reportError( + new GraphQLError( + operation.name + ? `Variable "$${varName}" is not defined by operation "${operation.name.value}".` + : `Variable "$${varName}" is not defined.`, + [node, operation], + ), + ); + } + } + }, + }, + VariableDefinition(node) { + variableNameDefined[node.variable.name.value] = true; + }, + }; +} diff --git a/src/validation/rules/NoUnusedFragmentsRule.ts b/src/validation/rules/NoUnusedFragmentsRule.ts new file mode 100644 index 00000000..20479454 --- /dev/null +++ b/src/validation/rules/NoUnusedFragmentsRule.ts @@ -0,0 +1,59 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { + FragmentDefinitionNode, + OperationDefinitionNode, +} from '../../language/ast'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { ASTValidationContext } from '../ValidationContext'; + +/** + * No unused fragments + * + * A GraphQL document is only valid if all fragment definitions are spread + * within operations, or spread within other fragments spread within operations. + * + * See https://spec.graphql.org/draft/#sec-Fragments-Must-Be-Used + */ +export function NoUnusedFragmentsRule( + context: ASTValidationContext, +): ASTVisitor { + const operationDefs: Array = []; + const fragmentDefs: Array = []; + + return { + OperationDefinition(node) { + operationDefs.push(node); + return false; + }, + FragmentDefinition(node) { + fragmentDefs.push(node); + return false; + }, + Document: { + leave() { + const fragmentNameUsed = Object.create(null); + for (const operation of operationDefs) { + for (const fragment of context.getRecursivelyReferencedFragments( + operation, + )) { + fragmentNameUsed[fragment.name.value] = true; + } + } + + for (const fragmentDef of fragmentDefs) { + const fragName = fragmentDef.name.value; + if (fragmentNameUsed[fragName] !== true) { + context.reportError( + new GraphQLError( + `Fragment "${fragName}" is never used.`, + fragmentDef, + ), + ); + } + } + }, + }, + }; +} diff --git a/src/validation/rules/NoUnusedVariablesRule.ts b/src/validation/rules/NoUnusedVariablesRule.ts new file mode 100644 index 00000000..b81fd078 --- /dev/null +++ b/src/validation/rules/NoUnusedVariablesRule.ts @@ -0,0 +1,51 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { VariableDefinitionNode } from '../../language/ast'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { ValidationContext } from '../ValidationContext'; + +/** + * No unused variables + * + * A GraphQL operation is only valid if all variables defined by an operation + * are used, either directly or within a spread fragment. + * + * See https://spec.graphql.org/draft/#sec-All-Variables-Used + */ +export function NoUnusedVariablesRule(context: ValidationContext): ASTVisitor { + let variableDefs: Array = []; + + return { + OperationDefinition: { + enter() { + variableDefs = []; + }, + leave(operation) { + const variableNameUsed = Object.create(null); + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node } of usages) { + variableNameUsed[node.name.value] = true; + } + + for (const variableDef of variableDefs) { + const variableName = variableDef.variable.name.value; + if (variableNameUsed[variableName] !== true) { + context.reportError( + new GraphQLError( + operation.name + ? `Variable "$${variableName}" is never used in operation "${operation.name.value}".` + : `Variable "$${variableName}" is never used.`, + variableDef, + ), + ); + } + } + }, + }, + VariableDefinition(def) { + variableDefs.push(def); + }, + }; +} diff --git a/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts b/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts new file mode 100644 index 00000000..5796da6f --- /dev/null +++ b/src/validation/rules/OverlappingFieldsCanBeMergedRule.ts @@ -0,0 +1,837 @@ +import { inspect } from '../../jsutils/inspect'; +import type { Maybe } from '../../jsutils/Maybe'; +import type { ObjMap } from '../../jsutils/ObjMap'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { + ArgumentNode, + FieldNode, + FragmentDefinitionNode, + SelectionSetNode, + ValueNode, +} from '../../language/ast'; +import { Kind } from '../../language/kinds'; +import { print } from '../../language/printer'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { + GraphQLField, + GraphQLNamedType, + GraphQLOutputType, +} from '../../type/definition'; +import { + getNamedType, + isInterfaceType, + isLeafType, + isListType, + isNonNullType, + isObjectType, +} from '../../type/definition'; + +import { typeFromAST } from '../../utilities/typeFromAST'; + +import type { ValidationContext } from '../ValidationContext'; + +function reasonMessage(reason: ConflictReasonMessage): string { + if (Array.isArray(reason)) { + return reason + .map( + ([responseName, subReason]) => + `subfields "${responseName}" conflict because ` + + reasonMessage(subReason), + ) + .join(' and '); + } + return reason; +} + +/** + * Overlapping fields can be merged + * + * A selection set is only valid if all fields (including spreading any + * fragments) either correspond to distinct response names or can be merged + * without ambiguity. + * + * See https://spec.graphql.org/draft/#sec-Field-Selection-Merging + */ +export function OverlappingFieldsCanBeMergedRule( + context: ValidationContext, +): ASTVisitor { + // A memoization for when two fragments are compared "between" each other for + // conflicts. Two fragments may be compared many times, so memoizing this can + // dramatically improve the performance of this validator. + const comparedFragmentPairs = new PairSet(); + + // A cache for the "field map" and list of fragment names found in any given + // selection set. Selection sets may be asked for this information multiple + // times, so this improves the performance of this validator. + const cachedFieldsAndFragmentNames = new Map(); + + return { + SelectionSet(selectionSet) { + const conflicts = findConflictsWithinSelectionSet( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + context.getParentType(), + selectionSet, + ); + for (const [[responseName, reason], fields1, fields2] of conflicts) { + const reasonMsg = reasonMessage(reason); + context.reportError( + new GraphQLError( + `Fields "${responseName}" conflict because ${reasonMsg}. Use different aliases on the fields to fetch both if this was intentional.`, + fields1.concat(fields2), + ), + ); + } + }, + }; +} + +type Conflict = [ConflictReason, Array, Array]; +// Field name and reason. +type ConflictReason = [string, ConflictReasonMessage]; +// Reason is a string, or a nested list of conflicts. +type ConflictReasonMessage = string | Array; +// Tuple defining a field node in a context. +type NodeAndDef = [ + Maybe, + FieldNode, + Maybe>, +]; +// Map of array of those. +type NodeAndDefCollection = ObjMap>; +type FragmentNames = Array; +type FieldsAndFragmentNames = readonly [NodeAndDefCollection, FragmentNames]; + +/** + * Algorithm: + * + * Conflicts occur when two fields exist in a query which will produce the same + * response name, but represent differing values, thus creating a conflict. + * The algorithm below finds all conflicts via making a series of comparisons + * between fields. In order to compare as few fields as possible, this makes + * a series of comparisons "within" sets of fields and "between" sets of fields. + * + * Given any selection set, a collection produces both a set of fields by + * also including all inline fragments, as well as a list of fragments + * referenced by fragment spreads. + * + * A) Each selection set represented in the document first compares "within" its + * collected set of fields, finding any conflicts between every pair of + * overlapping fields. + * Note: This is the *only time* that a the fields "within" a set are compared + * to each other. After this only fields "between" sets are compared. + * + * B) Also, if any fragment is referenced in a selection set, then a + * comparison is made "between" the original set of fields and the + * referenced fragment. + * + * C) Also, if multiple fragments are referenced, then comparisons + * are made "between" each referenced fragment. + * + * D) When comparing "between" a set of fields and a referenced fragment, first + * a comparison is made between each field in the original set of fields and + * each field in the the referenced set of fields. + * + * E) Also, if any fragment is referenced in the referenced selection set, + * then a comparison is made "between" the original set of fields and the + * referenced fragment (recursively referring to step D). + * + * F) When comparing "between" two fragments, first a comparison is made between + * each field in the first referenced set of fields and each field in the the + * second referenced set of fields. + * + * G) Also, any fragments referenced by the first must be compared to the + * second, and any fragments referenced by the second must be compared to the + * first (recursively referring to step F). + * + * H) When comparing two fields, if both have selection sets, then a comparison + * is made "between" both selection sets, first comparing the set of fields in + * the first selection set with the set of fields in the second. + * + * I) Also, if any fragment is referenced in either selection set, then a + * comparison is made "between" the other set of fields and the + * referenced fragment. + * + * J) Also, if two fragments are referenced in both selection sets, then a + * comparison is made "between" the two fragments. + * + */ + +// Find all conflicts found "within" a selection set, including those found +// via spreading in fragments. Called when visiting each SelectionSet in the +// GraphQL Document. +function findConflictsWithinSelectionSet( + context: ValidationContext, + cachedFieldsAndFragmentNames: Map, + comparedFragmentPairs: PairSet, + parentType: Maybe, + selectionSet: SelectionSetNode, +): Array { + const conflicts: Array = []; + + const [fieldMap, fragmentNames] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType, + selectionSet, + ); + + // (A) Find find all conflicts "within" the fields of this selection set. + // Note: this is the *only place* `collectConflictsWithin` is called. + collectConflictsWithin( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + fieldMap, + ); + + if (fragmentNames.length !== 0) { + // (B) Then collect conflicts between these fields and those represented by + // each spread fragment name found. + for (let i = 0; i < fragmentNames.length; i++) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, + fieldMap, + fragmentNames[i], + ); + // (C) Then compare this fragment with all other fragments found in this + // selection set to collect conflicts between fragments spread together. + // This compares each item in the list of fragment names to every other + // item in that same list (except for itself). + for (let j = i + 1; j < fragmentNames.length; j++) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, + fragmentNames[i], + fragmentNames[j], + ); + } + } + } + return conflicts; +} + +// Collect all conflicts found between a set of fields and a fragment reference +// including via spreading in any nested fragments. +function collectConflictsBetweenFieldsAndFragment( + context: ValidationContext, + conflicts: Array, + cachedFieldsAndFragmentNames: Map, + comparedFragmentPairs: PairSet, + areMutuallyExclusive: boolean, + fieldMap: NodeAndDefCollection, + fragmentName: string, +): void { + const fragment = context.getFragment(fragmentName); + if (!fragment) { + return; + } + + const [fieldMap2, referencedFragmentNames] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment, + ); + + // Do not compare a fragment's fieldMap to itself. + if (fieldMap === fieldMap2) { + return; + } + + // (D) First collect any conflicts between the provided collection of fields + // and the collection of fields represented by the given fragment. + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + fieldMap2, + ); + + // (E) Then collect any conflicts between the provided collection of fields + // and any fragment names found in the given fragment. + for (const referencedFragmentName of referencedFragmentNames) { + // Memoize so two fragments are not compared for conflicts more than once. + if ( + comparedFragmentPairs.has( + referencedFragmentName, + fragmentName, + areMutuallyExclusive, + ) + ) { + continue; + } + comparedFragmentPairs.add( + referencedFragmentName, + fragmentName, + areMutuallyExclusive, + ); + + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap, + referencedFragmentName, + ); + } +} + +// Collect all conflicts found between two fragments, including via spreading in +// any nested fragments. +function collectConflictsBetweenFragments( + context: ValidationContext, + conflicts: Array, + cachedFieldsAndFragmentNames: Map, + comparedFragmentPairs: PairSet, + areMutuallyExclusive: boolean, + fragmentName1: string, + fragmentName2: string, +): void { + // No need to compare a fragment to itself. + if (fragmentName1 === fragmentName2) { + return; + } + + // Memoize so two fragments are not compared for conflicts more than once. + if ( + comparedFragmentPairs.has( + fragmentName1, + fragmentName2, + areMutuallyExclusive, + ) + ) { + return; + } + comparedFragmentPairs.add(fragmentName1, fragmentName2, areMutuallyExclusive); + + const fragment1 = context.getFragment(fragmentName1); + const fragment2 = context.getFragment(fragmentName2); + if (!fragment1 || !fragment2) { + return; + } + + const [fieldMap1, referencedFragmentNames1] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment1, + ); + const [fieldMap2, referencedFragmentNames2] = + getReferencedFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragment2, + ); + + // (F) First, collect all conflicts between these two collections of fields + // (not including any nested fragments). + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fieldMap2, + ); + + // (G) Then collect conflicts between the first fragment and any nested + // fragments spread in the second fragment. + for (const referencedFragmentName2 of referencedFragmentNames2) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + referencedFragmentName2, + ); + } + + // (G) Then collect conflicts between the second fragment and any nested + // fragments spread in the first fragment. + for (const referencedFragmentName1 of referencedFragmentNames1) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + referencedFragmentName1, + fragmentName2, + ); + } +} + +// Find all conflicts found between two selection sets, including those found +// via spreading in fragments. Called when determining if conflicts exist +// between the sub-fields of two overlapping fields. +function findConflictsBetweenSubSelectionSets( + context: ValidationContext, + cachedFieldsAndFragmentNames: Map, + comparedFragmentPairs: PairSet, + areMutuallyExclusive: boolean, + parentType1: Maybe, + selectionSet1: SelectionSetNode, + parentType2: Maybe, + selectionSet2: SelectionSetNode, +): Array { + const conflicts: Array = []; + + const [fieldMap1, fragmentNames1] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType1, + selectionSet1, + ); + const [fieldMap2, fragmentNames2] = getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + parentType2, + selectionSet2, + ); + + // (H) First, collect all conflicts between these two collections of field. + collectConflictsBetween( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fieldMap2, + ); + + // (I) Then collect conflicts between the first collection of fields and + // those referenced by each fragment name associated with the second. + for (const fragmentName2 of fragmentNames2) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap1, + fragmentName2, + ); + } + + // (I) Then collect conflicts between the second collection of fields and + // those referenced by each fragment name associated with the first. + for (const fragmentName1 of fragmentNames1) { + collectConflictsBetweenFieldsAndFragment( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fieldMap2, + fragmentName1, + ); + } + + // (J) Also collect conflicts between any fragment names by the first and + // fragment names by the second. This compares each item in the first set of + // names to each item in the second set of names. + for (const fragmentName1 of fragmentNames1) { + for (const fragmentName2 of fragmentNames2) { + collectConflictsBetweenFragments( + context, + conflicts, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + fragmentName1, + fragmentName2, + ); + } + } + return conflicts; +} + +// Collect all Conflicts "within" one collection of fields. +function collectConflictsWithin( + context: ValidationContext, + conflicts: Array, + cachedFieldsAndFragmentNames: Map, + comparedFragmentPairs: PairSet, + fieldMap: NodeAndDefCollection, +): void { + // A field map is a keyed collection, where each key represents a response + // name and the value at that key is a list of all fields which provide that + // response name. For every response name, if there are multiple fields, they + // must be compared to find a potential conflict. + for (const [responseName, fields] of Object.entries(fieldMap)) { + // This compares every field in the list to every other field in this list + // (except to itself). If the list only has one item, nothing needs to + // be compared. + if (fields.length > 1) { + for (let i = 0; i < fields.length; i++) { + for (let j = i + 1; j < fields.length; j++) { + const conflict = findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + false, // within one collection is never mutually exclusive + responseName, + fields[i], + fields[j], + ); + if (conflict) { + conflicts.push(conflict); + } + } + } + } + } +} + +// Collect all Conflicts between two collections of fields. This is similar to, +// but different from the `collectConflictsWithin` function above. This check +// assumes that `collectConflictsWithin` has already been called on each +// provided collection of fields. This is true because this validator traverses +// each individual selection set. +function collectConflictsBetween( + context: ValidationContext, + conflicts: Array, + cachedFieldsAndFragmentNames: Map, + comparedFragmentPairs: PairSet, + parentFieldsAreMutuallyExclusive: boolean, + fieldMap1: NodeAndDefCollection, + fieldMap2: NodeAndDefCollection, +): void { + // A field map is a keyed collection, where each key represents a response + // name and the value at that key is a list of all fields which provide that + // response name. For any response name which appears in both provided field + // maps, each field from the first field map must be compared to every field + // in the second field map to find potential conflicts. + for (const [responseName, fields1] of Object.entries(fieldMap1)) { + const fields2 = fieldMap2[responseName]; + if (fields2) { + for (const field1 of fields1) { + for (const field2 of fields2) { + const conflict = findConflict( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + parentFieldsAreMutuallyExclusive, + responseName, + field1, + field2, + ); + if (conflict) { + conflicts.push(conflict); + } + } + } + } + } +} + +// Determines if there is a conflict between two particular fields, including +// comparing their sub-fields. +function findConflict( + context: ValidationContext, + cachedFieldsAndFragmentNames: Map, + comparedFragmentPairs: PairSet, + parentFieldsAreMutuallyExclusive: boolean, + responseName: string, + field1: NodeAndDef, + field2: NodeAndDef, +): Maybe { + const [parentType1, node1, def1] = field1; + const [parentType2, node2, def2] = field2; + + // If it is known that two fields could not possibly apply at the same + // time, due to the parent types, then it is safe to permit them to diverge + // in aliased field or arguments used as they will not present any ambiguity + // by differing. + // It is known that two parent types could never overlap if they are + // different Object types. Interface or Union types might overlap - if not + // in the current state of the schema, then perhaps in some future version, + // thus may not safely diverge. + const areMutuallyExclusive = + parentFieldsAreMutuallyExclusive || + (parentType1 !== parentType2 && + isObjectType(parentType1) && + isObjectType(parentType2)); + + if (!areMutuallyExclusive) { + // Two aliases must refer to the same field. + const name1 = node1.name.value; + const name2 = node2.name.value; + if (name1 !== name2) { + return [ + [responseName, `"${name1}" and "${name2}" are different fields`], + [node1], + [node2], + ]; + } + + // FIXME https://github.com/graphql/graphql-js/issues/2203 + const args1 = /* c8 ignore next */ node1.arguments ?? []; + const args2 = /* c8 ignore next */ node2.arguments ?? []; + + // Two field calls must have the same arguments. + if (!sameArguments(args1, args2)) { + return [ + [responseName, 'they have differing arguments'], + [node1], + [node2], + ]; + } + } + + // The return type for each field. + const type1 = def1?.type; + const type2 = def2?.type; + + if (type1 && type2 && doTypesConflict(type1, type2)) { + return [ + [ + responseName, + `they return conflicting types "${inspect(type1)}" and "${inspect( + type2, + )}"`, + ], + [node1], + [node2], + ]; + } + + // Collect and compare sub-fields. Use the same "visited fragment names" list + // for both collections so fields in a fragment reference are never + // compared to themselves. + const selectionSet1 = node1.selectionSet; + const selectionSet2 = node2.selectionSet; + if (selectionSet1 && selectionSet2) { + const conflicts = findConflictsBetweenSubSelectionSets( + context, + cachedFieldsAndFragmentNames, + comparedFragmentPairs, + areMutuallyExclusive, + getNamedType(type1), + selectionSet1, + getNamedType(type2), + selectionSet2, + ); + return subfieldConflicts(conflicts, responseName, node1, node2); + } +} + +function sameArguments( + arguments1: ReadonlyArray, + arguments2: ReadonlyArray, +): boolean { + if (arguments1.length !== arguments2.length) { + return false; + } + return arguments1.every((argument1) => { + const argument2 = arguments2.find( + (argument) => argument.name.value === argument1.name.value, + ); + if (!argument2) { + return false; + } + return sameValue(argument1.value, argument2.value); + }); +} + +function sameValue(value1: ValueNode, value2: ValueNode): boolean { + return print(value1) === print(value2); +} + +// Two types conflict if both types could not apply to a value simultaneously. +// Composite types are ignored as their individual field types will be compared +// later recursively. However List and Non-Null types must match. +function doTypesConflict( + type1: GraphQLOutputType, + type2: GraphQLOutputType, +): boolean { + if (isListType(type1)) { + return isListType(type2) + ? doTypesConflict(type1.ofType, type2.ofType) + : true; + } + if (isListType(type2)) { + return true; + } + if (isNonNullType(type1)) { + return isNonNullType(type2) + ? doTypesConflict(type1.ofType, type2.ofType) + : true; + } + if (isNonNullType(type2)) { + return true; + } + if (isLeafType(type1) || isLeafType(type2)) { + return type1 !== type2; + } + return false; +} + +// Given a selection set, return the collection of fields (a mapping of response +// name to field nodes and definitions) as well as a list of fragment names +// referenced via fragment spreads. +function getFieldsAndFragmentNames( + context: ValidationContext, + cachedFieldsAndFragmentNames: Map, + parentType: Maybe, + selectionSet: SelectionSetNode, +): FieldsAndFragmentNames { + const cached = cachedFieldsAndFragmentNames.get(selectionSet); + if (cached) { + return cached; + } + const nodeAndDefs: NodeAndDefCollection = Object.create(null); + const fragmentNames: ObjMap = Object.create(null); + _collectFieldsAndFragmentNames( + context, + parentType, + selectionSet, + nodeAndDefs, + fragmentNames, + ); + const result = [nodeAndDefs, Object.keys(fragmentNames)] as const; + cachedFieldsAndFragmentNames.set(selectionSet, result); + return result; +} + +// Given a reference to a fragment, return the represented collection of fields +// as well as a list of nested fragment names referenced via fragment spreads. +function getReferencedFieldsAndFragmentNames( + context: ValidationContext, + cachedFieldsAndFragmentNames: Map, + fragment: FragmentDefinitionNode, +) { + // Short-circuit building a type from the node if possible. + const cached = cachedFieldsAndFragmentNames.get(fragment.selectionSet); + if (cached) { + return cached; + } + + const fragmentType = typeFromAST(context.getSchema(), fragment.typeCondition); + return getFieldsAndFragmentNames( + context, + cachedFieldsAndFragmentNames, + fragmentType, + fragment.selectionSet, + ); +} + +function _collectFieldsAndFragmentNames( + context: ValidationContext, + parentType: Maybe, + selectionSet: SelectionSetNode, + nodeAndDefs: NodeAndDefCollection, + fragmentNames: ObjMap, +): void { + for (const selection of selectionSet.selections) { + switch (selection.kind) { + case Kind.FIELD: { + const fieldName = selection.name.value; + let fieldDef; + if (isObjectType(parentType) || isInterfaceType(parentType)) { + fieldDef = parentType.getFields()[fieldName]; + } + const responseName = selection.alias + ? selection.alias.value + : fieldName; + if (!nodeAndDefs[responseName]) { + nodeAndDefs[responseName] = []; + } + nodeAndDefs[responseName].push([parentType, selection, fieldDef]); + break; + } + case Kind.FRAGMENT_SPREAD: + fragmentNames[selection.name.value] = true; + break; + case Kind.INLINE_FRAGMENT: { + const typeCondition = selection.typeCondition; + const inlineFragmentType = typeCondition + ? typeFromAST(context.getSchema(), typeCondition) + : parentType; + _collectFieldsAndFragmentNames( + context, + inlineFragmentType, + selection.selectionSet, + nodeAndDefs, + fragmentNames, + ); + break; + } + } + } +} + +// Given a series of Conflicts which occurred between two sub-fields, generate +// a single Conflict. +function subfieldConflicts( + conflicts: ReadonlyArray, + responseName: string, + node1: FieldNode, + node2: FieldNode, +): Maybe { + if (conflicts.length > 0) { + return [ + [responseName, conflicts.map(([reason]) => reason)], + [node1, ...conflicts.map(([, fields1]) => fields1).flat()], + [node2, ...conflicts.map(([, , fields2]) => fields2).flat()], + ]; + } +} + +/** + * A way to keep track of pairs of things when the ordering of the pair does not matter. + */ +class PairSet { + _data: Map>; + + constructor() { + this._data = new Map(); + } + + has(a: string, b: string, areMutuallyExclusive: boolean): boolean { + const [key1, key2] = a < b ? [a, b] : [b, a]; + + const result = this._data.get(key1)?.get(key2); + if (result === undefined) { + return false; + } + + // areMutuallyExclusive being false is a superset of being true, hence if + // we want to know if this PairSet "has" these two with no exclusivity, + // we have to ensure it was added as such. + return areMutuallyExclusive ? true : areMutuallyExclusive === result; + } + + add(a: string, b: string, areMutuallyExclusive: boolean): void { + const [key1, key2] = a < b ? [a, b] : [b, a]; + + const map = this._data.get(key1); + if (map === undefined) { + this._data.set(key1, new Map([[key2, areMutuallyExclusive]])); + } else { + map.set(key2, areMutuallyExclusive); + } + } +} diff --git a/src/validation/rules/PossibleFragmentSpreadsRule.ts b/src/validation/rules/PossibleFragmentSpreadsRule.ts new file mode 100644 index 00000000..b2210e5a --- /dev/null +++ b/src/validation/rules/PossibleFragmentSpreadsRule.ts @@ -0,0 +1,78 @@ +import { inspect } from '../../jsutils/inspect'; +import type { Maybe } from '../../jsutils/Maybe'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ASTVisitor } from '../../language/visitor'; + +import type { GraphQLCompositeType } from '../../type/definition'; +import { isCompositeType } from '../../type/definition'; + +import { doTypesOverlap } from '../../utilities/typeComparators'; +import { typeFromAST } from '../../utilities/typeFromAST'; + +import type { ValidationContext } from '../ValidationContext'; + +/** + * Possible fragment spread + * + * A fragment spread is only valid if the type condition could ever possibly + * be true: if there is a non-empty intersection of the possible parent types, + * and possible types which pass the type condition. + */ +export function PossibleFragmentSpreadsRule( + context: ValidationContext, +): ASTVisitor { + return { + InlineFragment(node) { + const fragType = context.getType(); + const parentType = context.getParentType(); + if ( + isCompositeType(fragType) && + isCompositeType(parentType) && + !doTypesOverlap(context.getSchema(), fragType, parentType) + ) { + const parentTypeStr = inspect(parentType); + const fragTypeStr = inspect(fragType); + context.reportError( + new GraphQLError( + `Fragment cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, + node, + ), + ); + } + }, + FragmentSpread(node) { + const fragName = node.name.value; + const fragType = getFragmentType(context, fragName); + const parentType = context.getParentType(); + if ( + fragType && + parentType && + !doTypesOverlap(context.getSchema(), fragType, parentType) + ) { + const parentTypeStr = inspect(parentType); + const fragTypeStr = inspect(fragType); + context.reportError( + new GraphQLError( + `Fragment "${fragName}" cannot be spread here as objects of type "${parentTypeStr}" can never be of type "${fragTypeStr}".`, + node, + ), + ); + } + }, + }; +} + +function getFragmentType( + context: ValidationContext, + name: string, +): Maybe { + const frag = context.getFragment(name); + if (frag) { + const type = typeFromAST(context.getSchema(), frag.typeCondition); + if (isCompositeType(type)) { + return type; + } + } +} diff --git a/src/validation/rules/PossibleTypeExtensionsRule.ts b/src/validation/rules/PossibleTypeExtensionsRule.ts new file mode 100644 index 00000000..4abca7b7 --- /dev/null +++ b/src/validation/rules/PossibleTypeExtensionsRule.ts @@ -0,0 +1,144 @@ +import { didYouMean } from '../../jsutils/didYouMean'; +import { inspect } from '../../jsutils/inspect'; +import { invariant } from '../../jsutils/invariant'; +import type { ObjMap } from '../../jsutils/ObjMap'; +import { suggestionList } from '../../jsutils/suggestionList'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { DefinitionNode, TypeExtensionNode } from '../../language/ast'; +import { Kind } from '../../language/kinds'; +import { isTypeDefinitionNode } from '../../language/predicates'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { GraphQLNamedType } from '../../type/definition'; +import { + isEnumType, + isInputObjectType, + isInterfaceType, + isObjectType, + isScalarType, + isUnionType, +} from '../../type/definition'; + +import type { SDLValidationContext } from '../ValidationContext'; + +/** + * Possible type extension + * + * A type extension is only valid if the type is defined and has the same kind. + */ +export function PossibleTypeExtensionsRule( + context: SDLValidationContext, +): ASTVisitor { + const schema = context.getSchema(); + const definedTypes: ObjMap = Object.create(null); + + for (const def of context.getDocument().definitions) { + if (isTypeDefinitionNode(def)) { + definedTypes[def.name.value] = def; + } + } + + return { + ScalarTypeExtension: checkExtension, + ObjectTypeExtension: checkExtension, + InterfaceTypeExtension: checkExtension, + UnionTypeExtension: checkExtension, + EnumTypeExtension: checkExtension, + InputObjectTypeExtension: checkExtension, + }; + + function checkExtension(node: TypeExtensionNode): void { + const typeName = node.name.value; + const defNode = definedTypes[typeName]; + const existingType = schema?.getType(typeName); + + let expectedKind: Kind | undefined; + if (defNode) { + expectedKind = defKindToExtKind[defNode.kind]; + } else if (existingType) { + expectedKind = typeToExtKind(existingType); + } + + if (expectedKind) { + if (expectedKind !== node.kind) { + const kindStr = extensionKindToTypeName(node.kind); + context.reportError( + new GraphQLError( + `Cannot extend non-${kindStr} type "${typeName}".`, + defNode ? [defNode, node] : node, + ), + ); + } + } else { + const allTypeNames = Object.keys({ + ...definedTypes, + ...schema?.getTypeMap(), + }); + + const suggestedTypes = suggestionList(typeName, allTypeNames); + context.reportError( + new GraphQLError( + `Cannot extend type "${typeName}" because it is not defined.` + + didYouMean(suggestedTypes), + node.name, + ), + ); + } + } +} + +const defKindToExtKind: ObjMap = { + [Kind.SCALAR_TYPE_DEFINITION]: Kind.SCALAR_TYPE_EXTENSION, + [Kind.OBJECT_TYPE_DEFINITION]: Kind.OBJECT_TYPE_EXTENSION, + [Kind.INTERFACE_TYPE_DEFINITION]: Kind.INTERFACE_TYPE_EXTENSION, + [Kind.UNION_TYPE_DEFINITION]: Kind.UNION_TYPE_EXTENSION, + [Kind.ENUM_TYPE_DEFINITION]: Kind.ENUM_TYPE_EXTENSION, + [Kind.INPUT_OBJECT_TYPE_DEFINITION]: Kind.INPUT_OBJECT_TYPE_EXTENSION, +}; + +function typeToExtKind(type: GraphQLNamedType): Kind { + if (isScalarType(type)) { + return Kind.SCALAR_TYPE_EXTENSION; + } + if (isObjectType(type)) { + return Kind.OBJECT_TYPE_EXTENSION; + } + if (isInterfaceType(type)) { + return Kind.INTERFACE_TYPE_EXTENSION; + } + if (isUnionType(type)) { + return Kind.UNION_TYPE_EXTENSION; + } + if (isEnumType(type)) { + return Kind.ENUM_TYPE_EXTENSION; + } + if (isInputObjectType(type)) { + return Kind.INPUT_OBJECT_TYPE_EXTENSION; + } + /* c8 ignore next 3 */ + // Not reachable. All possible types have been considered + invariant(false, 'Unexpected type: ' + inspect(type)); +} + +function extensionKindToTypeName(kind: Kind): string { + switch (kind) { + case Kind.SCALAR_TYPE_EXTENSION: + return 'scalar'; + case Kind.OBJECT_TYPE_EXTENSION: + return 'object'; + case Kind.INTERFACE_TYPE_EXTENSION: + return 'interface'; + case Kind.UNION_TYPE_EXTENSION: + return 'union'; + case Kind.ENUM_TYPE_EXTENSION: + return 'enum'; + case Kind.INPUT_OBJECT_TYPE_EXTENSION: + return 'input object'; + // Not reachable. All possible types have been considered + /* c8 ignore next */ + default: + invariant(false, 'Unexpected kind: ' + inspect(kind)); + } +} diff --git a/src/validation/rules/ProvidedRequiredArgumentsRule.ts b/src/validation/rules/ProvidedRequiredArgumentsRule.ts new file mode 100644 index 00000000..b16079b1 --- /dev/null +++ b/src/validation/rules/ProvidedRequiredArgumentsRule.ts @@ -0,0 +1,127 @@ +import { inspect } from '../../jsutils/inspect'; +import { keyMap } from '../../jsutils/keyMap'; +import type { ObjMap } from '../../jsutils/ObjMap'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { InputValueDefinitionNode } from '../../language/ast'; +import { Kind } from '../../language/kinds'; +import { print } from '../../language/printer'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { GraphQLArgument } from '../../type/definition'; +import { isRequiredArgument, isType } from '../../type/definition'; +import { specifiedDirectives } from '../../type/directives'; + +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; + +/** + * Provided required arguments + * + * A field or directive is only valid if all required (non-null without a + * default value) field arguments have been provided. + */ +export function ProvidedRequiredArgumentsRule( + context: ValidationContext, +): ASTVisitor { + return { + // eslint-disable-next-line new-cap + ...ProvidedRequiredArgumentsOnDirectivesRule(context), + Field: { + // Validate on leave to allow for deeper errors to appear first. + leave(fieldNode) { + const fieldDef = context.getFieldDef(); + if (!fieldDef) { + return false; + } + + const providedArgs = new Set( + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + fieldNode.arguments?.map((arg) => arg.name.value), + ); + for (const argDef of fieldDef.args) { + if (!providedArgs.has(argDef.name) && isRequiredArgument(argDef)) { + const argTypeStr = inspect(argDef.type); + context.reportError( + new GraphQLError( + `Field "${fieldDef.name}" argument "${argDef.name}" of type "${argTypeStr}" is required, but it was not provided.`, + fieldNode, + ), + ); + } + } + }, + }, + }; +} + +/** + * @internal + */ +export function ProvidedRequiredArgumentsOnDirectivesRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor { + const requiredArgsMap: ObjMap< + ObjMap + > = Object.create(null); + + const schema = context.getSchema(); + const definedDirectives = schema?.getDirectives() ?? specifiedDirectives; + for (const directive of definedDirectives) { + requiredArgsMap[directive.name] = keyMap( + directive.args.filter(isRequiredArgument), + (arg) => arg.name, + ); + } + + const astDefinitions = context.getDocument().definitions; + for (const def of astDefinitions) { + if (def.kind === Kind.DIRECTIVE_DEFINITION) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const argNodes = def.arguments ?? []; + + requiredArgsMap[def.name.value] = keyMap( + argNodes.filter(isRequiredArgumentNode), + (arg) => arg.name.value, + ); + } + } + + return { + Directive: { + // Validate on leave to allow for deeper errors to appear first. + leave(directiveNode) { + const directiveName = directiveNode.name.value; + const requiredArgs = requiredArgsMap[directiveName]; + if (requiredArgs) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const argNodes = directiveNode.arguments ?? []; + const argNodeMap = new Set(argNodes.map((arg) => arg.name.value)); + for (const [argName, argDef] of Object.entries(requiredArgs)) { + if (!argNodeMap.has(argName)) { + const argType = isType(argDef.type) + ? inspect(argDef.type) + : print(argDef.type); + context.reportError( + new GraphQLError( + `Directive "@${directiveName}" argument "${argName}" of type "${argType}" is required, but it was not provided.`, + directiveNode, + ), + ); + } + } + } + }, + }, + }; +} + +function isRequiredArgumentNode(arg: InputValueDefinitionNode): boolean { + return arg.type.kind === Kind.NON_NULL_TYPE && arg.defaultValue == null; +} diff --git a/src/validation/rules/ScalarLeafsRule.ts b/src/validation/rules/ScalarLeafsRule.ts new file mode 100644 index 00000000..c59667d9 --- /dev/null +++ b/src/validation/rules/ScalarLeafsRule.ts @@ -0,0 +1,48 @@ +import { inspect } from '../../jsutils/inspect'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { FieldNode } from '../../language/ast'; +import type { ASTVisitor } from '../../language/visitor'; + +import { getNamedType, isLeafType } from '../../type/definition'; + +import type { ValidationContext } from '../ValidationContext'; + +/** + * Scalar leafs + * + * A GraphQL document is valid only if all leaf fields (fields without + * sub selections) are of scalar or enum types. + */ +export function ScalarLeafsRule(context: ValidationContext): ASTVisitor { + return { + Field(node: FieldNode) { + const type = context.getType(); + const selectionSet = node.selectionSet; + if (type) { + if (isLeafType(getNamedType(type))) { + if (selectionSet) { + const fieldName = node.name.value; + const typeStr = inspect(type); + context.reportError( + new GraphQLError( + `Field "${fieldName}" must not have a selection since type "${typeStr}" has no subfields.`, + selectionSet, + ), + ); + } + } else if (!selectionSet) { + const fieldName = node.name.value; + const typeStr = inspect(type); + context.reportError( + new GraphQLError( + `Field "${fieldName}" of type "${typeStr}" must have a selection of subfields. Did you mean "${fieldName} { ... }"?`, + node, + ), + ); + } + } + }, + }; +} diff --git a/src/validation/rules/SingleFieldSubscriptionsRule.ts b/src/validation/rules/SingleFieldSubscriptionsRule.ts new file mode 100644 index 00000000..db0e6446 --- /dev/null +++ b/src/validation/rules/SingleFieldSubscriptionsRule.ts @@ -0,0 +1,82 @@ +import type { ObjMap } from '../../jsutils/ObjMap'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { + FragmentDefinitionNode, + OperationDefinitionNode, +} from '../../language/ast'; +import { Kind } from '../../language/kinds'; +import type { ASTVisitor } from '../../language/visitor'; + +import { collectFields } from '../../execution/collectFields'; + +import type { ValidationContext } from '../ValidationContext'; + +/** + * Subscriptions must only include a non-introspection field. + * + * A GraphQL subscription is valid only if it contains a single root field and + * that root field is not an introspection field. + * + * See https://spec.graphql.org/draft/#sec-Single-root-field + */ +export function SingleFieldSubscriptionsRule( + context: ValidationContext, +): ASTVisitor { + return { + OperationDefinition(node: OperationDefinitionNode) { + if (node.operation === 'subscription') { + const schema = context.getSchema(); + const subscriptionType = schema.getSubscriptionType(); + if (subscriptionType) { + const operationName = node.name ? node.name.value : null; + const variableValues: { + [variable: string]: any; + } = Object.create(null); + const document = context.getDocument(); + const fragments: ObjMap = Object.create(null); + for (const definition of document.definitions) { + if (definition.kind === Kind.FRAGMENT_DEFINITION) { + fragments[definition.name.value] = definition; + } + } + const fields = collectFields( + schema, + fragments, + variableValues, + subscriptionType, + node.selectionSet, + ); + if (fields.size > 1) { + const fieldSelectionLists = [...fields.values()]; + const extraFieldSelectionLists = fieldSelectionLists.slice(1); + const extraFieldSelections = extraFieldSelectionLists.flat(); + context.reportError( + new GraphQLError( + operationName != null + ? `Subscription "${operationName}" must select only one top level field.` + : 'Anonymous Subscription must select only one top level field.', + extraFieldSelections, + ), + ); + } + for (const fieldNodes of fields.values()) { + const field = fieldNodes[0]; + const fieldName = field.name.value; + if (fieldName.startsWith('__')) { + context.reportError( + new GraphQLError( + operationName != null + ? `Subscription "${operationName}" must not select an introspection top level field.` + : 'Anonymous Subscription must not select an introspection top level field.', + fieldNodes, + ), + ); + } + } + } + } + }, + }; +} diff --git a/src/validation/rules/UniqueArgumentDefinitionNamesRule.ts b/src/validation/rules/UniqueArgumentDefinitionNamesRule.ts new file mode 100644 index 00000000..3f6e79df --- /dev/null +++ b/src/validation/rules/UniqueArgumentDefinitionNamesRule.ts @@ -0,0 +1,79 @@ +import { groupBy } from '../../jsutils/groupBy'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { + FieldDefinitionNode, + InputValueDefinitionNode, + NameNode, +} from '../../language/ast'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { SDLValidationContext } from '../ValidationContext'; + +/** + * Unique argument definition names + * + * A GraphQL Object or Interface type is only valid if all its fields have uniquely named arguments. + * A GraphQL Directive is only valid if all its arguments are uniquely named. + */ +export function UniqueArgumentDefinitionNamesRule( + context: SDLValidationContext, +): ASTVisitor { + return { + DirectiveDefinition(directiveNode) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const argumentNodes = directiveNode.arguments ?? []; + + return checkArgUniqueness(`@${directiveNode.name.value}`, argumentNodes); + }, + InterfaceTypeDefinition: checkArgUniquenessPerField, + InterfaceTypeExtension: checkArgUniquenessPerField, + ObjectTypeDefinition: checkArgUniquenessPerField, + ObjectTypeExtension: checkArgUniquenessPerField, + }; + + function checkArgUniquenessPerField(typeNode: { + readonly name: NameNode; + readonly fields?: ReadonlyArray; + }) { + const typeName = typeNode.name.value; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const fieldNodes = typeNode.fields ?? []; + + for (const fieldDef of fieldNodes) { + const fieldName = fieldDef.name.value; + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const argumentNodes = fieldDef.arguments ?? []; + + checkArgUniqueness(`${typeName}.${fieldName}`, argumentNodes); + } + + return false; + } + + function checkArgUniqueness( + parentName: string, + argumentNodes: ReadonlyArray, + ) { + const seenArgs = groupBy(argumentNodes, (arg) => arg.name.value); + + for (const [argName, argNodes] of seenArgs) { + if (argNodes.length > 1) { + context.reportError( + new GraphQLError( + `Argument "${parentName}(${argName}:)" can only be defined once.`, + argNodes.map((node) => node.name), + ), + ); + } + } + + return false; + } +} diff --git a/src/validation/rules/UniqueArgumentNamesRule.ts b/src/validation/rules/UniqueArgumentNamesRule.ts new file mode 100644 index 00000000..fad6ed0e --- /dev/null +++ b/src/validation/rules/UniqueArgumentNamesRule.ts @@ -0,0 +1,46 @@ +import { groupBy } from '../../jsutils/groupBy'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ArgumentNode } from '../../language/ast'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { ASTValidationContext } from '../ValidationContext'; + +/** + * Unique argument names + * + * A GraphQL field or directive is only valid if all supplied arguments are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Argument-Names + */ +export function UniqueArgumentNamesRule( + context: ASTValidationContext, +): ASTVisitor { + return { + Field: checkArgUniqueness, + Directive: checkArgUniqueness, + }; + + function checkArgUniqueness(parentNode: { + arguments?: ReadonlyArray; + }) { + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const argumentNodes = parentNode.arguments ?? []; + + const seenArgs = groupBy(argumentNodes, (arg) => arg.name.value); + + for (const [argName, argNodes] of seenArgs) { + if (argNodes.length > 1) { + context.reportError( + new GraphQLError( + `There can be only one argument named "${argName}".`, + argNodes.map((node) => node.name), + ), + ); + } + } + } +} diff --git a/src/validation/rules/UniqueDirectiveNamesRule.ts b/src/validation/rules/UniqueDirectiveNamesRule.ts new file mode 100644 index 00000000..cbd39ce2 --- /dev/null +++ b/src/validation/rules/UniqueDirectiveNamesRule.ts @@ -0,0 +1,46 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ASTVisitor } from '../../language/visitor'; + +import type { SDLValidationContext } from '../ValidationContext'; + +/** + * Unique directive names + * + * A GraphQL document is only valid if all defined directives have unique names. + */ +export function UniqueDirectiveNamesRule( + context: SDLValidationContext, +): ASTVisitor { + const knownDirectiveNames = Object.create(null); + const schema = context.getSchema(); + + return { + DirectiveDefinition(node) { + const directiveName = node.name.value; + + if (schema?.getDirective(directiveName)) { + context.reportError( + new GraphQLError( + `Directive "@${directiveName}" already exists in the schema. It cannot be redefined.`, + node.name, + ), + ); + return; + } + + if (knownDirectiveNames[directiveName]) { + context.reportError( + new GraphQLError( + `There can be only one directive named "@${directiveName}".`, + [knownDirectiveNames[directiveName], node.name], + ), + ); + } else { + knownDirectiveNames[directiveName] = node.name; + } + + return false; + }, + }; +} diff --git a/src/validation/rules/UniqueDirectivesPerLocationRule.ts b/src/validation/rules/UniqueDirectivesPerLocationRule.ts new file mode 100644 index 00000000..18b04c50 --- /dev/null +++ b/src/validation/rules/UniqueDirectivesPerLocationRule.ts @@ -0,0 +1,91 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import { Kind } from '../../language/kinds'; +import { + isTypeDefinitionNode, + isTypeExtensionNode, +} from '../../language/predicates'; +import type { ASTVisitor } from '../../language/visitor'; + +import { specifiedDirectives } from '../../type/directives'; + +import type { + SDLValidationContext, + ValidationContext, +} from '../ValidationContext'; + +/** + * Unique directive names per location + * + * A GraphQL document is only valid if all non-repeatable directives at + * a given location are uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Directives-Are-Unique-Per-Location + */ +export function UniqueDirectivesPerLocationRule( + context: ValidationContext | SDLValidationContext, +): ASTVisitor { + const uniqueDirectiveMap = Object.create(null); + + const schema = context.getSchema(); + const definedDirectives = schema + ? schema.getDirectives() + : specifiedDirectives; + for (const directive of definedDirectives) { + uniqueDirectiveMap[directive.name] = !directive.isRepeatable; + } + + const astDefinitions = context.getDocument().definitions; + for (const def of astDefinitions) { + if (def.kind === Kind.DIRECTIVE_DEFINITION) { + uniqueDirectiveMap[def.name.value] = !def.repeatable; + } + } + + const schemaDirectives = Object.create(null); + const typeDirectivesMap = Object.create(null); + + return { + // Many different AST nodes may contain directives. Rather than listing + // them all, just listen for entering any node, and check to see if it + // defines any directives. + enter(node) { + if (!('directives' in node) || !node.directives) { + return; + } + + let seenDirectives; + if ( + node.kind === Kind.SCHEMA_DEFINITION || + node.kind === Kind.SCHEMA_EXTENSION + ) { + seenDirectives = schemaDirectives; + } else if (isTypeDefinitionNode(node) || isTypeExtensionNode(node)) { + const typeName = node.name.value; + seenDirectives = typeDirectivesMap[typeName]; + if (seenDirectives === undefined) { + typeDirectivesMap[typeName] = seenDirectives = Object.create(null); + } + } else { + seenDirectives = Object.create(null); + } + + for (const directive of node.directives) { + const directiveName = directive.name.value; + + if (uniqueDirectiveMap[directiveName]) { + if (seenDirectives[directiveName]) { + context.reportError( + new GraphQLError( + `The directive "@${directiveName}" can only be used once at this location.`, + [seenDirectives[directiveName], directive], + ), + ); + } else { + seenDirectives[directiveName] = directive; + } + } + } + }, + }; +} diff --git a/src/validation/rules/UniqueEnumValueNamesRule.ts b/src/validation/rules/UniqueEnumValueNamesRule.ts new file mode 100644 index 00000000..5fbe62ce --- /dev/null +++ b/src/validation/rules/UniqueEnumValueNamesRule.ts @@ -0,0 +1,69 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { + EnumTypeDefinitionNode, + EnumTypeExtensionNode, +} from '../../language/ast'; +import type { ASTVisitor } from '../../language/visitor'; + +import { isEnumType } from '../../type/definition'; + +import type { SDLValidationContext } from '../ValidationContext'; + +/** + * Unique enum value names + * + * A GraphQL enum type is only valid if all its values are uniquely named. + */ +export function UniqueEnumValueNamesRule( + context: SDLValidationContext, +): ASTVisitor { + const schema = context.getSchema(); + const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); + const knownValueNames = Object.create(null); + + return { + EnumTypeDefinition: checkValueUniqueness, + EnumTypeExtension: checkValueUniqueness, + }; + + function checkValueUniqueness( + node: EnumTypeDefinitionNode | EnumTypeExtensionNode, + ) { + const typeName = node.name.value; + + if (!knownValueNames[typeName]) { + knownValueNames[typeName] = Object.create(null); + } + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const valueNodes = node.values ?? []; + const valueNames = knownValueNames[typeName]; + + for (const valueDef of valueNodes) { + const valueName = valueDef.name.value; + + const existingType = existingTypeMap[typeName]; + if (isEnumType(existingType) && existingType.getValue(valueName)) { + context.reportError( + new GraphQLError( + `Enum value "${typeName}.${valueName}" already exists in the schema. It cannot also be defined in this type extension.`, + valueDef.name, + ), + ); + } else if (valueNames[valueName]) { + context.reportError( + new GraphQLError( + `Enum value "${typeName}.${valueName}" can only be defined once.`, + [valueNames[valueName], valueDef.name], + ), + ); + } else { + valueNames[valueName] = valueDef.name; + } + } + + return false; + } +} diff --git a/src/validation/rules/UniqueFieldDefinitionNamesRule.ts b/src/validation/rules/UniqueFieldDefinitionNamesRule.ts new file mode 100644 index 00000000..f312b76d --- /dev/null +++ b/src/validation/rules/UniqueFieldDefinitionNamesRule.ts @@ -0,0 +1,88 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { + FieldDefinitionNode, + InputValueDefinitionNode, + NameNode, +} from '../../language/ast'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { GraphQLNamedType } from '../../type/definition'; +import { + isInputObjectType, + isInterfaceType, + isObjectType, +} from '../../type/definition'; + +import type { SDLValidationContext } from '../ValidationContext'; + +/** + * Unique field definition names + * + * A GraphQL complex type is only valid if all its fields are uniquely named. + */ +export function UniqueFieldDefinitionNamesRule( + context: SDLValidationContext, +): ASTVisitor { + const schema = context.getSchema(); + const existingTypeMap = schema ? schema.getTypeMap() : Object.create(null); + const knownFieldNames = Object.create(null); + + return { + InputObjectTypeDefinition: checkFieldUniqueness, + InputObjectTypeExtension: checkFieldUniqueness, + InterfaceTypeDefinition: checkFieldUniqueness, + InterfaceTypeExtension: checkFieldUniqueness, + ObjectTypeDefinition: checkFieldUniqueness, + ObjectTypeExtension: checkFieldUniqueness, + }; + + function checkFieldUniqueness(node: { + readonly name: NameNode; + readonly fields?: ReadonlyArray< + InputValueDefinitionNode | FieldDefinitionNode + >; + }) { + const typeName = node.name.value; + + if (!knownFieldNames[typeName]) { + knownFieldNames[typeName] = Object.create(null); + } + + // FIXME: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const fieldNodes = node.fields ?? []; + const fieldNames = knownFieldNames[typeName]; + + for (const fieldDef of fieldNodes) { + const fieldName = fieldDef.name.value; + + if (hasField(existingTypeMap[typeName], fieldName)) { + context.reportError( + new GraphQLError( + `Field "${typeName}.${fieldName}" already exists in the schema. It cannot also be defined in this type extension.`, + fieldDef.name, + ), + ); + } else if (fieldNames[fieldName]) { + context.reportError( + new GraphQLError( + `Field "${typeName}.${fieldName}" can only be defined once.`, + [fieldNames[fieldName], fieldDef.name], + ), + ); + } else { + fieldNames[fieldName] = fieldDef.name; + } + } + + return false; + } +} + +function hasField(type: GraphQLNamedType, fieldName: string): boolean { + if (isObjectType(type) || isInterfaceType(type) || isInputObjectType(type)) { + return type.getFields()[fieldName] != null; + } + return false; +} diff --git a/src/validation/rules/UniqueFragmentNamesRule.ts b/src/validation/rules/UniqueFragmentNamesRule.ts new file mode 100644 index 00000000..47e129e1 --- /dev/null +++ b/src/validation/rules/UniqueFragmentNamesRule.ts @@ -0,0 +1,35 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ASTVisitor } from '../../language/visitor'; + +import type { ASTValidationContext } from '../ValidationContext'; + +/** + * Unique fragment names + * + * A GraphQL document is only valid if all defined fragments have unique names. + * + * See https://spec.graphql.org/draft/#sec-Fragment-Name-Uniqueness + */ +export function UniqueFragmentNamesRule( + context: ASTValidationContext, +): ASTVisitor { + const knownFragmentNames = Object.create(null); + return { + OperationDefinition: () => false, + FragmentDefinition(node) { + const fragmentName = node.name.value; + if (knownFragmentNames[fragmentName]) { + context.reportError( + new GraphQLError( + `There can be only one fragment named "${fragmentName}".`, + [knownFragmentNames[fragmentName], node.name], + ), + ); + } else { + knownFragmentNames[fragmentName] = node.name; + } + return false; + }, + }; +} diff --git a/src/validation/rules/UniqueInputFieldNamesRule.ts b/src/validation/rules/UniqueInputFieldNamesRule.ts new file mode 100644 index 00000000..392df444 --- /dev/null +++ b/src/validation/rules/UniqueInputFieldNamesRule.ts @@ -0,0 +1,51 @@ +import { invariant } from '../../jsutils/invariant'; +import type { ObjMap } from '../../jsutils/ObjMap'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { NameNode } from '../../language/ast'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { ASTValidationContext } from '../ValidationContext'; + +/** + * Unique input field names + * + * A GraphQL input object value is only valid if all supplied fields are + * uniquely named. + * + * See https://spec.graphql.org/draft/#sec-Input-Object-Field-Uniqueness + */ +export function UniqueInputFieldNamesRule( + context: ASTValidationContext, +): ASTVisitor { + const knownNameStack: Array> = []; + let knownNames: ObjMap = Object.create(null); + + return { + ObjectValue: { + enter() { + knownNameStack.push(knownNames); + knownNames = Object.create(null); + }, + leave() { + const prevKnownNames = knownNameStack.pop(); + invariant(prevKnownNames); + knownNames = prevKnownNames; + }, + }, + ObjectField(node) { + const fieldName = node.name.value; + if (knownNames[fieldName]) { + context.reportError( + new GraphQLError( + `There can be only one input field named "${fieldName}".`, + [knownNames[fieldName], node.name], + ), + ); + } else { + knownNames[fieldName] = node.name; + } + }, + }; +} diff --git a/src/validation/rules/UniqueOperationNamesRule.ts b/src/validation/rules/UniqueOperationNamesRule.ts new file mode 100644 index 00000000..fb6b11cd --- /dev/null +++ b/src/validation/rules/UniqueOperationNamesRule.ts @@ -0,0 +1,37 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ASTVisitor } from '../../language/visitor'; + +import type { ASTValidationContext } from '../ValidationContext'; + +/** + * Unique operation names + * + * A GraphQL document is only valid if all defined operations have unique names. + * + * See https://spec.graphql.org/draft/#sec-Operation-Name-Uniqueness + */ +export function UniqueOperationNamesRule( + context: ASTValidationContext, +): ASTVisitor { + const knownOperationNames = Object.create(null); + return { + OperationDefinition(node) { + const operationName = node.name; + if (operationName) { + if (knownOperationNames[operationName.value]) { + context.reportError( + new GraphQLError( + `There can be only one operation named "${operationName.value}".`, + [knownOperationNames[operationName.value], operationName], + ), + ); + } else { + knownOperationNames[operationName.value] = operationName; + } + } + return false; + }, + FragmentDefinition: () => false, + }; +} diff --git a/src/validation/rules/UniqueOperationTypesRule.ts b/src/validation/rules/UniqueOperationTypesRule.ts new file mode 100644 index 00000000..59aa4c95 --- /dev/null +++ b/src/validation/rules/UniqueOperationTypesRule.ts @@ -0,0 +1,66 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { + SchemaDefinitionNode, + SchemaExtensionNode, +} from '../../language/ast'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { SDLValidationContext } from '../ValidationContext'; + +/** + * Unique operation types + * + * A GraphQL document is only valid if it has only one type per operation. + */ +export function UniqueOperationTypesRule( + context: SDLValidationContext, +): ASTVisitor { + const schema = context.getSchema(); + const definedOperationTypes = Object.create(null); + const existingOperationTypes = schema + ? { + query: schema.getQueryType(), + mutation: schema.getMutationType(), + subscription: schema.getSubscriptionType(), + } + : {}; + + return { + SchemaDefinition: checkOperationTypes, + SchemaExtension: checkOperationTypes, + }; + + function checkOperationTypes( + node: SchemaDefinitionNode | SchemaExtensionNode, + ) { + // See: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const operationTypesNodes = node.operationTypes ?? []; + + for (const operationType of operationTypesNodes) { + const operation = operationType.operation; + const alreadyDefinedOperationType = definedOperationTypes[operation]; + + if (existingOperationTypes[operation]) { + context.reportError( + new GraphQLError( + `Type for ${operation} already defined in the schema. It cannot be redefined.`, + operationType, + ), + ); + } else if (alreadyDefinedOperationType) { + context.reportError( + new GraphQLError( + `There can be only one ${operation} type in schema.`, + [alreadyDefinedOperationType, operationType], + ), + ); + } else { + definedOperationTypes[operation] = operationType; + } + } + + return false; + } +} diff --git a/src/validation/rules/UniqueTypeNamesRule.ts b/src/validation/rules/UniqueTypeNamesRule.ts new file mode 100644 index 00000000..7d11a320 --- /dev/null +++ b/src/validation/rules/UniqueTypeNamesRule.ts @@ -0,0 +1,52 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { TypeDefinitionNode } from '../../language/ast'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { SDLValidationContext } from '../ValidationContext'; + +/** + * Unique type names + * + * A GraphQL document is only valid if all defined types have unique names. + */ +export function UniqueTypeNamesRule(context: SDLValidationContext): ASTVisitor { + const knownTypeNames = Object.create(null); + const schema = context.getSchema(); + + return { + ScalarTypeDefinition: checkTypeName, + ObjectTypeDefinition: checkTypeName, + InterfaceTypeDefinition: checkTypeName, + UnionTypeDefinition: checkTypeName, + EnumTypeDefinition: checkTypeName, + InputObjectTypeDefinition: checkTypeName, + }; + + function checkTypeName(node: TypeDefinitionNode) { + const typeName = node.name.value; + + if (schema?.getType(typeName)) { + context.reportError( + new GraphQLError( + `Type "${typeName}" already exists in the schema. It cannot also be defined in this type definition.`, + node.name, + ), + ); + return; + } + + if (knownTypeNames[typeName]) { + context.reportError( + new GraphQLError(`There can be only one type named "${typeName}".`, [ + knownTypeNames[typeName], + node.name, + ]), + ); + } else { + knownTypeNames[typeName] = node.name; + } + + return false; + } +} diff --git a/src/validation/rules/UniqueVariableNamesRule.ts b/src/validation/rules/UniqueVariableNamesRule.ts new file mode 100644 index 00000000..1e9a5f8d --- /dev/null +++ b/src/validation/rules/UniqueVariableNamesRule.ts @@ -0,0 +1,40 @@ +import { groupBy } from '../../jsutils/groupBy'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ASTVisitor } from '../../language/visitor'; + +import type { ASTValidationContext } from '../ValidationContext'; + +/** + * Unique variable names + * + * A GraphQL operation is only valid if all its variables are uniquely named. + */ +export function UniqueVariableNamesRule( + context: ASTValidationContext, +): ASTVisitor { + return { + OperationDefinition(operationNode) { + // See: https://github.com/graphql/graphql-js/issues/2203 + /* c8 ignore next */ + const variableDefinitions = operationNode.variableDefinitions ?? []; + + const seenVariableDefinitions = groupBy( + variableDefinitions, + (node) => node.variable.name.value, + ); + + for (const [variableName, variableNodes] of seenVariableDefinitions) { + if (variableNodes.length > 1) { + context.reportError( + new GraphQLError( + `There can be only one variable named "$${variableName}".`, + variableNodes.map((node) => node.variable.name), + ), + ); + } + } + }, + }; +} diff --git a/src/validation/rules/ValuesOfCorrectTypeRule.ts b/src/validation/rules/ValuesOfCorrectTypeRule.ts new file mode 100644 index 00000000..158691c5 --- /dev/null +++ b/src/validation/rules/ValuesOfCorrectTypeRule.ts @@ -0,0 +1,157 @@ +import { didYouMean } from '../../jsutils/didYouMean'; +import { inspect } from '../../jsutils/inspect'; +import { keyMap } from '../../jsutils/keyMap'; +import { suggestionList } from '../../jsutils/suggestionList'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ValueNode } from '../../language/ast'; +import { print } from '../../language/printer'; +import type { ASTVisitor } from '../../language/visitor'; + +import { + getNamedType, + getNullableType, + isInputObjectType, + isLeafType, + isListType, + isNonNullType, + isRequiredInputField, +} from '../../type/definition'; + +import type { ValidationContext } from '../ValidationContext'; + +/** + * Value literals of correct type + * + * A GraphQL document is only valid if all value literals are of the type + * expected at their position. + * + * See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type + */ +export function ValuesOfCorrectTypeRule( + context: ValidationContext, +): ASTVisitor { + return { + ListValue(node) { + // Note: TypeInfo will traverse into a list's item type, so look to the + // parent input type to check if it is a list. + const type = getNullableType(context.getParentInputType()); + if (!isListType(type)) { + isValidValueNode(context, node); + return false; // Don't traverse further. + } + }, + ObjectValue(node) { + const type = getNamedType(context.getInputType()); + if (!isInputObjectType(type)) { + isValidValueNode(context, node); + return false; // Don't traverse further. + } + // Ensure every required field exists. + const fieldNodeMap = keyMap(node.fields, (field) => field.name.value); + for (const fieldDef of Object.values(type.getFields())) { + const fieldNode = fieldNodeMap[fieldDef.name]; + if (!fieldNode && isRequiredInputField(fieldDef)) { + const typeStr = inspect(fieldDef.type); + context.reportError( + new GraphQLError( + `Field "${type.name}.${fieldDef.name}" of required type "${typeStr}" was not provided.`, + node, + ), + ); + } + } + }, + ObjectField(node) { + const parentType = getNamedType(context.getParentInputType()); + const fieldType = context.getInputType(); + if (!fieldType && isInputObjectType(parentType)) { + const suggestions = suggestionList( + node.name.value, + Object.keys(parentType.getFields()), + ); + context.reportError( + new GraphQLError( + `Field "${node.name.value}" is not defined by type "${parentType.name}".` + + didYouMean(suggestions), + node, + ), + ); + } + }, + NullValue(node) { + const type = context.getInputType(); + if (isNonNullType(type)) { + context.reportError( + new GraphQLError( + `Expected value of type "${inspect(type)}", found ${print(node)}.`, + node, + ), + ); + } + }, + EnumValue: (node) => isValidValueNode(context, node), + IntValue: (node) => isValidValueNode(context, node), + FloatValue: (node) => isValidValueNode(context, node), + StringValue: (node) => isValidValueNode(context, node), + BooleanValue: (node) => isValidValueNode(context, node), + }; +} + +/** + * Any value literal may be a valid representation of a Scalar, depending on + * that scalar type. + */ +function isValidValueNode(context: ValidationContext, node: ValueNode): void { + // Report any error at the full type expected by the location. + const locationType = context.getInputType(); + if (!locationType) { + return; + } + + const type = getNamedType(locationType); + + if (!isLeafType(type)) { + const typeStr = inspect(locationType); + context.reportError( + new GraphQLError( + `Expected value of type "${typeStr}", found ${print(node)}.`, + node, + ), + ); + return; + } + + // Scalars and Enums determine if a literal value is valid via parseLiteral(), + // which may throw or return an invalid value to indicate failure. + try { + const parseResult = type.parseLiteral(node, undefined /* variables */); + if (parseResult === undefined) { + const typeStr = inspect(locationType); + context.reportError( + new GraphQLError( + `Expected value of type "${typeStr}", found ${print(node)}.`, + node, + ), + ); + } + } catch (error) { + const typeStr = inspect(locationType); + if (error instanceof GraphQLError) { + context.reportError(error); + } else { + context.reportError( + new GraphQLError( + `Expected value of type "${typeStr}", found ${print(node)}; ` + + error.message, + node, + undefined, + undefined, + undefined, + error, // Ensure a reference to the original error is maintained. + ), + ); + } + } +} diff --git a/src/validation/rules/VariablesAreInputTypesRule.ts b/src/validation/rules/VariablesAreInputTypesRule.ts new file mode 100644 index 00000000..bf830380 --- /dev/null +++ b/src/validation/rules/VariablesAreInputTypesRule.ts @@ -0,0 +1,41 @@ +import { GraphQLError } from '../../error/GraphQLError'; + +import type { VariableDefinitionNode } from '../../language/ast'; +import { print } from '../../language/printer'; +import type { ASTVisitor } from '../../language/visitor'; + +import { isInputType } from '../../type/definition'; + +import { typeFromAST } from '../../utilities/typeFromAST'; + +import type { ValidationContext } from '../ValidationContext'; + +/** + * Variables are input types + * + * A GraphQL operation is only valid if all the variables it defines are of + * input types (scalar, enum, or input object). + * + * See https://spec.graphql.org/draft/#sec-Variables-Are-Input-Types + */ +export function VariablesAreInputTypesRule( + context: ValidationContext, +): ASTVisitor { + return { + VariableDefinition(node: VariableDefinitionNode) { + const type = typeFromAST(context.getSchema(), node.type); + + if (type !== undefined && !isInputType(type)) { + const variableName = node.variable.name.value; + const typeName = print(node.type); + + context.reportError( + new GraphQLError( + `Variable "$${variableName}" cannot be non-input type "${typeName}".`, + node.type, + ), + ); + } + }, + }; +} diff --git a/src/validation/rules/VariablesInAllowedPositionRule.ts b/src/validation/rules/VariablesInAllowedPositionRule.ts new file mode 100644 index 00000000..d8d50025 --- /dev/null +++ b/src/validation/rules/VariablesInAllowedPositionRule.ts @@ -0,0 +1,102 @@ +import { inspect } from '../../jsutils/inspect'; +import type { Maybe } from '../../jsutils/Maybe'; + +import { GraphQLError } from '../../error/GraphQLError'; + +import type { ValueNode } from '../../language/ast'; +import { Kind } from '../../language/kinds'; +import type { ASTVisitor } from '../../language/visitor'; + +import type { GraphQLType } from '../../type/definition'; +import { isNonNullType } from '../../type/definition'; +import type { GraphQLSchema } from '../../type/schema'; + +import { isTypeSubTypeOf } from '../../utilities/typeComparators'; +import { typeFromAST } from '../../utilities/typeFromAST'; + +import type { ValidationContext } from '../ValidationContext'; + +/** + * Variables in allowed position + * + * Variable usages must be compatible with the arguments they are passed to. + * + * See https://spec.graphql.org/draft/#sec-All-Variable-Usages-are-Allowed + */ +export function VariablesInAllowedPositionRule( + context: ValidationContext, +): ASTVisitor { + let varDefMap = Object.create(null); + + return { + OperationDefinition: { + enter() { + varDefMap = Object.create(null); + }, + leave(operation) { + const usages = context.getRecursiveVariableUsages(operation); + + for (const { node, type, defaultValue } of usages) { + const varName = node.name.value; + const varDef = varDefMap[varName]; + if (varDef && type) { + // A var type is allowed if it is the same or more strict (e.g. is + // a subtype of) than the expected type. It can be more strict if + // the variable type is non-null when the expected type is nullable. + // If both are list types, the variable item type can be more strict + // than the expected item type (contravariant). + const schema = context.getSchema(); + const varType = typeFromAST(schema, varDef.type); + if ( + varType && + !allowedVariableUsage( + schema, + varType, + varDef.defaultValue, + type, + defaultValue, + ) + ) { + const varTypeStr = inspect(varType); + const typeStr = inspect(type); + context.reportError( + new GraphQLError( + `Variable "$${varName}" of type "${varTypeStr}" used in position expecting type "${typeStr}".`, + [varDef, node], + ), + ); + } + } + } + }, + }, + VariableDefinition(node) { + varDefMap[node.variable.name.value] = node; + }, + }; +} + +/** + * Returns true if the variable is allowed in the location it was found, + * which includes considering if default values exist for either the variable + * or the location at which it is located. + */ +function allowedVariableUsage( + schema: GraphQLSchema, + varType: GraphQLType, + varDefaultValue: Maybe, + locationType: GraphQLType, + locationDefaultValue: Maybe, +): boolean { + if (isNonNullType(locationType) && !isNonNullType(varType)) { + const hasNonNullVariableDefaultValue = + varDefaultValue != null && varDefaultValue.kind !== Kind.NULL; + const hasLocationDefaultValue = locationDefaultValue !== undefined; + if (!hasNonNullVariableDefaultValue && !hasLocationDefaultValue) { + return false; + } + const nullableLocationType = locationType.ofType; + return isTypeSubTypeOf(schema, varType, nullableLocationType); + } + return isTypeSubTypeOf(schema, varType, locationType); +} diff --git a/src/validation/rules/custom/NoDeprecatedCustomRule.ts b/src/validation/rules/custom/NoDeprecatedCustomRule.ts new file mode 100644 index 00000000..38b688a2 --- /dev/null +++ b/src/validation/rules/custom/NoDeprecatedCustomRule.ts @@ -0,0 +1,92 @@ +import { invariant } from '../../../jsutils/invariant'; + +import { GraphQLError } from '../../../error/GraphQLError'; + +import type { ASTVisitor } from '../../../language/visitor'; + +import { getNamedType, isInputObjectType } from '../../../type/definition'; + +import type { ValidationContext } from '../../ValidationContext'; + +/** + * No deprecated + * + * A GraphQL document is only valid if all selected fields and all used enum values have not been + * deprecated. + * + * Note: This rule is optional and is not part of the Validation section of the GraphQL + * Specification. The main purpose of this rule is detection of deprecated usages and not + * necessarily to forbid their use when querying a service. + */ +export function NoDeprecatedCustomRule(context: ValidationContext): ASTVisitor { + return { + Field(node) { + const fieldDef = context.getFieldDef(); + const deprecationReason = fieldDef?.deprecationReason; + if (fieldDef && deprecationReason != null) { + const parentType = context.getParentType(); + invariant(parentType != null); + context.reportError( + new GraphQLError( + `The field ${parentType.name}.${fieldDef.name} is deprecated. ${deprecationReason}`, + node, + ), + ); + } + }, + Argument(node) { + const argDef = context.getArgument(); + const deprecationReason = argDef?.deprecationReason; + if (argDef && deprecationReason != null) { + const directiveDef = context.getDirective(); + if (directiveDef != null) { + context.reportError( + new GraphQLError( + `Directive "@${directiveDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, + node, + ), + ); + } else { + const parentType = context.getParentType(); + const fieldDef = context.getFieldDef(); + invariant(parentType != null && fieldDef != null); + context.reportError( + new GraphQLError( + `Field "${parentType.name}.${fieldDef.name}" argument "${argDef.name}" is deprecated. ${deprecationReason}`, + node, + ), + ); + } + } + }, + ObjectField(node) { + const inputObjectDef = getNamedType(context.getParentInputType()); + if (isInputObjectType(inputObjectDef)) { + const inputFieldDef = inputObjectDef.getFields()[node.name.value]; + const deprecationReason = inputFieldDef?.deprecationReason; + if (deprecationReason != null) { + context.reportError( + new GraphQLError( + `The input field ${inputObjectDef.name}.${inputFieldDef.name} is deprecated. ${deprecationReason}`, + node, + ), + ); + } + } + }, + EnumValue(node) { + const enumValueDef = context.getEnumValue(); + const deprecationReason = enumValueDef?.deprecationReason; + if (enumValueDef && deprecationReason != null) { + const enumTypeDef = getNamedType(context.getInputType()); + invariant(enumTypeDef != null); + context.reportError( + new GraphQLError( + `The enum value "${enumTypeDef.name}.${enumValueDef.name}" is deprecated. ${deprecationReason}`, + node, + ), + ); + } + }, + }; +} diff --git a/src/validation/rules/custom/NoSchemaIntrospectionCustomRule.ts b/src/validation/rules/custom/NoSchemaIntrospectionCustomRule.ts new file mode 100644 index 00000000..7a1c1f2a --- /dev/null +++ b/src/validation/rules/custom/NoSchemaIntrospectionCustomRule.ts @@ -0,0 +1,37 @@ +import { GraphQLError } from '../../../error/GraphQLError'; + +import type { FieldNode } from '../../../language/ast'; +import type { ASTVisitor } from '../../../language/visitor'; + +import { getNamedType } from '../../../type/definition'; +import { isIntrospectionType } from '../../../type/introspection'; + +import type { ValidationContext } from '../../ValidationContext'; + +/** + * Prohibit introspection queries + * + * A GraphQL document is only valid if all fields selected are not fields that + * return an introspection type. + * + * Note: This rule is optional and is not part of the Validation section of the + * GraphQL Specification. This rule effectively disables introspection, which + * does not reflect best practices and should only be done if absolutely necessary. + */ +export function NoSchemaIntrospectionCustomRule( + context: ValidationContext, +): ASTVisitor { + return { + Field(node: FieldNode) { + const type = getNamedType(context.getType()); + if (type && isIntrospectionType(type)) { + context.reportError( + new GraphQLError( + `GraphQL introspection has been disabled, but the requested query contained the field "${node.name.value}".`, + node, + ), + ); + } + }, + }; +} diff --git a/src/validation/specifiedRules.ts b/src/validation/specifiedRules.ts new file mode 100644 index 00000000..16e555db --- /dev/null +++ b/src/validation/specifiedRules.ts @@ -0,0 +1,125 @@ +// Spec Section: "Executable Definitions" +import { ExecutableDefinitionsRule } from './rules/ExecutableDefinitionsRule'; +// Spec Section: "Field Selections on Objects, Interfaces, and Unions Types" +import { FieldsOnCorrectTypeRule } from './rules/FieldsOnCorrectTypeRule'; +// Spec Section: "Fragments on Composite Types" +import { FragmentsOnCompositeTypesRule } from './rules/FragmentsOnCompositeTypesRule'; +// Spec Section: "Argument Names" +import { + KnownArgumentNamesOnDirectivesRule, + KnownArgumentNamesRule, +} from './rules/KnownArgumentNamesRule'; +// Spec Section: "Directives Are Defined" +import { KnownDirectivesRule } from './rules/KnownDirectivesRule'; +// Spec Section: "Fragment spread target defined" +import { KnownFragmentNamesRule } from './rules/KnownFragmentNamesRule'; +// Spec Section: "Fragment Spread Type Existence" +import { KnownTypeNamesRule } from './rules/KnownTypeNamesRule'; +// Spec Section: "Lone Anonymous Operation" +import { LoneAnonymousOperationRule } from './rules/LoneAnonymousOperationRule'; +// SDL-specific validation rules +import { LoneSchemaDefinitionRule } from './rules/LoneSchemaDefinitionRule'; +// Spec Section: "Fragments must not form cycles" +import { NoFragmentCyclesRule } from './rules/NoFragmentCyclesRule'; +// Spec Section: "All Variable Used Defined" +import { NoUndefinedVariablesRule } from './rules/NoUndefinedVariablesRule'; +// Spec Section: "Fragments must be used" +import { NoUnusedFragmentsRule } from './rules/NoUnusedFragmentsRule'; +// Spec Section: "All Variables Used" +import { NoUnusedVariablesRule } from './rules/NoUnusedVariablesRule'; +// Spec Section: "Field Selection Merging" +import { OverlappingFieldsCanBeMergedRule } from './rules/OverlappingFieldsCanBeMergedRule'; +// Spec Section: "Fragment spread is possible" +import { PossibleFragmentSpreadsRule } from './rules/PossibleFragmentSpreadsRule'; +import { PossibleTypeExtensionsRule } from './rules/PossibleTypeExtensionsRule'; +// Spec Section: "Argument Optionality" +import { + ProvidedRequiredArgumentsOnDirectivesRule, + ProvidedRequiredArgumentsRule, +} from './rules/ProvidedRequiredArgumentsRule'; +// Spec Section: "Leaf Field Selections" +import { ScalarLeafsRule } from './rules/ScalarLeafsRule'; +// Spec Section: "Subscriptions with Single Root Field" +import { SingleFieldSubscriptionsRule } from './rules/SingleFieldSubscriptionsRule'; +import { UniqueArgumentDefinitionNamesRule } from './rules/UniqueArgumentDefinitionNamesRule'; +// Spec Section: "Argument Uniqueness" +import { UniqueArgumentNamesRule } from './rules/UniqueArgumentNamesRule'; +import { UniqueDirectiveNamesRule } from './rules/UniqueDirectiveNamesRule'; +// Spec Section: "Directives Are Unique Per Location" +import { UniqueDirectivesPerLocationRule } from './rules/UniqueDirectivesPerLocationRule'; +import { UniqueEnumValueNamesRule } from './rules/UniqueEnumValueNamesRule'; +import { UniqueFieldDefinitionNamesRule } from './rules/UniqueFieldDefinitionNamesRule'; +// Spec Section: "Fragment Name Uniqueness" +import { UniqueFragmentNamesRule } from './rules/UniqueFragmentNamesRule'; +// Spec Section: "Input Object Field Uniqueness" +import { UniqueInputFieldNamesRule } from './rules/UniqueInputFieldNamesRule'; +// Spec Section: "Operation Name Uniqueness" +import { UniqueOperationNamesRule } from './rules/UniqueOperationNamesRule'; +import { UniqueOperationTypesRule } from './rules/UniqueOperationTypesRule'; +import { UniqueTypeNamesRule } from './rules/UniqueTypeNamesRule'; +// Spec Section: "Variable Uniqueness" +import { UniqueVariableNamesRule } from './rules/UniqueVariableNamesRule'; +// Spec Section: "Value Type Correctness" +import { ValuesOfCorrectTypeRule } from './rules/ValuesOfCorrectTypeRule'; +// Spec Section: "Variables are Input Types" +import { VariablesAreInputTypesRule } from './rules/VariablesAreInputTypesRule'; +// Spec Section: "All Variable Usages Are Allowed" +import { VariablesInAllowedPositionRule } from './rules/VariablesInAllowedPositionRule'; +import type { SDLValidationRule, ValidationRule } from './ValidationContext'; + +/** + * This set includes all validation rules defined by the GraphQL spec. + * + * The order of the rules in this list has been adjusted to lead to the + * most clear output when encountering multiple validation errors. + */ +export const specifiedRules: ReadonlyArray = Object.freeze([ + ExecutableDefinitionsRule, + UniqueOperationNamesRule, + LoneAnonymousOperationRule, + SingleFieldSubscriptionsRule, + KnownTypeNamesRule, + FragmentsOnCompositeTypesRule, + VariablesAreInputTypesRule, + ScalarLeafsRule, + FieldsOnCorrectTypeRule, + UniqueFragmentNamesRule, + KnownFragmentNamesRule, + NoUnusedFragmentsRule, + PossibleFragmentSpreadsRule, + NoFragmentCyclesRule, + UniqueVariableNamesRule, + NoUndefinedVariablesRule, + NoUnusedVariablesRule, + KnownDirectivesRule, + UniqueDirectivesPerLocationRule, + KnownArgumentNamesRule, + UniqueArgumentNamesRule, + ValuesOfCorrectTypeRule, + ProvidedRequiredArgumentsRule, + VariablesInAllowedPositionRule, + OverlappingFieldsCanBeMergedRule, + UniqueInputFieldNamesRule, +]); + +/** + * @internal + */ +export const specifiedSDLRules: ReadonlyArray = + Object.freeze([ + LoneSchemaDefinitionRule, + UniqueOperationTypesRule, + UniqueTypeNamesRule, + UniqueEnumValueNamesRule, + UniqueFieldDefinitionNamesRule, + UniqueArgumentDefinitionNamesRule, + UniqueDirectiveNamesRule, + KnownTypeNamesRule, + KnownDirectivesRule, + UniqueDirectivesPerLocationRule, + PossibleTypeExtensionsRule, + KnownArgumentNamesOnDirectivesRule, + UniqueArgumentNamesRule, + UniqueInputFieldNamesRule, + ProvidedRequiredArgumentsOnDirectivesRule, + ]); diff --git a/src/validation/validate.ts b/src/validation/validate.ts new file mode 100644 index 00000000..72598742 --- /dev/null +++ b/src/validation/validate.ts @@ -0,0 +1,137 @@ +import { devAssert } from '../jsutils/devAssert'; +import type { Maybe } from '../jsutils/Maybe'; + +import { GraphQLError } from '../error/GraphQLError'; + +import type { DocumentNode } from '../language/ast'; +import { visit, visitInParallel } from '../language/visitor'; + +import type { GraphQLSchema } from '../type/schema'; +import { assertValidSchema } from '../type/validate'; + +import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo'; + +import { specifiedRules, specifiedSDLRules } from './specifiedRules'; +import type { SDLValidationRule, ValidationRule } from './ValidationContext'; +import { SDLValidationContext, ValidationContext } from './ValidationContext'; + +/** + * Implements the "Validation" section of the spec. + * + * Validation runs synchronously, returning an array of encountered errors, or + * an empty array if no errors were encountered and the document is valid. + * + * A list of specific validation rules may be provided. If not provided, the + * default list of rules defined by the GraphQL specification will be used. + * + * Each validation rules is a function which returns a visitor + * (see the language/visitor API). Visitor methods are expected to return + * GraphQLErrors, or Arrays of GraphQLErrors when invalid. + * + * Validate will stop validation after a `maxErrors` limit has been reached. + * Attackers can send pathologically invalid queries to induce a DoS attack, + * so by default `maxErrors` set to 100 errors. + * + * Optionally a custom TypeInfo instance may be provided. If not provided, one + * will be created from the provided schema. + */ +export function validate( + schema: GraphQLSchema, + documentAST: DocumentNode, + rules: ReadonlyArray = specifiedRules, + options?: { maxErrors?: number }, + + /** @deprecated will be removed in 17.0.0 */ + typeInfo: TypeInfo = new TypeInfo(schema), +): ReadonlyArray { + const maxErrors = options?.maxErrors ?? 100; + + devAssert(documentAST, 'Must provide document.'); + // If the schema used for validation is invalid, throw an error. + assertValidSchema(schema); + + const abortObj = Object.freeze({}); + const errors: Array = []; + const context = new ValidationContext( + schema, + documentAST, + typeInfo, + (error) => { + if (errors.length >= maxErrors) { + errors.push( + new GraphQLError( + 'Too many validation errors, error limit reached. Validation aborted.', + ), + ); + // eslint-disable-next-line @typescript-eslint/no-throw-literal + throw abortObj; + } + errors.push(error); + }, + ); + + // This uses a specialized visitor which runs multiple visitors in parallel, + // while maintaining the visitor skip and break API. + const visitor = visitInParallel(rules.map((rule) => rule(context))); + + // Visit the whole document with each instance of all provided rules. + try { + visit(documentAST, visitWithTypeInfo(typeInfo, visitor)); + } catch (e) { + if (e !== abortObj) { + throw e; + } + } + return errors; +} + +/** + * @internal + */ +export function validateSDL( + documentAST: DocumentNode, + schemaToExtend?: Maybe, + rules: ReadonlyArray = specifiedSDLRules, +): ReadonlyArray { + const errors: Array = []; + const context = new SDLValidationContext( + documentAST, + schemaToExtend, + (error) => { + errors.push(error); + }, + ); + + const visitors = rules.map((rule) => rule(context)); + visit(documentAST, visitInParallel(visitors)); + return errors; +} + +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ +export function assertValidSDL(documentAST: DocumentNode): void { + const errors = validateSDL(documentAST); + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} + +/** + * Utility function which asserts a SDL document is valid by throwing an error + * if it is invalid. + * + * @internal + */ +export function assertValidSDLExtension( + documentAST: DocumentNode, + schema: GraphQLSchema, +): void { + const errors = validateSDL(documentAST, schema); + if (errors.length !== 0) { + throw new Error(errors.map((error) => error.message).join('\n\n')); + } +} diff --git a/src/version.ts b/src/version.ts new file mode 100644 index 00000000..f1f2c1b6 --- /dev/null +++ b/src/version.ts @@ -0,0 +1,17 @@ +// Note: This file is autogenerated using "resources/gen-version.js" script and +// automatically updated by "npm version" command. + +/** + * A string containing the version of the GraphQL.js library + */ +export const version = '16.2.0' as string; + +/** + * An object containing the components of the GraphQL.js version string + */ +export const versionInfo = Object.freeze({ + major: 16 as number, + minor: 2 as number, + patch: 0 as number, + preReleaseTag: null as string | null, +}); diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..8dfb0f47 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,14 @@ +{ + "include": ["src/**/*"], + "compilerOptions": { + "module": "commonjs", + "lib": ["es2019", "es2020.promise", "es2020.bigint", "es2020.string"], + "target": "es2019", + "strict": true, + "useUnknownInCatchVariables": false, + "noEmit": true, + "isolatedModules": true, + "importsNotUsedAsValues": "error", + "forceConsistentCasingInFileNames": true + } +}