grafast 0.1.1-beta.4 → 0.1.1-beta.5

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 (48) hide show
  1. package/dist/bucket.d.ts +1 -89
  2. package/dist/dev.d.ts +0 -4
  3. package/dist/engine/LayerPlan.d.ts +1 -96
  4. package/dist/engine/OperationPlan.d.ts +3 -92
  5. package/dist/engine/OperationPlan.js +13 -15
  6. package/dist/engine/OutputPlan.d.ts +0 -12
  7. package/dist/engine/StepTracker.d.ts +1 -95
  8. package/dist/engine/StepTracker.js +4 -3
  9. package/dist/engine/executeBucket.d.ts +1 -7
  10. package/dist/engine/executeBucket.js +7 -6
  11. package/dist/engine/executeOutputPlan.d.ts +0 -53
  12. package/dist/error.d.ts +4 -48
  13. package/dist/error.js +4 -0
  14. package/dist/execute.d.ts +0 -5
  15. package/dist/exportAs.d.ts +1 -18
  16. package/dist/graphqlCollectFields.d.ts +1 -34
  17. package/dist/index.d.ts +3 -3
  18. package/dist/index.js +13 -1
  19. package/dist/input.d.ts +1 -9
  20. package/dist/interfaces.d.ts +1 -12
  21. package/dist/mermaid.d.ts +0 -17
  22. package/dist/prepare.d.ts +1 -7
  23. package/dist/step.d.ts +3 -64
  24. package/dist/steps/__item.d.ts +0 -4
  25. package/dist/steps/__trackedValue.d.ts +0 -11
  26. package/dist/steps/access.d.ts +0 -2
  27. package/dist/steps/applyTransforms.d.ts +0 -23
  28. package/dist/steps/each.js +1 -1
  29. package/dist/steps/first.d.ts +1 -1
  30. package/dist/steps/first.js +1 -1
  31. package/dist/steps/graphqlResolver.d.ts +2 -75
  32. package/dist/steps/index.d.ts +5 -1
  33. package/dist/steps/index.js +17 -2
  34. package/dist/steps/lambda.js +5 -0
  35. package/dist/steps/last.d.ts +1 -1
  36. package/dist/steps/last.js +1 -1
  37. package/dist/steps/list.d.ts +2 -0
  38. package/dist/steps/list.js +6 -0
  39. package/dist/steps/listTransform.d.ts +0 -6
  40. package/dist/steps/load.d.ts +0 -2
  41. package/dist/steps/load.js +0 -2
  42. package/dist/steps/sideEffect.d.ts +29 -0
  43. package/dist/steps/sideEffect.js +40 -0
  44. package/dist/utils.d.ts +0 -24
  45. package/dist/utils.js +11 -4
  46. package/dist/version.d.ts +1 -1
  47. package/dist/version.js +1 -1
  48. package/package.json +4 -4
