@cadenza.io/service 2.2.3 → 2.3.0
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 +25 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -18
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -281,6 +281,9 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
281
281
|
} else {
|
|
282
282
|
instances.push(serviceInstance);
|
|
283
283
|
}
|
|
284
|
+
if (this.serviceName === serviceName) {
|
|
285
|
+
return false;
|
|
286
|
+
}
|
|
284
287
|
if (!isFrontend && this.deputies.has(serviceName) || this.remoteSignals.has(serviceName)) {
|
|
285
288
|
const clientCreated = instances?.some(
|
|
286
289
|
(i) => i.address === address && i.port === port && i.clientCreated && i.isActive
|
|
@@ -407,24 +410,25 @@ var ServiceRegistry = class _ServiceRegistry {
|
|
|
407
410
|
this.handleServiceHandshakeTask = CadenzaService.createMetaTask(
|
|
408
411
|
"Handle service handshake",
|
|
409
412
|
(ctx, emit) => {
|
|
410
|
-
const { serviceName,
|
|
413
|
+
const { serviceName, serviceInstanceId } = ctx;
|
|
411
414
|
const serviceInstances = this.instances.get(serviceName);
|
|
412
|
-
const
|
|
413
|
-
(i) => i.
|
|
415
|
+
const instance = serviceInstances?.find(
|
|
416
|
+
(i) => i.uuid === serviceInstanceId
|
|
414
417
|
);
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
instance.isNonResponsive = false;
|
|
418
|
-
emit("global.meta.service_registry.service_handshake", {
|
|
419
|
-
data: {
|
|
420
|
-
isActive: instance.isActive,
|
|
421
|
-
isNonResponsive: instance.isNonResponsive
|
|
422
|
-
},
|
|
423
|
-
filter: {
|
|
424
|
-
uuid: instance.uuid
|
|
425
|
-
}
|
|
426
|
-
});
|
|
418
|
+
if (!instance) {
|
|
419
|
+
return false;
|
|
427
420
|
}
|
|
421
|
+
instance.isActive = true;
|
|
422
|
+
instance.isNonResponsive = false;
|
|
423
|
+
emit("global.meta.service_registry.service_handshake", {
|
|
424
|
+
data: {
|
|
425
|
+
isActive: instance.isActive,
|
|
426
|
+
isNonResponsive: instance.isNonResponsive
|
|
427
|
+
},
|
|
428
|
+
filter: {
|
|
429
|
+
uuid: instance.uuid
|
|
430
|
+
}
|
|
431
|
+
});
|
|
428
432
|
return true;
|
|
429
433
|
},
|
|
430
434
|
"Handles service handshake"
|
|
@@ -1204,7 +1208,7 @@ var RestController = class _RestController {
|
|
|
1204
1208
|
CadenzaService.createMetaTask(
|
|
1205
1209
|
"Configure network",
|
|
1206
1210
|
async (ctx) => {
|
|
1207
|
-
let address = "
|
|
1211
|
+
let address = "undefined";
|
|
1208
1212
|
let port = ctx.__port;
|
|
1209
1213
|
let exposed = false;
|
|
1210
1214
|
const createHttpServer = async (ctx2) => {
|
|
@@ -1221,7 +1225,7 @@ var RestController = class _RestController {
|
|
|
1221
1225
|
address = process.env.CADENZA_SERVER_URL || "localhost";
|
|
1222
1226
|
}
|
|
1223
1227
|
} else {
|
|
1224
|
-
address = server?.address()?.address || "";
|
|
1228
|
+
address = server?.address()?.address || "undefined";
|
|
1225
1229
|
}
|
|
1226
1230
|
console.log(
|
|
1227
1231
|
`Server is running on ${address}:${port}`
|
|
@@ -3228,7 +3232,10 @@ var DatabaseController = class _DatabaseController {
|
|
|
3228
3232
|
async updateFunction(tableName, context) {
|
|
3229
3233
|
const { data, filter = {}, transaction = true } = context;
|
|
3230
3234
|
if (!data || Object.keys(data).length === 0) {
|
|
3231
|
-
return {
|
|
3235
|
+
return {
|
|
3236
|
+
errored: true,
|
|
3237
|
+
__error: `No data provided for update of ${tableName}`
|
|
3238
|
+
};
|
|
3232
3239
|
}
|
|
3233
3240
|
let resultContext = {};
|
|
3234
3241
|
const client = transaction ? await this.getClient() : this.dbClient;
|