@player-ui/reference-assets-plugin 0.12.0--canary.649.24150 → 0.12.0--canary.677.24166

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.
@@ -1276,61 +1276,12 @@ var ReferenceAssetsPlugin = function() {
1276
1276
  };
1277
1277
  }
1278
1278
  };
1279
- var isPromiselike = function isPromiselike(value) {
1280
- var // Check for standard Promise constructor name
1281
- _value_constructor;
1282
- return value != null && typeof value === "object" && typeof value.then === "function" && // Additional safeguards against false positives
1283
- (_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
1284
- typeof value.catch === "function" && typeof value.finally === "function");
1285
- };
1286
- var isAwaitable = function isAwaitable(val) {
1287
- return isPromiselike(val) && val[AwaitableSymbol] !== void 0;
1288
- };
1289
- var collateAwaitable = function collateAwaitable(promises) {
1290
- var result = Promise.all(promises);
1291
- return makeAwaitable(result);
1292
- };
1293
1279
  var isObjectExpression = function isObjectExpression(expr) {
1294
1280
  if (isExpressionNode(expr)) {
1295
1281
  return false;
1296
1282
  }
1297
1283
  return typeof expr === "object" && expr !== null && !Array.isArray(expr) && "value" in expr;
1298
1284
  };
1299
- var makePromiseAwareBinaryOp = function makePromiseAwareBinaryOp(operation) {
1300
- return function(a, b, async) {
1301
- if (async && (isAwaitable(a) || isAwaitable(b))) {
1302
- return collateAwaitable([
1303
- Promise.resolve(a),
1304
- Promise.resolve(b)
1305
- ]).awaitableThen(function(param) {
1306
- var _param = _sliced_to_array(param, 2), resolvedA = _param[0], resolvedB = _param[1];
1307
- return operation(resolvedA, resolvedB);
1308
- });
1309
- }
1310
- return operation(a, b);
1311
- };
1312
- };
1313
- var makePromiseAwareUnaryOp = function makePromiseAwareUnaryOp(operation) {
1314
- return function(a, async) {
1315
- if (async && isAwaitable(a)) {
1316
- return a.awaitableThen(function(resolved) {
1317
- return operation(resolved);
1318
- });
1319
- }
1320
- return operation(a);
1321
- };
1322
- };
1323
- var handleConditionalBranching = function handleConditionalBranching(testValue, getTrueBranch, getFalseBranch, resolveNode, async) {
1324
- if (async && isAwaitable(testValue)) {
1325
- return testValue.awaitableThen(function(resolved) {
1326
- var branch2 = resolved ? getTrueBranch() : getFalseBranch();
1327
- var branchResult = resolveNode(branch2);
1328
- return isAwaitable(branchResult) ? Promise.resolve(branchResult) : branchResult;
1329
- });
1330
- }
1331
- var branch = testValue ? getTrueBranch() : getFalseBranch();
1332
- return resolveNode(branch);
1333
- };
1334
1285
  var parse2 = function parse2(schema) {
1335
1286
  var _loop = function() {
1336
1287
  var next = parseQueue.shift();
@@ -3856,19 +3807,8 @@ var ReferenceAssetsPlugin = function() {
3856
3807
  },
3857
3808
  setDataVal: function() {
3858
3809
  return setDataVal;
3859
- },
3860
- waitFor: function() {
3861
- return waitFor;
3862
3810
  }
3863
3811
  });
