graphql 17.0.0-beta.2 → 17.0.0

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 (262) hide show
  1. package/README.md +3 -5
  2. package/__dev__/diagnostics.d.mts +1 -0
  3. package/__dev__/diagnostics.d.ts +1 -0
  4. package/__dev__/diagnostics.js +3 -0
  5. package/__dev__/diagnostics.mjs +3 -0
  6. package/diagnostics.d.mts +307 -0
  7. package/diagnostics.d.ts +307 -0
  8. package/diagnostics.js +75 -0
  9. package/diagnostics.js.map +1 -0
  10. package/diagnostics.mjs +70 -0
  11. package/diagnostics.mjs.map +1 -0
  12. package/error/GraphQLError.d.mts +3 -1
  13. package/error/GraphQLError.d.ts +3 -1
  14. package/error/GraphQLError.js +3 -3
  15. package/error/GraphQLError.js.map +1 -1
  16. package/error/GraphQLError.mjs +3 -3
  17. package/error/GraphQLError.mjs.map +1 -1
  18. package/error/locatedError.d.mts +1 -3
  19. package/error/locatedError.d.ts +1 -3
  20. package/error/locatedError.js.map +1 -1
  21. package/error/locatedError.mjs.map +1 -1
  22. package/execution/ExecutionArgs.d.mts +6 -0
  23. package/execution/ExecutionArgs.d.ts +6 -0
  24. package/execution/ExecutionArgs.js.map +1 -1
  25. package/execution/ExecutionArgs.mjs.map +1 -1
  26. package/execution/Executor.d.mts +19 -1
  27. package/execution/Executor.d.ts +19 -1
  28. package/execution/Executor.js +49 -4
  29. package/execution/Executor.js.map +1 -1
  30. package/execution/Executor.mjs +49 -4
  31. package/execution/Executor.mjs.map +1 -1
  32. package/execution/execute.d.mts +65 -44
  33. package/execution/execute.d.ts +65 -44
  34. package/execution/execute.js +73 -4
  35. package/execution/execute.js.map +1 -1
  36. package/execution/execute.mjs +73 -4
  37. package/execution/execute.mjs.map +1 -1
  38. package/execution/values.d.mts +17 -17
  39. package/execution/values.d.ts +17 -17
  40. package/execution/values.js.map +1 -1
  41. package/execution/values.mjs.map +1 -1
  42. package/index.d.mts +1 -0
  43. package/index.d.ts +1 -0
  44. package/index.js.map +1 -1
  45. package/index.mjs.map +1 -1
  46. package/language/parser.d.mts +20 -30
  47. package/language/parser.d.ts +20 -30
  48. package/language/parser.js +9 -9
  49. package/language/parser.js.map +1 -1
  50. package/language/parser.mjs +9 -9
  51. package/language/parser.mjs.map +1 -1
  52. package/language/predicates.d.mts +5 -1
  53. package/language/predicates.d.ts +5 -1
  54. package/language/predicates.js.map +1 -1
  55. package/language/predicates.mjs.map +1 -1
  56. package/language/source.d.mts +4 -5
  57. package/language/source.d.ts +4 -5
  58. package/language/source.js.map +1 -1
  59. package/language/source.mjs.map +1 -1
  60. package/language/visitor.d.mts +10 -2
  61. package/language/visitor.d.ts +10 -2
  62. package/language/visitor.js.map +1 -1
  63. package/language/visitor.mjs.map +1 -1
  64. package/package.json +2 -2
  65. package/type/definition.d.mts +96 -64
  66. package/type/definition.d.ts +96 -64
  67. package/type/definition.js.map +1 -1
  68. package/type/definition.mjs.map +1 -1
  69. package/type/directives.d.mts +3 -3
  70. package/type/directives.d.ts +3 -3
  71. package/type/directives.js.map +1 -1
  72. package/type/directives.mjs.map +1 -1
  73. package/type/schema.d.mts +4 -8
  74. package/type/schema.d.ts +4 -8
  75. package/type/schema.js.map +1 -1
  76. package/type/schema.mjs.map +1 -1
  77. package/type/validate.js +101 -30
  78. package/type/validate.js.map +1 -1
  79. package/type/validate.mjs +101 -30
  80. package/type/validate.mjs.map +1 -1
  81. package/utilities/TypeInfo.d.mts +1 -1
  82. package/utilities/TypeInfo.d.ts +1 -1
  83. package/utilities/TypeInfo.js.map +1 -1
  84. package/utilities/TypeInfo.mjs.map +1 -1
  85. package/utilities/buildASTSchema.d.mts +0 -1
  86. package/utilities/buildASTSchema.d.ts +0 -1
  87. package/utilities/buildASTSchema.js +0 -1
  88. package/utilities/buildASTSchema.js.map +1 -1
  89. package/utilities/buildASTSchema.mjs +0 -1
  90. package/utilities/buildASTSchema.mjs.map +1 -1
  91. package/utilities/buildClientSchema.d.mts +5 -1
  92. package/utilities/buildClientSchema.d.ts +5 -1
  93. package/utilities/buildClientSchema.js.map +1 -1
  94. package/utilities/buildClientSchema.mjs.map +1 -1
  95. package/utilities/coerceInputValue.d.mts +7 -6
  96. package/utilities/coerceInputValue.d.ts +7 -6
  97. package/utilities/coerceInputValue.js.map +1 -1
  98. package/utilities/coerceInputValue.mjs.map +1 -1
  99. package/utilities/concatAST.d.mts +4 -1
  100. package/utilities/concatAST.d.ts +4 -1
  101. package/utilities/concatAST.js.map +1 -1
  102. package/utilities/concatAST.mjs.map +1 -1
  103. package/utilities/extendSchema.d.mts +3 -3
  104. package/utilities/extendSchema.d.ts +3 -3
  105. package/utilities/extendSchema.js +5 -1
  106. package/utilities/extendSchema.js.map +1 -1
  107. package/utilities/extendSchema.mjs +5 -1
  108. package/utilities/extendSchema.mjs.map +1 -1
  109. package/utilities/introspectionFromSchema.d.mts +6 -2
  110. package/utilities/introspectionFromSchema.d.ts +6 -2
  111. package/utilities/introspectionFromSchema.js.map +1 -1
  112. package/utilities/introspectionFromSchema.mjs.map +1 -1
  113. package/utilities/lexicographicSortSchema.d.mts +5 -1
  114. package/utilities/lexicographicSortSchema.d.ts +5 -1
  115. package/utilities/lexicographicSortSchema.js.map +1 -1
  116. package/utilities/lexicographicSortSchema.mjs.map +1 -1
  117. package/utilities/printSchema.d.mts +5 -1
  118. package/utilities/printSchema.d.ts +5 -1
  119. package/utilities/printSchema.js.map +1 -1
  120. package/utilities/printSchema.mjs.map +1 -1
  121. package/utilities/replaceVariables.d.mts +4 -8
  122. package/utilities/replaceVariables.d.ts +4 -8
  123. package/utilities/replaceVariables.js.map +1 -1
  124. package/utilities/replaceVariables.mjs.map +1 -1
  125. package/utilities/stripIgnoredCharacters.d.mts +2 -2
  126. package/utilities/stripIgnoredCharacters.d.ts +2 -2
  127. package/utilities/stripIgnoredCharacters.js.map +1 -1
  128. package/utilities/stripIgnoredCharacters.mjs.map +1 -1
  129. package/utilities/typeComparators.d.mts +1 -5
  130. package/utilities/typeComparators.d.ts +1 -5
  131. package/utilities/typeComparators.js.map +1 -1
  132. package/utilities/typeComparators.mjs.map +1 -1
  133. package/utilities/validateInputValue.d.mts +10 -8
  134. package/utilities/validateInputValue.d.ts +10 -8
  135. package/utilities/validateInputValue.js.map +1 -1
  136. package/utilities/validateInputValue.mjs.map +1 -1
  137. package/validation/rules/DeferStreamDirectiveOnRootFieldRule.d.mts +4 -1
  138. package/validation/rules/DeferStreamDirectiveOnRootFieldRule.d.ts +4 -1
  139. package/validation/rules/DeferStreamDirectiveOnRootFieldRule.js +70 -17
  140. package/validation/rules/DeferStreamDirectiveOnRootFieldRule.js.map +1 -1
  141. package/validation/rules/DeferStreamDirectiveOnRootFieldRule.mjs +70 -17
  142. package/validation/rules/DeferStreamDirectiveOnRootFieldRule.mjs.map +1 -1
  143. package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.d.mts +1 -1
  144. package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.d.ts +1 -1
  145. package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.js +90 -21
  146. package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.js.map +1 -1
  147. package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.mjs +91 -22
  148. package/validation/rules/DeferStreamDirectiveOnValidOperationsRule.mjs.map +1 -1
  149. package/validation/rules/ExecutableDefinitionsRule.d.mts +6 -2
  150. package/validation/rules/ExecutableDefinitionsRule.d.ts +6 -2
  151. package/validation/rules/ExecutableDefinitionsRule.js.map +1 -1
  152. package/validation/rules/ExecutableDefinitionsRule.mjs.map +1 -1
  153. package/validation/rules/FieldsOnCorrectTypeRule.d.mts +3 -1
  154. package/validation/rules/FieldsOnCorrectTypeRule.d.ts +3 -1
  155. package/validation/rules/FieldsOnCorrectTypeRule.js.map +1 -1
  156. package/validation/rules/FieldsOnCorrectTypeRule.mjs.map +1 -1
  157. package/validation/rules/FragmentsOnCompositeTypesRule.d.mts +6 -2
  158. package/validation/rules/FragmentsOnCompositeTypesRule.d.ts +6 -2
  159. package/validation/rules/FragmentsOnCompositeTypesRule.js.map +1 -1
  160. package/validation/rules/FragmentsOnCompositeTypesRule.mjs.map +1 -1
  161. package/validation/rules/KnownArgumentNamesRule.d.mts +3 -1
  162. package/validation/rules/KnownArgumentNamesRule.d.ts +3 -1
  163. package/validation/rules/KnownArgumentNamesRule.js.map +1 -1
  164. package/validation/rules/KnownArgumentNamesRule.mjs.map +1 -1
  165. package/validation/rules/KnownDirectivesRule.js +2 -1
  166. package/validation/rules/KnownDirectivesRule.js.map +1 -1
  167. package/validation/rules/KnownDirectivesRule.mjs +2 -1
  168. package/validation/rules/KnownDirectivesRule.mjs.map +1 -1
  169. package/validation/rules/KnownFragmentNamesRule.d.mts +3 -1
  170. package/validation/rules/KnownFragmentNamesRule.d.ts +3 -1
  171. package/validation/rules/KnownFragmentNamesRule.js.map +1 -1
  172. package/validation/rules/KnownFragmentNamesRule.mjs.map +1 -1
  173. package/validation/rules/LoneAnonymousOperationRule.d.mts +6 -2
  174. package/validation/rules/LoneAnonymousOperationRule.d.ts +6 -2
  175. package/validation/rules/LoneAnonymousOperationRule.js.map +1 -1
  176. package/validation/rules/LoneAnonymousOperationRule.mjs.map +1 -1
  177. package/validation/rules/MaxIntrospectionDepthRule.d.mts +6 -2
  178. package/validation/rules/MaxIntrospectionDepthRule.d.ts +6 -2
  179. package/validation/rules/MaxIntrospectionDepthRule.js.map +1 -1
  180. package/validation/rules/MaxIntrospectionDepthRule.mjs.map +1 -1
  181. package/validation/rules/NoUndefinedVariablesRule.d.mts +3 -1
  182. package/validation/rules/NoUndefinedVariablesRule.d.ts +3 -1
  183. package/validation/rules/NoUndefinedVariablesRule.js.map +1 -1
  184. package/validation/rules/NoUndefinedVariablesRule.mjs.map +1 -1
  185. package/validation/rules/NoUnusedFragmentsRule.d.mts +3 -1
  186. package/validation/rules/NoUnusedFragmentsRule.d.ts +3 -1
  187. package/validation/rules/NoUnusedFragmentsRule.js.map +1 -1
  188. package/validation/rules/NoUnusedFragmentsRule.mjs.map +1 -1
  189. package/validation/rules/NoUnusedVariablesRule.d.mts +3 -1
  190. package/validation/rules/NoUnusedVariablesRule.d.ts +3 -1
  191. package/validation/rules/NoUnusedVariablesRule.js.map +1 -1
  192. package/validation/rules/NoUnusedVariablesRule.mjs.map +1 -1
  193. package/validation/rules/OverlappingFieldsCanBeMergedRule.d.mts +6 -2
  194. package/validation/rules/OverlappingFieldsCanBeMergedRule.d.ts +6 -2
  195. package/validation/rules/OverlappingFieldsCanBeMergedRule.js.map +1 -1
  196. package/validation/rules/OverlappingFieldsCanBeMergedRule.mjs.map +1 -1
  197. package/validation/rules/PossibleFragmentSpreadsRule.d.mts +6 -2
  198. package/validation/rules/PossibleFragmentSpreadsRule.d.ts +6 -2
  199. package/validation/rules/PossibleFragmentSpreadsRule.js.map +1 -1
  200. package/validation/rules/PossibleFragmentSpreadsRule.mjs.map +1 -1
  201. package/validation/rules/ProvidedRequiredArgumentsRule.d.mts +6 -2
  202. package/validation/rules/ProvidedRequiredArgumentsRule.d.ts +6 -2
  203. package/validation/rules/ProvidedRequiredArgumentsRule.js.map +1 -1
  204. package/validation/rules/ProvidedRequiredArgumentsRule.mjs.map +1 -1
  205. package/validation/rules/SingleFieldSubscriptionsRule.d.mts +6 -2
  206. package/validation/rules/SingleFieldSubscriptionsRule.d.ts +6 -2
  207. package/validation/rules/SingleFieldSubscriptionsRule.js.map +1 -1
  208. package/validation/rules/SingleFieldSubscriptionsRule.mjs.map +1 -1
  209. package/validation/rules/UniqueArgumentNamesRule.d.mts +3 -1
  210. package/validation/rules/UniqueArgumentNamesRule.d.ts +3 -1
  211. package/validation/rules/UniqueArgumentNamesRule.js.map +1 -1
  212. package/validation/rules/UniqueArgumentNamesRule.mjs.map +1 -1
  213. package/validation/rules/UniqueDirectivesPerLocationRule.d.mts +6 -2
  214. package/validation/rules/UniqueDirectivesPerLocationRule.d.ts +6 -2
  215. package/validation/rules/UniqueDirectivesPerLocationRule.js.map +1 -1
  216. package/validation/rules/UniqueDirectivesPerLocationRule.mjs.map +1 -1
  217. package/validation/rules/UniqueFragmentNamesRule.d.mts +3 -1
  218. package/validation/rules/UniqueFragmentNamesRule.d.ts +3 -1
  219. package/validation/rules/UniqueFragmentNamesRule.js.map +1 -1
  220. package/validation/rules/UniqueFragmentNamesRule.mjs.map +1 -1
  221. package/validation/rules/UniqueInputFieldNamesRule.d.mts +6 -2
  222. package/validation/rules/UniqueInputFieldNamesRule.d.ts +6 -2
  223. package/validation/rules/UniqueInputFieldNamesRule.js.map +1 -1
  224. package/validation/rules/UniqueInputFieldNamesRule.mjs.map +1 -1
  225. package/validation/rules/UniqueOperationNamesRule.d.mts +3 -1
  226. package/validation/rules/UniqueOperationNamesRule.d.ts +3 -1
  227. package/validation/rules/UniqueOperationNamesRule.js.map +1 -1
  228. package/validation/rules/UniqueOperationNamesRule.mjs.map +1 -1
  229. package/validation/rules/UniqueVariableNamesRule.d.mts +3 -1
  230. package/validation/rules/UniqueVariableNamesRule.d.ts +3 -1
  231. package/validation/rules/UniqueVariableNamesRule.js.map +1 -1
  232. package/validation/rules/UniqueVariableNamesRule.mjs.map +1 -1
  233. package/validation/rules/ValuesOfCorrectTypeRule.d.mts +3 -1
  234. package/validation/rules/ValuesOfCorrectTypeRule.d.ts +3 -1
  235. package/validation/rules/ValuesOfCorrectTypeRule.js.map +1 -1
  236. package/validation/rules/ValuesOfCorrectTypeRule.mjs.map +1 -1
  237. package/validation/rules/VariablesAreInputTypesRule.d.mts +6 -2
  238. package/validation/rules/VariablesAreInputTypesRule.d.ts +6 -2
  239. package/validation/rules/VariablesAreInputTypesRule.js.map +1 -1
  240. package/validation/rules/VariablesAreInputTypesRule.mjs.map +1 -1
  241. package/validation/rules/VariablesInAllowedPositionRule.d.mts +6 -2
  242. package/validation/rules/VariablesInAllowedPositionRule.d.ts +6 -2
  243. package/validation/rules/VariablesInAllowedPositionRule.js.map +1 -1
  244. package/validation/rules/VariablesInAllowedPositionRule.mjs.map +1 -1
  245. package/validation/rules/custom/NoDeprecatedCustomRule.d.mts +3 -1
  246. package/validation/rules/custom/NoDeprecatedCustomRule.d.ts +3 -1
  247. package/validation/rules/custom/NoDeprecatedCustomRule.js.map +1 -1
  248. package/validation/rules/custom/NoDeprecatedCustomRule.mjs.map +1 -1
  249. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.mts +6 -2
  250. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.d.ts +6 -2
  251. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.js.map +1 -1
  252. package/validation/rules/custom/NoSchemaIntrospectionCustomRule.mjs.map +1 -1
  253. package/validation/validate.d.mts +3 -6
  254. package/validation/validate.d.ts +3 -6
  255. package/validation/validate.js +6 -0
  256. package/validation/validate.js.map +1 -1
  257. package/validation/validate.mjs +6 -0
  258. package/validation/validate.mjs.map +1 -1
  259. package/version.js +2 -2
  260. package/version.js.map +1 -1
  261. package/version.mjs +2 -2
  262. package/version.mjs.map +1 -1
