@player-ui/common-types-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 CommonTypesPlugin = 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
|
};
|
|
@@ -3610,6 +3626,9 @@ var CommonTypesPlugin = function() {
|
|
|
3610
3626
|
},
|
|
3611
3627
|
setDataVal: function() {
|
|
3612
3628
|
return setDataVal;
|
|
3629
|
+
},
|
|
3630
|
+
waitFor: function() {
|
|
3631
|
+
return waitFor;
|
|
3613
3632
|
}
|
|
3614
3633
|
});
|
|
3615
3634
|
var setDataVal = function(_context, binding, value) {
|
|
@@ -3637,6 +3656,27 @@ var CommonTypesPlugin = function() {
|
|
|
3637
3656
|
return null;
|
|
3638
3657
|
};
|
|
3639
3658
|
conditional.resolveParams = false;
|
|
3659
|
+
var waitFor = function() {
|
|
3660
|
+
var _ref = _async_to_generator(function(ctx, promise) {
|
|
3661
|
+
return _ts_generator(this, function(_state) {
|
|
3662
|
+
switch(_state.label){
|
|
3663
|
+
case 0:
|
|
3664
|
+
return [
|
|
3665
|
+
4,
|
|
3666
|
+
promise
|
|
3667
|
+
];
|
|
3668
|
+
case 1:
|
|
3669
|
+
return [
|
|
3670
|
+
2,
|
|
3671
|
+
_state.sent()
|
|
3672
|
+
];
|
|
3673
|
+
}
|
|
3674
|
+
});
|
|
3675
|
+
});
|
|
3676
|
+
return function waitFor(ctx, promise) {
|
|
3677
|
+
return _ref.apply(this, arguments);
|
|
3678
|
+
};
|
|
3679
|
+
}();
|
|
3640
3680
|
var andandOperator = function(ctx, a, b) {
|
|
3641
3681
|
return ctx.evaluate(a) && ctx.evaluate(b);
|
|
3642
3682
|
};
|
|
@@ -3742,7 +3782,12 @@ var CommonTypesPlugin = function() {
|
|
|
3742
3782
|
this.operators = {
|
|
3743
3783
|
binary: new Map(Object.entries(DEFAULT_BINARY_OPERATORS)),
|
|
3744
3784
|
unary: new Map(Object.entries(DEFAULT_UNARY_OPERATORS)),
|
|
3745
|
-
expressions: new Map(Object.entries(evaluator_functions_exports))
|
|
3785
|
+
expressions: new Map(_to_consumable_array(Object.entries(evaluator_functions_exports)).concat([
|
|
3786
|
+
[
|
|
3787
|
+
"await",
|
|
3788
|
+
waitFor
|
|
3789
|
+
]
|
|
3790
|
+
]))
|
|
3746
3791
|
};
|
|
3747
3792
|
this.defaultHookOptions = _object_spread_props(_object_spread({}, defaultOptions), {
|
|
3748
3793
|
evaluate: function(expr) {
|
|
@@ -3752,7 +3797,12 @@ var CommonTypesPlugin = function() {
|
|
|
3752
3797
|
return _this._execAST(node, _this.defaultHookOptions);
|
|
3753
3798
|
}
|
|
3754
3799
|
});
|
|
3755
|
-
this.hooks.resolve.tap("ExpressionEvaluator",
|
|
3800
|
+
this.hooks.resolve.tap("ExpressionEvaluator", function(result, node, options) {
|
|
3801
|
+
if (options.async) {
|
|
3802
|
+
return _this._resolveNodeAsync(result, node, options);
|
|
3803
|
+
}
|
|
3804
|
+
return _this._resolveNode(result, node, options);
|
|
3805
|
+
});
|
|
3756
3806
|
this.evaluate = this.evaluate.bind(this);
|
|
3757
3807
|
}
|
|
3758
3808
|
_create_class(ExpressionEvaluator, [
|
|
@@ -3790,6 +3840,14 @@ var CommonTypesPlugin = function() {
|
|
|
3790
3840
|
return this._execString(String(expression2), resolvedOpts);
|
|
3791
3841
|
}
|
|
3792
3842
|
},
|
|
3843
|
+
{
|
|
3844
|
+
key: "evaluateAsync",
|
|
3845
|
+
value: function evaluateAsync(expr, options) {
|
|
3846
|
+
return this.evaluate(expr, _object_spread_props(_object_spread({}, options), {
|
|
3847
|
+
async: true
|
|
3848
|
+
}));
|
|
3849
|
+
}
|
|
3850
|
+
},
|
|
3793
3851
|
{
|
|
3794
3852
|
key: "addExpressionFunction",
|
|
3795
3853
|
value: function addExpressionFunction(name, handler) {
|
|
@@ -3835,8 +3893,10 @@ var CommonTypesPlugin = function() {
|
|
|
3835
3893
|
var matches = exp.match(/^@\[(.*)\]@$/);
|
|
3836
3894
|
var matchedExp = exp;
|
|
3837
3895
|
if (matches) {
|
|
3838
|
-
var
|
|
3839
|
-
|
|
3896
|
+
var _Array_from = _sliced_to_array(Array.from(matches), 2), matched = _Array_from[1];
|
|
3897
|
+
if (matched) {
|
|
3898
|
+
matchedExp = matched;
|
|
3899
|
+
}
|
|
3840
3900
|
}
|
|
3841
3901
|
var storedAST;
|
|
3842
3902
|
try {
|
|
@@ -3997,6 +4057,452 @@ var CommonTypesPlugin = function() {
|
|
|
3997
4057
|
return resolveNode(node.left);
|
|
3998
4058
|
}
|
|
3999
4059
|
}
|
|
4060
|
+
},
|
|
4061
|
+
{
|
|
4062
|
+
key: "_resolveNodeAsync",
|
|
4063
|
+
value: function _resolveNodeAsync(_currentValue, node, options) {
|
|
4064
|
+
var _this = this;
|
|
4065
|
+
return _async_to_generator(function() {
|
|
4066
|
+
var resolveNode, model, expressionContext, operator, _tmp, _tmp1, operator1, _tmp2, _tmp3, attributes, resolvedAttributes, expressionName, operator2, args, obj, prop, value, value1, result, operation, newValue, _tmp4, _tmp5;
|
|
4067
|
+
return _ts_generator(this, function(_state) {
|
|
4068
|
+
switch(_state.label){
|
|
4069
|
+
case 0:
|
|
4070
|
+
resolveNode = options.resolveNode, model = options.model;
|
|
4071
|
+
expressionContext = _object_spread_props(_object_spread({}, options), {
|
|
4072
|
+
evaluate: function(expr) {
|
|
4073
|
+
return _this.evaluate(expr, options);
|
|
4074
|
+
}
|
|
4075
|
+
});
|
|
4076
|
+
if (!(node.type === "BinaryExpression" || node.type === "LogicalExpression")) return [
|
|
4077
|
+
3,
|
|
4078
|
+
7
|
|
4079
|
+
];
|
|
4080
|
+
operator = _this.operators.binary.get(node.operator);
|
|
4081
|
+
if (!operator) return [
|
|
4082
|
+
3,
|
|
4083
|
+
6
|
|
4084
|
+
];
|
|
4085
|
+
if (!("resolveParams" in operator)) return [
|
|
4086
|
+
3,
|
|
4087
|
+
3
|
|
4088
|
+
];
|
|
4089
|
+
if (operator.resolveParams === false) {
|
|
4090
|
+
return [
|
|
4091
|
+
2,
|
|
4092
|
+
operator(expressionContext, node.left, node.right)
|
|
4093
|
+
];
|
|
4094
|
+
}
|
|
4095
|
+
_tmp = [
|
|
4096
|
+
expressionContext
|
|
4097
|
+
];
|
|
4098
|
+
return [
|
|
4099
|
+
4,
|
|
4100
|
+
resolveNode(node.left)
|
|
4101
|
+
];
|
|
4102
|
+
case 1:
|
|
4103
|
+
_tmp = _tmp.concat([
|
|
4104
|
+
_state.sent()
|
|
4105
|
+
]);
|
|
4106
|
+
return [
|
|
4107
|
+
4,
|
|
4108
|
+
resolveNode(node.right)
|
|
4109
|
+
];
|
|
4110
|
+
case 2:
|
|
4111
|
+
return [
|
|
4112
|
+
2,
|
|
4113
|
+
operator.apply(void 0, _tmp.concat([
|
|
4114
|
+
_state.sent()
|
|
4115
|
+
]))
|
|
4116
|
+
];
|
|
4117
|
+
case 3:
|
|
4118
|
+
return [
|
|
4119
|
+
4,
|
|
4120
|
+
resolveNode(node.left)
|
|
4121
|
+
];
|
|
4122
|
+
case 4:
|
|
4123
|
+
_tmp1 = [
|
|
4124
|
+
_state.sent()
|
|
4125
|
+
];
|
|
4126
|
+
return [
|
|
4127
|
+
4,
|
|
4128
|
+
resolveNode(node.right)
|
|
4129
|
+
];
|
|
4130
|
+
case 5:
|
|
4131
|
+
return [
|
|
4132
|
+
2,
|
|
4133
|
+
operator.apply(void 0, _tmp1.concat([
|
|
4134
|
+
_state.sent()
|
|
4135
|
+
]))
|
|
4136
|
+
];
|
|
4137
|
+
case 6:
|
|
4138
|
+
return [
|
|
4139
|
+
2
|
|
4140
|
+
];
|
|
4141
|
+
case 7:
|
|
4142
|
+
if (!(node.type === "UnaryExpression")) return [
|
|
4143
|
+
3,
|
|
4144
|
+
14
|
|
4145
|
+
];
|
|
4146
|
+
operator1 = _this.operators.unary.get(node.operator);
|
|
4147
|
+
if (!operator1) return [
|
|
4148
|
+
3,
|
|
4149
|
+
13
|
|
4150
|
+
];
|
|
4151
|
+
if (!("resolveParams" in operator1)) return [
|
|
4152
|
+
3,
|
|
4153
|
+
11
|
|
4154
|
+
];
|
|
4155
|
+
_tmp2 = [
|
|
4156
|
+
expressionContext
|
|
4157
|
+
];
|
|
4158
|
+
if (!(operator1.resolveParams === false)) return [
|
|
4159
|
+
3,
|
|
4160
|
+
8
|
|
4161
|
+
];
|
|
4162
|
+
_tmp3 = node.argument;
|
|
4163
|
+
return [
|
|
4164
|
+
3,
|
|
4165
|
+
10
|
|
4166
|
+
];
|
|
4167
|
+
case 8:
|
|
4168
|
+
return [
|
|
4169
|
+
4,
|
|
4170
|
+
resolveNode(node.argument)
|
|
4171
|
+
];
|
|
4172
|
+
case 9:
|
|
4173
|
+
_tmp3 = _state.sent();
|
|
4174
|
+
_state.label = 10;
|
|
4175
|
+
case 10:
|
|
4176
|
+
return [
|
|
4177
|
+
2,
|
|
4178
|
+
operator1.apply(void 0, _tmp2.concat([
|
|
4179
|
+
_tmp3
|
|
4180
|
+
]))
|
|
4181
|
+
];
|
|
4182
|
+
case 11:
|
|
4183
|
+
return [
|
|
4184
|
+
4,
|
|
4185
|
+
resolveNode(node.argument)
|
|
4186
|
+
];
|
|
4187
|
+
case 12:
|
|
4188
|
+
return [
|
|
4189
|
+
2,
|
|
4190
|
+
operator1.apply(void 0, [
|
|
4191
|
+
_state.sent()
|
|
4192
|
+
])
|
|
4193
|
+
];
|
|
4194
|
+
case 13:
|
|
4195
|
+
return [
|
|
4196
|
+
2
|
|
4197
|
+
];
|
|
4198
|
+
case 14:
|
|
4199
|
+
if (!(node.type === "Object")) return [
|
|
4200
|
+
3,
|
|
4201
|
+
16
|
|
4202
|
+
];
|
|
4203
|
+
attributes = node.attributes;
|
|
4204
|
+
resolvedAttributes = {};
|
|
4205
|
+
return [
|
|
4206
|
+
4,
|
|
4207
|
+
Promise.all(attributes.map(function() {
|
|
4208
|
+
var _ref = _async_to_generator(function(attr) {
|
|
4209
|
+
var key, value;
|
|
4210
|
+
return _ts_generator(this, function(_state) {
|
|
4211
|
+
switch(_state.label){
|
|
4212
|
+
case 0:
|
|
4213
|
+
return [
|
|
4214
|
+
4,
|
|
4215
|
+
resolveNode(attr.key)
|
|
4216
|
+
];
|
|
4217
|
+
case 1:
|
|
4218
|
+
key = _state.sent();
|
|
4219
|
+
return [
|
|
4220
|
+
4,
|
|
4221
|
+
resolveNode(attr.value)
|
|
4222
|
+
];
|
|
4223
|
+
case 2:
|
|
4224
|
+
value = _state.sent();
|
|
4225
|
+
resolvedAttributes[key] = value;
|
|
4226
|
+
return [
|
|
4227
|
+
2
|
|
4228
|
+
];
|
|
4229
|
+
}
|
|
4230
|
+
});
|
|
4231
|
+
});
|
|
4232
|
+
return function(attr) {
|
|
4233
|
+
return _ref.apply(this, arguments);
|
|
4234
|
+
};
|
|
4235
|
+
}()))
|
|
4236
|
+
];
|
|
4237
|
+
case 15:
|
|
4238
|
+
_state.sent();
|
|
4239
|
+
return [
|
|
4240
|
+
2,
|
|
4241
|
+
resolvedAttributes
|
|
4242
|
+
];
|
|
4243
|
+
case 16:
|
|
4244
|
+
if (!(node.type === "CallExpression")) return [
|
|
4245
|
+
3,
|
|
4246
|
+
18
|
|
4247
|
+
];
|
|
4248
|
+
expressionName = node.callTarget.name;
|
|
4249
|
+
operator2 = _this.operators.expressions.get(expressionName);
|
|
4250
|
+
if (!operator2) {
|
|
4251
|
+
throw new Error("Unknown expression function: ".concat(expressionName));
|
|
4252
|
+
}
|
|
4253
|
+
if ("resolveParams" in operator2 && operator2.resolveParams === false) {
|
|
4254
|
+
return [
|
|
4255
|
+
2,
|
|
4256
|
+
operator2.apply(void 0, [
|
|
4257
|
+
expressionContext
|
|
4258
|
+
].concat(_to_consumable_array(node.args)))
|
|
4259
|
+
];
|
|
4260
|
+
}
|
|
4261
|
+
return [
|
|
4262
|
+
4,
|
|
4263
|
+
Promise.all(node.args.map(function() {
|
|
4264
|
+
var _ref = _async_to_generator(function(n) {
|
|
4265
|
+
return _ts_generator(this, function(_state) {
|
|
4266
|
+
switch(_state.label){
|
|
4267
|
+
case 0:
|
|
4268
|
+
return [
|
|
4269
|
+
4,
|
|
4270
|
+
resolveNode(n)
|
|
4271
|
+
];
|
|
4272
|
+
case 1:
|
|
4273
|
+
return [
|
|
4274
|
+
2,
|
|
4275
|
+
_state.sent()
|
|
4276
|
+
];
|
|
4277
|
+
}
|
|
4278
|
+
});
|
|
4279
|
+
});
|
|
4280
|
+
return function(n) {
|
|
4281
|
+
return _ref.apply(this, arguments);
|
|
4282
|
+
};
|
|
4283
|
+
}()))
|
|
4284
|
+
];
|
|
4285
|
+
case 17:
|
|
4286
|
+
args = _state.sent();
|
|
4287
|
+
return [
|
|
4288
|
+
2,
|
|
4289
|
+
operator2.apply(void 0, [
|
|
4290
|
+
expressionContext
|
|
4291
|
+
].concat(_to_consumable_array(args)))
|
|
4292
|
+
];
|
|
4293
|
+
case 18:
|
|
4294
|
+
if (node.type === "ModelRef") {
|
|
4295
|
+
return [
|
|
4296
|
+
2,
|
|
4297
|
+
model.get(node.ref, {
|
|
4298
|
+
context: {
|
|
4299
|
+
model: options.model
|
|
4300
|
+
}
|
|
4301
|
+
})
|
|
4302
|
+
];
|
|
4303
|
+
}
|
|
4304
|
+
if (!(node.type === "MemberExpression")) return [
|
|
4305
|
+
3,
|
|
4306
|
+
21
|
|
4307
|
+
];
|
|
4308
|
+
return [
|
|
4309
|
+
4,
|
|
4310
|
+
resolveNode(node.object)
|
|
4311
|
+
];
|
|
4312
|
+
case 19:
|
|
4313
|
+
obj = _state.sent();
|
|
4314
|
+
return [
|
|
4315
|
+
4,
|
|
4316
|
+
resolveNode(node.property)
|
|
4317
|
+
];
|
|
4318
|
+
case 20:
|
|
4319
|
+
prop = _state.sent();
|
|
4320
|
+
return [
|
|
4321
|
+
2,
|
|
4322
|
+
obj[prop]
|
|
4323
|
+
];
|
|
4324
|
+
case 21:
|
|
4325
|
+
if (!(node.type === "Assignment")) return [
|
|
4326
|
+
3,
|
|
4327
|
+
26
|
|
4328
|
+
];
|
|
4329
|
+
if (!(node.left.type === "ModelRef")) return [
|
|
4330
|
+
3,
|
|
4331
|
+
23
|
|
4332
|
+
];
|
|
4333
|
+
return [
|
|
4334
|
+
4,
|
|
4335
|
+
resolveNode(node.right)
|
|
4336
|
+
];
|
|
4337
|
+
case 22:
|
|
4338
|
+
value = _state.sent();
|
|
4339
|
+
model.set([
|
|
4340
|
+
[
|
|
4341
|
+
node.left.ref,
|
|
4342
|
+
value
|
|
4343
|
+
]
|
|
4344
|
+
]);
|
|
4345
|
+
return [
|
|
4346
|
+
2,
|
|
4347
|
+
value
|
|
4348
|
+
];
|
|
4349
|
+
case 23:
|
|
4350
|
+
if (!(node.left.type === "Identifier")) return [
|
|
4351
|
+
3,
|
|
4352
|
+
25
|
|
4353
|
+
];
|
|
4354
|
+
return [
|
|
4355
|
+
4,
|
|
4356
|
+
resolveNode(node.right)
|
|
4357
|
+
];
|
|
4358
|
+
case 24:
|
|
4359
|
+
value1 = _state.sent();
|
|
4360
|
+
_this.vars[node.left.name] = value1;
|
|
4361
|
+
return [
|
|
4362
|
+
2,
|
|
4363
|
+
value1
|
|
4364
|
+
];
|
|
4365
|
+
case 25:
|
|
4366
|
+
return [
|
|
4367
|
+
2
|
|
4368
|
+
];
|
|
4369
|
+
case 26:
|
|
4370
|
+
if (!(node.type === "ConditionalExpression")) return [
|
|
4371
|
+
3,
|
|
4372
|
+
28
|
|
4373
|
+
];
|
|
4374
|
+
return [
|
|
4375
|
+
4,
|
|
4376
|
+
resolveNode(node.test)
|
|
4377
|
+
];
|
|
4378
|
+
case 27:
|
|
4379
|
+
result = _state.sent() ? node.consequent : node.alternate;
|
|
4380
|
+
return [
|
|
4381
|
+
2,
|
|
4382
|
+
resolveNode(result)
|
|
4383
|
+
];
|
|
4384
|
+
case 28:
|
|
4385
|
+
if (node.type === "ArrayExpression") {
|
|
4386
|
+
return [
|
|
4387
|
+
2,
|
|
4388
|
+
Promise.all(node.elements.map(function() {
|
|
4389
|
+
var _ref = _async_to_generator(function(ele) {
|
|
4390
|
+
return _ts_generator(this, function(_state) {
|
|
4391
|
+
switch(_state.label){
|
|
4392
|
+
case 0:
|
|
4393
|
+
return [
|
|
4394
|
+
4,
|
|
4395
|
+
resolveNode(ele)
|
|
4396
|
+
];
|
|
4397
|
+
case 1:
|
|
4398
|
+
return [
|
|
4399
|
+
2,
|
|
4400
|
+
_state.sent()
|
|
4401
|
+
];
|
|
4402
|
+
}
|
|
4403
|
+
});
|
|
4404
|
+
});
|
|
4405
|
+
return function(ele) {
|
|
4406
|
+
return _ref.apply(this, arguments);
|
|
4407
|
+
};
|
|
4408
|
+
}()))
|
|
4409
|
+
];
|
|
4410
|
+
}
|
|
4411
|
+
if (!(node.type === "Modification")) return [
|
|
4412
|
+
3,
|
|
4413
|
+
38
|
|
4414
|
+
];
|
|
4415
|
+
operation = _this.operators.binary.get(node.operator);
|
|
4416
|
+
if (!operation) return [
|
|
4417
|
+
3,
|
|
4418
|
+
37
|
|
4419
|
+
];
|
|
4420
|
+
if (!("resolveParams" in operation)) return [
|
|
4421
|
+
3,
|
|
4422
|
+
33
|
|
4423
|
+
];
|
|
4424
|
+
if (!(operation.resolveParams === false)) return [
|
|
4425
|
+
3,
|
|
4426
|
+
29
|
|
4427
|
+
];
|
|
4428
|
+
newValue = operation(expressionContext, node.left, node.right);
|
|
4429
|
+
return [
|
|
4430
|
+
3,
|
|
4431
|
+
32
|
|
4432
|
+
];
|
|
4433
|
+
case 29:
|
|
4434
|
+
_tmp4 = [
|
|
4435
|
+
expressionContext
|
|
4436
|
+
];
|
|
4437
|
+
return [
|
|
4438
|
+
4,
|
|
4439
|
+
resolveNode(node.left)
|
|
4440
|
+
];
|
|
4441
|
+
case 30:
|
|
4442
|
+
_tmp4 = _tmp4.concat([
|
|
4443
|
+
_state.sent()
|
|
4444
|
+
]);
|
|
4445
|
+
return [
|
|
4446
|
+
4,
|
|
4447
|
+
resolveNode(node.right)
|
|
4448
|
+
];
|
|
4449
|
+
case 31:
|
|
4450
|
+
newValue = operation.apply(void 0, _tmp4.concat([
|
|
4451
|
+
_state.sent()
|
|
4452
|
+
]));
|
|
4453
|
+
_state.label = 32;
|
|
4454
|
+
case 32:
|
|
4455
|
+
return [
|
|
4456
|
+
3,
|
|
4457
|
+
36
|
|
4458
|
+
];
|
|
4459
|
+
case 33:
|
|
4460
|
+
return [
|
|
4461
|
+
4,
|
|
4462
|
+
resolveNode(node.left)
|
|
4463
|
+
];
|
|
4464
|
+
case 34:
|
|
4465
|
+
_tmp5 = [
|
|
4466
|
+
_state.sent()
|
|
4467
|
+
];
|
|
4468
|
+
return [
|
|
4469
|
+
4,
|
|
4470
|
+
resolveNode(node.right)
|
|
4471
|
+
];
|
|
4472
|
+
case 35:
|
|
4473
|
+
newValue = operation.apply(void 0, _tmp5.concat([
|
|
4474
|
+
_state.sent()
|
|
4475
|
+
]));
|
|
4476
|
+
_state.label = 36;
|
|
4477
|
+
case 36:
|
|
4478
|
+
if (node.left.type === "ModelRef") {
|
|
4479
|
+
model.set([
|
|
4480
|
+
[
|
|
4481
|
+
node.left.ref,
|
|
4482
|
+
newValue
|
|
4483
|
+
]
|
|
4484
|
+
]);
|
|
4485
|
+
} else if (node.left.type === "Identifier") {
|
|
4486
|
+
_this.vars[node.left.name] = newValue;
|
|
4487
|
+
}
|
|
4488
|
+
return [
|
|
4489
|
+
2,
|
|
4490
|
+
newValue
|
|
4491
|
+
];
|
|
4492
|
+
case 37:
|
|
4493
|
+
return [
|
|
4494
|
+
2,
|
|
4495
|
+
resolveNode(node.left)
|
|
4496
|
+
];
|
|
4497
|
+
case 38:
|
|
4498
|
+
return [
|
|
4499
|
+
2,
|
|
4500
|
+
_this._resolveNode(_currentValue, node, options)
|
|
4501
|
+
];
|
|
4502
|
+
}
|
|
4503
|
+
});
|
|
4504
|
+
})();
|
|
4505
|
+
}
|
|
4000
4506
|
}
|
|
4001
4507
|
]);
|
|
4002
4508
|
return ExpressionEvaluator;
|
|
@@ -4509,15 +5015,6 @@ var CommonTypesPlugin = function() {
|
|
|
4509
5015
|
]);
|
|
4510
5016
|
return Parser;
|
|
4511
5017
|
}();
|
|
4512
|
-
function unpackAndPush(item, initial) {
|
|
4513
|
-
if (item.asset.values && Array.isArray(item.asset.values)) {
|
|
4514
|
-
item.asset.values.forEach(function(i) {
|
|
4515
|
-
unpackAndPush(i, initial);
|
|
4516
|
-
});
|
|
4517
|
-
} else {
|
|
4518
|
-
initial.push(item);
|
|
4519
|
-
}
|
|
4520
|
-
}
|
|
4521
5018
|
var withContext = function(model) {
|
|
4522
5019
|
return {
|
|
4523
5020
|
get: function(binding, options) {
|
|
@@ -4640,7 +5137,7 @@ var CommonTypesPlugin = function() {
|
|
|
4640
5137
|
key: "computeTree",
|
|
4641
5138
|
value: function computeTree(node, rawParent, dataChanges, cacheUpdate, options, partiallyResolvedParent, prevASTMap) {
|
|
4642
5139
|
var _this = this;
|
|
4643
|
-
var _partiallyResolvedParent_parent;
|
|
5140
|
+
var _partiallyResolvedParent_parent_parent, _partiallyResolvedParent_parent, _resolvedAST_parent, _partiallyResolvedParent_parent1;
|
|
4644
5141
|
var dependencyModel = new DependencyModel(options.data.model);
|
|
4645
5142
|
dependencyModel.trackSubset("core");
|
|
4646
5143
|
var depModelWithParser = withContext(withParser(dependencyModel, this.options.parseBinding));
|
|
@@ -4666,7 +5163,8 @@ var CommonTypesPlugin = function() {
|
|
|
4666
5163
|
var resolvedAST = (_this_hooks_beforeResolve_call = this.hooks.beforeResolve.call(clonedNode, resolveOptions)) !== null && _this_hooks_beforeResolve_call !== void 0 ? _this_hooks_beforeResolve_call : {
|
|
4667
5164
|
type: "empty"
|
|
4668
5165
|
};
|
|
4669
|
-
var
|
|
5166
|
+
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");
|
|
5167
|
+
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";
|
|
4670
5168
|
if (previousResult && shouldUseLastValue) {
|
|
4671
5169
|
var update2 = _object_spread_props(_object_spread({}, previousResult), {
|
|
4672
5170
|
updated: false
|
|
@@ -4700,7 +5198,11 @@ var CommonTypesPlugin = function() {
|
|
|
4700
5198
|
repopulateASTMapFromCache(previousResult, node, rawParent);
|
|
4701
5199
|
return update2;
|
|
4702
5200
|
}
|
|
4703
|
-
|
|
5201
|
+
if (isNestedMultiNodeWithAsync) {
|
|
5202
|
+
resolvedAST.parent = partiallyResolvedParent.parent;
|
|
5203
|
+
} else {
|
|
5204
|
+
resolvedAST.parent = partiallyResolvedParent;
|
|
5205
|
+
}
|
|
4704
5206
|
resolveOptions.node = resolvedAST;
|
|
4705
5207
|
this.ASTMap.set(resolvedAST, node);
|
|
4706
5208
|
var resolved = this.hooks.resolve.call(void 0, resolvedAST, resolveOptions);
|
|
@@ -4735,6 +5237,11 @@ var CommonTypesPlugin = function() {
|
|
|
4735
5237
|
} else if (resolvedAST.type === "multi-node") {
|
|
4736
5238
|
var childValue = [];
|
|
4737
5239
|
var rawParentToPassIn = isNestedMultiNode ? partiallyResolvedParent === null || partiallyResolvedParent === void 0 ? void 0 : partiallyResolvedParent.parent : node;
|
|
5240
|
+
var hasAsync = resolvedAST.values.map(function(value, index) {
|
|
5241
|
+
return value.type === "async" ? index : -1;
|
|
5242
|
+
}).filter(function(index) {
|
|
5243
|
+
return index !== -1;
|
|
5244
|
+
});
|
|
4738
5245
|
var newValues = resolvedAST.values.map(function(mValue) {
|
|
4739
5246
|
var mTree = _this.computeTree(mValue, rawParentToPassIn, dataChanges, cacheUpdate, resolveOptions, resolvedAST, prevASTMap);
|
|
4740
5247
|
if (mTree.value !== void 0 && mTree.value !== null) {
|
|
@@ -4750,7 +5257,19 @@ var CommonTypesPlugin = function() {
|
|
|
4750
5257
|
updated = updated || mTree.updated;
|
|
4751
5258
|
return mTree.node;
|
|
4752
5259
|
});
|
|
4753
|
-
|
|
5260
|
+
if (hasAsync.length > 0) {
|
|
5261
|
+
var copy = newValues;
|
|
5262
|
+
hasAsync.forEach(function(index) {
|
|
5263
|
+
var _copy;
|
|
5264
|
+
if (copy[index]) (_copy = copy).splice.apply(_copy, [
|
|
5265
|
+
index,
|
|
5266
|
+
1
|
|
5267
|
+
].concat(_to_consumable_array(unpackNode(copy[index]))));
|
|
5268
|
+
});
|
|
5269
|
+
resolvedAST.values = copy;
|
|
5270
|
+
} else {
|
|
5271
|
+
resolvedAST.values = newValues;
|
|
5272
|
+
}
|
|
4754
5273
|
resolved = childValue;
|
|
4755
5274
|
}
|
|
4756
5275
|
childDependencies.forEach(function(bindingDep) {
|
|
@@ -4779,6 +5298,15 @@ var CommonTypesPlugin = function() {
|
|
|
4779
5298
|
]);
|
|
4780
5299
|
return Resolver;
|
|
4781
5300
|
}();
|
|
5301
|
+
function unpackAndPush(item, initial) {
|
|
5302
|
+
if (item.asset.values && Array.isArray(item.asset.values)) {
|
|
5303
|
+
item.asset.values.forEach(function(i) {
|
|
5304
|
+
unpackAndPush(i, initial);
|
|
5305
|
+
});
|
|
5306
|
+
} else {
|
|
5307
|
+
initial.push(item);
|
|
5308
|
+
}
|
|
5309
|
+
}
|
|
4782
5310
|
var CrossfieldProvider = /*#__PURE__*/ function() {
|
|
4783
5311
|
function CrossfieldProvider(initialView, parser, logger) {
|
|
4784
5312
|
_class_call_check(this, CrossfieldProvider);
|
|
@@ -7399,15 +7927,56 @@ var CommonTypesPlugin = function() {
|
|
|
7399
7927
|
validationController.reset();
|
|
7400
7928
|
}
|
|
7401
7929
|
});
|
|
7402
|
-
flow.hooks.afterTransition.tap("player", function(
|
|
7403
|
-
var
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7930
|
+
flow.hooks.afterTransition.tap("player", function() {
|
|
7931
|
+
var _ref = _async_to_generator(function(flowInstance) {
|
|
7932
|
+
var _flowInstance_currentState, value, exp, result, e;
|
|
7933
|
+
return _ts_generator(this, function(_state) {
|
|
7934
|
+
switch(_state.label){
|
|
7935
|
+
case 0:
|
|
7936
|
+
value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
|
|
7937
|
+
if (!(value && value.state_type === "ACTION")) return [
|
|
7938
|
+
3,
|
|
7939
|
+
4
|
|
7940
|
+
];
|
|
7941
|
+
exp = value.exp;
|
|
7942
|
+
_state.label = 1;
|
|
7943
|
+
case 1:
|
|
7944
|
+
_state.trys.push([
|
|
7945
|
+
1,
|
|
7946
|
+
3,
|
|
7947
|
+
,
|
|
7948
|
+
4
|
|
7949
|
+
]);
|
|
7950
|
+
return [
|
|
7951
|
+
4,
|
|
7952
|
+
expressionEvaluator.evaluateAsync(exp)
|
|
7953
|
+
];
|
|
7954
|
+
case 2:
|
|
7955
|
+
result = _state.sent();
|
|
7956
|
+
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
|
|
7957
|
+
return [
|
|
7958
|
+
3,
|
|
7959
|
+
4
|
|
7960
|
+
];
|
|
7961
|
+
case 3:
|
|
7962
|
+
e = _state.sent();
|
|
7963
|
+
flowResultDeferred.reject(e);
|
|
7964
|
+
return [
|
|
7965
|
+
3,
|
|
7966
|
+
4
|
|
7967
|
+
];
|
|
7968
|
+
case 4:
|
|
7969
|
+
expressionEvaluator.reset();
|
|
7970
|
+
return [
|
|
7971
|
+
2
|
|
7972
|
+
];
|
|
7973
|
+
}
|
|
7974
|
+
});
|
|
7975
|
+
});
|
|
7976
|
+
return function(flowInstance) {
|
|
7977
|
+
return _ref.apply(this, arguments);
|
|
7978
|
+
};
|
|
7979
|
+
}());
|
|
7411
7980
|
});
|
|
7412
7981
|
this.hooks.dataController.call(dataController);
|
|
7413
7982
|
validationController.setOptions({
|