backend-plus 2.0.0-beta.16 → 2.0.0-beta.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.
@@ -95,6 +95,7 @@ img.light
95
95
 
96
96
  .result-div
97
97
  min-height 40px
98
+ padding 4px
98
99
 
99
100
  .result-pre
100
101
  white-space pre
@@ -74,15 +74,22 @@ myOwn.wScreens.procAux = {
74
74
  var params=addrParams.up;
75
75
  // var button = html.button(formDef.proceedLabel||my.messages.proceed).create();
76
76
  var label = formDef.proceedLabel||my.messages.proceed;
77
- var button = my.createForkeableButton({}, label);
77
+ var refresUrl = formDef.method != 'post' || formDef.autoproced !== false
78
+ var buttonOptions = {label}
79
+ if (formDef.method == 'post') {
80
+ buttonOptions.onclick = function(event){ event.preventDefault(); proceed(); }
81
+ }
82
+ var button = my.createForkeableButton({}, buttonOptions);
78
83
  var setHref = function(){
79
- button.setForkeableHref({
80
- ...addrParams,
81
- autoproced:true,
82
- directUrl:true,
83
- ...(formDef && formDef.proceedLabel ? {label} : {}),
84
- ...params
85
- })
84
+ if (refresUrl) {
85
+ button.setForkeableHref({
86
+ ...addrParams,
87
+ autoproced:true,
88
+ directUrl:true,
89
+ ...(formDef && formDef.proceedLabel ? {label} : {}),
90
+ // ...params
91
+ })
92
+ }
86
93
  }
87
94
  var divResult = html.div({class:formDef.resultClass||'result-pre'}).create();
88
95
  var id='progress'+Math.random();
@@ -114,7 +121,9 @@ myOwn.wScreens.procAux = {
114
121
  }
115
122
  control.addEventListener('update', function(){
116
123
  params[parameterDef.name] = control.getTypedValue();
117
- myOwn.replaceAddrParams(addrParams);
124
+ if (refresUrl) {
125
+ myOwn.replaceAddrParams(addrParams);
126
+ }
118
127
  setHref();
119
128
  });
120
129
  controls.push(control);
@@ -1236,19 +1236,20 @@ AppBackend.prototype.checkDatabaseStructure = async function checkDatabaseStruct
1236
1236
  }
1237
1237
  }
1238
1238
  }
1239
+ var bitacoraTableName = be.config.server.bitacoraTableName || 'bitacora';
1239
1240
  var bitacoraId = await client.query(`SELECT data_type
1240
1241
  FROM information_schema.columns
1241
- WHERE /*table_schema = 'his' AND*/ table_name = 'bitacora' AND column_name = 'id'
1242
+ WHERE /*table_schema = 'his' AND*/ table_name = '${bitacoraTableName}' AND column_name = 'id'
1242
1243
  `).fetchOneRowIfExists();
1243
1244
  if (bitacoraId.row?.data_type != 'bigint') {
1244
1245
  var message = `
1245
- ------- hay que cambiar la bitacora de lugar (a his) y agrandar el id (a bigint)
1246
- alter table ${be.config.db.schema}.bitacora set schema his;
1246
+ ------- hay que cambiar la bitacora (${bitacoraTableName})de lugar (a his) y agrandar el id (a bigint)
1247
+ alter table ${be.config.db.schema}.${bitacoraTableName} set schema his;
1247
1248
  alter table ${be.config.db.schema}.tokens set schema his;
1248
- alter table his.bitacora alter column id type bigint;
1249
+ alter table his.${bitacoraTableName} alter column id type bigint;
1249
1250
  grant usage on schema his to ${be.config.db.user};
1250
- grant select, insert, update on his.bitacora to ${be.config.db.user};
1251
- alter table his.bitacora alter column parameters_definition drop not null;
1251
+ grant select, insert, update on his.${bitacoraTableName} to ${be.config.db.user};
1252
+ alter table his.${bitacoraTableName} alter column parameters_definition drop not null;
1252
1253
  `;
1253
1254
  throw new Error(message);
1254
1255
  }
@@ -1231,15 +1231,17 @@ ProcedureTables = [
1231
1231
  {name:'encrypt', typeName:'text'}
1232
1232
  ],
1233
1233
  bitacora:{always: true, error: true},
1234
+ method:'post',
1235
+ autoproced:false,
1234
1236
  progress:true,
1235
1237
  resultOk:'showDownloadUrl',
1236
1238
  coreFunction:async function(context, parameters){
1237
- context.informProgress({message:"tart"});
1239
+ context.informProgress({message:"start"});
1238
1240
  var {be,client} = context;
1239
1241
  if (!be.can(context,'DownloadBackup')) {
1240
1242
  throw new Error('Forbiden backup')
1241
1243
  }
1242
- if (parameters.encript?.length < 10) {
1244
+ if (parameters.encrypt?.length < 10) {
1243
1245
  throw new Error(be.messages.server.badBackupEncryptKey)
1244
1246
  }
1245
1247
  var path = be.config.db['downloadable-backup-path']
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "backend-plus",
3
3
  "description": "Backend for the anti Pareto rule",
4
- "version": "2.0.0-beta.16",
4
+ "version": "2.0.0-beta.18",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "repository": "codenautas/backend-plus",
@@ -81,7 +81,7 @@
81
81
  "@types/js-yaml": "^4.0.9",
82
82
  "@types/mocha": "^10.0.6",
83
83
  "@types/multiparty": "~0.0.36",
84
- "@types/node": "^20.11.0",
84
+ "@types/node": "^20.11.9",
85
85
  "@types/nodemailer": "^6.4.14",
86
86
  "@types/numeral": "~2.0.5",
87
87
  "@types/session-file-store": "^1.2.5",
@@ -98,9 +98,9 @@
98
98
  "kill-9": "~0.4.3",
99
99
  "mocha": "^10.2.0",
100
100
  "nyc": "^15.1.0",
101
- "puppeteer": "^21.7.0",
101
+ "puppeteer": "^21.9.0",
102
102
  "sinon": "^17.0.1",
103
- "supertest": "^6.3.3",
103
+ "supertest": "^6.3.4",
104
104
  "types.d.ts": "~0.6.21",
105
105
  "typescript": "^5.3.3",
106
106
  "why-is-node-running": "^2.2.2"