grafast 0.1.1-beta.2 → 0.1.1-beta.21
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 +2 -3
- package/dist/args.d.ts +4 -7
- package/dist/args.js +53 -38
- package/dist/assert.js +2 -3
- package/dist/bucket.d.ts +1 -89
- package/dist/config.d.ts +0 -17
- package/dist/config.js +1 -95
- package/dist/constraints.d.ts +15 -1
- package/dist/constraints.js +41 -3
- package/dist/deferred.js +1 -2
- package/dist/dev.d.ts +1 -4
- package/dist/dev.js +18 -3
- package/dist/engine/LayerPlan.d.ts +21 -111
- package/dist/engine/LayerPlan.js +196 -78
- package/dist/engine/OperationPlan.d.ts +30 -104
- package/dist/engine/OperationPlan.js +763 -471
- package/dist/engine/OutputPlan.d.ts +9 -20
- package/dist/engine/OutputPlan.js +432 -444
- package/dist/engine/StepTracker.d.ts +1 -95
- package/dist/engine/StepTracker.js +94 -20
- package/dist/engine/executeBucket.d.ts +5 -7
- package/dist/engine/executeBucket.js +646 -244
- package/dist/engine/executeOutputPlan.d.ts +0 -53
- package/dist/engine/executeOutputPlan.js +7 -2
- package/dist/engine/lib/defaultPlanResolver.d.ts +6 -0
- package/dist/engine/lib/defaultPlanResolver.js +11 -0
- package/dist/engine/lib/withGlobalLayerPlan.d.ts +2 -0
- package/dist/engine/lib/withGlobalLayerPlan.js +7 -4
- package/dist/engine/lock.d.ts +4 -0
- package/dist/engine/lock.js +82 -0
- package/dist/envelop.js +5 -4
- package/dist/error.d.ts +18 -49
- package/dist/error.js +50 -39
- package/dist/establishOperationPlan.js +57 -42
- package/dist/execute.d.ts +5 -4
- package/dist/execute.js +31 -15
- package/dist/exportAs.d.ts +1 -18
- package/dist/exportAs.js +2 -3
- package/dist/global.js +2 -3
- package/dist/grafastGraphql.d.ts +6 -1
- package/dist/grafastGraphql.js +35 -16
- package/dist/grafastPrint.d.ts +3 -0
- package/dist/grafastPrint.js +67 -6
- package/dist/graphqlCollectFields.d.ts +7 -34
- package/dist/graphqlCollectFields.js +24 -13
- package/dist/graphqlMergeSelectionSets.js +1 -2
- package/dist/index.d.ts +44 -29
- package/dist/index.js +91 -18
- package/dist/input.d.ts +1 -9
- package/dist/input.js +75 -28
- package/dist/inspect.d.ts +9 -3
- package/dist/inspect.js +3 -3
- package/dist/interfaces.d.ts +238 -93
- package/dist/interfaces.js +20 -3
- package/dist/makeGrafastSchema.d.ts +21 -9
- package/dist/makeGrafastSchema.js +353 -133
- package/dist/mermaid.d.ts +0 -17
- package/dist/mermaid.js +131 -19
- package/dist/middleware.d.ts +7 -0
- package/dist/middleware.js +24 -0
- package/dist/multistep.d.ts +19 -0
- package/dist/multistep.js +54 -0
- package/dist/operationPlan-input.d.ts +5 -4
- package/dist/operationPlan-input.js +140 -368
- package/dist/planJSONInterfaces.d.ts +12 -2
- package/dist/polymorphic.js +4 -5
- package/dist/prepare.d.ts +1 -7
- package/dist/prepare.js +100 -74
- package/dist/step.d.ts +118 -172
- package/dist/step.js +262 -183
- package/dist/steps/__flag.d.ts +65 -0
- package/dist/steps/__flag.js +261 -0
- package/dist/steps/__inputDefault.d.ts +14 -0
- package/dist/steps/__inputDefault.js +48 -0
- package/dist/steps/__inputDynamicScalar.d.ts +4 -6
- package/dist/steps/__inputDynamicScalar.js +4 -2
- package/dist/steps/__inputList.d.ts +5 -9
- package/dist/steps/__inputList.js +4 -1
- package/dist/steps/__inputObject.d.ts +7 -11
- package/dist/steps/__inputObject.js +49 -3
- package/dist/steps/__inputStaticLeaf.d.ts +2 -4
- package/dist/steps/__inputStaticLeaf.js +3 -1
- package/dist/steps/__item.d.ts +10 -12
- package/dist/steps/__item.js +8 -2
- package/dist/steps/__trackedValue.d.ts +7 -55
- package/dist/steps/__trackedValue.js +69 -8
- package/dist/steps/__value.d.ts +5 -4
- package/dist/steps/__value.js +5 -4
- package/dist/steps/access.d.ts +10 -10
- package/dist/steps/access.js +50 -17
- package/dist/steps/applyInput.d.ts +44 -0
- package/dist/steps/applyInput.js +206 -0
- package/dist/steps/applyTransforms.d.ts +2 -25
- package/dist/steps/applyTransforms.js +53 -31
- package/dist/steps/bakedInput.d.ts +23 -0
- package/dist/steps/bakedInput.js +90 -0
- package/dist/steps/condition.d.ts +31 -0
- package/dist/steps/condition.js +94 -0
- package/dist/steps/connection.d.ts +56 -42
- package/dist/steps/connection.js +97 -44
- package/dist/steps/constant.d.ts +7 -7
- package/dist/steps/constant.js +86 -7
- package/dist/steps/each.d.ts +3 -3
- package/dist/steps/each.js +2 -3
- package/dist/steps/error.d.ts +4 -4
- package/dist/steps/error.js +7 -6
- package/dist/steps/filter.d.ts +3 -2
- package/dist/steps/filter.js +1 -2
- package/dist/steps/first.d.ts +10 -9
- package/dist/steps/first.js +9 -13
- package/dist/steps/graphqlResolver.d.ts +3 -76
- package/dist/steps/graphqlResolver.js +89 -72
- package/dist/steps/groupBy.d.ts +3 -2
- package/dist/steps/groupBy.js +1 -2
- package/dist/steps/index.d.ts +12 -3
- package/dist/steps/index.js +48 -6
- package/dist/steps/lambda.d.ts +9 -9
- package/dist/steps/lambda.js +18 -9
- package/dist/steps/last.d.ts +9 -8
- package/dist/steps/last.js +7 -6
- package/dist/steps/list.d.ts +20 -9
- package/dist/steps/list.js +56 -13
- package/dist/steps/listTransform.d.ts +18 -22
- package/dist/steps/listTransform.js +58 -27
- package/dist/steps/listen.d.ts +6 -11
- package/dist/steps/listen.js +14 -16
- package/dist/steps/load.d.ts +42 -33
- package/dist/steps/load.js +60 -27
- package/dist/steps/node.d.ts +17 -10
- package/dist/steps/node.js +18 -6
- package/dist/steps/object.d.ts +33 -27
- package/dist/steps/object.js +53 -32
- package/dist/steps/partitionByIndex.d.ts +3 -2
- package/dist/steps/partitionByIndex.js +1 -2
- package/dist/steps/polymorphicBranch.d.ts +27 -0
- package/dist/steps/polymorphicBranch.js +62 -0
- package/dist/steps/proxy.d.ts +11 -12
- package/dist/steps/proxy.js +8 -5
- package/dist/steps/remapKeys.d.ts +10 -10
- package/dist/steps/remapKeys.js +14 -7
- package/dist/steps/reverse.d.ts +8 -8
- package/dist/steps/reverse.js +10 -7
- package/dist/steps/setter.d.ts +9 -18
- package/dist/steps/setter.js +24 -14
- package/dist/steps/sideEffect.d.ts +28 -0
- package/dist/steps/sideEffect.js +44 -0
- package/dist/stringifyPayload.js +1 -2
- package/dist/stripAnsi.js +2 -2
- package/dist/subscribe.d.ts +7 -1
- package/dist/subscribe.js +24 -9
- package/dist/thereCanBeOnlyOne.js +1 -1
- package/dist/timeSource.d.ts +0 -1
- package/dist/utils.d.ts +56 -55
- package/dist/utils.js +179 -59
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -8
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import type EventEmitter from "eventemitter3";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { Middleware } from "graphile-config";
|
|
3
|
+
import type { ASTNode, ExecutionArgs, FragmentDefinitionNode, GraphQLArgs, GraphQLArgument, GraphQLArgumentConfig, GraphQLField, GraphQLFieldConfig, GraphQLInputField, GraphQLInputFieldConfig, GraphQLInputObjectType, GraphQLInputType, GraphQLList, GraphQLNonNull, GraphQLOutputType, GraphQLScalarType, GraphQLSchema, GraphQLType, OperationDefinitionNode, Source, ValueNode, VariableNode } from "graphql";
|
|
4
|
+
import type { ObjMap } from "graphql/jsutils/ObjMap.js";
|
|
5
|
+
import type { Constraint } from "./constraints.js";
|
|
6
|
+
import type { LayerPlanReasonListItemStream } from "./engine/LayerPlan.js";
|
|
4
7
|
import type { OperationPlan } from "./engine/OperationPlan.js";
|
|
5
|
-
import type { SafeError } from "./error.js";
|
|
6
|
-
import type {
|
|
8
|
+
import type { FlaggedValue, SafeError } from "./error.js";
|
|
9
|
+
import type { ListCapableStep, Step } from "./step.js";
|
|
10
|
+
import type { __InputDefaultStep } from "./steps/__inputDefault.js";
|
|
7
11
|
import type { __InputDynamicScalarStep } from "./steps/__inputDynamicScalar.js";
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
12
|
+
import type { ApplyableExecutableStep } from "./steps/applyInput.js";
|
|
13
|
+
import type { __InputListStep, __InputObjectStepWithDollars, __InputStaticLeafStep, __TrackedValueStepWithDollars, ConstantStep, ObjectStep } from "./steps/index.js";
|
|
14
|
+
import type { GrafastObjectType } from "./utils.js";
|
|
10
15
|
export interface GrafastTimeouts {
|
|
11
16
|
/**
|
|
12
17
|
* How many milliseconds should we allow for planning. Remember: planning is
|
|
@@ -37,13 +42,26 @@ export declare const $$cacheByOperation: unique symbol;
|
|
|
37
42
|
export type Fragments = {
|
|
38
43
|
[key: string]: FragmentDefinitionNode;
|
|
39
44
|
};
|
|
40
|
-
export
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
45
|
+
export interface IEstablishOperationPlanResult {
|
|
46
|
+
variableValuesConstraints: Constraint[];
|
|
47
|
+
contextConstraints: Constraint[];
|
|
48
|
+
rootValueConstraints: Constraint[];
|
|
49
|
+
}
|
|
50
|
+
export interface EstablishOperationPlanResultSuccess extends IEstablishOperationPlanResult {
|
|
51
|
+
error?: never;
|
|
52
|
+
operationPlan: OperationPlan;
|
|
53
|
+
}
|
|
54
|
+
export interface EstablishOperationPlanResultError extends IEstablishOperationPlanResult {
|
|
55
|
+
error: Error | SafeError<{
|
|
56
|
+
[$$timeout]: number;
|
|
57
|
+
[$$ts]: number;
|
|
58
|
+
} | {
|
|
59
|
+
[$$timeout]?: undefined;
|
|
60
|
+
[$$ts]?: undefined;
|
|
61
|
+
} | undefined>;
|
|
62
|
+
operationPlan?: never;
|
|
63
|
+
}
|
|
64
|
+
export type EstablishOperationPlanResult = EstablishOperationPlanResultSuccess | EstablishOperationPlanResultError;
|
|
47
65
|
/**
|
|
48
66
|
* This represents the list of possible operationPlans for a specific document.
|
|
49
67
|
*
|
|
@@ -58,7 +76,7 @@ export interface CacheByOperationEntry {
|
|
|
58
76
|
* list, and if the list grows beyond a maximum size we can drop the last
|
|
59
77
|
* element.
|
|
60
78
|
*/
|
|
61
|
-
possibleOperationPlans: LinkedList<
|
|
79
|
+
possibleOperationPlans: LinkedList<EstablishOperationPlanResult> | null;
|
|
62
80
|
fragments: Fragments;
|
|
63
81
|
}
|
|
64
82
|
export interface LinkedList<T> {
|
|
@@ -84,8 +102,6 @@ export declare const $$data: unique symbol;
|
|
|
84
102
|
export declare const $$extensions: unique symbol;
|
|
85
103
|
/**
|
|
86
104
|
* The "GraphQLObjectType" type name, useful when dealing with polymorphism.
|
|
87
|
-
*
|
|
88
|
-
* @internal
|
|
89
105
|
*/
|
|
90
106
|
export declare const $$concreteType: unique symbol;
|
|
91
107
|
/**
|
|
@@ -126,10 +142,13 @@ export interface PolymorphicData<TType extends string = string, TData = any> {
|
|
|
126
142
|
export interface IndexByListItemStepId {
|
|
127
143
|
[listItemStepId: number]: number;
|
|
128
144
|
}
|
|
129
|
-
export type GrafastValuesList<
|
|
145
|
+
export type GrafastValuesList<TData> = ReadonlyArray<TData>;
|
|
130
146
|
export type PromiseOrDirect<T> = PromiseLike<T> | T;
|
|
131
|
-
export type
|
|
132
|
-
export type
|
|
147
|
+
export type ExecutionResultValue<T> = T | FlaggedValue<Error> | FlaggedValue<null>;
|
|
148
|
+
export type GrafastResultsList<TData> = ReadonlyArray<PromiseOrDirect<ExecutionResultValue<TData>>>;
|
|
149
|
+
export type GrafastResultStreamList<TStreamItem> = ReadonlyArray<PromiseOrDirect<AsyncIterable<PromiseOrDirect<ExecutionResultValue<TStreamItem>>>> | PromiseLike<never>>;
|
|
150
|
+
export type AwaitedExecutionResults<TData> = ReadonlyArray<PromiseOrDirect<ExecutionResultValue<TData> | AsyncIterable<PromiseOrDirect<ExecutionResultValue<TData extends ReadonlyArray<infer UStreamItem> ? UStreamItem : never>>>>>;
|
|
151
|
+
export type ExecutionResults<TData> = PromiseOrDirect<AwaitedExecutionResults<TData>> | PromiseLike<never>;
|
|
133
152
|
export type BaseGraphQLRootValue = any;
|
|
134
153
|
export interface BaseGraphQLVariables {
|
|
135
154
|
[key: string]: unknown;
|
|
@@ -138,17 +157,27 @@ export interface BaseGraphQLArguments {
|
|
|
138
157
|
[key: string]: any;
|
|
139
158
|
}
|
|
140
159
|
export type BaseGraphQLInputObject = BaseGraphQLArguments;
|
|
141
|
-
export type TargetStepOrCallback = ExecutableStep | ModifierStep | ((indexOrFieldName: number | string) => TargetStepOrCallback);
|
|
142
160
|
export type FieldArgs = {
|
|
143
|
-
/**
|
|
144
|
-
get
|
|
145
|
-
|
|
146
|
-
|
|
161
|
+
/** @deprecated Use bakedInput() step instead. */
|
|
162
|
+
get?: never;
|
|
163
|
+
getRaw(path?: string | ReadonlyArray<string | number>): AnyInputStep | ObjectStep<{
|
|
164
|
+
[argName: string]: AnyInputStep;
|
|
165
|
+
}>;
|
|
166
|
+
typeAt(path: string | ReadonlyArray<string | number>): GraphQLInputType;
|
|
147
167
|
/** This also works (without path) to apply each list entry against $target */
|
|
148
|
-
apply($target:
|
|
168
|
+
apply<TArg extends object>($target: ApplyableExecutableStep<TArg>, path?: string | ReadonlyArray<string | number>, getTargetFromParent?: (parent: TArg, inputValue: any) => object | undefined): void;
|
|
169
|
+
apply<TArg extends object>($target: ApplyableExecutableStep<TArg>, getTargetFromParent: (parent: TArg, inputValue: any) => object | undefined, justTargetFromParent?: never): void;
|
|
149
170
|
} & AnyInputStepDollars;
|
|
150
|
-
export type
|
|
151
|
-
|
|
171
|
+
export type FieldArg = {
|
|
172
|
+
/** @deprecated Use bakedInput() step instead. */
|
|
173
|
+
get?: never;
|
|
174
|
+
getRaw(path?: string | ReadonlyArray<string | number>): AnyInputStep;
|
|
175
|
+
typeAt(path: string | ReadonlyArray<string | number>): GraphQLInputType;
|
|
176
|
+
/** This also works (without path) to apply each list entry against $target */
|
|
177
|
+
apply<TArg extends object>($target: ApplyableExecutableStep<TArg>, path?: string | ReadonlyArray<string | number>, getTargetFromParent?: (parent: TArg, inputValue: any) => object | undefined): void;
|
|
178
|
+
apply<TArg extends object>($target: ApplyableExecutableStep<TArg>, getTargetFromParent: (parent: TArg, inputValue: any) => object | undefined, justTargetFromParent?: never): void;
|
|
179
|
+
};
|
|
180
|
+
export type AnyInputStep = __TrackedValueStepWithDollars<any, GraphQLInputType> | __InputListStep | __InputStaticLeafStep | __InputDynamicScalarStep | __InputObjectStepWithDollars<GraphQLInputObjectType> | __InputDefaultStep | ConstantStep<any>;
|
|
152
181
|
export type AnyInputStepWithDollars = AnyInputStep & AnyInputStepDollars;
|
|
153
182
|
/**
|
|
154
183
|
* Lies to make it easier to write TypeScript code like
|
|
@@ -159,6 +188,7 @@ export type AnyInputStepDollars = {
|
|
|
159
188
|
[key in string as `$${key}`]: AnyInputStepWithDollars;
|
|
160
189
|
};
|
|
161
190
|
export interface FieldInfo {
|
|
191
|
+
fieldName: string;
|
|
162
192
|
field: GraphQLField<any, any, any>;
|
|
163
193
|
schema: GraphQLSchema;
|
|
164
194
|
}
|
|
@@ -179,52 +209,36 @@ export interface FieldInfo {
|
|
|
179
209
|
* We're using `TrackedObject<...>` so we can later consider caching these
|
|
180
210
|
* executions.
|
|
181
211
|
*/
|
|
182
|
-
export type FieldPlanResolver<_TArgs extends BaseGraphQLArguments, TParentStep extends
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
* (from an argument, or from a parent input object) or null if none, and an
|
|
186
|
-
* input plan that represents the value the user will pass to this field. The
|
|
187
|
-
* resolver must return either a ModifierStep or null.
|
|
188
|
-
*/
|
|
189
|
-
export type InputObjectFieldInputPlanResolver<TResultStep extends ExecutableStep = ExecutableStep> = (input: FieldArgs, info: {
|
|
212
|
+
export type FieldPlanResolver<_TArgs extends BaseGraphQLArguments, TParentStep extends Step | null, TResultStep extends Step | null> = ($parentPlan: TParentStep, args: FieldArgs, info: FieldInfo) => TResultStep;
|
|
213
|
+
export type InputObjectFieldApplyResolver<TParent> = (target: TParent, input: any, // Don't use unknown here, otherwise users can't easily cast it
|
|
214
|
+
info: {
|
|
190
215
|
schema: GraphQLSchema;
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
entity: GraphQLInputField;
|
|
196
|
-
}) => TResultStep;
|
|
197
|
-
export type InputObjectTypeInputPlanResolver = (input: FieldArgs, info: {
|
|
216
|
+
fieldName: string;
|
|
217
|
+
field: GraphQLInputField;
|
|
218
|
+
}) => any;
|
|
219
|
+
export type InputObjectTypeBakedInfo = {
|
|
198
220
|
schema: GraphQLSchema;
|
|
199
221
|
type: GraphQLInputObjectType;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
* the field plan (the plan that represents the field the arg is defined on)
|
|
205
|
-
* and an input plan that represents the value the user will pass to this
|
|
206
|
-
* argument. The resolver must return either a ModifierStep or null.
|
|
207
|
-
*/
|
|
208
|
-
export type ArgumentInputPlanResolver<TParentStep extends ExecutableStep = ExecutableStep, TResultStep extends ExecutableStep = ExecutableStep> = ($parentPlan: TParentStep, input: FieldArgs, info: {
|
|
209
|
-
schema: GraphQLSchema;
|
|
210
|
-
entity: GraphQLArgument;
|
|
211
|
-
}) => TResultStep;
|
|
212
|
-
export type ArgumentApplyPlanResolver<TParentStep extends ExecutableStep = ExecutableStep, TFieldStep extends ExecutableStep | ModifierStep<any> = ExecutableStep | ModifierStep<any>, TResultStep extends ExecutableStep | ModifierStep<ExecutableStep | ModifierStep> | null | void = ExecutableStep | ModifierStep<ExecutableStep | ModifierStep> | null | void> = ($parentPlan: TParentStep, $fieldPlan: TFieldStep, input: FieldArgs, info: {
|
|
222
|
+
applyChildren(val: any): void;
|
|
223
|
+
};
|
|
224
|
+
export type InputObjectTypeBakedResolver = (input: Record<string, any>, info: InputObjectTypeBakedInfo) => any;
|
|
225
|
+
export type ArgumentApplyPlanResolver<TParentStep extends Step = Step, TFieldStep extends Step = Step> = ($parentPlan: TParentStep, $fieldPlan: TFieldStep, input: FieldArg, info: {
|
|
213
226
|
schema: GraphQLSchema;
|
|
214
|
-
|
|
215
|
-
|
|
227
|
+
arg: GraphQLArgument;
|
|
228
|
+
argName: string;
|
|
229
|
+
}) => void;
|
|
216
230
|
/**
|
|
217
231
|
* GraphQLScalarTypes can have plans, these are passed the field plan and must
|
|
218
232
|
* return an executable plan.
|
|
219
233
|
*/
|
|
220
|
-
export type ScalarPlanResolver<TParentStep extends
|
|
234
|
+
export type ScalarPlanResolver<TParentStep extends Step = Step, TResultStep extends Step = Step> = ($parentPlan: TParentStep, info: {
|
|
221
235
|
schema: GraphQLSchema;
|
|
222
236
|
}) => TResultStep;
|
|
223
237
|
/**
|
|
224
238
|
* GraphQLScalarTypes can have plans, these are passed the field plan and must
|
|
225
239
|
* return an executable plan.
|
|
226
240
|
*/
|
|
227
|
-
export type ScalarInputPlanResolver<TResultStep extends
|
|
241
|
+
export type ScalarInputPlanResolver<TResultStep extends Step = Step> = ($inputValue: AnyInputStep, info: {
|
|
228
242
|
schema: GraphQLSchema;
|
|
229
243
|
type: GraphQLScalarType;
|
|
230
244
|
}) => TResultStep;
|
|
@@ -235,50 +249,48 @@ export type ScalarInputPlanResolver<TResultStep extends ExecutableStep = Executa
|
|
|
235
249
|
* subclasses of ExecutableStep but TypeScript only wants to allow
|
|
236
250
|
* superclasses.
|
|
237
251
|
*
|
|
238
|
-
* @
|
|
252
|
+
* @experimental
|
|
239
253
|
*/
|
|
240
|
-
export type
|
|
241
|
-
type OutputPlanForNamedType<TType extends GraphQLType> = TType extends GrafastObjectType<
|
|
242
|
-
export type OutputPlanForType<TType extends GraphQLOutputType> = TType extends GraphQLNonNull<GraphQLList<GraphQLNonNull<infer U>>> ? ListCapableStep<any, OutputPlanForNamedType<U>> |
|
|
243
|
-
type InputPlanForNamedType<TType extends GraphQLType> = TType extends GrafastInputObjectType<any, infer U, any> ? U : ModifierStep<any>;
|
|
244
|
-
type InputPlanForType<TType extends GraphQLInputType> = TType extends GraphQLNonNull<GraphQLList<GraphQLNonNull<infer U>>> ? InputPlanForNamedType<U> : TType extends GraphQLNonNull<GraphQLList<infer U>> ? InputPlanForNamedType<U> : TType extends GraphQLList<GraphQLNonNull<infer U>> ? InputPlanForNamedType<U> : TType extends GraphQLList<infer U> ? InputPlanForNamedType<U> : TType extends GraphQLNonNull<infer U> ? InputPlanForNamedType<U> : InputPlanForNamedType<TType>;
|
|
245
|
-
type InputTypeForNamedType<TType extends GraphQLType> = TType extends GraphQLScalarType<infer U> ? U : any;
|
|
246
|
-
type InputTypeFor<TType extends GraphQLInputType> = TType extends GraphQLNonNull<GraphQLList<GraphQLNonNull<infer U>>> ? InputTypeForNamedType<U> : TType extends GraphQLNonNull<GraphQLList<infer U>> ? InputTypeForNamedType<U> : TType extends GraphQLList<GraphQLNonNull<infer U>> ? InputTypeForNamedType<U> : TType extends GraphQLList<infer U> ? InputTypeForNamedType<U> : TType extends GraphQLNonNull<infer U> ? InputTypeForNamedType<U> : InputTypeForNamedType<TType>;
|
|
254
|
+
export type EnumValueApplyResolver<TParent = any> = (parent: TParent) => void;
|
|
255
|
+
type OutputPlanForNamedType<TType extends GraphQLType> = TType extends GrafastObjectType<infer TStep, any> ? TStep : Step;
|
|
256
|
+
export type OutputPlanForType<TType extends GraphQLOutputType> = TType extends GraphQLNonNull<GraphQLList<GraphQLNonNull<infer U>>> ? ListCapableStep<any, OutputPlanForNamedType<U>> | Step<ReadonlyArray<any>> : TType extends GraphQLNonNull<GraphQLList<infer U>> ? ListCapableStep<any, OutputPlanForNamedType<U>> | Step<ReadonlyArray<any>> : TType extends GraphQLList<GraphQLNonNull<infer U>> ? ListCapableStep<any, OutputPlanForNamedType<U>> | Step<ReadonlyArray<any>> : TType extends GraphQLList<infer U> ? ListCapableStep<any, OutputPlanForNamedType<U>> | Step<ReadonlyArray<any>> : TType extends GraphQLNonNull<infer U> ? OutputPlanForNamedType<U> : OutputPlanForNamedType<TType>;
|
|
247
257
|
/**
|
|
248
258
|
* Basically GraphQLFieldConfig but with an easy to access `plan` method.
|
|
249
259
|
*/
|
|
250
|
-
export type GrafastFieldConfig<TType extends GraphQLOutputType,
|
|
260
|
+
export type GrafastFieldConfig<TType extends GraphQLOutputType, TParentStep extends Step | null, TFieldStep extends Step, // TODO: should be OutputPlanForType<TType>, but that results in everything thinking it should be a ListStep
|
|
251
261
|
TArgs extends BaseGraphQLArguments> = Omit<GraphQLFieldConfig<any, any>, "args" | "type"> & {
|
|
252
262
|
type: TType;
|
|
253
263
|
plan?: FieldPlanResolver<TArgs, TParentStep, TFieldStep>;
|
|
254
264
|
subscribePlan?: FieldPlanResolver<TArgs, TParentStep, TFieldStep>;
|
|
255
|
-
args?: GrafastFieldConfigArgumentMap
|
|
265
|
+
args?: GrafastFieldConfigArgumentMap;
|
|
256
266
|
};
|
|
257
267
|
/**
|
|
258
268
|
* Basically GraphQLFieldConfigArgumentMap but allowing for args to have plans.
|
|
259
269
|
*/
|
|
260
|
-
export type GrafastFieldConfigArgumentMap
|
|
261
|
-
[argName: string]: GrafastArgumentConfig
|
|
270
|
+
export type GrafastFieldConfigArgumentMap = {
|
|
271
|
+
[argName: string]: GrafastArgumentConfig;
|
|
262
272
|
};
|
|
263
273
|
/**
|
|
264
274
|
* Basically GraphQLArgumentConfig but allowing for a plan.
|
|
265
275
|
*/
|
|
266
|
-
export type GrafastArgumentConfig<TInputType extends GraphQLInputType = GraphQLInputType, _TContext extends Grafast.Context = Grafast.Context, _TParentStep extends
|
|
276
|
+
export type GrafastArgumentConfig<TInputType extends GraphQLInputType = GraphQLInputType, _TContext extends Grafast.Context = Grafast.Context, _TParentStep extends Step | null = Step | null> = Omit<GraphQLArgumentConfig, "type"> & {
|
|
267
277
|
type: TInputType;
|
|
268
|
-
inputPlan?: ArgumentInputPlanResolver<any>;
|
|
269
278
|
applyPlan?: ArgumentApplyPlanResolver<any, any>;
|
|
270
|
-
|
|
271
|
-
|
|
279
|
+
applySubscribePlan?: ArgumentApplyPlanResolver<any, any>;
|
|
280
|
+
inputPlan?: never;
|
|
281
|
+
autoApplyAfterParentPlan?: never;
|
|
282
|
+
autoApplyAfterParentSubscribePlan?: never;
|
|
272
283
|
};
|
|
273
284
|
/**
|
|
274
285
|
* Basically GraphQLInputFieldConfig but allowing for the field to have a plan.
|
|
275
286
|
*/
|
|
276
|
-
export type GrafastInputFieldConfig<
|
|
287
|
+
export type GrafastInputFieldConfig<TParent = any, TInputType extends GraphQLInputType = GraphQLInputType> = Omit<GraphQLInputFieldConfig, "type"> & {
|
|
277
288
|
type: TInputType;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
289
|
+
apply?: InputObjectFieldApplyResolver<TParent>;
|
|
290
|
+
inputPlan?: never;
|
|
291
|
+
applyPlan?: never;
|
|
292
|
+
autoApplyAfterParentInputPlan?: never;
|
|
293
|
+
autoApplyAfterParentApplyPlan?: never;
|
|
282
294
|
};
|
|
283
295
|
/**
|
|
284
296
|
* The args passed to a field plan resolver, the values are plans.
|
|
@@ -289,8 +301,7 @@ export type TrackedArguments<TArgs extends BaseGraphQLArguments = BaseGraphQLArg
|
|
|
289
301
|
/**
|
|
290
302
|
* `@stream` directive meta.
|
|
291
303
|
*/
|
|
292
|
-
export interface StepStreamOptions {
|
|
293
|
-
initialCount: number;
|
|
304
|
+
export interface StepStreamOptions extends LayerPlanReasonListItemStream {
|
|
294
305
|
}
|
|
295
306
|
/**
|
|
296
307
|
* Additional details about the planning for a field; currently only relates to
|
|
@@ -301,12 +312,23 @@ export interface StepOptions {
|
|
|
301
312
|
* Details for the `@stream` directive.
|
|
302
313
|
*/
|
|
303
314
|
stream: StepStreamOptions | null;
|
|
315
|
+
/**
|
|
316
|
+
* Should we walk an iterable if presented. This is important because we
|
|
317
|
+
* don't want to walk things like Map/Set except if we're doing it as part of
|
|
318
|
+
* a list step.
|
|
319
|
+
*/
|
|
320
|
+
walkIterable: boolean;
|
|
304
321
|
}
|
|
305
322
|
/**
|
|
306
323
|
* Options passed to the `optimize` method of a plan to give more context.
|
|
307
324
|
*/
|
|
308
325
|
export interface StepOptimizeOptions {
|
|
309
|
-
|
|
326
|
+
/**
|
|
327
|
+
* If null, this step will not stream. If non-null, this step _might_ stream,
|
|
328
|
+
* but it's not guaranteed - it may be dependent on user variables, e.g. the
|
|
329
|
+
* `if` parameter.
|
|
330
|
+
*/
|
|
331
|
+
stream: null | {};
|
|
310
332
|
meta: Record<string, unknown> | undefined;
|
|
311
333
|
}
|
|
312
334
|
/**
|
|
@@ -335,7 +357,7 @@ export interface NodeIdCodec<T = any> {
|
|
|
335
357
|
* Determines if a NodeID relates to a given object type, and also relates to
|
|
336
358
|
* encoding the NodeID for that type.
|
|
337
359
|
*/
|
|
338
|
-
export type NodeIdHandler<TCodec extends NodeIdCodec<any> = NodeIdCodec<any>, TNodeStep extends
|
|
360
|
+
export type NodeIdHandler<TIdentifiers extends readonly any[] = readonly any[], TCodec extends NodeIdCodec<any> = NodeIdCodec<any>, TNodeStep extends Step = Step, TSpec = any> = {
|
|
339
361
|
/**
|
|
340
362
|
* The name of the object type this handler is for.
|
|
341
363
|
*/
|
|
@@ -348,11 +370,16 @@ export type NodeIdHandler<TCodec extends NodeIdCodec<any> = NodeIdCodec<any>, TN
|
|
|
348
370
|
* Returns true if the given decoded Node ID value represents this type.
|
|
349
371
|
*/
|
|
350
372
|
match(specifier: TCodec extends NodeIdCodec<infer U> ? U : any): boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Returns the underlying identifiers extracted from the decoded NodeID
|
|
375
|
+
* value.
|
|
376
|
+
*/
|
|
377
|
+
getIdentifiers(value: TCodec extends NodeIdCodec<infer U> ? U : any): TIdentifiers;
|
|
351
378
|
/**
|
|
352
379
|
* Returns a plan that returns the value ready to be encoded. When the result
|
|
353
380
|
* of this plan is fed into `match`, it should return `true`.
|
|
354
381
|
*/
|
|
355
|
-
plan($thing: TNodeStep):
|
|
382
|
+
plan($thing: TNodeStep): Step<TCodec extends NodeIdCodec<infer U> ? U : any>;
|
|
356
383
|
/**
|
|
357
384
|
* Returns a specification based on the Node ID, this can be in any format
|
|
358
385
|
* you like. It is intended to then be fed into `get` or handled in your own
|
|
@@ -360,7 +387,7 @@ export type NodeIdHandler<TCodec extends NodeIdCodec<any> = NodeIdCodec<any>, TN
|
|
|
360
387
|
* referencing a node without actually fetching it - e.g. allowing you to
|
|
361
388
|
* delete a node by its ID without first fetching it.)
|
|
362
389
|
*/
|
|
363
|
-
getSpec(plan:
|
|
390
|
+
getSpec(plan: Step<TCodec extends NodeIdCodec<infer U> ? U : any>): TSpec;
|
|
364
391
|
/**
|
|
365
392
|
* Combined with `getSpec`, this forms the recprocal of `plan`; i.e.
|
|
366
393
|
* `get(getSpec( plan(node) ))` should return a plan that results in the
|
|
@@ -393,16 +420,80 @@ export type ExecutionEventMap = {
|
|
|
393
420
|
};
|
|
394
421
|
};
|
|
395
422
|
export type ExecutionEventEmitter = TypedEventEmitter<ExecutionEventMap>;
|
|
396
|
-
export interface
|
|
423
|
+
export interface ExecutionExtraBase {
|
|
397
424
|
/** The `performance.now()` at which your step should stop executing */
|
|
398
425
|
stopTime: number | null;
|
|
399
426
|
/** If you have set a `metaKey` on your step, the relevant meta object which you can write into (e.g. for caching) */
|
|
400
427
|
meta: Record<string, unknown> | undefined;
|
|
401
428
|
eventEmitter: ExecutionEventEmitter | undefined;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
429
|
+
}
|
|
430
|
+
export interface ExecutionExtra extends ExecutionExtraBase {
|
|
431
|
+
}
|
|
432
|
+
export interface UnbatchedExecutionExtra extends ExecutionExtraBase {
|
|
433
|
+
stream: ExecutionDetailsStream | null;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* A bitwise number representing a number of flags:
|
|
437
|
+
*
|
|
438
|
+
* - 0: normal execution value
|
|
439
|
+
* - 1: errored (trappable)
|
|
440
|
+
* - 2: null (trappable)
|
|
441
|
+
* - 4: inhibited (trappable)
|
|
442
|
+
* - 8: disabled due to polymorphism (untrappable)
|
|
443
|
+
* - 16: stopped (untrappable) - e.g. due to fatal (unrecoverable) error
|
|
444
|
+
* - 32: ...
|
|
445
|
+
*/
|
|
446
|
+
export type ExecutionEntryFlags = number & {
|
|
447
|
+
readonly tsBrand?: unique symbol;
|
|
448
|
+
};
|
|
449
|
+
export declare const NO_FLAGS: ExecutionEntryFlags;
|
|
450
|
+
export declare const FLAG_ERROR: ExecutionEntryFlags;
|
|
451
|
+
export declare const FLAG_NULL: ExecutionEntryFlags;
|
|
452
|
+
export declare const FLAG_INHIBITED: ExecutionEntryFlags;
|
|
453
|
+
export declare const FLAG_POLY_SKIPPED: ExecutionEntryFlags;
|
|
454
|
+
export declare const FLAG_STOPPED: ExecutionEntryFlags;
|
|
455
|
+
export declare const ALL_FLAGS: ExecutionEntryFlags;
|
|
456
|
+
/** By default, accept null values as an input */
|
|
457
|
+
export declare const DEFAULT_ACCEPT_FLAGS: ExecutionEntryFlags;
|
|
458
|
+
export declare const TRAPPABLE_FLAGS: ExecutionEntryFlags;
|
|
459
|
+
export declare const DEFAULT_FORBIDDEN_FLAGS: ExecutionEntryFlags;
|
|
460
|
+
export declare const FORBIDDEN_BY_NULLABLE_BOUNDARY_FLAGS: ExecutionEntryFlags;
|
|
461
|
+
export type ExecutionValue<TData = any> = BatchExecutionValue<TData> | UnaryExecutionValue<TData>;
|
|
462
|
+
interface ExecutionValueBase<TData = any> {
|
|
463
|
+
at(i: number): TData;
|
|
464
|
+
isBatch: boolean;
|
|
465
|
+
/** Returns this.value for a unary execution value; throws if non-unary */
|
|
466
|
+
unaryValue(): TData;
|
|
467
|
+
}
|
|
468
|
+
export interface BatchExecutionValue<TData = any> extends ExecutionValueBase<TData> {
|
|
469
|
+
isBatch: true;
|
|
470
|
+
entries: ReadonlyArray<TData>;
|
|
471
|
+
/** Always throws, since this should only be called on unary execution values */
|
|
472
|
+
unaryValue(): never;
|
|
473
|
+
}
|
|
474
|
+
export interface UnaryExecutionValue<TData = any> extends ExecutionValueBase<TData> {
|
|
475
|
+
isBatch: false;
|
|
476
|
+
value: TData;
|
|
477
|
+
/** Same as getting .value */
|
|
478
|
+
unaryValue(): TData;
|
|
479
|
+
}
|
|
480
|
+
export type IndexMap = <T>(callback: (i: number) => T) => ReadonlyArray<T>;
|
|
481
|
+
export type IndexForEach = (callback: (i: number) => any) => void;
|
|
482
|
+
export interface ExecutionDetailsStream {
|
|
483
|
+
initialCount: number;
|
|
484
|
+
}
|
|
485
|
+
export interface ExecutionDetails<TDeps extends readonly [...any[]] = readonly [...any[]]> {
|
|
486
|
+
count: number;
|
|
487
|
+
indexMap: IndexMap;
|
|
488
|
+
indexForEach: IndexForEach;
|
|
489
|
+
values: {
|
|
490
|
+
[DepIdx in keyof TDeps]: ExecutionValue<TDeps[DepIdx]>;
|
|
491
|
+
} & {
|
|
492
|
+
length: TDeps["length"];
|
|
493
|
+
map: ReadonlyArray<ExecutionValue<TDeps[number]>>["map"];
|
|
494
|
+
};
|
|
495
|
+
extra: ExecutionExtra;
|
|
496
|
+
stream: ExecutionDetailsStream | null;
|
|
406
497
|
}
|
|
407
498
|
export interface LocationDetails {
|
|
408
499
|
node: ASTNode | readonly ASTNode[];
|
|
@@ -411,8 +502,8 @@ export interface LocationDetails {
|
|
|
411
502
|
/** This should only be null for the root selection */
|
|
412
503
|
fieldName: string | null;
|
|
413
504
|
}
|
|
414
|
-
export type UnwrapPlanTuple</* const */ TIn extends readonly
|
|
415
|
-
[Index in keyof TIn]: TIn[Index]
|
|
505
|
+
export type UnwrapPlanTuple</* const */ TIn extends readonly Step[]> = {
|
|
506
|
+
[Index in keyof TIn]: DataFromStep<TIn[Index]>;
|
|
416
507
|
};
|
|
417
508
|
export type NotVariableValueNode = Exclude<ValueNode, VariableNode>;
|
|
418
509
|
export type StreamMaybeMoreableArray<T = any> = Array<T> & {
|
|
@@ -424,7 +515,61 @@ export type StreamMoreableArray<T = any> = Array<T> & {
|
|
|
424
515
|
export interface GrafastArgs extends GraphQLArgs {
|
|
425
516
|
resolvedPreset?: GraphileConfig.ResolvedPreset;
|
|
426
517
|
requestContext?: Partial<Grafast.RequestContext>;
|
|
518
|
+
middleware?: Middleware<GraphileConfig.GrafastMiddleware> | null;
|
|
427
519
|
}
|
|
428
520
|
export type Maybe<T> = T | null | undefined;
|
|
429
521
|
export * from "./planJSONInterfaces.js";
|
|
522
|
+
export interface AddDependencyOptions<TStep extends Step = Step> {
|
|
523
|
+
step: TStep;
|
|
524
|
+
skipDeduplication?: boolean;
|
|
525
|
+
/** @defaultValue `FLAG_NULL` */
|
|
526
|
+
acceptFlags?: ExecutionEntryFlags;
|
|
527
|
+
onReject?: Maybe<Error>;
|
|
528
|
+
nonUnaryMessage?: ($dependent: Step, $dependency: Step) => string;
|
|
529
|
+
}
|
|
530
|
+
export interface DependencyOptions<TStep extends Step = Step> {
|
|
531
|
+
step: TStep;
|
|
532
|
+
acceptFlags: ExecutionEntryFlags;
|
|
533
|
+
onReject: Maybe<Error>;
|
|
534
|
+
}
|
|
535
|
+
export type DataFromStep<TStep extends Step> = TStep extends Step<infer TData> ? TData : never;
|
|
536
|
+
export interface GrafastExecutionArgs extends ExecutionArgs {
|
|
537
|
+
resolvedPreset?: GraphileConfig.ResolvedPreset;
|
|
538
|
+
middleware?: Middleware<GraphileConfig.GrafastMiddleware> | null;
|
|
539
|
+
requestContext?: Partial<Grafast.RequestContext>;
|
|
540
|
+
outputDataAsString?: boolean;
|
|
541
|
+
}
|
|
542
|
+
export interface ValidateSchemaEvent {
|
|
543
|
+
resolvedPreset: GraphileConfig.ResolvedPreset;
|
|
544
|
+
schema: GraphQLSchema;
|
|
545
|
+
}
|
|
546
|
+
export interface ParseAndValidateEvent {
|
|
547
|
+
resolvedPreset: GraphileConfig.ResolvedPreset;
|
|
548
|
+
schema: GraphQLSchema;
|
|
549
|
+
source: string | Source;
|
|
550
|
+
}
|
|
551
|
+
export interface PrepareArgsEvent {
|
|
552
|
+
args: Grafast.ExecutionArgs;
|
|
553
|
+
}
|
|
554
|
+
export interface ExecuteEvent {
|
|
555
|
+
args: GrafastExecutionArgs;
|
|
556
|
+
}
|
|
557
|
+
export interface SubscribeEvent {
|
|
558
|
+
args: GrafastExecutionArgs;
|
|
559
|
+
}
|
|
560
|
+
export interface EstablishOperationPlanEvent {
|
|
561
|
+
schema: GraphQLSchema;
|
|
562
|
+
operation: OperationDefinitionNode;
|
|
563
|
+
fragments: ObjMap<FragmentDefinitionNode>;
|
|
564
|
+
variableValues: Record<string, any>;
|
|
565
|
+
context: any;
|
|
566
|
+
rootValue: any;
|
|
567
|
+
planningTimeout: number | undefined;
|
|
568
|
+
args: GrafastExecutionArgs;
|
|
569
|
+
}
|
|
570
|
+
export interface ExecuteStepEvent {
|
|
571
|
+
args: GrafastExecutionArgs;
|
|
572
|
+
step: Step;
|
|
573
|
+
executeDetails: ExecutionDetails;
|
|
574
|
+
}
|
|
430
575
|
//# sourceMappingURL=interfaces.d.ts.map
|
package/dist/interfaces.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.$$ts = exports.$$timeout = exports.$$subroutine = exports.$$safeError = exports.$$proxy = exports.$$streamMore = exports.$$eventEmitter = exports.$$idempotent = exports.$$concreteType = exports.$$extensions = exports.$$data = exports.$$bypassGraphQL = exports.$$verbatim = exports.$$id = exports.$$planResults = exports.$$grafastContext = exports.$$hooked = exports.$$cacheByOperation = exports.$$queryCache = void 0;
|
|
3
|
+
exports.$$deepDepSkip = exports.FORBIDDEN_BY_NULLABLE_BOUNDARY_FLAGS = exports.DEFAULT_FORBIDDEN_FLAGS = exports.TRAPPABLE_FLAGS = exports.DEFAULT_ACCEPT_FLAGS = exports.ALL_FLAGS = exports.FLAG_STOPPED = exports.FLAG_POLY_SKIPPED = exports.FLAG_INHIBITED = exports.FLAG_NULL = exports.FLAG_ERROR = exports.NO_FLAGS = exports.$$ts = exports.$$timeout = exports.$$subroutine = exports.$$safeError = exports.$$proxy = exports.$$streamMore = exports.$$eventEmitter = exports.$$idempotent = exports.$$concreteType = exports.$$extensions = exports.$$data = exports.$$bypassGraphQL = exports.$$verbatim = exports.$$id = exports.$$planResults = exports.$$grafastContext = exports.$$hooked = exports.$$cacheByOperation = exports.$$queryCache = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
exports.$$queryCache = Symbol("queryCache");
|
|
6
6
|
/**
|
|
@@ -28,8 +28,6 @@ exports.$$data = Symbol("data");
|
|
|
28
28
|
exports.$$extensions = Symbol("extensions");
|
|
29
29
|
/**
|
|
30
30
|
* The "GraphQLObjectType" type name, useful when dealing with polymorphism.
|
|
31
|
-
*
|
|
32
|
-
* @internal
|
|
33
31
|
*/
|
|
34
32
|
exports.$$concreteType = Symbol("concreteType");
|
|
35
33
|
/**
|
|
@@ -59,5 +57,24 @@ exports.$$subroutine = Symbol("subroutine");
|
|
|
59
57
|
exports.$$timeout = Symbol("timeout");
|
|
60
58
|
/** For tracking _when_ the timeout happened (because once the JIT has warmed it might not need so long) */
|
|
61
59
|
exports.$$ts = Symbol("timestamp");
|
|
60
|
+
function flag(f) {
|
|
61
|
+
return f;
|
|
62
|
+
}
|
|
63
|
+
exports.NO_FLAGS = flag(0);
|
|
64
|
+
exports.FLAG_ERROR = flag(1 << 0);
|
|
65
|
+
exports.FLAG_NULL = flag(1 << 1);
|
|
66
|
+
exports.FLAG_INHIBITED = flag(1 << 2);
|
|
67
|
+
exports.FLAG_POLY_SKIPPED = flag(1 << 3);
|
|
68
|
+
exports.FLAG_STOPPED = flag(1 << 4);
|
|
69
|
+
exports.ALL_FLAGS = flag(exports.FLAG_ERROR | exports.FLAG_NULL | exports.FLAG_INHIBITED | exports.FLAG_POLY_SKIPPED | exports.FLAG_STOPPED);
|
|
70
|
+
/** By default, accept null values as an input */
|
|
71
|
+
exports.DEFAULT_ACCEPT_FLAGS = flag(exports.FLAG_NULL);
|
|
72
|
+
exports.TRAPPABLE_FLAGS = flag(exports.FLAG_ERROR | exports.FLAG_NULL | exports.FLAG_INHIBITED);
|
|
73
|
+
exports.DEFAULT_FORBIDDEN_FLAGS = flag(exports.ALL_FLAGS & ~exports.DEFAULT_ACCEPT_FLAGS);
|
|
74
|
+
exports.FORBIDDEN_BY_NULLABLE_BOUNDARY_FLAGS = flag(exports.FLAG_NULL | exports.FLAG_POLY_SKIPPED);
|
|
62
75
|
tslib_1.__exportStar(require("./planJSONInterfaces.js"), exports);
|
|
76
|
+
/**
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
exports.$$deepDepSkip = Symbol("deepDepSkip_experimental");
|
|
63
80
|
//# sourceMappingURL=interfaces.js.map
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { GraphQLFieldResolver, GraphQLScalarLiteralParser, GraphQLScalarSerializer, GraphQLScalarValueParser
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import type { GraphQLFieldResolver, GraphQLScalarLiteralParser, GraphQLScalarSerializer, GraphQLScalarValueParser } from "graphql";
|
|
2
|
+
import { GraphQLSchema } from "graphql";
|
|
3
|
+
import * as graphql from "graphql";
|
|
4
|
+
import type { ArgumentApplyPlanResolver, EnumValueApplyResolver, FieldPlanResolver, InputObjectFieldApplyResolver, InputObjectTypeBakedResolver, ScalarPlanResolver } from "./interfaces.js";
|
|
5
|
+
import type { Step } from "./step.js";
|
|
4
6
|
/**
|
|
5
7
|
* When defining a field with `typeDefs/plans` you can declare the field plan
|
|
6
8
|
* directly, or you can define a configuration object that accepts the plan and
|
|
@@ -12,15 +14,19 @@ export type FieldPlans = FieldPlanResolver<any, any, any> | {
|
|
|
12
14
|
resolve?: GraphQLFieldResolver<any, any>;
|
|
13
15
|
subscribe?: GraphQLFieldResolver<any, any>;
|
|
14
16
|
args?: {
|
|
15
|
-
[argName: string]:
|
|
17
|
+
[argName: string]: ArgumentApplyPlanResolver | {
|
|
18
|
+
applyPlan?: ArgumentApplyPlanResolver;
|
|
19
|
+
applySubscribePlan?: ArgumentApplyPlanResolver;
|
|
20
|
+
extensions?: graphql.GraphQLArgumentExtensions;
|
|
21
|
+
};
|
|
16
22
|
};
|
|
17
23
|
};
|
|
18
24
|
/**
|
|
19
25
|
* The plans/config for each field of a GraphQL object type.
|
|
20
26
|
*/
|
|
21
27
|
export type ObjectPlans = {
|
|
22
|
-
|
|
23
|
-
new (...args: any[]):
|
|
28
|
+
__assertStep?: ((step: Step) => asserts step is Step) | {
|
|
29
|
+
new (...args: any[]): Step;
|
|
24
30
|
};
|
|
25
31
|
} & {
|
|
26
32
|
[fieldName: string]: FieldPlans;
|
|
@@ -29,7 +35,12 @@ export type ObjectPlans = {
|
|
|
29
35
|
* The plans for each field of a GraphQL input object type.
|
|
30
36
|
*/
|
|
31
37
|
export type InputObjectPlans = {
|
|
32
|
-
|
|
38
|
+
__baked?: InputObjectTypeBakedResolver;
|
|
39
|
+
} & {
|
|
40
|
+
[fieldName: string]: InputObjectFieldApplyResolver<any> | {
|
|
41
|
+
apply?: InputObjectFieldApplyResolver<any>;
|
|
42
|
+
extensions?: graphql.GraphQLInputFieldExtensions;
|
|
43
|
+
};
|
|
33
44
|
};
|
|
34
45
|
/**
|
|
35
46
|
* The plan config for an interface or union type.
|
|
@@ -50,9 +61,10 @@ export type ScalarPlans = {
|
|
|
50
61
|
* The values/configs for the entries in a GraphQL enum type.
|
|
51
62
|
*/
|
|
52
63
|
export type EnumPlans = {
|
|
53
|
-
[enumValueName: string]:
|
|
64
|
+
[enumValueName: string]: EnumValueApplyResolver | string | number | boolean | {
|
|
54
65
|
value?: unknown;
|
|
55
|
-
|
|
66
|
+
extensions?: graphql.GraphQLEnumValueExtensions;
|
|
67
|
+
apply?: EnumValueApplyResolver;
|
|
56
68
|
};
|
|
57
69
|
};
|
|
58
70
|
/**
|