3864
- var AwaitableSymbol = Symbol("Awaitable");
3865
- function makeAwaitable(promise) {
3866
- promise[AwaitableSymbol] = AwaitableSymbol;
3867
- promise.awaitableThen = function(arg) {
3868
- return makeAwaitable(promise.then(arg));
3869
- };
3870
- return promise;
3871
- }
3872
3812
  var setDataVal = function(_context, binding, value) {
3873
3813
  _context.model.set([
3874
3814
  [
@@ -3884,19 +3824,8 @@ var ReferenceAssetsPlugin = function() {
3884
3824
  return _context.model.delete(binding);
3885
3825
  };
3886
3826
  var conditional = function(ctx, condition, ifTrue, ifFalse) {
3887
- var testResult = ctx.evaluate(condition);
3888
- if (isAwaitable(testResult)) {
3889
- return testResult.awaitableThen(function(resolvedTest) {
3890
- if (resolvedTest) {
3891
- return ctx.evaluate(ifTrue);
3892
- }
3893
- if (ifFalse) {
3894
- return ctx.evaluate(ifFalse);
3895
- }
3896
- return null;
3897
- });
3898
- }
3899
- if (testResult) {
3827
+ var resolution = ctx.evaluate(condition);
3828
+ if (resolution) {
3900
3829
  return ctx.evaluate(ifTrue);
3901
3830
  }
3902
3831
  if (ifFalse) {
@@ -3905,15 +3834,12 @@ var ReferenceAssetsPlugin = function() {
3905
3834
  return null;
3906
3835
  };
3907
3836
  conditional.resolveParams = false;
3908
- var waitFor = function(ctx, promise) {
3909
- return makeAwaitable(promise);
3910
- };
3911
- var andandOperator = function(ctx, a, b, async) {
3912
- return LogicalOperators.and(ctx, a, b, async);
3837
+ var andandOperator = function(ctx, a, b) {
3838
+ return ctx.evaluate(a) && ctx.evaluate(b);
3913
3839
  };
3914
3840
  andandOperator.resolveParams = false;
3915
- var ororOperator = function(ctx, a, b, async) {
3916
- return LogicalOperators.or(ctx, a, b, async);
3841
+ var ororOperator = function(ctx, a, b) {
3842
+ return ctx.evaluate(a) || ctx.evaluate(b);
3917
3843
  };
3918
3844
  ororOperator.resolveParams = false;
3919
3845
  var DEFAULT_BINARY_OPERATORS = {
@@ -3933,35 +3859,34 @@ var ReferenceAssetsPlugin = function() {
3933
3859
  "%": function(a, b) {
3934
3860
  return a % b;
3935
3861
  },
3936
- // Promise-aware comparison operators
3937
3862
  // eslint-disable-next-line
3938
- "==": makePromiseAwareBinaryOp(function(a, b) {
3863
+ "==": function(a, b) {
3939
3864
  return a == b;
3940
- }),
3865
+ },
3941
3866
  // eslint-disable-next-line
3942
- "!=": makePromiseAwareBinaryOp(function(a, b) {
3867
+ "!=": function(a, b) {
3943
3868
  return a != b;
3944
- }),
3945
- ">": makePromiseAwareBinaryOp(function(a, b) {
3869
+ },
3870
+ ">": function(a, b) {
3946
3871
  return a > b;
3947
- }),
3948
- ">=": makePromiseAwareBinaryOp(function(a, b) {
3872
+ },
3873
+ ">=": function(a, b) {
3949
3874
  return a >= b;
3950
- }),
3951
- "<": makePromiseAwareBinaryOp(function(a, b) {
3875
+ },
3876
+ "<": function(a, b) {
3952
3877
  return a < b;
3953
- }),
3954
- "<=": makePromiseAwareBinaryOp(function(a, b) {
3878
+ },
3879
+ "<=": function(a, b) {
3955
3880
  return a <= b;
3956
- }),
3957
- "!==": makePromiseAwareBinaryOp(function(a, b) {
3958
- return a !== b;
3959
- }),
3960
- "===": makePromiseAwareBinaryOp(function(a, b) {
3961
- return a === b;
3962
- }),
3881
+ },
3963
3882
  "&&": andandOperator,
3964
3883
  "||": ororOperator,
3884
+ "!==": function(a, b) {
3885
+ return a !== b;
3886
+ },
3887
+ "===": function(a, b) {
3888
+ return a === b;
3889
+ },
3965
3890
  // eslint-disable-next-line
3966
3891
  "|": function(a, b) {
3967
3892
  return a | b;
@@ -3992,73 +3917,8 @@ var ReferenceAssetsPlugin = function() {
3992
3917
  "+": function(a) {
3993
3918
  return Number(a);
3994
3919
  },
3995
- "!": makePromiseAwareUnaryOp(function(a) {
3920
+ "!": function(a) {
3996
3921
  return !a;
3997
- })
3998
- };
3999
- var PromiseCollectionHandler = {
4000
- /**
4001
- * Handle array with potential Promise elements
4002
- */ handleArray: function handleArray(items, async) {
4003
- if (!async) {
4004
- return items;
4005
- }
4006
- var hasPromises = items.some(function(item) {
4007
- return isAwaitable(item);
4008
- });
4009
- return hasPromises ? collateAwaitable(items) : items;
4010
- },
4011
- /**
4012
- * Handle object with potential Promise keys/values
4013
- */ handleObject: function handleObject(attributes, resolveNode, async) {
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 (async && (isAwaitable(key) || isAwaitable(value))) {
4021
- hasPromises = true;
4022
- var keyPromise = Promise.resolve(key);
4023
- var valuePromise = Promise.resolve(value);
4024
- promises.push(collateAwaitable([
4025
- keyPromise,
4026
- valuePromise
4027
- ]).awaitableThen(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 ? collateAwaitable(promises).awaitableThen(function() {
4036
- return resolvedAttributes;
4037
- }) : resolvedAttributes;
4038
- }
4039
- };
4040
- var LogicalOperators = {
4041
- and: function(ctx, leftNode, rightNode, async) {
4042
- var leftResult = ctx.evaluate(leftNode);
4043
- if (async && isAwaitable(leftResult)) {
4044
- return leftResult.awaitableThen(function(awaitedLeft) {
4045
- if (!awaitedLeft) return awaitedLeft;
4046
- var rightResult = ctx.evaluate(rightNode);
4047
- return isAwaitable(rightResult) ? rightResult : Promise.resolve(rightResult);
4048
- });
4049
- }
4050
- return leftResult && ctx.evaluate(rightNode);
4051
- },
4052
- or: function(ctx, leftNode, rightNode, async) {
4053
- var leftResult = ctx.evaluate(leftNode);
4054
- if (async && isAwaitable(leftResult)) {
4055
- return leftResult.awaitableThen(function(awaitedLeft) {
4056
- if (awaitedLeft) return awaitedLeft;
4057
- var rightResult = ctx.evaluate(rightNode);
4058
- return isAwaitable(rightResult) ? rightResult : Promise.resolve(rightResult);
4059
- });
4060
- }
4061
- return leftResult || ctx.evaluate(rightNode);
4062
3922
  }
4063
3923
  };
4064
3924
  var ExpressionEvaluator = /*#__PURE__*/ function() {
@@ -4079,12 +3939,7 @@ var ReferenceAssetsPlugin = function() {
4079
3939
  this.operators = {
4080
3940
  binary: new Map(Object.entries(DEFAULT_BINARY_OPERATORS)),
4081
3941
  unary: new Map(Object.entries(DEFAULT_UNARY_OPERATORS)),
4082
- expressions: new Map(_to_consumable_array(Object.entries(evaluator_functions_exports)).concat([
4083
- [
4084
- "await",
4085
- waitFor
4086
- ]
4087
- ]))
3942
+ expressions: new Map(Object.entries(evaluator_functions_exports))
4088
3943
  };
4089
3944
  this.defaultHookOptions = _object_spread_props(_object_spread({}, defaultOptions), {
4090
3945
  evaluate: function(expr) {
@@ -4094,9 +3949,7 @@ var ReferenceAssetsPlugin = function() {
4094
3949
  return _this._execAST(node, _this.defaultHookOptions);
4095
3950
  }
4096
3951
  });
4097
- this.hooks.resolve.tap("ExpressionEvaluator", function(result, node, options) {
4098
- return _this._resolveNode(result, node, options);
4099
- });
3952
+ this.hooks.resolve.tap("ExpressionEvaluator", this._resolveNode.bind(this));
4100
3953
  this.evaluate = this.evaluate.bind(this);
4101
3954
  }
4102
3955
  _create_class(ExpressionEvaluator, [
@@ -4134,38 +3987,6 @@ var ReferenceAssetsPlugin = function() {
4134
3987
  return this._execString(String(expression), resolvedOpts);
4135
3988
  }
4136
3989
  },
4137
- {
4138
- /**
4139
- * Evaluate functions in an async context
4140
- * @experimental These Player APIs are in active development and may change. Use with caution
4141
- */ key: "evaluateAsync",
4142
- value: function evaluateAsync(expr, options) {
4143
- if (Array.isArray(expr)) {
4144
- var _this = this;
4145
- return collateAwaitable(expr.map(function() {
4146
- var _ref = _async_to_generator(function(exp) {
4147
- return _ts_generator(this, function(_state) {
4148
- return [
4149
- 2,
4150
- _this.evaluate(exp, _object_spread_props(_object_spread({}, options), {
4151
- async: true
4152
- }))
4153
- ];
4154
- });
4155
- });
4156
- return function(exp) {
4157
- return _ref.apply(this, arguments);
4158
- };
4159
- }())).awaitableThen(function(values) {
4160
- return values.pop();
4161
- });
4162
- } else {
4163
- return this.evaluate(expr, _object_spread_props(_object_spread({}, options), {
4164
- async: true
4165
- }));
4166
- }
4167
- }
4168
- },
4169
3990
  {
4170
3991
  key: "addExpressionFunction",
4171
3992
  value: function addExpressionFunction(name, handler) {
@@ -4211,10 +4032,8 @@ var ReferenceAssetsPlugin = function() {
4211
4032
  var matches = exp.match(/^@\[(.*)\]@$/);
4212
4033
  var matchedExp = exp;
4213
4034
  if (matches) {
4214
- var _Array_from = _sliced_to_array(Array.from(matches), 2), matched = _Array_from[1];
4215
- if (matched) {
4216
- matchedExp = matched;
4217
- }
4035
+ var ref;
4036
+ ref = _sliced_to_array(Array.from(matches), 2), matchedExp = ref[1], ref;
4218
4037
  }
4219
4038
  var storedAST;
4220
4039
  try {
@@ -4243,8 +4062,6 @@ var ReferenceAssetsPlugin = function() {
4243
4062
  value: function _resolveNode(_currentValue, node, options) {
4244
4063
  var _this = this;
4245
4064
  var resolveNode = options.resolveNode, model = options.model;
4246
- var _options_async;
4247
- var isAsync = (_options_async = options.async) !== null && _options_async !== void 0 ? _options_async : false;
4248
4065
  var expressionContext = _object_spread_props(_object_spread({}, options), {
4249
4066
  evaluate: function(expr) {
4250
4067
  return _this.evaluate(expr, options);
@@ -4264,33 +4081,11 @@ var ReferenceAssetsPlugin = function() {
4264
4081
  if (operator) {
4265
4082
  if ("resolveParams" in operator) {
4266
4083
  if (operator.resolveParams === false) {
4267
- return operator(expressionContext, node.left, node.right, isAsync);
4268
- }
4269
- var left2 = resolveNode(node.left);
4270
- var right2 = resolveNode(node.right);
4271
- if (options.async && (isAwaitable(left2) || isAwaitable(right2))) {
4272
- return collateAwaitable([
4273
- left2,
4274
- right2
4275
- ]).awaitableThen(function(param) {
4276
- var _param = _sliced_to_array(param, 2), leftVal = _param[0], rightVal = _param[1];
4277
- return operator(expressionContext, leftVal, rightVal, isAsync);
4278
- });
4084
+ return operator(expressionContext, node.left, node.right);
4279
4085
  }
4280
- return operator(expressionContext, left2, right2, isAsync);
4281
- }
4282
- var left = resolveNode(node.left);
4283
- var right = resolveNode(node.right);
4284
- if (options.async && (isAwaitable(left) || isAwaitable(right))) {
4285
- return collateAwaitable([
4286
- left,
4287
- right
4288
- ]).awaitableThen(function(param) {
4289
- var _param = _sliced_to_array(param, 2), leftVal = _param[0], rightVal = _param[1];
4290
- return operator(leftVal, rightVal, isAsync);
4291
- });
4086
+ return operator(expressionContext, resolveNode(node.left), resolveNode(node.right));
4292
4087
  }
4293
- return operator(left, right, isAsync);
4088
+ return operator(resolveNode(node.left), resolveNode(node.right));
4294
4089
  }
4295
4090
  return;
4296
4091
  }
@@ -4298,29 +4093,21 @@ var ReferenceAssetsPlugin = function() {
4298
4093
  var operator1 = this.operators.unary.get(node.operator);
4299
4094
  if (operator1) {
4300
4095
  if ("resolveParams" in operator1) {
4301
- if (operator1.resolveParams === false) {
4302
- return operator1(expressionContext, node.argument, isAsync);
4303
- }
4304
- var arg2 = resolveNode(node.argument);
4305
- if (options.async && isAwaitable(arg2)) {
4306
- return arg2.awaitableThen(function(argVal) {
4307
- return operator1(expressionContext, argVal, isAsync);
4308
- });
4309
- }
4310
- return operator1(expressionContext, arg2, isAsync);
4096
+ return operator1(expressionContext, operator1.resolveParams === false ? node.argument : resolveNode(node.argument));
4311
4097
  }
4312
- var arg = resolveNode(node.argument);
4313
- if (options.async && isAwaitable(arg)) {
4314
- return arg.awaitableThen(function(argVal) {
4315
- return operator1(argVal, isAsync);
4316
- });
4317
- }
4318
- return operator1(arg, isAsync);
4098
+ return operator1(resolveNode(node.argument));
4319
4099
  }
4320
4100
  return;
4321
4101
  }
4322
4102
  if (node.type === "Object") {
4323
- return PromiseCollectionHandler.handleObject(node.attributes, resolveNode, options.async || false);
4103
+ var attributes = node.attributes;
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;
4324
4111
  }
4325
4112
  if (node.type === "CallExpression") {
4326
4113
  var expressionName = node.callTarget.name;
@@ -4328,9 +4115,6 @@ var ReferenceAssetsPlugin = function() {
4328
4115
  if (!operator2) {
4329
4116
  throw new Error("Unknown expression function: ".concat(expressionName));
4330
4117
  }
4331
- if (operator2.name === "waitFor" && !options.async) {
4332
- throw new Error("Usage of await outside of async context");
4333
- }
4334
4118
  if ("resolveParams" in operator2 && operator2.resolveParams === false) {
4335
4119
  return operator2.apply(void 0, [
4336
4120
  expressionContext
@@ -4339,16 +4123,6 @@ var ReferenceAssetsPlugin = function() {
4339
4123
  var args = node.args.map(function(n) {
4340
4124
  return resolveNode(n);
4341
4125
  });
4342
- if (options.async) {
4343
- var hasPromises = args.some(isAwaitable);
4344
- if (hasPromises) {
4345
- return collateAwaitable(args).awaitableThen(function(resolvedArgs) {
4346
- return operator2.apply(void 0, [
4347
- expressionContext
4348
- ].concat(_to_consumable_array(resolvedArgs)));
4349
- });
4350
- }
4351
- }
4352
4126
  return operator2.apply(void 0, [
4353
4127
  expressionContext
4354
4128
  ].concat(_to_consumable_array(args)));
@@ -4363,36 +4137,11 @@ var ReferenceAssetsPlugin = function() {
4363
4137
  if (node.type === "MemberExpression") {
4364
4138
  var obj = resolveNode(node.object);
4365
4139
  var prop = resolveNode(node.property);
4366
- if (options.async && (isAwaitable(obj) || isAwaitable(prop))) {
4367
- return collateAwaitable([
4368
- obj,
4369
- prop
4370
- ]).awaitableThen(function(param) {
4371
- var _param = _sliced_to_array(param, 2), objVal = _param[0], propVal = _param[1];
4372
- return objVal[propVal];
4373
- });
4374
- }
4375
4140
  return obj[prop];
4376
4141
  }
4377
4142
  if (node.type === "Assignment") {
4378
4143
  if (node.left.type === "ModelRef") {
4379
4144
  var value = resolveNode(node.right);
4380
- if (isPromiselike(value)) {
4381
- if (options.async && isAwaitable(value)) {
4382
- return value.awaitableThen(function(resolvedValue) {
4383
- model.set([
4384
- [
4385
- node.left.ref,
4386
- resolvedValue
4387
- ]
4388
- ]);
4389
- return resolvedValue;
4390
- });
4391
- } else {
4392
- var _options_logger;
4393
- (_options_logger = options.logger) === null || _options_logger === void 0 ? void 0 : _options_logger.warn("Unawaited promise written to mode, this behavior is undefined and may change in future releases");
4394
- }
4395
- }
4396
4145
  model.set([
4397
4146
  [
4398
4147
  node.left.ref,
@@ -4403,30 +4152,19 @@ var ReferenceAssetsPlugin = function() {
4403
4152
  }
4404
4153
  if (node.left.type === "Identifier") {
4405
4154
  var value1 = resolveNode(node.right);
4406
- if (options.async && isAwaitable(value1)) {
4407
- return value1.awaitableThen(function(resolvedValue) {
4408
- _this.vars[node.left.name] = resolvedValue;
4409
- return resolvedValue;
4410
- });
4411
- }
4412
4155
  this.vars[node.left.name] = value1;
4413
4156
  return value1;
4414
4157
  }
4415
4158
  return;
4416
4159
  }
4417
4160
  if (node.type === "ConditionalExpression") {
4418
- var testResult = resolveNode(node.test);
4419
- return handleConditionalBranching(testResult, function() {
4420
- return node.consequent;
4421
- }, function() {
4422
- return node.alternate;
4423
- }, resolveNode, isAsync);
4161
+ var result = resolveNode(node.test) ? node.consequent : node.alternate;
4162
+ return resolveNode(result);
4424
4163
  }
4425
4164
  if (node.type === "ArrayExpression") {
4426
- var results = node.elements.map(function(ele) {
4165
+ return node.elements.map(function(ele) {
4427
4166
  return resolveNode(ele);
4428
4167
  });
4429
- return PromiseCollectionHandler.handleArray(results, isAsync);
4430
4168
  }
4431
4169
  if (node.type === "Modification") {
4432
4170
  var operation = this.operators.binary.get(node.operator);
@@ -4434,49 +4172,14 @@ var ReferenceAssetsPlugin = function() {
4434
4172
  var newValue;
4435
4173
  if ("resolveParams" in operation) {
4436
4174
  if (operation.resolveParams === false) {
4437
- newValue = operation(expressionContext, node.left, node.right, isAsync);
4175
+ newValue = operation(expressionContext, node.left, node.right);
4438
4176
  } else {
4439
- var left1 = resolveNode(node.left);
4440
- var right1 = resolveNode(node.right);
4441
- if (options.async && (isAwaitable(left1) || isAwaitable(right1))) {
4442
- newValue = collateAwaitable([
4443
- left1,
4444
- right1
4445
- ]).awaitableThen(function(param) {
4446
- var _param = _sliced_to_array(param, 2), leftVal = _param[0], rightVal = _param[1];
4447
- return operation(expressionContext, leftVal, rightVal, isAsync);
4448
- });
4449
- } else {
4450
- newValue = operation(expressionContext, left1, right1, isAsync);
4451
- }
4177
+ newValue = operation(expressionContext, resolveNode(node.left), resolveNode(node.right));
4452
4178
  }
4453
4179
  } else {
4454
- var left3 = resolveNode(node.left);
4455
- var right3 = resolveNode(node.right);
4456
- if (options.async && (isAwaitable(left3) || isAwaitable(right3))) {
4457
- newValue = collateAwaitable([
4458
- left3,
4459
- right3
4460
- ]).awaitableThen(function(param) {
4461
- var _param = _sliced_to_array(param, 2), leftVal = _param[0], rightVal = _param[1];
4462
- return operation(leftVal, rightVal, isAsync);
4463
- });
4464
- } else {
4465
- newValue = operation(left3, right3, isAsync);
4466
- }
4180
+ newValue = operation(resolveNode(node.left), resolveNode(node.right));
4467
4181
  }
4468
4182
  if (node.left.type === "ModelRef") {
4469
- if (options.async && isAwaitable(newValue)) {
4470
- return newValue.awaitableThen(function(resolvedValue) {
4471
- model.set([
4472
- [
4473
- node.left.ref,
4474
- resolvedValue
4475
- ]
4476
- ]);
4477
- return resolvedValue;
4478
- });
4479
- }
4480
4183
  model.set([
4481
4184
  [
4482
4185
  node.left.ref,
@@ -4484,12 +4187,6 @@ var ReferenceAssetsPlugin = function() {
4484
4187
  ]
4485
4188
  ]);
4486
4189
  } else if (node.left.type === "Identifier") {
4487
- if (options.async && isAwaitable(newValue)) {
4488
- return newValue.awaitableThen(function(resolvedValue) {
4489
- _this.vars[node.left.name] = resolvedValue;
4490
- return resolvedValue;
4491
- });
4492
- }
4493
4190
  this.vars[node.left.name] = newValue;
4494
4191
  }
4495
4192
  return newValue;
@@ -8051,90 +7748,10 @@ var ReferenceAssetsPlugin = function() {
8051
7748
  var value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
8052
7749
  if (value && value.state_type === "ACTION") {
8053
7750
  var exp = value.exp;
8054
- var result = expressionEvaluator.evaluate(exp);
8055
- if (isPromiselike(result)) {
8056
- _this.logger.warn("Async expression used as return value in in non-async context, transitioning with '*' value");
8057
- }
8058
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7751
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(expressionEvaluator === null || expressionEvaluator === void 0 ? void 0 : expressionEvaluator.evaluate(exp)));
8059
7752
  }
8060
7753
  expressionEvaluator.reset();
8061
7754
  });
8062
- var _this1 = _this;
8063
- flow.hooks.afterTransition.tap("player", function() {
8064
- var _ref = _async_to_generator(function(flowInstance) {
8065
- var _flowInstance_currentState, value, exp, result, e;
8066
- return _ts_generator(this, function(_state) {
8067
- switch(_state.label){
8068
- case 0:
8069
- value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
8070
- if (!(value && value.state_type === "ASYNC_ACTION")) return [
8071
- 3,
8072
- 8
8073
- ];
8074
- exp = value.exp;
8075
- _state.label = 1;
8076
- case 1:
8077
- _state.trys.push([
8078
- 1,
8079
- 7,
8080
- ,
8081
- 8
8082
- ]);
8083
- result = expressionEvaluator.evaluateAsync(exp);
8084
- if (!isPromiselike(result)) return [
8085
- 3,
8086
- 5
8087
- ];
8088
- if (!value.await) return [
8089
- 3,
8090
- 3
8091
- ];
8092
- return [
8093
- 4,
8094
- result
8095
- ];
8096
- case 2:
8097
- result = _state.sent();
8098
- return [
8099
- 3,
8100
- 4
8101
- ];
8102
- case 3:
8103
- _this1.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
8104
- _state.label = 4;
8105
- case 4:
8106
- return [
8107
- 3,
8108
- 6
8109
- ];
8110
- case 5:
8111
- _this1.logger.warn("Non async expression used in async action node");
8112
- _state.label = 6;
8113
- case 6:
8114
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
8115
- return [
8116
- 3,
8117
- 8
8118
- ];
8119
- case 7:
8120
- e = _state.sent();
8121
- flowResultDeferred.reject(e);
8122
- return [
8123
- 3,
8124
- 8
8125
- ];
8126
- case 8:
8127
- expressionEvaluator.reset();
8128
- return [
8129
- 2
8130
- ];
8131
- }
8132
- });
8133
- });
8134
- return function(flowInstance) {
8135
- return _ref.apply(this, arguments);
8136
- };
8137
- }());
8138
7755
  });
8139
7756
  this.hooks.dataController.call(dataController);
8140
7757
  validationController.setOptions({