@cadenza.io/service 2.3.15 → 2.3.17
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.js +6 -40
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -329,7 +329,6 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
329
329
|
deleted
|
|
330
330
|
} = serviceInstance;
|
|
331
331
|
if (uuid4 === this.serviceInstanceId) return;
|
|
332
|
-
console.log("service instance", serviceName, uuid4, address);
|
|
333
332
|
if (deleted) {
|
|
334
333
|
this.instances.get(serviceName)?.splice(
|
|
335
334
|
this.instances.get(serviceName)?.findIndex((i) => i.uuid === uuid4) ?? -1,
|
|
@@ -409,7 +408,6 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
409
408
|
this.handleGlobalSignalRegistrationTask = CadenzaService.createMetaTask(
|
|
410
409
|
"Handle global Signal Registration",
|
|
411
410
|
(ctx) => {
|
|
412
|
-
console.log("Handling global signal registration...");
|
|
413
411
|
const { signalToTaskMaps } = ctx;
|
|
414
412
|
const sortedSignalToTaskMap = signalToTaskMaps.sort(
|
|
415
413
|
(a, b) => {
|
|
@@ -418,9 +416,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
418
416
|
return 0;
|
|
419
417
|
}
|
|
420
418
|
);
|
|
421
|
-
console.log(sortedSignalToTaskMap);
|
|
422
419
|
const locallyEmittedSignals = CadenzaService.signalBroker.listEmittedSignals().filter((s) => s.startsWith("global."));
|
|
423
|
-
console.log(locallyEmittedSignals);
|
|
424
420
|
for (const map of sortedSignalToTaskMap) {
|
|
425
421
|
if (map.deleted) {
|
|
426
422
|
this.remoteSignals.get(map.serviceName)?.delete(map.signalName);
|
|
@@ -437,9 +433,6 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
437
433
|
this.remoteSignals.set(map.serviceName, /* @__PURE__ */ new Set());
|
|
438
434
|
}
|
|
439
435
|
if (!this.remoteSignals.get(map.serviceName)?.has(map.signalName)) {
|
|
440
|
-
console.log(
|
|
441
|
-
`Creating signal transmission task for: ${map.signalName} to ${map.serviceName}`
|
|
442
|
-
);
|
|
443
436
|
CadenzaService.createSignalTransmissionTask(
|
|
444
437
|
map.signalName,
|
|
445
438
|
map.serviceName
|
|
@@ -551,26 +544,14 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
551
544
|
const mergeSyncDataTask = CadenzaService.createUniqueMetaTask(
|
|
552
545
|
"Merge sync data",
|
|
553
546
|
(ctx) => {
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
console.log(
|
|
560
|
-
"merging contexts of full sync...",
|
|
561
|
-
joinedContext.keys().join(", ")
|
|
562
|
-
);
|
|
563
|
-
return joinedContext;
|
|
564
|
-
} catch (e) {
|
|
565
|
-
console.log("Error", e.message, ctx);
|
|
566
|
-
return false;
|
|
567
|
-
}
|
|
547
|
+
let joinedContext = {};
|
|
548
|
+
ctx.joinedContexts.forEach((ctx2) => {
|
|
549
|
+
joinedContext = { ...joinedContext, ...ctx2 };
|
|
550
|
+
});
|
|
551
|
+
return joinedContext;
|
|
568
552
|
}
|
|
569
553
|
).emits("meta.service_registry.initial_sync_complete").then(this.handleGlobalSignalRegistrationTask);
|
|
570
554
|
this.fullSyncTask = CadenzaService.createMetaRoutine("Full sync", [
|
|
571
|
-
CadenzaService.createTask("Confirm full sync", () => {
|
|
572
|
-
console.log("Confirming full sync...");
|
|
573
|
-
}),
|
|
574
555
|
CadenzaService.createCadenzaDBQueryTask("signal_to_task_map", {
|
|
575
556
|
filter: {
|
|
576
557
|
isGlobal: true
|
|
@@ -1814,10 +1795,6 @@ var SocketController = class _SocketController {
|
|
|
1814
1795
|
"delegation",
|
|
1815
1796
|
(ctx2, callback) => {
|
|
1816
1797
|
const deputyExecId = ctx2.__metadata.__deputyExecId;
|
|
1817
|
-
console.log(
|
|
1818
|
-
"Delegation request received:",
|
|
1819
|
-
ctx2.__localTaskName
|
|
1820
|
-
);
|
|
1821
1798
|
CadenzaService.createEphemeralMetaTask(
|
|
1822
1799
|
"Resolve delegation",
|
|
1823
1800
|
(ctx3) => {
|
|
@@ -1852,7 +1829,6 @@ var SocketController = class _SocketController {
|
|
|
1852
1829
|
"signal",
|
|
1853
1830
|
(ctx2, callback) => {
|
|
1854
1831
|
if (CadenzaService.signalBroker.listObservedSignals().includes(ctx2.__signalName)) {
|
|
1855
|
-
console.log("Signal received:", ctx2.__signalName);
|
|
1856
1832
|
callback({
|
|
1857
1833
|
__status: "success",
|
|
1858
1834
|
__signalName: ctx2.__signalName
|
|
@@ -2129,7 +2105,6 @@ var SocketController = class _SocketController {
|
|
|
2129
2105
|
delete ctx2.__broadcast;
|
|
2130
2106
|
const requestSentAt = Date.now();
|
|
2131
2107
|
pendingDelegationIds.add(ctx2.__metadata.__deputyExecId);
|
|
2132
|
-
console.log("Delegating task:", ctx2.__remoteRoutineName);
|
|
2133
2108
|
emitWhenReady?.(
|
|
2134
2109
|
"delegation",
|
|
2135
2110
|
ctx2,
|
|
@@ -2138,12 +2113,6 @@ var SocketController = class _SocketController {
|
|
|
2138
2113
|
const requestDuration = Date.now() - requestSentAt;
|
|
2139
2114
|
const metadata = resultContext.__metadata;
|
|
2140
2115
|
delete resultContext.__metadata;
|
|
2141
|
-
console.log(
|
|
2142
|
-
"Delegation response received:",
|
|
2143
|
-
ctx2.__remoteRoutineName,
|
|
2144
|
-
"Duration:",
|
|
2145
|
-
requestDuration
|
|
2146
|
-
);
|
|
2147
2116
|
emit(
|
|
2148
2117
|
`meta.socket_client.delegated:${ctx2.__metadata.__deputyExecId}`,
|
|
2149
2118
|
{
|
|
@@ -2171,7 +2140,6 @@ var SocketController = class _SocketController {
|
|
|
2171
2140
|
}
|
|
2172
2141
|
return new Promise((resolve) => {
|
|
2173
2142
|
delete ctx2.__broadcast;
|
|
2174
|
-
console.log("Transmitting signal:", ctx2.__signalName);
|
|
2175
2143
|
emitWhenReady?.("signal", ctx2, 5e3, (response) => {
|
|
2176
2144
|
if (ctx2.__routineExecId) {
|
|
2177
2145
|
emit(
|
|
@@ -2477,7 +2445,7 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
2477
2445
|
data: {
|
|
2478
2446
|
...ctx.data,
|
|
2479
2447
|
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
2480
|
-
|
|
2448
|
+
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
2481
2449
|
},
|
|
2482
2450
|
filter: {
|
|
2483
2451
|
...ctx.filter
|
|
@@ -3005,7 +2973,6 @@ var DatabaseController = class _DatabaseController {
|
|
|
3005
2973
|
if (ddl && ddl.length > 0) {
|
|
3006
2974
|
for (const sql of ddl) {
|
|
3007
2975
|
try {
|
|
3008
|
-
console.log("Executing DDL", sql);
|
|
3009
2976
|
await this.dbClient.query(sql);
|
|
3010
2977
|
} catch (error) {
|
|
3011
2978
|
console.error(
|
|
@@ -4245,7 +4212,6 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
4245
4212
|
);
|
|
4246
4213
|
CadenzaService.schedule("meta.sync_requested", { __syncing: true }, 2e3);
|
|
4247
4214
|
}
|
|
4248
|
-
console.log("Syncing initiated", this.isCadenzaDBReady);
|
|
4249
4215
|
}
|
|
4250
4216
|
};
|
|
4251
4217
|
|