package/dist/bucket.d.ts CHANGED
@@ -1,90 +1,2 @@
1
- import type { LayerPlan } from "./engine/LayerPlan";
2
- import type { MetaByMetaKey } from "./engine/OperationPlan";
3
- import type { ExecutionEventEmitter } from "./interfaces.js";
4
- /**
5
- * @internal
6
- */
7
- export interface RequestTools {
8
- /** The `timeSource.now()` at which the request started executing */
9
- startTime: number;
10
- /** The `timeSource.now()` at which the request should stop executing (if a timeout was configured) */
11
- stopTime: number | null;
12
- readonly eventEmitter: ExecutionEventEmitter | undefined;
13
- /**
14
- * If we're running inside GraphQL then we should not serialize scalars,
15
- * otherwise we'll face the double-serialization problem.
16
- */
17
- insideGraphQL: false;
18
- }
19
- /**
20
- * A "bucket" is where the results from plans are stored so that other plans
21
- * can retrieve them, it may take on different forms depending on the mode of
22
- * execution. A "LayerPlan" is used to both identify the bucket and to specify
23
- * why it exists and how it behaves.
24
- *
25
- * Every `ExecutableStep` belongs to exactly one LayerPlan (and thus bucket),
26
- * specified by `plan.layerPlan`.
27
- *
28
- * @internal
29
- */
30
- export interface Bucket {
31
- /**
32
- * The LayerPlan definition this bucket adheres to
33
- */
34
- layerPlan: LayerPlan;
35
- /**
36
- * How many entries are there in the bucket?
37
- */
38
- size: number;
39
- /**
40
- * The polymorphic path through which each of the entries (respectively) has
41
- * travelled. This influences the steps that will be executed using the
42
- * related inputs.
43
- */
44
- polymorphicPathList: readonly (string | null)[];
45
- /**
46
- * These are the iterators the bucket (or its descendents, without crossing a
47
- * stream/defer boundary) have created (if any). Each of these must either be
48
- * processed via `processRoot`, or must be manually released (via
49
- * `releaseUnusedIterators`) otherwise a memory leak could occur.
50
- */
51
- iterators: Array<Set<AsyncIterator<any> | Iterator<any>>>;
52
- /**
53
- * `metaByMetaKey` belongs to the bucket rather than the request context
54
- * because mutations and subscriptions shouldn't re-use caches.
55
- *
56
- * TODO: `inheritMeta: boolean`?
57
- */
58
- metaByMetaKey: MetaByMetaKey;
59
- /**
60
- * Every entry in the store is a list with the same length as the bucket has
61
- * `size`.
62
- *
63
- * The entry for '-1' is the request indexes, so we can associate the results
64
- * back to the request that triggered them.
65
- */
66
- store: Map<number, any[]>;
67
- /**
68
- * Set this true when the bucket is fully executed.
69
- *
70
- * Initialize it to false.
71
- */
72
- isComplete: boolean;
73
- /**
74
- * If an error occurred at any stage we need to drop down to more careful
75
- * (and slower) handling.
76
- *
77
- * Initialize it to false.
78
- */
79
- hasErrors: boolean;
80
- /**
81
- * The child buckets of this bucket.
82
- */
83
- children: {
84
- [layerPlanId: number]: {
85
- bucket: Bucket;
86
- map: Map<number, number | number[]>;
87
- };
88
- };
89
- }
1
+ export {};
90
2
  //# sourceMappingURL=bucket.d.ts.map
package/dist/dev.d.ts CHANGED
@@ -1,6 +1,2 @@
1
- /**
2
- * @internal
3
- */
4
- export declare const isDev: boolean;
5
1
  export declare function noop(): void;
6
2
  //# sourceMappingURL=dev.d.ts.map
@@ -1,5 +1,5 @@
1
1
  import type { Bucket } from "../bucket.js";
2
- import type { ExecutableStep, ModifierStep, UnbatchedExecutableStep } from "../step";
2
+ import type { ExecutableStep } from "../step";
3
3
  import type { OperationPlan } from "./OperationPlan";
4
4
  /** Non-branching, non-deferred */
5
5
  export interface LayerPlanReasonRoot {
@@ -71,43 +71,6 @@ export type HasParent<A extends LayerPlanReason> = A extends any ? A extends {
71
71
  parentStep: ExecutableStep;
72
72
  } ? A : never : never;
73
73
  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
74
  /**
112
75
  * A LayerPlan represents (via "reason") either the root (root), when something
113
76
  * happens at a later time (mutationField, defer), when plurality changes
@@ -138,58 +101,6 @@ export declare class LayerPlan<TReason extends LayerPlanReason = LayerPlanReason
138
101
  parentLayerPlan: LayerPlan | null;
139
102
  readonly reason: TReason;
140
103
  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
104
  /** How "deep" this layer plan is (how many ancestors it has). The root layer plan has a depth of 0. */
194
105
  depth: number;
195
106
  /** The depth at which a "defer boundary" occurs (OperationPlan.getPeers cannot pass a defer boundary), or 0. */
@@ -203,12 +114,6 @@ export declare class LayerPlan<TReason extends LayerPlanReason = LayerPlanReason
203
114
  toString(): string;
204
115
  print(depth?: number): string;
205
116
  setRootStep($root: ExecutableStep): void;
206
- /** @internal Use plan.getStep(id) instead. */
207
- getStep(id: number, requestingStep: ExecutableStep): ExecutableStep;
208
- /** @internal */
209
- _addStep(step: ExecutableStep): number;
210
- /** @internal */
211
- _addModifierStep(step: ModifierStep<any>): string;
212
117
  finalize(): void;
213
118
  newBucket(parentBucket: Bucket): Bucket | null;
214
119
  }
