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.
Files changed (157) hide show
  1. package/README.md +2 -3
  2. package/dist/args.d.ts +4 -7
  3. package/dist/args.js +53 -38
  4. package/dist/assert.js +2 -3
  5. package/dist/bucket.d.ts +1 -89
  6. package/dist/config.d.ts +0 -17
  7. package/dist/config.js +1 -95
  8. package/dist/constraints.d.ts +15 -1
  9. package/dist/constraints.js +41 -3
  10. package/dist/deferred.js +1 -2
  11. package/dist/dev.d.ts +1 -4
  12. package/dist/dev.js +18 -3
  13. package/dist/engine/LayerPlan.d.ts +21 -111
  14. package/dist/engine/LayerPlan.js +196 -78
  15. package/dist/engine/OperationPlan.d.ts +30 -104
  16. package/dist/engine/OperationPlan.js +763 -471
  17. package/dist/engine/OutputPlan.d.ts +9 -20
  18. package/dist/engine/OutputPlan.js +432 -444
  19. package/dist/engine/StepTracker.d.ts +1 -95
  20. package/dist/engine/StepTracker.js +94 -20
  21. package/dist/engine/executeBucket.d.ts +5 -7
  22. package/dist/engine/executeBucket.js +646 -244
  23. package/dist/engine/executeOutputPlan.d.ts +0 -53
  24. package/dist/engine/executeOutputPlan.js +7 -2
  25. package/dist/engine/lib/defaultPlanResolver.d.ts +6 -0
  26. package/dist/engine/lib/defaultPlanResolver.js +11 -0
  27. package/dist/engine/lib/withGlobalLayerPlan.d.ts +2 -0
  28. package/dist/engine/lib/withGlobalLayerPlan.js +7 -4
  29. package/dist/engine/lock.d.ts +4 -0
  30. package/dist/engine/lock.js +82 -0
  31. package/dist/envelop.js +5 -4
  32. package/dist/error.d.ts +18 -49
  33. package/dist/error.js +50 -39
  34. package/dist/establishOperationPlan.js +57 -42
  35. package/dist/execute.d.ts +5 -4
  36. package/dist/execute.js +31 -15
  37. package/dist/exportAs.d.ts +1 -18
  38. package/dist/exportAs.js +2 -3
  39. package/dist/global.js +2 -3
  40. package/dist/grafastGraphql.d.ts +6 -1
  41. package/dist/grafastGraphql.js +35 -16
  42. package/dist/grafastPrint.d.ts +3 -0
  43. package/dist/grafastPrint.js +67 -6
  44. package/dist/graphqlCollectFields.d.ts +7 -34
  45. package/dist/graphqlCollectFields.js +24 -13
  46. package/dist/graphqlMergeSelectionSets.js +1 -2
  47. package/dist/index.d.ts +44 -29
  48. package/dist/index.js +91 -18
  49. package/dist/input.d.ts +1 -9
  50. package/dist/input.js +75 -28
  51. package/dist/inspect.d.ts +9 -3
  52. package/dist/inspect.js +3 -3
  53. package/dist/interfaces.d.ts +238 -93
  54. package/dist/interfaces.js +20 -3
  55. package/dist/makeGrafastSchema.d.ts +21 -9
  56. package/dist/makeGrafastSchema.js +353 -133
  57. package/dist/mermaid.d.ts +0 -17
  58. package/dist/mermaid.js +131 -19
  59. package/dist/middleware.d.ts +7 -0
  60. package/dist/middleware.js +24 -0
  61. package/dist/multistep.d.ts +19 -0
  62. package/dist/multistep.js +54 -0
  63. package/dist/operationPlan-input.d.ts +5 -4
  64. package/dist/operationPlan-input.js +140 -368
  65. package/dist/planJSONInterfaces.d.ts +12 -2
  66. package/dist/polymorphic.js +4 -5
  67. package/dist/prepare.d.ts +1 -7
  68. package/dist/prepare.js +100 -74
  69. package/dist/step.d.ts +118 -172
  70. package/dist/step.js +262 -183
  71. package/dist/steps/__flag.d.ts +65 -0
  72. package/dist/steps/__flag.js +261 -0
  73. package/dist/steps/__inputDefault.d.ts +14 -0
  74. package/dist/steps/__inputDefault.js +48 -0
  75. package/dist/steps/__inputDynamicScalar.d.ts +4 -6
  76. package/dist/steps/__inputDynamicScalar.js +4 -2
  77. package/dist/steps/__inputList.d.ts +5 -9
  78. package/dist/steps/__inputList.js +4 -1
  79. package/dist/steps/__inputObject.d.ts +7 -11
  80. package/dist/steps/__inputObject.js +49 -3
  81. package/dist/steps/__inputStaticLeaf.d.ts +2 -4
  82. package/dist/steps/__inputStaticLeaf.js +3 -1
  83. package/dist/steps/__item.d.ts +10 -12
  84. package/dist/steps/__item.js +8 -2
  85. package/dist/steps/__trackedValue.d.ts +7 -55
  86. package/dist/steps/__trackedValue.js +69 -8
  87. package/dist/steps/__value.d.ts +5 -4
  88. package/dist/steps/__value.js +5 -4
  89. package/dist/steps/access.d.ts +10 -10
  90. package/dist/steps/access.js +50 -17
  91. package/dist/steps/applyInput.d.ts +44 -0
  92. package/dist/steps/applyInput.js +206 -0
  93. package/dist/steps/applyTransforms.d.ts +2 -25
  94. package/dist/steps/applyTransforms.js +53 -31
  95. package/dist/steps/bakedInput.d.ts +23 -0
  96. package/dist/steps/bakedInput.js +90 -0
  97. package/dist/steps/condition.d.ts +31 -0
  98. package/dist/steps/condition.js +94 -0
  99. package/dist/steps/connection.d.ts +56 -42
  100. package/dist/steps/connection.js +97 -44
  101. package/dist/steps/constant.d.ts +7 -7
  102. package/dist/steps/constant.js +86 -7
  103. package/dist/steps/each.d.ts +3 -3
  104. package/dist/steps/each.js +2 -3
  105. package/dist/steps/error.d.ts +4 -4
  106. package/dist/steps/error.js +7 -6
  107. package/dist/steps/filter.d.ts +3 -2
  108. package/dist/steps/filter.js +1 -2
  109. package/dist/steps/first.d.ts +10 -9
  110. package/dist/steps/first.js +9 -13
  111. package/dist/steps/graphqlResolver.d.ts +3 -76
  112. package/dist/steps/graphqlResolver.js +89 -72
  113. package/dist/steps/groupBy.d.ts +3 -2
  114. package/dist/steps/groupBy.js +1 -2
  115. package/dist/steps/index.d.ts +12 -3
  116. package/dist/steps/index.js +48 -6
  117. package/dist/steps/lambda.d.ts +9 -9
  118. package/dist/steps/lambda.js +18 -9
  119. package/dist/steps/last.d.ts +9 -8
  120. package/dist/steps/last.js +7 -6
  121. package/dist/steps/list.d.ts +20 -9
  122. package/dist/steps/list.js +56 -13
  123. package/dist/steps/listTransform.d.ts +18 -22
  124. package/dist/steps/listTransform.js +58 -27
  125. package/dist/steps/listen.d.ts +6 -11
  126. package/dist/steps/listen.js +14 -16
  127. package/dist/steps/load.d.ts +42 -33
  128. package/dist/steps/load.js +60 -27
  129. package/dist/steps/node.d.ts +17 -10
  130. package/dist/steps/node.js +18 -6
  131. package/dist/steps/object.d.ts +33 -27
  132. package/dist/steps/object.js +53 -32
  133. package/dist/steps/partitionByIndex.d.ts +3 -2
  134. package/dist/steps/partitionByIndex.js +1 -2
  135. package/dist/steps/polymorphicBranch.d.ts +27 -0
  136. package/dist/steps/polymorphicBranch.js +62 -0
  137. package/dist/steps/proxy.d.ts +11 -12
  138. package/dist/steps/proxy.js +8 -5
  139. package/dist/steps/remapKeys.d.ts +10 -10
  140. package/dist/steps/remapKeys.js +14 -7
  141. package/dist/steps/reverse.d.ts +8 -8
  142. package/dist/steps/reverse.js +10 -7
  143. package/dist/steps/setter.d.ts +9 -18
  144. package/dist/steps/setter.js +24 -14
  145. package/dist/steps/sideEffect.d.ts +28 -0
  146. package/dist/steps/sideEffect.js +44 -0
  147. package/dist/stringifyPayload.js +1 -2
  148. package/dist/stripAnsi.js +2 -2
  149. package/dist/subscribe.d.ts +7 -1
  150. package/dist/subscribe.js +24 -9
  151. package/dist/thereCanBeOnlyOne.js +1 -1
  152. package/dist/timeSource.d.ts +0 -1
  153. package/dist/utils.d.ts +56 -55
  154. package/dist/utils.js +179 -59
  155. package/dist/version.d.ts +1 -1
  156. package/dist/version.js +1 -1
  157. 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 { ExecutionExtra, GrafastResultsList, GrafastResultStreamList, GrafastValuesList, JSONValue, PromiseOrDirect, StepOptimizeOptions, StepOptions } from "./interfaces.js";
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
- * The base abstract plan type; you should not extend this directly - instead
22
- * use an ExecutableStep (for use when planning output fields) or a
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 abstract class BaseStep {
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 GrafastError objects
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
- * The plan this plan will need data from in order to execute.
112
- * @internal
44
+ * (default = ALL_FLAGS & ~FLAG_NULL)
113
45
  */
114
- readonly dependencies: ReadonlyArray<ExecutableStep>;
46
+ protected readonly defaultForbiddenFlags: ExecutionEntryFlags;
115
47
  /**
116
- * Just for mermaid
117
- * @internal
48
+ * The plan this plan will need data from in order to execute.
118
49
  */
119
- readonly dependents: ReadonlyArray<{
120
- step: ExecutableStep;
121
- dependencyIndex: number;
122
- }>;
50
+ protected readonly dependencies: ReadonlyArray<Step>;
123
51
  /**
124
- * We reserve the right to change our mind as to whether this is a string or
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
- protected getStep(id: number): ExecutableStep;
170
- getDep(depId: number): ExecutableStep;
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): ExecutableStep;
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
- protected addDependency(step: ExecutableStep, skipDeduplication?: boolean): number;
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 ExecutableStep[]): readonly ExecutableStep[];
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: ExecutableStep): void;
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): ExecutableStep;
163
+ optimize?(_options: StepOptimizeOptions): Step;
201
164
  finalize(): void;
202
165
  /**
203
- * This function will be called with a `values` list: an array of entries for
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
- * It must return a list with the same length as `values`, where each value
209
- * in the list relates to the result of executing this plan for the
210
- * corresponding entry in the `values` list.
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(count: number, values: ReadonlyArray<GrafastValuesList<any>>, extra: ExecutionExtra): PromiseOrDirect<GrafastResultsList<TData>>;
190
+ execute(details: ExecutionDetails): ExecutionResults<TData>;
221
191
  destroy(): void;
222
192
  }
223
- export declare abstract class UnbatchedExecutableStep<TData = any> extends ExecutableStep<TData> {
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(count: number, values: ReadonlyArray<GrafastValuesList<any>>, extra: ExecutionExtra): PromiseOrDirect<GrafastResultsList<TData>>;
230
- abstract unbatchedExecute(extra: ExecutionExtra, ...tuple: any[]): PromiseOrDirect<TData>;
199
+ execute({ indexMap, values, extra, }: ExecutionDetails): PromiseOrDirect<GrafastResultsList<TData>>;
200
+ abstract unbatchedExecute(extra: UnbatchedExecutionExtra, ...tuple: any[]): PromiseOrDirect<TData>;
231
201
  }
232
- export declare function isExecutableStep<TData = any>(step: unknown): step is ExecutableStep<TData>;
233
- export declare function assertExecutableStep<TData>(step: BaseStep): asserts step is ExecutableStep<TData>;
234
- export declare function isUnbatchedExecutableStep<TData = any>(step: unknown): step is UnbatchedExecutableStep<TData>;
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]: ExecutableStep;
206
+ [key: string]: Step;
237
207
  } = {
238
- [key: string]: ExecutableStep;
239
- }> = ExecutableStep<{
240
- [key in keyof TData]: TData[key] extends ExecutableStep<infer U> ? U : never;
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): ExecutableStep<TData[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]: ExecutableStep;
215
+ [key: string]: Step;
246
216
  } = {
247
- [key: string]: ExecutableStep;
248
- }>(plan: ExecutableStep): plan is ObjectLikeStep<TData>;
249
- export type ListLikeStep<TData extends [...ExecutableStep[]] = [...ExecutableStep[]]> = ExecutableStep<{
250
- [key in keyof TData]: TData[key] extends ExecutableStep<infer U> ? U : never;
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): ExecutableStep<TData[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 isStreamableStep<TData>(plan: ExecutableStep<ReadonlyArray<TData>>): plan is StreamableStep<TData>;
266
- export type PolymorphicStep = ExecutableStep & {
267
- planForType(objectType: GraphQLObjectType): ExecutableStep;
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: ExecutableStep): s is PolymorphicStep;
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 ExecutableStep<TData>>(plan: ExecutableStep<ReadonlyArray<TData>>): plan is ListCapableStep<TData, TItemStep>;
295
- export declare function assertListCapableStep<TData, TItemStep extends ExecutableStep<TData>>(plan: ExecutableStep<ReadonlyArray<TData>>, pathDescription: string): asserts plan is ListCapableStep<TData, TItemStep>;
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