@ejfdelgado/ejflab-back 1.25.1 → 1.26.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/LICENSE +0 -0
- package/README.md +0 -0
- package/package.json +1 -1
- package/srv/AudIASrv.mjs +0 -0
- package/srv/AuthorizationSrv.mjs +0 -0
- package/srv/ComputeEngineSrv.mjs +0 -0
- package/srv/EmailHandler.mjs +0 -0
- package/srv/Image2MeshSrv.mjs +0 -0
- package/srv/ImagiationSrv.mjs +0 -0
- package/srv/KeysSrv.mjs +0 -0
- package/srv/MainHandler.mjs +0 -0
- package/srv/MainReplacer.mjs +0 -0
- package/srv/MfaSrv.mjs +0 -0
- package/srv/MilvusSrv.mjs +0 -0
- package/srv/MinioSrv.mjs +0 -0
- package/srv/MongoSrv.mjs +0 -0
- package/srv/MyFileService.mjs +0 -0
- package/srv/MyFileServiceLocal.mjs +0 -0
- package/srv/MyPdf.mjs +24 -8
- package/srv/MyShell.mjs +0 -0
- package/srv/MySqlSrv.mjs +0 -0
- package/srv/OpenCVSrv.mjs +0 -0
- package/srv/PayUSrv.mjs +0 -0
- package/srv/PayUSrvConstants.mjs +0 -0
- package/srv/PostgresSrv.mjs +0 -0
- package/srv/SecretsSrv.mjs +0 -0
- package/srv/SocketIOCall.mjs +0 -0
- package/srv/TupleSrv.mjs +0 -0
- package/srv/UtilesSrv.mjs +0 -0
- package/srv/callprocessors/AskIceServersProcessor.mjs +0 -0
- package/srv/callprocessors/AskRoomProcessor.mjs +0 -0
- package/srv/callprocessors/CallUserProcessor.mjs +0 -0
- package/srv/callprocessors/ChatSetSawProcessor.mjs +0 -0
- package/srv/callprocessors/CheckSrcResponseProcessor.mjs +0 -0
- package/srv/callprocessors/ClientChangeProcessor.mjs +0 -0
- package/srv/callprocessors/CloseVideoChatProcessor.mjs +0 -0
- package/srv/callprocessors/DestroyModelProcessor.mjs +0 -0
- package/srv/callprocessors/DisconnectProcessor.mjs +0 -0
- package/srv/callprocessors/GenericProcessor.mjs +0 -0
- package/srv/callprocessors/GetModelProcessor.mjs +0 -0
- package/srv/callprocessors/IncludeOtherPeersProcessor.mjs +0 -0
- package/srv/callprocessors/LoadFlowChartProcessor.mjs +0 -0
- package/srv/callprocessors/MakeAnswerProcessor.mjs +0 -0
- package/srv/callprocessors/OnIceCandidateProcessor.mjs +0 -0
- package/srv/callprocessors/OpenVideoChatProcessor.mjs +0 -0
- package/srv/callprocessors/PauseFlowChartProcessor.mjs +0 -0
- package/srv/callprocessors/ProcessResponseProcessor.mjs +0 -0
- package/srv/callprocessors/ReadSrcResponseProcessor.mjs +0 -0
- package/srv/callprocessors/RegisterProcessorProcessor.mjs +0 -0
- package/srv/callprocessors/RegisterSourceProcessor.mjs +0 -0
- package/srv/callprocessors/SendChatProcessor.mjs +0 -0
- package/srv/callprocessors/StartFlowChartProcessor.mjs +0 -0
- package/srv/callprocessors/StopFlowChartProcessor.mjs +0 -0
- package/srv/callprocessors/SubscribemeProcessor.mjs +0 -0
- package/srv/callprocessors/UpdateMyInformationProcessor.mjs +0 -0
- package/srv/common/FirebasConfig.mjs +0 -0
- package/srv/common/General.mjs +5 -4
- package/srv/common/MimeTypeMap.mjs +0 -0
- package/srv/common/MyStore.mjs +0 -0
- package/srv/common/Usuario.mjs +0 -0
- package/srv/common/Utilidades.mjs +0 -0
package/LICENSE
CHANGED
File without changes
|
package/README.md
CHANGED
File without changes
|
package/package.json
CHANGED
package/srv/AudIASrv.mjs
CHANGED
File without changes
|
package/srv/AuthorizationSrv.mjs
CHANGED
File without changes
|
package/srv/ComputeEngineSrv.mjs
CHANGED
File without changes
|
package/srv/EmailHandler.mjs
CHANGED
File without changes
|
package/srv/Image2MeshSrv.mjs
CHANGED
File without changes
|
package/srv/ImagiationSrv.mjs
CHANGED
File without changes
|
package/srv/KeysSrv.mjs
CHANGED
File without changes
|
package/srv/MainHandler.mjs
CHANGED
File without changes
|
package/srv/MainReplacer.mjs
CHANGED
File without changes
|
package/srv/MfaSrv.mjs
CHANGED
File without changes
|
package/srv/MilvusSrv.mjs
CHANGED
File without changes
|
package/srv/MinioSrv.mjs
CHANGED
File without changes
|
package/srv/MongoSrv.mjs
CHANGED
File without changes
|
package/srv/MyFileService.mjs
CHANGED
File without changes
|
File without changes
|
package/srv/MyPdf.mjs
CHANGED
@@ -1,10 +1,16 @@
|
|
1
1
|
import fs from "fs";
|
2
2
|
import puppeteer from 'puppeteer';
|
3
3
|
import { General } from "./common/General.mjs";
|
4
|
+
import { MyTemplate } from "@ejfdelgado/ejflab-common/src/MyTemplate.js";
|
4
5
|
|
5
6
|
export class MyPdf {
|
6
|
-
static async localRender(template) {
|
7
|
+
static async localRender(template, model = {}, format = "pdf") {
|
7
8
|
const source = fs.readFileSync(`./src/assets/templates/pdf/${template}`, { encoding: "utf8" });
|
9
|
+
const renderer = new MyTemplate();
|
10
|
+
const rendered = renderer.render(source, model);
|
11
|
+
if (format == "html") {
|
12
|
+
return rendered;
|
13
|
+
}
|
8
14
|
const browser = await puppeteer.launch({
|
9
15
|
headless: 'new',
|
10
16
|
executablePath: '/usr/bin/google-chrome',
|
@@ -14,7 +20,7 @@ export class MyPdf {
|
|
14
20
|
]
|
15
21
|
});
|
16
22
|
const page = await browser.newPage();
|
17
|
-
await page.setContent(
|
23
|
+
await page.setContent(rendered);
|
18
24
|
await page.emulateMediaType('print');
|
19
25
|
const pdf = await page.pdf({
|
20
26
|
margin: { top: '100px', right: '50px', bottom: '100px', left: '50px' },
|
@@ -27,11 +33,21 @@ export class MyPdf {
|
|
27
33
|
|
28
34
|
static async render(req, res, next) {
|
29
35
|
const template = General.readParam(req, "template");
|
30
|
-
const
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
+
const format = General.readParam(req, "format", "pdf");
|
37
|
+
const body = req.body;
|
38
|
+
const rendered = await MyPdf.localRender(template, body, format);
|
39
|
+
if (format == "html") {
|
40
|
+
res.writeHead(200, {
|
41
|
+
"Content-Type": "text/html",
|
42
|
+
"Content-disposition": "inline"
|
43
|
+
});
|
44
|
+
res.end(rendered);
|
45
|
+
} else {
|
46
|
+
res.writeHead(200, {
|
47
|
+
"Content-Type": "application/pdf",
|
48
|
+
"Content-disposition": "inline"
|
49
|
+
});
|
50
|
+
res.end(rendered);
|
51
|
+
}
|
36
52
|
}
|
37
53
|
}
|
package/srv/MyShell.mjs
CHANGED
File without changes
|
package/srv/MySqlSrv.mjs
CHANGED
File without changes
|
package/srv/OpenCVSrv.mjs
CHANGED
File without changes
|
package/srv/PayUSrv.mjs
CHANGED
File without changes
|
package/srv/PayUSrvConstants.mjs
CHANGED
File without changes
|
package/srv/PostgresSrv.mjs
CHANGED
File without changes
|
package/srv/SecretsSrv.mjs
CHANGED
File without changes
|
package/srv/SocketIOCall.mjs
CHANGED
File without changes
|
package/srv/TupleSrv.mjs
CHANGED
File without changes
|
package/srv/UtilesSrv.mjs
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
package/srv/common/General.mjs
CHANGED
@@ -74,12 +74,13 @@ export class General {
|
|
74
74
|
const limit = parseInt(General.readParam(req, "limit", General.PAGE_SIZE_DEFAULT));
|
75
75
|
const orderColumn = General.readParam(req, "orderColumn", orderColumnDef);
|
76
76
|
const direction = General.readParam(req, "direction", General.PAGE_DIRECTION).toLowerCase();
|
77
|
-
const page = parseInt(General.readParam(req, "page",
|
77
|
+
const page = parseInt(General.readParam(req, "page", null));
|
78
|
+
const offsetProvided = parseInt(General.readParam(req, "offset", null));
|
78
79
|
if (!(typeof limit == "number")) {
|
79
80
|
throw new MalaPeticionException("limit is expected to be a number");
|
80
81
|
}
|
81
|
-
if (
|
82
|
-
throw new MalaPeticionException("page is expected to be a number");
|
82
|
+
if (isNaN(page) && isNaN(offsetProvided)) {
|
83
|
+
throw new MalaPeticionException("page or offset is expected to be a number");
|
83
84
|
}
|
84
85
|
if (General.DIRECTION_CHOICES.indexOf(direction) < 0) {
|
85
86
|
throw new MalaPeticionException(`direction is expected to be one of ${General.DIRECTION_CHOICES.join(', ')}`);
|
@@ -89,7 +90,7 @@ export class General {
|
|
89
90
|
orderColumn,
|
90
91
|
direction,
|
91
92
|
page,
|
92
|
-
offset: page * limit
|
93
|
+
offset: !isNaN(offsetProvided) ? offsetProvided : page * limit
|
93
94
|
};
|
94
95
|
}
|
95
96
|
}
|
File without changes
|
package/srv/common/MyStore.mjs
CHANGED
File without changes
|
package/srv/common/Usuario.mjs
CHANGED
File without changes
|
File without changes
|