package/README.md CHANGED
@@ -1,11 +1,9 @@
1
- [![GraphQLConf 2025 Banner: September 08-10, Amsterdam. Hosted by the GraphQL Foundation](./assets/graphql-conf-2025.png)](https://graphql.org/conf/2025/?utm_source=github&utm_medium=graphql_js&utm_campaign=readme)
2
-
3
1
  # GraphQL.js
4
2
 
5
3
  The JavaScript reference implementation for GraphQL, a query language for APIs created by Facebook.
6
4
 
7
5
  [![npm version](https://badge.fury.io/js/graphql.svg)](https://badge.fury.io/js/graphql)
8
- [![Build Status](https://github.com/graphql/graphql-js/workflows/CI/badge.svg?branch=main)](https://github.com/graphql/graphql-js/actions?query=branch%3Amain)
6
+ [![Build Status](https://github.com/graphql/graphql-js/actions/workflows/push.yml/badge.svg?branch=17.x.x)](https://github.com/graphql/graphql-js/actions/workflows/push.yml?query=branch%3A17.x.x)
9
7
 
10
8
  See more complete documentation at https://graphql.org/ and
11
9
  https://graphql.org/graphql-js/.
@@ -111,7 +109,7 @@ graphql({ schema, source }).then((result) => {
111
109
  ## Want to ride the bleeding edge?
112
110
 
113
111
  The `npm` branch in this repository is automatically maintained to be the last
114
- commit to `main` to pass all tests, in the same form found on npm. It is
112
+ commit to `17.x.x` to pass all tests, in the same form found on npm. It is
115
113
  recommended to use builds deployed to npm for many reasons, but if you want to use
116
114
  the latest not-yet-released version of graphql-js, you can do so by depending
117
115
  directly on this branch:
@@ -139,7 +137,7 @@ in files with the `.js` extension and the ESModule build within `.mjs` files.
139
137
 
140
138
  We actively welcome pull requests. Learn how to [contribute](./.github/CONTRIBUTING.md).
141
139
 
142
- 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/).
140
+ 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/).
143
141
 
144
142
  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.
145
143
 
@@ -0,0 +1 @@
1
+ export * from '../diagnostics.mjs';
@@ -0,0 +1 @@
1
+ export * from '../diagnostics.js';
@@ -0,0 +1,3 @@
1
+ const { enableDevMode } = require('../devMode.js');
2
+ enableDevMode();
3
+ module.exports = require('../diagnostics.js');
@@ -0,0 +1,3 @@
1
+ import { enableDevMode } from '../devMode.mjs';
2
+ enableDevMode();
3
+ export * from '../diagnostics.mjs';
@@ -0,0 +1,307 @@
1
+ /**
2
+ * TracingChannel integration.
3
+ *
4
+ * GraphQL.js publishes lifecycle events on a set of named tracing channels
5
+ * that application performance monitoring (APM) tools can subscribe to in
6
+ * order to observe parse, validate, execute, subscribe, and resolver behavior,
7
+ * plus selected executor internals. At module load time GraphQL.js resolves
8
+ * `node:diagnostics_channel` itself so APMs do not need to interact with the
9
+ * GraphQL API to enable tracing. On runtimes that do not expose
10
+ * `node:diagnostics_channel` (e.g., browsers) the load silently no-ops and
11
+ * emission sites short-circuit.
12
+ *
13
+ * Within the tracing context types, `error` means the traced JavaScript call
14
+ * threw or rejected; it does not mean every `GraphQLError` returned by
15
+ * GraphQL.js. Some channels complete normally and publish GraphQL errors on
16
+ * `result`. Resolver errors can appear both as `message.error` on
17
+ * `graphql:resolve` and as formatted errors in an enclosing execution or
18
+ * subscription result. `graphql:parse`, `graphql:validate`, and
19
+ * `graphql:execute:variableCoercion` are sync-only channels.
20
+ * @category Diagnostics
21
+ */
22
+ import type { Maybe } from "./jsutils/Maybe.mjs";
23
+ import type { ObjMap } from "./jsutils/ObjMap.mjs";
24
+ import type { GraphQLError } from "./error/GraphQLError.mjs";
25
+ import type { DocumentNode, OperationDefinitionNode, OperationTypeNode } from "./language/ast.mjs";
26
+ import type { Source } from "./language/source.mjs";
27
+ import type { GraphQLSchema } from "./type/schema.mjs";
28
+ import type { ExecutionResult } from "./execution/Executor.mjs";
29
+ import type { ExperimentalIncrementalExecutionResults } from "./execution/incremental/IncrementalExecutor.mjs";
30
+ import type { VariableValues } from "./execution/values.mjs";
31
+ /**
32
+ * Structural subset of `DiagnosticsChannel` sufficient for publishing and
33
+ * subscriber gating. The `node:diagnostics_channel` `Channel` satisfies this.
34
+ *
35
+ * @internal
36
+ */
37
+ export interface MinimalChannel<TMessage = unknown> {
38
+ readonly hasSubscribers?: boolean;
39
+ publish: (message: TMessage) => void;
40
+ runStores: <T, ContextType extends object>(context: ContextType, fn: (this: ContextType, ...args: Array<unknown>) => T, thisArg?: unknown, ...args: Array<unknown>) => T;
41
+ }
42
+ /**
43
+ * Structural subset of the Node.js `TracingChannel` API. The
44
+ * `node:diagnostics_channel` `TracingChannel` satisfies this by duck typing,
45
+ * so GraphQL.js does not need a dependency on `@types/node` or on the runtime
46
+ * itself.
47
+ *
48
+ * @internal
49
+ */
50
+ export interface MinimalTracingChannel<TContext = unknown> {
51
+ readonly hasSubscribers: boolean | undefined;
52
+ readonly start: MinimalChannel<TContext>;
53
+ readonly end: MinimalChannel<TContext>;
54
+ readonly asyncStart: MinimalChannel<TContext>;
55
+ readonly asyncEnd: MinimalChannel<TContext>;
56
+ readonly error: MinimalChannel<TContext>;
57
+ traceSync: <T>(fn: (...args: Array<unknown>) => T, context: TContext extends object ? TContext : object, thisArg?: unknown, ...args: Array<unknown>) => T;
58
+ }
59
+ /** Context published on the sync-only `graphql:parse` channel. */
60
+ export interface GraphQLParseContext {
61
+ /** Source text or source object passed to the parser. */
62
+ source: string | Source;
63
+ /** Error thrown while parsing, when parsing fails. */
64
+ error?: unknown;
65
+ /** Parsed document, when parsing succeeds. */
66
+ result?: DocumentNode;
67
+ }
68
+ /** Context published on the sync-only `graphql:validate` channel. */
69
+ export interface GraphQLValidateContext {
70
+ /** Schema used for validation. */
71
+ schema: GraphQLSchema;
72
+ /** Parsed document being validated. */
73
+ document: DocumentNode;
74
+ /** Error thrown while validating, when validation fails abruptly. */
75
+ error?: unknown;
76
+ /** Validation errors returned by validation. */
77
+ result?: ReadonlyArray<GraphQLError>;
78
+ }
79
+ /**
80
+ * Context published on `graphql:execute`.
81
+ *
82
+ * Returned results may contain GraphQL errors collected during execution.
83
+ */
84
+ export interface GraphQLExecuteContext {
85
+ /** Schema used for execution. */
86
+ schema: GraphQLSchema;
87
+ /** Parsed document being executed. */
88
+ document: DocumentNode;
89
+ /** Raw variable values provided by the caller before coercion. */
90
+ rawVariableValues: Maybe<{
91
+ readonly [variable: string]: unknown;
92
+ }>;
93
+ /** Selected operation name, if one is available. */
94
+ operationName: string | undefined;
95
+ /** Selected operation type, if one is available. */
96
+ operationType: OperationTypeNode | undefined;
97
+ /** Error thrown or rejected while executing, when execution fails abruptly. */
98
+ error?: unknown;
99
+ /** Execution result returned by execution, including GraphQL errors. */
100
+ result?: ExecutionResult | ExperimentalIncrementalExecutionResults;
101
+ }
102
+ /**
103
+ * Context published on `graphql:execute:rootSelectionSet`.
104
+ *
105
+ * Returned results may contain GraphQL errors collected during execution.
106
+ */
107
+ export interface GraphQLExecuteRootSelectionSetContext {
108
+ /** Schema used for execution. */
109
+ schema: GraphQLSchema;
110
+ /** Parsed document being executed. */
111
+ document: DocumentNode;
112
+ /** Operation definition selected for execution. */
113
+ operation: OperationDefinitionNode;
114
+ /** Raw variable values provided by the caller before coercion. */
115
+ rawVariableValues: Maybe<{
116
+ readonly [variable: string]: unknown;
117
+ }>;
118
+ /** Selected operation name, if one is available. */
119
+ operationName: string | undefined;
120
+ /** Selected operation type. */
121
+ operationType: OperationTypeNode;
122
+ /** Error thrown or rejected while executing the root selection set. */
123
+ error?: unknown;
124
+ /**
125
+ * Execution result returned from the root selection set, including GraphQL
126
+ * errors.
127
+ */
128
+ result?: ExecutionResult | ExperimentalIncrementalExecutionResults;
129
+ }
130
+ /**
131
+ * Context published on `graphql:execute:variableCoercion`.
132
+ *
133
+ * Coercion runs synchronously while execution arguments are validated, so only
134
+ * the `start`/`end` (and, on an abrupt throw, `error`) lifecycle fires.
135
+ * Ordinary variable coercion failures are returned on `result.errors`; when
136
+ * execution is invoked through APIs such as `execute()` or `subscribe()`, they
137
+ * surface as GraphQL result errors rather than as the tracing `error`
138
+ * lifecycle event.
139
+ */
140
+ export interface GraphQLExecuteVariableCoercionContext {
141
+ /** Schema used for variable coercion. */
142
+ schema: GraphQLSchema;
143
+ /** Parsed document being executed. */
144
+ document: DocumentNode;
145
+ /** Operation definition whose variables are being coerced. */
146
+ operation: OperationDefinitionNode;
147
+ /** Raw variable values provided by the caller before coercion. */
148
+ rawVariableValues: Maybe<{
149
+ readonly [variable: string]: unknown;
150
+ }>;
151
+ /** Selected operation name, if one is available. */
152
+ operationName: string | undefined;
153
+ /** Selected operation type. */
154
+ operationType: OperationTypeNode;
155
+ /** Error thrown while coercing variables, when coercion fails abruptly. */
156
+ error?: unknown;
157
+ /** Coerced variable values or coercion errors returned by coercion. */
158
+ result?: {
159
+ variableValues: VariableValues;
160
+ } | {
161
+ errors: ReadonlyArray<GraphQLError>;
162
+ };
163
+ }
164
+ /**
165
+ * Context published on `graphql:subscribe`.
166
+ *
167
+ * Subscription source resolver errors and invalid source stream results are
168
+ * returned on `result` as ExecutionResult errors; they do not publish the
169
+ * `error` lifecycle event unless subscription setup fails abruptly before
170
+ * GraphQL can form a result.
171
+ */
172
+ export interface GraphQLSubscribeContext {
173
+ /** Schema used for subscription execution. */
174
+ schema: GraphQLSchema;
175
+ /** Parsed subscription document. */
176
+ document: DocumentNode;
177
+ /** Raw variable values provided by the caller before coercion. */
178
+ rawVariableValues: Maybe<{
179
+ readonly [variable: string]: unknown;
180
+ }>;
181
+ /** Selected operation name, if one is available. */
182
+ operationName: string | undefined;
183
+ /** Selected operation type, if one is available. */
184
+ operationType: OperationTypeNode | undefined;
185
+ /** Error thrown or rejected while subscribing, when setup fails abruptly. */
186
+ error?: unknown;
187
+ /**
188
+ * Subscription response stream, or an ExecutionResult containing GraphQL
189
+ * errors.
190
+ */
191
+ result?: AsyncGenerator<ExecutionResult, void, void> | ExecutionResult;
192
+ }
193
+ /**
194
+ * Context published on `graphql:resolve`.
195
+ *
196
+ * Resolver throws and rejections publish the `error` lifecycle event here.
197
+ * The same failure may also be formatted into the enclosing execution or
198
+ * subscription result.
199
+ */
200
+ export interface GraphQLResolveContext {
201
+ /** Field name being resolved. */
202
+ fieldName: string;
203
+ /** Response alias for the field being resolved. */
204
+ alias: string;
205
+ /** Parent type name for the field being resolved. */
206
+ parentType: string;
207
+ /** Return type string for the field being resolved. */
208
+ fieldType: string;
209
+ /** Argument values passed to the resolver. */
210
+ args: ObjMap<unknown>;
211
+ /** Whether the field is using the default resolver. */
212
+ isDefaultResolver: boolean;
213
+ /** Response path for the field being resolved. */
214
+ fieldPath: string;
215
+ /** Error thrown or rejected by the resolver, when resolution fails. */
216
+ error?: unknown;
217
+ /** Value returned by the resolver, when resolution succeeds. */
218
+ result?: unknown;
219
+ }
220
+ /** Mapping from tracing channel name to the context type published on it. */
221
+ export interface GraphQLChannelContextByName {
222
+ /** Context published on `graphql:parse`. */
223
+ 'graphql:parse': GraphQLParseContext;
224
+ /** Context published on `graphql:validate`. */
225
+ 'graphql:validate': GraphQLValidateContext;
226
+ /** Context published on `graphql:execute`. */
227
+ 'graphql:execute': GraphQLExecuteContext;
228
+ /** Context published on `graphql:execute:variableCoercion`. */
229
+ 'graphql:execute:variableCoercion': GraphQLExecuteVariableCoercionContext;
230
+ /** Context published on `graphql:execute:rootSelectionSet`. */
231
+ 'graphql:execute:rootSelectionSet': GraphQLExecuteRootSelectionSetContext;
232
+ /** Context published on `graphql:subscribe`. */
233
+ 'graphql:subscribe': GraphQLSubscribeContext;
234
+ /** Context published on `graphql:resolve`. */
235
+ 'graphql:resolve': GraphQLResolveContext;
236
+ }
237
+ /**
238
+ * The collection of tracing channels GraphQL.js emits on. Application
239
+ * performance monitoring (APM) tools subscribe to these by name on their own
240
+ * `node:diagnostics_channel` import; both paths land on the same channel
241
+ * instance because `tracingChannel(name)` is cached by name.
242
+ */
243
+ export interface GraphQLChannels {
244
+ /** Tracing channel for `graphql:execute`. */
245
+ execute: MinimalTracingChannel<GraphQLExecuteContext>;
246
+ /** Tracing channel for `graphql:execute:variableCoercion`. */
247
+ executeVariableCoercion: MinimalTracingChannel<GraphQLExecuteVariableCoercionContext>;
248
+ /** Tracing channel for `graphql:execute:rootSelectionSet`. */
249
+ executeRootSelectionSet: MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext>;
250
+ /** Tracing channel for `graphql:parse`. */
251
+ parse: MinimalTracingChannel<GraphQLParseContext>;
252
+ /** Tracing channel for `graphql:validate`. */
253
+ validate: MinimalTracingChannel<GraphQLValidateContext>;
254
+ /** Tracing channel for `graphql:resolve`. */
255
+ resolve: MinimalTracingChannel<GraphQLResolveContext>;
256
+ /** Tracing channel for `graphql:subscribe`. */
257
+ subscribe: MinimalTracingChannel<GraphQLSubscribeContext>;
258
+ }
259
+ /**
260
+ * Per-channel handles, resolved once at module load. `undefined` when
261
+ * `node:diagnostics_channel` isn't available. Emission sites read these
262
+ * directly to keep the no-subscriber fast path to a single property access
263
+ * plus a `hasSubscribers` check (no function calls, no closures).
264
+ *
265
+ * @internal
266
+ */
267
+ export declare const parseChannel: MinimalTracingChannel<GraphQLParseContext> | undefined;
268
+ /** @internal */
269
+ export declare const validateChannel: MinimalTracingChannel<GraphQLValidateContext> | undefined;
270
+ /** @internal */
271
+ export declare const executeChannel: MinimalTracingChannel<GraphQLExecuteContext> | undefined;
272
+ /** @internal */
273
+ export declare const executeVariableCoercionChannel: MinimalTracingChannel<GraphQLExecuteVariableCoercionContext> | undefined;
274
+ /** @internal */
275
+ export declare const executeRootSelectionSetChannel: MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext> | undefined;
276
+ /** @internal */
277
+ export declare const subscribeChannel: MinimalTracingChannel<GraphQLSubscribeContext> | undefined;
278
+ /** @internal */
279
+ export declare const resolveChannel: MinimalTracingChannel<GraphQLResolveContext> | undefined;
280
+ /**
281
+ * Whether emission sites should publish to `channel`. Trusts the
282
+ * `TracingChannel.hasSubscribers` aggregate when the runtime exposes it; if
283
+ * the getter is missing (e.g. Bun's `node:diagnostics_channel`, where
284
+ * `tracingChannel.hasSubscribers` is `undefined`), falls back to checking
285
+ * each of the five underlying lifecycle channels so a subscriber attached
286
+ * via `tracingChannel.subscribe(handlers)` is still observed.
287
+ *
288
+ * @internal
289
+ */
290
+ export declare function shouldTrace<TContext = unknown>(channel: MinimalTracingChannel<TContext> | undefined): channel is MinimalTracingChannel<TContext>;
291
+ interface TraceLifecycleContext {
292
+ error?: unknown;
293
+ result?: unknown;
294
+ }
295
+ type TraceStartContext<TContext extends TraceLifecycleContext> = Omit<TContext, 'error' | 'result'>;
296
+ /**
297
+ * Publish a traced call that may complete synchronously or with a promise.
298
+ * Caller has already verified that a subscriber is attached. On normal
299
+ * completion, `result` is attached before the terminal `end` or `asyncEnd`
300
+ * event. When the traced call throws or rejects, `error` is attached, the
301
+ * `error` sub-channel fires, and the terminal `end` or `asyncEnd` event is
302
+ * published before the original failure is propagated.
303
+ *
304
+ * @internal
305
+ */
306
+ export declare function traceMixed<TResult, TContext extends TraceLifecycleContext>(channel: MinimalTracingChannel<TContext>, contextInput: TraceStartContext<TContext>, fn: () => TResult): TResult;
307
+ export {};
@@ -0,0 +1,307 @@
1
+ /**
2
+ * TracingChannel integration.
3
+ *
4
+ * GraphQL.js publishes lifecycle events on a set of named tracing channels
5
+ * that application performance monitoring (APM) tools can subscribe to in
6
+ * order to observe parse, validate, execute, subscribe, and resolver behavior,
7
+ * plus selected executor internals. At module load time GraphQL.js resolves
8
+ * `node:diagnostics_channel` itself so APMs do not need to interact with the
9
+ * GraphQL API to enable tracing. On runtimes that do not expose
10
+ * `node:diagnostics_channel` (e.g., browsers) the load silently no-ops and
11
+ * emission sites short-circuit.
12
+ *
13
+ * Within the tracing context types, `error` means the traced JavaScript call
14
+ * threw or rejected; it does not mean every `GraphQLError` returned by
15
+ * GraphQL.js. Some channels complete normally and publish GraphQL errors on
16
+ * `result`. Resolver errors can appear both as `message.error` on
17
+ * `graphql:resolve` and as formatted errors in an enclosing execution or
18
+ * subscription result. `graphql:parse`, `graphql:validate`, and
19
+ * `graphql:execute:variableCoercion` are sync-only channels.
20
+ * @category Diagnostics
21
+ */
22
+ import type { Maybe } from "./jsutils/Maybe.js";
23
+ import type { ObjMap } from "./jsutils/ObjMap.js";
24
+ import type { GraphQLError } from "./error/GraphQLError.js";
25
+ import type { DocumentNode, OperationDefinitionNode, OperationTypeNode } from "./language/ast.js";
26
+ import type { Source } from "./language/source.js";
27
+ import type { GraphQLSchema } from "./type/schema.js";
28
+ import type { ExecutionResult } from "./execution/Executor.js";
29
+ import type { ExperimentalIncrementalExecutionResults } from "./execution/incremental/IncrementalExecutor.js";
30
+ import type { VariableValues } from "./execution/values.js";
31
+ /**
32
+ * Structural subset of `DiagnosticsChannel` sufficient for publishing and
33
+ * subscriber gating. The `node:diagnostics_channel` `Channel` satisfies this.
34
+ *
35
+ * @internal
36
+ */
37
+ export interface MinimalChannel<TMessage = unknown> {
38
+ readonly hasSubscribers?: boolean;
39
+ publish: (message: TMessage) => void;
40
+ runStores: <T, ContextType extends object>(context: ContextType, fn: (this: ContextType, ...args: Array<unknown>) => T, thisArg?: unknown, ...args: Array<unknown>) => T;
41
+ }
42
+ /**
43
+ * Structural subset of the Node.js `TracingChannel` API. The
44
+ * `node:diagnostics_channel` `TracingChannel` satisfies this by duck typing,
45
+ * so GraphQL.js does not need a dependency on `@types/node` or on the runtime
46
+ * itself.
47
+ *
48
+ * @internal
49
+ */
50
+ export interface MinimalTracingChannel<TContext = unknown> {
51
+ readonly hasSubscribers: boolean | undefined;
52
+ readonly start: MinimalChannel<TContext>;
53
+ readonly end: MinimalChannel<TContext>;
54
+ readonly asyncStart: MinimalChannel<TContext>;
55
+ readonly asyncEnd: MinimalChannel<TContext>;
56
+ readonly error: MinimalChannel<TContext>;
57
+ traceSync: <T>(fn: (...args: Array<unknown>) => T, context: TContext extends object ? TContext : object, thisArg?: unknown, ...args: Array<unknown>) => T;
58
+ }
59
+ /** Context published on the sync-only `graphql:parse` channel. */
60
+ export interface GraphQLParseContext {
61
+ /** Source text or source object passed to the parser. */
62
+ source: string | Source;
63
+ /** Error thrown while parsing, when parsing fails. */
64
+ error?: unknown;
65
+ /** Parsed document, when parsing succeeds. */
66
+ result?: DocumentNode;
67
+ }
68
+ /** Context published on the sync-only `graphql:validate` channel. */
69
+ export interface GraphQLValidateContext {
70
+ /** Schema used for validation. */
71
+ schema: GraphQLSchema;
72
+ /** Parsed document being validated. */
73
+ document: DocumentNode;
74
+ /** Error thrown while validating, when validation fails abruptly. */
75
+ error?: unknown;
76
+ /** Validation errors returned by validation. */
77
+ result?: ReadonlyArray<GraphQLError>;
78
+ }
79
+ /**
80
+ * Context published on `graphql:execute`.
81
+ *
82
+ * Returned results may contain GraphQL errors collected during execution.
83
+ */
84
+ export interface GraphQLExecuteContext {
85
+ /** Schema used for execution. */
86
+ schema: GraphQLSchema;
87
+ /** Parsed document being executed. */
88
+ document: DocumentNode;
89
+ /** Raw variable values provided by the caller before coercion. */
90
+ rawVariableValues: Maybe<{
91
+ readonly [variable: string]: unknown;
92
+ }>;
93
+ /** Selected operation name, if one is available. */
94
+ operationName: string | undefined;
95
+ /** Selected operation type, if one is available. */
96
+ operationType: OperationTypeNode | undefined;
97
+ /** Error thrown or rejected while executing, when execution fails abruptly. */
98
+ error?: unknown;
99
+ /** Execution result returned by execution, including GraphQL errors. */
100
+ result?: ExecutionResult | ExperimentalIncrementalExecutionResults;
101
+ }
102
+ /**
103
+ * Context published on `graphql:execute:rootSelectionSet`.
104
+ *
105
+ * Returned results may contain GraphQL errors collected during execution.
106
+ */
107
+ export interface GraphQLExecuteRootSelectionSetContext {
108
+ /** Schema used for execution. */
109
+ schema: GraphQLSchema;
110
+ /** Parsed document being executed. */
111
+ document: DocumentNode;
112
+ /** Operation definition selected for execution. */
113
+ operation: OperationDefinitionNode;
114
+ /** Raw variable values provided by the caller before coercion. */
115
+ rawVariableValues: Maybe<{
116
+ readonly [variable: string]: unknown;
117
+ }>;
118
+ /** Selected operation name, if one is available. */
119
+ operationName: string | undefined;
120
+ /** Selected operation type. */
121
+ operationType: OperationTypeNode;
122
+ /** Error thrown or rejected while executing the root selection set. */
123
+ error?: unknown;
124
+ /**
125
+ * Execution result returned from the root selection set, including GraphQL
126
+ * errors.
127
+ */
128
+ result?: ExecutionResult | ExperimentalIncrementalExecutionResults;
129
+ }
130
+ /**
131
+ * Context published on `graphql:execute:variableCoercion`.
132
+ *
133
+ * Coercion runs synchronously while execution arguments are validated, so only
134
+ * the `start`/`end` (and, on an abrupt throw, `error`) lifecycle fires.
135
+ * Ordinary variable coercion failures are returned on `result.errors`; when
136
+ * execution is invoked through APIs such as `execute()` or `subscribe()`, they
137
+ * surface as GraphQL result errors rather than as the tracing `error`
138
+ * lifecycle event.
139
+ */
140
+ export interface GraphQLExecuteVariableCoercionContext {
141
+ /** Schema used for variable coercion. */
142
+ schema: GraphQLSchema;
143
+ /** Parsed document being executed. */
144
+ document: DocumentNode;
145
+ /** Operation definition whose variables are being coerced. */
146
+ operation: OperationDefinitionNode;
147
+ /** Raw variable values provided by the caller before coercion. */
148
+ rawVariableValues: Maybe<{
149
+ readonly [variable: string]: unknown;
150
+ }>;
151
+ /** Selected operation name, if one is available. */
152
+ operationName: string | undefined;
153
+ /** Selected operation type. */
154
+ operationType: OperationTypeNode;
155
+ /** Error thrown while coercing variables, when coercion fails abruptly. */
156
+ error?: unknown;
157
+ /** Coerced variable values or coercion errors returned by coercion. */
158
+ result?: {
159
+ variableValues: VariableValues;
160
+ } | {
161
+ errors: ReadonlyArray<GraphQLError>;
162
+ };
163
+ }
164
+ /**
165
+ * Context published on `graphql:subscribe`.
166
+ *
167
+ * Subscription source resolver errors and invalid source stream results are
168
+ * returned on `result` as ExecutionResult errors; they do not publish the
169
+ * `error` lifecycle event unless subscription setup fails abruptly before
170
+ * GraphQL can form a result.
171
+ */
172
+ export interface GraphQLSubscribeContext {
173
+ /** Schema used for subscription execution. */
174
+ schema: GraphQLSchema;
175
+ /** Parsed subscription document. */
176
+ document: DocumentNode;
177
+ /** Raw variable values provided by the caller before coercion. */
178
+ rawVariableValues: Maybe<{
179
+ readonly [variable: string]: unknown;
180
+ }>;
181
+ /** Selected operation name, if one is available. */
182
+ operationName: string | undefined;
183
+ /** Selected operation type, if one is available. */
184
+ operationType: OperationTypeNode | undefined;
185
+ /** Error thrown or rejected while subscribing, when setup fails abruptly. */
186
+ error?: unknown;
187
+ /**
188
+ * Subscription response stream, or an ExecutionResult containing GraphQL
189
+ * errors.
190
+ */
191
+ result?: AsyncGenerator<ExecutionResult, void, void> | ExecutionResult;
192
+ }
193
+ /**
194
+ * Context published on `graphql:resolve`.
195
+ *
196
+ * Resolver throws and rejections publish the `error` lifecycle event here.
197
+ * The same failure may also be formatted into the enclosing execution or
198
+ * subscription result.
199
+ */
200
+ export interface GraphQLResolveContext {
201
+ /** Field name being resolved. */
202
+ fieldName: string;
203
+ /** Response alias for the field being resolved. */
204
+ alias: string;
205
+ /** Parent type name for the field being resolved. */
206
+ parentType: string;
207
+ /** Return type string for the field being resolved. */
208
+ fieldType: string;
209
+ /** Argument values passed to the resolver. */
210
+ args: ObjMap<unknown>;
211
+ /** Whether the field is using the default resolver. */
212
+ isDefaultResolver: boolean;
213
+ /** Response path for the field being resolved. */
214
+ fieldPath: string;
215
+ /** Error thrown or rejected by the resolver, when resolution fails. */
216
+ error?: unknown;
217
+ /** Value returned by the resolver, when resolution succeeds. */
218
+ result?: unknown;
219
+ }
220
+ /** Mapping from tracing channel name to the context type published on it. */
221
+ export interface GraphQLChannelContextByName {
222
+ /** Context published on `graphql:parse`. */
223
+ 'graphql:parse': GraphQLParseContext;
224
+ /** Context published on `graphql:validate`. */
225
+ 'graphql:validate': GraphQLValidateContext;
226
+ /** Context published on `graphql:execute`. */
227
+ 'graphql:execute': GraphQLExecuteContext;
228
+ /** Context published on `graphql:execute:variableCoercion`. */
229
+ 'graphql:execute:variableCoercion': GraphQLExecuteVariableCoercionContext;
230
+ /** Context published on `graphql:execute:rootSelectionSet`. */
231
+ 'graphql:execute:rootSelectionSet': GraphQLExecuteRootSelectionSetContext;
232
+ /** Context published on `graphql:subscribe`. */
233
+ 'graphql:subscribe': GraphQLSubscribeContext;
234
+ /** Context published on `graphql:resolve`. */
235
+ 'graphql:resolve': GraphQLResolveContext;
236
+ }
237
+ /**
238
+ * The collection of tracing channels GraphQL.js emits on. Application
239
+ * performance monitoring (APM) tools subscribe to these by name on their own
240
+ * `node:diagnostics_channel` import; both paths land on the same channel
241
+ * instance because `tracingChannel(name)` is cached by name.
242
+ */
243
+ export interface GraphQLChannels {
244
+ /** Tracing channel for `graphql:execute`. */
245
+ execute: MinimalTracingChannel<GraphQLExecuteContext>;
246
+ /** Tracing channel for `graphql:execute:variableCoercion`. */
247
+ executeVariableCoercion: MinimalTracingChannel<GraphQLExecuteVariableCoercionContext>;
248
+ /** Tracing channel for `graphql:execute:rootSelectionSet`. */
249
+ executeRootSelectionSet: MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext>;
250
+ /** Tracing channel for `graphql:parse`. */
251
+ parse: MinimalTracingChannel<GraphQLParseContext>;
252
+ /** Tracing channel for `graphql:validate`. */
253
+ validate: MinimalTracingChannel<GraphQLValidateContext>;
254
+ /** Tracing channel for `graphql:resolve`. */
255
+ resolve: MinimalTracingChannel<GraphQLResolveContext>;
256
+ /** Tracing channel for `graphql:subscribe`. */
257
+ subscribe: MinimalTracingChannel<GraphQLSubscribeContext>;
258
+ }
259
+ /**
260
+ * Per-channel handles, resolved once at module load. `undefined` when
261
+ * `node:diagnostics_channel` isn't available. Emission sites read these
262
+ * directly to keep the no-subscriber fast path to a single property access
263
+ * plus a `hasSubscribers` check (no function calls, no closures).
264
+ *
265
+ * @internal
266
+ */
267
+ export declare const parseChannel: MinimalTracingChannel<GraphQLParseContext> | undefined;
268
+ /** @internal */
269
+ export declare const validateChannel: MinimalTracingChannel<GraphQLValidateContext> | undefined;
270
+ /** @internal */
271
+ export declare const executeChannel: MinimalTracingChannel<GraphQLExecuteContext> | undefined;
272
+ /** @internal */
273
+ export declare const executeVariableCoercionChannel: MinimalTracingChannel<GraphQLExecuteVariableCoercionContext> | undefined;
274
+ /** @internal */
275
+ export declare const executeRootSelectionSetChannel: MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext> | undefined;
276
+ /** @internal */
277
+ export declare const subscribeChannel: MinimalTracingChannel<GraphQLSubscribeContext> | undefined;
278
+ /** @internal */
279
+ export declare const resolveChannel: MinimalTracingChannel<GraphQLResolveContext> | undefined;
280
+ /**
281
+ * Whether emission sites should publish to `channel`. Trusts the
282
+ * `TracingChannel.hasSubscribers` aggregate when the runtime exposes it; if
283
+ * the getter is missing (e.g. Bun's `node:diagnostics_channel`, where
284
+ * `tracingChannel.hasSubscribers` is `undefined`), falls back to checking
285
+ * each of the five underlying lifecycle channels so a subscriber attached
286
+ * via `tracingChannel.subscribe(handlers)` is still observed.
287
+ *
288
+ * @internal
289
+ */
290
+ export declare function shouldTrace<TContext = unknown>(channel: MinimalTracingChannel<TContext> | undefined): channel is MinimalTracingChannel<TContext>;
291
+ interface TraceLifecycleContext {
292
+ error?: unknown;
293
+ result?: unknown;
294
+ }
295
+ type TraceStartContext<TContext extends TraceLifecycleContext> = Omit<TContext, 'error' | 'result'>;
296
+ /**
297
+ * Publish a traced call that may complete synchronously or with a promise.
298
+ * Caller has already verified that a subscriber is attached. On normal
299
+ * completion, `result` is attached before the terminal `end` or `asyncEnd`
300
+ * event. When the traced call throws or rejects, `error` is attached, the
301
+ * `error` sub-channel fires, and the terminal `end` or `asyncEnd` event is
302
+ * published before the original failure is propagated.
303
+ *
304
+ * @internal
305
+ */
306
+ export declare function traceMixed<TResult, TContext extends TraceLifecycleContext>(channel: MinimalTracingChannel<TContext>, contextInput: TraceStartContext<TContext>, fn: () => TResult): TResult;
307
+ export {};