@cadenza.io/service 2.3.16 → 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 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -37
- 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,23 +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("merging contexts of full sync...", joinedContext);
|
|
560
|
-
return joinedContext;
|
|
561
|
-
} catch (e) {
|
|
562
|
-
console.log("Error", e.message, ctx);
|
|
563
|
-
return false;
|
|
564
|
-
}
|
|
547
|
+
let joinedContext = {};
|
|
548
|
+
ctx.joinedContexts.forEach((ctx2) => {
|
|
549
|
+
joinedContext = { ...joinedContext, ...ctx2 };
|
|
550
|
+
});
|
|
551
|
+
return joinedContext;
|
|
565
552
|
}
|
|
566
553
|
).emits("meta.service_registry.initial_sync_complete").then(this.handleGlobalSignalRegistrationTask);
|
|
567
554
|
this.fullSyncTask = CadenzaService.createMetaRoutine("Full sync", [
|
|
568
|
-
CadenzaService.createTask("Confirm full sync", () => {
|
|
569
|
-
console.log("Confirming full sync...");
|
|
570
|
-
}),
|
|
571
555
|
CadenzaService.createCadenzaDBQueryTask("signal_to_task_map", {
|
|
572
556
|
filter: {
|
|
573
557
|
isGlobal: true
|
|
@@ -1811,10 +1795,6 @@ var SocketController = class _SocketController {
|
|
|
1811
1795
|
"delegation",
|
|
1812
1796
|
(ctx2, callback) => {
|
|
1813
1797
|
const deputyExecId = ctx2.__metadata.__deputyExecId;
|
|
1814
|
-
console.log(
|
|
1815
|
-
"Delegation request received:",
|
|
1816
|
-
ctx2.__localTaskName
|
|
1817
|
-
);
|
|
1818
1798
|
CadenzaService.createEphemeralMetaTask(
|
|
1819
1799
|
"Resolve delegation",
|
|
1820
1800
|
(ctx3) => {
|
|
@@ -1849,7 +1829,6 @@ var SocketController = class _SocketController {
|
|
|
1849
1829
|
"signal",
|
|
1850
1830
|
(ctx2, callback) => {
|
|
1851
1831
|
if (CadenzaService.signalBroker.listObservedSignals().includes(ctx2.__signalName)) {
|
|
1852
|
-
console.log("Signal received:", ctx2.__signalName);
|
|
1853
1832
|
callback({
|
|
1854
1833
|
__status: "success",
|
|
1855
1834
|
__signalName: ctx2.__signalName
|
|
@@ -2126,7 +2105,6 @@ var SocketController = class _SocketController {
|
|
|
2126
2105
|
delete ctx2.__broadcast;
|
|
2127
2106
|
const requestSentAt = Date.now();
|
|
2128
2107
|
pendingDelegationIds.add(ctx2.__metadata.__deputyExecId);
|
|
2129
|
-
console.log("Delegating task:", ctx2.__remoteRoutineName);
|
|
2130
2108
|
emitWhenReady?.(
|
|
2131
2109
|
"delegation",
|
|
2132
2110
|
ctx2,
|
|
@@ -2135,12 +2113,6 @@ var SocketController = class _SocketController {
|
|
|
2135
2113
|
const requestDuration = Date.now() - requestSentAt;
|
|
2136
2114
|
const metadata = resultContext.__metadata;
|
|
2137
2115
|
delete resultContext.__metadata;
|
|
2138
|
-
console.log(
|
|
2139
|
-
"Delegation response received:",
|
|
2140
|
-
ctx2.__remoteRoutineName,
|
|
2141
|
-
"Duration:",
|
|
2142
|
-
requestDuration
|
|
2143
|
-
);
|
|
2144
2116
|
emit(
|
|
2145
2117
|
`meta.socket_client.delegated:${ctx2.__metadata.__deputyExecId}`,
|
|
2146
2118
|
{
|
|
@@ -2168,7 +2140,6 @@ var SocketController = class _SocketController {
|
|
|
2168
2140
|
}
|
|
2169
2141
|
return new Promise((resolve) => {
|
|
2170
2142
|
delete ctx2.__broadcast;
|
|
2171
|
-
console.log("Transmitting signal:", ctx2.__signalName);
|
|
2172
2143
|
emitWhenReady?.("signal", ctx2, 5e3, (response) => {
|
|
2173
2144
|
if (ctx2.__routineExecId) {
|
|
2174
2145
|
emit(
|
|
@@ -2474,7 +2445,7 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
2474
2445
|
data: {
|
|
2475
2446
|
...ctx.data,
|
|
2476
2447
|
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
2477
|
-
|
|
2448
|
+
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
2478
2449
|
},
|
|
2479
2450
|
filter: {
|
|
2480
2451
|
...ctx.filter
|
|
@@ -3002,7 +2973,6 @@ var DatabaseController = class _DatabaseController {
|
|
|
3002
2973
|
if (ddl && ddl.length > 0) {
|
|
3003
2974
|
for (const sql of ddl) {
|
|
3004
2975
|
try {
|
|
3005
|
-
console.log("Executing DDL", sql);
|
|
3006
2976
|
await this.dbClient.query(sql);
|
|
3007
2977
|
} catch (error) {
|
|
3008
2978
|
console.error(
|
|
@@ -4242,7 +4212,6 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
4242
4212
|
);
|
|
4243
4213
|
CadenzaService.schedule("meta.sync_requested", { __syncing: true }, 2e3);
|
|
4244
4214
|
}
|
|
4245
|
-
console.log("Syncing initiated", this.isCadenzaDBReady);
|
|
4246
4215
|
}
|
|
4247
4216
|
};
|
|
4248
4217
|
|