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.
- package/dist/args.js +2 -3
- package/dist/assert.js +2 -3
- package/dist/constraints.js +1 -2
- package/dist/deferred.js +1 -2
- package/dist/dev.js +2 -2
- package/dist/engine/LayerPlan.d.ts +20 -16
- package/dist/engine/LayerPlan.js +5 -10
- package/dist/engine/OperationPlan.d.ts +12 -13
- package/dist/engine/OperationPlan.js +210 -146
- package/dist/engine/OutputPlan.d.ts +4 -4
- package/dist/engine/OutputPlan.js +13 -10
- package/dist/engine/StepTracker.js +11 -2
- package/dist/engine/executeBucket.js +135 -94
- package/dist/engine/executeOutputPlan.js +1 -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 -2
- package/dist/engine/lib/withGlobalLayerPlan.js +4 -5
- package/dist/engine/lock.d.ts +3 -3
- package/dist/engine/lock.js +3 -3
- package/dist/error.js +4 -4
- package/dist/establishOperationPlan.js +2 -3
- package/dist/execute.js +3 -4
- package/dist/exportAs.js +2 -3
- package/dist/global.js +2 -3
- package/dist/grafastGraphql.js +2 -3
- package/dist/grafastPrint.js +7 -8
- package/dist/graphqlCollectFields.js +6 -7
- package/dist/graphqlMergeSelectionSets.js +1 -2
- package/dist/index.d.ts +22 -18
- package/dist/index.js +41 -16
- package/dist/input.js +75 -28
- package/dist/inspect.d.ts +9 -4
- package/dist/inspect.js +2 -2
- package/dist/interfaces.d.ts +110 -89
- package/dist/makeGrafastSchema.d.ts +18 -9
- package/dist/makeGrafastSchema.js +64 -30
- package/dist/mermaid.js +53 -14
- package/dist/middleware.js +1 -2
- package/dist/multistep.d.ts +6 -6
- package/dist/multistep.js +6 -7
- package/dist/operationPlan-input.d.ts +5 -4
- package/dist/operationPlan-input.js +131 -399
- package/dist/planJSONInterfaces.d.ts +6 -2
- package/dist/polymorphic.js +4 -5
- package/dist/prepare.js +6 -6
- package/dist/step.d.ts +67 -99
- package/dist/step.js +99 -127
- package/dist/steps/__flag.d.ts +16 -16
- package/dist/steps/__flag.js +9 -6
- package/dist/steps/__inputDefault.d.ts +14 -0
- package/dist/steps/__inputDefault.js +48 -0
- package/dist/steps/__inputDynamicScalar.d.ts +2 -4
- 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 +6 -11
- package/dist/steps/__inputObject.js +13 -3
- package/dist/steps/__inputStaticLeaf.d.ts +2 -4
- package/dist/steps/__inputStaticLeaf.js +3 -1
- package/dist/steps/__item.d.ts +6 -6
- package/dist/steps/__item.js +1 -1
- package/dist/steps/__trackedValue.d.ts +4 -49
- package/dist/steps/__trackedValue.js +24 -6
- package/dist/steps/__value.d.ts +3 -3
- package/dist/steps/__value.js +3 -2
- package/dist/steps/access.d.ts +7 -6
- package/dist/steps/access.js +14 -7
- package/dist/steps/applyInput.d.ts +44 -0
- package/dist/steps/applyInput.js +206 -0
- package/dist/steps/applyTransforms.d.ts +2 -2
- package/dist/steps/applyTransforms.js +7 -5
- package/dist/steps/bakedInput.d.ts +23 -0
- package/dist/steps/bakedInput.js +90 -0
- package/dist/steps/condition.d.ts +5 -5
- package/dist/steps/condition.js +3 -3
- package/dist/steps/connection.d.ts +42 -39
- package/dist/steps/connection.js +51 -35
- package/dist/steps/constant.d.ts +4 -8
- package/dist/steps/constant.js +54 -6
- package/dist/steps/each.d.ts +3 -3
- package/dist/steps/each.js +1 -2
- package/dist/steps/error.d.ts +2 -2
- package/dist/steps/error.js +3 -3
- package/dist/steps/filter.d.ts +3 -2
- package/dist/steps/filter.js +1 -2
- package/dist/steps/first.d.ts +6 -5
- package/dist/steps/first.js +5 -4
- package/dist/steps/graphqlResolver.d.ts +2 -2
- package/dist/steps/graphqlResolver.js +44 -56
- package/dist/steps/groupBy.d.ts +3 -2
- package/dist/steps/groupBy.js +1 -2
- package/dist/steps/index.d.ts +4 -2
- package/dist/steps/index.js +21 -9
- package/dist/steps/lambda.d.ts +5 -5
- package/dist/steps/lambda.js +4 -4
- package/dist/steps/last.d.ts +6 -5
- package/dist/steps/last.js +5 -4
- package/dist/steps/list.d.ts +7 -7
- package/dist/steps/list.js +3 -3
- package/dist/steps/listTransform.d.ts +14 -12
- package/dist/steps/listTransform.js +14 -7
- package/dist/steps/listen.d.ts +6 -8
- package/dist/steps/listen.js +7 -7
- package/dist/steps/load.d.ts +6 -6
- package/dist/steps/load.js +7 -7
- package/dist/steps/node.d.ts +16 -10
- package/dist/steps/node.js +14 -7
- package/dist/steps/object.d.ts +11 -11
- package/dist/steps/object.js +5 -5
- package/dist/steps/partitionByIndex.d.ts +3 -2
- package/dist/steps/partitionByIndex.js +1 -2
- package/dist/steps/polymorphicBranch.d.ts +8 -8
- package/dist/steps/polymorphicBranch.js +4 -4
- package/dist/steps/proxy.d.ts +8 -8
- package/dist/steps/proxy.js +3 -3
- package/dist/steps/remapKeys.d.ts +6 -6
- package/dist/steps/remapKeys.js +3 -3
- package/dist/steps/reverse.d.ts +5 -5
- package/dist/steps/reverse.js +4 -4
- package/dist/steps/setter.d.ts +9 -18
- package/dist/steps/setter.js +24 -14
- package/dist/steps/sideEffect.d.ts +4 -4
- package/dist/steps/sideEffect.js +3 -3
- package/dist/stringifyPayload.js +1 -2
- package/dist/stripAnsi.js +2 -2
- package/dist/subscribe.js +2 -3
- package/dist/timeSource.d.ts +0 -1
- package/dist/utils.d.ts +43 -31
- package/dist/utils.js +97 -61
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +2 -2
package/dist/steps/index.js
CHANGED
|
@@ -1,29 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.reverse = exports.RemapKeysStep = exports.remapKeys = exports.partitionByIndex = exports.ObjectStep = exports.object = exports.specFromNodeId = exports.NodeStep = exports.nodeIdFromNode = exports.node = exports.makeDecodeNodeId = exports.listTransform = exports.__ListTransformStep = exports.ListenStep = exports.listen = exports.ListStep = exports.list = exports.LastStep = exports.last = exports.LambdaStep = exports.lambda = exports.groupBy = exports.FirstStep = exports.first = exports.filter = exports.ErrorStep = exports.error = exports.each = exports.ConstantStep = exports.constant = exports.EdgeStep = exports.ConnectionStep = exports.connection = exports.assertPageInfoCapableStep = exports.assertEdgeCapableStep = exports.AccessStep = exports.access = exports.TRAP_INHIBITED = exports.TRAP_ERROR_OR_INHIBITED = exports.TRAP_ERROR = exports.trap = exports.inhibitOnNull = exports.assertNotNull = exports.__FlagStep =
|
|
4
|
-
exports.ProxyStep = exports.proxy = exports.PolymorphicBranchStep = exports.polymorphicBranch = exports.LoadStep = exports.loadOneCallback = exports.loadOne = exports.loadManyCallback = exports.loadMany = exports.LoadedRecordStep = exports.GraphQLResolverStep = exports.graphqlResolver = exports.graphqlItemHandler = exports.GraphQLItemHandler = exports.ConditionStep = exports.condition = exports.ApplyTransformsStep = exports.applyTransforms = exports.
|
|
3
|
+
exports.setter = exports.Setter = exports.createObjectAndApplyChildren = exports.ReverseStep = exports.reverseArray = exports.reverse = exports.RemapKeysStep = exports.remapKeys = exports.partitionByIndex = exports.ObjectStep = exports.object = exports.specFromNodeId = exports.NodeStep = exports.nodeIdFromNode = exports.node = exports.makeDecodeNodeIdRuntime = exports.makeDecodeNodeId = exports.listTransform = exports.__ListTransformStep = exports.ListenStep = exports.listen = exports.ListStep = exports.list = exports.LastStep = exports.last = exports.LambdaStep = exports.lambda = exports.groupBy = exports.FirstStep = exports.first = exports.filter = exports.ErrorStep = exports.error = exports.each = exports.ConstantStep = exports.constant = exports.EdgeStep = exports.ConnectionStep = exports.connection = exports.assertPageInfoCapableStep = exports.assertEdgeCapableStep = exports.AccessStep = exports.access = exports.TRAP_INHIBITED = exports.TRAP_ERROR_OR_INHIBITED = exports.TRAP_ERROR = exports.trap = exports.inhibitOnNull = exports.assertNotNull = exports.__FlagStep = void 0;
|
|
4
|
+
exports.ProxyStep = exports.proxy = exports.PolymorphicBranchStep = exports.polymorphicBranch = exports.LoadStep = exports.loadOneCallback = exports.loadOne = exports.loadManyCallback = exports.loadMany = exports.LoadedRecordStep = exports.GraphQLResolverStep = exports.graphqlResolver = exports.graphqlItemHandler = exports.GraphQLItemHandler = exports.ConditionStep = exports.condition = exports.BakedInputStep = exports.bakedInputRuntime = exports.bakedInput = exports.ApplyTransformsStep = exports.applyTransforms = exports.Modifier = exports.isModifier = exports.assertModifier = exports.ApplyInputStep = exports.applyInput = exports.__ValueStep = exports.__TrackedValueStep = exports.__ItemStep = exports.__InputStaticLeafStep = exports.__InputObjectStep = exports.__InputListStep = exports.SideEffectStep = exports.sideEffect = void 0;
|
|
5
|
+
exports.operationPlan = operationPlan;
|
|
6
|
+
exports.context = context;
|
|
7
|
+
exports.rootValue = rootValue;
|
|
8
|
+
exports.trackedContext = trackedContext;
|
|
9
|
+
exports.trackedRootValue = trackedRootValue;
|
|
10
|
+
exports.debugPlans = debugPlans;
|
|
5
11
|
const withGlobalLayerPlan_js_1 = require("../engine/lib/withGlobalLayerPlan.js");
|
|
6
12
|
const global_js_1 = require("../global.js");
|
|
7
13
|
function operationPlan() {
|
|
8
14
|
return (0, withGlobalLayerPlan_js_1.currentLayerPlan)().operationPlan;
|
|
9
15
|
}
|
|
10
|
-
exports.operationPlan = operationPlan;
|
|
11
16
|
function context() {
|
|
12
17
|
return operationPlan().contextStep;
|
|
13
18
|
}
|
|
14
|
-
exports.context = context;
|
|
15
19
|
function rootValue() {
|
|
16
20
|
return operationPlan().rootValueStep;
|
|
17
21
|
}
|
|
18
|
-
exports.rootValue = rootValue;
|
|
19
22
|
function trackedContext() {
|
|
20
23
|
return operationPlan().trackedContextStep;
|
|
21
24
|
}
|
|
22
|
-
exports.trackedContext = trackedContext;
|
|
23
25
|
function trackedRootValue() {
|
|
24
26
|
return operationPlan().trackedRootValueStep;
|
|
25
27
|
}
|
|
26
|
-
exports.trackedRootValue = trackedRootValue;
|
|
27
28
|
/**
|
|
28
29
|
* Turns on debug mode, calls the callback, and then turns debug mode back off
|
|
29
30
|
* again.
|
|
@@ -35,7 +36,6 @@ function debugPlans(callback) {
|
|
|
35
36
|
(0, global_js_1.setDebug)(oldDebug);
|
|
36
37
|
return result;
|
|
37
38
|
}
|
|
38
|
-
exports.debugPlans = debugPlans;
|
|
39
39
|
var __flag_js_1 = require("./__flag.js");
|
|
40
40
|
Object.defineProperty(exports, "__FlagStep", { enumerable: true, get: function () { return __flag_js_1.__FlagStep; } });
|
|
41
41
|
Object.defineProperty(exports, "assertNotNull", { enumerable: true, get: function () { return __flag_js_1.assertNotNull; } });
|
|
@@ -85,6 +85,7 @@ Object.defineProperty(exports, "__ListTransformStep", { enumerable: true, get: f
|
|
|
85
85
|
Object.defineProperty(exports, "listTransform", { enumerable: true, get: function () { return listTransform_js_1.listTransform; } });
|
|
86
86
|
var node_js_1 = require("./node.js");
|
|
87
87
|
Object.defineProperty(exports, "makeDecodeNodeId", { enumerable: true, get: function () { return node_js_1.makeDecodeNodeId; } });
|
|
88
|
+
Object.defineProperty(exports, "makeDecodeNodeIdRuntime", { enumerable: true, get: function () { return node_js_1.makeDecodeNodeIdRuntime; } });
|
|
88
89
|
Object.defineProperty(exports, "node", { enumerable: true, get: function () { return node_js_1.node; } });
|
|
89
90
|
Object.defineProperty(exports, "nodeIdFromNode", { enumerable: true, get: function () { return node_js_1.nodeIdFromNode; } });
|
|
90
91
|
Object.defineProperty(exports, "NodeStep", { enumerable: true, get: function () { return node_js_1.NodeStep; } });
|
|
@@ -102,8 +103,9 @@ Object.defineProperty(exports, "reverse", { enumerable: true, get: function () {
|
|
|
102
103
|
Object.defineProperty(exports, "reverseArray", { enumerable: true, get: function () { return reverse_js_1.reverseArray; } });
|
|
103
104
|
Object.defineProperty(exports, "ReverseStep", { enumerable: true, get: function () { return reverse_js_1.ReverseStep; } });
|
|
104
105
|
var setter_js_1 = require("./setter.js");
|
|
106
|
+
Object.defineProperty(exports, "createObjectAndApplyChildren", { enumerable: true, get: function () { return setter_js_1.createObjectAndApplyChildren; } });
|
|
107
|
+
Object.defineProperty(exports, "Setter", { enumerable: true, get: function () { return setter_js_1.Setter; } });
|
|
105
108
|
Object.defineProperty(exports, "setter", { enumerable: true, get: function () { return setter_js_1.setter; } });
|
|
106
|
-
Object.defineProperty(exports, "SetterStep", { enumerable: true, get: function () { return setter_js_1.SetterStep; } });
|
|
107
109
|
var sideEffect_js_1 = require("./sideEffect.js");
|
|
108
110
|
Object.defineProperty(exports, "sideEffect", { enumerable: true, get: function () { return sideEffect_js_1.sideEffect; } });
|
|
109
111
|
Object.defineProperty(exports, "SideEffectStep", { enumerable: true, get: function () { return sideEffect_js_1.SideEffectStep; } });
|
|
@@ -120,9 +122,19 @@ var __trackedValue_js_1 = require("./__trackedValue.js");
|
|
|
120
122
|
Object.defineProperty(exports, "__TrackedValueStep", { enumerable: true, get: function () { return __trackedValue_js_1.__TrackedValueStep; } });
|
|
121
123
|
var __value_js_1 = require("./__value.js");
|
|
122
124
|
Object.defineProperty(exports, "__ValueStep", { enumerable: true, get: function () { return __value_js_1.__ValueStep; } });
|
|
125
|
+
var applyInput_js_1 = require("./applyInput.js");
|
|
126
|
+
Object.defineProperty(exports, "applyInput", { enumerable: true, get: function () { return applyInput_js_1.applyInput; } });
|
|
127
|
+
Object.defineProperty(exports, "ApplyInputStep", { enumerable: true, get: function () { return applyInput_js_1.ApplyInputStep; } });
|
|
128
|
+
Object.defineProperty(exports, "assertModifier", { enumerable: true, get: function () { return applyInput_js_1.assertModifier; } });
|
|
129
|
+
Object.defineProperty(exports, "isModifier", { enumerable: true, get: function () { return applyInput_js_1.isModifier; } });
|
|
130
|
+
Object.defineProperty(exports, "Modifier", { enumerable: true, get: function () { return applyInput_js_1.Modifier; } });
|
|
123
131
|
var applyTransforms_js_1 = require("./applyTransforms.js");
|
|
124
132
|
Object.defineProperty(exports, "applyTransforms", { enumerable: true, get: function () { return applyTransforms_js_1.applyTransforms; } });
|
|
125
133
|
Object.defineProperty(exports, "ApplyTransformsStep", { enumerable: true, get: function () { return applyTransforms_js_1.ApplyTransformsStep; } });
|
|
134
|
+
var bakedInput_js_1 = require("./bakedInput.js");
|
|
135
|
+
Object.defineProperty(exports, "bakedInput", { enumerable: true, get: function () { return bakedInput_js_1.bakedInput; } });
|
|
136
|
+
Object.defineProperty(exports, "bakedInputRuntime", { enumerable: true, get: function () { return bakedInput_js_1.bakedInputRuntime; } });
|
|
137
|
+
Object.defineProperty(exports, "BakedInputStep", { enumerable: true, get: function () { return bakedInput_js_1.BakedInputStep; } });
|
|
126
138
|
var condition_js_1 = require("./condition.js");
|
|
127
139
|
Object.defineProperty(exports, "condition", { enumerable: true, get: function () { return condition_js_1.condition; } });
|
|
128
140
|
Object.defineProperty(exports, "ConditionStep", { enumerable: true, get: function () { return condition_js_1.ConditionStep; } });
|
package/dist/steps/lambda.d.ts
CHANGED
|
@@ -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 {
|
|
4
|
-
import {
|
|
3
|
+
import type { Step } from "../step.js";
|
|
4
|
+
import { UnbatchedStep } from "../step.js";
|
|
5
5
|
/**
|
|
6
6
|
* Calls the given lambda function for each tuple
|
|
7
7
|
*/
|
|
8
|
-
export declare class LambdaStep<TIn, TOut> extends
|
|
8
|
+
export declare class LambdaStep<TIn, TOut> extends UnbatchedStep<TOut> {
|
|
9
9
|
private fn;
|
|
10
10
|
static $$export: {
|
|
11
11
|
moduleName: string;
|
|
@@ -13,8 +13,8 @@ export declare class LambdaStep<TIn, TOut> extends UnbatchedExecutableStep<TOut>
|
|
|
13
13
|
};
|
|
14
14
|
isSyncAndSafe: boolean;
|
|
15
15
|
allowMultipleOptimizations: boolean;
|
|
16
|
-
private
|
|
17
|
-
constructor($plan:
|
|
16
|
+
private depId;
|
|
17
|
+
constructor($plan: Step<TIn> | null | undefined, fn: (value: TIn) => PromiseOrDirect<TOut>);
|
|
18
18
|
toStringMeta(): any;
|
|
19
19
|
deduplicate(peers: LambdaStep<any, any>[]): LambdaStep<TIn, TOut>[];
|
|
20
20
|
unbatchedExecute(_extra: UnbatchedExecutionExtra, value: TIn): PromiseOrDirect<TOut>;
|
package/dist/steps/lambda.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.LambdaStep = void 0;
|
|
4
|
+
exports.lambda = lambda;
|
|
4
5
|
const multistep_js_1 = require("../multistep.js");
|
|
5
6
|
const step_js_1 = require("../step.js");
|
|
6
7
|
const sideEffect_js_1 = require("./sideEffect.js");
|
|
7
8
|
/**
|
|
8
9
|
* Calls the given lambda function for each tuple
|
|
9
10
|
*/
|
|
10
|
-
class LambdaStep extends step_js_1.
|
|
11
|
+
class LambdaStep extends step_js_1.UnbatchedStep {
|
|
11
12
|
static { this.$$export = {
|
|
12
13
|
moduleName: "grafast",
|
|
13
14
|
exportName: "LambdaStep",
|
|
@@ -18,7 +19,7 @@ class LambdaStep extends step_js_1.UnbatchedExecutableStep {
|
|
|
18
19
|
// Lambda is only sync and safe if the callback is; so default to false
|
|
19
20
|
this.isSyncAndSafe = false;
|
|
20
21
|
this.allowMultipleOptimizations = true;
|
|
21
|
-
this.
|
|
22
|
+
this.depId = $plan != null ? this.addDependency($plan) : null;
|
|
22
23
|
if (fn.hasSideEffects) {
|
|
23
24
|
this.hasSideEffects = true;
|
|
24
25
|
}
|
|
@@ -63,5 +64,4 @@ function lambda(spec, fn, isSyncAndSafe = false) {
|
|
|
63
64
|
}
|
|
64
65
|
return $lambda;
|
|
65
66
|
}
|
|
66
|
-
exports.lambda = lambda;
|
|
67
67
|
//# sourceMappingURL=lambda.js.map
|
package/dist/steps/last.d.ts
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { UnbatchedExecutionExtra } from "../interfaces.js";
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import type { Step } from "../step.js";
|
|
3
|
+
import { UnbatchedStep } from "../step.js";
|
|
4
|
+
import type { ConnectionCapableStep } from "./connection.js";
|
|
5
|
+
export declare class LastStep<TData> extends UnbatchedStep<TData> {
|
|
5
6
|
static $$export: {
|
|
6
7
|
moduleName: string;
|
|
7
8
|
exportName: string;
|
|
8
9
|
};
|
|
9
10
|
isSyncAndSafe: boolean;
|
|
10
11
|
allowMultipleOptimizations: boolean;
|
|
11
|
-
constructor(parentPlan:
|
|
12
|
+
constructor(parentPlan: Step<ReadonlyArray<TData>> | ConnectionCapableStep<Step<TData>, any>);
|
|
12
13
|
unbatchedExecute: (_extra: UnbatchedExecutionExtra, list: ReadonlyArray<TData>) => TData;
|
|
13
14
|
deduplicate(peers: LastStep<TData>[]): LastStep<TData>[];
|
|
14
15
|
optimize(): any;
|
|
@@ -17,5 +18,5 @@ export declare class LastStep<TData> extends UnbatchedExecutableStep<TData> {
|
|
|
17
18
|
* A plan that resolves to the last entry in the list returned by the given
|
|
18
19
|
* plan.
|
|
19
20
|
*/
|
|
20
|
-
export declare function last<TData>(plan:
|
|
21
|
+
export declare function last<TData>(plan: Step<ReadonlyArray<TData>> | ConnectionCapableStep<Step<TData>, any>): LastStep<TData>;
|
|
21
22
|
//# sourceMappingURL=last.d.ts.map
|
package/dist/steps/last.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.LastStep = void 0;
|
|
4
|
+
exports.last = last;
|
|
4
5
|
const step_js_1 = require("../step.js");
|
|
6
|
+
const connection_js_1 = require("./connection.js");
|
|
5
7
|
const list_js_1 = require("./list.js");
|
|
6
|
-
class LastStep extends step_js_1.
|
|
8
|
+
class LastStep extends step_js_1.UnbatchedStep {
|
|
7
9
|
static { this.$$export = {
|
|
8
10
|
moduleName: "grafast",
|
|
9
11
|
exportName: "LastStep",
|
|
@@ -15,7 +17,7 @@ class LastStep extends step_js_1.UnbatchedExecutableStep {
|
|
|
15
17
|
this.unbatchedExecute = (_extra, list) => {
|
|
16
18
|
return list?.[list?.length - 1];
|
|
17
19
|
};
|
|
18
|
-
this.addDependency(parentPlan);
|
|
20
|
+
this.addDependency((0, connection_js_1.itemsOrStep)(parentPlan));
|
|
19
21
|
}
|
|
20
22
|
deduplicate(peers) {
|
|
21
23
|
return peers;
|
|
@@ -37,5 +39,4 @@ exports.LastStep = LastStep;
|
|
|
37
39
|
function last(plan) {
|
|
38
40
|
return plan.operationPlan.cacheStep(plan, "GrafastInternal:last()", "", () => new LastStep(plan));
|
|
39
41
|
}
|
|
40
|
-
exports.last = last;
|
|
41
42
|
//# sourceMappingURL=last.js.map
|
package/dist/steps/list.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ExecutionDetails, StepOptimizeOptions, UnbatchedExecutionExtra, UnwrapPlanTuple } from "../interfaces.js";
|
|
2
|
-
import type {
|
|
3
|
-
import {
|
|
2
|
+
import type { Step } from "../step.js";
|
|
3
|
+
import { UnbatchedStep } from "../step.js";
|
|
4
4
|
import { ConstantStep } from "./constant.js";
|
|
5
5
|
interface ListStepCacheConfig {
|
|
6
6
|
identifier?: string;
|
|
7
7
|
cacheSize?: number;
|
|
8
8
|
}
|
|
9
|
-
export declare class ListStep<const TPlanTuple extends readonly
|
|
9
|
+
export declare class ListStep<const TPlanTuple extends readonly Step[]> extends UnbatchedStep<UnwrapPlanTuple<TPlanTuple>> {
|
|
10
10
|
static $$export: {
|
|
11
11
|
moduleName: string;
|
|
12
12
|
exportName: string;
|
|
@@ -27,14 +27,14 @@ export declare class ListStep<const TPlanTuple extends readonly ExecutableStep[]
|
|
|
27
27
|
/**
|
|
28
28
|
* Get the original plan at the given index back again.
|
|
29
29
|
*/
|
|
30
|
-
at<TIndex extends keyof TPlanTuple>(index: TIndex): TPlanTuple[TIndex];
|
|
31
|
-
first(): TPlanTuple[0]
|
|
32
|
-
last(): TPlanTuple[number]
|
|
30
|
+
at<TIndex extends keyof TPlanTuple & number>(index: TIndex): TPlanTuple[TIndex];
|
|
31
|
+
first(): TPlanTuple[0] | import("./__flag.js").__FlagStep<TPlanTuple[0]>;
|
|
32
|
+
last(): TPlanTuple[number] | import("./__flag.js").__FlagStep<TPlanTuple[number]>;
|
|
33
33
|
}
|
|
34
34
|
/**
|
|
35
35
|
* Takes a list of plans and turns it into a single plan that represents the
|
|
36
36
|
* list of their values.
|
|
37
37
|
*/
|
|
38
|
-
export declare function list<const TPlanTuple extends readonly
|
|
38
|
+
export declare function list<const TPlanTuple extends readonly Step[]>(list: TPlanTuple, cacheConfig?: ListStepCacheConfig): ListStep<TPlanTuple>;
|
|
39
39
|
export {};
|
|
40
40
|
//# sourceMappingURL=list.d.ts.map
|
package/dist/steps/list.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ListStep = void 0;
|
|
4
|
+
exports.list = list;
|
|
4
5
|
const step_js_1 = require("../step.js");
|
|
5
6
|
const constant_js_1 = require("./constant.js");
|
|
6
7
|
const DEFAULT_CACHE_SIZE = 100;
|
|
7
|
-
class ListStep extends step_js_1.
|
|
8
|
+
class ListStep extends step_js_1.UnbatchedStep {
|
|
8
9
|
static { this.$$export = {
|
|
9
10
|
moduleName: "grafast",
|
|
10
11
|
exportName: "ListStep",
|
|
@@ -114,5 +115,4 @@ exports.ListStep = ListStep;
|
|
|
114
115
|
function list(list, cacheConfig) {
|
|
115
116
|
return new ListStep(list, cacheConfig);
|
|
116
117
|
}
|
|
117
|
-
exports.list = list;
|
|
118
118
|
//# sourceMappingURL=list.js.map
|
|
@@ -2,19 +2,20 @@ import type { ConnectionCapableStep, ExecutionDetails } from "../index.js";
|
|
|
2
2
|
import type { GrafastResultsList } from "../interfaces.js";
|
|
3
3
|
import { $$deepDepSkip } from "../interfaces.js";
|
|
4
4
|
import type { ListCapableStep } from "../step.js";
|
|
5
|
-
import {
|
|
5
|
+
import { Step } from "../step.js";
|
|
6
6
|
import { __ItemStep } from "./__item.js";
|
|
7
|
+
import type { ItemsStep } from "./connection.js";
|
|
7
8
|
export type ListTransformReduce<TMemo, TItemPlanData> = (memo: TMemo, entireItemValue: unknown, itemPlanData: TItemPlanData) => TMemo;
|
|
8
|
-
export type ListTransformItemPlanCallback<TListStep extends
|
|
9
|
-
export interface ListTransformOptions<TListStep extends
|
|
9
|
+
export type ListTransformItemPlanCallback<TListStep extends Step<readonly any[]>, TDepsStep extends Step> = (listItemPlan: ItemsStep<TListStep> extends ListCapableStep<any, any> ? ReturnType<ItemsStep<TListStep>["listItem"]> : __ItemStep<any>) => TDepsStep;
|
|
10
|
+
export interface ListTransformOptions<TListStep extends Step<readonly any[]> | ConnectionCapableStep<Step<any>, any>, TDepsStep extends Step, TMemo, TItemStep extends Step | undefined = undefined> {
|
|
10
11
|
listStep: TListStep;
|
|
11
|
-
itemPlanCallback: ListTransformItemPlanCallback<TListStep
|
|
12
|
+
itemPlanCallback: ListTransformItemPlanCallback<ItemsStep<TListStep>, TDepsStep>;
|
|
12
13
|
initialState(): TMemo;
|
|
13
|
-
reduceCallback: ListTransformReduce<TMemo, TDepsStep extends
|
|
14
|
-
listItem?(itemPlan:
|
|
14
|
+
reduceCallback: ListTransformReduce<TMemo, TDepsStep extends Step<infer U> ? U : never>;
|
|
15
|
+
listItem?(itemPlan: Step): TItemStep;
|
|
15
16
|
finalizeCallback?(data: TMemo): TMemo;
|
|
16
17
|
meta?: string;
|
|
17
|
-
optimize?: (this: __ListTransformStep<TListStep, TDepsStep, TMemo, TItemStep>) =>
|
|
18
|
+
optimize?: (this: __ListTransformStep<TListStep, TDepsStep, TMemo, TItemStep>) => Step;
|
|
18
19
|
connectionClone?: ConnectionCapableStep<TListStep, any>["connectionClone"];
|
|
19
20
|
}
|
|
20
21
|
/**
|
|
@@ -26,16 +27,17 @@ export interface ListTransformOptions<TListStep extends ExecutableStep<readonly
|
|
|
26
27
|
* It's recommended that you don't use this directly, please use one of the
|
|
27
28
|
* functions that uses this under the hood such as `filter()`.
|
|
28
29
|
*/
|
|
29
|
-
export declare class __ListTransformStep<TListStep extends
|
|
30
|
+
export declare class __ListTransformStep<TListStep extends Step<readonly any[]> | ConnectionCapableStep<any, any> = Step<readonly any[]> | ConnectionCapableStep<any, any>, TDepsStep extends Step = Step, TMemo = any, TItemStep extends Step | undefined = Step | undefined> extends Step<TMemo> {
|
|
30
31
|
static $$export: {
|
|
31
32
|
moduleName: string;
|
|
32
33
|
exportName: string;
|
|
33
34
|
};
|
|
34
35
|
isSyncAndSafe: boolean;
|
|
35
36
|
private listStepDepId;
|
|
36
|
-
|
|
37
|
+
private rawListStepDepId;
|
|
38
|
+
itemPlanCallback: ListTransformItemPlanCallback<ItemsStep<TListStep>, TDepsStep>;
|
|
37
39
|
initialState: () => TMemo;
|
|
38
|
-
reduceCallback: ListTransformReduce<TMemo, TDepsStep extends
|
|
40
|
+
reduceCallback: ListTransformReduce<TMemo, TDepsStep extends Step<infer U> ? U : never>;
|
|
39
41
|
finalizeCallback?: (data: TMemo) => TMemo;
|
|
40
42
|
listItem?: (itemPlan: __ItemStep<this>) => TItemStep;
|
|
41
43
|
private meta;
|
|
@@ -48,7 +50,7 @@ export declare class __ListTransformStep<TListStep extends ExecutableStep<readon
|
|
|
48
50
|
[$$deepDepSkip](): TListStep;
|
|
49
51
|
dangerouslyGetListPlan(): TListStep;
|
|
50
52
|
deduplicate(peers: __ListTransformStep<any, any, any, any>[]): __ListTransformStep<TListStep, TDepsStep, TMemo, TItemStep>[];
|
|
51
|
-
optimize():
|
|
53
|
+
optimize(): Step;
|
|
52
54
|
execute({ indexForEach, indexMap, values, extra, }: ExecutionDetails<[any[] | null | undefined | Error]>): Promise<GrafastResultsList<TMemo>>;
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
@@ -59,5 +61,5 @@ export declare class __ListTransformStep<TListStep extends ExecutableStep<readon
|
|
|
59
61
|
*
|
|
60
62
|
* {@page ~grafast/steps/listTransform.md}
|
|
61
63
|
*/
|
|
62
|
-
export declare function listTransform<TListStep extends
|
|
64
|
+
export declare function listTransform<TListStep extends Step<readonly any[]> | ConnectionCapableStep<any, any>, TDepsStep extends Step, TMemo, TItemStep extends Step | undefined = undefined>(options: ListTransformOptions<TListStep, TDepsStep, TMemo, TItemStep>): __ListTransformStep<TListStep, TDepsStep, TMemo, TItemStep>;
|
|
63
65
|
//# sourceMappingURL=listTransform.d.ts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
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");
|
|
@@ -10,6 +11,7 @@ const withGlobalLayerPlan_js_1 = require("../engine/lib/withGlobalLayerPlan.js")
|
|
|
10
11
|
const interfaces_js_1 = require("../interfaces.js");
|
|
11
12
|
const step_js_1 = require("../step.js");
|
|
12
13
|
const __item_js_1 = require("./__item.js");
|
|
14
|
+
const connection_js_1 = require("./connection.js");
|
|
13
15
|
/**
|
|
14
16
|
* **Experimental.**
|
|
15
17
|
*
|
|
@@ -19,7 +21,7 @@ const __item_js_1 = require("./__item.js");
|
|
|
19
21
|
* It's recommended that you don't use this directly, please use one of the
|
|
20
22
|
* functions that uses this under the hood such as `filter()`.
|
|
21
23
|
*/
|
|
22
|
-
class __ListTransformStep extends step_js_1.
|
|
24
|
+
class __ListTransformStep extends step_js_1.Step {
|
|
23
25
|
static { this.$$export = {
|
|
24
26
|
moduleName: "grafast",
|
|
25
27
|
exportName: "__ListTransformStep",
|
|
@@ -28,8 +30,14 @@ class __ListTransformStep extends step_js_1.ExecutableStep {
|
|
|
28
30
|
super();
|
|
29
31
|
// OPTIMIZE: if all the steps in the inner bucket are synchronous then theoretically we can be synchronous too
|
|
30
32
|
this.isSyncAndSafe = false;
|
|
31
|
-
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);
|
|
32
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);
|
|
33
41
|
this.itemPlanCallback = itemPlanCallback;
|
|
34
42
|
this.initialState = initialState;
|
|
35
43
|
this.reduceCallback = reduceCallback;
|
|
@@ -69,13 +77,13 @@ class __ListTransformStep extends step_js_1.ExecutableStep {
|
|
|
69
77
|
return this.meta;
|
|
70
78
|
}
|
|
71
79
|
getListStep() {
|
|
72
|
-
return this.
|
|
80
|
+
return this.getDepOptions(this.rawListStepDepId).step;
|
|
73
81
|
}
|
|
74
82
|
[interfaces_js_1.$$deepDepSkip]() {
|
|
75
83
|
return this.getListStep();
|
|
76
84
|
}
|
|
77
85
|
dangerouslyGetListPlan() {
|
|
78
|
-
return this.dependencies[this.
|
|
86
|
+
return this.dependencies[this.rawListStepDepId];
|
|
79
87
|
}
|
|
80
88
|
deduplicate(peers) {
|
|
81
89
|
return peers.filter((peer) => peer.itemPlanCallback === this.itemPlanCallback &&
|
|
@@ -109,7 +117,7 @@ class __ListTransformStep extends step_js_1.ExecutableStep {
|
|
|
109
117
|
}
|
|
110
118
|
const listStepValue = values[this.listStepDepId];
|
|
111
119
|
if (itemStep._isUnary) {
|
|
112
|
-
const list = listStepValue.
|
|
120
|
+
const list = listStepValue.unaryValue();
|
|
113
121
|
store.set(itemStepId, (0, executeBucket_js_1.unaryExecutionValue)(Array.isArray(list) ? list[0] : list));
|
|
114
122
|
}
|
|
115
123
|
else {
|
|
@@ -205,5 +213,4 @@ exports.__ListTransformStep = __ListTransformStep;
|
|
|
205
213
|
function listTransform(options) {
|
|
206
214
|
return new __ListTransformStep(options);
|
|
207
215
|
}
|
|
208
|
-
exports.listTransform = listTransform;
|
|
209
216
|
//# sourceMappingURL=listTransform.js.map
|
package/dist/steps/listen.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type {
|
|
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,9 +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({ indexMap, values, }: StreamDetails<readonly [GrafastSubscriber<TTopics>, TTopic]>): 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]>;
|
|
30
28
|
}
|
|
31
29
|
/**
|
|
32
30
|
* Subscribes to the given `pubsubOrPlan` to get realtime updates on a given
|
|
@@ -35,5 +33,5 @@ export declare class ListenStep<TTopics extends {
|
|
|
35
33
|
*/
|
|
36
34
|
export declare function listen<TTopics extends {
|
|
37
35
|
[topic: string]: any;
|
|
38
|
-
}, 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>;
|
|
39
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,10 +27,10 @@ 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
|
-
|
|
30
|
+
execute({ indexMap, values, stream, }) {
|
|
31
|
+
if (!stream) {
|
|
32
|
+
throw new Error("ListenStep must be streamed, never merely executed");
|
|
33
|
+
}
|
|
33
34
|
const pubsubValue = values[this.pubsubDep];
|
|
34
35
|
const topicValue = values[this.topicDep];
|
|
35
36
|
return indexMap((i) => {
|
|
@@ -55,5 +56,4 @@ exports.ListenStep = ListenStep;
|
|
|
55
56
|
function listen(pubsubOrPlan, topicOrPlan, itemPlan) {
|
|
56
57
|
return new ListenStep(pubsubOrPlan, topicOrPlan, itemPlan);
|
|
57
58
|
}
|
|
58
|
-
exports.listen = listen;
|
|
59
59
|
//# sourceMappingURL=listen.js.map
|
package/dist/steps/load.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { __ItemStep, ExecutionDetails } from "../index.js";
|
|
2
2
|
import type { GrafastResultsList, Maybe, PromiseOrDirect } from "../interfaces.js";
|
|
3
3
|
import type { Multistep, UnwrapMultistep } from "../multistep.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Step } from "../step.js";
|
|
5
5
|
export interface LoadOptions<TItem, TParams extends Record<string, any>, TUnarySpec = never> {
|
|
6
6
|
unary: TUnarySpec;
|
|
7
7
|
attributes: ReadonlyArray<keyof TItem>;
|
|
@@ -26,7 +26,7 @@ export declare function loadManyCallback<TSpec, TItem, TParams extends Record<st
|
|
|
26
26
|
/**
|
|
27
27
|
* You shouldn't create instances of this yourself - use `loadOne` or `loadMany` instead.
|
|
28
28
|
*/
|
|
29
|
-
export declare class LoadedRecordStep<TItem, TParams extends Record<string, any> = 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,15 +37,15 @@ 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
43
|
private _getInner;
|
|
44
44
|
setParam<TParamKey extends keyof TParams>(paramKey: TParamKey, value: TParams[TParamKey]): void;
|
|
45
|
-
optimize():
|
|
45
|
+
optimize(): Step<any> | import("./__flag.js").__FlagStep<Step<any>>;
|
|
46
46
|
execute({ count, values: [values0], }: ExecutionDetails<[TItem]>): GrafastResultsList<TItem>;
|
|
47
47
|
}
|
|
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
|
|
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
49
|
private ioEquivalence;
|
|
50
50
|
private load;
|
|
51
51
|
static $$export: {
|
package/dist/steps/load.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
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");
|
|
5
9
|
const multistep_js_1 = require("../multistep.js");
|
|
6
10
|
const step_js_1 = require("../step.js");
|
|
@@ -13,7 +17,6 @@ const access_js_1 = require("./access.js");
|
|
|
13
17
|
function loadOneCallback(callback) {
|
|
14
18
|
return callback;
|
|
15
19
|
}
|
|
16
|
-
exports.loadOneCallback = loadOneCallback;
|
|
17
20
|
/**
|
|
18
21
|
* A TypeScript Identity Function to help you strongly type your
|
|
19
22
|
* LoadManyCallback.
|
|
@@ -21,13 +24,12 @@ exports.loadOneCallback = loadOneCallback;
|
|
|
21
24
|
function loadManyCallback(callback) {
|
|
22
25
|
return callback;
|
|
23
26
|
}
|
|
24
|
-
exports.loadManyCallback = loadManyCallback;
|
|
25
27
|
const idByLoad = new WeakMap();
|
|
26
28
|
let loadCounter = 0;
|
|
27
29
|
/**
|
|
28
30
|
* You shouldn't create instances of this yourself - use `loadOne` or `loadMany` instead.
|
|
29
31
|
*/
|
|
30
|
-
class LoadedRecordStep extends step_js_1.
|
|
32
|
+
class LoadedRecordStep extends step_js_1.Step {
|
|
31
33
|
static { this.$$export = {
|
|
32
34
|
moduleName: "grafast",
|
|
33
35
|
exportName: "LoadedRecordStep",
|
|
@@ -90,7 +92,7 @@ class LoadedRecordStep extends step_js_1.ExecutableStep {
|
|
|
90
92
|
}
|
|
91
93
|
}
|
|
92
94
|
exports.LoadedRecordStep = LoadedRecordStep;
|
|
93
|
-
class LoadStep extends step_js_1.
|
|
95
|
+
class LoadStep extends step_js_1.Step {
|
|
94
96
|
/* implements ListCapableStep<TItem, LoadedRecordStep<TItem, TParams>> */
|
|
95
97
|
static { this.$$export = { moduleName: "grafast", exportName: "LoadStep" }; }
|
|
96
98
|
constructor(spec, unarySpec, ioEquivalence, load) {
|
|
@@ -322,7 +324,6 @@ function loadMany(spec, loadCallbackOrIoEquivalenceOrUnarySpec, loadCallbackOrIo
|
|
|
322
324
|
return load(spec, null, null, loadCallbackOrIoEquivalenceOrUnarySpec);
|
|
323
325
|
}
|
|
324
326
|
}
|
|
325
|
-
exports.loadMany = loadMany;
|
|
326
327
|
function loadOne(spec, loadCallbackOrIoEquivalenceOrUnarySpec, loadCallbackOrIoEquivalence, loadCallbackOnly) {
|
|
327
328
|
if (loadCallbackOnly) {
|
|
328
329
|
return load(spec, loadCallbackOrIoEquivalenceOrUnarySpec, loadCallbackOrIoEquivalence, loadCallbackOnly).single();
|
|
@@ -339,5 +340,4 @@ function loadOne(spec, loadCallbackOrIoEquivalenceOrUnarySpec, loadCallbackOrIoE
|
|
|
339
340
|
return load(spec, null, null, loadCallbackOrIoEquivalenceOrUnarySpec).single();
|
|
340
341
|
}
|
|
341
342
|
}
|
|
342
|
-
exports.loadOne = loadOne;
|
|
343
343
|
//# sourceMappingURL=load.js.map
|
package/dist/steps/node.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import type { GraphQLObjectType } from "graphql";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
2
|
+
import type { Maybe, NodeIdHandler, PolymorphicData, UnbatchedExecutionExtra } from "../interfaces.js";
|
|
3
|
+
import type { PolymorphicStep, Step } from "../step.js";
|
|
4
|
+
import { UnbatchedStep } from "../step.js";
|
|
5
5
|
/**
|
|
6
6
|
* A plan to get a Node by its global object identifier (string). Accepts an
|
|
7
7
|
* object specifying the supported codecs, an object map detailing the
|
|
8
8
|
* typeNames supported and their details (codec to use, how to find the record,
|
|
9
9
|
* etc), and finally the Node id string plan.
|
|
10
10
|
*/
|
|
11
|
-
export declare class NodeStep extends
|
|
11
|
+
export declare class NodeStep extends UnbatchedStep implements PolymorphicStep {
|
|
12
12
|
private possibleTypes;
|
|
13
13
|
static $$export: {
|
|
14
14
|
moduleName: string;
|
|
@@ -19,8 +19,8 @@ export declare class NodeStep extends UnbatchedExecutableStep implements Polymor
|
|
|
19
19
|
private specPlanDep;
|
|
20
20
|
constructor(possibleTypes: {
|
|
21
21
|
[typeName: string]: NodeIdHandler;
|
|
22
|
-
}, $id:
|
|
23
|
-
planForType(type: GraphQLObjectType):
|
|
22
|
+
}, $id: Step<string | null | undefined>);
|
|
23
|
+
planForType(type: GraphQLObjectType): Step;
|
|
24
24
|
private getTypeNameFromSpecifier;
|
|
25
25
|
unbatchedExecute: (_extra: UnbatchedExecutionExtra, specifier: any) => PolymorphicData<string, ReadonlyArray<any>> | null;
|
|
26
26
|
}
|
|
@@ -32,10 +32,16 @@ export declare class NodeStep extends UnbatchedExecutableStep implements Polymor
|
|
|
32
32
|
*/
|
|
33
33
|
export declare function node(possibleTypes: {
|
|
34
34
|
[typeName: string]: NodeIdHandler;
|
|
35
|
-
}, $id:
|
|
36
|
-
export declare function specFromNodeId(handler: NodeIdHandler<any>, $id:
|
|
37
|
-
export declare function nodeIdFromNode(handler: NodeIdHandler<any>, $node:
|
|
38
|
-
export declare function
|
|
35
|
+
}, $id: Step<string | null | undefined>): NodeStep;
|
|
36
|
+
export declare function specFromNodeId(handler: NodeIdHandler<any>, $id: Step<Maybe<string>>): any;
|
|
37
|
+
export declare function nodeIdFromNode(handler: NodeIdHandler<any>, $node: Step): import("./lambda.js").LambdaStep<any, string | null>;
|
|
38
|
+
export declare function makeDecodeNodeIdRuntime(handlers: readonly NodeIdHandler[]): {
|
|
39
|
+
(raw: string | null | undefined): {
|
|
40
|
+
[codecName: string]: any;
|
|
41
|
+
} | null;
|
|
42
|
+
isSyncAndSafe: boolean;
|
|
43
|
+
};
|
|
44
|
+
export declare function makeDecodeNodeId(handlers: readonly NodeIdHandler[]): ($id: Step<string | null | undefined>) => import("./lambda.js").LambdaStep<string | null | undefined, {
|
|
39
45
|
[codecName: string]: any;
|
|
40
46
|
} | null>;
|
|
41
47
|
//# sourceMappingURL=node.d.ts.map
|