@xuda.io/drive_module 1.1.1399 → 1.1.1401

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 (3) hide show
  1. package/index.mjs +26 -15
  2. package/index_ms.mjs +250 -2
  3. package/package.json +1 -1
package/index.mjs CHANGED
@@ -31,7 +31,21 @@ const _utils = await import(path.join(process.env.XUDA_HOME, 'common', 'xuda-cpi
31
31
  const module_path = path.join(process.env.XUDA_HOME, 'cpi') + (!_conf.is_debug ? '/node_modules/@xuda.io' : '');
32
32
  const fs_module = await import(`${module_path}/fs_module/index.mjs`);
33
33
  const db_module = await import(`${module_path}/db_module/index.mjs`);
34
- const misc_module = await import(`${module_path}/misc_module/index.mjs`);
34
+
35
+ const jobs_ms = await import(`${module_path}/jobs_module/index_ms.mjs`);
36
+ const plugins_ms = await import(`${module_path}/plugins_module/index_ms.mjs`);
37
+ const email_ms = await import(`${module_path}/email_module/index_ms.mjs`);
38
+ const deploy_ms = await import(`${module_path}/deploy_module/index_ms.mjs`);
39
+ const notification_ms = await import(`${module_path}/notification_module/index_ms.mjs`);
40
+ const drive_ms = await import(`${module_path}/drive_module/index_ms.mjs`);
41
+ const session_ms = await import(`${module_path}/session_module/index_ms.mjs`);
42
+ const account_ms = await import(`${module_path}/account_module/index_ms.mjs`);
43
+ const marketplace_ms = await import(`${module_path}/marketplace_module/index_ms.mjs`);
44
+ const misc_ms = await import(`${module_path}/misc_module/index_ms.mjs`);
45
+ const support_ms = await import(`${module_path}/support_module/index_ms.mjs`);
46
+ const build_ms = await import(`${module_path}/build_module/index_ms.mjs`);
47
+ const backup_ms = await import(`${module_path}/backup_module/index_ms.mjs`);
48
+ const team_ms = await import(`${module_path}/team_module/index_ms.mjs`);
35
49
 
36
50
  ////////////////////////////////////////////
37
51
 
@@ -512,7 +526,7 @@ export const delete_drive_files = async (req, job_id, headers) => {
512
526
  save_ret = await db_module.save_app_couch_doc(app_id_reference, doc);
513
527
  }
514
528
 
515
- misc_module.rsync_drive_resources_to_remote_servers('studio', app_id_reference);
529
+ misc_ms.rsync_drive_resources_to_remote_servers('studio', app_id_reference);
516
530
  break;
517
531
  }
518
532
 
@@ -611,7 +625,7 @@ export const update_drive_file = async (req, job_id, headers, file_obj) => {
611
625
  const app_id_reference = await _common.get_project_app_id(app_id);
612
626
  save_ret = await db_module.save_app_couch_doc(app_id_reference, doc);
613
627
 
614
- misc_module.rsync_drive_resources_to_remote_servers('studio', app_id_reference);
628
+ misc_ms.rsync_drive_resources_to_remote_servers('studio', app_id_reference);
615
629
  break;
616
630
  }
617
631
  case 'workspace': {
@@ -738,7 +752,7 @@ export const create_drive_folder = async (req, job_id, headers) => {
738
752
  await create_directory(fs_target_dir, 0o775, true);
739
753
  doc._id = target_dir;
740
754
  save_ret = await db_module.save_app_couch_doc(app_id_master, doc);
741
- misc_module.rsync_drive_resources_to_remote_servers('studio', app_id_master);
755
+ misc_ms.rsync_drive_resources_to_remote_servers('studio', app_id_master);
742
756
  break;
743
757
  }
744
758
 
@@ -857,7 +871,7 @@ export const rename_drive_folder = async (req) => {
857
871
  doc_ret.data._id = new_path;
858
872
  delete doc_ret.data._rev;
859
873
 
860
- misc_module.rsync_drive_resources_to_remote_servers('studio', app_id_reference);
874
+ misc_ms.rsync_drive_resources_to_remote_servers('studio', app_id_reference);
861
875
  break;
862
876
  }
863
877
  case 'workspace': {
@@ -1193,7 +1207,7 @@ export const upload_drive_file = async (req, job_id, headers = {}, file_obj) =>
1193
1207
  doc._id = file_name;
1194
1208
 
1195
1209
  save_ret = await db_module.save_app_couch_doc(ref, doc);
1196
- misc_module.rsync_drive_resources_to_remote_servers('studio', app_id);
1210
+ misc_ms.rsync_drive_resources_to_remote_servers('studio', app_id);
1197
1211
  break;
1198
1212
  }
1199
1213
  case 'workspace': {
@@ -1682,8 +1696,8 @@ const get_folder_size = async (dir, drive_type, app_id, uid) => {
1682
1696
  let ret;
1683
1697
  if (drive_type === 'user') {
1684
1698
  // opt.selector.uid = uid;
1685
- const account_module = await import(`${module_path}/account_module/index.mjs`);
1686
- const app_id = await account_module.get_account_default_project_id(uid);
1699
+
1700
+ const app_id = await account_ms.get_account_default_project_id(uid);
1687
1701
  ret = await db_module.find_app_couch_query(app_id, opt);
1688
1702
  } else {
1689
1703
  ret = await db_module.find_app_couch_query(app_id, opt);
@@ -2025,7 +2039,7 @@ export default {
2025
2039
  await _utils.run_ssh_script(`npm i --prefix ${studio_drive_script_program_folder};`);
2026
2040
  const build_ret = await _utils.run_ssh_script(`npm run build --prefix ${studio_drive_script_program_folder};`);
2027
2041
 
2028
- misc_module.rsync_drive_resources_to_remote_servers('studio', app_id);
2042
+ misc_ms.rsync_drive_resources_to_remote_servers('studio', app_id);
2029
2043
  const vite_build_res = {
2030
2044
  code: 1,
2031
2045
  data: {
@@ -2120,22 +2134,19 @@ export const getExtensionFromUrl = function (imageUrl) {
2120
2134
  };
2121
2135
 
2122
2136
  export const get_user_drive_file = async function (uid, filename) {
2123
- const account_module = await import(`${module_path}/account_module/index.mjs`);
2124
- const app_id = await account_module.get_account_default_project_id(uid);
2137
+ const app_id = await account_ms.get_account_default_project_id(uid);
2125
2138
  const drive_ret = await db_module.get_app_couch_doc(app_id, filename);
2126
2139
  return drive_ret;
2127
2140
  };
2128
2141
 
2129
2142
  export const save_user_drive_file = async function (uid, drive_doc) {
2130
- const account_module = await import(`${module_path}/account_module/index.mjs`);
2131
- const app_id = await account_module.get_account_default_project_id(uid);
2143
+ const app_id = await account_ms.get_account_default_project_id(uid);
2132
2144
  const save_ret = await db_module.save_app_couch_doc(app_id, drive_doc);
2133
2145
  return save_ret;
2134
2146
  };
2135
2147
 
2136
2148
  export const find_contact_query = async function (uid, opt) {
2137
- const account_module = await import(`${module_path}/account_module/index.mjs`);
2138
- const app_id = await account_module.get_account_default_project_id(uid);
2149
+ const app_id = await account_ms.get_account_default_project_id(uid);
2139
2150
  const ret = await db_module.find_app_couch_query(app_id, opt);
2140
2151
  return ret;
2141
2152
  };
package/index_ms.mjs CHANGED
@@ -46,7 +46,7 @@ const send_to_queue =async function(ms_method, ...args) {
46
46
  const timeout = setTimeout(() => {
47
47
  delete queue[queue_id];
48
48
  reject(new Error(`Queue timeout for ${ms_method}`));
49
- }, 30000); // 30 second timeout
49
+ }, 300000); // 300 second timeout
50
50
 
51
51
  // Wrap resolve to clean up
52
52
  queue[queue_id].resolve = (value) => {
@@ -61,7 +61,8 @@ const send_to_queue =async function(ms_method, ...args) {
61
61
  delete queue[queue_id];
62
62
  reject(error);
63
63
  };
64
-
64
+
65
+ try{
65
66
  global[`_${global.module_in}_ch`].sendToQueue(
66
67
  'drive_module',
67
68
  Buffer.from(
@@ -74,6 +75,9 @@ const send_to_queue =async function(ms_method, ...args) {
74
75
  )
75
76
  );
76
77
 
78
+ }catch(err){
79
+ debugger
80
+ }
77
81
  })
78
82
 
79
83
  };
@@ -81,6 +85,250 @@ const send_to_queue =async function(ms_method, ...args) {
81
85
  // You must define this somewhere before using these wrappers:
82
86
  const module_name = 'drive_module';
83
87
 
88
+ export const get_drive_files = async function (...args) {
89
+ return await send_to_queue("get_drive_files", ...args);
90
+ };
91
+
92
+ export const get_drive_file_info = async function (...args) {
93
+ return await send_to_queue("get_drive_file_info", ...args);
94
+ };
95
+
96
+ export const delete_drive_files = async function (...args) {
97
+ return await send_to_queue("delete_drive_files", ...args);
98
+ };
99
+
100
+ export const update_drive_file = async function (...args) {
101
+ return await send_to_queue("update_drive_file", ...args);
102
+ };
103
+
104
+ export const create_drive_folder = async function (...args) {
105
+ return await send_to_queue("create_drive_folder", ...args);
106
+ };
107
+
108
+ export const rename_drive_file = async function (...args) {
109
+ return await send_to_queue("rename_drive_file", ...args);
110
+ };
111
+
112
+ export const rename_drive_folder = async function (...args) {
113
+ return await send_to_queue("rename_drive_folder", ...args);
114
+ };
115
+
116
+ export const update_drive_file_sharing_mode = async function (...args) {
117
+ return await send_to_queue("update_drive_file_sharing_mode", ...args);
118
+ };
119
+
120
+ export const extract_drive_file = async function (...args) {
121
+ return await send_to_queue("extract_drive_file", ...args);
122
+ };
123
+
124
+ export const delete_file_bulk = async function (...args) {
125
+ return await send_to_queue("delete_file_bulk", ...args);
126
+ };
127
+
128
+ export const upload_drive_file = async function (...args) {
129
+ return await send_to_queue("upload_drive_file", ...args);
130
+ };
131
+
132
+ export const check_drive_file = async function (...args) {
133
+ return await send_to_queue("check_drive_file", ...args);
134
+ };
135
+
136
+ export const run_drive_pending_ocr = async function (...args) {
137
+ return await send_to_queue("run_drive_pending_ocr", ...args);
138
+ };
139
+
140
+ export const get_drive_size = async function (...args) {
141
+ return await send_to_queue("get_drive_size", ...args);
142
+ };
143
+
144
+ export const copy_file_to_another_bucket = async function (...args) {
145
+ return await send_to_queue("copy_file_to_another_bucket", ...args);
146
+ };
147
+
148
+ export const delete_file_from_bucket = async function (...args) {
149
+ return await send_to_queue("delete_file_from_bucket", ...args);
150
+ };
151
+
152
+ export const update_drive_file_tags = async function (...args) {
153
+ return await send_to_queue("update_drive_file_tags", ...args);
154
+ };
155
+
156
+ export const compile_javascript_program_in_studio_drive = async function (...args) {
157
+ return await send_to_queue("compile_javascript_program_in_studio_drive", ...args);
158
+ };
159
+
160
+ export const update_drive_addons = async function (...args) {
161
+ return await send_to_queue("update_drive_addons", ...args);
162
+ };
163
+
164
+ export const get_drive_files_workspace = async function (...args) {
165
+ return await send_to_queue("get_drive_files_workspace", ...args);
166
+ };
167
+
168
+ export const get_drive_files_studio = async function (...args) {
169
+ return await send_to_queue("get_drive_files_studio", ...args);
170
+ };
171
+
172
+ export const get_drive_files_user = async function (...args) {
173
+ return await send_to_queue("get_drive_files_user", ...args);
174
+ };
175
+
176
+ export const get_drive_file_info_workspace = async function (...args) {
177
+ return await send_to_queue("get_drive_file_info_workspace", ...args);
178
+ };
179
+
180
+ export const get_drive_file_info_studio = async function (...args) {
181
+ return await send_to_queue("get_drive_file_info_studio", ...args);
182
+ };
183
+
184
+ export const get_drive_file_info_user = async function (...args) {
185
+ return await send_to_queue("get_drive_file_info_user", ...args);
186
+ };
187
+
188
+ export const delete_drive_files_workspace = async function (...args) {
189
+ return await send_to_queue("delete_drive_files_workspace", ...args);
190
+ };
191
+
192
+ export const delete_drive_files_studio = async function (...args) {
193
+ return await send_to_queue("delete_drive_files_studio", ...args);
194
+ };
195
+
196
+ export const delete_drive_files_user = async function (...args) {
197
+ return await send_to_queue("delete_drive_files_user", ...args);
198
+ };
199
+
200
+ export const extract_drive_file_workspace = async function (...args) {
201
+ return await send_to_queue("extract_drive_file_workspace", ...args);
202
+ };
203
+
204
+ export const extract_drive_file_studio = async function (...args) {
205
+ return await send_to_queue("extract_drive_file_studio", ...args);
206
+ };
207
+
208
+ export const extract_drive_file_user = async function (...args) {
209
+ return await send_to_queue("extract_drive_file_user", ...args);
210
+ };
211
+
212
+ export const upload_drive_file_workspace = async function (...args) {
213
+ return await send_to_queue("upload_drive_file_workspace", ...args);
214
+ };
215
+
216
+ export const upload_drive_file_studio = async function (...args) {
217
+ return await send_to_queue("upload_drive_file_studio", ...args);
218
+ };
219
+
220
+ export const upload_drive_file_user = async function (...args) {
221
+ return await send_to_queue("upload_drive_file_user", ...args);
222
+ };
223
+
224
+ export const update_drive_file_workspace = async function (...args) {
225
+ return await send_to_queue("update_drive_file_workspace", ...args);
226
+ };
227
+
228
+ export const update_drive_file_studio = async function (...args) {
229
+ return await send_to_queue("update_drive_file_studio", ...args);
230
+ };
231
+
232
+ export const update_drive_file_user = async function (...args) {
233
+ return await send_to_queue("update_drive_file_user", ...args);
234
+ };
235
+
236
+ export const create_drive_folder_workspace = async function (...args) {
237
+ return await send_to_queue("create_drive_folder_workspace", ...args);
238
+ };
239
+
240
+ export const create_drive_folder_studio = async function (...args) {
241
+ return await send_to_queue("create_drive_folder_studio", ...args);
242
+ };
243
+
244
+ export const create_drive_folder_user = async function (...args) {
245
+ return await send_to_queue("create_drive_folder_user", ...args);
246
+ };
247
+
248
+ export const rename_drive_file_workspace = async function (...args) {
249
+ return await send_to_queue("rename_drive_file_workspace", ...args);
250
+ };
251
+
252
+ export const rename_drive_file_studio = async function (...args) {
253
+ return await send_to_queue("rename_drive_file_studio", ...args);
254
+ };
255
+
256
+ export const rename_drive_file_user = async function (...args) {
257
+ return await send_to_queue("rename_drive_file_user", ...args);
258
+ };
259
+
260
+ export const rename_drive_folder_workspace = async function (...args) {
261
+ return await send_to_queue("rename_drive_folder_workspace", ...args);
262
+ };
263
+
264
+ export const rename_drive_folder_studio = async function (...args) {
265
+ return await send_to_queue("rename_drive_folder_studio", ...args);
266
+ };
267
+
268
+ export const rename_drive_folder_user = async function (...args) {
269
+ return await send_to_queue("rename_drive_folder_user", ...args);
270
+ };
271
+
272
+ export const update_drive_file_sharing_mode_workspace = async function (...args) {
273
+ return await send_to_queue("update_drive_file_sharing_mode_workspace", ...args);
274
+ };
275
+
276
+ export const update_drive_file_sharing_mode_studio = async function (...args) {
277
+ return await send_to_queue("update_drive_file_sharing_mode_studio", ...args);
278
+ };
279
+
280
+ export const update_drive_file_sharing_mode_user = async function (...args) {
281
+ return await send_to_queue("update_drive_file_sharing_mode_user", ...args);
282
+ };
283
+
284
+ export const delete_file_bulk_workspace = async function (...args) {
285
+ return await send_to_queue("delete_file_bulk_workspace", ...args);
286
+ };
287
+
288
+ export const delete_file_bulk_studio = async function (...args) {
289
+ return await send_to_queue("delete_file_bulk_studio", ...args);
290
+ };
291
+
292
+ export const delete_file_bulk_user = async function (...args) {
293
+ return await send_to_queue("delete_file_bulk_user", ...args);
294
+ };
295
+
296
+ export const check_drive_file_workspace = async function (...args) {
297
+ return await send_to_queue("check_drive_file_workspace", ...args);
298
+ };
299
+
300
+ export const check_drive_file_studio = async function (...args) {
301
+ return await send_to_queue("check_drive_file_studio", ...args);
302
+ };
303
+
304
+ export const check_drive_file_user = async function (...args) {
305
+ return await send_to_queue("check_drive_file_user", ...args);
306
+ };
307
+
308
+ export const update_drive_file_tags_workspace = async function (...args) {
309
+ return await send_to_queue("update_drive_file_tags_workspace", ...args);
310
+ };
311
+
312
+ export const update_drive_file_tags_studio = async function (...args) {
313
+ return await send_to_queue("update_drive_file_tags_studio", ...args);
314
+ };
315
+
316
+ export const update_drive_file_tags_user = async function (...args) {
317
+ return await send_to_queue("update_drive_file_tags_user", ...args);
318
+ };
319
+
320
+ export const update_drive_addons_workspace = async function (...args) {
321
+ return await send_to_queue("update_drive_addons_workspace", ...args);
322
+ };
323
+
324
+ export const update_drive_addons_studio = async function (...args) {
325
+ return await send_to_queue("update_drive_addons_studio", ...args);
326
+ };
327
+
328
+ export const update_drive_addons_user = async function (...args) {
329
+ return await send_to_queue("update_drive_addons_user", ...args);
330
+ };
331
+
84
332
  export const getExtensionFromUrl = async function (...args) {
85
333
  return await send_to_queue("getExtensionFromUrl", ...args);
86
334
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/drive_module",
3
- "version": "1.1.1399",
3
+ "version": "1.1.1401",
4
4
  "description": "Xuda Drive Server Module",
5
5
  "main": "index.mjs",
6
6
  "dependencies": {