@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.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,26 +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(
|
|
512
|
-
"merging contexts of full sync...",
|
|
513
|
-
joinedContext.keys().join(", ")
|
|
514
|
-
);
|
|
515
|
-
return joinedContext;
|
|
516
|
-
} catch (e) {
|
|
517
|
-
console.log("Error", e.message, ctx);
|
|
518
|
-
return false;
|
|
519
|
-
}
|
|
499
|
+
let joinedContext = {};
|
|
500
|
+
ctx.joinedContexts.forEach((ctx2) => {
|
|
501
|
+
joinedContext = { ...joinedContext, ...ctx2 };
|
|
502
|
+
});
|
|
503
|
+
return joinedContext;
|
|
520
504
|
}
|
|
521
505
|
).emits("meta.service_registry.initial_sync_complete").then(this.handleGlobalSignalRegistrationTask);
|
|
522
506
|
this.fullSyncTask = CadenzaService.createMetaRoutine("Full sync", [
|
|
523
|
-
CadenzaService.createTask("Confirm full sync", () => {
|
|
524
|
-
console.log("Confirming full sync...");
|
|
525
|
-
}),
|
|
526
507
|
CadenzaService.createCadenzaDBQueryTask("signal_to_task_map", {
|
|
527
508
|
filter: {
|
|
528
509
|
isGlobal: true
|
|
@@ -1766,10 +1747,6 @@ var SocketController = class _SocketController {
|
|
|
1766
1747
|
"delegation",
|
|
1767
1748
|
(ctx2, callback) => {
|
|
1768
1749
|
const deputyExecId = ctx2.__metadata.__deputyExecId;
|
|
1769
|
-
console.log(
|
|
1770
|
-
"Delegation request received:",
|
|
1771
|
-
ctx2.__localTaskName
|
|
1772
|
-
);
|
|
1773
1750
|
CadenzaService.createEphemeralMetaTask(
|
|
1774
1751
|
"Resolve delegation",
|
|
1775
1752
|
(ctx3) => {
|
|
@@ -1804,7 +1781,6 @@ var SocketController = class _SocketController {
|
|
|
1804
1781
|
"signal",
|
|
1805
1782
|
(ctx2, callback) => {
|
|
1806
1783
|
if (CadenzaService.signalBroker.listObservedSignals().includes(ctx2.__signalName)) {
|
|
1807
|
-
console.log("Signal received:", ctx2.__signalName);
|
|
1808
1784
|
callback({
|
|
1809
1785
|
__status: "success",
|
|
1810
1786
|
__signalName: ctx2.__signalName
|
|
@@ -2081,7 +2057,6 @@ var SocketController = class _SocketController {
|
|
|
2081
2057
|
delete ctx2.__broadcast;
|
|
2082
2058
|
const requestSentAt = Date.now();
|
|
2083
2059
|
pendingDelegationIds.add(ctx2.__metadata.__deputyExecId);
|
|
2084
|
-
console.log("Delegating task:", ctx2.__remoteRoutineName);
|
|
2085
2060
|
emitWhenReady?.(
|
|
2086
2061
|
"delegation",
|
|
2087
2062
|
ctx2,
|
|
@@ -2090,12 +2065,6 @@ var SocketController = class _SocketController {
|
|
|
2090
2065
|
const requestDuration = Date.now() - requestSentAt;
|
|
2091
2066
|
const metadata = resultContext.__metadata;
|
|
2092
2067
|
delete resultContext.__metadata;
|
|
2093
|
-
console.log(
|
|
2094
|
-
"Delegation response received:",
|
|
2095
|
-
ctx2.__remoteRoutineName,
|
|
2096
|
-
"Duration:",
|
|
2097
|
-
requestDuration
|
|
2098
|
-
);
|
|
2099
2068
|
emit(
|
|
2100
2069
|
`meta.socket_client.delegated:${ctx2.__metadata.__deputyExecId}`,
|
|
2101
2070
|
{
|
|
@@ -2123,7 +2092,6 @@ var SocketController = class _SocketController {
|
|
|
2123
2092
|
}
|
|
2124
2093
|
return new Promise((resolve) => {
|
|
2125
2094
|
delete ctx2.__broadcast;
|
|
2126
|
-
console.log("Transmitting signal:", ctx2.__signalName);
|
|
2127
2095
|
emitWhenReady?.("signal", ctx2, 5e3, (response) => {
|
|
2128
2096
|
if (ctx2.__routineExecId) {
|
|
2129
2097
|
emit(
|
|
@@ -2429,7 +2397,7 @@ var GraphMetadataController = class _GraphMetadataController {
|
|
|
2429
2397
|
data: {
|
|
2430
2398
|
...ctx.data,
|
|
2431
2399
|
serviceName: CadenzaService.serviceRegistry.serviceName,
|
|
2432
|
-
|
|
2400
|
+
serviceInstanceId: CadenzaService.serviceRegistry.serviceInstanceId
|
|
2433
2401
|
},
|
|
2434
2402
|
filter: {
|
|
2435
2403
|
...ctx.filter
|
|
@@ -2957,7 +2925,6 @@ var DatabaseController = class _DatabaseController {
|
|
|
2957
2925
|
if (ddl && ddl.length > 0) {
|
|
2958
2926
|
for (const sql of ddl) {
|
|
2959
2927
|
try {
|
|
2960
|
-
console.log("Executing DDL", sql);
|
|
2961
2928
|
await this.dbClient.query(sql);
|
|
2962
2929
|
} catch (error) {
|
|
2963
2930
|
console.error(
|
|
@@ -4197,7 +4164,6 @@ var GraphSyncController = class _GraphSyncController {
|
|
|
4197
4164
|
);
|
|
4198
4165
|
CadenzaService.schedule("meta.sync_requested", { __syncing: true }, 2e3);
|
|
4199
4166
|
}
|
|
4200
|
-
console.log("Syncing initiated", this.isCadenzaDBReady);
|
|
4201
4167
|
}
|
|
4202
4168
|
};
|
|
4203
4169
|
|