@xuda.io/drive_module 1.1.1445 → 1.1.1450
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 +47 -49
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -279,6 +279,7 @@ export const get_drive_files = async (req) => {
|
|
|
279
279
|
};
|
|
280
280
|
};
|
|
281
281
|
const get_user_files = async () => {
|
|
282
|
+
debugger;
|
|
282
283
|
opt.selector.docType = 'user_drive';
|
|
283
284
|
opt.selector.uid = uid;
|
|
284
285
|
const ret = await find_contact_query(uid, opt);
|
|
@@ -624,59 +625,57 @@ export const delete_drive_files = async (req, job_id, headers) => {
|
|
|
624
625
|
ret = await db_module.sava_app_couch_bulk_docs(app_id_delete, docs);
|
|
625
626
|
|
|
626
627
|
// cleanup
|
|
627
|
-
setTimeout(() => {
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
635
|
-
const target_dir = path.join(_conf[`studio_drive_path`], app_id_reference, doc.originalname);
|
|
628
|
+
setTimeout(async () => {
|
|
629
|
+
for (const doc of docs) {
|
|
630
|
+
try {
|
|
631
|
+
switch (drive_type) {
|
|
632
|
+
case 'studio': {
|
|
633
|
+
const app_id_reference = await _common.get_project_app_id(app_id);
|
|
634
|
+
const target_dir = path.join(_conf[`studio_drive_path`], app_id_reference, doc.originalname);
|
|
636
635
|
|
|
637
|
-
|
|
636
|
+
rimraf.sync(target_dir);
|
|
638
637
|
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
638
|
+
misc_msa.rsync_drive_resources_to_remote_servers('studio', app_id_reference);
|
|
639
|
+
break;
|
|
640
|
+
}
|
|
642
641
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
642
|
+
case 'workspace': {
|
|
643
|
+
if (doc.type === 'file') {
|
|
644
|
+
try {
|
|
645
|
+
if (doc.bucket) {
|
|
646
|
+
await delete_file_from_bucket(doc.bucket);
|
|
647
|
+
} else {
|
|
648
|
+
const { data: app_obj } = await db_module.get_app_obj(app_id);
|
|
649
|
+
if (app_obj?.app_type === 'datacenter') {
|
|
650
|
+
const host = `root@${app_obj.app_hosting_server.ip}`;
|
|
651
|
+
await _utils.run_ssh_script(`ssh ${host} "mv /var/xuda/workspace_drive/${doc.server_file_name} /tmp/;" `);
|
|
652
|
+
} else if (app_obj?.is_deployment) {
|
|
653
|
+
const { data: datacenter_obj } = await db_module.get_app_obj(app_obj.app_datacenter_id);
|
|
654
|
+
const host = `root@${datacenter_obj.app_hosting_server.ip}`;
|
|
655
|
+
await _utils.run_ssh_script(`ssh ${host} "mv /var/xuda/workspace_drive/${doc.server_file_name} /tmp/;" `);
|
|
656
|
+
}
|
|
657
657
|
}
|
|
658
|
-
}
|
|
659
|
-
}
|
|
658
|
+
} catch (error) {}
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
break;
|
|
660
662
|
}
|
|
661
663
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
+
case 'user': {
|
|
665
|
+
if (doc.type === 'file') {
|
|
666
|
+
try {
|
|
667
|
+
await delete_file_from_bucket(doc.bucket);
|
|
668
|
+
} catch (error) {}
|
|
669
|
+
}
|
|
664
670
|
|
|
665
|
-
|
|
666
|
-
if (doc.type === 'file') {
|
|
667
|
-
try {
|
|
668
|
-
await delete_file_from_bucket(doc.bucket);
|
|
669
|
-
} catch (error) {}
|
|
671
|
+
break;
|
|
670
672
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
+
default:
|
|
674
|
+
break;
|
|
673
675
|
}
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
} catch (error) {}
|
|
678
|
-
}
|
|
679
|
-
}, 1000);
|
|
676
|
+
} catch (error) {}
|
|
677
|
+
}
|
|
678
|
+
}, 1000);
|
|
680
679
|
return {
|
|
681
680
|
code: 200,
|
|
682
681
|
data: ret,
|
|
@@ -1980,8 +1979,6 @@ const save_drive_doc = async (drive_type, uid, app_id, doc) => {
|
|
|
1980
1979
|
};
|
|
1981
1980
|
|
|
1982
1981
|
export const compile_javascript_program_in_studio_drive = async (req, job_id) => {
|
|
1983
|
-
// debugger;
|
|
1984
|
-
|
|
1985
1982
|
const { app_id, doc } = req;
|
|
1986
1983
|
|
|
1987
1984
|
try {
|
|
@@ -2071,10 +2068,11 @@ export const compile_javascript_program_in_studio_drive = async (req, job_id) =>
|
|
|
2071
2068
|
for await (const dep of allDependencies) {
|
|
2072
2069
|
if (!devDependencies[dep]) {
|
|
2073
2070
|
console.log(`Adding dependency: ${dep}`);
|
|
2074
|
-
const npm_ret = await getPackageManifest({
|
|
2075
|
-
|
|
2076
|
-
});
|
|
2071
|
+
// const npm_ret = await getPackageManifest({
|
|
2072
|
+
// name: dep,
|
|
2073
|
+
// });
|
|
2077
2074
|
|
|
2075
|
+
const npm_ret = await getPackageManifest(dep);
|
|
2078
2076
|
devDependencies[dep] = npm_ret.version;
|
|
2079
2077
|
}
|
|
2080
2078
|
}
|