fpavon-ee-shared 1.0.54 → 1.0.55

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 (22) hide show
  1. package/dist/digitalSignature/application/digitalSignature.useCase.js +4 -3
  2. package/dist/digitalSignature/domain/SignPDF.d.ts +1 -0
  3. package/dist/documentos/infrastructure/repository/documentos.ftp.repository.js +5 -2
  4. package/dist/estados/infrastructure/controller/flujos.controller.d.ts +0 -1
  5. package/dist/expediente-electronico/infrastructure/controller/expediente-electronico.controller.d.ts +0 -1
  6. package/dist/expediente-electronico/infrastructure/repositories/expediente-electronico.sql.repository.js +2 -2
  7. package/dist/infrastructure/bd/connection.sql.js +5 -4
  8. package/dist/infrastructure/fileServer/fileServer.basic-ftp.d.ts +2 -0
  9. package/dist/infrastructure/fileServer/fileServer.basic-ftp.js +7 -17
  10. package/dist/infrastructure/middlewares/middleware.apikey.d.ts +0 -1
  11. package/dist/infrastructure/middlewares/middleware.auth.js +10 -20
  12. package/dist/infrastructure/middlewares/middleware.validarCampos.d.ts +0 -1
  13. package/dist/infrastructure/middlewares/middleware.validarRol.js +2 -1
  14. package/dist/infrastructure/middlewares/validarNivel.d.ts +0 -1
  15. package/dist/infrastructure/middlewares/validarNivel.js +3 -2
  16. package/dist/infrastructure/server/httpsServer.class.d.ts +2 -0
  17. package/dist/infrastructure/server/server.class.d.ts +1 -0
  18. package/dist/infrastructure/stream-handler/stream-handler.d.ts +1 -0
  19. package/dist/usuarios/infrastructure/controller/usuarios.controller.d.ts +0 -1
  20. package/dist/usuarios/infrastructure/routes/usuarios.routes.js +2 -1
  21. package/documentos/infrastructure/repository/documentos.ftp.repository.ts +5 -3
  22. package/package.json +1 -1
@@ -12,16 +12,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.obtenerFirmasDocumento = obtenerFirmasDocumento;
16
- exports.firmarDocumento2 = firmarDocumento2;
15
+ exports.firmarDocumento2 = exports.obtenerFirmasDocumento = void 0;
17
16
  const fs = require('fs');
18
17
  const pdf_lib_1 = require("pdf-lib");
19
18
  const moment_1 = __importDefault(require("moment"));
20
19
  const axios_1 = __importDefault(require("axios"));
21
20
  const form_data_1 = __importDefault(require("form-data"));
