backend-plus 2.7.0-beta.8 → 2.7.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/for-client/css/my-menu.styl +13 -15
- package/for-client/css/my-tables.styl +28 -28
- package/for-client/css/my-things.styl +12 -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 +179 -141
- 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 +39 -35
- package/lib/backend-plus.js +42 -87
- package/lib/in-backend-plus.d.ts +1 -1
- package/lib/my-debugger.js +2 -2
- package/lib/procedures-table.js +55 -42
- 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 +23 -13
- 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/my-debugger.js
CHANGED
package/lib/procedures-table.js
CHANGED
|
@@ -10,6 +10,7 @@ var likeAr=require('like-ar');
|
|
|
10
10
|
const f = require('session-file-store');
|
|
11
11
|
const { expected } = require('cast-error');
|
|
12
12
|
const bestGlobals = require('best-globals');
|
|
13
|
+
const { AppBackend } = require('backend-plus');
|
|
13
14
|
|
|
14
15
|
const PANIC_IMPORT = true;
|
|
15
16
|
|
|
@@ -51,7 +52,7 @@ ProcedureTables = [
|
|
|
51
52
|
insert:true,
|
|
52
53
|
}});
|
|
53
54
|
}
|
|
54
|
-
if(struct.JSONFieldForOtherFields){
|
|
55
|
+
if(struct.JSONFieldForOtherFields){
|
|
55
56
|
var registerImports = struct.registerImports;
|
|
56
57
|
if(registerImports.inTable && registerImports.fieldNames.tableName && registerImports.fieldNames.fieldName){
|
|
57
58
|
return context.client.query(
|
|
@@ -85,26 +86,29 @@ ProcedureTables = [
|
|
|
85
86
|
{name: 'fixedFields', defaultValue:[]},
|
|
86
87
|
{name: 'paramfun', defaultValue:[]},
|
|
87
88
|
{name: 'pick', defaultValue:'', encoding:'plain'},
|
|
88
|
-
{name: '
|
|
89
|
+
{name: 'retrieveWithBroadWhere', defaultValue:false}
|
|
89
90
|
],
|
|
90
91
|
coreFunction:
|
|
91
92
|
/**
|
|
92
|
-
*
|
|
93
|
-
* @param {*} context
|
|
94
|
-
* @param {{table:string, fixedFields:{fieldName:string, value:any, range?:string, until?:string}[], paramfun:string
|
|
93
|
+
*
|
|
94
|
+
* @param {*} context
|
|
95
|
+
* @param {{table:string, fixedFields:{fieldName:string, value:any, range?:string, until?:string}[], paramfun:Record<string, string>, pick:string, retrieveWithBroadWhere:boolean}} parameters
|
|
95
96
|
*/
|
|
96
97
|
async function tableDatum(context, parameters){
|
|
98
|
+
/** @type {AppBackend} */
|
|
97
99
|
var be=context.be;
|
|
98
100
|
var tableName=parameters.table;
|
|
99
|
-
var
|
|
100
|
-
if(!
|
|
101
|
+
var defTableFun=be.tableStructures[tableName];
|
|
102
|
+
if(!defTableFun){
|
|
101
103
|
throw new Error('no table def for '+tableName+' (in table_data)')
|
|
102
104
|
}
|
|
103
|
-
defTable=
|
|
105
|
+
var defTable=defTableFun(context);
|
|
104
106
|
/** @type {string} */
|
|
105
107
|
var sql;
|
|
106
108
|
var queryValues=[];
|
|
109
|
+
/** @type {string[]} */
|
|
107
110
|
var specialFixedClause=[];
|
|
111
|
+
/** @type {string[]} */
|
|
108
112
|
var fixedClausule=[];
|
|
109
113
|
if(defTable.functionDef){
|
|
110
114
|
parameters.fixedFields.forEach(function(pair, iPair){
|
|
@@ -155,10 +159,19 @@ ProcedureTables = [
|
|
|
155
159
|
fixedClausule.push(exprClausule)
|
|
156
160
|
}
|
|
157
161
|
});
|
|
162
|
+
|
|
163
|
+
const getBaseWhere = (defTable, params) => {
|
|
164
|
+
if (params?.retrieveWithBroadWhere && defTable.sql?.broadWhere) return defTable.sql.broadWhere;
|
|
165
|
+
if (params?.retrieveWithBroadWhere) console.warn("No broadWhere found for retrieveWithBroadWhere. Using default configuration.");
|
|
166
|
+
return defTable.sql?.where || (defTable.allow?.select && !defTable.forInsertOnlyMode ? 'true' : 'false');
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
const whereCondition = getBaseWhere(defTable, parameters) + fixedClausule.join("");
|
|
170
|
+
|
|
158
171
|
/** @type {string} */
|
|
159
172
|
var sql="SELECT "+[...defTable.sql.select].join(', ')+
|
|
160
173
|
"\n FROM "+defTable.sql.from+
|
|
161
|
-
"\n WHERE "+
|
|
174
|
+
"\n WHERE "+whereCondition+
|
|
162
175
|
// " ORDER BY "+defTable.primaryKey.map(be.db.quoteIdent.bind(be.db)).join(',')
|
|
163
176
|
"\n ORDER BY "+(defTable.sql.orderBy||defTable.primaryKey).map(function(fieldName){ return be.db.quoteIdent(fieldName); }).join(',')
|
|
164
177
|
if(specialFixedClause.length){
|
|
@@ -173,7 +186,7 @@ ProcedureTables = [
|
|
|
173
186
|
var line = likeAr(row).join(' ').trim().split(/\s+/);
|
|
174
187
|
return pickParts.every(palabraBuscada =>
|
|
175
188
|
line.map(p => bestGlobals.hyperSimplifyText(p)).filter(palabra =>
|
|
176
|
-
palabraBuscada.length <= 3
|
|
189
|
+
palabraBuscada.length <= 3
|
|
177
190
|
? palabra == palabraBuscada
|
|
178
191
|
: palabra.includes(palabraBuscada)
|
|
179
192
|
).length
|
|
@@ -196,12 +209,12 @@ ProcedureTables = [
|
|
|
196
209
|
{name: 'status', encoding:'plain'},
|
|
197
210
|
],
|
|
198
211
|
/**
|
|
199
|
-
*
|
|
200
|
-
* @param {ProcedureContext} context
|
|
201
|
-
* @param {*} parameters
|
|
202
|
-
* @param {*} files
|
|
203
|
-
* @param {*} opts
|
|
204
|
-
* @returns
|
|
212
|
+
*
|
|
213
|
+
* @param {ProcedureContext} context
|
|
214
|
+
* @param {*} parameters
|
|
215
|
+
* @param {*} files
|
|
216
|
+
* @param {*} opts
|
|
217
|
+
* @returns
|
|
205
218
|
*/
|
|
206
219
|
coreFunction:async function(context, parameters, files, opts){
|
|
207
220
|
var be=context.be;
|
|
@@ -229,7 +242,7 @@ ProcedureTables = [
|
|
|
229
242
|
throw new Error("field "+name+" does not exist in "+mainDefTable.name);
|
|
230
243
|
}
|
|
231
244
|
if(!defField.allow[action] && (!opts || !opts.forImport) && (
|
|
232
|
-
!defField.isPk ||
|
|
245
|
+
!defField.isPk ||
|
|
233
246
|
parameters.primaryKeyValues[defField.isPk-1]!=parameters.newRow[name]
|
|
234
247
|
)){
|
|
235
248
|
throw changing(new Error(action+" not allowed for "+name),{status:403});
|
|
@@ -326,7 +339,7 @@ ProcedureTables = [
|
|
|
326
339
|
primaryKeyValuesForUpdate[i]=value;
|
|
327
340
|
}
|
|
328
341
|
if(!fieldNames4Insert.includes(name) && value != null && defField.inTable !== false){
|
|
329
|
-
fieldNames4Insert.push(name);
|
|
342
|
+
fieldNames4Insert.push(name);
|
|
330
343
|
values4Insert.push(value);
|
|
331
344
|
}
|
|
332
345
|
});
|
|
@@ -414,7 +427,7 @@ ProcedureTables = [
|
|
|
414
427
|
mainResult=result;
|
|
415
428
|
}
|
|
416
429
|
}
|
|
417
|
-
if((!mainDefTable || parameters.status!='new')
|
|
430
|
+
if((!mainDefTable || parameters.status!='new')
|
|
418
431
|
&& (!mainDefTable || parameters.primaryKeyValues.length!=mainDefTable.primaryKey.length)
|
|
419
432
|
&& (parameters.masive && parameters.primaryKeyValues.length>0)
|
|
420
433
|
){
|
|
@@ -564,7 +577,7 @@ ProcedureTables = [
|
|
|
564
577
|
function(tableDef){
|
|
565
578
|
return be.procedure.table_data.coreFunction(
|
|
566
579
|
context,{
|
|
567
|
-
table: tableDef.name,
|
|
580
|
+
table: tableDef.name,
|
|
568
581
|
fixedFields:fixedFields
|
|
569
582
|
}
|
|
570
583
|
)
|
|
@@ -596,7 +609,7 @@ ProcedureTables = [
|
|
|
596
609
|
promiseChain=promiseChain.then(function(){
|
|
597
610
|
return be.procedure.table_record_save.coreFunction(
|
|
598
611
|
context,{
|
|
599
|
-
table: 'locks',
|
|
612
|
+
table: 'locks',
|
|
600
613
|
primaryKeyValues,
|
|
601
614
|
newRow,
|
|
602
615
|
oldRow:[],
|
|
@@ -705,7 +718,7 @@ ProcedureTables = [
|
|
|
705
718
|
).fetchOneRowIfExists().then(function(result){
|
|
706
719
|
return 'ok';
|
|
707
720
|
});
|
|
708
|
-
|
|
721
|
+
|
|
709
722
|
}
|
|
710
723
|
},
|
|
711
724
|
{
|
|
@@ -787,8 +800,8 @@ ProcedureTables = [
|
|
|
787
800
|
otherFieldNames.push({index: iColumn, name: fieldName});
|
|
788
801
|
fields.push(changing(tableDef.JSONFieldForOtherFields,{iColumn:iColumn}));
|
|
789
802
|
}
|
|
790
|
-
if(defField &&
|
|
791
|
-
defField.inTable!==false &&
|
|
803
|
+
if(defField &&
|
|
804
|
+
defField.inTable!==false &&
|
|
792
805
|
(defField.allow.import || defField.allow.insert && (defField.allow.update || defField.isPk)) &&
|
|
793
806
|
(!defField.clientSide || defField.serverSide)
|
|
794
807
|
){
|
|
@@ -797,18 +810,18 @@ ProcedureTables = [
|
|
|
797
810
|
}
|
|
798
811
|
};
|
|
799
812
|
var addFieldToOthers = function addFieldToOthers(othersArray, field, value){
|
|
800
|
-
var otherFieldName = otherFieldNames.find(function findOtherFieldName(aux) {
|
|
813
|
+
var otherFieldName = otherFieldNames.find(function findOtherFieldName(aux) {
|
|
801
814
|
return aux.index === field.iColumn;
|
|
802
815
|
});
|
|
803
816
|
if(otherFieldName){
|
|
804
|
-
var index = othersArray.findIndex(function findIndexForOtherFieldName(aux) {
|
|
817
|
+
var index = othersArray.findIndex(function findIndexForOtherFieldName(aux) {
|
|
805
818
|
return aux.name === otherFieldName.name
|
|
806
819
|
});
|
|
807
|
-
var row = {name: otherFieldName.name, index: otherFieldName.index, value: value || ''};
|
|
820
|
+
var row = {name: otherFieldName.name, index: otherFieldName.index, value: value || ''};
|
|
808
821
|
if(index == -1){
|
|
809
|
-
othersArray.push(row);
|
|
822
|
+
othersArray.push(row);
|
|
810
823
|
}else{
|
|
811
|
-
othersArray[index] = row;
|
|
824
|
+
othersArray[index] = row;
|
|
812
825
|
}
|
|
813
826
|
}
|
|
814
827
|
};
|
|
@@ -954,7 +967,7 @@ ProcedureTables = [
|
|
|
954
967
|
if(field.defaultForOtherFields){
|
|
955
968
|
addFieldToOthers(othersArray, field, value);
|
|
956
969
|
}else{
|
|
957
|
-
newRow[field.name]=value;
|
|
970
|
+
newRow[field.name]=value;
|
|
958
971
|
}
|
|
959
972
|
}
|
|
960
973
|
};
|
|
@@ -1030,7 +1043,7 @@ ProcedureTables = [
|
|
|
1030
1043
|
}
|
|
1031
1044
|
for(let field of fields){
|
|
1032
1045
|
var value = newRow[field.name];
|
|
1033
|
-
var prefilledField = parameters.prefilledFields.find(function findPrefilledfield(aux) {
|
|
1046
|
+
var prefilledField = parameters.prefilledFields.find(function findPrefilledfield(aux) {
|
|
1034
1047
|
return aux.fieldName === field.name;
|
|
1035
1048
|
});
|
|
1036
1049
|
if(prefilledField && prefilledField.value != value){
|
|
@@ -1070,7 +1083,7 @@ ProcedureTables = [
|
|
|
1070
1083
|
var result = await be.procedure[procedure].coreFunction(
|
|
1071
1084
|
context,
|
|
1072
1085
|
{
|
|
1073
|
-
table: parameters.table,
|
|
1086
|
+
table: parameters.table,
|
|
1074
1087
|
primaryKeyValues,
|
|
1075
1088
|
newRow,
|
|
1076
1089
|
oldRow:[],
|
|
@@ -1114,7 +1127,7 @@ ProcedureTables = [
|
|
|
1114
1127
|
lineNumber++;
|
|
1115
1128
|
};
|
|
1116
1129
|
if(tableDef.registerImports.inTable){
|
|
1117
|
-
var otherFieldsTableDef = be.tableStructures[tableDef.registerImports.inTable](context);
|
|
1130
|
+
var otherFieldsTableDef = be.tableStructures[tableDef.registerImports.inTable](context);
|
|
1118
1131
|
var timestamp = datetime.now();
|
|
1119
1132
|
var fieldNames = tableDef.registerImports.fieldNames;
|
|
1120
1133
|
for(let otherField of otherFieldNames){
|
|
@@ -1131,7 +1144,7 @@ ProcedureTables = [
|
|
|
1131
1144
|
};
|
|
1132
1145
|
await be.procedure[procedure].coreFunction(
|
|
1133
1146
|
context,{
|
|
1134
|
-
table: otherFieldsTableDef.name,
|
|
1147
|
+
table: otherFieldsTableDef.name,
|
|
1135
1148
|
primaryKeyValues,
|
|
1136
1149
|
newRow,
|
|
1137
1150
|
oldRow:[],
|
|
@@ -1211,7 +1224,7 @@ ProcedureTables = [
|
|
|
1211
1224
|
var cache={}
|
|
1212
1225
|
allCache[row.name]=cache;
|
|
1213
1226
|
for(var j=0; j<summaryDef.fields.length; j++){ var fieldDef=summaryDef.fields[j];
|
|
1214
|
-
if(fieldDef.summary
|
|
1227
|
+
if(fieldDef.summary
|
|
1215
1228
|
&& (!fieldDef.summary.types4 || fieldDef.summary.types4.includes(row.data_type))
|
|
1216
1229
|
&& (!fieldDef.summary.excludeTypes || !fieldDef.summary.excludeTypes.includes(row.data_type))
|
|
1217
1230
|
){
|
|
@@ -1263,12 +1276,12 @@ ProcedureTables = [
|
|
|
1263
1276
|
}
|
|
1264
1277
|
var tableDef = be.tableStructures[parameters.tableName](context);
|
|
1265
1278
|
var pk = likeAr.toPlainObject(tableDef.primaryKey, parameters.primaryKeyValues)
|
|
1266
|
-
var result = await client.query(`select
|
|
1267
|
-
cha_new_value as valor,
|
|
1279
|
+
var result = await client.query(`select
|
|
1280
|
+
cha_new_value as valor,
|
|
1268
1281
|
cha_when as cuando,
|
|
1269
1282
|
split_part(cha_context,' ',1) as quien
|
|
1270
1283
|
from his.changes
|
|
1271
|
-
where cha_table = $1
|
|
1284
|
+
where cha_table = $1
|
|
1272
1285
|
and cha_column = $2
|
|
1273
1286
|
and cha_new_pk = ${context.be.db.quoteLiteral(JSON.stringify(pk))}
|
|
1274
1287
|
order by cha_when desc
|
|
@@ -1318,10 +1331,10 @@ ProcedureTables = [
|
|
|
1318
1331
|
})
|
|
1319
1332
|
var zip = spawn(be.config.server.bin.zip ?? 'zip',[
|
|
1320
1333
|
...(be.config.server.bin["zip-fixed-parameters"] ?? []),
|
|
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
|
|
1334
|
+
...(be.config.server.bin["zip-password-parameter-flag"] === false ? [] : [be.config.server.bin["zip-password-parameter-flag"] ?? '--password']),
|
|
1335
|
+
`${be.config.server.bin["zip-password-prefix"] ?? ''}${parameters.encrypt}` ,
|
|
1336
|
+
'./local-private/backup-db.zip',
|
|
1337
|
+
path
|
|
1325
1338
|
], {stdio: [out, out, out]});
|
|
1326
1339
|
var code = await new Promise((resolve, reject) => {
|
|
1327
1340
|
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
|
|
4
|
+
"version": "2.7.0",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -28,6 +28,14 @@
|
|
|
28
28
|
"email": "manueldelapenna@gmail.com"
|
|
29
29
|
}
|
|
30
30
|
],
|
|
31
|
+
"overrides": {
|
|
32
|
+
"diff": ">=8.0.2",
|
|
33
|
+
"serialize-javascript": ">=7.0.0",
|
|
34
|
+
"stylus": {
|
|
35
|
+
"glob": "^11"
|
|
36
|
+
},
|
|
37
|
+
"uuid": ">=14.0.0"
|
|
38
|
+
},
|
|
31
39
|
"dependencies": {
|
|
32
40
|
"@upgraded/locate-path": "^6.0.0-alfa.1",
|
|
33
41
|
"ajax-best-promise": "^0.4.5",
|
|
@@ -38,18 +46,19 @@
|
|
|
38
46
|
"castellano": "^0.1.7",
|
|
39
47
|
"cors": "^2.8.6",
|
|
40
48
|
"dialog-promise": "^0.10.7",
|
|
41
|
-
"ensure-login": "^0.1.6
|
|
49
|
+
"ensure-login": "^0.1.6",
|
|
42
50
|
"express": "^5.2.1",
|
|
43
51
|
"express-useragent": "^2.2.1",
|
|
52
|
+
"fflate": "^0.8.3",
|
|
44
53
|
"fs-extra": "^11.4.0",
|
|
45
|
-
"js-to-html": "^1.
|
|
46
|
-
"js-yaml": "^5.2.
|
|
54
|
+
"js-to-html": "^1.4.0",
|
|
55
|
+
"js-yaml": "^5.2.3",
|
|
47
56
|
"json4all": "^1.4.4",
|
|
48
57
|
"lazy-some": "^0.1.0",
|
|
49
58
|
"like-ar": "^0.5.3",
|
|
50
|
-
"login-plus": "^1.9.0
|
|
59
|
+
"login-plus": "^1.9.0",
|
|
51
60
|
"memorystore": "^1.6.8",
|
|
52
|
-
"mini-tools": "^1.13.
|
|
61
|
+
"mini-tools": "^1.13.10",
|
|
53
62
|
"moment": "^2.30.1",
|
|
54
63
|
"multiparty": "^4.3.0",
|
|
55
64
|
"nodemailer": "^9.0.3",
|
|
@@ -57,8 +66,8 @@
|
|
|
57
66
|
"pg-promise-strict": "^1.5.0",
|
|
58
67
|
"pg-triggers": "0.4.6",
|
|
59
68
|
"pikaday": "^1.8.2",
|
|
60
|
-
"require-bro": "^0.
|
|
61
|
-
"serve-content": "^1.0.
|
|
69
|
+
"require-bro": "^0.4.0",
|
|
70
|
+
"serve-content": "^1.0.6",
|
|
62
71
|
"session-file-store": "^1.5.0",
|
|
63
72
|
"simple-git": "^3.36.0",
|
|
64
73
|
"sql-tools": "^0.1.7",
|
|
@@ -66,7 +75,8 @@
|
|
|
66
75
|
"tab-plus": "^0.1.8",
|
|
67
76
|
"type-store": "^0.6.0",
|
|
68
77
|
"typed-controls": "^0.12.7",
|
|
69
|
-
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"
|
|
78
|
+
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz",
|
|
79
|
+
"xlsx-now": "^0.2.1"
|
|
70
80
|
},
|
|
71
81
|
"devDependencies": {
|
|
72
82
|
"@types/big.js": "^7.0.0",
|
|
@@ -77,7 +87,7 @@
|
|
|
77
87
|
"@types/js-yaml": "^4.0.9",
|
|
78
88
|
"@types/mocha": "^10.0.10",
|
|
79
89
|
"@types/multiparty": "^4.2.1",
|
|
80
|
-
"@types/node": "^26.1.
|
|
90
|
+
"@types/node": "^26.1.2",
|
|
81
91
|
"@types/nodemailer": "^8.0.1",
|
|
82
92
|
"@types/numeral": "~2.0.5",
|
|
83
93
|
"@types/session-file-store": "^1.2.6",
|
|
@@ -96,14 +106,14 @@
|
|
|
96
106
|
"kill-9": "^0.4.3",
|
|
97
107
|
"mocha": "^12.0.0-rc.5",
|
|
98
108
|
"nyc": "^18.0.0",
|
|
99
|
-
"puppeteer": "^25.
|
|
100
|
-
"qa-control": "0.
|
|
109
|
+
"puppeteer": "^25.4.0",
|
|
110
|
+
"qa-control": "0.9.2",
|
|
101
111
|
"regexplicit": "^0.1.3",
|
|
102
112
|
"self-explain": "^0.11.0",
|
|
103
113
|
"sinon": "^22.1.0",
|
|
104
114
|
"supertest": "^7.2.2",
|
|
105
115
|
"types.d.ts": "^0.6.22",
|
|
106
|
-
"typescript": "^5.9.
|
|
116
|
+
"typescript": "^5.9.3",
|
|
107
117
|
"why-is-node-running": "^3.2.2"
|
|
108
118
|
},
|
|
109
119
|
"engines": {
|
|
@@ -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
|
package/unlogged/css/login.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
|
|
|
@@ -11,12 +11,12 @@ input
|
|
|
11
11
|
.logintableLogoImgRow
|
|
12
12
|
text-align center
|
|
13
13
|
|
|
14
|
-
#loginFormRightImg
|
|
14
|
+
#loginFormRightImg
|
|
15
15
|
height 120px
|
|
16
16
|
|
|
17
17
|
.forgetLabel
|
|
18
18
|
text-align right
|
|
19
|
-
font-size 80%
|
|
19
|
+
font-size 80%
|
|
20
20
|
|
|
21
21
|
.formtd input#email
|
|
22
|
-
width 500px
|
|
22
|
+
width 500px
|
package/unlogged/globals.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
declare var define:()=>void
|
|
1
|
+
declare var define:()=>void
|