backend-plus 2.7.0-beta.1 → 2.7.0-beta.12
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/css/my-menu.styl +13 -15
- package/for-client/css/my-tables.styl +28 -28
- package/for-client/css/my-things.styl +23 -12
- package/for-client/img/fuentes.txt +1 -1
- package/for-client/login.jade +3 -3
- package/for-client/my-localdb.js +2 -2
- package/for-client/my-localdb.js.map +1 -1
- package/for-client/my-menu.js +9 -9
- package/for-client/my-tables.js +180 -140
- package/for-client/my-things.js +18 -18
- package/for-client/my-websqldb.js +1 -1
- package/for-client/my-websqldb.js.map +1 -1
- package/for-client/new-password-result.jade +2 -2
- package/install/semver_to_decimal-fun.sql +1 -1
- package/lib/backend-plus.d.ts +51 -36
- package/lib/backend-plus.js +204 -124
- package/lib/in-backend-plus.d.ts +1 -1
- package/lib/my-debugger.js +2 -2
- package/lib/procedures-table.js +47 -31
- package/lib/table-def-adapt.js +5 -5
- package/lib/table-mixin.js +0 -2
- package/lib/tables/table-locks.js +1 -1
- package/lib/tables/table-tokens.js +1 -1
- package/package.json +35 -29
- package/src/for-client/my-localdb.ts +15 -15
- package/src/for-client/my-websqldb.ts +5 -5
- package/src/test/karma-test-localdb.ts +2 -2
- package/unlogged/auto-login.js +1 -1
- package/unlogged/compatibilidad.js +2 -2
- package/unlogged/css/chpass.styl +6 -6
- package/unlogged/css/login.styl +4 -4
- package/unlogged/globals.d.ts +1 -1
- package/unlogged/my-ajax.js +20 -20
- package/unlogged/my-start.js +1 -1
package/lib/in-backend-plus.d.ts
CHANGED
package/lib/my-debugger.js
CHANGED
package/lib/procedures-table.js
CHANGED
|
@@ -13,6 +13,9 @@ const bestGlobals = require('best-globals');
|
|
|
13
13
|
|
|
14
14
|
const PANIC_IMPORT = true;
|
|
15
15
|
|
|
16
|
+
/** @import { TableDefinitionInternal, ProcedureContext } from './in-backend-plus' */
|
|
17
|
+
|
|
18
|
+
|
|
16
19
|
var ProcedureTables;
|
|
17
20
|
|
|
18
21
|
/** @type {<T>(x:T)=>NonNullable<T>} */
|
|
@@ -21,6 +24,9 @@ var notnull = x =>{
|
|
|
21
24
|
return x;
|
|
22
25
|
};
|
|
23
26
|
|
|
27
|
+
/**
|
|
28
|
+
* @param {any} mmm
|
|
29
|
+
*/
|
|
24
30
|
function inlineLog(mmm){ console.log(mmm); return mmm; }
|
|
25
31
|
|
|
26
32
|
ProcedureTables = [
|
|
@@ -45,7 +51,7 @@ ProcedureTables = [
|
|
|
45
51
|
insert:true,
|
|
46
52
|
}});
|
|
47
53
|
}
|
|
48
|
-
if(struct.JSONFieldForOtherFields){
|
|
54
|
+
if(struct.JSONFieldForOtherFields){
|
|
49
55
|
var registerImports = struct.registerImports;
|
|
50
56
|
if(registerImports.inTable && registerImports.fieldNames.tableName && registerImports.fieldNames.fieldName){
|
|
51
57
|
return context.client.query(
|
|
@@ -83,9 +89,9 @@ ProcedureTables = [
|
|
|
83
89
|
],
|
|
84
90
|
coreFunction:
|
|
85
91
|
/**
|
|
86
|
-
*
|
|
87
|
-
* @param {*} context
|
|
88
|
-
* @param {{table:string, fixedFields:{fieldName:string, value:any, range?:string, until?:string}[], paramfun:string[], pick:string, retrieveIgnoringWhere:boolean}} parameters
|
|
92
|
+
*
|
|
93
|
+
* @param {*} context
|
|
94
|
+
* @param {{table:string, fixedFields:{fieldName:string, value:any, range?:string, until?:string}[], paramfun:string[], pick:string, retrieveIgnoringWhere:boolean}} parameters
|
|
89
95
|
*/
|
|
90
96
|
async function tableDatum(context, parameters){
|
|
91
97
|
var be=context.be;
|
|
@@ -167,7 +173,7 @@ ProcedureTables = [
|
|
|
167
173
|
var line = likeAr(row).join(' ').trim().split(/\s+/);
|
|
168
174
|
return pickParts.every(palabraBuscada =>
|
|
169
175
|
line.map(p => bestGlobals.hyperSimplifyText(p)).filter(palabra =>
|
|
170
|
-
palabraBuscada.length <= 3
|
|
176
|
+
palabraBuscada.length <= 3
|
|
171
177
|
? palabra == palabraBuscada
|
|
172
178
|
: palabra.includes(palabraBuscada)
|
|
173
179
|
).length
|
|
@@ -189,9 +195,18 @@ ProcedureTables = [
|
|
|
189
195
|
{name: 'oldRow'},
|
|
190
196
|
{name: 'status', encoding:'plain'},
|
|
191
197
|
],
|
|
198
|
+
/**
|
|
199
|
+
*
|
|
200
|
+
* @param {ProcedureContext} context
|
|
201
|
+
* @param {*} parameters
|
|
202
|
+
* @param {*} files
|
|
203
|
+
* @param {*} opts
|
|
204
|
+
* @returns
|
|
205
|
+
*/
|
|
192
206
|
coreFunction:async function(context, parameters, files, opts){
|
|
193
207
|
var be=context.be;
|
|
194
208
|
var mainDefTable=be.tableStructures[parameters.table](context);
|
|
209
|
+
/** @type {'insert'|'update'} */
|
|
195
210
|
var action=parameters.status=='new'?'insert':'update';
|
|
196
211
|
if(!mainDefTable.allow[action] && (!opts || !opts.forImport)){
|
|
197
212
|
throw changing(new Error(action+" not allowed"),{status:403});
|
|
@@ -214,7 +229,7 @@ ProcedureTables = [
|
|
|
214
229
|
throw new Error("field "+name+" does not exist in "+mainDefTable.name);
|
|
215
230
|
}
|
|
216
231
|
if(!defField.allow[action] && (!opts || !opts.forImport) && (
|
|
217
|
-
!defField.isPk ||
|
|
232
|
+
!defField.isPk ||
|
|
218
233
|
parameters.primaryKeyValues[defField.isPk-1]!=parameters.newRow[name]
|
|
219
234
|
)){
|
|
220
235
|
throw changing(new Error(action+" not allowed for "+name),{status:403});
|
|
@@ -254,6 +269,7 @@ ProcedureTables = [
|
|
|
254
269
|
var updates = updatesOthers.filter(u => !u.defTable.saveAfter)
|
|
255
270
|
.concat(plainUpdate.values.length?[changing({defTable:mainDefTable,main:true},plainUpdate)]:[])
|
|
256
271
|
.concat(updatesOthers.filter(u => u.defTable.saveAfter));
|
|
272
|
+
/** @type {Record<string, any>} */
|
|
257
273
|
var globalPrimaryKeyValue={}
|
|
258
274
|
mainDefTable.primaryKey.forEach(function(name,i){
|
|
259
275
|
globalPrimaryKeyValue[name]=parameters.primaryKeyValues[i];
|
|
@@ -310,7 +326,7 @@ ProcedureTables = [
|
|
|
310
326
|
primaryKeyValuesForUpdate[i]=value;
|
|
311
327
|
}
|
|
312
328
|
if(!fieldNames4Insert.includes(name) && value != null && defField.inTable !== false){
|
|
313
|
-
fieldNames4Insert.push(name);
|
|
329
|
+
fieldNames4Insert.push(name);
|
|
314
330
|
values4Insert.push(value);
|
|
315
331
|
}
|
|
316
332
|
});
|
|
@@ -398,7 +414,7 @@ ProcedureTables = [
|
|
|
398
414
|
mainResult=result;
|
|
399
415
|
}
|
|
400
416
|
}
|
|
401
|
-
if((!mainDefTable || parameters.status!='new')
|
|
417
|
+
if((!mainDefTable || parameters.status!='new')
|
|
402
418
|
&& (!mainDefTable || parameters.primaryKeyValues.length!=mainDefTable.primaryKey.length)
|
|
403
419
|
&& (parameters.masive && parameters.primaryKeyValues.length>0)
|
|
404
420
|
){
|
|
@@ -548,7 +564,7 @@ ProcedureTables = [
|
|
|
548
564
|
function(tableDef){
|
|
549
565
|
return be.procedure.table_data.coreFunction(
|
|
550
566
|
context,{
|
|
551
|
-
table: tableDef.name,
|
|
567
|
+
table: tableDef.name,
|
|
552
568
|
fixedFields:fixedFields
|
|
553
569
|
}
|
|
554
570
|
)
|
|
@@ -580,7 +596,7 @@ ProcedureTables = [
|
|
|
580
596
|
promiseChain=promiseChain.then(function(){
|
|
581
597
|
return be.procedure.table_record_save.coreFunction(
|
|
582
598
|
context,{
|
|
583
|
-
table: 'locks',
|
|
599
|
+
table: 'locks',
|
|
584
600
|
primaryKeyValues,
|
|
585
601
|
newRow,
|
|
586
602
|
oldRow:[],
|
|
@@ -689,7 +705,7 @@ ProcedureTables = [
|
|
|
689
705
|
).fetchOneRowIfExists().then(function(result){
|
|
690
706
|
return 'ok';
|
|
691
707
|
});
|
|
692
|
-
|
|
708
|
+
|
|
693
709
|
}
|
|
694
710
|
},
|
|
695
711
|
{
|
|
@@ -771,8 +787,8 @@ ProcedureTables = [
|
|
|
771
787
|
otherFieldNames.push({index: iColumn, name: fieldName});
|
|
772
788
|
fields.push(changing(tableDef.JSONFieldForOtherFields,{iColumn:iColumn}));
|
|
773
789
|
}
|
|
774
|
-
if(defField &&
|
|
775
|
-
defField.inTable!==false &&
|
|
790
|
+
if(defField &&
|
|
791
|
+
defField.inTable!==false &&
|
|
776
792
|
(defField.allow.import || defField.allow.insert && (defField.allow.update || defField.isPk)) &&
|
|
777
793
|
(!defField.clientSide || defField.serverSide)
|
|
778
794
|
){
|
|
@@ -781,18 +797,18 @@ ProcedureTables = [
|
|
|
781
797
|
}
|
|
782
798
|
};
|
|
783
799
|
var addFieldToOthers = function addFieldToOthers(othersArray, field, value){
|
|
784
|
-
var otherFieldName = otherFieldNames.find(function findOtherFieldName(aux) {
|
|
800
|
+
var otherFieldName = otherFieldNames.find(function findOtherFieldName(aux) {
|
|
785
801
|
return aux.index === field.iColumn;
|
|
786
802
|
});
|
|
787
803
|
if(otherFieldName){
|
|
788
|
-
var index = othersArray.findIndex(function findIndexForOtherFieldName(aux) {
|
|
804
|
+
var index = othersArray.findIndex(function findIndexForOtherFieldName(aux) {
|
|
789
805
|
return aux.name === otherFieldName.name
|
|
790
806
|
});
|
|
791
|
-
var row = {name: otherFieldName.name, index: otherFieldName.index, value: value || ''};
|
|
807
|
+
var row = {name: otherFieldName.name, index: otherFieldName.index, value: value || ''};
|
|
792
808
|
if(index == -1){
|
|
793
|
-
othersArray.push(row);
|
|
809
|
+
othersArray.push(row);
|
|
794
810
|
}else{
|
|
795
|
-
othersArray[index] = row;
|
|
811
|
+
othersArray[index] = row;
|
|
796
812
|
}
|
|
797
813
|
}
|
|
798
814
|
};
|
|
@@ -938,7 +954,7 @@ ProcedureTables = [
|
|
|
938
954
|
if(field.defaultForOtherFields){
|
|
939
955
|
addFieldToOthers(othersArray, field, value);
|
|
940
956
|
}else{
|
|
941
|
-
newRow[field.name]=value;
|
|
957
|
+
newRow[field.name]=value;
|
|
942
958
|
}
|
|
943
959
|
}
|
|
944
960
|
};
|
|
@@ -1014,7 +1030,7 @@ ProcedureTables = [
|
|
|
1014
1030
|
}
|
|
1015
1031
|
for(let field of fields){
|
|
1016
1032
|
var value = newRow[field.name];
|
|
1017
|
-
var prefilledField = parameters.prefilledFields.find(function findPrefilledfield(aux) {
|
|
1033
|
+
var prefilledField = parameters.prefilledFields.find(function findPrefilledfield(aux) {
|
|
1018
1034
|
return aux.fieldName === field.name;
|
|
1019
1035
|
});
|
|
1020
1036
|
if(prefilledField && prefilledField.value != value){
|
|
@@ -1054,7 +1070,7 @@ ProcedureTables = [
|
|
|
1054
1070
|
var result = await be.procedure[procedure].coreFunction(
|
|
1055
1071
|
context,
|
|
1056
1072
|
{
|
|
1057
|
-
table: parameters.table,
|
|
1073
|
+
table: parameters.table,
|
|
1058
1074
|
primaryKeyValues,
|
|
1059
1075
|
newRow,
|
|
1060
1076
|
oldRow:[],
|
|
@@ -1098,7 +1114,7 @@ ProcedureTables = [
|
|
|
1098
1114
|
lineNumber++;
|
|
1099
1115
|
};
|
|
1100
1116
|
if(tableDef.registerImports.inTable){
|
|
1101
|
-
var otherFieldsTableDef = be.tableStructures[tableDef.registerImports.inTable](context);
|
|
1117
|
+
var otherFieldsTableDef = be.tableStructures[tableDef.registerImports.inTable](context);
|
|
1102
1118
|
var timestamp = datetime.now();
|
|
1103
1119
|
var fieldNames = tableDef.registerImports.fieldNames;
|
|
1104
1120
|
for(let otherField of otherFieldNames){
|
|
@@ -1115,7 +1131,7 @@ ProcedureTables = [
|
|
|
1115
1131
|
};
|
|
1116
1132
|
await be.procedure[procedure].coreFunction(
|
|
1117
1133
|
context,{
|
|
1118
|
-
table: otherFieldsTableDef.name,
|
|
1134
|
+
table: otherFieldsTableDef.name,
|
|
1119
1135
|
primaryKeyValues,
|
|
1120
1136
|
newRow,
|
|
1121
1137
|
oldRow:[],
|
|
@@ -1195,7 +1211,7 @@ ProcedureTables = [
|
|
|
1195
1211
|
var cache={}
|
|
1196
1212
|
allCache[row.name]=cache;
|
|
1197
1213
|
for(var j=0; j<summaryDef.fields.length; j++){ var fieldDef=summaryDef.fields[j];
|
|
1198
|
-
if(fieldDef.summary
|
|
1214
|
+
if(fieldDef.summary
|
|
1199
1215
|
&& (!fieldDef.summary.types4 || fieldDef.summary.types4.includes(row.data_type))
|
|
1200
1216
|
&& (!fieldDef.summary.excludeTypes || !fieldDef.summary.excludeTypes.includes(row.data_type))
|
|
1201
1217
|
){
|
|
@@ -1247,12 +1263,12 @@ ProcedureTables = [
|
|
|
1247
1263
|
}
|
|
1248
1264
|
var tableDef = be.tableStructures[parameters.tableName](context);
|
|
1249
1265
|
var pk = likeAr.toPlainObject(tableDef.primaryKey, parameters.primaryKeyValues)
|
|
1250
|
-
var result = await client.query(`select
|
|
1251
|
-
cha_new_value as valor,
|
|
1266
|
+
var result = await client.query(`select
|
|
1267
|
+
cha_new_value as valor,
|
|
1252
1268
|
cha_when as cuando,
|
|
1253
1269
|
split_part(cha_context,' ',1) as quien
|
|
1254
1270
|
from his.changes
|
|
1255
|
-
where cha_table = $1
|
|
1271
|
+
where cha_table = $1
|
|
1256
1272
|
and cha_column = $2
|
|
1257
1273
|
and cha_new_pk = ${context.be.db.quoteLiteral(JSON.stringify(pk))}
|
|
1258
1274
|
order by cha_when desc
|
|
@@ -1302,10 +1318,10 @@ ProcedureTables = [
|
|
|
1302
1318
|
})
|
|
1303
1319
|
var zip = spawn(be.config.server.bin.zip ?? 'zip',[
|
|
1304
1320
|
...(be.config.server.bin["zip-fixed-parameters"] ?? []),
|
|
1305
|
-
...(be.config.server.bin["zip-password-parameter-flag"] === false ? [] : [be.config.server.bin["zip-password-parameter-flag"] ?? '--password']),
|
|
1306
|
-
`${be.config.server.bin["zip-password-prefix"] ?? ''}${parameters.encrypt}` ,
|
|
1307
|
-
'./local-private/backup-db.zip',
|
|
1308
|
-
path
|
|
1321
|
+
...(be.config.server.bin["zip-password-parameter-flag"] === false ? [] : [be.config.server.bin["zip-password-parameter-flag"] ?? '--password']),
|
|
1322
|
+
`${be.config.server.bin["zip-password-prefix"] ?? ''}${parameters.encrypt}` ,
|
|
1323
|
+
'./local-private/backup-db.zip',
|
|
1324
|
+
path
|
|
1309
1325
|
], {stdio: [out, out, out]});
|
|
1310
1326
|
var code = await new Promise((resolve, reject) => {
|
|
1311
1327
|
zip.on('data', chunk => out.write(chunk));
|
package/lib/table-def-adapt.js
CHANGED
|
@@ -13,8 +13,8 @@ function completeEditablesProperties(def,defaultValue,otherAllow){
|
|
|
13
13
|
['insert','delete','update','select'].forEach(function(actionName){
|
|
14
14
|
if(!(actionName in def.allow)){
|
|
15
15
|
def.allow[actionName] = (
|
|
16
|
-
actionName!=='select' && 'editable' in def ?
|
|
17
|
-
!!def.editable :
|
|
16
|
+
actionName!=='select' && 'editable' in def ?
|
|
17
|
+
!!def.editable :
|
|
18
18
|
(actionName in otherAllow?otherAllow[actionName]:defaultValue)
|
|
19
19
|
);
|
|
20
20
|
}
|
|
@@ -72,7 +72,7 @@ function tableDefAdapt(tableDef, context){
|
|
|
72
72
|
},
|
|
73
73
|
refrescable: false
|
|
74
74
|
},tableDef);
|
|
75
|
-
var JSONFieldForOtherFields = tableDef.fields.filter(function findDefaultForOthers(field) {
|
|
75
|
+
var JSONFieldForOtherFields = tableDef.fields.filter(function findDefaultForOthers(field) {
|
|
76
76
|
return field.defaultForOtherFields === true;
|
|
77
77
|
});
|
|
78
78
|
if(JSONFieldForOtherFields.length === 0){
|
|
@@ -224,7 +224,7 @@ function tableDefAdapt(tableDef, context){
|
|
|
224
224
|
resultTableDef.sql.originalFrom = resultTableDef.sql.from;
|
|
225
225
|
resultTableDef.sql.from = (resultTableDef.sql.from || (
|
|
226
226
|
be.db.quoteIdent(resultTableDef.tableName)+(resultTableDef.functionDef?
|
|
227
|
-
'('+resultTableDef.functionDef.parameters.map(function(x,i){return '$'+(i+1);}).join(',')+')'
|
|
227
|
+
'('+resultTableDef.functionDef.parameters.map(function(x,i){return '$'+(i+1);}).join(',')+')'
|
|
228
228
|
:'')
|
|
229
229
|
));
|
|
230
230
|
if(resultTableDef.sql.from.endsWith(' x')){
|
|
@@ -362,4 +362,4 @@ tableDefAdapt.forInsertOnly = function forInsertOnly(tableDef){
|
|
|
362
362
|
}
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
module.exports = tableDefAdapt;
|
|
365
|
+
module.exports = tableDefAdapt;
|
package/lib/table-mixin.js
CHANGED
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.7.0-beta.
|
|
4
|
+
"version": "2.7.0-beta.12",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -29,84 +29,90 @@
|
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
31
|
"overrides": {
|
|
32
|
-
"diff": "
|
|
33
|
-
"serialize-javascript": "
|
|
34
|
-
"
|
|
32
|
+
"diff": ">=8.0.2",
|
|
33
|
+
"serialize-javascript": ">=7.0.0",
|
|
34
|
+
"stylus": {
|
|
35
|
+
"glob": "^11"
|
|
36
|
+
},
|
|
37
|
+
"uuid": ">=14.0.0"
|
|
35
38
|
},
|
|
36
39
|
"dependencies": {
|
|
37
40
|
"@upgraded/locate-path": "^6.0.0-alfa.1",
|
|
38
|
-
"ajax-best-promise": "^0.4.
|
|
41
|
+
"ajax-best-promise": "^0.4.5",
|
|
39
42
|
"best-globals": "^2.2.2",
|
|
40
43
|
"big.js": "^7.0.1",
|
|
41
44
|
"body-parser": "^2.3.0",
|
|
42
|
-
"cast-error": "^0.1.
|
|
45
|
+
"cast-error": "^0.1.5",
|
|
43
46
|
"castellano": "^0.1.7",
|
|
44
47
|
"cors": "^2.8.6",
|
|
45
48
|
"dialog-promise": "^0.10.7",
|
|
46
|
-
"ensure-login": "^0.1.6
|
|
49
|
+
"ensure-login": "^0.1.6",
|
|
47
50
|
"express": "^5.2.1",
|
|
48
51
|
"express-useragent": "^2.2.1",
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
"js-
|
|
52
|
+
"fflate": "^0.8.3",
|
|
53
|
+
"fs-extra": "^11.4.0",
|
|
54
|
+
"js-to-html": "^1.4.0",
|
|
55
|
+
"js-yaml": "^5.2.3",
|
|
52
56
|
"json4all": "^1.4.4",
|
|
53
57
|
"lazy-some": "^0.1.0",
|
|
54
58
|
"like-ar": "^0.5.3",
|
|
55
|
-
"login-plus": "^1.9.0
|
|
59
|
+
"login-plus": "^1.9.0",
|
|
56
60
|
"memorystore": "^1.6.8",
|
|
57
|
-
"mini-tools": "^1.13.
|
|
61
|
+
"mini-tools": "^1.13.10",
|
|
58
62
|
"moment": "^2.30.1",
|
|
59
63
|
"multiparty": "^4.3.0",
|
|
60
64
|
"nodemailer": "^9.0.3",
|
|
61
65
|
"numeral": "^2.0.6",
|
|
62
|
-
"pg-promise-strict": "^1.
|
|
66
|
+
"pg-promise-strict": "^1.5.0",
|
|
63
67
|
"pg-triggers": "0.4.6",
|
|
64
68
|
"pikaday": "^1.8.2",
|
|
65
|
-
"require-bro": "^0.
|
|
66
|
-
"serve-content": "^1.0.
|
|
69
|
+
"require-bro": "^0.4.0",
|
|
70
|
+
"serve-content": "^1.0.6",
|
|
67
71
|
"session-file-store": "^1.5.0",
|
|
68
72
|
"simple-git": "^3.36.0",
|
|
69
73
|
"sql-tools": "^0.1.7",
|
|
70
74
|
"stack-trace": "^1.0.0",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
73
|
-
"
|
|
75
|
+
"tab-plus": "^0.1.8",
|
|
76
|
+
"type-store": "^0.6.0",
|
|
77
|
+
"typed-controls": "^0.12.7",
|
|
78
|
+
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz",
|
|
79
|
+
"xlsx-now": "^0.2.1"
|
|
74
80
|
},
|
|
75
81
|
"devDependencies": {
|
|
76
82
|
"@types/big.js": "^7.0.0",
|
|
77
|
-
"@types/expect.js": "
|
|
83
|
+
"@types/expect.js": "^0.3.32",
|
|
78
84
|
"@types/express": "^5.0.6",
|
|
79
85
|
"@types/express-useragent": "^1.0.5",
|
|
80
86
|
"@types/fs-extra": "^11.0.4",
|
|
81
87
|
"@types/js-yaml": "^4.0.9",
|
|
82
88
|
"@types/mocha": "^10.0.10",
|
|
83
|
-
"@types/multiparty": "
|
|
84
|
-
"@types/node": "^26.1.
|
|
89
|
+
"@types/multiparty": "^4.2.1",
|
|
90
|
+
"@types/node": "^26.1.2",
|
|
85
91
|
"@types/nodemailer": "^8.0.1",
|
|
86
92
|
"@types/numeral": "~2.0.5",
|
|
87
93
|
"@types/session-file-store": "^1.2.6",
|
|
88
|
-
"@types/stack-trace": "
|
|
94
|
+
"@types/stack-trace": "^0.0.33",
|
|
89
95
|
"@types/websql": "~0.0.30",
|
|
90
96
|
"backend-skins": "^0.1.34",
|
|
91
97
|
"discrepances": "^0.2.14",
|
|
92
98
|
"esprima": "^4.0.1",
|
|
93
|
-
"expect.js": "
|
|
99
|
+
"expect.js": "^0.3.1",
|
|
94
100
|
"karma": "6.4.4",
|
|
95
101
|
"karma-chrome-launcher": "^3.2.0",
|
|
96
102
|
"karma-expect": "^1.1.3",
|
|
97
103
|
"karma-firefox-launcher": "^2.1.3",
|
|
98
104
|
"karma-ie-launcher": "^1.0.0",
|
|
99
105
|
"karma-mocha": "^2.0.1",
|
|
100
|
-
"kill-9": "
|
|
101
|
-
"mocha": "^
|
|
106
|
+
"kill-9": "^0.4.3",
|
|
107
|
+
"mocha": "^12.0.0-rc.5",
|
|
102
108
|
"nyc": "^18.0.0",
|
|
103
|
-
"puppeteer": "^25.
|
|
104
|
-
"qa-control": "0.
|
|
109
|
+
"puppeteer": "^25.4.0",
|
|
110
|
+
"qa-control": "0.9.2",
|
|
105
111
|
"regexplicit": "^0.1.3",
|
|
106
112
|
"self-explain": "^0.11.0",
|
|
107
|
-
"sinon": "^22.
|
|
113
|
+
"sinon": "^22.1.0",
|
|
108
114
|
"supertest": "^7.2.2",
|
|
109
|
-
"types.d.ts": "
|
|
115
|
+
"types.d.ts": "^0.6.22",
|
|
110
116
|
"typescript": "^5.9.3",
|
|
111
117
|
"why-is-node-running": "^3.2.2"
|
|
112
118
|
},
|
|
@@ -17,18 +17,18 @@
|
|
|
17
17
|
* https://caniuse.com/#feat=indexeddb ocurren dos cosas trágicas:
|
|
18
18
|
* 1) en IE y EDGE no hay claves de tipo array
|
|
19
19
|
* 2) en iOS de 8 a 9.3 hay un error que no permite que en dos objetos distintos haya una misma Pk
|
|
20
|
-
*
|
|
20
|
+
*
|
|
21
21
|
* más explicaciones en:
|
|
22
22
|
* 1) https://stackoverflow.com/questions/14283257/dataerror-when-creating-an-index-with-a-compound-key-in-ie-10
|
|
23
23
|
* 2) https://www.raymondcamden.com/2014/09/25/IndexedDB-on-iOS-8-Broken-Bad/
|
|
24
|
-
*
|
|
24
|
+
*
|
|
25
25
|
* hay un test en:
|
|
26
26
|
* a) https://codepen.io/cemerick/pen/Itymi
|
|
27
|
-
*
|
|
27
|
+
*
|
|
28
28
|
* workarround para contemplar IE, y iOS viejos:
|
|
29
29
|
* 1) se transforman las claves antes de usarlas en un string (JSON.stringify del array para el problema del IE)
|
|
30
30
|
* 2) se prefija el string con el nombre del objectStore (para que todas las claves sean distintas y no haya problemas con el iOS viejo)
|
|
31
|
-
*
|
|
31
|
+
*
|
|
32
32
|
* detección
|
|
33
33
|
* 1) por ahora solo probamos la detección del problema del array de claves
|
|
34
34
|
* 2) TODO: Falta programar la detección del problema de iOS viejo, quizás haya que ser explícito, hay que probarlo con varios iPad
|
|
@@ -49,11 +49,11 @@ export interface TableDefinition{
|
|
|
49
49
|
foreignKeys?:ForeignKey[]
|
|
50
50
|
softForeignKeys?:ForeignKey[]
|
|
51
51
|
fields:FieldDefinition[]
|
|
52
|
-
}
|
|
52
|
+
}
|
|
53
53
|
|
|
54
54
|
type VersionInfo = {
|
|
55
55
|
var:'version',
|
|
56
|
-
num:1,
|
|
56
|
+
num:1,
|
|
57
57
|
timestamp:string,
|
|
58
58
|
stores:StoreDefs
|
|
59
59
|
}
|
|
@@ -80,7 +80,7 @@ export class LocalDb{
|
|
|
80
80
|
};
|
|
81
81
|
var initialVersionInfo:VersionInfo={
|
|
82
82
|
var:'version',
|
|
83
|
-
num:1,
|
|
83
|
+
num:1,
|
|
84
84
|
timestamp:new Date().toJSON(),
|
|
85
85
|
stores:initialStores
|
|
86
86
|
}
|
|
@@ -137,7 +137,7 @@ export class LocalDb{
|
|
|
137
137
|
var wait4dbCurrent=this.wait4db;
|
|
138
138
|
var registerTask=this.registerStructureInside(tableDef, wait4dbCurrent);
|
|
139
139
|
this.wait4db = registerTask.then(result=>result.wait4db);
|
|
140
|
-
var result=await registerTask;
|
|
140
|
+
var result=await registerTask;
|
|
141
141
|
return result.result;
|
|
142
142
|
}
|
|
143
143
|
async detectFeatures(store:IDBObjectStore):Promise<DetectFeatures>{
|
|
@@ -252,7 +252,7 @@ export class LocalDb{
|
|
|
252
252
|
var db=await ldb.wait4db
|
|
253
253
|
var rows:T[]=[];
|
|
254
254
|
var internalKey:string|Key;
|
|
255
|
-
|
|
255
|
+
|
|
256
256
|
if(detectedFeatures.needToUnwrapArrayKeys){
|
|
257
257
|
internalKey=tableName+JSON.stringify(parentKey);
|
|
258
258
|
internalKey=internalKey.substr(0,internalKey.length-1);
|
|
@@ -265,8 +265,8 @@ export class LocalDb{
|
|
|
265
265
|
// @ts-ignore target no conoce result en la definición de TS. Verificar dentro de un tiempo si TS mejoró
|
|
266
266
|
var cursor:IDBCursorWithValue = event.target.result;
|
|
267
267
|
if(cursor && ((parentKey == null) || (
|
|
268
|
-
detectedFeatures.needToUnwrapArrayKeys ?
|
|
269
|
-
internalKey == (cursor.key as string).slice(0,internalKey.length) :
|
|
268
|
+
detectedFeatures.needToUnwrapArrayKeys ?
|
|
269
|
+
internalKey == (cursor.key as string).slice(0,internalKey.length) :
|
|
270
270
|
! parentKey.find(function(expectedValue,i){
|
|
271
271
|
var storedValue = (cursor.key as any[])[i]
|
|
272
272
|
return expectedValue != storedValue
|
|
@@ -359,7 +359,7 @@ export class LocalDb{
|
|
|
359
359
|
var ldb=this;
|
|
360
360
|
var db=await ldb.wait4db
|
|
361
361
|
var tableDef=await ldb.getStructure(tableName);
|
|
362
|
-
|
|
362
|
+
|
|
363
363
|
var transaction=db.transaction(tableName,"readwrite");
|
|
364
364
|
var objectStore=transaction.objectStore(tableName);
|
|
365
365
|
var i = 0;
|
|
@@ -378,7 +378,7 @@ export class LocalDb{
|
|
|
378
378
|
}else{
|
|
379
379
|
return Promise.resolve();
|
|
380
380
|
}
|
|
381
|
-
}
|
|
381
|
+
}
|
|
382
382
|
}
|
|
383
383
|
async close():Promise<void>{
|
|
384
384
|
var db=await this.wait4db;
|
|
@@ -414,12 +414,12 @@ export class LocalDbTransaction {
|
|
|
414
414
|
try{
|
|
415
415
|
await ldb.close();
|
|
416
416
|
if(previousError){
|
|
417
|
-
// @ts-ignore
|
|
417
|
+
// @ts-ignore
|
|
418
418
|
previousError.ldbWasClosed=true;
|
|
419
419
|
}
|
|
420
420
|
}catch(errClose){
|
|
421
421
|
if(previousError){
|
|
422
|
-
// @ts-ignore
|
|
422
|
+
// @ts-ignore
|
|
423
423
|
previousError.ldbWasNotClosedBecause=errClose;
|
|
424
424
|
}else{
|
|
425
425
|
throw errClose;
|
|
@@ -194,7 +194,7 @@ export class WebsqlDb{
|
|
|
194
194
|
notSupportedFields.forEach(function(notSupportedField){
|
|
195
195
|
var fieldName = notSupportedField.name;
|
|
196
196
|
row[fieldName]=JSON.parse(row[fieldName]);
|
|
197
|
-
})
|
|
197
|
+
})
|
|
198
198
|
}
|
|
199
199
|
})
|
|
200
200
|
return records
|
|
@@ -207,7 +207,7 @@ export class WebsqlDb{
|
|
|
207
207
|
}
|
|
208
208
|
}
|
|
209
209
|
async getOne<T>(tableName:string, key:Key, ignoreDetectFeatures?:boolean):Promise<T>{
|
|
210
|
-
ignoreDetectFeatures=ignoreDetectFeatures||false;
|
|
210
|
+
ignoreDetectFeatures=ignoreDetectFeatures||false;
|
|
211
211
|
var tableDef = await this.getStructure(tableName);
|
|
212
212
|
var jsonbFields = this.getNotSupportedFields(tableDef);
|
|
213
213
|
var fieldNames=tableDef.primaryKey;
|
|
@@ -215,8 +215,8 @@ export class WebsqlDb{
|
|
|
215
215
|
fieldNames.forEach(function(fieldName, i){
|
|
216
216
|
whereExpr.push(fieldName + '=' + SqlTools.quoteLiteral(key[i]))
|
|
217
217
|
})
|
|
218
|
-
var sql =
|
|
219
|
-
`SELECT *
|
|
218
|
+
var sql =
|
|
219
|
+
`SELECT *
|
|
220
220
|
from `+SqlTools.quoteIdent(tableName)+`
|
|
221
221
|
where ` + whereExpr.join(' and ');
|
|
222
222
|
var result = await this.executeQuery(sql,[]);
|
|
@@ -347,7 +347,7 @@ export class WebsqlDb{
|
|
|
347
347
|
}
|
|
348
348
|
async close():Promise<void>{
|
|
349
349
|
//TODO
|
|
350
|
-
return Promise.resolve()
|
|
350
|
+
return Promise.resolve()
|
|
351
351
|
}
|
|
352
352
|
async clear(tableName:string):Promise<void>{
|
|
353
353
|
await this.executeQuery(
|
|
@@ -301,7 +301,7 @@ describe("websql-db", function(){
|
|
|
301
301
|
})
|
|
302
302
|
})
|
|
303
303
|
});
|
|
304
|
-
|
|
304
|
+
|
|
305
305
|
|
|
306
306
|
//
|
|
307
307
|
//describe("local-db-transaction", function(){
|
|
@@ -378,4 +378,4 @@ describe("websql-db", function(){
|
|
|
378
378
|
// compare(tableDef3,registeredStructs[2]);
|
|
379
379
|
// });
|
|
380
380
|
// });
|
|
381
|
-
//});
|
|
381
|
+
//});
|
package/unlogged/auto-login.js
CHANGED
package/unlogged/css/chpass.styl
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
body
|
|
2
2
|
font-size 120%
|
|
3
3
|
font-family arial, sans-serif
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
input
|
|
6
6
|
font-size 100%
|
|
7
7
|
|
|
@@ -10,12 +10,12 @@ input
|
|
|
10
10
|
|
|
11
11
|
.logintableLogoImgRow
|
|
12
12
|
text-align center
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
.chpasstableImgRow
|
|
15
15
|
display none
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
.iconostd
|
|
18
18
|
display none
|
|
19
|
-
|
|
20
|
-
#chpassFormRightImg
|
|
21
|
-
height 140px
|
|
19
|
+
|
|
20
|
+
#chpassFormRightImg
|
|
21
|
+
height 140px
|