@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.mjs
CHANGED
|
@@ -6060,6 +6060,14 @@ function decomposeSignalName(signalName) {
|
|
|
6060
6060
|
}
|
|
6061
6061
|
|
|
6062
6062
|
// src/signals/SignalController.ts
|
|
6063
|
+
function buildSignalDatabaseTriggerContext(data) {
|
|
6064
|
+
return {
|
|
6065
|
+
data: { ...data },
|
|
6066
|
+
queryData: {
|
|
6067
|
+
data: { ...data }
|
|
6068
|
+
}
|
|
6069
|
+
};
|
|
6070
|
+
}
|
|
6063
6071
|
var SignalController = class _SignalController {
|
|
6064
6072
|
static get instance() {
|
|
6065
6073
|
if (!this._instance) this._instance = new _SignalController();
|
|
@@ -6085,15 +6093,16 @@ var SignalController = class _SignalController {
|
|
|
6085
6093
|
(ctx, emit) => {
|
|
6086
6094
|
const { signalName } = ctx;
|
|
6087
6095
|
const { isMeta, isGlobal, domain, action } = decomposeSignalName(signalName);
|
|
6088
|
-
emit(
|
|
6089
|
-
|
|
6096
|
+
emit(
|
|
6097
|
+
"global.meta.signal_controller.signal_added",
|
|
6098
|
+
buildSignalDatabaseTriggerContext({
|
|
6090
6099
|
name: signalName,
|
|
6091
6100
|
isGlobal,
|
|
6092
6101
|
domain,
|
|
6093
6102
|
action,
|
|
6094
6103
|
isMeta
|
|
6095
|
-
}
|
|
6096
|
-
|
|
6104
|
+
})
|
|
6105
|
+
);
|
|
6097
6106
|
return ctx;
|
|
6098
6107
|
},
|
|
6099
6108
|
"Handles signal registration from a service instance"
|
|
@@ -6257,6 +6266,23 @@ function registerActorSessionPersistenceTasks() {
|
|
|
6257
6266
|
}
|
|
6258
6267
|
|
|
6259
6268
|
// src/graph/controllers/GraphMetadataController.ts
|
|
6269
|
+
function buildDatabaseTriggerContext(data, filter, extra = {}) {
|
|
6270
|
+
const nextData = data && typeof data === "object" ? { ...data } : void 0;
|
|
6271
|
+
const nextFilter = filter && typeof filter === "object" ? { ...filter } : void 0;
|
|
6272
|
+
const queryData = {};
|
|
6273
|
+
if (nextData !== void 0) {
|
|
6274
|
+
queryData.data = nextData;
|
|
6275
|
+
}
|
|
6276
|
+
if (nextFilter !== void 0) {
|
|
6277
|
+
queryData.filter = nextFilter;
|
|
6278
|
+
}
|
|
6279
|
+
return {
|
|
6280
|
+
...extra,
|
|
6281
|
+
...nextData !== void 0 ? { data: nextData } : {},
|
|
6282
|
+
...nextFilter !== void 0 ? { filter: nextFilter } : {},
|
|
6283
|
+
...Object.keys(queryData).length > 0 ? { queryData } : {}
|
|
6284
|
+
};
|
|
6285
|
+
}
|
|
6260
6286
|
var GraphMetadataController = class _GraphMetadataController {
|
|
6261
6287
|
static get instance() {
|
|
6262
6288
|
if (!this._instance) this._instance = new _GraphMetadataController();
|
|
@@ -6264,21 +6290,19 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6264
6290
|
}
|
|
6265
6291
|
constructor() {
|
|
6266
6292
|
CadenzaService.createMetaTask("Handle task creation", (ctx) => {
|
|
6267
|
-
return {
|
|
6268
|
-
data
|
|
6269
|
-
|
|
6270
|
-
|
|
6271
|
-
}
|
|
6272
|
-
};
|
|
6293
|
+
return buildDatabaseTriggerContext({
|
|
6294
|
+
...ctx.data,
|
|
6295
|
+
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6296
|
+
});
|
|
6273
6297
|
}).doOn("meta.task.created").emits("global.meta.graph_metadata.task_created");
|
|
6274
6298
|
CadenzaService.createMetaTask("Handle task update", (ctx) => {
|
|
6275
|
-
return
|
|
6276
|
-
|
|
6277
|
-
|
|
6299
|
+
return buildDatabaseTriggerContext(
|
|
6300
|
+
ctx.data ?? void 0,
|
|
6301
|
+
{
|
|
6278
6302
|
...ctx.filter,
|
|
6279
6303
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6280
6304
|
}
|
|
6281
|
-
|
|
6305
|
+
);
|
|
6282
6306
|
}).doOn("meta.task.layer_index_changed", "meta.task.destroyed").emits("global.meta.graph_metadata.task_updated");
|
|
6283
6307
|
CadenzaService.createMetaTask("Handle task relationship creation", (ctx) => {
|
|
6284
6308
|
const taskName = ctx.data?.taskName ?? ctx.data?.task_name;
|
|
@@ -6288,114 +6312,101 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6288
6312
|
if (!task?.registered || !predecessorTask?.registered) {
|
|
6289
6313
|
return false;
|
|
6290
6314
|
}
|
|
6291
|
-
return {
|
|
6292
|
-
data
|
|
6293
|
-
|
|
6294
|
-
|
|
6295
|
-
|
|
6296
|
-
}
|
|
6297
|
-
};
|
|
6315
|
+
return buildDatabaseTriggerContext({
|
|
6316
|
+
...ctx.data,
|
|
6317
|
+
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
6318
|
+
predecessorServiceName: CadenzaService.serviceRegistry.serviceName
|
|
6319
|
+
});
|
|
6298
6320
|
}).doOn("meta.task.relationship_added").emits("global.meta.graph_metadata.task_relationship_created");
|
|
6299
6321
|
CadenzaService.createMetaTask("Handle task error", (ctx) => {
|
|
6300
6322
|
CadenzaService.log(`Error in task ${ctx.data.taskName}`, ctx.data, "error");
|
|
6301
6323
|
}).doOn("meta.node.errored");
|
|
6302
6324
|
CadenzaService.createMetaTask("Handle task signal observation", (ctx) => {
|
|
6303
6325
|
const isGlobal = ctx.signalName.startsWith("global.");
|
|
6304
|
-
return {
|
|
6305
|
-
data
|
|
6306
|
-
|
|
6307
|
-
|
|
6308
|
-
|
|
6309
|
-
}
|
|
6310
|
-
};
|
|
6326
|
+
return buildDatabaseTriggerContext({
|
|
6327
|
+
...ctx.data,
|
|
6328
|
+
isGlobal,
|
|
6329
|
+
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6330
|
+
});
|
|
6311
6331
|
}).doOn("meta.task.observed_signal").emits("global.meta.graph_metadata.task_signal_observed");
|
|
6312
6332
|
CadenzaService.createMetaTask("Handle task signal attachment", (ctx) => {
|
|
6313
|
-
return
|
|
6314
|
-
data
|
|
6315
|
-
|
|
6316
|
-
},
|
|
6317
|
-
filter: {
|
|
6333
|
+
return buildDatabaseTriggerContext(
|
|
6334
|
+
ctx.data ?? void 0,
|
|
6335
|
+
{
|
|
6318
6336
|
...ctx.filter,
|
|
6319
6337
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6320
6338
|
}
|
|
6321
|
-
|
|
6339
|
+
);
|
|
6322
6340
|
}).doOn("meta.task.attached_signal").emits("global.meta.graph_metadata.task_attached_signal");
|
|
6323
6341
|
CadenzaService.createMetaTask("Handle task unsubscribing signal", (ctx) => {
|
|
6324
|
-
return
|
|
6325
|
-
|
|
6342
|
+
return buildDatabaseTriggerContext(
|
|
6343
|
+
{
|
|
6326
6344
|
deleted: true
|
|
6327
6345
|
},
|
|
6328
|
-
|
|
6346
|
+
{
|
|
6329
6347
|
...ctx.filter,
|
|
6330
6348
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6331
6349
|
}
|
|
6332
|
-
|
|
6350
|
+
);
|
|
6333
6351
|
}).doOn("meta.task.unsubscribed_signal").emits("meta.graph_metadata.task_unsubscribed_signal");
|
|
6334
6352
|
CadenzaService.createMetaTask("Handle task detaching signal", (ctx) => {
|
|
6335
|
-
return
|
|
6336
|
-
|
|
6353
|
+
return buildDatabaseTriggerContext(
|
|
6354
|
+
{
|
|
6337
6355
|
deleted: true
|
|
6338
6356
|
},
|
|
6339
|
-
|
|
6357
|
+
{
|
|
6340
6358
|
...ctx.filter,
|
|
6341
6359
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6342
6360
|
}
|
|
6343
|
-
|
|
6361
|
+
);
|
|
6344
6362
|
}).doOn("meta.task.detached_signal").emits("global.meta.graph_metadata.task_detached_signal");
|
|
6345
6363
|
CadenzaService.createMetaTask("Handle routine creation", (ctx) => {
|
|
6346
|
-
return {
|
|
6347
|
-
data
|
|
6348
|
-
|
|
6349
|
-
|
|
6350
|
-
}
|
|
6351
|
-
};
|
|
6364
|
+
return buildDatabaseTriggerContext({
|
|
6365
|
+
...ctx.data,
|
|
6366
|
+
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6367
|
+
});
|
|
6352
6368
|
}).doAfter(CadenzaService.registry.registerRoutine).emits("global.meta.graph_metadata.routine_created");
|
|
6353
6369
|
CadenzaService.createMetaTask("Handle routine update", (ctx) => {
|
|
6354
|
-
return
|
|
6355
|
-
|
|
6356
|
-
|
|
6370
|
+
return buildDatabaseTriggerContext(
|
|
6371
|
+
ctx.data ?? void 0,
|
|
6372
|
+
{
|
|
6357
6373
|
...ctx.filter,
|
|
6358
6374
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6359
6375
|
}
|
|
6360
|
-
|
|
6376
|
+
);
|
|
6361
6377
|
}).doOn("meta.routine.destroyed").emits("global.meta.graph_metadata.routine_updated");
|
|
6362
6378
|
CadenzaService.createMetaTask("Handle adding task to routine", (ctx) => {
|
|
6363
|
-
return {
|
|
6364
|
-
data
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
}
|
|
6368
|
-
};
|
|
6379
|
+
return buildDatabaseTriggerContext({
|
|
6380
|
+
...ctx.data,
|
|
6381
|
+
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6382
|
+
});
|
|
6369
6383
|
}).doOn("meta.routine.task_added").emits("global.meta.graph_metadata.task_added_to_routine");
|
|
6370
6384
|
CadenzaService.createMetaTask("Handle new trace", (ctx) => {
|
|
6371
|
-
return {
|
|
6372
|
-
data
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
}
|
|
6377
|
-
};
|
|
6385
|
+
return buildDatabaseTriggerContext({
|
|
6386
|
+
...ctx.data,
|
|
6387
|
+
service_name: CadenzaService.serviceRegistry.serviceName,
|
|
6388
|
+
service_instance_id: CadenzaService.serviceRegistry.serviceInstanceId
|
|
6389
|
+
});
|
|
6378
6390
|
}).doOn("meta.runner.new_trace", "sub_meta.signal_broker.new_trace").emits("global.meta.graph_metadata.execution_trace_created");
|
|
6379
6391
|
CadenzaService.createMetaTask(
|
|
6380
6392
|
"Handle routine execution creation",
|
|
6381
6393
|
(ctx) => {
|
|
6382
|
-
return {
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
6388
|
-
}
|
|
6389
|
-
}
|
|
6390
|
-
};
|
|
6394
|
+
return buildDatabaseTriggerContext({
|
|
6395
|
+
...ctx.data,
|
|
6396
|
+
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
6397
|
+
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
6398
|
+
});
|
|
6391
6399
|
},
|
|
6392
6400
|
"Handles routine execution creation",
|
|
6393
6401
|
{ concurrency: 100, isSubMeta: true }
|
|
6394
6402
|
).doOn("meta.runner.added_tasks").emits("global.meta.graph_metadata.routine_execution_created");
|
|
6395
6403
|
CadenzaService.createMetaTask(
|
|
6396
6404
|
"Handle routine execution started",
|
|
6397
|
-
() => {
|
|
6398
|
-
return
|
|
6405
|
+
(ctx) => {
|
|
6406
|
+
return buildDatabaseTriggerContext(
|
|
6407
|
+
ctx.data ?? void 0,
|
|
6408
|
+
ctx.filter ?? void 0
|
|
6409
|
+
);
|
|
6399
6410
|
},
|
|
6400
6411
|
"Handles routine execution started",
|
|
6401
6412
|
{ concurrency: 100, isSubMeta: true }
|
|
@@ -6403,16 +6414,14 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6403
6414
|
CadenzaService.createMetaTask(
|
|
6404
6415
|
"Handle routine execution ended",
|
|
6405
6416
|
(ctx) => {
|
|
6406
|
-
return
|
|
6407
|
-
|
|
6417
|
+
return buildDatabaseTriggerContext(
|
|
6418
|
+
{
|
|
6408
6419
|
...ctx.data,
|
|
6409
6420
|
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
6410
6421
|
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
6411
6422
|
},
|
|
6412
|
-
filter
|
|
6413
|
-
|
|
6414
|
-
}
|
|
6415
|
-
};
|
|
6423
|
+
ctx.filter ?? void 0
|
|
6424
|
+
);
|
|
6416
6425
|
},
|
|
6417
6426
|
"Handles routine execution ended",
|
|
6418
6427
|
{ concurrency: 100, isSubMeta: true }
|
|
@@ -6420,29 +6429,33 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6420
6429
|
CadenzaService.createMetaTask(
|
|
6421
6430
|
"Handle task execution creation",
|
|
6422
6431
|
(ctx) => {
|
|
6423
|
-
return {
|
|
6424
|
-
data
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
}
|
|
6429
|
-
};
|
|
6432
|
+
return buildDatabaseTriggerContext({
|
|
6433
|
+
...ctx.data,
|
|
6434
|
+
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
6435
|
+
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
6436
|
+
});
|
|
6430
6437
|
},
|
|
6431
6438
|
"Handles task execution creation",
|
|
6432
6439
|
{ concurrency: 100, isSubMeta: true }
|
|
6433
6440
|
).doOn("meta.node.scheduled").emits("global.meta.graph_metadata.task_execution_created");
|
|
6434
6441
|
CadenzaService.createMetaTask(
|
|
6435
6442
|
"Handle task execution mapped",
|
|
6436
|
-
() => {
|
|
6437
|
-
return
|
|
6443
|
+
(ctx) => {
|
|
6444
|
+
return buildDatabaseTriggerContext(
|
|
6445
|
+
ctx.data ?? void 0,
|
|
6446
|
+
ctx.filter ?? void 0
|
|
6447
|
+
);
|
|
6438
6448
|
},
|
|
6439
6449
|
"Handles task execution mapping",
|
|
6440
6450
|
{ concurrency: 100, isSubMeta: true }
|
|
6441
6451
|
).doOn("meta.node.mapped", "meta.node.detected_previous_task_execution").emits("global.meta.graph_metadata.task_execution_mapped");
|
|
6442
6452
|
CadenzaService.createMetaTask(
|
|
6443
6453
|
"Handle task execution started",
|
|
6444
|
-
() => {
|
|
6445
|
-
return
|
|
6454
|
+
(ctx) => {
|
|
6455
|
+
return buildDatabaseTriggerContext(
|
|
6456
|
+
ctx.data ?? void 0,
|
|
6457
|
+
ctx.filter ?? void 0
|
|
6458
|
+
);
|
|
6446
6459
|
},
|
|
6447
6460
|
"Handles task execution started",
|
|
6448
6461
|
{ concurrency: 100, isSubMeta: true }
|
|
@@ -6450,16 +6463,14 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6450
6463
|
CadenzaService.createMetaTask(
|
|
6451
6464
|
"Handle task execution ended",
|
|
6452
6465
|
(ctx) => {
|
|
6453
|
-
return
|
|
6454
|
-
|
|
6466
|
+
return buildDatabaseTriggerContext(
|
|
6467
|
+
{
|
|
6455
6468
|
...ctx.data,
|
|
6456
6469
|
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
6457
6470
|
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
6458
6471
|
},
|
|
6459
|
-
filter
|
|
6460
|
-
|
|
6461
|
-
}
|
|
6462
|
-
};
|
|
6472
|
+
ctx.filter ?? void 0
|
|
6473
|
+
);
|
|
6463
6474
|
},
|
|
6464
6475
|
"Handles task execution ended",
|
|
6465
6476
|
{ concurrency: 100, isSubMeta: true }
|
|
@@ -6467,45 +6478,39 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
6467
6478
|
CadenzaService.createMetaTask(
|
|
6468
6479
|
"Handle task execution relationship creation",
|
|
6469
6480
|
(ctx) => {
|
|
6470
|
-
return
|
|
6471
|
-
|
|
6481
|
+
return buildDatabaseTriggerContext(
|
|
6482
|
+
{
|
|
6472
6483
|
executionCount: "increment",
|
|
6473
6484
|
lastExecuted: formatTimestamp(Date.now())
|
|
6474
6485
|
},
|
|
6475
|
-
|
|
6486
|
+
{
|
|
6476
6487
|
...ctx.filter,
|
|
6477
6488
|
serviceName: CadenzaService.serviceRegistry.serviceName
|
|
6478
6489
|
}
|
|
6479
|
-
|
|
6490
|
+
);
|
|
6480
6491
|
},
|
|
6481
6492
|
"Handles task execution relationship creation",
|
|
6482
6493
|
{ concurrency: 100, isSubMeta: true }
|
|
6483
6494
|
).doOn("meta.node.mapped", "meta.node.detected_previous_task_execution").emits("global.meta.graph_metadata.relationship_executed");
|
|
6484
6495
|
CadenzaService.createMetaTask("Handle actor creation", (ctx) => {
|
|
6485
|
-
return {
|
|
6486
|
-
data
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
}
|
|
6490
|
-
};
|
|
6496
|
+
return buildDatabaseTriggerContext({
|
|
6497
|
+
...ctx.data,
|
|
6498
|
+
service_name: CadenzaService.serviceRegistry.serviceName
|
|
6499
|
+
});
|
|
6491
6500
|
}).doOn("meta.actor.created").emits("global.meta.graph_metadata.actor_created");
|
|
6492
6501
|
CadenzaService.createMetaTask("Handle actor task association", (ctx) => {
|
|
6493
|
-
return {
|
|
6494
|
-
data
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
}
|
|
6498
|
-
};
|
|
6502
|
+
return buildDatabaseTriggerContext({
|
|
6503
|
+
...ctx.data,
|
|
6504
|
+
service_name: CadenzaService.serviceRegistry.serviceName
|
|
6505
|
+
});
|
|
6499
6506
|
}).doOn("meta.actor.task_associated").emits("global.meta.graph_metadata.actor_task_associated");
|
|
6500
6507
|
registerActorSessionPersistenceTasks();
|
|
6501
6508
|
CadenzaService.createMetaTask("Handle Intent Creation", (ctx) => {
|
|
6502
6509
|
const intentName = ctx.data?.name;
|
|
6503
|
-
return {
|
|
6504
|
-
data
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
}
|
|
6508
|
-
};
|
|
6510
|
+
return buildDatabaseTriggerContext({
|
|
6511
|
+
...ctx.data,
|
|
6512
|
+
isMeta: intentName ? isMetaIntentName(intentName) : false
|
|
6513
|
+
});
|
|
6509
6514
|
}).doOn("meta.inquiry_broker.added").emits("global.meta.graph_metadata.intent_created");
|
|
6510
6515
|
}
|
|
6511
6516
|
};
|