graphql 17.0.0 → 17.0.2
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/diagnostics.js +2 -1
- package/diagnostics.js.map +1 -1
- package/diagnostics.mjs +2 -1
- package/diagnostics.mjs.map +1 -1
- package/package.json +1 -4
- package/utilities/findSchemaChanges.d.mts +2 -0
- package/utilities/findSchemaChanges.d.ts +2 -0
- package/utilities/findSchemaChanges.js +25 -0
- package/utilities/findSchemaChanges.js.map +1 -1
- package/utilities/findSchemaChanges.mjs +25 -0
- package/utilities/findSchemaChanges.mjs.map +1 -1
- package/utilities/mapSchemaConfig.js +1 -1
- package/utilities/mapSchemaConfig.js.map +1 -1
- package/utilities/mapSchemaConfig.mjs +1 -1
- package/utilities/mapSchemaConfig.mjs.map +1 -1
- package/version.js +2 -2
- package/version.js.map +1 -1
- package/version.mjs +2 -2
- package/version.mjs.map +1 -1
package/diagnostics.js
CHANGED
|
@@ -59,14 +59,15 @@ function traceMixed(channel, contextInput, fn) {
|
|
|
59
59
|
return result;
|
|
60
60
|
}
|
|
61
61
|
channel.end.publish(context);
|
|
62
|
-
channel.asyncStart.publish(context);
|
|
63
62
|
return result.then((value) => {
|
|
64
63
|
context.result = value;
|
|
64
|
+
channel.asyncStart.publish(context);
|
|
65
65
|
channel.asyncEnd.publish(context);
|
|
66
66
|
return value;
|
|
67
67
|
}, (err) => {
|
|
68
68
|
context.error = err;
|
|
69
69
|
channel.error.publish(context);
|
|
70
|
+
channel.asyncStart.publish(context);
|
|
70
71
|
channel.asyncEnd.publish(context);
|
|
71
72
|
throw err;
|
|
72
73
|
});
|
package/diagnostics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":";;;AA6WA,kCAiBC;AAsBD,gCAyCC;AAvaD,yDAAuD;AA2QvD,SAAS,yBAAyB;IAChC,IAAI,EAAwC,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AO,CAAC,OAAO,CAAC,CAAC;YAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAClC,MAAM,GAAG,CAAC;QACZ,CAAC,CACS,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * TracingChannel integration.\n *\n * GraphQL.js publishes lifecycle events on a set of named tracing channels\n * that application performance monitoring (APM) tools can subscribe to in\n * order to observe parse, validate, execute, subscribe, and resolver behavior,\n * plus selected executor internals. At module load time GraphQL.js resolves\n * `node:diagnostics_channel` itself so APMs do not need to interact with the\n * GraphQL API to enable tracing. On runtimes that do not expose\n * `node:diagnostics_channel` (e.g., browsers) the load silently no-ops and\n * emission sites short-circuit.\n *\n * Within the tracing context types, `error` means the traced JavaScript call\n * threw or rejected; it does not mean every `GraphQLError` returned by\n * GraphQL.js. Some channels complete normally and publish GraphQL errors on\n * `result`. Resolver errors can appear both as `message.error` on\n * `graphql:resolve` and as formatted errors in an enclosing execution or\n * subscription result. `graphql:parse`, `graphql:validate`, and\n * `graphql:execute:variableCoercion` are sync-only channels.\n * @category Diagnostics\n */\n\nimport { isPromiseLike } from './jsutils/isPromise.ts';\nimport type { Maybe } from './jsutils/Maybe.ts';\nimport type { ObjMap } from './jsutils/ObjMap.ts';\n\nimport type { GraphQLError } from './error/GraphQLError.ts';\n\nimport type {\n DocumentNode,\n OperationDefinitionNode,\n OperationTypeNode,\n} from './language/ast.ts';\nimport type { Source } from './language/source.ts';\n\nimport type { GraphQLSchema } from './type/schema.ts';\n\nimport type { ExecutionResult } from './execution/Executor.ts';\nimport type { ExperimentalIncrementalExecutionResults } from './execution/incremental/IncrementalExecutor.ts';\nimport type { VariableValues } from './execution/values.ts';\n\n/**\n * Structural subset of `DiagnosticsChannel` sufficient for publishing and\n * subscriber gating. The `node:diagnostics_channel` `Channel` satisfies this.\n *\n * @internal\n */\nexport interface MinimalChannel<TMessage = unknown> {\n readonly hasSubscribers?: boolean;\n publish: (message: TMessage) => void;\n runStores: <T, ContextType extends object>(\n context: ContextType,\n fn: (this: ContextType, ...args: Array<unknown>) => T,\n thisArg?: unknown,\n ...args: Array<unknown>\n ) => T;\n}\n\n/**\n * Structural subset of the Node.js `TracingChannel` API. The\n * `node:diagnostics_channel` `TracingChannel` satisfies this by duck typing,\n * so GraphQL.js does not need a dependency on `@types/node` or on the runtime\n * itself.\n *\n * @internal\n */\nexport interface MinimalTracingChannel<TContext = unknown> {\n // `undefined` accommodates runtimes (e.g. Bun) that ship `tracingChannel`\n // without exposing the aggregate `hasSubscribers` getter.\n readonly hasSubscribers: boolean | undefined;\n readonly start: MinimalChannel<TContext>;\n readonly end: MinimalChannel<TContext>;\n readonly asyncStart: MinimalChannel<TContext>;\n readonly asyncEnd: MinimalChannel<TContext>;\n readonly error: MinimalChannel<TContext>;\n\n traceSync: <T>(\n fn: (...args: Array<unknown>) => T,\n context: TContext extends object ? TContext : object,\n thisArg?: unknown,\n ...args: Array<unknown>\n ) => T;\n}\n\ninterface DiagnosticsChannelModule {\n tracingChannel: <TContext = unknown>(\n name: string,\n ) => MinimalTracingChannel<TContext>;\n}\n\n/** Context published on the sync-only `graphql:parse` channel. */\nexport interface GraphQLParseContext {\n /** Source text or source object passed to the parser. */\n source: string | Source;\n /** Error thrown while parsing, when parsing fails. */\n error?: unknown;\n /** Parsed document, when parsing succeeds. */\n result?: DocumentNode;\n}\n\n/** Context published on the sync-only `graphql:validate` channel. */\nexport interface GraphQLValidateContext {\n /** Schema used for validation. */\n schema: GraphQLSchema;\n /** Parsed document being validated. */\n document: DocumentNode;\n /** Error thrown while validating, when validation fails abruptly. */\n error?: unknown;\n /** Validation errors returned by validation. */\n result?: ReadonlyArray<GraphQLError>;\n}\n\n/**\n * Context published on `graphql:execute`.\n *\n * Returned results may contain GraphQL errors collected during execution.\n */\nexport interface GraphQLExecuteContext {\n /** Schema used for execution. */\n schema: GraphQLSchema;\n /** Parsed document being executed. */\n document: DocumentNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type, if one is available. */\n operationType: OperationTypeNode | undefined;\n /** Error thrown or rejected while executing, when execution fails abruptly. */\n error?: unknown;\n /** Execution result returned by execution, including GraphQL errors. */\n result?: ExecutionResult | ExperimentalIncrementalExecutionResults;\n}\n\n/**\n * Context published on `graphql:execute:rootSelectionSet`.\n *\n * Returned results may contain GraphQL errors collected during execution.\n */\nexport interface GraphQLExecuteRootSelectionSetContext {\n /** Schema used for execution. */\n schema: GraphQLSchema;\n /** Parsed document being executed. */\n document: DocumentNode;\n /** Operation definition selected for execution. */\n operation: OperationDefinitionNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type. */\n operationType: OperationTypeNode;\n /** Error thrown or rejected while executing the root selection set. */\n error?: unknown;\n /**\n * Execution result returned from the root selection set, including GraphQL\n * errors.\n */\n result?: ExecutionResult | ExperimentalIncrementalExecutionResults;\n}\n\n/**\n * Context published on `graphql:execute:variableCoercion`.\n *\n * Coercion runs synchronously while execution arguments are validated, so only\n * the `start`/`end` (and, on an abrupt throw, `error`) lifecycle fires.\n * Ordinary variable coercion failures are returned on `result.errors`; when\n * execution is invoked through APIs such as `execute()` or `subscribe()`, they\n * surface as GraphQL result errors rather than as the tracing `error`\n * lifecycle event.\n */\nexport interface GraphQLExecuteVariableCoercionContext {\n /** Schema used for variable coercion. */\n schema: GraphQLSchema;\n /** Parsed document being executed. */\n document: DocumentNode;\n /** Operation definition whose variables are being coerced. */\n operation: OperationDefinitionNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type. */\n operationType: OperationTypeNode;\n /** Error thrown while coercing variables, when coercion fails abruptly. */\n error?: unknown;\n /** Coerced variable values or coercion errors returned by coercion. */\n result?:\n | { variableValues: VariableValues }\n | { errors: ReadonlyArray<GraphQLError> };\n}\n\n/**\n * Context published on `graphql:subscribe`.\n *\n * Subscription source resolver errors and invalid source stream results are\n * returned on `result` as ExecutionResult errors; they do not publish the\n * `error` lifecycle event unless subscription setup fails abruptly before\n * GraphQL can form a result.\n */\nexport interface GraphQLSubscribeContext {\n /** Schema used for subscription execution. */\n schema: GraphQLSchema;\n /** Parsed subscription document. */\n document: DocumentNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type, if one is available. */\n operationType: OperationTypeNode | undefined;\n /** Error thrown or rejected while subscribing, when setup fails abruptly. */\n error?: unknown;\n /**\n * Subscription response stream, or an ExecutionResult containing GraphQL\n * errors.\n */\n result?: AsyncGenerator<ExecutionResult, void, void> | ExecutionResult;\n}\n\n/**\n * Context published on `graphql:resolve`.\n *\n * Resolver throws and rejections publish the `error` lifecycle event here.\n * The same failure may also be formatted into the enclosing execution or\n * subscription result.\n */\nexport interface GraphQLResolveContext {\n /** Field name being resolved. */\n fieldName: string;\n /** Response alias for the field being resolved. */\n alias: string;\n /** Parent type name for the field being resolved. */\n parentType: string;\n /** Return type string for the field being resolved. */\n fieldType: string;\n /** Argument values passed to the resolver. */\n args: ObjMap<unknown>;\n /** Whether the field is using the default resolver. */\n isDefaultResolver: boolean;\n /** Response path for the field being resolved. */\n fieldPath: string;\n /** Error thrown or rejected by the resolver, when resolution fails. */\n error?: unknown;\n /** Value returned by the resolver, when resolution succeeds. */\n result?: unknown;\n}\n\n/** Mapping from tracing channel name to the context type published on it. */\nexport interface GraphQLChannelContextByName {\n /** Context published on `graphql:parse`. */\n 'graphql:parse': GraphQLParseContext;\n /** Context published on `graphql:validate`. */\n 'graphql:validate': GraphQLValidateContext;\n /** Context published on `graphql:execute`. */\n 'graphql:execute': GraphQLExecuteContext;\n /** Context published on `graphql:execute:variableCoercion`. */\n 'graphql:execute:variableCoercion': GraphQLExecuteVariableCoercionContext;\n /** Context published on `graphql:execute:rootSelectionSet`. */\n 'graphql:execute:rootSelectionSet': GraphQLExecuteRootSelectionSetContext;\n /** Context published on `graphql:subscribe`. */\n 'graphql:subscribe': GraphQLSubscribeContext;\n /** Context published on `graphql:resolve`. */\n 'graphql:resolve': GraphQLResolveContext;\n}\n\n/**\n * The collection of tracing channels GraphQL.js emits on. Application\n * performance monitoring (APM) tools subscribe to these by name on their own\n * `node:diagnostics_channel` import; both paths land on the same channel\n * instance because `tracingChannel(name)` is cached by name.\n */\nexport interface GraphQLChannels {\n /** Tracing channel for `graphql:execute`. */\n execute: MinimalTracingChannel<GraphQLExecuteContext>;\n /** Tracing channel for `graphql:execute:variableCoercion`. */\n executeVariableCoercion: MinimalTracingChannel<GraphQLExecuteVariableCoercionContext>;\n /** Tracing channel for `graphql:execute:rootSelectionSet`. */\n executeRootSelectionSet: MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext>;\n /** Tracing channel for `graphql:parse`. */\n parse: MinimalTracingChannel<GraphQLParseContext>;\n /** Tracing channel for `graphql:validate`. */\n validate: MinimalTracingChannel<GraphQLValidateContext>;\n /** Tracing channel for `graphql:resolve`. */\n resolve: MinimalTracingChannel<GraphQLResolveContext>;\n /** Tracing channel for `graphql:subscribe`. */\n subscribe: MinimalTracingChannel<GraphQLSubscribeContext>;\n}\n\nfunction resolveDiagnosticsChannel(): DiagnosticsChannelModule | undefined {\n let dc: DiagnosticsChannelModule | undefined;\n try {\n const processRef = (\n globalThis as {\n process?: { getBuiltinModule?: (id: string) => unknown };\n }\n ).process;\n if (\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n typeof processRef?.getBuiltinModule === 'function'\n ) {\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n dc = processRef.getBuiltinModule(\n 'node:diagnostics_channel',\n ) as DiagnosticsChannelModule;\n }\n /* node:coverage ignore next 3 */\n } catch {\n // diagnostics_channel not available on this runtime; tracing is a no-op.\n }\n return dc;\n}\n\nconst dc = resolveDiagnosticsChannel();\n\n/**\n * Per-channel handles, resolved once at module load. `undefined` when\n * `node:diagnostics_channel` isn't available. Emission sites read these\n * directly to keep the no-subscriber fast path to a single property access\n * plus a `hasSubscribers` check (no function calls, no closures).\n *\n * @internal\n */\nexport const parseChannel:\n | MinimalTracingChannel<GraphQLParseContext>\n | undefined = dc?.tracingChannel('graphql:parse');\n/** @internal */\nexport const validateChannel:\n | MinimalTracingChannel<GraphQLValidateContext>\n | undefined = dc?.tracingChannel('graphql:validate');\n/** @internal */\nexport const executeChannel:\n | MinimalTracingChannel<GraphQLExecuteContext>\n | undefined = dc?.tracingChannel('graphql:execute');\n/** @internal */\nexport const executeVariableCoercionChannel:\n | MinimalTracingChannel<GraphQLExecuteVariableCoercionContext>\n | undefined = dc?.tracingChannel('graphql:execute:variableCoercion');\n/** @internal */\nexport const executeRootSelectionSetChannel:\n | MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext>\n | undefined = dc?.tracingChannel('graphql:execute:rootSelectionSet');\n/** @internal */\nexport const subscribeChannel:\n | MinimalTracingChannel<GraphQLSubscribeContext>\n | undefined = dc?.tracingChannel('graphql:subscribe');\n/** @internal */\nexport const resolveChannel:\n | MinimalTracingChannel<GraphQLResolveContext>\n | undefined = dc?.tracingChannel('graphql:resolve');\n\nconst SUB_CHANNEL_KEYS: ReadonlyArray<\n 'start' | 'end' | 'asyncStart' | 'asyncEnd' | 'error'\n> = ['start', 'end', 'asyncStart', 'asyncEnd', 'error'];\n\n/**\n * Whether emission sites should publish to `channel`. Trusts the\n * `TracingChannel.hasSubscribers` aggregate when the runtime exposes it; if\n * the getter is missing (e.g. Bun's `node:diagnostics_channel`, where\n * `tracingChannel.hasSubscribers` is `undefined`), falls back to checking\n * each of the five underlying lifecycle channels so a subscriber attached\n * via `tracingChannel.subscribe(handlers)` is still observed.\n *\n * @internal\n */\nexport function shouldTrace<TContext = unknown>(\n channel: MinimalTracingChannel<TContext> | undefined,\n): channel is MinimalTracingChannel<TContext> {\n if (channel == null) {\n return false;\n }\n const aggregate = channel.hasSubscribers;\n if (aggregate !== undefined) {\n return aggregate;\n }\n // Bun-only fallback, exercised by integrationTests/diagnostics-bun.\n for (const key of SUB_CHANNEL_KEYS) {\n if (channel[key].hasSubscribers) {\n return true;\n }\n }\n return false;\n}\n\ninterface TraceLifecycleContext {\n error?: unknown;\n result?: unknown;\n}\n\ntype TraceStartContext<TContext extends TraceLifecycleContext> = Omit<\n TContext,\n 'error' | 'result'\n>;\n\n/**\n * Publish a traced call that may complete synchronously or with a promise.\n * Caller has already verified that a subscriber is attached. On normal\n * completion, `result` is attached before the terminal `end` or `asyncEnd`\n * event. When the traced call throws or rejects, `error` is attached, the\n * `error` sub-channel fires, and the terminal `end` or `asyncEnd` event is\n * published before the original failure is propagated.\n *\n * @internal\n */\nexport function traceMixed<TResult, TContext extends TraceLifecycleContext>(\n channel: MinimalTracingChannel<TContext>,\n contextInput: TraceStartContext<TContext>,\n fn: () => TResult,\n): TResult {\n const context = contextInput as TContext;\n\n return channel.start.runStores(context, () => {\n let result: TResult;\n try {\n result = fn();\n } catch (err) {\n context.error = err;\n channel.error.publish(context);\n channel.end.publish(context);\n throw err;\n }\n\n if (!isPromiseLike(result)) {\n context.result = result;\n channel.end.publish(context);\n return result;\n }\n\n channel.end.publish(context);\n channel.asyncStart.publish(context);\n\n return result.then(\n (value) => {\n context.result = value;\n channel.asyncEnd.publish(context);\n return value;\n },\n (err: unknown) => {\n context.error = err;\n channel.error.publish(context);\n channel.asyncEnd.publish(context);\n throw err;\n },\n ) as TResult;\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":";;;AA6WA,kCAiBC;AAsBD,gCA0CC;AAxaD,yDAAuD;AA2QvD,SAAS,yBAAyB;IAChC,IAAI,EAAwC,CAA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AAC,OAAO,CAAC,CAAC;YAC/B,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAClC,MAAM,GAAG,CAAC;QACZ,CAAC,CACS,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * TracingChannel integration.\n *\n * GraphQL.js publishes lifecycle events on a set of named tracing channels\n * that application performance monitoring (APM) tools can subscribe to in\n * order to observe parse, validate, execute, subscribe, and resolver behavior,\n * plus selected executor internals. At module load time GraphQL.js resolves\n * `node:diagnostics_channel` itself so APMs do not need to interact with the\n * GraphQL API to enable tracing. On runtimes that do not expose\n * `node:diagnostics_channel` (e.g., browsers) the load silently no-ops and\n * emission sites short-circuit.\n *\n * Within the tracing context types, `error` means the traced JavaScript call\n * threw or rejected; it does not mean every `GraphQLError` returned by\n * GraphQL.js. Some channels complete normally and publish GraphQL errors on\n * `result`. Resolver errors can appear both as `message.error` on\n * `graphql:resolve` and as formatted errors in an enclosing execution or\n * subscription result. `graphql:parse`, `graphql:validate`, and\n * `graphql:execute:variableCoercion` are sync-only channels.\n * @category Diagnostics\n */\n\nimport { isPromiseLike } from './jsutils/isPromise.ts';\nimport type { Maybe } from './jsutils/Maybe.ts';\nimport type { ObjMap } from './jsutils/ObjMap.ts';\n\nimport type { GraphQLError } from './error/GraphQLError.ts';\n\nimport type {\n DocumentNode,\n OperationDefinitionNode,\n OperationTypeNode,\n} from './language/ast.ts';\nimport type { Source } from './language/source.ts';\n\nimport type { GraphQLSchema } from './type/schema.ts';\n\nimport type { ExecutionResult } from './execution/Executor.ts';\nimport type { ExperimentalIncrementalExecutionResults } from './execution/incremental/IncrementalExecutor.ts';\nimport type { VariableValues } from './execution/values.ts';\n\n/**\n * Structural subset of `DiagnosticsChannel` sufficient for publishing and\n * subscriber gating. The `node:diagnostics_channel` `Channel` satisfies this.\n *\n * @internal\n */\nexport interface MinimalChannel<TMessage = unknown> {\n readonly hasSubscribers?: boolean;\n publish: (message: TMessage) => void;\n runStores: <T, ContextType extends object>(\n context: ContextType,\n fn: (this: ContextType, ...args: Array<unknown>) => T,\n thisArg?: unknown,\n ...args: Array<unknown>\n ) => T;\n}\n\n/**\n * Structural subset of the Node.js `TracingChannel` API. The\n * `node:diagnostics_channel` `TracingChannel` satisfies this by duck typing,\n * so GraphQL.js does not need a dependency on `@types/node` or on the runtime\n * itself.\n *\n * @internal\n */\nexport interface MinimalTracingChannel<TContext = unknown> {\n // `undefined` accommodates runtimes (e.g. Bun) that ship `tracingChannel`\n // without exposing the aggregate `hasSubscribers` getter.\n readonly hasSubscribers: boolean | undefined;\n readonly start: MinimalChannel<TContext>;\n readonly end: MinimalChannel<TContext>;\n readonly asyncStart: MinimalChannel<TContext>;\n readonly asyncEnd: MinimalChannel<TContext>;\n readonly error: MinimalChannel<TContext>;\n\n traceSync: <T>(\n fn: (...args: Array<unknown>) => T,\n context: TContext extends object ? TContext : object,\n thisArg?: unknown,\n ...args: Array<unknown>\n ) => T;\n}\n\ninterface DiagnosticsChannelModule {\n tracingChannel: <TContext = unknown>(\n name: string,\n ) => MinimalTracingChannel<TContext>;\n}\n\n/** Context published on the sync-only `graphql:parse` channel. */\nexport interface GraphQLParseContext {\n /** Source text or source object passed to the parser. */\n source: string | Source;\n /** Error thrown while parsing, when parsing fails. */\n error?: unknown;\n /** Parsed document, when parsing succeeds. */\n result?: DocumentNode;\n}\n\n/** Context published on the sync-only `graphql:validate` channel. */\nexport interface GraphQLValidateContext {\n /** Schema used for validation. */\n schema: GraphQLSchema;\n /** Parsed document being validated. */\n document: DocumentNode;\n /** Error thrown while validating, when validation fails abruptly. */\n error?: unknown;\n /** Validation errors returned by validation. */\n result?: ReadonlyArray<GraphQLError>;\n}\n\n/**\n * Context published on `graphql:execute`.\n *\n * Returned results may contain GraphQL errors collected during execution.\n */\nexport interface GraphQLExecuteContext {\n /** Schema used for execution. */\n schema: GraphQLSchema;\n /** Parsed document being executed. */\n document: DocumentNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type, if one is available. */\n operationType: OperationTypeNode | undefined;\n /** Error thrown or rejected while executing, when execution fails abruptly. */\n error?: unknown;\n /** Execution result returned by execution, including GraphQL errors. */\n result?: ExecutionResult | ExperimentalIncrementalExecutionResults;\n}\n\n/**\n * Context published on `graphql:execute:rootSelectionSet`.\n *\n * Returned results may contain GraphQL errors collected during execution.\n */\nexport interface GraphQLExecuteRootSelectionSetContext {\n /** Schema used for execution. */\n schema: GraphQLSchema;\n /** Parsed document being executed. */\n document: DocumentNode;\n /** Operation definition selected for execution. */\n operation: OperationDefinitionNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type. */\n operationType: OperationTypeNode;\n /** Error thrown or rejected while executing the root selection set. */\n error?: unknown;\n /**\n * Execution result returned from the root selection set, including GraphQL\n * errors.\n */\n result?: ExecutionResult | ExperimentalIncrementalExecutionResults;\n}\n\n/**\n * Context published on `graphql:execute:variableCoercion`.\n *\n * Coercion runs synchronously while execution arguments are validated, so only\n * the `start`/`end` (and, on an abrupt throw, `error`) lifecycle fires.\n * Ordinary variable coercion failures are returned on `result.errors`; when\n * execution is invoked through APIs such as `execute()` or `subscribe()`, they\n * surface as GraphQL result errors rather than as the tracing `error`\n * lifecycle event.\n */\nexport interface GraphQLExecuteVariableCoercionContext {\n /** Schema used for variable coercion. */\n schema: GraphQLSchema;\n /** Parsed document being executed. */\n document: DocumentNode;\n /** Operation definition whose variables are being coerced. */\n operation: OperationDefinitionNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type. */\n operationType: OperationTypeNode;\n /** Error thrown while coercing variables, when coercion fails abruptly. */\n error?: unknown;\n /** Coerced variable values or coercion errors returned by coercion. */\n result?:\n | { variableValues: VariableValues }\n | { errors: ReadonlyArray<GraphQLError> };\n}\n\n/**\n * Context published on `graphql:subscribe`.\n *\n * Subscription source resolver errors and invalid source stream results are\n * returned on `result` as ExecutionResult errors; they do not publish the\n * `error` lifecycle event unless subscription setup fails abruptly before\n * GraphQL can form a result.\n */\nexport interface GraphQLSubscribeContext {\n /** Schema used for subscription execution. */\n schema: GraphQLSchema;\n /** Parsed subscription document. */\n document: DocumentNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type, if one is available. */\n operationType: OperationTypeNode | undefined;\n /** Error thrown or rejected while subscribing, when setup fails abruptly. */\n error?: unknown;\n /**\n * Subscription response stream, or an ExecutionResult containing GraphQL\n * errors.\n */\n result?: AsyncGenerator<ExecutionResult, void, void> | ExecutionResult;\n}\n\n/**\n * Context published on `graphql:resolve`.\n *\n * Resolver throws and rejections publish the `error` lifecycle event here.\n * The same failure may also be formatted into the enclosing execution or\n * subscription result.\n */\nexport interface GraphQLResolveContext {\n /** Field name being resolved. */\n fieldName: string;\n /** Response alias for the field being resolved. */\n alias: string;\n /** Parent type name for the field being resolved. */\n parentType: string;\n /** Return type string for the field being resolved. */\n fieldType: string;\n /** Argument values passed to the resolver. */\n args: ObjMap<unknown>;\n /** Whether the field is using the default resolver. */\n isDefaultResolver: boolean;\n /** Response path for the field being resolved. */\n fieldPath: string;\n /** Error thrown or rejected by the resolver, when resolution fails. */\n error?: unknown;\n /** Value returned by the resolver, when resolution succeeds. */\n result?: unknown;\n}\n\n/** Mapping from tracing channel name to the context type published on it. */\nexport interface GraphQLChannelContextByName {\n /** Context published on `graphql:parse`. */\n 'graphql:parse': GraphQLParseContext;\n /** Context published on `graphql:validate`. */\n 'graphql:validate': GraphQLValidateContext;\n /** Context published on `graphql:execute`. */\n 'graphql:execute': GraphQLExecuteContext;\n /** Context published on `graphql:execute:variableCoercion`. */\n 'graphql:execute:variableCoercion': GraphQLExecuteVariableCoercionContext;\n /** Context published on `graphql:execute:rootSelectionSet`. */\n 'graphql:execute:rootSelectionSet': GraphQLExecuteRootSelectionSetContext;\n /** Context published on `graphql:subscribe`. */\n 'graphql:subscribe': GraphQLSubscribeContext;\n /** Context published on `graphql:resolve`. */\n 'graphql:resolve': GraphQLResolveContext;\n}\n\n/**\n * The collection of tracing channels GraphQL.js emits on. Application\n * performance monitoring (APM) tools subscribe to these by name on their own\n * `node:diagnostics_channel` import; both paths land on the same channel\n * instance because `tracingChannel(name)` is cached by name.\n */\nexport interface GraphQLChannels {\n /** Tracing channel for `graphql:execute`. */\n execute: MinimalTracingChannel<GraphQLExecuteContext>;\n /** Tracing channel for `graphql:execute:variableCoercion`. */\n executeVariableCoercion: MinimalTracingChannel<GraphQLExecuteVariableCoercionContext>;\n /** Tracing channel for `graphql:execute:rootSelectionSet`. */\n executeRootSelectionSet: MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext>;\n /** Tracing channel for `graphql:parse`. */\n parse: MinimalTracingChannel<GraphQLParseContext>;\n /** Tracing channel for `graphql:validate`. */\n validate: MinimalTracingChannel<GraphQLValidateContext>;\n /** Tracing channel for `graphql:resolve`. */\n resolve: MinimalTracingChannel<GraphQLResolveContext>;\n /** Tracing channel for `graphql:subscribe`. */\n subscribe: MinimalTracingChannel<GraphQLSubscribeContext>;\n}\n\nfunction resolveDiagnosticsChannel(): DiagnosticsChannelModule | undefined {\n let dc: DiagnosticsChannelModule | undefined;\n try {\n const processRef = (\n globalThis as {\n process?: { getBuiltinModule?: (id: string) => unknown };\n }\n ).process;\n if (\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n typeof processRef?.getBuiltinModule === 'function'\n ) {\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n dc = processRef.getBuiltinModule(\n 'node:diagnostics_channel',\n ) as DiagnosticsChannelModule;\n }\n /* node:coverage ignore next 3 */\n } catch {\n // diagnostics_channel not available on this runtime; tracing is a no-op.\n }\n return dc;\n}\n\nconst dc = resolveDiagnosticsChannel();\n\n/**\n * Per-channel handles, resolved once at module load. `undefined` when\n * `node:diagnostics_channel` isn't available. Emission sites read these\n * directly to keep the no-subscriber fast path to a single property access\n * plus a `hasSubscribers` check (no function calls, no closures).\n *\n * @internal\n */\nexport const parseChannel:\n | MinimalTracingChannel<GraphQLParseContext>\n | undefined = dc?.tracingChannel('graphql:parse');\n/** @internal */\nexport const validateChannel:\n | MinimalTracingChannel<GraphQLValidateContext>\n | undefined = dc?.tracingChannel('graphql:validate');\n/** @internal */\nexport const executeChannel:\n | MinimalTracingChannel<GraphQLExecuteContext>\n | undefined = dc?.tracingChannel('graphql:execute');\n/** @internal */\nexport const executeVariableCoercionChannel:\n | MinimalTracingChannel<GraphQLExecuteVariableCoercionContext>\n | undefined = dc?.tracingChannel('graphql:execute:variableCoercion');\n/** @internal */\nexport const executeRootSelectionSetChannel:\n | MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext>\n | undefined = dc?.tracingChannel('graphql:execute:rootSelectionSet');\n/** @internal */\nexport const subscribeChannel:\n | MinimalTracingChannel<GraphQLSubscribeContext>\n | undefined = dc?.tracingChannel('graphql:subscribe');\n/** @internal */\nexport const resolveChannel:\n | MinimalTracingChannel<GraphQLResolveContext>\n | undefined = dc?.tracingChannel('graphql:resolve');\n\nconst SUB_CHANNEL_KEYS: ReadonlyArray<\n 'start' | 'end' | 'asyncStart' | 'asyncEnd' | 'error'\n> = ['start', 'end', 'asyncStart', 'asyncEnd', 'error'];\n\n/**\n * Whether emission sites should publish to `channel`. Trusts the\n * `TracingChannel.hasSubscribers` aggregate when the runtime exposes it; if\n * the getter is missing (e.g. Bun's `node:diagnostics_channel`, where\n * `tracingChannel.hasSubscribers` is `undefined`), falls back to checking\n * each of the five underlying lifecycle channels so a subscriber attached\n * via `tracingChannel.subscribe(handlers)` is still observed.\n *\n * @internal\n */\nexport function shouldTrace<TContext = unknown>(\n channel: MinimalTracingChannel<TContext> | undefined,\n): channel is MinimalTracingChannel<TContext> {\n if (channel == null) {\n return false;\n }\n const aggregate = channel.hasSubscribers;\n if (aggregate !== undefined) {\n return aggregate;\n }\n // Bun-only fallback, exercised by integrationTests/diagnostics-bun.\n for (const key of SUB_CHANNEL_KEYS) {\n if (channel[key].hasSubscribers) {\n return true;\n }\n }\n return false;\n}\n\ninterface TraceLifecycleContext {\n error?: unknown;\n result?: unknown;\n}\n\ntype TraceStartContext<TContext extends TraceLifecycleContext> = Omit<\n TContext,\n 'error' | 'result'\n>;\n\n/**\n * Publish a traced call that may complete synchronously or with a promise.\n * Caller has already verified that a subscriber is attached. On normal\n * completion, `result` is attached before the terminal `end` or `asyncEnd`\n * event. When the traced call throws or rejects, `error` is attached, the\n * `error` sub-channel fires, and the terminal `end` or `asyncEnd` event is\n * published before the original failure is propagated.\n *\n * @internal\n */\nexport function traceMixed<TResult, TContext extends TraceLifecycleContext>(\n channel: MinimalTracingChannel<TContext>,\n contextInput: TraceStartContext<TContext>,\n fn: () => TResult,\n): TResult {\n const context = contextInput as TContext;\n\n return channel.start.runStores(context, () => {\n let result: TResult;\n try {\n result = fn();\n } catch (err) {\n context.error = err;\n channel.error.publish(context);\n channel.end.publish(context);\n throw err;\n }\n\n if (!isPromiseLike(result)) {\n context.result = result;\n channel.end.publish(context);\n return result;\n }\n\n channel.end.publish(context);\n\n return result.then(\n (value) => {\n context.result = value;\n channel.asyncStart.publish(context);\n channel.asyncEnd.publish(context);\n return value;\n },\n (err: unknown) => {\n context.error = err;\n channel.error.publish(context);\n channel.asyncStart.publish(context);\n channel.asyncEnd.publish(context);\n throw err;\n },\n ) as TResult;\n });\n}\n"]}
|
package/diagnostics.mjs
CHANGED
|
@@ -54,14 +54,15 @@ export function traceMixed(channel, contextInput, fn) {
|
|
|
54
54
|
return result;
|
|
55
55
|
}
|
|
56
56
|
channel.end.publish(context);
|
|
57
|
-
channel.asyncStart.publish(context);
|
|
58
57
|
return result.then((value) => {
|
|
59
58
|
context.result = value;
|
|
59
|
+
channel.asyncStart.publish(context);
|
|
60
60
|
channel.asyncEnd.publish(context);
|
|
61
61
|
return value;
|
|
62
62
|
}, (err) => {
|
|
63
63
|
context.error = err;
|
|
64
64
|
channel.error.publish(context);
|
|
65
|
+
channel.asyncStart.publish(context);
|
|
65
66
|
channel.asyncEnd.publish(context);
|
|
66
67
|
throw err;
|
|
67
68
|
});
|
package/diagnostics.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,aAAa,EAAE,gCAA+B;AA2QvD,SAAS,yBAAyB;IAChC,IAAI,EAAwC,CAAC;IAC7C,IAAI,CAAC;QACH,MAAM,UAAU,GACd,UAGD,CAAC,OAAO,CAAC;QACV,IAEE,OAAO,UAAU,EAAE,gBAAgB,KAAK,UAAU,EAClD,CAAC;YAED,EAAE,GAAG,UAAU,CAAC,gBAAgB,CAC9B,0BAA0B,CACC,CAAC;QAChC,CAAC;IAEH,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,EAAE,GAAG,yBAAyB,EAAE,CAAC;AAUvC,MAAM,CAAC,MAAM,YAAY,GAET,EAAE,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;AAEpD,MAAM,CAAC,MAAM,eAAe,GAEZ,EAAE,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,cAAc,GAEX,EAAE,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,8BAA8B,GAE3B,EAAE,EAAE,cAAc,CAAC,kCAAkC,CAAC,CAAC;AAEvE,MAAM,CAAC,MAAM,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AG,CAAC;QACZ,CAAC;QAED,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC7B,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC7B,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAEpC,OAAO,MAAM,CAAC,IAAI,CAChB,CAAC,KAAK,EAAE,EAAE;YACR,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;YACvB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC,EACD,CAAC,GAAY,EAAE,EAAE;YACf,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC/B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAClC,MAAM,GAAG,CAAC;QACZ,CAAC,CACS,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * TracingChannel integration.\n *\n * GraphQL.js publishes lifecycle events on a set of named tracing channels\n * that application performance monitoring (APM) tools can subscribe to in\n * order to observe parse, validate, execute, subscribe, and resolver behavior,\n * plus selected executor internals. At module load time GraphQL.js resolves\n * `node:diagnostics_channel` itself so APMs do not need to interact with the\n * GraphQL API to enable tracing. On runtimes that do not expose\n * `node:diagnostics_channel` (e.g., browsers) the load silently no-ops and\n * emission sites short-circuit.\n *\n * Within the tracing context types, `error` means the traced JavaScript call\n * threw or rejected; it does not mean every `GraphQLError` returned by\n * GraphQL.js. Some channels complete normally and publish GraphQL errors on\n * `result`. Resolver errors can appear both as `message.error` on\n * `graphql:resolve` and as formatted errors in an enclosing execution or\n * subscription result. `graphql:parse`, `graphql:validate`, and\n * `graphql:execute:variableCoercion` are sync-only channels.\n * @category Diagnostics\n */\n\nimport { isPromiseLike } from './jsutils/isPromise.ts';\nimport type { Maybe } from './jsutils/Maybe.ts';\nimport type { ObjMap } from './jsutils/ObjMap.ts';\n\nimport type { GraphQLError } from './error/GraphQLError.ts';\n\nimport type {\n DocumentNode,\n OperationDefinitionNode,\n OperationTypeNode,\n} from './language/ast.ts';\nimport type { Source } from './language/source.ts';\n\nimport type { GraphQLSchema } from './type/schema.ts';\n\nimport type { ExecutionResult } from './execution/Executor.ts';\nimport type { ExperimentalIncrementalExecutionResults } from './execution/incremental/IncrementalExecutor.ts';\nimport type { VariableValues } from './execution/values.ts';\n\n/**\n * Structural subset of `DiagnosticsChannel` sufficient for publishing and\n * subscriber gating. The `node:diagnostics_channel` `Channel` satisfies this.\n *\n * @internal\n */\nexport interface MinimalChannel<TMessage = unknown> {\n readonly hasSubscribers?: boolean;\n publish: (message: TMessage) => void;\n runStores: <T, ContextType extends object>(\n context: ContextType,\n fn: (this: ContextType, ...args: Array<unknown>) => T,\n thisArg?: unknown,\n ...args: Array<unknown>\n ) => T;\n}\n\n/**\n * Structural subset of the Node.js `TracingChannel` API. The\n * `node:diagnostics_channel` `TracingChannel` satisfies this by duck typing,\n * so GraphQL.js does not need a dependency on `@types/node` or on the runtime\n * itself.\n *\n * @internal\n */\nexport interface MinimalTracingChannel<TContext = unknown> {\n // `undefined` accommodates runtimes (e.g. Bun) that ship `tracingChannel`\n // without exposing the aggregate `hasSubscribers` getter.\n readonly hasSubscribers: boolean | undefined;\n readonly start: MinimalChannel<TContext>;\n readonly end: MinimalChannel<TContext>;\n readonly asyncStart: MinimalChannel<TContext>;\n readonly asyncEnd: MinimalChannel<TContext>;\n readonly error: MinimalChannel<TContext>;\n\n traceSync: <T>(\n fn: (...args: Array<unknown>) => T,\n context: TContext extends object ? TContext : object,\n thisArg?: unknown,\n ...args: Array<unknown>\n ) => T;\n}\n\ninterface DiagnosticsChannelModule {\n tracingChannel: <TContext = unknown>(\n name: string,\n ) => MinimalTracingChannel<TContext>;\n}\n\n/** Context published on the sync-only `graphql:parse` channel. */\nexport interface GraphQLParseContext {\n /** Source text or source object passed to the parser. */\n source: string | Source;\n /** Error thrown while parsing, when parsing fails. */\n error?: unknown;\n /** Parsed document, when parsing succeeds. */\n result?: DocumentNode;\n}\n\n/** Context published on the sync-only `graphql:validate` channel. */\nexport interface GraphQLValidateContext {\n /** Schema used for validation. */\n schema: GraphQLSchema;\n /** Parsed document being validated. */\n document: DocumentNode;\n /** Error thrown while validating, when validation fails abruptly. */\n error?: unknown;\n /** Validation errors returned by validation. */\n result?: ReadonlyArray<GraphQLError>;\n}\n\n/**\n * Context published on `graphql:execute`.\n *\n * Returned results may contain GraphQL errors collected during execution.\n */\nexport interface GraphQLExecuteContext {\n /** Schema used for execution. */\n schema: GraphQLSchema;\n /** Parsed document being executed. */\n document: DocumentNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type, if one is available. */\n operationType: OperationTypeNode | undefined;\n /** Error thrown or rejected while executing, when execution fails abruptly. */\n error?: unknown;\n /** Execution result returned by execution, including GraphQL errors. */\n result?: ExecutionResult | ExperimentalIncrementalExecutionResults;\n}\n\n/**\n * Context published on `graphql:execute:rootSelectionSet`.\n *\n * Returned results may contain GraphQL errors collected during execution.\n */\nexport interface GraphQLExecuteRootSelectionSetContext {\n /** Schema used for execution. */\n schema: GraphQLSchema;\n /** Parsed document being executed. */\n document: DocumentNode;\n /** Operation definition selected for execution. */\n operation: OperationDefinitionNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type. */\n operationType: OperationTypeNode;\n /** Error thrown or rejected while executing the root selection set. */\n error?: unknown;\n /**\n * Execution result returned from the root selection set, including GraphQL\n * errors.\n */\n result?: ExecutionResult | ExperimentalIncrementalExecutionResults;\n}\n\n/**\n * Context published on `graphql:execute:variableCoercion`.\n *\n * Coercion runs synchronously while execution arguments are validated, so only\n * the `start`/`end` (and, on an abrupt throw, `error`) lifecycle fires.\n * Ordinary variable coercion failures are returned on `result.errors`; when\n * execution is invoked through APIs such as `execute()` or `subscribe()`, they\n * surface as GraphQL result errors rather than as the tracing `error`\n * lifecycle event.\n */\nexport interface GraphQLExecuteVariableCoercionContext {\n /** Schema used for variable coercion. */\n schema: GraphQLSchema;\n /** Parsed document being executed. */\n document: DocumentNode;\n /** Operation definition whose variables are being coerced. */\n operation: OperationDefinitionNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type. */\n operationType: OperationTypeNode;\n /** Error thrown while coercing variables, when coercion fails abruptly. */\n error?: unknown;\n /** Coerced variable values or coercion errors returned by coercion. */\n result?:\n | { variableValues: VariableValues }\n | { errors: ReadonlyArray<GraphQLError> };\n}\n\n/**\n * Context published on `graphql:subscribe`.\n *\n * Subscription source resolver errors and invalid source stream results are\n * returned on `result` as ExecutionResult errors; they do not publish the\n * `error` lifecycle event unless subscription setup fails abruptly before\n * GraphQL can form a result.\n */\nexport interface GraphQLSubscribeContext {\n /** Schema used for subscription execution. */\n schema: GraphQLSchema;\n /** Parsed subscription document. */\n document: DocumentNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type, if one is available. */\n operationType: OperationTypeNode | undefined;\n /** Error thrown or rejected while subscribing, when setup fails abruptly. */\n error?: unknown;\n /**\n * Subscription response stream, or an ExecutionResult containing GraphQL\n * errors.\n */\n result?: AsyncGenerator<ExecutionResult, void, void> | ExecutionResult;\n}\n\n/**\n * Context published on `graphql:resolve`.\n *\n * Resolver throws and rejections publish the `error` lifecycle event here.\n * The same failure may also be formatted into the enclosing execution or\n * subscription result.\n */\nexport interface GraphQLResolveContext {\n /** Field name being resolved. */\n fieldName: string;\n /** Response alias for the field being resolved. */\n alias: string;\n /** Parent type name for the field being resolved. */\n parentType: string;\n /** Return type string for the field being resolved. */\n fieldType: string;\n /** Argument values passed to the resolver. */\n args: ObjMap<unknown>;\n /** Whether the field is using the default resolver. */\n isDefaultResolver: boolean;\n /** Response path for the field being resolved. */\n fieldPath: string;\n /** Error thrown or rejected by the resolver, when resolution fails. */\n error?: unknown;\n /** Value returned by the resolver, when resolution succeeds. */\n result?: unknown;\n}\n\n/** Mapping from tracing channel name to the context type published on it. */\nexport interface GraphQLChannelContextByName {\n /** Context published on `graphql:parse`. */\n 'graphql:parse': GraphQLParseContext;\n /** Context published on `graphql:validate`. */\n 'graphql:validate': GraphQLValidateContext;\n /** Context published on `graphql:execute`. */\n 'graphql:execute': GraphQLExecuteContext;\n /** Context published on `graphql:execute:variableCoercion`. */\n 'graphql:execute:variableCoercion': GraphQLExecuteVariableCoercionContext;\n /** Context published on `graphql:execute:rootSelectionSet`. */\n 'graphql:execute:rootSelectionSet': GraphQLExecuteRootSelectionSetContext;\n /** Context published on `graphql:subscribe`. */\n 'graphql:subscribe': GraphQLSubscribeContext;\n /** Context published on `graphql:resolve`. */\n 'graphql:resolve': GraphQLResolveContext;\n}\n\n/**\n * The collection of tracing channels GraphQL.js emits on. Application\n * performance monitoring (APM) tools subscribe to these by name on their own\n * `node:diagnostics_channel` import; both paths land on the same channel\n * instance because `tracingChannel(name)` is cached by name.\n */\nexport interface GraphQLChannels {\n /** Tracing channel for `graphql:execute`. */\n execute: MinimalTracingChannel<GraphQLExecuteContext>;\n /** Tracing channel for `graphql:execute:variableCoercion`. */\n executeVariableCoercion: MinimalTracingChannel<GraphQLExecuteVariableCoercionContext>;\n /** Tracing channel for `graphql:execute:rootSelectionSet`. */\n executeRootSelectionSet: MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext>;\n /** Tracing channel for `graphql:parse`. */\n parse: MinimalTracingChannel<GraphQLParseContext>;\n /** Tracing channel for `graphql:validate`. */\n validate: MinimalTracingChannel<GraphQLValidateContext>;\n /** Tracing channel for `graphql:resolve`. */\n resolve: MinimalTracingChannel<GraphQLResolveContext>;\n /** Tracing channel for `graphql:subscribe`. */\n subscribe: MinimalTracingChannel<GraphQLSubscribeContext>;\n}\n\nfunction resolveDiagnosticsChannel(): DiagnosticsChannelModule | undefined {\n let dc: DiagnosticsChannelModule | undefined;\n try {\n const processRef = (\n globalThis as {\n process?: { getBuiltinModule?: (id: string) => unknown };\n }\n ).process;\n if (\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n typeof processRef?.getBuiltinModule === 'function'\n ) {\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n dc = processRef.getBuiltinModule(\n 'node:diagnostics_channel',\n ) as DiagnosticsChannelModule;\n }\n /* node:coverage ignore next 3 */\n } catch {\n // diagnostics_channel not available on this runtime; tracing is a no-op.\n }\n return dc;\n}\n\nconst dc = resolveDiagnosticsChannel();\n\n/**\n * Per-channel handles, resolved once at module load. `undefined` when\n * `node:diagnostics_channel` isn't available. Emission sites read these\n * directly to keep the no-subscriber fast path to a single property access\n * plus a `hasSubscribers` check (no function calls, no closures).\n *\n * @internal\n */\nexport const parseChannel:\n | MinimalTracingChannel<GraphQLParseContext>\n | undefined = dc?.tracingChannel('graphql:parse');\n/** @internal */\nexport const validateChannel:\n | MinimalTracingChannel<GraphQLValidateContext>\n | undefined = dc?.tracingChannel('graphql:validate');\n/** @internal */\nexport const executeChannel:\n | MinimalTracingChannel<GraphQLExecuteContext>\n | undefined = dc?.tracingChannel('graphql:execute');\n/** @internal */\nexport const executeVariableCoercionChannel:\n | MinimalTracingChannel<GraphQLExecuteVariableCoercionContext>\n | undefined = dc?.tracingChannel('graphql:execute:variableCoercion');\n/** @internal */\nexport const executeRootSelectionSetChannel:\n | MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext>\n | undefined = dc?.tracingChannel('graphql:execute:rootSelectionSet');\n/** @internal */\nexport const subscribeChannel:\n | MinimalTracingChannel<GraphQLSubscribeContext>\n | undefined = dc?.tracingChannel('graphql:subscribe');\n/** @internal */\nexport const resolveChannel:\n | MinimalTracingChannel<GraphQLResolveContext>\n | undefined = dc?.tracingChannel('graphql:resolve');\n\nconst SUB_CHANNEL_KEYS: ReadonlyArray<\n 'start' | 'end' | 'asyncStart' | 'asyncEnd' | 'error'\n> = ['start', 'end', 'asyncStart', 'asyncEnd', 'error'];\n\n/**\n * Whether emission sites should publish to `channel`. Trusts the\n * `TracingChannel.hasSubscribers` aggregate when the runtime exposes it; if\n * the getter is missing (e.g. Bun's `node:diagnostics_channel`, where\n * `tracingChannel.hasSubscribers` is `undefined`), falls back to checking\n * each of the five underlying lifecycle channels so a subscriber attached\n * via `tracingChannel.subscribe(handlers)` is still observed.\n *\n * @internal\n */\nexport function shouldTrace<TContext = unknown>(\n channel: MinimalTracingChannel<TContext> | undefined,\n): channel is MinimalTracingChannel<TContext> {\n if (channel == null) {\n return false;\n }\n const aggregate = channel.hasSubscribers;\n if (aggregate !== undefined) {\n return aggregate;\n }\n // Bun-only fallback, exercised by integrationTests/diagnostics-bun.\n for (const key of SUB_CHANNEL_KEYS) {\n if (channel[key].hasSubscribers) {\n return true;\n }\n }\n return false;\n}\n\ninterface TraceLifecycleContext {\n error?: unknown;\n result?: unknown;\n}\n\ntype TraceStartContext<TContext extends TraceLifecycleContext> = Omit<\n TContext,\n 'error' | 'result'\n>;\n\n/**\n * Publish a traced call that may complete synchronously or with a promise.\n * Caller has already verified that a subscriber is attached. On normal\n * completion, `result` is attached before the terminal `end` or `asyncEnd`\n * event. When the traced call throws or rejects, `error` is attached, the\n * `error` sub-channel fires, and the terminal `end` or `asyncEnd` event is\n * published before the original failure is propagated.\n *\n * @internal\n */\nexport function traceMixed<TResult, TContext extends TraceLifecycleContext>(\n channel: MinimalTracingChannel<TContext>,\n contextInput: TraceStartContext<TContext>,\n fn: () => TResult,\n): TResult {\n const context = contextInput as TContext;\n\n return channel.start.runStores(context, () => {\n let result: TResult;\n try {\n result = fn();\n } catch (err) {\n context.error = err;\n channel.error.publish(context);\n channel.end.publish(context);\n throw err;\n }\n\n if (!isPromiseLike(result)) {\n context.result = result;\n channel.end.publish(context);\n return result;\n }\n\n channel.end.publish(context);\n channel.asyncStart.publish(context);\n\n return result.then(\n (value) => {\n context.result = value;\n channel.asyncEnd.publish(context);\n return value;\n },\n (err: unknown) => {\n context.error = err;\n channel.error.publish(context);\n channel.asyncEnd.publish(context);\n throw err;\n },\n ) as TResult;\n });\n}\n"]}
|
|
1
|
+
{"version":3,"file":"diagnostics.js","sourceRoot":"","sources":["../src/diagnostics.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,aAAa,EAAE,gCAA+B;AA2QvD,SAAS,yBAAyB;IAChC,IAAI,EAAwC,CAAC;IAC7C,IAAI,CAAC;QACH,MAAM,UAAU,GACd,UAGD,CAAC,OAAO,CAAC;QACV,IAEE,OAAO,UAAU,EAAE,gBAAgB,KAAK,UAAU,EAClD,CAAC;YAED,EAAE,GAAG,UAAU,CAAC,gBAAgB,CAC9B,0BAA0B,CACC,CAAC;QAChC,CAAC;IAEH,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,EAAE,GAAG,yBAAyB,EAAE,CAAC;AAUvC,MAAM,CAAC,MAAM,YAAY,GAET,EAAE,EAAE,cAAc,CAAC,eAAe,CAAC,CAAC;AAEpD,MAAM,CAAC,MAAM,eAAe,GAEZ,EAAE,EAAE,cAAc,CAAC,kBAAkB,CAAC,CAAC;AAEvD,MAAM,CAAC,MAAM,cAAc,GAEX,EAAE,EAAE,cAAc,CAAC,iBAAiB,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,8BAA8B,GAE3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B,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC7B,MAAM,GAAG,CAAC;QACZ,CAAC;QAED,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;YACxB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC7B,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAE7B,OAAO,MAAM,CAAC,IAAI,CAChB,CAAC,KAAK,EAAE,EAAE;YACR,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC;YACvB,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAClC,OAAO,KAAK,CAAC;QACf,CAAC,EACD,CAAC,GAAY,EAAE,EAAE;YACf,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC/B,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAClC,MAAM,GAAG,CAAC;QACZ,CAAC,CACS,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["/**\n * TracingChannel integration.\n *\n * GraphQL.js publishes lifecycle events on a set of named tracing channels\n * that application performance monitoring (APM) tools can subscribe to in\n * order to observe parse, validate, execute, subscribe, and resolver behavior,\n * plus selected executor internals. At module load time GraphQL.js resolves\n * `node:diagnostics_channel` itself so APMs do not need to interact with the\n * GraphQL API to enable tracing. On runtimes that do not expose\n * `node:diagnostics_channel` (e.g., browsers) the load silently no-ops and\n * emission sites short-circuit.\n *\n * Within the tracing context types, `error` means the traced JavaScript call\n * threw or rejected; it does not mean every `GraphQLError` returned by\n * GraphQL.js. Some channels complete normally and publish GraphQL errors on\n * `result`. Resolver errors can appear both as `message.error` on\n * `graphql:resolve` and as formatted errors in an enclosing execution or\n * subscription result. `graphql:parse`, `graphql:validate`, and\n * `graphql:execute:variableCoercion` are sync-only channels.\n * @category Diagnostics\n */\n\nimport { isPromiseLike } from './jsutils/isPromise.ts';\nimport type { Maybe } from './jsutils/Maybe.ts';\nimport type { ObjMap } from './jsutils/ObjMap.ts';\n\nimport type { GraphQLError } from './error/GraphQLError.ts';\n\nimport type {\n DocumentNode,\n OperationDefinitionNode,\n OperationTypeNode,\n} from './language/ast.ts';\nimport type { Source } from './language/source.ts';\n\nimport type { GraphQLSchema } from './type/schema.ts';\n\nimport type { ExecutionResult } from './execution/Executor.ts';\nimport type { ExperimentalIncrementalExecutionResults } from './execution/incremental/IncrementalExecutor.ts';\nimport type { VariableValues } from './execution/values.ts';\n\n/**\n * Structural subset of `DiagnosticsChannel` sufficient for publishing and\n * subscriber gating. The `node:diagnostics_channel` `Channel` satisfies this.\n *\n * @internal\n */\nexport interface MinimalChannel<TMessage = unknown> {\n readonly hasSubscribers?: boolean;\n publish: (message: TMessage) => void;\n runStores: <T, ContextType extends object>(\n context: ContextType,\n fn: (this: ContextType, ...args: Array<unknown>) => T,\n thisArg?: unknown,\n ...args: Array<unknown>\n ) => T;\n}\n\n/**\n * Structural subset of the Node.js `TracingChannel` API. The\n * `node:diagnostics_channel` `TracingChannel` satisfies this by duck typing,\n * so GraphQL.js does not need a dependency on `@types/node` or on the runtime\n * itself.\n *\n * @internal\n */\nexport interface MinimalTracingChannel<TContext = unknown> {\n // `undefined` accommodates runtimes (e.g. Bun) that ship `tracingChannel`\n // without exposing the aggregate `hasSubscribers` getter.\n readonly hasSubscribers: boolean | undefined;\n readonly start: MinimalChannel<TContext>;\n readonly end: MinimalChannel<TContext>;\n readonly asyncStart: MinimalChannel<TContext>;\n readonly asyncEnd: MinimalChannel<TContext>;\n readonly error: MinimalChannel<TContext>;\n\n traceSync: <T>(\n fn: (...args: Array<unknown>) => T,\n context: TContext extends object ? TContext : object,\n thisArg?: unknown,\n ...args: Array<unknown>\n ) => T;\n}\n\ninterface DiagnosticsChannelModule {\n tracingChannel: <TContext = unknown>(\n name: string,\n ) => MinimalTracingChannel<TContext>;\n}\n\n/** Context published on the sync-only `graphql:parse` channel. */\nexport interface GraphQLParseContext {\n /** Source text or source object passed to the parser. */\n source: string | Source;\n /** Error thrown while parsing, when parsing fails. */\n error?: unknown;\n /** Parsed document, when parsing succeeds. */\n result?: DocumentNode;\n}\n\n/** Context published on the sync-only `graphql:validate` channel. */\nexport interface GraphQLValidateContext {\n /** Schema used for validation. */\n schema: GraphQLSchema;\n /** Parsed document being validated. */\n document: DocumentNode;\n /** Error thrown while validating, when validation fails abruptly. */\n error?: unknown;\n /** Validation errors returned by validation. */\n result?: ReadonlyArray<GraphQLError>;\n}\n\n/**\n * Context published on `graphql:execute`.\n *\n * Returned results may contain GraphQL errors collected during execution.\n */\nexport interface GraphQLExecuteContext {\n /** Schema used for execution. */\n schema: GraphQLSchema;\n /** Parsed document being executed. */\n document: DocumentNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type, if one is available. */\n operationType: OperationTypeNode | undefined;\n /** Error thrown or rejected while executing, when execution fails abruptly. */\n error?: unknown;\n /** Execution result returned by execution, including GraphQL errors. */\n result?: ExecutionResult | ExperimentalIncrementalExecutionResults;\n}\n\n/**\n * Context published on `graphql:execute:rootSelectionSet`.\n *\n * Returned results may contain GraphQL errors collected during execution.\n */\nexport interface GraphQLExecuteRootSelectionSetContext {\n /** Schema used for execution. */\n schema: GraphQLSchema;\n /** Parsed document being executed. */\n document: DocumentNode;\n /** Operation definition selected for execution. */\n operation: OperationDefinitionNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type. */\n operationType: OperationTypeNode;\n /** Error thrown or rejected while executing the root selection set. */\n error?: unknown;\n /**\n * Execution result returned from the root selection set, including GraphQL\n * errors.\n */\n result?: ExecutionResult | ExperimentalIncrementalExecutionResults;\n}\n\n/**\n * Context published on `graphql:execute:variableCoercion`.\n *\n * Coercion runs synchronously while execution arguments are validated, so only\n * the `start`/`end` (and, on an abrupt throw, `error`) lifecycle fires.\n * Ordinary variable coercion failures are returned on `result.errors`; when\n * execution is invoked through APIs such as `execute()` or `subscribe()`, they\n * surface as GraphQL result errors rather than as the tracing `error`\n * lifecycle event.\n */\nexport interface GraphQLExecuteVariableCoercionContext {\n /** Schema used for variable coercion. */\n schema: GraphQLSchema;\n /** Parsed document being executed. */\n document: DocumentNode;\n /** Operation definition whose variables are being coerced. */\n operation: OperationDefinitionNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type. */\n operationType: OperationTypeNode;\n /** Error thrown while coercing variables, when coercion fails abruptly. */\n error?: unknown;\n /** Coerced variable values or coercion errors returned by coercion. */\n result?:\n | { variableValues: VariableValues }\n | { errors: ReadonlyArray<GraphQLError> };\n}\n\n/**\n * Context published on `graphql:subscribe`.\n *\n * Subscription source resolver errors and invalid source stream results are\n * returned on `result` as ExecutionResult errors; they do not publish the\n * `error` lifecycle event unless subscription setup fails abruptly before\n * GraphQL can form a result.\n */\nexport interface GraphQLSubscribeContext {\n /** Schema used for subscription execution. */\n schema: GraphQLSchema;\n /** Parsed subscription document. */\n document: DocumentNode;\n /** Raw variable values provided by the caller before coercion. */\n rawVariableValues: Maybe<{ readonly [variable: string]: unknown }>;\n /** Selected operation name, if one is available. */\n operationName: string | undefined;\n /** Selected operation type, if one is available. */\n operationType: OperationTypeNode | undefined;\n /** Error thrown or rejected while subscribing, when setup fails abruptly. */\n error?: unknown;\n /**\n * Subscription response stream, or an ExecutionResult containing GraphQL\n * errors.\n */\n result?: AsyncGenerator<ExecutionResult, void, void> | ExecutionResult;\n}\n\n/**\n * Context published on `graphql:resolve`.\n *\n * Resolver throws and rejections publish the `error` lifecycle event here.\n * The same failure may also be formatted into the enclosing execution or\n * subscription result.\n */\nexport interface GraphQLResolveContext {\n /** Field name being resolved. */\n fieldName: string;\n /** Response alias for the field being resolved. */\n alias: string;\n /** Parent type name for the field being resolved. */\n parentType: string;\n /** Return type string for the field being resolved. */\n fieldType: string;\n /** Argument values passed to the resolver. */\n args: ObjMap<unknown>;\n /** Whether the field is using the default resolver. */\n isDefaultResolver: boolean;\n /** Response path for the field being resolved. */\n fieldPath: string;\n /** Error thrown or rejected by the resolver, when resolution fails. */\n error?: unknown;\n /** Value returned by the resolver, when resolution succeeds. */\n result?: unknown;\n}\n\n/** Mapping from tracing channel name to the context type published on it. */\nexport interface GraphQLChannelContextByName {\n /** Context published on `graphql:parse`. */\n 'graphql:parse': GraphQLParseContext;\n /** Context published on `graphql:validate`. */\n 'graphql:validate': GraphQLValidateContext;\n /** Context published on `graphql:execute`. */\n 'graphql:execute': GraphQLExecuteContext;\n /** Context published on `graphql:execute:variableCoercion`. */\n 'graphql:execute:variableCoercion': GraphQLExecuteVariableCoercionContext;\n /** Context published on `graphql:execute:rootSelectionSet`. */\n 'graphql:execute:rootSelectionSet': GraphQLExecuteRootSelectionSetContext;\n /** Context published on `graphql:subscribe`. */\n 'graphql:subscribe': GraphQLSubscribeContext;\n /** Context published on `graphql:resolve`. */\n 'graphql:resolve': GraphQLResolveContext;\n}\n\n/**\n * The collection of tracing channels GraphQL.js emits on. Application\n * performance monitoring (APM) tools subscribe to these by name on their own\n * `node:diagnostics_channel` import; both paths land on the same channel\n * instance because `tracingChannel(name)` is cached by name.\n */\nexport interface GraphQLChannels {\n /** Tracing channel for `graphql:execute`. */\n execute: MinimalTracingChannel<GraphQLExecuteContext>;\n /** Tracing channel for `graphql:execute:variableCoercion`. */\n executeVariableCoercion: MinimalTracingChannel<GraphQLExecuteVariableCoercionContext>;\n /** Tracing channel for `graphql:execute:rootSelectionSet`. */\n executeRootSelectionSet: MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext>;\n /** Tracing channel for `graphql:parse`. */\n parse: MinimalTracingChannel<GraphQLParseContext>;\n /** Tracing channel for `graphql:validate`. */\n validate: MinimalTracingChannel<GraphQLValidateContext>;\n /** Tracing channel for `graphql:resolve`. */\n resolve: MinimalTracingChannel<GraphQLResolveContext>;\n /** Tracing channel for `graphql:subscribe`. */\n subscribe: MinimalTracingChannel<GraphQLSubscribeContext>;\n}\n\nfunction resolveDiagnosticsChannel(): DiagnosticsChannelModule | undefined {\n let dc: DiagnosticsChannelModule | undefined;\n try {\n const processRef = (\n globalThis as {\n process?: { getBuiltinModule?: (id: string) => unknown };\n }\n ).process;\n if (\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n typeof processRef?.getBuiltinModule === 'function'\n ) {\n // eslint-disable-next-line n/no-unsupported-features/node-builtins\n dc = processRef.getBuiltinModule(\n 'node:diagnostics_channel',\n ) as DiagnosticsChannelModule;\n }\n /* node:coverage ignore next 3 */\n } catch {\n // diagnostics_channel not available on this runtime; tracing is a no-op.\n }\n return dc;\n}\n\nconst dc = resolveDiagnosticsChannel();\n\n/**\n * Per-channel handles, resolved once at module load. `undefined` when\n * `node:diagnostics_channel` isn't available. Emission sites read these\n * directly to keep the no-subscriber fast path to a single property access\n * plus a `hasSubscribers` check (no function calls, no closures).\n *\n * @internal\n */\nexport const parseChannel:\n | MinimalTracingChannel<GraphQLParseContext>\n | undefined = dc?.tracingChannel('graphql:parse');\n/** @internal */\nexport const validateChannel:\n | MinimalTracingChannel<GraphQLValidateContext>\n | undefined = dc?.tracingChannel('graphql:validate');\n/** @internal */\nexport const executeChannel:\n | MinimalTracingChannel<GraphQLExecuteContext>\n | undefined = dc?.tracingChannel('graphql:execute');\n/** @internal */\nexport const executeVariableCoercionChannel:\n | MinimalTracingChannel<GraphQLExecuteVariableCoercionContext>\n | undefined = dc?.tracingChannel('graphql:execute:variableCoercion');\n/** @internal */\nexport const executeRootSelectionSetChannel:\n | MinimalTracingChannel<GraphQLExecuteRootSelectionSetContext>\n | undefined = dc?.tracingChannel('graphql:execute:rootSelectionSet');\n/** @internal */\nexport const subscribeChannel:\n | MinimalTracingChannel<GraphQLSubscribeContext>\n | undefined = dc?.tracingChannel('graphql:subscribe');\n/** @internal */\nexport const resolveChannel:\n | MinimalTracingChannel<GraphQLResolveContext>\n | undefined = dc?.tracingChannel('graphql:resolve');\n\nconst SUB_CHANNEL_KEYS: ReadonlyArray<\n 'start' | 'end' | 'asyncStart' | 'asyncEnd' | 'error'\n> = ['start', 'end', 'asyncStart', 'asyncEnd', 'error'];\n\n/**\n * Whether emission sites should publish to `channel`. Trusts the\n * `TracingChannel.hasSubscribers` aggregate when the runtime exposes it; if\n * the getter is missing (e.g. Bun's `node:diagnostics_channel`, where\n * `tracingChannel.hasSubscribers` is `undefined`), falls back to checking\n * each of the five underlying lifecycle channels so a subscriber attached\n * via `tracingChannel.subscribe(handlers)` is still observed.\n *\n * @internal\n */\nexport function shouldTrace<TContext = unknown>(\n channel: MinimalTracingChannel<TContext> | undefined,\n): channel is MinimalTracingChannel<TContext> {\n if (channel == null) {\n return false;\n }\n const aggregate = channel.hasSubscribers;\n if (aggregate !== undefined) {\n return aggregate;\n }\n // Bun-only fallback, exercised by integrationTests/diagnostics-bun.\n for (const key of SUB_CHANNEL_KEYS) {\n if (channel[key].hasSubscribers) {\n return true;\n }\n }\n return false;\n}\n\ninterface TraceLifecycleContext {\n error?: unknown;\n result?: unknown;\n}\n\ntype TraceStartContext<TContext extends TraceLifecycleContext> = Omit<\n TContext,\n 'error' | 'result'\n>;\n\n/**\n * Publish a traced call that may complete synchronously or with a promise.\n * Caller has already verified that a subscriber is attached. On normal\n * completion, `result` is attached before the terminal `end` or `asyncEnd`\n * event. When the traced call throws or rejects, `error` is attached, the\n * `error` sub-channel fires, and the terminal `end` or `asyncEnd` event is\n * published before the original failure is propagated.\n *\n * @internal\n */\nexport function traceMixed<TResult, TContext extends TraceLifecycleContext>(\n channel: MinimalTracingChannel<TContext>,\n contextInput: TraceStartContext<TContext>,\n fn: () => TResult,\n): TResult {\n const context = contextInput as TContext;\n\n return channel.start.runStores(context, () => {\n let result: TResult;\n try {\n result = fn();\n } catch (err) {\n context.error = err;\n channel.error.publish(context);\n channel.end.publish(context);\n throw err;\n }\n\n if (!isPromiseLike(result)) {\n context.result = result;\n channel.end.publish(context);\n return result;\n }\n\n channel.end.publish(context);\n\n return result.then(\n (value) => {\n context.result = value;\n channel.asyncStart.publish(context);\n channel.asyncEnd.publish(context);\n return value;\n },\n (err: unknown) => {\n context.error = err;\n channel.error.publish(context);\n channel.asyncStart.publish(context);\n channel.asyncEnd.publish(context);\n throw err;\n },\n ) as TResult;\n });\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "graphql",
|
|
3
|
-
"version": "17.0.
|
|
3
|
+
"version": "17.0.2",
|
|
4
4
|
"description": "A Query Language and Runtime which can target any service.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"typesVersions": {
|
|
@@ -33,9 +33,6 @@
|
|
|
33
33
|
"engines": {
|
|
34
34
|
"node": "^22.0.0 || ^24.0.0 || ^25.0.0 || >=26.0.0"
|
|
35
35
|
},
|
|
36
|
-
"publishConfig": {
|
|
37
|
-
"tag": "latest"
|
|
38
|
-
},
|
|
39
36
|
"main": "index.js",
|
|
40
37
|
"module": "index.mjs",
|
|
41
38
|
"types": "index.d.ts",
|
|
@@ -29,6 +29,7 @@ export declare const DangerousChangeType: {
|
|
|
29
29
|
readonly OPTIONAL_ARG_ADDED: "OPTIONAL_ARG_ADDED";
|
|
30
30
|
readonly IMPLEMENTED_INTERFACE_ADDED: "IMPLEMENTED_INTERFACE_ADDED";
|
|
31
31
|
readonly ARG_DEFAULT_VALUE_CHANGE: "ARG_DEFAULT_VALUE_CHANGE";
|
|
32
|
+
readonly INPUT_FIELD_DEFAULT_VALUE_CHANGE: "INPUT_FIELD_DEFAULT_VALUE_CHANGE";
|
|
32
33
|
};
|
|
33
34
|
/** Categories of schema changes that may be dangerous for existing operations. */
|
|
34
35
|
export type DangerousChangeType = (typeof DangerousChangeType)[keyof typeof DangerousChangeType];
|
|
@@ -46,6 +47,7 @@ export declare const SafeChangeType: {
|
|
|
46
47
|
readonly FIELD_CHANGED_KIND_SAFE: "FIELD_CHANGED_KIND_SAFE";
|
|
47
48
|
readonly ARG_CHANGED_KIND_SAFE: "ARG_CHANGED_KIND_SAFE";
|
|
48
49
|
readonly ARG_DEFAULT_VALUE_ADDED: "ARG_DEFAULT_VALUE_ADDED";
|
|
50
|
+
readonly INPUT_FIELD_DEFAULT_VALUE_ADDED: "INPUT_FIELD_DEFAULT_VALUE_ADDED";
|
|
49
51
|
};
|
|
50
52
|
/** Categories of schema changes that are considered safe for existing operations. */
|
|
51
53
|
export type SafeChangeType = (typeof SafeChangeType)[keyof typeof SafeChangeType];
|
|
@@ -29,6 +29,7 @@ export declare const DangerousChangeType: {
|
|
|
29
29
|
readonly OPTIONAL_ARG_ADDED: "OPTIONAL_ARG_ADDED";
|
|
30
30
|
readonly IMPLEMENTED_INTERFACE_ADDED: "IMPLEMENTED_INTERFACE_ADDED";
|
|
31
31
|
readonly ARG_DEFAULT_VALUE_CHANGE: "ARG_DEFAULT_VALUE_CHANGE";
|
|
32
|
+
readonly INPUT_FIELD_DEFAULT_VALUE_CHANGE: "INPUT_FIELD_DEFAULT_VALUE_CHANGE";
|
|
32
33
|
};
|
|
33
34
|
/** Categories of schema changes that may be dangerous for existing operations. */
|
|
34
35
|
export type DangerousChangeType = (typeof DangerousChangeType)[keyof typeof DangerousChangeType];
|
|
@@ -46,6 +47,7 @@ export declare const SafeChangeType: {
|
|
|
46
47
|
readonly FIELD_CHANGED_KIND_SAFE: "FIELD_CHANGED_KIND_SAFE";
|
|
47
48
|
readonly ARG_CHANGED_KIND_SAFE: "ARG_CHANGED_KIND_SAFE";
|
|
48
49
|
readonly ARG_DEFAULT_VALUE_ADDED: "ARG_DEFAULT_VALUE_ADDED";
|
|
50
|
+
readonly INPUT_FIELD_DEFAULT_VALUE_ADDED: "INPUT_FIELD_DEFAULT_VALUE_ADDED";
|
|
49
51
|
};
|
|
50
52
|
/** Categories of schema changes that are considered safe for existing operations. */
|
|
51
53
|
export type SafeChangeType = (typeof SafeChangeType)[keyof typeof SafeChangeType];
|
|
@@ -37,6 +37,7 @@ exports.DangerousChangeType = {
|
|
|
37
37
|
OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED',
|
|
38
38
|
IMPLEMENTED_INTERFACE_ADDED: 'IMPLEMENTED_INTERFACE_ADDED',
|
|
39
39
|
ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE',
|
|
40
|
+
INPUT_FIELD_DEFAULT_VALUE_CHANGE: 'INPUT_FIELD_DEFAULT_VALUE_CHANGE',
|
|
40
41
|
};
|
|
41
42
|
exports.SafeChangeType = {
|
|
42
43
|
DESCRIPTION_CHANGED: 'DESCRIPTION_CHANGED',
|
|
@@ -51,6 +52,7 @@ exports.SafeChangeType = {
|
|
|
51
52
|
FIELD_CHANGED_KIND_SAFE: 'FIELD_CHANGED_KIND_SAFE',
|
|
52
53
|
ARG_CHANGED_KIND_SAFE: 'ARG_CHANGED_KIND_SAFE',
|
|
53
54
|
ARG_DEFAULT_VALUE_ADDED: 'ARG_DEFAULT_VALUE_ADDED',
|
|
55
|
+
INPUT_FIELD_DEFAULT_VALUE_ADDED: 'INPUT_FIELD_DEFAULT_VALUE_ADDED',
|
|
54
56
|
};
|
|
55
57
|
function findBreakingChanges(oldSchema, newSchema) {
|
|
56
58
|
return findSchemaChanges(oldSchema, newSchema).filter((change) => change.type in exports.BreakingChangeType);
|
|
@@ -257,12 +259,35 @@ function findInputObjectTypeChanges(oldType, newType) {
|
|
|
257
259
|
}
|
|
258
260
|
for (const [oldField, newField] of fieldsDiff.persisted) {
|
|
259
261
|
const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldField.type, newField.type);
|
|
262
|
+
const oldDefaultValueStr = getDefaultValue(oldField);
|
|
263
|
+
const newDefaultValueStr = getDefaultValue(newField);
|
|
260
264
|
if (!isSafe) {
|
|
261
265
|
schemaChanges.push({
|
|
262
266
|
type: exports.BreakingChangeType.FIELD_CHANGED_KIND,
|
|
263
267
|
description: `Field ${newField} changed type from ${oldField.type} to ${newField.type}.`,
|
|
264
268
|
});
|
|
265
269
|
}
|
|
270
|
+
else if (oldDefaultValueStr !== undefined) {
|
|
271
|
+
if (newDefaultValueStr === undefined) {
|
|
272
|
+
schemaChanges.push({
|
|
273
|
+
type: exports.DangerousChangeType.INPUT_FIELD_DEFAULT_VALUE_CHANGE,
|
|
274
|
+
description: `${oldField} defaultValue was removed.`,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
else if (oldDefaultValueStr !== newDefaultValueStr) {
|
|
278
|
+
schemaChanges.push({
|
|
279
|
+
type: exports.DangerousChangeType.INPUT_FIELD_DEFAULT_VALUE_CHANGE,
|
|
280
|
+
description: `${oldField} has changed defaultValue from ${oldDefaultValueStr} to ${newDefaultValueStr}.`,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
else if (newDefaultValueStr !== undefined &&
|
|
285
|
+
oldDefaultValueStr === undefined) {
|
|
286
|
+
schemaChanges.push({
|
|
287
|
+
type: exports.SafeChangeType.INPUT_FIELD_DEFAULT_VALUE_ADDED,
|
|
288
|
+
description: `${oldField} added a defaultValue ${newDefaultValueStr}.`,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
266
291
|
else if (oldField.type.toString() !== newField.type.toString()) {
|
|
267
292
|
schemaChanges.push({
|
|
268
293
|
type: exports.SafeChangeType.F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AAC,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YACvC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AACvC,CAAC","sourcesContent":["/** @category Schema Changes */\n\nimport { inspect } from '../jsutils/inspect.ts';\nimport { invariant } from '../jsutils/invariant.ts';\nimport { keyMap } from '../jsutils/keyMap.ts';\n\nimport { print } from '../language/printer.ts';\n\nimport type {\n GraphQLArgument,\n GraphQLEnumType,\n GraphQLField,\n GraphQLInputField,\n GraphQLInputObjectType,\n GraphQLInterfaceType,\n GraphQLNamedType,\n GraphQLObjectType,\n GraphQLType,\n GraphQLUnionType,\n} from '../type/definition.ts';\nimport {\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNamedType,\n isNonNullType,\n isObjectType,\n isRequiredArgument,\n isRequiredInputField,\n isScalarType,\n isUnionType,\n} from '../type/definition.ts';\nimport { isSpecifiedScalarType } from '../type/scalars.ts';\nimport type { GraphQLSchema } from '../type/schema.ts';\n\nimport { getDefaultValueAST } from './getDefaultValueAST.ts';\nimport { sortValueNode } from './sortValueNode.ts';\n\n/** Categories of schema changes that may break existing operations. */\nexport const BreakingChangeType = {\n TYPE_REMOVED: 'TYPE_REMOVED' as const,\n TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND' as const,\n TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION' as const,\n VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM' as const,\n REQUIRED_INPUT_FIELD_ADDED: 'REQUIRED_INPUT_FIELD_ADDED' as const,\n IMPLEMENTED_INTERFACE_REMOVED: 'IMPLEMENTED_INTERFACE_REMOVED' as const,\n FIELD_REMOVED: 'FIELD_REMOVED' as const,\n FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND' as const,\n REQUIRED_ARG_ADDED: 'REQUIRED_ARG_ADDED' as const,\n ARG_REMOVED: 'ARG_REMOVED' as const,\n ARG_CHANGED_KIND: 'ARG_CHANGED_KIND' as const,\n DIRECTIVE_REMOVED: 'DIRECTIVE_REMOVED' as const,\n DIRECTIVE_ARG_REMOVED: 'DIRECTIVE_ARG_REMOVED' as const,\n REQUIRED_DIRECTIVE_ARG_ADDED: 'REQUIRED_DIRECTIVE_ARG_ADDED' as const,\n DIRECTIVE_REPEATABLE_REMOVED: 'DIRECTIVE_REPEATABLE_REMOVED' as const,\n DIRECTIVE_LOCATION_REMOVED: 'DIRECTIVE_LOCATION_REMOVED' as const,\n} as const;\n\n/** Categories of schema changes that may break existing operations. */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type BreakingChangeType =\n (typeof BreakingChangeType)[keyof typeof BreakingChangeType];\n\n/** Categories of schema changes that may be dangerous for existing operations. */\nexport const DangerousChangeType = {\n VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM' as const,\n TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION' as const,\n OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED' as const,\n OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED' as const,\n IMPLEMENTED_INTERFACE_ADDED: 'IMPLEMENTED_INTERFACE_ADDED' as const,\n ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE' as const,\n} as const;\n\n/** Categories of schema changes that may be dangerous for existing operations. */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type DangerousChangeType =\n (typeof DangerousChangeType)[keyof typeof DangerousChangeType];\n\n/** Categories of schema changes that are considered safe for existing operations. */\nexport const SafeChangeType = {\n DESCRIPTION_CHANGED: 'DESCRIPTION_CHANGED' as const,\n TYPE_ADDED: 'TYPE_ADDED' as const,\n OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED' as const,\n OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED' as const,\n DIRECTIVE_ADDED: 'DIRECTIVE_ADDED' as const,\n FIELD_ADDED: 'FIELD_ADDED' as const,\n DIRECTIVE_REPEATABLE_ADDED: 'DIRECTIVE_REPEATABLE_ADDED' as const,\n DIRECTIVE_LOCATION_ADDED: 'DIRECTIVE_LOCATION_ADDED' as const,\n OPTIONAL_DIRECTIVE_ARG_ADDED: 'OPTIONAL_DIRECTIVE_ARG_ADDED' as const,\n FIELD_CHANGED_KIND_SAFE: 'FIELD_CHANGED_KIND_SAFE' as const,\n ARG_CHANGED_KIND_SAFE: 'ARG_CHANGED_KIND_SAFE' as const,\n ARG_DEFAULT_VALUE_ADDED: 'ARG_DEFAULT_VALUE_ADDED' as const,\n} as const;\n\n/** Categories of schema changes that are considered safe for existing operations. */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type SafeChangeType =\n (typeof SafeChangeType)[keyof typeof SafeChangeType];\n\n/** Description of a schema change that may break existing operations. */\nexport interface BreakingChange {\n /** Specific kind of breaking schema change. */\n type: BreakingChangeType;\n /** Human-readable description of the breaking schema change. */\n description: string;\n}\n\n/** Description of a schema change that may be dangerous for existing operations. */\nexport interface DangerousChange {\n /** Specific kind of dangerous schema change. */\n type: DangerousChangeType;\n /** Human-readable description of the dangerous schema change. */\n description: string;\n}\n\n/** Description of a schema change that is considered safe for existing operations. */\nexport interface SafeChange {\n /** Specific kind of safe schema change. */\n type: SafeChangeType;\n /** Human-readable description of the safe schema change. */\n description: string;\n}\n\n/** Any schema change detected between two schemas. */\nexport type SchemaChange = SafeChange | DangerousChange | BreakingChange;\n\n/**\n * Given two schemas, returns an Array containing descriptions of all the types\n * of breaking changes covered by the other functions down below. This\n * deprecated wrapper will be removed in v18; use `findSchemaChanges()` instead\n * and filter for breaking changes.\n * @param oldSchema - Schema before the change.\n * @param newSchema - Schema after the change.\n * @returns Breaking changes between the two schemas.\n * @example\n * ```ts\n * import { buildSchema, findBreakingChanges } from 'graphql/utilities';\n *\n * const oldSchema = buildSchema(`\n * type Query {\n * greeting: String\n * }\n * `);\n * const newSchema = buildSchema(`\n * type Query {\n * hello: String\n * }\n * `);\n *\n * const changes = findBreakingChanges(oldSchema, newSchema);\n *\n * changes.map((change) => change.type); // => ['FIELD_REMOVED']\n * ```\n * @deprecated Please use `findSchemaChanges` instead. Will be removed in v18.\n */\nexport function findBreakingChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<BreakingChange> {\n // @ts-expect-error\n return findSchemaChanges(oldSchema, newSchema).filter(\n (change) => change.type in BreakingChangeType,\n );\n}\n\n/**\n * Given two schemas, returns an Array containing descriptions of all the types\n * of potentially dangerous changes covered by the other functions down below.\n * This deprecated wrapper will be removed in v18; use `findSchemaChanges()`\n * instead and filter for dangerous changes.\n * @param oldSchema - Schema before the change.\n * @param newSchema - Schema after the change.\n * @returns Dangerous changes between the two schemas.\n * @example\n * ```ts\n * import { buildSchema, findDangerousChanges } from 'graphql/utilities';\n *\n * const oldSchema = buildSchema(`\n * enum Episode {\n * NEW_HOPE\n * }\n *\n * type Query {\n * episode: Episode\n * }\n * `);\n * const newSchema = buildSchema(`\n * enum Episode {\n * NEW_HOPE\n * EMPIRE\n * }\n *\n * type Query {\n * episode: Episode\n * }\n * `);\n *\n * const changes = findDangerousChanges(oldSchema, newSchema);\n *\n * changes.map((change) => change.type); // => ['VALUE_ADDED_TO_ENUM']\n * ```\n * @deprecated Please use `findSchemaChanges` instead. Will be removed in v18.\n */\nexport function findDangerousChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<DangerousChange> {\n // @ts-expect-error\n return findSchemaChanges(oldSchema, newSchema).filter(\n (change) => change.type in DangerousChangeType,\n );\n}\n\n/**\n * Finds all schema changes between two schemas.\n * @param oldSchema - Schema before the change.\n * @param newSchema - Schema after the change.\n * @returns Safe, dangerous, and breaking changes between the two schemas.\n * @example\n * ```ts\n * import { buildSchema, findSchemaChanges } from 'graphql/utilities';\n *\n * const oldSchema = buildSchema(`\n * type Query {\n * greeting: String\n * }\n * `);\n * const newSchema = buildSchema(`\n * type Query {\n * greeting(name: String): String\n * farewell: String\n * }\n * `);\n *\n * const changes = findSchemaChanges(oldSchema, newSchema);\n *\n * changes.map((change) => change.type); // => ['OPTIONAL_ARG_ADDED', 'FIELD_ADDED']\n * ```\n */\nexport function findSchemaChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<SchemaChange> {\n return [\n ...findTypeChanges(oldSchema, newSchema),\n ...findDirectiveChanges(oldSchema, newSchema),\n ];\n}\n\nfunction findDirectiveChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<SchemaChange> {\n const schemaChanges = [];\n\n const directivesDiff = diff(\n oldSchema.getDirectives(),\n newSchema.getDirectives(),\n );\n\n for (const oldDirective of directivesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_REMOVED,\n description: `Directive ${oldDirective} was removed.`,\n });\n }\n\n for (const newDirective of directivesDiff.added) {\n schemaChanges.push({\n type: SafeChangeType.DIRECTIVE_ADDED,\n description: `Directive @${newDirective.name} was added.`,\n });\n }\n\n for (const [oldDirective, newDirective] of directivesDiff.persisted) {\n const argsDiff = diff(oldDirective.args, newDirective.args);\n\n for (const newArg of argsDiff.added) {\n if (isRequiredArgument(newArg)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED,\n description: `A required argument ${newArg} was added.`,\n });\n } else {\n schemaChanges.push({\n type: SafeChangeType.OPTIONAL_DIRECTIVE_ARG_ADDED,\n description: `An optional argument @${oldDirective.name}(${newArg.name}:) was added.`,\n });\n }\n }\n\n for (const oldArg of argsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_ARG_REMOVED,\n description: `Argument ${oldArg} was removed.`,\n });\n }\n\n for (const [oldArg, newArg] of argsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldArg.type,\n newArg.type,\n );\n\n const oldDefaultValueStr = getDefaultValue(oldArg);\n const newDefaultValueStr = getDefaultValue(newArg);\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description:\n `Argument @${oldDirective.name}(${oldArg.name}:) has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n } else if (oldDefaultValueStr !== undefined) {\n if (newDefaultValueStr === undefined) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `@${oldDirective.name}(${oldArg.name}:) defaultValue was removed.`,\n });\n } else if (oldDefaultValueStr !== newDefaultValueStr) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `@${oldDirective.name}(${oldArg.name}:) has changed defaultValue from ${oldDefaultValueStr} to ${newDefaultValueStr}.`,\n });\n }\n } else if (\n newDefaultValueStr !== undefined &&\n oldDefaultValueStr === undefined\n ) {\n schemaChanges.push({\n type: SafeChangeType.ARG_DEFAULT_VALUE_ADDED,\n description: `@${oldDirective.name}(${oldArg.name}:) added a defaultValue ${newDefaultValueStr}.`,\n });\n } else if (oldArg.type.toString() !== newArg.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.ARG_CHANGED_KIND_SAFE,\n description:\n `Argument @${oldDirective.name}(${oldArg.name}:) has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n }\n\n if (oldArg.description !== newArg.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of @${oldDirective.name}(${oldDirective.name}) has changed to \"${newArg.description}\".`,\n });\n }\n }\n\n if (oldDirective.isRepeatable && !newDirective.isRepeatable) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED,\n description: `Repeatable flag was removed from ${oldDirective}.`,\n });\n } else if (newDirective.isRepeatable && !oldDirective.isRepeatable) {\n schemaChanges.push({\n type: SafeChangeType.DIRECTIVE_REPEATABLE_ADDED,\n description: `Repeatable flag was added to @${oldDirective.name}.`,\n });\n }\n\n if (oldDirective.description !== newDirective.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of @${oldDirective.name} has changed to \"${newDirective.description}\".`,\n });\n }\n\n for (const location of oldDirective.locations) {\n if (!newDirective.locations.includes(location)) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED,\n description: `${location} was removed from ${oldDirective}.`,\n });\n }\n }\n\n for (const location of newDirective.locations) {\n if (!oldDirective.locations.includes(location)) {\n schemaChanges.push({\n type: SafeChangeType.DIRECTIVE_LOCATION_ADDED,\n description: `${location} was added to @${oldDirective.name}.`,\n });\n }\n }\n }\n\n return schemaChanges;\n}\n\nfunction findTypeChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<SchemaChange> {\n const schemaChanges = [];\n\n const typesDiff = diff(\n Object.values(oldSchema.getTypeMap()),\n Object.values(newSchema.getTypeMap()),\n );\n\n for (const oldType of typesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: isSpecifiedScalarType(oldType)\n ? `Standard scalar ${oldType} was removed because it is not referenced anymore.`\n : `${oldType} was removed.`,\n });\n }\n\n for (const newType of typesDiff.added) {\n schemaChanges.push({\n type: SafeChangeType.TYPE_ADDED,\n description: `${newType} was added.`,\n });\n }\n\n for (const [oldType, newType] of typesDiff.persisted) {\n if (oldType.description !== newType.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of ${oldType.name} has changed to \"${newType.description}\".`,\n });\n }\n\n if (isEnumType(oldType) && isEnumType(newType)) {\n schemaChanges.push(...findEnumTypeChanges(oldType, newType));\n } else if (isUnionType(oldType) && isUnionType(newType)) {\n schemaChanges.push(...findUnionTypeChanges(oldType, newType));\n } else if (isInputObjectType(oldType) && isInputObjectType(newType)) {\n schemaChanges.push(...findInputObjectTypeChanges(oldType, newType));\n } else if (isObjectType(oldType) && isObjectType(newType)) {\n schemaChanges.push(\n ...findFieldChanges(oldType, newType),\n ...findImplementedInterfacesChanges(oldType, newType),\n );\n } else if (isInterfaceType(oldType) && isInterfaceType(newType)) {\n schemaChanges.push(\n ...findFieldChanges(oldType, newType),\n ...findImplementedInterfacesChanges(oldType, newType),\n );\n } else if (oldType.constructor !== newType.constructor) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: `${oldType} changed from ${typeKindName(\n oldType,\n )} to ${typeKindName(newType)}.`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findInputObjectTypeChanges(\n oldType: GraphQLInputObjectType,\n newType: GraphQLInputObjectType,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const fieldsDiff = diff(\n Object.values(oldType.getFields()),\n Object.values(newType.getFields()),\n );\n\n for (const newField of fieldsDiff.added) {\n if (isRequiredInputField(newField)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED,\n description: `A required field ${newField} was added.`,\n });\n } else {\n schemaChanges.push({\n type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED,\n description: `An optional field ${newField} was added.`,\n });\n }\n }\n\n for (const oldField of fieldsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_REMOVED,\n description: `Field ${oldField} was removed.`,\n });\n }\n\n for (const [oldField, newField] of fieldsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldField.type,\n newField.type,\n );\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_CHANGED_KIND,\n description: `Field ${newField} changed type from ${oldField.type} to ${newField.type}.`,\n });\n } else if (oldField.type.toString() !== newField.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.FIELD_CHANGED_KIND_SAFE,\n description:\n `Field ${oldType}.${oldField.name} changed type from ` +\n `${String(oldField.type)} to ${String(newField.type)}.`,\n });\n }\n\n if (oldField.description !== newField.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of input-field ${newType}.${newField.name} has changed to \"${newField.description}\".`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findUnionTypeChanges(\n oldType: GraphQLUnionType,\n newType: GraphQLUnionType,\n): Array<BreakingChange | DangerousChange> {\n const schemaChanges = [];\n const possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes());\n\n for (const newPossibleType of possibleTypesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: `${newPossibleType} was added to union type ${oldType}.`,\n });\n }\n\n for (const oldPossibleType of possibleTypesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: `${oldPossibleType} was removed from union type ${oldType}.`,\n });\n }\n\n return schemaChanges;\n}\n\nfunction findEnumTypeChanges(\n oldType: GraphQLEnumType,\n newType: GraphQLEnumType,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const valuesDiff = diff(oldType.getValues(), newType.getValues());\n\n for (const newValue of valuesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: `Enum value ${newValue} was added.`,\n });\n }\n\n for (const oldValue of valuesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: `Enum value ${oldValue} was removed.`,\n });\n }\n\n for (const [oldValue, newValue] of valuesDiff.persisted) {\n if (oldValue.description !== newValue.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of enum value ${oldType}.${oldValue.name} has changed to \"${newValue.description}\".`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findImplementedInterfacesChanges(\n oldType: GraphQLObjectType | GraphQLInterfaceType,\n newType: GraphQLObjectType | GraphQLInterfaceType,\n): Array<BreakingChange | DangerousChange> {\n const schemaChanges = [];\n const interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces());\n\n for (const newInterface of interfacesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED,\n description: `${newInterface} added to interfaces implemented by ${oldType}.`,\n });\n }\n\n for (const oldInterface of interfacesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED,\n description: `${oldType} no longer implements interface ${oldInterface}.`,\n });\n }\n\n return schemaChanges;\n}\n\nfunction findFieldChanges(\n oldType: GraphQLObjectType | GraphQLInterfaceType,\n newType: GraphQLObjectType | GraphQLInterfaceType,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const fieldsDiff = diff(\n Object.values(oldType.getFields()),\n Object.values(newType.getFields()),\n );\n\n for (const oldField of fieldsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_REMOVED,\n description: `Field ${oldField} was removed.`,\n });\n }\n\n for (const newField of fieldsDiff.added) {\n schemaChanges.push({\n type: SafeChangeType.FIELD_ADDED,\n description: `Field ${oldType}.${newField.name} was added.`,\n });\n }\n\n for (const [oldField, newField] of fieldsDiff.persisted) {\n schemaChanges.push(...findArgChanges(oldField, newField));\n\n const isSafe = isChangeSafeForObjectOrInterfaceField(\n oldField.type,\n newField.type,\n );\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_CHANGED_KIND,\n description: `Field ${newField} changed type from ${oldField.type} to ${newField.type}.`,\n });\n } else if (oldField.type.toString() !== newField.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.FIELD_CHANGED_KIND_SAFE,\n description:\n `Field ${oldType}.${oldField.name} changed type from ` +\n `${String(oldField.type)} to ${String(newField.type)}.`,\n });\n }\n\n if (oldField.description !== newField.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of field ${oldType}.${oldField.name} has changed to \"${newField.description}\".`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findArgChanges(\n oldField: GraphQLField<unknown, unknown>,\n newField: GraphQLField<unknown, unknown>,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const argsDiff = diff(oldField.args, newField.args);\n\n for (const oldArg of argsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: `Argument ${oldArg} was removed.`,\n });\n }\n\n for (const [oldArg, newArg] of argsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldArg.type,\n newArg.type,\n );\n\n const oldDefaultValueStr = getDefaultValue(oldArg);\n const newDefaultValueStr = getDefaultValue(newArg);\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: `Argument ${newArg} has changed type from ${oldArg.type} to ${newArg.type}.`,\n });\n } else if (oldDefaultValueStr !== undefined) {\n if (newDefaultValueStr === undefined) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `${oldArg} defaultValue was removed.`,\n });\n } else if (oldDefaultValueStr !== newDefaultValueStr) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `${oldArg} has changed defaultValue from ${oldDefaultValueStr} to ${newDefaultValueStr}.`,\n });\n }\n } else if (\n newDefaultValueStr !== undefined &&\n oldDefaultValueStr === undefined\n ) {\n schemaChanges.push({\n type: SafeChangeType.ARG_DEFAULT_VALUE_ADDED,\n description: `${oldArg} added a defaultValue ${newDefaultValueStr}.`,\n });\n } else if (oldArg.type.toString() !== newArg.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.ARG_CHANGED_KIND_SAFE,\n description:\n `Argument ${oldArg} has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n }\n\n if (oldArg.description !== newArg.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of argument ${oldArg} has changed to \"${newArg.description}\".`,\n });\n }\n }\n\n for (const newArg of argsDiff.added) {\n if (isRequiredArgument(newArg)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_ARG_ADDED,\n description: `A required argument ${newArg} was added.`,\n });\n } else {\n schemaChanges.push({\n type: DangerousChangeType.OPTIONAL_ARG_ADDED,\n description: `An optional argument ${newArg} was added.`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction isChangeSafeForObjectOrInterfaceField(\n oldType: GraphQLType,\n newType: GraphQLType,\n): boolean {\n if (isListType(oldType)) {\n return (\n // if they're both lists, make sure the underlying types are compatible\n (isListType(newType) &&\n isChangeSafeForObjectOrInterfaceField(\n oldType.ofType,\n newType.ofType,\n )) ||\n // moving from nullable to non-null of the same underlying type is safe\n (isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))\n );\n }\n\n if (isNonNullType(oldType)) {\n // if they're both non-null, make sure the underlying types are compatible\n return (\n isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType)\n );\n }\n\n return (\n // if they're both named types, see if their names are equivalent\n (isNamedType(newType) && oldType.name === newType.name) ||\n // moving from nullable to non-null of the same underlying type is safe\n (isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))\n );\n}\n\nfunction isChangeSafeForInputObjectFieldOrFieldArg(\n oldType: GraphQLType,\n newType: GraphQLType,\n): boolean {\n if (isListType(oldType)) {\n // if they're both lists, make sure the underlying types are compatible\n return (\n isListType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType)\n );\n }\n\n if (isNonNullType(oldType)) {\n return (\n // if they're both non-null, make sure the underlying types are\n // compatible\n (isNonNullType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(\n oldType.ofType,\n newType.ofType,\n )) ||\n // moving from non-null to nullable of the same underlying type is safe\n (!isNonNullType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType))\n );\n }\n\n // if they're both named types, see if their names are equivalent\n return isNamedType(newType) && oldType.name === newType.name;\n}\n\nfunction typeKindName(type: GraphQLNamedType): string {\n if (isScalarType(type)) {\n return 'a Scalar type';\n }\n if (isObjectType(type)) {\n return 'an Object type';\n }\n if (isInterfaceType(type)) {\n return 'an Interface type';\n }\n if (isUnionType(type)) {\n return 'a Union type';\n }\n if (isEnumType(type)) {\n return 'an Enum type';\n }\n if (isInputObjectType(type)) {\n return 'an Input type';\n /* node:coverage ignore next 4 */\n }\n // Not reachable, all possible types have been considered.\n invariant(false, 'Unexpected type: ' + inspect(type));\n}\n\n// Since we looking only for client's observable changes we should\n// compare default values in the same representation as they are\n// represented inside introspection.\nfunction getDefaultValue(\n argOrInputField: GraphQLArgument | GraphQLInputField,\n): string | undefined {\n const ast = getDefaultValueAST(argOrInputField);\n if (ast) {\n return print(sortValueNode(ast));\n }\n}\n\nfunction diff<T extends { name: string }>(\n oldArray: ReadonlyArray<T>,\n newArray: ReadonlyArray<T>,\n): {\n added: ReadonlyArray<T>;\n removed: ReadonlyArray<T>;\n persisted: ReadonlyArray<[T, T]>;\n} {\n const added: Array<T> = [];\n const removed: Array<T> = [];\n const persisted: Array<[T, T]> = [];\n\n const oldMap = keyMap(oldArray, ({ name }) => name);\n const newMap = keyMap(newArray, ({ name }) => name);\n\n for (const oldItem of oldArray) {\n const newItem = newMap[oldItem.name];\n if (newItem === undefined) {\n removed.push(oldItem);\n } else {\n persisted.push([oldItem, newItem]);\n }\n }\n\n for (const newItem of newArray) {\n if (oldMap[newItem.name] === undefined) {\n added.push(newItem);\n }\n }\n\n return { added, persisted, removed };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"findSchemaChanges.js","s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\nimport { invariant } from '../jsutils/invariant.ts';\nimport { keyMap } from '../jsutils/keyMap.ts';\n\nimport { print } from '../language/printer.ts';\n\nimport type {\n GraphQLArgument,\n GraphQLEnumType,\n GraphQLField,\n GraphQLInputField,\n GraphQLInputObjectType,\n GraphQLInterfaceType,\n GraphQLNamedType,\n GraphQLObjectType,\n GraphQLType,\n GraphQLUnionType,\n} from '../type/definition.ts';\nimport {\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNamedType,\n isNonNullType,\n isObjectType,\n isRequiredArgument,\n isRequiredInputField,\n isScalarType,\n isUnionType,\n} from '../type/definition.ts';\nimport { isSpecifiedScalarType } from '../type/scalars.ts';\nimport type { GraphQLSchema } from '../type/schema.ts';\n\nimport { getDefaultValueAST } from './getDefaultValueAST.ts';\nimport { sortValueNode } from './sortValueNode.ts';\n\n/** Categories of schema changes that may break existing operations. */\nexport const BreakingChangeType = {\n TYPE_REMOVED: 'TYPE_REMOVED' as const,\n TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND' as const,\n TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION' as const,\n VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM' as const,\n REQUIRED_INPUT_FIELD_ADDED: 'REQUIRED_INPUT_FIELD_ADDED' as const,\n IMPLEMENTED_INTERFACE_REMOVED: 'IMPLEMENTED_INTERFACE_REMOVED' as const,\n FIELD_REMOVED: 'FIELD_REMOVED' as const,\n FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND' as const,\n REQUIRED_ARG_ADDED: 'REQUIRED_ARG_ADDED' as const,\n ARG_REMOVED: 'ARG_REMOVED' as const,\n ARG_CHANGED_KIND: 'ARG_CHANGED_KIND' as const,\n DIRECTIVE_REMOVED: 'DIRECTIVE_REMOVED' as const,\n DIRECTIVE_ARG_REMOVED: 'DIRECTIVE_ARG_REMOVED' as const,\n REQUIRED_DIRECTIVE_ARG_ADDED: 'REQUIRED_DIRECTIVE_ARG_ADDED' as const,\n DIRECTIVE_REPEATABLE_REMOVED: 'DIRECTIVE_REPEATABLE_REMOVED' as const,\n DIRECTIVE_LOCATION_REMOVED: 'DIRECTIVE_LOCATION_REMOVED' as const,\n} as const;\n\n/** Categories of schema changes that may break existing operations. */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type BreakingChangeType =\n (typeof BreakingChangeType)[keyof typeof BreakingChangeType];\n\n/** Categories of schema changes that may be dangerous for existing operations. */\nexport const DangerousChangeType = {\n VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM' as const,\n TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION' as const,\n OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED' as const,\n OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED' as const,\n IMPLEMENTED_INTERFACE_ADDED: 'IMPLEMENTED_INTERFACE_ADDED' as const,\n ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE' as const,\n INPUT_FIELD_DEFAULT_VALUE_CHANGE: 'INPUT_FIELD_DEFAULT_VALUE_CHANGE' as const,\n} as const;\n\n/** Categories of schema changes that may be dangerous for existing operations. */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type DangerousChangeType =\n (typeof DangerousChangeType)[keyof typeof DangerousChangeType];\n\n/** Categories of schema changes that are considered safe for existing operations. */\nexport const SafeChangeType = {\n DESCRIPTION_CHANGED: 'DESCRIPTION_CHANGED' as const,\n TYPE_ADDED: 'TYPE_ADDED' as const,\n OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED' as const,\n OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED' as const,\n DIRECTIVE_ADDED: 'DIRECTIVE_ADDED' as const,\n FIELD_ADDED: 'FIELD_ADDED' as const,\n DIRECTIVE_REPEATABLE_ADDED: 'DIRECTIVE_REPEATABLE_ADDED' as const,\n DIRECTIVE_LOCATION_ADDED: 'DIRECTIVE_LOCATION_ADDED' as const,\n OPTIONAL_DIRECTIVE_ARG_ADDED: 'OPTIONAL_DIRECTIVE_ARG_ADDED' as const,\n FIELD_CHANGED_KIND_SAFE: 'FIELD_CHANGED_KIND_SAFE' as const,\n ARG_CHANGED_KIND_SAFE: 'ARG_CHANGED_KIND_SAFE' as const,\n ARG_DEFAULT_VALUE_ADDED: 'ARG_DEFAULT_VALUE_ADDED' as const,\n INPUT_FIELD_DEFAULT_VALUE_ADDED: 'INPUT_FIELD_DEFAULT_VALUE_ADDED' as const,\n} as const;\n\n/** Categories of schema changes that are considered safe for existing operations. */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type SafeChangeType =\n (typeof SafeChangeType)[keyof typeof SafeChangeType];\n\n/** Description of a schema change that may break existing operations. */\nexport interface BreakingChange {\n /** Specific kind of breaking schema change. */\n type: BreakingChangeType;\n /** Human-readable description of the breaking schema change. */\n description: string;\n}\n\n/** Description of a schema change that may be dangerous for existing operations. */\nexport interface DangerousChange {\n /** Specific kind of dangerous schema change. */\n type: DangerousChangeType;\n /** Human-readable description of the dangerous schema change. */\n description: string;\n}\n\n/** Description of a schema change that is considered safe for existing operations. */\nexport interface SafeChange {\n /** Specific kind of safe schema change. */\n type: SafeChangeType;\n /** Human-readable description of the safe schema change. */\n description: string;\n}\n\n/** Any schema change detected between two schemas. */\nexport type SchemaChange = SafeChange | DangerousChange | BreakingChange;\n\n/**\n * Given two schemas, returns an Array containing descriptions of all the types\n * of breaking changes covered by the other functions down below. This\n * deprecated wrapper will be removed in v18; use `findSchemaChanges()` instead\n * and filter for breaking changes.\n * @param oldSchema - Schema before the change.\n * @param newSchema - Schema after the change.\n * @returns Breaking changes between the two schemas.\n * @example\n * ```ts\n * import { buildSchema, findBreakingChanges } from 'graphql/utilities';\n *\n * const oldSchema = buildSchema(`\n * type Query {\n * greeting: String\n * }\n * `);\n * const newSchema = buildSchema(`\n * type Query {\n * hello: String\n * }\n * `);\n *\n * const changes = findBreakingChanges(oldSchema, newSchema);\n *\n * changes.map((change) => change.type); // => ['FIELD_REMOVED']\n * ```\n * @deprecated Please use `findSchemaChanges` instead. Will be removed in v18.\n */\nexport function findBreakingChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<BreakingChange> {\n // @ts-expect-error\n return findSchemaChanges(oldSchema, newSchema).filter(\n (change) => change.type in BreakingChangeType,\n );\n}\n\n/**\n * Given two schemas, returns an Array containing descriptions of all the types\n * of potentially dangerous changes covered by the other functions down below.\n * This deprecated wrapper will be removed in v18; use `findSchemaChanges()`\n * instead and filter for dangerous changes.\n * @param oldSchema - Schema before the change.\n * @param newSchema - Schema after the change.\n * @returns Dangerous changes between the two schemas.\n * @example\n * ```ts\n * import { buildSchema, findDangerousChanges } from 'graphql/utilities';\n *\n * const oldSchema = buildSchema(`\n * enum Episode {\n * NEW_HOPE\n * }\n *\n * type Query {\n * episode: Episode\n * }\n * `);\n * const newSchema = buildSchema(`\n * enum Episode {\n * NEW_HOPE\n * EMPIRE\n * }\n *\n * type Query {\n * episode: Episode\n * }\n * `);\n *\n * const changes = findDangerousChanges(oldSchema, newSchema);\n *\n * changes.map((change) => change.type); // => ['VALUE_ADDED_TO_ENUM']\n * ```\n * @deprecated Please use `findSchemaChanges` instead. Will be removed in v18.\n */\nexport function findDangerousChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<DangerousChange> {\n // @ts-expect-error\n return findSchemaChanges(oldSchema, newSchema).filter(\n (change) => change.type in DangerousChangeType,\n );\n}\n\n/**\n * Finds all schema changes between two schemas.\n * @param oldSchema - Schema before the change.\n * @param newSchema - Schema after the change.\n * @returns Safe, dangerous, and breaking changes between the two schemas.\n * @example\n * ```ts\n * import { buildSchema, findSchemaChanges } from 'graphql/utilities';\n *\n * const oldSchema = buildSchema(`\n * type Query {\n * greeting: String\n * }\n * `);\n * const newSchema = buildSchema(`\n * type Query {\n * greeting(name: String): String\n * farewell: String\n * }\n * `);\n *\n * const changes = findSchemaChanges(oldSchema, newSchema);\n *\n * changes.map((change) => change.type); // => ['OPTIONAL_ARG_ADDED', 'FIELD_ADDED']\n * ```\n */\nexport function findSchemaChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<SchemaChange> {\n return [\n ...findTypeChanges(oldSchema, newSchema),\n ...findDirectiveChanges(oldSchema, newSchema),\n ];\n}\n\nfunction findDirectiveChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<SchemaChange> {\n const schemaChanges = [];\n\n const directivesDiff = diff(\n oldSchema.getDirectives(),\n newSchema.getDirectives(),\n );\n\n for (const oldDirective of directivesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_REMOVED,\n description: `Directive ${oldDirective} was removed.`,\n });\n }\n\n for (const newDirective of directivesDiff.added) {\n schemaChanges.push({\n type: SafeChangeType.DIRECTIVE_ADDED,\n description: `Directive @${newDirective.name} was added.`,\n });\n }\n\n for (const [oldDirective, newDirective] of directivesDiff.persisted) {\n const argsDiff = diff(oldDirective.args, newDirective.args);\n\n for (const newArg of argsDiff.added) {\n if (isRequiredArgument(newArg)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED,\n description: `A required argument ${newArg} was added.`,\n });\n } else {\n schemaChanges.push({\n type: SafeChangeType.OPTIONAL_DIRECTIVE_ARG_ADDED,\n description: `An optional argument @${oldDirective.name}(${newArg.name}:) was added.`,\n });\n }\n }\n\n for (const oldArg of argsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_ARG_REMOVED,\n description: `Argument ${oldArg} was removed.`,\n });\n }\n\n for (const [oldArg, newArg] of argsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldArg.type,\n newArg.type,\n );\n\n const oldDefaultValueStr = getDefaultValue(oldArg);\n const newDefaultValueStr = getDefaultValue(newArg);\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description:\n `Argument @${oldDirective.name}(${oldArg.name}:) has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n } else if (oldDefaultValueStr !== undefined) {\n if (newDefaultValueStr === undefined) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `@${oldDirective.name}(${oldArg.name}:) defaultValue was removed.`,\n });\n } else if (oldDefaultValueStr !== newDefaultValueStr) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `@${oldDirective.name}(${oldArg.name}:) has changed defaultValue from ${oldDefaultValueStr} to ${newDefaultValueStr}.`,\n });\n }\n } else if (\n newDefaultValueStr !== undefined &&\n oldDefaultValueStr === undefined\n ) {\n schemaChanges.push({\n type: SafeChangeType.ARG_DEFAULT_VALUE_ADDED,\n description: `@${oldDirective.name}(${oldArg.name}:) added a defaultValue ${newDefaultValueStr}.`,\n });\n } else if (oldArg.type.toString() !== newArg.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.ARG_CHANGED_KIND_SAFE,\n description:\n `Argument @${oldDirective.name}(${oldArg.name}:) has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n }\n\n if (oldArg.description !== newArg.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of @${oldDirective.name}(${oldDirective.name}) has changed to \"${newArg.description}\".`,\n });\n }\n }\n\n if (oldDirective.isRepeatable && !newDirective.isRepeatable) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED,\n description: `Repeatable flag was removed from ${oldDirective}.`,\n });\n } else if (newDirective.isRepeatable && !oldDirective.isRepeatable) {\n schemaChanges.push({\n type: SafeChangeType.DIRECTIVE_REPEATABLE_ADDED,\n description: `Repeatable flag was added to @${oldDirective.name}.`,\n });\n }\n\n if (oldDirective.description !== newDirective.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of @${oldDirective.name} has changed to \"${newDirective.description}\".`,\n });\n }\n\n for (const location of oldDirective.locations) {\n if (!newDirective.locations.includes(location)) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED,\n description: `${location} was removed from ${oldDirective}.`,\n });\n }\n }\n\n for (const location of newDirective.locations) {\n if (!oldDirective.locations.includes(location)) {\n schemaChanges.push({\n type: SafeChangeType.DIRECTIVE_LOCATION_ADDED,\n description: `${location} was added to @${oldDirective.name}.`,\n });\n }\n }\n }\n\n return schemaChanges;\n}\n\nfunction findTypeChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<SchemaChange> {\n const schemaChanges = [];\n\n const typesDiff = diff(\n Object.values(oldSchema.getTypeMap()),\n Object.values(newSchema.getTypeMap()),\n );\n\n for (const oldType of typesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: isSpecifiedScalarType(oldType)\n ? `Standard scalar ${oldType} was removed because it is not referenced anymore.`\n : `${oldType} was removed.`,\n });\n }\n\n for (const newType of typesDiff.added) {\n schemaChanges.push({\n type: SafeChangeType.TYPE_ADDED,\n description: `${newType} was added.`,\n });\n }\n\n for (const [oldType, newType] of typesDiff.persisted) {\n if (oldType.description !== newType.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of ${oldType.name} has changed to \"${newType.description}\".`,\n });\n }\n\n if (isEnumType(oldType) && isEnumType(newType)) {\n schemaChanges.push(...findEnumTypeChanges(oldType, newType));\n } else if (isUnionType(oldType) && isUnionType(newType)) {\n schemaChanges.push(...findUnionTypeChanges(oldType, newType));\n } else if (isInputObjectType(oldType) && isInputObjectType(newType)) {\n schemaChanges.push(...findInputObjectTypeChanges(oldType, newType));\n } else if (isObjectType(oldType) && isObjectType(newType)) {\n schemaChanges.push(\n ...findFieldChanges(oldType, newType),\n ...findImplementedInterfacesChanges(oldType, newType),\n );\n } else if (isInterfaceType(oldType) && isInterfaceType(newType)) {\n schemaChanges.push(\n ...findFieldChanges(oldType, newType),\n ...findImplementedInterfacesChanges(oldType, newType),\n );\n } else if (oldType.constructor !== newType.constructor) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: `${oldType} changed from ${typeKindName(\n oldType,\n )} to ${typeKindName(newType)}.`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findInputObjectTypeChanges(\n oldType: GraphQLInputObjectType,\n newType: GraphQLInputObjectType,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const fieldsDiff = diff(\n Object.values(oldType.getFields()),\n Object.values(newType.getFields()),\n );\n\n for (const newField of fieldsDiff.added) {\n if (isRequiredInputField(newField)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED,\n description: `A required field ${newField} was added.`,\n });\n } else {\n schemaChanges.push({\n type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED,\n description: `An optional field ${newField} was added.`,\n });\n }\n }\n\n for (const oldField of fieldsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_REMOVED,\n description: `Field ${oldField} was removed.`,\n });\n }\n\n for (const [oldField, newField] of fieldsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldField.type,\n newField.type,\n );\n\n const oldDefaultValueStr = getDefaultValue(oldField);\n const newDefaultValueStr = getDefaultValue(newField);\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_CHANGED_KIND,\n description: `Field ${newField} changed type from ${oldField.type} to ${newField.type}.`,\n });\n } else if (oldDefaultValueStr !== undefined) {\n if (newDefaultValueStr === undefined) {\n schemaChanges.push({\n type: DangerousChangeType.INPUT_FIELD_DEFAULT_VALUE_CHANGE,\n description: `${oldField} defaultValue was removed.`,\n });\n } else if (oldDefaultValueStr !== newDefaultValueStr) {\n schemaChanges.push({\n type: DangerousChangeType.INPUT_FIELD_DEFAULT_VALUE_CHANGE,\n description: `${oldField} has changed defaultValue from ${oldDefaultValueStr} to ${newDefaultValueStr}.`,\n });\n }\n } else if (\n newDefaultValueStr !== undefined &&\n oldDefaultValueStr === undefined\n ) {\n schemaChanges.push({\n type: SafeChangeType.INPUT_FIELD_DEFAULT_VALUE_ADDED,\n description: `${oldField} added a defaultValue ${newDefaultValueStr}.`,\n });\n } else if (oldField.type.toString() !== newField.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.FIELD_CHANGED_KIND_SAFE,\n description:\n `Field ${oldType}.${oldField.name} changed type from ` +\n `${String(oldField.type)} to ${String(newField.type)}.`,\n });\n }\n\n if (oldField.description !== newField.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of input-field ${newType}.${newField.name} has changed to \"${newField.description}\".`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findUnionTypeChanges(\n oldType: GraphQLUnionType,\n newType: GraphQLUnionType,\n): Array<BreakingChange | DangerousChange> {\n const schemaChanges = [];\n const possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes());\n\n for (const newPossibleType of possibleTypesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: `${newPossibleType} was added to union type ${oldType}.`,\n });\n }\n\n for (const oldPossibleType of possibleTypesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: `${oldPossibleType} was removed from union type ${oldType}.`,\n });\n }\n\n return schemaChanges;\n}\n\nfunction findEnumTypeChanges(\n oldType: GraphQLEnumType,\n newType: GraphQLEnumType,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const valuesDiff = diff(oldType.getValues(), newType.getValues());\n\n for (const newValue of valuesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: `Enum value ${newValue} was added.`,\n });\n }\n\n for (const oldValue of valuesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: `Enum value ${oldValue} was removed.`,\n });\n }\n\n for (const [oldValue, newValue] of valuesDiff.persisted) {\n if (oldValue.description !== newValue.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of enum value ${oldType}.${oldValue.name} has changed to \"${newValue.description}\".`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findImplementedInterfacesChanges(\n oldType: GraphQLObjectType | GraphQLInterfaceType,\n newType: GraphQLObjectType | GraphQLInterfaceType,\n): Array<BreakingChange | DangerousChange> {\n const schemaChanges = [];\n const interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces());\n\n for (const newInterface of interfacesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED,\n description: `${newInterface} added to interfaces implemented by ${oldType}.`,\n });\n }\n\n for (const oldInterface of interfacesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED,\n description: `${oldType} no longer implements interface ${oldInterface}.`,\n });\n }\n\n return schemaChanges;\n}\n\nfunction findFieldChanges(\n oldType: GraphQLObjectType | GraphQLInterfaceType,\n newType: GraphQLObjectType | GraphQLInterfaceType,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const fieldsDiff = diff(\n Object.values(oldType.getFields()),\n Object.values(newType.getFields()),\n );\n\n for (const oldField of fieldsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_REMOVED,\n description: `Field ${oldField} was removed.`,\n });\n }\n\n for (const newField of fieldsDiff.added) {\n schemaChanges.push({\n type: SafeChangeType.FIELD_ADDED,\n description: `Field ${oldType}.${newField.name} was added.`,\n });\n }\n\n for (const [oldField, newField] of fieldsDiff.persisted) {\n schemaChanges.push(...findArgChanges(oldField, newField));\n\n const isSafe = isChangeSafeForObjectOrInterfaceField(\n oldField.type,\n newField.type,\n );\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_CHANGED_KIND,\n description: `Field ${newField} changed type from ${oldField.type} to ${newField.type}.`,\n });\n } else if (oldField.type.toString() !== newField.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.FIELD_CHANGED_KIND_SAFE,\n description:\n `Field ${oldType}.${oldField.name} changed type from ` +\n `${String(oldField.type)} to ${String(newField.type)}.`,\n });\n }\n\n if (oldField.description !== newField.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of field ${oldType}.${oldField.name} has changed to \"${newField.description}\".`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findArgChanges(\n oldField: GraphQLField<unknown, unknown>,\n newField: GraphQLField<unknown, unknown>,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const argsDiff = diff(oldField.args, newField.args);\n\n for (const oldArg of argsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: `Argument ${oldArg} was removed.`,\n });\n }\n\n for (const [oldArg, newArg] of argsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldArg.type,\n newArg.type,\n );\n\n const oldDefaultValueStr = getDefaultValue(oldArg);\n const newDefaultValueStr = getDefaultValue(newArg);\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: `Argument ${newArg} has changed type from ${oldArg.type} to ${newArg.type}.`,\n });\n } else if (oldDefaultValueStr !== undefined) {\n if (newDefaultValueStr === undefined) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `${oldArg} defaultValue was removed.`,\n });\n } else if (oldDefaultValueStr !== newDefaultValueStr) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `${oldArg} has changed defaultValue from ${oldDefaultValueStr} to ${newDefaultValueStr}.`,\n });\n }\n } else if (\n newDefaultValueStr !== undefined &&\n oldDefaultValueStr === undefined\n ) {\n schemaChanges.push({\n type: SafeChangeType.ARG_DEFAULT_VALUE_ADDED,\n description: `${oldArg} added a defaultValue ${newDefaultValueStr}.`,\n });\n } else if (oldArg.type.toString() !== newArg.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.ARG_CHANGED_KIND_SAFE,\n description:\n `Argument ${oldArg} has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n }\n\n if (oldArg.description !== newArg.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of argument ${oldArg} has changed to \"${newArg.description}\".`,\n });\n }\n }\n\n for (const newArg of argsDiff.added) {\n if (isRequiredArgument(newArg)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_ARG_ADDED,\n description: `A required argument ${newArg} was added.`,\n });\n } else {\n schemaChanges.push({\n type: DangerousChangeType.OPTIONAL_ARG_ADDED,\n description: `An optional argument ${newArg} was added.`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction isChangeSafeForObjectOrInterfaceField(\n oldType: GraphQLType,\n newType: GraphQLType,\n): boolean {\n if (isListType(oldType)) {\n return (\n // if they're both lists, make sure the underlying types are compatible\n (isListType(newType) &&\n isChangeSafeForObjectOrInterfaceField(\n oldType.ofType,\n newType.ofType,\n )) ||\n // moving from nullable to non-null of the same underlying type is safe\n (isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))\n );\n }\n\n if (isNonNullType(oldType)) {\n // if they're both non-null, make sure the underlying types are compatible\n return (\n isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType)\n );\n }\n\n return (\n // if they're both named types, see if their names are equivalent\n (isNamedType(newType) && oldType.name === newType.name) ||\n // moving from nullable to non-null of the same underlying type is safe\n (isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))\n );\n}\n\nfunction isChangeSafeForInputObjectFieldOrFieldArg(\n oldType: GraphQLType,\n newType: GraphQLType,\n): boolean {\n if (isListType(oldType)) {\n // if they're both lists, make sure the underlying types are compatible\n return (\n isListType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType)\n );\n }\n\n if (isNonNullType(oldType)) {\n return (\n // if they're both non-null, make sure the underlying types are\n // compatible\n (isNonNullType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(\n oldType.ofType,\n newType.ofType,\n )) ||\n // moving from non-null to nullable of the same underlying type is safe\n (!isNonNullType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType))\n );\n }\n\n // if they're both named types, see if their names are equivalent\n return isNamedType(newType) && oldType.name === newType.name;\n}\n\nfunction typeKindName(type: GraphQLNamedType): string {\n if (isScalarType(type)) {\n return 'a Scalar type';\n }\n if (isObjectType(type)) {\n return 'an Object type';\n }\n if (isInterfaceType(type)) {\n return 'an Interface type';\n }\n if (isUnionType(type)) {\n return 'a Union type';\n }\n if (isEnumType(type)) {\n return 'an Enum type';\n }\n if (isInputObjectType(type)) {\n return 'an Input type';\n /* node:coverage ignore next 4 */\n }\n // Not reachable, all possible types have been considered.\n invariant(false, 'Unexpected type: ' + inspect(type));\n}\n\n// Since we looking only for client's observable changes we should\n// compare default values in the same representation as they are\n// represented inside introspection.\nfunction getDefaultValue(\n argOrInputField: GraphQLArgument | GraphQLInputField,\n): string | undefined {\n const ast = getDefaultValueAST(argOrInputField);\n if (ast) {\n return print(sortValueNode(ast));\n }\n}\n\nfunction diff<T extends { name: string }>(\n oldArray: ReadonlyArray<T>,\n newArray: ReadonlyArray<T>,\n): {\n added: ReadonlyArray<T>;\n removed: ReadonlyArray<T>;\n persisted: ReadonlyArray<[T, T]>;\n} {\n const added: Array<T> = [];\n const removed: Array<T> = [];\n const persisted: Array<[T, T]> = [];\n\n const oldMap = keyMap(oldArray, ({ name }) => name);\n const newMap = keyMap(newArray, ({ name }) => name);\n\n for (const oldItem of oldArray) {\n const newItem = newMap[oldItem.name];\n if (newItem === undefined) {\n removed.push(oldItem);\n } else {\n persisted.push([oldItem, newItem]);\n }\n }\n\n for (const newItem of newArray) {\n if (oldMap[newItem.name] === undefined) {\n added.push(newItem);\n }\n }\n\n return { added, persisted, removed };\n}\n"]}
|
|
@@ -31,6 +31,7 @@ export const DangerousChangeType = {
|
|
|
31
31
|
OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED',
|
|
32
32
|
IMPLEMENTED_INTERFACE_ADDED: 'IMPLEMENTED_INTERFACE_ADDED',
|
|
33
33
|
ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE',
|
|
34
|
+
INPUT_FIELD_DEFAULT_VALUE_CHANGE: 'INPUT_FIELD_DEFAULT_VALUE_CHANGE',
|
|
34
35
|
};
|
|
35
36
|
export const SafeChangeType = {
|
|
36
37
|
DESCRIPTION_CHANGED: 'DESCRIPTION_CHANGED',
|
|
@@ -45,6 +46,7 @@ export const SafeChangeType = {
|
|
|
45
46
|
FIELD_CHANGED_KIND_SAFE: 'FIELD_CHANGED_KIND_SAFE',
|
|
46
47
|
ARG_CHANGED_KIND_SAFE: 'ARG_CHANGED_KIND_SAFE',
|
|
47
48
|
ARG_DEFAULT_VALUE_ADDED: 'ARG_DEFAULT_VALUE_ADDED',
|
|
49
|
+
INPUT_FIELD_DEFAULT_VALUE_ADDED: 'INPUT_FIELD_DEFAULT_VALUE_ADDED',
|
|
48
50
|
};
|
|
49
51
|
export function findBreakingChanges(oldSchema, newSchema) {
|
|
50
52
|
return findSchemaChanges(oldSchema, newSchema).filter((change) => change.type in BreakingChangeType);
|
|
@@ -251,12 +253,35 @@ function findInputObjectTypeChanges(oldType, newType) {
|
|
|
251
253
|
}
|
|
252
254
|
for (const [oldField, newField] of fieldsDiff.persisted) {
|
|
253
255
|
const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(oldField.type, newField.type);
|
|
256
|
+
const oldDefaultValueStr = getDefaultValue(oldField);
|
|
257
|
+
const newDefaultValueStr = getDefaultValue(newField);
|
|
254
258
|
if (!isSafe) {
|
|
255
259
|
schemaChanges.push({
|
|
256
260
|
type: BreakingChangeType.FIELD_CHANGED_KIND,
|
|
257
261
|
description: `Field ${newField} changed type from ${oldField.type} to ${newField.type}.`,
|
|
258
262
|
});
|
|
259
263
|
}
|
|
264
|
+
else if (oldDefaultValueStr !== undefined) {
|
|
265
|
+
if (newDefaultValueStr === undefined) {
|
|
266
|
+
schemaChanges.push({
|
|
267
|
+
type: DangerousChangeType.INPUT_FIELD_DEFAULT_VALUE_CHANGE,
|
|
268
|
+
description: `${oldField} defaultValue was removed.`,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
else if (oldDefaultValueStr !== newDefaultValueStr) {
|
|
272
|
+
schemaChanges.push({
|
|
273
|
+
type: DangerousChangeType.INPUT_FIELD_DEFAULT_VALUE_CHANGE,
|
|
274
|
+
description: `${oldField} has changed defaultValue from ${oldDefaultValueStr} to ${newDefaultValueStr}.`,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
else if (newDefaultValueStr !== undefined &&
|
|
279
|
+
oldDefaultValueStr === undefined) {
|
|
280
|
+
schemaChanges.push({
|
|
281
|
+
type: SafeChangeType.INPUT_FIELD_DEFAULT_VALUE_ADDED,
|
|
282
|
+
description: `${oldField} added a defaultValue ${newDefaultValueStr}.`,
|
|
283
|
+
});
|
|
284
|
+
}
|
|
260
285
|
else if (oldField.type.toString() !== newField.type.toString()) {
|
|
261
286
|
schemaChanges.push({
|
|
262
287
|
type: SafeChangeType.FIELD_CHANGED_KIND_SAFE,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"findSchemaChanges.js","sourceRoot":"","sources":["../../src/utilities/findSchemaChanges.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,+BAA8B;AAChD,OAAO,EAAE,SAAS,EAAE,iCAAgC;AACpD,OAA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AO,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YACvC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AACvC,CAAC","sourcesContent":["/** @category Schema Changes */\n\nimport { inspect } from '../jsutils/inspect.ts';\nimport { invariant } from '../jsutils/invariant.ts';\nimport { keyMap } from '../jsutils/keyMap.ts';\n\nimport { print } from '../language/printer.ts';\n\nimport type {\n GraphQLArgument,\n GraphQLEnumType,\n GraphQLField,\n GraphQLInputField,\n GraphQLInputObjectType,\n GraphQLInterfaceType,\n GraphQLNamedType,\n GraphQLObjectType,\n GraphQLType,\n GraphQLUnionType,\n} from '../type/definition.ts';\nimport {\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNamedType,\n isNonNullType,\n isObjectType,\n isRequiredArgument,\n isRequiredInputField,\n isScalarType,\n isUnionType,\n} from '../type/definition.ts';\nimport { isSpecifiedScalarType } from '../type/scalars.ts';\nimport type { GraphQLSchema } from '../type/schema.ts';\n\nimport { getDefaultValueAST } from './getDefaultValueAST.ts';\nimport { sortValueNode } from './sortValueNode.ts';\n\n/** Categories of schema changes that may break existing operations. */\nexport const BreakingChangeType = {\n TYPE_REMOVED: 'TYPE_REMOVED' as const,\n TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND' as const,\n TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION' as const,\n VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM' as const,\n REQUIRED_INPUT_FIELD_ADDED: 'REQUIRED_INPUT_FIELD_ADDED' as const,\n IMPLEMENTED_INTERFACE_REMOVED: 'IMPLEMENTED_INTERFACE_REMOVED' as const,\n FIELD_REMOVED: 'FIELD_REMOVED' as const,\n FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND' as const,\n REQUIRED_ARG_ADDED: 'REQUIRED_ARG_ADDED' as const,\n ARG_REMOVED: 'ARG_REMOVED' as const,\n ARG_CHANGED_KIND: 'ARG_CHANGED_KIND' as const,\n DIRECTIVE_REMOVED: 'DIRECTIVE_REMOVED' as const,\n DIRECTIVE_ARG_REMOVED: 'DIRECTIVE_ARG_REMOVED' as const,\n REQUIRED_DIRECTIVE_ARG_ADDED: 'REQUIRED_DIRECTIVE_ARG_ADDED' as const,\n DIRECTIVE_REPEATABLE_REMOVED: 'DIRECTIVE_REPEATABLE_REMOVED' as const,\n DIRECTIVE_LOCATION_REMOVED: 'DIRECTIVE_LOCATION_REMOVED' as const,\n} as const;\n\n/** Categories of schema changes that may break existing operations. */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type BreakingChangeType =\n (typeof BreakingChangeType)[keyof typeof BreakingChangeType];\n\n/** Categories of schema changes that may be dangerous for existing operations. */\nexport const DangerousChangeType = {\n VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM' as const,\n TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION' as const,\n OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED' as const,\n OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED' as const,\n IMPLEMENTED_INTERFACE_ADDED: 'IMPLEMENTED_INTERFACE_ADDED' as const,\n ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE' as const,\n} as const;\n\n/** Categories of schema changes that may be dangerous for existing operations. */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type DangerousChangeType =\n (typeof DangerousChangeType)[keyof typeof DangerousChangeType];\n\n/** Categories of schema changes that are considered safe for existing operations. */\nexport const SafeChangeType = {\n DESCRIPTION_CHANGED: 'DESCRIPTION_CHANGED' as const,\n TYPE_ADDED: 'TYPE_ADDED' as const,\n OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED' as const,\n OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED' as const,\n DIRECTIVE_ADDED: 'DIRECTIVE_ADDED' as const,\n FIELD_ADDED: 'FIELD_ADDED' as const,\n DIRECTIVE_REPEATABLE_ADDED: 'DIRECTIVE_REPEATABLE_ADDED' as const,\n DIRECTIVE_LOCATION_ADDED: 'DIRECTIVE_LOCATION_ADDED' as const,\n OPTIONAL_DIRECTIVE_ARG_ADDED: 'OPTIONAL_DIRECTIVE_ARG_ADDED' as const,\n FIELD_CHANGED_KIND_SAFE: 'FIELD_CHANGED_KIND_SAFE' as const,\n ARG_CHANGED_KIND_SAFE: 'ARG_CHANGED_KIND_SAFE' as const,\n ARG_DEFAULT_VALUE_ADDED: 'ARG_DEFAULT_VALUE_ADDED' as const,\n} as const;\n\n/** Categories of schema changes that are considered safe for existing operations. */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type SafeChangeType =\n (typeof SafeChangeType)[keyof typeof SafeChangeType];\n\n/** Description of a schema change that may break existing operations. */\nexport interface BreakingChange {\n /** Specific kind of breaking schema change. */\n type: BreakingChangeType;\n /** Human-readable description of the breaking schema change. */\n description: string;\n}\n\n/** Description of a schema change that may be dangerous for existing operations. */\nexport interface DangerousChange {\n /** Specific kind of dangerous schema change. */\n type: DangerousChangeType;\n /** Human-readable description of the dangerous schema change. */\n description: string;\n}\n\n/** Description of a schema change that is considered safe for existing operations. */\nexport interface SafeChange {\n /** Specific kind of safe schema change. */\n type: SafeChangeType;\n /** Human-readable description of the safe schema change. */\n description: string;\n}\n\n/** Any schema change detected between two schemas. */\nexport type SchemaChange = SafeChange | DangerousChange | BreakingChange;\n\n/**\n * Given two schemas, returns an Array containing descriptions of all the types\n * of breaking changes covered by the other functions down below. This\n * deprecated wrapper will be removed in v18; use `findSchemaChanges()` instead\n * and filter for breaking changes.\n * @param oldSchema - Schema before the change.\n * @param newSchema - Schema after the change.\n * @returns Breaking changes between the two schemas.\n * @example\n * ```ts\n * import { buildSchema, findBreakingChanges } from 'graphql/utilities';\n *\n * const oldSchema = buildSchema(`\n * type Query {\n * greeting: String\n * }\n * `);\n * const newSchema = buildSchema(`\n * type Query {\n * hello: String\n * }\n * `);\n *\n * const changes = findBreakingChanges(oldSchema, newSchema);\n *\n * changes.map((change) => change.type); // => ['FIELD_REMOVED']\n * ```\n * @deprecated Please use `findSchemaChanges` instead. Will be removed in v18.\n */\nexport function findBreakingChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<BreakingChange> {\n // @ts-expect-error\n return findSchemaChanges(oldSchema, newSchema).filter(\n (change) => change.type in BreakingChangeType,\n );\n}\n\n/**\n * Given two schemas, returns an Array containing descriptions of all the types\n * of potentially dangerous changes covered by the other functions down below.\n * This deprecated wrapper will be removed in v18; use `findSchemaChanges()`\n * instead and filter for dangerous changes.\n * @param oldSchema - Schema before the change.\n * @param newSchema - Schema after the change.\n * @returns Dangerous changes between the two schemas.\n * @example\n * ```ts\n * import { buildSchema, findDangerousChanges } from 'graphql/utilities';\n *\n * const oldSchema = buildSchema(`\n * enum Episode {\n * NEW_HOPE\n * }\n *\n * type Query {\n * episode: Episode\n * }\n * `);\n * const newSchema = buildSchema(`\n * enum Episode {\n * NEW_HOPE\n * EMPIRE\n * }\n *\n * type Query {\n * episode: Episode\n * }\n * `);\n *\n * const changes = findDangerousChanges(oldSchema, newSchema);\n *\n * changes.map((change) => change.type); // => ['VALUE_ADDED_TO_ENUM']\n * ```\n * @deprecated Please use `findSchemaChanges` instead. Will be removed in v18.\n */\nexport function findDangerousChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<DangerousChange> {\n // @ts-expect-error\n return findSchemaChanges(oldSchema, newSchema).filter(\n (change) => change.type in DangerousChangeType,\n );\n}\n\n/**\n * Finds all schema changes between two schemas.\n * @param oldSchema - Schema before the change.\n * @param newSchema - Schema after the change.\n * @returns Safe, dangerous, and breaking changes between the two schemas.\n * @example\n * ```ts\n * import { buildSchema, findSchemaChanges } from 'graphql/utilities';\n *\n * const oldSchema = buildSchema(`\n * type Query {\n * greeting: String\n * }\n * `);\n * const newSchema = buildSchema(`\n * type Query {\n * greeting(name: String): String\n * farewell: String\n * }\n * `);\n *\n * const changes = findSchemaChanges(oldSchema, newSchema);\n *\n * changes.map((change) => change.type); // => ['OPTIONAL_ARG_ADDED', 'FIELD_ADDED']\n * ```\n */\nexport function findSchemaChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<SchemaChange> {\n return [\n ...findTypeChanges(oldSchema, newSchema),\n ...findDirectiveChanges(oldSchema, newSchema),\n ];\n}\n\nfunction findDirectiveChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<SchemaChange> {\n const schemaChanges = [];\n\n const directivesDiff = diff(\n oldSchema.getDirectives(),\n newSchema.getDirectives(),\n );\n\n for (const oldDirective of directivesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_REMOVED,\n description: `Directive ${oldDirective} was removed.`,\n });\n }\n\n for (const newDirective of directivesDiff.added) {\n schemaChanges.push({\n type: SafeChangeType.DIRECTIVE_ADDED,\n description: `Directive @${newDirective.name} was added.`,\n });\n }\n\n for (const [oldDirective, newDirective] of directivesDiff.persisted) {\n const argsDiff = diff(oldDirective.args, newDirective.args);\n\n for (const newArg of argsDiff.added) {\n if (isRequiredArgument(newArg)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED,\n description: `A required argument ${newArg} was added.`,\n });\n } else {\n schemaChanges.push({\n type: SafeChangeType.OPTIONAL_DIRECTIVE_ARG_ADDED,\n description: `An optional argument @${oldDirective.name}(${newArg.name}:) was added.`,\n });\n }\n }\n\n for (const oldArg of argsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_ARG_REMOVED,\n description: `Argument ${oldArg} was removed.`,\n });\n }\n\n for (const [oldArg, newArg] of argsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldArg.type,\n newArg.type,\n );\n\n const oldDefaultValueStr = getDefaultValue(oldArg);\n const newDefaultValueStr = getDefaultValue(newArg);\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description:\n `Argument @${oldDirective.name}(${oldArg.name}:) has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n } else if (oldDefaultValueStr !== undefined) {\n if (newDefaultValueStr === undefined) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `@${oldDirective.name}(${oldArg.name}:) defaultValue was removed.`,\n });\n } else if (oldDefaultValueStr !== newDefaultValueStr) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `@${oldDirective.name}(${oldArg.name}:) has changed defaultValue from ${oldDefaultValueStr} to ${newDefaultValueStr}.`,\n });\n }\n } else if (\n newDefaultValueStr !== undefined &&\n oldDefaultValueStr === undefined\n ) {\n schemaChanges.push({\n type: SafeChangeType.ARG_DEFAULT_VALUE_ADDED,\n description: `@${oldDirective.name}(${oldArg.name}:) added a defaultValue ${newDefaultValueStr}.`,\n });\n } else if (oldArg.type.toString() !== newArg.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.ARG_CHANGED_KIND_SAFE,\n description:\n `Argument @${oldDirective.name}(${oldArg.name}:) has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n }\n\n if (oldArg.description !== newArg.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of @${oldDirective.name}(${oldDirective.name}) has changed to \"${newArg.description}\".`,\n });\n }\n }\n\n if (oldDirective.isRepeatable && !newDirective.isRepeatable) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED,\n description: `Repeatable flag was removed from ${oldDirective}.`,\n });\n } else if (newDirective.isRepeatable && !oldDirective.isRepeatable) {\n schemaChanges.push({\n type: SafeChangeType.DIRECTIVE_REPEATABLE_ADDED,\n description: `Repeatable flag was added to @${oldDirective.name}.`,\n });\n }\n\n if (oldDirective.description !== newDirective.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of @${oldDirective.name} has changed to \"${newDirective.description}\".`,\n });\n }\n\n for (const location of oldDirective.locations) {\n if (!newDirective.locations.includes(location)) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED,\n description: `${location} was removed from ${oldDirective}.`,\n });\n }\n }\n\n for (const location of newDirective.locations) {\n if (!oldDirective.locations.includes(location)) {\n schemaChanges.push({\n type: SafeChangeType.DIRECTIVE_LOCATION_ADDED,\n description: `${location} was added to @${oldDirective.name}.`,\n });\n }\n }\n }\n\n return schemaChanges;\n}\n\nfunction findTypeChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<SchemaChange> {\n const schemaChanges = [];\n\n const typesDiff = diff(\n Object.values(oldSchema.getTypeMap()),\n Object.values(newSchema.getTypeMap()),\n );\n\n for (const oldType of typesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: isSpecifiedScalarType(oldType)\n ? `Standard scalar ${oldType} was removed because it is not referenced anymore.`\n : `${oldType} was removed.`,\n });\n }\n\n for (const newType of typesDiff.added) {\n schemaChanges.push({\n type: SafeChangeType.TYPE_ADDED,\n description: `${newType} was added.`,\n });\n }\n\n for (const [oldType, newType] of typesDiff.persisted) {\n if (oldType.description !== newType.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of ${oldType.name} has changed to \"${newType.description}\".`,\n });\n }\n\n if (isEnumType(oldType) && isEnumType(newType)) {\n schemaChanges.push(...findEnumTypeChanges(oldType, newType));\n } else if (isUnionType(oldType) && isUnionType(newType)) {\n schemaChanges.push(...findUnionTypeChanges(oldType, newType));\n } else if (isInputObjectType(oldType) && isInputObjectType(newType)) {\n schemaChanges.push(...findInputObjectTypeChanges(oldType, newType));\n } else if (isObjectType(oldType) && isObjectType(newType)) {\n schemaChanges.push(\n ...findFieldChanges(oldType, newType),\n ...findImplementedInterfacesChanges(oldType, newType),\n );\n } else if (isInterfaceType(oldType) && isInterfaceType(newType)) {\n schemaChanges.push(\n ...findFieldChanges(oldType, newType),\n ...findImplementedInterfacesChanges(oldType, newType),\n );\n } else if (oldType.constructor !== newType.constructor) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: `${oldType} changed from ${typeKindName(\n oldType,\n )} to ${typeKindName(newType)}.`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findInputObjectTypeChanges(\n oldType: GraphQLInputObjectType,\n newType: GraphQLInputObjectType,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const fieldsDiff = diff(\n Object.values(oldType.getFields()),\n Object.values(newType.getFields()),\n );\n\n for (const newField of fieldsDiff.added) {\n if (isRequiredInputField(newField)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED,\n description: `A required field ${newField} was added.`,\n });\n } else {\n schemaChanges.push({\n type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED,\n description: `An optional field ${newField} was added.`,\n });\n }\n }\n\n for (const oldField of fieldsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_REMOVED,\n description: `Field ${oldField} was removed.`,\n });\n }\n\n for (const [oldField, newField] of fieldsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldField.type,\n newField.type,\n );\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_CHANGED_KIND,\n description: `Field ${newField} changed type from ${oldField.type} to ${newField.type}.`,\n });\n } else if (oldField.type.toString() !== newField.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.FIELD_CHANGED_KIND_SAFE,\n description:\n `Field ${oldType}.${oldField.name} changed type from ` +\n `${String(oldField.type)} to ${String(newField.type)}.`,\n });\n }\n\n if (oldField.description !== newField.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of input-field ${newType}.${newField.name} has changed to \"${newField.description}\".`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findUnionTypeChanges(\n oldType: GraphQLUnionType,\n newType: GraphQLUnionType,\n): Array<BreakingChange | DangerousChange> {\n const schemaChanges = [];\n const possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes());\n\n for (const newPossibleType of possibleTypesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: `${newPossibleType} was added to union type ${oldType}.`,\n });\n }\n\n for (const oldPossibleType of possibleTypesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: `${oldPossibleType} was removed from union type ${oldType}.`,\n });\n }\n\n return schemaChanges;\n}\n\nfunction findEnumTypeChanges(\n oldType: GraphQLEnumType,\n newType: GraphQLEnumType,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const valuesDiff = diff(oldType.getValues(), newType.getValues());\n\n for (const newValue of valuesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: `Enum value ${newValue} was added.`,\n });\n }\n\n for (const oldValue of valuesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: `Enum value ${oldValue} was removed.`,\n });\n }\n\n for (const [oldValue, newValue] of valuesDiff.persisted) {\n if (oldValue.description !== newValue.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of enum value ${oldType}.${oldValue.name} has changed to \"${newValue.description}\".`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findImplementedInterfacesChanges(\n oldType: GraphQLObjectType | GraphQLInterfaceType,\n newType: GraphQLObjectType | GraphQLInterfaceType,\n): Array<BreakingChange | DangerousChange> {\n const schemaChanges = [];\n const interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces());\n\n for (const newInterface of interfacesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED,\n description: `${newInterface} added to interfaces implemented by ${oldType}.`,\n });\n }\n\n for (const oldInterface of interfacesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED,\n description: `${oldType} no longer implements interface ${oldInterface}.`,\n });\n }\n\n return schemaChanges;\n}\n\nfunction findFieldChanges(\n oldType: GraphQLObjectType | GraphQLInterfaceType,\n newType: GraphQLObjectType | GraphQLInterfaceType,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const fieldsDiff = diff(\n Object.values(oldType.getFields()),\n Object.values(newType.getFields()),\n );\n\n for (const oldField of fieldsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_REMOVED,\n description: `Field ${oldField} was removed.`,\n });\n }\n\n for (const newField of fieldsDiff.added) {\n schemaChanges.push({\n type: SafeChangeType.FIELD_ADDED,\n description: `Field ${oldType}.${newField.name} was added.`,\n });\n }\n\n for (const [oldField, newField] of fieldsDiff.persisted) {\n schemaChanges.push(...findArgChanges(oldField, newField));\n\n const isSafe = isChangeSafeForObjectOrInterfaceField(\n oldField.type,\n newField.type,\n );\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_CHANGED_KIND,\n description: `Field ${newField} changed type from ${oldField.type} to ${newField.type}.`,\n });\n } else if (oldField.type.toString() !== newField.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.FIELD_CHANGED_KIND_SAFE,\n description:\n `Field ${oldType}.${oldField.name} changed type from ` +\n `${String(oldField.type)} to ${String(newField.type)}.`,\n });\n }\n\n if (oldField.description !== newField.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of field ${oldType}.${oldField.name} has changed to \"${newField.description}\".`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findArgChanges(\n oldField: GraphQLField<unknown, unknown>,\n newField: GraphQLField<unknown, unknown>,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const argsDiff = diff(oldField.args, newField.args);\n\n for (const oldArg of argsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: `Argument ${oldArg} was removed.`,\n });\n }\n\n for (const [oldArg, newArg] of argsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldArg.type,\n newArg.type,\n );\n\n const oldDefaultValueStr = getDefaultValue(oldArg);\n const newDefaultValueStr = getDefaultValue(newArg);\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: `Argument ${newArg} has changed type from ${oldArg.type} to ${newArg.type}.`,\n });\n } else if (oldDefaultValueStr !== undefined) {\n if (newDefaultValueStr === undefined) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `${oldArg} defaultValue was removed.`,\n });\n } else if (oldDefaultValueStr !== newDefaultValueStr) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `${oldArg} has changed defaultValue from ${oldDefaultValueStr} to ${newDefaultValueStr}.`,\n });\n }\n } else if (\n newDefaultValueStr !== undefined &&\n oldDefaultValueStr === undefined\n ) {\n schemaChanges.push({\n type: SafeChangeType.ARG_DEFAULT_VALUE_ADDED,\n description: `${oldArg} added a defaultValue ${newDefaultValueStr}.`,\n });\n } else if (oldArg.type.toString() !== newArg.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.ARG_CHANGED_KIND_SAFE,\n description:\n `Argument ${oldArg} has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n }\n\n if (oldArg.description !== newArg.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of argument ${oldArg} has changed to \"${newArg.description}\".`,\n });\n }\n }\n\n for (const newArg of argsDiff.added) {\n if (isRequiredArgument(newArg)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_ARG_ADDED,\n description: `A required argument ${newArg} was added.`,\n });\n } else {\n schemaChanges.push({\n type: DangerousChangeType.OPTIONAL_ARG_ADDED,\n description: `An optional argument ${newArg} was added.`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction isChangeSafeForObjectOrInterfaceField(\n oldType: GraphQLType,\n newType: GraphQLType,\n): boolean {\n if (isListType(oldType)) {\n return (\n // if they're both lists, make sure the underlying types are compatible\n (isListType(newType) &&\n isChangeSafeForObjectOrInterfaceField(\n oldType.ofType,\n newType.ofType,\n )) ||\n // moving from nullable to non-null of the same underlying type is safe\n (isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))\n );\n }\n\n if (isNonNullType(oldType)) {\n // if they're both non-null, make sure the underlying types are compatible\n return (\n isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType)\n );\n }\n\n return (\n // if they're both named types, see if their names are equivalent\n (isNamedType(newType) && oldType.name === newType.name) ||\n // moving from nullable to non-null of the same underlying type is safe\n (isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))\n );\n}\n\nfunction isChangeSafeForInputObjectFieldOrFieldArg(\n oldType: GraphQLType,\n newType: GraphQLType,\n): boolean {\n if (isListType(oldType)) {\n // if they're both lists, make sure the underlying types are compatible\n return (\n isListType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType)\n );\n }\n\n if (isNonNullType(oldType)) {\n return (\n // if they're both non-null, make sure the underlying types are\n // compatible\n (isNonNullType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(\n oldType.ofType,\n newType.ofType,\n )) ||\n // moving from non-null to nullable of the same underlying type is safe\n (!isNonNullType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType))\n );\n }\n\n // if they're both named types, see if their names are equivalent\n return isNamedType(newType) && oldType.name === newType.name;\n}\n\nfunction typeKindName(type: GraphQLNamedType): string {\n if (isScalarType(type)) {\n return 'a Scalar type';\n }\n if (isObjectType(type)) {\n return 'an Object type';\n }\n if (isInterfaceType(type)) {\n return 'an Interface type';\n }\n if (isUnionType(type)) {\n return 'a Union type';\n }\n if (isEnumType(type)) {\n return 'an Enum type';\n }\n if (isInputObjectType(type)) {\n return 'an Input type';\n /* node:coverage ignore next 4 */\n }\n // Not reachable, all possible types have been considered.\n invariant(false, 'Unexpected type: ' + inspect(type));\n}\n\n// Since we looking only for client's observable changes we should\n// compare default values in the same representation as they are\n// represented inside introspection.\nfunction getDefaultValue(\n argOrInputField: GraphQLArgument | GraphQLInputField,\n): string | undefined {\n const ast = getDefaultValueAST(argOrInputField);\n if (ast) {\n return print(sortValueNode(ast));\n }\n}\n\nfunction diff<T extends { name: string }>(\n oldArray: ReadonlyArray<T>,\n newArray: ReadonlyArray<T>,\n): {\n added: ReadonlyArray<T>;\n removed: ReadonlyArray<T>;\n persisted: ReadonlyArray<[T, T]>;\n} {\n const added: Array<T> = [];\n const removed: Array<T> = [];\n const persisted: Array<[T, T]> = [];\n\n const oldMap = keyMap(oldArray, ({ name }) => name);\n const newMap = keyMap(newArray, ({ name }) => name);\n\n for (const oldItem of oldArray) {\n const newItem = newMap[oldItem.name];\n if (newItem === undefined) {\n removed.push(oldItem);\n } else {\n persisted.push([oldItem, newItem]);\n }\n }\n\n for (const newItem of newArray) {\n if (oldMap[newItem.name] === undefined) {\n added.push(newItem);\n }\n }\n\n return { added, persisted, removed };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"findSchemaChanges.js","sourceRoot":"","sources":["../../src/utilities/findSchemaChanges.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,+BAA8B;AAChD,OAAO,EAAE,SAAS,EAAE,iCAAgC;AACpD,OAAO,EAAE,MAAM,EAAE,8BAA6B;AAE9C,OAAO,EAAE,KAAK,EAAE,gCAA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;IACnC,CAAC;AACH,CAAC;AAED,SAAS,IAAI,CACX,QAA0B,EAC1B,QAA0B;IAM1B,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,SAAS,GAAkB,EAAE,CAAC;IAEpC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IACpD,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;IAEpD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxB,CAAC;aAAM,CAAC;YACN,SAAS,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;IAED,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;QAC/B,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YACvC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC;AACvC,CAAC","sourcesContent":["/** @category Schema Changes */\n\nimport { inspect } from '../jsutils/inspect.ts';\nimport { invariant } from '../jsutils/invariant.ts';\nimport { keyMap } from '../jsutils/keyMap.ts';\n\nimport { print } from '../language/printer.ts';\n\nimport type {\n GraphQLArgument,\n GraphQLEnumType,\n GraphQLField,\n GraphQLInputField,\n GraphQLInputObjectType,\n GraphQLInterfaceType,\n GraphQLNamedType,\n GraphQLObjectType,\n GraphQLType,\n GraphQLUnionType,\n} from '../type/definition.ts';\nimport {\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNamedType,\n isNonNullType,\n isObjectType,\n isRequiredArgument,\n isRequiredInputField,\n isScalarType,\n isUnionType,\n} from '../type/definition.ts';\nimport { isSpecifiedScalarType } from '../type/scalars.ts';\nimport type { GraphQLSchema } from '../type/schema.ts';\n\nimport { getDefaultValueAST } from './getDefaultValueAST.ts';\nimport { sortValueNode } from './sortValueNode.ts';\n\n/** Categories of schema changes that may break existing operations. */\nexport const BreakingChangeType = {\n TYPE_REMOVED: 'TYPE_REMOVED' as const,\n TYPE_CHANGED_KIND: 'TYPE_CHANGED_KIND' as const,\n TYPE_REMOVED_FROM_UNION: 'TYPE_REMOVED_FROM_UNION' as const,\n VALUE_REMOVED_FROM_ENUM: 'VALUE_REMOVED_FROM_ENUM' as const,\n REQUIRED_INPUT_FIELD_ADDED: 'REQUIRED_INPUT_FIELD_ADDED' as const,\n IMPLEMENTED_INTERFACE_REMOVED: 'IMPLEMENTED_INTERFACE_REMOVED' as const,\n FIELD_REMOVED: 'FIELD_REMOVED' as const,\n FIELD_CHANGED_KIND: 'FIELD_CHANGED_KIND' as const,\n REQUIRED_ARG_ADDED: 'REQUIRED_ARG_ADDED' as const,\n ARG_REMOVED: 'ARG_REMOVED' as const,\n ARG_CHANGED_KIND: 'ARG_CHANGED_KIND' as const,\n DIRECTIVE_REMOVED: 'DIRECTIVE_REMOVED' as const,\n DIRECTIVE_ARG_REMOVED: 'DIRECTIVE_ARG_REMOVED' as const,\n REQUIRED_DIRECTIVE_ARG_ADDED: 'REQUIRED_DIRECTIVE_ARG_ADDED' as const,\n DIRECTIVE_REPEATABLE_REMOVED: 'DIRECTIVE_REPEATABLE_REMOVED' as const,\n DIRECTIVE_LOCATION_REMOVED: 'DIRECTIVE_LOCATION_REMOVED' as const,\n} as const;\n\n/** Categories of schema changes that may break existing operations. */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type BreakingChangeType =\n (typeof BreakingChangeType)[keyof typeof BreakingChangeType];\n\n/** Categories of schema changes that may be dangerous for existing operations. */\nexport const DangerousChangeType = {\n VALUE_ADDED_TO_ENUM: 'VALUE_ADDED_TO_ENUM' as const,\n TYPE_ADDED_TO_UNION: 'TYPE_ADDED_TO_UNION' as const,\n OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED' as const,\n OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED' as const,\n IMPLEMENTED_INTERFACE_ADDED: 'IMPLEMENTED_INTERFACE_ADDED' as const,\n ARG_DEFAULT_VALUE_CHANGE: 'ARG_DEFAULT_VALUE_CHANGE' as const,\n INPUT_FIELD_DEFAULT_VALUE_CHANGE: 'INPUT_FIELD_DEFAULT_VALUE_CHANGE' as const,\n} as const;\n\n/** Categories of schema changes that may be dangerous for existing operations. */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type DangerousChangeType =\n (typeof DangerousChangeType)[keyof typeof DangerousChangeType];\n\n/** Categories of schema changes that are considered safe for existing operations. */\nexport const SafeChangeType = {\n DESCRIPTION_CHANGED: 'DESCRIPTION_CHANGED' as const,\n TYPE_ADDED: 'TYPE_ADDED' as const,\n OPTIONAL_INPUT_FIELD_ADDED: 'OPTIONAL_INPUT_FIELD_ADDED' as const,\n OPTIONAL_ARG_ADDED: 'OPTIONAL_ARG_ADDED' as const,\n DIRECTIVE_ADDED: 'DIRECTIVE_ADDED' as const,\n FIELD_ADDED: 'FIELD_ADDED' as const,\n DIRECTIVE_REPEATABLE_ADDED: 'DIRECTIVE_REPEATABLE_ADDED' as const,\n DIRECTIVE_LOCATION_ADDED: 'DIRECTIVE_LOCATION_ADDED' as const,\n OPTIONAL_DIRECTIVE_ARG_ADDED: 'OPTIONAL_DIRECTIVE_ARG_ADDED' as const,\n FIELD_CHANGED_KIND_SAFE: 'FIELD_CHANGED_KIND_SAFE' as const,\n ARG_CHANGED_KIND_SAFE: 'ARG_CHANGED_KIND_SAFE' as const,\n ARG_DEFAULT_VALUE_ADDED: 'ARG_DEFAULT_VALUE_ADDED' as const,\n INPUT_FIELD_DEFAULT_VALUE_ADDED: 'INPUT_FIELD_DEFAULT_VALUE_ADDED' as const,\n} as const;\n\n/** Categories of schema changes that are considered safe for existing operations. */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\nexport type SafeChangeType =\n (typeof SafeChangeType)[keyof typeof SafeChangeType];\n\n/** Description of a schema change that may break existing operations. */\nexport interface BreakingChange {\n /** Specific kind of breaking schema change. */\n type: BreakingChangeType;\n /** Human-readable description of the breaking schema change. */\n description: string;\n}\n\n/** Description of a schema change that may be dangerous for existing operations. */\nexport interface DangerousChange {\n /** Specific kind of dangerous schema change. */\n type: DangerousChangeType;\n /** Human-readable description of the dangerous schema change. */\n description: string;\n}\n\n/** Description of a schema change that is considered safe for existing operations. */\nexport interface SafeChange {\n /** Specific kind of safe schema change. */\n type: SafeChangeType;\n /** Human-readable description of the safe schema change. */\n description: string;\n}\n\n/** Any schema change detected between two schemas. */\nexport type SchemaChange = SafeChange | DangerousChange | BreakingChange;\n\n/**\n * Given two schemas, returns an Array containing descriptions of all the types\n * of breaking changes covered by the other functions down below. This\n * deprecated wrapper will be removed in v18; use `findSchemaChanges()` instead\n * and filter for breaking changes.\n * @param oldSchema - Schema before the change.\n * @param newSchema - Schema after the change.\n * @returns Breaking changes between the two schemas.\n * @example\n * ```ts\n * import { buildSchema, findBreakingChanges } from 'graphql/utilities';\n *\n * const oldSchema = buildSchema(`\n * type Query {\n * greeting: String\n * }\n * `);\n * const newSchema = buildSchema(`\n * type Query {\n * hello: String\n * }\n * `);\n *\n * const changes = findBreakingChanges(oldSchema, newSchema);\n *\n * changes.map((change) => change.type); // => ['FIELD_REMOVED']\n * ```\n * @deprecated Please use `findSchemaChanges` instead. Will be removed in v18.\n */\nexport function findBreakingChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<BreakingChange> {\n // @ts-expect-error\n return findSchemaChanges(oldSchema, newSchema).filter(\n (change) => change.type in BreakingChangeType,\n );\n}\n\n/**\n * Given two schemas, returns an Array containing descriptions of all the types\n * of potentially dangerous changes covered by the other functions down below.\n * This deprecated wrapper will be removed in v18; use `findSchemaChanges()`\n * instead and filter for dangerous changes.\n * @param oldSchema - Schema before the change.\n * @param newSchema - Schema after the change.\n * @returns Dangerous changes between the two schemas.\n * @example\n * ```ts\n * import { buildSchema, findDangerousChanges } from 'graphql/utilities';\n *\n * const oldSchema = buildSchema(`\n * enum Episode {\n * NEW_HOPE\n * }\n *\n * type Query {\n * episode: Episode\n * }\n * `);\n * const newSchema = buildSchema(`\n * enum Episode {\n * NEW_HOPE\n * EMPIRE\n * }\n *\n * type Query {\n * episode: Episode\n * }\n * `);\n *\n * const changes = findDangerousChanges(oldSchema, newSchema);\n *\n * changes.map((change) => change.type); // => ['VALUE_ADDED_TO_ENUM']\n * ```\n * @deprecated Please use `findSchemaChanges` instead. Will be removed in v18.\n */\nexport function findDangerousChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<DangerousChange> {\n // @ts-expect-error\n return findSchemaChanges(oldSchema, newSchema).filter(\n (change) => change.type in DangerousChangeType,\n );\n}\n\n/**\n * Finds all schema changes between two schemas.\n * @param oldSchema - Schema before the change.\n * @param newSchema - Schema after the change.\n * @returns Safe, dangerous, and breaking changes between the two schemas.\n * @example\n * ```ts\n * import { buildSchema, findSchemaChanges } from 'graphql/utilities';\n *\n * const oldSchema = buildSchema(`\n * type Query {\n * greeting: String\n * }\n * `);\n * const newSchema = buildSchema(`\n * type Query {\n * greeting(name: String): String\n * farewell: String\n * }\n * `);\n *\n * const changes = findSchemaChanges(oldSchema, newSchema);\n *\n * changes.map((change) => change.type); // => ['OPTIONAL_ARG_ADDED', 'FIELD_ADDED']\n * ```\n */\nexport function findSchemaChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<SchemaChange> {\n return [\n ...findTypeChanges(oldSchema, newSchema),\n ...findDirectiveChanges(oldSchema, newSchema),\n ];\n}\n\nfunction findDirectiveChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<SchemaChange> {\n const schemaChanges = [];\n\n const directivesDiff = diff(\n oldSchema.getDirectives(),\n newSchema.getDirectives(),\n );\n\n for (const oldDirective of directivesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_REMOVED,\n description: `Directive ${oldDirective} was removed.`,\n });\n }\n\n for (const newDirective of directivesDiff.added) {\n schemaChanges.push({\n type: SafeChangeType.DIRECTIVE_ADDED,\n description: `Directive @${newDirective.name} was added.`,\n });\n }\n\n for (const [oldDirective, newDirective] of directivesDiff.persisted) {\n const argsDiff = diff(oldDirective.args, newDirective.args);\n\n for (const newArg of argsDiff.added) {\n if (isRequiredArgument(newArg)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_DIRECTIVE_ARG_ADDED,\n description: `A required argument ${newArg} was added.`,\n });\n } else {\n schemaChanges.push({\n type: SafeChangeType.OPTIONAL_DIRECTIVE_ARG_ADDED,\n description: `An optional argument @${oldDirective.name}(${newArg.name}:) was added.`,\n });\n }\n }\n\n for (const oldArg of argsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_ARG_REMOVED,\n description: `Argument ${oldArg} was removed.`,\n });\n }\n\n for (const [oldArg, newArg] of argsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldArg.type,\n newArg.type,\n );\n\n const oldDefaultValueStr = getDefaultValue(oldArg);\n const newDefaultValueStr = getDefaultValue(newArg);\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description:\n `Argument @${oldDirective.name}(${oldArg.name}:) has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n } else if (oldDefaultValueStr !== undefined) {\n if (newDefaultValueStr === undefined) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `@${oldDirective.name}(${oldArg.name}:) defaultValue was removed.`,\n });\n } else if (oldDefaultValueStr !== newDefaultValueStr) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `@${oldDirective.name}(${oldArg.name}:) has changed defaultValue from ${oldDefaultValueStr} to ${newDefaultValueStr}.`,\n });\n }\n } else if (\n newDefaultValueStr !== undefined &&\n oldDefaultValueStr === undefined\n ) {\n schemaChanges.push({\n type: SafeChangeType.ARG_DEFAULT_VALUE_ADDED,\n description: `@${oldDirective.name}(${oldArg.name}:) added a defaultValue ${newDefaultValueStr}.`,\n });\n } else if (oldArg.type.toString() !== newArg.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.ARG_CHANGED_KIND_SAFE,\n description:\n `Argument @${oldDirective.name}(${oldArg.name}:) has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n }\n\n if (oldArg.description !== newArg.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of @${oldDirective.name}(${oldDirective.name}) has changed to \"${newArg.description}\".`,\n });\n }\n }\n\n if (oldDirective.isRepeatable && !newDirective.isRepeatable) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_REPEATABLE_REMOVED,\n description: `Repeatable flag was removed from ${oldDirective}.`,\n });\n } else if (newDirective.isRepeatable && !oldDirective.isRepeatable) {\n schemaChanges.push({\n type: SafeChangeType.DIRECTIVE_REPEATABLE_ADDED,\n description: `Repeatable flag was added to @${oldDirective.name}.`,\n });\n }\n\n if (oldDirective.description !== newDirective.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of @${oldDirective.name} has changed to \"${newDirective.description}\".`,\n });\n }\n\n for (const location of oldDirective.locations) {\n if (!newDirective.locations.includes(location)) {\n schemaChanges.push({\n type: BreakingChangeType.DIRECTIVE_LOCATION_REMOVED,\n description: `${location} was removed from ${oldDirective}.`,\n });\n }\n }\n\n for (const location of newDirective.locations) {\n if (!oldDirective.locations.includes(location)) {\n schemaChanges.push({\n type: SafeChangeType.DIRECTIVE_LOCATION_ADDED,\n description: `${location} was added to @${oldDirective.name}.`,\n });\n }\n }\n }\n\n return schemaChanges;\n}\n\nfunction findTypeChanges(\n oldSchema: GraphQLSchema,\n newSchema: GraphQLSchema,\n): Array<SchemaChange> {\n const schemaChanges = [];\n\n const typesDiff = diff(\n Object.values(oldSchema.getTypeMap()),\n Object.values(newSchema.getTypeMap()),\n );\n\n for (const oldType of typesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_REMOVED,\n description: isSpecifiedScalarType(oldType)\n ? `Standard scalar ${oldType} was removed because it is not referenced anymore.`\n : `${oldType} was removed.`,\n });\n }\n\n for (const newType of typesDiff.added) {\n schemaChanges.push({\n type: SafeChangeType.TYPE_ADDED,\n description: `${newType} was added.`,\n });\n }\n\n for (const [oldType, newType] of typesDiff.persisted) {\n if (oldType.description !== newType.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of ${oldType.name} has changed to \"${newType.description}\".`,\n });\n }\n\n if (isEnumType(oldType) && isEnumType(newType)) {\n schemaChanges.push(...findEnumTypeChanges(oldType, newType));\n } else if (isUnionType(oldType) && isUnionType(newType)) {\n schemaChanges.push(...findUnionTypeChanges(oldType, newType));\n } else if (isInputObjectType(oldType) && isInputObjectType(newType)) {\n schemaChanges.push(...findInputObjectTypeChanges(oldType, newType));\n } else if (isObjectType(oldType) && isObjectType(newType)) {\n schemaChanges.push(\n ...findFieldChanges(oldType, newType),\n ...findImplementedInterfacesChanges(oldType, newType),\n );\n } else if (isInterfaceType(oldType) && isInterfaceType(newType)) {\n schemaChanges.push(\n ...findFieldChanges(oldType, newType),\n ...findImplementedInterfacesChanges(oldType, newType),\n );\n } else if (oldType.constructor !== newType.constructor) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_CHANGED_KIND,\n description: `${oldType} changed from ${typeKindName(\n oldType,\n )} to ${typeKindName(newType)}.`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findInputObjectTypeChanges(\n oldType: GraphQLInputObjectType,\n newType: GraphQLInputObjectType,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const fieldsDiff = diff(\n Object.values(oldType.getFields()),\n Object.values(newType.getFields()),\n );\n\n for (const newField of fieldsDiff.added) {\n if (isRequiredInputField(newField)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_INPUT_FIELD_ADDED,\n description: `A required field ${newField} was added.`,\n });\n } else {\n schemaChanges.push({\n type: DangerousChangeType.OPTIONAL_INPUT_FIELD_ADDED,\n description: `An optional field ${newField} was added.`,\n });\n }\n }\n\n for (const oldField of fieldsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_REMOVED,\n description: `Field ${oldField} was removed.`,\n });\n }\n\n for (const [oldField, newField] of fieldsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldField.type,\n newField.type,\n );\n\n const oldDefaultValueStr = getDefaultValue(oldField);\n const newDefaultValueStr = getDefaultValue(newField);\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_CHANGED_KIND,\n description: `Field ${newField} changed type from ${oldField.type} to ${newField.type}.`,\n });\n } else if (oldDefaultValueStr !== undefined) {\n if (newDefaultValueStr === undefined) {\n schemaChanges.push({\n type: DangerousChangeType.INPUT_FIELD_DEFAULT_VALUE_CHANGE,\n description: `${oldField} defaultValue was removed.`,\n });\n } else if (oldDefaultValueStr !== newDefaultValueStr) {\n schemaChanges.push({\n type: DangerousChangeType.INPUT_FIELD_DEFAULT_VALUE_CHANGE,\n description: `${oldField} has changed defaultValue from ${oldDefaultValueStr} to ${newDefaultValueStr}.`,\n });\n }\n } else if (\n newDefaultValueStr !== undefined &&\n oldDefaultValueStr === undefined\n ) {\n schemaChanges.push({\n type: SafeChangeType.INPUT_FIELD_DEFAULT_VALUE_ADDED,\n description: `${oldField} added a defaultValue ${newDefaultValueStr}.`,\n });\n } else if (oldField.type.toString() !== newField.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.FIELD_CHANGED_KIND_SAFE,\n description:\n `Field ${oldType}.${oldField.name} changed type from ` +\n `${String(oldField.type)} to ${String(newField.type)}.`,\n });\n }\n\n if (oldField.description !== newField.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of input-field ${newType}.${newField.name} has changed to \"${newField.description}\".`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findUnionTypeChanges(\n oldType: GraphQLUnionType,\n newType: GraphQLUnionType,\n): Array<BreakingChange | DangerousChange> {\n const schemaChanges = [];\n const possibleTypesDiff = diff(oldType.getTypes(), newType.getTypes());\n\n for (const newPossibleType of possibleTypesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.TYPE_ADDED_TO_UNION,\n description: `${newPossibleType} was added to union type ${oldType}.`,\n });\n }\n\n for (const oldPossibleType of possibleTypesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.TYPE_REMOVED_FROM_UNION,\n description: `${oldPossibleType} was removed from union type ${oldType}.`,\n });\n }\n\n return schemaChanges;\n}\n\nfunction findEnumTypeChanges(\n oldType: GraphQLEnumType,\n newType: GraphQLEnumType,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const valuesDiff = diff(oldType.getValues(), newType.getValues());\n\n for (const newValue of valuesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.VALUE_ADDED_TO_ENUM,\n description: `Enum value ${newValue} was added.`,\n });\n }\n\n for (const oldValue of valuesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.VALUE_REMOVED_FROM_ENUM,\n description: `Enum value ${oldValue} was removed.`,\n });\n }\n\n for (const [oldValue, newValue] of valuesDiff.persisted) {\n if (oldValue.description !== newValue.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of enum value ${oldType}.${oldValue.name} has changed to \"${newValue.description}\".`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findImplementedInterfacesChanges(\n oldType: GraphQLObjectType | GraphQLInterfaceType,\n newType: GraphQLObjectType | GraphQLInterfaceType,\n): Array<BreakingChange | DangerousChange> {\n const schemaChanges = [];\n const interfacesDiff = diff(oldType.getInterfaces(), newType.getInterfaces());\n\n for (const newInterface of interfacesDiff.added) {\n schemaChanges.push({\n type: DangerousChangeType.IMPLEMENTED_INTERFACE_ADDED,\n description: `${newInterface} added to interfaces implemented by ${oldType}.`,\n });\n }\n\n for (const oldInterface of interfacesDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.IMPLEMENTED_INTERFACE_REMOVED,\n description: `${oldType} no longer implements interface ${oldInterface}.`,\n });\n }\n\n return schemaChanges;\n}\n\nfunction findFieldChanges(\n oldType: GraphQLObjectType | GraphQLInterfaceType,\n newType: GraphQLObjectType | GraphQLInterfaceType,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const fieldsDiff = diff(\n Object.values(oldType.getFields()),\n Object.values(newType.getFields()),\n );\n\n for (const oldField of fieldsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_REMOVED,\n description: `Field ${oldField} was removed.`,\n });\n }\n\n for (const newField of fieldsDiff.added) {\n schemaChanges.push({\n type: SafeChangeType.FIELD_ADDED,\n description: `Field ${oldType}.${newField.name} was added.`,\n });\n }\n\n for (const [oldField, newField] of fieldsDiff.persisted) {\n schemaChanges.push(...findArgChanges(oldField, newField));\n\n const isSafe = isChangeSafeForObjectOrInterfaceField(\n oldField.type,\n newField.type,\n );\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.FIELD_CHANGED_KIND,\n description: `Field ${newField} changed type from ${oldField.type} to ${newField.type}.`,\n });\n } else if (oldField.type.toString() !== newField.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.FIELD_CHANGED_KIND_SAFE,\n description:\n `Field ${oldType}.${oldField.name} changed type from ` +\n `${String(oldField.type)} to ${String(newField.type)}.`,\n });\n }\n\n if (oldField.description !== newField.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of field ${oldType}.${oldField.name} has changed to \"${newField.description}\".`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction findArgChanges(\n oldField: GraphQLField<unknown, unknown>,\n newField: GraphQLField<unknown, unknown>,\n): Array<SchemaChange> {\n const schemaChanges = [];\n const argsDiff = diff(oldField.args, newField.args);\n\n for (const oldArg of argsDiff.removed) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_REMOVED,\n description: `Argument ${oldArg} was removed.`,\n });\n }\n\n for (const [oldArg, newArg] of argsDiff.persisted) {\n const isSafe = isChangeSafeForInputObjectFieldOrFieldArg(\n oldArg.type,\n newArg.type,\n );\n\n const oldDefaultValueStr = getDefaultValue(oldArg);\n const newDefaultValueStr = getDefaultValue(newArg);\n if (!isSafe) {\n schemaChanges.push({\n type: BreakingChangeType.ARG_CHANGED_KIND,\n description: `Argument ${newArg} has changed type from ${oldArg.type} to ${newArg.type}.`,\n });\n } else if (oldDefaultValueStr !== undefined) {\n if (newDefaultValueStr === undefined) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `${oldArg} defaultValue was removed.`,\n });\n } else if (oldDefaultValueStr !== newDefaultValueStr) {\n schemaChanges.push({\n type: DangerousChangeType.ARG_DEFAULT_VALUE_CHANGE,\n description: `${oldArg} has changed defaultValue from ${oldDefaultValueStr} to ${newDefaultValueStr}.`,\n });\n }\n } else if (\n newDefaultValueStr !== undefined &&\n oldDefaultValueStr === undefined\n ) {\n schemaChanges.push({\n type: SafeChangeType.ARG_DEFAULT_VALUE_ADDED,\n description: `${oldArg} added a defaultValue ${newDefaultValueStr}.`,\n });\n } else if (oldArg.type.toString() !== newArg.type.toString()) {\n schemaChanges.push({\n type: SafeChangeType.ARG_CHANGED_KIND_SAFE,\n description:\n `Argument ${oldArg} has changed type from ` +\n `${String(oldArg.type)} to ${String(newArg.type)}.`,\n });\n }\n\n if (oldArg.description !== newArg.description) {\n schemaChanges.push({\n type: SafeChangeType.DESCRIPTION_CHANGED,\n description: `Description of argument ${oldArg} has changed to \"${newArg.description}\".`,\n });\n }\n }\n\n for (const newArg of argsDiff.added) {\n if (isRequiredArgument(newArg)) {\n schemaChanges.push({\n type: BreakingChangeType.REQUIRED_ARG_ADDED,\n description: `A required argument ${newArg} was added.`,\n });\n } else {\n schemaChanges.push({\n type: DangerousChangeType.OPTIONAL_ARG_ADDED,\n description: `An optional argument ${newArg} was added.`,\n });\n }\n }\n\n return schemaChanges;\n}\n\nfunction isChangeSafeForObjectOrInterfaceField(\n oldType: GraphQLType,\n newType: GraphQLType,\n): boolean {\n if (isListType(oldType)) {\n return (\n // if they're both lists, make sure the underlying types are compatible\n (isListType(newType) &&\n isChangeSafeForObjectOrInterfaceField(\n oldType.ofType,\n newType.ofType,\n )) ||\n // moving from nullable to non-null of the same underlying type is safe\n (isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))\n );\n }\n\n if (isNonNullType(oldType)) {\n // if they're both non-null, make sure the underlying types are compatible\n return (\n isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType.ofType, newType.ofType)\n );\n }\n\n return (\n // if they're both named types, see if their names are equivalent\n (isNamedType(newType) && oldType.name === newType.name) ||\n // moving from nullable to non-null of the same underlying type is safe\n (isNonNullType(newType) &&\n isChangeSafeForObjectOrInterfaceField(oldType, newType.ofType))\n );\n}\n\nfunction isChangeSafeForInputObjectFieldOrFieldArg(\n oldType: GraphQLType,\n newType: GraphQLType,\n): boolean {\n if (isListType(oldType)) {\n // if they're both lists, make sure the underlying types are compatible\n return (\n isListType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType.ofType)\n );\n }\n\n if (isNonNullType(oldType)) {\n return (\n // if they're both non-null, make sure the underlying types are\n // compatible\n (isNonNullType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(\n oldType.ofType,\n newType.ofType,\n )) ||\n // moving from non-null to nullable of the same underlying type is safe\n (!isNonNullType(newType) &&\n isChangeSafeForInputObjectFieldOrFieldArg(oldType.ofType, newType))\n );\n }\n\n // if they're both named types, see if their names are equivalent\n return isNamedType(newType) && oldType.name === newType.name;\n}\n\nfunction typeKindName(type: GraphQLNamedType): string {\n if (isScalarType(type)) {\n return 'a Scalar type';\n }\n if (isObjectType(type)) {\n return 'an Object type';\n }\n if (isInterfaceType(type)) {\n return 'an Interface type';\n }\n if (isUnionType(type)) {\n return 'a Union type';\n }\n if (isEnumType(type)) {\n return 'an Enum type';\n }\n if (isInputObjectType(type)) {\n return 'an Input type';\n /* node:coverage ignore next 4 */\n }\n // Not reachable, all possible types have been considered.\n invariant(false, 'Unexpected type: ' + inspect(type));\n}\n\n// Since we looking only for client's observable changes we should\n// compare default values in the same representation as they are\n// represented inside introspection.\nfunction getDefaultValue(\n argOrInputField: GraphQLArgument | GraphQLInputField,\n): string | undefined {\n const ast = getDefaultValueAST(argOrInputField);\n if (ast) {\n return print(sortValueNode(ast));\n }\n}\n\nfunction diff<T extends { name: string }>(\n oldArray: ReadonlyArray<T>,\n newArray: ReadonlyArray<T>,\n): {\n added: ReadonlyArray<T>;\n removed: ReadonlyArray<T>;\n persisted: ReadonlyArray<[T, T]>;\n} {\n const added: Array<T> = [];\n const removed: Array<T> = [];\n const persisted: Array<[T, T]> = [];\n\n const oldMap = keyMap(oldArray, ({ name }) => name);\n const newMap = keyMap(newArray, ({ name }) => name);\n\n for (const oldItem of oldArray) {\n const newItem = newMap[oldItem.name];\n if (newItem === undefined) {\n removed.push(oldItem);\n } else {\n persisted.push([oldItem, newItem]);\n }\n }\n\n for (const newItem of newArray) {\n if (oldMap[newItem.name] === undefined) {\n added.push(newItem);\n }\n }\n\n return { added, persisted, removed };\n}\n"]}
|
|
@@ -130,7 +130,7 @@ function mapSchemaConfig(schemaConfig, configMapperMapFn) {
|
|
|
130
130
|
let mappedField = {
|
|
131
131
|
...field,
|
|
132
132
|
type: getType(field.type),
|
|
133
|
-
args: mapArgs(field.args,
|
|
133
|
+
args: mapArgs(field.args, fieldName, parentTypeName),
|
|
134
134
|
};
|
|
135
135
|
const mapper = configMapperMap[exports.SchemaElementKind.FIELD];
|
|
136
136
|
if (mapper) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapSchemaConfig.js","sourceRoot":"","sources":["../../src/utilities/mapSchemaConfig.ts"],"names":[],"mappings":";;;AAwLA,0CAoRC;AA5cD,sDAAgD;AAChD,0DAAoD;AAmBpD,yDAiB+B;AAE/B,yDAA+E;AAC/E,+DAGkC;AAClC,mDAG4B;AAQf,QAAA,iBAAiB,GAAG;IAC/B,MAAM,EAAE,QAAiB;IACzB,MAAM,EAAE,QAAiB;IACzB,MAAM,EAAE,QAAiB;IACzB,KAAK,EAAE,OAAgB;IACvB,QAAQ,EAAE,UAAmB;IAC7B,SAAS,EAAE,WAAoB;IAC/B,KAAK,EAAE,OAAgB;IACvB,IAAI,EAAE,MAAe;IACrB,UAAU,EAAE,YAAqB;IACjC,YAAY,EAAE,cAAuB;IACrC,WAAW,EAAE,aAAsB;IACnC,SAAS,EAAE,WAAoB;CACvB,CAAC;AAoHX,SAAgB,eAAe,CAC7B,YAA2C,EAC3C,iBAAoE;IAEpE,MAAM,eAAe,GAAG,iBAAiB,CAAC;QACxC,YAAY;QACZ,YAAY;QACZ,aAAa;KACd,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,IAAI,GAAG,EAA4B,CAAC;IAC1D,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;QACtC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC;QAC3B,MAAM,eAAe,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QAC3C,IAAI,eAAe,EA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;QAExC,MAAM,YAAY,GAAG;YACnB,GAAG,MAAM;YACT,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;SACnD,CAAC;QACF,MAAM,MAAM,GAAG,eAAe,CAAC,yBAAiB,CAAC,SAAS,CAAC,CAAC;QAC5D,OAAO,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,IAAI,GAAG,CACxB,CAAC,GAAG,iCAAoB,EAAE,GAAG,qCAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;IAC7D,IAAI,CAAC,IAAI;IACT,IAAI;CACL,CAAC,CACH,CAAC","sourcesContent":["import { inspect } from '../jsutils/inspect.ts';\nimport { invariant } from '../jsutils/invariant.ts';\nimport type { Maybe } from '../jsutils/Maybe.ts';\n\nimport type {\n GraphQLArgumentNormalizedConfig,\n GraphQLEnumTypeNormalizedConfig,\n GraphQLEnumValueConfig,\n GraphQLFieldNormalizedConfig,\n GraphQLFieldNormalizedConfigArgumentMap,\n GraphQLFieldNormalizedConfigMap,\n GraphQLInputFieldConfig,\n GraphQLInputObjectTypeNormalizedConfig,\n GraphQLInterfaceTypeNormalizedConfig,\n GraphQLNamedType,\n GraphQLObjectTypeNormalizedConfig,\n GraphQLScalarTypeNormalizedConfig,\n GraphQLType,\n GraphQLUnionTypeNormalizedConfig,\n} from '../type/definition.ts';\nimport {\n GraphQLEnumType,\n GraphQLInputObjectType,\n GraphQLInterfaceType,\n GraphQLList,\n GraphQLNonNull,\n GraphQLObjectType,\n GraphQLScalarType,\n GraphQLUnionType,\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNonNullType,\n isObjectType,\n isScalarType,\n isUnionType,\n} from '../type/definition.ts';\nimport type { GraphQLDirectiveNormalizedConfig } from '../type/directives.ts';\nimport { GraphQLDirective, isSpecifiedDirective } from '../type/directives.ts';\nimport {\n introspectionTypes,\n isIntrospectionType,\n} from '../type/introspection.ts';\nimport {\n isSpecifiedScalarType,\n specifiedScalarTypes,\n} from '../type/scalars.ts';\nimport type { GraphQLSchemaNormalizedConfig } from '../type/schema.ts';\n\n/**\n * The set of GraphQL Schema Elements.\n *\n * @internal\n */\nexport const SchemaElementKind = {\n SCHEMA: 'SCHEMA' as const,\n SCALAR: 'SCALAR' as const,\n OBJECT: 'OBJECT' as const,\n FIELD: 'FIELD' as const,\n ARGUMENT: 'ARGUMENT' as const,\n INTERFACE: 'INTERFACE' as const,\n UNION: 'UNION' as const,\n ENUM: 'ENUM' as const,\n ENUM_VALUE: 'ENUM_VALUE' as const,\n INPUT_OBJECT: 'INPUT_OBJECT' as const,\n INPUT_FIELD: 'INPUT_FIELD' as const,\n DIRECTIVE: 'DIRECTIVE' as const,\n} as const;\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\ntype SchemaElementKind =\n (typeof SchemaElementKind)[keyof typeof SchemaElementKind];\n\n/** @internal */\nexport interface MappedSchemaContext {\n getNamedType: (typeName: string) => GraphQLNamedType;\n setNamedType: (type: GraphQLNamedType) => void;\n getNamedTypes: () => ReadonlyArray<GraphQLNamedType>;\n}\n\ntype GraphQLScalarTypeMappedConfig = GraphQLScalarTypeNormalizedConfig<\n any,\n any\n>;\n\ntype EnsureThunks<T, ThunkFields extends keyof T> = {\n [K in keyof T]: K extends ThunkFields ? () => T[K] : T[K];\n};\n\ntype GraphQLObjectTypeMappedConfig = EnsureThunks<\n GraphQLObjectTypeNormalizedConfig<any, any>,\n 'interfaces' | 'fields'\n>;\ntype GraphQLInterfaceTypeMappedConfig = EnsureThunks<\n GraphQLInterfaceTypeNormalizedConfig<any, any>,\n 'interfaces' | 'fields'\n>;\ntype GraphQLUnionTypeMappedConfig = EnsureThunks<\n GraphQLUnionTypeNormalizedConfig<any, any>,\n 'types'\n>;\ntype GraphQLEnumTypeMappedConfig = EnsureThunks<\n GraphQLEnumTypeNormalizedConfig,\n 'values'\n>;\ntype GraphQLInputObjectTypeMappedConfig = EnsureThunks<\n GraphQLInputObjectTypeNormalizedConfig,\n 'fields'\n>;\n\ntype ScalarTypeConfigMapper = (\n scalarConfig: GraphQLScalarTypeMappedConfig,\n) => GraphQLScalarTypeMappedConfig;\n\ntype ObjectTypeConfigMapper = (\n objectConfig: GraphQLObjectTypeMappedConfig,\n) => GraphQLObjectTypeMappedConfig;\n\ntype FieldConfigMapper = (\n fieldConfig: GraphQLFieldNormalizedConfig<any, any>,\n parentTypeName: string,\n) => GraphQLFieldNormalizedConfig<any, any>;\n\ntype ArgumentConfigMapper = (\n argConfig: GraphQLArgumentNormalizedConfig,\n fieldOrDirectiveName: string,\n parentTypeName?: string,\n) => GraphQLArgumentNormalizedConfig;\n\ntype InterfaceTypeConfigMapper = (\n interfaceConfig: GraphQLInterfaceTypeMappedConfig,\n) => GraphQLInterfaceTypeMappedConfig;\n\ntype UnionTypeConfigMapper = (\n unionConfig: GraphQLUnionTypeMappedConfig,\n) => GraphQLUnionTypeMappedConfig;\n\ntype EnumTypeConfigMapper = (\n enumConfig: GraphQLEnumTypeMappedConfig,\n) => GraphQLEnumTypeMappedConfig;\n\ntype EnumValueConfigMapper = (\n enumValueConfig: GraphQLEnumValueConfig,\n valueName: string,\n enumName: string,\n) => GraphQLEnumValueConfig;\n\ntype InputObjectTypeConfigMapper = (\n inputObjectConfig: GraphQLInputObjectTypeMappedConfig,\n) => GraphQLInputObjectTypeMappedConfig;\n\ntype InputFieldConfigMapper = (\n inputFieldConfig: GraphQLInputFieldConfig,\n inputFieldName: string,\n inputObjectTypeName: string,\n) => GraphQLInputFieldConfig;\n\ntype DirectiveConfigMapper = (\n directiveConfig: GraphQLDirectiveNormalizedConfig,\n) => GraphQLDirectiveNormalizedConfig;\n\ntype SchemaConfigMapper = (\n originalSchemaConfig: GraphQLSchemaNormalizedConfig,\n) => GraphQLSchemaNormalizedConfig;\n\n/** @internal */\nexport interface ConfigMapperMap {\n [SchemaElementKind.SCALAR]?: ScalarTypeConfigMapper;\n [SchemaElementKind.OBJECT]?: ObjectTypeConfigMapper;\n [SchemaElementKind.FIELD]?: FieldConfigMapper;\n [SchemaElementKind.ARGUMENT]?: ArgumentConfigMapper;\n [SchemaElementKind.INTERFACE]?: InterfaceTypeConfigMapper;\n [SchemaElementKind.UNION]?: UnionTypeConfigMapper;\n [SchemaElementKind.ENUM]?: EnumTypeConfigMapper;\n [SchemaElementKind.ENUM_VALUE]?: EnumValueConfigMapper;\n [SchemaElementKind.INPUT_OBJECT]?: InputObjectTypeConfigMapper;\n [SchemaElementKind.INPUT_FIELD]?: InputFieldConfigMapper;\n [SchemaElementKind.DIRECTIVE]?: DirectiveConfigMapper;\n [SchemaElementKind.SCHEMA]?: SchemaConfigMapper;\n}\n\n/** @internal */\nexport function mapSchemaConfig(\n schemaConfig: GraphQLSchemaNormalizedConfig,\n configMapperMapFn: (context: MappedSchemaContext) => ConfigMapperMap,\n): GraphQLSchemaNormalizedConfig {\n const configMapperMap = configMapperMapFn({\n getNamedType,\n setNamedType,\n getNamedTypes,\n });\n\n const mappedTypeMap = new Map<string, GraphQLNamedType>();\n for (const type of schemaConfig.types) {\n const typeName = type.name;\n const mappedNamedType = mapNamedType(type);\n if (mappedNamedType) {\n mappedTypeMap.set(typeName, mappedNamedType);\n }\n }\n\n const mappedDirectives: Array<GraphQLDirective> = [];\n for (const directive of schemaConfig.directives) {\n if (isSpecifiedDirective(directive)) {\n // Builtin directives cannot be mapped.\n mappedDirectives.push(directive);\n continue;\n }\n\n const mappedDirectiveConfig = mapDirective(directive.toConfig());\n if (mappedDirectiveConfig) {\n mappedDirectives.push(new GraphQLDirective(mappedDirectiveConfig));\n }\n }\n\n const mappedSchemaConfig = {\n ...schemaConfig,\n query:\n schemaConfig.query &&\n (getNamedType(schemaConfig.query.name) as GraphQLObjectType),\n mutation:\n schemaConfig.mutation &&\n (getNamedType(schemaConfig.mutation.name) as GraphQLObjectType),\n subscription:\n schemaConfig.subscription &&\n (getNamedType(schemaConfig.subscription.name) as GraphQLObjectType),\n types: Array.from(mappedTypeMap.values()),\n directives: mappedDirectives,\n };\n\n const schemaMapper = configMapperMap[SchemaElementKind.SCHEMA];\n\n return schemaMapper == null\n ? mappedSchemaConfig\n : schemaMapper(mappedSchemaConfig);\n\n function getType<T extends GraphQLType>(type: T): T {\n if (isListType(type)) {\n return new GraphQLList(getType(type.ofType)) as T;\n }\n if (isNonNullType(type)) {\n return new GraphQLNonNull(getType(type.ofType)) as T;\n }\n\n return getNamedType(type.name) as T;\n }\n\n function getNamedType(typeName: string): GraphQLNamedType {\n const type = stdTypeMap.get(typeName) ?? mappedTypeMap.get(typeName);\n invariant(type !== undefined, `Unknown type: \"${typeName}\".`);\n return type;\n }\n\n function setNamedType(type: GraphQLNamedType): void {\n mappedTypeMap.set(type.name, type);\n }\n\n function getNamedTypes(): ReadonlyArray<GraphQLNamedType> {\n return Array.from(mappedTypeMap.values());\n }\n\n function mapNamedType(type: GraphQLNamedType): Maybe<GraphQLNamedType> {\n if (isIntrospectionType(type) || isSpecifiedScalarType(type)) {\n // Builtin types cannot be mapped.\n return type;\n }\n\n if (isScalarType(type)) {\n return mapScalarType(type);\n }\n if (isObjectType(type)) {\n return mapObjectType(type);\n }\n if (isInterfaceType(type)) {\n return mapInterfaceType(type);\n }\n if (isUnionType(type)) {\n return mapUnionType(type);\n }\n if (isEnumType(type)) {\n return mapEnumType(type);\n }\n if (isInputObjectType(type)) {\n return mapInputObjectType(type);\n /* node:coverage ignore next 4 */\n }\n // Not reachable, all possible type definition nodes have been considered.\n invariant(false, 'Unexpected type: ' + inspect(type));\n }\n\n function mapScalarType(type: GraphQLScalarType): GraphQLScalarType {\n let mappedConfig: Maybe<GraphQLScalarTypeMappedConfig> = type.toConfig();\n const mapper = configMapperMap[SchemaElementKind.SCALAR];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLScalarType(mappedConfig);\n }\n\n function mapObjectType(type: GraphQLObjectType): GraphQLObjectType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLObjectTypeMappedConfig> = {\n ...config,\n interfaces: () =>\n config.interfaces.map(\n (iface) => getNamedType(iface.name) as GraphQLInterfaceType,\n ),\n fields: () => mapFields(config.fields, type.name),\n };\n const mapper = configMapperMap[SchemaElementKind.OBJECT];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLObjectType(mappedConfig);\n }\n\n function mapFields(\n fieldMap: GraphQLFieldNormalizedConfigMap<any, any>,\n parentTypeName: string,\n ): GraphQLFieldNormalizedConfigMap<any, any> {\n const newFieldMap = Object.create(null);\n for (const [fieldName, field] of Object.entries(fieldMap)) {\n let mappedField = {\n ...field,\n type: getType(field.type),\n args: mapArgs(field.args, parentTypeName, fieldName),\n };\n const mapper = configMapperMap[SchemaElementKind.FIELD];\n if (mapper) {\n mappedField = mapper(mappedField, parentTypeName);\n }\n newFieldMap[fieldName] = mappedField;\n }\n return newFieldMap;\n }\n\n function mapArgs(\n argumentMap: GraphQLFieldNormalizedConfigArgumentMap,\n fieldOrDirectiveName: string,\n parentTypeName?: string,\n ): GraphQLFieldNormalizedConfigArgumentMap {\n const newArgumentMap = Object.create(null);\n\n for (const [argName, arg] of Object.entries(argumentMap)) {\n let mappedArg = {\n ...arg,\n type: getType(arg.type),\n };\n const mapper = configMapperMap[SchemaElementKind.ARGUMENT];\n if (mapper) {\n mappedArg = mapper(mappedArg, fieldOrDirectiveName, parentTypeName);\n }\n newArgumentMap[argName] = mappedArg;\n }\n\n return newArgumentMap;\n }\n\n function mapInterfaceType(type: GraphQLInterfaceType): GraphQLInterfaceType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLInterfaceTypeMappedConfig> = {\n ...config,\n interfaces: () =>\n config.interfaces.map(\n (iface) => getNamedType(iface.name) as GraphQLInterfaceType,\n ),\n fields: () => mapFields(config.fields, type.name),\n };\n const mapper = configMapperMap[SchemaElementKind.INTERFACE];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLInterfaceType(mappedConfig);\n }\n\n function mapUnionType(type: GraphQLUnionType): GraphQLUnionType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLUnionTypeMappedConfig> = {\n ...config,\n types: () =>\n config.types.map(\n (memberType) => getNamedType(memberType.name) as GraphQLObjectType,\n ),\n };\n const mapper = configMapperMap[SchemaElementKind.UNION];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLUnionType(mappedConfig);\n }\n\n function mapEnumType(type: GraphQLEnumType): GraphQLEnumType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLEnumTypeMappedConfig> = {\n ...config,\n values: () => {\n const newEnumValues = Object.create(null);\n for (const [valueName, value] of Object.entries(config.values)) {\n const mappedValue = mapEnumValue(value, valueName, type.name);\n newEnumValues[valueName] = mappedValue;\n }\n return newEnumValues;\n },\n };\n const mapper = configMapperMap[SchemaElementKind.ENUM];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLEnumType(mappedConfig);\n }\n\n function mapEnumValue(\n valueConfig: GraphQLEnumValueConfig,\n valueName: string,\n enumName: string,\n ): GraphQLEnumValueConfig {\n const mappedConfig = { ...valueConfig };\n const mapper = configMapperMap[SchemaElementKind.ENUM_VALUE];\n return mapper == null\n ? mappedConfig\n : mapper(mappedConfig, valueName, enumName);\n }\n\n function mapInputObjectType(\n type: GraphQLInputObjectType,\n ): GraphQLInputObjectType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLInputObjectTypeMappedConfig> = {\n ...config,\n fields: () => {\n const newInputFieldMap = Object.create(null);\n for (const [fieldName, field] of Object.entries(config.fields)) {\n const mappedField = mapInputField(field, fieldName, type.name);\n newInputFieldMap[fieldName] = mappedField;\n }\n return newInputFieldMap;\n },\n };\n const mapper = configMapperMap[SchemaElementKind.INPUT_OBJECT];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLInputObjectType(mappedConfig);\n }\n\n function mapInputField(\n inputFieldConfig: GraphQLInputFieldConfig,\n inputFieldName: string,\n inputObjectTypeName: string,\n ): GraphQLInputFieldConfig {\n const mappedConfig = {\n ...inputFieldConfig,\n type: getType(inputFieldConfig.type),\n };\n const mapper = configMapperMap[SchemaElementKind.INPUT_FIELD];\n return mapper == null\n ? mappedConfig\n : mapper(mappedConfig, inputFieldName, inputObjectTypeName);\n }\n\n function mapDirective(\n config: GraphQLDirectiveNormalizedConfig,\n ): Maybe<GraphQLDirectiveNormalizedConfig> {\n const mappedConfig = {\n ...config,\n args: mapArgs(config.args, config.name, undefined),\n };\n const mapper = configMapperMap[SchemaElementKind.DIRECTIVE];\n return mapper == null ? mappedConfig : mapper(mappedConfig);\n }\n}\n\nconst stdTypeMap = new Map(\n [...specifiedScalarTypes, ...introspectionTypes].map((type) => [\n type.name,\n type,\n ]),\n);\n"]}
|
|
1
|
+
{"version":3,"file":"mapSchemaConfig.js","sourceRoot":"","sources":["../../src/utilities/mapSchemaConfig.ts"],"names":[],"mappings":";;;AAwLA,0CAoRC;AA5cD,sDAAgD;AAChD,0DAAoD;AAmBpD,yDAiB+B;AAE/B,yDAA+E;AAC/E,+DAGkC;AAClC,mDAG4B;AAQf,QAAA,iBAAiB,GAAG;IAC/B,MAAM,EAAE,QAAiB;IACzB,MAAM,EAAE,QAAiB;IACzB,MAAM,EAAE,QAAiB;IACzB,KAAK,EAAE,OAAgB;IACvB,QAAQ,EAAE,UAAmB;IAC7B,SAAS,EAAE,WAAoB;IAC/B,KAAK,EAAE,OAAgB;IACvB,IAAI,EAAE,MAAe;IACrB,UAAU,EAAE,YAAqB;IACjC,YAAY,EAAE,cAAuB;IACrC,WAAW,EAAE,aAAsB;IACnC,SAAS,EAAE,WAAoB;CACvB,CAAC;AAoHX,SAAgB,eAAe,CAC7B,YAA2C,EAC3C,iBAA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,GAAG;YACnB,GAAG,gBAAgB;YACnB,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC;SACrC,CAAC;QACF,MAAM,MAAM,GAAG,eAAe,CAAC,yBAAiB,CAAC,WAAW,CAAC,CAAC;QAC9D,OAAO,MAAM,IAAI,IAAI;YACnB,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,EAAE,mBAAmB,CAAC,CAAC;IAChE,CAAC;IAED,SAAS,YAAY,CACnB,MAAwC;QAExC,MAAM,YAAY,GAAG;YACnB,GAAG,MAAM;YACT,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;SACnD,CAAC;QACF,MAAM,MAAM,GAAG,eAAe,CAAC,yBAAiB,CAAC,SAAS,CAAC,CAAC;QAC5D,OAAO,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,IAAI,GAAG,CACxB,CAAC,GAAG,iCAAoB,EAAE,GAAG,qCAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;IAC7D,IAAI,CAAC,IAAI;IACT,IAAI;CACL,CAAC,CACH,CAAC","sourcesContent":["import { inspect } from '../jsutils/inspect.ts';\nimport { invariant } from '../jsutils/invariant.ts';\nimport type { Maybe } from '../jsutils/Maybe.ts';\n\nimport type {\n GraphQLArgumentNormalizedConfig,\n GraphQLEnumTypeNormalizedConfig,\n GraphQLEnumValueConfig,\n GraphQLFieldNormalizedConfig,\n GraphQLFieldNormalizedConfigArgumentMap,\n GraphQLFieldNormalizedConfigMap,\n GraphQLInputFieldConfig,\n GraphQLInputObjectTypeNormalizedConfig,\n GraphQLInterfaceTypeNormalizedConfig,\n GraphQLNamedType,\n GraphQLObjectTypeNormalizedConfig,\n GraphQLScalarTypeNormalizedConfig,\n GraphQLType,\n GraphQLUnionTypeNormalizedConfig,\n} from '../type/definition.ts';\nimport {\n GraphQLEnumType,\n GraphQLInputObjectType,\n GraphQLInterfaceType,\n GraphQLList,\n GraphQLNonNull,\n GraphQLObjectType,\n GraphQLScalarType,\n GraphQLUnionType,\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNonNullType,\n isObjectType,\n isScalarType,\n isUnionType,\n} from '../type/definition.ts';\nimport type { GraphQLDirectiveNormalizedConfig } from '../type/directives.ts';\nimport { GraphQLDirective, isSpecifiedDirective } from '../type/directives.ts';\nimport {\n introspectionTypes,\n isIntrospectionType,\n} from '../type/introspection.ts';\nimport {\n isSpecifiedScalarType,\n specifiedScalarTypes,\n} from '../type/scalars.ts';\nimport type { GraphQLSchemaNormalizedConfig } from '../type/schema.ts';\n\n/**\n * The set of GraphQL Schema Elements.\n *\n * @internal\n */\nexport const SchemaElementKind = {\n SCHEMA: 'SCHEMA' as const,\n SCALAR: 'SCALAR' as const,\n OBJECT: 'OBJECT' as const,\n FIELD: 'FIELD' as const,\n ARGUMENT: 'ARGUMENT' as const,\n INTERFACE: 'INTERFACE' as const,\n UNION: 'UNION' as const,\n ENUM: 'ENUM' as const,\n ENUM_VALUE: 'ENUM_VALUE' as const,\n INPUT_OBJECT: 'INPUT_OBJECT' as const,\n INPUT_FIELD: 'INPUT_FIELD' as const,\n DIRECTIVE: 'DIRECTIVE' as const,\n} as const;\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\ntype SchemaElementKind =\n (typeof SchemaElementKind)[keyof typeof SchemaElementKind];\n\n/** @internal */\nexport interface MappedSchemaContext {\n getNamedType: (typeName: string) => GraphQLNamedType;\n setNamedType: (type: GraphQLNamedType) => void;\n getNamedTypes: () => ReadonlyArray<GraphQLNamedType>;\n}\n\ntype GraphQLScalarTypeMappedConfig = GraphQLScalarTypeNormalizedConfig<\n any,\n any\n>;\n\ntype EnsureThunks<T, ThunkFields extends keyof T> = {\n [K in keyof T]: K extends ThunkFields ? () => T[K] : T[K];\n};\n\ntype GraphQLObjectTypeMappedConfig = EnsureThunks<\n GraphQLObjectTypeNormalizedConfig<any, any>,\n 'interfaces' | 'fields'\n>;\ntype GraphQLInterfaceTypeMappedConfig = EnsureThunks<\n GraphQLInterfaceTypeNormalizedConfig<any, any>,\n 'interfaces' | 'fields'\n>;\ntype GraphQLUnionTypeMappedConfig = EnsureThunks<\n GraphQLUnionTypeNormalizedConfig<any, any>,\n 'types'\n>;\ntype GraphQLEnumTypeMappedConfig = EnsureThunks<\n GraphQLEnumTypeNormalizedConfig,\n 'values'\n>;\ntype GraphQLInputObjectTypeMappedConfig = EnsureThunks<\n GraphQLInputObjectTypeNormalizedConfig,\n 'fields'\n>;\n\ntype ScalarTypeConfigMapper = (\n scalarConfig: GraphQLScalarTypeMappedConfig,\n) => GraphQLScalarTypeMappedConfig;\n\ntype ObjectTypeConfigMapper = (\n objectConfig: GraphQLObjectTypeMappedConfig,\n) => GraphQLObjectTypeMappedConfig;\n\ntype FieldConfigMapper = (\n fieldConfig: GraphQLFieldNormalizedConfig<any, any>,\n parentTypeName: string,\n) => GraphQLFieldNormalizedConfig<any, any>;\n\ntype ArgumentConfigMapper = (\n argConfig: GraphQLArgumentNormalizedConfig,\n fieldOrDirectiveName: string,\n parentTypeName?: string,\n) => GraphQLArgumentNormalizedConfig;\n\ntype InterfaceTypeConfigMapper = (\n interfaceConfig: GraphQLInterfaceTypeMappedConfig,\n) => GraphQLInterfaceTypeMappedConfig;\n\ntype UnionTypeConfigMapper = (\n unionConfig: GraphQLUnionTypeMappedConfig,\n) => GraphQLUnionTypeMappedConfig;\n\ntype EnumTypeConfigMapper = (\n enumConfig: GraphQLEnumTypeMappedConfig,\n) => GraphQLEnumTypeMappedConfig;\n\ntype EnumValueConfigMapper = (\n enumValueConfig: GraphQLEnumValueConfig,\n valueName: string,\n enumName: string,\n) => GraphQLEnumValueConfig;\n\ntype InputObjectTypeConfigMapper = (\n inputObjectConfig: GraphQLInputObjectTypeMappedConfig,\n) => GraphQLInputObjectTypeMappedConfig;\n\ntype InputFieldConfigMapper = (\n inputFieldConfig: GraphQLInputFieldConfig,\n inputFieldName: string,\n inputObjectTypeName: string,\n) => GraphQLInputFieldConfig;\n\ntype DirectiveConfigMapper = (\n directiveConfig: GraphQLDirectiveNormalizedConfig,\n) => GraphQLDirectiveNormalizedConfig;\n\ntype SchemaConfigMapper = (\n originalSchemaConfig: GraphQLSchemaNormalizedConfig,\n) => GraphQLSchemaNormalizedConfig;\n\n/** @internal */\nexport interface ConfigMapperMap {\n [SchemaElementKind.SCALAR]?: ScalarTypeConfigMapper;\n [SchemaElementKind.OBJECT]?: ObjectTypeConfigMapper;\n [SchemaElementKind.FIELD]?: FieldConfigMapper;\n [SchemaElementKind.ARGUMENT]?: ArgumentConfigMapper;\n [SchemaElementKind.INTERFACE]?: InterfaceTypeConfigMapper;\n [SchemaElementKind.UNION]?: UnionTypeConfigMapper;\n [SchemaElementKind.ENUM]?: EnumTypeConfigMapper;\n [SchemaElementKind.ENUM_VALUE]?: EnumValueConfigMapper;\n [SchemaElementKind.INPUT_OBJECT]?: InputObjectTypeConfigMapper;\n [SchemaElementKind.INPUT_FIELD]?: InputFieldConfigMapper;\n [SchemaElementKind.DIRECTIVE]?: DirectiveConfigMapper;\n [SchemaElementKind.SCHEMA]?: SchemaConfigMapper;\n}\n\n/** @internal */\nexport function mapSchemaConfig(\n schemaConfig: GraphQLSchemaNormalizedConfig,\n configMapperMapFn: (context: MappedSchemaContext) => ConfigMapperMap,\n): GraphQLSchemaNormalizedConfig {\n const configMapperMap = configMapperMapFn({\n getNamedType,\n setNamedType,\n getNamedTypes,\n });\n\n const mappedTypeMap = new Map<string, GraphQLNamedType>();\n for (const type of schemaConfig.types) {\n const typeName = type.name;\n const mappedNamedType = mapNamedType(type);\n if (mappedNamedType) {\n mappedTypeMap.set(typeName, mappedNamedType);\n }\n }\n\n const mappedDirectives: Array<GraphQLDirective> = [];\n for (const directive of schemaConfig.directives) {\n if (isSpecifiedDirective(directive)) {\n // Builtin directives cannot be mapped.\n mappedDirectives.push(directive);\n continue;\n }\n\n const mappedDirectiveConfig = mapDirective(directive.toConfig());\n if (mappedDirectiveConfig) {\n mappedDirectives.push(new GraphQLDirective(mappedDirectiveConfig));\n }\n }\n\n const mappedSchemaConfig = {\n ...schemaConfig,\n query:\n schemaConfig.query &&\n (getNamedType(schemaConfig.query.name) as GraphQLObjectType),\n mutation:\n schemaConfig.mutation &&\n (getNamedType(schemaConfig.mutation.name) as GraphQLObjectType),\n subscription:\n schemaConfig.subscription &&\n (getNamedType(schemaConfig.subscription.name) as GraphQLObjectType),\n types: Array.from(mappedTypeMap.values()),\n directives: mappedDirectives,\n };\n\n const schemaMapper = configMapperMap[SchemaElementKind.SCHEMA];\n\n return schemaMapper == null\n ? mappedSchemaConfig\n : schemaMapper(mappedSchemaConfig);\n\n function getType<T extends GraphQLType>(type: T): T {\n if (isListType(type)) {\n return new GraphQLList(getType(type.ofType)) as T;\n }\n if (isNonNullType(type)) {\n return new GraphQLNonNull(getType(type.ofType)) as T;\n }\n\n return getNamedType(type.name) as T;\n }\n\n function getNamedType(typeName: string): GraphQLNamedType {\n const type = stdTypeMap.get(typeName) ?? mappedTypeMap.get(typeName);\n invariant(type !== undefined, `Unknown type: \"${typeName}\".`);\n return type;\n }\n\n function setNamedType(type: GraphQLNamedType): void {\n mappedTypeMap.set(type.name, type);\n }\n\n function getNamedTypes(): ReadonlyArray<GraphQLNamedType> {\n return Array.from(mappedTypeMap.values());\n }\n\n function mapNamedType(type: GraphQLNamedType): Maybe<GraphQLNamedType> {\n if (isIntrospectionType(type) || isSpecifiedScalarType(type)) {\n // Builtin types cannot be mapped.\n return type;\n }\n\n if (isScalarType(type)) {\n return mapScalarType(type);\n }\n if (isObjectType(type)) {\n return mapObjectType(type);\n }\n if (isInterfaceType(type)) {\n return mapInterfaceType(type);\n }\n if (isUnionType(type)) {\n return mapUnionType(type);\n }\n if (isEnumType(type)) {\n return mapEnumType(type);\n }\n if (isInputObjectType(type)) {\n return mapInputObjectType(type);\n /* node:coverage ignore next 4 */\n }\n // Not reachable, all possible type definition nodes have been considered.\n invariant(false, 'Unexpected type: ' + inspect(type));\n }\n\n function mapScalarType(type: GraphQLScalarType): GraphQLScalarType {\n let mappedConfig: Maybe<GraphQLScalarTypeMappedConfig> = type.toConfig();\n const mapper = configMapperMap[SchemaElementKind.SCALAR];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLScalarType(mappedConfig);\n }\n\n function mapObjectType(type: GraphQLObjectType): GraphQLObjectType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLObjectTypeMappedConfig> = {\n ...config,\n interfaces: () =>\n config.interfaces.map(\n (iface) => getNamedType(iface.name) as GraphQLInterfaceType,\n ),\n fields: () => mapFields(config.fields, type.name),\n };\n const mapper = configMapperMap[SchemaElementKind.OBJECT];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLObjectType(mappedConfig);\n }\n\n function mapFields(\n fieldMap: GraphQLFieldNormalizedConfigMap<any, any>,\n parentTypeName: string,\n ): GraphQLFieldNormalizedConfigMap<any, any> {\n const newFieldMap = Object.create(null);\n for (const [fieldName, field] of Object.entries(fieldMap)) {\n let mappedField = {\n ...field,\n type: getType(field.type),\n args: mapArgs(field.args, fieldName, parentTypeName),\n };\n const mapper = configMapperMap[SchemaElementKind.FIELD];\n if (mapper) {\n mappedField = mapper(mappedField, parentTypeName);\n }\n newFieldMap[fieldName] = mappedField;\n }\n return newFieldMap;\n }\n\n function mapArgs(\n argumentMap: GraphQLFieldNormalizedConfigArgumentMap,\n fieldOrDirectiveName: string,\n parentTypeName?: string,\n ): GraphQLFieldNormalizedConfigArgumentMap {\n const newArgumentMap = Object.create(null);\n\n for (const [argName, arg] of Object.entries(argumentMap)) {\n let mappedArg = {\n ...arg,\n type: getType(arg.type),\n };\n const mapper = configMapperMap[SchemaElementKind.ARGUMENT];\n if (mapper) {\n mappedArg = mapper(mappedArg, fieldOrDirectiveName, parentTypeName);\n }\n newArgumentMap[argName] = mappedArg;\n }\n\n return newArgumentMap;\n }\n\n function mapInterfaceType(type: GraphQLInterfaceType): GraphQLInterfaceType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLInterfaceTypeMappedConfig> = {\n ...config,\n interfaces: () =>\n config.interfaces.map(\n (iface) => getNamedType(iface.name) as GraphQLInterfaceType,\n ),\n fields: () => mapFields(config.fields, type.name),\n };\n const mapper = configMapperMap[SchemaElementKind.INTERFACE];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLInterfaceType(mappedConfig);\n }\n\n function mapUnionType(type: GraphQLUnionType): GraphQLUnionType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLUnionTypeMappedConfig> = {\n ...config,\n types: () =>\n config.types.map(\n (memberType) => getNamedType(memberType.name) as GraphQLObjectType,\n ),\n };\n const mapper = configMapperMap[SchemaElementKind.UNION];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLUnionType(mappedConfig);\n }\n\n function mapEnumType(type: GraphQLEnumType): GraphQLEnumType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLEnumTypeMappedConfig> = {\n ...config,\n values: () => {\n const newEnumValues = Object.create(null);\n for (const [valueName, value] of Object.entries(config.values)) {\n const mappedValue = mapEnumValue(value, valueName, type.name);\n newEnumValues[valueName] = mappedValue;\n }\n return newEnumValues;\n },\n };\n const mapper = configMapperMap[SchemaElementKind.ENUM];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLEnumType(mappedConfig);\n }\n\n function mapEnumValue(\n valueConfig: GraphQLEnumValueConfig,\n valueName: string,\n enumName: string,\n ): GraphQLEnumValueConfig {\n const mappedConfig = { ...valueConfig };\n const mapper = configMapperMap[SchemaElementKind.ENUM_VALUE];\n return mapper == null\n ? mappedConfig\n : mapper(mappedConfig, valueName, enumName);\n }\n\n function mapInputObjectType(\n type: GraphQLInputObjectType,\n ): GraphQLInputObjectType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLInputObjectTypeMappedConfig> = {\n ...config,\n fields: () => {\n const newInputFieldMap = Object.create(null);\n for (const [fieldName, field] of Object.entries(config.fields)) {\n const mappedField = mapInputField(field, fieldName, type.name);\n newInputFieldMap[fieldName] = mappedField;\n }\n return newInputFieldMap;\n },\n };\n const mapper = configMapperMap[SchemaElementKind.INPUT_OBJECT];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLInputObjectType(mappedConfig);\n }\n\n function mapInputField(\n inputFieldConfig: GraphQLInputFieldConfig,\n inputFieldName: string,\n inputObjectTypeName: string,\n ): GraphQLInputFieldConfig {\n const mappedConfig = {\n ...inputFieldConfig,\n type: getType(inputFieldConfig.type),\n };\n const mapper = configMapperMap[SchemaElementKind.INPUT_FIELD];\n return mapper == null\n ? mappedConfig\n : mapper(mappedConfig, inputFieldName, inputObjectTypeName);\n }\n\n function mapDirective(\n config: GraphQLDirectiveNormalizedConfig,\n ): Maybe<GraphQLDirectiveNormalizedConfig> {\n const mappedConfig = {\n ...config,\n args: mapArgs(config.args, config.name, undefined),\n };\n const mapper = configMapperMap[SchemaElementKind.DIRECTIVE];\n return mapper == null ? mappedConfig : mapper(mappedConfig);\n }\n}\n\nconst stdTypeMap = new Map(\n [...specifiedScalarTypes, ...introspectionTypes].map((type) => [\n type.name,\n type,\n ]),\n);\n"]}
|
|
@@ -126,7 +126,7 @@ export function mapSchemaConfig(schemaConfig, configMapperMapFn) {
|
|
|
126
126
|
let mappedField = {
|
|
127
127
|
...field,
|
|
128
128
|
type: getType(field.type),
|
|
129
|
-
args: mapArgs(field.args,
|
|
129
|
+
args: mapArgs(field.args, fieldName, parentTypeName),
|
|
130
130
|
};
|
|
131
131
|
const mapper = configMapperMap[SchemaElementKind.FIELD];
|
|
132
132
|
if (mapper) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mapSchemaConfig.js","sourceRoot":"","sources":["../../src/utilities/mapSchemaConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+BAA8B;AAChD,OAAO,EAAE,SAAS,EAAE,iCAAgC;AAmBpD,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,+BAA8B;AAE/B,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,+BAA8B;AAC/E,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,kCAAiC;AAClC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,4BAA2B;AAQ5B,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,MAAM,EAAE,QAAiB;IACzB,MAAM,EAAE,QAAiB;IACzB,MAAM,EAAE,QAAiB;IACzB,KAAK,EAAE,OAAgB;IACvB,QAAQ,EAAE,UAAmB;IAC7B,SAAS,EAAE,WAAoB;IAC/B,KAAK,EAAE,OAAgB;IACvB,IAAI,EAAE,MAAe;IACrB,UAAU,EAAE,YAAqB;IACjC,YAAY,EAAE,cAAuB;IACrC,WAAW,EAAE,aAAsB;IACnC,SAAS,EAAE,WAAoB;CACvB,CAAC;AAoHX,MAAM,UAAU,eAAe,CAC7B,YAA2C,EAC3C,iBAAoE;IAEpE,MAAM,eAAe,GAAG,iBAAiB,CAAC;QACxC,YAAY;QACZ,YAAY;QACZ,aAAa;KACd,CAAC,CAAC;IAEH,MAAM,aAAa,GAAG,IAAI,GAAG,EAA4B,CAAC;IAC1D,KAAK,MAAM,IAAI,IAAI,YAAY,CAAC,KAAK,EAAE,CAAC;QACtC,MAAM,QAAQ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,CACnB,MAAwC;QAExC,MAAM,YAAY,GAAG;YACnB,GAAG,MAAM;YACT,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;SACnD,CAAC;QACF,MAAM,MAAM,GAAG,eAAe,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAC5D,OAAO,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,IAAI,GAAG,CACxB,CAAC,GAAG,oBAAoB,EAAE,GAAG,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;IAC7D,IAAI,CAAC,IAAI;IACT,IAAI;CACL,CAAC,CACH,CAAC","sourcesContent":["import { inspect } from '../jsutils/inspect.ts';\nimport { invariant } from '../jsutils/invariant.ts';\nimport type { Maybe } from '../jsutils/Maybe.ts';\n\nimport type {\n GraphQLArgumentNormalizedConfig,\n GraphQLEnumTypeNormalizedConfig,\n GraphQLEnumValueConfig,\n GraphQLFieldNormalizedConfig,\n GraphQLFieldNormalizedConfigArgumentMap,\n GraphQLFieldNormalizedConfigMap,\n GraphQLInputFieldConfig,\n GraphQLInputObjectTypeNormalizedConfig,\n GraphQLInterfaceTypeNormalizedConfig,\n GraphQLNamedType,\n GraphQLObjectTypeNormalizedConfig,\n GraphQLScalarTypeNormalizedConfig,\n GraphQLType,\n GraphQLUnionTypeNormalizedConfig,\n} from '../type/definition.ts';\nimport {\n GraphQLEnumType,\n GraphQLInputObjectType,\n GraphQLInterfaceType,\n GraphQLList,\n GraphQLNonNull,\n GraphQLObjectType,\n GraphQLScalarType,\n GraphQLUnionType,\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNonNullType,\n isObjectType,\n isScalarType,\n isUnionType,\n} from '../type/definition.ts';\nimport type { GraphQLDirectiveNormalizedConfig } from '../type/directives.ts';\nimport { GraphQLDirective, isSpecifiedDirective } from '../type/directives.ts';\nimport {\n introspectionTypes,\n isIntrospectionType,\n} from '../type/introspection.ts';\nimport {\n isSpecifiedScalarType,\n specifiedScalarTypes,\n} from '../type/scalars.ts';\nimport type { GraphQLSchemaNormalizedConfig } from '../type/schema.ts';\n\n/**\n * The set of GraphQL Schema Elements.\n *\n * @internal\n */\nexport const SchemaElementKind = {\n SCHEMA: 'SCHEMA' as const,\n SCALAR: 'SCALAR' as const,\n OBJECT: 'OBJECT' as const,\n FIELD: 'FIELD' as const,\n ARGUMENT: 'ARGUMENT' as const,\n INTERFACE: 'INTERFACE' as const,\n UNION: 'UNION' as const,\n ENUM: 'ENUM' as const,\n ENUM_VALUE: 'ENUM_VALUE' as const,\n INPUT_OBJECT: 'INPUT_OBJECT' as const,\n INPUT_FIELD: 'INPUT_FIELD' as const,\n DIRECTIVE: 'DIRECTIVE' as const,\n} as const;\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\ntype SchemaElementKind =\n (typeof SchemaElementKind)[keyof typeof SchemaElementKind];\n\n/** @internal */\nexport interface MappedSchemaContext {\n getNamedType: (typeName: string) => GraphQLNamedType;\n setNamedType: (type: GraphQLNamedType) => void;\n getNamedTypes: () => ReadonlyArray<GraphQLNamedType>;\n}\n\ntype GraphQLScalarTypeMappedConfig = GraphQLScalarTypeNormalizedConfig<\n any,\n any\n>;\n\ntype EnsureThunks<T, ThunkFields extends keyof T> = {\n [K in keyof T]: K extends ThunkFields ? () => T[K] : T[K];\n};\n\ntype GraphQLObjectTypeMappedConfig = EnsureThunks<\n GraphQLObjectTypeNormalizedConfig<any, any>,\n 'interfaces' | 'fields'\n>;\ntype GraphQLInterfaceTypeMappedConfig = EnsureThunks<\n GraphQLInterfaceTypeNormalizedConfig<any, any>,\n 'interfaces' | 'fields'\n>;\ntype GraphQLUnionTypeMappedConfig = EnsureThunks<\n GraphQLUnionTypeNormalizedConfig<any, any>,\n 'types'\n>;\ntype GraphQLEnumTypeMappedConfig = EnsureThunks<\n GraphQLEnumTypeNormalizedConfig,\n 'values'\n>;\ntype GraphQLInputObjectTypeMappedConfig = EnsureThunks<\n GraphQLInputObjectTypeNormalizedConfig,\n 'fields'\n>;\n\ntype ScalarTypeConfigMapper = (\n scalarConfig: GraphQLScalarTypeMappedConfig,\n) => GraphQLScalarTypeMappedConfig;\n\ntype ObjectTypeConfigMapper = (\n objectConfig: GraphQLObjectTypeMappedConfig,\n) => GraphQLObjectTypeMappedConfig;\n\ntype FieldConfigMapper = (\n fieldConfig: GraphQLFieldNormalizedConfig<any, any>,\n parentTypeName: string,\n) => GraphQLFieldNormalizedConfig<any, any>;\n\ntype ArgumentConfigMapper = (\n argConfig: GraphQLArgumentNormalizedConfig,\n fieldOrDirectiveName: string,\n parentTypeName?: string,\n) => GraphQLArgumentNormalizedConfig;\n\ntype InterfaceTypeConfigMapper = (\n interfaceConfig: GraphQLInterfaceTypeMappedConfig,\n) => GraphQLInterfaceTypeMappedConfig;\n\ntype UnionTypeConfigMapper = (\n unionConfig: GraphQLUnionTypeMappedConfig,\n) => GraphQLUnionTypeMappedConfig;\n\ntype EnumTypeConfigMapper = (\n enumConfig: GraphQLEnumTypeMappedConfig,\n) => GraphQLEnumTypeMappedConfig;\n\ntype EnumValueConfigMapper = (\n enumValueConfig: GraphQLEnumValueConfig,\n valueName: string,\n enumName: string,\n) => GraphQLEnumValueConfig;\n\ntype InputObjectTypeConfigMapper = (\n inputObjectConfig: GraphQLInputObjectTypeMappedConfig,\n) => GraphQLInputObjectTypeMappedConfig;\n\ntype InputFieldConfigMapper = (\n inputFieldConfig: GraphQLInputFieldConfig,\n inputFieldName: string,\n inputObjectTypeName: string,\n) => GraphQLInputFieldConfig;\n\ntype DirectiveConfigMapper = (\n directiveConfig: GraphQLDirectiveNormalizedConfig,\n) => GraphQLDirectiveNormalizedConfig;\n\ntype SchemaConfigMapper = (\n originalSchemaConfig: GraphQLSchemaNormalizedConfig,\n) => GraphQLSchemaNormalizedConfig;\n\n/** @internal */\nexport interface ConfigMapperMap {\n [SchemaElementKind.SCALAR]?: ScalarTypeConfigMapper;\n [SchemaElementKind.OBJECT]?: ObjectTypeConfigMapper;\n [SchemaElementKind.FIELD]?: FieldConfigMapper;\n [SchemaElementKind.ARGUMENT]?: ArgumentConfigMapper;\n [SchemaElementKind.INTERFACE]?: InterfaceTypeConfigMapper;\n [SchemaElementKind.UNION]?: UnionTypeConfigMapper;\n [SchemaElementKind.ENUM]?: EnumTypeConfigMapper;\n [SchemaElementKind.ENUM_VALUE]?: EnumValueConfigMapper;\n [SchemaElementKind.INPUT_OBJECT]?: InputObjectTypeConfigMapper;\n [SchemaElementKind.INPUT_FIELD]?: InputFieldConfigMapper;\n [SchemaElementKind.DIRECTIVE]?: DirectiveConfigMapper;\n [SchemaElementKind.SCHEMA]?: SchemaConfigMapper;\n}\n\n/** @internal */\nexport function mapSchemaConfig(\n schemaConfig: GraphQLSchemaNormalizedConfig,\n configMapperMapFn: (context: MappedSchemaContext) => ConfigMapperMap,\n): GraphQLSchemaNormalizedConfig {\n const configMapperMap = configMapperMapFn({\n getNamedType,\n setNamedType,\n getNamedTypes,\n });\n\n const mappedTypeMap = new Map<string, GraphQLNamedType>();\n for (const type of schemaConfig.types) {\n const typeName = type.name;\n const mappedNamedType = mapNamedType(type);\n if (mappedNamedType) {\n mappedTypeMap.set(typeName, mappedNamedType);\n }\n }\n\n const mappedDirectives: Array<GraphQLDirective> = [];\n for (const directive of schemaConfig.directives) {\n if (isSpecifiedDirective(directive)) {\n // Builtin directives cannot be mapped.\n mappedDirectives.push(directive);\n continue;\n }\n\n const mappedDirectiveConfig = mapDirective(directive.toConfig());\n if (mappedDirectiveConfig) {\n mappedDirectives.push(new GraphQLDirective(mappedDirectiveConfig));\n }\n }\n\n const mappedSchemaConfig = {\n ...schemaConfig,\n query:\n schemaConfig.query &&\n (getNamedType(schemaConfig.query.name) as GraphQLObjectType),\n mutation:\n schemaConfig.mutation &&\n (getNamedType(schemaConfig.mutation.name) as GraphQLObjectType),\n subscription:\n schemaConfig.subscription &&\n (getNamedType(schemaConfig.subscription.name) as GraphQLObjectType),\n types: Array.from(mappedTypeMap.values()),\n directives: mappedDirectives,\n };\n\n const schemaMapper = configMapperMap[SchemaElementKind.SCHEMA];\n\n return schemaMapper == null\n ? mappedSchemaConfig\n : schemaMapper(mappedSchemaConfig);\n\n function getType<T extends GraphQLType>(type: T): T {\n if (isListType(type)) {\n return new GraphQLList(getType(type.ofType)) as T;\n }\n if (isNonNullType(type)) {\n return new GraphQLNonNull(getType(type.ofType)) as T;\n }\n\n return getNamedType(type.name) as T;\n }\n\n function getNamedType(typeName: string): GraphQLNamedType {\n const type = stdTypeMap.get(typeName) ?? mappedTypeMap.get(typeName);\n invariant(type !== undefined, `Unknown type: \"${typeName}\".`);\n return type;\n }\n\n function setNamedType(type: GraphQLNamedType): void {\n mappedTypeMap.set(type.name, type);\n }\n\n function getNamedTypes(): ReadonlyArray<GraphQLNamedType> {\n return Array.from(mappedTypeMap.values());\n }\n\n function mapNamedType(type: GraphQLNamedType): Maybe<GraphQLNamedType> {\n if (isIntrospectionType(type) || isSpecifiedScalarType(type)) {\n // Builtin types cannot be mapped.\n return type;\n }\n\n if (isScalarType(type)) {\n return mapScalarType(type);\n }\n if (isObjectType(type)) {\n return mapObjectType(type);\n }\n if (isInterfaceType(type)) {\n return mapInterfaceType(type);\n }\n if (isUnionType(type)) {\n return mapUnionType(type);\n }\n if (isEnumType(type)) {\n return mapEnumType(type);\n }\n if (isInputObjectType(type)) {\n return mapInputObjectType(type);\n /* node:coverage ignore next 4 */\n }\n // Not reachable, all possible type definition nodes have been considered.\n invariant(false, 'Unexpected type: ' + inspect(type));\n }\n\n function mapScalarType(type: GraphQLScalarType): GraphQLScalarType {\n let mappedConfig: Maybe<GraphQLScalarTypeMappedConfig> = type.toConfig();\n const mapper = configMapperMap[SchemaElementKind.SCALAR];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLScalarType(mappedConfig);\n }\n\n function mapObjectType(type: GraphQLObjectType): GraphQLObjectType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLObjectTypeMappedConfig> = {\n ...config,\n interfaces: () =>\n config.interfaces.map(\n (iface) => getNamedType(iface.name) as GraphQLInterfaceType,\n ),\n fields: () => mapFields(config.fields, type.name),\n };\n const mapper = configMapperMap[SchemaElementKind.OBJECT];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLObjectType(mappedConfig);\n }\n\n function mapFields(\n fieldMap: GraphQLFieldNormalizedConfigMap<any, any>,\n parentTypeName: string,\n ): GraphQLFieldNormalizedConfigMap<any, any> {\n const newFieldMap = Object.create(null);\n for (const [fieldName, field] of Object.entries(fieldMap)) {\n let mappedField = {\n ...field,\n type: getType(field.type),\n args: mapArgs(field.args, parentTypeName, fieldName),\n };\n const mapper = configMapperMap[SchemaElementKind.FIELD];\n if (mapper) {\n mappedField = mapper(mappedField, parentTypeName);\n }\n newFieldMap[fieldName] = mappedField;\n }\n return newFieldMap;\n }\n\n function mapArgs(\n argumentMap: GraphQLFieldNormalizedConfigArgumentMap,\n fieldOrDirectiveName: string,\n parentTypeName?: string,\n ): GraphQLFieldNormalizedConfigArgumentMap {\n const newArgumentMap = Object.create(null);\n\n for (const [argName, arg] of Object.entries(argumentMap)) {\n let mappedArg = {\n ...arg,\n type: getType(arg.type),\n };\n const mapper = configMapperMap[SchemaElementKind.ARGUMENT];\n if (mapper) {\n mappedArg = mapper(mappedArg, fieldOrDirectiveName, parentTypeName);\n }\n newArgumentMap[argName] = mappedArg;\n }\n\n return newArgumentMap;\n }\n\n function mapInterfaceType(type: GraphQLInterfaceType): GraphQLInterfaceType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLInterfaceTypeMappedConfig> = {\n ...config,\n interfaces: () =>\n config.interfaces.map(\n (iface) => getNamedType(iface.name) as GraphQLInterfaceType,\n ),\n fields: () => mapFields(config.fields, type.name),\n };\n const mapper = configMapperMap[SchemaElementKind.INTERFACE];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLInterfaceType(mappedConfig);\n }\n\n function mapUnionType(type: GraphQLUnionType): GraphQLUnionType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLUnionTypeMappedConfig> = {\n ...config,\n types: () =>\n config.types.map(\n (memberType) => getNamedType(memberType.name) as GraphQLObjectType,\n ),\n };\n const mapper = configMapperMap[SchemaElementKind.UNION];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLUnionType(mappedConfig);\n }\n\n function mapEnumType(type: GraphQLEnumType): GraphQLEnumType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLEnumTypeMappedConfig> = {\n ...config,\n values: () => {\n const newEnumValues = Object.create(null);\n for (const [valueName, value] of Object.entries(config.values)) {\n const mappedValue = mapEnumValue(value, valueName, type.name);\n newEnumValues[valueName] = mappedValue;\n }\n return newEnumValues;\n },\n };\n const mapper = configMapperMap[SchemaElementKind.ENUM];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLEnumType(mappedConfig);\n }\n\n function mapEnumValue(\n valueConfig: GraphQLEnumValueConfig,\n valueName: string,\n enumName: string,\n ): GraphQLEnumValueConfig {\n const mappedConfig = { ...valueConfig };\n const mapper = configMapperMap[SchemaElementKind.ENUM_VALUE];\n return mapper == null\n ? mappedConfig\n : mapper(mappedConfig, valueName, enumName);\n }\n\n function mapInputObjectType(\n type: GraphQLInputObjectType,\n ): GraphQLInputObjectType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLInputObjectTypeMappedConfig> = {\n ...config,\n fields: () => {\n const newInputFieldMap = Object.create(null);\n for (const [fieldName, field] of Object.entries(config.fields)) {\n const mappedField = mapInputField(field, fieldName, type.name);\n newInputFieldMap[fieldName] = mappedField;\n }\n return newInputFieldMap;\n },\n };\n const mapper = configMapperMap[SchemaElementKind.INPUT_OBJECT];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLInputObjectType(mappedConfig);\n }\n\n function mapInputField(\n inputFieldConfig: GraphQLInputFieldConfig,\n inputFieldName: string,\n inputObjectTypeName: string,\n ): GraphQLInputFieldConfig {\n const mappedConfig = {\n ...inputFieldConfig,\n type: getType(inputFieldConfig.type),\n };\n const mapper = configMapperMap[SchemaElementKind.INPUT_FIELD];\n return mapper == null\n ? mappedConfig\n : mapper(mappedConfig, inputFieldName, inputObjectTypeName);\n }\n\n function mapDirective(\n config: GraphQLDirectiveNormalizedConfig,\n ): Maybe<GraphQLDirectiveNormalizedConfig> {\n const mappedConfig = {\n ...config,\n args: mapArgs(config.args, config.name, undefined),\n };\n const mapper = configMapperMap[SchemaElementKind.DIRECTIVE];\n return mapper == null ? mappedConfig : mapper(mappedConfig);\n }\n}\n\nconst stdTypeMap = new Map(\n [...specifiedScalarTypes, ...introspectionTypes].map((type) => [\n type.name,\n type,\n ]),\n);\n"]}
|
|
1
|
+
{"version":3,"file":"mapSchemaConfig.js","sourceRoot":"","sources":["../../src/utilities/mapSchemaConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,+BAA8B;AAChD,OAAO,EAAE,SAAS,EAAE,iCAAgC;AAmBpD,OAAO,EACL,eAAe,EACf,sBAAsB,EACtB,oBAAoB,EACpB,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,UAAU,EACV,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,GACZ,+BAA8B;AAE/B,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,+BAA8B;AAC/E,OAAO,EACL,kBAAkB,EAClB,mBAAmB,GACpB,kCAAiC;AAClC,OAAO,EACL,qBAAqB,EACrB,oBAAoB,GACrB,4BAA2B;AAQ5B,MAAM,CAAC,M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,eAAe,CAAC,iBAAiB,CAAC,YAAY,CAAC,CAAC;QAC/D,YAAY,GAAG,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACpE,OAAO,IAAI,sBAAsB,CAAC,YAAY,CAAC,CAAC;IAClD,CAAC;IAED,SAAS,aAAa,CACpB,gBAAyC,EACzC,cAAsB,EACtB,mBAA2B;QAE3B,MAAM,YAAY,GAAG;YACnB,GAAG,gBAAgB;YACnB,IAAI,EAAE,OAAO,CAAC,gBAAgB,CAAC,IAAI,CAAC;SACrC,CAAC;QACF,MAAM,MAAM,GAAG,eAAe,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;QAC9D,OAAO,MAAM,IAAI,IAAI;YACnB,CAAC,CAAC,YAAY;YACd,CAAC,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,EAAE,mBAAmB,CAAC,CAAC;IAChE,CAAC;IAED,SAAS,YAAY,CACnB,MAAwC;QAExC,MAAM,YAAY,GAAG;YACnB,GAAG,MAAM;YACT,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;SACnD,CAAC;QACF,MAAM,MAAM,GAAG,eAAe,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;QAC5D,OAAO,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED,MAAM,UAAU,GAAG,IAAI,GAAG,CACxB,CAAC,GAAG,oBAAoB,EAAE,GAAG,kBAAkB,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;IAC7D,IAAI,CAAC,IAAI;IACT,IAAI;CACL,CAAC,CACH,CAAC","sourcesContent":["import { inspect } from '../jsutils/inspect.ts';\nimport { invariant } from '../jsutils/invariant.ts';\nimport type { Maybe } from '../jsutils/Maybe.ts';\n\nimport type {\n GraphQLArgumentNormalizedConfig,\n GraphQLEnumTypeNormalizedConfig,\n GraphQLEnumValueConfig,\n GraphQLFieldNormalizedConfig,\n GraphQLFieldNormalizedConfigArgumentMap,\n GraphQLFieldNormalizedConfigMap,\n GraphQLInputFieldConfig,\n GraphQLInputObjectTypeNormalizedConfig,\n GraphQLInterfaceTypeNormalizedConfig,\n GraphQLNamedType,\n GraphQLObjectTypeNormalizedConfig,\n GraphQLScalarTypeNormalizedConfig,\n GraphQLType,\n GraphQLUnionTypeNormalizedConfig,\n} from '../type/definition.ts';\nimport {\n GraphQLEnumType,\n GraphQLInputObjectType,\n GraphQLInterfaceType,\n GraphQLList,\n GraphQLNonNull,\n GraphQLObjectType,\n GraphQLScalarType,\n GraphQLUnionType,\n isEnumType,\n isInputObjectType,\n isInterfaceType,\n isListType,\n isNonNullType,\n isObjectType,\n isScalarType,\n isUnionType,\n} from '../type/definition.ts';\nimport type { GraphQLDirectiveNormalizedConfig } from '../type/directives.ts';\nimport { GraphQLDirective, isSpecifiedDirective } from '../type/directives.ts';\nimport {\n introspectionTypes,\n isIntrospectionType,\n} from '../type/introspection.ts';\nimport {\n isSpecifiedScalarType,\n specifiedScalarTypes,\n} from '../type/scalars.ts';\nimport type { GraphQLSchemaNormalizedConfig } from '../type/schema.ts';\n\n/**\n * The set of GraphQL Schema Elements.\n *\n * @internal\n */\nexport const SchemaElementKind = {\n SCHEMA: 'SCHEMA' as const,\n SCALAR: 'SCALAR' as const,\n OBJECT: 'OBJECT' as const,\n FIELD: 'FIELD' as const,\n ARGUMENT: 'ARGUMENT' as const,\n INTERFACE: 'INTERFACE' as const,\n UNION: 'UNION' as const,\n ENUM: 'ENUM' as const,\n ENUM_VALUE: 'ENUM_VALUE' as const,\n INPUT_OBJECT: 'INPUT_OBJECT' as const,\n INPUT_FIELD: 'INPUT_FIELD' as const,\n DIRECTIVE: 'DIRECTIVE' as const,\n} as const;\n\n/** @internal */\n// eslint-disable-next-line @typescript-eslint/no-redeclare\ntype SchemaElementKind =\n (typeof SchemaElementKind)[keyof typeof SchemaElementKind];\n\n/** @internal */\nexport interface MappedSchemaContext {\n getNamedType: (typeName: string) => GraphQLNamedType;\n setNamedType: (type: GraphQLNamedType) => void;\n getNamedTypes: () => ReadonlyArray<GraphQLNamedType>;\n}\n\ntype GraphQLScalarTypeMappedConfig = GraphQLScalarTypeNormalizedConfig<\n any,\n any\n>;\n\ntype EnsureThunks<T, ThunkFields extends keyof T> = {\n [K in keyof T]: K extends ThunkFields ? () => T[K] : T[K];\n};\n\ntype GraphQLObjectTypeMappedConfig = EnsureThunks<\n GraphQLObjectTypeNormalizedConfig<any, any>,\n 'interfaces' | 'fields'\n>;\ntype GraphQLInterfaceTypeMappedConfig = EnsureThunks<\n GraphQLInterfaceTypeNormalizedConfig<any, any>,\n 'interfaces' | 'fields'\n>;\ntype GraphQLUnionTypeMappedConfig = EnsureThunks<\n GraphQLUnionTypeNormalizedConfig<any, any>,\n 'types'\n>;\ntype GraphQLEnumTypeMappedConfig = EnsureThunks<\n GraphQLEnumTypeNormalizedConfig,\n 'values'\n>;\ntype GraphQLInputObjectTypeMappedConfig = EnsureThunks<\n GraphQLInputObjectTypeNormalizedConfig,\n 'fields'\n>;\n\ntype ScalarTypeConfigMapper = (\n scalarConfig: GraphQLScalarTypeMappedConfig,\n) => GraphQLScalarTypeMappedConfig;\n\ntype ObjectTypeConfigMapper = (\n objectConfig: GraphQLObjectTypeMappedConfig,\n) => GraphQLObjectTypeMappedConfig;\n\ntype FieldConfigMapper = (\n fieldConfig: GraphQLFieldNormalizedConfig<any, any>,\n parentTypeName: string,\n) => GraphQLFieldNormalizedConfig<any, any>;\n\ntype ArgumentConfigMapper = (\n argConfig: GraphQLArgumentNormalizedConfig,\n fieldOrDirectiveName: string,\n parentTypeName?: string,\n) => GraphQLArgumentNormalizedConfig;\n\ntype InterfaceTypeConfigMapper = (\n interfaceConfig: GraphQLInterfaceTypeMappedConfig,\n) => GraphQLInterfaceTypeMappedConfig;\n\ntype UnionTypeConfigMapper = (\n unionConfig: GraphQLUnionTypeMappedConfig,\n) => GraphQLUnionTypeMappedConfig;\n\ntype EnumTypeConfigMapper = (\n enumConfig: GraphQLEnumTypeMappedConfig,\n) => GraphQLEnumTypeMappedConfig;\n\ntype EnumValueConfigMapper = (\n enumValueConfig: GraphQLEnumValueConfig,\n valueName: string,\n enumName: string,\n) => GraphQLEnumValueConfig;\n\ntype InputObjectTypeConfigMapper = (\n inputObjectConfig: GraphQLInputObjectTypeMappedConfig,\n) => GraphQLInputObjectTypeMappedConfig;\n\ntype InputFieldConfigMapper = (\n inputFieldConfig: GraphQLInputFieldConfig,\n inputFieldName: string,\n inputObjectTypeName: string,\n) => GraphQLInputFieldConfig;\n\ntype DirectiveConfigMapper = (\n directiveConfig: GraphQLDirectiveNormalizedConfig,\n) => GraphQLDirectiveNormalizedConfig;\n\ntype SchemaConfigMapper = (\n originalSchemaConfig: GraphQLSchemaNormalizedConfig,\n) => GraphQLSchemaNormalizedConfig;\n\n/** @internal */\nexport interface ConfigMapperMap {\n [SchemaElementKind.SCALAR]?: ScalarTypeConfigMapper;\n [SchemaElementKind.OBJECT]?: ObjectTypeConfigMapper;\n [SchemaElementKind.FIELD]?: FieldConfigMapper;\n [SchemaElementKind.ARGUMENT]?: ArgumentConfigMapper;\n [SchemaElementKind.INTERFACE]?: InterfaceTypeConfigMapper;\n [SchemaElementKind.UNION]?: UnionTypeConfigMapper;\n [SchemaElementKind.ENUM]?: EnumTypeConfigMapper;\n [SchemaElementKind.ENUM_VALUE]?: EnumValueConfigMapper;\n [SchemaElementKind.INPUT_OBJECT]?: InputObjectTypeConfigMapper;\n [SchemaElementKind.INPUT_FIELD]?: InputFieldConfigMapper;\n [SchemaElementKind.DIRECTIVE]?: DirectiveConfigMapper;\n [SchemaElementKind.SCHEMA]?: SchemaConfigMapper;\n}\n\n/** @internal */\nexport function mapSchemaConfig(\n schemaConfig: GraphQLSchemaNormalizedConfig,\n configMapperMapFn: (context: MappedSchemaContext) => ConfigMapperMap,\n): GraphQLSchemaNormalizedConfig {\n const configMapperMap = configMapperMapFn({\n getNamedType,\n setNamedType,\n getNamedTypes,\n });\n\n const mappedTypeMap = new Map<string, GraphQLNamedType>();\n for (const type of schemaConfig.types) {\n const typeName = type.name;\n const mappedNamedType = mapNamedType(type);\n if (mappedNamedType) {\n mappedTypeMap.set(typeName, mappedNamedType);\n }\n }\n\n const mappedDirectives: Array<GraphQLDirective> = [];\n for (const directive of schemaConfig.directives) {\n if (isSpecifiedDirective(directive)) {\n // Builtin directives cannot be mapped.\n mappedDirectives.push(directive);\n continue;\n }\n\n const mappedDirectiveConfig = mapDirective(directive.toConfig());\n if (mappedDirectiveConfig) {\n mappedDirectives.push(new GraphQLDirective(mappedDirectiveConfig));\n }\n }\n\n const mappedSchemaConfig = {\n ...schemaConfig,\n query:\n schemaConfig.query &&\n (getNamedType(schemaConfig.query.name) as GraphQLObjectType),\n mutation:\n schemaConfig.mutation &&\n (getNamedType(schemaConfig.mutation.name) as GraphQLObjectType),\n subscription:\n schemaConfig.subscription &&\n (getNamedType(schemaConfig.subscription.name) as GraphQLObjectType),\n types: Array.from(mappedTypeMap.values()),\n directives: mappedDirectives,\n };\n\n const schemaMapper = configMapperMap[SchemaElementKind.SCHEMA];\n\n return schemaMapper == null\n ? mappedSchemaConfig\n : schemaMapper(mappedSchemaConfig);\n\n function getType<T extends GraphQLType>(type: T): T {\n if (isListType(type)) {\n return new GraphQLList(getType(type.ofType)) as T;\n }\n if (isNonNullType(type)) {\n return new GraphQLNonNull(getType(type.ofType)) as T;\n }\n\n return getNamedType(type.name) as T;\n }\n\n function getNamedType(typeName: string): GraphQLNamedType {\n const type = stdTypeMap.get(typeName) ?? mappedTypeMap.get(typeName);\n invariant(type !== undefined, `Unknown type: \"${typeName}\".`);\n return type;\n }\n\n function setNamedType(type: GraphQLNamedType): void {\n mappedTypeMap.set(type.name, type);\n }\n\n function getNamedTypes(): ReadonlyArray<GraphQLNamedType> {\n return Array.from(mappedTypeMap.values());\n }\n\n function mapNamedType(type: GraphQLNamedType): Maybe<GraphQLNamedType> {\n if (isIntrospectionType(type) || isSpecifiedScalarType(type)) {\n // Builtin types cannot be mapped.\n return type;\n }\n\n if (isScalarType(type)) {\n return mapScalarType(type);\n }\n if (isObjectType(type)) {\n return mapObjectType(type);\n }\n if (isInterfaceType(type)) {\n return mapInterfaceType(type);\n }\n if (isUnionType(type)) {\n return mapUnionType(type);\n }\n if (isEnumType(type)) {\n return mapEnumType(type);\n }\n if (isInputObjectType(type)) {\n return mapInputObjectType(type);\n /* node:coverage ignore next 4 */\n }\n // Not reachable, all possible type definition nodes have been considered.\n invariant(false, 'Unexpected type: ' + inspect(type));\n }\n\n function mapScalarType(type: GraphQLScalarType): GraphQLScalarType {\n let mappedConfig: Maybe<GraphQLScalarTypeMappedConfig> = type.toConfig();\n const mapper = configMapperMap[SchemaElementKind.SCALAR];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLScalarType(mappedConfig);\n }\n\n function mapObjectType(type: GraphQLObjectType): GraphQLObjectType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLObjectTypeMappedConfig> = {\n ...config,\n interfaces: () =>\n config.interfaces.map(\n (iface) => getNamedType(iface.name) as GraphQLInterfaceType,\n ),\n fields: () => mapFields(config.fields, type.name),\n };\n const mapper = configMapperMap[SchemaElementKind.OBJECT];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLObjectType(mappedConfig);\n }\n\n function mapFields(\n fieldMap: GraphQLFieldNormalizedConfigMap<any, any>,\n parentTypeName: string,\n ): GraphQLFieldNormalizedConfigMap<any, any> {\n const newFieldMap = Object.create(null);\n for (const [fieldName, field] of Object.entries(fieldMap)) {\n let mappedField = {\n ...field,\n type: getType(field.type),\n args: mapArgs(field.args, fieldName, parentTypeName),\n };\n const mapper = configMapperMap[SchemaElementKind.FIELD];\n if (mapper) {\n mappedField = mapper(mappedField, parentTypeName);\n }\n newFieldMap[fieldName] = mappedField;\n }\n return newFieldMap;\n }\n\n function mapArgs(\n argumentMap: GraphQLFieldNormalizedConfigArgumentMap,\n fieldOrDirectiveName: string,\n parentTypeName?: string,\n ): GraphQLFieldNormalizedConfigArgumentMap {\n const newArgumentMap = Object.create(null);\n\n for (const [argName, arg] of Object.entries(argumentMap)) {\n let mappedArg = {\n ...arg,\n type: getType(arg.type),\n };\n const mapper = configMapperMap[SchemaElementKind.ARGUMENT];\n if (mapper) {\n mappedArg = mapper(mappedArg, fieldOrDirectiveName, parentTypeName);\n }\n newArgumentMap[argName] = mappedArg;\n }\n\n return newArgumentMap;\n }\n\n function mapInterfaceType(type: GraphQLInterfaceType): GraphQLInterfaceType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLInterfaceTypeMappedConfig> = {\n ...config,\n interfaces: () =>\n config.interfaces.map(\n (iface) => getNamedType(iface.name) as GraphQLInterfaceType,\n ),\n fields: () => mapFields(config.fields, type.name),\n };\n const mapper = configMapperMap[SchemaElementKind.INTERFACE];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLInterfaceType(mappedConfig);\n }\n\n function mapUnionType(type: GraphQLUnionType): GraphQLUnionType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLUnionTypeMappedConfig> = {\n ...config,\n types: () =>\n config.types.map(\n (memberType) => getNamedType(memberType.name) as GraphQLObjectType,\n ),\n };\n const mapper = configMapperMap[SchemaElementKind.UNION];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLUnionType(mappedConfig);\n }\n\n function mapEnumType(type: GraphQLEnumType): GraphQLEnumType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLEnumTypeMappedConfig> = {\n ...config,\n values: () => {\n const newEnumValues = Object.create(null);\n for (const [valueName, value] of Object.entries(config.values)) {\n const mappedValue = mapEnumValue(value, valueName, type.name);\n newEnumValues[valueName] = mappedValue;\n }\n return newEnumValues;\n },\n };\n const mapper = configMapperMap[SchemaElementKind.ENUM];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLEnumType(mappedConfig);\n }\n\n function mapEnumValue(\n valueConfig: GraphQLEnumValueConfig,\n valueName: string,\n enumName: string,\n ): GraphQLEnumValueConfig {\n const mappedConfig = { ...valueConfig };\n const mapper = configMapperMap[SchemaElementKind.ENUM_VALUE];\n return mapper == null\n ? mappedConfig\n : mapper(mappedConfig, valueName, enumName);\n }\n\n function mapInputObjectType(\n type: GraphQLInputObjectType,\n ): GraphQLInputObjectType {\n const config = type.toConfig();\n let mappedConfig: Maybe<GraphQLInputObjectTypeMappedConfig> = {\n ...config,\n fields: () => {\n const newInputFieldMap = Object.create(null);\n for (const [fieldName, field] of Object.entries(config.fields)) {\n const mappedField = mapInputField(field, fieldName, type.name);\n newInputFieldMap[fieldName] = mappedField;\n }\n return newInputFieldMap;\n },\n };\n const mapper = configMapperMap[SchemaElementKind.INPUT_OBJECT];\n mappedConfig = mapper == null ? mappedConfig : mapper(mappedConfig);\n return new GraphQLInputObjectType(mappedConfig);\n }\n\n function mapInputField(\n inputFieldConfig: GraphQLInputFieldConfig,\n inputFieldName: string,\n inputObjectTypeName: string,\n ): GraphQLInputFieldConfig {\n const mappedConfig = {\n ...inputFieldConfig,\n type: getType(inputFieldConfig.type),\n };\n const mapper = configMapperMap[SchemaElementKind.INPUT_FIELD];\n return mapper == null\n ? mappedConfig\n : mapper(mappedConfig, inputFieldName, inputObjectTypeName);\n }\n\n function mapDirective(\n config: GraphQLDirectiveNormalizedConfig,\n ): Maybe<GraphQLDirectiveNormalizedConfig> {\n const mappedConfig = {\n ...config,\n args: mapArgs(config.args, config.name, undefined),\n };\n const mapper = configMapperMap[SchemaElementKind.DIRECTIVE];\n return mapper == null ? mappedConfig : mapper(mappedConfig);\n }\n}\n\nconst stdTypeMap = new Map(\n [...specifiedScalarTypes, ...introspectionTypes].map((type) => [\n type.name,\n type,\n ]),\n);\n"]}
|
package/version.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.versionInfo = exports.version = void 0;
|
|
4
|
-
exports.version = '17.0.
|
|
4
|
+
exports.version = '17.0.2';
|
|
5
5
|
exports.versionInfo = Object.freeze({
|
|
6
6
|
major: 17,
|
|
7
7
|
minor: 0,
|
|
8
|
-
patch:
|
|
8
|
+
patch: 2,
|
|
9
9
|
preReleaseTag: null,
|
|
10
10
|
});
|
|
11
11
|
//# sourceMappingURL=version.js.map
|
package/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAMa,QAAA,OAAO,GAAG,QAAkB,CAAC;AAG7B,QAAA,WAAW,GAKnB,MAAM,CAAC,MAAM,CAAC;IACjB,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,aAAa,EAAE,IAAI;CACpB,CAAC,CAAC","sourcesContent":["/** @category Version */\n\n// Note: This file is autogenerated using \"resources/gen-version.js\" script and\n// automatically updated by \"npm version\" command.\n\n/** A string containing the version of the GraphQL.js library */\nexport const version = '17.0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":";;;AAMa,QAAA,OAAO,GAAG,QAAkB,CAAC;AAG7B,QAAA,WAAW,GAKnB,MAAM,CAAC,MAAM,CAAC;IACjB,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,aAAa,EAAE,IAAI;CACpB,CAAC,CAAC","sourcesContent":["/** @category Version */\n\n// Note: This file is autogenerated using \"resources/gen-version.js\" script and\n// automatically updated by \"npm version\" command.\n\n/** A string containing the version of the GraphQL.js library */\nexport const version = '17.0.2' as string;\n\n/** An object containing the components of the GraphQL.js version string */\nexport const versionInfo: Readonly<{\n major: number;\n minor: number;\n patch: number;\n preReleaseTag: string | null;\n}> = Object.freeze({\n major: 17,\n minor: 0,\n patch: 2,\n preReleaseTag: null,\n});\n"]}
|
package/version.mjs
CHANGED
package/version.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAkB,CAAC;AAG1C,MAAM,CAAC,MAAM,WAAW,GAKnB,MAAM,CAAC,MAAM,CAAC;IACjB,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,aAAa,EAAE,IAAI;CACpB,CAAC,CAAC","sourcesContent":["/** @category Version */\n\n// Note: This file is autogenerated using \"resources/gen-version.js\" script and\n// automatically updated by \"npm version\" command.\n\n/** A string containing the version of the GraphQL.js library */\nexport const version = '17.0.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAkB,CAAC;AAG1C,MAAM,CAAC,MAAM,WAAW,GAKnB,MAAM,CAAC,MAAM,CAAC;IACjB,KAAK,EAAE,EAAE;IACT,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,aAAa,EAAE,IAAI;CACpB,CAAC,CAAC","sourcesContent":["/** @category Version */\n\n// Note: This file is autogenerated using \"resources/gen-version.js\" script and\n// automatically updated by \"npm version\" command.\n\n/** A string containing the version of the GraphQL.js library */\nexport const version = '17.0.2' as string;\n\n/** An object containing the components of the GraphQL.js version string */\nexport const versionInfo: Readonly<{\n major: number;\n minor: number;\n patch: number;\n preReleaseTag: string | null;\n}> = Object.freeze({\n major: 17,\n minor: 0,\n patch: 2,\n preReleaseTag: null,\n});\n"]}
|