@cadenza.io/service 1.9.37 → 1.9.38

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
@@ -995,8 +995,8 @@ var RestController = class _RestController {
995
995
  const app = ctx.__app;
996
996
  app.post("/handshake", (req, res) => {
997
997
  try {
998
- console.log("handshake", req);
999
- CadenzaService.broker.emit("meta.rest.handshake", req);
998
+ console.log("handshake", req.body);
999
+ CadenzaService.broker.emit("meta.rest.handshake", req.body);
1000
1000
  res.send({ __status: "success" });
1001
1001
  } catch (e) {
1002
1002
  console.error("Error in handshake", e);
@@ -1007,7 +1007,7 @@ var RestController = class _RestController {
1007
1007
  let routineExecId;
1008
1008
  let ctx2;
1009
1009
  try {
1010
- ctx2 = req;
1010
+ ctx2 = req.body;
1011
1011
  routineExecId = ctx2.__routineExecId || (0, import_uuid3.v4)();
1012
1012
  console.log("delegation", ctx2);
1013
1013
  } catch (e) {
@@ -1043,7 +1043,7 @@ var RestController = class _RestController {
1043
1043
  app.post("/signal", (req, res) => {
1044
1044
  let ctx2;
1045
1045
  try {
1046
- ctx2 = req;
1046
+ ctx2 = req.body;
1047
1047
  console.log("signal", ctx2);
1048
1048
  res.send({ __status: "success" });
1049
1049
  } catch (e) {
@@ -1178,12 +1178,10 @@ var RestController = class _RestController {
1178
1178
  (ctx2, emit2) => __async(null, null, function* () {
1179
1179
  var _a2;
1180
1180
  console.log("Sending handshake", ctx2);
1181
- const formData = new FormData();
1182
- formData.append(
1183
- "handshakeData",
1184
- JSON.stringify(__spreadValues({}, ctx2.handshakeData))
1185
- );
1186
1181
  const response = yield (0, import_node_fetch.default)(`${URL}/handshake`, {
1182
+ headers: {
1183
+ "Content-Type": "application/json"
1184
+ },
1187
1185
  method: "POST",
1188
1186
  body: JSON.stringify(ctx2.handshakeData)
1189
1187
  });
@@ -1225,11 +1223,12 @@ var RestController = class _RestController {
1225
1223
  }
1226
1224
  let resultContext;
1227
1225
  try {
1228
- const formData = new FormData();
1229
- formData.append("context", JSON.stringify(ctx2));
1230
1226
  const response = yield (0, import_node_fetch.default)(`${URL}/delegation`, {
1227
+ headers: {
1228
+ "Content-Type": "application/json"
1229
+ },
1231
1230
  method: "POST",
1232
- body: formData
1231
+ body: JSON.stringify(ctx2)
1233
1232
  });
1234
1233
  resultContext = yield response.json();
1235
1234
  } catch (e) {
@@ -1255,11 +1254,12 @@ var RestController = class _RestController {
1255
1254
  }
1256
1255
  let response;
1257
1256
  try {
1258
- const formData = new FormData();
1259
- formData.append("context", JSON.stringify(ctx2));
1260
1257
  response = yield (0, import_node_fetch.default)(`${URL}/signal`, {
1258
+ headers: {
1259
+ "Content-Type": "application/json"
1260
+ },
1261
1261
  method: "POST",
1262
- body: formData
1262
+ body: JSON.stringify(ctx2)
1263
1263
  });
1264
1264
  response = yield response.json();
1265
1265
  if (ctx2.__routineExecId) {
@@ -3620,11 +3620,17 @@ var CadenzaService = class {
3620
3620
  } else {
3621
3621
  import_core3.default.broker.emit("meta.create_service_requested", initContext);
3622
3622
  }
3623
- this.createEphemeralMetaTask("Handle service setup completion", (ctx) => {
3624
- SignalController.instance;
3625
- GraphMetadataController.instance;
3626
- return true;
3627
- }).doOn("meta.service_registry.instance_inserted");
3623
+ this.createEphemeralMetaTask(
3624
+ "Handle service setup completion",
3625
+ (ctx, emit) => {
3626
+ SignalController.instance;
3627
+ GraphMetadataController.instance;
3628
+ emit("meta.register_all_routines", {});
3629
+ emit("meta.register_all_tasks", {});
3630
+ emit("meta.register_all_signals", {});
3631
+ return true;
3632
+ }
3633
+ ).doOn("meta.service_registry.instance_inserted");
3628
3634
  this.serviceCreated = true;
3629
3635
  }
3630
3636
  static createCadenzaMetaService(serviceName, description, options = {}) {