backend-plus 1.14.4 → 1.14.8
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/for-client/my-menu.js +0 -46
- package/for-client/my-tables.js +8 -3
- package/lib/backend-plus.js +6 -5
- package/lib/procedures-table.js +1 -1
- package/lib/table-def-adapt.js +4 -4
- package/package.json +7 -7
- package/unlogged/my-ajax.js +46 -0
package/for-client/my-menu.js
CHANGED
|
@@ -209,52 +209,6 @@ myOwn.wScreens.path = function(addrParams){
|
|
|
209
209
|
window.location.href='.'+addrParams.path;
|
|
210
210
|
}
|
|
211
211
|
|
|
212
|
-
myOwn.UriSearchToObject = function UriSearchToObject(locationSearch){
|
|
213
|
-
var parts=locationSearch.split('&');
|
|
214
|
-
var addrParams={}
|
|
215
|
-
parts.forEach(function(pair,i){
|
|
216
|
-
if(pair[0]==='#'){
|
|
217
|
-
pair=pair.substr(1);
|
|
218
|
-
}
|
|
219
|
-
if(pair[0]==='?'){
|
|
220
|
-
pair=pair.substr(1);
|
|
221
|
-
}
|
|
222
|
-
var eq = pair.indexOf('=');
|
|
223
|
-
if(eq !== -1){
|
|
224
|
-
var varName=pair.substr(0, eq);
|
|
225
|
-
var value = decodeURIComponent(pair.substr(eq+1));
|
|
226
|
-
var paramDef=myOwn.UriSearchToObjectParams[varName];
|
|
227
|
-
if(paramDef && paramDef.decode){
|
|
228
|
-
value = paramDef.decode(value);
|
|
229
|
-
}
|
|
230
|
-
addrParams[varName] = value;
|
|
231
|
-
if(!i){
|
|
232
|
-
Object.defineProperty(addrParams,'_firstParameterName',{value:varName, writable:false, enumerable:false});
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
return addrParams;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function noChange(x){ return x; }
|
|
240
|
-
|
|
241
|
-
myOwn.UriSearchToObjectParams={
|
|
242
|
-
i :{ showInMenu:true , encode:function(value,menu){ return menu.name?(menu.parents||[]).concat(menu.name).join(','):value }},
|
|
243
|
-
fc :{ encode:function(x){ return JSON.stringify(x); }, decode:function(x){ return JSON.parse(x)} },
|
|
244
|
-
ff :{ encode:function(x){ return JSON.stringify(x); }, decode:function(x){ return JSON.parse(x)} },
|
|
245
|
-
up :{ encode:function(x){ return json4all.stringify(x); }, decode:function(x){ return json4all.parse(x)} },
|
|
246
|
-
pf :{ encode:function(x){ return JSON.stringify(x); }, decode:function(x){ return JSON.parse(x)} },
|
|
247
|
-
today :{ encode:function(x){ return JSON.stringify(x); }, decode:function(x){ return bestGlobals.date.iso((x+'').substr(0,10))} },
|
|
248
|
-
section :{ showInMenu:true , encode:noChange , decode:noChange },
|
|
249
|
-
directUrl :{ hide:true },
|
|
250
|
-
selectedByDefault:{ hide:true },
|
|
251
|
-
showParams :{ hide:true },
|
|
252
|
-
parents :{ hide:true },
|
|
253
|
-
button :{ hide:true },
|
|
254
|
-
fixedFields :{ varName:'ff' , encode:function(pairs){ return JSON.stringify(likeAr.toPlainObject(pairs, 'fieldName')); }},
|
|
255
|
-
detailing :{ encode:function(x){ return JSON.stringify(x); }, decode:function(x){ return JSON.parse(x)} },
|
|
256
|
-
}
|
|
257
|
-
|
|
258
212
|
myOwn.preDisplayPage = function preDisplayPage(addrParams, wScreen, w){
|
|
259
213
|
var my = this;
|
|
260
214
|
var pageTitle = wScreen.pageTitle || addrParams.pageTitle || addrParams.title || addrParams.name || my.config.config.title;
|
package/for-client/my-tables.js
CHANGED
|
@@ -1056,7 +1056,7 @@ myOwn.DetailColumnGrid.prototype.td = function td(depot, iColumn, tr){
|
|
|
1056
1056
|
detailControl.img = html.img({
|
|
1057
1057
|
src:my.path.img+'detail-unknown.png',
|
|
1058
1058
|
alt:'DETAIL',
|
|
1059
|
-
title:my.messages.details
|
|
1059
|
+
title:detailTableDef.label||my.messages.details
|
|
1060
1060
|
}).create();
|
|
1061
1061
|
var menuRef={w:'table', table:detailTableDef.table};
|
|
1062
1062
|
var calculateFixedFields = function(){
|
|
@@ -1162,7 +1162,7 @@ myOwn.DetailColumnGrid.prototype.td = function td(depot, iColumn, tr){
|
|
|
1162
1162
|
}else{
|
|
1163
1163
|
detailControl.img.src=my.path.img+'detail-expand.png';
|
|
1164
1164
|
detailControl.img.alt="[+]";
|
|
1165
|
-
detailControl.img.title=my.messages.details;
|
|
1165
|
+
detailControl.img.title=detailTableDef.label||my.messages.details;
|
|
1166
1166
|
if(detailControl.tr){
|
|
1167
1167
|
grid.my.fade(detailControl.tr, {smooth:{spans:spansForSmooth, content:detailControl.divDetail}});
|
|
1168
1168
|
depot.detailRows = depot.detailRows.filter(function(tr){ return tr!==detailControl.tr;});
|
|
@@ -2717,6 +2717,9 @@ myOwn.getReference = function getReference(referenceName, opts){
|
|
|
2717
2717
|
getLabel: function getLabel(row){
|
|
2718
2718
|
return this.getLabels(row).join(', ');
|
|
2719
2719
|
},
|
|
2720
|
+
getImage: function getImage(row){
|
|
2721
|
+
return row.image?'img/'+row.image:'';
|
|
2722
|
+
},
|
|
2720
2723
|
fixedFields:[]
|
|
2721
2724
|
},opts||{});
|
|
2722
2725
|
var reference={};
|
|
@@ -2742,6 +2745,7 @@ myOwn.getReference = function getReference(referenceName, opts){
|
|
|
2742
2745
|
reference.getValue = opts.getValue;
|
|
2743
2746
|
reference.getLabels = opts.getLabels;
|
|
2744
2747
|
reference.getLabel = opts.getLabel;
|
|
2748
|
+
reference.getImage = opts.getImage;
|
|
2745
2749
|
return rows;
|
|
2746
2750
|
});
|
|
2747
2751
|
reference=my.references[referenceName]={
|
|
@@ -2854,7 +2858,8 @@ myOwn.ExpanderReferences={
|
|
|
2854
2858
|
var menu=rows.map(function(row){
|
|
2855
2859
|
return {
|
|
2856
2860
|
value:reference.getValue(row),
|
|
2857
|
-
labels:reference.getLabels(row,true)
|
|
2861
|
+
labels:reference.getLabels(row,true),
|
|
2862
|
+
img:reference.getImage(row)
|
|
2858
2863
|
};
|
|
2859
2864
|
});
|
|
2860
2865
|
if(typeInfo.nullable){
|
package/lib/backend-plus.js
CHANGED
|
@@ -581,7 +581,7 @@ AppBackend.prototype.start = function start(opts){
|
|
|
581
581
|
console.log("==============================================");
|
|
582
582
|
console.log("ERROR controling not index.* in privates paths");
|
|
583
583
|
console.log(err);
|
|
584
|
-
process.exit();
|
|
584
|
+
process.exit(1);
|
|
585
585
|
});
|
|
586
586
|
});
|
|
587
587
|
/** @type {Express.Application} */
|
|
@@ -1092,7 +1092,7 @@ AppBackend.prototype.start = function start(opts){
|
|
|
1092
1092
|
}
|
|
1093
1093
|
if(err.dumping){
|
|
1094
1094
|
console.log('error dumping db');
|
|
1095
|
-
process.exit(
|
|
1095
|
+
process.exit(1);
|
|
1096
1096
|
}
|
|
1097
1097
|
var mailDeAvisoDeFalla = be.sendMail({
|
|
1098
1098
|
to: be.config.mailer?.supervise?.to,
|
|
@@ -1114,7 +1114,7 @@ AppBackend.prototype.start = function start(opts){
|
|
|
1114
1114
|
},function(){
|
|
1115
1115
|
console.log('no pudo avisarse por mail')
|
|
1116
1116
|
}).finally(function(){
|
|
1117
|
-
process.exit(
|
|
1117
|
+
process.exit(1);
|
|
1118
1118
|
});
|
|
1119
1119
|
});
|
|
1120
1120
|
};
|
|
@@ -2699,7 +2699,8 @@ AppBackend.prototype.dumpDbSchemaPartial = async function dumpDbSchemaPartial(pa
|
|
|
2699
2699
|
}
|
|
2700
2700
|
var enancePart= 'do $SQL_ENANCE$\n begin\n' + enanceLines.join('\n')+'\n' + 'end\n$SQL_ENANCE$;';
|
|
2701
2701
|
var someNotFound=false;
|
|
2702
|
-
return Promise.all(
|
|
2702
|
+
return Promise.all(likeAr(partialTableStructures).map(function(tableDef, tableName, _, i){
|
|
2703
|
+
if(tableDef?.sql?.isTable === false) return;
|
|
2703
2704
|
// TODO: buscar
|
|
2704
2705
|
var buscarEn=[Path.join('local-install',tableName+'.tab')].concat(
|
|
2705
2706
|
be.appStack.map(function(stackNode){
|
|
@@ -2798,7 +2799,7 @@ AppBackend.prototype.dumpDbSchemaPartial = async function dumpDbSchemaPartial(pa
|
|
|
2798
2799
|
throw err;
|
|
2799
2800
|
}
|
|
2800
2801
|
});
|
|
2801
|
-
})).then(function(){
|
|
2802
|
+
}).array()).then(function(){
|
|
2802
2803
|
if(someNotFound){
|
|
2803
2804
|
console.log('silence "skipping content" messages in "local-config.yaml".install.dump.skip-content=true');
|
|
2804
2805
|
}
|
package/lib/procedures-table.js
CHANGED
|
@@ -910,7 +910,7 @@ ProcedureTables = [
|
|
|
910
910
|
return aux.fieldName === field.name;
|
|
911
911
|
});
|
|
912
912
|
if(prefilledField && prefilledField.value != value){
|
|
913
|
-
throw new Error(be.messages.server.prefilledField1IsInConflictWithImportedField.replace('$1',prefilledField.fieldName);
|
|
913
|
+
throw new Error(be.messages.server.prefilledField1IsInConflictWithImportedField.replace('$1',prefilledField.fieldName));
|
|
914
914
|
}
|
|
915
915
|
if(field.isPk){
|
|
916
916
|
primaryKeyValues[field.isPk-1]=value;
|
package/lib/table-def-adapt.js
CHANGED
|
@@ -264,7 +264,7 @@ function tableDefAdapt(tableDef, context){
|
|
|
264
264
|
fkDef.displayFields = fkDef.displayAllFields?
|
|
265
265
|
(fkTableDef.fields.filter(fd=>fd.visible && !fd.clientSide && !resultTableDef.field[fd.name] && !fd.inJoin && !fkTableDef.sql.fields[fd.name]).map(fd=>fd.name)): //EVALUAR SI ESTÁ BIEN COMENTARLO
|
|
266
266
|
fkDef.displayFields || fkTableDef.nameFields;
|
|
267
|
-
resultTableDef.sql.from += '\n left join ' + fkTableDef.sql.fromWoAs + ' as ' + fkDef.alias + ' on ' +
|
|
267
|
+
resultTableDef.sql.from += '\n left join ' + fkTableDef.sql.fromWoAs + ' as ' + be.db.quoteIdent(fkDef.alias) + ' on ' +
|
|
268
268
|
fkDef.fields.map(function(pair){
|
|
269
269
|
lastSourceField = pair.source;
|
|
270
270
|
return be.db.quoteIdent(resultTableDef.alias)+'.'+be.db.quoteIdent(pair.source)
|
|
@@ -345,11 +345,11 @@ tableDefAdapt.forInsertOnly = function forInsertOnly(tableDef){
|
|
|
345
345
|
tableDef.fields.sort(bestGlobals.compareForOrder([{column:'orderForInsertOnly'}]))
|
|
346
346
|
tableDef.sql.select = tableDef.fields.map(function(fieldDef){
|
|
347
347
|
var typer=TypeStore.typerFrom(fieldDef);
|
|
348
|
-
return (fieldDef.inTable===false || fieldDef.inJoin) && tableDef.sql.fields[fieldDef.name] ?"null::"+typer.typeDbPg+" as "+
|
|
348
|
+
return (fieldDef.inTable===false || fieldDef.inJoin) && tableDef.sql.fields[fieldDef.name] ?"null::"+typer.typeDbPg+" as "+be.db.quoteIdent(fieldDef.name):(
|
|
349
349
|
fieldDef.referencedName?(
|
|
350
|
-
|
|
350
|
+
be.db.quoteIdent(fieldDef.referencedAlias)+"."+be.db.quoteIdent(fieldDef.referencedName)+" as "+be.db.quoteIdent(fieldDef.name)
|
|
351
351
|
):(
|
|
352
|
-
|
|
352
|
+
be.db.quoteIdent(tableDef.alias)+"."+be.db.quoteIdent(fieldDef.name)
|
|
353
353
|
)
|
|
354
354
|
);
|
|
355
355
|
});
|
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.14.
|
|
4
|
+
"version": "1.14.8",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"ajax-best-promise": "^0.3.7",
|
|
32
32
|
"backend-skins": "^0.1.15",
|
|
33
|
-
"best-globals": "^1.0.
|
|
33
|
+
"best-globals": "^1.0.2",
|
|
34
34
|
"big.js": "^6.1.1",
|
|
35
35
|
"body-parser": "^1.19.1",
|
|
36
36
|
"cast-error": "^0.1.0",
|
|
@@ -70,27 +70,27 @@
|
|
|
70
70
|
"stylus": "^0.56.0",
|
|
71
71
|
"type-store": "^0.2.41",
|
|
72
72
|
"typed-controls": "^0.10.0",
|
|
73
|
-
"xlsx": "^0.17.
|
|
73
|
+
"xlsx": "^0.17.5",
|
|
74
74
|
"xlsx-style": "^0.8.13"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
77
|
"@types/big.js": "^6.1.2",
|
|
78
78
|
"@types/expect.js": "~0.3.29",
|
|
79
79
|
"@types/express": "^4.17.13",
|
|
80
|
-
"@types/express-useragent": "^1.0.
|
|
80
|
+
"@types/express-useragent": "^1.0.2",
|
|
81
81
|
"@types/fs-extra": "^9.0.13",
|
|
82
82
|
"@types/js-yaml": "^4.0.5",
|
|
83
83
|
"@types/mocha": "^9.0.0",
|
|
84
84
|
"@types/nodemailer": "^6.4.4",
|
|
85
85
|
"@types/multiparty": "~0.0.33",
|
|
86
|
-
"@types/node": "^17.0.
|
|
86
|
+
"@types/node": "^17.0.8",
|
|
87
87
|
"@types/numeral": "~2.0.2",
|
|
88
88
|
"@types/session-file-store": "^1.2.2",
|
|
89
89
|
"@types/stack-trace": "~0.0.29",
|
|
90
90
|
"@types/websql": "~0.0.27",
|
|
91
91
|
"esprima": "^4.0.1",
|
|
92
92
|
"expect.js": "~0.3.1",
|
|
93
|
-
"karma": "6.3.
|
|
93
|
+
"karma": "6.3.11",
|
|
94
94
|
"karma-chrome-launcher": "^3.1.0",
|
|
95
95
|
"karma-expect": "^1.1.3",
|
|
96
96
|
"karma-firefox-launcher": "^2.1.2",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"nyc": "^15.1.0",
|
|
102
102
|
"puppeteer": "^13.0.1",
|
|
103
103
|
"sinon": "^12.0.1",
|
|
104
|
-
"supertest": "^6.1
|
|
104
|
+
"supertest": "^6.2.1",
|
|
105
105
|
"types.d.ts": "~0.6.6",
|
|
106
106
|
"typescript": "^4.5.4",
|
|
107
107
|
"why-is-node-running": "^2.2.0"
|
package/unlogged/my-ajax.js
CHANGED
|
@@ -563,6 +563,52 @@ myAjax.agregar_json=agregar_json;
|
|
|
563
563
|
// require.paths=require.paths||{}
|
|
564
564
|
// require.paths.vs = '../node_modules/monaco-editor/min/vs';
|
|
565
565
|
|
|
566
|
+
function noChange(x){ return x; }
|
|
567
|
+
|
|
568
|
+
myAjax.UriSearchToObjectParams={
|
|
569
|
+
i :{ showInMenu:true , encode:function(value,menu){ return menu.name?(menu.parents||[]).concat(menu.name).join(','):value }},
|
|
570
|
+
fc :{ encode:function(x){ return JSON.stringify(x); }, U:function(x){ return JSON.parse(x)} },
|
|
571
|
+
ff :{ encode:function(x){ return JSON.stringify(x); }, decode:function(x){ return JSON.parse(x)} },
|
|
572
|
+
up :{ encode:function(x){ return json4all.stringify(x); }, decode:function(x){ return json4all.parse(x)} },
|
|
573
|
+
pf :{ encode:function(x){ return JSON.stringify(x); }, decode:function(x){ return JSON.parse(x)} },
|
|
574
|
+
today :{ encode:function(x){ return JSON.stringify(x); }, decode:function(x){ return bestGlobals.date.iso((x+'').substr(0,10))} },
|
|
575
|
+
section :{ showInMenu:true , encode:noChange , decode:noChange },
|
|
576
|
+
directUrl :{ hide:true },
|
|
577
|
+
selectedByDefault:{ hide:true },
|
|
578
|
+
showParams :{ hide:true },
|
|
579
|
+
parents :{ hide:true },
|
|
580
|
+
button :{ hide:true },
|
|
581
|
+
fixedFields :{ varName:'ff' , encode:function(pairs){ return JSON.stringify(likeAr.toPlainObject(pairs, 'fieldName')); }},
|
|
582
|
+
detailing :{ encode:function(x){ return JSON.stringify(x); }, decode:function(x){ return JSON.parse(x)} },
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
myAjax.UriSearchToObject = function UriSearchToObject(locationSearch){
|
|
586
|
+
var parts=locationSearch.split('&');
|
|
587
|
+
var addrParams={}
|
|
588
|
+
parts.forEach(function(pair,i){
|
|
589
|
+
if(pair[0]==='#'){
|
|
590
|
+
pair=pair.substr(1);
|
|
591
|
+
}
|
|
592
|
+
if(pair[0]==='?'){
|
|
593
|
+
pair=pair.substr(1);
|
|
594
|
+
}
|
|
595
|
+
var eq = pair.indexOf('=');
|
|
596
|
+
if(eq !== -1){
|
|
597
|
+
var varName=pair.substr(0, eq);
|
|
598
|
+
var value = decodeURIComponent(pair.substr(eq+1));
|
|
599
|
+
var paramDef=myOwn.UriSearchToObjectParams[varName];
|
|
600
|
+
if(paramDef && paramDef.decode){
|
|
601
|
+
value = paramDef.decode(value);
|
|
602
|
+
}
|
|
603
|
+
addrParams[varName] = value;
|
|
604
|
+
if(!i){
|
|
605
|
+
Object.defineProperty(addrParams,'_firstParameterName',{value:varName, writable:false, enumerable:false});
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
});
|
|
609
|
+
return addrParams;
|
|
610
|
+
}
|
|
611
|
+
|
|
566
612
|
return myAjax;
|
|
567
613
|
|
|
568
614
|
});
|