grafast 0.1.1-beta.21 → 0.1.1-beta.23
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 +0 -4
- package/dist/args.js +3 -3
- package/dist/constants.d.ts +79 -0
- package/dist/constants.js +79 -0
- package/dist/engine/LayerPlan.d.ts +71 -8
- package/dist/engine/LayerPlan.js +375 -265
- package/dist/engine/OperationPlan.d.ts +77 -14
- package/dist/engine/OperationPlan.js +1508 -382
- package/dist/engine/OperationPlanTypes.d.ts +66 -0
- package/dist/engine/OperationPlanTypes.js +3 -0
- package/dist/engine/OutputPlan.d.ts +6 -0
- package/dist/engine/OutputPlan.js +138 -82
- package/dist/engine/StepTracker.js +76 -17
- package/dist/engine/executeBucket.js +327 -166
- package/dist/engine/lib/defaultPlanResolver.d.ts +1 -4
- package/dist/engine/lib/defaultPlanResolver.js +1 -5
- package/dist/engine/lib/withGlobalLayerPlan.d.ts +3 -1
- package/dist/engine/lib/withGlobalLayerPlan.js +19 -1
- package/dist/envelop.js +14 -3
- package/dist/error.d.ts +1 -1
- package/dist/error.js +9 -9
- package/dist/establishOperationPlan.d.ts +2 -1
- package/dist/establishOperationPlan.js +10 -10
- package/dist/execute.js +7 -5
- package/dist/global.d.ts +10 -0
- package/dist/global.js +25 -0
- package/dist/grafastGraphql.js +4 -3
- package/dist/grafastPrint.js +36 -4
- package/dist/index.d.ts +76 -8
- package/dist/index.js +37 -33
- package/dist/input.js +20 -1
- package/dist/inspect.js +1 -0
- package/dist/interfaces.d.ts +80 -122
- package/dist/interfaces.js +0 -77
- package/dist/makeGrafastSchema.d.ts +118 -35
- package/dist/makeGrafastSchema.js +197 -29
- package/dist/mermaid.js +198 -97
- package/dist/operationPlan-input.d.ts +1 -1
- package/dist/operationPlan-input.js +15 -5
- package/dist/planJSONInterfaces.d.ts +24 -5
- package/dist/prepare.d.ts +16 -9
- package/dist/prepare.js +54 -51
- package/dist/step.d.ts +45 -9
- package/dist/step.js +139 -22
- package/dist/steps/__flag.d.ts +3 -2
- package/dist/steps/__flag.js +31 -29
- package/dist/steps/__inputObject.d.ts +1 -1
- package/dist/steps/__inputStaticLeaf.d.ts +3 -2
- package/dist/steps/__inputStaticLeaf.js +13 -7
- package/dist/steps/__item.d.ts +1 -1
- package/dist/steps/__item.js +3 -3
- package/dist/steps/__trackedValue.d.ts +6 -3
- package/dist/steps/__trackedValue.js +25 -9
- package/dist/steps/__value.d.ts +2 -1
- package/dist/steps/__value.js +5 -0
- package/dist/steps/access.d.ts +17 -1
- package/dist/steps/access.js +14 -1
- package/dist/steps/applyInput.d.ts +1 -1
- package/dist/steps/applyInput.js +7 -6
- package/dist/steps/applyTransforms.js +9 -7
- package/dist/steps/bakedInput.js +2 -2
- package/dist/steps/coalesce.d.ts +15 -0
- package/dist/steps/coalesce.js +36 -0
- package/dist/steps/constant.js +16 -14
- package/dist/steps/each.d.ts +2 -2
- package/dist/steps/first.d.ts +2 -0
- package/dist/steps/first.js +5 -1
- package/dist/steps/graphqlResolver.d.ts +2 -2
- package/dist/steps/graphqlResolver.js +63 -161
- package/dist/steps/index.d.ts +3 -15
- package/dist/steps/index.js +6 -41
- package/dist/steps/lambda.js +1 -1
- package/dist/steps/last.d.ts +2 -0
- package/dist/steps/last.js +4 -0
- package/dist/steps/listTransform.d.ts +2 -2
- package/dist/steps/listTransform.js +11 -13
- package/dist/steps/load.d.ts +28 -22
- package/dist/steps/load.js +47 -1
- package/dist/steps/node.d.ts +10 -7
- package/dist/steps/node.js +5 -19
- package/dist/steps/object.js +6 -1
- package/dist/steps/proxy.d.ts +0 -6
- package/dist/steps/proxy.js +3 -3
- package/dist/steps/remapKeys.d.ts +1 -1
- package/dist/steps/remapKeys.js +0 -1
- package/dist/utils.d.ts +27 -5
- package/dist/utils.js +235 -15
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -7
- package/dist/polymorphic.d.ts +0 -14
- package/dist/polymorphic.js +0 -72
- package/dist/steps/polymorphicBranch.d.ts +0 -27
- package/dist/steps/polymorphicBranch.js +0 -62
package/README.md
CHANGED
|
@@ -50,11 +50,7 @@ And please give some love to our featured sponsors 🤩:
|
|
|
50
50
|
|
|
51
51
|
<table><tr>
|
|
52
52
|
<td align="center"><a href="https://www.the-guild.dev/"><img src="https://graphile.org/images/sponsors/theguild.png" width="90" height="90" alt="The Guild" /><br />The Guild</a> *</td>
|
|
53
|
-
<td align="center"><a href="https://dovetailapp.com/"><img src="https://graphile.org/images/sponsors/dovetail.png" width="90" height="90" alt="Dovetail" /><br />Dovetail</a> *</td>
|
|
54
|
-
<td align="center"><a href="https://stellate.co/"><img src="https://graphile.org/images/sponsors/Stellate.png" width="90" height="90" alt="Stellate" /><br />Stellate</a> *</td>
|
|
55
53
|
<td align="center"><a href="https://gosteelhead.com/"><img src="https://graphile.org/images/sponsors/steelhead.svg" width="90" height="90" alt="Steelhead" /><br />Steelhead</a> *</td>
|
|
56
|
-
</tr><tr>
|
|
57
|
-
<td align="center"><a href=""><img src="https://graphile.org/images/sponsors/latchbio.jpg" width="90" height="90" alt="LatchBio" /><br />LatchBio</a> *</td>
|
|
58
54
|
</tr></table>
|
|
59
55
|
|
|
60
56
|
<em>\* Sponsors the entire Graphile suite</em>
|
package/dist/args.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.hookArgs = hookArgs;
|
|
4
|
-
const
|
|
4
|
+
const constants_js_1 = require("./constants.js");
|
|
5
5
|
const middleware_js_1 = require("./middleware.js");
|
|
6
6
|
const utils_js_1 = require("./utils.js");
|
|
7
7
|
const EMPTY_OBJECT = Object.freeze(Object.create(null));
|
|
@@ -35,10 +35,10 @@ function hookArgs(rawArgs, legacyResolvedPreset, legacyCtx) {
|
|
|
35
35
|
}
|
|
36
36
|
const args = rawArgs;
|
|
37
37
|
// Assert that args haven't already been hooked
|
|
38
|
-
if (args[
|
|
38
|
+
if (args[constants_js_1.$$hooked]) {
|
|
39
39
|
throw new Error("Must not call hookArgs twice!");
|
|
40
40
|
}
|
|
41
|
-
args[
|
|
41
|
+
args[constants_js_1.$$hooked] = true;
|
|
42
42
|
if (middleware != null) {
|
|
43
43
|
return middleware.run("prepareArgs", { args }, finalizeWithEvent);
|
|
44
44
|
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
export declare const $$hooked: unique symbol;
|
|
2
|
+
export declare const $$grafastContext: unique symbol;
|
|
3
|
+
export declare const $$planResults: unique symbol;
|
|
4
|
+
export declare const $$id: unique symbol;
|
|
5
|
+
/** Return the value verbatim, don't execute */
|
|
6
|
+
export declare const $$verbatim: unique symbol;
|
|
7
|
+
/**
|
|
8
|
+
* If we're sure the data is the right shape and valid, we can set this key and
|
|
9
|
+
* it can be returned directly
|
|
10
|
+
*/
|
|
11
|
+
export declare const $$bypassGraphQL: unique symbol;
|
|
12
|
+
export declare const $$data: unique symbol;
|
|
13
|
+
/**
|
|
14
|
+
* For attaching additional metadata to the GraphQL execution result, for
|
|
15
|
+
* example details of the plan or SQL queries or similar that were executed.
|
|
16
|
+
*/
|
|
17
|
+
export declare const $$extensions: unique symbol;
|
|
18
|
+
/**
|
|
19
|
+
* Set this key on a type if that type's serialization is idempotent (that is
|
|
20
|
+
* to say `serialize(serialize(thing)) === serialize(thing)`). This means we
|
|
21
|
+
* don't have to "roll-back" serialization if we need to fallback to graphql-js
|
|
22
|
+
* execution.
|
|
23
|
+
*/
|
|
24
|
+
export declare const $$idempotent: unique symbol;
|
|
25
|
+
/**
|
|
26
|
+
* The event emitter used for outputting execution events.
|
|
27
|
+
*/
|
|
28
|
+
export declare const $$eventEmitter: unique symbol;
|
|
29
|
+
/**
|
|
30
|
+
* Used to indicate that an array has more results available via a stream.
|
|
31
|
+
*/
|
|
32
|
+
export declare const $$streamMore: unique symbol;
|
|
33
|
+
export declare const $$proxy: unique symbol;
|
|
34
|
+
/**
|
|
35
|
+
* If an error has this property set then it's safe to send through to the user
|
|
36
|
+
* without being masked.
|
|
37
|
+
*/
|
|
38
|
+
export declare const $$safeError: unique symbol;
|
|
39
|
+
/** The layerPlan used as a subroutine for this step */
|
|
40
|
+
export declare const $$subroutine: unique symbol;
|
|
41
|
+
/** For tracking the timeout a TimeoutError happened from */
|
|
42
|
+
export declare const $$timeout: unique symbol;
|
|
43
|
+
/** For tracking _when_ the timeout happened (because once the JIT has warmed it might not need so long) */
|
|
44
|
+
export declare const $$ts: unique symbol;
|
|
45
|
+
export declare const $$queryCache: unique symbol;
|
|
46
|
+
/**
|
|
47
|
+
* We store the cache directly onto the GraphQLSchema so that it gets garbage
|
|
48
|
+
* collected along with the schema when it's not needed any more. To do so, we
|
|
49
|
+
* attach it using this symbol.
|
|
50
|
+
*/
|
|
51
|
+
export declare const $$cacheByOperation: unique symbol;
|
|
52
|
+
export declare const $$contextPlanCache: unique symbol;
|
|
53
|
+
/**
|
|
54
|
+
* A bitwise number representing a number of flags:
|
|
55
|
+
*
|
|
56
|
+
* - 0: normal execution value
|
|
57
|
+
* - 1: errored (trappable)
|
|
58
|
+
* - 2: null (trappable)
|
|
59
|
+
* - 4: inhibited (trappable)
|
|
60
|
+
* - 8: disabled due to polymorphism (untrappable)
|
|
61
|
+
* - 16: stopped (untrappable) - e.g. due to fatal (unrecoverable) error
|
|
62
|
+
* - 32: ...
|
|
63
|
+
*/
|
|
64
|
+
export type ExecutionEntryFlags = number & {
|
|
65
|
+
readonly tsBrand?: unique symbol;
|
|
66
|
+
};
|
|
67
|
+
export declare const NO_FLAGS: ExecutionEntryFlags;
|
|
68
|
+
export declare const FLAG_ERROR: ExecutionEntryFlags;
|
|
69
|
+
export declare const FLAG_NULL: ExecutionEntryFlags;
|
|
70
|
+
export declare const FLAG_INHIBITED: ExecutionEntryFlags;
|
|
71
|
+
export declare const FLAG_POLY_SKIPPED: ExecutionEntryFlags;
|
|
72
|
+
export declare const FLAG_STOPPED: ExecutionEntryFlags;
|
|
73
|
+
export declare const ALL_FLAGS: ExecutionEntryFlags;
|
|
74
|
+
/** By default, accept null values as an input */
|
|
75
|
+
export declare const DEFAULT_ACCEPT_FLAGS: ExecutionEntryFlags;
|
|
76
|
+
export declare const TRAPPABLE_FLAGS: ExecutionEntryFlags;
|
|
77
|
+
export declare const DEFAULT_FORBIDDEN_FLAGS: ExecutionEntryFlags;
|
|
78
|
+
export declare const FORBIDDEN_BY_NULLABLE_BOUNDARY_FLAGS: ExecutionEntryFlags;
|
|
79
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FORBIDDEN_BY_NULLABLE_BOUNDARY_FLAGS = exports.DEFAULT_FORBIDDEN_FLAGS = exports.TRAPPABLE_FLAGS = exports.DEFAULT_ACCEPT_FLAGS = exports.ALL_FLAGS = exports.FLAG_STOPPED = exports.FLAG_POLY_SKIPPED = exports.FLAG_INHIBITED = exports.FLAG_NULL = exports.FLAG_ERROR = exports.NO_FLAGS = exports.$$contextPlanCache = exports.$$cacheByOperation = exports.$$queryCache = exports.$$deepDepSkip = exports.$$ts = exports.$$timeout = exports.$$subroutine = exports.$$safeError = exports.$$proxy = exports.$$streamMore = exports.$$eventEmitter = exports.$$idempotent = exports.$$extensions = exports.$$data = exports.$$bypassGraphQL = exports.$$verbatim = exports.$$id = exports.$$planResults = exports.$$grafastContext = exports.$$hooked = void 0;
|
|
4
|
+
exports.$$hooked = Symbol("hookArgsApplied");
|
|
5
|
+
exports.$$grafastContext = Symbol("context");
|
|
6
|
+
exports.$$planResults = Symbol("planResults");
|
|
7
|
+
exports.$$id = Symbol("id");
|
|
8
|
+
/** Return the value verbatim, don't execute */
|
|
9
|
+
exports.$$verbatim = Symbol("verbatim");
|
|
10
|
+
/**
|
|
11
|
+
* If we're sure the data is the right shape and valid, we can set this key and
|
|
12
|
+
* it can be returned directly
|
|
13
|
+
*/
|
|
14
|
+
exports.$$bypassGraphQL = Symbol("bypassGraphQL");
|
|
15
|
+
exports.$$data = Symbol("data");
|
|
16
|
+
/**
|
|
17
|
+
* For attaching additional metadata to the GraphQL execution result, for
|
|
18
|
+
* example details of the plan or SQL queries or similar that were executed.
|
|
19
|
+
*/
|
|
20
|
+
exports.$$extensions = Symbol("extensions");
|
|
21
|
+
/**
|
|
22
|
+
* Set this key on a type if that type's serialization is idempotent (that is
|
|
23
|
+
* to say `serialize(serialize(thing)) === serialize(thing)`). This means we
|
|
24
|
+
* don't have to "roll-back" serialization if we need to fallback to graphql-js
|
|
25
|
+
* execution.
|
|
26
|
+
*/
|
|
27
|
+
exports.$$idempotent = Symbol("idempotent");
|
|
28
|
+
/**
|
|
29
|
+
* The event emitter used for outputting execution events.
|
|
30
|
+
*/
|
|
31
|
+
exports.$$eventEmitter = Symbol("executionEventEmitter");
|
|
32
|
+
/**
|
|
33
|
+
* Used to indicate that an array has more results available via a stream.
|
|
34
|
+
*/
|
|
35
|
+
exports.$$streamMore = Symbol("streamMore");
|
|
36
|
+
exports.$$proxy = Symbol("proxy");
|
|
37
|
+
/**
|
|
38
|
+
* If an error has this property set then it's safe to send through to the user
|
|
39
|
+
* without being masked.
|
|
40
|
+
*/
|
|
41
|
+
exports.$$safeError = Symbol("safeError");
|
|
42
|
+
/** The layerPlan used as a subroutine for this step */
|
|
43
|
+
exports.$$subroutine = Symbol("subroutine");
|
|
44
|
+
/** For tracking the timeout a TimeoutError happened from */
|
|
45
|
+
exports.$$timeout = Symbol("timeout");
|
|
46
|
+
/** For tracking _when_ the timeout happened (because once the JIT has warmed it might not need so long) */
|
|
47
|
+
exports.$$ts = Symbol("timestamp");
|
|
48
|
+
/**
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
exports.$$deepDepSkip = Symbol("deepDepSkip_experimental");
|
|
52
|
+
exports.$$queryCache = Symbol("queryCache");
|
|
53
|
+
/**
|
|
54
|
+
* We store the cache directly onto the GraphQLSchema so that it gets garbage
|
|
55
|
+
* collected along with the schema when it's not needed any more. To do so, we
|
|
56
|
+
* attach it using this symbol.
|
|
57
|
+
*/
|
|
58
|
+
exports.$$cacheByOperation = Symbol("cacheByOperation");
|
|
59
|
+
exports.$$contextPlanCache = Symbol("contextPlanCache");
|
|
60
|
+
function flag(f) {
|
|
61
|
+
return f;
|
|
62
|
+
}
|
|
63
|
+
exports.NO_FLAGS = flag(0); // 0
|
|
64
|
+
exports.FLAG_ERROR = flag(1 << 0); // 1
|
|
65
|
+
exports.FLAG_NULL = flag(1 << 1); // 2
|
|
66
|
+
exports.FLAG_INHIBITED = flag(1 << 2); // 4
|
|
67
|
+
exports.FLAG_POLY_SKIPPED = flag(1 << 3); // 8
|
|
68
|
+
exports.FLAG_STOPPED = flag(1 << 4); // 16
|
|
69
|
+
exports.ALL_FLAGS = flag(exports.FLAG_ERROR | exports.FLAG_NULL | exports.FLAG_INHIBITED | exports.FLAG_POLY_SKIPPED | exports.FLAG_STOPPED);
|
|
70
|
+
/** By default, accept null values as an input */
|
|
71
|
+
exports.DEFAULT_ACCEPT_FLAGS = flag(exports.FLAG_NULL);
|
|
72
|
+
exports.TRAPPABLE_FLAGS = flag(exports.FLAG_ERROR | exports.FLAG_NULL | exports.FLAG_INHIBITED);
|
|
73
|
+
exports.DEFAULT_FORBIDDEN_FLAGS = flag(exports.ALL_FLAGS & ~exports.DEFAULT_ACCEPT_FLAGS);
|
|
74
|
+
exports.FORBIDDEN_BY_NULLABLE_BOUNDARY_FLAGS = flag(exports.FLAG_NULL | exports.FLAG_POLY_SKIPPED);
|
|
75
|
+
// TODO: make `FORBIDDEN_BY_NULLABLE_BOUNDARY_FLAGS = flag(FLAG_ERROR | FLAG_NULL | FLAG_POLY_SKIPPED | FLAG_INHIBITED | FLAG_STOPPED);`
|
|
76
|
+
// Currently this isn't enabled because the bucket has to exist for the output
|
|
77
|
+
// plan to throw the error; really the root should be evaluated before
|
|
78
|
+
// descending into the output plan rather than as part of descending?
|
|
79
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Bucket } from "../bucket.js";
|
|
2
2
|
import type { Step } from "../step";
|
|
3
|
+
import type { __ValueStep } from "../steps/index.js";
|
|
3
4
|
import type { OperationPlan } from "./OperationPlan";
|
|
4
5
|
/** Non-branching, non-deferred */
|
|
5
6
|
export interface LayerPlanReasonRoot {
|
|
@@ -8,6 +9,7 @@ export interface LayerPlanReasonRoot {
|
|
|
8
9
|
/** Non-branching, non-deferred */
|
|
9
10
|
export interface LayerPlanReasonNullableField {
|
|
10
11
|
type: "nullableBoundary";
|
|
12
|
+
parentLayerPlan: LayerPlan;
|
|
11
13
|
/**
|
|
12
14
|
* Can be used such that the same LayerPlan can be used for two selection
|
|
13
15
|
* sets for the same parent plan. In this case an additional output plan
|
|
@@ -25,6 +27,7 @@ export interface LayerPlanReasonListItemStream {
|
|
|
25
27
|
/** Non-branching, non-deferred */
|
|
26
28
|
export interface LayerPlanReasonListItem {
|
|
27
29
|
type: "listItem";
|
|
30
|
+
parentLayerPlan: LayerPlan;
|
|
28
31
|
/**
|
|
29
32
|
* Can be used such that the same LayerPlan can be used for two lists for
|
|
30
33
|
* the same parent plan. In this case an additional output plan would be
|
|
@@ -41,36 +44,82 @@ export interface LayerPlanReasonListItem {
|
|
|
41
44
|
/** Non-branching, deferred */
|
|
42
45
|
export interface LayerPlanReasonSubscription {
|
|
43
46
|
type: "subscription";
|
|
47
|
+
parentLayerPlan: LayerPlan;
|
|
44
48
|
}
|
|
45
49
|
/** Non-branching, deferred */
|
|
46
50
|
export interface LayerPlanReasonMutationField {
|
|
47
51
|
type: "mutationField";
|
|
52
|
+
parentLayerPlan: LayerPlan;
|
|
48
53
|
mutationIndex: number;
|
|
49
54
|
}
|
|
50
55
|
/** Non-branching, deferred */
|
|
51
56
|
export interface LayerPlanReasonDefer {
|
|
52
57
|
type: "defer";
|
|
58
|
+
parentLayerPlan: LayerPlan;
|
|
53
59
|
label?: string;
|
|
54
60
|
}
|
|
55
|
-
/**
|
|
61
|
+
/**
|
|
62
|
+
* Non-branching, non-deferred
|
|
63
|
+
*
|
|
64
|
+
* A polymorphic bucket indicates a transition between values of unknown type
|
|
65
|
+
* and values of a known polymorphic type. This is predicated based on the
|
|
66
|
+
* given typename - before the typename is known, we must run all steps for all
|
|
67
|
+
* types, but once the type is known we can be more selective about which steps
|
|
68
|
+
* to run.
|
|
69
|
+
*
|
|
70
|
+
* When a polymorphic type is met, there will always be a polymorphic layer
|
|
71
|
+
* plan, even if all steps within it run for all types. This is necessary to
|
|
72
|
+
* advance the `polymorphicPathList` index for the relevant indicies.
|
|
73
|
+
*/
|
|
56
74
|
export interface LayerPlanReasonPolymorphic {
|
|
57
75
|
type: "polymorphic";
|
|
76
|
+
parentLayerPlan: LayerPlan;
|
|
58
77
|
typeNames: string[];
|
|
59
78
|
/**
|
|
60
|
-
*
|
|
79
|
+
* Stores the __typename, needed for execution (see `executeBucket`).
|
|
61
80
|
*/
|
|
62
|
-
parentStep: Step
|
|
81
|
+
parentStep: Step<string | null>;
|
|
63
82
|
polymorphicPaths: Set<string>;
|
|
64
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Branching, non-deferred
|
|
86
|
+
*
|
|
87
|
+
* A polymorphicPartition bucket accepts a subset of types and contains only
|
|
88
|
+
* steps relevant to those types; it's a way to avoid having to do a lot of
|
|
89
|
+
* filtering of values being passed into steps' execute methods by
|
|
90
|
+
* pre-filtering the values.
|
|
91
|
+
*/
|
|
92
|
+
export interface LayerPlanReasonPolymorphicPartition {
|
|
93
|
+
type: "polymorphicPartition";
|
|
94
|
+
parentLayerPlan: LayerPlan<LayerPlanReasonPolymorphic>;
|
|
95
|
+
typeNames: string[];
|
|
96
|
+
polymorphicPaths: ReadonlySet<string>;
|
|
97
|
+
}
|
|
65
98
|
/** Non-branching, non-deferred */
|
|
66
99
|
export interface LayerPlanReasonSubroutine {
|
|
67
100
|
type: "subroutine";
|
|
101
|
+
parentLayerPlan: LayerPlan;
|
|
68
102
|
parentStep: Step;
|
|
69
103
|
}
|
|
70
|
-
|
|
104
|
+
/**
|
|
105
|
+
* Anti-branching, non-deferred
|
|
106
|
+
*
|
|
107
|
+
* A "combined" layer plan exists to re-combine values from multiple layer
|
|
108
|
+
* plans together again, to allow future steps to be more efficient. It's
|
|
109
|
+
* typically relevant when polymorphism has occurred and has caused branching,
|
|
110
|
+
* the combined layer plan allows the values to be recombined before branching
|
|
111
|
+
* again, such that L layers of polymorphism, where there are P different
|
|
112
|
+
* polymorphic branches at each layer, results in P*L branches rather than P^L
|
|
113
|
+
* branches - i.e. it scales linary with number of layers rather than
|
|
114
|
+
* exponentially.
|
|
115
|
+
*/
|
|
116
|
+
export interface LayerPlanReasonCombined {
|
|
117
|
+
type: "combined";
|
|
118
|
+
parentLayerPlans: ReadonlyArray<LayerPlan>;
|
|
119
|
+
}
|
|
120
|
+
export declare function hasParentLayerPlan(reason: LayerPlanReason): reason is Exclude<LayerPlanReason, LayerPlanReasonRoot | LayerPlanReasonCombined>;
|
|
71
121
|
export declare function isDeferredLayerPlan(layerPlan: LayerPlan): boolean;
|
|
72
|
-
export
|
|
73
|
-
export type LayerPlanReason = LayerPlanReasonRoot | LayerPlanReasonNullableField | LayerPlanReasonListItem | LayerPlanReasonSubscription | LayerPlanReasonMutationField | LayerPlanReasonDefer | LayerPlanReasonPolymorphic | LayerPlanReasonSubroutine;
|
|
122
|
+
export type LayerPlanReason = LayerPlanReasonRoot | LayerPlanReasonNullableField | LayerPlanReasonListItem | LayerPlanReasonSubscription | LayerPlanReasonMutationField | LayerPlanReasonDefer | LayerPlanReasonPolymorphic | LayerPlanReasonPolymorphicPartition | LayerPlanReasonCombined | LayerPlanReasonSubroutine;
|
|
74
123
|
export type HasParent<A extends LayerPlanReason> = A extends any ? A extends {
|
|
75
124
|
parentStep: Step;
|
|
76
125
|
} ? A : never : never;
|
|
@@ -102,7 +151,6 @@ export type LayerPlanReasonsWithParentStep = HasParent<LayerPlanReason>;
|
|
|
102
151
|
*/
|
|
103
152
|
export declare class LayerPlan<TReason extends LayerPlanReason = LayerPlanReason> {
|
|
104
153
|
readonly operationPlan: OperationPlan;
|
|
105
|
-
parentLayerPlan: LayerPlan | null;
|
|
106
154
|
readonly reason: TReason;
|
|
107
155
|
id: number;
|
|
108
156
|
/** How "deep" this layer plan is (how many ancestors it has). The root layer plan has a depth of 0. */
|
|
@@ -114,12 +162,27 @@ export declare class LayerPlan<TReason extends LayerPlanReason = LayerPlanReason
|
|
|
114
162
|
* layer plan, grouped by their step class.
|
|
115
163
|
*/
|
|
116
164
|
stepsByConstructor: Map<Function, Set<Step>>;
|
|
117
|
-
|
|
165
|
+
/**
|
|
166
|
+
* Populated during `finalize`, this will be empty except for phase
|
|
167
|
+
* transition layer plans (defer/stream) wherein it will contain a list of
|
|
168
|
+
* "unreachable" layer plan IDs relevant to the "combined" layer plans trying
|
|
169
|
+
* to refer to parent layer plans which are outside of this incremental
|
|
170
|
+
* boundary (e.g. if two lists both stream, we might combine those, but at
|
|
171
|
+
* runtime only one will be populated so we can't wait for the other to
|
|
172
|
+
* complete otherwise nothing will happen).
|
|
173
|
+
*/
|
|
174
|
+
outOfBoundsLayerPlanIds: Set<number>;
|
|
175
|
+
constructor(operationPlan: OperationPlan, reason: TReason);
|
|
118
176
|
toString(): string;
|
|
119
177
|
print(depth?: number): string;
|
|
120
178
|
_hasSetRootStep: boolean;
|
|
121
179
|
setRootStep($root: Step): void;
|
|
122
180
|
finalize(): void;
|
|
123
181
|
newBucket(parentBucket: Bucket): Bucket | null;
|
|
182
|
+
newCombinedBucket(finalParentBucket: Pick<Bucket, "sharedState">): Bucket | null;
|
|
183
|
+
addCombo(sources: ReadonlyArray<{
|
|
184
|
+
layerPlan: LayerPlan;
|
|
185
|
+
step: Step;
|
|
186
|
+
}>, $target: __ValueStep<any>): void;
|
|
124
187
|
}
|
|
125
188
|
//# sourceMappingURL=LayerPlan.d.ts.map
|