@xuda.io/drive_module 1.1.1241 → 1.1.1243

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 +22 -24
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import { createRequire } from 'module';
2
1
  import path from 'path';
3
2
  import _ from 'lodash';
4
3
  import { rimraf } from 'rimraf';
@@ -20,13 +19,11 @@ import { Upload } from '@aws-sdk/lib-storage';
20
19
 
21
20
  console.log('Drive Module loaded...');
22
21
 
23
- // Initialize require for dynamic paths
24
- const require = createRequire(import.meta.url);
25
-
26
- // Load Globals
27
- global._conf = await import(path.join(process.env.XUDA_HOME, process.env.XUDA_CONFIG), {
28
- with: { type: 'json' },
29
- });
22
+ global._conf = (
23
+ await import(path.join(process.env.XUDA_HOME, process.env.XUDA_CONFIG), {
24
+ with: { type: 'json' },
25
+ })
26
+ ).default;
30
27
 
31
28
  const _common = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda_node_common.mjs'));
32
29
  const _utils = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda-cpi-utils.mjs'));
@@ -43,21 +40,21 @@ const get_studio_path = (raw_path, ref, file_name) => {
43
40
  };
44
41
 
45
42
  // Helper to get S3 Client
46
- const getS3Client = (region) => {
47
- const endpoint = _conf.storage_bucket[region || process.env.XUDA_HOSTNAME].endpoint;
48
- // AWS SDK v3 requires protocol in endpoint, v2 didn't always strict check
49
- const formattedEndpoint = endpoint.startsWith('http') ? endpoint : `https://${endpoint}`;
50
-
51
- return new S3Client({
52
- endpoint: formattedEndpoint,
53
- region: _conf.storage_bucket[region || process.env.XUDA_HOSTNAME].region,
54
- credentials: {
55
- accessKeyId: _conf.digitalocean.spaces_access_key,
56
- secretAccessKey: _conf.digitalocean.spaces_secret_key,
57
- },
58
- forcePathStyle: false, // DigitalOcean Spaces supports virtual-hosted style
59
- });
60
- };
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
+ // };
61
58
 
62
59
  export const get_drive_files = async (req) => {
63
60
  try {
@@ -1004,7 +1001,7 @@ export const delete_file_bulk = async (req) => {
1004
1001
 
1005
1002
  export const upload_drive_file = async (req, job_id, headers, file_obj) => {
1006
1003
  try {
1007
- const { drive_type, app_id, uid, make_public, tags = '' } = req;
1004
+ const { drive_type, app_id, uid, make_public, tags = '', reserve } = req;
1008
1005
 
1009
1006
  /// validations
1010
1007
  validate_drive_type(drive_type);
@@ -1051,6 +1048,7 @@ export const upload_drive_file = async (req, job_id, headers, file_obj) => {
1051
1048
  size: stat.isFile() ? stat.size : 0,
1052
1049
  public: make_public,
1053
1050
  tags: tags_arr,
1051
+ reserve,
1054
1052
  };
1055
1053
  doc = { ...doc, ...(await get_file_info(tempPath)) };
1056
1054
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.1241",
3
+ "version": "1.1.1243",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {