@quantiya/codevibe-claude-plugin 1.0.36 → 1.0.38

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.
Files changed (201) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/bin/codevibe-claude +17 -3
  3. package/dist/server.js +13 -13
  4. package/hooks/stop.sh +30 -10
  5. package/node_modules/@quantiya/codevibe-core/dist/auth/auth-telemetry.d.ts +56 -0
  6. package/node_modules/@quantiya/codevibe-core/dist/index.js +30 -30
  7. package/node_modules/@quantiya/codevibe-core/dist/keychain/keychain-manager.d.ts +16 -2
  8. package/node_modules/@quantiya/codevibe-core/dist/session/session-rekey.d.ts +40 -0
  9. package/node_modules/@quantiya/codevibe-core/dist/session/session-resume.d.ts +1 -0
  10. package/node_modules/@quantiya/codevibe-core/package.json +1 -1
  11. package/node_modules/body-parser/README.md +18 -18
  12. package/node_modules/body-parser/index.js +6 -15
  13. package/node_modules/body-parser/lib/read.js +17 -20
  14. package/node_modules/body-parser/lib/types/json.js +8 -16
  15. package/node_modules/body-parser/lib/types/raw.js +3 -4
  16. package/node_modules/body-parser/lib/types/text.js +3 -4
  17. package/node_modules/body-parser/lib/types/urlencoded.js +8 -8
  18. package/node_modules/body-parser/lib/utils.js +11 -9
  19. package/node_modules/body-parser/package.json +2 -2
  20. package/node_modules/content-disposition/README.md +7 -8
  21. package/node_modules/content-disposition/index.js +118 -40
  22. package/node_modules/content-disposition/package.json +8 -11
  23. package/node_modules/express/Readme.md +39 -29
  24. package/node_modules/express/lib/application.js +1 -1
  25. package/node_modules/express/lib/request.js +5 -6
  26. package/node_modules/express/lib/response.js +14 -0
  27. package/node_modules/express/lib/utils.js +3 -1
  28. package/node_modules/express/package.json +6 -5
  29. package/node_modules/finalhandler/HISTORY.md +6 -0
  30. package/node_modules/finalhandler/README.md +26 -23
  31. package/node_modules/finalhandler/package.json +13 -9
  32. package/node_modules/graphql/execution/execute.d.ts +14 -1
  33. package/node_modules/graphql/execution/execute.js +63 -13
  34. package/node_modules/graphql/execution/execute.mjs +63 -13
  35. package/node_modules/graphql/execution/subscribe.js +1 -0
  36. package/node_modules/graphql/execution/subscribe.mjs +2 -0
  37. package/node_modules/graphql/execution/values.js +4 -4
  38. package/node_modules/graphql/execution/values.mjs +4 -4
  39. package/node_modules/graphql/index.d.ts +1 -0
  40. package/node_modules/graphql/language/ast.d.ts +10 -1
  41. package/node_modules/graphql/language/ast.js +8 -1
  42. package/node_modules/graphql/language/ast.mjs +8 -1
  43. package/node_modules/graphql/language/directiveLocation.d.ts +1 -0
  44. package/node_modules/graphql/language/directiveLocation.js +1 -0
  45. package/node_modules/graphql/language/directiveLocation.mjs +1 -0
  46. package/node_modules/graphql/language/index.d.ts +1 -0
  47. package/node_modules/graphql/language/kinds.d.ts +1 -0
  48. package/node_modules/graphql/language/kinds.js +1 -0
  49. package/node_modules/graphql/language/kinds.mjs +1 -0
  50. package/node_modules/graphql/language/parser.d.ts +14 -0
  51. package/node_modules/graphql/language/parser.js +33 -0
  52. package/node_modules/graphql/language/parser.mjs +33 -0
  53. package/node_modules/graphql/language/predicates.js +3 -1
  54. package/node_modules/graphql/language/predicates.mjs +5 -1
  55. package/node_modules/graphql/language/printer.js +13 -1
  56. package/node_modules/graphql/language/printer.mjs +13 -1
  57. package/node_modules/graphql/package.json +1 -1
  58. package/node_modules/graphql/type/directives.d.ts +9 -1
  59. package/node_modules/graphql/type/directives.js +10 -1
  60. package/node_modules/graphql/type/directives.mjs +10 -1
  61. package/node_modules/graphql/type/introspection.js +24 -1
  62. package/node_modules/graphql/type/introspection.mjs +24 -1
  63. package/node_modules/graphql/utilities/buildASTSchema.js +4 -0
  64. package/node_modules/graphql/utilities/buildASTSchema.mjs +4 -0
  65. package/node_modules/graphql/utilities/buildClientSchema.js +1 -0
  66. package/node_modules/graphql/utilities/buildClientSchema.mjs +1 -0
  67. package/node_modules/graphql/utilities/coerceInputValue.js +2 -2
  68. package/node_modules/graphql/utilities/coerceInputValue.mjs +2 -2
  69. package/node_modules/graphql/utilities/extendSchema.js +58 -3
  70. package/node_modules/graphql/utilities/extendSchema.mjs +58 -3
  71. package/node_modules/graphql/utilities/getIntrospectionQuery.d.ts +16 -0
  72. package/node_modules/graphql/utilities/getIntrospectionQuery.js +31 -38
  73. package/node_modules/graphql/utilities/getIntrospectionQuery.mjs +31 -38
  74. package/node_modules/graphql/utilities/introspectionFromSchema.js +1 -0
  75. package/node_modules/graphql/utilities/introspectionFromSchema.mjs +1 -0
  76. package/node_modules/graphql/utilities/printSchema.js +1 -0
  77. package/node_modules/graphql/utilities/printSchema.mjs +1 -0
  78. package/node_modules/graphql/utilities/valueFromAST.js +12 -2
  79. package/node_modules/graphql/utilities/valueFromAST.mjs +12 -2
  80. package/node_modules/graphql/validation/rules/KnownDirectivesRule.js +4 -0
  81. package/node_modules/graphql/validation/rules/KnownDirectivesRule.mjs +4 -0
  82. package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.js +12 -0
  83. package/node_modules/graphql/validation/rules/UniqueDirectivesPerLocationRule.mjs +12 -0
  84. package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.js +5 -11
  85. package/node_modules/graphql/validation/rules/ValuesOfCorrectTypeRule.mjs +5 -11
  86. package/node_modules/graphql/validation/validate.js +12 -0
  87. package/node_modules/graphql/validation/validate.mjs +13 -2
  88. package/node_modules/graphql/version.js +2 -2
  89. package/node_modules/graphql/version.mjs +2 -2
  90. package/node_modules/hasown/CHANGELOG.md +11 -0
  91. package/node_modules/hasown/eslint.config.mjs +6 -0
  92. package/node_modules/hasown/index.d.ts +1 -0
  93. package/node_modules/hasown/package.json +14 -14
  94. package/node_modules/iconv-lite/lib/index.d.ts +114 -26
  95. package/node_modules/iconv-lite/lib/index.js +39 -40
  96. package/node_modules/iconv-lite/package.json +13 -2
  97. package/node_modules/iconv-lite/types/encodings.d.ts +423 -0
  98. package/node_modules/node-abi/abi_registry.json +10 -3
  99. package/node_modules/{semver → node-abi/node_modules/semver}/README.md +19 -4
  100. package/node_modules/{semver → node-abi/node_modules/semver}/bin/semver.js +14 -10
  101. package/node_modules/node-abi/node_modules/semver/functions/truncate.js +48 -0
  102. package/node_modules/{semver → node-abi/node_modules/semver}/index.js +2 -0
  103. package/node_modules/{semver → node-abi/node_modules/semver}/internal/re.js +1 -1
  104. package/node_modules/{semver → node-abi/node_modules/semver}/package.json +3 -3
  105. package/node_modules/{semver → node-abi/node_modules/semver}/range.bnf +5 -4
  106. package/node_modules/node-abi/package.json +1 -1
  107. package/node_modules/path-to-regexp/Readme.md +3 -3
  108. package/node_modules/path-to-regexp/dist/index.d.ts +3 -0
  109. package/node_modules/path-to-regexp/dist/index.js +215 -193
  110. package/node_modules/path-to-regexp/dist/index.js.map +1 -1
  111. package/node_modules/path-to-regexp/package.json +2 -2
  112. package/node_modules/qs/.editorconfig +1 -1
  113. package/node_modules/qs/.github/SECURITY.md +11 -0
  114. package/node_modules/qs/.github/THREAT_MODEL.md +78 -0
  115. package/node_modules/qs/CHANGELOG.md +190 -0
  116. package/node_modules/qs/README.md +29 -4
  117. package/node_modules/qs/dist/qs.js +21 -21
  118. package/node_modules/qs/eslint.config.mjs +56 -0
  119. package/node_modules/qs/lib/parse.js +94 -49
  120. package/node_modules/qs/lib/utils.js +85 -11
  121. package/node_modules/qs/package.json +10 -9
  122. package/node_modules/qs/test/parse.js +391 -13
  123. package/node_modules/qs/test/stringify.js +16 -3
  124. package/node_modules/qs/test/utils.js +173 -3
  125. package/node_modules/send/package.json +11 -8
  126. package/node_modules/serve-static/README.md +23 -23
  127. package/node_modules/serve-static/package.json +6 -3
  128. package/node_modules/side-channel-list/CHANGELOG.md +25 -4
  129. package/node_modules/side-channel-list/index.js +1 -3
  130. package/node_modules/side-channel-list/package.json +8 -8
  131. package/node_modules/side-channel-list/test/index.js +50 -0
  132. package/node_modules/uuid/dist/v35.js +3 -0
  133. package/node_modules/uuid/dist/v6.js +3 -0
  134. package/node_modules/uuid/dist-node/v35.js +3 -0
  135. package/node_modules/uuid/dist-node/v6.js +3 -0
  136. package/node_modules/uuid/package.json +1 -1
  137. package/node_modules/ws/index.js +15 -6
  138. package/node_modules/ws/lib/constants.js +1 -0
  139. package/node_modules/ws/lib/permessage-deflate.js +6 -6
  140. package/node_modules/ws/lib/websocket-server.js +10 -6
  141. package/node_modules/ws/lib/websocket.js +19 -14
  142. package/node_modules/ws/package.json +4 -3
  143. package/node_modules/ws/wrapper.mjs +14 -1
  144. package/package.json +2 -2
  145. package/node_modules/content-disposition/HISTORY.md +0 -72
  146. package/node_modules/express/History.md +0 -3858
  147. package/node_modules/hasown/.eslintrc +0 -5
  148. package/node_modules/iconv-lite/Changelog.md +0 -236
  149. package/node_modules/qs/.eslintrc +0 -39
  150. package/node_modules/send/HISTORY.md +0 -580
  151. package/node_modules/serve-static/HISTORY.md +0 -516
  152. /package/node_modules/{semver → node-abi/node_modules/semver}/LICENSE +0 -0
  153. /package/node_modules/{semver → node-abi/node_modules/semver}/classes/comparator.js +0 -0
  154. /package/node_modules/{semver → node-abi/node_modules/semver}/classes/index.js +0 -0
  155. /package/node_modules/{semver → node-abi/node_modules/semver}/classes/range.js +0 -0
  156. /package/node_modules/{semver → node-abi/node_modules/semver}/classes/semver.js +0 -0
  157. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/clean.js +0 -0
  158. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/cmp.js +0 -0
  159. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/coerce.js +0 -0
  160. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/compare-build.js +0 -0
  161. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/compare-loose.js +0 -0
  162. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/compare.js +0 -0
  163. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/diff.js +0 -0
  164. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/eq.js +0 -0
  165. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/gt.js +0 -0
  166. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/gte.js +0 -0
  167. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/inc.js +0 -0
  168. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/lt.js +0 -0
  169. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/lte.js +0 -0
  170. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/major.js +0 -0
  171. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/minor.js +0 -0
  172. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/neq.js +0 -0
  173. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/parse.js +0 -0
  174. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/patch.js +0 -0
  175. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/prerelease.js +0 -0
  176. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/rcompare.js +0 -0
  177. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/rsort.js +0 -0
  178. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/satisfies.js +0 -0
  179. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/sort.js +0 -0
  180. /package/node_modules/{semver → node-abi/node_modules/semver}/functions/valid.js +0 -0
  181. /package/node_modules/{semver → node-abi/node_modules/semver}/internal/constants.js +0 -0
  182. /package/node_modules/{semver → node-abi/node_modules/semver}/internal/debug.js +0 -0
  183. /package/node_modules/{semver → node-abi/node_modules/semver}/internal/identifiers.js +0 -0
  184. /package/node_modules/{semver → node-abi/node_modules/semver}/internal/lrucache.js +0 -0
  185. /package/node_modules/{semver → node-abi/node_modules/semver}/internal/parse-options.js +0 -0
  186. /package/node_modules/{semver → node-abi/node_modules/semver}/preload.js +0 -0
  187. /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/gtr.js +0 -0
  188. /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/intersects.js +0 -0
  189. /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/ltr.js +0 -0
  190. /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/max-satisfying.js +0 -0
  191. /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/min-satisfying.js +0 -0
  192. /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/min-version.js +0 -0
  193. /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/outside.js +0 -0
  194. /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/simplify.js +0 -0
  195. /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/subset.js +0 -0
  196. /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/to-comparators.js +0 -0
  197. /package/node_modules/{semver → node-abi/node_modules/semver}/ranges/valid.js +0 -0
  198. /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/index.js +0 -0
  199. /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/license +0 -0
  200. /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/package.json +0 -0
  201. /package/node_modules/{strip-json-comments → rc/node_modules/strip-json-comments}/readme.md +0 -0
