utn-cli 2.1.18 → 2.1.19

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,90 +11,113 @@ 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/MiscelaneasMixins/Modulos.js');
14
+ const rutaDeMiscelaneas = path.join(process.cwd(), 'servicios/Nucleo/Miscelaneas.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.
18
19
  if (!fs.existsSync(rutaDeInformacionDelModuloJson)) {
19
20
  console.error('InformacionDelModulo.json not found. This should be present after copying templates.');
20
21
  closeReadLine();
21
22
  process.exit(1);
22
23
  }
23
24
  let informacionDelModuloJson = JSON.parse(fs.readFileSync(rutaDeInformacionDelModuloJson, 'utf-8'));
25
+ const rutaDeInformacionDelModulo = path.join(process.cwd(), 'servicios/InformacionDelModulo.js');
24
26
 
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) {
27
+ // Helper to ask and replace
28
+ async function askAndReplace(prop, promptText, fileToReplace, placeholder, specialHandler = null) {
30
29
  let value = informacionDelModuloJson[prop];
31
- if (value === prop || value === undefined) {
30
+ if (value === placeholder) {
32
31
  value = await hacerPreguntaTrim(promptText);
33
32
  informacionDelModuloJson[prop] = value;
34
33
  }
35
34
  if (specialHandler) {
36
35
  specialHandler(value);
37
36
  }
37
+ reemplazarContenidoEnArchivo(fileToReplace, placeholder, value);
38
38
  return value;
39
39
  }
40
40
 
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?: ');
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');
44
44
 
45
- await askAndSave('NOMBRE_DEL_CANONICO_DEL_PROYECTO', '¿Cuál es el nombre canónico del proyecto?: ', (val) => {
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) => {
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)) return;
48
+ if (fs.existsSync(newFileName)) {
49
+ // If the new file name already exists, do nothing.
50
+ return;
51
+ }
49
52
  if (fs.existsSync(oldFileName)) {
50
53
  fs.renameSync(oldFileName, newFileName);
51
54
  } 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.
52
57
  console.log(`Warning: ${oldFileName} not found during canonical project name rename.`);
53
58
  }
54
59
  });
55
60
 
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));
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));
64
73
  });
65
74
 
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.`);
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.`);
69
80
  });
70
81
 
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?: ');
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');
77
88
 
78
- await askAndSave('nombre_de_desarrollador', '¿Cuál es el nombre del desarrollador?: ', (val) => {
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) => {
79
90
  reemplazarContenidoEnArchivo(path.join(process.cwd(), 'package.json'), 'nombre_de_desarrollador', `Para la Universidad Técnica Nacional por: ${val}`);
80
91
  });
81
92
 
82
- await askAndSave('CEDULA_DEL_DESARROLLADOR', '¿Cuál es el número de cédula del desarrollador?: ');
93
+ await askAndReplace('CEDULA_DEL_DESARROLLADOR', '¿Cuál es el número de cédula del desarrollador?: ', rutaDeInformacionDelModulo, 'CEDULA_DEL_DESARROLLADOR');
83
94
 
84
- await askAndSave('url_del_grupo', '¿Cuál es la URL del grupo en el Git?: ', (val) => {
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) => {
85
96
  reemplazarContenidoEnArchivo(path.join(process.cwd(), 'package.json'), 'url_del_grupo', val);
86
97
  });
87
98
 
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
- : [];
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', '');
95
118
  }
96
119
 
97
- await askAndSave('VERSION', '¿Cuál es la versión del módulo?: ');
120
+ await askAndReplace('VERSION', '¿Cuál es la versión del módulo?: ', rutaDeInformacionDelModulo, 'VERSION');
98
121
 
99
122
  fs.writeFileSync(rutaDeInformacionDelModuloJson, JSON.stringify(informacionDelModuloJson, null, 2));
100
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "utn-cli",
3
- "version": "2.1.18",
3
+ "version": "2.1.19",
4
4
  "description": "Herramienta CLI unificada para la gestión de plantillas en SIGU.",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1,193 +1,73 @@
1
- const path = require('path');
2
-
3
1
  class InformacionDelModulo {
4
2
 
5
3
  constructor() {
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
- }
4
+ };
103
5
 
