@player-ui/reference-assets-plugin 0.13.0-next.1 → 0.13.0-next.3

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.
@@ -2933,9 +2933,10 @@ var ReferenceAssetsPlugin = function() {
2933
2933
  var import_timm7 = __toESM(require_timm(), 1);
2934
2934
  var import_timm8 = __toESM(require_timm(), 1);
2935
2935
  var import_p_defer = __toESM(require_p_defer(), 1);
2936
+ var import_queue_microtask = __toESM(require_queue_microtask(), 1);
2936
2937
  var import_p_defer2 = __toESM(require_p_defer(), 1);
2937
2938
  var import_timm9 = __toESM(require_timm(), 1);
2938
- var import_queue_microtask = __toESM(require_queue_microtask(), 1);
2939
+ var import_queue_microtask2 = __toESM(require_queue_microtask(), 1);
2939
2940
  var __defProp2 = Object.defineProperty;
2940
2941
  var __export2 = function(target, all) {
2941
2942
  for(var name in all)__defProp2(target, name, {
@@ -6294,13 +6295,13 @@ var ReferenceAssetsPlugin = function() {
6294
6295
  this.isTransitioning = false;
6295
6296
  this.hooks = {
6296
6297
  beforeStart: new SyncBailHook(),
6297
- /** A callback when the onStart node was present */ onStart: new SyncHook(),
6298
- /** A callback when the onEnd node was present */ onEnd: new SyncHook(),
6299
- /** A hook to intercept and block a transition */ skipTransition: new SyncBailHook(),
6300
- /** A chance to manipulate the flow-node used to calculate the given transition used */ beforeTransition: new SyncWaterfallHook(),
6301
- /** A chance to manipulate the flow-node calculated after a transition */ resolveTransitionNode: new SyncWaterfallHook(),
6302
- /** A callback when a transition from 1 state to another was made */ transition: new SyncHook(),
6303
- /** A callback to run actions after a transition occurs */ afterTransition: new SyncHook()
6298
+ onStart: new SyncHook(),
6299
+ onEnd: new SyncHook(),
6300
+ skipTransition: new SyncBailHook(),
6301
+ beforeTransition: new SyncWaterfallHook(),
6302
+ resolveTransitionNode: new SyncWaterfallHook(),
6303
+ transition: new SyncHook(),
6304
+ afterTransition: new SyncHook()
6304
6305
  };
6305
6306
  this.id = id;
6306
6307
  this.flow = flow;
@@ -7390,7 +7391,7 @@ var ReferenceAssetsPlugin = function() {
7390
7391
  }
7391
7392
  if (!this.pendingUpdate.scheduled && !silent) {
7392
7393
  this.pendingUpdate.scheduled = true;
7393
- (0, import_queue_microtask.default)(function() {
7394
+ (0, import_queue_microtask2.default)(function() {
7394
7395
  var _this_pendingUpdate, _this_currentView;
7395
7396
  var updates = (_this_pendingUpdate = _this.pendingUpdate) === null || _this_pendingUpdate === void 0 ? void 0 : _this_pendingUpdate.changedBindings;
7396
7397
  _this.pendingUpdate = void 0;
@@ -8059,95 +8060,41 @@ var ReferenceAssetsPlugin = function() {
8059
8060
  validationController.reset();
8060
8061
  }
8061
8062
  });
8062
- flow.hooks.afterTransition.tap("player", function(flowInstance) {
8063
+ flow.hooks.afterTransition.tap("player-action-states", function(flowInstance) {
8063
8064
  var _flowInstance_currentState;
8064
8065
  var value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
8065
- if (value && value.state_type === "ACTION") {
8066
+ if (value && value.state_type === "ASYNC_ACTION") {
8066
8067
  var exp = value.exp;
8067
- var result = expressionEvaluator.evaluate(exp);
8068
- if (isPromiseLike(result)) {
8068
+ try {
8069
+ var result = expressionEvaluator.evaluateAsync(exp);
8070
+ if (isPromiseLike(result)) {
8071
+ if (value.await) {
8072
+ (0, import_queue_microtask.default)(function() {
8073
+ result.then(function(r) {
8074
+ return flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(r));
8075
+ }).catch(flowResultDeferred.reject);
8076
+ });
8077
+ } else {
8078
+ _this.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
8079
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
8080
+ }
8081
+ } else {
8082
+ _this.logger.warn("Non async expression used in async action node");
8083
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
8084
+ }
8085
+ } catch (e) {
8086
+ flowResultDeferred.reject(e);
8087
+ }
8088
+ } else if (value && value.state_type === "ACTION") {
8089
+ var exp1 = value.exp;
8090
+ var result1 = expressionEvaluator.evaluate(exp1);
8091
+ if (isPromiseLike(result1)) {
8069
8092
  _this.logger.warn("Async expression used as return value in in non-async context, transitioning with '*' value");
8070
8093
  }
8071
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
8094
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result1));
8072
8095
  }
8073
8096
  expressionEvaluator.reset();
8074
8097
  });
8075
- var _this1 = _this;
8076
- flow.hooks.afterTransition.tap("player", function() {
8077
- var _ref = _async_to_generator(function(flowInstance) {
8078
- var _flowInstance_currentState, value, exp, result, e;
8079
- return _ts_generator(this, function(_state) {
8080
- switch(_state.label){
8081
- case 0:
8082
- value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
8083
- if (!(value && value.state_type === "ASYNC_ACTION")) return [
8084
- 3,
8085
- 8
8086
- ];
8087
- exp = value.exp;
8088
- _state.label = 1;
8089
- case 1:
8090
- _state.trys.push([
8091
- 1,
8092
- 7,
8093
- ,
8094
- 8
8095
- ]);
8096
- result = expressionEvaluator.evaluateAsync(exp);
8097
- if (!isPromiseLike(result)) return [
8098
- 3,
8099
- 5
8100
- ];
8101
- if (!value.await) return [
8102
- 3,
8103
- 3
8104
- ];
8105
- return [
8106
- 4,
8107
- result
8108
- ];
8109
- case 2:
8110
- result = _state.sent();
8111
- return [
8112
- 3,
8113
- 4
8114
- ];
8115
- case 3:
8116
- _this1.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
8117
- _state.label = 4;
8118
- case 4:
8119
- return [
8120
- 3,
8121
- 6
8122
- ];
8123
- case 5:
8124
- _this1.logger.warn("Non async expression used in async action node");
8125
- _state.label = 6;
8126
- case 6:
8127
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
8128
- return [
8129
- 3,
8130
- 8
8131
- ];
8132
- case 7:
8133
- e = _state.sent();
8134
- flowResultDeferred.reject(e);
8135
- return [
8136
- 3,
8137
- 8
8138
- ];
8139
- case 8:
8140
- expressionEvaluator.reset();
8141
- return [
8142
- 2
8143
- ];
8144
- }
8145
- });
8146
- });
8147
- return function(flowInstance) {
8148
- return _ref.apply(this, arguments);
8149
- };
8150
- }());
8151
8098
  });
8152
8099
  this.hooks.dataController.call(dataController);
8153
8100
  validationController.setOptions({
@@ -8311,7 +8258,7 @@ var ReferenceAssetsPlugin = function() {
8311
8258
  commit: COMMIT
8312
8259
  };
8313
8260
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+async-node-plugin@0.0.0/node_modules/@player-ui/async-node-plugin/dist/index.mjs
8314
- var import_queue_microtask2 = __toESM(require_queue_microtask(), 1);
8261
+ var import_queue_microtask3 = __toESM(require_queue_microtask(), 1);
8315
8262
  var import_timm10 = __toESM(require_timm(), 1);
8316
8263
  var asyncTransform = function(assetId, wrapperAssetType, asset, flatten2) {
8317
8264
  var id = "async-" + assetId;