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.
Files changed (94) hide show
  1. package/README.md +0 -4
  2. package/dist/args.js +3 -3
  3. package/dist/constants.d.ts +79 -0
  4. package/dist/constants.js +79 -0
  5. package/dist/engine/LayerPlan.d.ts +71 -8
  6. package/dist/engine/LayerPlan.js +375 -265
  7. package/dist/engine/OperationPlan.d.ts +77 -14
  8. package/dist/engine/OperationPlan.js +1508 -382
  9. package/dist/engine/OperationPlanTypes.d.ts +66 -0
  10. package/dist/engine/OperationPlanTypes.js +3 -0
  11. package/dist/engine/OutputPlan.d.ts +6 -0
  12. package/dist/engine/OutputPlan.js +138 -82
  13. package/dist/engine/StepTracker.js +76 -17
  14. package/dist/engine/executeBucket.js +327 -166
  15. package/dist/engine/lib/defaultPlanResolver.d.ts +1 -4
  16. package/dist/engine/lib/defaultPlanResolver.js +1 -5
  17. package/dist/engine/lib/withGlobalLayerPlan.d.ts +3 -1
  18. package/dist/engine/lib/withGlobalLayerPlan.js +19 -1
  19. package/dist/envelop.js +14 -3
  20. package/dist/error.d.ts +1 -1
  21. package/dist/error.js +9 -9
  22. package/dist/establishOperationPlan.d.ts +2 -1
  23. package/dist/establishOperationPlan.js +10 -10
  24. package/dist/execute.js +7 -5
  25. package/dist/global.d.ts +10 -0
  26. package/dist/global.js +25 -0
  27. package/dist/grafastGraphql.js +4 -3
  28. package/dist/grafastPrint.js +36 -4
  29. package/dist/index.d.ts +76 -8
  30. package/dist/index.js +37 -33
  31. package/dist/input.js +20 -1
  32. package/dist/inspect.js +1 -0
  33. package/dist/interfaces.d.ts +80 -122
  34. package/dist/interfaces.js +0 -77
  35. package/dist/makeGrafastSchema.d.ts +118 -35
  36. package/dist/makeGrafastSchema.js +197 -29
  37. package/dist/mermaid.js +198 -97
  38. package/dist/operationPlan-input.d.ts +1 -1
  39. package/dist/operationPlan-input.js +15 -5
  40. package/dist/planJSONInterfaces.d.ts +24 -5
  41. package/dist/prepare.d.ts +16 -9
  42. package/dist/prepare.js +54 -51
  43. package/dist/step.d.ts +45 -9
  44. package/dist/step.js +139 -22
  45. package/dist/steps/__flag.d.ts +3 -2
  46. package/dist/steps/__flag.js +31 -29
  47. package/dist/steps/__inputObject.d.ts +1 -1
  48. package/dist/steps/__inputStaticLeaf.d.ts +3 -2
  49. package/dist/steps/__inputStaticLeaf.js +13 -7
  50. package/dist/steps/__item.d.ts +1 -1
  51. package/dist/steps/__item.js +3 -3
  52. package/dist/steps/__trackedValue.d.ts +6 -3
  53. package/dist/steps/__trackedValue.js +25 -9
  54. package/dist/steps/__value.d.ts +2 -1
  55. package/dist/steps/__value.js +5 -0
  56. package/dist/steps/access.d.ts +17 -1
  57. package/dist/steps/access.js +14 -1
  58. package/dist/steps/applyInput.d.ts +1 -1
  59. package/dist/steps/applyInput.js +7 -6
  60. package/dist/steps/applyTransforms.js +9 -7
  61. package/dist/steps/bakedInput.js +2 -2
  62. package/dist/steps/coalesce.d.ts +15 -0
  63. package/dist/steps/coalesce.js +36 -0
  64. package/dist/steps/constant.js +16 -14
  65. package/dist/steps/each.d.ts +2 -2
  66. package/dist/steps/first.d.ts +2 -0
  67. package/dist/steps/first.js +5 -1
  68. package/dist/steps/graphqlResolver.d.ts +2 -2
  69. package/dist/steps/graphqlResolver.js +63 -161
  70. package/dist/steps/index.d.ts +3 -15
  71. package/dist/steps/index.js +6 -41
  72. package/dist/steps/lambda.js +1 -1
  73. package/dist/steps/last.d.ts +2 -0
  74. package/dist/steps/last.js +4 -0
  75. package/dist/steps/listTransform.d.ts +2 -2
  76. package/dist/steps/listTransform.js +11 -13
  77. package/dist/steps/load.d.ts +28 -22
  78. package/dist/steps/load.js +47 -1
  79. package/dist/steps/node.d.ts +10 -7
  80. package/dist/steps/node.js +5 -19
  81. package/dist/steps/object.js +6 -1
  82. package/dist/steps/proxy.d.ts +0 -6
  83. package/dist/steps/proxy.js +3 -3
  84. package/dist/steps/remapKeys.d.ts +1 -1
  85. package/dist/steps/remapKeys.js +0 -1
  86. package/dist/utils.d.ts +27 -5
  87. package/dist/utils.js +235 -15
  88. package/dist/version.d.ts +1 -1
  89. package/dist/version.js +1 -1
  90. package/package.json +7 -7
  91. package/dist/polymorphic.d.ts +0 -14
  92. package/dist/polymorphic.js +0 -72
  93. package/dist/steps/polymorphicBranch.d.ts +0 -27
  94. package/dist/steps/polymorphicBranch.js +0 -62
