@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.
Files changed (61) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +0 -0
  3. package/package.json +1 -1
  4. package/srv/AudIASrv.mjs +0 -0
  5. package/srv/AuthorizationSrv.mjs +0 -0
  6. package/srv/ComputeEngineSrv.mjs +0 -0
  7. package/srv/EmailHandler.mjs +0 -0
  8. package/srv/Image2MeshSrv.mjs +0 -0
  9. package/srv/ImagiationSrv.mjs +0 -0
  10. package/srv/KeysSrv.mjs +0 -0
  11. package/srv/MainHandler.mjs +0 -0
  12. package/srv/MainReplacer.mjs +0 -0
  13. package/srv/MfaSrv.mjs +0 -0
  14. package/srv/MilvusSrv.mjs +0 -0
  15. package/srv/MinioSrv.mjs +0 -0
  16. package/srv/MongoSrv.mjs +0 -0
  17. package/srv/MyFileService.mjs +0 -0
  18. package/srv/MyFileServiceLocal.mjs +0 -0
  19. package/srv/MyPdf.mjs +24 -8
  20. package/srv/MyShell.mjs +0 -0
  21. package/srv/MySqlSrv.mjs +0 -0
  22. package/srv/OpenCVSrv.mjs +0 -0
  23. package/srv/PayUSrv.mjs +0 -0
  24. package/srv/PayUSrvConstants.mjs +0 -0
  25. package/srv/PostgresSrv.mjs +0 -0
  26. package/srv/SecretsSrv.mjs +0 -0
  27. package/srv/SocketIOCall.mjs +0 -0
  28. package/srv/TupleSrv.mjs +0 -0
  29. package/srv/UtilesSrv.mjs +0 -0
  30. package/srv/callprocessors/AskIceServersProcessor.mjs +0 -0
  31. package/srv/callprocessors/AskRoomProcessor.mjs +0 -0
  32. package/srv/callprocessors/CallUserProcessor.mjs +0 -0
  33. package/srv/callprocessors/ChatSetSawProcessor.mjs +0 -0
  34. package/srv/callprocessors/CheckSrcResponseProcessor.mjs +0 -0
  35. package/srv/callprocessors/ClientChangeProcessor.mjs +0 -0
  36. package/srv/callprocessors/CloseVideoChatProcessor.mjs +0 -0
  37. package/srv/callprocessors/DestroyModelProcessor.mjs +0 -0
  38. package/srv/callprocessors/DisconnectProcessor.mjs +0 -0
  39. package/srv/callprocessors/GenericProcessor.mjs +0 -0
  40. package/srv/callprocessors/GetModelProcessor.mjs +0 -0
  41. package/srv/callprocessors/IncludeOtherPeersProcessor.mjs +0 -0
  42. package/srv/callprocessors/LoadFlowChartProcessor.mjs +0 -0
  43. package/srv/callprocessors/MakeAnswerProcessor.mjs +0 -0
  44. package/srv/callprocessors/OnIceCandidateProcessor.mjs +0 -0
  45. package/srv/callprocessors/OpenVideoChatProcessor.mjs +0 -0
  46. package/srv/callprocessors/PauseFlowChartProcessor.mjs +0 -0
  47. package/srv/callprocessors/ProcessResponseProcessor.mjs +0 -0
  48. package/srv/callprocessors/ReadSrcResponseProcessor.mjs +0 -0
  49. package/srv/callprocessors/RegisterProcessorProcessor.mjs +0 -0
  50. package/srv/callprocessors/RegisterSourceProcessor.mjs +0 -0
  51. package/srv/callprocessors/SendChatProcessor.mjs +0 -0
  52. package/srv/callprocessors/StartFlowChartProcessor.mjs +0 -0
  53. package/srv/callprocessors/StopFlowChartProcessor.mjs +0 -0
  54. package/srv/callprocessors/SubscribemeProcessor.mjs +0 -0
  55. package/srv/callprocessors/UpdateMyInformationProcessor.mjs +0 -0
  56. package/srv/common/FirebasConfig.mjs +0 -0
  57. package/srv/common/General.mjs +5 -4
  58. package/srv/common/MimeTypeMap.mjs +0 -0
  59. package/srv/common/MyStore.mjs +0 -0
  60. package/srv/common/Usuario.mjs +0 -0
  61. package/srv/common/Utilidades.mjs +0 -0
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ejfdelgado/ejflab-back",
3
- "version": "1.25.1",
3
+ "version": "1.26.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/ejfdelgado/ejflab-back.git"
package/srv/AudIASrv.mjs CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
package/srv/KeysSrv.mjs CHANGED
File without changes
File without changes
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
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(source);
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 pdf = await MyPdf.localRender(template);
31
- res.writeHead(200, {
32
- "Content-Type": "application/pdf",
33
- "Content-disposition": "inline"
34
- });
35
- res.end(pdf);
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
File without changes
File without changes
File without changes
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
@@ -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", "0"));
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 (!(typeof page == "number")) {
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
File without changes
File without changes
File without changes