@player-ui/beacon-plugin 0.11.1-next.0 → 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 BeaconPlugin = 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
|
};
|
|
@@ -3580,6 +3596,9 @@ var BeaconPlugin = function() {
|
|
|
3580
3596
|
},
|
|
3581
3597
|
setDataVal: function() {
|
|
3582
3598
|
return setDataVal;
|
|
3599
|
+
},
|
|
3600
|
+
waitFor: function() {
|
|
3601
|
+
return waitFor;
|
|
3583
3602
|
}
|
|
3584
3603
|
});
|
|
3585
3604
|
var setDataVal = function(_context, binding, value) {
|
|
@@ -3607,6 +3626,27 @@ var BeaconPlugin = function() {
|
|
|
3607
3626
|
return null;
|
|
3608
3627
|
};
|
|
3609
3628
|
conditional.resolveParams = false;
|
|
3629
|
+
var waitFor = function() {
|
|
3630
|
+
var _ref = _async_to_generator(function(ctx, promise) {
|
|
3631
|
+
return _ts_generator(this, function(_state) {
|
|
3632
|
+
switch(_state.label){
|
|
3633
|
+
case 0:
|
|
3634
|
+
return [
|
|
3635
|
+
4,
|
|
3636
|
+
promise
|
|
3637
|
+
];
|
|
3638
|
+
case 1:
|
|
3639
|
+
return [
|
|
3640
|
+
2,
|
|
3641
|
+
_state.sent()
|
|
3642
|
+
];
|
|
3643
|
+
}
|
|
3644
|
+
});
|
|
3645
|
+
});
|
|
3646
|
+
return function waitFor(ctx, promise) {
|
|
3647
|
+
return _ref.apply(this, arguments);
|
|
3648
|
+
};
|
|
3649
|
+
}();
|
|
3610
3650
|
var andandOperator = function(ctx, a, b) {
|
|
3611
3651
|
return ctx.evaluate(a) && ctx.evaluate(b);
|
|
3612
3652
|
};
|
|
@@ -3712,7 +3752,12 @@ var BeaconPlugin = function() {
|
|
|
3712
3752
|
this.operators = {
|
|
3713
3753
|
binary: new Map(Object.entries(DEFAULT_BINARY_OPERATORS)),
|
|
3714
3754
|
unary: new Map(Object.entries(DEFAULT_UNARY_OPERATORS)),
|
|
3715
|
-
expressions: new Map(Object.entries(evaluator_functions_exports))
|
|
3755
|
+
expressions: new Map(_to_consumable_array(Object.entries(evaluator_functions_exports)).concat([
|
|
3756
|
+
[
|
|
3757
|
+
"await",
|
|
3758
|
+
waitFor
|
|
3759
|
+
]
|
|
3760
|
+
]))
|
|
3716
3761
|
};
|
|
3717
3762
|
this.defaultHookOptions = _object_spread_props(_object_spread({}, defaultOptions), {
|
|
3718
3763
|
evaluate: function(expr) {
|
|
@@ -3722,7 +3767,12 @@ var BeaconPlugin = function() {
|
|
|
3722
3767
|
return _this._execAST(node, _this.defaultHookOptions);
|
|
3723
3768
|
}
|
|
3724
3769
|
});
|
|
3725
|
-
this.hooks.resolve.tap("ExpressionEvaluator",
|
|
3770
|
+
this.hooks.resolve.tap("ExpressionEvaluator", function(result, node, options) {
|
|
3771
|
+
if (options.async) {
|
|
3772
|
+
return _this._resolveNodeAsync(result, node, options);
|
|
3773
|
+
}
|
|
3774
|
+
return _this._resolveNode(result, node, options);
|
|
3775
|
+
});
|
|
3726
3776
|
this.evaluate = this.evaluate.bind(this);
|
|
3727
3777
|
}
|
|
3728
3778
|
_create_class(ExpressionEvaluator, [
|
|
@@ -3760,6 +3810,14 @@ var BeaconPlugin = function() {
|
|
|
3760
3810
|
return this._execString(String(expression), resolvedOpts);
|
|
3761
3811
|
}
|
|
3762
3812
|
},
|
|
3813
|
+
{
|
|
3814
|
+
key: "evaluateAsync",
|
|
3815
|
+
value: function evaluateAsync(expr, options) {
|
|
3816
|
+
return this.evaluate(expr, _object_spread_props(_object_spread({}, options), {
|
|
3817
|
+
async: true
|
|
3818
|
+
}));
|
|
3819
|
+
}
|
|
3820
|
+
},
|
|
3763
3821
|
{
|
|
3764
3822
|
key: "addExpressionFunction",
|
|
3765
3823
|
value: function addExpressionFunction(name, handler) {
|
|
@@ -3805,8 +3863,10 @@ var BeaconPlugin = function() {
|
|
|
3805
3863
|
var matches = exp.match(/^@\[(.*)\]@$/);
|
|
3806
3864
|
var matchedExp = exp;
|
|
3807
3865
|
if (matches) {
|
|
3808
|
-
var
|
|
3809
|
-
|
|
3866
|
+
var _Array_from = _sliced_to_array(Array.from(matches), 2), matched = _Array_from[1];
|
|
3867
|
+
if (matched) {
|
|
3868
|
+
matchedExp = matched;
|
|
3869
|
+
}
|
|
3810
3870
|
}
|
|
3811
3871
|
var storedAST;
|
|
3812
3872
|
try {
|
|
@@ -3967,6 +4027,452 @@ var BeaconPlugin = function() {
|
|
|
3967
4027
|
return resolveNode(node.left);
|
|
3968
4028
|
}
|
|
3969
4029
|
}
|
|
4030
|
+
},
|
|
4031
|
+
{
|
|
4032
|
+
key: "_resolveNodeAsync",
|
|
4033
|
+
value: function _resolveNodeAsync(_currentValue, node, options) {
|
|
4034
|
+
var _this = this;
|
|
4035
|
+
return _async_to_generator(function() {
|
|
4036
|
+
var resolveNode, model, expressionContext, operator, _tmp, _tmp1, operator1, _tmp2, _tmp3, attributes, resolvedAttributes, expressionName, operator2, args, obj, prop, value, value1, result, operation, newValue, _tmp4, _tmp5;
|
|
4037
|
+
return _ts_generator(this, function(_state) {
|
|
4038
|
+
switch(_state.label){
|
|
4039
|
+
case 0:
|
|
4040
|
+
resolveNode = options.resolveNode, model = options.model;
|
|
4041
|
+
expressionContext = _object_spread_props(_object_spread({}, options), {
|
|
4042
|
+
evaluate: function(expr) {
|
|
4043
|
+
return _this.evaluate(expr, options);
|
|
4044
|
+
}
|
|
4045
|
+
});
|
|
4046
|
+
if (!(node.type === "BinaryExpression" || node.type === "LogicalExpression")) return [
|
|
4047
|
+
3,
|
|
4048
|
+
7
|
|
4049
|
+
];
|
|
4050
|
+
operator = _this.operators.binary.get(node.operator);
|
|
4051
|
+
if (!operator) return [
|
|
4052
|
+
3,
|
|
4053
|
+
6
|
|
4054
|
+
];
|
|
4055
|
+
if (!("resolveParams" in operator)) return [
|
|
4056
|
+
3,
|
|
4057
|
+
3
|
|
4058
|
+
];
|
|
4059
|
+
if (operator.resolveParams === false) {
|
|
4060
|
+
return [
|
|
4061
|
+
2,
|
|
4062
|
+
operator(expressionContext, node.left, node.right)
|
|
4063
|
+
];
|
|
4064
|
+
}
|
|
4065
|
+
_tmp = [
|
|
4066
|
+
expressionContext
|
|
4067
|
+
];
|
|
4068
|
+
return [
|
|
4069
|
+
4,
|
|
4070
|
+
resolveNode(node.left)
|
|
4071
|
+
];
|
|
4072
|
+
case 1:
|
|
4073
|
+
_tmp = _tmp.concat([
|
|
4074
|
+
_state.sent()
|
|
4075
|
+
]);
|
|
4076
|
+
return [
|
|
4077
|
+
4,
|
|
4078
|
+
resolveNode(node.right)
|
|
4079
|
+
];
|
|
4080
|
+
case 2:
|
|
4081
|
+
return [
|
|
4082
|
+
2,
|
|
4083
|
+
operator.apply(void 0, _tmp.concat([
|
|
4084
|
+
_state.sent()
|
|
4085
|
+
]))
|
|
4086
|
+
];
|
|
4087
|
+
case 3:
|
|
4088
|
+
return [
|
|
4089
|
+
4,
|
|
4090
|
+
resolveNode(node.left)
|
|
4091
|
+
];
|
|
4092
|
+
case 4:
|
|
4093
|
+
_tmp1 = [
|
|
4094
|
+
_state.sent()
|
|
4095
|
+
];
|
|
4096
|
+
return [
|
|
4097
|
+
4,
|
|
4098
|
+
resolveNode(node.right)
|
|
4099
|
+
];
|
|
4100
|
+
case 5:
|
|
4101
|
+
return [
|
|
4102
|
+
2,
|
|
4103
|
+
operator.apply(void 0, _tmp1.concat([
|
|
4104
|
+
_state.sent()
|
|
4105
|
+
]))
|
|
4106
|
+
];
|
|
4107
|
+
case 6:
|
|
4108
|
+
return [
|
|
4109
|
+
2
|
|
4110
|
+
];
|
|
4111
|
+
case 7:
|
|
4112
|
+
if (!(node.type === "UnaryExpression")) return [
|
|
4113
|
+
3,
|
|
4114
|
+
14
|
|
4115
|
+
];
|
|
4116
|
+
operator1 = _this.operators.unary.get(node.operator);
|
|
4117
|
+
if (!operator1) return [
|
|
4118
|
+
3,
|
|
4119
|
+
13
|
|
4120
|
+
];
|
|
4121
|
+
if (!("resolveParams" in operator1)) return [
|
|
4122
|
+
3,
|
|
4123
|
+
11
|
|
4124
|
+
];
|
|
4125
|
+
_tmp2 = [
|
|
4126
|
+
expressionContext
|
|
4127
|
+
];
|
|
4128
|
+
if (!(operator1.resolveParams === false)) return [
|
|
4129
|
+
3,
|
|
4130
|
+
8
|
|
4131
|
+
];
|
|
4132
|
+
_tmp3 = node.argument;
|
|
4133
|
+
return [
|
|
4134
|
+
3,
|
|
4135
|
+
10
|
|
4136
|
+
];
|
|
4137
|
+
case 8:
|
|
4138
|
+
return [
|
|
4139
|
+
4,
|
|
4140
|
+
resolveNode(node.argument)
|
|
4141
|
+
];
|
|
4142
|
+
case 9:
|
|
4143
|
+
_tmp3 = _state.sent();
|
|
4144
|
+
_state.label = 10;
|
|
4145
|
+
case 10:
|
|
4146
|
+
return [
|
|
4147
|
+
2,
|
|
4148
|
+
operator1.apply(void 0, _tmp2.concat([
|
|
4149
|
+
_tmp3
|
|
4150
|
+
]))
|
|
4151
|
+
];
|
|
4152
|
+
case 11:
|
|
4153
|
+
return [
|
|
4154
|
+
4,
|
|
4155
|
+
resolveNode(node.argument)
|
|
4156
|
+
];
|
|
4157
|
+
case 12:
|
|
4158
|
+
return [
|
|
4159
|
+
2,
|
|
4160
|
+
operator1.apply(void 0, [
|
|
4161
|
+
_state.sent()
|
|
4162
|
+
])
|
|
4163
|
+
];
|
|
4164
|
+
case 13:
|
|
4165
|
+
return [
|
|
4166
|
+
2
|
|
4167
|
+
];
|
|
4168
|
+
case 14:
|
|
4169
|
+
if (!(node.type === "Object")) return [
|
|
4170
|
+
3,
|
|
4171
|
+
16
|
|
4172
|
+
];
|
|
4173
|
+
attributes = node.attributes;
|
|
4174
|
+
resolvedAttributes = {};
|
|
4175
|
+
return [
|
|
4176
|
+
4,
|
|
4177
|
+
Promise.all(attributes.map(function() {
|
|
4178
|
+
var _ref = _async_to_generator(function(attr) {
|
|
4179
|
+
var key, value;
|
|
4180
|
+
return _ts_generator(this, function(_state) {
|
|
4181
|
+
switch(_state.label){
|
|
4182
|
+
case 0:
|
|
4183
|
+
return [
|
|
4184
|
+
4,
|
|
4185
|
+
resolveNode(attr.key)
|
|
4186
|
+
];
|
|
4187
|
+
case 1:
|
|
4188
|
+
key = _state.sent();
|
|
4189
|
+
return [
|
|
4190
|
+
4,
|
|
4191
|
+
resolveNode(attr.value)
|
|
4192
|
+
];
|
|
4193
|
+
case 2:
|
|
4194
|
+
value = _state.sent();
|
|
4195
|
+
resolvedAttributes[key] = value;
|
|
4196
|
+
return [
|
|
4197
|
+
2
|
|
4198
|
+
];
|
|
4199
|
+
}
|
|
4200
|
+
});
|
|
4201
|
+
});
|
|
4202
|
+
return function(attr) {
|
|
4203
|
+
return _ref.apply(this, arguments);
|
|
4204
|
+
};
|
|
4205
|
+
}()))
|
|
4206
|
+
];
|
|
4207
|
+
case 15:
|
|
4208
|
+
_state.sent();
|
|
4209
|
+
return [
|
|
4210
|
+
2,
|
|
4211
|
+
resolvedAttributes
|
|
4212
|
+
];
|
|
4213
|
+
case 16:
|
|
4214
|
+
if (!(node.type === "CallExpression")) return [
|
|
4215
|
+
3,
|
|
4216
|
+
18
|
|
4217
|
+
];
|
|
4218
|
+
expressionName = node.callTarget.name;
|
|
4219
|
+
operator2 = _this.operators.expressions.get(expressionName);
|
|
4220
|
+
if (!operator2) {
|
|
4221
|
+
throw new Error("Unknown expression function: ".concat(expressionName));
|
|
4222
|
+
}
|
|
4223
|
+
if ("resolveParams" in operator2 && operator2.resolveParams === false) {
|
|
4224
|
+
return [
|
|
4225
|
+
2,
|
|
4226
|
+
operator2.apply(void 0, [
|
|
4227
|
+
expressionContext
|
|
4228
|
+
].concat(_to_consumable_array(node.args)))
|
|
4229
|
+
];
|
|
4230
|
+
}
|
|
4231
|
+
return [
|
|
4232
|
+
4,
|
|
4233
|
+
Promise.all(node.args.map(function() {
|
|
4234
|
+
var _ref = _async_to_generator(function(n) {
|
|
4235
|
+
return _ts_generator(this, function(_state) {
|
|
4236
|
+
switch(_state.label){
|
|
4237
|
+
case 0:
|
|
4238
|
+
return [
|
|
4239
|
+
4,
|
|
4240
|
+
resolveNode(n)
|
|
4241
|
+
];
|
|
4242
|
+
case 1:
|
|
4243
|
+
return [
|
|
4244
|
+
2,
|
|
4245
|
+
_state.sent()
|
|
4246
|
+
];
|
|
4247
|
+
}
|
|
4248
|
+
});
|
|
4249
|
+
});
|
|
4250
|
+
return function(n) {
|
|
4251
|
+
return _ref.apply(this, arguments);
|
|
4252
|
+
};
|
|
4253
|
+
}()))
|
|
4254
|
+
];
|
|
4255
|
+
case 17:
|
|
4256
|
+
args = _state.sent();
|
|
4257
|
+
return [
|
|
4258
|
+
2,
|
|
4259
|
+
operator2.apply(void 0, [
|
|
4260
|
+
expressionContext
|
|
4261
|
+
].concat(_to_consumable_array(args)))
|
|
4262
|
+
];
|
|
4263
|
+
case 18:
|
|
4264
|
+
if (node.type === "ModelRef") {
|
|
4265
|
+
return [
|
|
4266
|
+
2,
|
|
4267
|
+
model.get(node.ref, {
|
|
4268
|
+
context: {
|
|
4269
|
+
model: options.model
|
|
4270
|
+
}
|
|
4271
|
+
})
|
|
4272
|
+
];
|
|
4273
|
+
}
|
|
4274
|
+
if (!(node.type === "MemberExpression")) return [
|
|
4275
|
+
3,
|
|
4276
|
+
21
|
|
4277
|
+
];
|
|
4278
|
+
return [
|
|
4279
|
+
4,
|
|
4280
|
+
resolveNode(node.object)
|
|
4281
|
+
];
|
|
4282
|
+
case 19:
|
|
4283
|
+
obj = _state.sent();
|
|
4284
|
+
return [
|
|
4285
|
+
4,
|
|
4286
|
+
resolveNode(node.property)
|
|
4287
|
+
];
|
|
4288
|
+
case 20:
|
|
4289
|
+
prop = _state.sent();
|
|
4290
|
+
return [
|
|
4291
|
+
2,
|
|
4292
|
+
obj[prop]
|
|
4293
|
+
];
|
|
4294
|
+
case 21:
|
|
4295
|
+
if (!(node.type === "Assignment")) return [
|
|
4296
|
+
3,
|
|
4297
|
+
26
|
|
4298
|
+
];
|
|
4299
|
+
if (!(node.left.type === "ModelRef")) return [
|
|
4300
|
+
3,
|
|
4301
|
+
23
|
|
4302
|
+
];
|
|
4303
|
+
return [
|
|
4304
|
+
4,
|
|
4305
|
+
resolveNode(node.right)
|
|
4306
|
+
];
|
|
4307
|
+
case 22:
|
|
4308
|
+
value = _state.sent();
|
|
4309
|
+
model.set([
|
|
4310
|
+
[
|
|
4311
|
+
node.left.ref,
|
|
4312
|
+
value
|
|
4313
|
+
]
|
|
4314
|
+
]);
|
|
4315
|
+
return [
|
|
4316
|
+
2,
|
|
4317
|
+
value
|
|
4318
|
+
];
|
|
4319
|
+
case 23:
|
|
4320
|
+
if (!(node.left.type === "Identifier")) return [
|
|
4321
|
+
3,
|
|
4322
|
+
25
|
|
4323
|
+
];
|
|
4324
|
+
return [
|
|
4325
|
+
4,
|
|
4326
|
+
resolveNode(node.right)
|
|
4327
|
+
];
|
|
4328
|
+
case 24:
|
|
4329
|
+
value1 = _state.sent();
|
|
4330
|
+
_this.vars[node.left.name] = value1;
|
|
4331
|
+
return [
|
|
4332
|
+
2,
|
|
4333
|
+
value1
|
|
4334
|
+
];
|
|
4335
|
+
case 25:
|
|
4336
|
+
return [
|
|
4337
|
+
2
|
|
4338
|
+
];
|
|
4339
|
+
case 26:
|
|
4340
|
+
if (!(node.type === "ConditionalExpression")) return [
|
|
4341
|
+
3,
|
|
4342
|
+
28
|
|
4343
|
+
];
|
|
4344
|
+
return [
|
|
4345
|
+
4,
|
|
4346
|
+
resolveNode(node.test)
|
|
4347
|
+
];
|
|
4348
|
+
case 27:
|
|
4349
|
+
result = _state.sent() ? node.consequent : node.alternate;
|
|
4350
|
+
return [
|
|
4351
|
+
2,
|
|
4352
|
+
resolveNode(result)
|
|
4353
|
+
];
|
|
4354
|
+
case 28:
|
|
4355
|
+
if (node.type === "ArrayExpression") {
|
|
4356
|
+
return [
|
|
4357
|
+
2,
|
|
4358
|
+
Promise.all(node.elements.map(function() {
|
|
4359
|
+
var _ref = _async_to_generator(function(ele) {
|
|
4360
|
+
return _ts_generator(this, function(_state) {
|
|
4361
|
+
switch(_state.label){
|
|
4362
|
+
case 0:
|
|
4363
|
+
return [
|
|
4364
|
+
4,
|
|
4365
|
+
resolveNode(ele)
|
|
4366
|
+
];
|
|
4367
|
+
case 1:
|
|
4368
|
+
return [
|
|
4369
|
+
2,
|
|
4370
|
+
_state.sent()
|
|
4371
|
+
];
|
|
4372
|
+
}
|
|
4373
|
+
});
|
|
4374
|
+
});
|
|
4375
|
+
return function(ele) {
|
|
4376
|
+
return _ref.apply(this, arguments);
|
|
4377
|
+
};
|
|
4378
|
+
}()))
|
|
4379
|
+
];
|
|
4380
|
+
}
|
|
4381
|
+
if (!(node.type === "Modification")) return [
|
|
4382
|
+
3,
|
|
4383
|
+
38
|
|
4384
|
+
];
|
|
4385
|
+
operation = _this.operators.binary.get(node.operator);
|
|
4386
|
+
if (!operation) return [
|
|
4387
|
+
3,
|
|
4388
|
+
37
|
|
4389
|
+
];
|
|
4390
|
+
if (!("resolveParams" in operation)) return [
|
|
4391
|
+
3,
|
|
4392
|
+
33
|
|
4393
|
+
];
|
|
4394
|
+
if (!(operation.resolveParams === false)) return [
|
|
4395
|
+
3,
|
|
4396
|
+
29
|
|
4397
|
+
];
|
|
4398
|
+
newValue = operation(expressionContext, node.left, node.right);
|
|
4399
|
+
return [
|
|
4400
|
+
3,
|
|
4401
|
+
32
|
|
4402
|
+
];
|
|
4403
|
+
case 29:
|
|
4404
|
+
_tmp4 = [
|
|
4405
|
+
expressionContext
|
|
4406
|
+
];
|
|
4407
|
+
return [
|
|
4408
|
+
4,
|
|
4409
|
+
resolveNode(node.left)
|
|
4410
|
+
];
|
|
4411
|
+
case 30:
|
|
4412
|
+
_tmp4 = _tmp4.concat([
|
|
4413
|
+
_state.sent()
|
|
4414
|
+
]);
|
|
4415
|
+
return [
|
|
4416
|
+
4,
|
|
4417
|
+
resolveNode(node.right)
|
|
4418
|
+
];
|
|
4419
|
+
case 31:
|
|
4420
|
+
newValue = operation.apply(void 0, _tmp4.concat([
|
|
4421
|
+
_state.sent()
|
|
4422
|
+
]));
|
|
4423
|
+
_state.label = 32;
|
|
4424
|
+
case 32:
|
|
4425
|
+
return [
|
|
4426
|
+
3,
|
|
4427
|
+
36
|
|
4428
|
+
];
|
|
4429
|
+
case 33:
|
|
4430
|
+
return [
|
|
4431
|
+
4,
|
|
4432
|
+
resolveNode(node.left)
|
|
4433
|
+
];
|
|
4434
|
+
case 34:
|
|
4435
|
+
_tmp5 = [
|
|
4436
|
+
_state.sent()
|
|
4437
|
+
];
|
|
4438
|
+
return [
|
|
4439
|
+
4,
|
|
4440
|
+
resolveNode(node.right)
|
|
4441
|
+
];
|
|
4442
|
+
case 35:
|
|
4443
|
+
newValue = operation.apply(void 0, _tmp5.concat([
|
|
4444
|
+
_state.sent()
|
|
4445
|
+
]));
|
|
4446
|
+
_state.label = 36;
|
|
4447
|
+
case 36:
|
|
4448
|
+
if (node.left.type === "ModelRef") {
|
|
4449
|
+
model.set([
|
|
4450
|
+
[
|
|
4451
|
+
node.left.ref,
|
|
4452
|
+
newValue
|
|
4453
|
+
]
|
|
4454
|
+
]);
|
|
4455
|
+
} else if (node.left.type === "Identifier") {
|
|
4456
|
+
_this.vars[node.left.name] = newValue;
|
|
4457
|
+
}
|
|
4458
|
+
return [
|
|
4459
|
+
2,
|
|
4460
|
+
newValue
|
|
4461
|
+
];
|
|
4462
|
+
case 37:
|
|
4463
|
+
return [
|
|
4464
|
+
2,
|
|
4465
|
+
resolveNode(node.left)
|
|
4466
|
+
];
|
|
4467
|
+
case 38:
|
|
4468
|
+
return [
|
|
4469
|
+
2,
|
|
4470
|
+
_this._resolveNode(_currentValue, node, options)
|
|
4471
|
+
];
|
|
4472
|
+
}
|
|
4473
|
+
});
|
|
4474
|
+
})();
|
|
4475
|
+
}
|
|
3970
4476
|
}
|
|
3971
4477
|
]);
|
|
3972
4478
|
return ExpressionEvaluator;
|
|
@@ -4479,15 +4985,6 @@ var BeaconPlugin = function() {
|
|
|
4479
4985
|
]);
|
|
4480
4986
|
return Parser;
|
|
4481
4987
|
}();
|
|
4482
|
-
function unpackAndPush(item, initial) {
|
|
4483
|
-
if (item.asset.values && Array.isArray(item.asset.values)) {
|
|
4484
|
-
item.asset.values.forEach(function(i) {
|
|
4485
|
-
unpackAndPush(i, initial);
|
|
4486
|
-
});
|
|
4487
|
-
} else {
|
|
4488
|
-
initial.push(item);
|
|
4489
|
-
}
|
|
4490
|
-
}
|
|
4491
4988
|
var withContext = function(model) {
|
|
4492
4989
|
return {
|
|
4493
4990
|
get: function(binding, options) {
|
|
@@ -4610,7 +5107,7 @@ var BeaconPlugin = function() {
|
|
|
4610
5107
|
key: "computeTree",
|
|
4611
5108
|
value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
|
|
4612
5109
|
var _this = this;
|
|
4613
|
-
var _partiallyResolvedParent_parent;
|
|
5110
|
+
var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
|
|
4614
5111
|
var dependencyModel = new DependencyModel(options.data.model);
|
|
4615
5112
|
dependencyModel.trackSubset("core");
|
|
4616
5113
|
var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
|
|
@@ -4636,7 +5133,8 @@ var BeaconPlugin = function() {
|
|
|
4636
5133
|
var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
|
|
4637
5134
|
type: "empty"
|
|
4638
5135
|
};
|
|
4639
|
-
var
|
|
5136
|
+
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");
|
|
5137
|
+
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";
|
|
4640
5138
|
if (previousResult && shouldUseLastValue) {
|
|
4641
5139
|
var update2 = _object_spread_props(_object_spread({}, previousResult), {
|
|
4642
5140
|
updated: false
|
|
@@ -4670,7 +5168,11 @@ var BeaconPlugin = function() {
|
|
|
4670
5168
|
repopulateASTMapFromCache(previousResult, node, rawParent);
|
|
4671
5169
|
return update2;
|
|
4672
5170
|
}
|
|
4673
|
-
|
|
5171
|
+
if (isNestedMultiNodeWithAsync) {
|
|
5172
|
+
resolvedAST.parent = partiallyResolvedParent.parent;
|
|
5173
|
+
} else {
|
|
5174
|
+
resolvedAST.parent = partiallyResolvedParent;
|
|
5175
|
+
}
|
|
4674
5176
|
resolveOptions.node = resolvedAST;
|
|
4675
5177
|
this.ASTMap.set(resolvedAST, node);
|
|
4676
5178
|
var resolved = this.hooks.resolve.call(void 0, resolvedAST, resolveOptions);
|
|
@@ -4705,6 +5207,11 @@ var BeaconPlugin = function() {
|
|
|
4705
5207
|
} else if (resolvedAST.type === "multi-node") {
|
|
4706
5208
|
var childValue = [];
|
|
4707
5209
|
var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
|
|
5210
|
+
var hasAsync = resolvedAST.values.map(function(value, index) {
|
|
5211
|
+
return value.type === "async" ? index : -1;
|
|
5212
|
+
}).filter(function(index) {
|
|
5213
|
+
return index !== -1;
|
|
5214
|
+
});
|
|
4708
5215
|
var newValues = resolvedAST.values.map(function(mValue) {
|
|
4709
5216
|
var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
|
|
4710
5217
|
if (mTree.value !== void 0 && mTree.value !== null) {
|
|
@@ -4720,7 +5227,19 @@ var BeaconPlugin = function() {
|
|
|
4720
5227
|
updated = updated || mTree.updated;
|
|
4721
5228
|
return mTree.node;
|
|
4722
5229
|
});
|
|
4723
|
-
|
|
5230
|
+
if (hasAsync.length > 0) {
|
|
5231
|
+
var copy = newValues;
|
|
5232
|
+
hasAsync.forEach(function(index) {
|
|
5233
|
+
var _copy;
|
|
5234
|
+
if (copy[index]) (_copy = copy).splice.apply(_copy, [
|
|
5235
|
+
index,
|
|
5236
|
+
1
|
|
5237
|
+
].concat(_to_consumable_array(unpackNode(copy[index]))));
|
|
5238
|
+
});
|
|
5239
|
+
resolvedAST.values = copy;
|
|
5240
|
+
} else {
|
|
5241
|
+
resolvedAST.values = newValues;
|
|
5242
|
+
}
|
|
4724
5243
|
resolved = childValue;
|
|
4725
5244
|
}
|
|
4726
5245
|
childDependencies.forEach(function(bindingDep) {
|
|
@@ -4749,6 +5268,15 @@ var BeaconPlugin = function() {
|
|
|
4749
5268
|
]);
|
|
4750
5269
|
return Resolver;
|
|
4751
5270
|
}();
|
|
5271
|
+
function unpackAndPush(item, initial) {
|
|
5272
|
+
if (item.asset.values && Array.isArray(item.asset.values)) {
|
|
5273
|
+
item.asset.values.forEach(function(i) {
|
|
5274
|
+
unpackAndPush(i, initial);
|
|
5275
|
+
});
|
|
5276
|
+
} else {
|
|
5277
|
+
initial.push(item);
|
|
5278
|
+
}
|
|
5279
|
+
}
|
|
4752
5280
|
var CrossfieldProvider = /*#__PURE__*/ function() {
|
|
4753
5281
|
function CrossfieldProvider(initialView, parser, logger) {
|
|
4754
5282
|
_class_call_check(this, CrossfieldProvider);
|
|
@@ -7369,15 +7897,56 @@ var BeaconPlugin = function() {
|
|
|
7369
7897
|
validationController.reset();
|
|
7370
7898
|
}
|
|
7371
7899
|
});
|
|
7372
|
-
flow.hooks.afterTransition.tap("player", function(
|
|
7373
|
-
var
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
|
|
7378
|
-
|
|
7379
|
-
|
|
7380
|
-
|
|
7900
|
+
flow.hooks.afterTransition.tap("player", function() {
|
|
7901
|
+
var _ref = _async_to_generator(function(flowInstance) {
|
|
7902
|
+
var _flowInstance_currentState, value, exp, result, e;
|
|
7903
|
+
return _ts_generator(this, function(_state) {
|
|
7904
|
+
switch(_state.label){
|
|
7905
|
+
case 0:
|
|
7906
|
+
value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
|
|
7907
|
+
if (!(value && value.state_type === "ACTION")) return [
|
|
7908
|
+
3,
|
|
7909
|
+
4
|
|
7910
|
+
];
|
|
7911
|
+
exp = value.exp;
|
|
7912
|
+
_state.label = 1;
|
|
7913
|
+
case 1:
|
|
7914
|
+
_state.trys.push([
|
|
7915
|
+
1,
|
|
7916
|
+
3,
|
|
7917
|
+
,
|
|
7918
|
+
4
|
|
7919
|
+
]);
|
|
7920
|
+
return [
|
|
7921
|
+
4,
|
|
7922
|
+
expressionEvaluator.evaluateAsync(exp)
|
|
7923
|
+
];
|
|
7924
|
+
case 2:
|
|
7925
|
+
result = _state.sent();
|
|
7926
|
+
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
|
|
7927
|
+
return [
|
|
7928
|
+
3,
|
|
7929
|
+
4
|
|
7930
|
+
];
|
|
7931
|
+
case 3:
|
|
7932
|
+
e = _state.sent();
|
|
7933
|
+
flowResultDeferred.reject(e);
|
|
7934
|
+
return [
|
|
7935
|
+
3,
|
|
7936
|
+
4
|
|
7937
|
+
];
|
|
7938
|
+
case 4:
|
|
7939
|
+
expressionEvaluator.reset();
|
|
7940
|
+
return [
|
|
7941
|
+
2
|
|
7942
|
+
];
|
|
7943
|
+
}
|
|
7944
|
+
});
|
|
7945
|
+
});
|
|
7946
|
+
return function(flowInstance) {
|
|
7947
|
+
return _ref.apply(this, arguments);
|
|
7948
|
+
};
|
|
7949
|
+
}());
|
|
7381
7950
|
});
|
|
7382
7951
|
this.hooks.dataController.call(dataController);
|
|
7383
7952
|
validationController.setOptions({
|