@ejfdelgado/ejflab-back 1.17.2 → 1.18.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/package.json +1 -1
- package/srv/EmailHandler.mjs +11 -2
- package/srv/SocketIOCall.mjs +12 -0
package/package.json
CHANGED
package/srv/EmailHandler.mjs
CHANGED
@@ -4,11 +4,14 @@ import { MainHandler } from "./MainHandler.mjs";
|
|
4
4
|
import { MyTemplate } from "@ejfdelgado/ejflab-common/src/MyTemplate.js";
|
5
5
|
import { General } from "./common/General.mjs";
|
6
6
|
import MyDatesBack from "@ejfdelgado/ejflab-common/src/MyDatesBack.mjs";
|
7
|
+
import * as sortifyModule from "@ejfdelgado/ejflab-common/src/sortify.js";
|
8
|
+
|
9
|
+
const sortify = sortifyModule.default;
|
7
10
|
|
8
11
|
export class EmailHandler {
|
9
12
|
static async send(req, res) {
|
10
13
|
const useDebug = false;
|
11
|
-
console.log(`Using SEND_GRID_VARIABLE ${process.env.SEND_GRID_VARIABLE.substring(0,
|
14
|
+
console.log(`Using SEND_GRID_VARIABLE ${JSON.stringify(process.env.SEND_GRID_VARIABLE.substring(0, 7))}...`);
|
12
15
|
sgMail.setApiKey(
|
13
16
|
process.env.SEND_GRID_VARIABLE
|
14
17
|
);
|
@@ -41,6 +44,7 @@ export class EmailHandler {
|
|
41
44
|
html: contenidoFinal,
|
42
45
|
};
|
43
46
|
|
47
|
+
console.log(`Using EMAIL_SENDER ${JSON.stringify(MyConstants.EMAIL_SENDER)}`);
|
44
48
|
//console.log(JSON.stringify(body.params, null, 4));
|
45
49
|
//console.log(JSON.stringify(contenidoFinal, null, 4));
|
46
50
|
|
@@ -48,7 +52,12 @@ export class EmailHandler {
|
|
48
52
|
res.status(200).set({ 'content-type': 'text/html; charset=utf-8' }).send(contenidoFinal).end();
|
49
53
|
} else {
|
50
54
|
let answer = {};
|
51
|
-
|
55
|
+
try {
|
56
|
+
answer = await sgMail.send(msg);
|
57
|
+
} catch (err) {
|
58
|
+
console.log(sortify(err));
|
59
|
+
throw err;
|
60
|
+
}
|
52
61
|
res.status(200).json(answer).end();
|
53
62
|
}
|
54
63
|
}
|
package/srv/SocketIOCall.mjs
CHANGED
@@ -45,6 +45,7 @@ export class SocketIOCall {
|
|
45
45
|
static mapFlowChartExec = {};
|
46
46
|
static socketIdToSocket = {};
|
47
47
|
static socketRoomUUIDMap = {};
|
48
|
+
static socketToImage = {};
|
48
49
|
|
49
50
|
static echoLog(message) {
|
50
51
|
console.log(message);
|
@@ -274,6 +275,9 @@ export class SocketIOCall {
|
|
274
275
|
SocketIOCall.echoLog(`${socket.id} sends disconnect with ${JSON.stringify(payload)}`);
|
275
276
|
new DisconnectProcessor(SocketIOCall, SocketIOCall.io, socket).executeSave(payload);
|
276
277
|
SocketIOCall.disconnect(socket);
|
278
|
+
if (socket.id in SocketIOCall.socketToImage) {
|
279
|
+
delete SocketIOCall.socketToImage[socket.id];
|
280
|
+
}
|
277
281
|
});
|
278
282
|
/*
|
279
283
|
socket.on("reconnect", (payload) => {
|
@@ -520,4 +524,12 @@ export class SocketIOCall {
|
|
520
524
|
};
|
521
525
|
res.status(200).send(response);
|
522
526
|
}
|
527
|
+
|
528
|
+
static putSocketImage(socketId, bytes) {
|
529
|
+
SocketIOCall.socketToImage[socketId] = bytes;
|
530
|
+
}
|
531
|
+
|
532
|
+
static getSocketImage(socketId) {
|
533
|
+
return SocketIOCall.socketToImage[socketId];
|
534
|
+
}
|
523
535
|
}
|