@quantiya/codevibe-claude-plugin 1.0.37 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/plugin.json +1 -1
- package/bin/codevibe-claude +17 -3
- package/dist/server.js +8 -7
- package/hooks/stop.sh +30 -10
- package/node_modules/@quantiya/codevibe-core/dist/appsync/appsync-client.d.ts +1 -139
- package/node_modules/@quantiya/codevibe-core/dist/appsync/queries.d.ts +0 -5
- package/node_modules/@quantiya/codevibe-core/dist/auth/auth-telemetry.d.ts +64 -29
- package/node_modules/@quantiya/codevibe-core/dist/index.d.ts +0 -4
- package/node_modules/@quantiya/codevibe-core/dist/index.js +33 -194
- package/node_modules/@quantiya/codevibe-core/dist/keychain/keychain-manager.d.ts +16 -2
- package/node_modules/@quantiya/codevibe-core/dist/session/session-rekey.d.ts +40 -0
- package/node_modules/@quantiya/codevibe-core/dist/session/session-resume.d.ts +1 -0
- package/node_modules/@quantiya/codevibe-core/dist/types/index.d.ts +0 -2
- package/node_modules/@quantiya/codevibe-core/dist/types/session.d.ts +0 -16
- package/node_modules/@quantiya/codevibe-core/package.json +1 -1
- package/node_modules/body-parser/README.md +18 -18
- package/node_modules/body-parser/index.js +6 -15
- package/node_modules/body-parser/lib/read.js +17 -20
- package/node_modules/body-parser/lib/types/json.js +8 -16
- package/node_modules/body-parser/lib/types/raw.js +3 -4
- package/node_modules/body-parser/lib/types/text.js +3 -4
- package/node_modules/body-parser/lib/types/urlencoded.js +8 -8
- package/node_modules/body-parser/lib/utils.js +11 -9
- package/node_modules/body-parser/package.json +2 -2
- package/node_modules/content-disposition/README.md +7 -8
- package/node_modules/content-disposition/index.js +118 -40
- package/node_modules/content-disposition/package.json +8 -11
- package/node_modules/express/Readme.md +39 -29
- package/node_modules/express/lib/application.js +1 -1
- package/node_modules/express/lib/request.js +5 -6
- package/node_modules/express/lib/response.js +14 -0
- package/node_modules/express/lib/utils.js +3 -1
- package/node_modules/express/package.json +6 -5
- package/node_modules/finalhandler/HISTORY.md +6 -0
- package/node_modules/finalhandler/README.md +26 -23
- package/node_modules/finalhandler/package.json +13 -9
- package/node_modules/graphql/execution/execute.d.ts +14 -1
- package/node_modules/graphql/execution/execute.js +63 -13
- package/node_modules/graphql/execution/execute.mjs +63 -13
- package/node_modules/graphql/execution/subscribe.js +1 -0
- package/node_modules/graphql/execution/subscribe.mjs +2 -0
- package/node_modules/graphql/execution/values.js +4 -4
- package/node_modules/graphql/execution/values.mjs +4 -4
- package/node_modules/graphql/index.d.ts +1 -0
- package/node_modules/graphql/language/ast.d.ts +10 -1
- package/node_modules/graphql/language/ast.js +8 -1
- package/node_modules/graphql/language/ast.mjs +8 -1
- package/node_modules/graphql/language/directiveLocation.d.ts +1 -0
- package/node_modules/graphql/language/directiveLocation.js +1 -0
- package/node_modules/graphql/language/directiveLocation.mjs +1 -0
- package/node_modules/graphql/language/index.d.ts +1 -0
- package/node_modules/graphql/language/kinds.d.ts +1 -0
- package/node_modules/graphql/language/kinds.js +1 -0
- package/node_modules/graphql/language/kinds.mjs +1 -0
- package/node_modules/graphql/language/parser.d.ts +14 -0
- package/node_modules/graphql/language/parser.js +33 -0
- package/node_modules/graphql/language/parser.mjs +33 -0
- package/node_modules/graphql/language/predicates.js +3 -1
- package/node_modules/graphql/language/predicates.mjs +5 -1
- package/node_modules/graphql/language/printer.js +13 -1
- package/node_modules/graphql/language/printer.mjs +13 -1
- package/node_modules/graphql/package.json +1 -1
- package/node_modules/graphql/type/directives.d.ts +9 -1
- package/node_modules/graphql/type/directives.js +10 -1
- package/node_modules/graphql/type/directives.mjs +10 -1
- package/node_modules/graphql/type/introspection.js +24 -1
- package/node_modules/graphql/type/introspection.mjs +24 -1
- package/node_modules/graphql/utilities/buildASTSchema.js +4 -0
- package/node_modules/graphql/utilities/buildASTSchema.mjs +4 -0
- package/node_modules/graphql/utilities/buildClientSchema.js +1 -0
- package/node_modules/graphql/utilities/buildClientSchema.mjs +1 -0
- package/node_modules/graphql/utilities/coerceInputValue.js +2 -2
- package/node_modules/graphql/utilities/coerceInputValue.mjs +2 -2
- package/node_modules/graphql/utilities/extendSchema.js +58 -3
- package/node_modules/graphql/utilities/extendSchema.mjs +58 -3
- package/node_modules/graphql/utilities/getIntrospectionQuery.d.ts +16 -0
- package/node_modules/graphql/utilities/getIntrospectionQuery.js +31 -38
- package/node_modules/graphql/utilities/getIntrospectionQuery.mjs +31 -38
- package/node_modules/graphql/utilities/introspectionFromSchema.js +1 -0
- package/node_modules/graphql/utilities/introspectionFromSchema.mjs +1 -0
- package/node_modules/graphql/utilities/printSchema.js +1 -0
- package/node_modules/graphql/utilities/printSchema.mjs +1 -0
- package/node_modules/graphql/utilities/valueFromAST.js +12 -2
- package/node_modules/graphql/utilities/valueFromAST.mjs +12 -2
- package/node_modules/graphql/validation/rules/KnownDirectivesRule.js +4 -0
- package/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs +4 -0
- package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +12 -0
- package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs +12 -0
- package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js +5 -11
- package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs +5 -11
- package/node_modules/graphql/validation/validate.js +12 -0
- package/node_modules/graphql/validation/validate.mjs +13 -2
- package/node_modules/graphql/version.js +2 -2
- package/node_modules/graphql/version.mjs +2 -2
- package/node_modules/hasown/CHANGELOG.md +11 -0
- package/node_modules/hasown/eslint.config.mjs +6 -0
- package/node_modules/hasown/index.d.ts +1 -0
- package/node_modules/hasown/package.json +14 -14
- package/node_modules/iconv-lite/lib/index.d.ts +114 -26
- package/node_modules/iconv-lite/lib/index.js +39 -40
- package/node_modules/iconv-lite/package.json +13 -2
- package/node_modules/iconv-lite/types/encodings.d.ts +423 -0
- package/node_modules/node-abi/abi_registry.json +10 -3
- package/node_modules/{semver → node-abi/node_modules/semver}/README.md +19 -4
- package/node_modules/{semver → node-abi/node_modules/semver}/bin/semver.js +14 -10
- package/node_modules/node-abi/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/{semver → node-abi/node_modules/semver}/index.js +2 -0
- package/node_modules/{semver → node-abi/node_modules/semver}/internal/re.js +1 -1
- package/node_modules/{semver → node-abi/node_modules/semver}/package.json +3 -3
- package/node_modules/{semver → node-abi/node_modules/semver}/range.bnf +5 -4
- package/node_modules/node-abi/package.json +1 -1
- package/node_modules/path-to-regexp/Readme.md +3 -3
- package/node_modules/path-to-regexp/dist/index.d.ts +3 -0
- package/node_modules/path-to-regexp/dist/index.js +215 -193
- package/node_modules/path-to-regexp/dist/index.js.map +1 -1
- package/node_modules/path-to-regexp/package.json +2 -2
- package/node_modules/qs/.editorconfig +1 -1
- package/node_modules/qs/.github/SECURITY.md +11 -0
- package/node_modules/qs/.github/THREAT_MODEL.md +78 -0
- package/node_modules/qs/CHANGELOG.md +190 -0
- package/node_modules/qs/README.md +29 -4
- package/node_modules/qs/dist/qs.js +21 -21
- package/node_modules/qs/eslint.config.mjs +56 -0
- package/node_modules/qs/lib/parse.js +94 -49
- package/node_modules/qs/lib/utils.js +85 -11
- package/node_modules/qs/package.json +10 -9
- package/node_modules/qs/test/parse.js +391 -13
- package/node_modules/qs/test/stringify.js +16 -3
- package/node_modules/qs/test/utils.js +173 -3
- package/node_modules/send/package.json +11 -8
- package/node_modules/serve-static/README.md +23 -23
- package/node_modules/serve-static/package.json +6 -3
- package/node_modules/side-channel-list/CHANGELOG.md +25 -4
- package/node_modules/side-channel-list/index.js +1 -3
- package/node_modules/side-channel-list/package.json +8 -8
- package/node_modules/side-channel-list/test/index.js +50 -0
- package/node_modules/uuid/dist/v35.js +3 -0
- package/node_modules/uuid/dist/v6.js +3 -0
- package/node_modules/uuid/dist-node/v35.js +3 -0
- package/node_modules/uuid/dist-node/v6.js +3 -0
- package/node_modules/uuid/package.json +1 -1
- package/node_modules/ws/index.js +15 -6
- package/node_modules/ws/lib/constants.js +1 -0
- package/node_modules/ws/lib/permessage-deflate.js +6 -6
- package/node_modules/ws/lib/websocket-server.js +10 -6
- package/node_modules/ws/lib/websocket.js +19 -14
- package/node_modules/ws/package.json +4 -3
- package/node_modules/ws/wrapper.mjs +14 -1
- package/package.json +2 -2
- package/node_modules/@quantiya/codevibe-core/dist/appsync/__tests__/appsync-client.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/audit-keys/__tests__/audit-keys-parity.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/audit-keys/index.d.ts +0 -41
- package/node_modules/@quantiya/codevibe-core/dist/auth/__tests__/auth-telemetry.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-bootstrap.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-failure-recourse.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-save.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-seat-picker.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-telemetry.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-test-agents.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-types.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/setup-wizard.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/__tests__/v1-options.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/detect-agents.d.ts +0 -56
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/index.d.ts +0 -3
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/orchestration-cli.d.ts +0 -12
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-bootstrap.d.ts +0 -146
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-failure-recourse.d.ts +0 -23
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-save.d.ts +0 -47
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-seat-picker.d.ts +0 -72
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-telemetry.d.ts +0 -54
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-test-agents.d.ts +0 -108
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-types.d.ts +0 -140
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/setup-wizard.d.ts +0 -57
- package/node_modules/@quantiya/codevibe-core/dist/orchestration/v1-options.d.ts +0 -108
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/__tests__/integration.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/__tests__/mocks.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/__tests__/output-parser.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/__tests__/registry.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/__tests__/subprocess.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/index.d.ts +0 -15
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/mocks.d.ts +0 -80
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/output-parser.d.ts +0 -95
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/provider.d.ts +0 -153
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/__tests__/claude-live-smoke.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/__tests__/claude.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/__tests__/codex-live-smoke.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/__tests__/codex.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/__tests__/gemini-live-smoke.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/__tests__/gemini.test.d.ts +0 -1
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/claude.d.ts +0 -59
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/codex.d.ts +0 -67
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/common.d.ts +0 -25
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/providers/gemini.d.ts +0 -108
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/registry.d.ts +0 -87
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/subprocess.d.ts +0 -117
- package/node_modules/@quantiya/codevibe-core/dist/reviewer/types.d.ts +0 -101
- package/node_modules/@quantiya/codevibe-core/dist/types/orchestration.d.ts +0 -57
- package/node_modules/@quantiya/codevibe-core/dist/types/reviewer.d.ts +0 -67
- package/node_modules/content-disposition/HISTORY.md +0 -72
- package/node_modules/express/History.md +0 -3858
- package/node_modules/hasown/.eslintrc +0 -5
- package/node_modules/iconv-lite/Changelog.md +0 -236
- package/node_modules/qs/.eslintrc +0 -39
- package/node_modules/send/HISTORY.md +0 -580
- package/node_modules/serve-static/HISTORY.md +0 -516
- /package/node_modules/{semver → node-abi/node_modules/semver}/LICENSE +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/classes/comparator.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/classes/index.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/classes/range.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/classes/semver.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/clean.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/cmp.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/coerce.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/compare-build.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/compare-loose.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/compare.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/diff.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/eq.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/gt.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/gte.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/inc.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/lt.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/lte.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/major.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/minor.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/neq.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/parse.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/patch.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/prerelease.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/rcompare.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/rsort.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/satisfies.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/sort.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/functions/valid.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/constants.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/debug.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/identifiers.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/lrucache.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/internal/parse-options.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/preload.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/gtr.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/intersects.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/ltr.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/max-satisfying.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/min-satisfying.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/min-version.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/outside.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/simplify.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/subset.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/to-comparators.js +0 -0
- /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/valid.js +0 -0
- /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/index.js +0 -0
- /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/license +0 -0
- /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/package.json +0 -0
- /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/readme.md +0 -0
|
@@ -87,7 +87,8 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
87
87
|
|
|
88
88
|
// Collect the type definitions and extensions found in the document.
|
|
89
89
|
const typeDefs = [];
|
|
90
|
-
const typeExtensionsMap = Object.create(null);
|
|
90
|
+
const typeExtensionsMap = Object.create(null);
|
|
91
|
+
const directiveExtensionsMap = Object.create(null); // New directives and types are separate because a directives and types can
|
|
91
92
|
// have the same name. For example, a type named "skip".
|
|
92
93
|
|
|
93
94
|
const directiveDefs = [];
|
|
@@ -110,6 +111,14 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
110
111
|
: [def];
|
|
111
112
|
} else if (def.kind === Kind.DIRECTIVE_DEFINITION) {
|
|
112
113
|
directiveDefs.push(def);
|
|
114
|
+
} else if (def.kind === Kind.DIRECTIVE_EXTENSION) {
|
|
115
|
+
const extendedDirectiveName = def.name.value;
|
|
116
|
+
const existingDirectiveExtensions =
|
|
117
|
+
directiveExtensionsMap[extendedDirectiveName];
|
|
118
|
+
directiveExtensionsMap[extendedDirectiveName] =
|
|
119
|
+
existingDirectiveExtensions
|
|
120
|
+
? existingDirectiveExtensions.concat([def])
|
|
121
|
+
: [def];
|
|
113
122
|
}
|
|
114
123
|
} // If this document contains no new types, extensions, or directives then
|
|
115
124
|
// return the same unmodified GraphQLSchema instance.
|
|
@@ -117,6 +126,7 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
117
126
|
if (
|
|
118
127
|
Object.keys(typeExtensionsMap).length === 0 &&
|
|
119
128
|
typeDefs.length === 0 &&
|
|
129
|
+
Object.keys(directiveExtensionsMap).length === 0 &&
|
|
120
130
|
directiveDefs.length === 0 &&
|
|
121
131
|
schemaExtensions.length === 0 &&
|
|
122
132
|
schemaDef == null
|
|
@@ -141,6 +151,12 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
141
151
|
: buildType(typeNode);
|
|
142
152
|
}
|
|
143
153
|
|
|
154
|
+
const directiveMap = Object.create(null);
|
|
155
|
+
|
|
156
|
+
for (const existingDirective of schemaConfig.directives) {
|
|
157
|
+
directiveMap[existingDirective.name] = extendDirective(existingDirective);
|
|
158
|
+
}
|
|
159
|
+
|
|
144
160
|
const operationTypes = {
|
|
145
161
|
// Get the extended root operation types.
|
|
146
162
|
query: schemaConfig.query && replaceNamedType(schemaConfig.query),
|
|
@@ -152,6 +168,8 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
152
168
|
...getOperationTypes(schemaExtensions),
|
|
153
169
|
}; // Then produce and return a Schema config with these types.
|
|
154
170
|
|
|
171
|
+
const directives = Object.values(directiveMap); // will be `Array<GraphQLDirective>`
|
|
172
|
+
|
|
155
173
|
return {
|
|
156
174
|
description:
|
|
157
175
|
(_schemaDef = schemaDef) === null || _schemaDef === void 0
|
|
@@ -163,7 +181,7 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
163
181
|
...operationTypes,
|
|
164
182
|
types: Object.values(typeMap),
|
|
165
183
|
directives: [
|
|
166
|
-
...
|
|
184
|
+
...directives.map(replaceDirective),
|
|
167
185
|
...directiveDefs.map(buildDirective),
|
|
168
186
|
],
|
|
169
187
|
extensions: Object.create(null),
|
|
@@ -415,6 +433,29 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
415
433
|
return opTypes;
|
|
416
434
|
}
|
|
417
435
|
|
|
436
|
+
function extendDirective(directive) {
|
|
437
|
+
var _directiveExtensionsM, _config$deprecationRe;
|
|
438
|
+
|
|
439
|
+
const config = directive.toConfig();
|
|
440
|
+
const extensions =
|
|
441
|
+
(_directiveExtensionsM = directiveExtensionsMap[config.name]) !== null &&
|
|
442
|
+
_directiveExtensionsM !== void 0
|
|
443
|
+
? _directiveExtensionsM
|
|
444
|
+
: [];
|
|
445
|
+
const deprecationReason =
|
|
446
|
+
(_config$deprecationRe = config.deprecationReason) !== null &&
|
|
447
|
+
_config$deprecationRe !== void 0
|
|
448
|
+
? _config$deprecationRe
|
|
449
|
+
: extensions
|
|
450
|
+
.map((ext) => getDeprecationReason(ext))
|
|
451
|
+
.find((reason) => reason != null);
|
|
452
|
+
return new GraphQLDirective({
|
|
453
|
+
...config,
|
|
454
|
+
deprecationReason,
|
|
455
|
+
extensionASTNodes: config.extensionASTNodes.concat(extensions),
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
|
|
418
459
|
function getNamedType(node) {
|
|
419
460
|
var _stdTypeMap$name2;
|
|
420
461
|
|
|
@@ -445,8 +486,20 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
445
486
|
}
|
|
446
487
|
|
|
447
488
|
function buildDirective(node) {
|
|
448
|
-
var _node$description;
|
|
489
|
+
var _directiveExtensionsM2, _getDeprecationReason, _node$description;
|
|
449
490
|
|
|
491
|
+
const extensions =
|
|
492
|
+
(_directiveExtensionsM2 = directiveExtensionsMap[node.name.value]) !==
|
|
493
|
+
null && _directiveExtensionsM2 !== void 0
|
|
494
|
+
? _directiveExtensionsM2
|
|
495
|
+
: [];
|
|
496
|
+
const deprecationReason =
|
|
497
|
+
(_getDeprecationReason = getDeprecationReason(node)) !== null &&
|
|
498
|
+
_getDeprecationReason !== void 0
|
|
499
|
+
? _getDeprecationReason
|
|
500
|
+
: extensions
|
|
501
|
+
.map((ext) => getDeprecationReason(ext))
|
|
502
|
+
.find((reason) => reason != null);
|
|
450
503
|
return new GraphQLDirective({
|
|
451
504
|
name: node.name.value,
|
|
452
505
|
description:
|
|
@@ -458,7 +511,9 @@ export function extendSchemaImpl(schemaConfig, documentAST, options) {
|
|
|
458
511
|
locations: node.locations.map(({ value }) => value),
|
|
459
512
|
isRepeatable: node.repeatable,
|
|
460
513
|
args: buildArgumentMap(node.arguments),
|
|
514
|
+
deprecationReason,
|
|
461
515
|
astNode: node,
|
|
516
|
+
extensionASTNodes: extensions,
|
|
462
517
|
});
|
|
463
518
|
}
|
|
464
519
|
|
|
@@ -26,11 +26,25 @@ export interface IntrospectionOptions {
|
|
|
26
26
|
* Default: false
|
|
27
27
|
*/
|
|
28
28
|
inputValueDeprecation?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Whether target GraphQL server supports deprecation of directives.
|
|
31
|
+
* Default: false
|
|
32
|
+
*/
|
|
33
|
+
experimentalDirectiveDeprecation?: boolean;
|
|
29
34
|
/**
|
|
30
35
|
* Whether target GraphQL server supports `@oneOf` input objects.
|
|
31
36
|
* Default: false
|
|
32
37
|
*/
|
|
33
38
|
oneOf?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* How deep to recurse into nested types, larger values will result in more
|
|
41
|
+
* accurate results, but have a higher load on the server.
|
|
42
|
+
* Some servers might restrict the maximum query depth or complexity.
|
|
43
|
+
* If that's the case, try decreasing this value.
|
|
44
|
+
*
|
|
45
|
+
* Default: 9
|
|
46
|
+
*/
|
|
47
|
+
typeDepth?: number;
|
|
34
48
|
}
|
|
35
49
|
/**
|
|
36
50
|
* Produce the GraphQL query recommended for a full schema introspection.
|
|
@@ -183,6 +197,8 @@ export interface IntrospectionDirective {
|
|
|
183
197
|
readonly name: string;
|
|
184
198
|
readonly description?: Maybe<string>;
|
|
185
199
|
readonly isRepeatable?: boolean;
|
|
200
|
+
readonly isDeprecated?: boolean;
|
|
201
|
+
readonly deprecationReason?: Maybe<string>;
|
|
186
202
|
readonly locations: ReadonlyArray<DirectiveLocation>;
|
|
187
203
|
readonly args: ReadonlyArray<IntrospectionInputValue>;
|
|
188
204
|
}
|
|
@@ -16,7 +16,9 @@ function getIntrospectionQuery(options) {
|
|
|
16
16
|
directiveIsRepeatable: false,
|
|
17
17
|
schemaDescription: false,
|
|
18
18
|
inputValueDeprecation: false,
|
|
19
|
+
experimentalDirectiveDeprecation: false,
|
|
19
20
|
oneOf: false,
|
|
21
|
+
typeDepth: 9,
|
|
20
22
|
...options,
|
|
21
23
|
};
|
|
22
24
|
const descriptions = optionsWithDefault.descriptions ? 'description' : '';
|
|
@@ -34,7 +36,30 @@ function getIntrospectionQuery(options) {
|
|
|
34
36
|
return optionsWithDefault.inputValueDeprecation ? str : '';
|
|
35
37
|
}
|
|
36
38
|
|
|
39
|
+
function experimentalDirectiveDeprecation(str) {
|
|
40
|
+
return optionsWithDefault.experimentalDirectiveDeprecation ? str : '';
|
|
41
|
+
}
|
|
42
|
+
|
|
37
43
|
const oneOf = optionsWithDefault.oneOf ? 'isOneOf' : '';
|
|
44
|
+
|
|
45
|
+
function ofType(level, indent) {
|
|
46
|
+
if (level <= 0) {
|
|
47
|
+
return '';
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (level > 100) {
|
|
51
|
+
throw new Error(
|
|
52
|
+
'Please set typeDepth to a reasonable value between 0 and 100; the default is 9.',
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return `
|
|
57
|
+
${indent}ofType {
|
|
58
|
+
${indent} name
|
|
59
|
+
${indent} kind${ofType(level - 1, indent + ' ')}
|
|
60
|
+
${indent}}`;
|
|
61
|
+
}
|
|
62
|
+
|
|
38
63
|
return `
|
|
39
64
|
query IntrospectionQuery {
|
|
40
65
|
__schema {
|
|
@@ -45,10 +70,14 @@ function getIntrospectionQuery(options) {
|
|
|
45
70
|
types {
|
|
46
71
|
...FullType
|
|
47
72
|
}
|
|
48
|
-
directives
|
|
73
|
+
directives${experimentalDirectiveDeprecation(
|
|
74
|
+
'(includeDeprecated: true)',
|
|
75
|
+
)} {
|
|
49
76
|
name
|
|
50
77
|
${descriptions}
|
|
51
78
|
${directiveIsRepeatable}
|
|
79
|
+
${experimentalDirectiveDeprecation('isDeprecated')}
|
|
80
|
+
${experimentalDirectiveDeprecation('deprecationReason')}
|
|
52
81
|
locations
|
|
53
82
|
args${inputDeprecation('(includeDeprecated: true)')} {
|
|
54
83
|
...InputValue
|
|
@@ -103,43 +132,7 @@ function getIntrospectionQuery(options) {
|
|
|
103
132
|
|
|
104
133
|
fragment TypeRef on __Type {
|
|
105
134
|
kind
|
|
106
|
-
name
|
|
107
|
-
ofType {
|
|
108
|
-
kind
|
|
109
|
-
name
|
|
110
|
-
ofType {
|
|
111
|
-
kind
|
|
112
|
-
name
|
|
113
|
-
ofType {
|
|
114
|
-
kind
|
|
115
|
-
name
|
|
116
|
-
ofType {
|
|
117
|
-
kind
|
|
118
|
-
name
|
|
119
|
-
ofType {
|
|
120
|
-
kind
|
|
121
|
-
name
|
|
122
|
-
ofType {
|
|
123
|
-
kind
|
|
124
|
-
name
|
|
125
|
-
ofType {
|
|
126
|
-
kind
|
|
127
|
-
name
|
|
128
|
-
ofType {
|
|
129
|
-
kind
|
|
130
|
-
name
|
|
131
|
-
ofType {
|
|
132
|
-
kind
|
|
133
|
-
name
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
135
|
+
name${ofType(optionsWithDefault.typeDepth, ' ')}
|
|
143
136
|
}
|
|
144
137
|
`;
|
|
145
138
|
}
|
|
@@ -9,7 +9,9 @@ export function getIntrospectionQuery(options) {
|
|
|
9
9
|
directiveIsRepeatable: false,
|
|
10
10
|
schemaDescription: false,
|
|
11
11
|
inputValueDeprecation: false,
|
|
12
|
+
experimentalDirectiveDeprecation: false,
|
|
12
13
|
oneOf: false,
|
|
14
|
+
typeDepth: 9,
|
|
13
15
|
...options,
|
|
14
16
|
};
|
|
15
17
|
const descriptions = optionsWithDefault.descriptions ? 'description' : '';
|
|
@@ -27,7 +29,30 @@ export function getIntrospectionQuery(options) {
|
|
|
27
29
|
return optionsWithDefault.inputValueDeprecation ? str : '';
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
function experimentalDirectiveDeprecation(str) {
|
|
33
|
+
return optionsWithDefault.experimentalDirectiveDeprecation ? str : '';
|
|
34
|
+
}
|
|
35
|
+
|
|
30
36
|
const oneOf = optionsWithDefault.oneOf ? 'isOneOf' : '';
|
|
37
|
+
|
|
38
|
+
function ofType(level, indent) {
|
|
39
|
+
if (level <= 0) {
|
|
40
|
+
return '';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (level > 100) {
|
|
44
|
+
throw new Error(
|
|
45
|
+
'Please set typeDepth to a reasonable value between 0 and 100; the default is 9.',
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return `
|
|
50
|
+
${indent}ofType {
|
|
51
|
+
${indent} name
|
|
52
|
+
${indent} kind${ofType(level - 1, indent + ' ')}
|
|
53
|
+
${indent}}`;
|
|
54
|
+
}
|
|
55
|
+
|
|
31
56
|
return `
|
|
32
57
|
query IntrospectionQuery {
|
|
33
58
|
__schema {
|
|
@@ -38,10 +63,14 @@ export function getIntrospectionQuery(options) {
|
|
|
38
63
|
types {
|
|
39
64
|
...FullType
|
|
40
65
|
}
|
|
41
|
-
directives
|
|
66
|
+
directives${experimentalDirectiveDeprecation(
|
|
67
|
+
'(includeDeprecated: true)',
|
|
68
|
+
)} {
|
|
42
69
|
name
|
|
43
70
|
${descriptions}
|
|
44
71
|
${directiveIsRepeatable}
|
|
72
|
+
${experimentalDirectiveDeprecation('isDeprecated')}
|
|
73
|
+
${experimentalDirectiveDeprecation('deprecationReason')}
|
|
45
74
|
locations
|
|
46
75
|
args${inputDeprecation('(includeDeprecated: true)')} {
|
|
47
76
|
...InputValue
|
|
@@ -96,43 +125,7 @@ export function getIntrospectionQuery(options) {
|
|
|
96
125
|
|
|
97
126
|
fragment TypeRef on __Type {
|
|
98
127
|
kind
|
|
99
|
-
name
|
|
100
|
-
ofType {
|
|
101
|
-
kind
|
|
102
|
-
name
|
|
103
|
-
ofType {
|
|
104
|
-
kind
|
|
105
|
-
name
|
|
106
|
-
ofType {
|
|
107
|
-
kind
|
|
108
|
-
name
|
|
109
|
-
ofType {
|
|
110
|
-
kind
|
|
111
|
-
name
|
|
112
|
-
ofType {
|
|
113
|
-
kind
|
|
114
|
-
name
|
|
115
|
-
ofType {
|
|
116
|
-
kind
|
|
117
|
-
name
|
|
118
|
-
ofType {
|
|
119
|
-
kind
|
|
120
|
-
name
|
|
121
|
-
ofType {
|
|
122
|
-
kind
|
|
123
|
-
name
|
|
124
|
-
ofType {
|
|
125
|
-
kind
|
|
126
|
-
name
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
128
|
+
name${ofType(optionsWithDefault.typeDepth, ' ')}
|
|
136
129
|
}
|
|
137
130
|
`;
|
|
138
131
|
}
|
|
@@ -286,6 +286,7 @@ function printDirective(directive) {
|
|
|
286
286
|
'directive @' +
|
|
287
287
|
directive.name +
|
|
288
288
|
printArgs(directive.args) +
|
|
289
|
+
printDeprecated(directive.deprecationReason) +
|
|
289
290
|
(directive.isRepeatable ? ' repeatable' : '') +
|
|
290
291
|
' on ' +
|
|
291
292
|
directive.locations.join(' | ')
|
|
@@ -262,6 +262,7 @@ function printDirective(directive) {
|
|
|
262
262
|
'directive @' +
|
|
263
263
|
directive.name +
|
|
264
264
|
printArgs(directive.args) +
|
|
265
|
+
printDeprecated(directive.deprecationReason) +
|
|
265
266
|
(directive.isRepeatable ? ' repeatable' : '') +
|
|
266
267
|
' on ' +
|
|
267
268
|
directive.locations.join(' | ')
|
|
@@ -45,7 +45,11 @@ function valueFromAST(valueNode, type, variables) {
|
|
|
45
45
|
if (valueNode.kind === _kinds.Kind.VARIABLE) {
|
|
46
46
|
const variableName = valueNode.name.value;
|
|
47
47
|
|
|
48
|
-
if (
|
|
48
|
+
if (
|
|
49
|
+
variables == null ||
|
|
50
|
+
variables[variableName] === undefined ||
|
|
51
|
+
!hasOwnProperty(variables, variableName)
|
|
52
|
+
) {
|
|
49
53
|
// No valid return value.
|
|
50
54
|
return;
|
|
51
55
|
}
|
|
@@ -192,6 +196,12 @@ function valueFromAST(valueNode, type, variables) {
|
|
|
192
196
|
function isMissingVariable(valueNode, variables) {
|
|
193
197
|
return (
|
|
194
198
|
valueNode.kind === _kinds.Kind.VARIABLE &&
|
|
195
|
-
(variables == null ||
|
|
199
|
+
(variables == null ||
|
|
200
|
+
variables[valueNode.name.value] === undefined ||
|
|
201
|
+
!hasOwnProperty(variables, valueNode.name.value))
|
|
196
202
|
);
|
|
197
203
|
}
|
|
204
|
+
|
|
205
|
+
function hasOwnProperty(obj, prop) {
|
|
206
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
207
|
+
}
|
|
@@ -39,7 +39,11 @@ export function valueFromAST(valueNode, type, variables) {
|
|
|
39
39
|
if (valueNode.kind === Kind.VARIABLE) {
|
|
40
40
|
const variableName = valueNode.name.value;
|
|
41
41
|
|
|
42
|
-
if (
|
|
42
|
+
if (
|
|
43
|
+
variables == null ||
|
|
44
|
+
variables[variableName] === undefined ||
|
|
45
|
+
!hasOwnProperty(variables, variableName)
|
|
46
|
+
) {
|
|
43
47
|
// No valid return value.
|
|
44
48
|
return;
|
|
45
49
|
}
|
|
@@ -179,6 +183,12 @@ export function valueFromAST(valueNode, type, variables) {
|
|
|
179
183
|
function isMissingVariable(valueNode, variables) {
|
|
180
184
|
return (
|
|
181
185
|
valueNode.kind === Kind.VARIABLE &&
|
|
182
|
-
(variables == null ||
|
|
186
|
+
(variables == null ||
|
|
187
|
+
variables[valueNode.name.value] === undefined ||
|
|
188
|
+
!hasOwnProperty(variables, valueNode.name.value))
|
|
183
189
|
);
|
|
184
190
|
}
|
|
191
|
+
|
|
192
|
+
function hasOwnProperty(obj, prop) {
|
|
193
|
+
return Object.prototype.hasOwnProperty.call(obj, prop);
|
|
194
|
+
}
|
|
@@ -140,6 +140,10 @@ function getDirectiveLocationForASTPath(ancestors) {
|
|
|
140
140
|
? _directiveLocation.DirectiveLocation.INPUT_FIELD_DEFINITION
|
|
141
141
|
: _directiveLocation.DirectiveLocation.ARGUMENT_DEFINITION;
|
|
142
142
|
}
|
|
143
|
+
|
|
144
|
+
case _kinds.Kind.DIRECTIVE_DEFINITION:
|
|
145
|
+
case _kinds.Kind.DIRECTIVE_EXTENSION:
|
|
146
|
+
return _directiveLocation.DirectiveLocation.DIRECTIVE_DEFINITION;
|
|
143
147
|
// Not reachable, all possible types have been considered.
|
|
144
148
|
|
|
145
149
|
/* c8 ignore next */
|
|
@@ -127,6 +127,10 @@ function getDirectiveLocationForASTPath(ancestors) {
|
|
|
127
127
|
? DirectiveLocation.INPUT_FIELD_DEFINITION
|
|
128
128
|
: DirectiveLocation.ARGUMENT_DEFINITION;
|
|
129
129
|
}
|
|
130
|
+
|
|
131
|
+
case Kind.DIRECTIVE_DEFINITION:
|
|
132
|
+
case Kind.DIRECTIVE_EXTENSION:
|
|
133
|
+
return DirectiveLocation.DIRECTIVE_DEFINITION;
|
|
130
134
|
// Not reachable, all possible types have been considered.
|
|
131
135
|
|
|
132
136
|
/* c8 ignore next */
|
|
@@ -42,6 +42,7 @@ function UniqueDirectivesPerLocationRule(context) {
|
|
|
42
42
|
|
|
43
43
|
const schemaDirectives = Object.create(null);
|
|
44
44
|
const typeDirectivesMap = Object.create(null);
|
|
45
|
+
const directiveDirectivesMap = Object.create(null);
|
|
45
46
|
return {
|
|
46
47
|
// Many different AST nodes may contain directives. Rather than listing
|
|
47
48
|
// them all, just listen for entering any node, and check to see if it
|
|
@@ -68,6 +69,17 @@ function UniqueDirectivesPerLocationRule(context) {
|
|
|
68
69
|
if (seenDirectives === undefined) {
|
|
69
70
|
typeDirectivesMap[typeName] = seenDirectives = Object.create(null);
|
|
70
71
|
}
|
|
72
|
+
} else if (
|
|
73
|
+
node.kind === _kinds.Kind.DIRECTIVE_DEFINITION ||
|
|
74
|
+
node.kind === _kinds.Kind.DIRECTIVE_EXTENSION
|
|
75
|
+
) {
|
|
76
|
+
const directiveName = node.name.value;
|
|
77
|
+
seenDirectives = directiveDirectivesMap[directiveName];
|
|
78
|
+
|
|
79
|
+
if (seenDirectives === undefined) {
|
|
80
|
+
directiveDirectivesMap[directiveName] = seenDirectives =
|
|
81
|
+
Object.create(null);
|
|
82
|
+
}
|
|
71
83
|
} else {
|
|
72
84
|
seenDirectives = Object.create(null);
|
|
73
85
|
}
|
|
@@ -35,6 +35,7 @@ export function UniqueDirectivesPerLocationRule(context) {
|
|
|
35
35
|
|
|
36
36
|
const schemaDirectives = Object.create(null);
|
|
37
37
|
const typeDirectivesMap = Object.create(null);
|
|
38
|
+
const directiveDirectivesMap = Object.create(null);
|
|
38
39
|
return {
|
|
39
40
|
// Many different AST nodes may contain directives. Rather than listing
|
|
40
41
|
// them all, just listen for entering any node, and check to see if it
|
|
@@ -58,6 +59,17 @@ export function UniqueDirectivesPerLocationRule(context) {
|
|
|
58
59
|
if (seenDirectives === undefined) {
|
|
59
60
|
typeDirectivesMap[typeName] = seenDirectives = Object.create(null);
|
|
60
61
|
}
|
|
62
|
+
} else if (
|
|
63
|
+
node.kind === Kind.DIRECTIVE_DEFINITION ||
|
|
64
|
+
node.kind === Kind.DIRECTIVE_EXTENSION
|
|
65
|
+
) {
|
|
66
|
+
const directiveName = node.name.value;
|
|
67
|
+
seenDirectives = directiveDirectivesMap[directiveName];
|
|
68
|
+
|
|
69
|
+
if (seenDirectives === undefined) {
|
|
70
|
+
directiveDirectivesMap[directiveName] = seenDirectives =
|
|
71
|
+
Object.create(null);
|
|
72
|
+
}
|
|
61
73
|
} else {
|
|
62
74
|
seenDirectives = Object.create(null);
|
|
63
75
|
}
|
|
@@ -30,18 +30,7 @@ var _definition = require('../../type/definition.js');
|
|
|
30
30
|
* See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type
|
|
31
31
|
*/
|
|
32
32
|
function ValuesOfCorrectTypeRule(context) {
|
|
33
|
-
let variableDefinitions = {};
|
|
34
33
|
return {
|
|
35
|
-
OperationDefinition: {
|
|
36
|
-
enter() {
|
|
37
|
-
variableDefinitions = {};
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
VariableDefinition(definition) {
|
|
42
|
-
variableDefinitions[definition.variable.name.value] = definition;
|
|
43
|
-
},
|
|
44
|
-
|
|
45
34
|
ListValue(node) {
|
|
46
35
|
// Note: TypeInfo will traverse into a list's item type, so look to the
|
|
47
36
|
// parent input type to check if it is a list.
|
|
@@ -132,6 +121,11 @@ function ValuesOfCorrectTypeRule(context) {
|
|
|
132
121
|
EnumValue: (node) => isValidValueNode(context, node),
|
|
133
122
|
IntValue: (node) => isValidValueNode(context, node),
|
|
134
123
|
FloatValue: (node) => isValidValueNode(context, node),
|
|
124
|
+
// Descriptions are string values that would not validate according
|
|
125
|
+
// to the below logic, but since (per the specification) descriptions must
|
|
126
|
+
// not affect validation, they are ignored entirely when visiting the AST
|
|
127
|
+
// and do not require special handling.
|
|
128
|
+
// See https://spec.graphql.org/draft/#sec-Descriptions
|
|
135
129
|
StringValue: (node) => isValidValueNode(context, node),
|
|
136
130
|
BooleanValue: (node) => isValidValueNode(context, node),
|
|
137
131
|
};
|
|
@@ -24,18 +24,7 @@ import {
|
|
|
24
24
|
* See https://spec.graphql.org/draft/#sec-Values-of-Correct-Type
|
|
25
25
|
*/
|
|
26
26
|
export function ValuesOfCorrectTypeRule(context) {
|
|
27
|
-
let variableDefinitions = {};
|
|
28
27
|
return {
|
|
29
|
-
OperationDefinition: {
|
|
30
|
-
enter() {
|
|
31
|
-
variableDefinitions = {};
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
VariableDefinition(definition) {
|
|
36
|
-
variableDefinitions[definition.variable.name.value] = definition;
|
|
37
|
-
},
|
|
38
|
-
|
|
39
28
|
ListValue(node) {
|
|
40
29
|
// Note: TypeInfo will traverse into a list's item type, so look to the
|
|
41
30
|
// parent input type to check if it is a list.
|
|
@@ -117,6 +106,11 @@ export function ValuesOfCorrectTypeRule(context) {
|
|
|
117
106
|
EnumValue: (node) => isValidValueNode(context, node),
|
|
118
107
|
IntValue: (node) => isValidValueNode(context, node),
|
|
119
108
|
FloatValue: (node) => isValidValueNode(context, node),
|
|
109
|
+
// Descriptions are string values that would not validate according
|
|
110
|
+
// to the below logic, but since (per the specification) descriptions must
|
|
111
|
+
// not affect validation, they are ignored entirely when visiting the AST
|
|
112
|
+
// and do not require special handling.
|
|
113
|
+
// See https://spec.graphql.org/draft/#sec-Descriptions
|
|
120
114
|
StringValue: (node) => isValidValueNode(context, node),
|
|
121
115
|
BooleanValue: (node) => isValidValueNode(context, node),
|
|
122
116
|
};
|
|
@@ -10,8 +10,12 @@ exports.validateSDL = validateSDL;
|
|
|
10
10
|
|
|
11
11
|
var _devAssert = require('../jsutils/devAssert.js');
|
|
12
12
|
|
|
13
|
+
var _mapValue = require('../jsutils/mapValue.js');
|
|
14
|
+
|
|
13
15
|
var _GraphQLError = require('../error/GraphQLError.js');
|
|
14
16
|
|
|
17
|
+
var _ast = require('../language/ast.js');
|
|
18
|
+
|
|
15
19
|
var _visitor = require('../language/visitor.js');
|
|
16
20
|
|
|
17
21
|
var _validate = require('../type/validate.js');
|
|
@@ -22,6 +26,12 @@ var _specifiedRules = require('./specifiedRules.js');
|
|
|
22
26
|
|
|
23
27
|
var _ValidationContext = require('./ValidationContext.js');
|
|
24
28
|
|
|
29
|
+
// Per the specification, descriptions must not affect validation.
|
|
30
|
+
// See https://spec.graphql.org/draft/#sec-Descriptions
|
|
31
|
+
const QueryDocumentKeysToValidate = (0, _mapValue.mapValue)(
|
|
32
|
+
_ast.QueryDocumentKeys,
|
|
33
|
+
(keys) => keys.filter((key) => key !== 'description'),
|
|
34
|
+
);
|
|
25
35
|
/**
|
|
26
36
|
* Implements the "Validation" section of the spec.
|
|
27
37
|
*
|
|
@@ -42,6 +52,7 @@ var _ValidationContext = require('./ValidationContext.js');
|
|
|
42
52
|
* Optionally a custom TypeInfo instance may be provided. If not provided, one
|
|
43
53
|
* will be created from the provided schema.
|
|
44
54
|
*/
|
|
55
|
+
|
|
45
56
|
function validate(
|
|
46
57
|
schema,
|
|
47
58
|
documentAST,
|
|
@@ -91,6 +102,7 @@ function validate(
|
|
|
91
102
|
(0, _visitor.visit)(
|
|
92
103
|
documentAST,
|
|
93
104
|
(0, _TypeInfo.visitWithTypeInfo)(typeInfo, visitor),
|
|
105
|
+
QueryDocumentKeysToValidate,
|
|
94
106
|
);
|
|
95
107
|
} catch (e) {
|
|
96
108
|
if (e !== abortObj) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { devAssert } from '../jsutils/devAssert.mjs';
|
|
2
|
+
import { mapValue } from '../jsutils/mapValue.mjs';
|
|
2
3
|
import { GraphQLError } from '../error/GraphQLError.mjs';
|
|
4
|
+
import { QueryDocumentKeys } from '../language/ast.mjs';
|
|
3
5
|
import { visit, visitInParallel } from '../language/visitor.mjs';
|
|
4
6
|
import { assertValidSchema } from '../type/validate.mjs';
|
|
5
7
|
import { TypeInfo, visitWithTypeInfo } from '../utilities/TypeInfo.mjs';
|
|
@@ -7,7 +9,12 @@ import { specifiedRules, specifiedSDLRules } from './specifiedRules.mjs';
|
|
|
7
9
|
import {
|
|
8
10
|
SDLValidationContext,
|
|
9
11
|
ValidationContext,
|
|
10
|
-
} from './ValidationContext.mjs';
|
|
12
|
+
} from './ValidationContext.mjs'; // Per the specification, descriptions must not affect validation.
|
|
13
|
+
// See https://spec.graphql.org/draft/#sec-Descriptions
|
|
14
|
+
|
|
15
|
+
const QueryDocumentKeysToValidate = mapValue(QueryDocumentKeys, (keys) =>
|
|
16
|
+
keys.filter((key) => key !== 'description'),
|
|
17
|
+
);
|
|
11
18
|
/**
|
|
12
19
|
* Implements the "Validation" section of the spec.
|
|
13
20
|
*
|
|
@@ -73,7 +80,11 @@ export function validate(
|
|
|
73
80
|
const visitor = visitInParallel(rules.map((rule) => rule(context))); // Visit the whole document with each instance of all provided rules.
|
|
74
81
|
|
|
75
82
|
try {
|
|
76
|
-
visit(
|
|
83
|
+
visit(
|
|
84
|
+
documentAST,
|
|
85
|
+
visitWithTypeInfo(typeInfo, visitor),
|
|
86
|
+
QueryDocumentKeysToValidate,
|
|
87
|
+
);
|
|
77
88
|
} catch (e) {
|
|
78
89
|
if (e !== abortObj) {
|
|
79
90
|
throw e;
|
|
@@ -10,7 +10,7 @@ exports.versionInfo = exports.version = void 0;
|
|
|
10
10
|
/**
|
|
11
11
|
* A string containing the version of the GraphQL.js library
|
|
12
12
|
*/
|
|
13
|
-
const version = '16.
|
|
13
|
+
const version = '16.14.0';
|
|
14
14
|
/**
|
|
15
15
|
* An object containing the components of the GraphQL.js version string
|
|
16
16
|
*/
|
|
@@ -18,7 +18,7 @@ const version = '16.12.0';
|
|
|
18
18
|
exports.version = version;
|
|
19
19
|
const versionInfo = Object.freeze({
|
|
20
20
|
major: 16,
|
|
21
|
-
minor:
|
|
21
|
+
minor: 14,
|
|
22
22
|
patch: 0,
|
|
23
23
|
preReleaseTag: null,
|
|
24
24
|
});
|