backend-plus 2.0.0-rc.27 → 2.0.0-rc.29
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-websqldb.d.ts +0 -1
- package/lib/backend-plus.d.ts +5 -5
- package/lib/backend-plus.js +39 -3
- package/package.json +9 -9
package/lib/backend-plus.d.ts
CHANGED
|
@@ -32,14 +32,14 @@ export type UploadedFileInfo={
|
|
|
32
32
|
path: string
|
|
33
33
|
|
|
34
34
|
}
|
|
35
|
-
export type CoreFunction = ((context: ProcedureContext, parameters: CoreFunctionParameters) => Promise<any>)
|
|
36
|
-
| ((context: ProcedureContext, parameters: CoreFunctionParameters
|
|
35
|
+
export type CoreFunction<T> = ((context: ProcedureContext, parameters: CoreFunctionParameters<T>) => Promise<any>)
|
|
36
|
+
| ((context: ProcedureContext, parameters: CoreFunctionParameters<T>, files?:UploadedFileInfo[]) => Promise<any>);
|
|
37
37
|
|
|
38
|
-
export interface ProcedureDef {
|
|
38
|
+
export interface ProcedureDef<T = any> {
|
|
39
39
|
action: string
|
|
40
40
|
parameters: ProcedureParameter[]
|
|
41
41
|
method?: 'get'|'post'
|
|
42
|
-
coreFunction: CoreFunction
|
|
42
|
+
coreFunction: CoreFunction<T>
|
|
43
43
|
encoding?:'JSON4all'|'JSON'|'download'
|
|
44
44
|
multipart?:true
|
|
45
45
|
progress?:true
|
|
@@ -528,7 +528,7 @@ export class AppBackend{
|
|
|
528
528
|
inDbClient<T>(req:Request|null, doThisWithDbClient:(client:Client)=>Promise<T>):Promise<T>
|
|
529
529
|
inTransaction<T>(req:Request|null, doThisWithDbTransaction:(client:Client)=>Promise<T>):Promise<T>
|
|
530
530
|
inTransactionProcedureContext<T>(req:Request|null, coreFunction:(context:ProcedureContext)=>Promise<T>):Promise<T>
|
|
531
|
-
procedureDefCompleter(procedureDef:ProcedureDef):ProcedureDef
|
|
531
|
+
procedureDefCompleter<T>(procedureDef:ProcedureDef):ProcedureDef<T>
|
|
532
532
|
tableDefAdapt(tableDef:TableDefinition, context:Context):TableDefinition
|
|
533
533
|
pushApp(dirname:string):void
|
|
534
534
|
dumpDbTableFields(tableDefinition:TableDefinition):string[]
|
package/lib/backend-plus.js
CHANGED
|
@@ -1768,14 +1768,26 @@ function require_resolve(moduleName){
|
|
|
1768
1768
|
return resolved;
|
|
1769
1769
|
}
|
|
1770
1770
|
|
|
1771
|
-
function resolve_module_dir(moduleName,path){
|
|
1771
|
+
function resolve_module_dir(moduleName,path,fileToCheck){
|
|
1772
1772
|
var baseDir;
|
|
1773
1773
|
if(packagejson.name==moduleName){
|
|
1774
1774
|
baseDir=Path.join(process.cwd(), packagejson.main);
|
|
1775
1775
|
}else{
|
|
1776
1776
|
baseDir=require_resolve(moduleName);
|
|
1777
1777
|
}
|
|
1778
|
-
|
|
1778
|
+
var resultDir = Path.join(Path.dirname(baseDir),path||'');
|
|
1779
|
+
if (fileToCheck) {
|
|
1780
|
+
fs.stat(Path.join(resultDir, fileToCheck)).then(function(status){
|
|
1781
|
+
if (!status) {
|
|
1782
|
+
console.error('Error resolve_module_dir in:',resultDir,'no:',fileToCheck);
|
|
1783
|
+
} else if(!status.isFile()) {
|
|
1784
|
+
console.error('Error resolve_module_dir in:',resultDir,',',fileToCheck,'is not a file');
|
|
1785
|
+
}
|
|
1786
|
+
},function(err){
|
|
1787
|
+
console.error('Error resolve_module_dir in:',resultDir,'err:',err);
|
|
1788
|
+
});
|
|
1789
|
+
}
|
|
1790
|
+
return resultDir;
|
|
1779
1791
|
}
|
|
1780
1792
|
|
|
1781
1793
|
AppBackend.prototype.optsGenericForFiles = function optsGenericForFiles(req, opts){
|
|
@@ -1982,7 +1994,7 @@ AppBackend.prototype.addUnloggedServices = function addUnloggedServices(mainApp,
|
|
|
1982
1994
|
}
|
|
1983
1995
|
}
|
|
1984
1996
|
} catch (error) {
|
|
1985
|
-
console.error('ERROR: No se pudo servir el módulo
|
|
1997
|
+
console.error('ERROR: No se pudo servir el módulo', moduleDef.module);
|
|
1986
1998
|
throw error;
|
|
1987
1999
|
}
|
|
1988
2000
|
})
|
|
@@ -2670,6 +2682,30 @@ AppBackend.prototype.dumpDbSchemaPartial = async function dumpDbSchemaPartial(pa
|
|
|
2670
2682
|
}
|
|
2671
2683
|
var schema=db.quoteIdent(be.config.db.schema);
|
|
2672
2684
|
linesCreate.push("set role to "+owner+";");
|
|
2685
|
+
linesCreate.push(`do
|
|
2686
|
+
$do$
|
|
2687
|
+
declare
|
|
2688
|
+
vExpectedVersion text := '${be.config.db["min-version"]}';
|
|
2689
|
+
vCurrentVersion text := (select setting from pg_settings where name = 'server_version');
|
|
2690
|
+
begin
|
|
2691
|
+
if jsonb('['||replace(vCurrentVersion,'.',',')||']') < jsonb('['||replace(vExpectedVersion,'.',',')||']') then
|
|
2692
|
+
raise exception 'BACKEND-PLUS DUMP: Old PostrgreSQL Version % expected %', vCurrentVersion, vExpectedVersion;
|
|
2693
|
+
end if;
|
|
2694
|
+
end;
|
|
2695
|
+
$do$;
|
|
2696
|
+
`);
|
|
2697
|
+
linesCreate.push(`do
|
|
2698
|
+
$do$
|
|
2699
|
+
declare
|
|
2700
|
+
vExpected text := 'UTF8';
|
|
2701
|
+
vCurrent text := coalesce((select setting from pg_settings where name = 'server_encoding'),'unknown');
|
|
2702
|
+
begin
|
|
2703
|
+
if vCurrent is distinct from vExpected then
|
|
2704
|
+
raise exception 'BACKEND-PLUS DUMP: PostrgreSQL server_encoding %, expected %', vCurrent, vExpected;
|
|
2705
|
+
end if;
|
|
2706
|
+
end;
|
|
2707
|
+
$do$;
|
|
2708
|
+
`);
|
|
2673
2709
|
linesCreate.push("drop schema if exists "+schema+' cascade;');
|
|
2674
2710
|
if (be.config.install.dump["drop-his"]) {
|
|
2675
2711
|
linesCreate.push("drop schema if exists his cascade;");
|
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.29",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"js-yaml": "^4.1.0",
|
|
50
50
|
"json4all": "^1.3.0-beta.1",
|
|
51
51
|
"lazy-some": "^0.1.0",
|
|
52
|
-
"like-ar": "^0.
|
|
52
|
+
"like-ar": "^0.5.0",
|
|
53
53
|
"login-plus": "^1.7.1",
|
|
54
54
|
"memorystore": "^1.6.7",
|
|
55
55
|
"mini-tools": "^1.12.1",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"multiparty": "^4.2.3",
|
|
58
58
|
"nodemailer": "^6.9.14",
|
|
59
59
|
"numeral": "^2.0.6",
|
|
60
|
-
"pg-promise-strict": "^1.4.
|
|
60
|
+
"pg-promise-strict": "^1.4.1",
|
|
61
61
|
"pikaday": "^1.8.2",
|
|
62
62
|
"pug": "^3.0.3",
|
|
63
63
|
"read-yaml-promise": "^1.0.2",
|
|
@@ -69,8 +69,8 @@
|
|
|
69
69
|
"sql-tools": "^0.1.2",
|
|
70
70
|
"stack-trace": "^0.0.10",
|
|
71
71
|
"stylus": "0.63.0",
|
|
72
|
-
"type-store": "^0.4.
|
|
73
|
-
"typed-controls": "^0.12.
|
|
72
|
+
"type-store": "^0.4.2",
|
|
73
|
+
"typed-controls": "^0.12.1",
|
|
74
74
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
"@types/js-yaml": "^4.0.9",
|
|
83
83
|
"@types/mocha": "^10.0.7",
|
|
84
84
|
"@types/multiparty": "~0.0.36",
|
|
85
|
-
"@types/node": "^22.
|
|
85
|
+
"@types/node": "^22.5.2",
|
|
86
86
|
"@types/nodemailer": "^6.4.15",
|
|
87
87
|
"@types/numeral": "~2.0.5",
|
|
88
88
|
"@types/session-file-store": "^1.2.5",
|
|
@@ -90,16 +90,16 @@
|
|
|
90
90
|
"@types/websql": "~0.0.30",
|
|
91
91
|
"esprima": "^4.0.1",
|
|
92
92
|
"expect.js": "~0.3.1",
|
|
93
|
-
"karma": "6.4.
|
|
93
|
+
"karma": "6.4.4",
|
|
94
94
|
"karma-chrome-launcher": "^3.2.0",
|
|
95
95
|
"karma-expect": "^1.1.3",
|
|
96
96
|
"karma-firefox-launcher": "^2.1.3",
|
|
97
97
|
"karma-ie-launcher": "^1.0.0",
|
|
98
98
|
"karma-mocha": "^2.0.1",
|
|
99
99
|
"kill-9": "~0.4.3",
|
|
100
|
-
"mocha": "^10.7.
|
|
100
|
+
"mocha": "^10.7.3",
|
|
101
101
|
"nyc": "^17.0.0",
|
|
102
|
-
"puppeteer": "^
|
|
102
|
+
"puppeteer": "^23.2.1",
|
|
103
103
|
"sinon": "^18.0.0",
|
|
104
104
|
"supertest": "^7.0.0",
|
|
105
105
|
"types.d.ts": "~0.6.21",
|