backend-plus 1.18.10 → 1.18.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/my-tables.js +30 -8
- 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,
|
|
@@ -599,7 +615,9 @@ myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
|
|
|
599
615
|
})
|
|
600
616
|
};
|
|
601
617
|
var tick = Math.random();
|
|
618
|
+
var thereIsANewRecord = grid.depots.filter(depot => depot.status == 'new').length;
|
|
602
619
|
rows.forEach(function(row){
|
|
620
|
+
if (my.skipTimeStamp(row, timeStamp)) return;
|
|
603
621
|
var primaryKeyValuesForRow = getPrimaryKeyValues(primaryKey, row);
|
|
604
622
|
var depot = grid.depots.find(function(depot){
|
|
605
623
|
var primaryKeyValuesForDepotRow = getPrimaryKeyValues(primaryKey, depot.row);
|
|
@@ -614,7 +632,7 @@ myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
|
|
|
614
632
|
}
|
|
615
633
|
}
|
|
616
634
|
depot.tick = tick
|
|
617
|
-
} else if (!depot) {
|
|
635
|
+
} else if (!depot && !thereIsANewRecord) {
|
|
618
636
|
var depot = grid.createDepotFromRow(row);
|
|
619
637
|
grid.depots.push(depot);
|
|
620
638
|
grid.sortDepotsToDisplay(grid.depots);
|
|
@@ -627,13 +645,15 @@ myOwn.tableGrid = function tableGrid(tableName, mainElement, opts){
|
|
|
627
645
|
},3000);
|
|
628
646
|
}
|
|
629
647
|
})
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
depot.
|
|
635
|
-
|
|
636
|
-
|
|
648
|
+
if(!thereIsANewRecord){
|
|
649
|
+
var i = 0;
|
|
650
|
+
while (i < grid.depots.length) {
|
|
651
|
+
var depot = grid.depots[i];
|
|
652
|
+
if (depot.tick != tick) {
|
|
653
|
+
depot.manager.displayAsDeleted(depot);
|
|
654
|
+
} else {
|
|
655
|
+
i++;
|
|
656
|
+
}
|
|
637
657
|
}
|
|
638
658
|
}
|
|
639
659
|
})
|
|
@@ -2295,7 +2315,9 @@ myOwn.TableGrid.prototype.displayGrid = function displayGrid(){
|
|
|
2295
2315
|
return Promise.resolve(); // no grabo todavía
|
|
2296
2316
|
};
|
|
2297
2317
|
}
|
|
2318
|
+
var timeStamp = my.setTimeStamp(depot.row);
|
|
2298
2319
|
return grid.connector.saveRecord(depot, opts).then(function(result){
|
|
2320
|
+
if (my.skipTimeStamp(depot.row, timeStamp)) return;
|
|
2299
2321
|
grid.depotRefresh(depot,result);
|
|
2300
2322
|
}).catch(function(err){
|
|
2301
2323
|
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.12",
|
|
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)=='--'){
|