graphql-jit 0.8.9 → 0.9.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/README.md +25 -0
- package/dist/cjs/ast.d.ts +89 -0
- package/dist/cjs/ast.js +766 -0
- package/dist/cjs/ast.js.map +1 -0
- package/dist/cjs/compat.d.ts +70 -0
- package/dist/cjs/compat.js +144 -0
- package/dist/cjs/compat.js.map +1 -0
- package/dist/cjs/debug.d.ts +29 -0
- package/dist/cjs/debug.js +46 -0
- package/dist/cjs/debug.js.map +1 -0
- package/dist/cjs/error.d.ts +7 -0
- package/dist/cjs/error.js +58 -0
- package/dist/cjs/error.js.map +1 -0
- package/dist/cjs/execution.d.ts +154 -0
- package/dist/cjs/execution.js +1240 -0
- package/dist/cjs/execution.js.map +1 -0
- package/dist/cjs/generate.d.ts +4 -0
- package/dist/cjs/generate.js +13 -0
- package/dist/cjs/generate.js.map +1 -0
- package/dist/cjs/index.d.ts +3 -0
- package/dist/cjs/index.js +10 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/inspect.d.ts +5 -0
- package/dist/cjs/inspect.js +110 -0
- package/dist/cjs/inspect.js.map +1 -0
- package/dist/cjs/json.d.ts +9 -0
- package/dist/cjs/json.js +144 -0
- package/dist/cjs/json.js.map +1 -0
- package/dist/cjs/memoize.d.ts +5 -0
- package/dist/cjs/memoize.js +28 -0
- package/dist/cjs/memoize.js.map +1 -0
- package/dist/cjs/non-null.d.ts +9 -0
- package/dist/cjs/non-null.js +205 -0
- package/dist/cjs/non-null.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/{resolve-info.d.ts → cjs/resolve-info.d.ts} +10 -12
- package/dist/cjs/resolve-info.js +232 -0
- package/dist/cjs/resolve-info.js.map +1 -0
- package/dist/cjs/runtime.d.ts +14 -0
- package/dist/cjs/runtime.js +92 -0
- package/dist/cjs/runtime.js.map +1 -0
- package/dist/cjs/types.d.ts +1 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/variables.d.ts +20 -0
- package/dist/cjs/variables.js +357 -0
- package/dist/cjs/variables.js.map +1 -0
- package/dist/esm/ast.d.ts +89 -0
- package/dist/esm/ast.js +751 -0
- package/dist/esm/ast.js.map +1 -0
- package/dist/esm/compat.d.ts +70 -0
- package/dist/esm/compat.js +102 -0
- package/dist/esm/compat.js.map +1 -0
- package/dist/esm/debug.d.ts +29 -0
- package/dist/esm/debug.js +40 -0
- package/dist/esm/debug.js.map +1 -0
- package/dist/esm/error.d.ts +7 -0
- package/dist/esm/error.js +55 -0
- package/dist/esm/error.js.map +1 -0
- package/dist/esm/execution.d.ts +154 -0
- package/dist/esm/execution.js +1227 -0
- package/dist/esm/execution.js.map +1 -0
- package/dist/esm/generate.d.ts +4 -0
- package/dist/esm/generate.js +10 -0
- package/dist/esm/generate.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/inspect.d.ts +5 -0
- package/dist/esm/inspect.js +106 -0
- package/dist/esm/inspect.js.map +1 -0
- package/dist/esm/json.d.ts +9 -0
- package/dist/esm/json.js +141 -0
- package/dist/esm/json.js.map +1 -0
- package/dist/esm/memoize.d.ts +5 -0
- package/dist/esm/memoize.js +20 -0
- package/dist/esm/memoize.js.map +1 -0
- package/dist/esm/non-null.d.ts +9 -0
- package/dist/esm/non-null.js +199 -0
- package/dist/esm/non-null.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/{resolve-info.d.mts → esm/resolve-info.d.ts} +10 -12
- package/dist/esm/resolve-info.js +224 -0
- package/dist/esm/resolve-info.js.map +1 -0
- package/dist/esm/runtime.d.ts +14 -0
- package/dist/esm/runtime.js +89 -0
- package/dist/esm/runtime.js.map +1 -0
- package/dist/esm/types.d.ts +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/variables.d.ts +20 -0
- package/dist/esm/variables.js +350 -0
- package/dist/esm/variables.js.map +1 -0
- package/package.json +39 -35
- package/dist/ast.d.mts +0 -7
- package/dist/ast.d.ts +0 -7
- package/dist/ast.js +0 -635
- package/dist/ast.js.map +0 -1
- package/dist/ast.mjs +0 -612
- package/dist/ast.mjs.map +0 -1
- package/dist/compat.d.mts +0 -7
- package/dist/compat.d.ts +0 -7
- package/dist/compat.js +0 -113
- package/dist/compat.js.map +0 -1
- package/dist/compat.mjs +0 -75
- package/dist/compat.mjs.map +0 -1
- package/dist/error.d.mts +0 -11
- package/dist/error.d.ts +0 -11
- package/dist/error.js +0 -79
- package/dist/error.js.map +0 -1
- package/dist/error.mjs +0 -57
- package/dist/error.mjs.map +0 -1
- package/dist/execution.d.mts +0 -7
- package/dist/execution.d.ts +0 -7
- package/dist/execution.js +0 -1262
- package/dist/execution.js.map +0 -1
- package/dist/execution.mjs +0 -1248
- package/dist/execution.mjs.map +0 -1
- package/dist/generate.d.mts +0 -6
- package/dist/generate.d.ts +0 -6
- package/dist/generate.js +0 -37
- package/dist/generate.js.map +0 -1
- package/dist/generate.mjs +0 -13
- package/dist/generate.mjs.map +0 -1
- package/dist/index-CeluTkd4.d.mts +0 -329
- package/dist/index-mKv2zpdA.d.ts +0 -329
- package/dist/index.d.mts +0 -7
- package/dist/index.d.ts +0 -7
- package/dist/index.js +0 -36
- package/dist/index.js.map +0 -1
- package/dist/index.mjs +0 -15
- package/dist/index.mjs.map +0 -1
- package/dist/inspect.d.mts +0 -7
- package/dist/inspect.d.ts +0 -7
- package/dist/inspect.js +0 -121
- package/dist/inspect.js.map +0 -1
- package/dist/inspect.mjs +0 -97
- package/dist/inspect.mjs.map +0 -1
- package/dist/json.d.mts +0 -18
- package/dist/json.d.ts +0 -18
- package/dist/json.js +0 -181
- package/dist/json.js.map +0 -1
- package/dist/json.mjs +0 -164
- package/dist/json.mjs.map +0 -1
- package/dist/memoize.d.mts +0 -6
- package/dist/memoize.d.ts +0 -6
- package/dist/memoize.js +0 -67
- package/dist/memoize.js.map +0 -1
- package/dist/memoize.mjs +0 -31
- package/dist/memoize.mjs.map +0 -1
- package/dist/non-null.d.mts +0 -7
- package/dist/non-null.d.ts +0 -7
- package/dist/non-null.js +0 -196
- package/dist/non-null.js.map +0 -1
- package/dist/non-null.mjs +0 -167
- package/dist/non-null.mjs.map +0 -1
- package/dist/resolve-info.js +0 -245
- package/dist/resolve-info.js.map +0 -1
- package/dist/resolve-info.mjs +0 -219
- package/dist/resolve-info.mjs.map +0 -1
- package/dist/runtime.d.mts +0 -7
- package/dist/runtime.d.ts +0 -7
- package/dist/runtime.js +0 -115
- package/dist/runtime.js.map +0 -1
- package/dist/runtime.mjs +0 -91
- package/dist/runtime.mjs.map +0 -1
- package/dist/types.d.mts +0 -3
- package/dist/types.d.ts +0 -3
- package/dist/types.js +0 -17
- package/dist/types.js.map +0 -1
- package/dist/types.mjs +0 -1
- package/dist/types.mjs.map +0 -1
- package/dist/variables.d.mts +0 -17
- package/dist/variables.d.ts +0 -17
- package/dist/variables.js +0 -412
- package/dist/variables.js.map +0 -1
- package/dist/variables.mjs +0 -391
- package/dist/variables.mjs.map +0 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { type TypedDocumentNode } from "@graphql-typed-document-node/core";
|
|
2
|
+
import { type JitRuntime } from "./runtime.js";
|
|
3
|
+
import { type CompilerDebugOptions } from "./debug.js";
|
|
4
|
+
import { type DocumentNode, type ExecutionResult, type FragmentDefinitionNode, GraphQLError, type GraphQLFieldResolver, type GraphQLIsTypeOfFn, GraphQLObjectType, type GraphQLOutputType, GraphQLSchema, type FieldNode, type OperationDefinitionNode, type GraphQLTypeResolver } from "graphql";
|
|
5
|
+
import { type ExecutionContext as GraphQLContext } from "./compat.js";
|
|
6
|
+
import { type Arguments, type ObjectPath } from "./ast.js";
|
|
7
|
+
import { GraphQLError as GraphqlJitError } from "./error.js";
|
|
8
|
+
import { type NullTrimmer } from "./non-null.js";
|
|
9
|
+
import { type ResolveInfoEnricherInput } from "./resolve-info.js";
|
|
10
|
+
import { type Maybe } from "./types.js";
|
|
11
|
+
import { type CoercedVariableValues } from "./variables.js";
|
|
12
|
+
declare const inspect: (value: any) => string;
|
|
13
|
+
export interface CompilerOptions {
|
|
14
|
+
customJSONSerializer: boolean;
|
|
15
|
+
disableLeafSerialization: boolean;
|
|
16
|
+
disablingCapturingStackErrors: boolean;
|
|
17
|
+
customSerializers: {
|
|
18
|
+
[key: string]: (v: any) => any;
|
|
19
|
+
};
|
|
20
|
+
resolverInfoEnricher?: (inp: ResolveInfoEnricherInput) => object;
|
|
21
|
+
/**
|
|
22
|
+
* This option is a temporary workaround to rollout and test the new skip/include behavior.
|
|
23
|
+
* It will be removed in the next version along with the old behavior.
|
|
24
|
+
*
|
|
25
|
+
* Set this to true if you face issues with skip/include in fragment spreads.
|
|
26
|
+
*
|
|
27
|
+
* default: false
|
|
28
|
+
*
|
|
29
|
+
* @see https://github.com/zalando-incubator/graphql-jit/pull/197
|
|
30
|
+
*
|
|
31
|
+
*/
|
|
32
|
+
useExperimentalPathBasedSkipInclude: boolean;
|
|
33
|
+
/** Expose generated executors to JavaScript debuggers with virtual names. */
|
|
34
|
+
debug?: CompilerDebugOptions;
|
|
35
|
+
}
|
|
36
|
+
export interface ExecutionContext {
|
|
37
|
+
promiseCounter: number;
|
|
38
|
+
data: any;
|
|
39
|
+
errors: GraphQLError[];
|
|
40
|
+
nullErrors: GraphQLError[];
|
|
41
|
+
resolve?: (ctx: ExecutionContext) => void;
|
|
42
|
+
rt: JitRuntime;
|
|
43
|
+
inspect: typeof inspect;
|
|
44
|
+
variables: {
|
|
45
|
+
[key: string]: any;
|
|
46
|
+
};
|
|
47
|
+
context: any;
|
|
48
|
+
rootValue: any;
|
|
49
|
+
GraphQLError: typeof GraphqlJitError;
|
|
50
|
+
resolvers: {
|
|
51
|
+
[key: string]: GraphQLFieldResolver<any, any, any>;
|
|
52
|
+
};
|
|
53
|
+
trimmer: NullTrimmer;
|
|
54
|
+
serializers: {
|
|
55
|
+
[key: string]: (c: ExecutionContext, v: any, onError: (c: ExecutionContext, msg: string) => void) => any;
|
|
56
|
+
};
|
|
57
|
+
typeResolvers: {
|
|
58
|
+
[key: string]: GraphQLTypeResolver<any, any>;
|
|
59
|
+
};
|
|
60
|
+
isTypeOfs: {
|
|
61
|
+
[key: string]: GraphQLIsTypeOfFn<any, any>;
|
|
62
|
+
};
|
|
63
|
+
resolveInfos: {
|
|
64
|
+
[key: string]: any;
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
interface DeferredField {
|
|
68
|
+
name: string;
|
|
69
|
+
responsePath: ObjectPath;
|
|
70
|
+
originPaths: string[];
|
|
71
|
+
originPathsFormatted: string;
|
|
72
|
+
destinationPaths: string[];
|
|
73
|
+
parentType: GraphQLObjectType;
|
|
74
|
+
fieldName: string;
|
|
75
|
+
jsFieldName: string;
|
|
76
|
+
fieldType: GraphQLOutputType;
|
|
77
|
+
fieldNodes: FieldNode[];
|
|
78
|
+
args: Arguments;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The context used during compilation.
|
|
82
|
+
*
|
|
83
|
+
* It stores deferred nodes to be processed later as well as the function arguments to be bounded at top level
|
|
84
|
+
*/
|
|
85
|
+
export interface CompilationContext extends GraphQLContext {
|
|
86
|
+
resolvers: {
|
|
87
|
+
[key: string]: GraphQLFieldResolver<any, any, any>;
|
|
88
|
+
};
|
|
89
|
+
serializers: {
|
|
90
|
+
[key: string]: (c: ExecutionContext, v: any, onError: (c: ExecutionContext, msg: string) => void) => any;
|
|
91
|
+
};
|
|
92
|
+
hoistedFunctions: string[];
|
|
93
|
+
hoistedFunctionNames: Map<string, number>;
|
|
94
|
+
leafErrHandlerCache: Map<string, string>;
|
|
95
|
+
trivialTypeNameVar?: string;
|
|
96
|
+
typeResolvers: {
|
|
97
|
+
[key: string]: GraphQLTypeResolver<any, any>;
|
|
98
|
+
};
|
|
99
|
+
isTypeOfs: {
|
|
100
|
+
[key: string]: GraphQLIsTypeOfFn<any, any>;
|
|
101
|
+
};
|
|
102
|
+
resolveInfos: {
|
|
103
|
+
[key: string]: any;
|
|
104
|
+
};
|
|
105
|
+
deferred: DeferredField[];
|
|
106
|
+
options: CompilerOptions;
|
|
107
|
+
depth: number;
|
|
108
|
+
schema: GraphQLSchema;
|
|
109
|
+
operation: OperationDefinitionNode;
|
|
110
|
+
fragments: {
|
|
111
|
+
[key: string]: FragmentDefinitionNode;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export declare const GLOBAL_VARIABLES_NAME = "__context.variables";
|
|
115
|
+
export interface CompiledQuery<TResult = {
|
|
116
|
+
[key: string]: any;
|
|
117
|
+
}, TVariables = {
|
|
118
|
+
[key: string]: any;
|
|
119
|
+
}> {
|
|
120
|
+
operationName?: string;
|
|
121
|
+
query: (root: any, context: any, variables: Maybe<TVariables>) => Promise<ExecutionResult<TResult>> | ExecutionResult<TResult>;
|
|
122
|
+
subscribe?: (root: any, context: any, variables: Maybe<TVariables>) => Promise<AsyncIterableIterator<ExecutionResult<TResult>> | ExecutionResult<TResult>>;
|
|
123
|
+
stringify: (v: any) => string;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* It compiles a GraphQL query to an executable function
|
|
127
|
+
* @param {GraphQLSchema} schema GraphQL schema
|
|
128
|
+
* @param {DocumentNode} document Query being submitted
|
|
129
|
+
* @param {string} operationName name of the operation
|
|
130
|
+
* @param partialOptions compilation options to tune the compiler features
|
|
131
|
+
* @returns {CompiledQuery} the cacheable result
|
|
132
|
+
*/
|
|
133
|
+
export declare function compileQuery<TResult = {
|
|
134
|
+
[key: string]: any;
|
|
135
|
+
}, TVariables = {
|
|
136
|
+
[key: string]: any;
|
|
137
|
+
}>(schema: GraphQLSchema, document: TypedDocumentNode<TResult, TVariables>, operationName?: string, partialOptions?: Partial<CompilerOptions>): CompiledQuery<TResult, TVariables> | ExecutionResult<TResult>;
|
|
138
|
+
export declare function isCompiledQuery<C extends CompiledQuery, E extends ExecutionResult>(query: C | E): query is C;
|
|
139
|
+
export declare function createBoundQuery(compilationContext: CompilationContext, document: DocumentNode, func: (context: ExecutionContext) => Promise<any> | undefined, getVariableValues: (inputs: {
|
|
140
|
+
[key: string]: any;
|
|
141
|
+
}) => CoercedVariableValues, operationName?: string): (rootValue: any, context: any, variables: Maybe<{
|
|
142
|
+
[key: string]: any;
|
|
143
|
+
}>) => Promise<ExecutionResult> | ExecutionResult;
|
|
144
|
+
export declare function isPromise(value: any): value is Promise<any>;
|
|
145
|
+
export declare function isPromiseInliner(value: string): string;
|
|
146
|
+
/**
|
|
147
|
+
* Constructs a ExecutionContext object from the arguments passed to
|
|
148
|
+
* execute, which we will pass throughout the other execution methods.
|
|
149
|
+
*
|
|
150
|
+
* Throws a GraphQLError if a valid execution context cannot be created.
|
|
151
|
+
*/
|
|
152
|
+
export declare function buildCompilationContext(schema: GraphQLSchema, document: DocumentNode, options: CompilerOptions, operationName?: string): CompilationContext;
|
|
153
|
+
export declare function isAsyncIterable<T = unknown>(val: unknown): val is AsyncIterableIterator<T>;
|
|
154
|
+
export {};
|