backend-plus 1.17.10 → 1.17.12

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.
@@ -609,7 +609,16 @@ myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
609
609
  if (depot) {
610
610
  if (!sameValue(JSON.stringify(row),JSON.stringify(depot.row))) {
611
611
  //grid.retrieveRowAndRefresh(depot);
612
- grid.depotRefresh(depot,{updatedRow:row, sendedForUpdate:{}},{noDispatchEvents:true});
612
+ if(depot.tr){
613
+ grid.depotRefresh(depot,{updatedRow:row, sendedForUpdate:{}},{noDispatchEvents:true});
614
+ }else{
615
+ depot.row = row
616
+ grid.displayBody()
617
+ changeIoStatus(depot,'background-change', depot.row);
618
+ setTimeout(function(){
619
+ changeIoStatus(depot,'ok', depot.row);
620
+ },3000);
621
+ }
613
622
  }
614
623
  depot.tick = tick
615
624
  } else if (!depot) {
@@ -1719,7 +1719,7 @@ AppBackend.prototype.addUnloggedServices = function addUnloggedServices(mainApp,
1719
1719
  ).fetchUniqueRow();
1720
1720
  var chpath = req.protocol+'://' +Path.posix.join(req.hostname+baseUrl,'new-pass')+
1721
1721
  '?token='+token+'&nueva=clave';
1722
- console.log('chpass', chpath)
1722
+ // console.log('chpass', chpath)
1723
1723
  await be.sendMail({
1724
1724
  to: req.body.email,
1725
1725
  subject: be.messages.unlogged.newPassword.mailSubject,
@@ -1731,16 +1731,13 @@ AppBackend.prototype.addUnloggedServices = function addUnloggedServices(mainApp,
1731
1731
  }
1732
1732
  })
1733
1733
  }
1734
- console.log('aca 11')
1735
1734
  res.redirect(Path.posix.join(baseUrl, be.config.login.forget?.urlPathOk+'?result'+resultCode));
1736
- console.log('aca 12')
1737
1735
  promise.catch(err=>{
1738
1736
  console.log('error in /new-password');
1739
1737
  console.log(err);
1740
1738
  })
1741
1739
  })
