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.
package/lib/backend-plus.d.ts
CHANGED
|
@@ -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 & {
|
package/lib/backend-plus.js
CHANGED
|
@@ -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.
|
|
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.
|
|
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.
|
|
83
|
+
"@types/mocha": "^10.0.10",
|
|
84
84
|
"@types/multiparty": "~4.2.1",
|
|
85
|
-
"@types/node": "^22.9.
|
|
86
|
-
"@types/nodemailer": "^6.4.
|
|
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.
|
|
102
|
+
"puppeteer": "^23.9.0",
|
|
103
103
|
"sinon": "^19.0.2",
|
|
104
104
|
"supertest": "^7.0.0",
|
|
105
|
-
"types.d.ts": "~0.6.
|
|
106
|
-
"typescript": "^5.
|
|
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": {
|
package/unlogged/my-ajax.js
CHANGED
|
@@ -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);
|