@xuda.io/drive_module 1.1.1405 → 1.1.1407
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.mjs +53 -52
- package/index_ms.mjs +78 -69
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -27,10 +27,11 @@ global._conf = (
|
|
|
27
27
|
|
|
28
28
|
const _common = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda_node_common.mjs'));
|
|
29
29
|
const _utils = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda-cpi-utils.mjs'));
|
|
30
|
+
const { get_account_default_project_id } = await import(path.join(process.env.XUDA_HOME, 'common', 'cache_cpi.mjs'));
|
|
30
31
|
|
|
31
32
|
const module_path = path.join(process.env.XUDA_HOME, 'cpi') + (!_conf.is_debug ? '/node_modules/@xuda.io' : '');
|
|
32
33
|
const fs_module = await import(`${module_path}/fs_module/index.mjs`);
|
|
33
|
-
const
|
|
34
|
+
const db_ms = await import(`${module_path}/db_module/index_ms.mjs`);
|
|
34
35
|
|
|
35
36
|
const account_ms = await import(`${module_path}/account_module/index_ms.mjs`);
|
|
36
37
|
|
|
@@ -265,11 +266,11 @@ export const get_drive_files = async (req) => {
|
|
|
265
266
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
266
267
|
opt.selector.docType = 'workspace_drive';
|
|
267
268
|
|
|
268
|
-
const ret = await
|
|
269
|
+
const ret = await db_ms.find_app_couch_query(app_id, opt);
|
|
269
270
|
|
|
270
|
-
const file_doc = await
|
|
271
|
+
const file_doc = await db_ms.get_app_couch_doc(app_id, path.basename(file_path) || '/');
|
|
271
272
|
|
|
272
|
-
const { data: app_obj } = await
|
|
273
|
+
const { data: app_obj } = await db_ms.get_app_obj(app_id);
|
|
273
274
|
|
|
274
275
|
const ret_fetch_drive_files = await fetch_drive_files(ret, file_doc, app_id_reference, null, app_obj.app_datacenter_id, app_obj.is_deployment ? app_obj.app_access_url : undefined, app_obj);
|
|
275
276
|
return {
|
|
@@ -291,9 +292,9 @@ export const get_drive_files = async (req) => {
|
|
|
291
292
|
if (search_string) {
|
|
292
293
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
293
294
|
opt.selector.docType = 'studio_drive';
|
|
294
|
-
const ret = await
|
|
295
|
+
const ret = await db_ms.find_app_couch_query(app_id, opt);
|
|
295
296
|
|
|
296
|
-
const file_doc = await
|
|
297
|
+
const file_doc = await db_ms.get_app_couch_doc(app_id, path.basename(file_path) || '/');
|
|
297
298
|
|
|
298
299
|
return {
|
|
299
300
|
code: 1,
|
|
@@ -343,7 +344,7 @@ export const get_drive_files = async (req) => {
|
|
|
343
344
|
const directory_path = get_studio_path(val.path, app_id_master, val.relativePath);
|
|
344
345
|
const file_path = path.join(directory_path, val.name);
|
|
345
346
|
|
|
346
|
-
let ret = await
|
|
347
|
+
let ret = await db_ms.get_app_couch_doc(app_id_master, file_path);
|
|
347
348
|
|
|
348
349
|
if (ret.code > -1) {
|
|
349
350
|
if (val.type === 'file') {
|
|
@@ -438,12 +439,12 @@ export const get_drive_file_info = async (req, job_id, headers) => {
|
|
|
438
439
|
delete doc.bucket;
|
|
439
440
|
|
|
440
441
|
if (doc.uid) {
|
|
441
|
-
let ret = await
|
|
442
|
+
let ret = await db_ms.get_couch_doc('xuda_accounts', doc.uid);
|
|
442
443
|
doc.account_info = ret.data.account_info;
|
|
443
444
|
}
|
|
444
445
|
if (req.drive_type === 'workspace') {
|
|
445
446
|
const app_id_master = await _common.get_project_app_id(app_id, true);
|
|
446
|
-
const ret = await
|
|
447
|
+
const ret = await db_ms.get_app_obj(app_id_master);
|
|
447
448
|
|
|
448
449
|
if (ret.code < 0) {
|
|
449
450
|
return ret;
|
|
@@ -512,7 +513,7 @@ export const delete_drive_files = async (req, job_id, headers) => {
|
|
|
512
513
|
if (doc.type === 'file') {
|
|
513
514
|
doc.ts = Date.now();
|
|
514
515
|
doc.stat = 4;
|
|
515
|
-
save_ret = await
|
|
516
|
+
save_ret = await db_ms.save_app_couch_doc(app_id_reference, doc);
|
|
516
517
|
}
|
|
517
518
|
|
|
518
519
|
misc_ms.rsync_drive_resources_to_remote_servers('studio', app_id_reference);
|
|
@@ -526,12 +527,12 @@ export const delete_drive_files = async (req, job_id, headers) => {
|
|
|
526
527
|
if (doc.bucket) {
|
|
527
528
|
await delete_file_from_bucket(doc.bucket);
|
|
528
529
|
} else {
|
|
529
|
-
const { data: app_obj } = await
|
|
530
|
+
const { data: app_obj } = await db_ms.get_app_obj(app_id);
|
|
530
531
|
if (app_obj?.app_type === 'datacenter') {
|
|
531
532
|
const host = `root@${app_obj.app_hosting_server.ip}`;
|
|
532
533
|
await _utils.run_ssh_script(`ssh ${host} "rm /var/xuda/workspace_drive/${doc.server_file_name};" `);
|
|
533
534
|
} else if (app_obj?.is_deployment) {
|
|
534
|
-
const { data: datacenter_obj } = await
|
|
535
|
+
const { data: datacenter_obj } = await db_ms.get_app_obj(app_obj.app_datacenter_id);
|
|
535
536
|
const host = `root@${datacenter_obj.app_hosting_server.ip}`;
|
|
536
537
|
await _utils.run_ssh_script(`ssh ${host} "rm /var/xuda/workspace_drive/${doc.server_file_name};" `);
|
|
537
538
|
}
|
|
@@ -612,7 +613,7 @@ export const update_drive_file = async (req, job_id, headers, file_obj) => {
|
|
|
612
613
|
case 'studio': {
|
|
613
614
|
ref = await _common.get_project_app_id(app_id, true);
|
|
614
615
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
615
|
-
save_ret = await
|
|
616
|
+
save_ret = await db_ms.save_app_couch_doc(app_id_reference, doc);
|
|
616
617
|
|
|
617
618
|
misc_ms.rsync_drive_resources_to_remote_servers('studio', app_id_reference);
|
|
618
619
|
break;
|
|
@@ -622,19 +623,19 @@ export const update_drive_file = async (req, job_id, headers, file_obj) => {
|
|
|
622
623
|
const app_id_master = await _common.get_project_app_id(app_id, true);
|
|
623
624
|
ref = app_id_master;
|
|
624
625
|
|
|
625
|
-
const { data: app_obj } = await
|
|
626
|
+
const { data: app_obj } = await db_ms.get_app_obj(app_id);
|
|
626
627
|
if (app_obj?.app_type === 'datacenter') {
|
|
627
628
|
const host = `root@${app_obj.app_hosting_server.ip}`;
|
|
628
629
|
await _utils.run_ssh_script(`scp ${tempPath} ${host}:/var/xuda/workspace_drive/${doc.server_file_name}; `);
|
|
629
630
|
} else if (app_obj?.is_deployment) {
|
|
630
|
-
const { data: datacenter_obj } = await
|
|
631
|
+
const { data: datacenter_obj } = await db_ms.get_app_obj(app_obj.app_datacenter_id);
|
|
631
632
|
const host = `root@${datacenter_obj.app_hosting_server.ip}`;
|
|
632
633
|
await _utils.run_ssh_script(`scp ${tempPath} ${host}:/var/xuda/workspace_drive/${doc.server_file_name}; `);
|
|
633
634
|
} else {
|
|
634
635
|
doc.bucket[`${process.env.XUDA_HOSTNAME}`] = await upload_file_to_spaces(tempPath, app_id_master, drive_type, doc.server_file_name);
|
|
635
636
|
}
|
|
636
637
|
|
|
637
|
-
save_ret = await
|
|
638
|
+
save_ret = await db_ms.save_app_couch_doc(app_id_reference, doc);
|
|
638
639
|
break;
|
|
639
640
|
}
|
|
640
641
|
case 'user': {
|
|
@@ -740,7 +741,7 @@ export const create_drive_folder = async (req, job_id, headers) => {
|
|
|
740
741
|
}
|
|
741
742
|
await create_directory(fs_target_dir, 0o775, true);
|
|
742
743
|
doc._id = target_dir;
|
|
743
|
-
save_ret = await
|
|
744
|
+
save_ret = await db_ms.save_app_couch_doc(app_id_master, doc);
|
|
744
745
|
misc_ms.rsync_drive_resources_to_remote_servers('studio', app_id_master);
|
|
745
746
|
break;
|
|
746
747
|
}
|
|
@@ -749,7 +750,7 @@ export const create_drive_folder = async (req, job_id, headers) => {
|
|
|
749
750
|
folder_id = 'drive_folder_' + _utils.UUID();
|
|
750
751
|
let app_id_reference = await _common.get_project_app_id(app_id);
|
|
751
752
|
doc._id = folder_id;
|
|
752
|
-
save_ret = await
|
|
753
|
+
save_ret = await db_ms.save_app_couch_doc(app_id_reference, doc);
|
|
753
754
|
break;
|
|
754
755
|
}
|
|
755
756
|
|
|
@@ -791,7 +792,7 @@ export const rename_drive_file = async (req, job_id, headers) => {
|
|
|
791
792
|
let app_id_master = await _common.get_project_app_id(app_id, true);
|
|
792
793
|
|
|
793
794
|
doc._delete = true;
|
|
794
|
-
await
|
|
795
|
+
await db_ms.save_app_couch_doc(app_id_master, doc);
|
|
795
796
|
|
|
796
797
|
doc._id = file_name_to;
|
|
797
798
|
delete doc._rev;
|
|
@@ -805,7 +806,7 @@ export const rename_drive_file = async (req, job_id, headers) => {
|
|
|
805
806
|
case 'workspace':
|
|
806
807
|
case 'studio':
|
|
807
808
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
808
|
-
save_ret = await
|
|
809
|
+
save_ret = await db_ms.save_app_couch_doc(app_id_reference, doc);
|
|
809
810
|
break;
|
|
810
811
|
|
|
811
812
|
case 'user':
|
|
@@ -852,10 +853,10 @@ export const rename_drive_folder = async (req) => {
|
|
|
852
853
|
throw new Error('error - new_path unauthorized');
|
|
853
854
|
}
|
|
854
855
|
|
|
855
|
-
doc_ret = await
|
|
856
|
+
doc_ret = await db_ms.get_app_couch_doc(app_id_reference, curr_path);
|
|
856
857
|
await fs_module.rename(curr_path, new_path);
|
|
857
858
|
doc_ret.data._delete = true;
|
|
858
|
-
await
|
|
859
|
+
await db_ms.save_app_couch_doc(app_id_reference, doc_ret.data);
|
|
859
860
|
|
|
860
861
|
doc_ret.data._id = new_path;
|
|
861
862
|
delete doc_ret.data._rev;
|
|
@@ -865,7 +866,7 @@ export const rename_drive_folder = async (req) => {
|
|
|
865
866
|
}
|
|
866
867
|
case 'workspace': {
|
|
867
868
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
868
|
-
doc_ret = await
|
|
869
|
+
doc_ret = await db_ms.get_app_couch_doc(app_id_reference, curr_path);
|
|
869
870
|
if (doc_ret.code < 0) {
|
|
870
871
|
throw new Error(doc_ret.data);
|
|
871
872
|
}
|
|
@@ -895,7 +896,7 @@ export const rename_drive_folder = async (req) => {
|
|
|
895
896
|
case 'workspace':
|
|
896
897
|
case 'studio':
|
|
897
898
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
898
|
-
save_ret = await
|
|
899
|
+
save_ret = await db_ms.save_app_couch_doc(app_id_reference, doc);
|
|
899
900
|
break;
|
|
900
901
|
|
|
901
902
|
case 'user':
|
|
@@ -1025,7 +1026,7 @@ export const extract_drive_file = async (req, job_id, headers) => {
|
|
|
1025
1026
|
}
|
|
1026
1027
|
|
|
1027
1028
|
try {
|
|
1028
|
-
await
|
|
1029
|
+
await db_ms.save_app_couch_doc(app_id_reference, file_doc);
|
|
1029
1030
|
} catch (error) {}
|
|
1030
1031
|
})
|
|
1031
1032
|
.on('close', () => {
|
|
@@ -1195,7 +1196,7 @@ export const upload_drive_file = async (req, job_id, headers = {}, file_obj) =>
|
|
|
1195
1196
|
|
|
1196
1197
|
doc._id = file_name;
|
|
1197
1198
|
|
|
1198
|
-
save_ret = await
|
|
1199
|
+
save_ret = await db_ms.save_app_couch_doc(ref, doc);
|
|
1199
1200
|
misc_ms.rsync_drive_resources_to_remote_servers('studio', app_id);
|
|
1200
1201
|
break;
|
|
1201
1202
|
}
|
|
@@ -1212,12 +1213,12 @@ export const upload_drive_file = async (req, job_id, headers = {}, file_obj) =>
|
|
|
1212
1213
|
doc.app_id = app_id;
|
|
1213
1214
|
doc.app_id_reference = ref;
|
|
1214
1215
|
|
|
1215
|
-
const { data: app_obj } = await
|
|
1216
|
+
const { data: app_obj } = await db_ms.get_app_obj(app_id);
|
|
1216
1217
|
if (app_obj?.app_type === 'datacenter') {
|
|
1217
1218
|
const host = `root@${app_obj.app_hosting_server.ip}`;
|
|
1218
1219
|
await _utils.run_ssh_script(`scp ${tempPath} ${host}:/var/xuda/workspace_drive/${file_name}; `);
|
|
1219
1220
|
} else if (app_obj?.is_deployment) {
|
|
1220
|
-
const { data: datacenter_obj } = await
|
|
1221
|
+
const { data: datacenter_obj } = await db_ms.get_app_obj(app_obj.app_datacenter_id);
|
|
1221
1222
|
const host = `root@${datacenter_obj.app_hosting_server.ip}`;
|
|
1222
1223
|
await _utils.run_ssh_script(`scp ${tempPath} ${host}:/var/xuda/workspace_drive/${file_name}; `);
|
|
1223
1224
|
} else {
|
|
@@ -1226,7 +1227,7 @@ export const upload_drive_file = async (req, job_id, headers = {}, file_obj) =>
|
|
|
1226
1227
|
};
|
|
1227
1228
|
}
|
|
1228
1229
|
doc._id = file_name;
|
|
1229
|
-
save_ret = await
|
|
1230
|
+
save_ret = await db_ms.save_app_couch_doc(await _common.get_project_app_id(req.app_id), doc);
|
|
1230
1231
|
break;
|
|
1231
1232
|
}
|
|
1232
1233
|
case 'user': {
|
|
@@ -1309,7 +1310,7 @@ export const check_drive_file = async (req, job_id, headers, file_obj) => {
|
|
|
1309
1310
|
}
|
|
1310
1311
|
case 'workspace': {
|
|
1311
1312
|
selector.docType = 'workspace_drive';
|
|
1312
|
-
const workspace_drive_res = await
|
|
1313
|
+
const workspace_drive_res = await db_ms.find_app_couch_query(app_id, {
|
|
1313
1314
|
selector,
|
|
1314
1315
|
limit: 99,
|
|
1315
1316
|
});
|
|
@@ -1504,7 +1505,7 @@ export const run_drive_pending_ocr = async () => {
|
|
|
1504
1505
|
limit: 99999,
|
|
1505
1506
|
};
|
|
1506
1507
|
|
|
1507
|
-
let app_res = await
|
|
1508
|
+
let app_res = await db_ms.find_couch_query('xuda_master', app_opt);
|
|
1508
1509
|
|
|
1509
1510
|
for (let app of app_res.docs) {
|
|
1510
1511
|
let opt = {
|
|
@@ -1512,13 +1513,13 @@ export const run_drive_pending_ocr = async () => {
|
|
|
1512
1513
|
limit: 1,
|
|
1513
1514
|
};
|
|
1514
1515
|
|
|
1515
|
-
const user_drive_res = await
|
|
1516
|
+
const user_drive_res = await db_ms.find_app_couch_query(app._id, opt);
|
|
1516
1517
|
for await (let doc of user_drive_res.docs) {
|
|
1517
1518
|
await ocr_drive_file(null, doc);
|
|
1518
1519
|
}
|
|
1519
1520
|
|
|
1520
1521
|
opt.selector.docType = 'workspace_drive';
|
|
1521
|
-
const app_drive_res = await
|
|
1522
|
+
const app_drive_res = await db_ms.find_app_couch_query(app._id, opt);
|
|
1522
1523
|
for await (let doc of app_drive_res.docs) {
|
|
1523
1524
|
await ocr_drive_file(app._id, doc);
|
|
1524
1525
|
}
|
|
@@ -1686,10 +1687,10 @@ const get_folder_size = async (dir, drive_type, app_id, uid) => {
|
|
|
1686
1687
|
if (drive_type === 'user') {
|
|
1687
1688
|
// opt.selector.uid = uid;
|
|
1688
1689
|
|
|
1689
|
-
const app_id = await
|
|
1690
|
-
ret = await
|
|
1690
|
+
const app_id = await get_account_default_project_id(uid);
|
|
1691
|
+
ret = await db_ms.find_app_couch_query(app_id, opt);
|
|
1691
1692
|
} else {
|
|
1692
|
-
ret = await
|
|
1693
|
+
ret = await db_ms.find_app_couch_query(app_id, opt);
|
|
1693
1694
|
}
|
|
1694
1695
|
|
|
1695
1696
|
for await (let doc of ret.docs) {
|
|
@@ -1784,7 +1785,7 @@ const get_drive_doc = async (type, drive_type, app_id, uid, file_path, headers)
|
|
|
1784
1785
|
switch (drive_type) {
|
|
1785
1786
|
case 'studio': {
|
|
1786
1787
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
1787
|
-
doc_ret = await
|
|
1788
|
+
doc_ret = await db_ms.get_app_couch_doc(app_id_reference, file_path);
|
|
1788
1789
|
break;
|
|
1789
1790
|
}
|
|
1790
1791
|
case 'user':
|
|
@@ -1795,7 +1796,7 @@ const get_drive_doc = async (type, drive_type, app_id, uid, file_path, headers)
|
|
|
1795
1796
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
1796
1797
|
const app_id_master = await _common.get_project_app_id(app_id, true);
|
|
1797
1798
|
|
|
1798
|
-
doc_ret = await
|
|
1799
|
+
doc_ret = await db_ms.get_app_couch_doc(app_id_reference, check_existing_file_ret.duplicates[0]._id);
|
|
1799
1800
|
|
|
1800
1801
|
if (doc_ret?.data?.type === 'file' && !doc_ret?.data?._id.includes(app_id) && !doc_ret?.data?._id.includes(app_id_master)) {
|
|
1801
1802
|
throw new Error('file_path unauthorized');
|
|
@@ -1833,7 +1834,7 @@ const get_drive_doc = async (type, drive_type, app_id, uid, file_path, headers)
|
|
|
1833
1834
|
app_id_reference: await _common.get_project_app_id(app_id, true),
|
|
1834
1835
|
uid,
|
|
1835
1836
|
};
|
|
1836
|
-
const save_ret = await
|
|
1837
|
+
const save_ret = await db_ms.save_app_couch_doc(app_id_reference, doc);
|
|
1837
1838
|
if (save_ret.code < 0) {
|
|
1838
1839
|
throw new Error('studio file doc save error');
|
|
1839
1840
|
}
|
|
@@ -1855,7 +1856,7 @@ const save_drive_doc = async (drive_type, uid, app_id, doc) => {
|
|
|
1855
1856
|
case 'workspace':
|
|
1856
1857
|
case 'studio':
|
|
1857
1858
|
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
1858
|
-
save_ret = await
|
|
1859
|
+
save_ret = await db_ms.save_app_couch_doc(app_id_reference, doc);
|
|
1859
1860
|
break;
|
|
1860
1861
|
|
|
1861
1862
|
case 'user':
|
|
@@ -2043,7 +2044,7 @@ export default {
|
|
|
2043
2044
|
doc.vite_build_res = vite_build_res;
|
|
2044
2045
|
doc.scriptData.dependencies = devDependencies;
|
|
2045
2046
|
|
|
2046
|
-
|
|
2047
|
+
db_ms.save_app_couch_doc(app_id, doc);
|
|
2047
2048
|
} catch (err) {
|
|
2048
2049
|
doc.vite_build_res = {
|
|
2049
2050
|
code: -1,
|
|
@@ -2053,7 +2054,7 @@ export default {
|
|
|
2053
2054
|
if (job_id) {
|
|
2054
2055
|
return doc.vite_build_res;
|
|
2055
2056
|
}
|
|
2056
|
-
|
|
2057
|
+
db_ms.save_app_couch_doc(app_id, doc);
|
|
2057
2058
|
}
|
|
2058
2059
|
};
|
|
2059
2060
|
|
|
@@ -2086,21 +2087,21 @@ export const update_drive_addons = async (req, job_id) => {
|
|
|
2086
2087
|
let save_ret;
|
|
2087
2088
|
if (drive_type === 'workspace' || drive_type === 'studio') {
|
|
2088
2089
|
const master_id = await _common.get_project_app_id(app_id, true);
|
|
2089
|
-
let app_obj_ret = await
|
|
2090
|
+
let app_obj_ret = await db_ms.get_app_obj(master_id);
|
|
2090
2091
|
if (app_obj_ret.data.drive_addons) {
|
|
2091
2092
|
drive_addons = app_obj_ret.data.drive_addons;
|
|
2092
2093
|
}
|
|
2093
2094
|
set_drive_addons(drive_addons);
|
|
2094
|
-
save_ret = await
|
|
2095
|
+
save_ret = await db_ms.save_app_couch_doc2(master_id, app_obj_ret.data);
|
|
2095
2096
|
}
|
|
2096
2097
|
if (drive_type === 'user') {
|
|
2097
|
-
let account_ret = await
|
|
2098
|
+
let account_ret = await db_ms.get_couch_doc('xuda_accounts', uid);
|
|
2098
2099
|
|
|
2099
2100
|
if (account_ret.data.drive_addons) {
|
|
2100
2101
|
drive_addons = account_ret.data.drive_addons;
|
|
2101
2102
|
}
|
|
2102
2103
|
set_drive_addons(drive_addons);
|
|
2103
|
-
save_ret = await
|
|
2104
|
+
save_ret = await db_ms.save_couch_doc('xuda_accounts', account_ret.data);
|
|
2104
2105
|
}
|
|
2105
2106
|
return save_ret;
|
|
2106
2107
|
};
|
|
@@ -2123,20 +2124,20 @@ export const getExtensionFromUrl = function (imageUrl) {
|
|
|
2123
2124
|
};
|
|
2124
2125
|
|
|
2125
2126
|
export const get_user_drive_file = async function (uid, filename) {
|
|
2126
|
-
const app_id = await
|
|
2127
|
-
const drive_ret = await
|
|
2127
|
+
const app_id = await get_account_default_project_id(uid);
|
|
2128
|
+
const drive_ret = await db_ms.get_app_couch_doc(app_id, filename);
|
|
2128
2129
|
return drive_ret;
|
|
2129
2130
|
};
|
|
2130
2131
|
|
|
2131
2132
|
export const save_user_drive_file = async function (uid, drive_doc) {
|
|
2132
|
-
const app_id = await
|
|
2133
|
-
const save_ret = await
|
|
2133
|
+
const app_id = await get_account_default_project_id(uid);
|
|
2134
|
+
const save_ret = await db_ms.save_app_couch_doc(app_id, drive_doc);
|
|
2134
2135
|
return save_ret;
|
|
2135
2136
|
};
|
|
2136
2137
|
|
|
2137
2138
|
export const find_contact_query = async function (uid, opt) {
|
|
2138
|
-
const app_id = await
|
|
2139
|
-
const ret = await
|
|
2139
|
+
const app_id = await get_account_default_project_id(uid);
|
|
2140
|
+
const ret = await db_ms.find_app_couch_query(app_id, opt);
|
|
2140
2141
|
return ret;
|
|
2141
2142
|
};
|
|
2142
2143
|
|
package/index_ms.mjs
CHANGED
|
@@ -3,271 +3,280 @@
|
|
|
3
3
|
// Queue target : drive_module
|
|
4
4
|
// =====================================================
|
|
5
5
|
|
|
6
|
-
import path from 'node:path';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
|
|
9
|
+
const { MessageBroker } = await import(path.join(process.env.XUDA_HOME, 'common', 'ms_broker.mjs'));
|
|
10
|
+
|
|
11
|
+
const broker = new MessageBroker();
|
|
12
|
+
|
|
13
|
+
await broker.init({
|
|
14
|
+
queueName: 'drive_module',
|
|
15
|
+
module_in: global.module_in
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
|
|
10
19
|
|
|
11
20
|
export const get_drive_files = async function (...args) {
|
|
12
|
-
return await
|
|
21
|
+
return await broker.send_to_queue("get_drive_files", ...args);
|
|
13
22
|
};
|
|
14
23
|
|
|
15
24
|
export const get_drive_file_info = async function (...args) {
|
|
16
|
-
return await
|
|
25
|
+
return await broker.send_to_queue("get_drive_file_info", ...args);
|
|
17
26
|
};
|
|
18
27
|
|
|
19
28
|
export const delete_drive_files = async function (...args) {
|
|
20
|
-
return await
|
|
29
|
+
return await broker.send_to_queue("delete_drive_files", ...args);
|
|
21
30
|
};
|
|
22
31
|
|
|
23
32
|
export const update_drive_file = async function (...args) {
|
|
24
|
-
return await
|
|
33
|
+
return await broker.send_to_queue("update_drive_file", ...args);
|
|
25
34
|
};
|
|
26
35
|
|
|
27
36
|
export const create_drive_folder = async function (...args) {
|
|
28
|
-
return await
|
|
37
|
+
return await broker.send_to_queue("create_drive_folder", ...args);
|
|
29
38
|
};
|
|
30
39
|
|
|
31
40
|
export const rename_drive_file = async function (...args) {
|
|
32
|
-
return await
|
|
41
|
+
return await broker.send_to_queue("rename_drive_file", ...args);
|
|
33
42
|
};
|
|
34
43
|
|
|
35
44
|
export const rename_drive_folder = async function (...args) {
|
|
36
|
-
return await
|
|
45
|
+
return await broker.send_to_queue("rename_drive_folder", ...args);
|
|
37
46
|
};
|
|
38
47
|
|
|
39
48
|
export const update_drive_file_sharing_mode = async function (...args) {
|
|
40
|
-
return await
|
|
49
|
+
return await broker.send_to_queue("update_drive_file_sharing_mode", ...args);
|
|
41
50
|
};
|
|
42
51
|
|
|
43
52
|
export const extract_drive_file = async function (...args) {
|
|
44
|
-
return await
|
|
53
|
+
return await broker.send_to_queue("extract_drive_file", ...args);
|
|
45
54
|
};
|
|
46
55
|
|
|
47
56
|
export const delete_file_bulk = async function (...args) {
|
|
48
|
-
return await
|
|
57
|
+
return await broker.send_to_queue("delete_file_bulk", ...args);
|
|
49
58
|
};
|
|
50
59
|
|
|
51
60
|
export const upload_drive_file = async function (...args) {
|
|
52
|
-
return await
|
|
61
|
+
return await broker.send_to_queue("upload_drive_file", ...args);
|
|
53
62
|
};
|
|
54
63
|
|
|
55
64
|
export const check_drive_file = async function (...args) {
|
|
56
|
-
return await
|
|
65
|
+
return await broker.send_to_queue("check_drive_file", ...args);
|
|
57
66
|
};
|
|
58
67
|
|
|
59
68
|
export const run_drive_pending_ocr = async function (...args) {
|
|
60
|
-
return await
|
|
69
|
+
return await broker.send_to_queue("run_drive_pending_ocr", ...args);
|
|
61
70
|
};
|
|
62
71
|
|
|
63
72
|
export const get_drive_size = async function (...args) {
|
|
64
|
-
return await
|
|
73
|
+
return await broker.send_to_queue("get_drive_size", ...args);
|
|
65
74
|
};
|
|
66
75
|
|
|
67
76
|
export const copy_file_to_another_bucket = async function (...args) {
|
|
68
|
-
return await
|
|
77
|
+
return await broker.send_to_queue("copy_file_to_another_bucket", ...args);
|
|
69
78
|
};
|
|
70
79
|
|
|
71
80
|
export const delete_file_from_bucket = async function (...args) {
|
|
72
|
-
return await
|
|
81
|
+
return await broker.send_to_queue("delete_file_from_bucket", ...args);
|
|
73
82
|
};
|
|
74
83
|
|
|
75
84
|
export const update_drive_file_tags = async function (...args) {
|
|
76
|
-
return await
|
|
85
|
+
return await broker.send_to_queue("update_drive_file_tags", ...args);
|
|
77
86
|
};
|
|
78
87
|
|
|
79
88
|
export const compile_javascript_program_in_studio_drive = async function (...args) {
|
|
80
|
-
return await
|
|
89
|
+
return await broker.send_to_queue("compile_javascript_program_in_studio_drive", ...args);
|
|
81
90
|
};
|
|
82
91
|
|
|
83
92
|
export const update_drive_addons = async function (...args) {
|
|
84
|
-
return await
|
|
93
|
+
return await broker.send_to_queue("update_drive_addons", ...args);
|
|
85
94
|
};
|
|
86
95
|
|
|
87
96
|
export const get_drive_files_workspace = async function (...args) {
|
|
88
|
-
return await
|
|
97
|
+
return await broker.send_to_queue("get_drive_files_workspace", ...args);
|
|
89
98
|
};
|
|
90
99
|
|
|
91
100
|
export const get_drive_files_studio = async function (...args) {
|
|
92
|
-
return await
|
|
101
|
+
return await broker.send_to_queue("get_drive_files_studio", ...args);
|
|
93
102
|
};
|
|
94
103
|
|
|
95
104
|
export const get_drive_files_user = async function (...args) {
|
|
96
|
-
return await
|
|
105
|
+
return await broker.send_to_queue("get_drive_files_user", ...args);
|
|
97
106
|
};
|
|
98
107
|
|
|
99
108
|
export const get_drive_file_info_workspace = async function (...args) {
|
|
100
|
-
return await
|
|
109
|
+
return await broker.send_to_queue("get_drive_file_info_workspace", ...args);
|
|
101
110
|
};
|
|
102
111
|
|
|
103
112
|
export const get_drive_file_info_studio = async function (...args) {
|
|
104
|
-
return await
|
|
113
|
+
return await broker.send_to_queue("get_drive_file_info_studio", ...args);
|
|
105
114
|
};
|
|
106
115
|
|
|
107
116
|
export const get_drive_file_info_user = async function (...args) {
|
|
108
|
-
return await
|
|
117
|
+
return await broker.send_to_queue("get_drive_file_info_user", ...args);
|
|
109
118
|
};
|
|
110
119
|
|
|
111
120
|
export const delete_drive_files_workspace = async function (...args) {
|
|
112
|
-
return await
|
|
121
|
+
return await broker.send_to_queue("delete_drive_files_workspace", ...args);
|
|
113
122
|
};
|
|
114
123
|
|
|
115
124
|
export const delete_drive_files_studio = async function (...args) {
|
|
116
|
-
return await
|
|
125
|
+
return await broker.send_to_queue("delete_drive_files_studio", ...args);
|
|
117
126
|
};
|
|
118
127
|
|
|
119
128
|
export const delete_drive_files_user = async function (...args) {
|
|
120
|
-
return await
|
|
129
|
+
return await broker.send_to_queue("delete_drive_files_user", ...args);
|
|
121
130
|
};
|
|
122
131
|
|
|
123
132
|
export const extract_drive_file_workspace = async function (...args) {
|
|
124
|
-
return await
|
|
133
|
+
return await broker.send_to_queue("extract_drive_file_workspace", ...args);
|
|
125
134
|
};
|
|
126
135
|
|
|
127
136
|
export const extract_drive_file_studio = async function (...args) {
|
|
128
|
-
return await
|
|
137
|
+
return await broker.send_to_queue("extract_drive_file_studio", ...args);
|
|
129
138
|
};
|
|
130
139
|
|
|
131
140
|
export const extract_drive_file_user = async function (...args) {
|
|
132
|
-
return await
|
|
141
|
+
return await broker.send_to_queue("extract_drive_file_user", ...args);
|
|
133
142
|
};
|
|
134
143
|
|
|
135
144
|
export const upload_drive_file_workspace = async function (...args) {
|
|
136
|
-
return await
|
|
145
|
+
return await broker.send_to_queue("upload_drive_file_workspace", ...args);
|
|
137
146
|
};
|
|
138
147
|
|
|
139
148
|
export const upload_drive_file_studio = async function (...args) {
|
|
140
|
-
return await
|
|
149
|
+
return await broker.send_to_queue("upload_drive_file_studio", ...args);
|
|
141
150
|
};
|
|
142
151
|
|
|
143
152
|
export const upload_drive_file_user = async function (...args) {
|
|
144
|
-
return await
|
|
153
|
+
return await broker.send_to_queue("upload_drive_file_user", ...args);
|
|
145
154
|
};
|
|
146
155
|
|
|
147
156
|
export const update_drive_file_workspace = async function (...args) {
|
|
148
|
-
return await
|
|
157
|
+
return await broker.send_to_queue("update_drive_file_workspace", ...args);
|
|
149
158
|
};
|
|
150
159
|
|
|
151
160
|
export const update_drive_file_studio = async function (...args) {
|
|
152
|
-
return await
|
|
161
|
+
return await broker.send_to_queue("update_drive_file_studio", ...args);
|
|
153
162
|
};
|
|
154
163
|
|
|
155
164
|
export const update_drive_file_user = async function (...args) {
|
|
156
|
-
return await
|
|
165
|
+
return await broker.send_to_queue("update_drive_file_user", ...args);
|
|
157
166
|
};
|
|
158
167
|
|
|
159
168
|
export const create_drive_folder_workspace = async function (...args) {
|
|
160
|
-
return await
|
|
169
|
+
return await broker.send_to_queue("create_drive_folder_workspace", ...args);
|
|
161
170
|
};
|
|
162
171
|
|
|
163
172
|
export const create_drive_folder_studio = async function (...args) {
|
|
164
|
-
return await
|
|
173
|
+
return await broker.send_to_queue("create_drive_folder_studio", ...args);
|
|
165
174
|
};
|
|
166
175
|
|
|
167
176
|
export const create_drive_folder_user = async function (...args) {
|
|
168
|
-
return await
|
|
177
|
+
return await broker.send_to_queue("create_drive_folder_user", ...args);
|
|
169
178
|
};
|
|
170
179
|
|
|
171
180
|
export const rename_drive_file_workspace = async function (...args) {
|
|
172
|
-
return await
|
|
181
|
+
return await broker.send_to_queue("rename_drive_file_workspace", ...args);
|
|
173
182
|
};
|
|
174
183
|
|
|
175
184
|
export const rename_drive_file_studio = async function (...args) {
|
|
176
|
-
return await
|
|
185
|
+
return await broker.send_to_queue("rename_drive_file_studio", ...args);
|
|
177
186
|
};
|
|
178
187
|
|
|
179
188
|
export const rename_drive_file_user = async function (...args) {
|
|
180
|
-
return await
|
|
189
|
+
return await broker.send_to_queue("rename_drive_file_user", ...args);
|
|
181
190
|
};
|
|
182
191
|
|
|
183
192
|
export const rename_drive_folder_workspace = async function (...args) {
|
|
184
|
-
return await
|
|
193
|
+
return await broker.send_to_queue("rename_drive_folder_workspace", ...args);
|
|
185
194
|
};
|
|
186
195
|
|
|
187
196
|
export const rename_drive_folder_studio = async function (...args) {
|
|
188
|
-
return await
|
|
197
|
+
return await broker.send_to_queue("rename_drive_folder_studio", ...args);
|
|
189
198
|
};
|
|
190
199
|
|
|
191
200
|
export const rename_drive_folder_user = async function (...args) {
|
|
192
|
-
return await
|
|
201
|
+
return await broker.send_to_queue("rename_drive_folder_user", ...args);
|
|
193
202
|
};
|
|
194
203
|
|
|
195
204
|
export const update_drive_file_sharing_mode_workspace = async function (...args) {
|
|
196
|
-
return await
|
|
205
|
+
return await broker.send_to_queue("update_drive_file_sharing_mode_workspace", ...args);
|
|
197
206
|
};
|
|
198
207
|
|
|
199
208
|
export const update_drive_file_sharing_mode_studio = async function (...args) {
|
|
200
|
-
return await
|
|
209
|
+
return await broker.send_to_queue("update_drive_file_sharing_mode_studio", ...args);
|
|
201
210
|
};
|
|
202
211
|
|
|
203
212
|
export const update_drive_file_sharing_mode_user = async function (...args) {
|
|
204
|
-
return await
|
|
213
|
+
return await broker.send_to_queue("update_drive_file_sharing_mode_user", ...args);
|
|
205
214
|
};
|
|
206
215
|
|
|
207
216
|
export const delete_file_bulk_workspace = async function (...args) {
|
|
208
|
-
return await
|
|
217
|
+
return await broker.send_to_queue("delete_file_bulk_workspace", ...args);
|
|
209
218
|
};
|
|
210
219
|
|
|
211
220
|
export const delete_file_bulk_studio = async function (...args) {
|
|
212
|
-
return await
|
|
221
|
+
return await broker.send_to_queue("delete_file_bulk_studio", ...args);
|
|
213
222
|
};
|
|
214
223
|
|
|
215
224
|
export const delete_file_bulk_user = async function (...args) {
|
|
216
|
-
return await
|
|
225
|
+
return await broker.send_to_queue("delete_file_bulk_user", ...args);
|
|
217
226
|
};
|
|
218
227
|
|
|
219
228
|
export const check_drive_file_workspace = async function (...args) {
|
|
220
|
-
return await
|
|
229
|
+
return await broker.send_to_queue("check_drive_file_workspace", ...args);
|
|
221
230
|
};
|
|
222
231
|
|
|
223
232
|
export const check_drive_file_studio = async function (...args) {
|
|
224
|
-
return await
|
|
233
|
+
return await broker.send_to_queue("check_drive_file_studio", ...args);
|
|
225
234
|
};
|
|
226
235
|
|
|
227
236
|
export const check_drive_file_user = async function (...args) {
|
|
228
|
-
return await
|
|
237
|
+
return await broker.send_to_queue("check_drive_file_user", ...args);
|
|
229
238
|
};
|
|
230
239
|
|
|
231
240
|
export const update_drive_file_tags_workspace = async function (...args) {
|
|
232
|
-
return await
|
|
241
|
+
return await broker.send_to_queue("update_drive_file_tags_workspace", ...args);
|
|
233
242
|
};
|
|
234
243
|
|
|
235
244
|
export const update_drive_file_tags_studio = async function (...args) {
|
|
236
|
-
return await
|
|
245
|
+
return await broker.send_to_queue("update_drive_file_tags_studio", ...args);
|
|
237
246
|
};
|
|
238
247
|
|
|
239
248
|
export const update_drive_file_tags_user = async function (...args) {
|
|
240
|
-
return await
|
|
249
|
+
return await broker.send_to_queue("update_drive_file_tags_user", ...args);
|
|
241
250
|
};
|
|
242
251
|
|
|
243
252
|
export const update_drive_addons_workspace = async function (...args) {
|
|
244
|
-
return await
|
|
253
|
+
return await broker.send_to_queue("update_drive_addons_workspace", ...args);
|
|
245
254
|
};
|
|
246
255
|
|
|
247
256
|
export const update_drive_addons_studio = async function (...args) {
|
|
248
|
-
return await
|
|
257
|
+
return await broker.send_to_queue("update_drive_addons_studio", ...args);
|
|
249
258
|
};
|
|
250
259
|
|
|
251
260
|
export const update_drive_addons_user = async function (...args) {
|
|
252
|
-
return await
|
|
261
|
+
return await broker.send_to_queue("update_drive_addons_user", ...args);
|
|
253
262
|
};
|
|
254
263
|
|
|
255
264
|
export const getExtensionFromUrl = async function (...args) {
|
|
256
|
-
return await
|
|
265
|
+
return await broker.send_to_queue("getExtensionFromUrl", ...args);
|
|
257
266
|
};
|
|
258
267
|
|
|
259
268
|
export const get_user_drive_file = async function (...args) {
|
|
260
|
-
return await
|
|
269
|
+
return await broker.send_to_queue("get_user_drive_file", ...args);
|
|
261
270
|
};
|
|
262
271
|
|
|
263
272
|
export const save_user_drive_file = async function (...args) {
|
|
264
|
-
return await
|
|
273
|
+
return await broker.send_to_queue("save_user_drive_file", ...args);
|
|
265
274
|
};
|
|
266
275
|
|
|
267
276
|
export const find_contact_query = async function (...args) {
|
|
268
|
-
return await
|
|
277
|
+
return await broker.send_to_queue("find_contact_query", ...args);
|
|
269
278
|
};
|
|
270
279
|
|
|
271
280
|
export const file_upload_validator = async function (...args) {
|
|
272
|
-
return await
|
|
281
|
+
return await broker.send_to_queue("file_upload_validator", ...args);
|
|
273
282
|
};
|