@@ -1,16 +1,14 @@
1
1
  import type { FragmentDefinitionNode, GraphQLFieldMap, GraphQLObjectType, GraphQLSchema, GraphQLUnionType, OperationDefinitionNode } from "graphql";
2
- import type { Constraint } from "../constraints.js";
3
2
  import type { SelectionSetDigest } from "../graphqlCollectFields.js";
4
- import type { GrafastPlanJSON, ModifierStep } from "../index.js";
5
- import { __TrackedValueStep, __ValueStep, ExecutableStep } from "../index.js";
3
+ import type { GrafastPlanJSON } from "../index.js";
4
+ import { ExecutableStep } from "../index.js";
6
5
  import { $$timeout, $$ts } from "../interfaces.js";
7
6
  import type { LayerPlanReasonSubroutine } from "./LayerPlan.js";
8
7
  import { LayerPlan } from "./LayerPlan.js";
9
8
  import { OutputPlan } from "./OutputPlan.js";
10
- import { StepTracker } from "./StepTracker.js";
11
9
  export declare const POLYMORPHIC_ROOT_PATH: null;
12
10
  export declare const POLYMORPHIC_ROOT_PATHS: ReadonlySet<string> | null;
13
- /** @internal */
11
+ /** Beware: the list of phases may change over time... @experimental */
14
12
  export type OperationPlanPhase = "init" | "plan" | "validate" | "optimize" | "finalize" | "ready";