@@ -72,6 +72,55 @@ const collectSubfields = memoize3((exeContext, returnType, fieldNodes) =>
72
72
  * and the fragments defined in the query document
73
73
  */
74
74
 
75
+ /**
76
+ * @internal
77
+ */
78
+ class CollectedErrors {
79
+ constructor() {
80
+ this._errorPositions = new Set();
81
+ this._errors = [];
82
+ }
83
+
84
+ get errors() {
85
+ return this._errors;
86
+ }
87
+
88
+ add(error, path) {
89
+ // Do not modify errors list if the execution position for this error or
90
+ // any of its ancestors has already been nulled via error propagation.
91
+ // This check should be unnecessary for implementations able to implement
92
+ // actual cancellation.
93
+ if (this._hasNulledPosition(path)) {
94
+ return;
95
+ }
96
+
97
+ this._errorPositions.add(path);
98
+
99
+ this._errors.push(error);
100
+ }
101
+
102
+ _hasNulledPosition(startPath) {
103
+ let path = startPath;
104
+
105
+ while (path !== undefined) {
106
+ if (this._errorPositions.has(path)) {
107
+ return true;
108
+ }
109
+
110
+ path = path.prev;
111
+ }
112
+
113
+ return this._errorPositions.has(undefined);
114
+ }
115
+ }
116
+ /**
117
+ * The result of GraphQL execution.
118
+ *
119
+ * - `errors` is included when any errors occurred as a non-empty array.
120
+ * - `data` is the result of a successful execution of the query.
121
+ * - `extensions` is reserved for adding non-standard properties.
122
+ */
123
+
75
124
  /**
76
125
  * Implements the "Executing requests" section of the GraphQL specification.
77
126
  *
@@ -118,18 +167,18 @@ export function execute(args) {
118
167
 
119
168
  if (isPromise(result)) {
120
169
  return result.then(
121
- (data) => buildResponse(data, exeContext.errors),
170
+ (data) => buildResponse(data, exeContext.collectedErrors.errors),
122
171
  (error) => {
123
- exeContext.errors.push(error);
124
- return buildResponse(null, exeContext.errors);
172
+ exeContext.collectedErrors.add(error, undefined);
173
+ return buildResponse(null, exeContext.collectedErrors.errors);
125
174
  },
126
175
  );
127
176
  }
128
177
 
129
- return buildResponse(result, exeContext.errors);
178
+ return buildResponse(result, exeContext.collectedErrors.errors);
130
179
  } catch (error) {
131
- exeContext.errors.push(error);
132
- return buildResponse(null, exeContext.errors);
180
+ exeContext.collectedErrors.add(error, undefined);
181
+ return buildResponse(null, exeContext.collectedErrors.errors);
133
182
  }
134
183
  }
135
184
  /**
@@ -166,6 +215,7 @@ function buildResponse(data, errors) {
166
215
  * Essential assertions before executing to provide developer feedback for
167
216
  * improper use of the GraphQL library.
168
217
  *
218
+ * @deprecated will be removed in v17 in favor of assertValidSchema() and TS checks
169
219
  * @internal
170
220
  */
171
221
 
@@ -300,7 +350,7 @@ export function buildExecutionContext(args) {
300
350
  subscribeFieldResolver !== null && subscribeFieldResolver !== void 0
301
351
  ? subscribeFieldResolver
302
352
  : defaultFieldResolver,
303
- errors: [],
353
+ collectedErrors: new CollectedErrors(),
304
354
  };
305
355
  }
