@player-ui/async-node-plugin 0.11.1 → 0.11.2--canary.649.23032
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.
|
@@ -1405,6 +1405,22 @@ var AsyncNodePlugin = function() {
|
|
|
1405
1405
|
}
|
|
1406
1406
|
});
|
|
1407
1407
|
};
|
|
1408
|
+
var unpackNode = function unpackNode(item) {
|
|
1409
|
+
var _item_children_, _item_children, _item_children_1, _item_children1;
|
|
1410
|
+
var unpacked = [];
|
|
1411
|
+
if ("children" in item && ((_item_children = item.children) === null || _item_children === void 0 ? void 0 : (_item_children_ = _item_children[0]) === null || _item_children_ === void 0 ? void 0 : _item_children_.value.type) === "asset" && ((_item_children1 = item.children) === null || _item_children1 === void 0 ? void 0 : (_item_children_1 = _item_children1[0]) === null || _item_children_1 === void 0 ? void 0 : _item_children_1.value).children) {
|
|
1412
|
+
var _item_children__value_children_, _item_children__value_children, _item_children_2, _item_children2;
|
|
1413
|
+
if (((_item_children__value_children = ((_item_children2 = item.children) === null || _item_children2 === void 0 ? void 0 : (_item_children_2 = _item_children2[0]) === null || _item_children_2 === void 0 ? void 0 : _item_children_2.value).children) === null || _item_children__value_children === void 0 ? void 0 : (_item_children__value_children_ = _item_children__value_children[0]) === null || _item_children__value_children_ === void 0 ? void 0 : _item_children__value_children_.value.type) === "multi-node") {
|
|
1414
|
+
var _item_children__value_children_1, _item_children__value_children1, _item_children_3, _item_children3;
|
|
1415
|
+
((_item_children__value_children1 = ((_item_children3 = item.children) === null || _item_children3 === void 0 ? void 0 : (_item_children_3 = _item_children3[0]) === null || _item_children_3 === void 0 ? void 0 : _item_children_3.value).children) === null || _item_children__value_children1 === void 0 ? void 0 : (_item_children__value_children_1 = _item_children__value_children1[0]) === null || _item_children__value_children_1 === void 0 ? void 0 : _item_children__value_children_1.value).values.forEach(function(value) {
|
|
1416
|
+
unpacked.push(value);
|
|
1417
|
+
});
|
|
1418
|
+
}
|
|
1419
|
+
} else {
|
|
1420
|
+
unpacked.push(item);
|
|
1421
|
+
}
|
|
1422
|
+
return unpacked;
|
|
1423
|
+
};
|
|
1408
1424
|
var hasSomethingToResolve = function hasSomethingToResolve(str) {
|
|
1409
1425
|
return bindingResolveLookup(str) || expressionResolveLookup(str);
|
|
1410
1426
|
};
|
|
@@ -3563,6 +3579,9 @@ var AsyncNodePlugin = function() {
|
|
|
3563
3579
|
},
|
|
3564
3580
|
setDataVal: function() {
|
|
3565
3581
|
return setDataVal;
|
|
3582
|
+
},
|
|
3583
|
+
waitFor: function() {
|
|
3584
|
+
return waitFor;
|
|
3566
3585
|
}
|
|
3567
3586
|
});
|
|
3568
3587
|
var setDataVal = function(_context, binding, value) {
|
|
@@ -3590,6 +3609,27 @@ var AsyncNodePlugin = function() {
|
|
|
3590
3609
|
return null;
|
|
3591
3610
|
};
|
|
3592
3611
|
conditional.resolveParams = false;
|
|
3612
|
+
var waitFor = function() {
|
|
3613
|
+
var _ref = _async_to_generator(function(ctx, promise) {
|
|
3614
|
+
return _ts_generator(this, function(_state) {
|
|
3615
|
+
switch(_state.label){
|
|
3616
|
+
case 0:
|
|
3617
|
+
return [
|
|
3618
|
+
4,
|
|
3619
|
+
promise
|
|
3620
|
+
];
|
|
3621
|
+
case 1:
|
|
3622
|
+
return [
|
|
3623
|
+
2,
|
|
3624
|
+
_state.sent()
|
|
3625
|
+
];
|
|
3626
|
+
}
|
|
3627
|
+
});
|
|
3628
|
+
});
|
|
3629
|
+
return function waitFor(ctx, promise) {
|
|
3630
|
+
return _ref.apply(this, arguments);
|
|
3631
|
+
};
|
|
3632
|
+
}();
|
|
3593
3633
|
var andandOperator = function(ctx, a, b) {
|
|
3594
3634
|
return ctx.evaluate(a) && ctx.evaluate(b);
|
|
3595
3635
|
};
|
|
@@ -3695,7 +3735,12 @@ var AsyncNodePlugin = function() {
|
|
|
3695
3735
|
this.operators = {
|
|
3696
3736
|
binary: new Map(Object.entries(DEFAULT_BINARY_OPERATORS)),
|
|
3697
3737
|
unary: new Map(Object.entries(DEFAULT_UNARY_OPERATORS)),
|
|
3698
|
-
expressions: new Map(Object.entries(evaluator_functions_exports))
|
|
3738
|
+
expressions: new Map(_to_consumable_array(Object.entries(evaluator_functions_exports)).concat([
|
|
3739
|
+
[
|
|
3740
|
+
"await",
|
|
3741
|
+
waitFor
|
|
3742
|
+
]
|
|
3743
|
+
]))
|
|
3699
3744
|
};
|
|
3700
3745
|
this.defaultHookOptions = _object_spread_props(_object_spread({}, defaultOptions), {
|
|
3701
3746
|
evaluate: function(expr) {
|
|
@@ -3705,7 +3750,12 @@ var AsyncNodePlugin = function() {
|
|
|
3705
3750
|
return _this._execAST(node, _this.defaultHookOptions);
|
|
3706
3751
|
}
|
|
3707
3752
|
});
|
|
3708
|
-
this.hooks.resolve.tap("ExpressionEvaluator",
|
|
3753
|
+
this.hooks.resolve.tap("ExpressionEvaluator", function(result, node, options) {
|
|
3754
|
+
if (options.async) {
|
|
3755
|
+
return _this._resolveNodeAsync(result, node, options);
|
|
3756
|
+
}
|
|
3757
|
+
return _this._resolveNode(result, node, options);
|
|
3758
|
+
});
|
|
3709
3759
|
this.evaluate = this.evaluate.bind(this);
|
|
3710
3760
|
}
|
|
3711
3761
|
_create_class(ExpressionEvaluator, [
|
|
@@ -3743,6 +3793,14 @@ var AsyncNodePlugin = function() {
|
|
|
3743
3793
|
return this._execString(String(expression), resolvedOpts);
|
|
3744
3794
|
}
|
|
3745
3795
|
},
|
|
3796
|
+
{
|
|
3797
|
+
key: "evaluateAsync",
|
|
3798
|
+
value: function evaluateAsync(expr, options) {
|
|
3799
|
+
return this.evaluate(expr, _object_spread_props(_object_spread({}, options), {
|
|
3800
|
+
async: true
|
|
3801
|
+
}));
|
|
3802
|
+
}
|
|
3803
|
+
},
|
|
3746
3804
|
{
|
|
3747
3805
|
key: "addExpressionFunction",
|
|
3748
3806
|
value: function addExpressionFunction(name, handler) {
|
|
@@ -3788,8 +3846,10 @@ var AsyncNodePlugin = function() {
|
|
|
3788
3846
|
var matches = exp.match(/^@\[(.*)\]@$/);
|
|
3789
3847
|
var matchedExp = exp;
|
|
3790
3848
|
if (matches) {
|
|
3791
|
-
var
|
|
3792
|
-
|
|
3849
|
+
var _Array_from = _sliced_to_array(Array.from(matches), 2), matched = _Array_from[1];
|
|
3850
|
+
if (matched) {
|
|
3851
|
+
matchedExp = matched;
|
|
3852
|
+
}
|
|
3793
3853
|
}
|
|
3794
3854
|
var storedAST;
|
|
3795
3855
|
try {
|
|
@@ -3950,6 +4010,452 @@ var AsyncNodePlugin = function() {
|
|
|
3950
4010
|
return resolveNode(node.left);
|
|
3951
4011
|
}
|
|
3952
4012
|
}
|
|
4013
|
+
},
|
|
4014
|
+
{
|
|
4015
|
+
key: "_resolveNodeAsync",
|
|
4016
|
+
value: function _resolveNodeAsync(_currentValue, node, options) {
|
|
4017
|
+
var _this = this;
|
|
4018
|
+
return _async_to_generator(function() {
|
|
4019
|
+
var resolveNode, model, expressionContext, operator, _tmp, _tmp1, operator1, _tmp2, _tmp3, attributes, resolvedAttributes, expressionName, operator2, args, obj, prop, value, value1, result, operation, newValue, _tmp4, _tmp5;
|
|
4020
|
+
return _ts_generator(this, function(_state) {
|
|
4021
|
+
switch(_state.label){
|
|
4022
|
+
case 0:
|
|
4023
|
+
resolveNode = options.resolveNode, model = options.model;
|
|
4024
|
+
expressionContext = _object_spread_props(_object_spread({}, options), {
|
|
4025
|
+
evaluate: function(expr) {
|
|
4026
|
+
return _this.evaluate(expr, options);
|
|
4027
|
+
}
|
|
4028
|
+
});
|
|
4029
|
+
if (!(node.type === "BinaryExpression" || node.type === "LogicalExpression")) return [
|
|
4030
|
+
3,
|
|
4031
|
+
7
|
|
4032
|
+
];
|
|
4033
|
+
operator = _this.operators.binary.get(node.operator);
|
|
4034
|
+
if (!operator) return [
|
|
4035
|
+
3,
|
|
4036
|
+
6
|
|
4037
|
+
];
|
|
4038
|
+
if (!("resolveParams" in operator)) return [
|
|
4039
|
+
3,
|
|
4040
|
+
3
|
|
4041
|
+
];
|
|
4042
|
+
if (operator.resolveParams === false) {
|
|
4043
|
+
return [
|
|
4044
|
+
2,
|
|
4045
|
+
operator(expressionContext, node.left, node.right)
|
|
4046
|
+
];
|
|
4047
|
+
}
|
|
4048
|
+
_tmp = [
|
|
4049
|
+
expressionContext
|
|
4050
|
+
];
|
|
4051
|
+
return [
|
|
4052
|
+
4,
|
|
4053
|
+
resolveNode(node.left)
|
|
4054
|
+
];
|
|
4055
|
+
case 1:
|
|
4056
|
+
_tmp = _tmp.concat([
|
|
4057
|
+
_state.sent()
|
|
4058
|
+
]);
|
|
4059
|
+
return [
|
|
4060
|
+
4,
|
|
4061
|
+
resolveNode(node.right)
|
|
4062
|
+
];
|
|
4063
|
+
case 2:
|
|
4064
|
+
return [
|
|
4065
|
+
2,
|
|
4066
|
+
operator.apply(void 0, _tmp.concat([
|
|
4067
|
+
_state.sent()
|
|
4068
|
+
]))
|
|
4069
|
+
];
|
|
4070
|
+
case 3:
|
|
4071
|
+
return [
|
|
4072
|
+
4,
|
|
4073
|
+
resolveNode(node.left)
|
|
4074
|
+
];
|
|
4075
|
+
case 4:
|
|
4076
|
+
_tmp1 = [
|
|
4077
|
+
_state.sent()
|
|
4078
|
+
];
|
|
4079
|
+
return [
|
|
4080
|
+
4,
|
|
4081
|
+
resolveNode(node.right)
|
|
4082
|
+
];
|
|
4083
|
+
case 5:
|
|
4084
|
+
return [
|
|
4085
|
+
2,
|
|
4086
|
+
operator.apply(void 0, _tmp1.concat([
|
|
4087
|
+
_state.sent()
|
|
4088
|
+
]))
|
|
4089
|
+
];
|
|
4090
|
+
case 6:
|
|
4091
|
+
return [
|
|
4092
|
+
2
|
|
4093
|
+
];
|
|
4094
|
+
case 7:
|
|
4095
|
+
if (!(node.type === "UnaryExpression")) return [
|
|
4096
|
+
3,
|
|
4097
|
+
14
|
|
4098
|
+
];
|
|
4099
|
+
operator1 = _this.operators.unary.get(node.operator);
|
|
4100
|
+
if (!operator1) return [
|
|
4101
|
+
3,
|
|
4102
|
+
13
|
|
4103
|
+
];
|
|
4104
|
+
if (!("resolveParams" in operator1)) return [
|
|
4105
|
+
3,
|
|
4106
|
+
11
|
|
4107
|
+
];
|
|
4108
|
+
_tmp2 = [
|
|
4109
|
+
expressionContext
|
|
4110
|
+
];
|
|
4111
|
+
if (!(operator1.resolveParams === false)) return [
|
|
4112
|
+
3,
|
|
4113
|
+
8
|
|
4114
|
+
];
|
|
4115
|
+
_tmp3 = node.argument;
|
|
4116
|
+
return [
|
|
4117
|
+
3,
|
|
4118
|
+
10
|
|
4119
|
+
];
|
|
4120
|
+
case 8:
|
|
4121
|
+
return [
|
|
4122
|
+
4,
|
|
4123
|
+
resolveNode(node.argument)
|
|
4124
|
+
];
|
|
4125
|
+
case 9:
|
|
4126
|
+
_tmp3 = _state.sent();
|
|
4127
|
+
_state.label = 10;
|
|
4128
|
+
case 10:
|
|
4129
|
+
return [
|
|
4130
|
+
2,
|
|
4131
|
+
operator1.apply(void 0, _tmp2.concat([
|
|
4132
|
+
_tmp3
|
|
4133
|
+
]))
|
|
4134
|
+
];
|
|
4135
|
+
case 11:
|
|
4136
|
+
return [
|
|
4137
|
+
4,
|
|
4138
|
+
resolveNode(node.argument)
|
|
4139
|
+
];
|
|
4140
|
+
case 12:
|
|
4141
|
+
return [
|
|
4142
|
+
2,
|
|
4143
|
+
operator1.apply(void 0, [
|
|
4144
|
+
_state.sent()
|
|
4145
|
+
])
|
|
4146
|
+
];
|
|
4147
|
+
case 13:
|
|
4148
|
+
return [
|
|
4149
|
+
2
|
|
4150
|
+
];
|
|
4151
|
+
case 14:
|
|
4152
|
+
if (!(node.type === "Object")) return [
|
|
4153
|
+
3,
|
|
4154
|
+
16
|
|
4155
|
+
];
|
|
4156
|
+
attributes = node.attributes;
|
|
4157
|
+
resolvedAttributes = {};
|
|
4158
|
+
return [
|
|
4159
|
+
4,
|
|
4160
|
+
Promise.all(attributes.map(function() {
|
|
4161
|
+
var _ref = _async_to_generator(function(attr) {
|
|
4162
|
+
var key, value;
|
|
4163
|
+
return _ts_generator(this, function(_state) {
|
|
4164
|
+
switch(_state.label){
|
|
4165
|
+
case 0:
|
|
4166
|
+
return [
|
|
4167
|
+
4,
|
|
4168
|
+
resolveNode(attr.key)
|
|
4169
|
+
];
|
|
4170
|
+
case 1:
|
|
4171
|
+
key = _state.sent();
|
|
4172
|
+
return [
|
|
4173
|
+
4,
|
|
4174
|
+
resolveNode(attr.value)
|
|
4175
|
+
];
|
|
4176
|
+
case 2:
|
|
4177
|
+
value = _state.sent();
|
|
4178
|
+
resolvedAttributes[key] = value;
|
|
4179
|
+
return [
|
|
4180
|
+
2
|
|
4181
|
+
];
|
|
4182
|
+
}
|
|
4183
|
+
});
|
|
4184
|
+
});
|
|
4185
|
+
return function(attr) {
|
|
4186
|
+
return _ref.apply(this, arguments);
|
|
4187
|
+
};
|
|
4188
|
+
}()))
|
|
4189
|
+
];
|
|
4190
|
+
case 15:
|
|
4191
|
+
_state.sent();
|
|
4192
|
+
return [
|
|
4193
|
+
2,
|
|
4194
|
+
resolvedAttributes
|
|
4195
|
+
];
|
|
4196
|
+
case 16:
|
|
4197
|
+
if (!(node.type === "CallExpression")) return [
|
|
4198
|
+
3,
|
|
4199
|
+
18
|
|
4200
|
+
];
|
|
4201
|
+
expressionName = node.callTarget.name;
|
|
4202
|
+
operator2 = _this.operators.expressions.get(expressionName);
|
|
4203
|
+
if (!operator2) {
|
|
4204
|
+
throw new Error("Unknown expression function: ".concat(expressionName));
|
|
4205
|
+
}
|
|
4206
|
+
if ("resolveParams" in operator2 && operator2.resolveParams === false) {
|
|
4207
|
+
return [
|
|
4208
|
+
2,
|
|
4209
|
+
operator2.apply(void 0, [
|
|
4210
|
+
expressionContext
|
|
4211
|
+
].concat(_to_consumable_array(node.args)))
|
|
4212
|
+
];
|
|
4213
|
+
}
|
|
4214
|
+
return [
|
|
4215
|
+
4,
|
|
4216
|
+
Promise.all(node.args.map(function() {
|
|
4217
|
+
var _ref = _async_to_generator(function(n) {
|
|
4218
|
+
return _ts_generator(this, function(_state) {
|
|
4219
|
+
switch(_state.label){
|
|
4220
|
+
case 0:
|
|
4221
|
+
return [
|
|
4222
|
+
4,
|
|
4223
|
+
resolveNode(n)
|
|
4224
|
+
];
|
|
4225
|
+
case 1:
|
|
4226
|
+
return [
|
|
4227
|
+
2,
|
|
4228
|
+
_state.sent()
|
|
4229
|
+
];
|
|
4230
|
+
}
|
|
4231
|
+
});
|
|
4232
|
+
});
|
|
4233
|
+
return function(n) {
|
|
4234
|
+
return _ref.apply(this, arguments);
|
|
4235
|
+
};
|
|
4236
|
+
}()))
|
|
4237
|
+
];
|
|
4238
|
+
case 17:
|
|
4239
|
+
args = _state.sent();
|
|
4240
|
+
return [
|
|
4241
|
+
2,
|
|
4242
|
+
operator2.apply(void 0, [
|
|
4243
|
+
expressionContext
|
|
4244
|
+
].concat(_to_consumable_array(args)))
|
|
4245
|
+
];
|
|
4246
|
+
case 18:
|
|
4247
|
+
if (node.type === "ModelRef") {
|
|
4248
|
+
return [
|
|
4249
|
+
2,
|
|
4250
|
+
model.get(node.ref, {
|
|
4251
|
+
context: {
|
|
4252
|
+
model: options.model
|
|
4253
|
+
}
|
|
4254
|
+
})
|
|
4255
|
+
];
|
|
4256
|
+
}
|
|
4257
|
+
if (!(node.type === "MemberExpression")) return [
|
|
4258
|
+
3,
|
|
4259
|
+
21
|
|
4260
|
+
];
|
|
4261
|
+
return [
|
|
4262
|
+
4,
|
|
4263
|
+
resolveNode(node.object)
|
|
4264
|
+
];
|
|
4265
|
+
case 19:
|
|
4266
|
+
obj = _state.sent();
|
|
4267
|
+
return [
|
|
4268
|
+
4,
|
|
4269
|
+
resolveNode(node.property)
|
|
4270
|
+
];
|
|
4271
|
+
case 20:
|
|
4272
|
+
prop = _state.sent();
|
|
4273
|
+
return [
|
|
4274
|
+
2,
|
|
4275
|
+
obj[prop]
|
|
4276
|
+
];
|
|
4277
|
+
case 21:
|
|
4278
|
+
if (!(node.type === "Assignment")) return [
|
|
4279
|
+
3,
|
|
4280
|
+
26
|
|
4281
|
+
];
|
|
4282
|
+
if (!(node.left.type === "ModelRef")) return [
|
|
4283
|
+
3,
|
|
4284
|
+
23
|
|
4285
|
+
];
|
|
4286
|
+
return [
|
|
4287
|
+
4,
|
|
4288
|
+
resolveNode(node.right)
|
|
4289
|
+
];
|
|
4290
|
+
case 22:
|
|
4291
|
+
value = _state.sent();
|
|
4292
|
+
model.set([
|
|
4293
|
+
[
|
|
4294
|
+
node.left.ref,
|
|
4295
|
+
value
|
|
4296
|
+
]
|
|
4297
|
+
]);
|
|
4298
|
+
return [
|
|
4299
|
+
2,
|
|
4300
|
+
value
|
|
4301
|
+
];
|
|
4302
|
+
case 23:
|
|
4303
|
+
if (!(node.left.type === "Identifier")) return [
|
|
4304
|
+
3,
|
|
4305
|
+
25
|
|
4306
|
+
];
|
|
4307
|
+
return [
|
|
4308
|
+
4,
|
|
4309
|
+
resolveNode(node.right)
|
|
4310
|
+
];
|
|
4311
|
+
case 24:
|
|
4312
|
+
value1 = _state.sent();
|
|
4313
|
+
_this.vars[node.left.name] = value1;
|
|
4314
|
+
return [
|
|
4315
|
+
2,
|
|
4316
|
+
value1
|
|
4317
|
+
];
|
|
4318
|
+
case 25:
|
|
4319
|
+
return [
|
|
4320
|
+
2
|
|
4321
|
+
];
|
|
4322
|
+
case 26:
|
|
4323
|
+
if (!(node.type === "ConditionalExpression")) return [
|
|
4324
|
+
3,
|
|
4325
|
+
28
|
|
4326
|
+
];
|
|
4327
|
+
return [
|
|
4328
|
+
4,
|
|
4329
|
+
resolveNode(node.test)
|
|
4330
|
+
];
|
|
4331
|
+
case 27:
|
|
4332
|
+
result = _state.sent() ? node.consequent : node.alternate;
|
|
4333
|
+
return [
|
|
4334
|
+
2,
|
|
4335
|
+
resolveNode(result)
|
|
4336
|
+
];
|
|
4337
|
+
case 28:
|
|
4338
|
+
if (node.type === "ArrayExpression") {
|
|
4339
|
+
return [
|
|
4340
|
+
2,
|
|
4341
|
+
Promise.all(node.elements.map(function() {
|
|
4342
|
+
var _ref = _async_to_generator(function(ele) {
|
|
4343
|
+
return _ts_generator(this, function(_state) {
|
|
4344
|
+
switch(_state.label){
|
|
4345
|
+
case 0:
|
|
4346
|
+
return [
|
|
4347
|
+
4,
|
|
4348
|
+
resolveNode(ele)
|
|
4349
|
+
];
|
|
4350
|
+
case 1:
|
|
4351
|
+
return [
|
|
4352
|
+
2,
|
|
4353
|
+
_state.sent()
|
|
4354
|
+
];
|
|
4355
|
+
}
|
|
4356
|
+
});
|
|
4357
|
+
});
|
|
4358
|
+
return function(ele) {
|
|
4359
|
+
return _ref.apply(this, arguments);
|
|
4360
|
+
};
|
|
4361
|
+
}()))
|
|
4362
|
+
];
|
|
4363
|
+
}
|
|
4364
|
+
if (!(node.type === "Modification")) return [
|
|
4365
|
+
3,
|
|
4366
|
+
38
|
|
4367
|
+
];
|
|
4368
|
+
operation = _this.operators.binary.get(node.operator);
|
|
4369
|
+
if (!operation) return [
|
|
4370
|
+
3,
|
|
4371
|
+
37
|
|
4372
|
+
];
|
|
4373
|
+
if (!("resolveParams" in operation)) return [
|
|
4374
|
+
3,
|
|
4375
|
+
33
|
|
4376
|
+
];
|
|
4377
|
+
if (!(operation.resolveParams === false)) return [
|
|
4378
|
+
3,
|
|
4379
|
+
29
|
|
4380
|
+
];
|
|
4381
|
+
newValue = operation(expressionContext, node.left, node.right);
|
|
4382
|
+
return [
|
|
4383
|
+
3,
|
|
4384
|
+
32
|
|
4385
|
+
];
|
|
4386
|
+
case 29:
|
|
4387
|
+
_tmp4 = [
|
|
4388
|
+
expressionContext
|
|
4389
|
+
];
|
|
4390
|
+
return [
|
|
4391
|
+
4,
|
|
4392
|
+
resolveNode(node.left)
|
|
4393
|
+
];
|
|
4394
|
+
case 30:
|
|
4395
|
+
_tmp4 = _tmp4.concat([
|
|
4396
|
+
_state.sent()
|
|
4397
|
+
]);
|
|
4398
|
+
return [
|
|
4399
|
+
4,
|
|
4400
|
+
resolveNode(node.right)
|
|
4401
|
+
];
|
|
4402
|
+
case 31:
|
|
4403
|
+
newValue = operation.apply(void 0, _tmp4.concat([
|
|
4404
|
+
_state.sent()
|
|
4405
|
+
]));
|
|
4406
|
+
_state.label = 32;
|
|
4407
|
+
case 32:
|
|
4408
|
+
return [
|
|
4409
|
+
3,
|
|
4410
|
+
36
|
|
4411
|
+
];
|
|
4412
|
+
case 33:
|
|
4413
|
+
return [
|
|
4414
|
+
4,
|
|
4415
|
+
resolveNode(node.left)
|
|
4416
|
+
];
|
|
4417
|
+
case 34:
|
|
4418
|
+
_tmp5 = [
|
|
4419
|
+
_state.sent()
|
|
4420
|
+
];
|
|
4421
|
+
return [
|
|
4422
|
+
4,
|
|
4423
|
+
resolveNode(node.right)
|
|
4424
|
+
];
|
|
4425
|
+
case 35:
|
|
4426
|
+
newValue = operation.apply(void 0, _tmp5.concat([
|
|
4427
|
+
_state.sent()
|
|
4428
|
+
]));
|
|
4429
|
+
_state.label = 36;
|
|
4430
|
+
case 36:
|
|
4431
|
+
if (node.left.type === "ModelRef") {
|
|
4432
|
+
model.set([
|
|
4433
|
+
[
|
|
4434
|
+
node.left.ref,
|
|
4435
|
+
newValue
|
|
4436
|
+
]
|
|
4437
|
+
]);
|
|
4438
|
+
} else if (node.left.type === "Identifier") {
|
|
4439
|
+
_this.vars[node.left.name] = newValue;
|
|
4440
|
+
}
|
|
4441
|
+
return [
|
|
4442
|
+
2,
|
|
4443
|
+
newValue
|
|
4444
|
+
];
|
|
4445
|
+
case 37:
|
|
4446
|
+
return [
|
|
4447
|
+
2,
|
|
4448
|
+
resolveNode(node.left)
|
|
4449
|
+
];
|
|
4450
|
+
case 38:
|
|
4451
|
+
return [
|
|
4452
|
+
2,
|
|
4453
|
+
_this._resolveNode(_currentValue, node, options)
|
|
4454
|
+
];
|
|
4455
|
+
}
|
|
4456
|
+
});
|
|
4457
|
+
})();
|
|
4458
|
+
}
|
|
3953
4459
|
}
|
|
3954
4460
|
]);
|
|
3955
4461
|
return ExpressionEvaluator;
|
|
@@ -4475,15 +4981,6 @@ var AsyncNodePlugin = function() {
|
|
|
4475
4981
|
]);
|
|
4476
4982
|
return Parser;
|
|
4477
4983
|
}();
|
|
4478
|
-
function unpackAndPush(item, initial) {
|
|
4479
|
-
if (item.asset.values && Array.isArray(item.asset.values)) {
|
|
4480
|
-
item.asset.values.forEach(function(i) {
|
|
4481
|
-
unpackAndPush(i, initial);
|
|
4482
|
-
});
|
|
4483
|
-
} else {
|
|
4484
|
-
initial.push(item);
|
|
4485
|
-
}
|
|
4486
|
-
}
|
|
4487
4984
|
var withContext = function(model) {
|
|
4488
4985
|
return {
|
|
4489
4986
|
get: function(binding, options) {
|
|
@@ -4606,7 +5103,7 @@ var AsyncNodePlugin = function() {
|
|
|
4606
5103
|
key: "computeTree",
|
|
4607
5104
|
value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
|
|
4608
5105
|
var _this = this;
|
|
4609
|
-
var _partiallyResolvedParent_parent;
|
|
5106
|
+
var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
|
|
4610
5107
|
var dependencyModel = new DependencyModel(options.data.model);
|
|
4611
5108
|
dependencyModel.trackSubset("core");
|
|
4612
5109
|
var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
|
|
@@ -4632,7 +5129,8 @@ var AsyncNodePlugin = function() {
|
|
|
4632
5129
|
var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
|
|
4633
5130
|
type: "empty"
|
|
4634
5131
|
};
|
|
4635
|
-
var
|
|
5132
|
+
var isNestedMultiNodeWithAsync = resolvedAST.type === "multi-node" && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent === void 0 ? void 0 : (_partiallyResolvedParent_parent_parent = _partiallyResolvedParent_parent.parent) === null || _partiallyResolvedParent_parent_parent === void 0 ? void 0 : _partiallyResolvedParent_parent_parent.type) === "multi-node" && partiallyResolvedParent.parent.type === "value" && ((_resolvedAST_parent = resolvedAST.parent) === null || _resolvedAST_parent === void 0 ? void 0 : _resolvedAST_parent.type) === "asset" && resolvedAST.parent.value.id.includes("async");
|
|
5133
|
+
var isNestedMultiNode = resolvedAST.type === "multi-node" && (partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : (_partiallyResolvedParent_parent1 = partiallyResolvedParent.parent) === null || _partiallyResolvedParent_parent1 === void 0 ? void 0 : _partiallyResolvedParent_parent1.type) === "multi-node" && partiallyResolvedParent.type === "value";
|
|
4636
5134
|
if (previousResult && shouldUseLastValue) {
|
|
4637
5135
|
var update2 = _object_spread_props(_object_spread({}, previousResult), {
|
|
4638
5136
|
updated: false
|
|
@@ -4666,7 +5164,11 @@ var AsyncNodePlugin = function() {
|
|
|
4666
5164
|
repopulateASTMapFromCache(previousResult, node, rawParent);
|
|
4667
5165
|
return update2;
|
|
4668
5166
|
}
|
|
4669
|
-
|
|
5167
|
+
if (isNestedMultiNodeWithAsync) {
|
|
5168
|
+
resolvedAST.parent = partiallyResolvedParent.parent;
|
|
5169
|
+
} else {
|
|
5170
|
+
resolvedAST.parent = partiallyResolvedParent;
|
|
5171
|
+
}
|
|
4670
5172
|
resolveOptions.node = resolvedAST;
|
|
4671
5173
|
this.ASTMap.set(resolvedAST, node);
|
|
4672
5174
|
var resolved = this.hooks.resolve.call(void 0, resolvedAST, resolveOptions);
|
|
@@ -4701,6 +5203,11 @@ var AsyncNodePlugin = function() {
|
|
|
4701
5203
|
} else if (resolvedAST.type === "multi-node") {
|
|
4702
5204
|
var childValue = [];
|
|
4703
5205
|
var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
|
|
5206
|
+
var hasAsync = resolvedAST.values.map(function(value, index) {
|
|
5207
|
+
return value.type === "async" ? index : -1;
|
|
5208
|
+
}).filter(function(index) {
|
|
5209
|
+
return index !== -1;
|
|
5210
|
+
});
|
|
4704
5211
|
var newValues = resolvedAST.values.map(function(mValue) {
|
|
4705
5212
|
var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
|
|
4706
5213
|
if (mTree.value !== void 0 && mTree.value !== null) {
|
|
@@ -4716,7 +5223,19 @@ var AsyncNodePlugin = function() {
|
|
|
4716
5223
|
updated = updated || mTree.updated;
|
|
4717
5224
|
return mTree.node;
|
|
4718
5225
|
});
|
|
4719
|
-
|
|
5226
|
+
if (hasAsync.length > 0) {
|
|
5227
|
+
var copy = newValues;
|
|
5228
|
+
hasAsync.forEach(function(index) {
|
|
5229
|
+
var _copy;
|
|
5230
|
+
if (copy[index]) (_copy = copy).splice.apply(_copy, [
|
|
5231
|
+
index,
|
|
5232
|
+
1
|
|
5233
|
+
].concat(_to_consumable_array(unpackNode(copy[index]))));
|
|
5234
|
+
});
|
|
5235
|
+
resolvedAST.values = copy;
|
|
5236
|
+
} else {
|
|
5237
|
+
resolvedAST.values = newValues;
|
|
5238
|
+
}
|
|
4720
5239
|
resolved = childValue;
|
|
4721
5240
|
}
|
|
4722
5241
|
childDependencies.forEach(function(bindingDep) {
|
|
@@ -4745,6 +5264,15 @@ var AsyncNodePlugin = function() {
|
|
|
4745
5264
|
]);
|
|
4746
5265
|
return Resolver;
|
|
4747
5266
|
}();
|
|
5267
|
+
function unpackAndPush(item, initial) {
|
|
5268
|
+
if (item.asset.values && Array.isArray(item.asset.values)) {
|
|
5269
|
+
item.asset.values.forEach(function(i) {
|
|
5270
|
+
unpackAndPush(i, initial);
|
|
5271
|
+
});
|
|
5272
|
+
} else {
|
|
5273
|
+
initial.push(item);
|
|
5274
|
+
}
|
|
5275
|
+
}
|
|
4748
5276
|
var CrossfieldProvider = /*#__PURE__*/ function() {
|
|
4749
5277
|
function CrossfieldProvider(initialView, parser, logger) {
|
|
4750
5278
|
_class_call_check(this, CrossfieldProvider);
|
|
@@ -7492,15 +8020,56 @@ var AsyncNodePlugin = function() {
|
|
|
7492
8020
|
validationController.reset();
|
|
7493
8021
|
}
|
|
7494
8022
|
});
|
|
7495
|
-
flow.hooks.afterTransition.tap("player", function(
|
|
7496
|
-
var
|
|
7497
|
-
|
|
7498
|
-
|
|
7499
|
-
|
|
7500
|
-
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
|
|
8023
|
+
flow.hooks.afterTransition.tap("player", function() {
|
|
8024
|
+
var _ref = _async_to_generator(function(flowInstance) {
|
|
8025
|
+
var _flowInstance_currentState, value, exp, result, e;
|
|
8026
|
+
return _ts_generator(this, function(_state) {
|
|
8027
|
+
switch(_state.label){
|
|
8028
|
+
case 0:
|
|
8029
|
+
value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
|
|
8030
|
+
if (!(value && value.state_type === "ACTION")) return [
|
|
8031
|
+
3,
|
|
8032
|
+
4
|
|
8033
|
+
];
|
|
8034
|
+
exp = value.exp;
|
|
8035
|
+
_state.label = 1;
|
|
8036
|
+
case 1:
|
|
8037
|
+
_state.trys.push([
|
|
8038
|
+
1,
|
|
8039
|
+
3,
|
|
8040
|
+
,
|
|
8041
|
+
4
|
|
8042
|
+
]);
|
|
8043
|
+
return [
|
|
8044
|
+
4,
|
|
8045
|
+
expressionEvaluator.evaluateAsync(exp)
|
|
8046
|
+
];
|
|
8047
|
+
case 2:
|
|
8048
|
+
result = _state.sent();
|
|
8049
|
+
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
|
|
8050
|
+
return [
|
|
8051
|
+
3,
|
|
8052
|
+
4
|
|
8053
|
+
];
|
|
8054
|
+
case 3:
|
|
8055
|
+
e = _state.sent();
|
|
8056
|
+
flowResultDeferred.reject(e);
|
|
8057
|
+
return [
|
|
8058
|
+
3,
|
|
8059
|
+
4
|
|
8060
|
+
];
|
|
8061
|
+
case 4:
|
|
8062
|
+
expressionEvaluator.reset();
|
|
8063
|
+
return [
|
|
8064
|
+
2
|
|
8065
|
+
];
|
|
8066
|
+
}
|
|
8067
|
+
});
|
|
8068
|
+
});
|
|
8069
|
+
return function(flowInstance) {
|
|
8070
|
+
return _ref.apply(this, arguments);
|
|
8071
|
+
};
|
|
8072
|
+
}());
|
|
7504
8073
|
});
|
|
7505
8074
|
this.hooks.dataController.call(dataController);
|
|
7506
8075
|
validationController.setOptions({
|