backend-plus 1.18.9 → 1.18.11
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-tables.js +19 -1
- package/lib/backend-plus.js +12 -1
- package/package.json +4 -4
- package/unlogged/my-ajax.js +8 -3
package/for-client/my-tables.js
CHANGED
|
@@ -563,6 +563,21 @@ function upadteNumberOfRows(depot,grid){
|
|
|
563
563
|
depot.manager.dom.footInfo.displayTo.textContent=grid.depotsToDisplay.length;
|
|
564
564
|
}
|
|
565
565
|
|
|
566
|
+
var TIME_STAMP_PROP = Symbol('TIME_STAMP_PROP');
|
|
567
|
+
myOwn.setTimeStamp = function setTimeStamp(row){
|
|
568
|
+
var timeStamp = new Date().getTime();
|
|
569
|
+
row[TIME_STAMP_PROP] = timeStamp;
|
|
570
|
+
console.log('SET=', timeStamp, row[TIME_STAMP_PROP], JSON4all.toUrl(row))
|
|
571
|
+
return timeStamp;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
myOwn.skipTimeStamp = function skipTimeStamp(row, timeStamp){
|
|
575
|
+
var skip = (row[TIME_STAMP_PROP] || 0) > timeStamp;
|
|
576
|
+
console.log(skip ? 'SKIP' : 'PASS', timeStamp, row[TIME_STAMP_PROP], JSON4all.toUrl(row))
|
|
577
|
+
if (!skip) row[TIME_STAMP_PROP] = timeStamp;
|
|
578
|
+
return skip;
|
|
579
|
+
}
|
|
580
|
+
|
|
566
581
|
myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
|
|
567
582
|
var my = this;
|
|
568
583
|
var grid = new my.TableGrid({my: this}, mainElement);
|
|
@@ -587,6 +602,7 @@ myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
|
|
|
587
602
|
})
|
|
588
603
|
}
|
|
589
604
|
grid.refreshAllRows = function(){
|
|
605
|
+
var timeStamp = new Date().getTime();
|
|
590
606
|
grid.connector.my.ajax.table_data({
|
|
591
607
|
table:grid.connector.tableName,
|
|
592
608
|
fixedFields:grid.connector.fixedFields,
|
|
@@ -600,6 +616,7 @@ myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
|
|
|
600
616
|
};
|
|
601
617
|
var tick = Math.random();
|
|
602
618
|
rows.forEach(function(row){
|
|
619
|
+
if (my.skipTimeStamp(row, timeStamp)) return;
|
|
603
620
|
var primaryKeyValuesForRow = getPrimaryKeyValues(primaryKey, row);
|
|
604
621
|
var depot = grid.depots.find(function(depot){
|
|
605
622
|
var primaryKeyValuesForDepotRow = getPrimaryKeyValues(primaryKey, depot.row);
|
|
@@ -1419,7 +1436,6 @@ myOwn.TableGrid.prototype.prepareMenu = function prepareMenu(button){
|
|
|
1419
1436
|
messages,
|
|
1420
1437
|
grid,
|
|
1421
1438
|
false,
|
|
1422
|
-
false,
|
|
1423
1439
|
['skipUnknownFieldsAtImport','simplificateSpaces','replaceNewLineWithSpace']
|
|
1424
1440
|
)
|
|
1425
1441
|
);
|
|
@@ -2296,7 +2312,9 @@ myOwn.TableGrid.prototype.displayGrid = function displayGrid(){
|
|
|
2296
2312
|
return Promise.resolve(); // no grabo todavía
|
|
2297
2313
|
};
|
|
2298
2314
|
}
|
|
2315
|
+
var timeStamp = my.setTimeStamp(depot.row);
|
|
2299
2316
|
return grid.connector.saveRecord(depot, opts).then(function(result){
|
|
2317
|
+
if (my.skipTimeStamp(depot.row, timeStamp)) return;
|
|
2300
2318
|
grid.depotRefresh(depot,result);
|
|
2301
2319
|
}).catch(function(err){
|
|
2302
2320
|
changeIoStatus(depot,'error',depot.rowPendingForUpdate,err.message);
|
package/lib/backend-plus.js
CHANGED
|
@@ -1282,7 +1282,14 @@ AppBackend.prototype.addProcedureServices = function addProcedureServices(forUnl
|
|
|
1282
1282
|
if(!isLowerIdent(procedureDef.action)){
|
|
1283
1283
|
console.error('**** DEPRECATED ***** procedureDef action '+JSON.stringify(procedureDef.action)+' must be a Lower Ident');
|
|
1284
1284
|
}
|
|
1285
|
-
app[procedureDef.method]('/'+procedureDef.action,
|
|
1285
|
+
app[procedureDef.method]('/'+procedureDef.action,
|
|
1286
|
+
/**
|
|
1287
|
+
*
|
|
1288
|
+
* @param {Request} req
|
|
1289
|
+
* @param {Response} res
|
|
1290
|
+
* @param {import('express').NextFunction} next
|
|
1291
|
+
*/
|
|
1292
|
+
async function(req, res, next){
|
|
1286
1293
|
const BITACORA_TABLENAME = be.config.server.bitacoraTableName || 'bitacora';
|
|
1287
1294
|
var getDatetimeString = function getDatetimeString(){
|
|
1288
1295
|
return datetime.now().toPlainString()
|
|
@@ -1498,6 +1505,10 @@ AppBackend.prototype.addProcedureServices = function addProcedureServices(forUnl
|
|
|
1498
1505
|
})
|
|
1499
1506
|
})
|
|
1500
1507
|
}
|
|
1508
|
+
var bpClientTs = req.get('BP-Client-TS');
|
|
1509
|
+
if(bpClientTs){
|
|
1510
|
+
res.append('BP-Client-TS', bpClientTs);
|
|
1511
|
+
}
|
|
1501
1512
|
res.append('Content-Type', 'application/octet-stream');
|
|
1502
1513
|
return Promise.resolve().then(function(){
|
|
1503
1514
|
var thisCache;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "backend-plus",
|
|
3
3
|
"description": "Backend for typed controls",
|
|
4
|
-
"version": "1.18.
|
|
4
|
+
"version": "1.18.11",
|
|
5
5
|
"author": "Codenautas <codenautas@googlegroups.com>",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": "codenautas/backend-plus",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@upgraded/locate-path": "^6.0.0-alfa.1",
|
|
32
|
-
"ajax-best-promise": "^0.
|
|
32
|
+
"ajax-best-promise": "^0.4.0",
|
|
33
33
|
"backend-skins": "^0.1.15",
|
|
34
34
|
"best-globals": "^1.1.0",
|
|
35
35
|
"big.js": "^6.2.1",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@types/js-yaml": "^4.0.5",
|
|
82
82
|
"@types/mocha": "^10.0.1",
|
|
83
83
|
"@types/multiparty": "~0.0.33",
|
|
84
|
-
"@types/node": "^20.2.
|
|
84
|
+
"@types/node": "^20.2.5",
|
|
85
85
|
"@types/nodemailer": "^6.4.8",
|
|
86
86
|
"@types/numeral": "~2.0.2",
|
|
87
87
|
"@types/session-file-store": "^1.2.2",
|
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
"kill-9": "~0.4.3",
|
|
99
99
|
"mocha": "^10.2.0",
|
|
100
100
|
"nyc": "^15.1.0",
|
|
101
|
-
"puppeteer": "^20.
|
|
101
|
+
"puppeteer": "^20.4.0",
|
|
102
102
|
"sinon": "^15.1.0",
|
|
103
103
|
"supertest": "^6.3.3",
|
|
104
104
|
"types.d.ts": "~0.6.14",
|
package/unlogged/my-ajax.js
CHANGED
|
@@ -315,12 +315,17 @@ myAjax.ajaxPromise = function ajaxPromise(procedureDef,data,opts){
|
|
|
315
315
|
informProgress({start:true})
|
|
316
316
|
}
|
|
317
317
|
}, 500)
|
|
318
|
-
|
|
318
|
+
var ajaxCall = AjaxBestPromise[procedureDef.method]({
|
|
319
319
|
multipart:procedureDef.files,
|
|
320
320
|
url:procedureDef.action,
|
|
321
321
|
data:params,
|
|
322
|
-
uploading:opts.uploading
|
|
323
|
-
|
|
322
|
+
uploading:opts.uploading,
|
|
323
|
+
headers:opts.headers
|
|
324
|
+
});
|
|
325
|
+
if (opts.headersConsumer) {
|
|
326
|
+
ajaxCall = ajaxCall.onHeaders(opts.headersConsumer);
|
|
327
|
+
}
|
|
328
|
+
return ajaxCall.onLine(function(line,ender){
|
|
324
329
|
controlLoggedIn(line);
|
|
325
330
|
if(progress){
|
|
326
331
|
if(line.substr(0,2)=='--'){
|