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/step.d.ts
CHANGED
|
@@ -1,88 +1,21 @@
|
|
|
1
1
|
import type { GraphQLObjectType } from "graphql";
|
|
2
2
|
import type { LayerPlan, LayerPlanReasonSubroutine } from "./engine/LayerPlan.js";
|
|
3
3
|
import type { OperationPlan } from "./engine/OperationPlan.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { AddDependencyOptions, DependencyOptions, ExecutionDetails, ExecutionEntryFlags, ExecutionResults, GrafastResultsList, JSONValue, PromiseOrDirect, StepOptimizeOptions, UnbatchedExecutionExtra } from "./interfaces.js";
|
|
5
5
|
import { $$subroutine } from "./interfaces.js";
|
|
6
|
-
import type { __ItemStep } from "./steps/index.js";
|
|
7
|
-
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export declare const $$deepDepSkip: unique symbol;
|
|
11
|
-
/**
|
|
12
|
-
* This indicates that a step never executes (e.g. __ItemStep and __ValueStep)
|
|
13
|
-
* and thus when executed skips direct to reallyCompletedStep.
|
|
14
|
-
*
|
|
15
|
-
* @internal
|
|
16
|
-
*/
|
|
17
|
-
export declare const $$noExec: unique symbol;
|
|
18
|
-
declare function reallyAssertFinalized(plan: BaseStep): void;
|
|
6
|
+
import type { __FlagStep, __ItemStep } from "./steps/index.js";
|
|
7
|
+
declare function reallyAssertFinalized(plan: Step): void;
|
|
19
8
|
export declare const assertFinalized: typeof reallyAssertFinalized;
|
|
20
9
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* ModifierStep (for use when planning arguments/input fields).
|
|
24
|
-
*
|
|
25
|
-
* @remarks
|
|
26
|
-
*
|
|
27
|
-
* Though it might seem that ModifierStep should be used for all inputs
|
|
28
|
-
* (arguments, input objects), this is not the case. When planning an output
|
|
29
|
-
* field, all inputs to it (including arguments, parent plan, context, etc)
|
|
30
|
-
* should be other executable plans. The only time that ModifierStep is used is
|
|
31
|
-
* when writing specific plans as part of the argument or input field
|
|
32
|
-
* definitions themself; even in these cases the inputs to these plan resolvers
|
|
33
|
-
* will be ExecutablePlans.
|
|
10
|
+
* Executable plans are the plans associated with leaves on the GraphQL tree,
|
|
11
|
+
* they must be able to execute to return values.
|
|
34
12
|
*/
|
|
35
|
-
export declare
|
|
36
|
-
/**
|
|
37
|
-
* This identifies the "bucket" into which this plan's results will be stored.
|
|
38
|
-
* New buckets are introduced when you cross boundaries that may change the
|
|
39
|
-
* number of results in the bucket, or where control over execution is desired.
|
|
40
|
-
*
|
|
41
|
-
* - Lists / list items (generally multiplies up)
|
|
42
|
-
* - Polymorphism - different entries may go into different buckets
|
|
43
|
-
* - Mutations - early termination is likely
|
|
44
|
-
* - Defer boundaries - don't execute this stuff until later
|
|
45
|
-
* - null boundaries - if a null is met, no need to continue execution
|
|
46
|
-
*
|
|
47
|
-
* This bucket influences:
|
|
48
|
-
*
|
|
49
|
-
* 1. how plans are deduplicated
|
|
50
|
-
* 2. the order in which the plans are executed
|
|
51
|
-
* 3. where the result of executing the plan is stored
|
|
52
|
-
* 4. when the plan execution cache is allowed to be GC'd
|
|
53
|
-
*
|
|
54
|
-
* NOTE: `__ListTransformStep`'s effectively have a temporary bucket inside
|
|
55
|
-
* them (built on the `__Item`) that's thrown away once the transform is
|
|
56
|
-
* complete.
|
|
57
|
-
*
|
|
58
|
-
* @internal
|
|
59
|
-
*/
|
|
60
|
-
readonly layerPlan: LayerPlan;
|
|
13
|
+
export declare class Step<TData = any> {
|
|
61
14
|
readonly operationPlan: OperationPlan;
|
|
62
15
|
[$$subroutine]: LayerPlan<LayerPlanReasonSubroutine> | null;
|
|
63
16
|
isArgumentsFinalized: boolean;
|
|
64
17
|
isFinalized: boolean;
|
|
65
18
|
debug: boolean;
|
|
66
|
-
/**
|
|
67
|
-
* Set this true for plans that implement mutations; this will prevent them
|
|
68
|
-
* from being tree-shaken.
|
|
69
|
-
*/
|
|
70
|
-
hasSideEffects: boolean;
|
|
71
|
-
constructor();
|
|
72
|
-
toString(): string;
|
|
73
|
-
/**
|
|
74
|
-
* This metadata will be merged into toString when referencing this plan.
|
|
75
|
-
*/
|
|
76
|
-
toStringMeta(): string | null;
|
|
77
|
-
planJSONExtra(): Record<string, JSONValue | undefined> | undefined;
|
|
78
|
-
finalize(): void;
|
|
79
|
-
destroy(): void;
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Executable plans are the plans associated with leaves on the GraphQL tree,
|
|
83
|
-
* they must be able to execute to return values.
|
|
84
|
-
*/
|
|
85
|
-
export declare class ExecutableStep<TData = any> extends BaseStep {
|
|
86
19
|
static $$export: any;
|
|
87
20
|
/**
|
|
88
21
|
* Setting this true is a performance optimisation, but it comes with strong
|
|
@@ -95,7 +28,7 @@ export declare class ExecutableStep<TData = any> extends BaseStep {
|
|
|
95
28
|
* - The `execute` method must be a regular (not async) function
|
|
96
29
|
* - The `execute` method must NEVER return a promise
|
|
97
30
|
* - The values within the list returned from `execute` must NEVER include
|
|
98
|
-
* promises or
|
|
31
|
+
* promises or FlaggedValue objects
|
|
99
32
|
* - The result of calling `execute` should not differ after a
|
|
100
33
|
* `step.hasSideEffects` has executed (i.e. it should be pure, only
|
|
101
34
|
* dependent on its deps and use no external state)
|
|
@@ -108,23 +41,15 @@ export declare class ExecutableStep<TData = any> extends BaseStep {
|
|
|
108
41
|
*/
|
|
109
42
|
isSyncAndSafe: boolean;
|
|
110
43
|
/**
|
|
111
|
-
*
|
|
112
|
-
* @internal
|
|
44
|
+
* (default = ALL_FLAGS & ~FLAG_NULL)
|
|
113
45
|
*/
|
|
114
|
-
readonly
|
|
46
|
+
protected readonly defaultForbiddenFlags: ExecutionEntryFlags;
|
|
115
47
|
/**
|
|
116
|
-
*
|
|
117
|
-
* @internal
|
|
48
|
+
* The plan this plan will need data from in order to execute.
|
|
118
49
|
*/
|
|
119
|
-
readonly
|
|
120
|
-
step: ExecutableStep;
|
|
121
|
-
dependencyIndex: number;
|
|
122
|
-
}>;
|
|
50
|
+
protected readonly dependencies: ReadonlyArray<Step>;
|
|
123
51
|
/**
|
|
124
|
-
*
|
|
125
|
-
* number.
|
|
126
|
-
*
|
|
127
|
-
* @internal
|
|
52
|
+
* Unique identifier for this step within the plan.
|
|
128
53
|
*/
|
|
129
54
|
readonly id: number;
|
|
130
55
|
/**
|
|
@@ -139,19 +64,6 @@ export declare class ExecutableStep<TData = any> extends BaseStep {
|
|
|
139
64
|
* AccessStep).
|
|
140
65
|
*/
|
|
141
66
|
allowMultipleOptimizations: boolean;
|
|
142
|
-
/** @internal */
|
|
143
|
-
_stepOptions: StepOptions;
|
|
144
|
-
/** @internal */
|
|
145
|
-
polymorphicPaths: ReadonlySet<string> | null;
|
|
146
|
-
/**
|
|
147
|
-
* True if this needs to be permanently stored; for example:
|
|
148
|
-
*
|
|
149
|
-
* - Is the dep of another LayerPlan
|
|
150
|
-
* - Is used in an OutputPlan
|
|
151
|
-
*
|
|
152
|
-
* @internal
|
|
153
|
-
*/
|
|
154
|
-
store: boolean;
|
|
155
67
|
/**
|
|
156
68
|
* Set the metaKey so `execute` will be passed a meta object to use.
|
|
157
69
|
* Depending on what you set it to, you can share execution meta between
|
|
@@ -164,19 +76,70 @@ export declare class ExecutableStep<TData = any> extends BaseStep {
|
|
|
164
76
|
* Like `metaKey` but for the optimize phase
|
|
165
77
|
*/
|
|
166
78
|
optimizeMetaKey: number | string | symbol | undefined;
|
|
79
|
+
/**
|
|
80
|
+
* If the peerKey of two steps do not match, then they are definitely not
|
|
81
|
+
* peers. Use this to reduce the load on deduplicate by more quickly
|
|
82
|
+
* eradicating definitely-not-peers.
|
|
83
|
+
*
|
|
84
|
+
* Note: we may well change this to be a function in future, so it's advised
|
|
85
|
+
* that you don't use this unless you're working inside the graphile/crystal
|
|
86
|
+
* core codebase.
|
|
87
|
+
*
|
|
88
|
+
* @experimental
|
|
89
|
+
*/
|
|
90
|
+
peerKey: string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Set this true for plans that implement mutations; this will prevent them
|
|
93
|
+
* from being tree-shaken.
|
|
94
|
+
*/
|
|
95
|
+
hasSideEffects: boolean;
|
|
167
96
|
constructor();
|
|
97
|
+
/**
|
|
98
|
+
* Generally you should only use this once the dependencies of a step are
|
|
99
|
+
* established, if you use it beforehand and it returns `true` then adding a
|
|
100
|
+
* non-unary dependency later will result in an error.
|
|
101
|
+
*/
|
|
102
|
+
getAndFreezeIsUnary(): boolean;
|
|
168
103
|
protected withMyLayerPlan<T>(callback: () => T): T;
|
|
169
|
-
|
|
170
|
-
|
|
104
|
+
/** @experimental */
|
|
105
|
+
withLayerPlan<T>(callback: () => T): T;
|
|
106
|
+
protected getStep(id: number): Step;
|
|
107
|
+
protected getDepOptions<TStep extends Step = Step>(depId: number): DependencyOptions<TStep>;
|
|
108
|
+
protected getDep<TStep extends Step = Step>(_depId: number): TStep | __FlagStep<TStep>;
|
|
109
|
+
protected getDep<TStep extends Step = Step>(_depId: number, throwOnFlagged: true): TStep;
|
|
110
|
+
protected maybeGetDep<TStep extends Step = Step>(depId: number | null | undefined): TStep | __FlagStep<TStep> | null;
|
|
111
|
+
protected maybeGetDep<TStep extends Step = Step>(depId: number | null | undefined, throwOnFlagged: true): TStep | null;
|
|
112
|
+
protected getDepOrConstant<TData = any>(_depId: number | null, _fallback: TData): Step<TData>;
|
|
171
113
|
/**
|
|
172
114
|
* Like getDep, except it skips over __ItemStep and similar steps to get to
|
|
173
115
|
* where the parent really is.
|
|
174
116
|
*
|
|
175
117
|
* @experimental
|
|
176
118
|
*/
|
|
177
|
-
protected getDepDeep(depId: number):
|
|
119
|
+
protected getDepDeep(depId: number): Step;
|
|
120
|
+
/**
|
|
121
|
+
* Cache a generated step by a given identifier (cacheKey) such that we don't
|
|
122
|
+
* need to regenerate it on future calls, significantly reducing the load on
|
|
123
|
+
* deduplication later.
|
|
124
|
+
*
|
|
125
|
+
* @experimental
|
|
126
|
+
*/
|
|
127
|
+
protected cacheStep<T extends Step>(actionKey: string, cacheKey: symbol | string | number, cb: () => T): T;
|
|
178
128
|
toString(): string;
|
|
179
|
-
|
|
129
|
+
/**
|
|
130
|
+
* This metadata will be merged into toString when referencing this plan.
|
|
131
|
+
*/
|
|
132
|
+
toStringMeta(): string | null;
|
|
133
|
+
planJSONExtra(): Record<string, JSONValue | undefined> | undefined;
|
|
134
|
+
protected canAddDependency(step: Step): boolean;
|
|
135
|
+
protected addDependency(stepOrOptions: Step | AddDependencyOptions): number;
|
|
136
|
+
/**
|
|
137
|
+
* Adds "unary" dependencies; in `execute({count, values})` you'll receive a
|
|
138
|
+
* `values[index]` (where `index` is the return value of this function) with
|
|
139
|
+
* `isBatch = false` so you can use the `values[index].value` property
|
|
140
|
+
* directly.
|
|
141
|
+
*/
|
|
142
|
+
protected addUnaryDependency(stepOrOptions: Step | AddDependencyOptions): number;
|
|
180
143
|
/**
|
|
181
144
|
* Given a list of "peer" steps, return a list of these `peers` that are
|
|
182
145
|
* equivalent to this step.
|
|
@@ -187,27 +150,34 @@ export declare class ExecutableStep<TData = any> extends BaseStep {
|
|
|
187
150
|
* If you need to transform the peer to be equivalent you should do so via
|
|
188
151
|
* the `deduplicatedWith` callback later.
|
|
189
152
|
*/
|
|
190
|
-
deduplicate?(_peers: readonly
|
|
153
|
+
deduplicate?(_peers: readonly Step[]): readonly Step[];
|
|
191
154
|
/**
|
|
192
155
|
* If this plan is replaced via deduplication, this method gives it a chance
|
|
193
156
|
* to hand over its responsibilities to its replacement.
|
|
194
157
|
*/
|
|
195
|
-
deduplicatedWith?(replacement:
|
|
158
|
+
deduplicatedWith?(replacement: Step): void;
|
|
196
159
|
/**
|
|
197
160
|
* Our chance to optimise the plan (which could go as far as to inline the
|
|
198
161
|
* plan into the parent plan).
|
|
199
162
|
*/
|
|
200
|
-
optimize?(_options: StepOptimizeOptions):
|
|
163
|
+
optimize?(_options: StepOptimizeOptions): Step;
|
|
201
164
|
finalize(): void;
|
|
202
165
|
/**
|
|
203
|
-
* This function will be called with
|
|
204
|
-
* each incoming grafast object, where each entry in the array is a list of
|
|
205
|
-
* the values retrieved from executing the plans in `this.dependencies` for
|
|
206
|
-
* that grafast object.
|
|
166
|
+
* This function will be called with 'execution details', an object containing:
|
|
207
167
|
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
*
|
|
168
|
+
* - `count`: the number of entries in the batch that's being executed
|
|
169
|
+
* - `values`: a tuple representing the runtime values of the steps
|
|
170
|
+
* dependencies; each value in the tuple is an object, either a batch object
|
|
171
|
+
* containing a list of size `count` containing the values, or a unary
|
|
172
|
+
* object containing the single value common to all entries.
|
|
173
|
+
* - `indexMap`: helper function to map over each index from `0` to `count-1`,
|
|
174
|
+
* returning the resulting array.
|
|
175
|
+
* - `indexForEach`: as `indexMap`, but without the array result.
|
|
176
|
+
* - `meta`: [experimental]
|
|
177
|
+
*
|
|
178
|
+
* `execute` must return a list with `count` entries, where each value in the
|
|
179
|
+
* list relates to the result of executing this plan for the corresponding
|
|
180
|
+
* entry in each of the entries in the `values` tuple.
|
|
211
181
|
*
|
|
212
182
|
* IMPORTANT: it is up to the execute function to cache/memoize results as
|
|
213
183
|
* appropriate for performance, this can be done via the `meta` object.
|
|
@@ -217,81 +187,57 @@ export declare class ExecutableStep<TData = any> extends BaseStep {
|
|
|
217
187
|
* add attributes to meta for each purpose (e.g. use `meta.cache` for
|
|
218
188
|
* memoizing results) so that you can expand your usage of meta in future.
|
|
219
189
|
*/
|
|
220
|
-
execute(
|
|
190
|
+
execute(details: ExecutionDetails): ExecutionResults<TData>;
|
|
221
191
|
destroy(): void;
|
|
222
192
|
}
|
|
223
|
-
export declare abstract class
|
|
193
|
+
export declare abstract class UnbatchedStep<TData = any> extends Step<TData> {
|
|
224
194
|
static $$export: {
|
|
225
195
|
moduleName: string;
|
|
226
196
|
exportName: string;
|
|
227
197
|
};
|
|
228
198
|
finalize(): void;
|
|
229
|
-
execute(
|
|
230
|
-
abstract unbatchedExecute(extra:
|
|
199
|
+
execute({ indexMap, values, extra, }: ExecutionDetails): PromiseOrDirect<GrafastResultsList<TData>>;
|
|
200
|
+
abstract unbatchedExecute(extra: UnbatchedExecutionExtra, ...tuple: any[]): PromiseOrDirect<TData>;
|
|
231
201
|
}
|
|
232
|
-
export declare function
|
|
233
|
-
export declare function
|
|
234
|
-
export declare function
|
|
202
|
+
export declare function isStep<TData = any>(step: unknown): step is Step<TData>;
|
|
203
|
+
export declare function assertStep<TData>(step: unknown): asserts step is Step<TData>;
|
|
204
|
+
export declare function isUnbatchedStep<TData = any>(step: unknown): step is UnbatchedStep<TData>;
|
|
235
205
|
export type ObjectLikeStep<TData extends {
|
|
236
|
-
[key: string]:
|
|
206
|
+
[key: string]: Step;
|
|
237
207
|
} = {
|
|
238
|
-
[key: string]:
|
|
239
|
-
}> =
|
|
240
|
-
[key in keyof TData]: TData[key] extends
|
|
208
|
+
[key: string]: Step;
|
|
209
|
+
}> = Step<{
|
|
210
|
+
[key in keyof TData]: TData[key] extends Step<infer U> ? U : never;
|
|
241
211
|
}> & {
|
|
242
|
-
get<TKey extends keyof TData>(key: TKey):
|
|
212
|
+
get<TKey extends keyof TData>(key: TKey): Step<TData[TKey]>;
|
|
243
213
|
};
|
|
244
214
|
export declare function isObjectLikeStep<TData extends {
|
|
245
|
-
[key: string]:
|
|
215
|
+
[key: string]: Step;
|
|
246
216
|
} = {
|
|
247
|
-
[key: string]:
|
|
248
|
-
}>(plan:
|
|
249
|
-
export type ListLikeStep<TData extends [...
|
|
250
|
-
[key in keyof TData]: TData[key] extends
|
|
217
|
+
[key: string]: Step;
|
|
218
|
+
}>(plan: Step): plan is ObjectLikeStep<TData>;
|
|
219
|
+
export type ListLikeStep<TData extends [...Step[]] = [...Step[]]> = Step<{
|
|
220
|
+
[key in keyof TData]: TData[key] extends Step<infer U> ? U : never;
|
|
251
221
|
}> & {
|
|
252
|
-
at<TKey extends keyof TData>(key: TKey):
|
|
253
|
-
};
|
|
254
|
-
export declare function isListLikeStep<TData extends [...ExecutableStep[]] = [...ExecutableStep[]]>(plan: ExecutableStep): plan is ListLikeStep<TData>;
|
|
255
|
-
export type StreamableStep<TData> = ExecutableStep<ReadonlyArray<TData>> & {
|
|
256
|
-
/**
|
|
257
|
-
* If this plan supports streaming then it should implement this method. It's
|
|
258
|
-
* basically the same as `execute` except it returns a list of result streams
|
|
259
|
-
* rather than a list of results.
|
|
260
|
-
*/
|
|
261
|
-
stream(count: number, values: ReadonlyArray<GrafastValuesList<any>>, extra: ExecutionExtra, streamOptions: {
|
|
262
|
-
initialCount: number;
|
|
263
|
-
}): PromiseOrDirect<GrafastResultStreamList<TData>>;
|
|
222
|
+
at<TKey extends keyof TData>(key: TKey): Step<TData[TKey]>;
|
|
264
223
|
};
|
|
265
|
-
export declare function
|
|
266
|
-
export type PolymorphicStep =
|
|
267
|
-
planForType(objectType: GraphQLObjectType):
|
|
224
|
+
export declare function isListLikeStep<TData extends [...Step[]] = [...Step[]]>(plan: Step): plan is ListLikeStep<TData>;
|
|
225
|
+
export type PolymorphicStep = Step & {
|
|
226
|
+
planForType(objectType: GraphQLObjectType): Step;
|
|
268
227
|
};
|
|
269
|
-
export declare function isPolymorphicStep(s:
|
|
270
|
-
|
|
271
|
-
* Modifier plans modify their parent plan (which may be another ModifierStep
|
|
272
|
-
* or an ExecutableStep). First they gather all the requirements from their
|
|
273
|
-
* children (if any) being applied to them, then they apply themselves to their
|
|
274
|
-
* parent plan. This application is done through the `apply()` method.
|
|
275
|
-
*
|
|
276
|
-
* Modifier plans do not use dependencies.
|
|
277
|
-
*/
|
|
278
|
-
export declare abstract class ModifierStep<TParentStep extends BaseStep = BaseStep> extends BaseStep {
|
|
279
|
-
protected readonly $parent: TParentStep;
|
|
280
|
-
static $$export: any;
|
|
281
|
-
readonly id: string;
|
|
282
|
-
constructor($parent: TParentStep);
|
|
283
|
-
toString(): string;
|
|
284
|
-
/**
|
|
285
|
-
* In this method, you should apply the changes to your `this.$parent` plan
|
|
286
|
-
*/
|
|
287
|
-
abstract apply(): void;
|
|
288
|
-
}
|
|
289
|
-
export declare function isModifierStep<TParentStep extends ExecutableStep | ModifierStep<any>>(plan: BaseStep): plan is ModifierStep<TParentStep>;
|
|
290
|
-
export declare function assertModifierStep<TParentStep extends ExecutableStep | ModifierStep<any>>(plan: BaseStep, pathDescription: string): asserts plan is ModifierStep<TParentStep>;
|
|
291
|
-
export interface ListCapableStep<TOutputData, TItemStep extends ExecutableStep<TOutputData> = ExecutableStep<TOutputData>> extends ExecutableStep<ReadonlyArray<any>> {
|
|
228
|
+
export declare function isPolymorphicStep(s: Step): s is PolymorphicStep;
|
|
229
|
+
export interface ListCapableStep<TOutputData, TItemStep extends Step<TOutputData> = Step<TOutputData>> extends Step<ReadonlyArray<any>> {
|
|
292
230
|
listItem(itemPlan: __ItemStep<this>): TItemStep;
|
|
293
231
|
}
|
|
294
|
-
export declare function isListCapableStep<TData, TItemStep extends
|
|
295
|
-
export declare function assertListCapableStep<TData, TItemStep extends
|
|
296
|
-
export {
|
|
232
|
+
export declare function isListCapableStep<TData, TItemStep extends Step<TData>>(plan: Step<ReadonlyArray<TData>>): plan is ListCapableStep<TData, TItemStep>;
|
|
233
|
+
export declare function assertListCapableStep<TData, TItemStep extends Step<TData>>(plan: Step<ReadonlyArray<TData>>, pathDescription: string): asserts plan is ListCapableStep<TData, TItemStep>;
|
|
234
|
+
export {
|
|
235
|
+
/** @deprecated Use ExecutableStep instead */
|
|
236
|
+
Step as ExecutableStep,
|
|
237
|
+
/** @deprecated Use UnbatchedStep instead */
|
|
238
|
+
UnbatchedStep as UnbatchedExecutableStep, };
|
|
239
|
+
/** @deprecated Use isStep instead */
|
|
240
|
+
export declare const isExecutableStep: typeof isStep;
|
|
241
|
+
/** @deprecated Use isStep instead */
|
|
242
|
+
export declare function assertExecutableStep<TData>(step: unknown): asserts step is Step<TData>;
|
|
297
243
|
//# sourceMappingURL=step.d.ts.map
|