grafast 0.1.1-beta.20 → 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 (133) hide show
  1. package/dist/args.js +2 -3
  2. package/dist/assert.js +2 -3
  3. package/dist/constraints.js +1 -2
  4. package/dist/deferred.js +1 -2
  5. package/dist/dev.js +2 -2
  6. package/dist/engine/LayerPlan.d.ts +20 -16
  7. package/dist/engine/LayerPlan.js +5 -10
  8. package/dist/engine/OperationPlan.d.ts +12 -13
  9. package/dist/engine/OperationPlan.js +210 -146
  10. package/dist/engine/OutputPlan.d.ts +4 -4
  11. package/dist/engine/OutputPlan.js +13 -10
  12. package/dist/engine/StepTracker.js +11 -2
  13. package/dist/engine/executeBucket.js +135 -94
  14. package/dist/engine/executeOutputPlan.js +1 -2
  15. package/dist/engine/lib/defaultPlanResolver.d.ts +6 -0
  16. package/dist/engine/lib/defaultPlanResolver.js +11 -0
  17. package/dist/engine/lib/withGlobalLayerPlan.d.ts +2 -2
  18. package/dist/engine/lib/withGlobalLayerPlan.js +4 -5
  19. package/dist/engine/lock.d.ts +3 -3
  20. package/dist/engine/lock.js +3 -3
  21. package/dist/error.js +4 -4
  22. package/dist/establishOperationPlan.js +2 -3
  23. package/dist/execute.js +3 -4
  24. package/dist/exportAs.js +2 -3
  25. package/dist/global.js +2 -3
  26. package/dist/grafastGraphql.js +2 -3
  27. package/dist/grafastPrint.js +7 -8
  28. package/dist/graphqlCollectFields.js +6 -7
  29. package/dist/graphqlMergeSelectionSets.js +1 -2
  30. package/dist/index.d.ts +22 -18
  31. package/dist/index.js +41 -16
  32. package/dist/input.js +75 -28
  33. package/dist/inspect.d.ts +9 -4
  34. package/dist/inspect.js +2 -2
  35. package/dist/interfaces.d.ts +110 -89
  36. package/dist/makeGrafastSchema.d.ts +18 -9
  37. package/dist/makeGrafastSchema.js +64 -30
  38. package/dist/mermaid.js +53 -14
  39. package/dist/middleware.js +1 -2
  40. package/dist/multistep.d.ts +6 -6
  41. package/dist/multistep.js +6 -7
  42. package/dist/operationPlan-input.d.ts +5 -4
  43. package/dist/operationPlan-input.js +131 -399
  44. package/dist/planJSONInterfaces.d.ts +6 -2
  45. package/dist/polymorphic.js +4 -5
  46. package/dist/prepare.js +6 -6
  47. package/dist/step.d.ts +67 -99
  48. package/dist/step.js +99 -127
  49. package/dist/steps/__flag.d.ts +16 -16
  50. package/dist/steps/__flag.js +9 -6
  51. package/dist/steps/__inputDefault.d.ts +14 -0
  52. package/dist/steps/__inputDefault.js +48 -0
  53. package/dist/steps/__inputDynamicScalar.d.ts +2 -4
  54. package/dist/steps/__inputDynamicScalar.js +4 -2
  55. package/dist/steps/__inputList.d.ts +5 -9
  56. package/dist/steps/__inputList.js +4 -1
  57. package/dist/steps/__inputObject.d.ts +6 -11
  58. package/dist/steps/__inputObject.js +13 -3
  59. package/dist/steps/__inputStaticLeaf.d.ts +2 -4
  60. package/dist/steps/__inputStaticLeaf.js +3 -1
  61. package/dist/steps/__item.d.ts +6 -6
  62. package/dist/steps/__item.js +1 -1
  63. package/dist/steps/__trackedValue.d.ts +4 -49
  64. package/dist/steps/__trackedValue.js +24 -6
  65. package/dist/steps/__value.d.ts +3 -3
  66. package/dist/steps/__value.js +3 -2
  67. package/dist/steps/access.d.ts +7 -6
  68. package/dist/steps/access.js +14 -7
  69. package/dist/steps/applyInput.d.ts +44 -0
  70. package/dist/steps/applyInput.js +206 -0
  71. package/dist/steps/applyTransforms.d.ts +2 -2
  72. package/dist/steps/applyTransforms.js +7 -5
  73. package/dist/steps/bakedInput.d.ts +23 -0
  74. package/dist/steps/bakedInput.js +90 -0
  75. package/dist/steps/condition.d.ts +5 -5
  76. package/dist/steps/condition.js +3 -3
  77. package/dist/steps/connection.d.ts +42 -39
  78. package/dist/steps/connection.js +51 -35
  79. package/dist/steps/constant.d.ts +4 -8
  80. package/dist/steps/constant.js +54 -6
  81. package/dist/steps/each.d.ts +3 -3
  82. package/dist/steps/each.js +1 -2
  83. package/dist/steps/error.d.ts +2 -2
  84. package/dist/steps/error.js +3 -3
  85. package/dist/steps/filter.d.ts +3 -2
  86. package/dist/steps/filter.js +1 -2
  87. package/dist/steps/first.d.ts +6 -5
  88. package/dist/steps/first.js +5 -4
  89. package/dist/steps/graphqlResolver.d.ts +2 -2
  90. package/dist/steps/graphqlResolver.js +44 -56
  91. package/dist/steps/groupBy.d.ts +3 -2
  92. package/dist/steps/groupBy.js +1 -2
  93. package/dist/steps/index.d.ts +4 -2
  94. package/dist/steps/index.js +21 -9
  95. package/dist/steps/lambda.d.ts +5 -5
  96. package/dist/steps/lambda.js +4 -4
  97. package/dist/steps/last.d.ts +6 -5
  98. package/dist/steps/last.js +5 -4
  99. package/dist/steps/list.d.ts +7 -7
  100. package/dist/steps/list.js +3 -3
  101. package/dist/steps/listTransform.d.ts +14 -12
  102. package/dist/steps/listTransform.js +14 -7
  103. package/dist/steps/listen.d.ts +6 -8
  104. package/dist/steps/listen.js +7 -7
  105. package/dist/steps/load.d.ts +6 -6
  106. package/dist/steps/load.js +7 -7
  107. package/dist/steps/node.d.ts +16 -10
  108. package/dist/steps/node.js +14 -7
  109. package/dist/steps/object.d.ts +11 -11
  110. package/dist/steps/object.js +5 -5
  111. package/dist/steps/partitionByIndex.d.ts +3 -2
  112. package/dist/steps/partitionByIndex.js +1 -2
  113. package/dist/steps/polymorphicBranch.d.ts +8 -8
  114. package/dist/steps/polymorphicBranch.js +4 -4
  115. package/dist/steps/proxy.d.ts +8 -8
  116. package/dist/steps/proxy.js +3 -3
  117. package/dist/steps/remapKeys.d.ts +6 -6
  118. package/dist/steps/remapKeys.js +3 -3
  119. package/dist/steps/reverse.d.ts +5 -5
  120. package/dist/steps/reverse.js +4 -4
  121. package/dist/steps/setter.d.ts +9 -18
  122. package/dist/steps/setter.js +24 -14
  123. package/dist/steps/sideEffect.d.ts +4 -4
  124. package/dist/steps/sideEffect.js +3 -3
  125. package/dist/stringifyPayload.js +1 -2
  126. package/dist/stripAnsi.js +2 -2
  127. package/dist/subscribe.js +2 -3
  128. package/dist/timeSource.d.ts +0 -1
  129. package/dist/utils.d.ts +43 -31
  130. package/dist/utils.js +97 -61
  131. package/dist/version.d.ts +1 -1
  132. package/dist/version.js +1 -1
  133. package/package.json +2 -2
