grafast 0.0.1-alpha.13 → 0.0.1-alpha.15
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/dist/args.d.ts +7 -5
- package/dist/assert.d.ts +2 -0
- package/dist/bucket.d.ts +64 -0
- package/dist/constraints.d.ts +31 -0
- package/dist/deferred.d.ts +7 -0
- package/dist/dev.d.ts +3 -0
- package/dist/engine/LayerPlan.d.ts +131 -0
- package/dist/engine/OperationPlan.d.ts +151 -0
- package/dist/engine/OutputPlan.d.ts +105 -1
- package/dist/engine/StepTracker.d.ts +53 -0
- package/dist/engine/executeBucket.d.ts +2 -0
- package/dist/engine/executeOutputPlan.d.ts +41 -0
- package/dist/envelop.d.ts +12 -0
- package/dist/envelop.js +4 -4
- package/dist/error.d.ts +23 -0
- package/dist/establishOperationPlan.d.ts +7 -0
- package/dist/execute.d.ts +8 -0
- package/dist/exportAs.d.ts +14 -0
- package/dist/grafastGraphql.d.ts +8 -3
- package/dist/grafastPrint.d.ts +8 -0
- package/dist/graphqlCollectFields.d.ts +22 -0
- package/dist/graphqlMergeSelectionSets.d.ts +4 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -4
- package/dist/input.d.ts +7 -0
- package/dist/interfaces.d.ts +267 -5
- package/dist/makeGrafastSchema.d.ts +27 -0
- package/dist/mermaid.d.ts +28 -0
- package/dist/polymorphic.d.ts +8 -0
- package/dist/prepare.d.ts +16 -0
- package/dist/step.d.ts +183 -0
- package/dist/steps/__inputDynamicScalar.d.ts +3 -0
- package/dist/steps/__inputList.d.ts +3 -0
- package/dist/steps/__inputObject.d.ts +3 -0
- package/dist/steps/__inputStaticLeaf.d.ts +5 -0
- package/dist/steps/__item.d.ts +8 -0
- package/dist/steps/__trackedValue.d.ts +74 -0
- package/dist/steps/__value.d.ts +5 -0
- package/dist/steps/access.d.ts +19 -0
- package/dist/steps/applyTransforms.d.ts +13 -0
- package/dist/steps/connection.d.ts +47 -0
- package/dist/steps/constant.d.ts +7 -0
- package/dist/steps/each.d.ts +3 -0
- package/dist/steps/filter.d.ts +4 -0
- package/dist/steps/first.d.ts +4 -0
- package/dist/steps/graphqlResolver.d.ts +18 -0
- package/dist/steps/groupBy.d.ts +6 -0
- package/dist/steps/index.d.ts +4 -0
- package/dist/steps/lambda.d.ts +8 -0
- package/dist/steps/last.d.ts +4 -0
- package/dist/steps/list.d.ts +7 -0
- package/dist/steps/listTransform.d.ts +21 -0
- package/dist/steps/listen.d.ts +16 -0
- package/dist/steps/load.d.ts +13 -0
- package/dist/steps/node.d.ts +12 -0
- package/dist/steps/object.d.ts +15 -0
- package/dist/steps/partitionByIndex.d.ts +35 -0
- package/dist/steps/proxy.d.ts +11 -0
- package/dist/steps/remapKeys.d.ts +8 -0
- package/dist/steps/reverse.d.ts +9 -0
- package/dist/subscribe.d.ts +4 -0
- package/dist/utils.d.ts +102 -0
- package/dist/version.d.ts +1 -1
- package/fwd/graphql/index.d.ts +1 -0
- package/fwd/graphql/index.js +1 -0
- package/package.json +2 -2
package/dist/input.d.ts
CHANGED
|
@@ -3,5 +3,12 @@ import type { OperationPlan } from "./engine/OperationPlan.js";
|
|
|
3
3
|
import type { AnyInputStep } from "./interfaces.js";
|
|
4
4
|
export declare function assertInputStep(itemPlan: unknown): asserts itemPlan is AnyInputStep;
|
|
5
5
|
export declare function graphqlGetTypeForNode(operationPlan: OperationPlan, node: NamedTypeNode | ListTypeNode | NonNullTypeNode): GraphQLType;
|
|
6
|
+
/**
|
|
7
|
+
* Returns a plan for the given `rawInputValue` AST node which could be a
|
|
8
|
+
* variable or a literal, and could be nested so that a variable (or more than
|
|
9
|
+
* one) appears somewhere. More than one plan may be created.
|
|
10
|
+
*
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
6
13
|
export declare function inputStep(operationPlan: OperationPlan, inputType: GraphQLInputType, rawInputValue: ValueNode | undefined, defaultValue?: ConstValueNode | undefined): AnyInputStep;
|
|
7
14
|
//# sourceMappingURL=input.d.ts.map
|
package/dist/interfaces.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type LRU from "@graphile/lru";
|
|
2
2
|
import type EventEmitter from "eventemitter3";
|
|
3
3
|
import type { PluginHook } from "graphile-config";
|
|
4
|
-
import type { ASTNode, DocumentNode, ExecutionArgs, FragmentDefinitionNode, GraphQLArgument, GraphQLArgumentConfig, GraphQLError, GraphQLField, GraphQLFieldConfig, GraphQLInputField, GraphQLInputFieldConfig, GraphQLInputObjectType, GraphQLInputType, GraphQLList, GraphQLNonNull, GraphQLOutputType, GraphQLScalarType, GraphQLSchema, GraphQLType, OperationDefinitionNode, ValueNode, VariableNode } from "graphql";
|
|
4
|
+
import type { ASTNode, DocumentNode, ExecutionArgs as GraphQLExecutionArgs, FragmentDefinitionNode, GraphQLArgs, GraphQLArgument, GraphQLArgumentConfig, GraphQLError, GraphQLField, GraphQLFieldConfig, GraphQLInputField, GraphQLInputFieldConfig, GraphQLInputObjectType, GraphQLInputType, GraphQLList, GraphQLNonNull, GraphQLOutputType, GraphQLScalarType, GraphQLSchema, GraphQLType, OperationDefinitionNode, ValueNode, VariableNode } from "graphql";
|
|
5
5
|
import type { Bucket, RequestTools } from "./bucket.js";
|
|
6
6
|
import type { OperationPlan } from "./engine/OperationPlan.js";
|
|
7
7
|
import type { SafeError } from "./error.js";
|
|
@@ -11,15 +11,49 @@ import type { __InputListStep, __InputObjectStepWithDollars, __InputStaticLeafSt
|
|
|
11
11
|
import type { GrafastInputObjectType, GrafastObjectType } from "./utils.js";
|
|
12
12
|
type PromiseOrValue<T> = T | Promise<T>;
|
|
13
13
|
export interface GrafastTimeouts {
|
|
14
|
+
/**
|
|
15
|
+
* How many milliseconds should we allow for planning. Remember: planning is
|
|
16
|
+
* synchronous, so whilst it is happening the event loop is blocked.
|
|
17
|
+
*/
|
|
14
18
|
planning?: number;
|
|
19
|
+
/**
|
|
20
|
+
* How many milliseconds should we allow for execution. We will only check
|
|
21
|
+
* this immediately before triggering the execution of an asynchronous step,
|
|
22
|
+
* and if it is exceeded it will only prevent the execution of asynchronous
|
|
23
|
+
* steps, not synchronous ones.
|
|
24
|
+
*
|
|
25
|
+
* IMPORTANT: since we only check this _before_ an asynchronous step
|
|
26
|
+
* executes, there's nothing to stop an asynchronous step from continuing to
|
|
27
|
+
* execute long after the timeout has expired - therefore it's the
|
|
28
|
+
* responsibility of each step to abort itself if it goes over the allocated
|
|
29
|
+
* time budget (which is detailed in `ExecutionExtra.stopTime`).
|
|
30
|
+
*/
|
|
15
31
|
execution?: number;
|
|
16
32
|
}
|
|
17
33
|
export interface GrafastOptions {
|
|
18
|
-
|
|
34
|
+
/**
|
|
35
|
+
* An object to merge into the GraphQL context. Alternatively, pass an
|
|
36
|
+
* (optionally asynchronous) function that returns an object to merge into
|
|
37
|
+
* the GraphQL context.
|
|
38
|
+
*/
|
|
39
|
+
context?: Partial<Grafast.Context> | ((ctx: Partial<Grafast.RequestContext>, args: Grafast.ExecutionArgs) => PromiseOrValue<Partial<Grafast.Context>>);
|
|
40
|
+
/**
|
|
41
|
+
* A list of 'explain' types that should be included in `extensions.explain`.
|
|
42
|
+
*
|
|
43
|
+
* - `mermaid-js` will cause the mermaid plan to be included
|
|
44
|
+
* - other values are dependent on the plugins in play
|
|
45
|
+
*
|
|
46
|
+
* If set to `true` then all possible explain types will be exposed.
|
|
47
|
+
*/
|
|
19
48
|
explain?: boolean | string[];
|
|
20
49
|
timeouts?: GrafastTimeouts;
|
|
21
50
|
}
|
|
22
51
|
export declare const $$queryCache: unique symbol;
|
|
52
|
+
/**
|
|
53
|
+
* We store the cache directly onto the GraphQLSchema so that it gets garbage
|
|
54
|
+
* collected along with the schema when it's not needed any more. To do so, we
|
|
55
|
+
* attach it using this symbol.
|
|
56
|
+
*/
|
|
23
57
|
export declare const $$cacheByOperation: unique symbol;
|
|
24
58
|
export type Fragments = {
|
|
25
59
|
[key: string]: FragmentDefinitionNode;
|
|
@@ -31,7 +65,20 @@ export type OperationPlanOrError = OperationPlan | Error | SafeError<{
|
|
|
31
65
|
[$$timeout]?: undefined;
|
|
32
66
|
[$$ts]?: undefined;
|
|
33
67
|
} | undefined>;
|
|
68
|
+
/**
|
|
69
|
+
* This represents the list of possible operationPlans for a specific document.
|
|
70
|
+
*
|
|
71
|
+
* @remarks
|
|
72
|
+
*
|
|
73
|
+
* It also includes the fragments for validation, but generally we trust that
|
|
74
|
+
* if the OperationDefinitionNode is the same then the request is equivalent.
|
|
75
|
+
*/
|
|
34
76
|
export interface CacheByOperationEntry {
|
|
77
|
+
/**
|
|
78
|
+
* Implemented as a linked list so the hot operationPlans can be kept at the top of the
|
|
79
|
+
* list, and if the list grows beyond a maximum size we can drop the last
|
|
80
|
+
* element.
|
|
81
|
+
*/
|
|
35
82
|
possibleOperationPlans: LinkedList<OperationPlanOrError> | null;
|
|
36
83
|
fragments: Fragments;
|
|
37
84
|
}
|
|
@@ -39,10 +86,25 @@ export interface LinkedList<T> {
|
|
|
39
86
|
value: T;
|
|
40
87
|
next: LinkedList<T> | null;
|
|
41
88
|
}
|
|
89
|
+
export declare const $$hooked: unique symbol;
|
|
42
90
|
declare global {
|
|
43
91
|
namespace Grafast {
|
|
92
|
+
type ExecutionArgs = Pick<GraphQLExecutionArgs, "schema" | "document" | "rootValue" | "variableValues" | "operationName"> & {
|
|
93
|
+
[$$hooked]?: boolean;
|
|
94
|
+
contextValue: Grafast.Context;
|
|
95
|
+
};
|
|
96
|
+
/**
|
|
97
|
+
* Details about the incoming GraphQL request - e.g. if it was sent over an
|
|
98
|
+
* HTTP request, the request itself so headers can be interrogated.
|
|
99
|
+
*
|
|
100
|
+
* It's anticipated this will be expanded via declaration merging, e.g. if
|
|
101
|
+
* your server is Koa then a `koaCtx` might be added.
|
|
102
|
+
*/
|
|
44
103
|
interface RequestContext {
|
|
45
104
|
}
|
|
105
|
+
/**
|
|
106
|
+
* The GraphQL context our schemas expect, generally generated from details in Grafast.RequestContext
|
|
107
|
+
*/
|
|
46
108
|
interface Context {
|
|
47
109
|
}
|
|
48
110
|
interface FieldExtensions {
|
|
@@ -72,28 +134,55 @@ declare global {
|
|
|
72
134
|
interface EnumTypeExtensions {
|
|
73
135
|
}
|
|
74
136
|
interface EnumValueExtensions {
|
|
137
|
+
/**
|
|
138
|
+
* EXPERIMENTAL!
|
|
139
|
+
*
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
75
142
|
applyPlan?: EnumValueApplyPlanResolver<any>;
|
|
76
143
|
}
|
|
77
144
|
interface ScalarTypeExtensions {
|
|
78
145
|
plan?: ScalarPlanResolver;
|
|
79
146
|
inputPlan?: ScalarInputPlanResolver;
|
|
147
|
+
/**
|
|
148
|
+
* Set true if `serialize(serialize(foo)) === serialize(foo)` for all foo
|
|
149
|
+
*/
|
|
80
150
|
idempotent?: boolean;
|
|
81
151
|
}
|
|
82
152
|
interface SchemaExtensions {
|
|
153
|
+
/**
|
|
154
|
+
* Maximum number of queries to store in this schema's query cache.
|
|
155
|
+
*/
|
|
83
156
|
queryCacheMaxLength?: number;
|
|
157
|
+
/**
|
|
158
|
+
* The underlying query cache
|
|
159
|
+
*/
|
|
84
160
|
[$$queryCache]?: LRU<string, DocumentNode | ReadonlyArray<GraphQLError>>;
|
|
161
|
+
/**
|
|
162
|
+
* Maximum number of operations to store an operation plan lookup cache for
|
|
163
|
+
*/
|
|
85
164
|
operationsCacheMaxLength?: number;
|
|
165
|
+
/**
|
|
166
|
+
* Maximum number of operation plans to store in a single operation's cache
|
|
167
|
+
*/
|
|
86
168
|
operationOperationPlansCacheMaxLength?: number;
|
|
169
|
+
/**
|
|
170
|
+
* The starting point for finding/storing the relevant OperationPlan for a request.
|
|
171
|
+
*/
|
|
87
172
|
[$$cacheByOperation]?: LRU<OperationDefinitionNode, CacheByOperationEntry>;
|
|
88
173
|
}
|
|
89
174
|
}
|
|
90
175
|
namespace GraphileConfig {
|
|
91
176
|
interface Preset {
|
|
177
|
+
/**
|
|
178
|
+
* Options that control how `grafast` should execute your GraphQL
|
|
179
|
+
* operations.
|
|
180
|
+
*/
|
|
92
181
|
grafast?: GrafastOptions;
|
|
93
182
|
}
|
|
94
183
|
interface GrafastHooks {
|
|
95
184
|
args: PluginHook<(event: {
|
|
96
|
-
args: ExecutionArgs;
|
|
185
|
+
args: Grafast.ExecutionArgs;
|
|
97
186
|
ctx: Grafast.RequestContext;
|
|
98
187
|
resolvedPreset: GraphileConfig.ResolvedPreset;
|
|
99
188
|
}) => PromiseOrValue<void>>;
|
|
@@ -137,19 +226,56 @@ declare module "graphql" {
|
|
|
137
226
|
export declare const $$grafastContext: unique symbol;
|
|
138
227
|
export declare const $$planResults: unique symbol;
|
|
139
228
|
export declare const $$id: unique symbol;
|
|
229
|
+
/** Return the value verbatim, don't execute */
|
|
140
230
|
export declare const $$verbatim: unique symbol;
|
|
231
|
+
/**
|
|
232
|
+
* If we're sure the data is the right shape and valid, we can set this key and
|
|
233
|
+
* it can be returned directly
|
|
234
|
+
*/
|
|
141
235
|
export declare const $$bypassGraphQL: unique symbol;
|
|
142
236
|
export declare const $$data: unique symbol;
|
|
237
|
+
/**
|
|
238
|
+
* For attaching additional metadata to the GraphQL execution result, for
|
|
239
|
+
* example details of the plan or SQL queries or similar that were executed.
|
|
240
|
+
*/
|
|
143
241
|
export declare const $$extensions: unique symbol;
|
|
242
|
+
/**
|
|
243
|
+
* The "GraphQLObjectType" type name, useful when dealing with polymorphism.
|
|
244
|
+
*
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
144
247
|
export declare const $$concreteType: unique symbol;
|
|
248
|
+
/**
|
|
249
|
+
* Set this key on a type if that type's serialization is idempotent (that is
|
|
250
|
+
* to say `serialize(serialize(thing)) === serialize(thing)`). This means we
|
|
251
|
+
* don't have to "roll-back" serialization if we need to fallback to graphql-js
|
|
252
|
+
* execution.
|
|
253
|
+
*/
|
|
145
254
|
export declare const $$idempotent: unique symbol;
|
|
255
|
+
/**
|
|
256
|
+
* The event emitter used for outputting execution events.
|
|
257
|
+
*/
|
|
146
258
|
export declare const $$eventEmitter: unique symbol;
|
|
259
|
+
/**
|
|
260
|
+
* Used to indicate that an array has more results available via a stream.
|
|
261
|
+
*/
|
|
147
262
|
export declare const $$streamMore: unique symbol;
|
|
148
263
|
export declare const $$proxy: unique symbol;
|
|
264
|
+
/**
|
|
265
|
+
* If an error has this property set then it's safe to send through to the user
|
|
266
|
+
* without being masked.
|
|
267
|
+
*/
|
|
149
268
|
export declare const $$safeError: unique symbol;
|
|
269
|
+
/** The layerPlan used as a subroutine for this step */
|
|
150
270
|
export declare const $$subroutine: unique symbol;
|
|
271
|
+
/** For tracking the timeout a TimeoutError happened from */
|
|
151
272
|
export declare const $$timeout: unique symbol;
|
|
273
|
+
/** For tracking _when_ the timeout happened (because once the JIT has warmed it might not need so long) */
|
|
152
274
|
export declare const $$ts: unique symbol;
|
|
275
|
+
/**
|
|
276
|
+
* When dealing with a polymorphic thing we need to be able to determine what
|
|
277
|
+
* the concrete type of it is, we use the $$concreteType property for that.
|
|
278
|
+
*/
|
|
153
279
|
export interface PolymorphicData<TType extends string = string, TData = any> {
|
|
154
280
|
[$$concreteType]: TType;
|
|
155
281
|
[$$data]?: TData;
|
|
@@ -171,13 +297,21 @@ export interface BaseGraphQLArguments {
|
|
|
171
297
|
export type BaseGraphQLInputObject = BaseGraphQLArguments;
|
|
172
298
|
export type TargetStepOrCallback = ExecutableStep | ModifierStep | ((indexOrFieldName: number | string) => TargetStepOrCallback);
|
|
173
299
|
export type FieldArgs = {
|
|
300
|
+
/** Gets the value, evaluating the `inputPlan` at each field if appropriate */
|
|
174
301
|
get(path?: string | ReadonlyArray<string | number>): ExecutableStep;
|
|
302
|
+
/** Gets the value *without* calling any `inputPlan`s */
|
|
175
303
|
getRaw(path?: string | ReadonlyArray<string | number>): AnyInputStep;
|
|
304
|
+
/** This also works (without path) to apply each list entry against $target */
|
|
176
305
|
apply($target: ExecutableStep | ModifierStep | (() => ModifierStep), path?: string | ReadonlyArray<string | number>): void;
|
|
177
306
|
} & AnyInputStepDollars;
|
|
178
307
|
export type InputStep<TInputType extends GraphQLInputType = GraphQLInputType> = GraphQLInputType extends TInputType ? AnyInputStep : TInputType extends GraphQLNonNull<infer U> ? Exclude<InputStep<U & GraphQLInputType>, ConstantStep<undefined>> : TInputType extends GraphQLList<GraphQLInputType> ? __InputListStep<TInputType> | __TrackedValueStep<any, TInputType> | ConstantStep<undefined> : TInputType extends GraphQLInputObjectType ? __TrackedValueStepWithDollars<any, TInputType> | __InputObjectStepWithDollars<TInputType> | ConstantStep<undefined> : AnyInputStep;
|
|
179
308
|
export type AnyInputStep = __TrackedValueStepWithDollars<any, GraphQLInputType> | __InputListStep | __InputStaticLeafStep | __InputDynamicScalarStep | __InputObjectStepWithDollars<GraphQLInputObjectType> | ConstantStep<undefined>;
|
|
180
309
|
export type AnyInputStepWithDollars = AnyInputStep & AnyInputStepDollars;
|
|
310
|
+
/**
|
|
311
|
+
* Lies to make it easier to write TypeScript code like
|
|
312
|
+
* `{ $input: { $user: { $username } } }` without having to pass loads of
|
|
313
|
+
* generics.
|
|
314
|
+
*/
|
|
181
315
|
export type AnyInputStepDollars = {
|
|
182
316
|
[key in string as `$${key}`]: AnyInputStepWithDollars;
|
|
183
317
|
};
|
|
@@ -185,7 +319,30 @@ export interface FieldInfo {
|
|
|
185
319
|
field: GraphQLField<any, any, any>;
|
|
186
320
|
schema: GraphQLSchema;
|
|
187
321
|
}
|
|
322
|
+
/**
|
|
323
|
+
* Step resolvers are like regular resolvers except they're called beforehand,
|
|
324
|
+
* they return plans rather than values, and they only run once for lists
|
|
325
|
+
* rather than for each item in the list.
|
|
326
|
+
*
|
|
327
|
+
* The idea is that the plan resolver returns a plan object which later will
|
|
328
|
+
* process the data and feed that into the actual resolver functions
|
|
329
|
+
* (preferably using the default resolver function?).
|
|
330
|
+
*
|
|
331
|
+
* They are stored onto `<field>.extensions.grafast.plan`
|
|
332
|
+
*
|
|
333
|
+
* @returns a plan for this field.
|
|
334
|
+
*
|
|
335
|
+
* @remarks
|
|
336
|
+
* We're using `TrackedObject<...>` so we can later consider caching these
|
|
337
|
+
* executions.
|
|
338
|
+
*/
|
|
188
339
|
export type FieldPlanResolver<_TArgs extends BaseGraphQLArguments, TParentStep extends ExecutableStep | null, TResultStep extends ExecutableStep> = ($parentPlan: TParentStep, args: FieldArgs, info: FieldInfo) => TResultStep | null;
|
|
340
|
+
/**
|
|
341
|
+
* Fields on input objects can have plans; the plan resolver is passed a parent plan
|
|
342
|
+
* (from an argument, or from a parent input object) or null if none, and an
|
|
343
|
+
* input plan that represents the value the user will pass to this field. The
|
|
344
|
+
* resolver must return either a ModifierStep or null.
|
|
345
|
+
*/
|
|
189
346
|
export type InputObjectFieldInputPlanResolver<TResultStep extends ExecutableStep = ExecutableStep> = (input: FieldArgs, info: {
|
|
190
347
|
schema: GraphQLSchema;
|
|
191
348
|
entity: GraphQLInputField;
|
|
@@ -198,6 +355,13 @@ export type InputObjectTypeInputPlanResolver = (input: FieldArgs, info: {
|
|
|
198
355
|
schema: GraphQLSchema;
|
|
199
356
|
type: GraphQLInputObjectType;
|
|
200
357
|
}) => ExecutableStep;
|
|
358
|
+
/**
|
|
359
|
+
* Arguments can have plans; the plan resolver is passed the parent plan (the
|
|
360
|
+
* plan that represents the _parent_ field of the field the arg is defined on),
|
|
361
|
+
* the field plan (the plan that represents the field the arg is defined on)
|
|
362
|
+
* and an input plan that represents the value the user will pass to this
|
|
363
|
+
* argument. The resolver must return either a ModifierStep or null.
|
|
364
|
+
*/
|
|
201
365
|
export type ArgumentInputPlanResolver<TParentStep extends ExecutableStep = ExecutableStep, TResultStep extends ExecutableStep = ExecutableStep> = ($parentPlan: TParentStep, input: FieldArgs, info: {
|
|
202
366
|
schema: GraphQLSchema;
|
|
203
367
|
entity: GraphQLArgument;
|
|
@@ -206,13 +370,30 @@ export type ArgumentApplyPlanResolver<TParentStep extends ExecutableStep = Execu
|
|
|
206
370
|
schema: GraphQLSchema;
|
|
207
371
|
entity: GraphQLArgument;
|
|
208
372
|
}) => TResultStep;
|
|
373
|
+
/**
|
|
374
|
+
* GraphQLScalarTypes can have plans, these are passed the field plan and must
|
|
375
|
+
* return an executable plan.
|
|
376
|
+
*/
|
|
209
377
|
export type ScalarPlanResolver<TParentStep extends ExecutableStep = ExecutableStep, TResultStep extends ExecutableStep = ExecutableStep> = ($parentPlan: TParentStep, info: {
|
|
210
378
|
schema: GraphQLSchema;
|
|
211
379
|
}) => TResultStep;
|
|
380
|
+
/**
|
|
381
|
+
* GraphQLScalarTypes can have plans, these are passed the field plan and must
|
|
382
|
+
* return an executable plan.
|
|
383
|
+
*/
|
|
212
384
|
export type ScalarInputPlanResolver<TResultStep extends ExecutableStep = ExecutableStep> = ($inputValue: InputStep, info: {
|
|
213
385
|
schema: GraphQLSchema;
|
|
214
386
|
type: GraphQLScalarType;
|
|
215
387
|
}) => TResultStep;
|
|
388
|
+
/**
|
|
389
|
+
* EXPERIMENTAL!
|
|
390
|
+
*
|
|
391
|
+
* NOTE: this is an `any` because we want to allow users to specify
|
|
392
|
+
* subclasses of ExecutableStep but TypeScript only wants to allow
|
|
393
|
+
* superclasses.
|
|
394
|
+
*
|
|
395
|
+
* @internal
|
|
396
|
+
*/
|
|
216
397
|
export type EnumValueApplyPlanResolver<TParentStep extends ExecutableStep | ModifierStep = ExecutableStep | ModifierStep> = ($parent: TParentStep) => ModifierStep | void;
|
|
217
398
|
type OutputPlanForNamedType<TType extends GraphQLType> = TType extends GrafastObjectType<any, infer TStep, any> ? TStep : ExecutableStep;
|
|
218
399
|
export type OutputPlanForType<TType extends GraphQLOutputType> = TType extends GraphQLNonNull<GraphQLList<GraphQLNonNull<infer U>>> ? ListCapableStep<any, OutputPlanForNamedType<U>> | ExecutableStep<ReadonlyArray<any>> : TType extends GraphQLNonNull<GraphQLList<infer U>> ? ListCapableStep<any, OutputPlanForNamedType<U>> | ExecutableStep<ReadonlyArray<any>> : TType extends GraphQLList<GraphQLNonNull<infer U>> ? ListCapableStep<any, OutputPlanForNamedType<U>> | ExecutableStep<ReadonlyArray<any>> : TType extends GraphQLList<infer U> ? ListCapableStep<any, OutputPlanForNamedType<U>> | ExecutableStep<ReadonlyArray<any>> : TType extends GraphQLNonNull<infer U> ? OutputPlanForNamedType<U> : OutputPlanForNamedType<TType>;
|
|
@@ -220,15 +401,25 @@ type InputPlanForNamedType<TType extends GraphQLType> = TType extends GrafastInp
|
|
|
220
401
|
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>;
|
|
221
402
|
type InputTypeForNamedType<TType extends GraphQLType> = TType extends GraphQLScalarType<infer U> ? U : any;
|
|
222
403
|
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>;
|
|
223
|
-
|
|
404
|
+
/**
|
|
405
|
+
* Basically GraphQLFieldConfig but with an easy to access `plan` method.
|
|
406
|
+
*/
|
|
407
|
+
export type GrafastFieldConfig<TType extends GraphQLOutputType, TContext extends Grafast.Context, TParentStep extends ExecutableStep | null, TFieldStep extends ExecutableStep, // TODO: should be OutputPlanForType<TType>, but that results in everything thinking it should be a ListStep
|
|
408
|
+
TArgs extends BaseGraphQLArguments> = Omit<GraphQLFieldConfig<any, any>, "args" | "type"> & {
|
|
224
409
|
type: TType;
|
|
225
410
|
plan?: FieldPlanResolver<TArgs, TParentStep, TFieldStep>;
|
|
226
411
|
subscribePlan?: FieldPlanResolver<TArgs, TParentStep, TFieldStep>;
|
|
227
412
|
args?: GrafastFieldConfigArgumentMap<TType, TContext, TParentStep, TFieldStep>;
|
|
228
413
|
};
|
|
414
|
+
/**
|
|
415
|
+
* Basically GraphQLFieldConfigArgumentMap but allowing for args to have plans.
|
|
416
|
+
*/
|
|
229
417
|
export type GrafastFieldConfigArgumentMap<_TType extends GraphQLOutputType, TContext extends Grafast.Context, TParentStep extends ExecutableStep | null, TFieldStep extends ExecutableStep> = {
|
|
230
418
|
[argName: string]: GrafastArgumentConfig<any, TContext, TParentStep, TFieldStep, any, any>;
|
|
231
419
|
};
|
|
420
|
+
/**
|
|
421
|
+
* Basically GraphQLArgumentConfig but allowing for a plan.
|
|
422
|
+
*/
|
|
232
423
|
export type GrafastArgumentConfig<TInputType extends GraphQLInputType = GraphQLInputType, _TContext extends Grafast.Context = Grafast.Context, _TParentStep extends ExecutableStep | null = ExecutableStep | null, TFieldStep extends ExecutableStep = ExecutableStep, _TArgumentStep extends TFieldStep extends ExecutableStep ? ModifierStep<TFieldStep> | null : null = TFieldStep extends ExecutableStep ? ModifierStep<TFieldStep> | null : null, _TInput extends InputTypeFor<TInputType> = InputTypeFor<TInputType>> = Omit<GraphQLArgumentConfig, "type"> & {
|
|
233
424
|
type: TInputType;
|
|
234
425
|
inputPlan?: ArgumentInputPlanResolver<any>;
|
|
@@ -236,6 +427,9 @@ export type GrafastArgumentConfig<TInputType extends GraphQLInputType = GraphQLI
|
|
|
236
427
|
autoApplyAfterParentPlan?: boolean;
|
|
237
428
|
autoApplyAfterParentSubscribePlan?: boolean;
|
|
238
429
|
};
|
|
430
|
+
/**
|
|
431
|
+
* Basically GraphQLInputFieldConfig but allowing for the field to have a plan.
|
|
432
|
+
*/
|
|
239
433
|
export type GrafastInputFieldConfig<TInputType extends GraphQLInputType, _TContext extends Grafast.Context, _TParentStep extends ModifierStep<any>, _TResultStep extends InputPlanForType<TInputType>, _TInput extends InputTypeFor<TInputType>> = Omit<GraphQLInputFieldConfig, "type"> & {
|
|
240
434
|
type: TInputType;
|
|
241
435
|
inputPlan?: InputObjectFieldInputPlanResolver;
|
|
@@ -243,19 +437,40 @@ export type GrafastInputFieldConfig<TInputType extends GraphQLInputType, _TConte
|
|
|
243
437
|
autoApplyAfterParentInputPlan?: boolean;
|
|
244
438
|
autoApplyAfterParentApplyPlan?: boolean;
|
|
245
439
|
};
|
|
440
|
+
/**
|
|
441
|
+
* The args passed to a field plan resolver, the values are plans.
|
|
442
|
+
*/
|
|
246
443
|
export type TrackedArguments<TArgs extends BaseGraphQLArguments = BaseGraphQLArguments> = {
|
|
247
444
|
get<TKey extends keyof TArgs>(key: TKey): AnyInputStep;
|
|
248
445
|
};
|
|
446
|
+
/**
|
|
447
|
+
* `@stream` directive meta.
|
|
448
|
+
*/
|
|
249
449
|
export interface StepStreamOptions {
|
|
250
450
|
initialCount: number;
|
|
251
451
|
}
|
|
452
|
+
/**
|
|
453
|
+
* Additional details about the planning for a field; currently only relates to
|
|
454
|
+
* the `@stream` directive.
|
|
455
|
+
*/
|
|
252
456
|
export interface StepOptions {
|
|
457
|
+
/**
|
|
458
|
+
* Details for the `@stream` directive.
|
|
459
|
+
*/
|
|
253
460
|
stream: StepStreamOptions | null;
|
|
254
461
|
}
|
|
462
|
+
/**
|
|
463
|
+
* Options passed to the `optimize` method of a plan to give more context.
|
|
464
|
+
*/
|
|
255
465
|
export interface StepOptimizeOptions {
|
|
256
466
|
stream: StepStreamOptions | null;
|
|
257
467
|
meta: Record<string, unknown> | undefined;
|
|
258
468
|
}
|
|
469
|
+
/**
|
|
470
|
+
* A subscriber provides realtime data, a SubscribeStep can subscribe to a
|
|
471
|
+
* given topic (string) and will receive an AsyncIterableIterator with messages
|
|
472
|
+
* published to that topic (standard pub/sub semantics).
|
|
473
|
+
*/
|
|
259
474
|
export type GrafastSubscriber<TTopics extends {
|
|
260
475
|
[key: string]: any;
|
|
261
476
|
} = {
|
|
@@ -263,17 +478,50 @@ export type GrafastSubscriber<TTopics extends {
|
|
|
263
478
|
}> = {
|
|
264
479
|
subscribe<TTopic extends keyof TTopics = keyof TTopics>(topic: TTopic): PromiseOrDirect<AsyncIterableIterator<TTopics[TTopic]>>;
|
|
265
480
|
};
|
|
481
|
+
/**
|
|
482
|
+
* Specifically relates to the stringification of NodeIDs, e.g. `["User", 1]`
|
|
483
|
+
* to/from `WyJVc2VyIiwgMV0=`
|
|
484
|
+
*/
|
|
266
485
|
export interface NodeIdCodec<T = any> {
|
|
267
486
|
name: string;
|
|
268
487
|
encode(value: T): string | null;
|
|
269
488
|
decode(value: string): T;
|
|
270
489
|
}
|
|
490
|
+
/**
|
|
491
|
+
* Determines if a NodeID relates to a given object type, and also relates to
|
|
492
|
+
* encoding the NodeID for that type.
|
|
493
|
+
*/
|
|
271
494
|
export type NodeIdHandler<TCodec extends NodeIdCodec<any> = NodeIdCodec<any>, TNodeStep extends ExecutableStep = ExecutableStep, TSpec = any> = {
|
|
495
|
+
/**
|
|
496
|
+
* The name of the object type this handler is for.
|
|
497
|
+
*/
|
|
272
498
|
typeName: string;
|
|
499
|
+
/**
|
|
500
|
+
* Which codec are we using to encode/decode the NodeID string?
|
|
501
|
+
*/
|
|
273
502
|
codec: TCodec;
|
|
503
|
+
/**
|
|
504
|
+
* Returns true if the given decoded Node ID value represents this type.
|
|
505
|
+
*/
|
|
274
506
|
match(specifier: TCodec extends NodeIdCodec<infer U> ? U : any): boolean;
|
|
507
|
+
/**
|
|
508
|
+
* Returns a plan that returns the value ready to be encoded. When the result
|
|
509
|
+
* of this plan is fed into `match`, it should return `true`.
|
|
510
|
+
*/
|
|
275
511
|
plan($thing: TNodeStep): ExecutableStep<TCodec extends NodeIdCodec<infer U> ? U : any>;
|
|
512
|
+
/**
|
|
513
|
+
* Returns a specification based on the Node ID, this can be in any format
|
|
514
|
+
* you like. It is intended to then be fed into `get` or handled in your own
|
|
515
|
+
* code as you see fit. (When used directly, it's primarily useful for
|
|
516
|
+
* referencing a node without actually fetching it - e.g. allowing you to
|
|
517
|
+
* delete a node by its ID without first fetching it.)
|
|
518
|
+
*/
|
|
276
519
|
getSpec(plan: ExecutableStep<TCodec extends NodeIdCodec<infer U> ? U : any>): TSpec;
|
|
520
|
+
/**
|
|
521
|
+
* Combined with `getSpec`, this forms the recprocal of `plan`; i.e.
|
|
522
|
+
* `get(getSpec( plan(node) ))` should return a plan that results in the
|
|
523
|
+
* original node.
|
|
524
|
+
*/
|
|
277
525
|
get(spec: TSpec): TNodeStep;
|
|
278
526
|
deprecationReason?: string;
|
|
279
527
|
};
|
|
@@ -289,6 +537,10 @@ export interface TypedEventEmitter<TEventMap extends BaseEventMap> extends Event
|
|
|
289
537
|
emit<TEventName extends EventMapKey<TEventMap>>(eventName: TEventName, params: TEventMap[TEventName]): boolean;
|
|
290
538
|
}
|
|
291
539
|
export type ExecutionEventMap = {
|
|
540
|
+
/**
|
|
541
|
+
* Something that can be added to the
|
|
542
|
+
* ExecutionResult.extensions.explain.operations list.
|
|
543
|
+
*/
|
|
292
544
|
explainOperation: {
|
|
293
545
|
operation: Record<string, any> & {
|
|
294
546
|
type: string;
|
|
@@ -298,15 +550,21 @@ export type ExecutionEventMap = {
|
|
|
298
550
|
};
|
|
299
551
|
export type ExecutionEventEmitter = TypedEventEmitter<ExecutionEventMap>;
|
|
300
552
|
export interface ExecutionExtra {
|
|
553
|
+
/** The `performance.now()` at which your step should stop executing */
|
|
301
554
|
stopTime: number | null;
|
|
555
|
+
/** If you have set a `metaKey` on your step, the relevant meta object which you can write into (e.g. for caching) */
|
|
302
556
|
meta: Record<string, unknown> | undefined;
|
|
303
557
|
eventEmitter: ExecutionEventEmitter | undefined;
|
|
558
|
+
/** @internal */
|
|
304
559
|
_bucket: Bucket;
|
|
560
|
+
/** @internal */
|
|
305
561
|
_requestContext: RequestTools;
|
|
306
562
|
}
|
|
307
563
|
export interface LocationDetails {
|
|
308
564
|
node: ASTNode | readonly ASTNode[];
|
|
565
|
+
/** This should only be null for the root selection */
|
|
309
566
|
parentTypeName: string | null;
|
|
567
|
+
/** This should only be null for the root selection */
|
|
310
568
|
fieldName: string | null;
|
|
311
569
|
}
|
|
312
570
|
export type JSONValue = boolean | number | string | null | JSONObject | JSONArray;
|
|
@@ -315,7 +573,7 @@ export interface JSONObject {
|
|
|
315
573
|
}
|
|
316
574
|
export interface JSONArray extends Array<JSONValue> {
|
|
317
575
|
}
|
|
318
|
-
export type UnwrapPlanTuple
|
|
576
|
+
export type UnwrapPlanTuple</* const */ TIn extends readonly ExecutableStep[]> = {
|
|
319
577
|
[Index in keyof TIn]: TIn[Index] extends ExecutableStep<infer U> ? U : never;
|
|
320
578
|
} & {
|
|
321
579
|
length: number;
|
|
@@ -327,5 +585,9 @@ export type StreamMaybeMoreableArray<T = any> = Array<T> & {
|
|
|
327
585
|
export type StreamMoreableArray<T = any> = Array<T> & {
|
|
328
586
|
[$$streamMore]: AsyncIterator<any, any, any> | Iterator<any, any, any>;
|
|
329
587
|
};
|
|
588
|
+
export interface GrafastArgs extends GraphQLArgs {
|
|
589
|
+
resolvedPreset?: GraphileConfig.ResolvedPreset;
|
|
590
|
+
requestContext?: Partial<Grafast.RequestContext>;
|
|
591
|
+
}
|
|
330
592
|
export {};
|
|
331
593
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import type { GraphQLFieldResolver, GraphQLScalarLiteralParser, GraphQLScalarSerializer, GraphQLScalarValueParser, GraphQLSchema } from "graphql";
|
|
2
2
|
import type { EnumValueApplyPlanResolver, FieldPlanResolver, ScalarPlanResolver } from "./interfaces.js";
|
|
3
3
|
import type { ExecutableStep } from "./step.js";
|
|
4
|
+
/**
|
|
5
|
+
* When defining a field with `typeDefs/plans` you can declare the field plan
|
|
6
|
+
* directly, or you can define a configuration object that accepts the plan and
|
|
7
|
+
* more.
|
|
8
|
+
*/
|
|
4
9
|
export type FieldPlans = FieldPlanResolver<any, any, any> | {
|
|
5
10
|
plan?: FieldPlanResolver<any, any, any>;
|
|
6
11
|
subscribePlan?: FieldPlanResolver<any, any, any>;
|
|
@@ -10,6 +15,9 @@ export type FieldPlans = FieldPlanResolver<any, any, any> | {
|
|
|
10
15
|
[argName: string]: Grafast.ArgumentExtensions;
|
|
11
16
|
};
|
|
12
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* The plans/config for each field of a GraphQL object type.
|
|
20
|
+
*/
|
|
13
21
|
export type ObjectPlans = {
|
|
14
22
|
__Step?: {
|
|
15
23
|
new (...args: any[]): ExecutableStep;
|
|
@@ -17,27 +25,46 @@ export type ObjectPlans = {
|
|
|
17
25
|
} & {
|
|
18
26
|
[fieldName: string]: FieldPlans;
|
|
19
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* The plans for each field of a GraphQL input object type.
|
|
30
|
+
*/
|
|
20
31
|
export type InputObjectPlans = {
|
|
21
32
|
[fieldName: string]: Grafast.InputFieldExtensions;
|
|
22
33
|
};
|
|
34
|
+
/**
|
|
35
|
+
* The plan config for an interface or union type.
|
|
36
|
+
*/
|
|
23
37
|
export type InterfaceOrUnionPlans = {
|
|
24
38
|
__resolveType?: (o: unknown) => string;
|
|
25
39
|
};
|
|
40
|
+
/**
|
|
41
|
+
* The config for a GraphQL scalar type.
|
|
42
|
+
*/
|
|
26
43
|
export type ScalarPlans = {
|
|
27
44
|
serialize?: GraphQLScalarSerializer<any>;
|
|
28
45
|
parseValue?: GraphQLScalarValueParser<any>;
|
|
29
46
|
parseLiteral?: GraphQLScalarLiteralParser<any>;
|
|
30
47
|
plan?: ScalarPlanResolver<any, any>;
|
|
31
48
|
};
|
|
49
|
+
/**
|
|
50
|
+
* The values/configs for the entries in a GraphQL enum type.
|
|
51
|
+
*/
|
|
32
52
|
export type EnumPlans = {
|
|
33
53
|
[enumValueName: string]: EnumValueApplyPlanResolver | string | number | boolean | {
|
|
34
54
|
value?: unknown;
|
|
35
55
|
applyPlan?: EnumValueApplyPlanResolver;
|
|
36
56
|
};
|
|
37
57
|
};
|
|
58
|
+
/**
|
|
59
|
+
* A map from GraphQL named type to the config for that type.
|
|
60
|
+
*/
|
|
38
61
|
export interface GrafastPlans {
|
|
39
62
|
[typeName: string]: ObjectPlans | InputObjectPlans | InterfaceOrUnionPlans | ScalarPlans | EnumPlans;
|
|
40
63
|
}
|
|
64
|
+
/**
|
|
65
|
+
* Takes a GraphQL schema definition in Interface Definition Language (IDL/SDL)
|
|
66
|
+
* syntax and configs for the types in it and returns a GraphQL schema.
|
|
67
|
+
*/
|
|
41
68
|
export declare function makeGrafastSchema(details: {
|
|
42
69
|
typeDefs: string;
|
|
43
70
|
plans: GrafastPlans;
|
package/dist/mermaid.d.ts
CHANGED
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import type { OperationPlan } from ".";
|
|
2
2
|
import type { ExecutableStep } from "./step.js";
|
|
3
|
+
/**
|
|
4
|
+
* An array of hex colour codes that we use for colouring the buckets/steps in
|
|
5
|
+
* the mermaid-js plan diagram.
|
|
6
|
+
*
|
|
7
|
+
* Generated by mokole.com/palette.html; re-ordered by Jem
|
|
8
|
+
*/
|
|
3
9
|
export declare const COLORS: string[];
|
|
10
|
+
/**
|
|
11
|
+
* Given a string, escapes the string so that it can be embedded as the description of a node in a mermaid chart.
|
|
12
|
+
*
|
|
13
|
+
* 1. If it's already safe, returns it verbatim
|
|
14
|
+
* 2. If it contains disallowed characters, escape them by replacing them with similar-looking characters,
|
|
15
|
+
* 3. Wrap the string in quote marks.
|
|
16
|
+
*
|
|
17
|
+
* @remarks
|
|
18
|
+
*
|
|
19
|
+
* NOTE: rather than doing literal escapes, we replace with lookalike characters because:
|
|
20
|
+
*
|
|
21
|
+
* 1. Mermaid has a bug when calculating the width of the node that doesn't respect escapes,
|
|
22
|
+
* 2. It's easier to read the raw mermaid markup with substitutes rather than messy escapes.
|
|
23
|
+
*
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
4
26
|
export declare const mermaidEscape: (str: string) => string;
|
|
5
27
|
export interface PrintPlanGraphOptions {
|
|
6
28
|
printPathRelations?: boolean;
|
|
@@ -8,6 +30,12 @@ export interface PrintPlanGraphOptions {
|
|
|
8
30
|
concise?: boolean;
|
|
9
31
|
skipBuckets?: boolean;
|
|
10
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Convert an OpPlan into a plan graph; call this via `operationPlan.printPlanGraph()`
|
|
35
|
+
* rather than calling this function directly.
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
11
39
|
export declare function printPlanGraph(operationPlan: OperationPlan, { concise, skipBuckets, }: PrintPlanGraphOptions, { steps, }: {
|
|
12
40
|
steps: {
|
|
13
41
|
[stepId: number]: ExecutableStep | null;
|
package/dist/polymorphic.d.ts
CHANGED
|
@@ -1,6 +1,14 @@
|
|
|
1
1
|
import type { PolymorphicData } from "./interfaces.js";
|
|
2
2
|
export declare function isPolymorphicData(data: unknown): data is PolymorphicData;
|
|
3
3
|
export declare function assertPolymorphicData(data: unknown): asserts data is PolymorphicData;
|
|
4
|
+
/**
|
|
5
|
+
* Returns an object with the given concrete type (and, optionally, associated
|
|
6
|
+
* data)
|
|
7
|
+
*/
|
|
4
8
|
export declare function polymorphicWrap<TType extends string, TData>(type: TType, data?: TData): PolymorphicData<TType, TData>;
|
|
9
|
+
/**
|
|
10
|
+
* All polymorphic objects in Grafast have a $$concreteType property which
|
|
11
|
+
* contains the GraphQL object's type name; we simply return that.
|
|
12
|
+
*/
|
|
5
13
|
export declare function resolveType(o: unknown): string;
|
|
6
14
|
//# sourceMappingURL=polymorphic.d.ts.map
|
package/dist/prepare.d.ts
CHANGED
|
@@ -3,7 +3,20 @@ import type { AsyncExecutionResult, ExecutionResult } from "graphql/execution/ex
|
|
|
3
3
|
import type { GrafastTimeouts, PromiseOrDirect } from "./interfaces.js";
|
|
4
4
|
declare const $$contextPlanCache: unique symbol;
|
|
5
5
|
export interface GrafastPrepareOptions {
|
|
6
|
+
/**
|
|
7
|
+
* A list of 'explain' types that should be included in `extensions.explain`.
|
|
8
|
+
*
|
|
9
|
+
* - `mermaid-js` will cause the mermaid plan to be included
|
|
10
|
+
* - other values are dependent on the plugins in play
|
|
11
|
+
*
|
|
12
|
+
* If set to `true` then all possible explain types will be exposed.
|
|
13
|
+
*/
|
|
6
14
|
explain?: boolean | string[];
|
|
15
|
+
/**
|
|
16
|
+
* If true, the result will be returned as a string rather than an object -
|
|
17
|
+
* this is an optimization for returning the data over a network socket or
|
|
18
|
+
* similar.
|
|
19
|
+
*/
|
|
7
20
|
outputDataAsString?: boolean;
|
|
8
21
|
timeouts?: GrafastTimeouts;
|
|
9
22
|
}
|
|
@@ -12,6 +25,9 @@ declare module "./engine/OperationPlan.js" {
|
|
|
12
25
|
[$$contextPlanCache]?: string;
|
|
13
26
|
}
|
|
14
27
|
}
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
15
31
|
export declare function grafastPrepare(args: ExecutionArgs, options?: GrafastPrepareOptions): PromiseOrDirect<ExecutionResult | AsyncGenerator<AsyncExecutionResult, void, void>>;
|
|
16
32
|
export {};
|
|
17
33
|
//# sourceMappingURL=prepare.d.ts.map
|