backend-plus 2.6.9 → 2.7.0-beta.0
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/README.md +293 -263
- package/lib/backend-plus.d.ts +1 -1
- package/lib/backend-plus.js +35 -23
- package/package.json +30 -32
- package/unlogged/my-ajax.js +1 -1
package/README.md
CHANGED
|
@@ -1,263 +1,293 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
# backend-plus
|
|
4
|
-
|
|
5
|
-
Backend for the anti Pareto rule.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
](https://npmjs.org/package/backend-plus)
|
|
9
|
+
[](https://npmjs.org/package/backend-plus)
|
|
10
|
+
[](https://github.com/codenautas/backend-plus/actions/workflows/build-and-test.yml)
|
|
11
|
+
[](https://socket.dev/npm/package/backend-plus)
|
|
12
|
+
[](https://github.com/codenautas/backend-plus/actions/workflows/qa-control.yml)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
language: 
|
|
16
|
+
also available in:
|
|
17
|
+
[](LEEME.md)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
It's a framework for developing web applications based on PostgreSQL database. Its main features are:
|
|
22
|
+
|
|
23
|
+
1. It is based on centralized metadata that defines:
|
|
24
|
+
1. The data structure (tables and views structure)
|
|
25
|
+
2. The procedures structure (param definition, permissions, encoding)
|
|
26
|
+
3. The menus structure
|
|
27
|
+
2. It provides:
|
|
28
|
+
1. Editable grids (orderable and filterable), with support for edit data using XLSX format files
|
|
29
|
+
2. Login mechanism
|
|
30
|
+
3. Menus
|
|
31
|
+
4. Skins definition
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## API
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### [table definitions](doc/table-definitions.md)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
### [module definitions](doc/module-definitions.md)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### [client side definitions](doc/client-side-definitions.md)
|
|
45
|
+
|
|
46
|
+
### Menus definition
|
|
47
|
+
|
|
48
|
+
menuType | use
|
|
49
|
+
---------|----------
|
|
50
|
+
menu | menu or submenu
|
|
51
|
+
table | grid or table
|
|
52
|
+
proc | procedures
|
|
53
|
+
|
|
54
|
+
property | type | default value | menuType | use
|
|
55
|
+
------------|------|----------------|----------|---------
|
|
56
|
+
menuType | T | | | menu Type
|
|
57
|
+
name | T | | | option name (id)
|
|
58
|
+
menuContent | A | | menu | menu content
|
|
59
|
+
table | T | `name` | table | table name
|
|
60
|
+
label | T | `name` | | if you don't want to use default value to display in menu
|
|
61
|
+
selectedByDefault | B | | | is the selected by default option
|
|
62
|
+
autoproced | B | `false` | proc | if yo want to execute the procedure without clicking the proced button
|
|
63
|
+
|
|
64
|
+
Integrating example:
|
|
65
|
+
|
|
66
|
+
```js
|
|
67
|
+
getMenu(context){
|
|
68
|
+
return {menu:[
|
|
69
|
+
{menuType:'menu', name:'periodic table', menuContent:[
|
|
70
|
+
{menuType:'table', name:'ptable' , label:'elements'},
|
|
71
|
+
{menuType:'table', name:'pgroups' , label:'groups' },
|
|
72
|
+
{menuType:'table', name:'isotopes', label:'isotopes'},
|
|
73
|
+
{menuType:'proc' , name:'count_without_isotopes', label:'count'}
|
|
74
|
+
]},
|
|
75
|
+
{menuType:'table', name:'images', table:'element_images'},
|
|
76
|
+
{menuType:'menu', name:'test', menuContent:[
|
|
77
|
+
{menuType:'table', name:'bigint'},
|
|
78
|
+
]},
|
|
79
|
+
{menuType:'menu', name:'config', menuContent:[
|
|
80
|
+
{name:'users', menuType:'table'},
|
|
81
|
+
]},
|
|
82
|
+
]}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
### Procedures definition
|
|
87
|
+
|
|
88
|
+
#### procDef:
|
|
89
|
+
|
|
90
|
+
property | type | default value | use
|
|
91
|
+
------------|------|-------------------------------|-----------------------------------------------------
|
|
92
|
+
action | T | | Name that will be invoked the procedure
|
|
93
|
+
bitacora | BO | { error:false, always:false } | Bitacora Object for core functions register
|
|
94
|
+
parameters | POA | `[]` | Param Objects Array
|
|
95
|
+
cacheable | Bool | false | The result can be cached
|
|
96
|
+
coreFunction| F | | Function that implements the procedure
|
|
97
|
+
|
|
98
|
+
#### bitacoraDef:
|
|
99
|
+
|
|
100
|
+
property | type | default value | use
|
|
101
|
+
----------------------------------|----------------|----------------------------|-------------------
|
|
102
|
+
error | B | false | If true, bitacora saves data of error ocurred during core function execution
|
|
103
|
+
always | B | false | If true, bitacora saves all data ocurred during core function execution (overrides error)
|
|
104
|
+
targetTable | T | null | Tablename for update result of execution data (must to exists a record for update) (see **targetTableBitacoraFields**). Use null for ignore option
|
|
105
|
+
targetTableBitacoraFields | O | { **init_date**: 'init_date', **end_date**: 'end_date', **has_error**: 'has_error', **end_status**: 'end_status'} | Objects who defines the fields where **'targetTable'** will reply bitacora fields (If targetTable is null it's ommited)
|
|
106
|
+
targetTableUpdateFieldsCondition | A | null | Fields array to define update condition (each value must to be passed as parameter with the same field name)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
#### paramDef:
|
|
110
|
+
|
|
111
|
+
property | type | default value | use
|
|
112
|
+
--------------|----------------|----------------|-------------------
|
|
113
|
+
name | T | | name of the parameter that is sent to the procedure
|
|
114
|
+
defaultValue | according to typeName | | parameter default value
|
|
115
|
+
typeName | T | | to define the data type
|
|
116
|
+
label | T | name | if you don't want to use default value to display on screen
|
|
117
|
+
|
|
118
|
+
#### coreFunction(context, parameters)
|
|
119
|
+
|
|
120
|
+
context | use
|
|
121
|
+
---------|----------------------
|
|
122
|
+
be | backendApp object
|
|
123
|
+
username | username
|
|
124
|
+
|
|
125
|
+
Process definition example:
|
|
126
|
+
|
|
127
|
+
```js
|
|
128
|
+
{
|
|
129
|
+
action:'count_without_isotopes',
|
|
130
|
+
bitacora:{
|
|
131
|
+
error:true,
|
|
132
|
+
always:true,
|
|
133
|
+
targetTable:'other_table',
|
|
134
|
+
targetTableBitacoraFields: {
|
|
135
|
+
init_date: 'fecha_hora_inicio',
|
|
136
|
+
end_date: 'fecha_hora_final',
|
|
137
|
+
has_error: 'hubo_error',
|
|
138
|
+
end_status: 'resultado'
|
|
139
|
+
},
|
|
140
|
+
targetTableUpdateFieldsCondition: ['id']
|
|
141
|
+
},
|
|
142
|
+
parameters:[
|
|
143
|
+
{name:'first_atomic_number', defaultValue:10, typeName:'integer'},
|
|
144
|
+
{name:'last_atomic_number' , defaultValue:99, typeName:'integer'},
|
|
145
|
+
],
|
|
146
|
+
coreFunction:function(context, parameters){
|
|
147
|
+
return context.client.query(
|
|
148
|
+
`SELECT count(*) as number_of_elements
|
|
149
|
+
FROM ptable p left join isotopes i on p.atomic_number=i.atomic_number
|
|
150
|
+
WHERE i.atomic_number IS NULL
|
|
151
|
+
AND p.atomic_number between coalesce($1,0) and coalesce($2,999)`,
|
|
152
|
+
[parameters.first_atomic_number, parameters.last_atomic_number]
|
|
153
|
+
).fetchUniqueRow().then(function(result){
|
|
154
|
+
return result.row.number_of_elements;
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
},
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## def-config
|
|
161
|
+
|
|
162
|
+
```js
|
|
163
|
+
/// def-config.ts
|
|
164
|
+
export defConfig=`
|
|
165
|
+
server:
|
|
166
|
+
port: 3000
|
|
167
|
+
base-url: /my-app
|
|
168
|
+
db:
|
|
169
|
+
motor: postgresql
|
|
170
|
+
host: localhost
|
|
171
|
+
database: my_app_db
|
|
172
|
+
user: my_app_user
|
|
173
|
+
install:
|
|
174
|
+
dump:
|
|
175
|
+
db:
|
|
176
|
+
owner: my_app_owner
|
|
177
|
+
client-setup:
|
|
178
|
+
title: My app
|
|
179
|
+
lang: es
|
|
180
|
+
`;
|
|
181
|
+
|
|
182
|
+
/// main.ts
|
|
183
|
+
import {defConfig} from "./def-config"
|
|
184
|
+
|
|
185
|
+
export function emergeMyApp<T extends Constructor<AppBackend>>(Base:T){
|
|
186
|
+
/// ...
|
|
187
|
+
configStaticConfig(){
|
|
188
|
+
super.configStaticConfig();
|
|
189
|
+
this.setStaticConfig(defConfig);
|
|
190
|
+
}
|
|
191
|
+
///...
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
The general application config is setted with `setStaticConfig`.
|
|
197
|
+
Any option can be overwrited in `local-config.yaml` file.
|
|
198
|
+
|
|
199
|
+
`BACKEND_PLUS_LOCAL_CONFIG` enviroment variable can be a `filename.yaml` with more config options.
|
|
200
|
+
|
|
201
|
+
### config format:
|
|
202
|
+
|
|
203
|
+
entry | usage
|
|
204
|
+
-----------------------------|---------------
|
|
205
|
+
server | server level options
|
|
206
|
+
.port | port where it is listening
|
|
207
|
+
.base-url | base url added to domain name
|
|
208
|
+
.module-store | name of the module that stores sessions: file, memory (in devel mode it saves to disk from time to time)
|
|
209
|
+
install | install options
|
|
210
|
+
.table-data-dir | directory or list of directories where the .tabs used by the dump-db command are located (it creates inserts into the local-db-dump.sql file)
|
|
211
|
+
.dump | install dump options
|
|
212
|
+
..db.owner | database owner user
|
|
213
|
+
..scripts.post-adapt | list of file names to adapt the database structure
|
|
214
|
+
..scripts.parts-order | order of the parts in which the dump-db is generated
|
|
215
|
+
devel | set of options for the development and testing environment
|
|
216
|
+
.delay | additional average wait time (to simulate a slow server)
|
|
217
|
+
.cache-content | caches images and files in general (when not in "devel" mode it always caches, the cache can't be turned off outside devel mode)
|
|
218
|
+
.forceShowAsEditable | forces grids to be shown as editable grids to show how the server prevents modification
|
|
219
|
+
.useFileDevelopment | uses the fileDevelopment versions instead of file coming from clientIncludes()
|
|
220
|
+
login | login options
|
|
221
|
+
.plus | options to pass to the login-plus module
|
|
222
|
+
..allowHttpLogin | whether it allows login from HTTP connections
|
|
223
|
+
.table | name of the table where users are validated
|
|
224
|
+
.schema | schema where the users table is located
|
|
225
|
+
.userFieldName | name of the field that contains the user
|
|
226
|
+
.passFieldName | name of the field that contains md5(password+user)
|
|
227
|
+
.rolFieldName | name of the field where the user role is
|
|
228
|
+
.passUpdatedAtFieldName | name of the field where the date of the last password change is stored (optional)
|
|
229
|
+
.passAlgorithmFieldName | name of the field where the password algorithm is stored (optional)
|
|
230
|
+
.infoFieldList | array with the field names that go to the user field
|
|
231
|
+
.activeClausule | SQL boolean expression that determines whether the user is active
|
|
232
|
+
.messages | messages to show on the login screen
|
|
233
|
+
.keepAlive | maximum logged-in duration if only keep-alive messages are received
|
|
234
|
+
.preserve-case | whether it accepts users with uppercase letters
|
|
235
|
+
log | console log
|
|
236
|
+
.req | shows each request
|
|
237
|
+
.session | shows session info
|
|
238
|
+
.serve-content | whether it should log everything served with `serve-content`
|
|
239
|
+
.db | database connection logs
|
|
240
|
+
..last-error | whether it should always log the last error (saved in `last-pg-error-local.sql`)
|
|
241
|
+
..until | whether it should log every executed SQL statement. In `until` you must specify how long since startup (e.g.: '1m30s') or until which day and time (e.g.: '2018-01-20 10:30')
|
|
242
|
+
..on-demand | whether the logging of all executed SQL can be restarted with `URLbase/--log-db`
|
|
243
|
+
..results | whether it includes the results in the log of all SQL
|
|
244
|
+
client-setup | front-end options
|
|
245
|
+
.cursors | (in preparation) tells whether it uses cursors to show where (with the cursor on which record) each user is
|
|
246
|
+
.skin | skin name
|
|
247
|
+
.menu | whether it uses the integrated menus
|
|
248
|
+
.title | screen title
|
|
249
|
+
.lang | frontend language (and locale), for now "es" or "en"
|
|
250
|
+
db | database options
|
|
251
|
+
.motor | for now only 'postgresql'
|
|
252
|
+
.database |
|
|
253
|
+
.tablespace | tablespace where the database is created (only if applicable)
|
|
254
|
+
.user |
|
|
255
|
+
.password |
|
|
256
|
+
.port |
|
|
257
|
+
.schema | main schema where to create the new objects
|
|
258
|
+
.search_path | array of schema names, if not specified `search_path = [schema, 'public']`
|
|
259
|
+
.log-last-error | true if you want the last SQL statement that contained an error to be left in a file (only works if config.devel is specified)
|
|
260
|
+
.allow_double_lodash_fields | whether fields with double `_` underscore are allowed
|
|
261
|
+
imports | options for importing to the platform
|
|
262
|
+
.allow-plain-xls | whether it allows importing xlsx that don't have the #backend-plus signal in cell A1
|
|
263
|
+
|
|
264
|
+
```yaml
|
|
265
|
+
install:
|
|
266
|
+
dump:
|
|
267
|
+
db:
|
|
268
|
+
owner: user_owner
|
|
269
|
+
scripts:
|
|
270
|
+
post-adapt: [special_triggers.sql, other_constraints.sql]
|
|
271
|
+
login:
|
|
272
|
+
plus:
|
|
273
|
+
allowHttpLogin: true
|
|
274
|
+
store:
|
|
275
|
+
module-name: file
|
|
276
|
+
log:
|
|
277
|
+
req: true
|
|
278
|
+
session: true
|
|
279
|
+
devel:
|
|
280
|
+
cache-content: true
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Install
|
|
284
|
+
|
|
285
|
+
```sh
|
|
286
|
+
$ npm install backend-plus
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
## License
|
|
290
|
+
|
|
291
|
+
[MIT](LICENSE)
|
|
292
|
+
|
|
293
|
+
----------------
|
package/lib/backend-plus.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export interface ProcedureDef<T = any> {
|
|
|
43
43
|
encoding?:'JSON4all'|'JSON'|'download'
|
|
44
44
|
multipart?:true
|
|
45
45
|
progress?:true
|
|
46
|
-
files?:{count?:number}
|
|
46
|
+
files?:{count?:number, minCount?:number, maxCount?:number}
|
|
47
47
|
roles?:string[]
|
|
48
48
|
cacheable?:true
|
|
49
49
|
resultOk?:string
|
package/lib/backend-plus.js
CHANGED
|
@@ -47,8 +47,6 @@ pg.log=function log(m){
|
|
|
47
47
|
}
|
|
48
48
|
// */
|
|
49
49
|
|
|
50
|
-
var readYaml = require('read-yaml-promise');
|
|
51
|
-
|
|
52
50
|
var fs = require('fs-extra');
|
|
53
51
|
var fsP = require('fs/promises');
|
|
54
52
|
|
|
@@ -1079,7 +1077,16 @@ AppBackend.prototype.start = function start(opts){
|
|
|
1079
1077
|
const whitelist = ['localhost'].concat(be.config.server.allowedHosts);
|
|
1080
1078
|
const corsOptions = {
|
|
1081
1079
|
origin: function (origin, callback) {
|
|
1082
|
-
if (
|
|
1080
|
+
if (!origin) {
|
|
1081
|
+
return callback(null, true);
|
|
1082
|
+
}
|
|
1083
|
+
var hostname;
|
|
1084
|
+
try{
|
|
1085
|
+
hostname = new URL(origin).hostname;
|
|
1086
|
+
}catch(err){
|
|
1087
|
+
return callback(new Error('Not allowed by CORS'));
|
|
1088
|
+
}
|
|
1089
|
+
if (whitelist.includes(hostname)){
|
|
1083
1090
|
callback(null, true);
|
|
1084
1091
|
}else{
|
|
1085
1092
|
callback(new Error('Not allowed by CORS'));
|
|
@@ -1165,6 +1172,7 @@ AppBackend.prototype.start = function start(opts){
|
|
|
1165
1172
|
name: 'bp'+(packagejson.name+be.config.server["base-url"]||Math.random()).replace(/\//g,'#')+'-connect.sid',
|
|
1166
1173
|
cookie:{
|
|
1167
1174
|
path: be.config.server["base-url"]||'/',
|
|
1175
|
+
sameSite: be.config.login.plus.session?.cookie?.sameSite ?? 'lax',
|
|
1168
1176
|
}
|
|
1169
1177
|
}});
|
|
1170
1178
|
var loginPlusOpts={
|
|
@@ -1582,7 +1590,7 @@ AppBackend.prototype.checkDatabaseStructure = async function checkDatabaseStruct
|
|
|
1582
1590
|
throw new Error('ERROR en la DB: set_app_user no es un PROCEDURE es ' + set_app_user_RoutineType);
|
|
1583
1591
|
}
|
|
1584
1592
|
var message = ''
|
|
1585
|
-
likeAr(AppBackend.prototype.sql_routines).forEach((
|
|
1593
|
+
likeAr(AppBackend.prototype.sql_routines).forEach((def, routine_name) => {
|
|
1586
1594
|
if (sqlRoutines[routine_name] && def.dump.includes(sqlRoutines[routine_name].routine_definition)) {
|
|
1587
1595
|
message += `
|
|
1588
1596
|
----- hay que crear o actualizar la rutina ${routine_name}:
|
|
@@ -1700,8 +1708,8 @@ AppBackend.prototype.addProcedureServices = function addProcedureServices(forUnl
|
|
|
1700
1708
|
return;
|
|
1701
1709
|
}
|
|
1702
1710
|
procedureDef.parameters.forEach(function(paramDef){
|
|
1703
|
-
if(paramDef.
|
|
1704
|
-
throw new Error("plain
|
|
1711
|
+
if(paramDef.encoding==='plain' && (procedureDef.files || procedureDef.multipart)){
|
|
1712
|
+
throw new Error("plain encoding in parameters not allowed in multipart procedure "+procedureDef.action);
|
|
1705
1713
|
}
|
|
1706
1714
|
});
|
|
1707
1715
|
if(!isLowerIdent(procedureDef.action)){
|
|
@@ -1828,16 +1836,16 @@ AppBackend.prototype.addProcedureServices = function addProcedureServices(forUnl
|
|
|
1828
1836
|
files = files.concat(req.files[name]);
|
|
1829
1837
|
}
|
|
1830
1838
|
if(
|
|
1831
|
-
'minCount' in procedureDef.files && files.length<procedureDef.files.minCount
|
|
1839
|
+
'minCount' in procedureDef.files && files.length<procedureDef.files.minCount ||
|
|
1832
1840
|
'count' in procedureDef.files && files.length<procedureDef.files.count
|
|
1833
1841
|
){
|
|
1834
|
-
throw new Error("internal procedure "+procedureDef.action+" error: receiving less than "+procedureDef.files.minCount+" files");
|
|
1842
|
+
throw new Error("internal procedure "+procedureDef.action+" error: receiving less than "+(procedureDef.files.minCount ?? procedureDef.files.count)+" files");
|
|
1835
1843
|
}
|
|
1836
1844
|
if(
|
|
1837
|
-
'maxCount' in procedureDef.files && files.length
|
|
1838
|
-
'count' in procedureDef.files && files.length
|
|
1845
|
+
'maxCount' in procedureDef.files && files.length>procedureDef.files.maxCount ||
|
|
1846
|
+
'count' in procedureDef.files && files.length>procedureDef.files.count
|
|
1839
1847
|
){
|
|
1840
|
-
throw new Error("internal procedure "+procedureDef.action+" error: receiving
|
|
1848
|
+
throw new Error("internal procedure "+procedureDef.action+" error: receiving more than "+(procedureDef.files.maxCount ?? procedureDef.files.count)+" files");
|
|
1841
1849
|
}
|
|
1842
1850
|
}
|
|
1843
1851
|
var context=be.getContext(req);
|
|
@@ -1905,12 +1913,21 @@ AppBackend.prototype.addProcedureServices = function addProcedureServices(forUnl
|
|
|
1905
1913
|
}
|
|
1906
1914
|
res.append('Content-Type', 'application/octet-stream');
|
|
1907
1915
|
return Promise.resolve().then(function(){
|
|
1916
|
+
return be.isThisProcedureAllowed(context,procedureDef,params)
|
|
1917
|
+
}).then(function(allowed){
|
|
1918
|
+
if(!allowed){
|
|
1919
|
+
console.log('FORBIDDEN',procedureDef.action,params.table,context.username);
|
|
1920
|
+
var err = new Error("FORBIDDEN");
|
|
1921
|
+
err.status="403";
|
|
1922
|
+
throw err;
|
|
1923
|
+
}
|
|
1924
|
+
}).then(function(){
|
|
1908
1925
|
var thisCache;
|
|
1909
1926
|
if(procedureDef.cacheable){
|
|
1910
|
-
var
|
|
1911
|
-
thisCache = be.caches.procedures[
|
|
1927
|
+
var cacheKey = procedureDef.action+' '+JSON.stringify(params);
|
|
1928
|
+
thisCache = be.caches.procedures[cacheKey];
|
|
1912
1929
|
if(!thisCache){
|
|
1913
|
-
thisCache = be.caches.procedures[
|
|
1930
|
+
thisCache = be.caches.procedures[cacheKey] = {timestamp:new Date().getTime()};
|
|
1914
1931
|
}
|
|
1915
1932
|
if(thisCache.result !== undefined){
|
|
1916
1933
|
return thisCache.result;
|
|
@@ -1918,15 +1935,6 @@ AppBackend.prototype.addProcedureServices = function addProcedureServices(forUnl
|
|
|
1918
1935
|
}
|
|
1919
1936
|
var keepAliveManager=null;
|
|
1920
1937
|
return Promise.resolve().then(function(){
|
|
1921
|
-
return be.isThisProcedureAllowed(context,procedureDef,params)
|
|
1922
|
-
}).then(function(allowed){
|
|
1923
|
-
if(!allowed){
|
|
1924
|
-
console.log('FORBIDDEN',procedureDef.action,params.table,context.username);
|
|
1925
|
-
var err = new Error("FORBIDDEN");
|
|
1926
|
-
err.code="403";
|
|
1927
|
-
throw err;
|
|
1928
|
-
}
|
|
1929
|
-
}).then(function(){
|
|
1930
1938
|
if(procedureDef.progress && be.config.server["keep-alive"]){
|
|
1931
1939
|
keepAliveManager=setInterval(function(){
|
|
1932
1940
|
res.write(JSON.stringify({progress:{keepAlive:true, ts:new Date().getTime()}})+"\n")
|
|
@@ -2920,6 +2928,10 @@ AppBackend.prototype.validateBitacora = function validateBitacora(procedureDef){
|
|
|
2920
2928
|
|
|
2921
2929
|
AppBackend.prototype.procedureDefCompleter = function procedureDefCompleter(procedureDef){
|
|
2922
2930
|
procedureDef.isCompleted=true;
|
|
2931
|
+
if(procedureDef.unlogged && procedureDef.roles){
|
|
2932
|
+
console.warn('WARNING procedure '+procedureDef.action+' declares roles, unlogged ignored');
|
|
2933
|
+
procedureDef.unlogged=false;
|
|
2934
|
+
}
|
|
2923
2935
|
procedureDef.withFastWindow=procedureDef.withFastWindow||true;
|
|
2924
2936
|
procedureDef.method=procedureDef.method||this.defaultMethod;
|
|
2925
2937
|
procedureDef.encoding=procedureDef.encoding||'JSON4all';
|
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.
|
|
4
|
+
"version": "2.7.0-beta.0",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -36,49 +36,40 @@
|
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@upgraded/locate-path": "^6.0.0-alfa.1",
|
|
38
38
|
"ajax-best-promise": "^0.4.3",
|
|
39
|
-
"
|
|
40
|
-
"best-globals": "^2.2.0",
|
|
39
|
+
"best-globals": "^2.2.2",
|
|
41
40
|
"big.js": "^7.0.1",
|
|
42
41
|
"body-parser": "^2.3.0",
|
|
43
|
-
"cast-error": "^0.1.
|
|
44
|
-
"castellano": "^0.1.
|
|
45
|
-
"connect-pg-simple": "^10.0.0",
|
|
46
|
-
"cookie-parser": "^1.4.7",
|
|
42
|
+
"cast-error": "^0.1.4",
|
|
43
|
+
"castellano": "^0.1.7",
|
|
47
44
|
"cors": "^2.8.6",
|
|
48
45
|
"dialog-promise": "^0.10.7",
|
|
49
|
-
"
|
|
46
|
+
"ensure-login": "^0.1.6-beta.0",
|
|
50
47
|
"express": "^5.2.1",
|
|
51
|
-
"express-
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"js-
|
|
55
|
-
"
|
|
56
|
-
"json4all": "^1.4.2",
|
|
48
|
+
"express-useragent": "^2.2.1",
|
|
49
|
+
"fs-extra": "^11.3.6",
|
|
50
|
+
"js-to-html": "^1.3.6",
|
|
51
|
+
"js-yaml": "^5.2.1",
|
|
52
|
+
"json4all": "^1.4.4",
|
|
57
53
|
"lazy-some": "^0.1.0",
|
|
58
|
-
"like-ar": "^0.5.
|
|
54
|
+
"like-ar": "^0.5.3",
|
|
59
55
|
"login-plus": "^1.8.1",
|
|
60
56
|
"memorystore": "^1.6.8",
|
|
61
|
-
"mini-tools": "^1.13.
|
|
57
|
+
"mini-tools": "^1.13.7",
|
|
62
58
|
"moment": "^2.30.1",
|
|
63
59
|
"multiparty": "^4.3.0",
|
|
64
|
-
"nodemailer": "^9.0.
|
|
60
|
+
"nodemailer": "^9.0.3",
|
|
65
61
|
"numeral": "^2.0.6",
|
|
66
|
-
"pg-promise-strict": "^1.4.
|
|
62
|
+
"pg-promise-strict": "^1.4.6",
|
|
67
63
|
"pg-triggers": "0.4.6",
|
|
68
64
|
"pikaday": "^1.8.2",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"regexplicit": "^0.1.3",
|
|
72
|
-
"require-bro": "^0.3.5",
|
|
73
|
-
"self-explain": "^0.11.0",
|
|
74
|
-
"serve-content": "^1.0.4",
|
|
65
|
+
"require-bro": "^0.3.6",
|
|
66
|
+
"serve-content": "^1.0.5",
|
|
75
67
|
"session-file-store": "^1.5.0",
|
|
76
68
|
"simple-git": "^3.36.0",
|
|
77
69
|
"sql-tools": "^0.1.7",
|
|
78
70
|
"stack-trace": "^1.0.0",
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"typed-controls": "^0.12.4",
|
|
71
|
+
"type-store": "^0.5.2",
|
|
72
|
+
"typed-controls": "^0.12.6",
|
|
82
73
|
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"
|
|
83
74
|
},
|
|
84
75
|
"devDependencies": {
|
|
@@ -90,12 +81,14 @@
|
|
|
90
81
|
"@types/js-yaml": "^4.0.9",
|
|
91
82
|
"@types/mocha": "^10.0.10",
|
|
92
83
|
"@types/multiparty": "~4.2.1",
|
|
93
|
-
"@types/node": "^26.
|
|
84
|
+
"@types/node": "^26.1.0",
|
|
94
85
|
"@types/nodemailer": "^8.0.1",
|
|
95
86
|
"@types/numeral": "~2.0.5",
|
|
96
87
|
"@types/session-file-store": "^1.2.6",
|
|
97
88
|
"@types/stack-trace": "~0.0.33",
|
|
98
89
|
"@types/websql": "~0.0.30",
|
|
90
|
+
"backend-skins": "^0.1.34",
|
|
91
|
+
"discrepances": "^0.2.14",
|
|
99
92
|
"esprima": "^4.0.1",
|
|
100
93
|
"expect.js": "~0.3.1",
|
|
101
94
|
"karma": "6.4.4",
|
|
@@ -107,7 +100,10 @@
|
|
|
107
100
|
"kill-9": "~0.4.3",
|
|
108
101
|
"mocha": "^11.7.6",
|
|
109
102
|
"nyc": "^18.0.0",
|
|
110
|
-
"puppeteer": "^25.
|
|
103
|
+
"puppeteer": "^25.3.0",
|
|
104
|
+
"qa-control": "0.7.5",
|
|
105
|
+
"regexplicit": "^0.1.3",
|
|
106
|
+
"self-explain": "^0.11.0",
|
|
111
107
|
"sinon": "^22.0.0",
|
|
112
108
|
"supertest": "^7.2.2",
|
|
113
109
|
"types.d.ts": "~0.6.22",
|
|
@@ -134,10 +130,12 @@
|
|
|
134
130
|
"prepublish": "(tsc -p tsconfig-server.json || echo \"continue w/error\") && (tsc -p tsconfig-client.json || echo \"continue w/error\")"
|
|
135
131
|
},
|
|
136
132
|
"qa-control": {
|
|
137
|
-
"
|
|
133
|
+
"profile": "minimum",
|
|
138
134
|
"run-in": "server",
|
|
139
135
|
"type": "lib",
|
|
140
|
-
"
|
|
141
|
-
"
|
|
136
|
+
"gha": "all",
|
|
137
|
+
"silenced": [
|
|
138
|
+
"invalid_dependency_version_number_format_in_dep_1"
|
|
139
|
+
]
|
|
142
140
|
}
|
|
143
141
|
}
|
package/unlogged/my-ajax.js
CHANGED
|
@@ -116,7 +116,7 @@ myAjax.readProcedureDefinitions=function readProcedureDefinitions(){
|
|
|
116
116
|
backgroundUrl = 'url("img/background-test.png")';
|
|
117
117
|
}else if(/(^|[-_0-9/])(capa|capacitacion)($|[-_0-9/])/.test(location.pathname)){
|
|
118
118
|
backgroundUrl = 'url("img/background-capa.png")';
|
|
119
|
-
}else if(/(^|[-_0-9/])(desa|devel)($|[-_0-9/])/.test(location.pathname)){
|
|
119
|
+
}else if(/(^|[-_0-9/])(desa|devel)($|[-_0-9/])/.test(location.pathname) || my.config.config && my.config.config['devel']){
|
|
120
120
|
backgroundUrl = 'url("img/background-devel.png")';
|
|
121
121
|
}else{
|
|
122
122
|
backgroundUrl = '';
|