backend-plus 2.0.0-rc.2 → 2.0.0-rc.4
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 +1 -1
- package/lib/backend-plus.d.ts +3 -3
- package/lib/backend-plus.js +23 -14
- package/package.json +6 -6
package/for-client/my-menu.js
CHANGED
|
@@ -152,7 +152,7 @@ myOwn.wScreens.procAux = {
|
|
|
152
152
|
button.disabled=false;
|
|
153
153
|
divProgressOutside.style.opacity=0.33;
|
|
154
154
|
toggleProgress.disabled=false;
|
|
155
|
-
labelProgress.textContent=resultOk?my.messages.completed:'error';
|
|
155
|
+
labelProgress.textContent=typeof resultOk == "string" ? resultOk : resultOk !== false ? my.messages.completed : 'error';
|
|
156
156
|
}).catch(function(err){
|
|
157
157
|
my.log(err);
|
|
158
158
|
divProgress.textContent=err.message;
|
package/lib/backend-plus.d.ts
CHANGED
|
@@ -35,7 +35,7 @@ export type UploadedFileInfo={
|
|
|
35
35
|
|
|
36
36
|
}
|
|
37
37
|
export type CoreFunction = ((context: ProcedureContext, parameters: CoreFunctionParameters) => Promise<any>)
|
|
38
|
-
|
|
38
|
+
| ((context: ProcedureContext, parameters: CoreFunctionParameters, files?:UploadedFileInfo[]) => Promise<any>);
|
|
39
39
|
|
|
40
40
|
export interface ProcedureDef {
|
|
41
41
|
action: string
|
|
@@ -252,6 +252,7 @@ export type Constraint = {constraintType:string, consName?:string} & (
|
|
|
252
252
|
{constraintType:'unique', fields:string[], where?:string} |
|
|
253
253
|
{constraintType:'check', expr?:string}
|
|
254
254
|
)
|
|
255
|
+
export type OtherTableDefs = Record<string,Partial<TableDefinition & {prefilledField:Record<string,any>}>>
|
|
255
256
|
export type TableDefinition = EditableDbDefinition & {
|
|
256
257
|
name:string
|
|
257
258
|
elementName?:string
|
|
@@ -293,7 +294,7 @@ export type TableDefinition = EditableDbDefinition & {
|
|
|
293
294
|
}
|
|
294
295
|
join?:string
|
|
295
296
|
constraintsDeferred?:boolean
|
|
296
|
-
otherTableDefs?:
|
|
297
|
+
otherTableDefs?:OtherTableDefs
|
|
297
298
|
}
|
|
298
299
|
foreignKeys?:ForeignKey[]
|
|
299
300
|
softForeignKeys?:ForeignKey[]
|
|
@@ -322,7 +323,6 @@ export type TableDefinition = EditableDbDefinition & {
|
|
|
322
323
|
filterColumns?:{column:string, operator:string, value:any}[],
|
|
323
324
|
gridAlias?:string /* front-end css my-table = gridAlias */
|
|
324
325
|
}
|
|
325
|
-
export type OtherTableDefs = TableDefinition['sql']['otherTableDefs']
|
|
326
326
|
export interface DetailTable { table?: string, fields: FieldsForConnectDetailTable, abr: string, label?: string, refreshParent?:boolean, refreshFromParent?:boolean, wScreen?:string, condition?:string }
|
|
327
327
|
export type TableDefinitionFunction = (context: ContextForDump, opts?:any) => TableDefinition;
|
|
328
328
|
export type TableItemDef=string|{name:string, path?:string, tableGenerator?:(context:TableContext)=>TableDefinition}
|
package/lib/backend-plus.js
CHANGED
|
@@ -456,7 +456,7 @@ AppBackend.prototype.setStaticConfig = function setStaticConfig(defConfigYamlStr
|
|
|
456
456
|
|
|
457
457
|
AppBackend.prototype.configList = function configList(){
|
|
458
458
|
var list=[this.staticConfig];
|
|
459
|
-
if(!this.staticConfig["client-setup"]
|
|
459
|
+
if(!this.staticConfig["client-setup"]?.title && fs.existsSync(this.rootPath+'/def-config.yaml')){
|
|
460
460
|
console.log('DEPRECATED!!!!!!')
|
|
461
461
|
console.error('ERROR el def-config hay que ponerlo dentro de staticConfig');
|
|
462
462
|
console.log('DEPRECATED!!!!!!')
|
|
@@ -466,7 +466,7 @@ AppBackend.prototype.configList = function configList(){
|
|
|
466
466
|
list.push(this.rootPath+'/def-config.yaml')
|
|
467
467
|
};
|
|
468
468
|
list.push(this.rootPath+'/local-config');
|
|
469
|
-
list.push(process.env.BACKEND_PLUS_LOCAL_CONFIG||{});
|
|
469
|
+
list.push(process.env.BACKEND_PLUS_LOCAL_CONFIG?.trim()||{});
|
|
470
470
|
return list;
|
|
471
471
|
};
|
|
472
472
|
|
|
@@ -1130,7 +1130,7 @@ AppBackend.prototype.start = function start(opts){
|
|
|
1130
1130
|
}
|
|
1131
1131
|
return be.sendMail({
|
|
1132
1132
|
to: be.config.mailer?.supervise?.to,
|
|
1133
|
-
subject: `npm start ${be.config["client-setup"]
|
|
1133
|
+
subject: `npm start ${be.config["client-setup"]?.title || packagejson.name} ok ✔️`,
|
|
1134
1134
|
text:`Inicio del servicio: ${new Date().toJSON()}
|
|
1135
1135
|
|
|
1136
1136
|
Contexto: ${os.userInfo().username} ${process.cwd()}
|
|
@@ -1152,7 +1152,7 @@ AppBackend.prototype.start = function start(opts){
|
|
|
1152
1152
|
}
|
|
1153
1153
|
var mailDeAvisoDeFalla = be.sendMail({
|
|
1154
1154
|
to: be.config.mailer?.supervise?.to,
|
|
1155
|
-
subject: `npm start ${be.config["client-setup"]
|
|
1155
|
+
subject: `npm start ${be.config["client-setup"]?.title || packagejson.name} fallido 🛑`,
|
|
1156
1156
|
text:`Falla en el inicio del servicio: ${new Date().toJSON()}
|
|
1157
1157
|
|
|
1158
1158
|
Contexto: ${os.userInfo().username} ${process.cwd()}
|
|
@@ -2181,7 +2181,7 @@ AppBackend.prototype.mainPage = function mainPage(req, offlineMode, opts){
|
|
|
2181
2181
|
}
|
|
2182
2182
|
return html.html(attr,[
|
|
2183
2183
|
html.head([
|
|
2184
|
-
html.title(be.config["client-setup"]
|
|
2184
|
+
html.title(be.config["client-setup"]?.title),
|
|
2185
2185
|
html.meta({charset:"utf-8"}),
|
|
2186
2186
|
viewportAttrs?html.meta(viewportAttrs):null,
|
|
2187
2187
|
html.link({href: opts.icons.iconShortcut , rel: "shortcut icon", type: "image/png"}),
|
|
@@ -2847,7 +2847,7 @@ AppBackend.prototype.dumpDbSchemaPartial = async function dumpDbSchemaPartial(pa
|
|
|
2847
2847
|
allTableData = allTableContent.slice(startIndex, lastIndex);
|
|
2848
2848
|
} catch(err) {
|
|
2849
2849
|
if (err.code != 'ENOENT') throw err;
|
|
2850
|
-
throw err;
|
|
2850
|
+
//throw err;
|
|
2851
2851
|
}
|
|
2852
2852
|
}
|
|
2853
2853
|
if (allTableData) {
|
|
@@ -2965,20 +2965,29 @@ AppBackend.prototype.dumpDbSchemaPartial = async function dumpDbSchemaPartial(pa
|
|
|
2965
2965
|
console.log('silence "skipping content" messages in "local-config.yaml".install.dump.skip-content=true');
|
|
2966
2966
|
}
|
|
2967
2967
|
}
|
|
2968
|
+
let installFolders = be.config.install.dump.folders ?? ['install']
|
|
2968
2969
|
let texts = await Promise.all(
|
|
2969
2970
|
['prepare.sql','pre-adapt.sql','adapt.sql']
|
|
2970
2971
|
.concat(be.config.install.dump.scripts['prepare'])
|
|
2971
2972
|
.concat(be.config.install.dump.scripts['post-adapt'])
|
|
2972
|
-
.map(function(fileName){
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2973
|
+
.map(async function(fileName){
|
|
2974
|
+
if (!fileName) return '';
|
|
2975
|
+
var i = 0;
|
|
2976
|
+
var content;
|
|
2977
|
+
do {
|
|
2978
|
+
var folder = installFolders[i];
|
|
2979
|
+
try{
|
|
2980
|
+
content = await fs.readFile(be.rootPath+'/'+folder+'/'+fileName, {encoding:'UTF8'});
|
|
2981
|
+
} catch (err) {
|
|
2982
|
+
if(err.code!='ENOENT') throw err;
|
|
2976
2983
|
}
|
|
2977
|
-
|
|
2984
|
+
i++;
|
|
2985
|
+
} while (i < installFolders.length && !content);
|
|
2986
|
+
if (!content) {
|
|
2978
2987
|
return '-- no '+fileName+'\n';
|
|
2979
|
-
}
|
|
2980
|
-
return '-- '+fileName+'\n'+content;
|
|
2981
|
-
}
|
|
2988
|
+
} else {
|
|
2989
|
+
return '-- '+folder+'/'+fileName+'\n'+content;
|
|
2990
|
+
};
|
|
2982
2991
|
})
|
|
2983
2992
|
);
|
|
2984
2993
|
var prepareList=(be.config.install.dump.scripts['prepare']||[]);
|
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.0-rc.
|
|
4
|
+
"version": "2.0.0-rc.4",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"dialog-promise": "^0.9.15",
|
|
42
42
|
"discrepances": "^0.2.8",
|
|
43
43
|
"express": "^4.18.2",
|
|
44
|
-
"express-session": "^1.
|
|
44
|
+
"express-session": "^1.18.0",
|
|
45
45
|
"express-useragent": "^1.0.15",
|
|
46
46
|
"fs-extra": "^11.2.0",
|
|
47
47
|
"js-to-html": "^1.3.2",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"mini-tools": "^1.12.1",
|
|
55
55
|
"moment": "^2.30.1",
|
|
56
56
|
"multiparty": "^4.2.3",
|
|
57
|
-
"nodemailer": "^6.9.
|
|
57
|
+
"nodemailer": "^6.9.9",
|
|
58
58
|
"numeral": "^2.0.6",
|
|
59
59
|
"pg-promise-strict": "^1.3.3",
|
|
60
60
|
"pikaday": "^1.8.2",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@types/js-yaml": "^4.0.9",
|
|
82
82
|
"@types/mocha": "^10.0.6",
|
|
83
83
|
"@types/multiparty": "~0.0.36",
|
|
84
|
-
"@types/node": "^20.11.
|
|
84
|
+
"@types/node": "^20.11.17",
|
|
85
85
|
"@types/nodemailer": "^6.4.14",
|
|
86
86
|
"@types/numeral": "~2.0.5",
|
|
87
87
|
"@types/session-file-store": "^1.2.5",
|
|
@@ -96,9 +96,9 @@
|
|
|
96
96
|
"karma-ie-launcher": "^1.0.0",
|
|
97
97
|
"karma-mocha": "^2.0.1",
|
|
98
98
|
"kill-9": "~0.4.3",
|
|
99
|
-
"mocha": "^10.
|
|
99
|
+
"mocha": "^10.3.0",
|
|
100
100
|
"nyc": "^15.1.0",
|
|
101
|
-
"puppeteer": "^
|
|
101
|
+
"puppeteer": "^22.0.0",
|
|
102
102
|
"sinon": "^17.0.1",
|
|
103
103
|
"supertest": "^6.3.4",
|
|
104
104
|
"types.d.ts": "~0.6.21",
|