grafast 0.1.1-beta.2 → 0.1.1-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -3
- package/dist/args.d.ts +4 -7
- package/dist/args.js +53 -38
- package/dist/assert.js +2 -3
- package/dist/bucket.d.ts +1 -89
- package/dist/config.d.ts +0 -17
- package/dist/config.js +1 -95
- package/dist/constraints.d.ts +15 -1
- package/dist/constraints.js +41 -3
- package/dist/deferred.js +1 -2
- package/dist/dev.d.ts +1 -4
- package/dist/dev.js +18 -3
- package/dist/engine/LayerPlan.d.ts +21 -111
- package/dist/engine/LayerPlan.js +196 -78
- package/dist/engine/OperationPlan.d.ts +30 -104
- package/dist/engine/OperationPlan.js +763 -471
- package/dist/engine/OutputPlan.d.ts +9 -20
- package/dist/engine/OutputPlan.js +432 -444
- package/dist/engine/StepTracker.d.ts +1 -95
- package/dist/engine/StepTracker.js +94 -20
- package/dist/engine/executeBucket.d.ts +5 -7
- package/dist/engine/executeBucket.js +646 -244
- package/dist/engine/executeOutputPlan.d.ts +0 -53
- package/dist/engine/executeOutputPlan.js +7 -2
- package/dist/engine/lib/defaultPlanResolver.d.ts +6 -0
- package/dist/engine/lib/defaultPlanResolver.js +11 -0
- package/dist/engine/lib/withGlobalLayerPlan.d.ts +2 -0
- package/dist/engine/lib/withGlobalLayerPlan.js +7 -4
- package/dist/engine/lock.d.ts +4 -0
- package/dist/engine/lock.js +82 -0
- package/dist/envelop.js +5 -4
- package/dist/error.d.ts +18 -49
- package/dist/error.js +50 -39
- package/dist/establishOperationPlan.js +57 -42
- package/dist/execute.d.ts +5 -4
- package/dist/execute.js +31 -15
- package/dist/exportAs.d.ts +1 -18
- package/dist/exportAs.js +2 -3
- package/dist/global.js +2 -3
- package/dist/grafastGraphql.d.ts +6 -1
- package/dist/grafastGraphql.js +35 -16
- package/dist/grafastPrint.d.ts +3 -0
- package/dist/grafastPrint.js +67 -6
- package/dist/graphqlCollectFields.d.ts +7 -34
- package/dist/graphqlCollectFields.js +24 -13
- package/dist/graphqlMergeSelectionSets.js +1 -2
- package/dist/index.d.ts +44 -29
- package/dist/index.js +91 -18
- package/dist/input.d.ts +1 -9
- package/dist/input.js +75 -28
- package/dist/inspect.d.ts +9 -3
- package/dist/inspect.js +3 -3
- package/dist/interfaces.d.ts +238 -93
- package/dist/interfaces.js +20 -3
- package/dist/makeGrafastSchema.d.ts +21 -9
- package/dist/makeGrafastSchema.js +353 -133
- package/dist/mermaid.d.ts +0 -17
- package/dist/mermaid.js +131 -19
- package/dist/middleware.d.ts +7 -0
- package/dist/middleware.js +24 -0
- package/dist/multistep.d.ts +19 -0
- package/dist/multistep.js +54 -0
- package/dist/operationPlan-input.d.ts +5 -4
- package/dist/operationPlan-input.js +140 -368
- package/dist/planJSONInterfaces.d.ts +12 -2
- package/dist/polymorphic.js +4 -5
- package/dist/prepare.d.ts +1 -7
- package/dist/prepare.js +100 -74
- package/dist/step.d.ts +118 -172
- package/dist/step.js +262 -183
- package/dist/steps/__flag.d.ts +65 -0
- package/dist/steps/__flag.js +261 -0
- package/dist/steps/__inputDefault.d.ts +14 -0
- package/dist/steps/__inputDefault.js +48 -0
- package/dist/steps/__inputDynamicScalar.d.ts +4 -6
- package/dist/steps/__inputDynamicScalar.js +4 -2
- package/dist/steps/__inputList.d.ts +5 -9
- package/dist/steps/__inputList.js +4 -1
- package/dist/steps/__inputObject.d.ts +7 -11
- package/dist/steps/__inputObject.js +49 -3
- package/dist/steps/__inputStaticLeaf.d.ts +2 -4
- package/dist/steps/__inputStaticLeaf.js +3 -1
- package/dist/steps/__item.d.ts +10 -12
- package/dist/steps/__item.js +8 -2
- package/dist/steps/__trackedValue.d.ts +7 -55
- package/dist/steps/__trackedValue.js +69 -8
- package/dist/steps/__value.d.ts +5 -4
- package/dist/steps/__value.js +5 -4
- package/dist/steps/access.d.ts +10 -10
- package/dist/steps/access.js +50 -17
- package/dist/steps/applyInput.d.ts +44 -0
- package/dist/steps/applyInput.js +206 -0
- package/dist/steps/applyTransforms.d.ts +2 -25
- package/dist/steps/applyTransforms.js +53 -31
- package/dist/steps/bakedInput.d.ts +23 -0
- package/dist/steps/bakedInput.js +90 -0
- package/dist/steps/condition.d.ts +31 -0
- package/dist/steps/condition.js +94 -0
- package/dist/steps/connection.d.ts +56 -42
- package/dist/steps/connection.js +97 -44
- package/dist/steps/constant.d.ts +7 -7
- package/dist/steps/constant.js +86 -7
- package/dist/steps/each.d.ts +3 -3
- package/dist/steps/each.js +2 -3
- package/dist/steps/error.d.ts +4 -4
- package/dist/steps/error.js +7 -6
- package/dist/steps/filter.d.ts +3 -2
- package/dist/steps/filter.js +1 -2
- package/dist/steps/first.d.ts +10 -9
- package/dist/steps/first.js +9 -13
- package/dist/steps/graphqlResolver.d.ts +3 -76
- package/dist/steps/graphqlResolver.js +89 -72
- package/dist/steps/groupBy.d.ts +3 -2
- package/dist/steps/groupBy.js +1 -2
- package/dist/steps/index.d.ts +12 -3
- package/dist/steps/index.js +48 -6
- package/dist/steps/lambda.d.ts +9 -9
- package/dist/steps/lambda.js +18 -9
- package/dist/steps/last.d.ts +9 -8
- package/dist/steps/last.js +7 -6
- package/dist/steps/list.d.ts +20 -9
- package/dist/steps/list.js +56 -13
- package/dist/steps/listTransform.d.ts +18 -22
- package/dist/steps/listTransform.js +58 -27
- package/dist/steps/listen.d.ts +6 -11
- package/dist/steps/listen.js +14 -16
- package/dist/steps/load.d.ts +42 -33
- package/dist/steps/load.js +60 -27
- package/dist/steps/node.d.ts +17 -10
- package/dist/steps/node.js +18 -6
- package/dist/steps/object.d.ts +33 -27
- package/dist/steps/object.js +53 -32
- package/dist/steps/partitionByIndex.d.ts +3 -2
- package/dist/steps/partitionByIndex.js +1 -2
- package/dist/steps/polymorphicBranch.d.ts +27 -0
- package/dist/steps/polymorphicBranch.js +62 -0
- package/dist/steps/proxy.d.ts +11 -12
- package/dist/steps/proxy.js +8 -5
- package/dist/steps/remapKeys.d.ts +10 -10
- package/dist/steps/remapKeys.js +14 -7
- package/dist/steps/reverse.d.ts +8 -8
- package/dist/steps/reverse.js +10 -7
- package/dist/steps/setter.d.ts +9 -18
- package/dist/steps/setter.js +24 -14
- package/dist/steps/sideEffect.d.ts +28 -0
- package/dist/steps/sideEffect.js +44 -0
- package/dist/stringifyPayload.js +1 -2
- package/dist/stripAnsi.js +2 -2
- package/dist/subscribe.d.ts +7 -1
- package/dist/subscribe.js +24 -9
- package/dist/thereCanBeOnlyOne.js +1 -1
- package/dist/timeSource.d.ts +0 -1
- package/dist/utils.d.ts +56 -55
- package/dist/utils.js +179 -59
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -8
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.__ListTransformStep = void 0;
|
|
4
|
+
exports.listTransform = listTransform;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const assert = tslib_1.__importStar(require("../assert.js"));
|
|
6
7
|
const dev_js_1 = require("../dev.js");
|
|
7
8
|
const executeBucket_js_1 = require("../engine/executeBucket.js");
|
|
8
9
|
const LayerPlan_js_1 = require("../engine/LayerPlan.js");
|
|
9
10
|
const withGlobalLayerPlan_js_1 = require("../engine/lib/withGlobalLayerPlan.js");
|
|
11
|
+
const interfaces_js_1 = require("../interfaces.js");
|
|
10
12
|
const step_js_1 = require("../step.js");
|
|
11
13
|
const __item_js_1 = require("./__item.js");
|
|
14
|
+
const connection_js_1 = require("./connection.js");
|
|
12
15
|
/**
|
|
13
16
|
* **Experimental.**
|
|
14
17
|
*
|
|
@@ -18,7 +21,7 @@ const __item_js_1 = require("./__item.js");
|
|
|
18
21
|
* It's recommended that you don't use this directly, please use one of the
|
|
19
22
|
* functions that uses this under the hood such as `filter()`.
|
|
20
23
|
*/
|
|
21
|
-
class __ListTransformStep extends step_js_1.
|
|
24
|
+
class __ListTransformStep extends step_js_1.Step {
|
|
22
25
|
static { this.$$export = {
|
|
23
26
|
moduleName: "grafast",
|
|
24
27
|
exportName: "__ListTransformStep",
|
|
@@ -27,8 +30,14 @@ class __ListTransformStep extends step_js_1.ExecutableStep {
|
|
|
27
30
|
super();
|
|
28
31
|
// OPTIMIZE: if all the steps in the inner bucket are synchronous then theoretically we can be synchronous too
|
|
29
32
|
this.isSyncAndSafe = false;
|
|
30
|
-
const { listStep, itemPlanCallback, initialState, reduceCallback, finalizeCallback, listItem, meta, optimize, connectionClone, } = options;
|
|
33
|
+
const { listStep: rawListStep, itemPlanCallback, initialState, reduceCallback, finalizeCallback, listItem, meta, optimize, connectionClone, } = options;
|
|
34
|
+
const listStep = (0, connection_js_1.itemsOrStep)(rawListStep);
|
|
31
35
|
this.listStepDepId = this.addDependency(listStep);
|
|
36
|
+
// PERF: This is just so we can populate getListStep() correctly... Ideally we could mark this as a "plan-time-only" dependency.
|
|
37
|
+
this.rawListStepDepId =
|
|
38
|
+
rawListStep === listStep
|
|
39
|
+
? this.listStepDepId
|
|
40
|
+
: this.addDependency(rawListStep);
|
|
32
41
|
this.itemPlanCallback = itemPlanCallback;
|
|
33
42
|
this.initialState = initialState;
|
|
34
43
|
this.reduceCallback = reduceCallback;
|
|
@@ -68,13 +77,13 @@ class __ListTransformStep extends step_js_1.ExecutableStep {
|
|
|
68
77
|
return this.meta;
|
|
69
78
|
}
|
|
70
79
|
getListStep() {
|
|
71
|
-
return this.
|
|
80
|
+
return this.getDepOptions(this.rawListStepDepId).step;
|
|
72
81
|
}
|
|
73
|
-
[
|
|
82
|
+
[interfaces_js_1.$$deepDepSkip]() {
|
|
74
83
|
return this.getListStep();
|
|
75
84
|
}
|
|
76
85
|
dangerouslyGetListPlan() {
|
|
77
|
-
return this.dependencies[this.
|
|
86
|
+
return this.dependencies[this.rawListStepDepId];
|
|
78
87
|
}
|
|
79
88
|
deduplicate(peers) {
|
|
80
89
|
return peers.filter((peer) => peer.itemPlanCallback === this.itemPlanCallback &&
|
|
@@ -88,33 +97,49 @@ class __ListTransformStep extends step_js_1.ExecutableStep {
|
|
|
88
97
|
optimize() {
|
|
89
98
|
return this;
|
|
90
99
|
}
|
|
91
|
-
async execute(
|
|
100
|
+
async execute({ indexForEach, indexMap, values, extra, }) {
|
|
92
101
|
const bucket = extra._bucket;
|
|
93
102
|
const childLayerPlan = this.subroutineLayer;
|
|
94
|
-
const copyStepIds = childLayerPlan
|
|
103
|
+
const { copyStepIds, rootStep } = childLayerPlan;
|
|
104
|
+
if (rootStep === null) {
|
|
105
|
+
throw new Error(`rootStep of ${childLayerPlan} must not be null.`);
|
|
106
|
+
}
|
|
95
107
|
const store = new Map();
|
|
96
108
|
const polymorphicPathList = [];
|
|
97
109
|
const iterators = [];
|
|
98
110
|
const map = new Map();
|
|
99
111
|
let size = 0;
|
|
100
112
|
// ENHANCE: do this better!
|
|
101
|
-
const
|
|
113
|
+
const itemStep = this.operationPlan.dangerouslyGetStep(this.itemStepId);
|
|
114
|
+
const itemStepId = itemStep.id;
|
|
102
115
|
if (itemStepId == null) {
|
|
103
116
|
throw new Error("GrafastInternalError<b3a2bff9-15c6-47e2-aa82-19c862324f1a>: listItem layer plan has no rootStepId");
|
|
104
117
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
store.set(
|
|
109
|
-
|
|
110
|
-
|
|
118
|
+
const listStepValue = values[this.listStepDepId];
|
|
119
|
+
if (itemStep._isUnary) {
|
|
120
|
+
const list = listStepValue.unaryValue();
|
|
121
|
+
store.set(itemStepId, (0, executeBucket_js_1.unaryExecutionValue)(Array.isArray(list) ? list[0] : list));
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
store.set(itemStepId, (0, executeBucket_js_1.batchExecutionValue)([]));
|
|
125
|
+
}
|
|
126
|
+
for (const stepId of copyStepIds) {
|
|
127
|
+
const ev = bucket.store.get(stepId);
|
|
128
|
+
if (!ev) {
|
|
129
|
+
throw new Error(`GrafastInternalError<2be5c2c6-a7f8-4002-93a0-6ace5a89a962>: unary step '${stepId}' (${this.operationPlan.dangerouslyGetStep(stepId)}) listed in copyStepIds but not available in parent bucket for ${this}`);
|
|
130
|
+
}
|
|
131
|
+
if (ev.isBatch) {
|
|
132
|
+
// Prepare store with an empty list for each copyPlanId
|
|
133
|
+
store.set(stepId, (0, executeBucket_js_1.batchExecutionValue)([]));
|
|
134
|
+
}
|
|
135
|
+
else {
|
|
136
|
+
store.set(stepId, ev);
|
|
111
137
|
}
|
|
112
138
|
}
|
|
113
|
-
const listValues = values[this.listStepDepId];
|
|
114
139
|
// We'll typically be creating more listItem bucket entries than we
|
|
115
140
|
// have parent buckets, so we must "multiply up" the store entries.
|
|
116
|
-
|
|
117
|
-
const list =
|
|
141
|
+
indexForEach((originalIndex) => {
|
|
142
|
+
const list = listStepValue.at(originalIndex);
|
|
118
143
|
if (Array.isArray(list)) {
|
|
119
144
|
const newIndexes = [];
|
|
120
145
|
map.set(originalIndex, newIndexes);
|
|
@@ -126,27 +151,34 @@ class __ListTransformStep extends step_js_1.ExecutableStep {
|
|
|
126
151
|
// Copying across the iterators because we do NOT call outputBucket,
|
|
127
152
|
// so we need to ensure any streams are cleaned up.
|
|
128
153
|
iterators[newIndex] = bucket.iterators[originalIndex];
|
|
129
|
-
store.get(itemStepId)
|
|
154
|
+
const ev = store.get(itemStepId);
|
|
155
|
+
if (ev.isBatch) {
|
|
156
|
+
ev._setResult(newIndex, list[j], 0);
|
|
157
|
+
}
|
|
130
158
|
for (const planId of copyStepIds) {
|
|
131
|
-
store.get(planId)
|
|
132
|
-
|
|
159
|
+
const ev = store.get(planId);
|
|
160
|
+
if (ev.isBatch) {
|
|
161
|
+
const orig = bucket.store.get(planId);
|
|
162
|
+
ev._setResult(newIndex, orig.at(originalIndex), orig._flagsAt(originalIndex));
|
|
163
|
+
}
|
|
133
164
|
}
|
|
134
165
|
}
|
|
135
166
|
}
|
|
136
|
-
}
|
|
167
|
+
});
|
|
137
168
|
if (size > 0) {
|
|
138
169
|
const childBucket = (0, executeBucket_js_1.newBucket)({
|
|
139
170
|
layerPlan: childLayerPlan,
|
|
140
171
|
size,
|
|
141
172
|
store,
|
|
142
|
-
|
|
173
|
+
flagUnion: bucket.flagUnion,
|
|
143
174
|
polymorphicPathList,
|
|
144
175
|
iterators,
|
|
145
176
|
}, bucket.metaByMetaKey);
|
|
146
177
|
await (0, executeBucket_js_1.executeBucket)(childBucket, extra._requestContext);
|
|
147
178
|
}
|
|
148
|
-
const depResults = store.get(
|
|
149
|
-
return
|
|
179
|
+
const depResults = store.get(rootStep.id);
|
|
180
|
+
return indexMap((originalIndex) => {
|
|
181
|
+
const list = listStepValue.at(originalIndex);
|
|
150
182
|
if (list == null) {
|
|
151
183
|
return list;
|
|
152
184
|
}
|
|
@@ -156,7 +188,7 @@ class __ListTransformStep extends step_js_1.ExecutableStep {
|
|
|
156
188
|
console.warn(`Either list or values was not an array when processing ${this}`);
|
|
157
189
|
return null;
|
|
158
190
|
}
|
|
159
|
-
const values = indexes.map((idx) => depResults
|
|
191
|
+
const values = indexes.map((idx) => depResults.at(idx));
|
|
160
192
|
if (dev_js_1.isDev) {
|
|
161
193
|
assert.strictEqual(list.length, values.length, "GrafastInternalError<c85b6936-d406-4801-9c6b-625a567d32ff>: The list and values length must match for a __ListTransformStep");
|
|
162
194
|
}
|
|
@@ -181,5 +213,4 @@ exports.__ListTransformStep = __ListTransformStep;
|
|
|
181
213
|
function listTransform(options) {
|
|
182
214
|
return new __ListTransformStep(options);
|
|
183
215
|
}
|
|
184
|
-
exports.listTransform = listTransform;
|
|
185
216
|
//# sourceMappingURL=listTransform.js.map
|
package/dist/steps/listen.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { GrafastResultStreamList, GrafastSubscriber
|
|
2
|
-
import
|
|
3
|
-
import { ExecutableStep } from "../step.js";
|
|
1
|
+
import type { ExecutionDetails, GrafastResultStreamList, GrafastSubscriber } from "../interfaces.js";
|
|
2
|
+
import { Step } from "../step.js";
|
|
4
3
|
import type { __ItemStep } from "./__item.js";
|
|
5
4
|
/**
|
|
6
5
|
* Subscribes to the given `pubsubOrPlan` to get realtime updates on a given
|
|
@@ -9,7 +8,7 @@ import type { __ItemStep } from "./__item.js";
|
|
|
9
8
|
*/
|
|
10
9
|
export declare class ListenStep<TTopics extends {
|
|
11
10
|
[topic: string]: any;
|
|
12
|
-
}, TTopic extends keyof TTopics, TPayloadStep extends
|
|
11
|
+
}, TTopic extends keyof TTopics, TPayloadStep extends Step> extends Step<TTopics[TTopic][]> {
|
|
13
12
|
itemPlan: (itemPlan: __ItemStep<TTopics[TTopic]>) => TPayloadStep;
|
|
14
13
|
static $$export: {
|
|
15
14
|
moduleName: string;
|
|
@@ -24,12 +23,8 @@ export declare class ListenStep<TTopics extends {
|
|
|
24
23
|
* The plan that will tell us which topic we're subscribing to.
|
|
25
24
|
*/
|
|
26
25
|
private topicDep;
|
|
27
|
-
constructor(pubsubOrPlan:
|
|
28
|
-
execute():
|
|
29
|
-
stream(count: number, values: readonly [
|
|
30
|
-
GrafastValuesList<GrafastSubscriber<TTopics>>,
|
|
31
|
-
GrafastValuesList<TTopic>
|
|
32
|
-
]): GrafastResultStreamList<TTopics[TTopic]>;
|
|
26
|
+
constructor(pubsubOrPlan: Step<GrafastSubscriber<TTopics> | null> | GrafastSubscriber<TTopics> | null, topicOrPlan: Step<TTopic> | string, itemPlan?: (itemPlan: __ItemStep<TTopics[TTopic]>) => TPayloadStep);
|
|
27
|
+
execute({ indexMap, values, stream, }: ExecutionDetails<readonly [GrafastSubscriber<TTopics>, TTopic]>): GrafastResultStreamList<TTopics[TTopic]>;
|
|
33
28
|
}
|
|
34
29
|
/**
|
|
35
30
|
* Subscribes to the given `pubsubOrPlan` to get realtime updates on a given
|
|
@@ -38,5 +33,5 @@ export declare class ListenStep<TTopics extends {
|
|
|
38
33
|
*/
|
|
39
34
|
export declare function listen<TTopics extends {
|
|
40
35
|
[topic: string]: any;
|
|
41
|
-
}, TTopic extends keyof TTopics, TPayloadStep extends
|
|
36
|
+
}, TTopic extends keyof TTopics, TPayloadStep extends Step>(pubsubOrPlan: Step<GrafastSubscriber<TTopics> | null> | GrafastSubscriber<TTopics> | null, topicOrPlan: Step<TTopic> | string, itemPlan?: (itemPlan: __ItemStep<TTopics[TTopic]>) => TPayloadStep): ListenStep<TTopics, TTopic, TPayloadStep>;
|
|
42
37
|
//# sourceMappingURL=listen.d.ts.map
|
package/dist/steps/listen.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ListenStep = void 0;
|
|
4
|
+
exports.listen = listen;
|
|
4
5
|
const dev_js_1 = require("../dev.js");
|
|
5
6
|
const index_js_1 = require("../index.js");
|
|
6
7
|
const step_js_1 = require("../step.js");
|
|
@@ -10,7 +11,7 @@ const constant_js_1 = require("./constant.js");
|
|
|
10
11
|
* topic (`topicOrPlan`), mapping the resulting event via the `itemPlan`
|
|
11
12
|
* callback.
|
|
12
13
|
*/
|
|
13
|
-
class ListenStep extends step_js_1.
|
|
14
|
+
class ListenStep extends step_js_1.Step {
|
|
14
15
|
static { this.$$export = {
|
|
15
16
|
moduleName: "grafast",
|
|
16
17
|
exportName: "ListenStep",
|
|
@@ -26,15 +27,14 @@ class ListenStep extends step_js_1.ExecutableStep {
|
|
|
26
27
|
this.pubsubDep = this.addDependency($pubsub);
|
|
27
28
|
this.topicDep = this.addDependency($topic);
|
|
28
29
|
}
|
|
29
|
-
execute() {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const pubsub = pubsubs[i];
|
|
30
|
+
execute({ indexMap, values, stream, }) {
|
|
31
|
+
if (!stream) {
|
|
32
|
+
throw new Error("ListenStep must be streamed, never merely executed");
|
|
33
|
+
}
|
|
34
|
+
const pubsubValue = values[this.pubsubDep];
|
|
35
|
+
const topicValue = values[this.topicDep];
|
|
36
|
+
return indexMap((i) => {
|
|
37
|
+
const pubsub = pubsubValue.at(i);
|
|
38
38
|
if (!pubsub) {
|
|
39
39
|
throw new index_js_1.SafeError("Subscription not supported", dev_js_1.isDev
|
|
40
40
|
? {
|
|
@@ -42,10 +42,9 @@ class ListenStep extends step_js_1.ExecutableStep {
|
|
|
42
42
|
}
|
|
43
43
|
: {});
|
|
44
44
|
}
|
|
45
|
-
const topic =
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
return result;
|
|
45
|
+
const topic = topicValue.at(i);
|
|
46
|
+
return pubsub.subscribe(topic);
|
|
47
|
+
});
|
|
49
48
|
}
|
|
50
49
|
}
|
|
51
50
|
exports.ListenStep = ListenStep;
|
|
@@ -57,5 +56,4 @@ exports.ListenStep = ListenStep;
|
|
|
57
56
|
function listen(pubsubOrPlan, topicOrPlan, itemPlan) {
|
|
58
57
|
return new ListenStep(pubsubOrPlan, topicOrPlan, itemPlan);
|
|
59
58
|
}
|
|
60
|
-
exports.listen = listen;
|
|
61
59
|
//# sourceMappingURL=listen.js.map
|
package/dist/steps/load.d.ts
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
import type { __ItemStep } from "../index.js";
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import type { __ItemStep, ExecutionDetails } from "../index.js";
|
|
2
|
+
import type { GrafastResultsList, Maybe, PromiseOrDirect } from "../interfaces.js";
|
|
3
|
+
import type { Multistep, UnwrapMultistep } from "../multistep.js";
|
|
4
|
+
import { Step } from "../step.js";
|
|
5
|
+
export interface LoadOptions<TItem, TParams extends Record<string, any>, TUnarySpec = never> {
|
|
6
|
+
unary: TUnarySpec;
|
|
5
7
|
attributes: ReadonlyArray<keyof TItem>;
|
|
6
8
|
params: Partial<TParams>;
|
|
7
9
|
}
|
|
8
|
-
type LoadCallback<TSpec, TItem, TData extends TItem | ReadonlyArray<TItem>, TParams extends Record<string, any
|
|
9
|
-
(specs: ReadonlyArray<TSpec>, options: LoadOptions<TItem, TParams>): PromiseOrDirect<ReadonlyArray<Maybe<TData>>>;
|
|
10
|
+
type LoadCallback<TSpec, TItem, TData extends TItem | ReadonlyArray<TItem>, TParams extends Record<string, any>, TUnarySpec = never> = {
|
|
11
|
+
(specs: ReadonlyArray<TSpec>, options: LoadOptions<TItem, TParams, TUnarySpec>): PromiseOrDirect<ReadonlyArray<Maybe<TData>>>;
|
|
10
12
|
displayName?: string;
|
|
11
13
|
};
|
|
12
|
-
export type LoadOneCallback<TSpec, TItem, TParams extends Record<string, any
|
|
13
|
-
export type LoadManyCallback<TSpec, TItem, TParams extends Record<string, any
|
|
14
|
+
export type LoadOneCallback<TSpec, TItem, TParams extends Record<string, any>, TUnarySpec = never> = LoadCallback<TSpec, TItem, TItem, TParams, TUnarySpec>;
|
|
15
|
+
export type LoadManyCallback<TSpec, TItem, TParams extends Record<string, any>, TUnarySpec = never> = LoadCallback<TSpec, TItem, ReadonlyArray<TItem>, TParams, TUnarySpec>;
|
|
14
16
|
/**
|
|
15
17
|
* A TypeScript Identity Function to help you strongly type your
|
|
16
18
|
* LoadOneCallback.
|
|
17
19
|
*/
|
|
18
|
-
export declare function loadOneCallback<TSpec, TItem, TParams extends Record<string, any
|
|
20
|
+
export declare function loadOneCallback<TSpec, TItem, TParams extends Record<string, any>, TUnarySpec = never>(callback: LoadOneCallback<TSpec, TItem, TParams, TUnarySpec>): LoadOneCallback<TSpec, TItem, TParams, TUnarySpec>;
|
|
19
21
|
/**
|
|
20
22
|
* A TypeScript Identity Function to help you strongly type your
|
|
21
23
|
* LoadManyCallback.
|
|
22
24
|
*/
|
|
23
|
-
export declare function loadManyCallback<TSpec, TItem, TParams extends Record<string, any
|
|
25
|
+
export declare function loadManyCallback<TSpec, TItem, TParams extends Record<string, any>, TUnarySpec = never>(callback: LoadManyCallback<TSpec, TItem, TParams, TUnarySpec>): LoadManyCallback<TSpec, TItem, TParams, TUnarySpec>;
|
|
24
26
|
/**
|
|
25
27
|
* You shouldn't create instances of this yourself - use `loadOne` or `loadMany` instead.
|
|
26
|
-
*
|
|
27
|
-
* @internal
|
|
28
28
|
*/
|
|
29
|
-
export declare class LoadedRecordStep<TItem, TParams extends Record<string, any>> extends
|
|
29
|
+
export declare class LoadedRecordStep<TItem, TParams extends Record<string, any> = Record<string, any>> extends Step<TItem> {
|
|
30
30
|
private isSingle;
|
|
31
31
|
private sourceDescription;
|
|
32
32
|
private ioEquivalence;
|
|
@@ -37,43 +37,52 @@ export declare class LoadedRecordStep<TItem, TParams extends Record<string, any>
|
|
|
37
37
|
isSyncAndSafe: boolean;
|
|
38
38
|
attributes: Set<keyof TItem>;
|
|
39
39
|
params: Partial<TParams>;
|
|
40
|
-
constructor($data:
|
|
40
|
+
constructor($data: Step<TItem>, isSingle: boolean, sourceDescription: string, ioEquivalence: Record<string, Step>);
|
|
41
41
|
toStringMeta(): string;
|
|
42
|
-
get(attr: keyof TItem & (string | number)):
|
|
42
|
+
get(attr: keyof TItem & (string | number)): Step<any>;
|
|
43
|
+
private _getInner;
|
|
43
44
|
setParam<TParamKey extends keyof TParams>(paramKey: TParamKey, value: TParams[TParamKey]): void;
|
|
44
|
-
optimize():
|
|
45
|
-
execute(
|
|
45
|
+
optimize(): Step<any> | import("./__flag.js").__FlagStep<Step<any>>;
|
|
46
|
+
execute({ count, values: [values0], }: ExecutionDetails<[TItem]>): GrafastResultsList<TItem>;
|
|
46
47
|
}
|
|
47
|
-
export declare class LoadStep<
|
|
48
|
+
export declare class LoadStep<const TMultistep extends Multistep, TItem, TData extends TItem | ReadonlyArray<TItem>, TParams extends Record<string, any>, const TUnaryMultistep extends Multistep = never> extends Step {
|
|
49
|
+
private ioEquivalence;
|
|
48
50
|
private load;
|
|
49
|
-
private ioEquivalence?;
|
|
50
51
|
static $$export: {
|
|
51
52
|
moduleName: string;
|
|
52
53
|
exportName: string;
|
|
53
54
|
};
|
|
54
|
-
|
|
55
|
+
isSyncAndSafe: boolean;
|
|
56
|
+
loadOptions: Omit<LoadOptions<TItem, TParams, UnwrapMultistep<TUnaryMultistep>>, "unary"> | null;
|
|
55
57
|
loadOptionsKey: string;
|
|
56
58
|
attributes: Set<keyof TItem>;
|
|
57
59
|
params: Partial<TParams>;
|
|
58
|
-
|
|
60
|
+
unaryDepId: number | null;
|
|
61
|
+
constructor(spec: TMultistep, unarySpec: TUnaryMultistep | null, ioEquivalence: IOEquivalence<TMultistep>, load: LoadCallback<UnwrapMultistep<TMultistep>, TItem, TData, TParams, UnwrapMultistep<TUnaryMultistep>>);
|
|
59
62
|
toStringMeta(): string;
|
|
60
63
|
private makeAccessMap;
|
|
61
|
-
listItem($item: __ItemStep<
|
|
64
|
+
listItem($item: __ItemStep<TItem>): LoadedRecordStep<TItem, TParams>;
|
|
62
65
|
single(): TData extends ReadonlyArray<any> ? never : LoadedRecordStep<TItem, TParams>;
|
|
63
66
|
setParam<TParamKey extends keyof TParams>(paramKey: TParamKey, value: TParams[TParamKey]): void;
|
|
64
67
|
addAttributes(attributes: Set<keyof TItem>): void;
|
|
65
68
|
finalize(): void;
|
|
66
|
-
execute(count
|
|
69
|
+
execute({ count, values: [values0, values1], extra, }: ExecutionDetails<[
|
|
70
|
+
UnwrapMultistep<TMultistep>,
|
|
71
|
+
UnwrapMultistep<TUnaryMultistep>
|
|
72
|
+
]>): PromiseOrDirect<GrafastResultsList<Maybe<TData>>>;
|
|
67
73
|
}
|
|
68
|
-
export declare function loadMany<
|
|
69
|
-
export declare function loadMany<
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
74
|
+
export declare function loadMany<const TMultistep extends Multistep, TItem, TParams extends Record<string, any> = Record<string, any>, const TUnaryMultistep extends Multistep = never>(spec: TMultistep, loadCallback: LoadManyCallback<UnwrapMultistep<TMultistep>, TItem, TParams, UnwrapMultistep<TUnaryMultistep>>): LoadStep<UnwrapMultistep<TMultistep>, TItem, ReadonlyArray<TItem>, TParams, UnwrapMultistep<TUnaryMultistep>>;
|
|
75
|
+
export declare function loadMany<const TMultistep extends Multistep, TItem, TParams extends Record<string, any> = Record<string, any>, const TUnaryMultistep extends Multistep = never>(spec: TMultistep, ioEquivalence: IOEquivalence<TMultistep>, loadCallback: LoadManyCallback<UnwrapMultistep<TMultistep>, TItem, TParams, UnwrapMultistep<TUnaryMultistep>>): LoadStep<UnwrapMultistep<TMultistep>, TItem, ReadonlyArray<TItem>, TParams, UnwrapMultistep<TUnaryMultistep>>;
|
|
76
|
+
export declare function loadMany<const TMultistep extends Multistep, TItem, TParams extends Record<string, any> = Record<string, any>, const TUnaryMultistep extends Multistep = never>(spec: TMultistep, unarySpec: TUnaryMultistep | null, loadCallback: LoadManyCallback<UnwrapMultistep<TMultistep>, TItem, TParams, UnwrapMultistep<TUnaryMultistep>>): LoadStep<UnwrapMultistep<TMultistep>, TItem, ReadonlyArray<TItem>, TParams, UnwrapMultistep<TUnaryMultistep>>;
|
|
77
|
+
export declare function loadMany<const TMultistep extends Multistep, TItem, TParams extends Record<string, any> = Record<string, any>, const TUnaryMultistep extends Multistep = never>(spec: TMultistep, unarySpec: TUnaryMultistep | null, ioEquivalence: IOEquivalence<TMultistep>, loadCallback: LoadManyCallback<UnwrapMultistep<TMultistep>, TItem, TParams, UnwrapMultistep<TUnaryMultistep>>): LoadStep<UnwrapMultistep<TMultistep>, TItem, ReadonlyArray<TItem>, TParams, UnwrapMultistep<TUnaryMultistep>>;
|
|
78
|
+
type IOEquivalence<TMultistep extends Multistep> = null | string | (UnwrapMultistep<TMultistep> extends readonly [...(readonly any[])] ? {
|
|
79
|
+
[key in Exclude<keyof UnwrapMultistep<TMultistep>, keyof any[]>]: string | null;
|
|
80
|
+
} : UnwrapMultistep<TMultistep> extends Record<string, any> ? {
|
|
81
|
+
[key in keyof UnwrapMultistep<TMultistep>]?: string | null;
|
|
82
|
+
} : never);
|
|
83
|
+
export declare function loadOne<const TMultistep extends Multistep, TItem, TParams extends Record<string, any> = Record<string, any>, const TUnaryMultistep extends Multistep = never>(spec: TMultistep, loadCallback: LoadOneCallback<UnwrapMultistep<TMultistep>, TItem, TParams, UnwrapMultistep<TUnaryMultistep>>): LoadedRecordStep<TItem, TParams>;
|
|
84
|
+
export declare function loadOne<const TMultistep extends Multistep, TItem, TParams extends Record<string, any> = Record<string, any>, const TUnaryMultistep extends Multistep = never>(spec: TMultistep, ioEquivalence: IOEquivalence<TMultistep>, loadCallback: LoadOneCallback<UnwrapMultistep<TMultistep>, TItem, TParams, UnwrapMultistep<TUnaryMultistep>>): LoadedRecordStep<TItem, TParams>;
|
|
85
|
+
export declare function loadOne<const TMultistep extends Multistep, TItem, TParams extends Record<string, any> = Record<string, any>, const TUnaryMultistep extends Multistep = never>(spec: TMultistep, unarySpec: TUnaryMultistep | null, loadCallback: LoadOneCallback<UnwrapMultistep<TMultistep>, TItem, TParams, UnwrapMultistep<TUnaryMultistep>>): LoadedRecordStep<TItem, TParams>;
|
|
86
|
+
export declare function loadOne<const TMultistep extends Multistep, TItem, TParams extends Record<string, any> = Record<string, any>, const TUnaryMultistep extends Multistep = never>(spec: TMultistep, unarySpec: TUnaryMultistep | null, ioEquivalence: IOEquivalence<TMultistep>, loadCallback: LoadOneCallback<UnwrapMultistep<TMultistep>, TItem, TParams, UnwrapMultistep<TUnaryMultistep>>): LoadedRecordStep<TItem, TParams>;
|
|
78
87
|
export {};
|
|
79
88
|
//# sourceMappingURL=load.d.ts.map
|
package/dist/steps/load.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.LoadStep = exports.LoadedRecordStep = void 0;
|
|
4
|
+
exports.loadOneCallback = loadOneCallback;
|
|
5
|
+
exports.loadManyCallback = loadManyCallback;
|
|
6
|
+
exports.loadMany = loadMany;
|
|
7
|
+
exports.loadOne = loadOne;
|
|
4
8
|
const index_js_1 = require("../index.js");
|
|
9
|
+
const multistep_js_1 = require("../multistep.js");
|
|
5
10
|
const step_js_1 = require("../step.js");
|
|
6
11
|
const utils_js_1 = require("../utils.js");
|
|
7
12
|
const access_js_1 = require("./access.js");
|
|
@@ -12,7 +17,6 @@ const access_js_1 = require("./access.js");
|
|
|
12
17
|
function loadOneCallback(callback) {
|
|
13
18
|
return callback;
|
|
14
19
|
}
|
|
15
|
-
exports.loadOneCallback = loadOneCallback;
|
|
16
20
|
/**
|
|
17
21
|
* A TypeScript Identity Function to help you strongly type your
|
|
18
22
|
* LoadManyCallback.
|
|
@@ -20,15 +24,12 @@ exports.loadOneCallback = loadOneCallback;
|
|
|
20
24
|
function loadManyCallback(callback) {
|
|
21
25
|
return callback;
|
|
22
26
|
}
|
|
23
|
-
exports.loadManyCallback = loadManyCallback;
|
|
24
27
|
const idByLoad = new WeakMap();
|
|
25
28
|
let loadCounter = 0;
|
|
26
29
|
/**
|
|
27
30
|
* You shouldn't create instances of this yourself - use `loadOne` or `loadMany` instead.
|
|
28
|
-
*
|
|
29
|
-
* @internal
|
|
30
31
|
*/
|
|
31
|
-
class LoadedRecordStep extends step_js_1.
|
|
32
|
+
class LoadedRecordStep extends step_js_1.Step {
|
|
32
33
|
static { this.$$export = {
|
|
33
34
|
moduleName: "grafast",
|
|
34
35
|
exportName: "LoadedRecordStep",
|
|
@@ -49,6 +50,9 @@ class LoadedRecordStep extends step_js_1.ExecutableStep {
|
|
|
49
50
|
return this.sourceDescription ?? null;
|
|
50
51
|
}
|
|
51
52
|
get(attr) {
|
|
53
|
+
return this.cacheStep("get", attr, () => this._getInner(attr));
|
|
54
|
+
}
|
|
55
|
+
_getInner(attr) {
|
|
52
56
|
// Allow auto-collapsing of the waterfall by knowing keys are equivalent
|
|
53
57
|
if (this.operationPlan.phase === "plan" &&
|
|
54
58
|
this.ioEquivalence[attr]) {
|
|
@@ -81,23 +85,32 @@ class LoadedRecordStep extends step_js_1.ExecutableStep {
|
|
|
81
85
|
return this.getDep(0);
|
|
82
86
|
}
|
|
83
87
|
// This'll never be called, due to `optimize` above.
|
|
84
|
-
execute(
|
|
85
|
-
return
|
|
88
|
+
execute({ count, values: [values0], }) {
|
|
89
|
+
return values0.isBatch
|
|
90
|
+
? values0.entries
|
|
91
|
+
: (0, utils_js_1.arrayOfLength)(count, values0.value);
|
|
86
92
|
}
|
|
87
93
|
}
|
|
88
94
|
exports.LoadedRecordStep = LoadedRecordStep;
|
|
89
|
-
class LoadStep extends step_js_1.
|
|
95
|
+
class LoadStep extends step_js_1.Step {
|
|
90
96
|
/* implements ListCapableStep<TItem, LoadedRecordStep<TItem, TParams>> */
|
|
91
97
|
static { this.$$export = { moduleName: "grafast", exportName: "LoadStep" }; }
|
|
92
|
-
constructor(
|
|
98
|
+
constructor(spec, unarySpec, ioEquivalence, load) {
|
|
93
99
|
super();
|
|
94
|
-
this.load = load;
|
|
95
100
|
this.ioEquivalence = ioEquivalence;
|
|
101
|
+
this.load = load;
|
|
102
|
+
this.isSyncAndSafe = false;
|
|
96
103
|
this.loadOptions = null;
|
|
97
104
|
this.loadOptionsKey = "";
|
|
98
105
|
this.attributes = new Set();
|
|
99
106
|
this.params = Object.create(null);
|
|
107
|
+
this.unaryDepId = null;
|
|
108
|
+
const $spec = (0, multistep_js_1.multistep)(spec, "load");
|
|
100
109
|
this.addDependency($spec);
|
|
110
|
+
const $unarySpec = unarySpec == null ? null : (0, multistep_js_1.multistep)(unarySpec, "loadUnary");
|
|
111
|
+
if ($unarySpec) {
|
|
112
|
+
this.unaryDepId = this.addUnaryDependency($unarySpec);
|
|
113
|
+
}
|
|
101
114
|
}
|
|
102
115
|
toStringMeta() {
|
|
103
116
|
return this.load.displayName || this.load.name;
|
|
@@ -112,7 +125,7 @@ class LoadStep extends step_js_1.ExecutableStep {
|
|
|
112
125
|
map[this.ioEquivalence] = $spec;
|
|
113
126
|
return map;
|
|
114
127
|
}
|
|
115
|
-
else if (
|
|
128
|
+
else if ((0, utils_js_1.isTuple)(this.ioEquivalence)) {
|
|
116
129
|
for (let i = 0, l = this.ioEquivalence.length; i < l; i++) {
|
|
117
130
|
const key = this.ioEquivalence[i];
|
|
118
131
|
map[key] = (0, step_js_1.isListLikeStep)($spec) ? $spec.at(i) : (0, access_js_1.access)($spec, [i]);
|
|
@@ -181,8 +194,9 @@ class LoadStep extends step_js_1.ExecutableStep {
|
|
|
181
194
|
idByLoad.set(this.load, loadId);
|
|
182
195
|
}
|
|
183
196
|
this.metaKey = `LoadStep|${loadId}|${this.loadOptionsKey}`;
|
|
197
|
+
super.finalize();
|
|
184
198
|
}
|
|
185
|
-
execute(count, [
|
|
199
|
+
execute({ count, values: [values0, values1], extra, }) {
|
|
186
200
|
const meta = extra.meta;
|
|
187
201
|
let cache = meta.cache;
|
|
188
202
|
if (!cache) {
|
|
@@ -190,9 +204,10 @@ class LoadStep extends step_js_1.ExecutableStep {
|
|
|
190
204
|
meta.cache = cache;
|
|
191
205
|
}
|
|
192
206
|
const batch = new Map();
|
|
207
|
+
const unary = values1?.isBatch === false ? values1.value : undefined;
|
|
193
208
|
const results = [];
|
|
194
209
|
for (let i = 0; i < count; i++) {
|
|
195
|
-
const spec =
|
|
210
|
+
const spec = values0.at(i);
|
|
196
211
|
if (cache.has(spec)) {
|
|
197
212
|
results.push(cache.get(spec));
|
|
198
213
|
}
|
|
@@ -227,11 +242,14 @@ class LoadStep extends step_js_1.ExecutableStep {
|
|
|
227
242
|
meta.loadBatchesByLoad.set(this.load, loadBatches);
|
|
228
243
|
// Guaranteed by the metaKey to be equivalent for all entries sharing the same `meta`. Note equivalent is not identical; key order may change.
|
|
229
244
|
const loadOptions = this.loadOptions;
|
|
230
|
-
|
|
245
|
+
process.nextTick(() => {
|
|
231
246
|
// Don't allow adding anything else to the batch
|
|
232
247
|
meta.loadBatchesByLoad.delete(this.load);
|
|
233
|
-
executeBatches(loadBatches, this.load,
|
|
234
|
-
|
|
248
|
+
executeBatches(loadBatches, this.load, {
|
|
249
|
+
...loadOptions,
|
|
250
|
+
unary: unary,
|
|
251
|
+
});
|
|
252
|
+
});
|
|
235
253
|
}
|
|
236
254
|
return (async () => {
|
|
237
255
|
const loadResults = await deferred;
|
|
@@ -286,25 +304,40 @@ async function executeBatches(loadBatches, load, loadOptions) {
|
|
|
286
304
|
}
|
|
287
305
|
}
|
|
288
306
|
}
|
|
289
|
-
function load(
|
|
290
|
-
return new LoadStep(
|
|
307
|
+
function load(spec, unarySpec, ioEquivalence, loadCallback) {
|
|
308
|
+
return new LoadStep(spec, unarySpec, ioEquivalence, loadCallback);
|
|
291
309
|
}
|
|
292
|
-
function loadMany(
|
|
310
|
+
function loadMany(spec, loadCallbackOrIoEquivalenceOrUnarySpec, loadCallbackOrIoEquivalence, loadCallbackOnly) {
|
|
293
311
|
if (loadCallbackOnly) {
|
|
294
|
-
return load(
|
|
312
|
+
return load(spec, loadCallbackOrIoEquivalenceOrUnarySpec, loadCallbackOrIoEquivalence, loadCallbackOnly);
|
|
313
|
+
}
|
|
314
|
+
// At most 3 arguments
|
|
315
|
+
else if ((0, multistep_js_1.isMultistep)(loadCallbackOrIoEquivalenceOrUnarySpec)) {
|
|
316
|
+
return load(spec, loadCallbackOrIoEquivalenceOrUnarySpec, null, loadCallbackOrIoEquivalence);
|
|
317
|
+
}
|
|
318
|
+
// Unary step is definitely null; 3 arguments
|
|
319
|
+
else if (loadCallbackOrIoEquivalence) {
|
|
320
|
+
return load(spec, null, loadCallbackOrIoEquivalenceOrUnarySpec, loadCallbackOrIoEquivalence);
|
|
295
321
|
}
|
|
322
|
+
// 2 arguments
|
|
296
323
|
else {
|
|
297
|
-
return load(
|
|
324
|
+
return load(spec, null, null, loadCallbackOrIoEquivalenceOrUnarySpec);
|
|
298
325
|
}
|
|
299
326
|
}
|
|
300
|
-
|
|
301
|
-
function loadOne($spec, loadCallbackOrIoEquivalence, loadCallbackOnly) {
|
|
327
|
+
function loadOne(spec, loadCallbackOrIoEquivalenceOrUnarySpec, loadCallbackOrIoEquivalence, loadCallbackOnly) {
|
|
302
328
|
if (loadCallbackOnly) {
|
|
303
|
-
return load(
|
|
329
|
+
return load(spec, loadCallbackOrIoEquivalenceOrUnarySpec, loadCallbackOrIoEquivalence, loadCallbackOnly).single();
|
|
330
|
+
}
|
|
331
|
+
// At most 3 arguments
|
|
332
|
+
else if ((0, multistep_js_1.isMultistep)(loadCallbackOrIoEquivalenceOrUnarySpec)) {
|
|
333
|
+
return load(spec, loadCallbackOrIoEquivalenceOrUnarySpec, null, loadCallbackOrIoEquivalence).single();
|
|
334
|
+
}
|
|
335
|
+
// Unary step is definitely null; 3 arguments
|
|
336
|
+
else if (loadCallbackOrIoEquivalence) {
|
|
337
|
+
return load(spec, null, loadCallbackOrIoEquivalenceOrUnarySpec, loadCallbackOrIoEquivalence).single();
|
|
304
338
|
}
|
|
305
339
|
else {
|
|
306
|
-
return load(
|
|
340
|
+
return load(spec, null, null, loadCallbackOrIoEquivalenceOrUnarySpec).single();
|
|
307
341
|
}
|
|
308
342
|
}
|
|
309
|
-
exports.loadOne = loadOne;
|
|
310
343
|
//# sourceMappingURL=load.js.map
|