@cadenza.io/service 2.17.75 → 2.17.76
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 +50 -51
- package/dist/browser/index.js.map +1 -1
- package/dist/browser/index.mjs +50 -51
- package/dist/browser/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +50 -51
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -51
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.js
CHANGED
|
@@ -1212,39 +1212,12 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
1212
1212
|
if (trackedInstance?.isFrontend) {
|
|
1213
1213
|
return true;
|
|
1214
1214
|
}
|
|
1215
|
-
const trackedTransport = this.getRouteableTransport(
|
|
1216
|
-
trackedInstance,
|
|
1217
|
-
this.useSocket ? "socket" : "rest"
|
|
1218
|
-
);
|
|
1219
1215
|
if (this.deputies.has(serviceName) || this.remoteIntents.has(serviceName) || this.remoteSignals.has(serviceName)) {
|
|
1220
|
-
const
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
)
|
|
1216
|
+
const connected = this.ensureDependeeClientForInstance(
|
|
1217
|
+
trackedInstance,
|
|
1218
|
+
emit
|
|
1224
1219
|
);
|
|
1225
|
-
if (!
|
|
1226
|
-
communicationTypes.push("signal");
|
|
1227
|
-
}
|
|
1228
|
-
if (trackedTransport) {
|
|
1229
|
-
const clientCreated = this.hasTransportClientCreated(
|
|
1230
|
-
trackedInstance,
|
|
1231
|
-
trackedTransport.uuid
|
|
1232
|
-
);
|
|
1233
|
-
if (!clientCreated) {
|
|
1234
|
-
emit("meta.service_registry.dependee_registered", {
|
|
1235
|
-
serviceName,
|
|
1236
|
-
serviceInstanceId: uuid7,
|
|
1237
|
-
serviceTransportId: trackedTransport.uuid,
|
|
1238
|
-
serviceOrigin: trackedTransport.origin,
|
|
1239
|
-
transportProtocols: trackedTransport.protocols,
|
|
1240
|
-
communicationTypes
|
|
1241
|
-
});
|
|
1242
|
-
this.markTransportClientCreated(
|
|
1243
|
-
trackedInstance,
|
|
1244
|
-
trackedTransport.uuid
|
|
1245
|
-
);
|
|
1246
|
-
}
|
|
1247
|
-
} else {
|
|
1220
|
+
if (!connected) {
|
|
1248
1221
|
emit("meta.service_registry.routeable_transport_missing", {
|
|
1249
1222
|
serviceName,
|
|
1250
1223
|
serviceInstanceId: uuid7,
|
|
@@ -1310,25 +1283,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
1310
1283
|
if (!hasRemoteInterest) {
|
|
1311
1284
|
return true;
|
|
1312
1285
|
}
|
|
1313
|
-
|
|
1314
|
-
const communicationTypes = Array.from(
|
|
1315
|
-
new Set(
|
|
1316
|
-
this.deputies.get(ownerInstance.serviceName)?.map((descriptor) => descriptor.communicationType) ?? []
|
|
1317
|
-
)
|
|
1318
|
-
);
|
|
1319
|
-
if (!communicationTypes.includes("signal") && this.remoteSignals.has(ownerInstance.serviceName)) {
|
|
1320
|
-
communicationTypes.push("signal");
|
|
1321
|
-
}
|
|
1322
|
-
emit("meta.service_registry.dependee_registered", {
|
|
1323
|
-
serviceName: ownerInstance.serviceName,
|
|
1324
|
-
serviceInstanceId: ownerInstance.uuid,
|
|
1325
|
-
serviceTransportId: transport.uuid,
|
|
1326
|
-
serviceOrigin: transport.origin,
|
|
1327
|
-
transportProtocols: transport.protocols,
|
|
1328
|
-
communicationTypes
|
|
1329
|
-
});
|
|
1330
|
-
this.markTransportClientCreated(ownerInstance, transport.uuid);
|
|
1331
|
-
}
|
|
1286
|
+
this.ensureDependeeClientForInstance(ownerInstance, emit);
|
|
1332
1287
|
return true;
|
|
1333
1288
|
},
|
|
1334
1289
|
"Handles service transport updates independently from instance rows."
|
|
@@ -1409,7 +1364,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
1409
1364
|
).emits("meta.service_registry.registered_global_signals").doOn("global.meta.cadenza_db.gathered_sync_data");
|
|
1410
1365
|
this.handleGlobalIntentRegistrationTask = CadenzaService.createMetaTask(
|
|
1411
1366
|
"Handle global intent registration",
|
|
1412
|
-
(ctx) => {
|
|
1367
|
+
(ctx, emit) => {
|
|
1413
1368
|
const intentToTaskMaps = this.normalizeIntentMaps(ctx);
|
|
1414
1369
|
const sorted = intentToTaskMaps.sort((a, b) => {
|
|
1415
1370
|
if (a.deleted && !b.deleted) return -1;
|
|
@@ -1425,6 +1380,7 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
1425
1380
|
name: map.intentName
|
|
1426
1381
|
});
|
|
1427
1382
|
this.registerRemoteIntentDeputy(map);
|
|
1383
|
+
this.ensureDependeeClientsForService(map.serviceName, emit);
|
|
1428
1384
|
}
|
|
1429
1385
|
return true;
|
|
1430
1386
|
},
|
|
@@ -2850,6 +2806,49 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
2850
2806
|
}
|
|
2851
2807
|
return buildTransportClientKey(transport);
|
|
2852
2808
|
}
|
|
2809
|
+
resolveCommunicationTypesForService(serviceName) {
|
|
2810
|
+
const communicationTypes = Array.from(
|
|
2811
|
+
new Set(
|
|
2812
|
+
this.deputies.get(serviceName)?.map((descriptor) => descriptor.communicationType) ?? []
|
|
2813
|
+
)
|
|
2814
|
+
);
|
|
2815
|
+
if (!communicationTypes.includes("signal") && this.remoteSignals.has(serviceName)) {
|
|
2816
|
+
communicationTypes.push("signal");
|
|
2817
|
+
}
|
|
2818
|
+
return communicationTypes;
|
|
2819
|
+
}
|
|
2820
|
+
ensureDependeeClientForInstance(instance, emit) {
|
|
2821
|
+
if (!instance || instance.uuid === this.serviceInstanceId || instance.isFrontend || !instance.isActive || instance.isNonResponsive || instance.isBlocked) {
|
|
2822
|
+
return false;
|
|
2823
|
+
}
|
|
2824
|
+
if (!this.deputies.has(instance.serviceName) && !this.remoteIntents.has(instance.serviceName) && !this.remoteSignals.has(instance.serviceName)) {
|
|
2825
|
+
return false;
|
|
2826
|
+
}
|
|
2827
|
+
const transport = this.getRouteableTransport(
|
|
2828
|
+
instance,
|
|
2829
|
+
this.useSocket ? "socket" : "rest"
|
|
2830
|
+
);
|
|
2831
|
+
if (!transport || this.hasTransportClientCreated(instance, transport.uuid)) {
|
|
2832
|
+
return false;
|
|
2833
|
+
}
|
|
2834
|
+
emit("meta.service_registry.dependee_registered", {
|
|
2835
|
+
serviceName: instance.serviceName,
|
|
2836
|
+
serviceInstanceId: instance.uuid,
|
|
2837
|
+
serviceTransportId: transport.uuid,
|
|
2838
|
+
serviceOrigin: transport.origin,
|
|
2839
|
+
transportProtocols: transport.protocols,
|
|
2840
|
+
communicationTypes: this.resolveCommunicationTypesForService(
|
|
2841
|
+
instance.serviceName
|
|
2842
|
+
)
|
|
2843
|
+
});
|
|
2844
|
+
this.markTransportClientCreated(instance, transport.uuid);
|
|
2845
|
+
return true;
|
|
2846
|
+
}
|
|
2847
|
+
ensureDependeeClientsForService(serviceName, emit) {
|
|
2848
|
+
for (const instance of this.instances.get(serviceName) ?? []) {
|
|
2849
|
+
this.ensureDependeeClientForInstance(instance, emit);
|
|
2850
|
+
}
|
|
2851
|
+
}
|
|
2853
2852
|
hasTransportClientCreated(instance, transportId) {
|
|
2854
2853
|
return (instance.clientCreatedTransportIds ?? []).includes(transportId);
|
|
2855
2854
|
}
|