306
356
  /**
@@ -501,14 +551,14 @@ function executeField(exeContext, parentType, source, fieldNodes, path) {
501
551
  // to take a second callback for the error case.
502
552
  return completed.then(undefined, (rawError) => {
503
553
  const error = locatedError(rawError, fieldNodes, pathToArray(path));
504
- return handleFieldError(error, returnType, exeContext);
554
+ return handleFieldError(error, returnType, path, exeContext);
505
555
  });
506
556
  }
507
557
 
508
558
  return completed;
509
559
  } catch (rawError) {
510
560
  const error = locatedError(rawError, fieldNodes, pathToArray(path));
511
- return handleFieldError(error, returnType, exeContext);
561
+ return handleFieldError(error, returnType, path, exeContext);
512
562
  }
513
563
  }
514
564
  /**
@@ -538,7 +588,7 @@ export function buildResolveInfo(
538
588
  };
539
589
  }
540
590
 
541
- function handleFieldError(error, returnType, exeContext) {
591
+ function handleFieldError(error, returnType, path, exeContext) {
542
592
  // If the field type is non-nullable, then it is resolved without any
543
593
  // protection from errors, however it still properly locates the error.
544
594
  if (isNonNullType(returnType)) {
@@ -546,7 +596,7 @@ function handleFieldError(error, returnType, exeContext) {
546
596
  } // Otherwise, error protection is applied, logging the error and resolving
547
597
  // a null value for this field if one is encountered.
548
598
 
549
- exeContext.errors.push(error);
599
+ exeContext.collectedErrors.add(error, path);
550
600
  return null;
551
601
  }
552
602
  /**
@@ -710,14 +760,14 @@ function completeListValue(
710
760
  fieldNodes,
711
761
  pathToArray(itemPath),
712
762
  );
713
- return handleFieldError(error, itemType, exeContext);
763
+ return handleFieldError(error, itemType, itemPath, exeContext);
714
764
  });
715
765
  }
716
766
 
717
767
  return completedItem;
718
768
  } catch (rawError) {
719
769
  const error = locatedError(rawError, fieldNodes, pathToArray(itemPath));
720
- return handleFieldError(error, itemType, exeContext);
770
+ return handleFieldError(error, itemType, itemPath, exeContext);
721
771
  }
722
772
  });
723
773
  return containsPromise ? Promise.all(completedResults) : completedResults;
@@ -125,6 +125,7 @@ async function createSourceEventStream(...rawArgs) {
125
125
  const args = toNormalizedArgs(rawArgs);
126
126
  const { schema, document, variableValues } = args; // If arguments are missing or incorrectly typed, this is an internal
127
127
  // developer mistake which should throw an early error.
128
+ // eslint-disable-next-line import/no-deprecated
128
129
 
129
130
  (0, _execute.assertValidExecutionArguments)(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments,
130
131
  // a "Response" with only errors is returned.
@@ -6,6 +6,7 @@ import { GraphQLError } from '../error/GraphQLError.mjs';
6
6
  import { locatedError } from '../error/locatedError.mjs';
7
7
  import { collectFields } from './collectFields.mjs';
8
8
  import {
9
+ // eslint-disable-next-line import/no-deprecated
9
10
  assertValidExecutionArguments,
10
11
  buildExecutionContext,
11
12
  buildResolveInfo,
@@ -111,6 +112,7 @@ export async function createSourceEventStream(...rawArgs) {
111
112
  const args = toNormalizedArgs(rawArgs);
112
113
  const { schema, document, variableValues } = args; // If arguments are missing or incorrectly typed, this is an internal
113
114
  // developer mistake which should throw an early error.
115
+ // eslint-disable-next-line import/no-deprecated
114
116
 
115
117
  assertValidExecutionArguments(schema, document, variableValues); // If a valid execution context cannot be created due to incorrect arguments,
116
118
  // a "Response" with only errors is returned.
@@ -72,7 +72,7 @@ function getVariableValues(schema, varDefNodes, inputs, options) {
72
72
  }
73
73
 
74
74
  function coerceVariableValues(schema, varDefNodes, inputs, onError) {
75
- const coercedValues = {};
75
+ const coercedValues = Object.create(null);
76
76
 
77
77
  for (const varDefNode of varDefNodes) {
78
78
  const varName = varDefNode.variable.name.value;
@@ -153,7 +153,7 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
153
153
  );
154
154
  }
155
155
 
156
- return coercedValues;
156
+ return { ...coercedValues };
157
157
  }
158
158
  /**
159
159
  * Prepares an object map of argument values given a list of argument
@@ -167,7 +167,7 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
167
167
  function getArgumentValues(def, node, variableValues) {
168
168
  var _node$arguments;
169
169
 
170
- const coercedValues = {}; // FIXME: https://github.com/graphql/graphql-js/issues/2203
170
+ const coercedValues = Object.create(null); // FIXME: https://github.com/graphql/graphql-js/issues/2203
171
171
 
172
172
  /* c8 ignore next */
