@xuda.io/drive_module 1.1.1242 → 1.1.1244
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 +19 -17
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -40,21 +40,21 @@ const get_studio_path = (raw_path, ref, file_name) => {
|
|
|
40
40
|
};
|
|
41
41
|
|
|
42
42
|
// Helper to get S3 Client
|
|
43
|
-
const getS3Client = (region) => {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
};
|
|
43
|
+
// const getS3Client = (region) => {
|
|
44
|
+
// const endpoint = _conf.storage_bucket[region || process.env.XUDA_HOSTNAME].endpoint;
|
|
45
|
+
// // AWS SDK v3 requires protocol in endpoint, v2 didn't always strict check
|
|
46
|
+
// const formattedEndpoint = endpoint.startsWith('http') ? endpoint : `https://${endpoint}`;
|
|
47
|
+
|
|
48
|
+
// return new S3Client({
|
|
49
|
+
// endpoint: formattedEndpoint,
|
|
50
|
+
// region: _conf.storage_bucket[region || process.env.XUDA_HOSTNAME].region,
|
|
51
|
+
// credentials: {
|
|
52
|
+
// accessKeyId: _conf.digitalocean.spaces_access_key,
|
|
53
|
+
// secretAccessKey: _conf.digitalocean.spaces_secret_key,
|
|
54
|
+
// },
|
|
55
|
+
// forcePathStyle: false, // DigitalOcean Spaces supports virtual-hosted style
|
|
56
|
+
// });
|
|
57
|
+
// };
|
|
58
58
|
|
|
59
59
|
export const get_drive_files = async (req) => {
|
|
60
60
|
try {
|
|
@@ -645,7 +645,7 @@ export const update_drive_file = async (req, job_id, headers, file_obj) => {
|
|
|
645
645
|
|
|
646
646
|
export const create_drive_folder = async (req, job_id, headers) => {
|
|
647
647
|
try {
|
|
648
|
-
const { drive_type, app_id, folder_name, uid } = req;
|
|
648
|
+
const { drive_type, app_id, folder_name, uid, reserve } = req;
|
|
649
649
|
validate_drive_type(drive_type);
|
|
650
650
|
|
|
651
651
|
let folder_id;
|
|
@@ -666,6 +666,7 @@ export const create_drive_folder = async (req, job_id, headers) => {
|
|
|
666
666
|
is_folder: true,
|
|
667
667
|
type: 'directory',
|
|
668
668
|
file_path: req.path,
|
|
669
|
+
reserve,
|
|
669
670
|
};
|
|
670
671
|
|
|
671
672
|
switch (drive_type) {
|
|
@@ -1001,7 +1002,7 @@ export const delete_file_bulk = async (req) => {
|
|
|
1001
1002
|
|
|
1002
1003
|
export const upload_drive_file = async (req, job_id, headers, file_obj) => {
|
|
1003
1004
|
try {
|
|
1004
|
-
const { drive_type, app_id, uid, make_public, tags = '' } = req;
|
|
1005
|
+
const { drive_type, app_id, uid, make_public, tags = '', reserve } = req;
|
|
1005
1006
|
|
|
1006
1007
|
/// validations
|
|
1007
1008
|
validate_drive_type(drive_type);
|
|
@@ -1048,6 +1049,7 @@ export const upload_drive_file = async (req, job_id, headers, file_obj) => {
|
|
|
1048
1049
|
size: stat.isFile() ? stat.size : 0,
|
|
1049
1050
|
public: make_public,
|
|
1050
1051
|
tags: tags_arr,
|
|
1052
|
+
reserve,
|
|
1051
1053
|
};
|
|
1052
1054
|
doc = { ...doc, ...(await get_file_info(tempPath)) };
|
|
1053
1055
|
|