@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/index.js
CHANGED
|
@@ -6111,6 +6111,14 @@ function decomposeSignalName(signalName) {
|
|
|
6111
6111
|
}
|
|
6112
6112
|
|
|
6113
6113
|
// src/signals/SignalController.ts
|
|
6114
|
+
function buildSignalDatabaseTriggerContext(data) {
|
|
6115
|
+
return {
|
|
6116
|
+
data: { ...data },
|
|
6117
|
+
queryData: {
|
|
6118
|
+
data: { ...data }
|
|
6119
|
+
}
|
|
6120
|
+
};
|
|
6121
|
+
}
|
|
6114
6122
|
var SignalController = class _SignalController {
|
|
6115
6123
|
static get instance() {
|
|
6116
6124
|
if (!this._instance) this._instance = new _SignalController();
|
|
@@ -6136,15 +6144,16 @@ var SignalController = class _SignalController {
|
|
|
6136
6144
|
(ctx, emit) => {
|
|
6137
6145
|
const { signalName } = ctx;
|
|
6138
6146
|
const { isMeta, isGlobal, domain, action } = decomposeSignalName(signalName);
|
|
6139
|
-
emit(
|
|
6140
|
-
|
|
6147
|
+
emit(
|
|
6148
|
+
"global.meta.signal_controller.signal_added",
|
|
6149
|
+
buildSignalDatabaseTriggerContext({
|
|
6141
6150
|
name: signalName,
|
|
6142
6151
|
isGlobal,
|
|
6143
6152
|
domain,
|
|
6144
6153
|
action,
|
|
6145
6154
|
isMeta
|
|
6146
|
-
}
|
|
6147
|
-
|
|
6155
|
+
})
|
|
6156
|
+
);
|
|
6148
6157
|
return ctx;
|
|
6149
6158
|
},
|
|
6150
6159
|
"Handles signal registration from a service instance"
|
|
@@ -6308,6 +6317,23 @@ function registerActorSessionPersistenceTasks() {
|
|
|
6308
6317
|
}
|
|
6309
6318
|
|
|
6310
6319
|
// src/graph/controllers/GraphMetadataController.ts
|
|
6320
|
+
function buildDatabaseTriggerContext(data, filter, extra = {}) {
|
|
6321
|
+
const nextData = data && typeof data === "object" ? { ...data } : void 0;
|
|
6322
|
+
const nextFilter = filter && typeof filter === "object" ? { ...filter } : void 0;
|
|
6323
|
+
const queryData = {};
|
|
6324
|
+
if (nextData !== void 0) {
|
|
6325
|
+
queryData.data = nextData;
|
|
6326
|
+
}
|
|
6327
|
+
if (nextFilter !== void 0) {
|
|
6328
|
+
queryData.filter = nextFilter;
|
|
6329
|
+
}
|
|
6330
|
+
return {
|
|
6331
|
+
...extra,
|
|
6332
|
+
...nextData !== void 0 ? { data: nextData } : {},
|
|
6333
|
+
...nextFilter !== void 0 ? { filter: nextFilter } : {},
|
|
6334
|
+
...Object.keys(queryData).length > 0 ? { queryData } : {}
|
|
6335
|
+
};
|
|
6336
|
+
}
|
|
6311
6337
|
var GraphMetadataController = class _GraphMetadataController {
|
|
6312
6338
|
static get instance() {
|
|
6313
6339
|
if (!this._instance) this._instance = new _GraphMetadataController();
|
|
@@ -6315,21 +6341,19 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6315
6341
|
}
|
|
6316
6342
|
constructor() {
|
|
6317
6343
|
CadenzaService.createMetaTask("Handle task creation", (ctx) => {
|
|
6318
|
-
return {
|
|
6319
|
-
data
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
}
|
|
6323
|
-
};
|
|
6344
|
+
return buildDatabaseTriggerContext({
|
|
6345
|
+
...ctx.data,
|
|
6346
|
+
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6347
|
+
});
|
|
6324
6348
|
}).doOn("meta.task.created").emits("global.meta.graph_metadata.task_created");
|
|
6325
6349
|
CadenzaService.createMetaTask("Handle task update", (ctx) => {
|
|
6326
|
-
return
|
|
6327
|
-
|
|
6328
|
-
|
|
6350
|
+
return buildDatabaseTriggerContext(
|
|
6351
|
+
ctx.data ?? void 0,
|
|
6352
|
+
{
|
|
6329
6353
|
...ctx.filter,
|
|
6330
6354
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6331
6355
|
}
|
|
6332
|
-
|
|
6356
|
+
);
|
|
6333
6357
|
}).doOn("meta.task.layer_index_changed", "meta.task.destroyed").emits("global.meta.graph_metadata.task_updated");
|
|
6334
6358
|
CadenzaService.createMetaTask("Handle task relationship creation", (ctx) => {
|
|
6335
6359
|
const taskName = ctx.data?.taskName ?? ctx.data?.task_name;
|
|
@@ -6339,114 +6363,101 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6339
6363
|
if (!task?.registered || !predecessorTask?.registered) {
|
|
6340
6364
|
return false;
|
|
6341
6365
|
}
|
|
6342
|
-
return {
|
|
6343
|
-
data
|
|
6344
|
-
|
|
6345
|
-
|
|
6346
|
-
|
|
6347
|
-
}
|
|
6348
|
-
};
|
|
6366
|
+
return buildDatabaseTriggerContext({
|
|
6367
|
+
...ctx.data,
|
|
6368
|
+
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
6369
|
+
predecessorServiceName: CadenzaService.serviceRegistry.serviceName
|
|
6370
|
+
});
|
|
6349
6371
|
}).doOn("meta.task.relationship_added").emits("global.meta.graph_metadata.task_relationship_created");
|
|
6350
6372
|
CadenzaService.createMetaTask("Handle task error", (ctx) => {
|
|
6351
6373
|
CadenzaService.log(`Error in task ${ctx.data.taskName}`, ctx.data, "error");
|
|
6352
6374
|
}).doOn("meta.node.errored");
|
|
6353
6375
|
CadenzaService.createMetaTask("Handle task signal observation", (ctx) => {
|
|
6354
6376
|
const isGlobal = ctx.signalName.startsWith("global.");
|
|
6355
|
-
return {
|
|
6356
|
-
data
|
|
6357
|
-
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
}
|
|
6361
|
-
};
|
|
6377
|
+
return buildDatabaseTriggerContext({
|
|
6378
|
+
...ctx.data,
|
|
6379
|
+
isGlobal,
|
|
6380
|
+
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6381
|
+
});
|
|
6362
6382
|
}).doOn("meta.task.observed_signal").emits("global.meta.graph_metadata.task_signal_observed");
|
|
6363
6383
|
CadenzaService.createMetaTask("Handle task signal attachment", (ctx) => {
|
|
6364
|
-
return
|
|
6365
|
-
data
|
|
6366
|
-
|
|
6367
|
-
},
|
|
6368
|
-
filter: {
|
|
6384
|
+
return buildDatabaseTriggerContext(
|
|
6385
|
+
ctx.data ?? void 0,
|
|
6386
|
+
{
|
|
6369
6387
|
...ctx.filter,
|
|
6370
6388
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6371
6389
|
}
|
|
6372
|
-
|
|
6390
|
+
);
|
|
6373
6391
|
}).doOn("meta.task.attached_signal").emits("global.meta.graph_metadata.task_attached_signal");
|
|
6374
6392
|
CadenzaService.createMetaTask("Handle task unsubscribing signal", (ctx) => {
|
|
6375
|
-
return
|
|
6376
|
-
|
|
6393
|
+
return buildDatabaseTriggerContext(
|
|
6394
|
+
{
|
|
6377
6395
|
deleted: true
|
|
6378
6396
|
},
|
|
6379
|
-
|
|
6397
|
+
{
|
|
6380
6398
|
...ctx.filter,
|
|
6381
6399
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6382
6400
|
}
|
|
6383
|
-
|
|
6401
|
+
);
|
|
6384
6402
|
}).doOn("meta.task.unsubscribed_signal").emits("meta.graph_metadata.task_unsubscribed_signal");
|
|
6385
6403
|
CadenzaService.createMetaTask("Handle task detaching signal", (ctx) => {
|
|
6386
|
-
return
|
|
6387
|
-
|
|
6404
|
+
return buildDatabaseTriggerContext(
|
|
6405
|
+
{
|
|
6388
6406
|
deleted: true
|
|
6389
6407
|
},
|
|
6390
|
-
|
|
6408
|
+
{
|
|
6391
6409
|
...ctx.filter,
|
|
6392
6410
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6393
6411
|
}
|
|
6394
|
-
|
|
6412
|
+
);
|
|
6395
6413
|
}).doOn("meta.task.detached_signal").emits("global.meta.graph_metadata.task_detached_signal");
|
|
6396
6414
|
CadenzaService.createMetaTask("Handle routine creation", (ctx) => {
|
|
6397
|
-
return {
|
|
6398
|
-
data
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
}
|
|
6402
|
-
};
|
|
6415
|
+
return buildDatabaseTriggerContext({
|
|
6416
|
+
...ctx.data,
|
|
6417
|
+
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6418
|
+
});
|
|
6403
6419
|
}).doAfter(CadenzaService.registry.registerRoutine).emits("global.meta.graph_metadata.routine_created");
|
|
6404
6420
|
CadenzaService.createMetaTask("Handle routine update", (ctx) => {
|
|
6405
|
-
return
|
|
6406
|
-
|
|
6407
|
-
|
|
6421
|
+
return buildDatabaseTriggerContext(
|
|
6422
|
+
ctx.data ?? void 0,
|
|
6423
|
+
{
|
|
6408
6424
|
...ctx.filter,
|
|
6409
6425
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6410
6426
|
}
|
|
6411
|
-
|
|
6427
|
+
);
|
|
6412
6428
|
}).doOn("meta.routine.destroyed").emits("global.meta.graph_metadata.routine_updated");
|
|
6413
6429
|
CadenzaService.createMetaTask("Handle adding task to routine", (ctx) => {
|
|
6414
|
-
return {
|
|
6415
|
-
data
|
|
6416
|
-
|
|
6417
|
-
|
|
6418
|
-
}
|
|
6419
|
-
};
|
|
6430
|
+
return buildDatabaseTriggerContext({
|
|
6431
|
+
...ctx.data,
|
|
6432
|
+
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6433
|
+
});
|
|
6420
6434
|
}).doOn("meta.routine.task_added").emits("global.meta.graph_metadata.task_added_to_routine");
|
|
6421
6435
|
CadenzaService.createMetaTask("Handle new trace", (ctx) => {
|
|
6422
|
-
return {
|
|
6423
|
-
data
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
}
|
|
6428
|
-
};
|
|
6436
|
+
return buildDatabaseTriggerContext({
|
|
6437
|
+
...ctx.data,
|
|
6438
|
+
service_name: CadenzaService.serviceRegistry.serviceName,
|
|
6439
|
+
service_instance_id: CadenzaService.serviceRegistry.serviceInstanceId
|
|
6440
|
+
});
|
|
6429
6441
|
}).doOn("meta.runner.new_trace", "sub_meta.signal_broker.new_trace").emits("global.meta.graph_metadata.execution_trace_created");
|
|
6430
6442
|
CadenzaService.createMetaTask(
|
|
6431
6443
|
"Handle routine execution creation",
|
|
6432
6444
|
(ctx) => {
|
|
6433
|
-
return {
|
|
6434
|
-
|
|
6435
|
-
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
6439
|
-
}
|
|
6440
|
-
}
|
|
6441
|
-
};
|
|
6445
|
+
return buildDatabaseTriggerContext({
|
|
6446
|
+
...ctx.data,
|
|
6447
|
+
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
6448
|
+
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
6449
|
+
});
|
|
6442
6450
|
},
|
|
6443
6451
|
"Handles routine execution creation",
|
|
6444
6452
|
{ concurrency: 100, isSubMeta: true }
|
|
6445
6453
|
).doOn("meta.runner.added_tasks").emits("global.meta.graph_metadata.routine_execution_created");
|
|
6446
6454
|
CadenzaService.createMetaTask(
|
|
6447
6455
|
"Handle routine execution started",
|
|
6448
|
-
() => {
|
|
6449
|
-
return
|
|
6456
|
+
(ctx) => {
|
|
6457
|
+
return buildDatabaseTriggerContext(
|
|
6458
|
+
ctx.data ?? void 0,
|
|
6459
|
+
ctx.filter ?? void 0
|
|
6460
|
+
);
|
|
6450
6461
|
},
|
|
6451
6462
|
"Handles routine execution started",
|
|
6452
6463
|
{ concurrency: 100, isSubMeta: true }
|
|
@@ -6454,16 +6465,14 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6454
6465
|
CadenzaService.createMetaTask(
|
|
6455
6466
|
"Handle routine execution ended",
|
|
6456
6467
|
(ctx) => {
|
|
6457
|
-
return
|
|
6458
|
-
|
|
6468
|
+
return buildDatabaseTriggerContext(
|
|
6469
|
+
{
|
|
6459
6470
|
...ctx.data,
|
|
6460
6471
|
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
6461
6472
|
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
6462
6473
|
},
|
|
6463
|
-
filter
|
|
6464
|
-
|
|
6465
|
-
}
|
|
6466
|
-
};
|
|
6474
|
+
ctx.filter ?? void 0
|
|
6475
|
+
);
|
|
6467
6476
|
},
|
|
6468
6477
|
"Handles routine execution ended",
|
|
6469
6478
|
{ concurrency: 100, isSubMeta: true }
|
|
@@ -6471,29 +6480,33 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6471
6480
|
CadenzaService.createMetaTask(
|
|
6472
6481
|
"Handle task execution creation",
|
|
6473
6482
|
(ctx) => {
|
|
6474
|
-
return {
|
|
6475
|
-
data
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
|
|
6479
|
-
}
|
|
6480
|
-
};
|
|
6483
|
+
return buildDatabaseTriggerContext({
|
|
6484
|
+
...ctx.data,
|
|
6485
|
+
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
6486
|
+
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
6487
|
+
});
|
|
6481
6488
|
},
|
|
6482
6489
|
"Handles task execution creation",
|
|
6483
6490
|
{ concurrency: 100, isSubMeta: true }
|
|
6484
6491
|
).doOn("meta.node.scheduled").emits("global.meta.graph_metadata.task_execution_created");
|
|
6485
6492
|
CadenzaService.createMetaTask(
|
|
6486
6493
|
"Handle task execution mapped",
|
|
6487
|
-
() => {
|
|
6488
|
-
return
|
|
6494
|
+
(ctx) => {
|
|
6495
|
+
return buildDatabaseTriggerContext(
|
|
6496
|
+
ctx.data ?? void 0,
|
|
6497
|
+
ctx.filter ?? void 0
|
|
6498
|
+
);
|
|
6489
6499
|
},
|
|
6490
6500
|
"Handles task execution mapping",
|
|
6491
6501
|
{ concurrency: 100, isSubMeta: true }
|
|
6492
6502
|
).doOn("meta.node.mapped", "meta.node.detected_previous_task_execution").emits("global.meta.graph_metadata.task_execution_mapped");
|
|
6493
6503
|
CadenzaService.createMetaTask(
|
|
6494
6504
|
"Handle task execution started",
|
|
6495
|
-
() => {
|
|
6496
|
-
return
|
|
6505
|
+
(ctx) => {
|
|
6506
|
+
return buildDatabaseTriggerContext(
|
|
6507
|
+
ctx.data ?? void 0,
|
|
6508
|
+
ctx.filter ?? void 0
|
|
6509
|
+
);
|
|
6497
6510
|
},
|
|
6498
6511
|
"Handles task execution started",
|
|
6499
6512
|
{ concurrency: 100, isSubMeta: true }
|
|
@@ -6501,16 +6514,14 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6501
6514
|
CadenzaService.createMetaTask(
|
|
6502
6515
|
"Handle task execution ended",
|
|
6503
6516
|
(ctx) => {
|
|
6504
|
-
return
|
|
6505
|
-
|
|
6517
|
+
return buildDatabaseTriggerContext(
|
|
6518
|
+
{
|
|
6506
6519
|
...ctx.data,
|
|
6507
6520
|
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
6508
6521
|
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
6509
6522
|
},
|
|
6510
|
-
filter
|
|
6511
|
-
|
|
6512
|
-
}
|
|
6513
|
-
};
|
|
6523
|
+
ctx.filter ?? void 0
|
|
6524
|
+
);
|
|
6514
6525
|
},
|
|
6515
6526
|
"Handles task execution ended",
|
|
6516
6527
|
{ concurrency: 100, isSubMeta: true }
|
|
@@ -6518,45 +6529,39 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6518
6529
|
CadenzaService.createMetaTask(
|
|
6519
6530
|
"Handle task execution relationship creation",
|
|
6520
6531
|
(ctx) => {
|
|
6521
|
-
return
|
|
6522
|
-
|
|
6532
|
+
return buildDatabaseTriggerContext(
|
|
6533
|
+
{
|
|
6523
6534
|
executionCount: "increment",
|
|
6524
6535
|
lastExecuted: formatTimestamp(Date.now())
|
|
6525
6536
|
},
|
|
6526
|
-
|
|
6537
|
+
{
|
|
6527
6538
|
...ctx.filter,
|
|
6528
6539
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6529
6540
|
}
|
|
6530
|
-
|
|
6541
|
+
);
|
|
6531
6542
|
},
|
|
6532
6543
|
"Handles task execution relationship creation",
|
|
6533
6544
|
{ concurrency: 100, isSubMeta: true }
|
|
6534
6545
|
).doOn("meta.node.mapped", "meta.node.detected_previous_task_execution").emits("global.meta.graph_metadata.relationship_executed");
|
|
6535
6546
|
CadenzaService.createMetaTask("Handle actor creation", (ctx) => {
|
|
6536
|
-
return {
|
|
6537
|
-
data
|
|
6538
|
-
|
|
6539
|
-
|
|
6540
|
-
}
|
|
6541
|
-
};
|
|
6547
|
+
return buildDatabaseTriggerContext({
|
|
6548
|
+
...ctx.data,
|
|
6549
|
+
service_name: CadenzaService.serviceRegistry.serviceName
|
|
6550
|
+
});
|
|
6542
6551
|
}).doOn("meta.actor.created").emits("global.meta.graph_metadata.actor_created");
|
|
6543
6552
|
CadenzaService.createMetaTask("Handle actor task association", (ctx) => {
|
|
6544
|
-
return {
|
|
6545
|
-
data
|
|
6546
|
-
|
|
6547
|
-
|
|
6548
|
-
}
|
|
6549
|
-
};
|
|
6553
|
+
return buildDatabaseTriggerContext({
|
|
6554
|
+
...ctx.data,
|
|
6555
|
+
service_name: CadenzaService.serviceRegistry.serviceName
|
|
6556
|
+
});
|
|
6550
6557
|
}).doOn("meta.actor.task_associated").emits("global.meta.graph_metadata.actor_task_associated");
|
|
6551
6558
|
registerActorSessionPersistenceTasks();
|
|
6552
6559
|
CadenzaService.createMetaTask("Handle Intent Creation", (ctx) => {
|
|
6553
6560
|
const intentName = ctx.data?.name;
|
|
6554
|
-
return {
|
|
6555
|
-
data
|
|
6556
|
-
|
|
6557
|
-
|
|
6558
|
-
}
|
|
6559
|
-
};
|
|
6561
|
+
return buildDatabaseTriggerContext({
|
|
6562
|
+
...ctx.data,
|
|
6563
|
+
isMeta: intentName ? isMetaIntentName(intentName) : false
|
|
6564
|
+
});
|
|
6560
6565
|
}).doOn("meta.inquiry_broker.added").emits("global.meta.graph_metadata.intent_created");
|
|
6561
6566
|
}
|
|
6562
6567
|
};
|