@@ -1,11 +1,14 @@
1
- import type { FragmentDefinitionNode, GraphQLFieldMap, GraphQLObjectType, GraphQLSchema, GraphQLUnionType, OperationDefinitionNode } from "graphql";
1
+ import type { FragmentDefinitionNode, GraphQLField, GraphQLObjectType, GraphQLOutputType, GraphQLSchema, GraphQLUnionType, OperationDefinitionNode } from "graphql";
2
+ import { $$timeout, $$ts } from "../constants.js";
2
3
  import type { Constraint } from "../constraints.js";
3
- import type { SelectionSetDigest } from "../graphqlCollectFields.js";
4
4
  import type { GrafastPlanJSON } from "../index.js";
5
5
  import { Step } from "../index.js";
6
- import { $$timeout, $$ts } from "../interfaces.js";
6
+ import type { FieldPlanResolver, LocationDetails, TrackedArguments } from "../interfaces.js";
7
+ import type { ApplyAfterModeArg } from "../operationPlan-input.js";
8
+ import type { GrafastOperationOptions } from "../prepare.js";
7
9
  import type { LayerPlanReasonSubroutine } from "./LayerPlan.js";
8
10
  import { LayerPlan } from "./LayerPlan.js";
11
+ import type { ProcessGroupedFieldSetDetails, StreamDetails } from "./OperationPlanTypes.js";
9
12
  import { OutputPlan } from "./OutputPlan.js";
10
13
  export declare const POLYMORPHIC_ROOT_PATH: null;
11
14
  export declare const POLYMORPHIC_ROOT_PATHS: ReadonlySet<string> | null;
@@ -27,7 +30,6 @@ export declare class OperationPlan {
27
30
  [key: string]: any;
28
31
  };
29
32
  readonly rootValue: any;
30
- private readonly planningTimeout;
31
33
  readonly [$$timeout]: undefined;
32
34
  readonly [$$ts]: undefined;
33
35
  readonly queryType: GraphQLObjectType;
@@ -63,13 +65,16 @@ export declare class OperationPlan {
63
65
  private laps;
64
66
  private optimizeMeta;
65
67
  private scalarPlanInfo;
68
+ private frozenPlanningPaths;
69
+ private readonly planningTimeout;
70
+ private readonly maxPlanningDepth;
66
71
  constructor(schema: GraphQLSchema, operation: OperationDefinitionNode, fragments: {
67
72
  [fragmentName: string]: FragmentDefinitionNode;
68
73
  }, variableValuesConstraints: Constraint[], variableValues: {
69
74
  [key: string]: any;
70
75
  }, contextConstraints: Constraint[], context: {
71
76
  [key: string]: any;
72
- }, rootValueConstraints: Constraint[], rootValue: any, planningTimeout: number | null);
77
+ }, rootValueConstraints: Constraint[], rootValue: any, options: GrafastOperationOptions);
73
78
  private lap;
74
79
  private checkTimeout;
75
80
  private planOperation;
