@cadenza.io/core 3.6.0 → 3.8.0

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.
package/dist/index.d.mts CHANGED
@@ -469,6 +469,7 @@ declare class Task extends SignalEmitter implements Graph {
469
469
  */
470
470
  emits(...signals: string[]): this;
471
471
  emitsOnFail(...signals: string[]): this;
472
+ attachSignal(signal: string, isOnFail?: boolean): void;
472
473
  /**
473
474
  * Unsubscribes from specific signals.
474
475
  * @param signals The signals.
package/dist/index.d.ts CHANGED
@@ -469,6 +469,7 @@ declare class Task extends SignalEmitter implements Graph {
469
469
  */
470
470
  emits(...signals: string[]): this;
471
471
  emitsOnFail(...signals: string[]): this;
472
+ attachSignal(signal: string, isOnFail?: boolean): void;
472
473
  /**
473
474
  * Unsubscribes from specific signals.
474
475
  * @param signals The signals.
package/dist/index.js CHANGED
@@ -2008,36 +2008,30 @@ var Task = class extends SignalEmitter {
2008
2008
  emits(...signals) {
2009
2009
  signals.forEach((signal) => {
2010
2010
  this.signalsToEmitAfter.add(signal);
2011
- this.emitsSignals.add(signal);
2012
- if (this.register) {
2013
- this.emitWithMetadata("meta.task.attached_signal", {
2014
- data: {
2015
- signalName: signal.split(":")[0],
2016
- taskName: this.name,
2017
- taskVersion: this.version
2018
- }
2019
- });
2020
- }
2011
+ this.attachSignal(signal);
2021
2012
  });
2022
2013
  return this;
2023
2014
  }
2024
2015
  emitsOnFail(...signals) {
2025
2016
  signals.forEach((signal) => {
2026
2017
  this.signalsToEmitOnFail.add(signal);
2027
- this.emitsSignals.add(signal);
2028
- if (this.register) {
2029
- this.emitWithMetadata("meta.task.attached_signal", {
2030
- data: {
2031
- signalName: signal,
2032
- taskName: this.name,
2033
- taskVersion: this.version,
2034
- isOnFail: true
2035
- }
2036
- });
2037
- }
2018
+ this.attachSignal(signal, true);
2038
2019
  });
2039
2020
  return this;
2040
2021
  }
2022
+ attachSignal(signal, isOnFail = false) {
2023
+ this.emitsSignals.add(signal);
2024
+ if (this.register) {
2025
+ this.emitWithMetadata("meta.task.attached_signal", {
2026
+ data: {
2027
+ signalName: signal.split(":")[0],
2028
+ taskName: this.name,
2029
+ taskVersion: this.version,
2030
+ isOnFail
2031
+ }
2032
+ });
2033
+ }
2034
+ }
2041
2035
  /**
2042
2036
  * Unsubscribes from specific signals.
2043
2037
  * @param signals The signals.