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
package/dist/index-mKv2zpdA.d.ts
DELETED
|
@@ -1,329 +0,0 @@
|
|
|
1
|
-
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
|
|
2
|
-
import { GraphQLSchema, OperationDefinitionNode, GraphQLObjectType, GraphQLError, GraphQLFormattedError, ASTNode, FieldNode, GraphQLField, GraphQLScalarType, ConstValueNode, GraphQLFieldResolver, GraphQLTypeResolver, GraphQLIsTypeOfFn, FragmentDefinitionNode, ExecutionResult, DocumentNode, GraphQLOutputType, SelectionSetNode, GraphQLDirective, DirectiveNode, ValueNode, GraphQLInputType, SourceLocation, VariableNode, GraphQLArgument, ArgumentNode } from 'graphql';
|
|
3
|
-
import { Maybe } from './types.js';
|
|
4
|
-
import { GraphQLError as GraphQLError$1 } from './error.js';
|
|
5
|
-
import { ResolveInfoEnricherInput } from './resolve-info.js';
|
|
6
|
-
import { CoercedVariableValues } from './variables.js';
|
|
7
|
-
|
|
8
|
-
type Serializer = (c: ExecutionContext, v: any, onError: any, ...idx: number[]) => any;
|
|
9
|
-
declare const jitRuntime: {
|
|
10
|
-
isPromise(value: unknown): boolean;
|
|
11
|
-
checkNonNullLeaf(ctx: ExecutionContext, value: unknown, dest: any[], nullMsg: string, locs: any, path: any, capStack: boolean, serialize: Serializer, errHandler: any, ...parentIndexes: number[]): any;
|
|
12
|
-
checkNullableLeaf(ctx: ExecutionContext, value: unknown, dest: any[], locs: any, path: any, capStack: boolean, serialize: Serializer, errHandler: any, ...parentIndexes: number[]): any;
|
|
13
|
-
callResolver(ctx: ExecutionContext, call: () => unknown, onSuccess: (result: unknown) => void, onError: (err: unknown) => void): void;
|
|
14
|
-
handleResolverResult(ctx: ExecutionContext, value: unknown, onSuccess: (result: unknown) => void, onError: (err: unknown) => void): void;
|
|
15
|
-
handleListItemResult(ctx: ExecutionContext, item: unknown, onSuccess: (result: unknown) => void, onError: (err: unknown) => void): void;
|
|
16
|
-
finalizeResult(ctx: ExecutionContext): Promise<unknown> | undefined;
|
|
17
|
-
safeMap(ctx: ExecutionContext, iterable: Iterable<unknown> | string, cb: (context: ExecutionContext, a: unknown, index: number, resultArray: unknown[], ...idx: number[]) => void, ...idx: number[]): unknown[];
|
|
18
|
-
};
|
|
19
|
-
type JitRuntime = typeof jitRuntime;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* A helper file to support backward compatibility for different versions of graphql-js.
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* v15 does not have schema.getRootType
|
|
26
|
-
* v16 has both
|
|
27
|
-
* v17 will not have getOperationRootType
|
|
28
|
-
*
|
|
29
|
-
* To support all these 3 versions of graphql-js, at least for migration, this helper
|
|
30
|
-
* would be useful.
|
|
31
|
-
*
|
|
32
|
-
* This can be removed once we drop support for v15.
|
|
33
|
-
*
|
|
34
|
-
* GraphQL v17 would remove getOperationRootType.
|
|
35
|
-
*/
|
|
36
|
-
declare function getOperationRootType(schema: GraphQLSchema, operation: OperationDefinitionNode): GraphQLObjectType;
|
|
37
|
-
/**
|
|
38
|
-
* v16 and lower versions don't have .toJSON method on GraphQLError
|
|
39
|
-
* v17 does have .toJSON and doesn't have "formatError" export anymore
|
|
40
|
-
*/
|
|
41
|
-
declare function formatError(error: GraphQLError): GraphQLFormattedError;
|
|
42
|
-
/**
|
|
43
|
-
* v17 dropped support for positional arguments in GraphQLError constructor
|
|
44
|
-
* https://github.com/graphql/graphql-js/pull/3577
|
|
45
|
-
*/
|
|
46
|
-
declare function getGraphQLErrorOptions(nodes: Maybe<ReadonlyArray<ASTNode> | ASTNode>): ConstructorParameters<typeof GraphQLError>[1];
|
|
47
|
-
/**
|
|
48
|
-
* Resolves the field on the given source object. In particular, this
|
|
49
|
-
* figures out the value that the field returns by calling its resolve function,
|
|
50
|
-
* then calls completeValue to complete promises, serialize scalars, or execute
|
|
51
|
-
* the sub-selection-set for objects.
|
|
52
|
-
*
|
|
53
|
-
* v15 has getFieldDef that accepts field name
|
|
54
|
-
* v16 has getFieldDef that accepts field node
|
|
55
|
-
* v17 drops getFieldDef support and adds getField method
|
|
56
|
-
*/
|
|
57
|
-
declare function resolveFieldDef(compilationContext: CompilationContext, parentType: GraphQLObjectType, fieldNodes: FieldNode[]): Maybe<GraphQLField<any, any>>;
|
|
58
|
-
/**
|
|
59
|
-
* v17 introduces `arg.default = { value }` for SDL-built schemas.
|
|
60
|
-
* Programmatic schemas still use `arg.defaultValue`.
|
|
61
|
-
* This helper normalizes both to a single value.
|
|
62
|
-
*/
|
|
63
|
-
declare function getDefaultValue(argOrField: {
|
|
64
|
-
defaultValue?: unknown;
|
|
65
|
-
default?: {
|
|
66
|
-
value?: unknown;
|
|
67
|
-
literal?: unknown;
|
|
68
|
-
};
|
|
69
|
-
}): unknown;
|
|
70
|
-
declare function hasDefaultValue(argOrField: {
|
|
71
|
-
defaultValue?: unknown;
|
|
72
|
-
default?: {
|
|
73
|
-
value?: unknown;
|
|
74
|
-
literal?: unknown;
|
|
75
|
-
};
|
|
76
|
-
}): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* v17 deprecates parseLiteral in favor of coerceInputLiteral for custom scalars
|
|
79
|
-
* However, custom scalars may still only define parseLiteral, so we check
|
|
80
|
-
* for the method's existence rather than just the version.
|
|
81
|
-
*/
|
|
82
|
-
declare function coerceInputLiteral(type: GraphQLScalarType<unknown, unknown>, valueNode: ConstValueNode): any;
|
|
83
|
-
/**
|
|
84
|
-
* V17 removes execution context
|
|
85
|
-
* This is a minimal interface to support the execution context for v16 and v17+
|
|
86
|
-
*/
|
|
87
|
-
interface ExecutionContext$1 {
|
|
88
|
-
errors: Array<GraphQLError> | undefined;
|
|
89
|
-
completed: boolean;
|
|
90
|
-
errorPropagation: boolean;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
type NullTrimmer = (data: any, errors: GraphQLError[]) => any;
|
|
94
|
-
/**
|
|
95
|
-
*
|
|
96
|
-
* @param {CompilationContext} compilationContext
|
|
97
|
-
* @returns {(data: any, errors: GraphQLError[]) => {data: any; errors: GraphQLError[]}}
|
|
98
|
-
*/
|
|
99
|
-
declare function createNullTrimmer(compilationContext: CompilationContext): NullTrimmer;
|
|
100
|
-
|
|
101
|
-
declare const inspect: (value: any) => string;
|
|
102
|
-
interface CompilerOptions {
|
|
103
|
-
customJSONSerializer: boolean;
|
|
104
|
-
disableLeafSerialization: boolean;
|
|
105
|
-
disablingCapturingStackErrors: boolean;
|
|
106
|
-
customSerializers: {
|
|
107
|
-
[key: string]: (v: any) => any;
|
|
108
|
-
};
|
|
109
|
-
resolverInfoEnricher?: (inp: ResolveInfoEnricherInput) => object;
|
|
110
|
-
/**
|
|
111
|
-
* This option is a temporary workaround to rollout and test the new skip/include behavior.
|
|
112
|
-
* It will be removed in the next version along with the old behavior.
|
|
113
|
-
*
|
|
114
|
-
* Set this to true if you face issues with skip/include in fragment spreads.
|
|
115
|
-
*
|
|
116
|
-
* default: false
|
|
117
|
-
*
|
|
118
|
-
* @see https://github.com/zalando-incubator/graphql-jit/pull/197
|
|
119
|
-
*
|
|
120
|
-
*/
|
|
121
|
-
useExperimentalPathBasedSkipInclude: boolean;
|
|
122
|
-
}
|
|
123
|
-
interface ExecutionContext {
|
|
124
|
-
promiseCounter: number;
|
|
125
|
-
data: any;
|
|
126
|
-
errors: GraphQLError[];
|
|
127
|
-
nullErrors: GraphQLError[];
|
|
128
|
-
resolve?: (ctx: ExecutionContext) => void;
|
|
129
|
-
rt: JitRuntime;
|
|
130
|
-
inspect: typeof inspect;
|
|
131
|
-
variables: {
|
|
132
|
-
[key: string]: any;
|
|
133
|
-
};
|
|
134
|
-
context: any;
|
|
135
|
-
rootValue: any;
|
|
136
|
-
GraphQLError: typeof GraphQLError$1;
|
|
137
|
-
resolvers: {
|
|
138
|
-
[key: string]: GraphQLFieldResolver<any, any, any>;
|
|
139
|
-
};
|
|
140
|
-
trimmer: NullTrimmer;
|
|
141
|
-
serializers: {
|
|
142
|
-
[key: string]: (c: ExecutionContext, v: any, onError: (c: ExecutionContext, msg: string) => void) => any;
|
|
143
|
-
};
|
|
144
|
-
typeResolvers: {
|
|
145
|
-
[key: string]: GraphQLTypeResolver<any, any>;
|
|
146
|
-
};
|
|
147
|
-
isTypeOfs: {
|
|
148
|
-
[key: string]: GraphQLIsTypeOfFn<any, any>;
|
|
149
|
-
};
|
|
150
|
-
resolveInfos: {
|
|
151
|
-
[key: string]: any;
|
|
152
|
-
};
|
|
153
|
-
}
|
|
154
|
-
interface DeferredField {
|
|
155
|
-
name: string;
|
|
156
|
-
responsePath: ObjectPath;
|
|
157
|
-
originPaths: string[];
|
|
158
|
-
originPathsFormatted: string;
|
|
159
|
-
destinationPaths: string[];
|
|
160
|
-
parentType: GraphQLObjectType;
|
|
161
|
-
fieldName: string;
|
|
162
|
-
jsFieldName: string;
|
|
163
|
-
fieldType: GraphQLOutputType;
|
|
164
|
-
fieldNodes: FieldNode[];
|
|
165
|
-
args: Arguments;
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* The context used during compilation.
|
|
169
|
-
*
|
|
170
|
-
* It stores deferred nodes to be processed later as well as the function arguments to be bounded at top level
|
|
171
|
-
*/
|
|
172
|
-
interface CompilationContext extends ExecutionContext$1 {
|
|
173
|
-
resolvers: {
|
|
174
|
-
[key: string]: GraphQLFieldResolver<any, any, any>;
|
|
175
|
-
};
|
|
176
|
-
serializers: {
|
|
177
|
-
[key: string]: (c: ExecutionContext, v: any, onError: (c: ExecutionContext, msg: string) => void) => any;
|
|
178
|
-
};
|
|
179
|
-
hoistedFunctions: string[];
|
|
180
|
-
hoistedFunctionNames: Map<string, number>;
|
|
181
|
-
leafErrHandlerCache: Map<string, string>;
|
|
182
|
-
trivialTypeNameVar?: string;
|
|
183
|
-
typeResolvers: {
|
|
184
|
-
[key: string]: GraphQLTypeResolver<any, any>;
|
|
185
|
-
};
|
|
186
|
-
isTypeOfs: {
|
|
187
|
-
[key: string]: GraphQLIsTypeOfFn<any, any>;
|
|
188
|
-
};
|
|
189
|
-
resolveInfos: {
|
|
190
|
-
[key: string]: any;
|
|
191
|
-
};
|
|
192
|
-
deferred: DeferredField[];
|
|
193
|
-
options: CompilerOptions;
|
|
194
|
-
depth: number;
|
|
195
|
-
schema: GraphQLSchema;
|
|
196
|
-
operation: OperationDefinitionNode;
|
|
197
|
-
fragments: {
|
|
198
|
-
[key: string]: FragmentDefinitionNode;
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
declare const GLOBAL_VARIABLES_NAME = "__context.variables";
|
|
202
|
-
interface CompiledQuery<TResult = {
|
|
203
|
-
[key: string]: any;
|
|
204
|
-
}, TVariables = {
|
|
205
|
-
[key: string]: any;
|
|
206
|
-
}> {
|
|
207
|
-
operationName?: string;
|
|
208
|
-
query: (root: any, context: any, variables: Maybe<TVariables>) => Promise<ExecutionResult<TResult>> | ExecutionResult<TResult>;
|
|
209
|
-
subscribe?: (root: any, context: any, variables: Maybe<TVariables>) => Promise<AsyncIterableIterator<ExecutionResult<TResult>> | ExecutionResult<TResult>>;
|
|
210
|
-
stringify: (v: any) => string;
|
|
211
|
-
}
|
|
212
|
-
/**
|
|
213
|
-
* It compiles a GraphQL query to an executable function
|
|
214
|
-
* @param {GraphQLSchema} schema GraphQL schema
|
|
215
|
-
* @param {DocumentNode} document Query being submitted
|
|
216
|
-
* @param {string} operationName name of the operation
|
|
217
|
-
* @param partialOptions compilation options to tune the compiler features
|
|
218
|
-
* @returns {CompiledQuery} the cacheable result
|
|
219
|
-
*/
|
|
220
|
-
declare function compileQuery<TResult = {
|
|
221
|
-
[key: string]: any;
|
|
222
|
-
}, TVariables = {
|
|
223
|
-
[key: string]: any;
|
|
224
|
-
}>(schema: GraphQLSchema, document: TypedDocumentNode<TResult, TVariables>, operationName?: string, partialOptions?: Partial<CompilerOptions>): CompiledQuery<TResult, TVariables> | ExecutionResult<TResult>;
|
|
225
|
-
declare function isCompiledQuery<C extends CompiledQuery, E extends ExecutionResult>(query: C | E): query is C;
|
|
226
|
-
declare function createBoundQuery(compilationContext: CompilationContext, document: DocumentNode, func: (context: ExecutionContext) => Promise<any> | undefined, getVariableValues: (inputs: {
|
|
227
|
-
[key: string]: any;
|
|
228
|
-
}) => CoercedVariableValues, operationName?: string): (rootValue: any, context: any, variables: Maybe<{
|
|
229
|
-
[key: string]: any;
|
|
230
|
-
}>) => Promise<ExecutionResult> | ExecutionResult;
|
|
231
|
-
declare function isPromise(value: any): value is Promise<any>;
|
|
232
|
-
declare function isPromiseInliner(value: string): string;
|
|
233
|
-
/**
|
|
234
|
-
* Constructs a ExecutionContext object from the arguments passed to
|
|
235
|
-
* execute, which we will pass throughout the other execution methods.
|
|
236
|
-
*
|
|
237
|
-
* Throws a GraphQLError if a valid execution context cannot be created.
|
|
238
|
-
*/
|
|
239
|
-
declare function buildCompilationContext(schema: GraphQLSchema, document: DocumentNode, options: CompilerOptions, operationName?: string): CompilationContext;
|
|
240
|
-
declare function isAsyncIterable<T = unknown>(val: unknown): val is AsyncIterableIterator<T>;
|
|
241
|
-
|
|
242
|
-
interface JitFieldNode extends FieldNode {
|
|
243
|
-
/**
|
|
244
|
-
* @deprecated Use __internalShouldIncludePath instead
|
|
245
|
-
* @see __internalShouldIncludePath
|
|
246
|
-
*/
|
|
247
|
-
__internalShouldInclude?: string[];
|
|
248
|
-
__internalShouldIncludePath?: {
|
|
249
|
-
[path: string]: string[];
|
|
250
|
-
};
|
|
251
|
-
}
|
|
252
|
-
interface FieldsAndNodes {
|
|
253
|
-
[key: string]: JitFieldNode[];
|
|
254
|
-
}
|
|
255
|
-
/**
|
|
256
|
-
* Given a selectionSet, adds all of the fields in that selection to
|
|
257
|
-
* the passed in map of fields, and returns it at the end.
|
|
258
|
-
*
|
|
259
|
-
* CollectFields requires the "runtime type" of an object. For a field which
|
|
260
|
-
* returns an Interface or Union type, the "runtime type" will be the actual
|
|
261
|
-
* Object type returned by that field.
|
|
262
|
-
*/
|
|
263
|
-
declare function collectFields(compilationContext: CompilationContext, runtimeType: GraphQLObjectType, selectionSet: SelectionSetNode, fields: FieldsAndNodes, visitedFragmentNames: {
|
|
264
|
-
[key: string]: boolean;
|
|
265
|
-
}, parentResponsePath?: ObjectPath): FieldsAndNodes;
|
|
266
|
-
|
|
267
|
-
declare function collectSubfields(compilationContext: CompilationContext, returnType: GraphQLObjectType, fieldNodes: FieldNode[], parentResponsePath?: ObjectPath): {
|
|
268
|
-
[key: string]: FieldNode[];
|
|
269
|
-
};
|
|
270
|
-
type ResponsePathType = "variable" | "literal" | "meta";
|
|
271
|
-
interface ObjectPath {
|
|
272
|
-
prev: ObjectPath | undefined;
|
|
273
|
-
key: string;
|
|
274
|
-
type: ResponsePathType;
|
|
275
|
-
}
|
|
276
|
-
interface MissingVariablePath {
|
|
277
|
-
valueNode: VariableNode;
|
|
278
|
-
path?: ObjectPath;
|
|
279
|
-
argument?: {
|
|
280
|
-
definition: GraphQLArgument;
|
|
281
|
-
node: ArgumentNode;
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
interface Arguments {
|
|
285
|
-
values: {
|
|
286
|
-
[argument: string]: any;
|
|
287
|
-
};
|
|
288
|
-
missing: MissingVariablePath[];
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Prepares an object map of argument values given a list of argument
|
|
292
|
-
* definitions and list of argument AST nodes.
|
|
293
|
-
*
|
|
294
|
-
* Note: The returned value is a plain Object with a prototype, since it is
|
|
295
|
-
* exposed to user code. Care should be taken to not pull values from the
|
|
296
|
-
* Object prototype.
|
|
297
|
-
*/
|
|
298
|
-
declare function getArgumentDefs(def: GraphQLField<any, any> | GraphQLDirective, node: FieldNode | DirectiveNode): Arguments;
|
|
299
|
-
interface ASTValueWithVariables {
|
|
300
|
-
value: object | string | boolean | symbol | number | null | any[];
|
|
301
|
-
variables: MissingVariablePath[];
|
|
302
|
-
}
|
|
303
|
-
interface ASTValue {
|
|
304
|
-
value: object | string | boolean | symbol | number | null | any[];
|
|
305
|
-
}
|
|
306
|
-
declare function valueFromAST(valueNode: ValueNode, type: GraphQLInputType): undefined | ASTValue | ASTValueWithVariables;
|
|
307
|
-
declare function computeLocations(nodes: ASTNode[]): SourceLocation[];
|
|
308
|
-
declare function addPath(responsePath: ObjectPath | undefined, key: string, type?: ResponsePathType): ObjectPath;
|
|
309
|
-
declare function flattenPath(path: ObjectPath): Array<{
|
|
310
|
-
key: string;
|
|
311
|
-
type: ResponsePathType;
|
|
312
|
-
}>;
|
|
313
|
-
/**
|
|
314
|
-
* Serialize a path for use in the skip/include directives.
|
|
315
|
-
*
|
|
316
|
-
* @param path The path to serialize
|
|
317
|
-
* @returns The path serialized as a string, with the root path first.
|
|
318
|
-
*/
|
|
319
|
-
declare function serializeObjectPathForSkipInclude(path: ObjectPath | undefined): string;
|
|
320
|
-
/**
|
|
321
|
-
* join two path segments to a dot notation, handling empty strings
|
|
322
|
-
*
|
|
323
|
-
* @param a path segment
|
|
324
|
-
* @param b path segment
|
|
325
|
-
* @returns combined path in dot notation
|
|
326
|
-
*/
|
|
327
|
-
declare function joinSkipIncludePath(a: string, b: string): string;
|
|
328
|
-
|
|
329
|
-
export { type Arguments as A, flattenPath as B, type CompilationContext as C, serializeObjectPathForSkipInclude as D, type ExecutionContext$1 as E, type FieldsAndNodes as F, GLOBAL_VARIABLES_NAME as G, joinSkipIncludePath as H, type JitRuntime as J, type NullTrimmer as N, type ObjectPath as O, getGraphQLErrorOptions as a, getDefaultValue as b, coerceInputLiteral as c, createNullTrimmer as d, type CompilerOptions as e, formatError as f, getOperationRootType as g, hasDefaultValue as h, type ExecutionContext as i, jitRuntime as j, type CompiledQuery as k, compileQuery as l, isCompiledQuery as m, createBoundQuery as n, isPromise as o, isPromiseInliner as p, buildCompilationContext as q, resolveFieldDef as r, isAsyncIterable as s, type JitFieldNode as t, collectFields as u, collectSubfields as v, getArgumentDefs as w, valueFromAST as x, computeLocations as y, addPath as z };
|
package/dist/index.d.mts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { k as CompiledQuery, e as CompilerOptions, l as compileQuery, m as isCompiledQuery } from './index-CeluTkd4.mjs';
|
|
2
|
-
export { FieldExpansion, GraphQLJitResolveInfo, LeafField, ResolveInfoEnricherInput, TypeExpansion, fieldExpansionEnricher, isLeafField } from './resolve-info.mjs';
|
|
3
|
-
import '@graphql-typed-document-node/core';
|
|
4
|
-
import 'graphql';
|
|
5
|
-
import './types.mjs';
|
|
6
|
-
import './error.mjs';
|
|
7
|
-
import './variables.mjs';
|
package/dist/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { k as CompiledQuery, e as CompilerOptions, l as compileQuery, m as isCompiledQuery } from './index-mKv2zpdA.js';
|
|
2
|
-
export { FieldExpansion, GraphQLJitResolveInfo, LeafField, ResolveInfoEnricherInput, TypeExpansion, fieldExpansionEnricher, isLeafField } from './resolve-info.js';
|
|
3
|
-
import '@graphql-typed-document-node/core';
|
|
4
|
-
import 'graphql';
|
|
5
|
-
import './types.js';
|
|
6
|
-
import './error.js';
|
|
7
|
-
import './variables.js';
|
package/dist/index.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var src_exports = {};
|
|
20
|
-
__export(src_exports, {
|
|
21
|
-
compileQuery: () => import_execution.compileQuery,
|
|
22
|
-
fieldExpansionEnricher: () => import_resolve_info.fieldExpansionEnricher,
|
|
23
|
-
isCompiledQuery: () => import_execution.isCompiledQuery,
|
|
24
|
-
isLeafField: () => import_resolve_info.isLeafField
|
|
25
|
-
});
|
|
26
|
-
module.exports = __toCommonJS(src_exports);
|
|
27
|
-
var import_execution = require("./execution.js");
|
|
28
|
-
var import_resolve_info = require("./resolve-info.js");
|
|
29
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
-
0 && (module.exports = {
|
|
31
|
-
compileQuery,
|
|
32
|
-
fieldExpansionEnricher,
|
|
33
|
-
isCompiledQuery,
|
|
34
|
-
isLeafField
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n compileQuery,\n isCompiledQuery,\n type CompilerOptions,\n type CompiledQuery\n} from \"./execution.js\";\n\nexport {\n type GraphQLJitResolveInfo,\n type FieldExpansion,\n type LeafField,\n type TypeExpansion,\n fieldExpansionEnricher,\n isLeafField,\n type ResolveInfoEnricherInput\n} from \"./resolve-info.js\";\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAKO;AAEP,0BAQO;","names":[]}
|
package/dist/index.mjs
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
compileQuery,
|
|
3
|
-
isCompiledQuery
|
|
4
|
-
} from "./execution.js";
|
|
5
|
-
import {
|
|
6
|
-
fieldExpansionEnricher,
|
|
7
|
-
isLeafField
|
|
8
|
-
} from "./resolve-info.js";
|
|
9
|
-
export {
|
|
10
|
-
compileQuery,
|
|
11
|
-
fieldExpansionEnricher,
|
|
12
|
-
isCompiledQuery,
|
|
13
|
-
isLeafField
|
|
14
|
-
};
|
|
15
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"sourcesContent":["export {\n compileQuery,\n isCompiledQuery,\n type CompilerOptions,\n type CompiledQuery\n} from \"./execution.js\";\n\nexport {\n type GraphQLJitResolveInfo,\n type FieldExpansion,\n type LeafField,\n type TypeExpansion,\n fieldExpansionEnricher,\n isLeafField,\n type ResolveInfoEnricherInput\n} from \"./resolve-info.js\";\n"],"mappings":"AAAA;AAAA,EACE;AAAA,EACA;AAAA,OAGK;AAEP;AAAA,EAKE;AAAA,EACA;AAAA,OAEK;","names":[]}
|
package/dist/inspect.d.mts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Based on https://github.com/graphql/graphql-js/blob/master/src/jsutils/inspect.js
|
|
3
|
-
*/
|
|
4
|
-
declare const nodejsCustomInspectSymbol: unique symbol;
|
|
5
|
-
declare function createInspect(maxArrayLength?: number, maxRecursiveDepth?: number): (value: any) => string;
|
|
6
|
-
|
|
7
|
-
export { createInspect as default, nodejsCustomInspectSymbol };
|
package/dist/inspect.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Based on https://github.com/graphql/graphql-js/blob/master/src/jsutils/inspect.js
|
|
3
|
-
*/
|
|
4
|
-
declare const nodejsCustomInspectSymbol: unique symbol;
|
|
5
|
-
declare function createInspect(maxArrayLength?: number, maxRecursiveDepth?: number): (value: any) => string;
|
|
6
|
-
|
|
7
|
-
export { createInspect as default, nodejsCustomInspectSymbol };
|
package/dist/inspect.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var inspect_exports = {};
|
|
20
|
-
__export(inspect_exports, {
|
|
21
|
-
default: () => createInspect,
|
|
22
|
-
nodejsCustomInspectSymbol: () => nodejsCustomInspectSymbol
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(inspect_exports);
|
|
25
|
-
const nodejsCustomInspectSymbol = Symbol.for(
|
|
26
|
-
"nodejs.util.inspect.custom"
|
|
27
|
-
);
|
|
28
|
-
function createInspect(maxArrayLength = 10, maxRecursiveDepth = 2) {
|
|
29
|
-
return function inspect(value) {
|
|
30
|
-
return formatValue(value, []);
|
|
31
|
-
};
|
|
32
|
-
function formatValue(value, seenValues) {
|
|
33
|
-
switch (typeof value) {
|
|
34
|
-
case "string":
|
|
35
|
-
return JSON.stringify(value);
|
|
36
|
-
case "function":
|
|
37
|
-
return value.name ? `[function ${value.name}]` : "[function]";
|
|
38
|
-
case "object":
|
|
39
|
-
return formatObjectValue(value, seenValues);
|
|
40
|
-
default:
|
|
41
|
-
return String(value);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
function formatObjectValue(value, previouslySeenValues) {
|
|
45
|
-
if (previouslySeenValues.indexOf(value) !== -1) {
|
|
46
|
-
return "[Circular]";
|
|
47
|
-
}
|
|
48
|
-
const seenValues = [...previouslySeenValues, value];
|
|
49
|
-
if (value) {
|
|
50
|
-
const customInspectFn = getCustomFn(value);
|
|
51
|
-
if (customInspectFn) {
|
|
52
|
-
const customValue = customInspectFn.call(value);
|
|
53
|
-
if (customValue !== value) {
|
|
54
|
-
return typeof customValue === "string" ? customValue : formatValue(customValue, seenValues);
|
|
55
|
-
}
|
|
56
|
-
} else if (Array.isArray(value)) {
|
|
57
|
-
return formatArray(value, seenValues);
|
|
58
|
-
}
|
|
59
|
-
return formatObject(value, seenValues);
|
|
60
|
-
}
|
|
61
|
-
return String(value);
|
|
62
|
-
}
|
|
63
|
-
function formatObject(object, seenValues) {
|
|
64
|
-
const keys = Object.keys(object);
|
|
65
|
-
if (keys.length === 0) {
|
|
66
|
-
return "{}";
|
|
67
|
-
}
|
|
68
|
-
if (seenValues.length > maxRecursiveDepth) {
|
|
69
|
-
return "[" + getObjectTag(object) + "]";
|
|
70
|
-
}
|
|
71
|
-
const properties = keys.map((key) => {
|
|
72
|
-
const value = formatValue(object[key], seenValues);
|
|
73
|
-
return key + ": " + value;
|
|
74
|
-
});
|
|
75
|
-
return "{ " + properties.join(", ") + " }";
|
|
76
|
-
}
|
|
77
|
-
function formatArray(array, seenValues) {
|
|
78
|
-
if (array.length === 0) {
|
|
79
|
-
return "[]";
|
|
80
|
-
}
|
|
81
|
-
if (seenValues.length > maxRecursiveDepth) {
|
|
82
|
-
return "[Array]";
|
|
83
|
-
}
|
|
84
|
-
const len = Math.min(maxArrayLength, array.length);
|
|
85
|
-
const remaining = array.length - len;
|
|
86
|
-
const items = [];
|
|
87
|
-
for (let i = 0; i < len; ++i) {
|
|
88
|
-
items.push(formatValue(array[i], seenValues));
|
|
89
|
-
}
|
|
90
|
-
if (remaining === 1) {
|
|
91
|
-
items.push("... 1 more item");
|
|
92
|
-
} else if (remaining > 1) {
|
|
93
|
-
items.push(`... ${remaining} more items`);
|
|
94
|
-
}
|
|
95
|
-
return "[" + items.join(", ") + "]";
|
|
96
|
-
}
|
|
97
|
-
function getCustomFn(object) {
|
|
98
|
-
const customInspectFn = object[String(nodejsCustomInspectSymbol)];
|
|
99
|
-
if (typeof customInspectFn === "function") {
|
|
100
|
-
return customInspectFn;
|
|
101
|
-
}
|
|
102
|
-
if (typeof object.inspect === "function") {
|
|
103
|
-
return object.inspect;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
function getObjectTag(object) {
|
|
107
|
-
const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
|
|
108
|
-
if (tag === "Object" && typeof object.constructor === "function") {
|
|
109
|
-
const name = object.constructor.name;
|
|
110
|
-
if (typeof name === "string") {
|
|
111
|
-
return name;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return tag;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
118
|
-
0 && (module.exports = {
|
|
119
|
-
nodejsCustomInspectSymbol
|
|
120
|
-
});
|
|
121
|
-
//# sourceMappingURL=inspect.js.map
|
package/dist/inspect.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/inspect.ts"],"sourcesContent":["/**\n * Based on https://github.com/graphql/graphql-js/blob/master/src/jsutils/inspect.js\n */\n\nexport const nodejsCustomInspectSymbol = Symbol.for(\n \"nodejs.util.inspect.custom\"\n);\nexport default function createInspect(\n maxArrayLength = 10,\n maxRecursiveDepth = 2\n) {\n /**\n * Used to print values in error messages.\n */\n return function inspect(value: any): string {\n return formatValue(value, []);\n };\n\n function formatValue(value: any, seenValues: any[]) {\n switch (typeof value) {\n case \"string\":\n return JSON.stringify(value);\n case \"function\":\n return value.name ? `[function ${value.name}]` : \"[function]\";\n case \"object\":\n return formatObjectValue(value, seenValues);\n default:\n return String(value);\n }\n }\n\n function formatObjectValue(value: any, previouslySeenValues: any[]): string {\n if (previouslySeenValues.indexOf(value) !== -1) {\n return \"[Circular]\";\n }\n const seenValues = [...previouslySeenValues, value];\n\n if (value) {\n const customInspectFn = getCustomFn(value);\n\n if (customInspectFn) {\n // $FlowFixMe(>=0.90.0)\n const customValue = customInspectFn.call(value);\n\n // check for infinite recursion\n if (customValue !== value) {\n return typeof customValue === \"string\"\n ? customValue\n : formatValue(customValue, seenValues);\n }\n } else if (Array.isArray(value)) {\n return formatArray(value, seenValues);\n }\n\n return formatObject(value, seenValues);\n }\n\n return String(value);\n }\n\n function formatObject(\n object: { [key: string]: string },\n seenValues: any[]\n ): string {\n const keys = Object.keys(object);\n if (keys.length === 0) {\n return \"{}\";\n }\n\n if (seenValues.length > maxRecursiveDepth) {\n return \"[\" + getObjectTag(object) + \"]\";\n }\n\n const properties = keys.map((key) => {\n const value = formatValue(object[key], seenValues);\n return key + \": \" + value;\n });\n\n return \"{ \" + properties.join(\", \") + \" }\";\n }\n\n function formatArray(array: any[], seenValues: any[]) {\n if (array.length === 0) {\n return \"[]\";\n }\n\n if (seenValues.length > maxRecursiveDepth) {\n return \"[Array]\";\n }\n\n const len = Math.min(maxArrayLength, array.length);\n const remaining = array.length - len;\n const items = [];\n\n for (let i = 0; i < len; ++i) {\n items.push(formatValue(array[i], seenValues));\n }\n\n if (remaining === 1) {\n items.push(\"... 1 more item\");\n } else if (remaining > 1) {\n items.push(`... ${remaining} more items`);\n }\n\n return \"[\" + items.join(\", \") + \"]\";\n }\n\n function getCustomFn(object: any) {\n const customInspectFn = object[String(nodejsCustomInspectSymbol)];\n\n if (typeof customInspectFn === \"function\") {\n return customInspectFn;\n }\n\n if (typeof object.inspect === \"function\") {\n return object.inspect;\n }\n }\n\n function getObjectTag(object: any) {\n const tag = Object.prototype.toString\n .call(object)\n .replace(/^\\[object /, \"\")\n .replace(/]$/, \"\");\n\n if (tag === \"Object\" && typeof object.constructor === \"function\") {\n const name = object.constructor.name;\n if (typeof name === \"string\") {\n return name;\n }\n }\n\n return tag;\n }\n}\n"],"mappings":"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","names":[]}
|
package/dist/inspect.mjs
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
const nodejsCustomInspectSymbol = Symbol.for(
|
|
2
|
-
"nodejs.util.inspect.custom"
|
|
3
|
-
);
|
|
4
|
-
function createInspect(maxArrayLength = 10, maxRecursiveDepth = 2) {
|
|
5
|
-
return function inspect(value) {
|
|
6
|
-
return formatValue(value, []);
|
|
7
|
-
};
|
|
8
|
-
function formatValue(value, seenValues) {
|
|
9
|
-
switch (typeof value) {
|
|
10
|
-
case "string":
|
|
11
|
-
return JSON.stringify(value);
|
|
12
|
-
case "function":
|
|
13
|
-
return value.name ? `[function ${value.name}]` : "[function]";
|
|
14
|
-
case "object":
|
|
15
|
-
return formatObjectValue(value, seenValues);
|
|
16
|
-
default:
|
|
17
|
-
return String(value);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function formatObjectValue(value, previouslySeenValues) {
|
|
21
|
-
if (previouslySeenValues.indexOf(value) !== -1) {
|
|
22
|
-
return "[Circular]";
|
|
23
|
-
}
|
|
24
|
-
const seenValues = [...previouslySeenValues, value];
|
|
25
|
-
if (value) {
|
|
26
|
-
const customInspectFn = getCustomFn(value);
|
|
27
|
-
if (customInspectFn) {
|
|
28
|
-
const customValue = customInspectFn.call(value);
|
|
29
|
-
if (customValue !== value) {
|
|
30
|
-
return typeof customValue === "string" ? customValue : formatValue(customValue, seenValues);
|
|
31
|
-
}
|
|
32
|
-
} else if (Array.isArray(value)) {
|
|
33
|
-
return formatArray(value, seenValues);
|
|
34
|
-
}
|
|
35
|
-
return formatObject(value, seenValues);
|
|
36
|
-
}
|
|
37
|
-
return String(value);
|
|
38
|
-
}
|
|
39
|
-
function formatObject(object, seenValues) {
|
|
40
|
-
const keys = Object.keys(object);
|
|
41
|
-
if (keys.length === 0) {
|
|
42
|
-
return "{}";
|
|
43
|
-
}
|
|
44
|
-
if (seenValues.length > maxRecursiveDepth) {
|
|
45
|
-
return "[" + getObjectTag(object) + "]";
|
|
46
|
-
}
|
|
47
|
-
const properties = keys.map((key) => {
|
|
48
|
-
const value = formatValue(object[key], seenValues);
|
|
49
|
-
return key + ": " + value;
|
|
50
|
-
});
|
|
51
|
-
return "{ " + properties.join(", ") + " }";
|
|
52
|
-
}
|
|
53
|
-
function formatArray(array, seenValues) {
|
|
54
|
-
if (array.length === 0) {
|
|
55
|
-
return "[]";
|
|
56
|
-
}
|
|
57
|
-
if (seenValues.length > maxRecursiveDepth) {
|
|
58
|
-
return "[Array]";
|
|
59
|
-
}
|
|
60
|
-
const len = Math.min(maxArrayLength, array.length);
|
|
61
|
-
const remaining = array.length - len;
|
|
62
|
-
const items = [];
|
|
63
|
-
for (let i = 0; i < len; ++i) {
|
|
64
|
-
items.push(formatValue(array[i], seenValues));
|
|
65
|
-
}
|
|
66
|
-
if (remaining === 1) {
|
|
67
|
-
items.push("... 1 more item");
|
|
68
|
-
} else if (remaining > 1) {
|
|
69
|
-
items.push(`... ${remaining} more items`);
|
|
70
|
-
}
|
|
71
|
-
return "[" + items.join(", ") + "]";
|
|
72
|
-
}
|
|
73
|
-
function getCustomFn(object) {
|
|
74
|
-
const customInspectFn = object[String(nodejsCustomInspectSymbol)];
|
|
75
|
-
if (typeof customInspectFn === "function") {
|
|
76
|
-
return customInspectFn;
|
|
77
|
-
}
|
|
78
|
-
if (typeof object.inspect === "function") {
|
|
79
|
-
return object.inspect;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
function getObjectTag(object) {
|
|
83
|
-
const tag = Object.prototype.toString.call(object).replace(/^\[object /, "").replace(/]$/, "");
|
|
84
|
-
if (tag === "Object" && typeof object.constructor === "function") {
|
|
85
|
-
const name = object.constructor.name;
|
|
86
|
-
if (typeof name === "string") {
|
|
87
|
-
return name;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
return tag;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
export {
|
|
94
|
-
createInspect as default,
|
|
95
|
-
nodejsCustomInspectSymbol
|
|
96
|
-
};
|
|
97
|
-
//# sourceMappingURL=inspect.mjs.map
|
package/dist/inspect.mjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/inspect.ts"],"sourcesContent":["/**\n * Based on https://github.com/graphql/graphql-js/blob/master/src/jsutils/inspect.js\n */\n\nexport const nodejsCustomInspectSymbol = Symbol.for(\n \"nodejs.util.inspect.custom\"\n);\nexport default function createInspect(\n maxArrayLength = 10,\n maxRecursiveDepth = 2\n) {\n /**\n * Used to print values in error messages.\n */\n return function inspect(value: any): string {\n return formatValue(value, []);\n };\n\n function formatValue(value: any, seenValues: any[]) {\n switch (typeof value) {\n case \"string\":\n return JSON.stringify(value);\n case \"function\":\n return value.name ? `[function ${value.name}]` : \"[function]\";\n case \"object\":\n return formatObjectValue(value, seenValues);\n default:\n return String(value);\n }\n }\n\n function formatObjectValue(value: any, previouslySeenValues: any[]): string {\n if (previouslySeenValues.indexOf(value) !== -1) {\n return \"[Circular]\";\n }\n const seenValues = [...previouslySeenValues, value];\n\n if (value) {\n const customInspectFn = getCustomFn(value);\n\n if (customInspectFn) {\n // $FlowFixMe(>=0.90.0)\n const customValue = customInspectFn.call(value);\n\n // check for infinite recursion\n if (customValue !== value) {\n return typeof customValue === \"string\"\n ? customValue\n : formatValue(customValue, seenValues);\n }\n } else if (Array.isArray(value)) {\n return formatArray(value, seenValues);\n }\n\n return formatObject(value, seenValues);\n }\n\n return String(value);\n }\n\n function formatObject(\n object: { [key: string]: string },\n seenValues: any[]\n ): string {\n const keys = Object.keys(object);\n if (keys.length === 0) {\n return \"{}\";\n }\n\n if (seenValues.length > maxRecursiveDepth) {\n return \"[\" + getObjectTag(object) + \"]\";\n }\n\n const properties = keys.map((key) => {\n const value = formatValue(object[key], seenValues);\n return key + \": \" + value;\n });\n\n return \"{ \" + properties.join(\", \") + \" }\";\n }\n\n function formatArray(array: any[], seenValues: any[]) {\n if (array.length === 0) {\n return \"[]\";\n }\n\n if (seenValues.length > maxRecursiveDepth) {\n return \"[Array]\";\n }\n\n const len = Math.min(maxArrayLength, array.length);\n const remaining = array.length - len;\n const items = [];\n\n for (let i = 0; i < len; ++i) {\n items.push(formatValue(array[i], seenValues));\n }\n\n if (remaining === 1) {\n items.push(\"... 1 more item\");\n } else if (remaining > 1) {\n items.push(`... ${remaining} more items`);\n }\n\n return \"[\" + items.join(\", \") + \"]\";\n }\n\n function getCustomFn(object: any) {\n const customInspectFn = object[String(nodejsCustomInspectSymbol)];\n\n if (typeof customInspectFn === \"function\") {\n return customInspectFn;\n }\n\n if (typeof object.inspect === \"function\") {\n return object.inspect;\n }\n }\n\n function getObjectTag(object: any) {\n const tag = Object.prototype.toString\n .call(object)\n .replace(/^\\[object /, \"\")\n .replace(/]$/, \"\");\n\n if (tag === \"Object\" && typeof object.constructor === \"function\") {\n const name = object.constructor.name;\n if (typeof name === \"string\") {\n return name;\n }\n }\n\n return tag;\n }\n}\n"],"mappings":"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","names":[]}
|