22
21
  function obtenerFirmasDocumento(uuid) {
22
+ var _a;
23
23
  return __awaiter(this, void 0, void 0, function* () {
24
- var _a;
25
24
  try {
26
25
  const response = yield axios_1.default.get(`${process.env.URL_FIRMAS_SERVICE}/detalle-firmas/${uuid}`);
27
26
  return response.data; // Esto sería un array con las firmas y sus datos
@@ -48,6 +47,7 @@ function obtenerFirmasDocumento(uuid) {
48
47
  }
49
48
  });
50
49
  }
50
+ exports.obtenerFirmasDocumento = obtenerFirmasDocumento;
51
51
  function firmarDocumento2(token, uuid, firma, clave, x1, y1, page) {
52
52
  return __awaiter(this, void 0, void 0, function* () {
53
53
  let form = new form_data_1.default;
@@ -82,6 +82,7 @@ function firmarDocumento2(token, uuid, firma, clave, x1, y1, page) {
82
82
  }
83
83
  });
84
84
  }
85
+ exports.firmarDocumento2 = firmarDocumento2;
85
86
  function addSignPage(usuario) {
86
87
  return __awaiter(this, void 0, void 0, function* () {
87
88
  const response = yield axios_1.default.get(`http://serverfirmas.ccba.usr.bpba:6050/ListImg/SW3UIDbGetRecInfo.php?IDX_FIR=001%20000${usuario.documento}000%20%20%20%20%20%20&IDX_TYA=TIT&IDX_LOC=ONL&TIP_DOC1=000${usuario.documento}000`, { responseType: 'arraybuffer' });
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  export default class SignPDF {
2
3
  pdfDoc: any;
3
4
  certificate: any;
@@ -193,6 +193,7 @@ class DocumentosFTPRepository {
193
193
  request.input("FECHA_FIRMA", mssql_1.default.Date, pin.FECHA_FIRMA);
194
194
  request.input("USUARIO", mssql_1.default.VarChar(10), pin.USUARIO);
195
195
  request.input("TOKEN", mssql_1.default.VarChar(), pin.TOKEN);
196
+ request.input("DATOS_USUARIO", mssql_1.default.NVarChar(), JSON.stringify(pin.DATOS_USUARIO));
196
197
  // 2. Ejecutar la consulta INSERT adaptada a la nueva tabla
197
198
  const insertResult = yield request.query(`
198
199
  INSERT INTO dbo.FirmaCertificadoLocal (
@@ -203,7 +204,8 @@ class DocumentosFTPRepository {
203
204
  UUID_FIRMADO,
204
205
  FECHA_FIRMA,
205
206
  USUARIO,
206
- TOKEN
207
+ TOKEN,
208
+ DATOS_USUARIO
207
209
  )
208
210
  VALUES (
209
211
  @PIN,
@@ -213,7 +215,8 @@ class DocumentosFTPRepository {
213
215
  @UUID_FIRMADO,
214
216
  @FECHA_FIRMA,
215
217
  @USUARIO,
216
- @TOKEN
218
+ @TOKEN,
219
+ @DATOS_USUARIO
217
220
  )`);
218
221
  // MUY IMPORTANTE: Verifica que la inserción afecte 1 fila.
219
222
  if (insertResult.rowsAffected[0] === 0) {
@@ -1,4 +1,3 @@
1
- import { Request as ExRequest, Response as ExResponse, NextFunction } from "express";
2
1
  import { FlujosUseCase } from "../../application/flujos.useCase";
3
2
  export declare class FlujosController {
4
3
  private readonly flujosUseCase;
@@ -1,4 +1,3 @@
1
- import { Request, Response } from "express";
2
1
  import { ExpedienteElectronicoUseCase } from "../../application/expediente-electronico.useCase";
3
2
  import { NotificacionController } from "../../../notificaciones/infrastructure/notificacion.controller";
4
3
  export declare class ExpedienteElectronicoController {
@@ -359,8 +359,8 @@ class ExpedienteElectronicoSqlRepository {
359
359
  * @returns
360
360
  */
361
361
  getExpPendientesRepo(usuario, pagination) {
362
+ var _a;
362
363
  return __awaiter(this, void 0, void 0, function* () {
363
- var _a;
364
364
  try {
365
365
  const queryGrupos = `SELECT * FROM Grupos WHERE grupo IN(${usuario.grupos.map(elemento => `'${elemento}'`).join(",")})`;
366
366
  const gruposUsuario = yield (0, connection_sql_1.getConnection)(queryGrupos)
@@ -482,8 +482,8 @@ class ExpedienteElectronicoSqlRepository {
482
482
  });
483
483
  }
484
484
  getExpPendientesSinPaginacionRepo(usuario) {
485
+ var _a;
485
486
  return __awaiter(this, void 0, void 0, function* () {
486
- var _a;
487
487
  try {
488
488
  const queryGrupos = `SELECT * FROM Grupos WHERE grupo IN(${usuario.grupos.map(elemento => `'${elemento}'`).join(",")})`;
489
489
  const gruposUsuario = yield (0, connection_sql_1.getConnection)(queryGrupos)
@@ -12,10 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getConnection = getConnection;
16
- exports.executeQuery = executeQuery;
17
- exports.getConnectionForTransaction = getConnectionForTransaction;
18
- exports.executeQueryWithParams = executeQueryWithParams;
15
+ exports.executeQueryWithParams = exports.getConnectionForTransaction = exports.executeQuery = exports.getConnection = void 0;
19
16
  const mssql_1 = __importDefault(require("mssql"));
20
17
  function getConfig() {
21
18
  return {
@@ -32,6 +29,7 @@ function getConfig() {
32
29
  function getConnection(query) {
33
30
  return executeQuery(query);
34
31
  }
32
+ exports.getConnection = getConnection;
35
33
  function executeQuery(query, params) {
36
34
  const conexion = getConfig();
37
35
  return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () {
@@ -53,6 +51,7 @@ function executeQuery(query, params) {
53
51
  }
54
52
  }));
55
53
  }
54
+ exports.executeQuery = executeQuery;
56
55
  function getConnectionForTransaction() {
57
56
  return __awaiter(this, void 0, void 0, function* () {
58
57
  const conexion = getConfig();
@@ -66,6 +65,7 @@ function getConnectionForTransaction() {
66
65
  }
67
66
  });
68
67
  }
68
+ exports.getConnectionForTransaction = getConnectionForTransaction;
69
69
  function executeQueryWithParams(query, params) {
70
70
  return __awaiter(this, void 0, void 0, function* () {
71
71
  const conexion = getConfig();
@@ -89,3 +89,4 @@ function executeQueryWithParams(query, params) {
89
89
  }));
90
90
  });
91
91
  }
92
+ exports.executeQueryWithParams = executeQueryWithParams;
@@ -1,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
1
3
  import * as ftp from 'basic-ftp';
2
4
  import { PassThrough } from 'node:stream';
3
5
  export declare class FtpConnection {
@@ -15,23 +15,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
35
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -1,2 +1 @@
1
- import { Request, Response, NextFunction } from 'express';
2
1
  export declare const validarApiKeyInternet: (req: Request, res: Response, next: NextFunction) => any;
@@ -15,23 +15,13 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
35
25
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
26
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
27
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -45,9 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
45
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
46
36
  };
47
37
  Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.obtenerUnidadPadre = exports.unidadesJoinFuncion = exports.getChildrenLabelNumbers = exports.descifrarToken = exports.cifrado = exports.extraerNivel = exports.validarToken = void 0;
49
- exports.getGerencia = getGerencia;
50
- exports.getChildrenUnitIds = getChildrenUnitIds;
38
+ exports.obtenerUnidadPadre = exports.unidadesJoinFuncion = exports.getChildrenUnitIds = exports.getGerencia = exports.getChildrenLabelNumbers = exports.descifrarToken = exports.cifrado = exports.extraerNivel = exports.validarToken = void 0;
51
39
  const jwt = __importStar(require("jsonwebtoken"));
52
40
  const connection_sql_1 = require("../bd/connection.sql"); // Asegúrate de ajustar la ruta a tu configuración de base de datos
53
41
  const axios_1 = __importDefault(require("axios"));
@@ -323,6 +311,7 @@ function getGerencia(unidad) {
323
311
  }
324
312
  });
325
313
  }
314
+ exports.getGerencia = getGerencia;
326
315
  /**
327
316
  * Obtiene los IDs de todas las unidades subordinadas
328
317
  */
@@ -392,6 +381,7 @@ function getChildrenUnitIds(searchUnitId) {
392
381
  }
393
382
  });
394
383
  }
384
+ exports.getChildrenUnitIds = getChildrenUnitIds;
395
385
  const unidadesJoinFuncion = (unidad) => __awaiter(void 0, void 0, void 0, function* () {
396
386
  let unidades = [];
397
387
  try {
@@ -1,2 +1 @@
1
- import { Response, Request } from 'express';
2
1
  export declare const validarCampos: (req: Request, res: Response, next: any) => any;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validarRol = validarRol;
3
+ exports.validarRol = void 0;
4
4
  function validarRol(rolRequerido) {
5
5
  if (typeof rolRequerido != 'string')
6
6
  throw new Error("Debe enviar un rol requerido");
@@ -22,3 +22,4 @@ function validarRol(rolRequerido) {
22
22
  }
23
23
  };
24
24
  }
25
+ exports.validarRol = validarRol;
@@ -1,3 +1,2 @@
1
- import { Request, Response } from 'express';
2
1
  export declare function validarNivel(nivelRequerido: number): (req: Request, res: Response, next: any) => any;
3
2
  export declare function validarGerencia(gerenciaRequerido: string): (req: Request, res: Response, next: any) => any;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validarNivel = validarNivel;
4
- exports.validarGerencia = validarGerencia;
3
+ exports.validarGerencia = exports.validarNivel = void 0;
5
4
  function validarNivel(nivelRequerido) {
6
5
  return function (req, res, next) {
7
6
  // Aquí podrías validar el nivel de usuario
@@ -18,6 +17,7 @@ function validarNivel(nivelRequerido) {
18
17
  }
19
18
  };
20
19
  }
20
+ exports.validarNivel = validarNivel;
21
21
  function validarGerencia(gerenciaRequerido) {
22
22
  return function (req, res, next) {
23
23
  // Aquí podrías validar gerencia de usuario
@@ -34,3 +34,4 @@ function validarGerencia(gerenciaRequerido) {
34
34
  }
35
35
  };
36
36
  }
37
+ exports.validarGerencia = validarGerencia;
@@ -1,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
1
3
  import https from 'https';
2
4
  export declare class HttpsServidor {
3
5
  expressApp: any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import http from 'http';
2
3
  export declare class Servidor {
3
4
  expressApp: any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="node" />
1
2
  import { Request, Response } from "express";
2
3
  import { Readable } from "stream";
3
4
  import { Documento } from "../../documentos/domain/documento.class";
@@ -1,4 +1,3 @@
1
- import { Request, Response } from "express";
2
1
  import { UsuariosUseCase } from "../../application/usuarios.useCase";
3
2
  export declare class UsuariosController {
4
3
  private readonly usuariosUseCase;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.usuariosRoutes = usuariosRoutes;
6
+ exports.usuariosRoutes = void 0;
7
7
  const express_1 = require("express");
8
8
  const dependency_injection_1 = __importDefault(require("../../../dependency-injection/dependency-injection"));
9
9
  const middleware_auth_1 = require("../../../infrastructure/middlewares/middleware.auth");
@@ -16,3 +16,4 @@ function usuariosRoutes() {
16
16
  route.get('/usuarios', middleware_auth_1.validarToken, usuariosController.getUsuarios);
17
17
  return route;
18
18
  }
19
+ exports.usuariosRoutes = usuariosRoutes;
@@ -194,7 +194,7 @@ export class DocumentosFTPRepository implements IDocumentosRepository{
194
194
  request.input("FECHA_FIRMA", sql.Date, pin.FECHA_FIRMA);
195
195
  request.input("USUARIO", sql.VarChar(10), pin.USUARIO);
196
196
  request.input("TOKEN", sql.VarChar(), pin.TOKEN);
197
-
197
+ request.input("DATOS_USUARIO", sql.NVarChar(), JSON.stringify(pin.DATOS_USUARIO));
198
198
 
199
199
  // 2. Ejecutar la consulta INSERT adaptada a la nueva tabla
200
200
  const insertResult = await request.query(`
@@ -206,7 +206,8 @@ export class DocumentosFTPRepository implements IDocumentosRepository{
206
206
  UUID_FIRMADO,
207
207
  FECHA_FIRMA,
208
208
  USUARIO,
209
- TOKEN
209
+ TOKEN,
210
+ DATOS_USUARIO
210
211
  )
211
212
  VALUES (
212
213
  @PIN,
@@ -216,7 +217,8 @@ export class DocumentosFTPRepository implements IDocumentosRepository{
216
217
  @UUID_FIRMADO,
217
218
  @FECHA_FIRMA,
218
219
  @USUARIO,
219
- @TOKEN
220
+ @TOKEN,
221
+ @DATOS_USUARIO
220
222
  )`);
221
223
 
222
224
  // MUY IMPORTANTE: Verifica que la inserción afecte 1 fila.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fpavon-ee-shared",
3
- "version": "1.0.54",
3
+ "version": "1.0.55",
4
4
  "description": "Carpeta compartida entre servicios de Expediente Electronico",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",