@player-ui/common-types-plugin 0.11.3--canary.660.23339 → 0.11.3--canary.649.23399

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.
@@ -1190,6 +1190,48 @@ var CommonTypesPlugin = function() {
1190
1190
  }
1191
1191
  return typeof expr === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
1192
1192
  };
1193
+ var isPromiselike = function isPromiselike(value) {
1194
+ var // Check for standard Promise constructor name
1195
+ _value_constructor;
1196
+ return value != null && typeof value === "object" && typeof value.then === "function" && // Additional safeguards against false positives
1197
+ (_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
1198
+ typeof value.catch === "function" && typeof value.finally === "function");
1199
+ };
1200
+ var makePromiseAwareBinaryOp = function makePromiseAwareBinaryOp(operation) {
1201
+ return function(a, b) {
1202
+ if (isPromiselike(a) || isPromiselike(b)) {
1203
+ return Promise.all([
1204
+ Promise.resolve(a),
1205
+ Promise.resolve(b)
1206
+ ]).then(function(param) {
1207
+ var _param = _sliced_to_array(param, 2), resolvedA = _param[0], resolvedB = _param[1];
1208
+ return operation(resolvedA, resolvedB);
1209
+ });
1210
+ }
1211
+ return operation(a, b);
1212
+ };
1213
+ };
1214
+ var makePromiseAwareUnaryOp = function makePromiseAwareUnaryOp(operation) {
1215
+ return function(a) {
1216
+ if (isPromiselike(a)) {
1217
+ return a.then(function(resolved) {
1218
+ return operation(resolved);
1219
+ });
1220
+ }
1221
+ return operation(a);
1222
+ };
1223
+ };
1224
+ var handleConditionalBranching = function handleConditionalBranching(testValue, getTrueBranch, getFalseBranch, resolveNode) {
1225
+ if (isPromiselike(testValue)) {
1226
+ return testValue.then(function(resolved) {
1227
+ var branch2 = resolved ? getTrueBranch() : getFalseBranch();
1228
+ var branchResult = resolveNode(branch2);
1229
+ return isPromiselike(branchResult) ? branchResult : Promise.resolve(branchResult);
1230
+ });
1231
+ }
1232
+ var branch = testValue ? getTrueBranch() : getFalseBranch();
1233
+ return resolveNode(branch);
1234
+ };
1193
1235
  var parse2 = function parse2(schema) {
1194
1236
  var _loop = function() {
1195
1237
  var next = parseQueue.shift();
@@ -3626,6 +3668,9 @@ var CommonTypesPlugin = function() {
3626
3668
  },
3627
3669
  setDataVal: function() {
3628
3670
  return setDataVal;
3671
+ },
3672
+ waitFor: function() {
3673
+ return waitFor;
3629
3674
  }
3630
3675
  });
