@cadenza.io/core 1.11.8 → 1.11.9
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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +36 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +36 -10
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -468,6 +468,8 @@ declare class Task extends SignalParticipant implements Graph {
|
|
|
468
468
|
setOutputContextSchema(schema: SchemaDefinition): void;
|
|
469
469
|
setValidateInputContext(value: boolean): void;
|
|
470
470
|
setValidateOutputContext(value: boolean): void;
|
|
471
|
+
private emitWithMetadata;
|
|
472
|
+
private emitMetricsWithMetadata;
|
|
471
473
|
/**
|
|
472
474
|
* Validates a context deeply against a schema.
|
|
473
475
|
* @param data - The data to validate (input context or output result).
|
package/dist/index.d.ts
CHANGED
|
@@ -468,6 +468,8 @@ declare class Task extends SignalParticipant implements Graph {
|
|
|
468
468
|
setOutputContextSchema(schema: SchemaDefinition): void;
|
|
469
469
|
setValidateInputContext(value: boolean): void;
|
|
470
470
|
setValidateOutputContext(value: boolean): void;
|
|
471
|
+
private emitWithMetadata;
|
|
472
|
+
private emitMetricsWithMetadata;
|
|
471
473
|
/**
|
|
472
474
|
* Validates a context deeply against a schema.
|
|
473
475
|
* @param data - The data to validate (input context or output result).
|
package/dist/index.js
CHANGED
|
@@ -977,6 +977,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
977
977
|
if (!this.task.isHidden) {
|
|
978
978
|
data.__signalEmission = {
|
|
979
979
|
taskId: this.task.id,
|
|
980
|
+
taskName: this.task.name,
|
|
980
981
|
taskExecutionId: this.id
|
|
981
982
|
};
|
|
982
983
|
data.__metadata = {
|
|
@@ -990,6 +991,7 @@ var GraphNode = class _GraphNode extends SignalEmitter {
|
|
|
990
991
|
if (!this.task.isHidden) {
|
|
991
992
|
data.__signalEmission = {
|
|
992
993
|
taskId: this.task.id,
|
|
994
|
+
taskName: this.task.name,
|
|
993
995
|
taskExecutionId: this.id,
|
|
994
996
|
isMetric: true
|
|
995
997
|
};
|
|
@@ -1543,7 +1545,7 @@ var Task = class extends SignalParticipant {
|
|
|
1543
1545
|
* @edge Emits 'meta.task.created' with { __task: this } for seed.
|
|
1544
1546
|
*/
|
|
1545
1547
|
constructor(name, task, description = "", concurrency = 0, timeout = 0, register = true, isUnique = false, isMeta = false, isSubMeta = false, isHidden = false, getTagCallback = void 0, inputSchema = void 0, validateInputContext = false, outputSchema = void 0, validateOutputContext = false, retryCount = 0, retryDelay = 0, retryDelayMax = 0, retryDelayFactor = 1) {
|
|
1546
|
-
super();
|
|
1548
|
+
super(isSubMeta || isHidden);
|
|
1547
1549
|
this.isMeta = false;
|
|
1548
1550
|
this.isSubMeta = false;
|
|
1549
1551
|
this.isHidden = false;
|
|
@@ -1591,7 +1593,7 @@ var Task = class extends SignalParticipant {
|
|
|
1591
1593
|
}
|
|
1592
1594
|
if (register && !this.isHidden && !this.isSubMeta) {
|
|
1593
1595
|
const { __functionString, __getTagCallback } = this.export();
|
|
1594
|
-
this.
|
|
1596
|
+
this.emitWithMetadata("meta.task.created", {
|
|
1595
1597
|
__task: {
|
|
1596
1598
|
uuid: this.id,
|
|
1597
1599
|
name: this.name,
|
|
@@ -1626,7 +1628,10 @@ var Task = class extends SignalParticipant {
|
|
|
1626
1628
|
setGlobalId(id) {
|
|
1627
1629
|
const oldId = this.id;
|
|
1628
1630
|
this.id = id;
|
|
1629
|
-
this.
|
|
1631
|
+
this.emitWithMetadata("meta.task.global_id_set", {
|
|
1632
|
+
__id: this.id,
|
|
1633
|
+
__oldId: oldId
|
|
1634
|
+
});
|
|
1630
1635
|
}
|
|
1631
1636
|
setTimeout(timeout) {
|
|
1632
1637
|
this.timeout = timeout;
|
|
@@ -1649,6 +1654,27 @@ var Task = class extends SignalParticipant {
|
|
|
1649
1654
|
setValidateOutputContext(value) {
|
|
1650
1655
|
this.validateOutputContext = value;
|
|
1651
1656
|
}
|
|
1657
|
+
emitWithMetadata(signal, ctx = {}) {
|
|
1658
|
+
const data = { ...ctx };
|
|
1659
|
+
if (!this.isHidden && !this.isSubMeta) {
|
|
1660
|
+
data.__signalEmission = {
|
|
1661
|
+
taskId: this.id,
|
|
1662
|
+
taskName: this.name
|
|
1663
|
+
};
|
|
1664
|
+
}
|
|
1665
|
+
this.emit(signal, data);
|
|
1666
|
+
}
|
|
1667
|
+
emitMetricsWithMetadata(signal, ctx = {}) {
|
|
1668
|
+
const data = { ...ctx };
|
|
1669
|
+
if (!this.isHidden && !this.isSubMeta) {
|
|
1670
|
+
data.__signalEmission = {
|
|
1671
|
+
taskId: this.id,
|
|
1672
|
+
taskName: this.name,
|
|
1673
|
+
isMetric: true
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1676
|
+
this.emitMetrics(signal, data);
|
|
1677
|
+
}
|
|
1652
1678
|
/**
|
|
1653
1679
|
* Validates a context deeply against a schema.
|
|
1654
1680
|
* @param data - The data to validate (input context or output result).
|
|
@@ -1765,7 +1791,7 @@ var Task = class extends SignalParticipant {
|
|
|
1765
1791
|
this.inputContextSchema
|
|
1766
1792
|
);
|
|
1767
1793
|
if (!validationResult.valid) {
|
|
1768
|
-
this.
|
|
1794
|
+
this.emitWithMetadata("meta.task.input_validation_failed", {
|
|
1769
1795
|
__taskId: this.id,
|
|
1770
1796
|
__taskName: this.name,
|
|
1771
1797
|
__context: context,
|
|
@@ -1787,7 +1813,7 @@ var Task = class extends SignalParticipant {
|
|
|
1787
1813
|
this.outputContextSchema
|
|
1788
1814
|
);
|
|
1789
1815
|
if (!validationResult.valid) {
|
|
1790
|
-
this.
|
|
1816
|
+
this.emitWithMetadata("meta.task.outputValidationFailed", {
|
|
1791
1817
|
__taskId: this.id,
|
|
1792
1818
|
__result: context,
|
|
1793
1819
|
__errors: validationResult.errors
|
|
@@ -1827,7 +1853,7 @@ var Task = class extends SignalParticipant {
|
|
|
1827
1853
|
this.decouple(pred);
|
|
1828
1854
|
throw new Error(`Cycle adding pred ${pred.name} to ${this.name}`);
|
|
1829
1855
|
}
|
|
1830
|
-
this.
|
|
1856
|
+
this.emitMetricsWithMetadata("meta.task.relationship_added", {
|
|
1831
1857
|
data: {
|
|
1832
1858
|
taskId: this.id,
|
|
1833
1859
|
predecessorTaskId: pred.id
|
|
@@ -1847,7 +1873,7 @@ var Task = class extends SignalParticipant {
|
|
|
1847
1873
|
this.decouple(next);
|
|
1848
1874
|
throw new Error(`Cycle adding next ${next.name} to ${this.name}`);
|
|
1849
1875
|
}
|
|
1850
|
-
this.
|
|
1876
|
+
this.emitMetricsWithMetadata("meta.task.relationship_added", {
|
|
1851
1877
|
data: {
|
|
1852
1878
|
taskId: next.id,
|
|
1853
1879
|
predecessorTaskId: this.id
|
|
@@ -1878,7 +1904,7 @@ var Task = class extends SignalParticipant {
|
|
|
1878
1904
|
this.decouple(task);
|
|
1879
1905
|
throw new Error(`Cycle adding onFail ${task.name} to ${this.name}`);
|
|
1880
1906
|
}
|
|
1881
|
-
this.
|
|
1907
|
+
this.emitMetricsWithMetadata("meta.task.on_fail_relationship_added", {
|
|
1882
1908
|
data: {
|
|
1883
1909
|
taskId: this.id,
|
|
1884
1910
|
onFailTaskId: task.id
|
|
@@ -1922,7 +1948,7 @@ var Task = class extends SignalParticipant {
|
|
|
1922
1948
|
);
|
|
1923
1949
|
this.layerIndex = maxPred + 1;
|
|
1924
1950
|
if (prevLayerIndex !== this.layerIndex) {
|
|
1925
|
-
this.
|
|
1951
|
+
this.emitMetricsWithMetadata("meta.task.layer_index_changed", {
|
|
1926
1952
|
data: {
|
|
1927
1953
|
layerIndex: this.layerIndex
|
|
1928
1954
|
},
|
|
@@ -1968,7 +1994,7 @@ var Task = class extends SignalParticipant {
|
|
|
1968
1994
|
this.predecessorTasks.clear();
|
|
1969
1995
|
this.onFailTasks.clear();
|
|
1970
1996
|
this.destroyed = true;
|
|
1971
|
-
this.
|
|
1997
|
+
this.emitMetricsWithMetadata("meta.task.destroyed", {
|
|
1972
1998
|
data: { deleted: true },
|
|
1973
1999
|
filter: { uuid: this.id }
|
|
1974
2000
|
});
|