@xuda.io/xuda-worker-bundle-min 1.3.493 → 1.3.495
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/index.js +55 -60
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -386,17 +386,18 @@ func.common.db = async function (
|
|
|
386
386
|
);
|
|
387
387
|
}
|
|
388
388
|
};
|
|
389
|
-
const
|
|
389
|
+
const create_dbs_pouch = async function (db) {
|
|
390
390
|
try {
|
|
391
|
+
// if (_session.DS_GLB[0].data_system.SYS_GLOBAL_BOL_ONLINE) {
|
|
392
|
+
// throw "online";
|
|
393
|
+
// }
|
|
391
394
|
const { code: table_req_code, data: table_req_id } =
|
|
392
395
|
await validate_existence_of_whole_table_request(db);
|
|
393
396
|
|
|
394
397
|
if (table_req_code > 0) {
|
|
395
398
|
data.full_table_downloaded = true;
|
|
396
399
|
}
|
|
397
|
-
|
|
398
|
-
await db.get(dataP.row_id);
|
|
399
|
-
return await func.db.pouch["del"](SESSION_ID, data);
|
|
400
|
+
return await func.db.pouch[serviceP](SESSION_ID, data);
|
|
400
401
|
} catch (err) {
|
|
401
402
|
return await func.common.perform_rpi_request(
|
|
402
403
|
SESSION_ID,
|
|
@@ -406,18 +407,17 @@ func.common.db = async function (
|
|
|
406
407
|
);
|
|
407
408
|
}
|
|
408
409
|
};
|
|
409
|
-
const
|
|
410
|
+
const delete_dbs_pouch = async function (db) {
|
|
410
411
|
try {
|
|
411
|
-
// if (_session.DS_GLB[0].data_system.SYS_GLOBAL_BOL_ONLINE) {
|
|
412
|
-
// throw "online";
|
|
413
|
-
// }
|
|
414
412
|
const { code: table_req_code, data: table_req_id } =
|
|
415
413
|
await validate_existence_of_whole_table_request(db);
|
|
416
414
|
|
|
417
415
|
if (table_req_code > 0) {
|
|
418
416
|
data.full_table_downloaded = true;
|
|
419
417
|
}
|
|
420
|
-
|
|
418
|
+
|
|
419
|
+
await db.get(dataP.row_id);
|
|
420
|
+
return await func.db.pouch["del"](SESSION_ID, data);
|
|
421
421
|
} catch (err) {
|
|
422
422
|
return await func.common.perform_rpi_request(
|
|
423
423
|
SESSION_ID,
|
|
@@ -427,7 +427,6 @@ func.common.db = async function (
|
|
|
427
427
|
);
|
|
428
428
|
}
|
|
429
429
|
};
|
|
430
|
-
|
|
431
430
|
if (
|
|
432
431
|
(typeof IS_DOCKER === "undefined" &&
|
|
433
432
|
typeof IS_PROCESS_SERVER === "undefined") ||
|
|
@@ -441,10 +440,6 @@ func.common.db = async function (
|
|
|
441
440
|
switch (serviceP) {
|
|
442
441
|
case "dbs_read": {
|
|
443
442
|
try {
|
|
444
|
-
// const ret = {
|
|
445
|
-
// code: 1,
|
|
446
|
-
// data: await read_dbs_pouch(db),
|
|
447
|
-
// };
|
|
448
443
|
return success_callback(await read_dbs_pouch(db));
|
|
449
444
|
} catch (err) {
|
|
450
445
|
return error_callback(err);
|
|
@@ -5781,54 +5776,54 @@ func.utils.ws_worker.functions = {
|
|
|
5781
5776
|
data: params,
|
|
5782
5777
|
});
|
|
5783
5778
|
},
|
|
5784
|
-
|
|
5785
|
-
|
|
5779
|
+
heartbeat: async function (params) {
|
|
5780
|
+
var SESSION_ID = params.session_id;
|
|
5786
5781
|
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
5809
|
-
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5782
|
+
try {
|
|
5783
|
+
const do_heartbeat = async function (
|
|
5784
|
+
app_replicate,
|
|
5785
|
+
app_id,
|
|
5786
|
+
token_id,
|
|
5787
|
+
fingerprint,
|
|
5788
|
+
device_name,
|
|
5789
|
+
stat
|
|
5790
|
+
) {
|
|
5791
|
+
try {
|
|
5792
|
+
module.exports.close_expired_device_log_sessions(app_id);
|
|
5793
|
+
|
|
5794
|
+
return await update_device(
|
|
5795
|
+
app_replicate,
|
|
5796
|
+
app_id,
|
|
5797
|
+
token_id,
|
|
5798
|
+
fingerprint,
|
|
5799
|
+
device_name,
|
|
5800
|
+
stat
|
|
5801
|
+
);
|
|
5802
|
+
} catch (err) {
|
|
5803
|
+
return { code: -400, data: err.message };
|
|
5804
|
+
}
|
|
5805
|
+
};
|
|
5806
|
+
let ret = await do_heartbeat(
|
|
5807
|
+
params.app_replicate,
|
|
5808
|
+
params.app_id,
|
|
5809
|
+
params.gtp_token || req.body.token,
|
|
5810
|
+
params.fingerprint,
|
|
5811
|
+
params.device_name,
|
|
5812
|
+
params.stat
|
|
5813
|
+
);
|
|
5819
5814
|
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5815
|
+
// session_status: ret_session.data.stat
|
|
5816
|
+
if (params.token) {
|
|
5817
|
+
try {
|
|
5818
|
+
const couch = await __.rpi.get_app_couch(req.body.app_id);
|
|
5819
|
+
const session_doc = await couch.get(req.body.token);
|
|
5820
|
+
ret.session_stat = session_doc.stat;
|
|
5821
|
+
} catch (error) {}
|
|
5822
|
+
}
|
|
5823
|
+
} catch (error) {
|
|
5824
|
+
debugger;
|
|
5825
|
+
}
|
|
5826
|
+
},
|
|
5832
5827
|
return_rpi_request_from_studio: function (params) {
|
|
5833
5828
|
var SESSION_ID = params.session_id;
|
|
5834
5829
|
function emitCustomEvent(eventName, detail) {
|