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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Bucket } from "../bucket.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { Step } from "../step";
|
|
3
3
|
import type { OperationPlan } from "./OperationPlan";
|
|
4
4
|
/** Non-branching, non-deferred */
|
|
5
5
|
export interface LayerPlanReasonRoot {
|
|
@@ -15,7 +15,12 @@ export interface LayerPlanReasonNullableField {
|
|
|
15
15
|
*
|
|
16
16
|
* Also needed for execution (see `executeBucket`).
|
|
17
17
|
*/
|
|
18
|
-
parentStep:
|
|
18
|
+
parentStep: Step;
|
|
19
|
+
}
|
|
20
|
+
export interface LayerPlanReasonListItemStream {
|
|
21
|
+
initialCountStepId?: number;
|
|
22
|
+
ifStepId?: number;
|
|
23
|
+
labelStepId?: number;
|
|
19
24
|
}
|
|
20
25
|
/** Non-branching, non-deferred */
|
|
21
26
|
export interface LayerPlanReasonListItem {
|
|
@@ -27,12 +32,11 @@ export interface LayerPlanReasonListItem {
|
|
|
27
32
|
*
|
|
28
33
|
* Also needed for execution (see `executeBucket`).
|
|
29
34
|
*/
|
|
30
|
-
parentStep:
|
|
31
|
-
/**
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
};
|
|
35
|
+
parentStep: Step;
|
|
36
|
+
/**
|
|
37
|
+
* If this listItem is to be streamed, the configuration for that streaming.
|
|
38
|
+
*/
|
|
39
|
+
stream?: LayerPlanReasonListItemStream;
|
|
36
40
|
}
|
|
37
41
|
/** Non-branching, deferred */
|
|
38
42
|
export interface LayerPlanReasonSubscription {
|
|
@@ -55,59 +59,22 @@ export interface LayerPlanReasonPolymorphic {
|
|
|
55
59
|
/**
|
|
56
60
|
* Needed for execution (see `executeBucket`).
|
|
57
61
|
*/
|
|
58
|
-
parentStep:
|
|
62
|
+
parentStep: Step;
|
|
59
63
|
polymorphicPaths: Set<string>;
|
|
60
64
|
}
|
|
61
65
|
/** Non-branching, non-deferred */
|
|
62
66
|
export interface LayerPlanReasonSubroutine {
|
|
63
67
|
type: "subroutine";
|
|
64
|
-
parentStep:
|
|
68
|
+
parentStep: Step;
|
|
65
69
|
}
|
|
66
|
-
export declare function isBranchingLayerPlan(layerPlan: LayerPlan
|
|
67
|
-
export declare function isDeferredLayerPlan(layerPlan: LayerPlan
|
|
68
|
-
export declare function isPolymorphicLayerPlan(layerPlan: LayerPlan
|
|
70
|
+
export declare function isBranchingLayerPlan(layerPlan: LayerPlan): boolean;
|
|
71
|
+
export declare function isDeferredLayerPlan(layerPlan: LayerPlan): boolean;
|
|
72
|
+
export declare function isPolymorphicLayerPlan(layerPlan: LayerPlan): boolean;
|
|
69
73
|
export type LayerPlanReason = LayerPlanReasonRoot | LayerPlanReasonNullableField | LayerPlanReasonListItem | LayerPlanReasonSubscription | LayerPlanReasonMutationField | LayerPlanReasonDefer | LayerPlanReasonPolymorphic | LayerPlanReasonSubroutine;
|
|
70
74
|
export type HasParent<A extends LayerPlanReason> = A extends any ? A extends {
|
|
71
|
-
parentStep:
|
|
75
|
+
parentStep: Step;
|
|
72
76
|
} ? A : never : never;
|
|
73
77
|
export type LayerPlanReasonsWithParentStep = HasParent<LayerPlanReason>;
|
|
74
|
-
/** @internal */
|
|
75
|
-
export interface LayerPlanPhase {
|
|
76
|
-
/**
|
|
77
|
-
* If true, we should check before the layer plan executes to see if the
|
|
78
|
-
* execution has already timed out.
|
|
79
|
-
*
|
|
80
|
-
* @see {@link RequestTools.stopTime}
|
|
81
|
-
*/
|
|
82
|
-
checkTimeout: boolean;
|
|
83
|
-
/**
|
|
84
|
-
* A list of steps that can be ran in parallel at this point, since all
|
|
85
|
-
* their previous dependencies have already been satisfied.
|
|
86
|
-
*/
|
|
87
|
-
normalSteps: Array<{
|
|
88
|
-
step: ExecutableStep;
|
|
89
|
-
}> | undefined;
|
|
90
|
-
/**
|
|
91
|
-
* A list of 'isSyncAndSafe' steps with unbatchedExecute methods that can be
|
|
92
|
-
* ran once the `normalSteps` have completed; they must only depend on steps
|
|
93
|
-
* that have already been executed before them (including previous
|
|
94
|
-
* unbatchedSyncAndSafeSteps in the same list).
|
|
95
|
-
*/
|
|
96
|
-
unbatchedSyncAndSafeSteps: Array<{
|
|
97
|
-
step: UnbatchedExecutableStep;
|
|
98
|
-
/**
|
|
99
|
-
* Store the result of the step here if you want - useful to avoid lookups
|
|
100
|
-
* and when there's no storage. HIGHLY VOLATILE, will not survive a tick!
|
|
101
|
-
*/
|
|
102
|
-
scratchpad: any;
|
|
103
|
-
}> | undefined;
|
|
104
|
-
/**
|
|
105
|
-
* Optimization - a digest of all steps in normalSteps and unbatchedSyncAndSafeSteps
|
|
106
|
-
*
|
|
107
|
-
* @internal
|
|
108
|
-
*/
|
|
109
|
-
_allSteps: ExecutableStep[];
|
|
110
|
-
}
|
|
111
78
|
/**
|
|
112
79
|
* A LayerPlan represents (via "reason") either the root (root), when something
|
|
113
80
|
* happens at a later time (mutationField, defer), when plurality changes
|
|
@@ -138,58 +105,6 @@ export declare class LayerPlan<TReason extends LayerPlanReason = LayerPlanReason
|
|
|
138
105
|
parentLayerPlan: LayerPlan | null;
|
|
139
106
|
readonly reason: TReason;
|
|
140
107
|
id: number;
|
|
141
|
-
/**
|
|
142
|
-
* Every layer plan has a "root step" that shapes the value the layer
|
|
143
|
-
* returns. Note that this step may be dependent on other steps included in
|
|
144
|
-
* the LayerPlan, or could be provided externally.
|
|
145
|
-
*
|
|
146
|
-
* The root step is different for different layer step reasons:
|
|
147
|
-
*
|
|
148
|
-
* - root: the `operationPlan.rootValue`
|
|
149
|
-
* - listItem: the `__ItemStep`
|
|
150
|
-
* - stream: also the `__ItemStep`
|
|
151
|
-
* - subscription: also the `__ItemStep`
|
|
152
|
-
* - mutationField: the result plan of the mutation field
|
|
153
|
-
* - defer: the parent layer's rootStep (defer always results in an object, unless an error occurs)
|
|
154
|
-
* - polymorphic: the plan for the particular type
|
|
155
|
-
* - subroutine: the result (returned) plan of the subroutine
|
|
156
|
-
*
|
|
157
|
-
* @internal
|
|
158
|
-
*/
|
|
159
|
-
readonly rootStep: ExecutableStep | null;
|
|
160
|
-
/**
|
|
161
|
-
* Which plans the results for which are available in a parent bucket need to
|
|
162
|
-
* be "copied across" to this bucket because plans in this bucket still
|
|
163
|
-
* reference them?
|
|
164
|
-
*
|
|
165
|
-
* @internal
|
|
166
|
-
*/
|
|
167
|
-
copyStepIds: number[];
|
|
168
|
-
/** @internal */
|
|
169
|
-
children: LayerPlan[];
|
|
170
|
-
/** @internal */
|
|
171
|
-
steps: ExecutableStep[];
|
|
172
|
-
/** @internal */
|
|
173
|
-
pendingSteps: ExecutableStep[];
|
|
174
|
-
/**
|
|
175
|
-
* Describes the order in which the steps within this LayerPlan are executed.
|
|
176
|
-
*
|
|
177
|
-
* Special attention must be paid to steps that have side effects.
|
|
178
|
-
*
|
|
179
|
-
* @internal
|
|
180
|
-
*/
|
|
181
|
-
phases: Array<LayerPlanPhase>;
|
|
182
|
-
/**
|
|
183
|
-
* The list of layerPlans that steps added to this LayerPlan may depend upon.
|
|
184
|
-
* Note this includes self, so it has one more entry than `depth`.
|
|
185
|
-
*
|
|
186
|
-
* ```
|
|
187
|
-
* this.ancestry[this.depth] === this;
|
|
188
|
-
* ```
|
|
189
|
-
*
|
|
190
|
-
* @internal
|
|
191
|
-
*/
|
|
192
|
-
ancestry: LayerPlan[];
|
|
193
108
|
/** How "deep" this layer plan is (how many ancestors it has). The root layer plan has a depth of 0. */
|
|
194
109
|
depth: number;
|
|
195
110
|
/** The depth at which a "defer boundary" occurs (OperationPlan.getPeers cannot pass a defer boundary), or 0. */
|
|
@@ -198,17 +113,12 @@ export declare class LayerPlan<TReason extends LayerPlanReason = LayerPlanReason
|
|
|
198
113
|
* An optimization for OperationPlan.getPeers; this tracks the steps in this
|
|
199
114
|
* layer plan, grouped by their step class.
|
|
200
115
|
*/
|
|
201
|
-
stepsByConstructor: Map<Function, Set<
|
|
116
|
+
stepsByConstructor: Map<Function, Set<Step>>;
|
|
202
117
|
constructor(operationPlan: OperationPlan, parentLayerPlan: LayerPlan | null, reason: TReason);
|
|
203
118
|
toString(): string;
|
|
204
119
|
print(depth?: number): string;
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
getStep(id: number, requestingStep: ExecutableStep): ExecutableStep;
|
|
208
|
-
/** @internal */
|
|
209
|
-
_addStep(step: ExecutableStep): number;
|
|
210
|
-
/** @internal */
|
|
211
|
-
_addModifierStep(step: ModifierStep<any>): string;
|
|
120
|
+
_hasSetRootStep: boolean;
|
|
121
|
+
setRootStep($root: Step): void;
|
|
212
122
|
finalize(): void;
|
|
213
123
|
newBucket(parentBucket: Bucket): Bucket | null;
|
|
214
124
|
}
|