@xuda.io/xuda-worker-bundle-min 1.3.492 → 1.3.494
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 +77 -50
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -407,7 +407,26 @@ func.common.db = async function (
|
|
|
407
407
|
);
|
|
408
408
|
}
|
|
409
409
|
};
|
|
410
|
+
const delete_dbs_pouch = async function (db) {
|
|
411
|
+
try {
|
|
412
|
+
const { code: table_req_code, data: table_req_id } =
|
|
413
|
+
await validate_existence_of_whole_table_request(db);
|
|
414
|
+
|
|
415
|
+
if (table_req_code > 0) {
|
|
416
|
+
data.full_table_downloaded = true;
|
|
417
|
+
}
|
|
410
418
|
|
|
419
|
+
await db.get(dataP.row_id);
|
|
420
|
+
return await func.db.pouch["del"](SESSION_ID, data);
|
|
421
|
+
} catch (err) {
|
|
422
|
+
return await func.common.perform_rpi_request(
|
|
423
|
+
SESSION_ID,
|
|
424
|
+
serviceP,
|
|
425
|
+
opt,
|
|
426
|
+
data
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
};
|
|
411
430
|
if (
|
|
412
431
|
(typeof IS_DOCKER === "undefined" &&
|
|
413
432
|
typeof IS_PROCESS_SERVER === "undefined") ||
|
|
@@ -421,10 +440,6 @@ func.common.db = async function (
|
|
|
421
440
|
switch (serviceP) {
|
|
422
441
|
case "dbs_read": {
|
|
423
442
|
try {
|
|
424
|
-
// const ret = {
|
|
425
|
-
// code: 1,
|
|
426
|
-
// data: await read_dbs_pouch(db),
|
|
427
|
-
// };
|
|
428
443
|
return success_callback(await read_dbs_pouch(db));
|
|
429
444
|
} catch (err) {
|
|
430
445
|
return error_callback(err);
|
|
@@ -455,6 +470,18 @@ func.common.db = async function (
|
|
|
455
470
|
}
|
|
456
471
|
break;
|
|
457
472
|
}
|
|
473
|
+
case "dbs_delete": {
|
|
474
|
+
try {
|
|
475
|
+
const ret = {
|
|
476
|
+
code: 1,
|
|
477
|
+
data: await delete_dbs_pouch(db),
|
|
478
|
+
};
|
|
479
|
+
return success_callback(ret);
|
|
480
|
+
} catch (err) {
|
|
481
|
+
return error_callback(err);
|
|
482
|
+
}
|
|
483
|
+
break;
|
|
484
|
+
}
|
|
458
485
|
|
|
459
486
|
default:
|
|
460
487
|
try {
|
|
@@ -5749,54 +5776,54 @@ func.utils.ws_worker.functions = {
|
|
|
5749
5776
|
data: params,
|
|
5750
5777
|
});
|
|
5751
5778
|
},
|
|
5752
|
-
|
|
5753
|
-
|
|
5779
|
+
heartbeat: async function (params) {
|
|
5780
|
+
var SESSION_ID = params.session_id;
|
|
5754
5781
|
|
|
5755
|
-
|
|
5756
|
-
|
|
5757
|
-
|
|
5758
|
-
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
5770
|
-
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
5779
|
-
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
|
|
5784
|
-
|
|
5785
|
-
|
|
5786
|
-
|
|
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
|
+
);
|
|
5787
5814
|
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
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
|
+
},
|
|
5800
5827
|
return_rpi_request_from_studio: function (params) {
|
|
5801
5828
|
var SESSION_ID = params.session_id;
|
|
5802
5829
|
function emitCustomEvent(eventName, detail) {
|