@xuda.io/xuda-worker-bundle-min 1.3.496 → 1.3.498
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 -78
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -409,100 +409,109 @@ func.common.db = async function (
|
|
|
409
409
|
}
|
|
410
410
|
};
|
|
411
411
|
const delete_dbs_pouch = async function (db) {
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
412
|
+
for await (let row_id of dataP.ids) {
|
|
413
|
+
try {
|
|
414
|
+
const { code: table_req_code, data: table_req_id } =
|
|
415
|
+
await validate_existence_of_whole_table_request(db);
|
|
415
416
|
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
417
|
+
if (table_req_code > 0) {
|
|
418
|
+
data.full_table_downloaded = true;
|
|
419
|
+
}
|
|
419
420
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
421
|
+
await db.get(row_id);
|
|
422
|
+
let _data = _.cloneDeep(dataP);
|
|
423
|
+
_data.ids = [row_id];
|
|
424
|
+
return await func.db.pouch["dbs_delete"](SESSION_ID, _data);
|
|
425
|
+
} catch (err) {
|
|
426
|
+
return await func.common.perform_rpi_request(
|
|
427
|
+
SESSION_ID,
|
|
428
|
+
serviceP,
|
|
429
|
+
opt,
|
|
430
|
+
data
|
|
431
|
+
);
|
|
432
|
+
}
|
|
429
433
|
}
|
|
430
434
|
};
|
|
431
435
|
if (
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
436
|
+
typeof IS_DOCKER === "undefined" &&
|
|
437
|
+
typeof IS_PROCESS_SERVER === "undefined"
|
|
438
|
+
// ||
|
|
439
|
+
// !SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes(serviceP)
|
|
435
440
|
) {
|
|
436
441
|
// (await func.db.pouch.get_replication_stat(SESSION_ID)) &&
|
|
437
442
|
// (_session.engine_mode === "live_preview" ||
|
|
438
443
|
// APP_OBJ[_session.APP_ID].app_available_offline)
|
|
444
|
+
|
|
439
445
|
try {
|
|
440
|
-
if (
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
446
|
+
if (!SESSION_OBJ?.[SESSION_ID]?.rpi_http_methods?.includes(serviceP)) {
|
|
447
|
+
throw "";
|
|
448
|
+
}
|
|
449
|
+
if (!(await func?.db?.pouch?.get_replication_stat(SESSION_ID)))
|
|
450
|
+
throw "";
|
|
451
|
+
const db = await func.utils.connect_pouchdb(SESSION_ID);
|
|
452
|
+
switch (serviceP) {
|
|
453
|
+
case "dbs_read": {
|
|
454
|
+
try {
|
|
455
|
+
return success_callback(await read_dbs_pouch(db));
|
|
456
|
+
} catch (err) {
|
|
457
|
+
if (err === "creating index in progress") {
|
|
458
|
+
throw "";
|
|
451
459
|
}
|
|
452
|
-
|
|
460
|
+
return error_callback(err);
|
|
453
461
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
}
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
462
|
+
break;
|
|
463
|
+
}
|
|
464
|
+
case "dbs_update": {
|
|
465
|
+
try {
|
|
466
|
+
const ret = {
|
|
467
|
+
code: 1,
|
|
468
|
+
data: await update_dbs_pouch(db),
|
|
469
|
+
};
|
|
470
|
+
return success_callback(ret);
|
|
471
|
+
} catch (err) {
|
|
472
|
+
return error_callback(err);
|
|
465
473
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
}
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
474
|
+
break;
|
|
475
|
+
}
|
|
476
|
+
case "dbs_create": {
|
|
477
|
+
try {
|
|
478
|
+
const ret = {
|
|
479
|
+
code: 1,
|
|
480
|
+
data: await create_dbs_pouch(db),
|
|
481
|
+
};
|
|
482
|
+
return success_callback(ret);
|
|
483
|
+
} catch (err) {
|
|
484
|
+
return error_callback(err);
|
|
477
485
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
}
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
486
|
+
break;
|
|
487
|
+
}
|
|
488
|
+
case "dbs_delete": {
|
|
489
|
+
try {
|
|
490
|
+
const ret = {
|
|
491
|
+
code: 1,
|
|
492
|
+
data: await delete_dbs_pouch(db),
|
|
493
|
+
};
|
|
494
|
+
return success_callback(ret);
|
|
495
|
+
} catch (err) {
|
|
496
|
+
return error_callback(err);
|
|
489
497
|
}
|
|
490
|
-
|
|
491
|
-
default:
|
|
492
|
-
// try {
|
|
493
|
-
// const json = await func.common.perform_rpi_request(
|
|
494
|
-
// SESSION_ID,
|
|
495
|
-
// serviceP,
|
|
496
|
-
// opt,
|
|
497
|
-
// data
|
|
498
|
-
// );
|
|
499
|
-
// return success_callback(json, true);
|
|
500
|
-
// } catch (err) {
|
|
501
|
-
// return error_callback(err);
|
|
502
|
-
// }
|
|
503
|
-
throw "";
|
|
504
|
-
break;
|
|
498
|
+
break;
|
|
505
499
|
}
|
|
500
|
+
|
|
501
|
+
default:
|
|
502
|
+
// try {
|
|
503
|
+
// const json = await func.common.perform_rpi_request(
|
|
504
|
+
// SESSION_ID,
|
|
505
|
+
// serviceP,
|
|
506
|
+
// opt,
|
|
507
|
+
// data
|
|
508
|
+
// );
|
|
509
|
+
// return success_callback(json, true);
|
|
510
|
+
// } catch (err) {
|
|
511
|
+
// return error_callback(err);
|
|
512
|
+
// }
|
|
513
|
+
throw "";
|
|
514
|
+
break;
|
|
506
515
|
}
|
|
507
516
|
} catch (err) {
|
|
508
517
|
try {
|
|
@@ -1498,6 +1507,7 @@ func.datasource.prepare = async function (
|
|
|
1498
1507
|
worker_id
|
|
1499
1508
|
) {
|
|
1500
1509
|
const set_parameters = async function () {
|
|
1510
|
+
var _session = SESSION_OBJ[SESSION_ID];
|
|
1501
1511
|
const get_Out_parameters = async function (
|
|
1502
1512
|
fieldIdP,
|
|
1503
1513
|
located_field_param_idxP,
|