@sinoia/hubdoc-tools 1.3.8 → 1.4.0
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/dist/commands/export-v2.d.ts +45 -0
- package/dist/commands/export-v2.d.ts.map +1 -0
- package/dist/commands/export-v2.js +369 -0
- package/dist/commands/export-v2.js.map +1 -0
- package/dist/commands/import-v2.d.ts +32 -0
- package/dist/commands/import-v2.d.ts.map +1 -0
- package/dist/commands/import-v2.js +331 -0
- package/dist/commands/import-v2.js.map +1 -0
- package/dist/commands/import.d.ts.map +1 -1
- package/dist/commands/import.js +10 -2
- package/dist/commands/import.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/plugins/alfresco/plugin.json +1 -1
- package/dist/plugins/aws-s3/plugin.json +1 -1
- package/dist/plugins/azure-blob/plugin.json +1 -1
- package/dist/plugins/box/plugin.json +1 -1
- package/dist/plugins/core/plugin.json +1 -1
- package/dist/plugins/nuxeo/plugin.json +1 -1
- package/dist/plugins/o365-mail/index.d.ts +26 -0
- package/dist/plugins/o365-mail/index.d.ts.map +1 -0
- package/dist/plugins/o365-mail/index.js +392 -0
- package/dist/plugins/o365-mail/index.js.map +1 -0
- package/dist/plugins/o365-mail/plugin.json +8 -0
- package/dist/plugins/opentext/plugin.json +1 -1
- package/dist/plugins/sharepoint/plugin.json +1 -1
- package/dist/services/hubdoc-api-v2.d.ts +150 -0
- package/dist/services/hubdoc-api-v2.d.ts.map +1 -0
- package/dist/services/hubdoc-api-v2.js +418 -0
- package/dist/services/hubdoc-api-v2.js.map +1 -0
- package/dist/services/hubdoc-client.d.ts +246 -0
- package/dist/services/hubdoc-client.d.ts.map +1 -0
- package/dist/services/hubdoc-client.js +714 -0
- package/dist/services/hubdoc-client.js.map +1 -0
- package/dist/services/hubdoc-export-service.d.ts +90 -0
- package/dist/services/hubdoc-export-service.d.ts.map +1 -0
- package/dist/services/hubdoc-export-service.js +443 -0
- package/dist/services/hubdoc-export-service.js.map +1 -0
- package/dist/services/hubdoc-export-v2.d.ts +77 -0
- package/dist/services/hubdoc-export-v2.d.ts.map +1 -0
- package/dist/services/hubdoc-export-v2.js +329 -0
- package/dist/services/hubdoc-export-v2.js.map +1 -0
- package/dist/services/hubdoc-import-service.d.ts +64 -0
- package/dist/services/hubdoc-import-service.d.ts.map +1 -0
- package/dist/services/hubdoc-import-service.js +374 -0
- package/dist/services/hubdoc-import-service.js.map +1 -0
- package/dist/test/hubdoc-api-test.d.ts +8 -0
- package/dist/test/hubdoc-api-test.d.ts.map +1 -0
- package/dist/test/hubdoc-api-test.js +152 -0
- package/dist/test/hubdoc-api-test.js.map +1 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const axios_1 = __importDefault(require("axios"));
|
|
7
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const concurrent_processor_1 = require("../../src/utils/concurrent-processor");
|
|
10
|
+
class O365MailPlugin {
|
|
11
|
+
constructor() {
|
|
12
|
+
this.name = 'o365-mail';
|
|
13
|
+
this.version = '1.0.0';
|
|
14
|
+
this.description = 'Microsoft 365 Mail via Microsoft Graph API';
|
|
15
|
+
this.supportedOperations = ['import'];
|
|
16
|
+
this.baseUrl = 'https://graph.microsoft.com/v1.0';
|
|
17
|
+
}
|
|
18
|
+
async testConnection(config) {
|
|
19
|
+
try {
|
|
20
|
+
const client = this.createApiClient(config);
|
|
21
|
+
const mailboxConfig = config;
|
|
22
|
+
const mailboxPath = mailboxConfig.mailbox || 'me';
|
|
23
|
+
// Test connection by fetching user info
|
|
24
|
+
const response = await client.get(`/users/${mailboxPath}`);
|
|
25
|
+
return response.status === 200;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
console.error(`O365 Mail connection test failed: ${error.message}`);
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async scan(config, options) {
|
|
33
|
+
this.config = config;
|
|
34
|
+
this.apiClient = this.createApiClient(this.config);
|
|
35
|
+
const sources = [];
|
|
36
|
+
const errors = [];
|
|
37
|
+
let totalSize = 0;
|
|
38
|
+
try {
|
|
39
|
+
const limit = this.config.limit || options?.limit;
|
|
40
|
+
const mailboxPath = this.config.mailbox || 'me';
|
|
41
|
+
const folderId = this.config.folderId || 'inbox';
|
|
42
|
+
console.log(`🔍 Scanning O365 Mail folder${limit ? ` (limit: ${limit})` : ''}...`);
|
|
43
|
+
// Scan messages with pagination
|
|
44
|
+
let nextLink = null;
|
|
45
|
+
let processedCount = 0;
|
|
46
|
+
const pageSize = limit && limit < 50 ? limit : 50;
|
|
47
|
+
do {
|
|
48
|
+
try {
|
|
49
|
+
const url = nextLink || `/users/${mailboxPath}/mailFolders/${folderId}/messages`;
|
|
50
|
+
const response = await this.apiClient.get(url, {
|
|
51
|
+
params: nextLink ? {} : {
|
|
52
|
+
$top: pageSize,
|
|
53
|
+
$select: 'id,subject,bodyPreview,from,toRecipients,receivedDateTime,sentDateTime,hasAttachments,importance,isRead,categories,internetMessageId,conversationId',
|
|
54
|
+
$orderby: 'receivedDateTime DESC'
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
const messages = response.data.value || [];
|
|
58
|
+
console.log(`📧 Processing ${messages.length} messages...`);
|
|
59
|
+
for (const message of messages) {
|
|
60
|
+
// Create a document source for the email itself
|
|
61
|
+
const emailSource = await this.createEmailSource(message, mailboxPath);
|
|
62
|
+
if (this.shouldIncludeSource(emailSource, options)) {
|
|
63
|
+
sources.push(emailSource);
|
|
64
|
+
totalSize += emailSource.size;
|
|
65
|
+
processedCount++;
|
|
66
|
+
}
|
|
67
|
+
// If attachments are enabled, also create sources for attachments
|
|
68
|
+
if (this.config.includeAttachments && message.hasAttachments) {
|
|
69
|
+
const attachmentSources = await this.scanAttachments(message, mailboxPath);
|
|
70
|
+
for (const attachmentSource of attachmentSources) {
|
|
71
|
+
if (this.shouldIncludeSource(attachmentSource, options)) {
|
|
72
|
+
sources.push(attachmentSource);
|
|
73
|
+
totalSize += attachmentSource.size;
|
|
74
|
+
processedCount++;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
// Check limit
|
|
79
|
+
if (limit && processedCount >= limit) {
|
|
80
|
+
console.log(`📏 Reached limit of ${limit} items`);
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
nextLink = response.data['@odata.nextLink'] || null;
|
|
85
|
+
// Respect API rate limits
|
|
86
|
+
await this.sleep(200);
|
|
87
|
+
}
|
|
88
|
+
catch (pageError) {
|
|
89
|
+
console.warn(`⚠️ Warning: Failed to fetch messages: ${pageError.message}`);
|
|
90
|
+
errors.push(`Failed to fetch messages: ${pageError.message}`);
|
|
91
|
+
break;
|
|
92
|
+
}
|
|
93
|
+
if (limit && processedCount >= limit) {
|
|
94
|
+
break;
|
|
95
|
+
}
|
|
96
|
+
} while (nextLink);
|
|
97
|
+
console.log(`✅ Scan completed: ${sources.length} items found (emails + attachments)`);
|
|
98
|
+
return {
|
|
99
|
+
sources,
|
|
100
|
+
totalCount: sources.length,
|
|
101
|
+
totalSize,
|
|
102
|
+
errors
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
return {
|
|
107
|
+
sources: [],
|
|
108
|
+
totalCount: 0,
|
|
109
|
+
totalSize: 0,
|
|
110
|
+
errors: [`O365 Mail scan failed: ${error.message}`]
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async createEmailSource(message, mailboxPath) {
|
|
115
|
+
// Estimate email size (body + metadata)
|
|
116
|
+
const bodySize = message.bodyPreview?.length || 0;
|
|
117
|
+
const estimatedSize = bodySize + 2000; // Add overhead for metadata
|
|
118
|
+
// Create a clean filename from subject
|
|
119
|
+
const cleanSubject = this.sanitizeFilename(message.subject || 'No Subject');
|
|
120
|
+
const dateStr = new Date(message.receivedDateTime).toISOString().split('T')[0];
|
|
121
|
+
const fileName = `${dateStr}_${cleanSubject}.eml`;
|
|
122
|
+
return {
|
|
123
|
+
id: message.id,
|
|
124
|
+
name: fileName,
|
|
125
|
+
path: `emails/${dateStr}/${fileName}`,
|
|
126
|
+
size: estimatedSize,
|
|
127
|
+
mimeType: 'message/rfc822',
|
|
128
|
+
lastModified: new Date(message.receivedDateTime),
|
|
129
|
+
metadata: {
|
|
130
|
+
messageId: message.id,
|
|
131
|
+
subject: message.subject,
|
|
132
|
+
from: message.from.emailAddress.address,
|
|
133
|
+
fromName: message.from.emailAddress.name,
|
|
134
|
+
to: message.toRecipients.map(r => r.emailAddress.address).join(', '),
|
|
135
|
+
cc: message.ccRecipients?.map(r => r.emailAddress.address).join(', '),
|
|
136
|
+
receivedDateTime: message.receivedDateTime,
|
|
137
|
+
sentDateTime: message.sentDateTime,
|
|
138
|
+
hasAttachments: message.hasAttachments,
|
|
139
|
+
importance: message.importance,
|
|
140
|
+
isRead: message.isRead,
|
|
141
|
+
categories: message.categories,
|
|
142
|
+
internetMessageId: message.internetMessageId,
|
|
143
|
+
conversationId: message.conversationId,
|
|
144
|
+
type: 'email'
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
async scanAttachments(message, mailboxPath) {
|
|
149
|
+
if (!this.apiClient)
|
|
150
|
+
return [];
|
|
151
|
+
try {
|
|
152
|
+
const response = await this.apiClient.get(`/users/${mailboxPath}/messages/${message.id}/attachments`, {
|
|
153
|
+
params: {
|
|
154
|
+
$select: 'id,name,contentType,size,isInline,lastModifiedDateTime'
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
const attachments = response.data.value || [];
|
|
158
|
+
const sources = [];
|
|
159
|
+
for (const attachment of attachments) {
|
|
160
|
+
// Skip inline attachments (embedded images, etc.) if desired
|
|
161
|
+
if (attachment.isInline)
|
|
162
|
+
continue;
|
|
163
|
+
const dateStr = new Date(message.receivedDateTime).toISOString().split('T')[0];
|
|
164
|
+
const cleanSubject = this.sanitizeFilename(message.subject || 'No Subject');
|
|
165
|
+
sources.push({
|
|
166
|
+
id: `${message.id}:${attachment.id}`,
|
|
167
|
+
name: attachment.name,
|
|
168
|
+
path: `attachments/${dateStr}/${cleanSubject}/${attachment.name}`,
|
|
169
|
+
size: attachment.size,
|
|
170
|
+
mimeType: attachment.contentType || 'application/octet-stream',
|
|
171
|
+
lastModified: new Date(attachment.lastModifiedDateTime || message.receivedDateTime),
|
|
172
|
+
metadata: {
|
|
173
|
+
messageId: message.id,
|
|
174
|
+
attachmentId: attachment.id,
|
|
175
|
+
parentSubject: message.subject,
|
|
176
|
+
from: message.from.emailAddress.address,
|
|
177
|
+
receivedDateTime: message.receivedDateTime,
|
|
178
|
+
isInline: attachment.isInline,
|
|
179
|
+
type: 'attachment'
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
return sources;
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
console.warn(`⚠️ Warning: Failed to fetch attachments for message ${message.id}: ${error.message}`);
|
|
187
|
+
return [];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
async import(config, sources, targetDir, options) {
|
|
191
|
+
this.config = config;
|
|
192
|
+
this.apiClient = this.createApiClient(this.config);
|
|
193
|
+
const concurrency = options?.concurrent || 1;
|
|
194
|
+
const mailboxPath = this.config.mailbox || 'me';
|
|
195
|
+
console.log(`📥 Starting concurrent import of ${sources.length} items from O365 Mail (${concurrency} jobs)`);
|
|
196
|
+
// Use concurrent processor
|
|
197
|
+
const processingResult = await concurrent_processor_1.ConcurrentProcessor.processWithProgress(sources, async (source, index) => {
|
|
198
|
+
const result = await this.importSingle(source, targetDir, mailboxPath);
|
|
199
|
+
// Rate limiting delay
|
|
200
|
+
if (concurrency > 1) {
|
|
201
|
+
await this.sleep(100);
|
|
202
|
+
}
|
|
203
|
+
return result;
|
|
204
|
+
}, {
|
|
205
|
+
concurrency,
|
|
206
|
+
operation: 'Import from O365 Mail',
|
|
207
|
+
itemName: 'items'
|
|
208
|
+
});
|
|
209
|
+
// Filter valid results and handle errors
|
|
210
|
+
const validResults = processingResult.results.filter(r => r !== undefined);
|
|
211
|
+
const errorResults = processingResult.errors.map(({ item, error }) => ({
|
|
212
|
+
success: false,
|
|
213
|
+
source: item,
|
|
214
|
+
error: error.message
|
|
215
|
+
}));
|
|
216
|
+
return [...validResults, ...errorResults];
|
|
217
|
+
}
|
|
218
|
+
async importSingle(source, targetDir, mailboxPath) {
|
|
219
|
+
try {
|
|
220
|
+
if (!this.apiClient)
|
|
221
|
+
throw new Error('API client not initialized');
|
|
222
|
+
const targetPath = path_1.default.join(targetDir, source.path);
|
|
223
|
+
const targetDirectory = path_1.default.dirname(targetPath);
|
|
224
|
+
await fs_extra_1.default.ensureDir(targetDirectory);
|
|
225
|
+
if (source.metadata?.type === 'email') {
|
|
226
|
+
// Download email content
|
|
227
|
+
return await this.importEmail(source, targetPath, mailboxPath);
|
|
228
|
+
}
|
|
229
|
+
else if (source.metadata?.type === 'attachment') {
|
|
230
|
+
// Download attachment
|
|
231
|
+
return await this.importAttachment(source, targetPath, mailboxPath);
|
|
232
|
+
}
|
|
233
|
+
else {
|
|
234
|
+
throw new Error('Unknown source type');
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
catch (error) {
|
|
238
|
+
console.error(`❌ Failed to import ${source.name}: ${error.message}`);
|
|
239
|
+
return {
|
|
240
|
+
success: false,
|
|
241
|
+
source,
|
|
242
|
+
error: error.message
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
async importEmail(source, targetPath, mailboxPath) {
|
|
247
|
+
try {
|
|
248
|
+
// Fetch full email content in MIME format
|
|
249
|
+
const response = await this.apiClient.get(`/users/${mailboxPath}/messages/${source.id}/$value`, {
|
|
250
|
+
responseType: 'arraybuffer',
|
|
251
|
+
headers: {
|
|
252
|
+
'Accept': 'message/rfc822'
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
// Write email to file
|
|
256
|
+
await fs_extra_1.default.writeFile(targetPath, response.data);
|
|
257
|
+
const stats = await fs_extra_1.default.stat(targetPath);
|
|
258
|
+
console.log(`✅ Imported email: ${source.name} (${stats.size} bytes)`);
|
|
259
|
+
return {
|
|
260
|
+
success: true,
|
|
261
|
+
source,
|
|
262
|
+
localPath: targetPath,
|
|
263
|
+
bytesTransferred: stats.size
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
throw new Error(`Failed to import email: ${error.message}`);
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
async importAttachment(source, targetPath, mailboxPath) {
|
|
271
|
+
try {
|
|
272
|
+
// Extract messageId and attachmentId
|
|
273
|
+
const [messageId, attachmentId] = source.id.split(':');
|
|
274
|
+
// Fetch attachment content
|
|
275
|
+
const response = await this.apiClient.get(`/users/${mailboxPath}/messages/${messageId}/attachments/${attachmentId}`, {
|
|
276
|
+
params: {
|
|
277
|
+
$select: 'contentBytes'
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
const attachment = response.data;
|
|
281
|
+
// Decode base64 content and write to file
|
|
282
|
+
if (attachment.contentBytes) {
|
|
283
|
+
const buffer = Buffer.from(attachment.contentBytes, 'base64');
|
|
284
|
+
await fs_extra_1.default.writeFile(targetPath, buffer);
|
|
285
|
+
const stats = await fs_extra_1.default.stat(targetPath);
|
|
286
|
+
console.log(`✅ Imported attachment: ${source.name} (${stats.size} bytes)`);
|
|
287
|
+
return {
|
|
288
|
+
success: true,
|
|
289
|
+
source,
|
|
290
|
+
localPath: targetPath,
|
|
291
|
+
bytesTransferred: stats.size
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
else {
|
|
295
|
+
throw new Error('Attachment content not available');
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
catch (error) {
|
|
299
|
+
throw new Error(`Failed to import attachment: ${error.message}`);
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
getConfigSchema() {
|
|
303
|
+
return {
|
|
304
|
+
type: 'object',
|
|
305
|
+
properties: {
|
|
306
|
+
accessToken: {
|
|
307
|
+
type: 'string',
|
|
308
|
+
description: 'Microsoft Graph API access token with Mail.Read permissions',
|
|
309
|
+
required: true
|
|
310
|
+
},
|
|
311
|
+
mailbox: {
|
|
312
|
+
type: 'string',
|
|
313
|
+
description: 'Email address or "me" for current user (default: me)',
|
|
314
|
+
required: false
|
|
315
|
+
},
|
|
316
|
+
folderId: {
|
|
317
|
+
type: 'string',
|
|
318
|
+
description: 'Mail folder ID or name (default: inbox). Common values: inbox, sentitems, drafts, deleteditems',
|
|
319
|
+
required: false
|
|
320
|
+
},
|
|
321
|
+
includeAttachments: {
|
|
322
|
+
type: 'boolean',
|
|
323
|
+
description: 'Whether to include email attachments (default: true)',
|
|
324
|
+
required: false
|
|
325
|
+
},
|
|
326
|
+
limit: {
|
|
327
|
+
type: 'number',
|
|
328
|
+
description: 'Maximum number of items to scan (useful for testing)',
|
|
329
|
+
required: false
|
|
330
|
+
}
|
|
331
|
+
},
|
|
332
|
+
required: ['accessToken']
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
async initialize(config) {
|
|
336
|
+
this.config = config;
|
|
337
|
+
if (!this.config.accessToken) {
|
|
338
|
+
throw new Error('O365 Mail plugin requires accessToken');
|
|
339
|
+
}
|
|
340
|
+
// Set default values
|
|
341
|
+
if (this.config.includeAttachments === undefined) {
|
|
342
|
+
this.config.includeAttachments = true;
|
|
343
|
+
}
|
|
344
|
+
this.apiClient = this.createApiClient(this.config);
|
|
345
|
+
console.log('✅ O365 Mail plugin initialized successfully');
|
|
346
|
+
}
|
|
347
|
+
async destroy() {
|
|
348
|
+
this.config = undefined;
|
|
349
|
+
this.apiClient = undefined;
|
|
350
|
+
}
|
|
351
|
+
createApiClient(config) {
|
|
352
|
+
return axios_1.default.create({
|
|
353
|
+
baseURL: this.baseUrl,
|
|
354
|
+
headers: {
|
|
355
|
+
'Authorization': `Bearer ${config.accessToken}`,
|
|
356
|
+
'Content-Type': 'application/json'
|
|
357
|
+
},
|
|
358
|
+
timeout: 60000 // Longer timeout for email downloads
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
sanitizeFilename(filename) {
|
|
362
|
+
// Remove or replace invalid filesystem characters
|
|
363
|
+
return filename
|
|
364
|
+
.replace(/[<>:"/\\|?*\x00-\x1F]/g, '_')
|
|
365
|
+
.replace(/\s+/g, '_')
|
|
366
|
+
.substring(0, 100); // Limit length
|
|
367
|
+
}
|
|
368
|
+
shouldIncludeSource(source, options) {
|
|
369
|
+
// Apply size filter
|
|
370
|
+
if (options?.filters?.maxSize && source.size > options.filters.maxSize) {
|
|
371
|
+
return false;
|
|
372
|
+
}
|
|
373
|
+
// Apply date range filter
|
|
374
|
+
if (options?.filters?.dateRange) {
|
|
375
|
+
const { from, to } = options.filters.dateRange;
|
|
376
|
+
if (from && source.lastModified < from)
|
|
377
|
+
return false;
|
|
378
|
+
if (to && source.lastModified > to)
|
|
379
|
+
return false;
|
|
380
|
+
}
|
|
381
|
+
// Apply MIME type filter
|
|
382
|
+
if (options?.filters?.mimeTypes && !options.filters.mimeTypes.includes(source.mimeType)) {
|
|
383
|
+
return false;
|
|
384
|
+
}
|
|
385
|
+
return true;
|
|
386
|
+
}
|
|
387
|
+
sleep(ms) {
|
|
388
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
exports.default = O365MailPlugin;
|
|
392
|
+
//# sourceMappingURL=index.js.map
|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
|
+
export interface HubDocWorkspace {
|
|
3
|
+
id: string;
|
|
4
|
+
name: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
permissions: {
|
|
7
|
+
level: 'read' | 'write' | 'admin';
|
|
8
|
+
users: string[];
|
|
9
|
+
groups: string[];
|
|
10
|
+
}[];
|
|
11
|
+
metadata?: Record<string, any>;
|
|
12
|
+
created_at: string;
|
|
13
|
+
updated_at: string;
|
|
14
|
+
}
|
|
15
|
+
export interface HubDocFile {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
size: number;
|
|
19
|
+
mime_type: string;
|
|
20
|
+
folder_id?: string;
|
|
21
|
+
workspace_id?: string;
|
|
22
|
+
version: number;
|
|
23
|
+
metadata?: Record<string, any>;
|
|
24
|
+
permissions: {
|
|
25
|
+
level: 'read' | 'write' | 'admin';
|
|
26
|
+
users: string[];
|
|
27
|
+
groups: string[];
|
|
28
|
+
}[];
|
|
29
|
+
created_at: string;
|
|
30
|
+
updated_at: string;
|
|
31
|
+
download_url?: string;
|
|
32
|
+
}
|
|
33
|
+
export interface HubDocFolderV2 {
|
|
34
|
+
id: string;
|
|
35
|
+
name: string;
|
|
36
|
+
parent_id?: string;
|
|
37
|
+
workspace_id?: string;
|
|
38
|
+
permissions: {
|
|
39
|
+
level: 'read' | 'write' | 'admin';
|
|
40
|
+
users: string[];
|
|
41
|
+
groups: string[];
|
|
42
|
+
}[];
|
|
43
|
+
metadata?: Record<string, any>;
|
|
44
|
+
created_at: string;
|
|
45
|
+
updated_at: string;
|
|
46
|
+
}
|
|
47
|
+
export interface CreateWorkspaceRequest {
|
|
48
|
+
name: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
permissions?: {
|
|
51
|
+
level: 'read' | 'write' | 'admin';
|
|
52
|
+
users?: string[];
|
|
53
|
+
groups?: string[];
|
|
54
|
+
}[];
|
|
55
|
+
metadata?: Record<string, any>;
|
|
56
|
+
}
|
|
57
|
+
export interface CreateFolderRequest {
|
|
58
|
+
name: string;
|
|
59
|
+
parent_id?: string;
|
|
60
|
+
workspace_id?: string;
|
|
61
|
+
permissions?: {
|
|
62
|
+
level: 'read' | 'write' | 'admin';
|
|
63
|
+
users?: string[];
|
|
64
|
+
groups?: string[];
|
|
65
|
+
}[];
|
|
66
|
+
metadata?: Record<string, any>;
|
|
67
|
+
}
|
|
68
|
+
export interface UploadFileRequest {
|
|
69
|
+
folder_id?: string;
|
|
70
|
+
workspace_id?: string;
|
|
71
|
+
permissions?: {
|
|
72
|
+
level: 'read' | 'write' | 'admin';
|
|
73
|
+
users?: string[];
|
|
74
|
+
groups?: string[];
|
|
75
|
+
}[];
|
|
76
|
+
metadata?: Record<string, any>;
|
|
77
|
+
}
|
|
78
|
+
export declare class HubDocApiServiceV2 {
|
|
79
|
+
private client;
|
|
80
|
+
private config;
|
|
81
|
+
constructor(config: HubDocConfig);
|
|
82
|
+
/**
|
|
83
|
+
* Test API connection
|
|
84
|
+
*/
|
|
85
|
+
testConnection(): Promise<boolean>;
|
|
86
|
+
/**
|
|
87
|
+
* Login and get JWT token
|
|
88
|
+
*/
|
|
89
|
+
login(email: string, password: string): Promise<string>;
|
|
90
|
+
/**
|
|
91
|
+
* Get all workspaces
|
|
92
|
+
*/
|
|
93
|
+
getWorkspaces(): Promise<HubDocWorkspace[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Create a new workspace
|
|
96
|
+
*/
|
|
97
|
+
createWorkspace(request: CreateWorkspaceRequest): Promise<HubDocWorkspace>;
|
|
98
|
+
/**
|
|
99
|
+
* Find workspace by name
|
|
100
|
+
*/
|
|
101
|
+
findWorkspace(name: string): Promise<HubDocWorkspace | null>;
|
|
102
|
+
/**
|
|
103
|
+
* Find or create workspace
|
|
104
|
+
*/
|
|
105
|
+
findOrCreateWorkspace(name: string, permissions?: DocumentMapping['permissions']): Promise<HubDocWorkspace>;
|
|
106
|
+
/**
|
|
107
|
+
* Get folders in workspace
|
|
108
|
+
*/
|
|
109
|
+
getFolders(workspaceId?: string): Promise<HubDocFolderV2[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Create a new folder
|
|
112
|
+
*/
|
|
113
|
+
createFolder(request: CreateFolderRequest): Promise<HubDocFolderV2>;
|
|
114
|
+
/**
|
|
115
|
+
* Find or create folder hierarchy
|
|
116
|
+
*/
|
|
117
|
+
findOrCreateFolderPath(folderPath: string, workspaceId?: string, permissions?: DocumentMapping['permissions']): Promise<HubDocFolderV2>;
|
|
118
|
+
/**
|
|
119
|
+
* Upload a file
|
|
120
|
+
*/
|
|
121
|
+
uploadFile(filePath: string, request: UploadFileRequest): Promise<HubDocFile>;
|
|
122
|
+
/**
|
|
123
|
+
* Import document using mapping
|
|
124
|
+
*/
|
|
125
|
+
importDocument(mapping: DocumentMapping): Promise<ImportResult>;
|
|
126
|
+
/**
|
|
127
|
+
* Bulk import documents
|
|
128
|
+
*/
|
|
129
|
+
bulkImport(mappings: DocumentMapping[], options?: {
|
|
130
|
+
batchSize?: number;
|
|
131
|
+
concurrent?: boolean;
|
|
132
|
+
}): Promise<ImportResult[]>;
|
|
133
|
+
/**
|
|
134
|
+
* Search files and folders
|
|
135
|
+
*/
|
|
136
|
+
search(query: string, type?: 'file' | 'folder' | 'workspace'): Promise<any>;
|
|
137
|
+
/**
|
|
138
|
+
* Convert DocumentMapping permissions to HubDoc API format
|
|
139
|
+
*/
|
|
140
|
+
private convertPermissions;
|
|
141
|
+
/**
|
|
142
|
+
* Get MIME type from file extension
|
|
143
|
+
*/
|
|
144
|
+
private getMimeType;
|
|
145
|
+
/**
|
|
146
|
+
* Format file size for display
|
|
147
|
+
*/
|
|
148
|
+
private formatFileSize;
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=hubdoc-api-v2.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hubdoc-api-v2.d.ts","sourceRoot":"","sources":["../../src/services/hubdoc-api-v2.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAgC,eAAe,EA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