@cadenza.io/service 1.9.33 → 1.9.35
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 +14 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -994,12 +994,14 @@ var RestController = class _RestController {
|
|
|
994
994
|
(ctx) => {
|
|
995
995
|
const app = ctx.__app;
|
|
996
996
|
app.post("/handshake", (req, res) => {
|
|
997
|
+
console.log("handshake", req.body);
|
|
997
998
|
CadenzaService.broker.emit("meta.rest.handshake", req.body);
|
|
998
999
|
res.send({ __status: "success" });
|
|
999
1000
|
});
|
|
1000
1001
|
app.post("/delegation", (req, res) => {
|
|
1001
1002
|
const ctx2 = req.body;
|
|
1002
1003
|
const routineExecId = ctx2.__routineExecId || (0, import_uuid3.v4)();
|
|
1004
|
+
console.log("delegation", ctx2);
|
|
1003
1005
|
CadenzaService.createEphemeralMetaTask(
|
|
1004
1006
|
"Resolve delegation",
|
|
1005
1007
|
(endCtx) => res.json({
|
|
@@ -1027,6 +1029,7 @@ var RestController = class _RestController {
|
|
|
1027
1029
|
});
|
|
1028
1030
|
app.post("/signal", (req, res) => {
|
|
1029
1031
|
const ctx2 = req.body;
|
|
1032
|
+
console.log("signal", ctx2);
|
|
1030
1033
|
res.send({ __status: "success" });
|
|
1031
1034
|
CadenzaService.broker.emit(ctx2.__signalName, ctx2.__context);
|
|
1032
1035
|
});
|
|
@@ -1154,12 +1157,14 @@ var RestController = class _RestController {
|
|
|
1154
1157
|
"Send Handshake",
|
|
1155
1158
|
(ctx2, emit2) => __async(null, null, function* () {
|
|
1156
1159
|
var _a2;
|
|
1160
|
+
console.log("Sending handshake", ctx2);
|
|
1157
1161
|
const response = yield (0, import_node_fetch.default)(`${URL}/handshake`, {
|
|
1158
1162
|
method: "POST",
|
|
1159
1163
|
body: JSON.stringify(ctx2.handshakeData)
|
|
1160
1164
|
});
|
|
1161
1165
|
const result = yield response.json();
|
|
1162
|
-
|
|
1166
|
+
console.log("Handshake result", result);
|
|
1167
|
+
if (result.__status === "error") {
|
|
1163
1168
|
throw new Error(
|
|
1164
1169
|
(_a2 = result.__error) != null ? _a2 : `Failed to connect to service ${serviceName} ${ctx2.serviceInstanceId}`
|
|
1165
1170
|
);
|
|
@@ -1269,10 +1274,11 @@ var RestController = class _RestController {
|
|
|
1269
1274
|
CadenzaService.createMetaTask(
|
|
1270
1275
|
"Prepare handshake",
|
|
1271
1276
|
(ctx, emit) => {
|
|
1272
|
-
const { serviceInstanceId, serviceName } = ctx;
|
|
1277
|
+
const { serviceInstanceId, serviceName, communicationTypes } = ctx;
|
|
1273
1278
|
emit(`meta.fetch.handshake_requested:${serviceInstanceId}`, {
|
|
1274
1279
|
serviceInstanceId,
|
|
1275
1280
|
serviceName,
|
|
1281
|
+
communicationTypes,
|
|
1276
1282
|
handshakeData: {
|
|
1277
1283
|
// JWT token...
|
|
1278
1284
|
}
|
|
@@ -3158,8 +3164,9 @@ var DatabaseController = class _DatabaseController {
|
|
|
3158
3164
|
}
|
|
3159
3165
|
createDatabaseTask(op, tableName, table, queryFunction, options) {
|
|
3160
3166
|
var _a2, _b2, _c2, _d2;
|
|
3167
|
+
const tableNameFormatted = tableName.split("_").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join("");
|
|
3161
3168
|
const task = CadenzaService.createThrottledTask(
|
|
3162
|
-
`db${op.charAt(0).toUpperCase() + op.slice(1)}${
|
|
3169
|
+
`db${op.charAt(0).toUpperCase() + op.slice(1)}${tableNameFormatted}`,
|
|
3163
3170
|
(context, emit) => __async(null, null, function* () {
|
|
3164
3171
|
var _a3, _b3, _c3, _d3, _e, _f, _g, _h;
|
|
3165
3172
|
const triggerConditions = (_c3 = (_b3 = (_a3 = table.customSignals) == null ? void 0 : _a3.triggers) == null ? void 0 : _b3.query) == null ? void 0 : _c3.filter(
|
|
@@ -3507,7 +3514,6 @@ var CadenzaService = class {
|
|
|
3507
3514
|
import_core3.default.validateName(serviceName);
|
|
3508
3515
|
this.validateServiceName(serviceName);
|
|
3509
3516
|
this.serviceRegistry.serviceName = serviceName;
|
|
3510
|
-
GraphMetadataController.instance;
|
|
3511
3517
|
options = __spreadValues({
|
|
3512
3518
|
loadBalance: true,
|
|
3513
3519
|
useSocket: true,
|
|
@@ -3579,6 +3585,10 @@ var CadenzaService = class {
|
|
|
3579
3585
|
__retryCount: options.retryCount,
|
|
3580
3586
|
__cadenzaDBConnect: (_k = options.cadenzaDB) == null ? void 0 : _k.connect
|
|
3581
3587
|
});
|
|
3588
|
+
this.createEphemeralMetaTask("Handle service setup completion", (ctx) => {
|
|
3589
|
+
GraphMetadataController.instance;
|
|
3590
|
+
return true;
|
|
3591
|
+
}).doOn("meta.service_registry.instance_inserted");
|
|
3582
3592
|
this.serviceCreated = true;
|
|
3583
3593
|
}
|
|
3584
3594
|
static createCadenzaMetaService(serviceName, description, options = {}) {
|