@player-ui/reference-assets-plugin 0.11.3--canary.660.23372 → 0.11.3--canary.649.23416
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/ReferenceAssetsPlugin.native.js +361 -53
- package/dist/ReferenceAssetsPlugin.native.js.map +1 -1
- package/dist/xlr/ActionAsset.json +2 -2
- package/dist/xlr/ChatMessageAsset.json +1 -1
- package/dist/xlr/ChoiceAsset.json +5 -5
- package/dist/xlr/CollectionAsset.json +1 -1
- package/dist/xlr/ImageAsset.json +2 -2
- package/dist/xlr/InfoAsset.json +1 -1
- package/dist/xlr/InputAsset.json +2 -2
- package/dist/xlr/TextAsset.json +4 -4
- package/package.json +5 -5
|
@@ -1282,6 +1282,48 @@ var ReferenceAssetsPlugin = function() {
|
|
|
1282
1282
|
}
|
|
1283
1283
|
return typeof expr === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
|
|
1284
1284
|
};
|
|
1285
|
+
var isPromiselike = function isPromiselike(value) {
|
|
1286
|
+
var // Check for standard Promise constructor name
|
|
1287
|
+
_value_constructor;
|
|
1288
|
+
return value != null && typeof value === "object" && typeof value.then === "function" && // Additional safeguards against false positives
|
|
1289
|
+
(_instanceof(value, Promise) || ((_value_constructor = value.constructor) === null || _value_constructor === void 0 ? void 0 : _value_constructor.name) === "Promise" || // Verify it has other Promise-like methods to reduce false positives
|
|
1290
|
+
typeof value.catch === "function" && typeof value.finally === "function");
|
|
1291
|
+
};
|
|
1292
|
+
var makePromiseAwareBinaryOp = function makePromiseAwareBinaryOp(operation) {
|
|
1293
|
+
return function(a, b) {
|
|
1294
|
+
if (isPromiselike(a) || isPromiselike(b)) {
|
|
1295
|
+
return Promise.all([
|
|
1296
|
+
Promise.resolve(a),
|
|
1297
|
+
Promise.resolve(b)
|
|
1298
|
+
]).then(function(param) {
|
|
1299
|
+
var _param = _sliced_to_array(param, 2), resolvedA = _param[0], resolvedB = _param[1];
|
|
1300
|
+
return operation(resolvedA, resolvedB);
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
return operation(a, b);
|
|
1304
|
+
};
|
|
1305
|
+
};
|
|
1306
|
+
var makePromiseAwareUnaryOp = function makePromiseAwareUnaryOp(operation) {
|
|
1307
|
+
return function(a) {
|
|
1308
|
+
if (isPromiselike(a)) {
|
|
1309
|
+
return a.then(function(resolved) {
|
|
1310
|
+
return operation(resolved);
|
|
1311
|
+
});
|
|
1312
|
+
}
|
|
1313
|
+
return operation(a);
|
|
1314
|
+
};
|
|
1315
|
+
};
|
|
1316
|
+
var handleConditionalBranching = function handleConditionalBranching(testValue, getTrueBranch, getFalseBranch, resolveNode) {
|
|
1317
|
+
if (isPromiselike(testValue)) {
|
|
1318
|
+
return testValue.then(function(resolved) {
|
|
1319
|
+
var branch2 = resolved ? getTrueBranch() : getFalseBranch();
|
|
1320
|
+
var branchResult = resolveNode(branch2);
|
|
1321
|
+
return isPromiselike(branchResult) ? branchResult : Promise.resolve(branchResult);
|
|
1322
|
+
});
|
|
1323
|
+
}
|
|
1324
|
+
var branch = testValue ? getTrueBranch() : getFalseBranch();
|
|
1325
|
+
return resolveNode(branch);
|
|
1326
|
+
};
|
|
1285
1327
|
var parse2 = function parse2(schema) {
|
|
1286
1328
|
var _loop = function() {
|
|
1287
1329
|
var next = parseQueue.shift();
|
|
@@ -3807,6 +3849,9 @@ var ReferenceAssetsPlugin = function() {
|
|
|
3807
3849
|
},
|
|
3808
3850
|
setDataVal: function() {
|
|
3809
3851
|
return setDataVal;
|
|
3852
|
+
},
|
|
3853
|
+
waitFor: function() {
|
|
3854
|
+
return waitFor;
|
|
3810
3855
|
}
|
|
3811
3856
|
});
|
|
3812
3857
|
var setDataVal = function(_context, binding, value) {
|
|
@@ -3824,8 +3869,19 @@ var ReferenceAssetsPlugin = function() {
|
|
|
3824
3869
|
return _context.model.delete(binding);
|
|
3825
3870
|
};
|
|
3826
3871
|
var conditional = function(ctx, condition, ifTrue, ifFalse) {
|
|
3827
|
-
var
|
|
3828
|
-
if (
|
|
3872
|
+
var testResult = ctx.evaluate(condition);
|
|
3873
|
+
if (_instanceof(testResult, Promise)) {
|
|
3874
|
+
return testResult.then(function(resolvedTest) {
|
|
3875
|
+
if (resolvedTest) {
|
|
3876
|
+
return ctx.evaluate(ifTrue);
|
|
3877
|
+
}
|
|
3878
|
+
if (ifFalse) {
|
|
3879
|
+
return ctx.evaluate(ifFalse);
|
|
3880
|
+
}
|
|
3881
|
+
return null;
|
|
3882
|
+
});
|
|
3883
|
+
}
|
|
3884
|
+
if (testResult) {
|
|
3829
3885
|
return ctx.evaluate(ifTrue);
|
|
3830
3886
|
}
|
|
3831
3887
|
if (ifFalse) {
|
|
@@ -3834,12 +3890,33 @@ var ReferenceAssetsPlugin = function() {
|
|
|
3834
3890
|
return null;
|
|
3835
3891
|
};
|
|
3836
3892
|
conditional.resolveParams = false;
|
|
3893
|
+
var waitFor = function() {
|
|
3894
|
+
var _ref = _async_to_generator(function(ctx, promise) {
|
|
3895
|
+
return _ts_generator(this, function(_state) {
|
|
3896
|
+
switch(_state.label){
|
|
3897
|
+
case 0:
|
|
3898
|
+
return [
|
|
3899
|
+
4,
|
|
3900
|
+
promise
|
|
3901
|
+
];
|
|
3902
|
+
case 1:
|
|
3903
|
+
return [
|
|
3904
|
+
2,
|
|
3905
|
+
_state.sent()
|
|
3906
|
+
];
|
|
3907
|
+
}
|
|
3908
|
+
});
|
|
3909
|
+
});
|
|
3910
|
+
return function waitFor(ctx, promise) {
|
|
3911
|
+
return _ref.apply(this, arguments);
|
|
3912
|
+
};
|
|
3913
|
+
}();
|
|
3837
3914
|
var andandOperator = function(ctx, a, b) {
|
|
3838
|
-
return
|
|
3915
|
+
return LogicalOperators.and(ctx, a, b);
|
|
3839
3916
|
};
|
|
3840
3917
|
andandOperator.resolveParams = false;
|
|
3841
3918
|
var ororOperator = function(ctx, a, b) {
|
|
3842
|
-
return
|
|
3919
|
+
return LogicalOperators.or(ctx, a, b);
|
|
3843
3920
|
};
|
|
3844
3921
|
ororOperator.resolveParams = false;
|
|
3845
3922
|
var DEFAULT_BINARY_OPERATORS = {
|
|
@@ -3859,34 +3936,35 @@ var ReferenceAssetsPlugin = function() {
|
|
|
3859
3936
|
"%": function(a, b) {
|
|
3860
3937
|
return a % b;
|
|
3861
3938
|
},
|
|
3939
|
+
// Promise-aware comparison operators
|
|
3862
3940
|
// eslint-disable-next-line
|
|
3863
|
-
"==": function(a, b) {
|
|
3941
|
+
"==": makePromiseAwareBinaryOp(function(a, b) {
|
|
3864
3942
|
return a == b;
|
|
3865
|
-
},
|
|
3943
|
+
}),
|
|
3866
3944
|
// eslint-disable-next-line
|
|
3867
|
-
"!=": function(a, b) {
|
|
3945
|
+
"!=": makePromiseAwareBinaryOp(function(a, b) {
|
|
3868
3946
|
return a != b;
|
|
3869
|
-
},
|
|
3870
|
-
">": function(a, b) {
|
|
3947
|
+
}),
|
|
3948
|
+
">": makePromiseAwareBinaryOp(function(a, b) {
|
|
3871
3949
|
return a > b;
|
|
3872
|
-
},
|
|
3873
|
-
">=": function(a, b) {
|
|
3950
|
+
}),
|
|
3951
|
+
">=": makePromiseAwareBinaryOp(function(a, b) {
|
|
3874
3952
|
return a >= b;
|
|
3875
|
-
},
|
|
3876
|
-
"<": function(a, b) {
|
|
3953
|
+
}),
|
|
3954
|
+
"<": makePromiseAwareBinaryOp(function(a, b) {
|
|
3877
3955
|
return a < b;
|
|
3878
|
-
},
|
|
3879
|
-
"<=": function(a, b) {
|
|
3956
|
+
}),
|
|
3957
|
+
"<=": makePromiseAwareBinaryOp(function(a, b) {
|
|
3880
3958
|
return a <= b;
|
|
3881
|
-
},
|
|
3882
|
-
"
|
|
3883
|
-
"||": ororOperator,
|
|
3884
|
-
"!==": function(a, b) {
|
|
3959
|
+
}),
|
|
3960
|
+
"!==": makePromiseAwareBinaryOp(function(a, b) {
|
|
3885
3961
|
return a !== b;
|
|
3886
|
-
},
|
|
3887
|
-
"===": function(a, b) {
|
|
3962
|
+
}),
|
|
3963
|
+
"===": makePromiseAwareBinaryOp(function(a, b) {
|
|
3888
3964
|
return a === b;
|
|
3889
|
-
},
|
|
3965
|
+
}),
|
|
3966
|
+
"&&": andandOperator,
|
|
3967
|
+
"||": ororOperator,
|
|
3890
3968
|
// eslint-disable-next-line
|
|
3891
3969
|
"|": function(a, b) {
|
|
3892
3970
|
return a | b;
|
|
@@ -3917,8 +3995,70 @@ var ReferenceAssetsPlugin = function() {
|
|
|
3917
3995
|
"+": function(a) {
|
|
3918
3996
|
return Number(a);
|
|
3919
3997
|
},
|
|
3920
|
-
"!": function(a) {
|
|
3998
|
+
"!": makePromiseAwareUnaryOp(function(a) {
|
|
3921
3999
|
return !a;
|
|
4000
|
+
})
|
|
4001
|
+
};
|
|
4002
|
+
var PromiseCollectionHandler = {
|
|
4003
|
+
/**
|
|
4004
|
+
* Handle array with potential Promise elements
|
|
4005
|
+
*/ handleArray: function handleArray(items) {
|
|
4006
|
+
var hasPromises = items.some(function(item) {
|
|
4007
|
+
return isPromiselike(item);
|
|
4008
|
+
});
|
|
4009
|
+
return hasPromises ? Promise.all(items) : items;
|
|
4010
|
+
},
|
|
4011
|
+
/**
|
|
4012
|
+
* Handle object with potential Promise keys/values
|
|
4013
|
+
*/ handleObject: function handleObject(attributes, resolveNode) {
|
|
4014
|
+
var resolvedAttributes = {};
|
|
4015
|
+
var promises = [];
|
|
4016
|
+
var hasPromises = false;
|
|
4017
|
+
attributes.forEach(function(attr) {
|
|
4018
|
+
var key = resolveNode(attr.key);
|
|
4019
|
+
var value = resolveNode(attr.value);
|
|
4020
|
+
if (isPromiselike(key) || isPromiselike(value)) {
|
|
4021
|
+
hasPromises = true;
|
|
4022
|
+
var keyPromise = Promise.resolve(key);
|
|
4023
|
+
var valuePromise = Promise.resolve(value);
|
|
4024
|
+
promises.push(Promise.all([
|
|
4025
|
+
keyPromise,
|
|
4026
|
+
valuePromise
|
|
4027
|
+
]).then(function(param) {
|
|
4028
|
+
var _param = _sliced_to_array(param, 2), resolvedKey = _param[0], resolvedValue = _param[1];
|
|
4029
|
+
resolvedAttributes[resolvedKey] = resolvedValue;
|
|
4030
|
+
}));
|
|
4031
|
+
} else {
|
|
4032
|
+
resolvedAttributes[key] = value;
|
|
4033
|
+
}
|
|
4034
|
+
});
|
|
4035
|
+
return hasPromises ? Promise.all(promises).then(function() {
|
|
4036
|
+
return resolvedAttributes;
|
|
4037
|
+
}) : resolvedAttributes;
|
|
4038
|
+
}
|
|
4039
|
+
};
|
|
4040
|
+
var LogicalOperators = {
|
|
4041
|
+
and: function(ctx, leftNode, rightNode) {
|
|
4042
|
+
var leftResult = ctx.evaluate(leftNode);
|
|
4043
|
+
if (isPromiselike(leftResult)) {
|
|
4044
|
+
return leftResult.then(function(awaitedLeft) {
|
|
4045
|
+
if (!awaitedLeft) return awaitedLeft;
|
|
4046
|
+
var rightResult = ctx.evaluate(rightNode);
|
|
4047
|
+
return isPromiselike(rightResult) ? rightResult : Promise.resolve(rightResult);
|
|
4048
|
+
});
|
|
4049
|
+
}
|
|
4050
|
+
return leftResult && ctx.evaluate(rightNode);
|
|
4051
|
+
},
|
|
4052
|
+
or: function(ctx, leftNode, rightNode) {
|
|
4053
|
+
var leftResult = ctx.evaluate(leftNode);
|
|
4054
|
+
if (isPromiselike(leftResult)) {
|
|
4055
|
+
return leftResult.then(function(awaitedLeft) {
|
|
4056
|
+
if (awaitedLeft) return awaitedLeft;
|
|
4057
|
+
var rightResult = ctx.evaluate(rightNode);
|
|
4058
|
+
return isPromiselike(rightResult) ? rightResult : Promise.resolve(rightResult);
|
|
4059
|
+
});
|
|
4060
|
+
}
|
|
4061
|
+
return leftResult || ctx.evaluate(rightNode);
|
|
3922
4062
|
}
|
|
3923
4063
|
};
|
|
3924
4064
|
var ExpressionEvaluator = /*#__PURE__*/ function() {
|
|
@@ -3939,7 +4079,12 @@ var ReferenceAssetsPlugin = function() {
|
|
|
3939
4079
|
this.operators = {
|
|
3940
4080
|
binary: new Map(Object.entries(DEFAULT_BINARY_OPERATORS)),
|
|
3941
4081
|
unary: new Map(Object.entries(DEFAULT_UNARY_OPERATORS)),
|
|
3942
|
-
expressions: new Map(Object.entries(evaluator_functions_exports))
|
|
4082
|
+
expressions: new Map(_to_consumable_array(Object.entries(evaluator_functions_exports)).concat([
|
|
4083
|
+
[
|
|
4084
|
+
"await",
|
|
4085
|
+
waitFor
|
|
4086
|
+
]
|
|
4087
|
+
]))
|
|
3943
4088
|
};
|
|
3944
4089
|
this.defaultHookOptions = _object_spread_props(_object_spread({}, defaultOptions), {
|
|
3945
4090
|
evaluate: function(expr) {
|
|
@@ -3949,7 +4094,9 @@ var ReferenceAssetsPlugin = function() {
|
|
|
3949
4094
|
return _this._execAST(node, _this.defaultHookOptions);
|
|
3950
4095
|
}
|
|
3951
4096
|
});
|
|
3952
|
-
this.hooks.resolve.tap("ExpressionEvaluator",
|
|
4097
|
+
this.hooks.resolve.tap("ExpressionEvaluator", function(result, node, options) {
|
|
4098
|
+
return _this._resolveNode(result, node, options);
|
|
4099
|
+
});
|
|
3953
4100
|
this.evaluate = this.evaluate.bind(this);
|
|
3954
4101
|
}
|
|
3955
4102
|
_create_class(ExpressionEvaluator, [
|
|
@@ -3987,6 +4134,14 @@ var ReferenceAssetsPlugin = function() {
|
|
|
3987
4134
|
return this._execString(String(expression), resolvedOpts);
|
|
3988
4135
|
}
|
|
3989
4136
|
},
|
|
4137
|
+
{
|
|
4138
|
+
key: "evaluateAsync",
|
|
4139
|
+
value: function evaluateAsync(expr, options) {
|
|
4140
|
+
return this.evaluate(expr, _object_spread_props(_object_spread({}, options), {
|
|
4141
|
+
async: true
|
|
4142
|
+
}));
|
|
4143
|
+
}
|
|
4144
|
+
},
|
|
3990
4145
|
{
|
|
3991
4146
|
key: "addExpressionFunction",
|
|
3992
4147
|
value: function addExpressionFunction(name, handler) {
|
|
@@ -4032,8 +4187,10 @@ var ReferenceAssetsPlugin = function() {
|
|
|
4032
4187
|
var matches = exp.match(/^@\[(.*)\]@$/);
|
|
4033
4188
|
var matchedExp = exp;
|
|
4034
4189
|
if (matches) {
|
|
4035
|
-
var
|
|
4036
|
-
|
|
4190
|
+
var _Array_from = _sliced_to_array(Array.from(matches), 2), matched = _Array_from[1];
|
|
4191
|
+
if (matched) {
|
|
4192
|
+
matchedExp = matched;
|
|
4193
|
+
}
|
|
4037
4194
|
}
|
|
4038
4195
|
var storedAST;
|
|
4039
4196
|
try {
|
|
@@ -4083,9 +4240,31 @@ var ReferenceAssetsPlugin = function() {
|
|
|
4083
4240
|
if (operator.resolveParams === false) {
|
|
4084
4241
|
return operator(expressionContext, node.left, node.right);
|
|
4085
4242
|
}
|
|
4086
|
-
|
|
4243
|
+
var left2 = resolveNode(node.left);
|
|
4244
|
+
var right2 = resolveNode(node.right);
|
|
4245
|
+
if (isPromiselike(left2) || isPromiselike(right2)) {
|
|
4246
|
+
return Promise.all([
|
|
4247
|
+
left2,
|
|
4248
|
+
right2
|
|
4249
|
+
]).then(function(param) {
|
|
4250
|
+
var _param = _sliced_to_array(param, 2), leftVal = _param[0], rightVal = _param[1];
|
|
4251
|
+
return operator(expressionContext, leftVal, rightVal);
|
|
4252
|
+
});
|
|
4253
|
+
}
|
|
4254
|
+
return operator(expressionContext, left2, right2);
|
|
4255
|
+
}
|
|
4256
|
+
var left = resolveNode(node.left);
|
|
4257
|
+
var right = resolveNode(node.right);
|
|
4258
|
+
if (isPromiselike(left) || isPromiselike(right)) {
|
|
4259
|
+
return Promise.all([
|
|
4260
|
+
left,
|
|
4261
|
+
right
|
|
4262
|
+
]).then(function(param) {
|
|
4263
|
+
var _param = _sliced_to_array(param, 2), leftVal = _param[0], rightVal = _param[1];
|
|
4264
|
+
return operator(leftVal, rightVal);
|
|
4265
|
+
});
|
|
4087
4266
|
}
|
|
4088
|
-
return operator(
|
|
4267
|
+
return operator(left, right);
|
|
4089
4268
|
}
|
|
4090
4269
|
return;
|
|
4091
4270
|
}
|
|
@@ -4093,21 +4272,29 @@ var ReferenceAssetsPlugin = function() {
|
|
|
4093
4272
|
var operator1 = this.operators.unary.get(node.operator);
|
|
4094
4273
|
if (operator1) {
|
|
4095
4274
|
if ("resolveParams" in operator1) {
|
|
4096
|
-
|
|
4275
|
+
if (operator1.resolveParams === false) {
|
|
4276
|
+
return operator1(expressionContext, node.argument);
|
|
4277
|
+
}
|
|
4278
|
+
var arg2 = resolveNode(node.argument);
|
|
4279
|
+
if (isPromiselike(arg2)) {
|
|
4280
|
+
return arg2.then(function(argVal) {
|
|
4281
|
+
return operator1(expressionContext, argVal);
|
|
4282
|
+
});
|
|
4283
|
+
}
|
|
4284
|
+
return operator1(expressionContext, arg2);
|
|
4285
|
+
}
|
|
4286
|
+
var arg = resolveNode(node.argument);
|
|
4287
|
+
if (isPromiselike(arg)) {
|
|
4288
|
+
return arg.then(function(argVal) {
|
|
4289
|
+
return operator1(argVal);
|
|
4290
|
+
});
|
|
4097
4291
|
}
|
|
4098
|
-
return operator1(
|
|
4292
|
+
return operator1(arg);
|
|
4099
4293
|
}
|
|
4100
4294
|
return;
|
|
4101
4295
|
}
|
|
4102
4296
|
if (node.type === "Object") {
|
|
4103
|
-
|
|
4104
|
-
var resolvedAttributes = {};
|
|
4105
|
-
attributes.forEach(function(attr) {
|
|
4106
|
-
var key = resolveNode(attr.key);
|
|
4107
|
-
var value = resolveNode(attr.value);
|
|
4108
|
-
resolvedAttributes[key] = value;
|
|
4109
|
-
});
|
|
4110
|
-
return resolvedAttributes;
|
|
4297
|
+
return PromiseCollectionHandler.handleObject(node.attributes, resolveNode);
|
|
4111
4298
|
}
|
|
4112
4299
|
if (node.type === "CallExpression") {
|
|
4113
4300
|
var expressionName = node.callTarget.name;
|
|
@@ -4123,6 +4310,14 @@ var ReferenceAssetsPlugin = function() {
|
|
|
4123
4310
|
var args = node.args.map(function(n) {
|
|
4124
4311
|
return resolveNode(n);
|
|
4125
4312
|
});
|
|
4313
|
+
var hasPromises = args.some(isPromiselike);
|
|
4314
|
+
if (hasPromises) {
|
|
4315
|
+
return Promise.all(args).then(function(resolvedArgs) {
|
|
4316
|
+
return operator2.apply(void 0, [
|
|
4317
|
+
expressionContext
|
|
4318
|
+
].concat(_to_consumable_array(resolvedArgs)));
|
|
4319
|
+
});
|
|
4320
|
+
}
|
|
4126
4321
|
return operator2.apply(void 0, [
|
|
4127
4322
|
expressionContext
|
|
4128
4323
|
].concat(_to_consumable_array(args)));
|
|
@@ -4137,11 +4332,31 @@ var ReferenceAssetsPlugin = function() {
|
|
|
4137
4332
|
if (node.type === "MemberExpression") {
|
|
4138
4333
|
var obj = resolveNode(node.object);
|
|
4139
4334
|
var prop = resolveNode(node.property);
|
|
4335
|
+
if (isPromiselike(obj) || isPromiselike(prop)) {
|
|
4336
|
+
return Promise.all([
|
|
4337
|
+
obj,
|
|
4338
|
+
prop
|
|
4339
|
+
]).then(function(param) {
|
|
4340
|
+
var _param = _sliced_to_array(param, 2), objVal = _param[0], propVal = _param[1];
|
|
4341
|
+
return objVal[propVal];
|
|
4342
|
+
});
|
|
4343
|
+
}
|
|
4140
4344
|
return obj[prop];
|
|
4141
4345
|
}
|
|
4142
4346
|
if (node.type === "Assignment") {
|
|
4143
4347
|
if (node.left.type === "ModelRef") {
|
|
4144
4348
|
var value = resolveNode(node.right);
|
|
4349
|
+
if (isPromiselike(value)) {
|
|
4350
|
+
return value.then(function(resolvedValue) {
|
|
4351
|
+
model.set([
|
|
4352
|
+
[
|
|
4353
|
+
node.left.ref,
|
|
4354
|
+
resolvedValue
|
|
4355
|
+
]
|
|
4356
|
+
]);
|
|
4357
|
+
return resolvedValue;
|
|
4358
|
+
});
|
|
4359
|
+
}
|
|
4145
4360
|
model.set([
|
|
4146
4361
|
[
|
|
4147
4362
|
node.left.ref,
|
|
@@ -4152,19 +4367,30 @@ var ReferenceAssetsPlugin = function() {
|
|
|
4152
4367
|
}
|
|
4153
4368
|
if (node.left.type === "Identifier") {
|
|
4154
4369
|
var value1 = resolveNode(node.right);
|
|
4370
|
+
if (isPromiselike(value1)) {
|
|
4371
|
+
return value1.then(function(resolvedValue) {
|
|
4372
|
+
_this.vars[node.left.name] = resolvedValue;
|
|
4373
|
+
return resolvedValue;
|
|
4374
|
+
});
|
|
4375
|
+
}
|
|
4155
4376
|
this.vars[node.left.name] = value1;
|
|
4156
4377
|
return value1;
|
|
4157
4378
|
}
|
|
4158
4379
|
return;
|
|
4159
4380
|
}
|
|
4160
4381
|
if (node.type === "ConditionalExpression") {
|
|
4161
|
-
var
|
|
4162
|
-
return
|
|
4382
|
+
var testResult = resolveNode(node.test);
|
|
4383
|
+
return handleConditionalBranching(testResult, function() {
|
|
4384
|
+
return node.consequent;
|
|
4385
|
+
}, function() {
|
|
4386
|
+
return node.alternate;
|
|
4387
|
+
}, resolveNode);
|
|
4163
4388
|
}
|
|
4164
4389
|
if (node.type === "ArrayExpression") {
|
|
4165
|
-
|
|
4390
|
+
var results = node.elements.map(function(ele) {
|
|
4166
4391
|
return resolveNode(ele);
|
|
4167
4392
|
});
|
|
4393
|
+
return PromiseCollectionHandler.handleArray(results);
|
|
4168
4394
|
}
|
|
4169
4395
|
if (node.type === "Modification") {
|
|
4170
4396
|
var operation = this.operators.binary.get(node.operator);
|
|
@@ -4174,12 +4400,47 @@ var ReferenceAssetsPlugin = function() {
|
|
|
4174
4400
|
if (operation.resolveParams === false) {
|
|
4175
4401
|
newValue = operation(expressionContext, node.left, node.right);
|
|
4176
4402
|
} else {
|
|
4177
|
-
|
|
4403
|
+
var left1 = resolveNode(node.left);
|
|
4404
|
+
var right1 = resolveNode(node.right);
|
|
4405
|
+
if (isPromiselike(left1) || isPromiselike(right1)) {
|
|
4406
|
+
newValue = Promise.all([
|
|
4407
|
+
left1,
|
|
4408
|
+
right1
|
|
4409
|
+
]).then(function(param) {
|
|
4410
|
+
var _param = _sliced_to_array(param, 2), leftVal = _param[0], rightVal = _param[1];
|
|
4411
|
+
return operation(expressionContext, leftVal, rightVal);
|
|
4412
|
+
});
|
|
4413
|
+
} else {
|
|
4414
|
+
newValue = operation(expressionContext, left1, right1);
|
|
4415
|
+
}
|
|
4178
4416
|
}
|
|
4179
4417
|
} else {
|
|
4180
|
-
|
|
4418
|
+
var left3 = resolveNode(node.left);
|
|
4419
|
+
var right3 = resolveNode(node.right);
|
|
4420
|
+
if (isPromiselike(left3) || isPromiselike(right3)) {
|
|
4421
|
+
newValue = Promise.all([
|
|
4422
|
+
left3,
|
|
4423
|
+
right3
|
|
4424
|
+
]).then(function(param) {
|
|
4425
|
+
var _param = _sliced_to_array(param, 2), leftVal = _param[0], rightVal = _param[1];
|
|
4426
|
+
return operation(leftVal, rightVal);
|
|
4427
|
+
});
|
|
4428
|
+
} else {
|
|
4429
|
+
newValue = operation(left3, right3);
|
|
4430
|
+
}
|
|
4181
4431
|
}
|
|
4182
4432
|
if (node.left.type === "ModelRef") {
|
|
4433
|
+
if (isPromiselike(newValue)) {
|
|
4434
|
+
return newValue.then(function(resolvedValue) {
|
|
4435
|
+
model.set([
|
|
4436
|
+
[
|
|
4437
|
+
node.left.ref,
|
|
4438
|
+
resolvedValue
|
|
4439
|
+
]
|
|
4440
|
+
]);
|
|
4441
|
+
return resolvedValue;
|
|
4442
|
+
});
|
|
4443
|
+
}
|
|
4183
4444
|
model.set([
|
|
4184
4445
|
[
|
|
4185
4446
|
node.left.ref,
|
|
@@ -4187,6 +4448,12 @@ var ReferenceAssetsPlugin = function() {
|
|
|
4187
4448
|
]
|
|
4188
4449
|
]);
|
|
4189
4450
|
} else if (node.left.type === "Identifier") {
|
|
4451
|
+
if (isPromiselike(newValue)) {
|
|
4452
|
+
return newValue.then(function(resolvedValue) {
|
|
4453
|
+
_this.vars[node.left.name] = resolvedValue;
|
|
4454
|
+
return resolvedValue;
|
|
4455
|
+
});
|
|
4456
|
+
}
|
|
4190
4457
|
this.vars[node.left.name] = newValue;
|
|
4191
4458
|
}
|
|
4192
4459
|
return newValue;
|
|
@@ -7745,15 +8012,56 @@ var ReferenceAssetsPlugin = function() {
|
|
|
7745
8012
|
validationController.reset();
|
|
7746
8013
|
}
|
|
7747
8014
|
});
|
|
7748
|
-
flow.hooks.afterTransition.tap("player", function(
|
|
7749
|
-
var
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7754
|
-
|
|
7755
|
-
|
|
7756
|
-
|
|
8015
|
+
flow.hooks.afterTransition.tap("player", function() {
|
|
8016
|
+
var _ref = _async_to_generator(function(flowInstance) {
|
|
8017
|
+
var _flowInstance_currentState, value, exp, result, e;
|
|
8018
|
+
return _ts_generator(this, function(_state) {
|
|
8019
|
+
switch(_state.label){
|
|
8020
|
+
case 0:
|
|
8021
|
+
value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
|
|
8022
|
+
if (!(value && value.state_type === "ACTION")) return [
|
|
8023
|
+
3,
|
|
8024
|
+
4
|
|
8025
|
+
];
|
|
8026
|
+
exp = value.exp;
|
|
8027
|
+
_state.label = 1;
|
|
8028
|
+
case 1:
|
|
8029
|
+
_state.trys.push([
|
|
8030
|
+
1,
|
|
8031
|
+
3,
|
|
8032
|
+
,
|
|
8033
|
+
4
|
|
8034
|
+
]);
|
|
8035
|
+
return [
|
|
8036
|
+
4,
|
|
8037
|
+
expressionEvaluator.evaluateAsync(exp)
|
|
8038
|
+
];
|
|
8039
|
+
case 2:
|
|
8040
|
+
result = _state.sent();
|
|
8041
|
+
flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
|
|
8042
|
+
return [
|
|
8043
|
+
3,
|
|
8044
|
+
4
|
|
8045
|
+
];
|
|
8046
|
+
case 3:
|
|
8047
|
+
e = _state.sent();
|
|
8048
|
+
flowResultDeferred.reject(e);
|
|
8049
|
+
return [
|
|
8050
|
+
3,
|
|
8051
|
+
4
|
|
8052
|
+
];
|
|
8053
|
+
case 4:
|
|
8054
|
+
expressionEvaluator.reset();
|
|
8055
|
+
return [
|
|
8056
|
+
2
|
|
8057
|
+
];
|
|
8058
|
+
}
|
|
8059
|
+
});
|
|
8060
|
+
});
|
|
8061
|
+
return function(flowInstance) {
|
|
8062
|
+
return _ref.apply(this, arguments);
|
|
8063
|
+
};
|
|
8064
|
+
}());
|
|
7757
8065
|
});
|
|
7758
8066
|
this.hooks.dataController.call(dataController);
|
|
7759
8067
|
validationController.setOptions({
|