@xuda.io/drive_module 1.1.1398 → 1.1.1400
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 -8
- package/index_ms.mjs +346 -0
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -32,6 +32,20 @@ const module_path = path.join(process.env.XUDA_HOME, 'cpi') + (!_conf.is_debug ?
|
|
|
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
34
|
const misc_module = await import(`${module_path}/misc_module/index.mjs`);
|
|
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
|
|
|
@@ -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
|
-
|
|
1686
|
-
const app_id = await
|
|
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);
|
|
@@ -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
|
|
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
|
|
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
|
|
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
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
// =====================================================
|
|
2
|
+
// Queue wrapper – generated from index.mjs
|
|
3
|
+
// Queue target : drive_module
|
|
4
|
+
// =====================================================
|
|
5
|
+
|
|
6
|
+
import amqplib from 'amqplib';
|
|
7
|
+
import { randomUUID } from 'crypto';
|
|
8
|
+
|
|
9
|
+
let queue={}
|
|
10
|
+
|
|
11
|
+
// --- AMQP Connection & Channel ---
|
|
12
|
+
const conn = await amqplib.connect('amqp://localhost');
|
|
13
|
+
const channel = await conn.createChannel();
|
|
14
|
+
await channel.assertQueue(`_drive_module-${global.module_in}_ch`, { durable: false });
|
|
15
|
+
|
|
16
|
+
channel.consume(`_drive_module-${global.module_in}_ch`, async (msg) => {
|
|
17
|
+
try{
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
if (msg === null) {
|
|
21
|
+
console.log('Consumer cancelled by server');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const content = JSON.parse(msg.content.toString());
|
|
26
|
+
|
|
27
|
+
queue[content.queue_id].resolve(content.ret)
|
|
28
|
+
|
|
29
|
+
channel.ack(msg);
|
|
30
|
+
} catch (err) {
|
|
31
|
+
channel.ack(msg); // Acknowledge to prevent requeue loops on error
|
|
32
|
+
console.error(module_in, content.method, err.message, err);
|
|
33
|
+
// debugger;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
const send_to_queue =async function(ms_method, ...args) {
|
|
39
|
+
|
|
40
|
+
const queue_id = randomUUID();
|
|
41
|
+
return new Promise((resolve,reject)=>{
|
|
42
|
+
|
|
43
|
+
queue[queue_id] = { resolve, reject };
|
|
44
|
+
|
|
45
|
+
// Set timeout to prevent hanging
|
|
46
|
+
const timeout = setTimeout(() => {
|
|
47
|
+
delete queue[queue_id];
|
|
48
|
+
reject(new Error(`Queue timeout for ${ms_method}`));
|
|
49
|
+
}, 30000); // 30 second timeout
|
|
50
|
+
|
|
51
|
+
// Wrap resolve to clean up
|
|
52
|
+
queue[queue_id].resolve = (value) => {
|
|
53
|
+
clearTimeout(timeout);
|
|
54
|
+
delete queue[queue_id];
|
|
55
|
+
resolve(value);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
// Wrap reject to clean up
|
|
59
|
+
queue[queue_id].reject = (error) => {
|
|
60
|
+
clearTimeout(timeout);
|
|
61
|
+
delete queue[queue_id];
|
|
62
|
+
reject(error);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
global[`_${global.module_in}_ch`].sendToQueue(
|
|
66
|
+
'drive_module',
|
|
67
|
+
Buffer.from(
|
|
68
|
+
JSON.stringify({
|
|
69
|
+
ms_method,
|
|
70
|
+
data: args,
|
|
71
|
+
cb:`_drive_module-${global.module_in}_ch`,
|
|
72
|
+
queue_id
|
|
73
|
+
})
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
// You must define this somewhere before using these wrappers:
|
|
82
|
+
const module_name = 'drive_module';
|
|
83
|
+
|
|
84
|
+
export const get_drive_files = async function (...args) {
|
|
85
|
+
return await send_to_queue("get_drive_files", ...args);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
export const get_drive_file_info = async function (...args) {
|
|
89
|
+
return await send_to_queue("get_drive_file_info", ...args);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
export const delete_drive_files = async function (...args) {
|
|
93
|
+
return await send_to_queue("delete_drive_files", ...args);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
export const update_drive_file = async function (...args) {
|
|
97
|
+
return await send_to_queue("update_drive_file", ...args);
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
export const create_drive_folder = async function (...args) {
|
|
101
|
+
return await send_to_queue("create_drive_folder", ...args);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const rename_drive_file = async function (...args) {
|
|
105
|
+
return await send_to_queue("rename_drive_file", ...args);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
export const rename_drive_folder = async function (...args) {
|
|
109
|
+
return await send_to_queue("rename_drive_folder", ...args);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export const update_drive_file_sharing_mode = async function (...args) {
|
|
113
|
+
return await send_to_queue("update_drive_file_sharing_mode", ...args);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export const extract_drive_file = async function (...args) {
|
|
117
|
+
return await send_to_queue("extract_drive_file", ...args);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const delete_file_bulk = async function (...args) {
|
|
121
|
+
return await send_to_queue("delete_file_bulk", ...args);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export const upload_drive_file = async function (...args) {
|
|
125
|
+
return await send_to_queue("upload_drive_file", ...args);
|
|
126
|
+
};
|
|
127
|
+
|
|
128
|
+
export const check_drive_file = async function (...args) {
|
|
129
|
+
return await send_to_queue("check_drive_file", ...args);
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
export const run_drive_pending_ocr = async function (...args) {
|
|
133
|
+
return await send_to_queue("run_drive_pending_ocr", ...args);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export const get_drive_size = async function (...args) {
|
|
137
|
+
return await send_to_queue("get_drive_size", ...args);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
export const copy_file_to_another_bucket = async function (...args) {
|
|
141
|
+
return await send_to_queue("copy_file_to_another_bucket", ...args);
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
export const delete_file_from_bucket = async function (...args) {
|
|
145
|
+
return await send_to_queue("delete_file_from_bucket", ...args);
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const update_drive_file_tags = async function (...args) {
|
|
149
|
+
return await send_to_queue("update_drive_file_tags", ...args);
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
export const compile_javascript_program_in_studio_drive = async function (...args) {
|
|
153
|
+
return await send_to_queue("compile_javascript_program_in_studio_drive", ...args);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
export const update_drive_addons = async function (...args) {
|
|
157
|
+
return await send_to_queue("update_drive_addons", ...args);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
export const get_drive_files_workspace = async function (...args) {
|
|
161
|
+
return await send_to_queue("get_drive_files_workspace", ...args);
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
export const get_drive_files_studio = async function (...args) {
|
|
165
|
+
return await send_to_queue("get_drive_files_studio", ...args);
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const get_drive_files_user = async function (...args) {
|
|
169
|
+
return await send_to_queue("get_drive_files_user", ...args);
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
export const get_drive_file_info_workspace = async function (...args) {
|
|
173
|
+
return await send_to_queue("get_drive_file_info_workspace", ...args);
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
export const get_drive_file_info_studio = async function (...args) {
|
|
177
|
+
return await send_to_queue("get_drive_file_info_studio", ...args);
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export const get_drive_file_info_user = async function (...args) {
|
|
181
|
+
return await send_to_queue("get_drive_file_info_user", ...args);
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
export const delete_drive_files_workspace = async function (...args) {
|
|
185
|
+
return await send_to_queue("delete_drive_files_workspace", ...args);
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const delete_drive_files_studio = async function (...args) {
|
|
189
|
+
return await send_to_queue("delete_drive_files_studio", ...args);
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export const delete_drive_files_user = async function (...args) {
|
|
193
|
+
return await send_to_queue("delete_drive_files_user", ...args);
|
|
194
|
+
};
|
|
195
|
+
|
|
196
|
+
export const extract_drive_file_workspace = async function (...args) {
|
|
197
|
+
return await send_to_queue("extract_drive_file_workspace", ...args);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
export const extract_drive_file_studio = async function (...args) {
|
|
201
|
+
return await send_to_queue("extract_drive_file_studio", ...args);
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export const extract_drive_file_user = async function (...args) {
|
|
205
|
+
return await send_to_queue("extract_drive_file_user", ...args);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export const upload_drive_file_workspace = async function (...args) {
|
|
209
|
+
return await send_to_queue("upload_drive_file_workspace", ...args);
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
export const upload_drive_file_studio = async function (...args) {
|
|
213
|
+
return await send_to_queue("upload_drive_file_studio", ...args);
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
export const upload_drive_file_user = async function (...args) {
|
|
217
|
+
return await send_to_queue("upload_drive_file_user", ...args);
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
export const update_drive_file_workspace = async function (...args) {
|
|
221
|
+
return await send_to_queue("update_drive_file_workspace", ...args);
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
export const update_drive_file_studio = async function (...args) {
|
|
225
|
+
return await send_to_queue("update_drive_file_studio", ...args);
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
export const update_drive_file_user = async function (...args) {
|
|
229
|
+
return await send_to_queue("update_drive_file_user", ...args);
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
export const create_drive_folder_workspace = async function (...args) {
|
|
233
|
+
return await send_to_queue("create_drive_folder_workspace", ...args);
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
export const create_drive_folder_studio = async function (...args) {
|
|
237
|
+
return await send_to_queue("create_drive_folder_studio", ...args);
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export const create_drive_folder_user = async function (...args) {
|
|
241
|
+
return await send_to_queue("create_drive_folder_user", ...args);
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export const rename_drive_file_workspace = async function (...args) {
|
|
245
|
+
return await send_to_queue("rename_drive_file_workspace", ...args);
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
export const rename_drive_file_studio = async function (...args) {
|
|
249
|
+
return await send_to_queue("rename_drive_file_studio", ...args);
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
export const rename_drive_file_user = async function (...args) {
|
|
253
|
+
return await send_to_queue("rename_drive_file_user", ...args);
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
export const rename_drive_folder_workspace = async function (...args) {
|
|
257
|
+
return await send_to_queue("rename_drive_folder_workspace", ...args);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
export const rename_drive_folder_studio = async function (...args) {
|
|
261
|
+
return await send_to_queue("rename_drive_folder_studio", ...args);
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
export const rename_drive_folder_user = async function (...args) {
|
|
265
|
+
return await send_to_queue("rename_drive_folder_user", ...args);
|
|
266
|
+
};
|
|
267
|
+
|
|
268
|
+
export const update_drive_file_sharing_mode_workspace = async function (...args) {
|
|
269
|
+
return await send_to_queue("update_drive_file_sharing_mode_workspace", ...args);
|
|
270
|
+
};
|
|
271
|
+
|
|
272
|
+
export const update_drive_file_sharing_mode_studio = async function (...args) {
|
|
273
|
+
return await send_to_queue("update_drive_file_sharing_mode_studio", ...args);
|
|
274
|
+
};
|
|
275
|
+
|
|
276
|
+
export const update_drive_file_sharing_mode_user = async function (...args) {
|
|
277
|
+
return await send_to_queue("update_drive_file_sharing_mode_user", ...args);
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
export const delete_file_bulk_workspace = async function (...args) {
|
|
281
|
+
return await send_to_queue("delete_file_bulk_workspace", ...args);
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
export const delete_file_bulk_studio = async function (...args) {
|
|
285
|
+
return await send_to_queue("delete_file_bulk_studio", ...args);
|
|
286
|
+
};
|
|
287
|
+
|
|
288
|
+
export const delete_file_bulk_user = async function (...args) {
|
|
289
|
+
return await send_to_queue("delete_file_bulk_user", ...args);
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
export const check_drive_file_workspace = async function (...args) {
|
|
293
|
+
return await send_to_queue("check_drive_file_workspace", ...args);
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
export const check_drive_file_studio = async function (...args) {
|
|
297
|
+
return await send_to_queue("check_drive_file_studio", ...args);
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
export const check_drive_file_user = async function (...args) {
|
|
301
|
+
return await send_to_queue("check_drive_file_user", ...args);
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
export const update_drive_file_tags_workspace = async function (...args) {
|
|
305
|
+
return await send_to_queue("update_drive_file_tags_workspace", ...args);
|
|
306
|
+
};
|
|
307
|
+
|
|
308
|
+
export const update_drive_file_tags_studio = async function (...args) {
|
|
309
|
+
return await send_to_queue("update_drive_file_tags_studio", ...args);
|
|
310
|
+
};
|
|
311
|
+
|
|
312
|
+
export const update_drive_file_tags_user = async function (...args) {
|
|
313
|
+
return await send_to_queue("update_drive_file_tags_user", ...args);
|
|
314
|
+
};
|
|
315
|
+
|
|
316
|
+
export const update_drive_addons_workspace = async function (...args) {
|
|
317
|
+
return await send_to_queue("update_drive_addons_workspace", ...args);
|
|
318
|
+
};
|
|
319
|
+
|
|
320
|
+
export const update_drive_addons_studio = async function (...args) {
|
|
321
|
+
return await send_to_queue("update_drive_addons_studio", ...args);
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
export const update_drive_addons_user = async function (...args) {
|
|
325
|
+
return await send_to_queue("update_drive_addons_user", ...args);
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
export const getExtensionFromUrl = async function (...args) {
|
|
329
|
+
return await send_to_queue("getExtensionFromUrl", ...args);
|
|
330
|
+
};
|
|
331
|
+
|
|
332
|
+
export const get_user_drive_file = async function (...args) {
|
|
333
|
+
return await send_to_queue("get_user_drive_file", ...args);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
export const save_user_drive_file = async function (...args) {
|
|
337
|
+
return await send_to_queue("save_user_drive_file", ...args);
|
|
338
|
+
};
|
|
339
|
+
|
|
340
|
+
export const find_contact_query = async function (...args) {
|
|
341
|
+
return await send_to_queue("find_contact_query", ...args);
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
export const file_upload_validator = async function (...args) {
|
|
345
|
+
return await send_to_queue("file_upload_validator", ...args);
|
|
346
|
+
};
|