tuain-form-manager 1.4.7 → 1.4.9

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.
@@ -144,6 +144,18 @@ class FormManager {
144
144
  errorObj = this.errMgr.get(modErrs.formActionExec.formNotFound, message);
145
145
  return [errorObj, null];
146
146
  }
147
+ const requireSession = formDefinition.form.requireSession ?? false;
148
+ if (requireSession) {
149
+ const { currentSession } = requestContext ?? {};
150
+ const { sessionDetail } = currentSession ?? {};
151
+ if (!currentSession || !sessionDetail) {
152
+ // El formulario requiere de la existencia de una sesión
153
+ message = `No existe una sesión válida para procesar la solicitud del formulario ${formCode}`;
154
+ this.logger.log({ level: 'error', label: 'FormManager', action: 'executeFormAction', message });
155
+ errorObj = this.errMgr.get(modErrs.formActionExec.sessionNotFound, message);
156
+ return [errorObj, null];
157
+ }
158
+ }
147
159
  const formCustomObject = new FormClass(this.logger, this.errMgr, requestContext, formDefinition, requestData);
148
160
  if (!formCustomObject) {
149
161
  message = `No fue posible instanciar la clase de gestión del formulario ${formCode}`;
package/lib/form.js CHANGED
@@ -162,6 +162,7 @@ class Form {
162
162
  set currentMode(state) { this.state = state; }
163
163
 
164
164
  get formCode() { return this._formDefinition.form.formCode; }
165
+ get requireSession() { return this._formDefinition.form.requireSession ?? false; }
165
166
  get globalFunctions() { return this._formDefinition?.bussinesFunctionsRequired ?? []; }
166
167
  get responseData() { return this._responseData; }
167
168
  set returnedFile(fileContent) { this._responseData.returnedFile = fileContent; }
@@ -8,6 +8,7 @@ module.exports = {
8
8
  formNotFound: ['01', 'Formulario no encontrado', 404],
9
9
  actionNotDefined: ['02', 'Acción no definida', 404],
10
10
  exceptionNotHandled: ['03', 'Excepción no controlada', 400],
11
+ sessionNotFound: ['04', 'Excepción no controlada', 400],
11
12
  },
12
13
  fieldValidation: {
13
14
  NoValidationCallback: ['01', 'Función de validación no existe', 405],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tuain-form-manager",
3
- "version": "1.4.7",
3
+ "version": "1.4.9",
4
4
  "description": "Component library to perform operations on Tuain Development Framework forms to interchange information on web or mobile applications based on the data interchange of abstract forms making trnasformation on the data upon actions required on both sides (front and back)",
5
5
  "main": "index.js",
6
6
  "scripts": {