@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.mjs
CHANGED
|
@@ -281,7 +281,6 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
281
281
|
deleted
|
|
282
282
|
} = serviceInstance;
|
|
283
283
|
if (uuid4 === this.serviceInstanceId) return;
|
|
284
|
-
console.log("service instance", serviceName, uuid4, address);
|
|
285
284
|
if (deleted) {
|
|
286
285
|
this.instances.get(serviceName)?.splice(
|
|
287
286
|
this.instances.get(serviceName)?.findIndex((i) => i.uuid === uuid4) ?? -1,
|
|
@@ -361,7 +360,6 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
361
360
|
this.handleGlobalSignalRegistrationTask = CadenzaService.createMetaTask(
|
|
362
361
|
"Handle global Signal Registration",
|
|
363
362
|
(ctx) => {
|
|
364
|
-
console.log("Handling global signal registration...");
|
|
365
363
|
const { signalToTaskMaps } = ctx;
|
|
366
364
|
const sortedSignalToTaskMap = signalToTaskMaps.sort(
|
|
367
365
|
(a, b) => {
|
|
@@ -370,9 +368,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
370
368
|
return 0;
|
|
371
369
|
}
|
|
372
370
|
);
|
|
373
|
-
console.log(sortedSignalToTaskMap);
|
|
374
371
|
const locallyEmittedSignals = CadenzaService.signalBroker.listEmittedSignals().filter((s) => s.startsWith("global."));
|
|
375
|
-
console.log(locallyEmittedSignals);
|
|
376
372
|
for (const map of sortedSignalToTaskMap) {
|
|
377
373
|
if (map.deleted) {
|
|
378
374
|
this.remoteSignals.get(map.serviceName)?.delete(map.signalName);
|
|
@@ -389,9 +385,6 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
389
385
|
this.remoteSignals.set(map.serviceName, /* @__PURE__ */ new Set());
|
|
390
386
|
}
|
|
391
387
|
if (!this.remoteSignals.get(map.serviceName)?.has(map.signalName)) {
|
|
392
|
-
console.log(
|
|
393
|
-
`Creating signal transmission task for: ${map.signalName} to ${map.serviceName}`
|
|
394
|
-
);
|
|
395
388
|
CadenzaService.createSignalTransmissionTask(
|
|
396
389
|
map.signalName,
|
|
397
390
|
map.serviceName
|
|
@@ -503,23 +496,14 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
503
496
|
const mergeSyncDataTask = CadenzaService.createUniqueMetaTask(
|
|
504
497
|
"Merge sync data",
|
|
505
498
|
(ctx) => {
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
console.log("merging contexts of full sync...", joinedContext);
|
|
512
|
-
return joinedContext;
|
|
513
|
-
} catch (e) {
|
|
514
|
-
console.log("Error", e.message, ctx);
|
|
515
|
-
return false;
|
|
516
|
-
}
|
|
499
|
+
let joinedContext = {};
|
|
500
|
+
ctx.joinedContexts.forEach((ctx2) => {
|
|
501
|
+
joinedContext = { ...joinedContext, ...ctx2 };
|
|
502
|
+
});
|
|
503
|
+
return joinedContext;
|
|
517
504
|
}
|
|
518
505
|
).emits("meta.service_registry.initial_sync_complete").then(this.handleGlobalSignalRegistrationTask);
|
|
519
506
|
this.fullSyncTask = CadenzaService.createMetaRoutine("Full sync", [
|
|
520
|
-
CadenzaService.createTask("Confirm full sync", () => {
|
|
521
|
-
console.log("Confirming full sync...");
|
|
522
|
-
}),
|
|
523
507
|
CadenzaService.createCadenzaDBQueryTask("signal_to_task_map", {
|
|
524
508
|
filter: {
|
|
525
509
|
isGlobal: true
|
|
@@ -1763,10 +1747,6 @@ var SocketController = class _SocketController {
|
|
|
1763
1747
|
"delegation",
|
|
1764
1748
|
(ctx2, callback) => {
|
|
1765
1749
|
const deputyExecId = ctx2.__metadata.__deputyExecId;
|
|
1766
|
-
console.log(
|
|
1767
|
-
"Delegation request received:",
|
|
1768
|
-
ctx2.__localTaskName
|
|
1769
|
-
);
|
|
1770
1750
|
CadenzaService.createEphemeralMetaTask(
|
|
1771
1751
|
"Resolve delegation",
|
|
1772
1752
|
(ctx3) => {
|
|
@@ -1801,7 +1781,6 @@ var SocketController = class _SocketController {
|
|
|
1801
1781
|
"signal",
|
|
1802
1782
|
(ctx2, callback) => {
|
|
1803
1783
|
if (CadenzaService.signalBroker.listObservedSignals().includes(ctx2.__signalName)) {
|
|
1804
|
-
console.log("Signal received:", ctx2.__signalName);
|
|
1805
1784
|
callback({
|
|
1806
1785
|
__status: "success",
|
|
1807
1786
|
__signalName: ctx2.__signalName
|
|
@@ -2078,7 +2057,6 @@ var SocketController = class _SocketController {
|
|
|
2078
2057
|
delete ctx2.__broadcast;
|
|
2079
2058
|
const requestSentAt = Date.now();
|
|
2080
2059
|
pendingDelegationIds.add(ctx2.__metadata.__deputyExecId);
|
|
2081
|
-
console.log("Delegating task:", ctx2.__remoteRoutineName);
|
|
2082
2060
|
emitWhenReady?.(
|
|
2083
2061
|
"delegation",
|
|
2084
2062
|
ctx2,
|
|
@@ -2087,12 +2065,6 @@ var SocketController = class _SocketController {
|
|
|
2087
2065
|
const requestDuration = Date.now() - requestSentAt;
|
|
2088
2066
|
const metadata = resultContext.__metadata;
|
|
2089
2067
|
delete resultContext.__metadata;
|
|
2090
|
-
console.log(
|
|
2091
|
-
"Delegation response received:",
|
|
2092
|
-
ctx2.__remoteRoutineName,
|
|
2093
|
-
"Duration:",
|
|
2094
|
-
requestDuration
|
|
2095
|
-
);
|
|
2096
2068
|
emit(
|
|
2097
2069
|
`meta.socket_client.delegated:${ctx2.__metadata.__deputyExecId}`,
|
|
2098
2070
|
{
|
|
@@ -2120,7 +2092,6 @@ var SocketController = class _SocketController {
|
|
|
2120
2092
|
}
|
|
2121
2093
|
return new Promise((resolve) => {
|
|
2122
2094
|
delete ctx2.__broadcast;
|
|
2123
|
-
console.log("Transmitting signal:", ctx2.__signalName);
|
|
2124
2095
|
emitWhenReady?.("signal", ctx2, 5e3, (response) => {
|
|
2125
2096
|
if (ctx2.__routineExecId) {
|
|
2126
2097
|
emit(
|
|
@@ -2426,7 +2397,7 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
2426
2397
|
data: {
|
|
2427
2398
|
...ctx.data,
|
|
2428
2399
|
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
2429
|
-
|
|
2400
|
+
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
2430
2401
|
},
|
|
2431
2402
|
filter: {
|
|
2432
2403
|
...ctx.filter
|
|
@@ -2954,7 +2925,6 @@ var DatabaseController = class _DatabaseController {
|
|
|
2954
2925
|
if (ddl && ddl.length > 0) {
|
|
2955
2926
|
for (const sql of ddl) {
|
|
2956
2927
|
try {
|
|
2957
|
-
console.log("Executing DDL", sql);
|
|
2958
2928
|
await this.dbClient.query(sql);
|
|
2959
2929
|
} catch (error) {
|
|
2960
2930
|
console.error(
|
|
@@ -4194,7 +4164,6 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
4194
4164
|
);
|
|
4195
4165
|
CadenzaService.schedule("meta.sync_requested", { __syncing: true }, 2e3);
|
|
4196
4166
|
}
|
|
4197
|
-
console.log("Syncing initiated", this.isCadenzaDBReady);
|
|
4198
4167
|
}
|
|
4199
4168
|
};
|
|
4200
4169
|
|