@@ -1,6 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeDecodeNodeId = exports.nodeIdFromNode = exports.specFromNodeId = exports.node = exports.NodeStep = void 0;
3
+ exports.NodeStep = void 0;
4
+ exports.node = node;
5
+ exports.specFromNodeId = specFromNodeId;
6
+ exports.nodeIdFromNode = nodeIdFromNode;
7
+ exports.makeDecodeNodeIdRuntime = makeDecodeNodeIdRuntime;
8
+ exports.makeDecodeNodeId = makeDecodeNodeId;
4
9
  const dev_js_1 = require("../dev.js");
5
10
  const inspect_js_1 = require("../inspect.js");
6
11
  const polymorphic_js_1 = require("../polymorphic.js");
@@ -14,7 +19,7 @@ const lambda_js_1 = require("./lambda.js");
14
19
  * typeNames supported and their details (codec to use, how to find the record,
15
20
  * etc), and finally the Node id string plan.
16
21
  */
17
- class NodeStep extends step_js_1.UnbatchedExecutableStep {
22
+ class NodeStep extends step_js_1.UnbatchedStep {
18
23
  static { this.$$export = {
19
24
  moduleName: "grafast",
20
25
  exportName: "NodeStep",
@@ -65,9 +70,10 @@ exports.NodeStep = NodeStep;
65
70
  function node(possibleTypes, $id) {
66
71
  return new NodeStep(possibleTypes, $id);
67
72
  }
68
- exports.node = node;
69
73
  function specFromNodeId(handler, $id) {
70
74
  function decodeWithCodecAndHandler(raw) {
75
+ if (raw == null)
76
+ return raw;
71
77
  try {
72
78
  const decoded = handler.codec.decode(raw);
73
79
  if (handler.match(decoded)) {
@@ -84,13 +90,11 @@ function specFromNodeId(handler, $id) {
84
90
  const $decoded = (0, lambda_js_1.lambda)($id, decodeWithCodecAndHandler);
85
91
  return handler.getSpec($decoded);
86
92
  }
87
- exports.specFromNodeId = specFromNodeId;
88
93
  function nodeIdFromNode(handler, $node) {
89
94
  const specifier = handler.plan($node);
90
95
  return (0, lambda_js_1.lambda)(specifier, handler.codec.encode);
91
96
  }
92
- exports.nodeIdFromNode = nodeIdFromNode;
93
- function makeDecodeNodeId(handlers) {
97
+ function makeDecodeNodeIdRuntime(handlers) {
94
98
  const codecs = [...new Set(handlers.map((h) => h.codec))];
95
99
  function decodeNodeIdWithCodecs(raw) {
96
100
  if (raw == null)
@@ -106,7 +110,10 @@ function makeDecodeNodeId(handlers) {
106
110
  }, { raw });
107
111
  }
108
112
  decodeNodeIdWithCodecs.isSyncAndSafe = true; // Optimization
113
+ return decodeNodeIdWithCodecs;
114
+ }
115
+ function makeDecodeNodeId(handlers) {
116
+ const decodeNodeIdWithCodecs = makeDecodeNodeIdRuntime(handlers);
109
117
  return ($id) => (0, lambda_js_1.lambda)($id, decodeNodeIdWithCodecs);
110
118
  }
111
- exports.makeDecodeNodeId = makeDecodeNodeId;
112
119
  //# sourceMappingURL=node.js.map
@@ -1,21 +1,20 @@
1
1
  import type { DataFromStep, ExecutionDetails, ExecutionExtra, StepOptimizeOptions, UnbatchedExecutionExtra } from "../interfaces.js";
2
- import type { ExecutableStep } from "../step.js";
3
- import { UnbatchedExecutableStep } from "../step.js";
2
+ import type { Step } from "../step.js";
3
+ import { UnbatchedStep } from "../step.js";
4
4
  import { ConstantStep } from "./constant.js";
5
- import type { SetterCapableStep } from "./setter.js";
6
5
  export type DataFromObjectSteps<TSteps extends {
7
- [key: string]: ExecutableStep;
6
+ [key: string]: Step;
8
7
  }> = {
9
8
  [key in keyof TSteps]: DataFromStep<TSteps[key]>;
10
9
  };
11
10
  type Results<TSteps extends {
12
- [key: string]: ExecutableStep;
11
+ [key: string]: Step;
13
12
  }> = Array<[
14
13
  Array<DataFromObjectSteps<TSteps>[keyof TSteps]>,
15
14
  DataFromObjectSteps<TSteps>
16
15
  ]>;
17
16
  export interface ObjectPlanMeta<TSteps extends {
18
- [key: string]: ExecutableStep;
17
+ [key: string]: Step;
19
18
  }> {
20
19
  results: Results<TSteps>;
21
20
  }
@@ -28,10 +27,10 @@ interface ObjectStepCacheConfig {
28
27
  * the results of the associated plans.
29
28
  */
30
29
  export declare class ObjectStep<TPlans extends {
31
- [key: string]: ExecutableStep;
30
+ [key: string]: Step;
32
31
  } = {
33
- [key: string]: ExecutableStep;
34
- }> extends UnbatchedExecutableStep<DataFromObjectSteps<TPlans>> implements SetterCapableStep<TPlans> {
32
+ [key: string]: Step;
33
+ }> extends UnbatchedStep<DataFromObjectSteps<TPlans>> {
35
34
  private cacheConfig?;
36
35
  static $$export: {
37
36
  moduleName: string;
@@ -49,7 +48,8 @@ export declare class ObjectStep<TPlans extends {
49
48
  * handy.
50
49
  */
51
50
  set<TKey extends keyof TPlans>(key: TKey, plan: TPlans[TKey]): void;
52
- getStepForKey<TKey extends keyof TPlans>(key: TKey, allowMissing?: boolean): TKey extends keyof TPlans ? TPlans[TKey] : null;
51
+ getStepForKey<TKey extends keyof TPlans>(key: TKey): TPlans[TKey];
52
+ getStepForKey<TKey extends keyof TPlans>(key: TKey, allowMissing: true): TPlans[TKey] | null;
53
53
  toStringMeta(): string;
54
54
  tupleToObjectJIT(callback: (fn: (extra: ExecutionExtra, ...tuple: Array<DataFromObjectSteps<TPlans>[keyof TPlans]>) => DataFromObjectSteps<TPlans>) => void): void;
55
55
  finalize(): void;
@@ -67,7 +67,7 @@ export declare class ObjectStep<TPlans extends {
67
67
  * the results of the associated plans.
68
68
  */
69
69
  export declare function object<TPlans extends {
70
- [key: string]: ExecutableStep;
70
+ [key: string]: Step;
71
71
  }>(obj: TPlans, cacheConfig?: ObjectStepCacheConfig): ObjectStep<TPlans>;
72
72
  export {};
73
73
  //# sourceMappingURL=object.d.ts.map
@@ -1,7 +1,8 @@
1
1
  "use strict";
2
2
  // import debugFactory from "debug";
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.object = exports.ObjectStep = void 0;
4
+ exports.ObjectStep = void 0;
5
+ exports.object = object;
5
6
  const tslib_1 = require("tslib");
6
7
  const tamedevil_1 = tslib_1.__importStar(require("tamedevil"));
7
8
  const step_js_1 = require("../step.js");
@@ -13,7 +14,7 @@ const EMPTY_OBJECT = Object.freeze(Object.create(null));
13
14
  * A plan that represents an object using the keys given and the values being
14
15
  * the results of the associated plans.
15
16
  */
16
- class ObjectStep extends step_js_1.UnbatchedExecutableStep {
17
+ class ObjectStep extends step_js_1.UnbatchedStep {
17
18
  static { this.$$export = {
18
19
  moduleName: "grafast",
19
20
  exportName: "ObjectStep",
@@ -61,7 +62,7 @@ class ObjectStep extends step_js_1.UnbatchedExecutableStep {
61
62
  }
62
63
  return null;
63
64
  }
64
- return this.getDep(idx);
65
+ return this.getDepOptions(idx).step;
65
66
  }
66
67
  toStringMeta() {
67
68
  return "{" + this.keys.join(",") + "}";
@@ -201,7 +202,7 @@ ${inner}
201
202
  if (index < 0) {
202
203
  throw new Error(`This ObjectStep doesn't have key '${String(key)}'; supported keys: '${this.keys.join("', '")}'`);
203
204
  }
204
- return this.getDep(index);
205
+ return this.getDepOptions(index).step;
205
206
  }
206
207
  }
207
208
  exports.ObjectStep = ObjectStep;
@@ -212,5 +213,4 @@ exports.ObjectStep = ObjectStep;
212
213
  function object(obj, cacheConfig) {
213
214
  return new ObjectStep(obj, cacheConfig);
214
215
  }
215
- exports.object = object;
216
216
  //# sourceMappingURL=object.js.map
@@ -1,4 +1,5 @@
1
- import type { ExecutableStep } from "../step.js";
1
+ import type { Step } from "../step.js";
2
+ import type { ConnectionCapableStep, ItemsStep } from "./connection.js";
2
3
  import type { __ListTransformStep, ListTransformItemPlanCallback } from "./listTransform.js";
3
4
  /**
4
5
  * Takes a single dimensional list plan and a mapper that calculates a
@@ -35,5 +36,5 @@ import type { __ListTransformStep, ListTransformItemPlanCallback } from "./listT
35
36
  *
36
37
  * Beware: the target indexes should not contain gaps.
37
38
  */
38
- export declare function partitionByIndex<TListStep extends ExecutableStep<readonly any[]>, TItemStep extends ExecutableStep<number>>(listStep: TListStep, mapper: ListTransformItemPlanCallback<TListStep, TItemStep>, startIndex?: 0 | 1): __ListTransformStep<TListStep, TItemStep, unknown[][], any>;
39
+ export declare function partitionByIndex<TListStep extends Step<readonly any[]> | ConnectionCapableStep<any, any>, TItemStep extends Step<number>>(listStep: TListStep, mapper: ListTransformItemPlanCallback<ItemsStep<TListStep>, TItemStep>, startIndex?: 0 | 1): __ListTransformStep<TListStep, TItemStep, unknown[][], any>;
39
40
  //# sourceMappingURL=partitionByIndex.d.ts.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.partitionByIndex = void 0;
3
+ exports.partitionByIndex = partitionByIndex;
4
4
  const tslib_1 = require("tslib");
5
5
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
6
6
  const step_js_1 = require("../step.js");
@@ -82,5 +82,4 @@ function partitionByIndex(listStep, mapper, startIndex = 0) {
82
82
  meta: `partitionByIndex${startIndex}:${chalk_1.default.yellow(listStep.id)}${mapper.name ? `/${mapper.name}` : ""}`,
83
83
  });
84
84
  }
85
- exports.partitionByIndex = partitionByIndex;
86
85
  //# sourceMappingURL=partitionByIndex.js.map
@@ -1,16 +1,16 @@
1
1
  import type { GraphQLObjectType } from "graphql";
2
2
  import type { ExecutionDetails, GrafastResultsList, PromiseOrDirect } from "../index.js";
3
3
  import type { PolymorphicStep } from "../step.js";
4
- import { ExecutableStep } from "../step.js";
5
- type StepData<TStep extends ExecutableStep> = TStep extends ExecutableStep<infer U> ? U : any;
6
- export interface PolymorphicBranchMatchers<TStep extends ExecutableStep> {
4
+ import { Step } from "../step.js";
5
+ type StepData<TStep extends Step> = TStep extends Step<infer U> ? U : any;
6
+ export interface PolymorphicBranchMatchers<TStep extends Step> {
7
7
  [typeName: string]: PolymorphicBranchMatcher<TStep>;
8
8
  }
9
- export interface PolymorphicBranchMatcher<TStep extends ExecutableStep> {
9
+ export interface PolymorphicBranchMatcher<TStep extends Step> {
10
10
  match?: (obj: StepData<TStep>) => boolean;
11
- plan?: ($obj: TStep) => ExecutableStep;
11
+ plan?: ($obj: TStep) => Step;
12
12
  }
13
- export declare class PolymorphicBranchStep<TStep extends ExecutableStep> extends ExecutableStep implements PolymorphicStep {
13
+ export declare class PolymorphicBranchStep<TStep extends Step> extends Step implements PolymorphicStep {
14
14
  static $$export: {
15
15
  moduleName: string;
16
16
  exportName: string;
@@ -19,9 +19,9 @@ export declare class PolymorphicBranchStep<TStep extends ExecutableStep> extends
19
19
  private typeNames;
20
20
  private matchers;
21
21
  constructor($step: TStep, matchers: PolymorphicBranchMatchers<TStep>);
22
- planForType(objectType: GraphQLObjectType): ExecutableStep;
22
+ planForType(objectType: GraphQLObjectType): Step;
23
23
  execute({ indexMap, values: [values0], }: ExecutionDetails): PromiseOrDirect<GrafastResultsList<any>>;
24
24
  }
25
- export declare function polymorphicBranch<TStep extends ExecutableStep>($step: TStep, matchers: PolymorphicBranchMatchers<TStep>): PolymorphicBranchStep<TStep>;
25
+ export declare function polymorphicBranch<TStep extends Step>($step: TStep, matchers: PolymorphicBranchMatchers<TStep>): PolymorphicBranchStep<TStep>;
26
26
  export {};
27
27
  //# sourceMappingURL=polymorphicBranch.d.ts.map
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.polymorphicBranch = exports.PolymorphicBranchStep = void 0;
3
+ exports.PolymorphicBranchStep = void 0;
4
+ exports.polymorphicBranch = polymorphicBranch;
4
5
  const index_js_1 = require("../index.js");
5
6
  const step_js_1 = require("../step.js");
6
7
  const constant_js_1 = require("./constant.js");
7
- class PolymorphicBranchStep extends step_js_1.ExecutableStep {
8
+ class PolymorphicBranchStep extends step_js_1.Step {
8
9
  static { this.$$export = {
9
10
  moduleName: "grafast",
10
11
  exportName: "PolymorphicBranchStep",
@@ -24,7 +25,7 @@ class PolymorphicBranchStep extends step_js_1.ExecutableStep {
24
25
  }
25
26
  planForType(objectType) {
26
27
  const matcher = this.matchers[objectType.name];
27
- const $step = this.getDep(0);
28
+ const $step = this.getDep(0, true);
28
29
  if (matcher) {
29
30
  if (typeof matcher.plan === "function") {
30
31
  return matcher.plan($step);
@@ -58,5 +59,4 @@ exports.PolymorphicBranchStep = PolymorphicBranchStep;
58
59
  function polymorphicBranch($step, matchers) {
59
60
  return new PolymorphicBranchStep($step, matchers);
60
61
  }
61
- exports.polymorphicBranch = polymorphicBranch;
62
62
  //# sourceMappingURL=polymorphicBranch.js.map
@@ -1,28 +1,28 @@
1
1
  import type { ExecutionDetails, GrafastResultsList, UnbatchedExecutionExtra } from "../interfaces.js";
2
2
  import { $$proxy } from "../interfaces.js";
3
- import type { ExecutableStep } from "../step.js";
4
- import { UnbatchedExecutableStep } from "../step.js";
3
+ import type { Step } from "../step.js";
4
+ import { UnbatchedStep } from "../step.js";
5
5
  /**
6
6
  * @experimental
7
7
  *
8
8
  * Never build this class directly.
9
9
  */
10
- export declare class ProxyStep<T> extends UnbatchedExecutableStep<T> {
10
+ export declare class ProxyStep<T> extends UnbatchedStep<T> {
11
11
  static $$export: {
12
12
  moduleName: string;
13
13
  exportName: string;
14
14
  };
15
15
  isSyncAndSafe: boolean;
16
16
  private $depId;
17
- constructor($dep: ExecutableStep<T>, $actualDep: ExecutableStep);
17
+ constructor($dep: Step<T>, $actualDep: Step);
18
18
  toStringMeta(): string | null;
19
- addDependency(step: ExecutableStep): number;
19
+ addDependency(step: Step): number;
20
20
  execute({ count, values: [values0], }: ExecutionDetails<[T]>): GrafastResultsList<T>;
21
21
  unbatchedExecute(_extra: UnbatchedExecutionExtra, value: T): T;
22
22
  stream: undefined;
23
23
  }
24
24
  declare module "../step.js" {
25
- interface ExecutableStep {
25
+ interface Step {
26
26
  [$$proxy]?: any;
27
27
  }
28
28
  }
@@ -32,7 +32,7 @@ declare module "../step.js" {
32
32
  * This could change at any time, may impact performance, and just, generally,
33
33
  * needs more work. You shouldn't need this in the vast majority of cases.
34
34
  */
35
- export declare function proxy<TData, TStep extends ExecutableStep<TData>>($step: TStep, $actualDep?: ExecutableStep): TStep & {
36
- addDependency(step: ExecutableStep): number;
35
+ export declare function proxy<TData, TStep extends Step<TData>>($step: TStep, $actualDep?: Step): TStep & {
36
+ addDependency(step: Step): number;
37
37
  };
38
38
  //# sourceMappingURL=proxy.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.proxy = exports.ProxyStep = void 0;
3
+ exports.ProxyStep = void 0;
4
+ exports.proxy = proxy;
4
5
  const interfaces_js_1 = require("../interfaces.js");
5
6
  const step_js_1 = require("../step.js");
6
7
  const utils_js_1 = require("../utils.js");
@@ -9,7 +10,7 @@ const utils_js_1 = require("../utils.js");
9
10
  *
10
11
  * Never build this class directly.
11
12
  */
12
- class ProxyStep extends step_js_1.UnbatchedExecutableStep {
13
+ class ProxyStep extends step_js_1.UnbatchedStep {
13
14
  static { this.$$export = {
14
15
  moduleName: "grafast",
15
16
  exportName: "ProxyStep",
@@ -113,5 +114,4 @@ function proxy($step, $actualDep = $step) {
113
114
  $proxy[interfaces_js_1.$$proxy] = proxy;
114
115
  return proxy;
115
116
  }
116
- exports.proxy = proxy;
117
117
  //# sourceMappingURL=proxy.js.map
@@ -1,6 +1,6 @@
1
1
  import type { ExecutionDetails, GrafastResultsList, UnbatchedExecutionExtra } from "../interfaces.js";
2
- import type { ExecutableStep } from "../step.js";
3
- import { UnbatchedExecutableStep } from "../step.js";
2
+ import type { Step } from "../step.js";
3
+ import { UnbatchedStep } from "../step.js";
4
4
  export type ActualKeyByDesiredKey = {
5
5
  [desiredKey: string]: string;
6
6
  };
@@ -8,7 +8,7 @@ export type ActualKeyByDesiredKey = {
8
8
  * A plan that returns an object resulting from extracting the given
9
9
  * `actualKey` from the input and storing it as the `desiredKey` in the output.
10
10
  */
11
- export declare class RemapKeysStep extends UnbatchedExecutableStep {
11
+ export declare class RemapKeysStep extends UnbatchedStep {
12
12
  private readonly actualKeyByDesiredKey;
13
13
  static $$export: {
14
14
  moduleName: string;
@@ -17,9 +17,9 @@ export declare class RemapKeysStep extends UnbatchedExecutableStep {
17
17
  isSyncAndSafe: boolean;
18
18
  allowMultipleOptimizations: boolean;
19
19
  private mapper;
20
- constructor($plan: ExecutableStep, actualKeyByDesiredKey: ActualKeyByDesiredKey);
20
+ constructor($plan: Step, actualKeyByDesiredKey: ActualKeyByDesiredKey);
21
21
  toStringMeta(): string;
22
- optimize(): ExecutableStep<any> | this;
22
+ optimize(): Step<any> | this;
23
23
  finalize(): void;
24
24
  execute({ count, values: [values0], }: ExecutionDetails): GrafastResultsList<any>;
25
25
  unbatchedExecute(_extra: UnbatchedExecutionExtra, value: any): any;
@@ -29,7 +29,7 @@ export declare class RemapKeysStep extends UnbatchedExecutableStep {
29
29
  * A plan that returns an object resulting from extracting the given
30
30
  * `actualKey` from the input and storing it as the `desiredKey` in the output.
31
31
  */
32
- export declare function remapKeys($step: ExecutableStep, actualKeyByDesiredKey: {
32
+ export declare function remapKeys($step: Step, actualKeyByDesiredKey: {
33
33
  [desiredKey: string]: string;
34
34
  }): RemapKeysStep;
35
35
  //# sourceMappingURL=remapKeys.d.ts.map
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.remapKeys = exports.RemapKeysStep = void 0;
3
+ exports.RemapKeysStep = void 0;
4
+ exports.remapKeys = remapKeys;
4
5
  const tslib_1 = require("tslib");
5
6
  /* eslint-disable @typescript-eslint/ban-types */
6
7
  const chalk_1 = tslib_1.__importDefault(require("chalk"));
@@ -30,7 +31,7 @@ function makeMapper(actualKeyByDesiredKey, callback) {
30
31
  * A plan that returns an object resulting from extracting the given
31
32
  * `actualKey` from the input and storing it as the `desiredKey` in the output.
32
33
  */
33
- class RemapKeysStep extends step_js_1.UnbatchedExecutableStep {
34
+ class RemapKeysStep extends step_js_1.UnbatchedStep {
34
35
  static { this.$$export = {
35
36
  moduleName: "grafast",
36
37
  exportName: "RemapKeysStep",
@@ -87,5 +88,4 @@ exports.RemapKeysStep = RemapKeysStep;
87
88
  function remapKeys($step, actualKeyByDesiredKey) {
88
89
  return new RemapKeysStep($step, actualKeyByDesiredKey);
89
90
  }
90
- exports.remapKeys = remapKeys;
91
91
  //# sourceMappingURL=remapKeys.js.map
@@ -1,6 +1,6 @@
1
1
  import type { ExecutionDetails, GrafastResultsList, UnbatchedExecutionExtra } from "../interfaces.js";
2
- import type { ExecutableStep } from "../step.js";
3
- import { UnbatchedExecutableStep } from "../step.js";
2
+ import type { Step } from "../step.js";
3
+ import { UnbatchedStep } from "../step.js";
4
4
  /**
5
5
  * Returns a reversed copy of the list.
6
6
  */
@@ -8,14 +8,14 @@ export declare function reverseArray<TData = any>(list: readonly TData[]): TData
8
8
  /**
9
9
  * Reverses a list.
10
10
  */
11
- export declare class ReverseStep<TData> extends UnbatchedExecutableStep<readonly TData[]> {
11
+ export declare class ReverseStep<TData> extends UnbatchedStep<readonly TData[]> {
12
12
  static $$export: {
13
13
  moduleName: string;
14
14
  exportName: string;
15
15
  };
16
16
  isSyncAndSafe: boolean;
17
17
  allowMultipleOptimizations: boolean;
18
- constructor(plan: ExecutableStep<readonly TData[]>);
18
+ constructor(plan: Step<readonly TData[]>);
19
19
  execute({ indexMap, values: [values0], }: ExecutionDetails<[TData[]]>): GrafastResultsList<TData[]>;
20
20
  unbatchedExecute(_extra: UnbatchedExecutionExtra, arr: TData[]): TData[];
21
21
  deduplicate(peers: ReverseStep<TData>[]): ReverseStep<TData>[];
@@ -23,5 +23,5 @@ export declare class ReverseStep<TData> extends UnbatchedExecutableStep<readonly
23
23
  /**
24
24
  * Reverses a list.
25
25
  */
26
- export declare function reverse<TData>(plan: ExecutableStep<readonly TData[]>): ReverseStep<TData>;
26
+ export declare function reverse<TData>(plan: Step<readonly TData[]>): ReverseStep<TData>;
27
27
  //# sourceMappingURL=reverse.d.ts.map
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.reverse = exports.ReverseStep = exports.reverseArray = void 0;
3
+ exports.ReverseStep = void 0;
4
+ exports.reverseArray = reverseArray;
5
+ exports.reverse = reverse;
4
6
  const step_js_1 = require("../step.js");
5
7
  /**
6
8
  * Returns a reversed copy of the list.
@@ -16,11 +18,10 @@ function reverseArray(list) {
16
18
  }
17
19
  return newList;
18
20
  }
19
- exports.reverseArray = reverseArray;
20
21
  /**
21
22
  * Reverses a list.
22
23
  */
23
- class ReverseStep extends step_js_1.UnbatchedExecutableStep {
24
+ class ReverseStep extends step_js_1.UnbatchedStep {
24
25
  static { this.$$export = {
25
26
  moduleName: "grafast",
26
27
  exportName: "ReverseStep",
@@ -51,5 +52,4 @@ exports.ReverseStep = ReverseStep;
51
52
  function reverse(plan) {
52
53
  return plan.operationPlan.cacheStep(plan, "GrafastInternal:reverse()", "", () => new ReverseStep(plan));
53
54
  }
54
- exports.reverse = reverse;
55
55
  //# sourceMappingURL=reverse.js.map
@@ -1,27 +1,18 @@
1
- import type { BaseStep, ExecutableStep } from "../step.js";
2
- import { ModifierStep } from "../step.js";
3
- export interface SetterCapableStep<TPlans extends {
4
- [key: string]: ExecutableStep;
5
- }> extends BaseStep {
6
- set<TKey extends keyof TPlans>(key: TKey, value: TPlans[TKey]): void;
1
+ import type { InputObjectTypeBakedInfo } from "../index.js";
2
+ import { Modifier } from "./applyInput.js";
3
+ export interface SetterCapable<TObj extends Record<string, any>> {
4
+ set<TKey extends keyof TObj>(key: TKey, value: TObj[TKey]): void;
7
5
  }
8
- export declare class SetterStep<TPlans extends {
9
- [key: string]: ExecutableStep;
10
- } = {
11
- [key: string]: ExecutableStep;
12
- }, TParentStep extends SetterCapableStep<TPlans> = SetterCapableStep<TPlans>> extends ModifierStep<TParentStep> {
6
+ export declare class Setter<TObj extends Record<string, any> = Record<string, any>, TParent extends SetterCapable<TObj> = SetterCapable<TObj>> extends Modifier<TParent> {
13
7
  static $$export: {
14
8
  moduleName: string;
15
9
  exportName: string;
16
10
  };
17
11
  private setters;
18
- constructor($parent: TParentStep);
19
- set<TKey extends keyof TPlans>(key: TKey, valuePlan: TPlans[TKey]): void;
12
+ constructor(parent: TParent);
13
+ set<TKey extends keyof TObj>(key: TKey, value: TObj[TKey]): void;
20
14
  apply(): void;
21
15
  }
22
- export declare function setter<TPlans extends {
23
- [key: string]: ExecutableStep;
24
- } = {
25
- [key: string]: ExecutableStep;
26
- }, TParentStep extends SetterCapableStep<TPlans> = SetterCapableStep<TPlans>>($parent: TParentStep): SetterStep<TPlans, TParentStep>;
16
+ export declare function setter<TObj extends Record<string, any> = Record<string, any>, TParent extends SetterCapable<TObj> = SetterCapable<TObj>>(parent: TParent): Setter<TObj, TParent>;
17
+ export declare function createObjectAndApplyChildren<TObj extends Record<string, any>>(_input: Record<string, any>, info: InputObjectTypeBakedInfo): TObj;
27
18
  //# sourceMappingURL=setter.d.ts.map
@@ -1,28 +1,38 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.setter = exports.SetterStep = void 0;
4
- const step_js_1 = require("../step.js");
5
- class SetterStep extends step_js_1.ModifierStep {
3
+ exports.Setter = void 0;
4
+ exports.setter = setter;
5
+ exports.createObjectAndApplyChildren = createObjectAndApplyChildren;
6
+ const applyInput_js_1 = require("./applyInput.js");
7
+ class Setter extends applyInput_js_1.Modifier {
6
8
  static { this.$$export = {
7
9
  moduleName: "grafast",
8
- exportName: "SetterStep",
10
+ exportName: "Setter",
9
11
  }; }
10
- constructor($parent) {
11
- super($parent);
12
+ constructor(parent) {
13
+ super(parent);
12
14
  this.setters = new Map();
13
15
  }
14
- set(key, valuePlan) {
15
- this.setters.set(key, valuePlan);
16
+ set(key, value) {
17
+ this.setters.set(key, value);
16
18
  }
17
19
  apply() {
18
- for (const [key, valuePlan] of this.setters.entries()) {
19
- this.$parent.set(key, valuePlan);
20
+ for (const [key, value] of this.setters.entries()) {
21
+ this.parent.set(key, value);
20
22
  }
21
23
  }
22
24
  }
23
- exports.SetterStep = SetterStep;
24
- function setter($parent) {
25
- return new SetterStep($parent);
25
+ exports.Setter = Setter;
26
+ function setter(parent) {
27
+ return new Setter(parent);
28
+ }
29
+ function createObjectAndApplyChildren(_input, info) {
30
+ const obj = Object.create(null);
31
+ info.applyChildren(setter({
32
+ set(key, value) {
33
+ obj[key] = value;
34
+ },
35
+ }));
36
+ return obj;
26
37
  }
27
- exports.setter = setter;
28
38
  //# sourceMappingURL=setter.js.map
@@ -1,11 +1,11 @@
1
1
  import type { PromiseOrDirect, UnbatchedExecutionExtra } from "../interfaces.js";
2
2
  import type { Multistep, UnwrapMultistep } from "../multistep.js";
3
- import type { ExecutableStep } from "../step.js";
4
- import { UnbatchedExecutableStep } from "../step.js";
3
+ import type { Step } from "../step.js";
4
+ import { UnbatchedStep } from "../step.js";
5
5
  /**
6
6
  * Calls the given callback function for each tuple
7
7
  */
8
- export declare class SideEffectStep<TIn, TOut> extends UnbatchedExecutableStep<TOut> {
8
+ export declare class SideEffectStep<TIn, TOut> extends UnbatchedStep<TOut> {
9
9
  private fn;
10
10
  static $$export: {
11
11
  moduleName: string;
@@ -14,7 +14,7 @@ export declare class SideEffectStep<TIn, TOut> extends UnbatchedExecutableStep<T
14
14
  isSyncAndSafe: boolean;
15
15
  allowMultipleOptimizations: boolean;
16
16
  private planDep;
17
- constructor($plan: ExecutableStep<TIn> | null | undefined, fn: (value: TIn) => PromiseOrDirect<TOut>);
17
+ constructor($plan: Step<TIn> | null | undefined, fn: (value: TIn) => PromiseOrDirect<TOut>);
18
18
  toStringMeta(): any;
19
19
  unbatchedExecute(_extra: UnbatchedExecutionExtra, value: TIn): PromiseOrDirect<TOut>;
20
20
  }
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.sideEffect = exports.SideEffectStep = void 0;
3
+ exports.SideEffectStep = void 0;
4
+ exports.sideEffect = sideEffect;
4
5
  const multistep_js_1 = require("../multistep.js");
5
6
  const step_js_1 = require("../step.js");
6
7
  /**
7
8
  * Calls the given callback function for each tuple
8
9
  */
9
- class SideEffectStep extends step_js_1.UnbatchedExecutableStep {
10
+ class SideEffectStep extends step_js_1.UnbatchedStep {
10
11
  static { this.$$export = {
11
12
  moduleName: "grafast",
12
13
  exportName: "SideEffectStep",
@@ -40,5 +41,4 @@ function sideEffect(spec, fn) {
40
41
  const $result = new SideEffectStep($in, fn);
41
42
  return $result;
42
43
  }
43
- exports.sideEffect = sideEffect;
44
44
  //# sourceMappingURL=sideEffect.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stringifyPayload = void 0;
3
+ exports.stringifyPayload = stringifyPayload;
4
4
  function stringifyPayload(payload, outputDataAsString) {
5
5
  if (!outputDataAsString || typeof payload.data !== "string") {
6
6
  return JSON.stringify(payload);
@@ -55,5 +55,4 @@ function stringifyPayload(payload, outputDataAsString) {
55
55
  str += "}";
56
56
  return str;
57
57
  }
58
- exports.stringifyPayload = stringifyPayload;
59
58
  //# sourceMappingURL=stringifyPayload.js.map
package/dist/stripAnsi.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.stripAnsi = exports.ANSI_REGEXP = void 0;
3
+ exports.ANSI_REGEXP = void 0;
4
+ exports.stripAnsi = stripAnsi;
4
5
  // Extracted from https://github.com/chalk/ansi-regex MIT license
5
6
  // Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
6
7
  // Copyright (c) Benjie (https://twitter.com/benjie)
@@ -10,5 +11,4 @@ exports.ANSI_REGEXP =
10
11
  function stripAnsi(str) {
11
12
  return str.replace(exports.ANSI_REGEXP, "");
12
13
  }
13
- exports.stripAnsi = stripAnsi;
14
14
  //# sourceMappingURL=stripAnsi.js.map
package/dist/subscribe.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.subscribe = void 0;
3
+ exports.subscribe = subscribe;
4
4
  const execute_js_1 = require("./execute.js");
5
5
  const middleware_js_1 = require("./middleware.js");
6
6
  function subscribe(args, legacyResolvedPreset, legacyOutputDataAsString) {
@@ -14,7 +14,7 @@ function subscribe(args, legacyResolvedPreset, legacyOutputDataAsString) {
14
14
  const { resolvedPreset } = args;
15
15
  const middleware = args.middleware === undefined && resolvedPreset != null
16
16
  ? (0, middleware_js_1.getGrafastMiddleware)(resolvedPreset)
17
- : args.middleware ?? null;
17
+ : (args.middleware ?? null);
18
18
  if (args.middleware === undefined) {
19
19
  args.middleware = middleware;
20
20
  }
@@ -25,6 +25,5 @@ function subscribe(args, legacyResolvedPreset, legacyOutputDataAsString) {
25
25
  return (0, execute_js_1.withGrafastArgs)(args);
26
26
  }
27
27
  }
28
- exports.subscribe = subscribe;
29
28
  const subscribeMiddlewareCallback = (event) => (0, execute_js_1.withGrafastArgs)(event.args);
30
29
  //# sourceMappingURL=subscribe.js.map
@@ -1,3 +1,2 @@
1
- /// <reference types="node" />
2
1
  export declare const timeSource: import("perf_hooks").Performance | DateConstructor;
3
2
  //# sourceMappingURL=timeSource.d.ts.map