@cadenza.io/service 2.17.71 → 2.17.72
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/browser/index.js +126 -121
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +126 -121
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.js +126 -121
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +126 -121
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.mjs
CHANGED
|
@@ -5594,6 +5594,14 @@ function decomposeSignalName(signalName) {
|
|
|
5594
5594
|
}
|
|
5595
5595
|
|
|
5596
5596
|
// src/signals/SignalController.ts
|
|
5597
|
+
function buildSignalDatabaseTriggerContext(data) {
|
|
5598
|
+
return {
|
|
5599
|
+
data: { ...data },
|
|
5600
|
+
queryData: {
|
|
5601
|
+
data: { ...data }
|
|
5602
|
+
}
|
|
5603
|
+
};
|
|
5604
|
+
}
|
|
5597
5605
|
var SignalController = class _SignalController {
|
|
5598
5606
|
static get instance() {
|
|
5599
5607
|
if (!this._instance) this._instance = new _SignalController();
|
|
@@ -5619,15 +5627,16 @@ var SignalController = class _SignalController {
|
|
|
5619
5627
|
(ctx, emit) => {
|
|
5620
5628
|
const { signalName } = ctx;
|
|
5621
5629
|
const { isMeta, isGlobal, domain, action } = decomposeSignalName(signalName);
|
|
5622
|
-
emit(
|
|
5623
|
-
|
|
5630
|
+
emit(
|
|
5631
|
+
"global.meta.signal_controller.signal_added",
|
|
5632
|
+
buildSignalDatabaseTriggerContext({
|
|
5624
5633
|
name: signalName,
|
|
5625
5634
|
isGlobal,
|
|
5626
5635
|
domain,
|
|
5627
5636
|
action,
|
|
5628
5637
|
isMeta
|
|
5629
|
-
}
|
|
5630
|
-
|
|
5638
|
+
})
|
|
5639
|
+
);
|
|
5631
5640
|
return ctx;
|
|
5632
5641
|
},
|
|
5633
5642
|
"Handles signal registration from a service instance"
|
|
@@ -5791,6 +5800,23 @@ function registerActorSessionPersistenceTasks() {
|
|
|
5791
5800
|
}
|
|
5792
5801
|
|
|
5793
5802
|
// src/graph/controllers/GraphMetadataController.ts
|
|
5803
|
+
function buildDatabaseTriggerContext(data, filter, extra = {}) {
|
|
5804
|
+
const nextData = data && typeof data === "object" ? { ...data } : void 0;
|
|
5805
|
+
const nextFilter = filter && typeof filter === "object" ? { ...filter } : void 0;
|
|
5806
|
+
const queryData = {};
|
|
5807
|
+
if (nextData !== void 0) {
|
|
5808
|
+
queryData.data = nextData;
|
|
5809
|
+
}
|
|
5810
|
+
if (nextFilter !== void 0) {
|
|
5811
|
+
queryData.filter = nextFilter;
|
|
5812
|
+
}
|
|
5813
|
+
return {
|
|
5814
|
+
...extra,
|
|
5815
|
+
...nextData !== void 0 ? { data: nextData } : {},
|
|
5816
|
+
...nextFilter !== void 0 ? { filter: nextFilter } : {},
|
|
5817
|
+
...Object.keys(queryData).length > 0 ? { queryData } : {}
|
|
5818
|
+
};
|
|
5819
|
+
}
|
|
5794
5820
|
var GraphMetadataController = class _GraphMetadataController {
|
|
5795
5821
|
static get instance() {
|
|
5796
5822
|
if (!this._instance) this._instance = new _GraphMetadataController();
|
|
@@ -5798,21 +5824,19 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
5798
5824
|
}
|
|
5799
5825
|
constructor() {
|
|
5800
5826
|
CadenzaService.createMetaTask("Handle task creation", (ctx) => {
|
|
5801
|
-
return {
|
|
5802
|
-
data
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
}
|
|
5806
|
-
};
|
|
5827
|
+
return buildDatabaseTriggerContext({
|
|
5828
|
+
...ctx.data,
|
|
5829
|
+
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
5830
|
+
});
|
|
5807
5831
|
}).doOn("meta.task.created").emits("global.meta.graph_metadata.task_created");
|
|
5808
5832
|
CadenzaService.createMetaTask("Handle task update", (ctx) => {
|
|
5809
|
-
return
|
|
5810
|
-
|
|
5811
|
-
|
|
5833
|
+
return buildDatabaseTriggerContext(
|
|
5834
|
+
ctx.data ?? void 0,
|
|
5835
|
+
{
|
|
5812
5836
|
...ctx.filter,
|
|
5813
5837
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
5814
5838
|
}
|
|
5815
|
-
|
|
5839
|
+
);
|
|
5816
5840
|
}).doOn("meta.task.layer_index_changed", "meta.task.destroyed").emits("global.meta.graph_metadata.task_updated");
|
|
5817
5841
|
CadenzaService.createMetaTask("Handle task relationship creation", (ctx) => {
|
|
5818
5842
|
const taskName = ctx.data?.taskName ?? ctx.data?.task_name;
|
|
@@ -5822,114 +5846,101 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
5822
5846
|
if (!task?.registered || !predecessorTask?.registered) {
|
|
5823
5847
|
return false;
|
|
5824
5848
|
}
|
|
5825
|
-
return {
|
|
5826
|
-
data
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
}
|
|
5831
|
-
};
|
|
5849
|
+
return buildDatabaseTriggerContext({
|
|
5850
|
+
...ctx.data,
|
|
5851
|
+
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
5852
|
+
predecessorServiceName: CadenzaService.serviceRegistry.serviceName
|
|
5853
|
+
});
|
|
5832
5854
|
}).doOn("meta.task.relationship_added").emits("global.meta.graph_metadata.task_relationship_created");
|
|
5833
5855
|
CadenzaService.createMetaTask("Handle task error", (ctx) => {
|
|
5834
5856
|
CadenzaService.log(`Error in task ${ctx.data.taskName}`, ctx.data, "error");
|
|
5835
5857
|
}).doOn("meta.node.errored");
|
|
5836
5858
|
CadenzaService.createMetaTask("Handle task signal observation", (ctx) => {
|
|
5837
5859
|
const isGlobal = ctx.signalName.startsWith("global.");
|
|
5838
|
-
return {
|
|
5839
|
-
data
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
}
|
|
5844
|
-
};
|
|
5860
|
+
return buildDatabaseTriggerContext({
|
|
5861
|
+
...ctx.data,
|
|
5862
|
+
isGlobal,
|
|
5863
|
+
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
5864
|
+
});
|
|
5845
5865
|
}).doOn("meta.task.observed_signal").emits("global.meta.graph_metadata.task_signal_observed");
|
|
5846
5866
|
CadenzaService.createMetaTask("Handle task signal attachment", (ctx) => {
|
|
5847
|
-
return
|
|
5848
|
-
data
|
|
5849
|
-
|
|
5850
|
-
},
|
|
5851
|
-
filter: {
|
|
5867
|
+
return buildDatabaseTriggerContext(
|
|
5868
|
+
ctx.data ?? void 0,
|
|
5869
|
+
{
|
|
5852
5870
|
...ctx.filter,
|
|
5853
5871
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
5854
5872
|
}
|
|
5855
|
-
|
|
5873
|
+
);
|
|
5856
5874
|
}).doOn("meta.task.attached_signal").emits("global.meta.graph_metadata.task_attached_signal");
|
|
5857
5875
|
CadenzaService.createMetaTask("Handle task unsubscribing signal", (ctx) => {
|
|
5858
|
-
return
|
|
5859
|
-
|
|
5876
|
+
return buildDatabaseTriggerContext(
|
|
5877
|
+
{
|
|
5860
5878
|
deleted: true
|
|
5861
5879
|
},
|
|
5862
|
-
|
|
5880
|
+
{
|
|
5863
5881
|
...ctx.filter,
|
|
5864
5882
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
5865
5883
|
}
|
|
5866
|
-
|
|
5884
|
+
);
|
|
5867
5885
|
}).doOn("meta.task.unsubscribed_signal").emits("meta.graph_metadata.task_unsubscribed_signal");
|
|
5868
5886
|
CadenzaService.createMetaTask("Handle task detaching signal", (ctx) => {
|
|
5869
|
-
return
|
|
5870
|
-
|
|
5887
|
+
return buildDatabaseTriggerContext(
|
|
5888
|
+
{
|
|
5871
5889
|
deleted: true
|
|
5872
5890
|
},
|
|
5873
|
-
|
|
5891
|
+
{
|
|
5874
5892
|
...ctx.filter,
|
|
5875
5893
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
5876
5894
|
}
|
|
5877
|
-
|
|
5895
|
+
);
|
|
5878
5896
|
}).doOn("meta.task.detached_signal").emits("global.meta.graph_metadata.task_detached_signal");
|
|
5879
5897
|
CadenzaService.createMetaTask("Handle routine creation", (ctx) => {
|
|
5880
|
-
return {
|
|
5881
|
-
data
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
}
|
|
5885
|
-
};
|
|
5898
|
+
return buildDatabaseTriggerContext({
|
|
5899
|
+
...ctx.data,
|
|
5900
|
+
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
5901
|
+
});
|
|
5886
5902
|
}).doAfter(CadenzaService.registry.registerRoutine).emits("global.meta.graph_metadata.routine_created");
|
|
5887
5903
|
CadenzaService.createMetaTask("Handle routine update", (ctx) => {
|
|
5888
|
-
return
|
|
5889
|
-
|
|
5890
|
-
|
|
5904
|
+
return buildDatabaseTriggerContext(
|
|
5905
|
+
ctx.data ?? void 0,
|
|
5906
|
+
{
|
|
5891
5907
|
...ctx.filter,
|
|
5892
5908
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
5893
5909
|
}
|
|
5894
|
-
|
|
5910
|
+
);
|
|
5895
5911
|
}).doOn("meta.routine.destroyed").emits("global.meta.graph_metadata.routine_updated");
|
|
5896
5912
|
CadenzaService.createMetaTask("Handle adding task to routine", (ctx) => {
|
|
5897
|
-
return {
|
|
5898
|
-
data
|
|
5899
|
-
|
|
5900
|
-
|
|
5901
|
-
}
|
|
5902
|
-
};
|
|
5913
|
+
return buildDatabaseTriggerContext({
|
|
5914
|
+
...ctx.data,
|
|
5915
|
+
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
5916
|
+
});
|
|
5903
5917
|
}).doOn("meta.routine.task_added").emits("global.meta.graph_metadata.task_added_to_routine");
|
|
5904
5918
|
CadenzaService.createMetaTask("Handle new trace", (ctx) => {
|
|
5905
|
-
return {
|
|
5906
|
-
data
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
}
|
|
5911
|
-
};
|
|
5919
|
+
return buildDatabaseTriggerContext({
|
|
5920
|
+
...ctx.data,
|
|
5921
|
+
service_name: CadenzaService.serviceRegistry.serviceName,
|
|
5922
|
+
service_instance_id: CadenzaService.serviceRegistry.serviceInstanceId
|
|
5923
|
+
});
|
|
5912
5924
|
}).doOn("meta.runner.new_trace", "sub_meta.signal_broker.new_trace").emits("global.meta.graph_metadata.execution_trace_created");
|
|
5913
5925
|
CadenzaService.createMetaTask(
|
|
5914
5926
|
"Handle routine execution creation",
|
|
5915
5927
|
(ctx) => {
|
|
5916
|
-
return {
|
|
5917
|
-
|
|
5918
|
-
|
|
5919
|
-
|
|
5920
|
-
|
|
5921
|
-
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
5922
|
-
}
|
|
5923
|
-
}
|
|
5924
|
-
};
|
|
5928
|
+
return buildDatabaseTriggerContext({
|
|
5929
|
+
...ctx.data,
|
|
5930
|
+
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
5931
|
+
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
5932
|
+
});
|
|
5925
5933
|
},
|
|
5926
5934
|
"Handles routine execution creation",
|
|
5927
5935
|
{ concurrency: 100, isSubMeta: true }
|
|
5928
5936
|
).doOn("meta.runner.added_tasks").emits("global.meta.graph_metadata.routine_execution_created");
|
|
5929
5937
|
CadenzaService.createMetaTask(
|
|
5930
5938
|
"Handle routine execution started",
|
|
5931
|
-
() => {
|
|
5932
|
-
return
|
|
5939
|
+
(ctx) => {
|
|
5940
|
+
return buildDatabaseTriggerContext(
|
|
5941
|
+
ctx.data ?? void 0,
|
|
5942
|
+
ctx.filter ?? void 0
|
|
5943
|
+
);
|
|
5933
5944
|
},
|
|
5934
5945
|
"Handles routine execution started",
|
|
5935
5946
|
{ concurrency: 100, isSubMeta: true }
|
|
@@ -5937,16 +5948,14 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
5937
5948
|
CadenzaService.createMetaTask(
|
|
5938
5949
|
"Handle routine execution ended",
|
|
5939
5950
|
(ctx) => {
|
|
5940
|
-
return
|
|
5941
|
-
|
|
5951
|
+
return buildDatabaseTriggerContext(
|
|
5952
|
+
{
|
|
5942
5953
|
...ctx.data,
|
|
5943
5954
|
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
5944
5955
|
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
5945
5956
|
},
|
|
5946
|
-
filter
|
|
5947
|
-
|
|
5948
|
-
}
|
|
5949
|
-
};
|
|
5957
|
+
ctx.filter ?? void 0
|
|
5958
|
+
);
|
|
5950
5959
|
},
|
|
5951
5960
|
"Handles routine execution ended",
|
|
5952
5961
|
{ concurrency: 100, isSubMeta: true }
|
|
@@ -5954,29 +5963,33 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
5954
5963
|
CadenzaService.createMetaTask(
|
|
5955
5964
|
"Handle task execution creation",
|
|
5956
5965
|
(ctx) => {
|
|
5957
|
-
return {
|
|
5958
|
-
data
|
|
5959
|
-
|
|
5960
|
-
|
|
5961
|
-
|
|
5962
|
-
}
|
|
5963
|
-
};
|
|
5966
|
+
return buildDatabaseTriggerContext({
|
|
5967
|
+
...ctx.data,
|
|
5968
|
+
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
5969
|
+
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
5970
|
+
});
|
|
5964
5971
|
},
|
|
5965
5972
|
"Handles task execution creation",
|
|
5966
5973
|
{ concurrency: 100, isSubMeta: true }
|
|
5967
5974
|
).doOn("meta.node.scheduled").emits("global.meta.graph_metadata.task_execution_created");
|
|
5968
5975
|
CadenzaService.createMetaTask(
|
|
5969
5976
|
"Handle task execution mapped",
|
|
5970
|
-
() => {
|
|
5971
|
-
return
|
|
5977
|
+
(ctx) => {
|
|
5978
|
+
return buildDatabaseTriggerContext(
|
|
5979
|
+
ctx.data ?? void 0,
|
|
5980
|
+
ctx.filter ?? void 0
|
|
5981
|
+
);
|
|
5972
5982
|
},
|
|
5973
5983
|
"Handles task execution mapping",
|
|
5974
5984
|
{ concurrency: 100, isSubMeta: true }
|
|
5975
5985
|
).doOn("meta.node.mapped", "meta.node.detected_previous_task_execution").emits("global.meta.graph_metadata.task_execution_mapped");
|
|
5976
5986
|
CadenzaService.createMetaTask(
|
|
5977
5987
|
"Handle task execution started",
|
|
5978
|
-
() => {
|
|
5979
|
-
return
|
|
5988
|
+
(ctx) => {
|
|
5989
|
+
return buildDatabaseTriggerContext(
|
|
5990
|
+
ctx.data ?? void 0,
|
|
5991
|
+
ctx.filter ?? void 0
|
|
5992
|
+
);
|
|
5980
5993
|
},
|
|
5981
5994
|
"Handles task execution started",
|
|
5982
5995
|
{ concurrency: 100, isSubMeta: true }
|
|
@@ -5984,16 +5997,14 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
5984
5997
|
CadenzaService.createMetaTask(
|
|
5985
5998
|
"Handle task execution ended",
|
|
5986
5999
|
(ctx) => {
|
|
5987
|
-
return
|
|
5988
|
-
|
|
6000
|
+
return buildDatabaseTriggerContext(
|
|
6001
|
+
{
|
|
5989
6002
|
...ctx.data,
|
|
5990
6003
|
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
5991
6004
|
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
5992
6005
|
},
|
|
5993
|
-
filter
|
|
5994
|
-
|
|
5995
|
-
}
|
|
5996
|
-
};
|
|
6006
|
+
ctx.filter ?? void 0
|
|
6007
|
+
);
|
|
5997
6008
|
},
|
|
5998
6009
|
"Handles task execution ended",
|
|
5999
6010
|
{ concurrency: 100, isSubMeta: true }
|
|
@@ -6001,45 +6012,39 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6001
6012
|
CadenzaService.createMetaTask(
|
|
6002
6013
|
"Handle task execution relationship creation",
|
|
6003
6014
|
(ctx) => {
|
|
6004
|
-
return
|
|
6005
|
-
|
|
6015
|
+
return buildDatabaseTriggerContext(
|
|
6016
|
+
{
|
|
6006
6017
|
executionCount: "increment",
|
|
6007
6018
|
lastExecuted: formatTimestamp(Date.now())
|
|
6008
6019
|
},
|
|
6009
|
-
|
|
6020
|
+
{
|
|
6010
6021
|
...ctx.filter,
|
|
6011
6022
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6012
6023
|
}
|
|
6013
|
-
|
|
6024
|
+
);
|
|
6014
6025
|
},
|
|
6015
6026
|
"Handles task execution relationship creation",
|
|
6016
6027
|
{ concurrency: 100, isSubMeta: true }
|
|
6017
6028
|
).doOn("meta.node.mapped", "meta.node.detected_previous_task_execution").emits("global.meta.graph_metadata.relationship_executed");
|
|
6018
6029
|
CadenzaService.createMetaTask("Handle actor creation", (ctx) => {
|
|
6019
|
-
return {
|
|
6020
|
-
data
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
}
|
|
6024
|
-
};
|
|
6030
|
+
return buildDatabaseTriggerContext({
|
|
6031
|
+
...ctx.data,
|
|
6032
|
+
service_name: CadenzaService.serviceRegistry.serviceName
|
|
6033
|
+
});
|
|
6025
6034
|
}).doOn("meta.actor.created").emits("global.meta.graph_metadata.actor_created");
|
|
6026
6035
|
CadenzaService.createMetaTask("Handle actor task association", (ctx) => {
|
|
6027
|
-
return {
|
|
6028
|
-
data
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
}
|
|
6032
|
-
};
|
|
6036
|
+
return buildDatabaseTriggerContext({
|
|
6037
|
+
...ctx.data,
|
|
6038
|
+
service_name: CadenzaService.serviceRegistry.serviceName
|
|
6039
|
+
});
|
|
6033
6040
|
}).doOn("meta.actor.task_associated").emits("global.meta.graph_metadata.actor_task_associated");
|
|
6034
6041
|
registerActorSessionPersistenceTasks();
|
|
6035
6042
|
CadenzaService.createMetaTask("Handle Intent Creation", (ctx) => {
|
|
6036
6043
|
const intentName = ctx.data?.name;
|
|
6037
|
-
return {
|
|
6038
|
-
data
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
}
|
|
6042
|
-
};
|
|
6044
|
+
return buildDatabaseTriggerContext({
|
|
6045
|
+
...ctx.data,
|
|
6046
|
+
isMeta: intentName ? isMetaIntentName(intentName) : false
|
|
6047
|
+
});
|
|
6043
6048
|
}).doOn("meta.inquiry_broker.added").emits("global.meta.graph_metadata.intent_created");
|
|
6044
6049
|
}
|
|
6045
6050
|
};
|