@xuda.io/xuda-worker-bundle-min 1.3.394 → 1.3.396
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 +88 -21
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -363,8 +363,7 @@ func.common.db = async function (
|
|
|
363
363
|
// });
|
|
364
364
|
// };
|
|
365
365
|
|
|
366
|
-
const
|
|
367
|
-
const db = await func.utils.connect_pouchdb(SESSION_ID);
|
|
366
|
+
const read_dbs_pouch = async function (db) {
|
|
368
367
|
let _data = _.cloneDeep(dataP);
|
|
369
368
|
|
|
370
369
|
function cleanString(json) {
|
|
@@ -439,33 +438,99 @@ func.common.db = async function (
|
|
|
439
438
|
return json;
|
|
440
439
|
}
|
|
441
440
|
};
|
|
441
|
+
const update_dbs_pouch = async function (db) {
|
|
442
|
+
try {
|
|
443
|
+
await db.get(dataP.row_id);
|
|
444
|
+
return await func.db.pouch[serviceP](SESSION_ID, dataP);
|
|
445
|
+
} catch (err) {
|
|
446
|
+
return await perform_rpi_request(serviceP);
|
|
447
|
+
}
|
|
448
|
+
};
|
|
449
|
+
const create_dbs_pouch = async function (db) {
|
|
450
|
+
try {
|
|
451
|
+
return await func.db.pouch[serviceP](SESSION_ID, dataP);
|
|
452
|
+
} catch (err) {
|
|
453
|
+
return await perform_rpi_request(serviceP);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
442
456
|
|
|
443
457
|
if (
|
|
444
458
|
(typeof IS_DOCKER === "undefined" &&
|
|
445
459
|
typeof IS_PROCESS_SERVER === "undefined") ||
|
|
446
460
|
!SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes(serviceP)
|
|
447
461
|
) {
|
|
448
|
-
if (
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
+
if (SESSION_OBJ[SESSION_ID].engine_mode === "live_preview") {
|
|
463
|
+
const db = await func.utils.connect_pouchdb(SESSION_ID);
|
|
464
|
+
switch (serviceP) {
|
|
465
|
+
case "dbs_read": {
|
|
466
|
+
try {
|
|
467
|
+
const ret = {
|
|
468
|
+
code: 1,
|
|
469
|
+
data: await read_dbs_pouch(db),
|
|
470
|
+
};
|
|
471
|
+
return success_callback(ret);
|
|
472
|
+
} catch (err) {
|
|
473
|
+
return error_callback(err);
|
|
474
|
+
}
|
|
475
|
+
break;
|
|
476
|
+
}
|
|
477
|
+
case "dbs_update": {
|
|
478
|
+
try {
|
|
479
|
+
const ret = {
|
|
480
|
+
code: 1,
|
|
481
|
+
data: await update_dbs_pouch(db),
|
|
482
|
+
};
|
|
483
|
+
return success_callback(ret);
|
|
484
|
+
} catch (err) {
|
|
485
|
+
return error_callback(err);
|
|
486
|
+
}
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
case "dbs_create": {
|
|
490
|
+
try {
|
|
491
|
+
const ret = {
|
|
492
|
+
code: 1,
|
|
493
|
+
data: await create_dbs_pouch(db),
|
|
494
|
+
};
|
|
495
|
+
return success_callback(ret);
|
|
496
|
+
} catch (err) {
|
|
497
|
+
return error_callback(err);
|
|
498
|
+
}
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
default:
|
|
503
|
+
try {
|
|
504
|
+
const json = await perform_rpi_request(serviceP);
|
|
505
|
+
return success_callback(json, true);
|
|
506
|
+
} catch (err) {
|
|
507
|
+
return error_callback(err);
|
|
508
|
+
}
|
|
509
|
+
break;
|
|
462
510
|
}
|
|
463
511
|
|
|
464
|
-
//
|
|
465
|
-
//
|
|
466
|
-
//
|
|
467
|
-
//
|
|
468
|
-
//
|
|
512
|
+
// if (
|
|
513
|
+
// SESSION_OBJ[SESSION_ID].engine_mode === "live_preview" &&
|
|
514
|
+
// ["dbs_read", "dbs_update", "dbs_delete", "dbs_create"].includes(
|
|
515
|
+
// serviceP
|
|
516
|
+
// )
|
|
517
|
+
// ) {
|
|
518
|
+
// try {
|
|
519
|
+
// const ret = {
|
|
520
|
+
// code: 1,
|
|
521
|
+
// data: await perform_rpi_request_from_pouch(serviceP),
|
|
522
|
+
// };
|
|
523
|
+
// return success_callback(ret);
|
|
524
|
+
// } catch (err) {
|
|
525
|
+
// return error_callback(err);
|
|
526
|
+
// }
|
|
527
|
+
|
|
528
|
+
// // const ret = {
|
|
529
|
+
// // code: 1,
|
|
530
|
+
// // data: await perform_rpi_request_from_pouch(serviceP),
|
|
531
|
+
// // };
|
|
532
|
+
// // return success_callback(ret);
|
|
533
|
+
// }
|
|
469
534
|
}
|
|
470
535
|
try {
|
|
471
536
|
const json = await perform_rpi_request(serviceP);
|
|
@@ -1525,6 +1590,8 @@ func.datasource.prepare = async function (
|
|
|
1525
1590
|
_ds.data_system["SYS_GLOBAL_BOL_CONTROL_KEY_STATE"] = 0;
|
|
1526
1591
|
_ds.data_system["SYS_GLOBAL_BOL_ALT_KEY_STATE"] = 0;
|
|
1527
1592
|
|
|
1593
|
+
_ds.data_system["SYS_GLOBAL_BOL_ONLINE"] = 0;
|
|
1594
|
+
|
|
1528
1595
|
_ds.data_system["SYS_GLOBAL_STR_FIREBASE_TOKEN_ID"] = 0;
|
|
1529
1596
|
|
|
1530
1597
|
_ds.data_system["SYS_GLOBAL_BOL_PUSH_NOTIFICATION_GRANTED"] =
|