@graphql-tools/executor 0.0.1-alpha-20221027112615-deb575af → 0.0.1-alpha-20221027114648-2510254a

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/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@graphql-tools/executor",
3
- "version": "0.0.1-alpha-20221027112615-deb575af",
3
+ "version": "0.0.1-alpha-20221027114648-2510254a",
4
4
  "sideEffects": false,
5
5
  "peerDependencies": {
6
6
  "graphql": "^14.0.0 || ^15.0.0 || ^16.0.0 || ^17.0.0"
7
7
  },
8
8
  "dependencies": {
9
- "@graphql-tools/utils": "8.13.0-alpha-20221027112615-deb575af",
9
+ "@graphql-tools/utils": "8.13.0-alpha-20221027114648-2510254a",
10
10
  "@graphql-typed-document-node/core": "3.1.1"
11
11
  },
12
12
  "repository": {
@@ -1,5 +1,5 @@
1
1
  import { GraphQLFormattedError, GraphQLError, FieldNode, FragmentDefinitionNode, OperationDefinitionNode, GraphQLField, GraphQLFieldResolver, GraphQLObjectType, GraphQLResolveInfo, GraphQLTypeResolver, GraphQLSchema } from 'graphql';
2
- import { Maybe, Path, MaybePromise } from '@graphql-tools/utils';
2
+ import { Maybe, Path, MaybePromise, ExecutionResult } from '@graphql-tools/utils';
3
3
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
4
4
  /**
5
5
  * Terminology
@@ -26,42 +26,26 @@ import { TypedDocumentNode } from '@graphql-typed-document-node/core';
26
26
  * Namely, schema of the type system that is currently executing,
27
27
  * and the fragments defined in the query document
28
28
  */
29
- export interface ExecutionContext {
29
+ export interface ExecutionContext<TContext = any> {
30
30
  schema: GraphQLSchema;
31
31
  fragments: Record<string, FragmentDefinitionNode>;
32
32
  rootValue: unknown;
33
- contextValue: unknown;
33
+ contextValue: TContext;
34
34
  operation: OperationDefinitionNode;
35
35
  variableValues: {
36
36
  [variable: string]: unknown;
37
37
  };
38
- fieldResolver: GraphQLFieldResolver<any, any>;
39
- typeResolver: GraphQLTypeResolver<any, any>;
40
- subscribeFieldResolver: GraphQLFieldResolver<any, any>;
38
+ fieldResolver: GraphQLFieldResolver<any, TContext>;
39
+ typeResolver: GraphQLTypeResolver<any, TContext>;
40
+ subscribeFieldResolver: GraphQLFieldResolver<any, TContext>;
41
41
  errors: Array<GraphQLError>;
42
42
  }
43
- /**
44
- * The result of GraphQL execution.
45
- *
46
- * - `errors` is included when any errors occurred as a non-empty array.
47
- * - `data` is the result of a successful execution of the query.
48
- * - `extensions` is reserved for adding non-standard properties.
49
- */
50
- export interface ExecutionResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> {
51
- errors?: ReadonlyArray<GraphQLError>;
52
- data?: TData | null;
53
- extensions?: TExtensions;
54
- }
55
- export interface FormattedExecutionResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> {
43
+ export interface FormattedExecutionResult<TData = any, TExtensions = any> {
56
44
  errors?: ReadonlyArray<GraphQLFormattedError>;
57
45
  data?: TData | null;
58
46
  extensions?: TExtensions;
59
47
  }
60
- export interface ExecutionArgs<TData = {
61
- [key: string]: any;
62
- }, TVariables = {
63
- [key: string]: any;
64
- }, TContext = any> {
48
+ export interface ExecutionArgs<TData = any, TVariables = any, TContext = any> {
65
49
  schema: GraphQLSchema;
66
50
  document: TypedDocumentNode<TData, TVariables>;
67
51
  rootValue?: unknown;
@@ -82,7 +66,11 @@ export interface ExecutionArgs<TData = {
82
66
  * If the arguments to this function do not result in a legal execution context,
83
67
  * a GraphQLError will be thrown immediately explaining the invalid input.
84
68
  */
85
- export declare function execute(args: ExecutionArgs): MaybePromise<ExecutionResult>;
69
+ export declare function execute<TData = {
70
+ [key: string]: any;
71
+ }, TVariables = {
72
+ [key: string]: any;
73
+ }, TContext = any>(args: ExecutionArgs<TData, TVariables, TContext>): MaybePromise<ExecutionResult<TData>>;
86
74
  /**
87
75
  * Also implements the "Executing requests" section of the GraphQL specification.
88
76
  * However, it guarantees to complete synchronously (or throw an error) assuming
@@ -1,5 +1,5 @@
1
1
  import { GraphQLFormattedError, GraphQLError, FieldNode, FragmentDefinitionNode, OperationDefinitionNode, GraphQLField, GraphQLFieldResolver, GraphQLObjectType, GraphQLResolveInfo, GraphQLTypeResolver, GraphQLSchema } from 'graphql';
2
- import { Maybe, Path, MaybePromise } from '@graphql-tools/utils';
2
+ import { Maybe, Path, MaybePromise, ExecutionResult } from '@graphql-tools/utils';
3
3
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
4
4
  /**
5
5
  * Terminology
@@ -26,42 +26,26 @@ import { TypedDocumentNode } from '@graphql-typed-document-node/core';
26
26
  * Namely, schema of the type system that is currently executing,
27
27
  * and the fragments defined in the query document
28
28
  */
29
- export interface ExecutionContext {
29
+ export interface ExecutionContext<TContext = any> {
30
30
  schema: GraphQLSchema;
31
31
  fragments: Record<string, FragmentDefinitionNode>;
32
32
  rootValue: unknown;
33
- contextValue: unknown;
33
+ contextValue: TContext;
34
34
  operation: OperationDefinitionNode;
35
35
  variableValues: {
36
36
  [variable: string]: unknown;
37
37
  };
38
- fieldResolver: GraphQLFieldResolver<any, any>;
39
- typeResolver: GraphQLTypeResolver<any, any>;
40
- subscribeFieldResolver: GraphQLFieldResolver<any, any>;
38
+ fieldResolver: GraphQLFieldResolver<any, TContext>;
39
+ typeResolver: GraphQLTypeResolver<any, TContext>;
40
+ subscribeFieldResolver: GraphQLFieldResolver<any, TContext>;
41
41
  errors: Array<GraphQLError>;
42
42
  }
43
- /**
44
- * The result of GraphQL execution.
45
- *
46
- * - `errors` is included when any errors occurred as a non-empty array.
47
- * - `data` is the result of a successful execution of the query.
48
- * - `extensions` is reserved for adding non-standard properties.
49
- */
50
- export interface ExecutionResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> {
51
- errors?: ReadonlyArray<GraphQLError>;
52
- data?: TData | null;
53
- extensions?: TExtensions;
54
- }
55
- export interface FormattedExecutionResult<TData = Record<string, unknown>, TExtensions = Record<string, unknown>> {
43
+ export interface FormattedExecutionResult<TData = any, TExtensions = any> {
56
44
  errors?: ReadonlyArray<GraphQLFormattedError>;
57
45
  data?: TData | null;
58
46
  extensions?: TExtensions;
59
47
  }
60
- export interface ExecutionArgs<TData = {
61
- [key: string]: any;
62
- }, TVariables = {
63
- [key: string]: any;
64
- }, TContext = any> {
48
+ export interface ExecutionArgs<TData = any, TVariables = any, TContext = any> {
65
49
  schema: GraphQLSchema;
66
50
  document: TypedDocumentNode<TData, TVariables>;
67
51
  rootValue?: unknown;
@@ -82,7 +66,11 @@ export interface ExecutionArgs<TData = {
82
66
  * If the arguments to this function do not result in a legal execution context,
83
67
  * a GraphQLError will be thrown immediately explaining the invalid input.
84
68
  */
85
- export declare function execute(args: ExecutionArgs): MaybePromise<ExecutionResult>;
69
+ export declare function execute<TData = {
70
+ [key: string]: any;
71
+ }, TVariables = {
72
+ [key: string]: any;
73
+ }, TContext = any>(args: ExecutionArgs<TData, TVariables, TContext>): MaybePromise<ExecutionResult<TData>>;
86
74
  /**
87
75
  * Also implements the "Executing requests" section of the GraphQL specification.
88
76
  * However, it guarantees to complete synchronously (or throw an error) assuming
@@ -1,6 +1,6 @@
1
1
  import { GraphQLFieldResolver, GraphQLSchema } from 'graphql';
2
- import { Maybe } from '@graphql-tools/utils';
3
- import type { ExecutionArgs, ExecutionResult } from './execute.cjs';
2
+ import { Maybe, ExecutionResult } from '@graphql-tools/utils';
3
+ import type { ExecutionArgs } from './execute.cjs';
4
4
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
5
  /**
6
6
  * Implements the "Subscribe" algorithm described in the GraphQL specification.
@@ -1,6 +1,6 @@
1
1
  import { GraphQLFieldResolver, GraphQLSchema } from 'graphql';
2
- import { Maybe } from '@graphql-tools/utils';
3
- import type { ExecutionArgs, ExecutionResult } from './execute.js';
2
+ import { Maybe, ExecutionResult } from '@graphql-tools/utils';
3
+ import type { ExecutionArgs } from './execute.js';
4
4
  import { TypedDocumentNode } from '@graphql-typed-document-node/core';
5
5
  /**
6
6
  * Implements the "Subscribe" algorithm described in the GraphQL specification.