utn-cli 2.1.17 → 2.1.18

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.
@@ -11,113 +11,90 @@ async function inicializarProyectoBackend() {
11
11
  const informacionDeRutaDelModuloJson = JSON.parse(fs.readFileSync(rutaDelModuloJson, 'utf-8'));
12
12
  console.log(`Versión de utn-backend (a través de utn-cli): ${informacionDeRutaDelModuloJson.version}.`);
13
13
 
14
- const rutaDeMiscelaneas = path.join(process.cwd(), 'servicios/Nucleo/Miscelaneas.js');
14
+ const rutaDeMiscelaneas = path.join(process.cwd(), 'servicios/Nucleo/MiscelaneasMixins/Modulos.js');
15
15
  reemplazarContenidoEnArchivo(rutaDeMiscelaneas, 'VERSION_DEL_NUCLEO', informacionDeRutaDelModuloJson.version);
16
16
 
17
17
  const rutaDeInformacionDelModuloJson = path.join(process.cwd(), 'InformacionDelModulo.json');
18
- // Check if InformacionDelModulo.json exists, if not, it's an init scenario.
19
18
  if (!fs.existsSync(rutaDeInformacionDelModuloJson)) {
20
19
  console.error('InformacionDelModulo.json not found. This should be present after copying templates.');
21
20
  closeReadLine();
22
21
  process.exit(1);
23
22
  }
24
23
  let informacionDelModuloJson = JSON.parse(fs.readFileSync(rutaDeInformacionDelModuloJson, 'utf-8'));
25
- const rutaDeInformacionDelModulo = path.join(process.cwd(), 'servicios/InformacionDelModulo.js');
26
24
 
27
- // Helper to ask and replace
28
- async function askAndReplace(prop, promptText, fileToReplace, placeholder, specialHandler = null) {
25
+ // InformacionDelModulo.js ya no usa strings hardcodeados — lee todo desde el JSON.
26
+ // Por eso este helper solo pregunta al usuario si el valor es placeholder y guarda en el JSON;
27
+ // el reemplazarContenidoEnArchivo solo se usa para archivos externos (package.json, db.js, etc.)
28
+ // mediante el specialHandler.
29
+ async function askAndSave(prop, promptText, specialHandler = null) {
29
30
  let value = informacionDelModuloJson[prop];
30
- if (value === placeholder) {
31
+ if (value === prop || value === undefined) {
31
32
  value = await hacerPreguntaTrim(promptText);
32
33
  informacionDelModuloJson[prop] = value;
33
34
  }
34
35
  if (specialHandler) {
35
36
  specialHandler(value);
36
37
  }
37
- reemplazarContenidoEnArchivo(fileToReplace, placeholder, value);
38
38
  return value;
39
39
  }
40
40
 
41
- const NOMBRE_DEL_PROYECTO = await askAndReplace('NOMBRE_DEL_PROYECTO', '¿Cuál es el nombre del proyecto?: ', rutaDeInformacionDelModulo, 'NOMBRE_DEL_PROYECTO');
42
- await askAndReplace('DESCRIPCION_DEL_PROYECTO', '¿Cuál es la descripción del proyecto?: ', rutaDeInformacionDelModulo, 'DESCRIPCION_DEL_PROYECTO');
43
- await askAndReplace('DETALLE_DEL_PROYECTO', '¿Cuál es el detalle del proyecto?: ', rutaDeInformacionDelModulo, 'DETALLE_DEL_PROYECTO');
41
+ await askAndSave('NOMBRE_DEL_PROYECTO', '¿Cuál es el nombre del proyecto?: ');
42
+ await askAndSave('DESCRIPCION_DEL_PROYECTO', '¿Cuál es la descripción del proyecto?: ');
43
+ await askAndSave('DETALLE_DEL_PROYECTO', '¿Cuál es el detalle del proyecto?: ');
44
44
 
45
- const NOMBRE_DEL_CANONICO_DEL_PROYECTO = await askAndReplace('NOMBRE_DEL_CANONICO_DEL_PROYECTO', '¿Cuál es el nombre canónico del proyecto?: ', rutaDeInformacionDelModulo, 'NOMBRE_DEL_CANONICO_DEL_PROYECTO', (val) => {
45
+ await askAndSave('NOMBRE_DEL_CANONICO_DEL_PROYECTO', '¿Cuál es el nombre canónico del proyecto?: ', (val) => {
46
46
  const oldFileName = path.join(process.cwd(), 'NOMBRE_DEL_CANONICO_DEL_PROYECTO.rest');
47
47
  const newFileName = path.join(process.cwd(), `${val}.rest`);
48
- if (fs.existsSync(newFileName)) {
49
- // If the new file name already exists, do nothing.
50
- return;
51
- }
48
+ if (fs.existsSync(newFileName)) return;
52
49
  if (fs.existsSync(oldFileName)) {
53
50
  fs.renameSync(oldFileName, newFileName);
54
51
  } else {
55
- // If the old file doesn't exist and the new one doesn't exist, it might be an update scenario where it was already renamed.
56
- // Or a fresh init where the file might not be present always. Log for now.
57
52
  console.log(`Warning: ${oldFileName} not found during canonical project name rename.`);
58
53
  }
59
54
  });
60
55
 
61
- await askAndReplace('TIPO_DE_TARJETA', '¿Cuál es el tipo de tarjeta? Posibles valores: Área, Proceso, Servicio: ', rutaDeInformacionDelModulo, 'TIPO_DE_TARJETA');
62
- await askAndReplace('NOMBRE_DEL_ROL', '¿Cuál es el nombre del rol?: ', rutaDeInformacionDelModulo, 'NOMBRE_DEL_ROL');
63
-
64
- const NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS = await askAndReplace('NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', '¿Cuál es el nombre del repositorio de base de datos?: ', rutaDeInformacionDelModulo, 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', (val) => {
65
- const rutaDeVariablesDeCalidad = path.join(process.cwd(), 'variables-calidad.env');
66
- reemplazarContenidoEnArchivo(rutaDeVariablesDeCalidad, 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', val);
67
- const rutaDeVariablesDeDesarrollo = path.join(process.cwd(), 'variables-desarrollo.env');
68
- reemplazarContenidoEnArchivo(rutaDeVariablesDeDesarrollo, 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', val);
69
- const rutaDeVariablesDePruebas = path.join(process.cwd(), 'variables-pruebas.env');
70
- reemplazarContenidoEnArchivo(rutaDeVariablesDePruebas, 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', val);
71
- const rutaDeDB = path.join(process.cwd(), 'servicios/Nucleo/db.js');
72
- reemplazarContenidoEnArchivo(rutaDeDB, 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', val.slice(0, -3));
56
+ await askAndSave('TIPO_DE_TARJETA', '¿Cuál es el tipo de tarjeta? Posibles valores: Área, Proceso, Servicio: ');
57
+ await askAndSave('NOMBRE_DEL_ROL', '¿Cuál es el nombre del rol?: ');
58
+
59
+ await askAndSave('NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', '¿Cuál es el nombre del repositorio de base de datos?: ', (val) => {
60
+ reemplazarContenidoEnArchivo(path.join(process.cwd(), 'variables-calidad.env'), 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', val);
61
+ reemplazarContenidoEnArchivo(path.join(process.cwd(), 'variables-desarrollo.env'), 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', val);
62
+ reemplazarContenidoEnArchivo(path.join(process.cwd(), 'variables-pruebas.env'), 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', val);
63
+ reemplazarContenidoEnArchivo(path.join(process.cwd(), 'servicios/Nucleo/db.js'), 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', val.slice(0, -3));
73
64
  });
74
65
 
75
- const NOMBRE_DEL_REPOSITORIO_DE_BACKEND = await askAndReplace('NOMBRE_DEL_REPOSITORIO_DE_BACKEND', '¿Cuál es el nombre del repositorio de backend?: ', rutaDeInformacionDelModulo, 'NOMBRE_DEL_REPOSITORIO_DE_BACKEND', (val) => {
76
- const rutaPackage = path.join(process.cwd(), 'package.json');
77
- reemplazarContenidoEnArchivo(rutaPackage, 'nombre_del_repositorio_backend', val);
78
- const rutaDeserver = path.join(process.cwd(), 'server.js');
79
- reemplazarContenidoEnArchivo(rutaDeserver, 'NOMBRE_DEL_REPOSITORIO_DE_BACKEND', `${val} corriendo en el puerto 80.`);
66
+ await askAndSave('NOMBRE_DEL_REPOSITORIO_DE_BACKEND', '¿Cuál es el nombre del repositorio de backend?: ', (val) => {
67
+ reemplazarContenidoEnArchivo(path.join(process.cwd(), 'package.json'), 'nombre_del_repositorio_backend', val);
68
+ reemplazarContenidoEnArchivo(path.join(process.cwd(), 'server.js'), 'NOMBRE_DEL_REPOSITORIO_DE_BACKEND', `${val} corriendo en el puerto 80.`);
80
69
  });
81
70
 
82
- await askAndReplace('NOMBRE_DEL_REPOSITORIO_DE_FRONTEND', '¿Cuál es el nombre del repositorio de frontend?: ', rutaDeInformacionDelModulo, 'NOMBRE_DEL_REPOSITORIO_DE_FRONTEND');
83
- await askAndReplace('NOMBRE_DEL_PERMISO', '¿Cuál es el nombre del permiso?: ', rutaDeInformacionDelModulo, 'NOMBRE_DEL_PERMISO');
84
- await askAndReplace('DESCRIPCION_DEL_PERMISO', '¿Cuál es la descripción del permiso?: ', rutaDeInformacionDelModulo, 'DESCRIPCION_DEL_PERMISO');
85
- await askAndReplace('MENU_PADRE', '¿Cuál es el nombre canónico del menú padre?: ', rutaDeInformacionDelModulo, 'MENU_PADRE');
86
- await askAndReplace('COLOR_DEL_MODULO', '¿Cuál es el color del módulo?: ', rutaDeInformacionDelModulo, 'COLOR_DEL_MODULO');
87
- await askAndReplace('CORREO_PARA_REPORTES', '¿Cuál es el correo para reportes?: ', rutaDeInformacionDelModulo, 'CORREO_PARA_REPORTES');
71
+ await askAndSave('NOMBRE_DEL_REPOSITORIO_DE_FRONTEND', '¿Cuál es el nombre del repositorio de frontend?: ');
72
+ await askAndSave('NOMBRE_DEL_PERMISO', '¿Cuál es el nombre del permiso?: ');
73
+ await askAndSave('DESCRIPCION_DEL_PERMISO', '¿Cuál es la descripción del permiso?: ');
74
+ await askAndSave('MENU_PADRE', '¿Cuál es el nombre canónico del menú padre?: ');
75
+ await askAndSave('COLOR_DEL_MODULO', '¿Cuál es el color del módulo?: ');
76
+ await askAndSave('CORREO_PARA_REPORTES', '¿Cuál es el correo para reportes?: ');
88
77
 
89
- const nombre_de_desarrollador = await askAndReplace('nombre_de_desarrollador', '¿Cuál es el nombre del desarrollador?: ', path.join(process.cwd(), 'package.json'), 'nombre_de_desarrollador', (val) => {
78
+ await askAndSave('nombre_de_desarrollador', '¿Cuál es el nombre del desarrollador?: ', (val) => {
90
79
  reemplazarContenidoEnArchivo(path.join(process.cwd(), 'package.json'), 'nombre_de_desarrollador', `Para la Universidad Técnica Nacional por: ${val}`);
91
80
  });
92
81
 
93
- await askAndReplace('CEDULA_DEL_DESARROLLADOR', '¿Cuál es el número de cédula del desarrollador?: ', rutaDeInformacionDelModulo, 'CEDULA_DEL_DESARROLLADOR');
82
+ await askAndSave('CEDULA_DEL_DESARROLLADOR', '¿Cuál es el número de cédula del desarrollador?: ');
94
83
 
95
- const url_del_grupo = await askAndReplace('url_del_grupo', '¿Cuál es la URL del grupo en el Git?: ', rutaDeInformacionDelModulo, 'url_del_grupo', (val) => {
84
+ await askAndSave('url_del_grupo', '¿Cuál es la URL del grupo en el Git?: ', (val) => {
96
85
  reemplazarContenidoEnArchivo(path.join(process.cwd(), 'package.json'), 'url_del_grupo', val);
97
86
  });
98
87
 
99
- let BACKENDS_QUE_CONSUME_ESTE_MODULO = informacionDelModuloJson.BACKENDS_QUE_CONSUME_ESTE_MODULO;
100
- if (BACKENDS_QUE_CONSUME_ESTE_MODULO === 'BACKENDS_QUE_CONSUME_ESTE_MODULO') {
101
- BACKENDS_QUE_CONSUME_ESTE_MODULO = await hacerPreguntaTrim('¿Qué backends consume este módulo? Lista separada por coma: ');
102
- if (BACKENDS_QUE_CONSUME_ESTE_MODULO.trim().length > 0) {
103
- BACKENDS_QUE_CONSUME_ESTE_MODULO = BACKENDS_QUE_CONSUME_ESTE_MODULO.split(",").map((x) => "'" + x.trim() + "'").toString();
104
- } else {
105
- BACKENDS_QUE_CONSUME_ESTE_MODULO = "";
106
- }
107
- informacionDelModuloJson.BACKENDS_QUE_CONSUME_ESTE_MODULO = BACKENDS_QUE_CONSUME_ESTE_MODULO;
108
- } else {
109
- // Already set, but needs formatting for replacement if not empty
110
- if (BACKENDS_QUE_CONSUME_ESTE_MODULO.trim().length > 0 && !BACKENDS_QUE_CONSUME_ESTE_MODULO.startsWith("'")) {
111
- BACKENDS_QUE_CONSUME_ESTE_MODULO = BACKENDS_QUE_CONSUME_ESTE_MODULO.split(",").map((x) => "'" + x.trim() + "'").toString();
112
- }
113
- }
114
- if (BACKENDS_QUE_CONSUME_ESTE_MODULO.trim().length > 2) {
115
- reemplazarContenidoEnArchivo(rutaDeInformacionDelModulo, 'BACKENDS_QUE_CONSUME_ESTE_MODULO', BACKENDS_QUE_CONSUME_ESTE_MODULO);
116
- } else {
117
- reemplazarContenidoEnArchivo(rutaDeInformacionDelModulo, 'BACKENDS_QUE_CONSUME_ESTE_MODULO', '');
88
+ // Backends: se guarda como array JSON ["b1","b2"] para que getBackEndsQueConsumeEsteModulo() lo lea directamente
89
+ let backendsActual = informacionDelModuloJson.BACKENDS_QUE_CONSUME_ESTE_MODULO;
90
+ if (!Array.isArray(backendsActual)) {
91
+ const respuesta = await hacerPreguntaTrim('¿Qué backends consume este módulo? Lista separada por coma (dejar vacío si ninguno): ');
92
+ informacionDelModuloJson.BACKENDS_QUE_CONSUME_ESTE_MODULO = respuesta.trim().length > 0
93
+ ? respuesta.split(',').map(x => x.trim()).filter(Boolean)
94
+ : [];
118
95
  }
119
96
 
120
- await askAndReplace('VERSION', '¿Cuál es la versión del módulo?: ', rutaDeInformacionDelModulo, 'VERSION');
97
+ await askAndSave('VERSION', '¿Cuál es la versión del módulo?: ');
121
98
 
122
99
  fs.writeFileSync(rutaDeInformacionDelModuloJson, JSON.stringify(informacionDelModuloJson, null, 2));
123
100
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utn-cli",
3
- "version": "2.1.17",
3
+ "version": "2.1.18",
4
4
  "description": "Herramienta CLI unificada para la gestión de plantillas en SIGU.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,73 +1,193 @@
1
+ const path = require('path');
2
+
1
3
  class InformacionDelModulo {
2
4
 
3
5
  constructor() {
4
- };
6
+ try {
7
+ this._json = require(path.join(__dirname, '../InformacionDelModulo.json'));
8
+ } catch (e) {
9
+ this._json = {};
10
+ }
11
+ this._db = null;
12
+ this._initialized = false;
13
+ this._loadPromise = null;
14
+ }
15
+
16
+ // Carga los datos desde la BD. Si no encuentra el módulo, mantiene los valores del JSON.
17
+ async initialize() {
18
+ if (this._initialized) return;
19
+ if (this._loadPromise) return this._loadPromise;
20
+ this._loadPromise = this._cargarDesdeDB().finally(() => {
21
+ this._initialized = true;
22
+ this._loadPromise = null;
23
+ });
24
+ return this._loadPromise;
25
+ }
26
+
27
+ async _cargarDesdeDB() {
28
+ try {
29
+ const { ejecutarConsultaSIGU } = require('./Nucleo/db.js');
30
+ const nombreCanonico = this._json['NOMBRE_DEL_CANONICO_DEL_PROYECTO'];
31
+ const nombreBackend = this._json['NOMBRE_DEL_REPOSITORIO_DE_BACKEND'];
32
+
33
+ // Si el JSON todavía tiene el placeholder, no tiene sentido consultar la BD
34
+ if (!nombreCanonico || nombreCanonico === 'NOMBRE_DEL_CANONICO_DEL_PROYECTO') return;
35
+
36
+ const [modulos, permisos, backendAccesos] = await Promise.all([
37
+ ejecutarConsultaSIGU(
38
+ "SELECT `Nombre`, `Padre`, `Descripcion`, `Detalle`, `Tipo`, `Color`, `Correo`, `Version`, `Repositorios` FROM `SIGU`.`SIGU_ModulosV2` WHERE `Nombre` = ?",
39
+ [nombreCanonico]
40
+ ),
41
+ ejecutarConsultaSIGU(
42
+ "SELECT `Nombre`, `Descripcion` FROM `SIGU`.`SIGU_PermisosV2` WHERE `Modulo` = ? LIMIT 1",
43
+ [nombreCanonico]
44
+ ),
45
+ (nombreBackend && nombreBackend !== 'NOMBRE_DEL_REPOSITORIO_DE_BACKEND')
46
+ ? ejecutarConsultaSIGU(
47
+ "SELECT `RepositorioDestino` FROM `SIGU`.`SIGU_RepositoriosAccesos` WHERE `RepositorioOrigen` = ?",
48
+ [nombreBackend]
49
+ )
50
+ : Promise.resolve([])
51
+ ]);
52
+
53
+ // Módulo no registrado aún en BD → se usan valores del JSON
54
+ if (modulos.length === 0) return;
55
+
56
+ const m = modulos[0];
57
+ this._db = {};
58
+
59
+ this._db.DescripcionDelModulo = m.Descripcion;
60
+ this._db.DetalleDelModulo = m.Detalle;
61
+ this._db.TipoDeCard = m.Tipo;
62
+ this._db.ColorDelModulo = m.Color;
63
+ this._db.CorreoParaReportes = m.Correo;
64
+ this._db.MenuPadre = m.Padre;
65
+ // La versión se almacena como "1.0.0$$NombreCanonico"; se extrae solo la parte semántica
66
+ this._db.Version = m.Version ? m.Version.split('$$')[0] : null;
67
+
68
+ // Repositorios: "https://grupo/repo-bd,https://grupo/repo-back,https://grupo/repo-front"
69
+ if (m.Repositorios) {
70
+ const repos = m.Repositorios.split(',');
71
+ if (repos.length >= 3) {
72
+ const extractName = url => url.trim().split('/').pop();
73
+ const extractGroup = url => url.trim().split('/').slice(0, -1).join('/');
74
+ this._db.NombreDelRepositorioDeLaBaseDeDatos = extractName(repos[0]);
75
+ this._db.NombreDelRepositorioDelBackend = extractName(repos[1]);
76
+ this._db.NombreDelRepositorioDelFrontend = extractName(repos[2]);
77
+ this._db.UrlDelGrupo = extractGroup(repos[0]);
78
+ }
79
+ }
80
+
81
+ if (permisos.length > 0) {
82
+ this._db.NombreDelPermiso = permisos[0].Nombre;
83
+ this._db.DescripcionDelPermiso = permisos[0].Descripcion;
84
+ }
85
+
86
+ if (backendAccesos.length > 0) {
87
+ this._db.BackEndsQueConsumeEsteModulo = backendAccesos.map(r => r.RepositorioDestino);
88
+ }
89
+
90
+ } catch (e) {
91
+ console.warn('InformacionDelModulo: no se pudo cargar desde BD, usando JSON:', e.message);
92
+ this._db = null;
93
+ }
94
+ }
95
+
96
+ // Retorna el valor de BD si existe, si no el del JSON, si no el fallback
97
+ _get(dbKey, jsonKey, fallback = '') {
98
+ if (this._db && this._db[dbKey] != null) return this._db[dbKey];
99
+ const jsonVal = this._json?.[jsonKey];
100
+ if (jsonVal != null) return jsonVal;
101
+ return fallback;
102
+ }
5
103
 
6
104
  getNombreDelModulo() {
7
- return 'NOMBRE_DEL_PROYECTO';
8
- };
105
+ return this._get('NombreDelModulo', 'NOMBRE_DEL_PROYECTO', 'NOMBRE_DEL_PROYECTO');
106
+ }
107
+
9
108
  getDescripcionDelModulo() {
10
- return 'DESCRIPCION_DEL_PROYECTO';
11
- };
109
+ return this._get('DescripcionDelModulo', 'DESCRIPCION_DEL_PROYECTO', 'DESCRIPCION_DEL_PROYECTO');
110
+ }
111
+
12
112
  getDetalleDelModulo() {
13
- return 'DETALLE_DEL_PROYECTO';
14
- };
113
+ return this._get('DetalleDelModulo', 'DETALLE_DEL_PROYECTO', 'DETALLE_DEL_PROYECTO');
114
+ }
115
+
15
116
  getNombreCanonicoDelModulo() {
16
- return 'NOMBRE_DEL_CANONICO_DEL_PROYECTO';
17
- };
117
+ return this._get('NombreCanonicoDelModulo', 'NOMBRE_DEL_CANONICO_DEL_PROYECTO', 'NOMBRE_DEL_CANONICO_DEL_PROYECTO');
118
+ }
119
+
18
120
  getTipoDeCard() {
19
- return 'TIPO_DE_TARJETA';
20
- };
121
+ return this._get('TipoDeCard', 'TIPO_DE_TARJETA', 'TIPO_DE_TARJETA');
122
+ }
123
+
21
124
  getNombreDelRol() {
22
- return 'NOMBRE_DEL_ROL';
23
- };
125
+ return this._get('NombreDelRol', 'NOMBRE_DEL_ROL', 'NOMBRE_DEL_ROL');
126
+ }
127
+
24
128
  getNombreDelRepositorioDeLaBaseDeDatos() {
25
- return 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS';
26
- };
129
+ return this._get('NombreDelRepositorioDeLaBaseDeDatos', 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS');
130
+ }
131
+
27
132
  getNombreDelRepositorioDelBackend() {
28
- return 'NOMBRE_DEL_REPOSITORIO_DE_BACKEND';
29
- };
133
+ return this._get('NombreDelRepositorioDelBackend', 'NOMBRE_DEL_REPOSITORIO_DE_BACKEND', 'NOMBRE_DEL_REPOSITORIO_DE_BACKEND');
134
+ }
135
+
30
136
  getNombreDelRepositorioDelFrontend() {
31
- return 'NOMBRE_DEL_REPOSITORIO_DE_FRONTEND';
32
- };
137
+ return this._get('NombreDelRepositorioDelFrontend', 'NOMBRE_DEL_REPOSITORIO_DE_FRONTEND', 'NOMBRE_DEL_REPOSITORIO_DE_FRONTEND');
138
+ }
139
+
33
140
  getNombreDelPermiso() {
34
- return 'NOMBRE_DEL_PERMISO';
35
- };
141
+ return this._get('NombreDelPermiso', 'NOMBRE_DEL_PERMISO', 'NOMBRE_DEL_PERMISO');
142
+ }
143
+
36
144
  getDescripcionDelPermiso() {
37
- return 'DESCRIPCION_DEL_PERMISO';
38
- };
145
+ return this._get('DescripcionDelPermiso', 'DESCRIPCION_DEL_PERMISO', 'DESCRIPCION_DEL_PERMISO');
146
+ }
147
+
39
148
  getMenuPadre() {
40
- // MenuPadre hace referencia al NombreCanonicoDelModulo del menú padre
41
- // Éste debe existir de lo contrario el registro fallará
42
- return 'MENU_PADRE';
43
- };
149
+ return this._get('MenuPadre', 'MENU_PADRE', 'MENU_PADRE');
150
+ }
151
+
44
152
  getBackEndsQueConsumeEsteModulo() {
45
- // BackEndsQueConsumeEsteModulo es un arreglo de strings de la forma ['dgf-presup-modifica-p-back', 'dpu-pide-p-back']
46
- // Se debe poner el nombre del repositorio de backend que se necesita consumir
47
- // Los repositorios ya deben estar registrados en SIGU o de lo contrario el proceso fallará
48
- return [BACKENDS_QUE_CONSUME_ESTE_MODULO];
49
- };
153
+ if (this._db?.BackEndsQueConsumeEsteModulo?.length) {
154
+ return this._db.BackEndsQueConsumeEsteModulo;
155
+ }
156
+ const val = this._json?.['BACKENDS_QUE_CONSUME_ESTE_MODULO'];
157
+ if (!val || val === 'BACKENDS_QUE_CONSUME_ESTE_MODULO') return [];
158
+ return Array.isArray(val) ? val : [val];
159
+ }
160
+
50
161
  getPerfilGeneral() {
51
- // Si no sabe qué poner, puede dejar Servidor
52
- return 'Servidor';
53
- };
162
+ return this._get('PerfilGeneral', 'PERFIL_GENERAL', 'Servidor');
163
+ }
164
+
54
165
  getUsuariosConAccesoInicial() {
55
- // UsuariosConAccesoInicial es un arreglo de strings de la forma ['111050570', '111050570']
56
- // Este arreglo se usa para asignar acceso a este módulo, suelen usarse las cédulas de los encargados del proyecto y el desarrollador
57
- return ['111050570', '204540859', '602990078', '109840817', '206860639', '801680123', 'CEDULA_DEL_DESARROLLADOR'];
58
- };
166
+ const lista = this._json?.['USUARIOS_CON_ACCESO_INICIAL'];
167
+ if (Array.isArray(lista)) return lista;
168
+ // Compatibilidad con formato anterior: cédula suelta + base fija
169
+ const cedula = this._json?.['CEDULA_DEL_DESARROLLADOR'];
170
+ const base = ['111050570', '204540859', '602990078', '109840817', '206860639', '801680123'];
171
+ if (cedula && cedula !== 'CEDULA_DEL_DESARROLLADOR') return [...base, cedula];
172
+ return base;
173
+ }
174
+
59
175
  getColorDelModulo() {
60
- return 'COLOR_DEL_MODULO';
61
- };
176
+ return this._get('ColorDelModulo', 'COLOR_DEL_MODULO', 'COLOR_DEL_MODULO');
177
+ }
178
+
62
179
  getCorreoParaReportes() {
63
- return 'CORREO_PARA_REPORTES';
64
- };
180
+ return this._get('CorreoParaReportes', 'CORREO_PARA_REPORTES', 'CORREO_PARA_REPORTES');
181
+ }
182
+
65
183
  getVersion() {
66
- return 'VERSION';
67
- };
184
+ return this._get('Version', 'VERSION', 'VERSION');
185
+ }
186
+
68
187
  getUrlDelGrupo() {
69
- return 'url_del_grupo';
70
- };
188
+ return this._get('UrlDelGrupo', 'url_del_grupo', 'url_del_grupo');
189
+ }
190
+
71
191
  }
72
192
 
73
- module.exports = new InformacionDelModulo();
193
+ module.exports = new InformacionDelModulo();