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