@@ -85,12 +90,19 @@ export declare class OperationPlan {
85
90
  * Implements the `PlanOpPlanSubscription` algorithm.
86
91
  */
87
92
  private planSubscription;
93
+ private getCombinedLayerPlanForLayerPlans;
88
94
  /**
89
95
  * Gets the item plan for a given parent list plan - this ensures we only
90
96
  * create one item plan per parent plan.
91
97
  */
92
98
  private itemStepForListStep;
93
- processGroupedFieldSet(outputPlan: OutputPlan, path: readonly string[], polymorphicPath: string | null, polymorphicPaths: ReadonlySet<string> | null, parentStep: Step, objectType: GraphQLObjectType, objectTypeFields: GraphQLFieldMap<any, any>, isMutation: boolean, groupedFieldSet: SelectionSetDigest): void;
99
+ processGroupedFieldSet(details: ProcessGroupedFieldSetDetails): Generator<() => {
100
+ haltTree: boolean;
101
+ step: Step;
102
+ }, void, {
103
+ step: Step<any>;
104
+ haltTree: boolean;
105
+ }>;
94
106
  /**
95
107
  *
96
108
  * @param outputPlan - The output plan that this selection set is being added to
@@ -101,11 +113,35 @@ export declare class OperationPlan {
101
113
  * @param isMutation - If true this selection set should be executed serially rather than in parallel (each field gets its own LayerPlan)
102
114
  */
103
115
  private planSelectionSet;
116
+ private planningQueue;
117
+ private planningQueueByPlanningPath;
118
+ private queueNextLayer;
119
+ private planPending;
120
+ withLocLpSE(loc: string[] | null, layerPlan: LayerPlan, layerPlanLatestSideEffect: Step | null, cb: () => void): void;
121
+ private mutateTodos;
104
122
  private internalDependency;
123
+ private planFieldReturnType;
105
124
  private planIntoOutputPlan;
106
- private polymorphicLayerPlanByPathByLayerPlan;
107
- private getPolymorphicLayerPlan;
108
- private planField;
125
+ handlePlanningError(details: {
126
+ outputPlan: OutputPlan;
127
+ layerPlan: LayerPlan;
128
+ objectType: GraphQLObjectType | null;
129
+ responseKey: string | null;
130
+ positionType: GraphQLOutputType;
131
+ locationDetails: LocationDetails;
132
+ err: Error;
133
+ }): void;
134
+ private polymorphicPlanObjectType;
135
+ planFieldBatch: PlanFieldBatch | null;
136
+ private batchPlanField;
137
+ private processPlanField;
138
+ _realPlanField(planFieldDetails: PlanFieldDetails): {
139
+ step: Step<unknown>;
140
+ haltTree: boolean;
141
+ } | {
142
+ step: import("../index.js").ErrorStep<any>;
143
+ haltTree: boolean;
144
+ };
109
145
  /**
110
146
  * A replacement for GraphQL's
111
147
  * `CoerceArgumentValues` that factors in tracked variables.
@@ -156,6 +192,7 @@ export declare class OperationPlan {
156
192
  * our child plans would be expecting.
157
193
  */
158
194
  private deduplicateSteps;
195
+ private _deduplicateStepsInner;
159
196
  private hoistAndDeduplicate;
160
197
  private hoistSteps;
161
198
  private pushDownSteps;
@@ -185,19 +222,17 @@ export declare class OperationPlan {
185
222
  getStepsByStepClass<TClass extends Step>(klass: {
186
223
  new (...args: any[]): TClass;
187
224
  }): TClass[];
188
- private _cacheStepStoreByLayerPlanAndActionKey;
225
+ private _cacheStepStoreByActionKeyByLayerPlan;
226
+ private _immutableCacheStepStoreAndActionKey;
189
227
  /**
190
228
  * Cache a generated step by a given identifier (cacheKey) such that we don't
191
229
  * need to regenerate it on future calls, significantly reducing the load on
192
230
  * deduplication later.
193
231
  *
194
- * Note: automatically extends the cached step into other (relevant)
195
- * polymorphic paths; if this shouldn't be the case then don't use cacheStep
196
- * and instead rely on deduplication as usual.
197
- *
198
232
  * @experimental
199
233
  */
200
234
  cacheStep<T extends Step>(ownerStep: Step, actionKey: string, cacheKey: symbol | string | number | boolean | null | undefined, cb: () => T): T;
235
+ _cacheStep<T extends Step>(store: StepCache, ownerStep: Step, actionKey: string, cacheKey: any, cb: () => T): T;
201
236
  /**
202
237
  * Clears the cache, typically due to side effects having taken place. Called
203
238
  * from setting hasSideEffects on an ExecutableStep, among other places.
@@ -205,4 +240,32 @@ export declare class OperationPlan {
205
240
  resetCache(): void;
206
241
  withRootLayerPlan<T>(cb: () => T): T;
207
242
  }
243
+ type StepCache = Record<string, Map<any, any> | undefined>;
244
+ interface PlanFieldDetails {
245
+ typeName: string;
246
+ fieldName: string;
247
+ layerPlan: LayerPlan;
248
+ path: readonly string[];
249
+ polymorphicPaths: ReadonlySet<string> | null;
250
+ planningPath: string;
251
+ planResolver: FieldPlanResolver;
252
+ applyAfterMode: ApplyAfterModeArg;
253
+ rawParentStep: Step;
254
+ field: GraphQLField<any, any>;
255
+ trackedArguments: TrackedArguments;
256
+ streamDetails: StreamDetails | true | false | null;
257
+ }
258
+ type PlanFieldBatchResult = {
259
+ error: Error;
260
+ } | {
261
+ error?: never;
262
+ haltTree: boolean;
263
+ step: Step;
264
+ };
265
+ interface PlanFieldBatch {
266
+ complete: boolean;
267
+ batch: Array<PlanFieldDetails>;
268
+ results: Array<PlanFieldBatchResult>;
269
+ }
270
+ export {};
208
271
  //# sourceMappingURL=OperationPlan.d.ts.map