@player-ui/async-node-plugin 0.11.3--canary.660.23372 → 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 AsyncNodePlugin = 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();
@@ -3579,6 +3621,9 @@ var AsyncNodePlugin = function() {
3579
3621
  },
3580
3622
  setDataVal: function() {
3581
3623
  return setDataVal;
3624
+ },
3625
+ waitFor: function() {
3626
+ return waitFor;
3582
3627
  }
3583
3628
  });
3584
3629
  var setDataVal = function(_context, binding, value) {
@@ -3606,12 +3651,33 @@ var AsyncNodePlugin = function() {
3606
3651
  return null;
3607
3652
  };
3608
3653
  conditional.resolveParams = false;
3654
+ var waitFor = function() {
3655
+ var _ref = _async_to_generator(function(ctx, promise) {
3656
+ return _ts_generator(this, function(_state) {
3657
+ switch(_state.label){
3658
+ case 0:
3659
+ return [
3660
+ 4,
3661
+ promise
3662
+ ];
3663
+ case 1:
3664
+ return [
3665
+ 2,
3666
+ _state.sent()
3667
+ ];
3668
+ }
3669
+ });
3670
+ });
3671
+ return function waitFor(ctx, promise) {
3672
+ return _ref.apply(this, arguments);
3673
+ };
3674
+ }();
3609
3675
  var andandOperator = function(ctx, a, b) {
3610
- return ctx.evaluate(a) && ctx.evaluate(b);
3676
+ return LogicalOperators.and(ctx, a, b);
3611
3677
  };
3612
3678
  andandOperator.resolveParams = false;
3613
3679
  var ororOperator = function(ctx, a, b) {
3614
- return ctx.evaluate(a) || ctx.evaluate(b);
3680
+ return LogicalOperators.or(ctx, a, b);
3615
3681
  };
3616
3682
  ororOperator.resolveParams = false;
3617
3683
  var DEFAULT_BINARY_OPERATORS = {
@@ -3631,34 +3697,35 @@ var AsyncNodePlugin = function() {
3631
3697
  "%": function(a, b) {
3632
3698
  return a % b;
3633
3699
  },
3700
+ // Promise-aware comparison operators
3634
3701
  // eslint-disable-next-line
3635
- "==": function(a, b) {
3702
+ "==": makePromiseAwareBinaryOp(function(a, b) {
3636
3703
  return a == b;
3637
- },
3704
+ }),
3638
3705
  // eslint-disable-next-line
3639
- "!=": function(a, b) {
3706
+ "!=": makePromiseAwareBinaryOp(function(a, b) {
3640
3707
  return a != b;
3641
- },
3642
- ">": function(a, b) {
3708
+ }),
3709
+ ">": makePromiseAwareBinaryOp(function(a, b) {
3643
3710
  return a > b;
3644
- },
3645
- ">=": function(a, b) {
3711
+ }),
3712
+ ">=": makePromiseAwareBinaryOp(function(a, b) {
3646
3713
  return a >= b;
3647
- },
3648
- "<": function(a, b) {
3714
+ }),
3715
+ "<": makePromiseAwareBinaryOp(function(a, b) {
3649
3716
  return a < b;
3650
- },
3651
- "<=": function(a, b) {
3717
+ }),
3718
+ "<=": makePromiseAwareBinaryOp(function(a, b) {
3652
3719
  return a <= b;
3653
- },
3654
- "&&": andandOperator,
3655
- "||": ororOperator,
3656
- "!==": function(a, b) {
3720
+ }),
3721
+ "!==": makePromiseAwareBinaryOp(function(a, b) {
3657
3722
  return a !== b;
3658
- },
3659
- "===": function(a, b) {
3723
+ }),
3724
+ "===": makePromiseAwareBinaryOp(function(a, b) {
3660
3725
  return a === b;
3661
- },
3726
+ }),
3727
+ "&&": andandOperator,
3728
+ "||": ororOperator,
3662
3729
  // eslint-disable-next-line
3663
3730
  "|": function(a, b) {
3664
3731
  return a | b;
@@ -3689,8 +3756,70 @@ var AsyncNodePlugin = function() {
3689
3756
  "+": function(a) {
3690
3757
  return Number(a);
3691
3758
  },
3692
- "!": function(a) {
3759
+ "!": makePromiseAwareUnaryOp(function(a) {
3693
3760
  return !a;
3761
+ })
3762
+ };
3763
+ var PromiseCollectionHandler = {
3764
+ /**
3765
+ * Handle array with potential Promise elements
3766
+ */ handleArray: function handleArray(items) {
3767
+ var hasPromises = items.some(function(item) {
3768
+ return isPromiselike(item);
3769
+ });
3770
+ return hasPromises ? Promise.all(items) : items;
3771
+ },
3772
+ /**
3773
+ * Handle object with potential Promise keys/values
3774
+ */ handleObject: function handleObject(attributes, resolveNode) {
3775
+ var resolvedAttributes = {};
3776
+ var promises = [];
3777
+ var hasPromises = false;
3778
+ attributes.forEach(function(attr) {
3779
+ var key = resolveNode(attr.key);
3780
+ var value = resolveNode(attr.value);
3781
+ if (isPromiselike(key) || isPromiselike(value)) {
3782
+ hasPromises = true;
3783
+ var keyPromise = Promise.resolve(key);
3784
+ var valuePromise = Promise.resolve(value);
3785
+ promises.push(Promise.all([
3786
+ keyPromise,
3787
+ valuePromise
3788
+ ]).then(function(param) {
3789
+ var _param = _sliced_to_array(param, 2), resolvedKey = _param[0], resolvedValue = _param[1];
3790
+ resolvedAttributes[resolvedKey] = resolvedValue;
3791
+ }));
3792
+ } else {
3793
+ resolvedAttributes[key] = value;
3794
+ }
3795
+ });
3796
+ return hasPromises ? Promise.all(promises).then(function() {
3797
+ return resolvedAttributes;
3798
+ }) : resolvedAttributes;
3799
+ }
3800
+ };
3801
+ var LogicalOperators = {
3802
+ and: function(ctx, leftNode, rightNode) {
3803
+ var leftResult = ctx.evaluate(leftNode);
3804
+ if (isPromiselike(leftResult)) {
3805
+ return leftResult.then(function(awaitedLeft) {
3806
+ if (!awaitedLeft) return awaitedLeft;
3807
+ var rightResult = ctx.evaluate(rightNode);
3808
+ return isPromiselike(rightResult) ? rightResult : Promise.resolve(rightResult);
3809
+ });
3810
+ }
3811
+ return leftResult && ctx.evaluate(rightNode);
3812
+ },
3813
+ or: function(ctx, leftNode, rightNode) {
3814
+ var leftResult = ctx.evaluate(leftNode);
3815
+ if (isPromiselike(leftResult)) {
3816
+ return leftResult.then(function(awaitedLeft) {
3817
+ if (awaitedLeft) return awaitedLeft;
3818
+ var rightResult = ctx.evaluate(rightNode);
3819
+ return isPromiselike(rightResult) ? rightResult : Promise.resolve(rightResult);
3820
+ });
3821
+ }
3822
+ return leftResult || ctx.evaluate(rightNode);
3694
3823
  }
3695
3824
  };
3696
3825
  var ExpressionEvaluator = /*#__PURE__*/ function() {
@@ -3711,7 +3840,12 @@ var AsyncNodePlugin = function() {
3711
3840
  this.operators = {
3712
3841
  binary: new Map(Object.entries(DEFAULT_BINARY_OPERATORS)),
3713
3842
  unary: new Map(Object.entries(DEFAULT_UNARY_OPERATORS)),
3714
- expressions: new Map(Object.entries(evaluator_functions_exports))
3843
+ expressions: new Map(_to_consumable_array(Object.entries(evaluator_functions_exports)).concat([
3844
+ [
3845
+ "await",
3846
+ waitFor
3847
+ ]
3848
+ ]))
3715
3849
  };
3716
3850
  this.defaultHookOptions = _object_spread_props(_object_spread({}, defaultOptions), {
3717
3851
  evaluate: function(expr) {
@@ -3721,7 +3855,12 @@ var AsyncNodePlugin = function() {
3721
3855
  return _this._execAST(node, _this.defaultHookOptions);
3722
3856
  }
3723
3857
  });
3724
- this.hooks.resolve.tap("ExpressionEvaluator", this._resolveNode.bind(this));
3858
+ this.hooks.resolve.tap("ExpressionEvaluator", function(result, node, options) {
3859
+ if (options.async) {
3860
+ return _this._resolveNodeAsync(result, node, options);
3861
+ }
3862
+ return _this._resolveNode(result, node, options);
3863
+ });
3725
3864
  this.evaluate = this.evaluate.bind(this);
3726
3865
  }
3727
3866
  _create_class(ExpressionEvaluator, [
@@ -3759,6 +3898,14 @@ var AsyncNodePlugin = function() {
3759
3898
  return this._execString(String(expression), resolvedOpts);
3760
3899
  }
3761
3900
  },
3901
+ {
3902
+ key: "evaluateAsync",
3903
+ value: function evaluateAsync(expr, options) {
3904
+ return this.evaluate(expr, _object_spread_props(_object_spread({}, options), {
3905
+ async: true
3906
+ }));
3907
+ }
3908
+ },
3762
3909
  {
3763
3910
  key: "addExpressionFunction",
3764
3911
  value: function addExpressionFunction(name, handler) {
@@ -3804,8 +3951,10 @@ var AsyncNodePlugin = function() {
3804
3951
  var matches = exp.match(/^@\[(.*)\]@$/);
3805
3952
  var matchedExp = exp;
3806
3953
  if (matches) {
3807
- var ref;
3808
- ref = _sliced_to_array(Array.from(matches), 2), matchedExp = ref[1], ref;
3954
+ var _Array_from = _sliced_to_array(Array.from(matches), 2), matched = _Array_from[1];
3955
+ if (matched) {
3956
+ matchedExp = matched;
3957
+ }
3809
3958
  }
3810
3959
  var storedAST;
3811
3960
  try {
@@ -3872,14 +4021,7 @@ var AsyncNodePlugin = function() {
3872
4021
  return;
3873
4022
  }
3874
4023
  if (node.type === "Object") {
3875
- var attributes = node.attributes;
3876
- var resolvedAttributes = {};
3877
- attributes.forEach(function(attr) {
3878
- var key = resolveNode(attr.key);
3879
- var value = resolveNode(attr.value);
3880
- resolvedAttributes[key] = value;
3881
- });
3882
- return resolvedAttributes;
4024
+ return PromiseCollectionHandler.handleObject(node.attributes, resolveNode);
3883
4025
  }
3884
4026
  if (node.type === "CallExpression") {
3885
4027
  var expressionName = node.callTarget.name;
@@ -3930,13 +4072,18 @@ var AsyncNodePlugin = function() {
3930
4072
  return;
3931
4073
  }
3932
4074
  if (node.type === "ConditionalExpression") {
3933
- var result = resolveNode(node.test) ? node.consequent : node.alternate;
3934
- return resolveNode(result);
4075
+ var testResult = resolveNode(node.test);
4076
+ return handleConditionalBranching(testResult, function() {
4077
+ return node.consequent;
4078
+ }, function() {
4079
+ return node.alternate;
4080
+ }, resolveNode);
3935
4081
  }
3936
4082
  if (node.type === "ArrayExpression") {
3937
- return node.elements.map(function(ele) {
4083
+ var results = node.elements.map(function(ele) {
3938
4084
  return resolveNode(ele);
3939
4085
  });
4086
+ return PromiseCollectionHandler.handleArray(results);
3940
4087
  }
3941
4088
  if (node.type === "Modification") {
3942
4089
  var operation = this.operators.binary.get(node.operator);
@@ -3966,6 +4113,459 @@ var AsyncNodePlugin = function() {
3966
4113
  return resolveNode(node.left);
3967
4114
  }
3968
4115
  }
4116
+ },
4117
+ {
4118
+ key: "_resolveNodeAsync",
4119
+ value: function _resolveNodeAsync(_currentValue, node, options) {
4120
+ var _this = this;
4121
+ return _async_to_generator(function() {
4122
+ 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;
4123
+ return _ts_generator(this, function(_state) {
4124
+ switch(_state.label){
4125
+ case 0:
4126
+ resolveNode = options.resolveNode, model = options.model;
4127
+ expressionContext = _object_spread_props(_object_spread({}, options), {
4128
+ evaluate: function(expr) {
4129
+ return _this.evaluate(expr, options);
4130
+ }
4131
+ });
4132
+ if (!(node.type === "BinaryExpression" || node.type === "LogicalExpression")) return [
4133
+ 3,
4134
+ 7
4135
+ ];
4136
+ operator = _this.operators.binary.get(node.operator);
4137
+ if (!operator) return [
4138
+ 3,
4139
+ 6
4140
+ ];
4141
+ if (!("resolveParams" in operator)) return [
4142
+ 3,
4143
+ 3
4144
+ ];
4145
+ if (operator.resolveParams === false) {
4146
+ return [
4147
+ 2,
4148
+ operator(expressionContext, node.left, node.right)
4149
+ ];
4150
+ }
4151
+ _tmp = [
4152
+ expressionContext
4153
+ ];
4154
+ return [
4155
+ 4,
4156
+ resolveNode(node.left)
4157
+ ];
4158
+ case 1:
4159
+ _tmp = _tmp.concat([
4160
+ _state.sent()
4161
+ ]);
4162
+ return [
4163
+ 4,
4164
+ resolveNode(node.right)
4165
+ ];
4166
+ case 2:
4167
+ return [
4168
+ 2,
4169
+ operator.apply(void 0, _tmp.concat([
4170
+ _state.sent()
4171
+ ]))
4172
+ ];
4173
+ case 3:
4174
+ return [
4175
+ 4,
4176
+ resolveNode(node.left)
4177
+ ];
4178
+ case 4:
4179
+ _tmp1 = [
4180
+ _state.sent()
4181
+ ];
4182
+ return [
4183
+ 4,
4184
+ resolveNode(node.right)
4185
+ ];
4186
+ case 5:
4187
+ return [
4188
+ 2,
4189
+ operator.apply(void 0, _tmp1.concat([
4190
+ _state.sent()
4191
+ ]))
4192
+ ];
4193
+ case 6:
4194
+ return [
4195
+ 2
4196
+ ];
4197
+ case 7:
4198
+ if (!(node.type === "UnaryExpression")) return [
4199
+ 3,
4200
+ 14
4201
+ ];
4202
+ operator1 = _this.operators.unary.get(node.operator);
4203
+ if (!operator1) return [
4204
+ 3,
4205
+ 13
4206
+ ];
4207
+ if (!("resolveParams" in operator1)) return [
4208
+ 3,
4209
+ 11
4210
+ ];
4211
+ _tmp2 = [
4212
+ expressionContext
4213
+ ];
4214
+ if (!(operator1.resolveParams === false)) return [
4215
+ 3,
4216
+ 8
4217
+ ];
4218
+ _tmp3 = node.argument;
4219
+ return [
4220
+ 3,
4221
+ 10
4222
+ ];
4223
+ case 8:
4224
+ return [
4225
+ 4,
4226
+ resolveNode(node.argument)
4227
+ ];
4228
+ case 9:
4229
+ _tmp3 = _state.sent();
4230
+ _state.label = 10;
4231
+ case 10:
4232
+ return [
4233
+ 2,
4234
+ operator1.apply(void 0, _tmp2.concat([
4235
+ _tmp3
4236
+ ]))
4237
+ ];
4238
+ case 11:
4239
+ return [
4240
+ 4,
4241
+ resolveNode(node.argument)
4242
+ ];
4243
+ case 12:
4244
+ return [
4245
+ 2,
4246
+ operator1.apply(void 0, [
4247
+ _state.sent()
4248
+ ])
4249
+ ];
4250
+ case 13:
4251
+ return [
4252
+ 2
4253
+ ];
4254
+ case 14:
4255
+ if (!(node.type === "Object")) return [
4256
+ 3,
4257
+ 16
4258
+ ];
4259
+ attributes = node.attributes;
4260
+ resolvedAttributes = {};
4261
+ return [
4262
+ 4,
4263
+ Promise.all(attributes.map(function() {
4264
+ var _ref = _async_to_generator(function(attr) {
4265
+ var key, value;
4266
+ return _ts_generator(this, function(_state) {
4267
+ switch(_state.label){
4268
+ case 0:
4269
+ return [
4270
+ 4,
4271
+ resolveNode(attr.key)
4272
+ ];
4273
+ case 1:
4274
+ key = _state.sent();
4275
+ return [
4276
+ 4,
4277
+ resolveNode(attr.value)
4278
+ ];
4279
+ case 2:
4280
+ value = _state.sent();
4281
+ resolvedAttributes[key] = value;
4282
+ return [
4283
+ 2
4284
+ ];
4285
+ }
4286
+ });
4287
+ });
4288
+ return function(attr) {
4289
+ return _ref.apply(this, arguments);
4290
+ };
4291
+ }()))
4292
+ ];
4293
+ case 15:
4294
+ _state.sent();
4295
+ return [
4296
+ 2,
4297
+ resolvedAttributes
4298
+ ];
4299
+ case 16:
4300
+ if (!(node.type === "CallExpression")) return [
4301
+ 3,
4302
+ 18
4303
+ ];
4304
+ expressionName = node.callTarget.name;
4305
+ operator2 = _this.operators.expressions.get(expressionName);
4306
+ if (!operator2) {
4307
+ throw new Error("Unknown expression function: ".concat(expressionName));
4308
+ }
4309
+ if ("resolveParams" in operator2 && operator2.resolveParams === false) {
4310
+ return [
4311
+ 2,
4312
+ operator2.apply(void 0, [
4313
+ expressionContext
4314
+ ].concat(_to_consumable_array(node.args)))
4315
+ ];
4316
+ }
4317
+ return [
4318
+ 4,
4319
+ Promise.all(node.args.map(function() {
4320
+ var _ref = _async_to_generator(function(n) {
4321
+ return _ts_generator(this, function(_state) {
4322
+ switch(_state.label){
4323
+ case 0:
4324
+ return [
4325
+ 4,
4326
+ resolveNode(n)
4327
+ ];
4328
+ case 1:
4329
+ return [
4330
+ 2,
4331
+ _state.sent()
4332
+ ];
4333
+ }
4334
+ });
4335
+ });
4336
+ return function(n) {
4337
+ return _ref.apply(this, arguments);
4338
+ };
4339
+ }()))
4340
+ ];
4341
+ case 17:
4342
+ args = _state.sent();
4343
+ return [
4344
+ 2,
4345
+ operator2.apply(void 0, [
4346
+ expressionContext
4347
+ ].concat(_to_consumable_array(args)))
4348
+ ];
4349
+ case 18:
4350
+ if (node.type === "ModelRef") {
4351
+ return [
4352
+ 2,
4353
+ model.get(node.ref, {
4354
+ context: {
4355
+ model: options.model
4356
+ }
4357
+ })
4358
+ ];
4359
+ }
4360
+ if (!(node.type === "MemberExpression")) return [
4361
+ 3,
4362
+ 21
4363
+ ];
4364
+ return [
4365
+ 4,
4366
+ resolveNode(node.object)
4367
+ ];
4368
+ case 19:
4369
+ obj = _state.sent();
4370
+ return [
4371
+ 4,
4372
+ resolveNode(node.property)
4373
+ ];
4374
+ case 20:
4375
+ prop = _state.sent();
4376
+ return [
4377
+ 2,
4378
+ obj[prop]
4379
+ ];
4380
+ case 21:
4381
+ if (!(node.type === "Assignment")) return [
4382
+ 3,
4383
+ 26
4384
+ ];
4385
+ if (!(node.left.type === "ModelRef")) return [
4386
+ 3,
4387
+ 23
4388
+ ];
4389
+ return [
4390
+ 4,
4391
+ resolveNode(node.right)
4392
+ ];
4393
+ case 22:
4394
+ value = _state.sent();
4395
+ model.set([
4396
+ [
4397
+ node.left.ref,
4398
+ value
4399
+ ]
4400
+ ]);
4401
+ return [
4402
+ 2,
4403
+ value
4404
+ ];
4405
+ case 23:
4406
+ if (!(node.left.type === "Identifier")) return [
4407
+ 3,
4408
+ 25
4409
+ ];
4410
+ return [
4411
+ 4,
4412
+ resolveNode(node.right)
4413
+ ];
4414
+ case 24:
4415
+ value1 = _state.sent();
4416
+ _this.vars[node.left.name] = value1;
4417
+ return [
4418
+ 2,
4419
+ value1
4420
+ ];
4421
+ case 25:
4422
+ return [
4423
+ 2
4424
+ ];
4425
+ case 26:
4426
+ if (!(node.type === "ConditionalExpression")) return [
4427
+ 3,
4428
+ 29
4429
+ ];
4430
+ return [
4431
+ 4,
4432
+ resolveNode(node.test)
4433
+ ];
4434
+ case 27:
4435
+ testResult = _state.sent();
4436
+ result = testResult ? node.consequent : node.alternate;
4437
+ return [
4438
+ 4,
4439
+ resolveNode(result)
4440
+ ];
4441
+ case 28:
4442
+ branchResult = _state.sent();
4443
+ return [
4444
+ 2,
4445
+ branchResult
4446
+ ];
4447
+ case 29:
4448
+ if (node.type === "ArrayExpression") {
4449
+ return [
4450
+ 2,
4451
+ Promise.all(node.elements.map(function() {
4452
+ var _ref = _async_to_generator(function(ele) {
4453
+ return _ts_generator(this, function(_state) {
4454
+ switch(_state.label){
4455
+ case 0:
4456
+ return [
4457
+ 4,
4458
+ resolveNode(ele)
4459
+ ];
4460
+ case 1:
4461
+ return [
4462
+ 2,
4463
+ _state.sent()
4464
+ ];
4465
+ }
4466
+ });
4467
+ });
4468
+ return function(ele) {
4469
+ return _ref.apply(this, arguments);
4470
+ };
4471
+ }()))
4472
+ ];
4473
+ }
4474
+ if (!(node.type === "Modification")) return [
4475
+ 3,
4476
+ 39
4477
+ ];
4478
+ operation = _this.operators.binary.get(node.operator);
4479
+ if (!operation) return [
4480
+ 3,
4481
+ 38
4482
+ ];
4483
+ if (!("resolveParams" in operation)) return [
4484
+ 3,
4485
+ 34
4486
+ ];
4487
+ if (!(operation.resolveParams === false)) return [
4488
+ 3,
4489
+ 30
4490
+ ];
4491
+ newValue = operation(expressionContext, node.left, node.right);
4492
+ return [
4493
+ 3,
4494
+ 33
4495
+ ];
4496
+ case 30:
4497
+ _tmp4 = [
4498
+ expressionContext
4499
+ ];
4500
+ return [
4501
+ 4,
4502
+ resolveNode(node.left)
4503
+ ];
4504
+ case 31:
4505
+ _tmp4 = _tmp4.concat([
4506
+ _state.sent()
4507
+ ]);
4508
+ return [
4509
+ 4,
4510
+ resolveNode(node.right)
4511
+ ];
4512
+ case 32:
4513
+ newValue = operation.apply(void 0, _tmp4.concat([
4514
+ _state.sent()
4515
+ ]));
4516
+ _state.label = 33;
4517
+ case 33:
4518
+ return [
4519
+ 3,
4520
+ 37
4521
+ ];
4522
+ case 34:
4523
+ return [
4524
+ 4,
4525
+ resolveNode(node.left)
4526
+ ];
4527
+ case 35:
4528
+ _tmp5 = [
4529
+ _state.sent()
4530
+ ];
4531
+ return [
4532
+ 4,
4533
+ resolveNode(node.right)
4534
+ ];
4535
+ case 36:
4536
+ newValue = operation.apply(void 0, _tmp5.concat([
4537
+ _state.sent()
4538
+ ]));
4539
+ _state.label = 37;
4540
+ case 37:
4541
+ if (node.left.type === "ModelRef") {
4542
+ model.set([
4543
+ [
4544
+ node.left.ref,
4545
+ newValue
4546
+ ]
4547
+ ]);
4548
+ } else if (node.left.type === "Identifier") {
4549
+ _this.vars[node.left.name] = newValue;
4550
+ }
4551
+ return [
4552
+ 2,
4553
+ newValue
4554
+ ];
4555
+ case 38:
4556
+ return [
4557
+ 2,
4558
+ resolveNode(node.left)
4559
+ ];
4560
+ case 39:
4561
+ return [
4562
+ 2,
4563
+ _this._resolveNode(_currentValue, node, options)
4564
+ ];
4565
+ }
4566
+ });
4567
+ })();
4568
+ }
3969
4569
  }
3970
4570
  ]);
3971
4571
  return ExpressionEvaluator;
@@ -7530,15 +8130,56 @@ var AsyncNodePlugin = function() {
7530
8130
  validationController.reset();
7531
8131
  }
7532
8132
  });
7533
- flow.hooks.afterTransition.tap("player", function(flowInstance) {
7534
- var _flowInstance_currentState;
7535
- var value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
7536
- if (value && value.state_type === "ACTION") {
7537
- var exp = value.exp;
7538
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp)));
7539
- }
7540
- expressionEvaluator.reset();
7541
- });
8133
+ flow.hooks.afterTransition.tap("player", function() {
8134
+ var _ref = _async_to_generator(function(flowInstance) {
8135
+ var _flowInstance_currentState, value, exp, result, e;
8136
+ return _ts_generator(this, function(_state) {
8137
+ switch(_state.label){
8138
+ case 0:
8139
+ value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
8140
+ if (!(value && value.state_type === "ACTION")) return [
8141
+ 3,
8142
+ 4
8143
+ ];
8144
+ exp = value.exp;
8145
+ _state.label = 1;
8146
+ case 1:
8147
+ _state.trys.push([
8148
+ 1,
8149
+ 3,
8150
+ ,
8151
+ 4
8152
+ ]);
8153
+ return [
8154
+ 4,
8155
+ expressionEvaluator.evaluateAsync(exp)
8156
+ ];
8157
+ case 2:
8158
+ result = _state.sent();
8159
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
8160
+ return [
8161
+ 3,
8162
+ 4
8163
+ ];
8164
+ case 3:
8165
+ e = _state.sent();
8166
+ flowResultDeferred.reject(e);
8167
+ return [
8168
+ 3,
8169
+ 4
8170
+ ];
8171
+ case 4:
8172
+ expressionEvaluator.reset();
8173
+ return [
8174
+ 2
8175
+ ];
8176
+ }
8177
+ });
8178
+ });
8179
+ return function(flowInstance) {
8180
+ return _ref.apply(this, arguments);
8181
+ };
8182
+ }());
7542
8183
  });
7543
8184
  this.hooks.dataController.call(dataController);
7544
8185
  validationController.setOptions({