173
173
 
@@ -266,7 +266,7 @@ function getArgumentValues(def, node, variableValues) {
266
266
  coercedValues[name] = coercedValue;
267
267
  }
268
268
 
269
- return coercedValues;
269
+ return { ...coercedValues };
270
270
  }
271
271
  /**
272
272
  * Prepares an object map of argument values given a directive definition
@@ -54,7 +54,7 @@ export function getVariableValues(schema, varDefNodes, inputs, options) {
54
54
  }
55
55
 
56
56
  function coerceVariableValues(schema, varDefNodes, inputs, onError) {
57
- const coercedValues = {};
57
+ const coercedValues = Object.create(null);
58
58
 
59
59
  for (const varDefNode of varDefNodes) {
60
60
  const varName = varDefNode.variable.name.value;
@@ -129,7 +129,7 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
129
129
  );
130
130
  }
131
131
 
132
- return coercedValues;
132
+ return { ...coercedValues };
133
133
  }
134
134
  /**
135
135
  * Prepares an object map of argument values given a list of argument
@@ -143,7 +143,7 @@ function coerceVariableValues(schema, varDefNodes, inputs, onError) {
143
143
  export function getArgumentValues(def, node, variableValues) {
144
144
  var _node$arguments;
145
145
 
146
- const coercedValues = {}; // FIXME: https://github.com/graphql/graphql-js/issues/2203
146
+ const coercedValues = Object.create(null); // FIXME: https://github.com/graphql/graphql-js/issues/2203
147
147
 
148
148
  /* c8 ignore next */
