backend-plus 2.7.1 → 2.7.3

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.
@@ -1742,8 +1742,8 @@ myOwn.dialogDownload = function dialogDownload(grid){
1742
1742
  var sheet2name=grid.def.name!=="metadata"?"metadata":"meta-data";
1743
1743
  var dataSheet = {
1744
1744
  name: sheet1name,
1745
- freezeRows: 1,
1746
- freezeColumns: grid.def.primaryKey?.length ?? 0,
1745
+ freezeRows: my.config.config?.['unfreeze-excel-rows'] ? 0 : 1,
1746
+ freezeColumns: my.config.config?.['unfreeze-excel-columns'] ? 0 : (grid.def.primaryKey?.length ?? 0),
1747
1747
  autoWidthMax: 40,
1748
1748
  rows: tableRowsXLS(grid.depotsToDisplay, fieldsDef2Export)
1749
1749
  };
@@ -509,6 +509,8 @@ export interface AppConfigClientSetup // front-end config
509
509
  "minimum-scale"?:string
510
510
  "maximum-scale"?:string
511
511
  "user-scalable"?:string
512
+ "unfreeze-excel-rows"?:boolean
513
+ "unfreeze-excel-columns"?:boolean
512
514
  }
513
515
  export interface AppConfig {
514
516
  package: {
@@ -3424,41 +3424,42 @@ $body$;
3424
3424
  .map(line => splitRawRowIntoRow(line))
3425
3425
  .filter(line => line.length>1 || line.length==1 && line[0].trim() );
3426
3426
  if(lines.length>1){
3427
- if(lines[0][0].startsWith('\ufeff')){
3428
- lines[0][0]=lines[0][0].replace('\ufeff','')
3429
- }
3430
- rows=lines.slice(1);
3431
- var filteredFieldDef = lines[0].filter(filterField);
3432
- if(tablesWithStrictSequence[tableName]){
3433
- var dataString="COPY "+db.quoteIdent(tableName)+" ("+
3434
- filteredFieldDef.map(db.quoteIdent).join(', ')+
3435
- ') FROM stdin;\n'+
3436
- rows.map(function(line){
3437
- return line.filter(function(_,i){ return filterField(lines[0][i]);}).map(function(value,i){
3438
- var def = tableDef.field[filteredFieldDef[i]];
3439
- return value==='' ? (
3440
- def.allowEmptyText && ('nullable' in def) && !def.nullable ? '' : '\\N'
3441
- ): value.replace(/\\/g,'\\\\').replace(/\t/g,'\\t').replace(/\n/g,'\\n').replace(/\r/g,'\\r');
3442
- }).join('\t')+'\n';
3443
- }).join('')+'\\.\n';
3444
- }else{
3445
- var dataString="insert into "+db.quoteIdent(tableName)+" ("+
3446
- filteredFieldDef.map(db.quoteIdent).join(', ')+
3447
- ') values\n'+
3448
- rows.map(function(line){
3449
- return "("+line.filter(function(_,i){ return filterField(lines[0][i]);}).map(function(value,i){
3450
- var def = tableDef.field[filteredFieldDef[i]];
3451
- if(def == null) {
3452
- throw Error("no se encuentra la columna "+filteredFieldDef[i]+" en "+tableName);
3453
- }
3454
- return value==='' ? (
3455
- def.allowEmptyText && ('nullable' in def) && !def.nullable ? "''" : 'null'
3456
- ) : db.quoteNullable(value);
3457
- }).join(', ')+")";
3458
- }).join(',\n')+';\n';
3459
- }
3460
- dataText.push(dataString);
3461
- if(process.env.TRY_TAB_PLUS){
3427
+ if(be.config?.internals?.["tab-plus"] != "only"){
3428
+ if(lines[0][0].startsWith('\ufeff')){
3429
+ lines[0][0]=lines[0][0].replace('\ufeff','')
3430
+ }
3431
+ rows=lines.slice(1);
3432
+ var filteredFieldDef = lines[0].filter(filterField);
3433
+ if(tablesWithStrictSequence[tableName]){
3434
+ var dataString="COPY "+db.quoteIdent(tableName)+" ("+
3435
+ filteredFieldDef.map(db.quoteIdent).join(', ')+
3436
+ ') FROM stdin;\n'+
3437
+ rows.map(function(line){
3438
+ return line.filter(function(_,i){ return filterField(lines[0][i]);}).map(function(value,i){
3439
+ var def = tableDef.field[filteredFieldDef[i]];
3440
+ return value==='' ? (
3441
+ def.allowEmptyText && ('nullable' in def) && !def.nullable ? '' : '\\N'
3442
+ ): value.replace(/\\/g,'\\\\').replace(/\t/g,'\\t').replace(/\n/g,'\\n').replace(/\r/g,'\\r');
3443
+ }).join('\t')+'\n';
3444
+ }).join('')+'\\.\n';
3445
+ }else{
3446
+ var dataString="insert into "+db.quoteIdent(tableName)+" ("+
3447
+ filteredFieldDef.map(db.quoteIdent).join(', ')+
3448
+ ') values\n'+
3449
+ rows.map(function(line){
3450
+ return "("+line.filter(function(_,i){ return filterField(lines[0][i]);}).map(function(value,i){
3451
+ var def = tableDef.field[filteredFieldDef[i]];
3452
+ if(def == null) {
3453
+ throw Error("no se encuentra la columna "+filteredFieldDef[i]+" en "+tableName);
3454
+ }
3455
+ return value==='' ? (
3456
+ def.allowEmptyText && ('nullable' in def) && !def.nullable ? "''" : 'null'
3457
+ ) : db.quoteNullable(value);
3458
+ }).join(', ')+")";
3459
+ }).join(',\n')+';\n';
3460
+ }
3461
+ dataText.push(dataString);
3462
+ } else if(be.config?.internals?.["tab-plus"]){
3462
3463
  var tabPlusEmptySymbol = Symbol('empty');
3463
3464
  var parsedTabPlus = tabPlus.parseTab(content, {emptyField: tabPlusEmptySymbol});
3464
3465
  var tabPlusFields = parsedTabPlus.fields;
@@ -3494,7 +3495,7 @@ $body$;
3494
3495
  }).join(', ')+")";
3495
3496
  }).join(',\n')+';\n';
3496
3497
  }
3497
- if(dataStringTabPlus !== dataString){
3498
+ if(be.config?.internals?.["tab-plus"] == "compare" && dataStringTabPlus !== dataString){
3498
3499
  var oldSqlPath = path.replace(/\.tab$/,'')+'-old-local.sql';
3499
3500
  var newSqlPath = path.replace(/\.tab$/,'')+'-new-local.sql';
3500
3501
  fs.writeFileSync(oldSqlPath, dataString, {encoding:'UTF8'});
@@ -3505,6 +3506,9 @@ $body$;
3505
3506
  console.log('TRY_TAB_PLUS: el parseo con tab-plus difiere del parseo anterior para '+tableName+' ('+path+'). Ver '+oldSqlPath+' y '+newSqlPath);
3506
3507
  }
3507
3508
  }
3509
+ if (be.config?.internals?.["tab-plus"] == "only") {
3510
+ dataText.push(dataStringTabPlus);
3511
+ }
3508
3512
  }
3509
3513
  }
3510
3514
  }
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.7.1",
4
+ "version": "2.7.3",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "repository": "codenautas/backend-plus",