3631
3676
  var setDataVal = function(_context, binding, value) {
@@ -3653,12 +3698,33 @@ var CommonTypesPlugin = function() {
3653
3698
  return null;
3654
3699
  };
3655
3700
  conditional.resolveParams = false;
3701
+ var waitFor = function() {
3702
+ var _ref = _async_to_generator(function(ctx, promise) {
3703
+ return _ts_generator(this, function(_state) {
3704
+ switch(_state.label){
3705
+ case 0:
3706
+ return [
3707
+ 4,
3708
+ promise
3709
+ ];
3710
+ case 1:
3711
+ return [
3712
+ 2,
3713
+ _state.sent()
3714
+ ];
3715
+ }
3716
+ });
3717
+ });
3718
+ return function waitFor(ctx, promise) {
3719
+ return _ref.apply(this, arguments);
3720
+ };
3721
+ }();
3656
3722
  var andandOperator = function(ctx, a, b) {
3657
- return ctx.evaluate(a) && ctx.evaluate(b);
3723
+ return LogicalOperators.and(ctx, a, b);
3658
3724
  };
3659
3725
  andandOperator.resolveParams = false;
3660
3726
  var ororOperator = function(ctx, a, b) {
3661
- return ctx.evaluate(a) || ctx.evaluate(b);
3727
+ return LogicalOperators.or(ctx, a, b);
3662
3728
  };
3663
3729
  ororOperator.resolveParams = false;
3664
3730
  var DEFAULT_BINARY_OPERATORS = {
@@ -3678,34 +3744,35 @@ var CommonTypesPlugin = function() {
3678
3744
  "%": function(a, b) {
3679
3745
  return a % b;
3680
3746
  },
3747
+ // Promise-aware comparison operators
3681
3748
  // eslint-disable-next-line
3682
- "==": function(a, b) {
3749
+ "==": makePromiseAwareBinaryOp(function(a, b) {
3683
3750
  return a == b;
3684
- },
3751
+ }),
3685
3752
  // eslint-disable-next-line
3686
- "!=": function(a, b) {
3753
+ "!=": makePromiseAwareBinaryOp(function(a, b) {
3687
3754
  return a != b;
3688
- },
3689
- ">": function(a, b) {
3755
+ }),
3756
+ ">": makePromiseAwareBinaryOp(function(a, b) {
3690
3757
  return a > b;
3691
- },
3692
- ">=": function(a, b) {
3758
+ }),
3759
+ ">=": makePromiseAwareBinaryOp(function(a, b) {
3693
3760
  return a >= b;
3694
- },
3695
- "<": function(a, b) {
3761
+ }),
3762
+ "<": makePromiseAwareBinaryOp(function(a, b) {
3696
3763
  return a < b;
3697
- },
3698
- "<=": function(a, b) {
3764
+ }),
3765
+ "<=": makePromiseAwareBinaryOp(function(a, b) {
3699
3766
  return a <= b;
3700
- },
3701
- "&&": andandOperator,
3702
- "||": ororOperator,
3703
- "!==": function(a, b) {
3767
+ }),
3768
+ "!==": makePromiseAwareBinaryOp(function(a, b) {
3704
3769
  return a !== b;
3705
- },
3706
- "===": function(a, b) {
3770
+ }),
3771
+ "===": makePromiseAwareBinaryOp(function(a, b) {
3707
3772
  return a === b;
3708
- },
3773
+ }),
3774
+ "&&": andandOperator,
3775
+ "||": ororOperator,
3709
3776
  // eslint-disable-next-line
3710
3777
  "|": function(a, b) {
3711
3778
  return a | b;
@@ -3736,8 +3803,70 @@ var CommonTypesPlugin = function() {
3736
3803
  "+": function(a) {
3737
3804
  return Number(a);
3738
3805
  },
3739
- "!": function(a) {
3806
+ "!": makePromiseAwareUnaryOp(function(a) {
3740
3807
  return !a;
3808
+ })
3809
+ };
3810
+ var PromiseCollectionHandler = {
3811
+ /**
3812
+ * Handle array with potential Promise elements
3813
+ */ handleArray: function handleArray(items) {
3814
+ var hasPromises = items.some(function(item) {
3815
+ return isPromiselike(item);
3816
+ });
3817
+ return hasPromises ? Promise.all(items) : items;
3818
+ },
3819
+ /**
3820
+ * Handle object with potential Promise keys/values
3821
+ */ handleObject: function handleObject(attributes, resolveNode) {
3822
+ var resolvedAttributes = {};
3823
+ var promises = [];
3824
+ var hasPromises = false;
3825
+ attributes.forEach(function(attr) {
3826
+ var key = resolveNode(attr.key);
3827
+ var value = resolveNode(attr.value);
3828
+ if (isPromiselike(key) || isPromiselike(value)) {
3829
+ hasPromises = true;
3830
+ var keyPromise = Promise.resolve(key);
3831
+ var valuePromise = Promise.resolve(value);
3832
+ promises.push(Promise.all([
3833
+ keyPromise,
3834
+ valuePromise
3835
+ ]).then(function(param) {
3836
+ var _param = _sliced_to_array(param, 2), resolvedKey = _param[0], resolvedValue = _param[1];
3837
+ resolvedAttributes[resolvedKey] = resolvedValue;
3838
+ }));
3839
+ } else {
3840
+ resolvedAttributes[key] = value;
3841
+ }
3842
+ });
3843
+ return hasPromises ? Promise.all(promises).then(function() {
3844
+ return resolvedAttributes;
3845
+ }) : resolvedAttributes;
3846
+ }
3847
+ };
3848
+ var LogicalOperators = {
3849
+ and: function(ctx, leftNode, rightNode) {
3850
+ var leftResult = ctx.evaluate(leftNode);
3851
+ if (isPromiselike(leftResult)) {
3852
+ return leftResult.then(function(awaitedLeft) {
3853
+ if (!awaitedLeft) return awaitedLeft;
3854
+ var rightResult = ctx.evaluate(rightNode);
3855
+ return isPromiselike(rightResult) ? rightResult : Promise.resolve(rightResult);
3856
+ });
3857
+ }
3858
+ return leftResult && ctx.evaluate(rightNode);
3859
+ },
3860
+ or: function(ctx, leftNode, rightNode) {
3861
+ var leftResult = ctx.evaluate(leftNode);
3862
+ if (isPromiselike(leftResult)) {
3863
+ return leftResult.then(function(awaitedLeft) {
3864
+ if (awaitedLeft) return awaitedLeft;
3865
+ var rightResult = ctx.evaluate(rightNode);
3866
+ return isPromiselike(rightResult) ? rightResult : Promise.resolve(rightResult);
3867
+ });
3868
+ }
3869
+ return leftResult || ctx.evaluate(rightNode);
3741
3870
  }
3742
3871
  };
3743
3872
  var ExpressionEvaluator = /*#__PURE__*/ function() {
@@ -3758,7 +3887,12 @@ var CommonTypesPlugin = function() {
3758
3887
  this.operators = {
3759
3888
  binary: new Map(Object.entries(DEFAULT_BINARY_OPERATORS)),
3760
3889
  unary: new Map(Object.entries(DEFAULT_UNARY_OPERATORS)),
3761
- expressions: new Map(Object.entries(evaluator_functions_exports))
3890
+ expressions: new Map(_to_consumable_array(Object.entries(evaluator_functions_exports)).concat([
3891
+ [
3892
+ "await",
3893
+ waitFor
3894
+ ]
3895
+ ]))
3762
3896
  };
3763
3897
  this.defaultHookOptions = _object_spread_props(_object_spread({}, defaultOptions), {
3764
3898
  evaluate: function(expr) {
@@ -3768,7 +3902,12 @@ var CommonTypesPlugin = function() {
3768
3902
  return _this._execAST(node, _this.defaultHookOptions);
3769
3903
  }
3770
3904
  });
3771
- this.hooks.resolve.tap("ExpressionEvaluator", this._resolveNode.bind(this));
3905
+ this.hooks.resolve.tap("ExpressionEvaluator", function(result, node, options) {
3906
+ if (options.async) {
3907
+ return _this._resolveNodeAsync(result, node, options);
3908
+ }
3909
+ return _this._resolveNode(result, node, options);
3910
+ });
3772
3911
  this.evaluate = this.evaluate.bind(this);
3773
3912
  }
3774
3913
  _create_class(ExpressionEvaluator, [
@@ -3806,6 +3945,14 @@ var CommonTypesPlugin = function() {
3806
3945
  return this._execString(String(expression2), resolvedOpts);
3807
3946
  }
3808
3947
  },
3948
+ {
3949
+ key: "evaluateAsync",
3950
+ value: function evaluateAsync(expr, options) {
3951
+ return this.evaluate(expr, _object_spread_props(_object_spread({}, options), {
3952
+ async: true
3953
+ }));
3954
+ }
3955
+ },
3809
3956
  {
3810
3957
  key: "addExpressionFunction",
3811
3958
  value: function addExpressionFunction(name, handler) {
@@ -3851,8 +3998,10 @@ var CommonTypesPlugin = function() {
3851
3998
  var matches = exp.match(/^@\[(.*)\]@$/);
3852
3999
  var matchedExp = exp;
3853
4000
  if (matches) {
3854
- var ref;
3855
- ref = _sliced_to_array(Array.from(matches), 2), matchedExp = ref[1], ref;
4001
+ var _Array_from = _sliced_to_array(Array.from(matches), 2), matched = _Array_from[1];
4002
+ if (matched) {
4003
+ matchedExp = matched;
4004
+ }
3856
4005
  }
3857
4006
  var storedAST;
3858
4007
  try {
@@ -3919,14 +4068,7 @@ var CommonTypesPlugin = function() {
3919
4068
  return;
3920
4069
  }
3921
4070
  if (node.type === "Object") {
3922
- var attributes = node.attributes;
3923
- var resolvedAttributes = {};
3924
- attributes.forEach(function(attr) {
3925
- var key = resolveNode(attr.key);
3926
- var value = resolveNode(attr.value);
3927
- resolvedAttributes[key] = value;
3928
- });
3929
- return resolvedAttributes;
4071
+ return PromiseCollectionHandler.handleObject(node.attributes, resolveNode);
3930
4072
  }
3931
4073
  if (node.type === "CallExpression") {
3932
4074
  var expressionName = node.callTarget.name;
@@ -3977,13 +4119,18 @@ var CommonTypesPlugin = function() {
3977
4119
  return;
3978
4120
  }
3979
4121
  if (node.type === "ConditionalExpression") {
3980
- var result = resolveNode(node.test) ? node.consequent : node.alternate;
3981
- return resolveNode(result);
4122
+ var testResult = resolveNode(node.test);
4123
+ return handleConditionalBranching(testResult, function() {
4124
+ return node.consequent;
4125
+ }, function() {
4126
+ return node.alternate;
4127
+ }, resolveNode);
3982
4128
  }
3983
4129
  if (node.type === "ArrayExpression") {
3984
- return node.elements.map(function(ele) {
4130
+ var results = node.elements.map(function(ele) {
3985
4131
  return resolveNode(ele);
3986
4132
  });
4133
+ return PromiseCollectionHandler.handleArray(results);
3987
4134
  }
3988
4135
  if (node.type === "Modification") {
3989
4136
  var operation = this.operators.binary.get(node.operator);
@@ -4013,6 +4160,459 @@ var CommonTypesPlugin = function() {
4013
4160
  return resolveNode(node.left);
4014
4161
  }
4015
4162
  }
4163
+ },
4164
+ {
4165
+ key: "_resolveNodeAsync",
4166
+ value: function _resolveNodeAsync(_currentValue, node, options) {
4167
+ var _this = this;
4168
+ return _async_to_generator(function() {
4169
+ var resolveNode, model, expressionContext, operator, _tmp, _tmp1, operator1, _tmp2, _tmp3, attributes, resolvedAttributes, expressionName, operator2, args, obj, prop, value, value1, testResult, result, branchResult, operation, newValue, _tmp4, _tmp5;
4170
+ return _ts_generator(this, function(_state) {
4171
+ switch(_state.label){
4172
+ case 0:
4173
+ resolveNode = options.resolveNode, model = options.model;
4174
+ expressionContext = _object_spread_props(_object_spread({}, options), {
4175
+ evaluate: function(expr) {
4176
+ return _this.evaluate(expr, options);
4177
+ }
4178
+ });
4179
+ if (!(node.type === "BinaryExpression" || node.type === "LogicalExpression")) return [
4180
+ 3,
4181
+ 7
4182
+ ];
4183
+ operator = _this.operators.binary.get(node.operator);
4184
+ if (!operator) return [
4185
+ 3,
4186
+ 6
4187
+ ];
4188
+ if (!("resolveParams" in operator)) return [
4189
+ 3,
4190
+ 3
4191
+ ];
4192
+ if (operator.resolveParams === false) {
4193
+ return [
4194
+ 2,
4195
+ operator(expressionContext, node.left, node.right)
4196
+ ];
4197
+ }
4198
+ _tmp = [
4199
+ expressionContext
4200
+ ];
4201
+ return [
4202
+ 4,
4203
+ resolveNode(node.left)
4204
+ ];
4205
+ case 1:
4206
+ _tmp = _tmp.concat([
4207
+ _state.sent()
4208
+ ]);
4209
+ return [
4210
+ 4,
4211
+ resolveNode(node.right)
4212
+ ];
4213
+ case 2:
4214
+ return [
4215
+ 2,
4216
+ operator.apply(void 0, _tmp.concat([
4217
+ _state.sent()
4218
+ ]))
4219
+ ];
4220
+ case 3:
4221
+ return [
4222
+ 4,
4223
+ resolveNode(node.left)
4224
+ ];
4225
+ case 4:
4226
+ _tmp1 = [
4227
+ _state.sent()
4228
+ ];
4229
+ return [
4230
+ 4,
4231
+ resolveNode(node.right)
4232
+ ];
4233
+ case 5:
4234
+ return [
4235
+ 2,
4236
+ operator.apply(void 0, _tmp1.concat([
4237
+ _state.sent()
4238
+ ]))
4239
+ ];
4240
+ case 6:
4241
+ return [
4242
+ 2
4243
+ ];
4244
+ case 7:
4245
+ if (!(node.type === "UnaryExpression")) return [
4246
+ 3,
4247
+ 14
4248
+ ];
4249
+ operator1 = _this.operators.unary.get(node.operator);
4250
+ if (!operator1) return [
4251
+ 3,
4252
+ 13
4253
+ ];
4254
+ if (!("resolveParams" in operator1)) return [
4255
+ 3,
4256
+ 11
4257
+ ];
4258
+ _tmp2 = [
4259
+ expressionContext
4260
+ ];
4261
+ if (!(operator1.resolveParams === false)) return [
4262
+ 3,
4263
+ 8
4264
+ ];
4265
+ _tmp3 = node.argument;
4266
+ return [
4267
+ 3,
4268
+ 10
4269
+ ];
4270
+ case 8:
4271
+ return [
4272
+ 4,
4273
+ resolveNode(node.argument)
4274
+ ];
4275
+ case 9:
4276
+ _tmp3 = _state.sent();
4277
+ _state.label = 10;
4278
+ case 10:
4279
+ return [
4280
+ 2,
4281
+ operator1.apply(void 0, _tmp2.concat([
4282
+ _tmp3
4283
+ ]))
4284
+ ];
4285
+ case 11:
4286
+ return [
4287
+ 4,
4288
+ resolveNode(node.argument)
4289
+ ];
4290
+ case 12:
4291
+ return [
4292
+ 2,
4293
+ operator1.apply(void 0, [
4294
+ _state.sent()
4295
+ ])
4296
+ ];
4297
+ case 13:
4298
+ return [
4299
+ 2
4300
+ ];
4301
+ case 14:
4302
+ if (!(node.type === "Object")) return [
4303
+ 3,
4304
+ 16
4305
+ ];
4306
+ attributes = node.attributes;
4307
+ resolvedAttributes = {};
4308
+ return [
4309
+ 4,
4310
+ Promise.all(attributes.map(function() {
4311
+ var _ref = _async_to_generator(function(attr) {
4312
+ var key, value;
4313
+ return _ts_generator(this, function(_state) {
4314
+ switch(_state.label){
4315
+ case 0:
4316
+ return [
4317
+ 4,
4318
+ resolveNode(attr.key)
4319
+ ];
4320
+ case 1:
4321
+ key = _state.sent();
4322
+ return [
4323
+ 4,
4324
+ resolveNode(attr.value)
4325
+ ];
4326
+ case 2:
4327
+ value = _state.sent();
4328
+ resolvedAttributes[key] = value;
4329
+ return [
4330
+ 2
4331
+ ];
4332
+ }
4333
+ });
4334
+ });
4335
+ return function(attr) {
4336
+ return _ref.apply(this, arguments);
4337
+ };
4338
+ }()))
4339
+ ];
4340
+ case 15:
4341
+ _state.sent();
4342
+ return [
4343
+ 2,
4344
+ resolvedAttributes
4345
+ ];
4346
+ case 16:
4347
+ if (!(node.type === "CallExpression")) return [
4348
+ 3,
4349
+ 18
4350
+ ];
4351
+ expressionName = node.callTarget.name;
4352
+ operator2 = _this.operators.expressions.get(expressionName);
4353
+ if (!operator2) {
4354
+ throw new Error("Unknown expression function: ".concat(expressionName));
4355
+ }
4356
+ if ("resolveParams" in operator2 && operator2.resolveParams === false) {
4357
+ return [
4358
+ 2,
4359
+ operator2.apply(void 0, [
4360
+ expressionContext
4361
+ ].concat(_to_consumable_array(node.args)))
4362
+ ];
4363
+ }
4364
+ return [
4365
+ 4,
4366
+ Promise.all(node.args.map(function() {
4367
+ var _ref = _async_to_generator(function(n) {
4368
+ return _ts_generator(this, function(_state) {
4369
+ switch(_state.label){
4370
+ case 0:
4371
+ return [
4372
+ 4,
4373
+ resolveNode(n)
4374
+ ];
4375
+ case 1:
4376
+ return [
4377
+ 2,
4378
+ _state.sent()
4379
+ ];
4380
+ }
4381
+ });
4382
+ });
4383
+ return function(n) {
4384
+ return _ref.apply(this, arguments);
4385
+ };
4386
+ }()))
4387
+ ];
4388
+ case 17:
4389
+ args = _state.sent();
4390
+ return [
4391
+ 2,
4392
+ operator2.apply(void 0, [
4393
+ expressionContext
4394
+ ].concat(_to_consumable_array(args)))
4395
+ ];
4396
+ case 18:
4397
+ if (node.type === "ModelRef") {
4398
+ return [
4399
+ 2,
4400
+ model.get(node.ref, {
4401
+ context: {
4402
+ model: options.model
4403
+ }
4404
+ })
4405
+ ];
4406
+ }
4407
+ if (!(node.type === "MemberExpression")) return [
4408
+ 3,
4409
+ 21
4410
+ ];
4411
+ return [
4412
+ 4,
4413
+ resolveNode(node.object)
4414
+ ];
4415
+ case 19:
4416
+ obj = _state.sent();
4417
+ return [
4418
+ 4,
4419
+ resolveNode(node.property)
4420
+ ];
4421
+ case 20:
4422
+ prop = _state.sent();
4423
+ return [
4424
+ 2,
4425
+ obj[prop]
4426
+ ];
4427
+ case 21:
4428
+ if (!(node.type === "Assignment")) return [
4429
+ 3,
4430
+ 26
4431
+ ];
4432
+ if (!(node.left.type === "ModelRef")) return [
4433
+ 3,
4434
+ 23
4435
+ ];
4436
+ return [
4437
+ 4,
4438
+ resolveNode(node.right)
4439
+ ];
4440
+ case 22:
4441
+ value = _state.sent();
4442
+ model.set([
4443
+ [
4444
+ node.left.ref,
4445
+ value
4446
+ ]
4447
+ ]);
4448
+ return [
4449
+ 2,
4450
+ value
4451
+ ];
4452
+ case 23:
4453
+ if (!(node.left.type === "Identifier")) return [
4454
+ 3,
4455
+ 25
4456
+ ];
4457
+ return [
4458
+ 4,
4459
+ resolveNode(node.right)
4460
+ ];
4461
+ case 24:
4462
+ value1 = _state.sent();
4463
+ _this.vars[node.left.name] = value1;
4464
+ return [
4465
+ 2,
4466
+ value1
4467
+ ];
4468
+ case 25:
4469
+ return [
4470
+ 2
4471
+ ];
4472
+ case 26:
4473
+ if (!(node.type === "ConditionalExpression")) return [
4474
+ 3,
4475
+ 29
4476
+ ];
4477
+ return [
4478
+ 4,
4479
+ resolveNode(node.test)
4480
+ ];
4481
+ case 27:
4482
+ testResult = _state.sent();
4483
+ result = testResult ? node.consequent : node.alternate;
4484
+ return [
4485
+ 4,
4486
+ resolveNode(result)
4487
+ ];
4488
+ case 28:
4489
+ branchResult = _state.sent();
4490
+ return [
4491
+ 2,
4492
+ branchResult
4493
+ ];
4494
+ case 29:
4495
+ if (node.type === "ArrayExpression") {
4496
+ return [
4497
+ 2,
4498
+ Promise.all(node.elements.map(function() {
4499
+ var _ref = _async_to_generator(function(ele) {
4500
+ return _ts_generator(this, function(_state) {
4501
+ switch(_state.label){
4502
+ case 0:
4503
+ return [
4504
+ 4,
4505
+ resolveNode(ele)
4506
+ ];
4507
+ case 1:
4508
+ return [
4509
+ 2,
4510
+ _state.sent()
4511
+ ];
4512
+ }
4513
+ });
4514
+ });
4515
+ return function(ele) {
4516
+ return _ref.apply(this, arguments);
4517
+ };
4518
+ }()))
4519
+ ];
4520
+ }
4521
+ if (!(node.type === "Modification")) return [
4522
+ 3,
4523
+ 39
4524
+ ];
4525
+ operation = _this.operators.binary.get(node.operator);
4526
+ if (!operation) return [
4527
+ 3,
4528
+ 38
4529
+ ];
4530
+ if (!("resolveParams" in operation)) return [
4531
+ 3,
4532
+ 34
4533
+ ];
4534
+ if (!(operation.resolveParams === false)) return [
4535
+ 3,
4536
+ 30
4537
+ ];
4538
+ newValue = operation(expressionContext, node.left, node.right);
4539
+ return [
4540
+ 3,
4541
+ 33
4542
+ ];
4543
+ case 30:
4544
+ _tmp4 = [
4545
+ expressionContext
4546
+ ];
4547
+ return [
4548
+ 4,
4549
+ resolveNode(node.left)
4550
+ ];
4551
+ case 31:
4552
+ _tmp4 = _tmp4.concat([
4553
+ _state.sent()
4554
+ ]);
4555
+ return [
4556
+ 4,
4557
+ resolveNode(node.right)
4558
+ ];
4559
+ case 32:
4560
+ newValue = operation.apply(void 0, _tmp4.concat([
4561
+ _state.sent()
4562
+ ]));
4563
+ _state.label = 33;
4564
+ case 33:
4565
+ return [
4566
+ 3,
4567
+ 37
4568
+ ];
4569
+ case 34:
4570
+ return [
4571
+ 4,
4572
+ resolveNode(node.left)
4573
+ ];
4574
+ case 35:
4575
+ _tmp5 = [
4576
+ _state.sent()
4577
+ ];
4578
+ return [
4579
+ 4,
4580
+ resolveNode(node.right)
4581
+ ];
4582
+ case 36:
4583
+ newValue = operation.apply(void 0, _tmp5.concat([
4584
+ _state.sent()
4585
+ ]));
4586
+ _state.label = 37;
4587
+ case 37:
4588
+ if (node.left.type === "ModelRef") {
4589
+ model.set([
4590
+ [
4591
+ node.left.ref,
4592
+ newValue
4593
+ ]
4594
+ ]);
4595
+ } else if (node.left.type === "Identifier") {
4596
+ _this.vars[node.left.name] = newValue;
4597
+ }
4598
+ return [
4599
+ 2,
4600
+ newValue
4601
+ ];
4602
+ case 38:
4603
+ return [
4604
+ 2,
4605
+ resolveNode(node.left)
4606
+ ];
4607
+ case 39:
4608
+ return [
4609
+ 2,
4610
+ _this._resolveNode(_currentValue, node, options)
4611
+ ];
4612
+ }
4613
+ });
4614
+ })();
4615
+ }
4016
4616
  }
4017
4617
  ]);
4018
4618
  return ExpressionEvaluator;
@@ -7437,15 +8037,56 @@ var CommonTypesPlugin = function() {
7437
8037
  validationController.reset();
7438
8038
  }
7439
8039
  });
7440
- flow.hooks.afterTransition.tap("player", function(flowInstance) {
7441
- var _flowInstance_currentState;
7442
- var value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
7443
- if (value && value.state_type === "ACTION") {
7444
- var exp = value.exp;
7445
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp)));
7446
- }
7447
- expressionEvaluator.reset();
7448
- });
8040
+ flow.hooks.afterTransition.tap("player", function() {
8041
+ var _ref = _async_to_generator(function(flowInstance) {
8042
+ var _flowInstance_currentState, value, exp, result, e;
8043
+ return _ts_generator(this, function(_state) {
8044
+ switch(_state.label){
8045
+ case 0:
8046
+ value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
8047
+ if (!(value && value.state_type === "ACTION")) return [
8048
+ 3,
8049
+ 4
8050
+ ];
8051
+ exp = value.exp;
8052
+ _state.label = 1;
8053
+ case 1:
8054
+ _state.trys.push([
8055
+ 1,
8056
+ 3,
8057
+ ,
8058
+ 4
8059
+ ]);
8060
+ return [
8061
+ 4,
8062
+ expressionEvaluator.evaluateAsync(exp)
8063
+ ];
8064
+ case 2:
8065
+ result = _state.sent();
8066
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
8067
+ return [
8068
+ 3,
8069
+ 4
8070
+ ];
8071
+ case 3:
8072
+ e = _state.sent();
8073
+ flowResultDeferred.reject(e);
8074
+ return [
8075
+ 3,
8076
+ 4
8077
+ ];
8078
+ case 4:
8079
+ expressionEvaluator.reset();
8080
+ return [
8081
+ 2
8082
+ ];
8083
+ }
8084
+ });
8085
+ });
8086
+ return function(flowInstance) {
8087
+ return _ref.apply(this, arguments);
8088
+ };
8089
+ }());
7449
8090
  });
7450
8091
  this.hooks.dataController.call(dataController);
7451
8092
  validationController.setOptions({