15
13
  export interface MetaByMetaKey {
16
14
  [metaKey: string | number | symbol]: Record<string, any>;
@@ -49,62 +47,17 @@ export declare class OperationPlan {
49
47
  * 7. ready
50
48
  *
51
49
  * Once in 'ready' state we can execute the plan.
52
- *
53
- * @internal
54
50
  */
55
51
  phase: OperationPlanPhase;
56
52
  /**
57
53
  * Gets updated as we work our way through the plan, useful for making errors more helpful.
58
54
  */
59
55
  loc: string[] | null;
60
- /** @internal */
61
- rootLayerPlan: LayerPlan;
62
- /**
63
- * Assigned during OperationPlan.planOperation(), guaranteed to exist after
64
- * initialization.
65
- *
66
- * @internal
67
- */
68
- rootOutputPlan: OutputPlan;
69
56
  private modifierStepCount;
70
57
  private modifierDepthCount;
71
58
  private modifierSteps;
72
- /** @internal */
73
- readonly stepTracker: StepTracker;
74
59
  private maxDeduplicatedStepId;
75
60
  private maxValidatedStepId;
76
- /** Constraints based on evaluating variables. @internal */
77
- readonly variableValuesConstraints: Constraint[];
78
- /** Stores the actual variableValues. @internal */
79
- readonly variableValuesStep: __ValueStep<{
80
- [key: string]: any;
81
- }>;
82
- /** A step for accessing variableValues in a tracked manner (allowing eval). @internal */
83
- readonly trackedVariableValuesStep: __TrackedValueStep<{
84
- [key: string]: any;
85
- }>;
86
- /** Constraints based on evaluating context. @internal */
87
- readonly contextConstraints: Constraint[];
88
- /** Stores the actual value of the context. @internal */
89
- readonly contextStep: __ValueStep<Grafast.Context>;
90
- /** Allows accessing context in a tracked manner (allowing eval). @internal */
91
- readonly trackedContextStep: __TrackedValueStep<{
92
- [key: string]: any;
93
- }>;
94
- /** Constraints based on evaluating rootValue. @internal */
95
- readonly rootValueConstraints: Constraint[];
96
- /** Stores the actual value of rootValue. @internal */
97
- readonly rootValueStep: __ValueStep<any>;
98
- /** Allows accessing rootValue in a tracked manner (allowing eval). @internal */
99
- readonly trackedRootValueStep: __TrackedValueStep<any>;
100
- /** @internal */
101
- makeMetaByMetaKey: () => MetaByMetaKey;
102
- /**
103
- * @internal
104
- */
105
- readonly itemStepIdByListStepId: {
106
- [listStepId: number]: number | undefined;
107
- };
108
61
  /**
109
62
  * If true, then this operation doesn't use (custom) resolvers.
110
63
  */
@@ -123,35 +76,6 @@ export declare class OperationPlan {
123
76
  }, rootValue: any, planningTimeout: number | null);
124
77
  private lap;
125
78
  private checkTimeout;
126
- /**
127
- * Called by the LayerPlan's constructor when it wants to get a new id to use.
128
- *
129
- * @internal
130
- */
131
- addLayerPlan(layerPlan: LayerPlan): number;
132
- /**
133
- * Adds a plan to the known steps and returns the number to use as the plan
134
- * id. ONLY to be used from Step, user code should never call this directly.
135
- *
136
- * @internal
137
- */
138
- _addStep(plan: ExecutableStep): number;
139
- /**
140
- * Adds a plan to the known steps and returns the number to use as the plan
141
- * id. ONLY to be used from Step, user code should never call this directly.
142
- *
143
- * @internal
144
- */
145
- _addModifierStep(step: ModifierStep<any>): string;
146
- /** @internal Use plan.getStep(id) instead. */
147
- getStep: (id: number, requestingStep: ExecutableStep) => ExecutableStep;
148
- /**
149
- * Get a plan without specifying who requested it; this disables all the
150
- * caller checks. Only intended to be called from internal code.
151
- *
152
- * @internal
153
- */
154
- dangerouslyGetStep(id: number): ExecutableStep;
155
79
  private planOperation;
156
80
  /**
157
81
  * Plans a GraphQL query operation.
@@ -204,13 +128,6 @@ export declare class OperationPlan {
204
128
  private validateSteps;
205
129
  private replaceStep;
206
130
  private processStep;
207
- /**
208
- * Process the given steps, either dependencies first (root to leaf) or
209
- * dependents first (leaves to root).
210
- *
211
- * @internal
212
- */
213
- processSteps(actionDescription: string, order: "dependents-first" | "dependencies-first", isReadonly: boolean, callback: (plan: ExecutableStep) => ExecutableStep): void;
214
131
  /**
215
132
  * Peers are steps of the same type (but not the same step!) that are in
216
133
  * compatible layers and have the same dependencies. Peers must not have side
@@ -268,12 +185,6 @@ export declare class OperationPlan {
268
185
  private walkOutputPlans;
269
186
  generatePlanJSON(): GrafastPlanJSON;
270
187
  finishSubroutine(subroutineStep: ExecutableStep, layerPlan: LayerPlan<LayerPlanReasonSubroutine>): void;
271
- /**
272
- * HIGHLY EXPERIMENTAL!
273
- *
274
- * @internal
275
- */
276
- deleteLayerPlan(layerPlan: LayerPlan): void;
277
188
  getStepsByMetaKey(metaKey: string | number | symbol): ExecutableStep[];
278
189
  getStepsByStepClass<TClass extends ExecutableStep>(klass: {
279
190
  new (...args: any[]): TClass;
@@ -83,8 +83,6 @@ class OperationPlan {
83
83
  * 7. ready
84
84
  *
85
85
  * Once in 'ready' state we can execute the plan.
86
- *
87
- * @internal
88
86
  */
89
87
  this.phase = "init";
90
88
  /**
@@ -1269,7 +1267,7 @@ class OperationPlan {
1269
1267
  }
1270
1268
  else {
1271
1269
  // used for: hoist
1272
- for (const $processFirst of step.dependencies) {
1270
+ for (const $processFirst of (0, utils_js_1.sudo)(step).dependencies) {
1273
1271
  if (!processed.has($processFirst)) {
1274
1272
  this.processStep(actionDescription, order, isReadonly, callback, processed, $processFirst);
1275
1273
  }
@@ -1350,7 +1348,7 @@ class OperationPlan {
1350
1348
  if (step.hasSideEffects) {
1351
1349
  return EMPTY_ARRAY;
1352
1350
  }
1353
- const { dependencies: deps, layerPlan: layerPlan, constructor: stepConstructor, } = step;
1351
+ const { dependencies: deps, layerPlan: layerPlan, constructor: stepConstructor, } = (0, utils_js_1.sudo)(step);
1354
1352
  const dependencyCount = deps.length;
1355
1353
  if (dependencyCount === 0) {
1356
1354
  let allPeers = null;
@@ -1388,7 +1386,7 @@ class OperationPlan {
1388
1386
  !possiblyPeer.hasSideEffects &&
1389
1387
  possiblyPeer.constructor === stepConstructor &&
1390
1388
  peerLayerPlan.depth >= minDepth &&
1391
- possiblyPeer.dependencies.length === dependencyCount &&
1389
+ (0, utils_js_1.sudo)(possiblyPeer).dependencies.length === dependencyCount &&
1392
1390
  peerLayerPlan === ancestry[peerLayerPlan.depth]) {
1393
1391
  if (allPeers === null) {
1394
1392
  allPeers = [possiblyPeer];
@@ -1430,7 +1428,7 @@ class OperationPlan {
1430
1428
  peerDependencyIndex === dependencyIndex &&
1431
1429
  !possiblyPeer.hasSideEffects &&
1432
1430
  possiblyPeer.constructor === stepConstructor &&
1433
- possiblyPeer.dependencies.length === dependencyCount &&
1431
+ (0, utils_js_1.sudo)(possiblyPeer).dependencies.length === dependencyCount &&
1434
1432
  possiblyPeer.layerPlan === ancestry[possiblyPeer.layerPlan.depth]) {
1435
1433
  possiblePeers.push(possiblyPeer);
1436
1434
  }
@@ -1451,7 +1449,7 @@ class OperationPlan {
1451
1449
  // We know the final dependency matches and the dependency count
1452
1450
  // matches - check the other dependencies match.
1453
1451
  for (let i = 0; i < dependencyCount - 1; i++) {
1454
- if (deps[i] !== possiblyPeer.dependencies[i]) {
1452
+ if (deps[i] !== (0, utils_js_1.sudo)(possiblyPeer).dependencies[i]) {
1455
1453
  continue outerloop;
1456
1454
  }
1457
1455
  }
@@ -1541,7 +1539,7 @@ class OperationPlan {
1541
1539
  case "nullableBoundary": {
1542
1540
  // Safe to hoist _unless_ it depends on the root step of the nullableBoundary.
1543
1541
  const $root = step.layerPlan.reason.parentStep;
1544
- if (step.dependencies.includes($root)) {
1542
+ if ((0, utils_js_1.sudo)(step).dependencies.includes($root)) {
1545
1543
  return;
1546
1544
  }
1547
1545
  else {
@@ -1580,7 +1578,7 @@ class OperationPlan {
1580
1578
  }
1581
1579
  }
1582
1580
  // Finally, check that none of its dependencies are in the same bucket.
1583
- const deps = step.dependencies;
1581
+ const deps = (0, utils_js_1.sudo)(step).dependencies;
1584
1582
  if (deps.some((dep) => dep.layerPlan === step.layerPlan)) {
1585
1583
  return;
1586
1584
  }
@@ -1896,7 +1894,7 @@ class OperationPlan {
1896
1894
  */
1897
1895
  deduplicateStepsProcess(processed, start, step) {
1898
1896
  processed.add(step);
1899
- for (const dep of step.dependencies) {
1897
+ for (const dep of (0, utils_js_1.sudo)(step).dependencies) {
1900
1898
  if (dep.id >= start && !processed.has(dep)) {
1901
1899
  this.deduplicateStepsProcess(processed, start, dep);
1902
1900
  }
@@ -2109,7 +2107,7 @@ class OperationPlan {
2109
2107
  pending.delete(step);
2110
2108
  const sideEffectDeps = [];
2111
2109
  const rest = [];
2112
- for (const dep of step.dependencies) {
2110
+ for (const dep of (0, utils_js_1.sudo)(step).dependencies) {
2113
2111
  if (dep.layerPlan !== layerPlan) {
2114
2112
  continue;
2115
2113
  }
@@ -2142,7 +2140,7 @@ class OperationPlan {
2142
2140
  processSideEffectPlan(sideEffectStep);
2143
2141
  }
2144
2142
  const readyToExecute = (step) => {
2145
- for (const dep of step.dependencies) {
2143
+ for (const dep of (0, utils_js_1.sudo)(step).dependencies) {
2146
2144
  if (dep.layerPlan === layerPlan && pending.has(dep)) {
2147
2145
  return false;
2148
2146
  }
@@ -2235,7 +2233,7 @@ class OperationPlan {
2235
2233
  if (step_js_1.$$noExec in step) {
2236
2234
  continue;
2237
2235
  }
2238
- for (const dep of step.dependencies) {
2236
+ for (const dep of (0, utils_js_1.sudo)(step).dependencies) {
2239
2237
  ensurePlanAvailableInLayer(dep, layerPlan);
2240
2238
  }
2241
2239
  }
@@ -2299,7 +2297,7 @@ class OperationPlan {
2299
2297
  stepClass: step.constructor.name,
2300
2298
  metaString: metaString ? (0, index_js_1.stripAnsi)(metaString) : metaString,
2301
2299
  bucketId: step.layerPlan.id,
2302
- dependencyIds: step.dependencies.map((d) => d.id),
2300
+ dependencyIds: (0, utils_js_1.sudo)(step).dependencies.map((d) => d.id),
2303
2301
  polymorphicPaths: step.polymorphicPaths
2304
2302
  ? [...step.polymorphicPaths]
2305
2303
  : undefined,
@@ -2383,7 +2381,7 @@ class OperationPlan {
2383
2381
  const process = (lp, known) => {
2384
2382
  for (const step of this.stepTracker.activeSteps) {
2385
2383
  if (step.layerPlan === lp) {
2386
- for (const dep of step.dependencies) {
2384
+ for (const dep of (0, utils_js_1.sudo)(step).dependencies) {
2387
2385
  if (!known.includes(dep.layerPlan)) {
2388
2386
  // Naughty naughty
2389
2387
  subroutineStep.addDependency(dep);
@@ -172,16 +172,4 @@ export declare class OutputPlan<TType extends OutputPlanType = OutputPlanType> {
172
172
  }
173
173
  export declare function coerceError(error: Error, locationDetails: LocationDetails, path: ReadonlyArray<string | number>): graphql.GraphQLError;
174
174
  export declare function nonNullError(locationDetails: LocationDetails, path: readonly (string | number)[]): graphql.GraphQLError;
175
- /**
176
- * We're currently running OutputPlan `outputPlan` in bucket `bucket` at index
177
- * `bucketIndex`. If this is an array OutputPlan then we're looping over the
178
- * entries in our list and we're currently at index `inArrayIndex` (otherwise
179
- * this is null).
180
- *
181
- * Now we want to run `childOutputPlan`, but to do so we need to find the
182
- * related `childBucket` and `childBucketIndex`.
183
- *
184
- * @internal
185
- */
186
- export declare function getChildBucketAndIndex(childOutputPlan: OutputPlan, outputPlan: OutputPlan | null, bucket: Bucket, bucketIndex: number, arrayIndex?: number | null): [Bucket, number] | null;
187
175
  //# sourceMappingURL=OutputPlan.d.ts.map
@@ -1,96 +1,2 @@
1
- import type { OperationPlan } from "../index.js";
2
- import type { ExecutableStep } from "../step";
3
- import type { LayerPlan, LayerPlanReasonsWithParentStep } from "./LayerPlan";
4
- import type { OutputPlan } from "./OutputPlan";
5
- /**
6
- * This class keeps track of all of our steps, and the dependencies between
7
- * steps and other steps, layer plans and steps, and output plans and steps.
8
- *
9
- * When a step is replaced by another step, all the dependencies are updated
10
- * such that the replaced step simply evaporates.
11
- *
12
- * @internal
13
- */
14
- export declare class StepTracker {
15
- private readonly operationPlan;
16
- /** @internal */
17
- stepCount: number;
18
- /** @internal */
19
- activeSteps: Set<ExecutableStep<any>>;
20
- /** @internal */
21
- stepById: {
22
- [stepId: number]: ExecutableStep | null;
23
- };
24
- /** @internal */
25
- private aliasesById;
26
- /** @internal */
27
- stepsWithNoDependencies: Set<ExecutableStep<any>>;
28
- /** @internal */
29
- outputPlansByRootStep: Map<ExecutableStep<any>, Set<OutputPlan<import("./OutputPlan").OutputPlanType>>>;
30
- /** @internal */
31
- layerPlansByRootStep: Map<ExecutableStep<any>, Set<LayerPlan<import("./LayerPlan").LayerPlanReason>>>;
32
- /** @internal */
33
- layerPlansByParentStep: Map<ExecutableStep<any>, Set<LayerPlan<LayerPlanReasonsWithParentStep>>>;
34
- /** @internal */
35
- layerPlans: Array<LayerPlan | null>;
36
- /**
37
- * All the OutputPlans that were created to allow a more efficient
38
- * walkOutputPlans implementation.
39
- *
40
- * @internal
41
- */
42
- allOutputPlans: OutputPlan[];
43
- nextStepIdToDeduplicate: number;
44
- constructor(operationPlan: OperationPlan);
45
- newStepsSince(oldStepCount: number): ExecutableStep<any>[];
46
- private forbid;
47
- /** Called when OperationPlan enters finalize phase. */
48
- finalizeSteps(): void;
49
- /** Called when OperationPlan is about to finalize the output plans. */
50
- finalizeOutputPlans(): void;
51
- addStep($step: ExecutableStep): number;
52
- /**
53
- * @internal
54
- */
55
- addLayerPlan(layerPlan: LayerPlan): number;
56
- /**
57
- * @internal
58
- */
59
- addOutputPlan(outputPlan: OutputPlan): void;
60
- /**
61
- * HIGHLY EXPERIMENTAL!
62
- *
63
- * @internal
64
- */
65
- deleteLayerPlan(layerPlan: LayerPlan): void;
66
- getStepById(id: number): ExecutableStep;
67
- getStepById(id: number, allowUnset: true): ExecutableStep | null;
68
- addStepDependency($dependent: ExecutableStep, $dependency: ExecutableStep): number;
69
- setOutputPlanRootStep(outputPlan: OutputPlan, $dependency: ExecutableStep): void;
70
- setLayerPlanRootStep(layerPlan: LayerPlan, $dependency: ExecutableStep): void;
71
- /** @internal */
72
- replaceStep($original: ExecutableStep, $replacement: ExecutableStep): void;
73
- treeShakeSteps(): void;
74
- /**
75
- * Return true if this step can be tree-shaken.
76
- */
77
- private isNotNeeded;
78
- /**
79
- * Only for use during planField.
80
- */
81
- purgeBackTo(count: number): void;
82
- /**
83
- * ONLY CALL THIS IF NOTHING DEPENDS ON $original! It's intended to be called
84
- * from `replaceStep` or from itself.
85
- *
86
- * This method removes $original from the various maps/sets/lists, and also
87
- * removes the fact that it was dependent on other steps. If these other
88
- * steps no longer have any dependents (steps, layer plans or output plans)
89
- * then they can also be eradicated _except_ during the 'plan' phase.
90
- */
91
- private eradicate;
92
- moveStepToLayerPlan(step: ExecutableStep, targetLayerPlan: LayerPlan): void;
93
- addStepToItsLayerPlan(step: ExecutableStep): void;
94
- removeStepFromItsLayerPlan(step: ExecutableStep): void;
95
- }
1
+ export {};
96
2
  //# sourceMappingURL=StepTracker.d.ts.map
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.StepTracker = void 0;
4
4
  const dev_js_1 = require("../dev.js");
5
5
  const interfaces_js_1 = require("../interfaces.js");
6
+ const utils_js_1 = require("../utils.js");
6
7
  /**
7
8
  * We want everything else to treat things like `dependencies` as read only,
8
9
  * however we ourselves want to be able to write to them, so we can use
@@ -220,7 +221,7 @@ class StepTracker {
220
221
  throw new Error(`Cannot add ${$dependency} as a dependency of ${$dependent}; the former is deleted!`);
221
222
  }
222
223
  this.stepsWithNoDependencies.delete($dependent);
223
- const dependencyIndex = writeableArray($dependent.dependencies).push($dependency) - 1;
224
+ const dependencyIndex = writeableArray((0, utils_js_1.sudo)($dependent).dependencies).push($dependency) - 1;
224
225
  writeableArray($dependency.dependents).push({
225
226
  step: $dependent,
226
227
  dependencyIndex,
@@ -309,7 +310,7 @@ class StepTracker {
309
310
  if (dependents.length > 0) {
310
311
  const replacementDependents = writeableArray($replacement.dependents);
311
312
  for (const dependent of dependents) {
312
- writeableArray(dependent.step.dependencies)[dependent.dependencyIndex] = $replacement;
313
+ writeableArray((0, utils_js_1.sudo)(dependent.step).dependencies)[dependent.dependencyIndex] = $replacement;
313
314
  replacementDependents.push(dependent);
314
315
  }
315
316
  $original.dependents = [];
@@ -456,7 +457,7 @@ class StepTracker {
456
457
  this.stepById[$original.id] = null;
457
458
  }
458
459
  // Since this step is being removed, it doesn't need its dependencies any more
459
- const oldDependencies = $original.dependencies;
460
+ const oldDependencies = (0, utils_js_1.sudo)($original).dependencies;
460
461
  for (const $dependency of oldDependencies) {
461
462
  // $dependency is no longer a dependent of $original, since we're getting
462
463
  // rid of $original
@@ -1,8 +1,2 @@
1
- import type { Bucket, RequestTools } from "../bucket.js";
2
- import type { PromiseOrDirect } from "../interfaces.js";
3
- import type { MetaByMetaKey } from "./OperationPlan.js";
4
- /** @internal */
5
- export declare function executeBucket(bucket: Bucket, requestContext: RequestTools): PromiseOrDirect<void>;
6
- /** @internal */
7
- export declare function newBucket(spec: Pick<Bucket, "layerPlan" | "store" | "size" | "hasErrors" | "polymorphicPathList" | "iterators">, parentMetaByMetaKey: MetaByMetaKey | null): Bucket;
1
+ export {};
8
2
  //# sourceMappingURL=executeBucket.d.ts.map