backend-plus 2.0.6 → 2.0.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.
@@ -163,7 +163,7 @@ a.disabled
163
163
  color #777
164
164
  > .json-container
165
165
  position sticky
166
- top 5%
167
- bottom 5%
166
+ top 2px
167
+ bottom 2px
168
168
 
169
169
 
@@ -156,7 +156,9 @@ animation-time = 2s
156
156
  .result-progress
157
157
  height 200px
158
158
  overflow auto
159
-
159
+ @media print
160
+ display none
161
+
160
162
  .dialog-promise
161
163
  .result-progress
162
164
  width 300px
@@ -257,7 +257,7 @@ export type ForeignKey = {
257
257
  export type Constraint = {constraintType:string, consName?:string} & (
258
258
  {constraintType:'unique', fields:string[], where?:string} |
259
259
  {constraintType:'check', expr?:string} |
260
- {constraintType:'exclude', using:'GIST', fields:(string|{fieldName:string, operator:'='|'&&'})[]}
260
+ {constraintType:'exclude', using:'GIST', fields:(string|{fieldName:string, operator:'='|'&&'})[], where?:string}
261
261
  )
262
262
  export type OtherTableDefs = Record<string,Partial<TableDefinition & {prefilledField:Record<string,any>}>>
263
263
  export type TableDefinition = EditableDbDefinition & {
@@ -2863,7 +2863,7 @@ AppBackend.prototype.dumpDbSchemaPartial = async function dumpDbSchemaPartial(pa
2863
2863
  sql='check ('+cons.expr+')';
2864
2864
  break;
2865
2865
  case 'exclude':
2866
- sql=`exclude using ${cons.using} (${cons.fields.map(f => typeof f == "string"?`${f} WITH =`:`${f.fieldName} WITH ${f.operator}`).join(', ')})`;
2866
+ sql=`exclude using ${cons.using} (${cons.fields.map(f => typeof f == "string"?`${f} WITH =`:`${f.fieldName} WITH ${f.operator}`).join(', ')})${cons.where ? ` WHERE (${cons.where})`:``}`;
2867
2867
  break;
2868
2868
  default:
2869
2869
  throw new Error('constraintType not implemented: '+cons.constraintType);
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.6",
4
+ "version": "2.0.9",
5
5
  "author": "Codenautas <codenautas@googlegroups.com>",
6
6
  "license": "MIT",
7
7
  "repository": "codenautas/backend-plus",
@@ -69,7 +69,7 @@
69
69
  "sql-tools": "^0.1.2",
70
70
  "stack-trace": "^0.0.10",
71
71
  "stylus": "0.64.0",
72
- "type-store": "^0.4.4",
72
+ "type-store": "^0.4.5",
73
73
  "typed-controls": "^0.12.2",
74
74
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"
75
75
  },
@@ -80,10 +80,10 @@
80
80
  "@types/express-useragent": "^1.0.5",
81
81
  "@types/fs-extra": "^11.0.4",
82
82
  "@types/js-yaml": "^4.0.9",
83
- "@types/mocha": "^10.0.9",
83
+ "@types/mocha": "^10.0.10",
84
84
  "@types/multiparty": "~4.2.1",
85
- "@types/node": "^22.9.0",
86
- "@types/nodemailer": "^6.4.16",
85
+ "@types/node": "^22.9.3",
86
+ "@types/nodemailer": "^6.4.17",
87
87
  "@types/numeral": "~2.0.5",
88
88
  "@types/session-file-store": "^1.2.5",
89
89
  "@types/stack-trace": "~0.0.33",
@@ -99,11 +99,11 @@
99
99
  "kill-9": "~0.4.3",
100
100
  "mocha": "^10.8.2",
101
101
  "nyc": "^17.1.0",
102
- "puppeteer": "^23.7.1",
102
+ "puppeteer": "^23.9.0",
103
103
  "sinon": "^19.0.2",
104
104
  "supertest": "^7.0.0",
105
- "types.d.ts": "~0.6.21",
106
- "typescript": "^5.6.3",
105
+ "types.d.ts": "~0.6.22",
106
+ "typescript": "^5.7.2",
107
107
  "why-is-node-running": "^3.2.1"
108
108
  },
109
109
  "engines": {
@@ -522,6 +522,23 @@ function agregar_class_textInDiv(td, className, text){
522
522
  td.appendChild(div);
523
523
  }
524
524
 
525
+ function containsObjectsWithTheSameColumns(o){
526
+ var keys = Object.keys(o);
527
+ if (!keys.length) return false;
528
+ var separator = Math.random();
529
+ var colNamesFirstObject = Object.keys(o[keys[0]]).join(separator);
530
+ return !keys.find(k => o[k] == null || !(o[k] instanceof Object) || Object.keys(o[k]).join(separator) != colNamesFirstObject);
531
+ }
532
+ /* test
533
+ var cases = [
534
+ [false, {}],
535
+ [false, {a:"hola"}],
536
+ [false, {a:{a:1, b:2, c:2}, b:{a:1, x:2, c:2}}],
537
+ [true , {a:{a:1, b:2, c:2}, b:{a:1, b:2, c:2}}]
538
+ ];
539
+ cases.forEach(([expected, param]) => console.log(param, containsObjectsWithTheSameColumns(param), containsObjectsWithTheSameColumns(param) == expected ? 'ok' : 'fail'))
540
+ */
541
+
525
542
  /**
526
543
  *
527
544
  * @param {HTMLElement} div
@@ -533,7 +550,7 @@ function agregar_json(div, o, ubicaciones=agregar_json_default_ubicaciones){
533
550
  return ;
534
551
  }
535
552
  if(typeof o == "object" && !(o instanceof Date) && !o.isRealDateTime){
536
- if(o instanceof Array && o[0] && o[0] instanceof Object && !(o[0] instanceof Array) && !(o[0].isRealDateTime)){
553
+ if((o instanceof Array && o[0] || containsObjectsWithTheSameColumns(o)) && o[0] instanceof Object && !(o[0] instanceof Array) && !(o[0].isRealDateTime)){
537
554
  var table = document.createElement('table');
538
555
  div.appendChild(table);
539
556
  var titleRow = table.insertRow(-1);