@xuda.io/drive_module 1.1.1280 → 1.1.1282

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.
Files changed (2) hide show
  1. package/index.mjs +9 -5
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -476,6 +476,10 @@ export const delete_drive_files = async (req, job_id, headers) => {
476
476
  for await (const file of files_arr) {
477
477
  let doc = await get_drive_doc(file.type, drive_type, app_id, uid, file.file_path, headers);
478
478
 
479
+ if (doc.is_protected) {
480
+ throw new Error(`${doc.type} protected`);
481
+ }
482
+
479
483
  let save_ret;
480
484
  switch (drive_type) {
481
485
  case 'studio': {
@@ -646,7 +650,7 @@ export const update_drive_file = async (req, job_id, headers, file_obj) => {
646
650
 
647
651
  export const create_drive_folder = async (req, job_id, headers) => {
648
652
  try {
649
- const { drive_type, app_id, folder_name, uid, reserve, path: file_path } = req;
653
+ const { drive_type, app_id, folder_name, uid, is_protected, path: file_path } = req;
650
654
  validate_drive_type(drive_type);
651
655
 
652
656
  let folder_id;
@@ -667,7 +671,7 @@ export const create_drive_folder = async (req, job_id, headers) => {
667
671
  is_folder: true,
668
672
  type: 'directory',
669
673
  file_path,
670
- reserve,
674
+ is_protected,
671
675
  };
672
676
 
673
677
  let check_req = {
@@ -684,7 +688,7 @@ export const create_drive_folder = async (req, job_id, headers) => {
684
688
  if (check_existing_file_ret.code < 0) {
685
689
  throw new Error(check_existing_file_ret.data);
686
690
  }
687
-
691
+ debugger;
688
692
  switch (drive_type) {
689
693
  case 'studio': {
690
694
  folder_id = req.folder_name;
@@ -1018,7 +1022,7 @@ export const delete_file_bulk = async (req) => {
1018
1022
 
1019
1023
  export const upload_drive_file = async (req, job_id, headers, file_obj) => {
1020
1024
  try {
1021
- const { drive_type, app_id, uid, make_public, tags = '', reserve, path: file_path } = req;
1025
+ const { drive_type, app_id, uid, make_public, tags = '', is_protected, path: file_path } = req;
1022
1026
 
1023
1027
  /// validations
1024
1028
  validate_drive_type(drive_type);
@@ -1065,7 +1069,7 @@ export const upload_drive_file = async (req, job_id, headers, file_obj) => {
1065
1069
  size: stat.isFile() ? stat.size : 0,
1066
1070
  public: make_public,
1067
1071
  tags: tags_arr,
1068
- reserve,
1072
+ is_protected,
1069
1073
  };
1070
1074
  doc = { ...doc, ...(await get_file_info(tempPath)) };
1071
1075
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.1280",
3
+ "version": "1.1.1282",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {