@player-ui/check-path-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.
@@ -2531,9 +2531,10 @@ var CheckPathPlugin = function() {
2531
2531
  var import_timm7 = __toESM(require_timm(), 1);
2532
2532
  var import_timm8 = __toESM(require_timm(), 1);
2533
2533
  var import_p_defer = __toESM(require_p_defer(), 1);
2534
+ var import_queue_microtask = __toESM(require_queue_microtask(), 1);
2534
2535
  var import_p_defer2 = __toESM(require_p_defer(), 1);
2535
2536
  var import_timm9 = __toESM(require_timm(), 1);
2536
- var import_queue_microtask = __toESM(require_queue_microtask(), 1);
2537
+ var import_queue_microtask2 = __toESM(require_queue_microtask(), 1);
2537
2538
  // ../../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/@player-ui+partial-match-registry@0.0.0/node_modules/@player-ui/partial-match-registry/dist/index.mjs
2538
2539
  var import_sorted_array = __toESM(require_sorted_array(), 1);
2539
2540
  function traverseObj(object) {
@@ -5907,13 +5908,13 @@ var CheckPathPlugin = function() {
5907
5908
  this.isTransitioning = false;
5908
5909
  this.hooks = {
5909
5910
  beforeStart: new SyncBailHook(),
5910
- /** A callback when the onStart node was present */ onStart: new SyncHook(),
5911
- /** A callback when the onEnd node was present */ onEnd: new SyncHook(),
5912
- /** A hook to intercept and block a transition */ skipTransition: new SyncBailHook(),
5913
- /** A chance to manipulate the flow-node used to calculate the given transition used */ beforeTransition: new SyncWaterfallHook(),
5914
- /** A chance to manipulate the flow-node calculated after a transition */ resolveTransitionNode: new SyncWaterfallHook(),
5915
- /** A callback when a transition from 1 state to another was made */ transition: new SyncHook(),
5916
- /** A callback to run actions after a transition occurs */ afterTransition: new SyncHook()
5911
+ onStart: new SyncHook(),
5912
+ onEnd: new SyncHook(),
5913
+ skipTransition: new SyncBailHook(),
5914
+ beforeTransition: new SyncWaterfallHook(),
5915
+ resolveTransitionNode: new SyncWaterfallHook(),
5916
+ transition: new SyncHook(),
5917
+ afterTransition: new SyncHook()
5917
5918
  };
5918
5919
  this.id = id;
5919
5920
  this.flow = flow;
@@ -7003,7 +7004,7 @@ var CheckPathPlugin = function() {
7003
7004
  }
7004
7005
  if (!this.pendingUpdate.scheduled && !silent) {
7005
7006
  this.pendingUpdate.scheduled = true;
7006
- (0, import_queue_microtask.default)(function() {
7007
+ (0, import_queue_microtask2.default)(function() {
7007
7008
  var _this_pendingUpdate, _this_currentView;
7008
7009
  var updates = (_this_pendingUpdate = _this.pendingUpdate) === null || _this_pendingUpdate === void 0 ? void 0 : _this_pendingUpdate.changedBindings;
7009
7010
  _this.pendingUpdate = void 0;
@@ -7672,95 +7673,41 @@ var CheckPathPlugin = function() {
7672
7673
  validationController.reset();
7673
7674
  }
7674
7675
  });
7675
- flow.hooks.afterTransition.tap("player", function(flowInstance) {
7676
+ flow.hooks.afterTransition.tap("player-action-states", function(flowInstance) {
7676
7677
  var _flowInstance_currentState;
7677
7678
  var value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
7678
- if (value && value.state_type === "ACTION") {
7679
+ if (value && value.state_type === "ASYNC_ACTION") {
7679
7680
  var exp = value.exp;
7680
- var result = expressionEvaluator.evaluate(exp);
7681
- if (isPromiseLike(result)) {
7681
+ try {
7682
+ var result = expressionEvaluator.evaluateAsync(exp);
7683
+ if (isPromiseLike(result)) {
7684
+ if (value.await) {
7685
+ (0, import_queue_microtask.default)(function() {
7686
+ result.then(function(r) {
7687
+ return flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(r));
7688
+ }).catch(flowResultDeferred.reject);
7689
+ });
7690
+ } else {
7691
+ _this.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
7692
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7693
+ }
7694
+ } else {
7695
+ _this.logger.warn("Non async expression used in async action node");
7696
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7697
+ }
7698
+ } catch (e) {
7699
+ flowResultDeferred.reject(e);
7700
+ }
7701
+ } else if (value && value.state_type === "ACTION") {
7702
+ var exp1 = value.exp;
7703
+ var result1 = expressionEvaluator.evaluate(exp1);
7704
+ if (isPromiseLike(result1)) {
7682
7705
  _this.logger.warn("Async expression used as return value in in non-async context, transitioning with '*' value");
7683
7706
  }
7684
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7707
+ flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result1));
7685
7708
  }
7686
7709
  expressionEvaluator.reset();
7687
7710
  });
7688
- var _this1 = _this;
7689
- flow.hooks.afterTransition.tap("player", function() {
7690
- var _ref = _async_to_generator(function(flowInstance) {
7691
- var _flowInstance_currentState, value, exp, result, e;
7692
- return _ts_generator(this, function(_state) {
7693
- switch(_state.label){
7694
- case 0:
7695
- value = (_flowInstance_currentState = flowInstance.currentState) === null || _flowInstance_currentState === void 0 ? void 0 : _flowInstance_currentState.value;
7696
- if (!(value && value.state_type === "ASYNC_ACTION")) return [
7697
- 3,
7698
- 8
7699
- ];
7700
- exp = value.exp;
7701
- _state.label = 1;
7702
- case 1:
7703
- _state.trys.push([
7704
- 1,
7705
- 7,
7706
- ,
7707
- 8
7708
- ]);
7709
- result = expressionEvaluator.evaluateAsync(exp);
7710
- if (!isPromiseLike(result)) return [
7711
- 3,
7712
- 5
7713
- ];
7714
- if (!value.await) return [
7715
- 3,
7716
- 3
7717
- ];
7718
- return [
7719
- 4,
7720
- result
7721
- ];
7722
- case 2:
7723
- result = _state.sent();
7724
- return [
7725
- 3,
7726
- 4
7727
- ];
7728
- case 3:
7729
- _this1.logger.warn("Unawaited promise used as return value in in non-async context, transitioning with '*' value");
7730
- _state.label = 4;
7731
- case 4:
7732
- return [
7733
- 3,
7734
- 6
7735
- ];
7736
- case 5:
7737
- _this1.logger.warn("Non async expression used in async action node");
7738
- _state.label = 6;
7739
- case 6:
7740
- flowController === null || flowController === void 0 ? void 0 : flowController.transition(String(result));
7741
- return [
7742
- 3,
7743
- 8
7744
- ];
7745
- case 7:
7746
- e = _state.sent();
7747
- flowResultDeferred.reject(e);
7748
- return [
7749
- 3,
7750
- 8
7751
- ];
7752
- case 8:
7753
- expressionEvaluator.reset();
7754
- return [
7755
- 2
7756
- ];
7757
- }
7758
- });
7759
- });
7760
- return function(flowInstance) {
7761
- return _ref.apply(this, arguments);
7762
- };
7763
- }());
7764
7711
  });
7765
7712
  this.hooks.dataController.call(dataController);
7766
7713
  validationController.setOptions({