149
149
 
@@ -229,7 +229,7 @@ export function getArgumentValues(def, node, variableValues) {
229
229
  coercedValues[name] = coercedValue;
230
230
  }
231
231
 
232
- return coercedValues;
232
+ return { ...coercedValues };
233
233
  }
234
234
  /**
235
235
  * Prepares an object map of argument values given a directive definition
@@ -280,6 +280,7 @@ export type {
280
280
  UnionTypeExtensionNode,
281
281
  EnumTypeExtensionNode,
282
282
  InputObjectTypeExtensionNode,
283
+ DirectiveExtensionNode,
283
284
  SchemaCoordinateNode,
284
285
  TypeCoordinateNode,
285
286
  MemberCoordinateNode,
@@ -135,6 +135,7 @@ export declare type ASTNode =
135
135
  | UnionTypeExtensionNode
136
136
  | EnumTypeExtensionNode
137
137
  | InputObjectTypeExtensionNode
138
+ | DirectiveExtensionNode
138
139
  | TypeCoordinateNode
139
140
  | MemberCoordinateNode
140
141
  | ArgumentCoordinateNode
@@ -480,13 +481,15 @@ export interface DirectiveDefinitionNode {
480
481
  readonly description?: StringValueNode;
481
482
  readonly name: NameNode;
482
483
  readonly arguments?: ReadonlyArray<InputValueDefinitionNode>;
484
+ readonly directives?: ReadonlyArray<ConstDirectiveNode>;
483
485
  readonly repeatable: boolean;
484
486
  readonly locations: ReadonlyArray<NameNode>;
485
487
  }
486
488
  /** Type System Extensions */
487
489
  export declare type TypeSystemExtensionNode =
488
490
  | SchemaExtensionNode
489
- | TypeExtensionNode;
491
+ | TypeExtensionNode
492
+ | DirectiveExtensionNode;
490
493
  export interface SchemaExtensionNode {
491
494
  readonly kind: Kind.SCHEMA_EXTENSION;
492
495
  readonly loc?: Location;
@@ -544,6 +547,12 @@ export interface InputObjectTypeExtensionNode {
544
547
  readonly directives?: ReadonlyArray<ConstDirectiveNode>;
545
548
  readonly fields?: ReadonlyArray<InputValueDefinitionNode>;
546
549
  }
550
+ export interface DirectiveExtensionNode {
551
+ readonly kind: Kind.DIRECTIVE_EXTENSION;
552
+ readonly loc?: Location;
553
+ readonly name: NameNode;
554
+ readonly directives?: ReadonlyArray<ConstDirectiveNode>;
555
+ }
547
556
  /** Schema Coordinates */
548
557
  export declare type SchemaCoordinateNode =
549
558
  | TypeCoordinateNode
@@ -200,8 +200,15 @@ const QueryDocumentKeys = {
200
200
  EnumTypeDefinition: ['description', 'name', 'directives', 'values'],
201
201
  EnumValueDefinition: ['description', 'name', 'directives'],
202
202
  InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],
203
- DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],
203
+ DirectiveDefinition: [
204
+ 'description',
205
+ 'name',
206
+ 'arguments',
207
+ 'directives',
208
+ 'locations',
209
+ ],
204
210
  SchemaExtension: ['directives', 'operationTypes'],
211
+ DirectiveExtension: ['name', 'directives'],
205
212
  ScalarTypeExtension: ['name', 'directives'],
206
213
  ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],
207
214
  InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'],
