@graphql-tools/utils 9.1.4 → 9.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/visitResult.js
CHANGED
|
@@ -116,6 +116,9 @@ function visitObjectValue(object, type, fieldNodeMap, schema, fragments, variabl
|
|
|
116
116
|
case '__schema':
|
|
117
117
|
fieldType = graphql_1.SchemaMetaFieldDef.type;
|
|
118
118
|
break;
|
|
119
|
+
case '__type':
|
|
120
|
+
fieldType = graphql_1.TypeMetaFieldDef.type;
|
|
121
|
+
break;
|
|
119
122
|
}
|
|
120
123
|
}
|
|
121
124
|
const newPathIndex = pathIndex + 1;
|
package/esm/visitResult.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { getOperationASTFromRequest } from './getOperationASTFromRequest.js';
|
|
2
|
-
import { Kind, isListType, getNullableType, isAbstractType, isObjectType, TypeNameMetaFieldDef, SchemaMetaFieldDef, } from 'graphql';
|
|
2
|
+
import { Kind, isListType, getNullableType, isAbstractType, isObjectType, TypeMetaFieldDef, TypeNameMetaFieldDef, SchemaMetaFieldDef, } from 'graphql';
|
|
3
3
|
import { collectFields, collectSubFields } from './collectFields.js';
|
|
4
4
|
export function visitData(data, enter, leave) {
|
|
5
5
|
if (Array.isArray(data)) {
|
|
@@ -110,6 +110,9 @@ function visitObjectValue(object, type, fieldNodeMap, schema, fragments, variabl
|
|
|
110
110
|
case '__schema':
|
|
111
111
|
fieldType = SchemaMetaFieldDef.type;
|
|
112
112
|
break;
|
|
113
|
+
case '__type':
|
|
114
|
+
fieldType = TypeMetaFieldDef.type;
|
|
115
|
+
break;
|
|
113
116
|
}
|
|
114
117
|
}
|
|
115
118
|
const newPathIndex = pathIndex + 1;
|
package/package.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphql-tools/utils",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"description": "Common package containing utils and types for GraphQL tools",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
+
"@graphql-typed-document-node/core": "^3.1.1",
|
|
10
11
|
"tslib": "^2.4.0"
|
|
11
12
|
},
|
|
12
13
|
"repository": {
|
package/typings/Interfaces.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
1
2
|
import { GraphQLSchema, GraphQLField, GraphQLInputType, GraphQLNamedType, GraphQLResolveInfo, GraphQLScalarType, DocumentNode, FieldNode, GraphQLEnumValue, GraphQLEnumType, GraphQLUnionType, GraphQLArgument, GraphQLInputField, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, GraphQLDirective, FragmentDefinitionNode, SelectionNode, GraphQLOutputType, FieldDefinitionNode, GraphQLFieldConfig, GraphQLInputFieldConfig, GraphQLArgumentConfig, GraphQLEnumValueConfig, GraphQLScalarSerializer, GraphQLScalarValueParser, GraphQLScalarLiteralParser, ScalarTypeDefinitionNode, ScalarTypeExtensionNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, GraphQLIsTypeOfFn, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, InterfaceTypeExtensionNode, InterfaceTypeDefinitionNode, GraphQLTypeResolver, UnionTypeDefinitionNode, UnionTypeExtensionNode, InputObjectTypeExtensionNode, InputObjectTypeDefinitionNode, GraphQLType, Source, DefinitionNode, OperationTypeNode, GraphQLError } from 'graphql';
|
|
2
3
|
/**
|
|
3
4
|
* The result of GraphQL execution.
|
|
@@ -17,9 +18,9 @@ export interface ExecutionResult<TData = any, TExtensions = any> {
|
|
|
17
18
|
path?: ReadonlyArray<string | number>;
|
|
18
19
|
items?: TData | null;
|
|
19
20
|
}
|
|
20
|
-
export interface ExecutionRequest<
|
|
21
|
-
document:
|
|
22
|
-
variables?:
|
|
21
|
+
export interface ExecutionRequest<TVariables extends Record<string, any> = any, TContext = any, TRootValue = any, TExtensions = Record<string, any>, TReturn = any> {
|
|
22
|
+
document: TypedDocumentNode<TReturn, TVariables>;
|
|
23
|
+
variables?: TVariables;
|
|
23
24
|
operationType?: OperationTypeNode;
|
|
24
25
|
operationName?: string;
|
|
25
26
|
extensions?: TExtensions;
|
package/typings/Interfaces.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
1
2
|
import { GraphQLSchema, GraphQLField, GraphQLInputType, GraphQLNamedType, GraphQLResolveInfo, GraphQLScalarType, DocumentNode, FieldNode, GraphQLEnumValue, GraphQLEnumType, GraphQLUnionType, GraphQLArgument, GraphQLInputField, GraphQLInputObjectType, GraphQLInterfaceType, GraphQLObjectType, GraphQLDirective, FragmentDefinitionNode, SelectionNode, GraphQLOutputType, FieldDefinitionNode, GraphQLFieldConfig, GraphQLInputFieldConfig, GraphQLArgumentConfig, GraphQLEnumValueConfig, GraphQLScalarSerializer, GraphQLScalarValueParser, GraphQLScalarLiteralParser, ScalarTypeDefinitionNode, ScalarTypeExtensionNode, EnumTypeDefinitionNode, EnumTypeExtensionNode, GraphQLIsTypeOfFn, ObjectTypeDefinitionNode, ObjectTypeExtensionNode, InterfaceTypeExtensionNode, InterfaceTypeDefinitionNode, GraphQLTypeResolver, UnionTypeDefinitionNode, UnionTypeExtensionNode, InputObjectTypeExtensionNode, InputObjectTypeDefinitionNode, GraphQLType, Source, DefinitionNode, OperationTypeNode, GraphQLError } from 'graphql';
|
|
2
3
|
/**
|
|
3
4
|
* The result of GraphQL execution.
|
|
@@ -17,9 +18,9 @@ export interface ExecutionResult<TData = any, TExtensions = any> {
|
|
|
17
18
|
path?: ReadonlyArray<string | number>;
|
|
18
19
|
items?: TData | null;
|
|
19
20
|
}
|
|
20
|
-
export interface ExecutionRequest<
|
|
21
|
-
document:
|
|
22
|
-
variables?:
|
|
21
|
+
export interface ExecutionRequest<TVariables extends Record<string, any> = any, TContext = any, TRootValue = any, TExtensions = Record<string, any>, TReturn = any> {
|
|
22
|
+
document: TypedDocumentNode<TReturn, TVariables>;
|
|
23
|
+
variables?: TVariables;
|
|
23
24
|
operationType?: OperationTypeNode;
|
|
24
25
|
operationName?: string;
|
|
25
26
|
extensions?: TExtensions;
|
package/typings/executor.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecutionResult, ExecutionRequest } from './Interfaces.cjs';
|
|
2
2
|
export type MaybePromise<T> = PromiseLike<T> | T;
|
|
3
3
|
export type MaybeAsyncIterable<T> = AsyncIterable<T> | T;
|
|
4
|
-
export type AsyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions>) => Promise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
|
|
5
|
-
export type SyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions>) => ExecutionResult<TReturn>;
|
|
6
|
-
export type Executor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions>) => MaybePromise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
|
|
4
|
+
export type AsyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => Promise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
|
|
5
|
+
export type SyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => ExecutionResult<TReturn>;
|
|
6
|
+
export type Executor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => MaybePromise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
|
package/typings/executor.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ExecutionResult, ExecutionRequest } from './Interfaces.js';
|
|
2
2
|
export type MaybePromise<T> = PromiseLike<T> | T;
|
|
3
3
|
export type MaybeAsyncIterable<T> = AsyncIterable<T> | T;
|
|
4
|
-
export type AsyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions>) => Promise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
|
|
5
|
-
export type SyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions>) => ExecutionResult<TReturn>;
|
|
6
|
-
export type Executor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions>) => MaybePromise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
|
|
4
|
+
export type AsyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => Promise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
|
|
5
|
+
export type SyncExecutor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => ExecutionResult<TReturn>;
|
|
6
|
+
export type Executor<TBaseContext = Record<string, any>, TBaseExtensions = Record<string, any>> = <TReturn = any, TArgs extends Record<string, any> = Record<string, any>, TContext extends TBaseContext = TBaseContext, TRoot = any, TExtensions extends TBaseExtensions = TBaseExtensions>(request: ExecutionRequest<TArgs, TContext, TRoot, TExtensions, TReturn>) => MaybePromise<MaybeAsyncIterable<ExecutionResult<TReturn>>>;
|