1742
1740
  mainApp.get(Path.posix.join(baseUrl,'/new-pass'), function(req,res,next){
1743
- console.log('ooooooooooooook')
1744
1741
  var resultCode;
1745
1742
  if(!req.query.token){
1746
1743
  res.send('No token');
@@ -1777,12 +1774,6 @@ AppBackend.prototype.addUnloggedServices = function addUnloggedServices(mainApp,
1777
1774
  }
1778
1775
  var promise = be.inDbClient(req, async (client)=>{
1779
1776
  var now = bestGlobals.datetime.now();
1780
- console.log(`select *
1781
- from tokens
1782
- where tokentype = 'new-pass' and token = $1
1783
- and $2 < due
1784
- limit 1;
1785
- `, [req.body.token, now])
1786
1777
  var {row} = await client.query(`select *
1787
1778
  from tokens
1788
1779
  where tokentype = 'new-pass' and token = $1
@@ -1801,7 +1792,7 @@ AppBackend.prototype.addUnloggedServices = function addUnloggedServices(mainApp,
1801
1792
  }else if(ok){
1802
1793
  resolve()
1803
1794
  }else{
1804
- console.log(arguments)
1795
+ // console.log(arguments)
1805
1796
  reject(message.message)
1806
1797
  }
1807
1798
  })
@@ -2338,11 +2329,8 @@ AppBackend.prototype.addLoggedServices = function addLoggedServices(){
2338
2329
  this.app.use('/info', async function(req,res,next){
2339
2330
  if(req.path.endsWith('.md')){
2340
2331
  var fileName=__dirname+'/../public-docs/'+req.path;
2341
- console.log('sirviendo',fileName)
2342
2332
  var content = await fs.readFile(fileName,'utf8');
2343
- console.log('content',content)
2344
2333
  var md = await markdownRender('html', content);
2345
- console.log('htmlContent',md.content)
2346
2334
  MiniTools.serveText(md.content, 'html')(req,res);
2347
2335
  }else{
2348
2336
  serveContent(__dirname+'/../docs',be.optsGenericForFiles(req))(req,res,next);
@@ -3011,7 +2999,6 @@ AppBackend.prototype.exportacionesGenerico = async function exportacionesGeneric
3011
2999
  if (typeof result[0].title !== "string" || typeof result[0].rows !== "object" && !(result[0].rows instanceof Array) ) {
3012
3000
  throw new Error ("exportacionesGenerico debe recibir {title:string, rows:Record<string, any>[]}")
3013
3001
  }
3014
- console.log('tengo los rows');
3015
3002
  await bestGlobals.sleep(100);
3016
3003
  context.informProgress({message:`buscando archivos recién generados`})
3017
3004
  /** @type {{url:string, label:string}[]} */
@@ -3088,7 +3075,6 @@ AppBackend.prototype.exportacionesGenerico = async function exportacionesGeneric
3088
3075
  (err)=>err?reject(err):resolve()
3089
3076
  ))
3090
3077
  }
3091
- console.log('tengo el listo');
3092
3078
  return [
3093
3079
  ...(fileName?[{url:fileName, label:csvFileName?'xlsx de control':fileName}]:[]),
3094
3080
  ...(csvFileName?[{url:csvFileName, label:fileName?'csv (formato UTF-8)':csvFileName}]:[]),
@@ -185,7 +185,6 @@ ProcedureTables = [
185
185
  throw changing(new Error(action+" not allowed for "+name),{status:403});
186
186
  }
187
187
  if(!defField){
188
- console.log("invalid request", parameters);
189
188
  throw new Error("invalid request");
190
189
  }
191
190
  var updateTarget;
@@ -347,7 +346,6 @@ ProcedureTables = [
347
346
  }
348
347
  }
349
348
  }else if(!parameters.masive || primaryKeyValues.length>0){
350
- console.log("invalid request", parameters);
351
349
  throw new Error(be.messages.server.missingPrimaryKeyValues);
352
350
  }else{
353
351
  return {masive:true};
@@ -404,7 +402,6 @@ ProcedureTables = [
404
402
  return result.row;
405
403
  });
406
404
  }else{
407
- console.log("invalid request", parameters);
408
405
  throw new Error("invalid request");
409
406
  }
410
407
  }
@@ -449,9 +446,8 @@ ProcedureTables = [
449
446
  }
450
447
  });
451
448
  return context.client.query(
452
- inlineLog(
453
449
  "DELETE FROM "+be.db.quoteIdent(defTable.sql.tableName)+
454
- " WHERE "+whereParts.join(" AND ")+" RETURNING 1"),
450
+ " WHERE "+whereParts.join(" AND ")+" RETURNING 1",
455
451
  dataParams
456
452
  ).fetchUniqueRow().then(function(){
457
453
  deleteCounter++;
@@ -679,14 +675,12 @@ ProcedureTables = [
679
675
  ).execute();
680
676
  }
681
677
  return Promise.resolve().then(async function(){
682
- // console.log('xxxxxxxx files', files);
683
678
  var tableDef=be.tableStructures[parameters.table](context);
684
679
  if(!tableDef.allow.import){
685
680
  throw changing(new Error("import not allowed"),{status:403});
686
681
  }
687
682
  context.informProgress({message:be.messages.fileUploaded});
688
683
  var readerFunction;
689
- // console.log('xxxxxxxxxxxxxxx ',files[0].originalFilename);
690
684
  var fields=[];
691
685
  var otherFieldNames=[];
692
686
  var inputCuidado = false;
@@ -1184,16 +1178,6 @@ ProcedureTables = [
1184
1178
  if(context.user[be.config.login.rolFieldName] != 'admin'){
1185
1179
  throw new Error('Forbiden history')
1186
1180
  }
1187
- console.log(`select
1188
- cha_new_value as valor,
1189
- cha_when as cuando,
1190
- cha_who as quien
1191
- from his.changes
1192
- where cha_table = $1
1193
- and cha_column = $2
1194
- and cha_new_pk = ${context.be.db.quoteLiteral(JSON.stringify(parameters.primaryKeyValues))}
1195
- order by cha_when desc
1196
- `)
1197
1181
  var tableDef = be.tableStructures[parameters.tableName](context);
1198
1182
  var pk = likeAr.toPlainObject(tableDef.primaryKey, parameters.primaryKeyValues)
1199
1183
  var result = await client.query(`select
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "backend-plus",
3
3
  "description": "Backend for typed controls",
4
- "version": "1.17.10",
4
+ "version": "1.17.12",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "repository": "codenautas/backend-plus",