@cadenza.io/service 1.2.0 → 1.2.1

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 CHANGED
@@ -373,8 +373,9 @@ var ServiceRegistry = class _ServiceRegistry {
373
373
  "meta.service_registry.instance_inserted"
374
374
  ).then(
375
375
  CadenzaService.createMetaTask("Split service instances", function* (ctx) {
376
- const { __serviceInstances } = ctx;
377
- for (const serviceInstance of __serviceInstances) {
376
+ const { serviceInstances } = ctx;
377
+ if (!serviceInstances) return;
378
+ for (const serviceInstance of serviceInstances) {
378
379
  yield serviceInstance;
379
380
  }
380
381
  }).then(this.handleInstanceUpdateTask)
@@ -665,11 +666,13 @@ var ServiceRegistry = class _ServiceRegistry {
665
666
  CadenzaService.createMetaTask(
666
667
  "Setup service",
667
668
  (ctx) => {
668
- const { serviceInstance, __useSocket, __retryCount } = ctx;
669
- this.serviceInstanceId = serviceInstance.id;
670
- this.instances.set(serviceInstance.serviceName, [
671
- __spreadValues({}, serviceInstance)
672
- ]);
669
+ var _a, _b;
670
+ const { serviceInstance, data, __useSocket, __retryCount } = ctx;
671
+ this.serviceInstanceId = (_a = data == null ? void 0 : data.id) != null ? _a : serviceInstance == null ? void 0 : serviceInstance.id;
672
+ this.instances.set(
673
+ (_b = data == null ? void 0 : data.service_name) != null ? _b : serviceInstance == null ? void 0 : serviceInstance.serviceName,
674
+ [__spreadValues({}, data != null ? data : serviceInstance)]
675
+ );
673
676
  this.useSocket = __useSocket;
674
677
  this.retryCount = __retryCount;
675
678
  return true;
@@ -1024,12 +1027,18 @@ var RestController = class _RestController {
1024
1027
  } else if (ctx.__networkMode === "auto") {
1025
1028
  createHttpServer(ctx);
1026
1029
  }
1027
- ctx.id = (0, import_uuid3.v4)();
1028
- ctx.address = address;
1029
- ctx.port = port;
1030
- ctx.exposed = exposed;
1031
- ctx.process_pid = process.pid;
1032
- ctx.service_name = ctx.__serviceName;
1030
+ ctx.data = {
1031
+ id: (0, import_uuid3.v4)(),
1032
+ address,
1033
+ port,
1034
+ exposed,
1035
+ process_pid: process.pid,
1036
+ service_name: ctx.__serviceName,
1037
+ is_active: true,
1038
+ is_non_responsive: false,
1039
+ is_blocked: false,
1040
+ health: {}
1041
+ };
1033
1042
  return ctx;
1034
1043
  },
1035
1044
  "Configures network mode"