@xuda.io/drive_module 1.1.1490 → 1.1.1491
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 +423 -0
- package/index_ms.mjs +88 -0
- package/index_msa.mjs +88 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -98,8 +98,12 @@ export const get_drive_files = async (req) => {
|
|
|
98
98
|
|
|
99
99
|
// The Starred view is flat — bookmarked items across ALL folders — so it
|
|
100
100
|
// ignores the folder path; the normal listing scopes to the current folder.
|
|
101
|
+
// `recent` (the Recent view) and `global` (the ⌘K drive search) are flat
|
|
102
|
+
// the same way — cross-folder, no path scope.
|
|
101
103
|
if (req.starred) {
|
|
102
104
|
opt.selector.starred = true;
|
|
105
|
+
} else if (req.recent || req.global) {
|
|
106
|
+
// flat cross-folder listing
|
|
103
107
|
} else if (file_path) {
|
|
104
108
|
opt.selector.file_path = file_path;
|
|
105
109
|
}
|
|
@@ -986,6 +990,351 @@ export const rename_drive_folder = async (req) => {
|
|
|
986
990
|
}
|
|
987
991
|
};
|
|
988
992
|
|
|
993
|
+
// Move files/folders into another folder within the same drive. The user +
|
|
994
|
+
// workspace drives store their hierarchy purely in CouchDB (file docs carry
|
|
995
|
+
// file_path = parent dir; folder docs file_path = parent dir + folder_name;
|
|
996
|
+
// the stored bytes are keyed by _id/bucket) — so a move is a metadata rewrite
|
|
997
|
+
// with zero storage I/O. Folders move their ENTIRE subtree
|
|
998
|
+
// (collect_folder_descendants + parent-path prefix rewrite). The studio drive
|
|
999
|
+
// is filesystem-keyed (doc _id = fs path) and is not supported here yet.
|
|
1000
|
+
// req: { drive_type, app_id, uid, files_arr: [{ type, file_path }], dest_path }
|
|
1001
|
+
export const move_drive_files = async (req, job_id, headers) => {
|
|
1002
|
+
try {
|
|
1003
|
+
const { drive_type, app_id, uid, files_arr, dest_path } = req;
|
|
1004
|
+
validate_drive_type(drive_type);
|
|
1005
|
+
|
|
1006
|
+
if (drive_type === 'studio') {
|
|
1007
|
+
throw new Error('Moving items in the studio drive is not supported yet');
|
|
1008
|
+
}
|
|
1009
|
+
if (!Array.isArray(files_arr) || !files_arr.length) {
|
|
1010
|
+
return { code: -400, data: 'error - files_arr must be a non-empty Array' };
|
|
1011
|
+
}
|
|
1012
|
+
if (typeof dest_path !== 'string' || !dest_path.startsWith('/')) {
|
|
1013
|
+
return { code: -400, data: 'error - dest_path must be an absolute drive path' };
|
|
1014
|
+
}
|
|
1015
|
+
|
|
1016
|
+
// Destination must be an existing folder (root always exists) — throws when missing.
|
|
1017
|
+
if (dest_path !== '/') {
|
|
1018
|
+
await get_drive_doc('directory', drive_type, app_id, uid, dest_path, headers);
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
// Existing names at the destination — refuse to silently overwrite.
|
|
1022
|
+
const dest_children = await get_folder_files(uid, app_id, drive_type, dest_path);
|
|
1023
|
+
const dest_names = new Set((dest_children || []).map((c) => c.name));
|
|
1024
|
+
|
|
1025
|
+
const conflicts = [];
|
|
1026
|
+
const moving = [];
|
|
1027
|
+
for (const item of files_arr) {
|
|
1028
|
+
if (!item || !item.file_path) continue;
|
|
1029
|
+
const item_name = path.basename(item.file_path);
|
|
1030
|
+
// Already in the destination — a no-op, skip silently.
|
|
1031
|
+
if (path.dirname(item.file_path) === dest_path) continue;
|
|
1032
|
+
// A folder can't be moved into itself or its own subtree.
|
|
1033
|
+
if (item.type === 'directory' && (dest_path === item.file_path || dest_path.startsWith(item.file_path + '/'))) {
|
|
1034
|
+
throw new Error(`Cannot move "${item_name}" into itself`);
|
|
1035
|
+
}
|
|
1036
|
+
if (dest_names.has(item_name)) {
|
|
1037
|
+
conflicts.push(item_name);
|
|
1038
|
+
continue;
|
|
1039
|
+
}
|
|
1040
|
+
moving.push(item);
|
|
1041
|
+
}
|
|
1042
|
+
if (conflicts.length) {
|
|
1043
|
+
return { code: -764, data: { error: 'name_conflict', conflicts } };
|
|
1044
|
+
}
|
|
1045
|
+
if (!moving.length) {
|
|
1046
|
+
return { code: 200, data: { moved: 0 } };
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
const docs = [];
|
|
1050
|
+
for (const item of moving) {
|
|
1051
|
+
const doc = await get_drive_doc(item.type, drive_type, app_id, uid, item.file_path, headers);
|
|
1052
|
+
if (item.type === 'directory') {
|
|
1053
|
+
const old_full = path.join(doc.file_path, doc.folder_name);
|
|
1054
|
+
const new_full = path.join(dest_path, doc.folder_name);
|
|
1055
|
+
// Rewrite every descendant's parent-path prefix old_full → new_full.
|
|
1056
|
+
// Collected BEFORE the bulk save, so the queries still see old paths.
|
|
1057
|
+
const descendants = await collect_folder_descendants(uid, app_id, drive_type, old_full);
|
|
1058
|
+
for (const entry of descendants) {
|
|
1059
|
+
try {
|
|
1060
|
+
const child = await get_drive_doc(entry.type, drive_type, app_id, uid, entry.file_path, headers);
|
|
1061
|
+
if (child.file_path === old_full || child.file_path.startsWith(old_full + '/')) {
|
|
1062
|
+
child.file_path = new_full + child.file_path.slice(old_full.length);
|
|
1063
|
+
child.date_modified = Date.now();
|
|
1064
|
+
docs.push(child);
|
|
1065
|
+
}
|
|
1066
|
+
} catch (error) {
|
|
1067
|
+
// Skip unreadable descendants; the rest of the subtree still moves.
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
}
|
|
1071
|
+
doc.file_path = dest_path;
|
|
1072
|
+
doc.date_modified = Date.now();
|
|
1073
|
+
docs.push(doc);
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
let app_id_save;
|
|
1077
|
+
switch (drive_type) {
|
|
1078
|
+
case 'workspace':
|
|
1079
|
+
app_id_save = await _common.get_project_app_id(app_id);
|
|
1080
|
+
break;
|
|
1081
|
+
case 'user':
|
|
1082
|
+
app_id_save = await get_account_default_project_id(uid);
|
|
1083
|
+
break;
|
|
1084
|
+
default:
|
|
1085
|
+
break;
|
|
1086
|
+
}
|
|
1087
|
+
const save_ret = await db_module.sava_app_couch_bulk_docs(app_id_save, docs);
|
|
1088
|
+
if (save_ret.code < 0) {
|
|
1089
|
+
throw new Error(save_ret.data);
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
return { code: 200, data: { moved: moving.length, docs: docs.length } };
|
|
1093
|
+
} catch (err) {
|
|
1094
|
+
return { code: -200, data: err.message };
|
|
1095
|
+
}
|
|
1096
|
+
};
|
|
1097
|
+
|
|
1098
|
+
// ─── Trash (user + workspace drives) ─────────────────────────────────────────
|
|
1099
|
+
// Soft-delete with restore. Unlike delete_drive_files (stat=4 + storage purge),
|
|
1100
|
+
// trashing only marks docs: stat=4, deleted_ts, trash_root = the trashed item's
|
|
1101
|
+
// full path (every doc in a trashed folder subtree carries the SAME trash_root,
|
|
1102
|
+
// so restore/purge can address the whole batch), is_trash_root on the top doc
|
|
1103
|
+
// (what the Trash view lists). Bytes stay in the bucket until purge. The studio
|
|
1104
|
+
// drive is filesystem-backed (files would keep being served from disk) — not
|
|
1105
|
+
// supported; the UI keeps hard-delete there.
|
|
1106
|
+
|
|
1107
|
+
const _trash_app_id = async (drive_type, app_id, uid) => {
|
|
1108
|
+
if (drive_type === 'workspace') return await _common.get_project_app_id(app_id);
|
|
1109
|
+
return await get_account_default_project_id(uid);
|
|
1110
|
+
};
|
|
1111
|
+
|
|
1112
|
+
const _validate_trash_drive = (drive_type) => {
|
|
1113
|
+
validate_drive_type(drive_type);
|
|
1114
|
+
if (drive_type === 'studio') {
|
|
1115
|
+
throw new Error('Trash is not supported for the studio drive');
|
|
1116
|
+
}
|
|
1117
|
+
};
|
|
1118
|
+
|
|
1119
|
+
// req: { drive_type, app_id, uid, files_arr: [{ type, file_path }] }
|
|
1120
|
+
export const trash_drive_files = async (req, job_id, headers) => {
|
|
1121
|
+
try {
|
|
1122
|
+
const { drive_type, app_id, uid, files_arr } = req;
|
|
1123
|
+
_validate_trash_drive(drive_type);
|
|
1124
|
+
if (!Array.isArray(files_arr) || !files_arr.length) {
|
|
1125
|
+
return { code: -400, data: 'error - files_arr must be a non-empty Array' };
|
|
1126
|
+
}
|
|
1127
|
+
|
|
1128
|
+
const now = Date.now();
|
|
1129
|
+
const docs = [];
|
|
1130
|
+
for (const item of files_arr) {
|
|
1131
|
+
if (!item || !item.file_path) continue;
|
|
1132
|
+
const doc = await get_drive_doc(item.type, drive_type, app_id, uid, item.file_path, headers);
|
|
1133
|
+
const root_path = item.type === 'directory' ? path.join(doc.file_path, doc.folder_name) : path.join(doc.file_path, doc.originalname);
|
|
1134
|
+
if (item.type === 'directory') {
|
|
1135
|
+
const descendants = await collect_folder_descendants(uid, app_id, drive_type, root_path);
|
|
1136
|
+
for (const entry of descendants) {
|
|
1137
|
+
try {
|
|
1138
|
+
const child = await get_drive_doc(entry.type, drive_type, app_id, uid, entry.file_path, headers);
|
|
1139
|
+
child.stat = 4;
|
|
1140
|
+
child.deleted_ts = now;
|
|
1141
|
+
child.trash_root = root_path;
|
|
1142
|
+
docs.push(child);
|
|
1143
|
+
} catch (error) {
|
|
1144
|
+
// Unreadable descendant — the rest of the subtree still trashes.
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
doc.stat = 4;
|
|
1149
|
+
doc.deleted_ts = now;
|
|
1150
|
+
doc.trash_root = root_path;
|
|
1151
|
+
doc.is_trash_root = true;
|
|
1152
|
+
docs.push(doc);
|
|
1153
|
+
}
|
|
1154
|
+
|
|
1155
|
+
const app_id_save = await _trash_app_id(drive_type, app_id, uid);
|
|
1156
|
+
const save_ret = await db_module.sava_app_couch_bulk_docs(app_id_save, docs);
|
|
1157
|
+
if (save_ret.code < 0) throw new Error(save_ret.data);
|
|
1158
|
+
return { code: 200, data: { trashed: docs.length } };
|
|
1159
|
+
} catch (err) {
|
|
1160
|
+
return { code: -200, data: err.message };
|
|
1161
|
+
}
|
|
1162
|
+
};
|
|
1163
|
+
|
|
1164
|
+
// Lists trash ROOTS (the items the user actually deleted, not every subtree doc).
|
|
1165
|
+
export const get_trashed_files = async (req) => {
|
|
1166
|
+
try {
|
|
1167
|
+
const { drive_type, app_id, uid } = req;
|
|
1168
|
+
_validate_trash_drive(drive_type);
|
|
1169
|
+
const app_id_q = await _trash_app_id(drive_type, app_id, uid);
|
|
1170
|
+
const ret = await db_module.find_app_couch_query(app_id_q, {
|
|
1171
|
+
selector: { docType: `${drive_type}_drive`, stat: 4, is_trash_root: true },
|
|
1172
|
+
limit: 500,
|
|
1173
|
+
});
|
|
1174
|
+
const docs = ret?.data?.docs || ret?.docs || [];
|
|
1175
|
+
const children = docs
|
|
1176
|
+
.map((d) => ({
|
|
1177
|
+
name: d.type === 'directory' ? d.folder_name : d.originalname,
|
|
1178
|
+
type: d.type,
|
|
1179
|
+
// Trash rows are addressed by their trash_root batch key.
|
|
1180
|
+
file_path: d.trash_root,
|
|
1181
|
+
trash_root: d.trash_root,
|
|
1182
|
+
orig_path: d.file_path,
|
|
1183
|
+
deleted_ts: d.deleted_ts,
|
|
1184
|
+
date_created: d.date_created,
|
|
1185
|
+
size: d.size ? (d.size < 1048576 ? (d.size / 1024).toFixed(1) + ' KB' : (d.size / 1048576).toFixed(1) + ' MB') : '',
|
|
1186
|
+
sizeInBytes: d.size || 0,
|
|
1187
|
+
tags: d.tags || [],
|
|
1188
|
+
extension: d?.file_ext?.substr(1),
|
|
1189
|
+
is_trashed: true,
|
|
1190
|
+
}))
|
|
1191
|
+
.sort((a, b) => (b.deleted_ts || 0) - (a.deleted_ts || 0));
|
|
1192
|
+
return { code: 200, data: { file_path: '/', name: 'Trash', children } };
|
|
1193
|
+
} catch (err) {
|
|
1194
|
+
return { code: -200, data: err.message };
|
|
1195
|
+
}
|
|
1196
|
+
};
|
|
1197
|
+
|
|
1198
|
+
// req: { drive_type, app_id, uid, trash_roots: [paths] } — restores each batch.
|
|
1199
|
+
export const restore_trashed_files = async (req) => {
|
|
1200
|
+
try {
|
|
1201
|
+
const { drive_type, app_id, uid, trash_roots } = req;
|
|
1202
|
+
_validate_trash_drive(drive_type);
|
|
1203
|
+
if (!Array.isArray(trash_roots) || !trash_roots.length) {
|
|
1204
|
+
return { code: -400, data: 'error - trash_roots must be a non-empty Array' };
|
|
1205
|
+
}
|
|
1206
|
+
const app_id_q = await _trash_app_id(drive_type, app_id, uid);
|
|
1207
|
+
const ret = await db_module.find_app_couch_query(app_id_q, {
|
|
1208
|
+
selector: { docType: `${drive_type}_drive`, stat: 4, trash_root: { $in: trash_roots } },
|
|
1209
|
+
limit: 10000,
|
|
1210
|
+
});
|
|
1211
|
+
const docs = ret?.data?.docs || ret?.docs || [];
|
|
1212
|
+
for (const doc of docs) {
|
|
1213
|
+
doc.stat = 3;
|
|
1214
|
+
delete doc.deleted_ts;
|
|
1215
|
+
delete doc.trash_root;
|
|
1216
|
+
delete doc.is_trash_root;
|
|
1217
|
+
}
|
|
1218
|
+
const save_ret = await db_module.sava_app_couch_bulk_docs(app_id_q, docs);
|
|
1219
|
+
if (save_ret.code < 0) throw new Error(save_ret.data);
|
|
1220
|
+
return { code: 200, data: { restored: docs.length } };
|
|
1221
|
+
} catch (err) {
|
|
1222
|
+
return { code: -200, data: err.message };
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1225
|
+
|
|
1226
|
+
// req: { drive_type, app_id, uid, trash_roots: [paths] } — permanently removes
|
|
1227
|
+
// the batches: docs stay as stat=4 tombstones (same as delete_drive_files) but
|
|
1228
|
+
// lose their trash markers, and the stored bytes are cleaned up best-effort.
|
|
1229
|
+
export const purge_trashed_files = async (req) => {
|
|
1230
|
+
try {
|
|
1231
|
+
const { drive_type, app_id, uid, trash_roots } = req;
|
|
1232
|
+
_validate_trash_drive(drive_type);
|
|
1233
|
+
if (!Array.isArray(trash_roots) || !trash_roots.length) {
|
|
1234
|
+
return { code: -400, data: 'error - trash_roots must be a non-empty Array' };
|
|
1235
|
+
}
|
|
1236
|
+
const app_id_q = await _trash_app_id(drive_type, app_id, uid);
|
|
1237
|
+
const ret = await db_module.find_app_couch_query(app_id_q, {
|
|
1238
|
+
selector: { docType: `${drive_type}_drive`, stat: 4, trash_root: { $in: trash_roots } },
|
|
1239
|
+
limit: 10000,
|
|
1240
|
+
});
|
|
1241
|
+
const docs = ret?.data?.docs || ret?.docs || [];
|
|
1242
|
+
for (const doc of docs) {
|
|
1243
|
+
delete doc.trash_root;
|
|
1244
|
+
delete doc.is_trash_root;
|
|
1245
|
+
}
|
|
1246
|
+
const save_ret = await db_module.sava_app_couch_bulk_docs(app_id_q, docs);
|
|
1247
|
+
if (save_ret.code < 0) throw new Error(save_ret.data);
|
|
1248
|
+
|
|
1249
|
+
// Storage cleanup — mirrors delete_drive_files' deferred best-effort pass.
|
|
1250
|
+
setTimeout(async () => {
|
|
1251
|
+
for (const doc of docs) {
|
|
1252
|
+
if (doc.type !== 'file') continue;
|
|
1253
|
+
try {
|
|
1254
|
+
if (doc.bucket) {
|
|
1255
|
+
await delete_file_from_bucket(doc.bucket);
|
|
1256
|
+
} else if (drive_type === 'workspace') {
|
|
1257
|
+
const { data: app_obj } = await db_module.get_app_obj(app_id);
|
|
1258
|
+
if (app_obj?.app_type === 'datacenter') {
|
|
1259
|
+
const host = `root@${app_obj.app_hosting_server.ip}`;
|
|
1260
|
+
await _utils.run_ssh_script(`ssh ${host} "mv /var/xuda/workspace_drive/${doc.server_file_name} /tmp/;" `);
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
} catch (error) {}
|
|
1264
|
+
}
|
|
1265
|
+
}, 1000);
|
|
1266
|
+
|
|
1267
|
+
return { code: 200, data: { purged: docs.length } };
|
|
1268
|
+
} catch (err) {
|
|
1269
|
+
return { code: -200, data: err.message };
|
|
1270
|
+
}
|
|
1271
|
+
};
|
|
1272
|
+
|
|
1273
|
+
// ─── Storage breakdown + duplicate finder (user + workspace) ─────────────────
|
|
1274
|
+
// One Mango sweep over the drive's file docs → totals by category + duplicate
|
|
1275
|
+
// groups (same name + same byte size), largest waste first.
|
|
1276
|
+
export const get_drive_breakdown = async (req) => {
|
|
1277
|
+
try {
|
|
1278
|
+
const { drive_type, app_id, uid } = req;
|
|
1279
|
+
validate_drive_type(drive_type);
|
|
1280
|
+
if (drive_type === 'studio') {
|
|
1281
|
+
return { code: -400, data: 'Breakdown is not supported for the studio drive yet' };
|
|
1282
|
+
}
|
|
1283
|
+
const app_id_q = await _trash_app_id(drive_type, app_id, uid);
|
|
1284
|
+
const ret = await db_module.find_app_couch_query(app_id_q, {
|
|
1285
|
+
selector: { docType: `${drive_type}_drive`, stat: 3, type: 'file' },
|
|
1286
|
+
fields: ['originalname', 'size', 'file_ext', 'mime', 'file_path'],
|
|
1287
|
+
limit: 50000,
|
|
1288
|
+
});
|
|
1289
|
+
const docs = ret?.data?.docs || ret?.docs || [];
|
|
1290
|
+
|
|
1291
|
+
const cat_of = (d) => {
|
|
1292
|
+
const mime = d.mime || '';
|
|
1293
|
+
const ext = (d.file_ext || '').replace('.', '').toLowerCase();
|
|
1294
|
+
if (mime.startsWith('image/') || ['png', 'jpg', 'jpeg', 'gif', 'webp', 'svg', 'tiff', 'psd'].includes(ext)) return 'images';
|
|
1295
|
+
if (mime.startsWith('video/') || ['mp4', 'mov', 'avi', 'webm'].includes(ext)) return 'video';
|
|
1296
|
+
if (mime.startsWith('audio/') || ['mp3', 'wav', 'ogg', 'flac'].includes(ext)) return 'audio';
|
|
1297
|
+
if (['pdf', 'doc', 'docx', 'txt', 'md', 'xls', 'xlsx', 'csv', 'ppt', 'pptx', 'plist'].includes(ext)) return 'documents';
|
|
1298
|
+
if (['zip', 'rar', '7z', 'tar', 'gz'].includes(ext)) return 'archives';
|
|
1299
|
+
if (['js', 'html', 'css', 'json', 'ts', 'vue', 'py'].includes(ext)) return 'code';
|
|
1300
|
+
return 'other';
|
|
1301
|
+
};
|
|
1302
|
+
|
|
1303
|
+
const by_type = {};
|
|
1304
|
+
const groups = {};
|
|
1305
|
+
let total = 0;
|
|
1306
|
+
for (const d of docs) {
|
|
1307
|
+
const size = d.size || 0;
|
|
1308
|
+
total += size;
|
|
1309
|
+
const cat = cat_of(d);
|
|
1310
|
+
if (!by_type[cat]) by_type[cat] = { type: cat, bytes: 0, count: 0 };
|
|
1311
|
+
by_type[cat].bytes += size;
|
|
1312
|
+
by_type[cat].count++;
|
|
1313
|
+
const key = (d.originalname || '') + '|' + size;
|
|
1314
|
+
if (!groups[key]) groups[key] = { name: d.originalname, size, count: 0, paths: [] };
|
|
1315
|
+
groups[key].count++;
|
|
1316
|
+
groups[key].paths.push(path.join(d.file_path || '/', d.originalname || ''));
|
|
1317
|
+
}
|
|
1318
|
+
const duplicates = Object.values(groups)
|
|
1319
|
+
.filter((g) => g.count > 1 && g.size > 0)
|
|
1320
|
+
.map((g) => ({ ...g, wasted: g.size * (g.count - 1) }))
|
|
1321
|
+
.sort((a, b) => b.wasted - a.wasted)
|
|
1322
|
+
.slice(0, 20);
|
|
1323
|
+
|
|
1324
|
+
return {
|
|
1325
|
+
code: 200,
|
|
1326
|
+
data: {
|
|
1327
|
+
total,
|
|
1328
|
+
count: docs.length,
|
|
1329
|
+
by_type: Object.values(by_type).sort((a, b) => b.bytes - a.bytes),
|
|
1330
|
+
duplicates,
|
|
1331
|
+
},
|
|
1332
|
+
};
|
|
1333
|
+
} catch (err) {
|
|
1334
|
+
return { code: -200, data: err.message };
|
|
1335
|
+
}
|
|
1336
|
+
};
|
|
1337
|
+
|
|
989
1338
|
export const update_drive_file_sharing_mode = async (req, job_id, headers) => {
|
|
990
1339
|
try {
|
|
991
1340
|
const { type, drive_type, uid, app_id, file_path, is_public } = req;
|
|
@@ -3234,6 +3583,80 @@ export const star_drive_file_user = async (req, job_id, headers, file_obj) => {
|
|
|
3234
3583
|
return await star_drive_file(req, job_id, headers, file_obj);
|
|
3235
3584
|
};
|
|
3236
3585
|
|
|
3586
|
+
export const move_drive_files_workspace = async (req, job_id, headers, file_obj) => {
|
|
3587
|
+
req.drive_type = 'workspace';
|
|
3588
|
+
return await move_drive_files(req, job_id, headers, file_obj);
|
|
3589
|
+
};
|
|
3590
|
+
export const move_drive_files_studio = _common.location_sensitive(async (req, job_id, headers, file_obj) => {
|
|
3591
|
+
req.drive_type = 'studio';
|
|
3592
|
+
return await move_drive_files(req, job_id, headers, file_obj);
|
|
3593
|
+
});
|
|
3594
|
+
export const move_drive_files_user = async (req, job_id, headers, file_obj) => {
|
|
3595
|
+
req.drive_type = 'user';
|
|
3596
|
+
if (!req.uid && req.token_ret?.data?.uid) req.uid = req.token_ret.data.uid; // user-drive ops resolve the project from the authenticated uid
|
|
3597
|
+
return await move_drive_files(req, job_id, headers, file_obj);
|
|
3598
|
+
};
|
|
3599
|
+
|
|
3600
|
+
export const get_drive_size_workspace = async (req, job_id, headers, file_obj) => {
|
|
3601
|
+
req.drive_type = 'workspace';
|
|
3602
|
+
return await get_drive_size(req, job_id, headers, file_obj);
|
|
3603
|
+
};
|
|
3604
|
+
export const get_drive_size_studio = _common.location_sensitive(async (req, job_id, headers, file_obj) => {
|
|
3605
|
+
req.drive_type = 'studio';
|
|
3606
|
+
return await get_drive_size(req, job_id, headers, file_obj);
|
|
3607
|
+
});
|
|
3608
|
+
export const get_drive_size_user = async (req, job_id, headers, file_obj) => {
|
|
3609
|
+
req.drive_type = 'user';
|
|
3610
|
+
if (!req.uid && req.token_ret?.data?.uid) req.uid = req.token_ret.data.uid; // user-drive ops resolve the project from the authenticated uid
|
|
3611
|
+
return await get_drive_size(req, job_id, headers, file_obj);
|
|
3612
|
+
};
|
|
3613
|
+
|
|
3614
|
+
export const trash_drive_files_workspace = async (req, job_id, headers, file_obj) => {
|
|
3615
|
+
req.drive_type = 'workspace';
|
|
3616
|
+
return await trash_drive_files(req, job_id, headers, file_obj);
|
|
3617
|
+
};
|
|
3618
|
+
export const trash_drive_files_user = async (req, job_id, headers, file_obj) => {
|
|
3619
|
+
req.drive_type = 'user';
|
|
3620
|
+
if (!req.uid && req.token_ret?.data?.uid) req.uid = req.token_ret.data.uid;
|
|
3621
|
+
return await trash_drive_files(req, job_id, headers, file_obj);
|
|
3622
|
+
};
|
|
3623
|
+
export const get_trashed_files_workspace = async (req, job_id, headers, file_obj) => {
|
|
3624
|
+
req.drive_type = 'workspace';
|
|
3625
|
+
return await get_trashed_files(req, job_id, headers, file_obj);
|
|
3626
|
+
};
|
|
3627
|
+
export const get_trashed_files_user = async (req, job_id, headers, file_obj) => {
|
|
3628
|
+
req.drive_type = 'user';
|
|
3629
|
+
if (!req.uid && req.token_ret?.data?.uid) req.uid = req.token_ret.data.uid;
|
|
3630
|
+
return await get_trashed_files(req, job_id, headers, file_obj);
|
|
3631
|
+
};
|
|
3632
|
+
export const restore_trashed_files_workspace = async (req, job_id, headers, file_obj) => {
|
|
3633
|
+
req.drive_type = 'workspace';
|
|
3634
|
+
return await restore_trashed_files(req, job_id, headers, file_obj);
|
|
3635
|
+
};
|
|
3636
|
+
export const restore_trashed_files_user = async (req, job_id, headers, file_obj) => {
|
|
3637
|
+
req.drive_type = 'user';
|
|
3638
|
+
if (!req.uid && req.token_ret?.data?.uid) req.uid = req.token_ret.data.uid;
|
|
3639
|
+
return await restore_trashed_files(req, job_id, headers, file_obj);
|
|
3640
|
+
};
|
|
3641
|
+
export const purge_trashed_files_workspace = async (req, job_id, headers, file_obj) => {
|
|
3642
|
+
req.drive_type = 'workspace';
|
|
3643
|
+
return await purge_trashed_files(req, job_id, headers, file_obj);
|
|
3644
|
+
};
|
|
3645
|
+
export const purge_trashed_files_user = async (req, job_id, headers, file_obj) => {
|
|
3646
|
+
req.drive_type = 'user';
|
|
3647
|
+
if (!req.uid && req.token_ret?.data?.uid) req.uid = req.token_ret.data.uid;
|
|
3648
|
+
return await purge_trashed_files(req, job_id, headers, file_obj);
|
|
3649
|
+
};
|
|
3650
|
+
export const get_drive_breakdown_workspace = async (req, job_id, headers, file_obj) => {
|
|
3651
|
+
req.drive_type = 'workspace';
|
|
3652
|
+
return await get_drive_breakdown(req, job_id, headers, file_obj);
|
|
3653
|
+
};
|
|
3654
|
+
export const get_drive_breakdown_user = async (req, job_id, headers, file_obj) => {
|
|
3655
|
+
req.drive_type = 'user';
|
|
3656
|
+
if (!req.uid && req.token_ret?.data?.uid) req.uid = req.token_ret.data.uid;
|
|
3657
|
+
return await get_drive_breakdown(req, job_id, headers, file_obj);
|
|
3658
|
+
};
|
|
3659
|
+
|
|
3237
3660
|
export const delete_file_bulk_workspace = async (req, job_id, headers, file_obj) => {
|
|
3238
3661
|
req.drive_type = 'workspace';
|
|
3239
3662
|
return await delete_file_bulk(req, job_id, headers, file_obj);
|
package/index_ms.mjs
CHANGED
|
@@ -45,6 +45,30 @@ export const rename_drive_folder = async function (...args) {
|
|
|
45
45
|
return await broker.send_to_queue("rename_drive_folder", ...args);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
export const move_drive_files = async function (...args) {
|
|
49
|
+
return await broker.send_to_queue("move_drive_files", ...args);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const trash_drive_files = async function (...args) {
|
|
53
|
+
return await broker.send_to_queue("trash_drive_files", ...args);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const get_trashed_files = async function (...args) {
|
|
57
|
+
return await broker.send_to_queue("get_trashed_files", ...args);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const restore_trashed_files = async function (...args) {
|
|
61
|
+
return await broker.send_to_queue("restore_trashed_files", ...args);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const purge_trashed_files = async function (...args) {
|
|
65
|
+
return await broker.send_to_queue("purge_trashed_files", ...args);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const get_drive_breakdown = async function (...args) {
|
|
69
|
+
return await broker.send_to_queue("get_drive_breakdown", ...args);
|
|
70
|
+
};
|
|
71
|
+
|
|
48
72
|
export const update_drive_file_sharing_mode = async function (...args) {
|
|
49
73
|
return await broker.send_to_queue("update_drive_file_sharing_mode", ...args);
|
|
50
74
|
};
|
|
@@ -253,6 +277,62 @@ export const star_drive_file_user = async function (...args) {
|
|
|
253
277
|
return await broker.send_to_queue("star_drive_file_user", ...args);
|
|
254
278
|
};
|
|
255
279
|
|
|
280
|
+
export const move_drive_files_workspace = async function (...args) {
|
|
281
|
+
return await broker.send_to_queue("move_drive_files_workspace", ...args);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
export const move_drive_files_user = async function (...args) {
|
|
285
|
+
return await broker.send_to_queue("move_drive_files_user", ...args);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export const get_drive_size_workspace = async function (...args) {
|
|
289
|
+
return await broker.send_to_queue("get_drive_size_workspace", ...args);
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
export const get_drive_size_user = async function (...args) {
|
|
293
|
+
return await broker.send_to_queue("get_drive_size_user", ...args);
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
export const trash_drive_files_workspace = async function (...args) {
|
|
297
|
+
return await broker.send_to_queue("trash_drive_files_workspace", ...args);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
export const trash_drive_files_user = async function (...args) {
|
|
301
|
+
return await broker.send_to_queue("trash_drive_files_user", ...args);
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
export const get_trashed_files_workspace = async function (...args) {
|
|
305
|
+
return await broker.send_to_queue("get_trashed_files_workspace", ...args);
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export const get_trashed_files_user = async function (...args) {
|
|
309
|
+
return await broker.send_to_queue("get_trashed_files_user", ...args);
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export const restore_trashed_files_workspace = async function (...args) {
|
|
313
|
+
return await broker.send_to_queue("restore_trashed_files_workspace", ...args);
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export const restore_trashed_files_user = async function (...args) {
|
|
317
|
+
return await broker.send_to_queue("restore_trashed_files_user", ...args);
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export const purge_trashed_files_workspace = async function (...args) {
|
|
321
|
+
return await broker.send_to_queue("purge_trashed_files_workspace", ...args);
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
export const purge_trashed_files_user = async function (...args) {
|
|
325
|
+
return await broker.send_to_queue("purge_trashed_files_user", ...args);
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export const get_drive_breakdown_workspace = async function (...args) {
|
|
329
|
+
return await broker.send_to_queue("get_drive_breakdown_workspace", ...args);
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
export const get_drive_breakdown_user = async function (...args) {
|
|
333
|
+
return await broker.send_to_queue("get_drive_breakdown_user", ...args);
|
|
334
|
+
};
|
|
335
|
+
|
|
256
336
|
export const delete_file_bulk_workspace = async function (...args) {
|
|
257
337
|
return await broker.send_to_queue("delete_file_bulk_workspace", ...args);
|
|
258
338
|
};
|
|
@@ -357,6 +437,14 @@ export const star_drive_file_studio = async function (...args) {
|
|
|
357
437
|
return await broker.send_to_queue("star_drive_file_studio", ...args);
|
|
358
438
|
};
|
|
359
439
|
|
|
440
|
+
export const move_drive_files_studio = async function (...args) {
|
|
441
|
+
return await broker.send_to_queue("move_drive_files_studio", ...args);
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
export const get_drive_size_studio = async function (...args) {
|
|
445
|
+
return await broker.send_to_queue("get_drive_size_studio", ...args);
|
|
446
|
+
};
|
|
447
|
+
|
|
360
448
|
export const delete_file_bulk_studio = async function (...args) {
|
|
361
449
|
return await broker.send_to_queue("delete_file_bulk_studio", ...args);
|
|
362
450
|
};
|
package/index_msa.mjs
CHANGED
|
@@ -45,6 +45,30 @@ export const rename_drive_folder = function (...args) {
|
|
|
45
45
|
broker.send_to_queue_async("rename_drive_folder", ...args);
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
export const move_drive_files = function (...args) {
|
|
49
|
+
broker.send_to_queue_async("move_drive_files", ...args);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const trash_drive_files = function (...args) {
|
|
53
|
+
broker.send_to_queue_async("trash_drive_files", ...args);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const get_trashed_files = function (...args) {
|
|
57
|
+
broker.send_to_queue_async("get_trashed_files", ...args);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const restore_trashed_files = function (...args) {
|
|
61
|
+
broker.send_to_queue_async("restore_trashed_files", ...args);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const purge_trashed_files = function (...args) {
|
|
65
|
+
broker.send_to_queue_async("purge_trashed_files", ...args);
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const get_drive_breakdown = function (...args) {
|
|
69
|
+
broker.send_to_queue_async("get_drive_breakdown", ...args);
|
|
70
|
+
};
|
|
71
|
+
|
|
48
72
|
export const update_drive_file_sharing_mode = function (...args) {
|
|
49
73
|
broker.send_to_queue_async("update_drive_file_sharing_mode", ...args);
|
|
50
74
|
};
|
|
@@ -253,6 +277,62 @@ export const star_drive_file_user = function (...args) {
|
|
|
253
277
|
broker.send_to_queue_async("star_drive_file_user", ...args);
|
|
254
278
|
};
|
|
255
279
|
|
|
280
|
+
export const move_drive_files_workspace = function (...args) {
|
|
281
|
+
broker.send_to_queue_async("move_drive_files_workspace", ...args);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
export const move_drive_files_user = function (...args) {
|
|
285
|
+
broker.send_to_queue_async("move_drive_files_user", ...args);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export const get_drive_size_workspace = function (...args) {
|
|
289
|
+
broker.send_to_queue_async("get_drive_size_workspace", ...args);
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
export const get_drive_size_user = function (...args) {
|
|
293
|
+
broker.send_to_queue_async("get_drive_size_user", ...args);
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
export const trash_drive_files_workspace = function (...args) {
|
|
297
|
+
broker.send_to_queue_async("trash_drive_files_workspace", ...args);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
export const trash_drive_files_user = function (...args) {
|
|
301
|
+
broker.send_to_queue_async("trash_drive_files_user", ...args);
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
export const get_trashed_files_workspace = function (...args) {
|
|
305
|
+
broker.send_to_queue_async("get_trashed_files_workspace", ...args);
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export const get_trashed_files_user = function (...args) {
|
|
309
|
+
broker.send_to_queue_async("get_trashed_files_user", ...args);
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export const restore_trashed_files_workspace = function (...args) {
|
|
313
|
+
broker.send_to_queue_async("restore_trashed_files_workspace", ...args);
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export const restore_trashed_files_user = function (...args) {
|
|
317
|
+
broker.send_to_queue_async("restore_trashed_files_user", ...args);
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export const purge_trashed_files_workspace = function (...args) {
|
|
321
|
+
broker.send_to_queue_async("purge_trashed_files_workspace", ...args);
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
export const purge_trashed_files_user = function (...args) {
|
|
325
|
+
broker.send_to_queue_async("purge_trashed_files_user", ...args);
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export const get_drive_breakdown_workspace = function (...args) {
|
|
329
|
+
broker.send_to_queue_async("get_drive_breakdown_workspace", ...args);
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
export const get_drive_breakdown_user = function (...args) {
|
|
333
|
+
broker.send_to_queue_async("get_drive_breakdown_user", ...args);
|
|
334
|
+
};
|
|
335
|
+
|
|
256
336
|
export const delete_file_bulk_workspace = function (...args) {
|
|
257
337
|
broker.send_to_queue_async("delete_file_bulk_workspace", ...args);
|
|
258
338
|
};
|
|
@@ -357,6 +437,14 @@ export const star_drive_file_studio = function (...args) {
|
|
|
357
437
|
broker.send_to_queue_async("star_drive_file_studio", ...args);
|
|
358
438
|
};
|
|
359
439
|
|
|
440
|
+
export const move_drive_files_studio = function (...args) {
|
|
441
|
+
broker.send_to_queue_async("move_drive_files_studio", ...args);
|
|
442
|
+
};
|
|
443
|
+
|
|
444
|
+
export const get_drive_size_studio = function (...args) {
|
|
445
|
+
broker.send_to_queue_async("get_drive_size_studio", ...args);
|
|
446
|
+
};
|
|
447
|
+
|
|
360
448
|
export const delete_file_bulk_studio = function (...args) {
|
|
361
449
|
broker.send_to_queue_async("delete_file_bulk_studio", ...args);
|
|
362
450
|
};
|