104
6
  getNombreDelModulo() {
105
- return this._get('NombreDelModulo', 'NOMBRE_DEL_PROYECTO', 'NOMBRE_DEL_PROYECTO');
106
- }
107
-
7
+ return 'NOMBRE_DEL_PROYECTO';
8
+ };
108
9
  getDescripcionDelModulo() {
109
- return this._get('DescripcionDelModulo', 'DESCRIPCION_DEL_PROYECTO', 'DESCRIPCION_DEL_PROYECTO');
110
- }
111
-
10
+ return 'DESCRIPCION_DEL_PROYECTO';
11
+ };
112
12
  getDetalleDelModulo() {
113
- return this._get('DetalleDelModulo', 'DETALLE_DEL_PROYECTO', 'DETALLE_DEL_PROYECTO');
114
- }
115
-
13
+ return 'DETALLE_DEL_PROYECTO';
14
+ };
116
15
  getNombreCanonicoDelModulo() {
117
- return this._get('NombreCanonicoDelModulo', 'NOMBRE_DEL_CANONICO_DEL_PROYECTO', 'NOMBRE_DEL_CANONICO_DEL_PROYECTO');
118
- }
119
-
16
+ return 'NOMBRE_DEL_CANONICO_DEL_PROYECTO';
17
+ };
120
18
  getTipoDeCard() {
121
- return this._get('TipoDeCard', 'TIPO_DE_TARJETA', 'TIPO_DE_TARJETA');
122
- }
123
-
19
+ return 'TIPO_DE_TARJETA';
20
+ };
124
21
  getNombreDelRol() {
125
- return this._get('NombreDelRol', 'NOMBRE_DEL_ROL', 'NOMBRE_DEL_ROL');
126
- }
127
-
22
+ return 'NOMBRE_DEL_ROL';
23
+ };
128
24
  getNombreDelRepositorioDeLaBaseDeDatos() {
129
- return this._get('NombreDelRepositorioDeLaBaseDeDatos', 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS', 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS');
130
- }
131
-
25
+ return 'NOMBRE_DEL_REPOSITORIO_DE_BASE_DE_DATOS';
26
+ };
132
27
  getNombreDelRepositorioDelBackend() {
133
- return this._get('NombreDelRepositorioDelBackend', 'NOMBRE_DEL_REPOSITORIO_DE_BACKEND', 'NOMBRE_DEL_REPOSITORIO_DE_BACKEND');
134
- }
135
-
28
+ return 'NOMBRE_DEL_REPOSITORIO_DE_BACKEND';
29
+ };
136
30
  getNombreDelRepositorioDelFrontend() {
137
- return this._get('NombreDelRepositorioDelFrontend', 'NOMBRE_DEL_REPOSITORIO_DE_FRONTEND', 'NOMBRE_DEL_REPOSITORIO_DE_FRONTEND');
138
- }
139
-
31
+ return 'NOMBRE_DEL_REPOSITORIO_DE_FRONTEND';
32
+ };
140
33
  getNombreDelPermiso() {
141
- return this._get('NombreDelPermiso', 'NOMBRE_DEL_PERMISO', 'NOMBRE_DEL_PERMISO');
142
- }
143
-
34
+ return 'NOMBRE_DEL_PERMISO';
35
+ };
144
36
  getDescripcionDelPermiso() {
145
- return this._get('DescripcionDelPermiso', 'DESCRIPCION_DEL_PERMISO', 'DESCRIPCION_DEL_PERMISO');
146
- }
147
-
37
+ return 'DESCRIPCION_DEL_PERMISO';
38
+ };
148
39
  getMenuPadre() {
149
- return this._get('MenuPadre', 'MENU_PADRE', 'MENU_PADRE');
150
- }
151
-
40
+ // MenuPadre hace referencia al NombreCanonicoDelModulo del menú padre
41
+ // Éste debe existir de lo contrario el registro fallará
42
+ return 'MENU_PADRE';
43
+ };
152
44
  getBackEndsQueConsumeEsteModulo() {
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
-
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
+ };
161
50
  getPerfilGeneral() {
162
- return this._get('PerfilGeneral', 'PERFIL_GENERAL', 'Servidor');
163
- }
164
-
51
+ // Si no sabe qué poner, puede dejar Servidor
52
+ return 'Servidor';
53
+ };
165
54
  getUsuariosConAccesoInicial() {
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
-
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
+ };
175
59
  getColorDelModulo() {
176
- return this._get('ColorDelModulo', 'COLOR_DEL_MODULO', 'COLOR_DEL_MODULO');
177
- }
178
-
60
+ return 'COLOR_DEL_MODULO';
61
+ };
179
62
  getCorreoParaReportes() {
180
- return this._get('CorreoParaReportes', 'CORREO_PARA_REPORTES', 'CORREO_PARA_REPORTES');
181
- }
182
-
63
+ return 'CORREO_PARA_REPORTES';
64
+ };
183
65
  getVersion() {
184
- return this._get('Version', 'VERSION', 'VERSION');
185
- }
186
-
66
+ return 'VERSION';
67
+ };
187
68
  getUrlDelGrupo() {
188
- return this._get('UrlDelGrupo', 'url_del_grupo', 'url_del_grupo');
189
- }
190
-
69
+ return 'url_del_grupo';
70
+ };
191
71
  }
192
72
 
193
- module.exports = new InformacionDelModulo();
73
+ module.exports = new InformacionDelModulo();