@@ -184,8 +184,15 @@ export const QueryDocumentKeys = {
184
184
  EnumTypeDefinition: ['description', 'name', 'directives', 'values'],
185
185
  EnumValueDefinition: ['description', 'name', 'directives'],
186
186
  InputObjectTypeDefinition: ['description', 'name', 'directives', 'fields'],
187
- DirectiveDefinition: ['description', 'name', 'arguments', 'locations'],
187
+ DirectiveDefinition: [
188
+ 'description',
189
+ 'name',
190
+ 'arguments',
191
+ 'directives',
192
+ 'locations',
193
+ ],
188
194
  SchemaExtension: ['directives', 'operationTypes'],
195
+ DirectiveExtension: ['name', 'directives'],
189
196
  ScalarTypeExtension: ['name', 'directives'],
190
197
  ObjectTypeExtension: ['name', 'interfaces', 'directives', 'fields'],
191
198
  InterfaceTypeExtension: ['name', 'interfaces', 'directives', 'fields'],
@@ -23,6 +23,7 @@ declare enum DirectiveLocation {
23
23
  ENUM_VALUE = 'ENUM_VALUE',
24
24
  INPUT_OBJECT = 'INPUT_OBJECT',
25
25
  INPUT_FIELD_DEFINITION = 'INPUT_FIELD_DEFINITION',
26
+ DIRECTIVE_DEFINITION = 'DIRECTIVE_DEFINITION',
26
27
  }
27
28
  export { DirectiveLocation };
28
29
  /**
@@ -31,6 +31,7 @@ exports.DirectiveLocation = DirectiveLocation;
31
31
  DirectiveLocation['ENUM_VALUE'] = 'ENUM_VALUE';
32
32
  DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT';
33
33
  DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';
34
+ DirectiveLocation['DIRECTIVE_DEFINITION'] = 'DIRECTIVE_DEFINITION';
34
35
  })(DirectiveLocation || (exports.DirectiveLocation = DirectiveLocation = {}));
35
36
  /**
36
37
  * The enum type representing the directive location values.
@@ -23,6 +23,7 @@ var DirectiveLocation;
23
23
  DirectiveLocation['ENUM_VALUE'] = 'ENUM_VALUE';
24
24
  DirectiveLocation['INPUT_OBJECT'] = 'INPUT_OBJECT';
25
25
  DirectiveLocation['INPUT_FIELD_DEFINITION'] = 'INPUT_FIELD_DEFINITION';
26
+ DirectiveLocation['DIRECTIVE_DEFINITION'] = 'DIRECTIVE_DEFINITION';
26
27
  })(DirectiveLocation || (DirectiveLocation = {}));
27
28
 
28
29
  export { DirectiveLocation };
@@ -86,6 +86,7 @@ export type {
86
86
  UnionTypeExtensionNode,
87
87
  EnumTypeExtensionNode,
88
88
  InputObjectTypeExtensionNode,
89
+ DirectiveExtensionNode,
89
90
  SchemaCoordinateNode,
90
91
  TypeCoordinateNode,
91
92
  MemberCoordinateNode,
@@ -49,6 +49,7 @@ declare enum Kind {
49
49
  DIRECTIVE_DEFINITION = 'DirectiveDefinition',
50
50
  /** Type System Extensions */
51
51
  SCHEMA_EXTENSION = 'SchemaExtension',
52
+ DIRECTIVE_EXTENSION = 'DirectiveExtension',
52
53
  /** Type Extensions */
53
54
  SCALAR_TYPE_EXTENSION = 'ScalarTypeExtension',
54
55
  OBJECT_TYPE_EXTENSION = 'ObjectTypeExtension',
@@ -49,6 +49,7 @@ exports.Kind = Kind;
49
49
  Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition';
50
50
  Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition';
51
51
  Kind['SCHEMA_EXTENSION'] = 'SchemaExtension';
52
+ Kind['DIRECTIVE_EXTENSION'] = 'DirectiveExtension';
52
53
  Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension';
53
54
  Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension';
54
55
  Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension';
@@ -41,6 +41,7 @@ var Kind;
41
41
  Kind['INPUT_OBJECT_TYPE_DEFINITION'] = 'InputObjectTypeDefinition';
42
42
  Kind['DIRECTIVE_DEFINITION'] = 'DirectiveDefinition';
43
43
  Kind['SCHEMA_EXTENSION'] = 'SchemaExtension';
44
+ Kind['DIRECTIVE_EXTENSION'] = 'DirectiveExtension';
44
45
  Kind['SCALAR_TYPE_EXTENSION'] = 'ScalarTypeExtension';
45
46
  Kind['OBJECT_TYPE_EXTENSION'] = 'ObjectTypeExtension';
46
47
  Kind['INTERFACE_TYPE_EXTENSION'] = 'InterfaceTypeExtension';
@@ -10,6 +10,7 @@ import type {
10
10
  ConstValueNode,
11
11
  DefinitionNode,
12
12
  DirectiveDefinitionNode,
13
+ DirectiveExtensionNode,
13
14
  DirectiveNode,
14
15
  DocumentNode,
15
16
  EnumTypeDefinitionNode,
@@ -89,6 +90,17 @@ export interface ParseOptions {
89
90
  * ```
90
91
  */
91
92
  allowLegacyFragmentVariables?: boolean;
93
+ /**
94
+ * EXPERIMENTAL:
95
+ *
96
+ * If enabled, the parser will parse directives on directive definitions.
97
+ * This syntax is not part of the GraphQL specification and may change.
98
+ *
99
+ * ```graphql
100
+ * directive @foo @bar on FIELD
101
+ * ```
102
+ */
103
+ experimentalDirectivesOnDirectiveDefinitions?: boolean;
92
104
  /**
93
105
  * You may override the Lexer class used to lex the source; this is used by
94
106
  * schema coordinates to introduce a lexer with a restricted syntax.
@@ -447,6 +459,7 @@ export declare class Parser {
447
459
  * - UnionTypeExtension
448
460
  * - EnumTypeExtension
449
461
  * - InputObjectTypeDefinition
462
+ * - DirectiveDefinitionExtension
450
463
  */
451
464
  parseTypeSystemExtension(): TypeSystemExtensionNode;
452
465
  /**
@@ -494,6 +507,7 @@ export declare class Parser {
494
507
  * - extend input Name Directives[Const]
495
508
  */
496
509
  parseInputObjectTypeExtension(): InputObjectTypeExtensionNode;
510
+ parseDirectiveDefinitionExtension(): DirectiveExtensionNode;
497
511
  /**
498
512
  * ```
499
513
  * DirectiveDefinition :
@@ -1112,6 +1112,7 @@ class Parser {
1112
1112
  * - UnionTypeExtension
1113
1113
  * - EnumTypeExtension
1114
1114
  * - InputObjectTypeDefinition
1115
+ * - DirectiveDefinitionExtension
1115
1116
  */
1116
1117
 
1117
1118
  parseTypeSystemExtension() {
@@ -1139,6 +1140,13 @@ class Parser {
1139
1140
 
1140
1141
  case 'input':
1141
1142
  return this.parseInputObjectTypeExtension();
1143
+
1144
+ case 'directive':
1145
+ if (this._options.experimentalDirectivesOnDirectiveDefinitions) {
1146
+ return this.parseDirectiveDefinitionExtension();
1147
+ }
1148
+
1149
+ break;
1142
1150
  }
1143
1151
  }
1144
1152
 
@@ -1334,6 +1342,25 @@ class Parser {
1334
1342
  fields,
1335
1343
  });
1336
1344
  }
1345
+
1346
+ parseDirectiveDefinitionExtension() {
1347
+ const start = this._lexer.token;
1348
+ this.expectKeyword('extend');
1349
+ this.expectKeyword('directive');
1350
+ this.expectToken(_tokenKind.TokenKind.AT);
1351
+ const name = this.parseName();
1352
+ const directives = this.parseConstDirectives();
1353
+
1354
+ if (directives.length === 0) {
1355
+ throw this.unexpected();
1356
+ }
1357
+
1358
+ return this.node(start, {
1359
+ kind: _kinds.Kind.DIRECTIVE_EXTENSION,
1360
+ name,
1361
+ directives,
1362
+ });
1363
+ }
1337
1364
  /**
1338
1365
  * ```
1339
1366
  * DirectiveDefinition :
@@ -1348,6 +1375,10 @@ class Parser {
1348
1375
  this.expectToken(_tokenKind.TokenKind.AT);
1349
1376
  const name = this.parseName();
1350
1377
  const args = this.parseArgumentDefs();
1378
+ const directives = this._options
1379
+ .experimentalDirectivesOnDirectiveDefinitions
1380
+ ? this.parseConstDirectives()
1381
+ : [];
1351
1382
  const repeatable = this.expectOptionalKeyword('repeatable');
1352
1383
  this.expectKeyword('on');
1353
1384
  const locations = this.parseDirectiveLocations();
@@ -1356,6 +1387,7 @@ class Parser {
1356
1387
  description,
1357
1388
  name,
1358
1389
  arguments: args,
1390
+ directives,
1359
1391
  repeatable,
1360
1392
  locations,
1361
1393
  });
@@ -1398,6 +1430,7 @@ class Parser {
1398
1430
  * `ENUM_VALUE`
1399
1431
  * `INPUT_OBJECT`
1400
1432
  * `INPUT_FIELD_DEFINITION`
1433
+ * `DIRECTIVE_DEFINITION`
1401
1434
  */
1402
1435
 
1403
1436
  parseDirectiveLocation() {
@@ -1075,6 +1075,7 @@ export class Parser {
1075
1075
  * - UnionTypeExtension
1076
1076
  * - EnumTypeExtension
1077
1077
  * - InputObjectTypeDefinition
1078
+ * - DirectiveDefinitionExtension
1078
1079
  */
1079
1080
 
1080
1081
  parseTypeSystemExtension() {
@@ -1102,6 +1103,13 @@ export class Parser {
1102
1103
 
1103
1104
  case 'input':
1104
1105
  return this.parseInputObjectTypeExtension();
1106
+
1107
+ case 'directive':
1108
+ if (this._options.experimentalDirectivesOnDirectiveDefinitions) {
1109
+ return this.parseDirectiveDefinitionExtension();
1110
+ }
1111
+
1112
+ break;
1105
1113
  }
1106
1114
  }
1107
1115
 
@@ -1297,6 +1305,25 @@ export class Parser {
1297
1305
  fields,
1298
1306
  });
1299
1307
  }
1308
+
1309
+ parseDirectiveDefinitionExtension() {
1310
+ const start = this._lexer.token;
1311
+ this.expectKeyword('extend');
1312
+ this.expectKeyword('directive');
1313
+ this.expectToken(TokenKind.AT);
1314
+ const name = this.parseName();
1315
+ const directives = this.parseConstDirectives();
1316
+
1317
+ if (directives.length === 0) {
1318
+ throw this.unexpected();
1319
+ }
1320
+
1321
+ return this.node(start, {
1322
+ kind: Kind.DIRECTIVE_EXTENSION,
1323
+ name,
1324
+ directives,
1325
+ });
1326
+ }
1300
1327
  /**
1301
1328
  * ```
1302
1329
  * DirectiveDefinition :
@@ -1311,6 +1338,10 @@ export class Parser {
1311
1338
  this.expectToken(TokenKind.AT);
1312
1339
  const name = this.parseName();
1313
1340
  const args = this.parseArgumentDefs();
1341
+ const directives = this._options
1342
+ .experimentalDirectivesOnDirectiveDefinitions
1343
+ ? this.parseConstDirectives()
1344
+ : [];
1314
1345
  const repeatable = this.expectOptionalKeyword('repeatable');
1315
1346
  this.expectKeyword('on');
1316
1347
  const locations = this.parseDirectiveLocations();
@@ -1319,6 +1350,7 @@ export class Parser {
1319
1350
  description,
1320
1351
  name,
1321
1352
  arguments: args,
1353
+ directives,
1322
1354
  repeatable,
1323
1355
  locations,
1324
1356
  });
@@ -1358,6 +1390,7 @@ export class Parser {
1358
1390
  * `ENUM_VALUE`
1359
1391
  * `INPUT_OBJECT`
1360
1392
  * `INPUT_FIELD_DEFINITION`
1393
+ * `DIRECTIVE_DEFINITION`
1361
1394
  */
1362
1395
 
1363
1396
  parseDirectiveLocation() {
@@ -94,7 +94,9 @@ function isTypeDefinitionNode(node) {
94
94
 
95
95
  function isTypeSystemExtensionNode(node) {
96
96
  return (
97
- node.kind === _kinds.Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node)
97
+ node.kind === _kinds.Kind.SCHEMA_EXTENSION ||
98
+ node.kind === _kinds.Kind.DIRECTIVE_EXTENSION ||
99
+ isTypeExtensionNode(node)
98
100
  );
99
101
  }
100
102
 
@@ -67,7 +67,11 @@ export function isTypeDefinitionNode(node) {
67
67
  );
68
68
  }
69
69
  export function isTypeSystemExtensionNode(node) {
70
- return node.kind === Kind.SCHEMA_EXTENSION || isTypeExtensionNode(node);
70
+ return (
71
+ node.kind === Kind.SCHEMA_EXTENSION ||
72
+ node.kind === Kind.DIRECTIVE_EXTENSION ||
73
+ isTypeExtensionNode(node)
74
+ );
71
75
  }
72
76
  export function isTypeExtensionNode(node) {
73
77
  return (
@@ -240,13 +240,21 @@ const printDocASTReducer = {
240
240
  join(['input', name, join(directives, ' '), block(fields)], ' '),
241
241
  },
242
242
  DirectiveDefinition: {
243
- leave: ({ description, name, arguments: args, repeatable, locations }) =>
243
+ leave: ({
244
+ description,
245
+ name,
246
+ arguments: args,
247
+ directives,
248
+ repeatable,
249
+ locations,
250
+ }) =>
244
251
  wrap('', description, '\n') +
245
252
  'directive @' +
246
253
  name +
247
254
  (hasMultilineItems(args)
248
255
  ? wrap('(\n', indent(join(args, '\n')), '\n)')
249
256
  : wrap('(', join(args, ', '), ')')) +
257
+ wrap(' ', join(directives, ' ')) +
250
258
  (repeatable ? ' repeatable' : '') +
251
259
  ' on ' +
252
260
  join(locations, ' | '),
@@ -308,6 +316,10 @@ const printDocASTReducer = {
308
316
  leave: ({ name, directives, fields }) =>
309
317
  join(['extend input', name, join(directives, ' '), block(fields)], ' '),
310
318
  },
319
+ DirectiveExtension: {
320
+ leave: ({ name, directives }) =>
321
+ join(['extend directive @' + name, join(directives, ' ')], ' '),
322
+ },
311
323
  // Schema Coordinates
312
324
  TypeCoordinate: {
313
325
  leave: ({ name }) => name,
@@ -228,13 +228,21 @@ const printDocASTReducer = {
228
228
  join(['input', name, join(directives, ' '), block(fields)], ' '),
229
229
  },
230
230
  DirectiveDefinition: {
231
- leave: ({ description, name, arguments: args, repeatable, locations }) =>
231
+ leave: ({
232
+ description,
233
+ name,
234
+ arguments: args,
235
+ directives,
236
+ repeatable,
237
+ locations,
238
+ }) =>
232
239
  wrap('', description, '\n') +
233
240
  'directive @' +
234
241
  name +
235
242
  (hasMultilineItems(args)
236
243
  ? wrap('(\n', indent(join(args, '\n')), '\n)')
237
244
  : wrap('(', join(args, ', '), ')')) +
245
+ wrap(' ', join(directives, ' ')) +
238
246
  (repeatable ? ' repeatable' : '') +
239
247
  ' on ' +
240
248
  join(locations, ' | '),
@@ -296,6 +304,10 @@ const printDocASTReducer = {
296
304
  leave: ({ name, directives, fields }) =>
297
305
  join(['extend input', name, join(directives, ' '), block(fields)], ' '),
298
306
  },
307
+ DirectiveExtension: {
308
+ leave: ({ name, directives }) =>
309
+ join(['extend directive @' + name, join(directives, ' ')], ' '),
310
+ },
299
311
  // Schema Coordinates
300
312
  TypeCoordinate: {
301
313
  leave: ({ name }) => name,