@sinoia/hubdoc-tools 1.3.3 → 1.3.5

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 (83) hide show
  1. package/dist/index.d.ts +1 -1
  2. package/dist/plugins/alfresco/index.d.ts +26 -0
  3. package/dist/plugins/alfresco/index.d.ts.map +1 -0
  4. package/dist/plugins/alfresco/index.js +405 -0
  5. package/dist/plugins/alfresco/index.js.map +1 -0
  6. package/dist/plugins/alfresco/plugin.json +12 -0
  7. package/dist/plugins/aws-s3/index.d.ts +23 -0
  8. package/dist/plugins/aws-s3/index.d.ts.map +1 -0
  9. package/dist/plugins/aws-s3/index.js +383 -0
  10. package/dist/plugins/aws-s3/index.js.map +1 -0
  11. package/dist/plugins/aws-s3/plugin.json +12 -0
  12. package/dist/plugins/azure-blob/index.d.ts +23 -0
  13. package/dist/plugins/azure-blob/index.d.ts.map +1 -0
  14. package/dist/plugins/azure-blob/index.js +340 -0
  15. package/dist/plugins/azure-blob/index.js.map +1 -0
  16. package/dist/plugins/azure-blob/plugin.json +12 -0
  17. package/dist/plugins/box/index.d.ts +26 -0
  18. package/dist/plugins/box/index.d.ts.map +1 -0
  19. package/dist/plugins/box/index.js +387 -0
  20. package/dist/plugins/box/index.js.map +1 -0
  21. package/dist/plugins/box/plugin.json +12 -0
  22. package/dist/plugins/core/index.d.ts +25 -0
  23. package/dist/plugins/core/index.d.ts.map +1 -0
  24. package/dist/plugins/core/index.js +400 -0
  25. package/dist/plugins/core/index.js.map +1 -0
  26. package/dist/plugins/core/plugin.json +26 -0
  27. package/dist/plugins/dropbox/index.d.ts +27 -0
  28. package/dist/plugins/dropbox/index.d.ts.map +1 -0
  29. package/dist/plugins/dropbox/index.js +375 -0
  30. package/dist/plugins/dropbox/index.js.map +1 -0
  31. package/dist/plugins/dropbox/plugin.json +12 -0
  32. package/dist/plugins/filesystem/index.d.ts +22 -0
  33. package/dist/plugins/filesystem/index.d.ts.map +1 -0
  34. package/dist/plugins/filesystem/index.js +306 -0
  35. package/dist/plugins/filesystem/index.js.map +1 -0
  36. package/dist/plugins/filesystem/plugin.json +12 -0
  37. package/dist/plugins/googledrive/index.d.ts +27 -0
  38. package/dist/plugins/googledrive/index.d.ts.map +1 -0
  39. package/dist/plugins/googledrive/index.js +383 -0
  40. package/dist/plugins/googledrive/index.js.map +1 -0
  41. package/dist/plugins/googledrive/plugin.json +12 -0
  42. package/dist/plugins/nuxeo/index.d.ts +24 -0
  43. package/dist/plugins/nuxeo/index.d.ts.map +1 -0
  44. package/dist/plugins/nuxeo/index.js +405 -0
  45. package/dist/plugins/nuxeo/index.js.map +1 -0
  46. package/dist/plugins/nuxeo/plugin.json +12 -0
  47. package/dist/plugins/onedrive/index.d.ts +25 -0
  48. package/dist/plugins/onedrive/index.d.ts.map +1 -0
  49. package/dist/plugins/onedrive/index.js +362 -0
  50. package/dist/plugins/onedrive/index.js.map +1 -0
  51. package/dist/plugins/onedrive/plugin.json +12 -0
  52. package/dist/plugins/opentext/index.d.ts +26 -0
  53. package/dist/plugins/opentext/index.d.ts.map +1 -0
  54. package/dist/plugins/opentext/index.js +440 -0
  55. package/dist/plugins/opentext/index.js.map +1 -0
  56. package/dist/plugins/opentext/plugin.json +12 -0
  57. package/dist/plugins/sharepoint/index.d.ts +27 -0
  58. package/dist/plugins/sharepoint/index.d.ts.map +1 -0
  59. package/dist/plugins/sharepoint/index.js +397 -0
  60. package/dist/plugins/sharepoint/index.js.map +1 -0
  61. package/dist/plugins/sharepoint/plugin.json +12 -0
  62. package/dist/services/hubdoc-api.d.ts +1 -1
  63. package/dist/services/hubdoc-api.js +1 -1
  64. package/dist/services/oauth-token-service.d.ts +1 -1
  65. package/dist/services/oauth-token-service.js +2 -2
  66. package/dist/services/permission-manager.d.ts +1 -1
  67. package/dist/services/permission-manager.js +1 -1
  68. package/dist/src/types/plugins.d.ts +111 -0
  69. package/dist/src/types/plugins.d.ts.map +1 -0
  70. package/dist/src/types/plugins.js +3 -0
  71. package/dist/src/types/plugins.js.map +1 -0
  72. package/dist/src/utils/concurrent-processor.d.ts +63 -0
  73. package/dist/src/utils/concurrent-processor.d.ts.map +1 -0
  74. package/dist/src/utils/concurrent-processor.js +240 -0
  75. package/dist/src/utils/concurrent-processor.js.map +1 -0
  76. package/dist/src/utils/xml-metadata.d.ts +47 -0
  77. package/dist/src/utils/xml-metadata.d.ts.map +1 -0
  78. package/dist/src/utils/xml-metadata.js +200 -0
  79. package/dist/src/utils/xml-metadata.js.map +1 -0
  80. package/dist/types/index.d.ts +1 -1
  81. package/package.json +10 -2
  82. package/plugins/aws-s3/index.ts +2 -2
  83. package/plugins/sharepoint/index.ts +1 -1
@@ -0,0 +1,397 @@
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
+ class SharePointPlugin {
10
+ constructor() {
11
+ this.name = 'sharepoint';
12
+ this.version = '1.0.0';
13
+ this.description = 'SharePoint Online document source';
14
+ this.supportedOperations = ['import', 'export', 'both'];
15
+ this.baseUrl = 'https://graph.microsoft.com/v1.0';
16
+ }
17
+ async testConnection(config) {
18
+ try {
19
+ const client = this.createApiClient(config);
20
+ const siteInfo = await this.getSiteInfo(client, config.siteUrl);
21
+ return !!siteInfo.id;
22
+ }
23
+ catch (error) {
24
+ console.error(`SharePoint connection test failed: ${error.message}`);
25
+ return false;
26
+ }
27
+ }
28
+ async scan(config, options) {
29
+ this.config = config;
30
+ this.apiClient = this.createApiClient(this.config);
31
+ const sources = [];
32
+ const errors = [];
33
+ let totalSize = 0;
34
+ try {
35
+ const limit = this.config.limit || options?.limit;
36
+ console.log(`🔍 Scanning SharePoint site${limit ? ` (limit: ${limit})` : ''}...`);
37
+ // Get site information
38
+ const siteInfo = await this.getSiteInfo(this.apiClient, this.config.siteUrl);
39
+ // Get drive ID (default drive or specified drive)
40
+ const driveId = this.config.driveId || await this.getDefaultDriveId(siteInfo.id);
41
+ // Scan items starting from root or specified folder
42
+ const startingFolderId = this.config.folderId || 'root';
43
+ const items = await this.scanDriveFolder(driveId, startingFolderId, '');
44
+ let processedCount = 0;
45
+ for (const item of items) {
46
+ if (item.file) {
47
+ const source = {
48
+ id: item.id,
49
+ name: item.name,
50
+ path: this.getItemPath(item),
51
+ size: item.size || 0,
52
+ mimeType: item.file.mimeType,
53
+ lastModified: new Date(item.lastModifiedDateTime),
54
+ metadata: {
55
+ sharepointId: item.id,
56
+ driveId: driveId,
57
+ createdAt: item.createdDateTime,
58
+ createdBy: item.createdBy.user.displayName,
59
+ modifiedBy: item.lastModifiedBy.user.displayName,
60
+ webUrl: item.webUrl,
61
+ quickXorHash: item.file.hashes?.quickXorHash,
62
+ sha1Hash: item.file.hashes?.sha1Hash
63
+ }
64
+ };
65
+ // Apply filters
66
+ if (this.shouldIncludeSource(source, options)) {
67
+ sources.push(source);
68
+ totalSize += source.size;
69
+ processedCount++;
70
+ // Check limit
71
+ if (limit && processedCount >= limit) {
72
+ console.log(`📏 Reached limit of ${limit} files`);
73
+ break;
74
+ }
75
+ }
76
+ }
77
+ }
78
+ return {
79
+ sources,
80
+ totalCount: sources.length,
81
+ totalSize,
82
+ errors
83
+ };
84
+ }
85
+ catch (error) {
86
+ return {
87
+ sources: [],
88
+ totalCount: 0,
89
+ totalSize: 0,
90
+ errors: [`SharePoint scan failed: ${error.message}`]
91
+ };
92
+ }
93
+ }
94
+ async scanDriveFolder(driveId, folderId, parentPath) {
95
+ if (!this.apiClient)
96
+ throw new Error('API client not initialized');
97
+ const allItems = [];
98
+ let nextLink = null;
99
+ try {
100
+ do {
101
+ const url = nextLink || `/drives/${driveId}/items/${folderId}/children`;
102
+ const response = await this.apiClient.get(url, {
103
+ params: nextLink ? {} : {
104
+ $expand: 'thumbnails',
105
+ $select: 'id,name,size,lastModifiedDateTime,createdDateTime,file,folder,createdBy,lastModifiedBy,parentReference,webUrl'
106
+ }
107
+ });
108
+ const items = response.data.value || [];
109
+ for (const item of items) {
110
+ const itemPath = parentPath ? `${parentPath}/${item.name}` : item.name;
111
+ if (item.file) {
112
+ // Add path information to the item
113
+ item.fullPath = itemPath;
114
+ allItems.push(item);
115
+ }
116
+ else if (item.folder) {
117
+ // Recursively scan subfolders
118
+ const subItems = await this.scanDriveFolder(driveId, item.id, itemPath);
119
+ allItems.push(...subItems);
120
+ }
121
+ }
122
+ nextLink = response.data['@odata.nextLink'] || null;
123
+ } while (nextLink);
124
+ return allItems;
125
+ }
126
+ catch (error) {
127
+ if (error.response?.status === 404) {
128
+ console.warn(`Warning: Folder not found: ${folderId}`);
129
+ return [];
130
+ }
131
+ throw error;
132
+ }
133
+ }
134
+ async import(config, sources, targetDir, options) {
135
+ this.config = config;
136
+ this.apiClient = this.createApiClient(this.config);
137
+ const results = [];
138
+ const batchSize = options?.batchSize || 5;
139
+ // Process in batches to respect API limits
140
+ for (let i = 0; i < sources.length; i += batchSize) {
141
+ const batch = sources.slice(i, i + batchSize);
142
+ for (const source of batch) {
143
+ const result = await this.importSingle(source, targetDir);
144
+ results.push(result);
145
+ // Small delay to respect rate limits
146
+ await this.sleep(200);
147
+ }
148
+ }
149
+ return results;
150
+ }
151
+ async importSingle(source, targetDir) {
152
+ try {
153
+ if (!this.apiClient)
154
+ throw new Error('API client not initialized');
155
+ const targetPath = path_1.default.join(targetDir, source.path);
156
+ const targetDirectory = path_1.default.dirname(targetPath);
157
+ await fs_extra_1.default.ensureDir(targetDirectory);
158
+ // Get the drive ID from metadata
159
+ const driveId = source.metadata?.driveId;
160
+ if (!driveId) {
161
+ throw new Error('Drive ID not found in source metadata');
162
+ }
163
+ // Download file content from SharePoint
164
+ const response = await this.apiClient.get(`/drives/${driveId}/items/${source.id}/content`, {
165
+ responseType: 'stream'
166
+ });
167
+ const writer = fs_extra_1.default.createWriteStream(targetPath);
168
+ response.data.pipe(writer);
169
+ return new Promise((resolve) => {
170
+ writer.on('finish', () => {
171
+ resolve({
172
+ success: true,
173
+ source,
174
+ localPath: targetPath,
175
+ bytesTransferred: source.size
176
+ });
177
+ });
178
+ writer.on('error', (error) => {
179
+ resolve({
180
+ success: false,
181
+ source,
182
+ error: error.message
183
+ });
184
+ });
185
+ });
186
+ }
187
+ catch (error) {
188
+ return {
189
+ success: false,
190
+ source,
191
+ error: error.message
192
+ };
193
+ }
194
+ }
195
+ async export(config, localSources, options) {
196
+ this.config = config;
197
+ this.apiClient = this.createApiClient(this.config);
198
+ const results = [];
199
+ try {
200
+ // Get site and drive information
201
+ const siteInfo = await this.getSiteInfo(this.apiClient, this.config.siteUrl);
202
+ const driveId = this.config.driveId || await this.getDefaultDriveId(siteInfo.id);
203
+ const rootFolderId = this.config.folderId || 'root';
204
+ for (const source of localSources) {
205
+ try {
206
+ // Determine target folder
207
+ let targetFolderId = rootFolderId;
208
+ if (options?.preserveStructure && source.path.includes('/')) {
209
+ const folderPath = path_1.default.dirname(source.path);
210
+ targetFolderId = await this.createFolderStructure(driveId, folderPath, rootFolderId);
211
+ }
212
+ // Read local file
213
+ const fileContent = await fs_extra_1.default.readFile(source.id);
214
+ // Normalize filename to NFC to handle accented characters consistently across platforms
215
+ const fileName = (options?.preserveStructure ? path_1.default.basename(source.path) : source.name).normalize('NFC');
216
+ // Upload file to SharePoint using simple upload (for files < 4MB)
217
+ // For larger files, we should use resumable upload sessions
218
+ const uploadUrl = `/drives/${driveId}/items/${targetFolderId}:/${fileName}:/content`;
219
+ await this.apiClient.put(uploadUrl, fileContent, {
220
+ headers: {
221
+ 'Content-Type': source.mimeType || 'application/octet-stream'
222
+ }
223
+ });
224
+ const targetPath = options?.preserveStructure ? source.path : source.name;
225
+ results.push({
226
+ success: true,
227
+ targetPath,
228
+ source,
229
+ bytesTransferred: source.size
230
+ });
231
+ }
232
+ catch (error) {
233
+ results.push({
234
+ success: false,
235
+ targetPath: options?.targetPath || '',
236
+ source,
237
+ error: error.message
238
+ });
239
+ }
240
+ }
241
+ }
242
+ catch (error) {
243
+ // If we can't get site/drive info, fail all exports
244
+ for (const source of localSources) {
245
+ results.push({
246
+ success: false,
247
+ targetPath: options?.targetPath || '',
248
+ source,
249
+ error: `Failed to initialize SharePoint connection: ${error.message}`
250
+ });
251
+ }
252
+ }
253
+ return results;
254
+ }
255
+ async getSiteInfo(client, siteUrl) {
256
+ // Extract hostname and site path from URL
257
+ const url = new URL(siteUrl);
258
+ const hostname = url.hostname;
259
+ const sitePath = url.pathname;
260
+ const response = await client.get(`/sites/${hostname}:${sitePath}`);
261
+ return response.data;
262
+ }
263
+ async getDefaultDriveId(siteId) {
264
+ if (!this.apiClient)
265
+ throw new Error('API client not initialized');
266
+ const response = await this.apiClient.get(`/sites/${siteId}/drive`);
267
+ return response.data.id;
268
+ }
269
+ async createFolderStructure(driveId, folderPath, parentId) {
270
+ if (!this.apiClient)
271
+ throw new Error('API client not initialized');
272
+ const parts = folderPath.split('/').filter(part => part.length > 0);
273
+ let currentParentId = parentId;
274
+ for (const folderName of parts) {
275
+ try {
276
+ // Check if folder already exists
277
+ const searchUrl = `/drives/${driveId}/items/${currentParentId}/children`;
278
+ const response = await this.apiClient.get(searchUrl, {
279
+ params: {
280
+ $filter: `name eq '${folderName}' and folder ne null`
281
+ }
282
+ });
283
+ const existingFolder = response.data.value[0];
284
+ if (existingFolder) {
285
+ currentParentId = existingFolder.id;
286
+ }
287
+ else {
288
+ // Create new folder
289
+ const createResponse = await this.apiClient.post(`/drives/${driveId}/items/${currentParentId}/children`, {
290
+ name: folderName,
291
+ folder: {},
292
+ '@microsoft.graph.conflictBehavior': 'rename'
293
+ });
294
+ currentParentId = createResponse.data.id;
295
+ }
296
+ }
297
+ catch (error) {
298
+ throw new Error(`Failed to create folder structure: ${error.message}`);
299
+ }
300
+ }
301
+ return currentParentId;
302
+ }
303
+ getConfigSchema() {
304
+ return {
305
+ type: 'object',
306
+ properties: {
307
+ siteUrl: {
308
+ type: 'string',
309
+ description: 'SharePoint site URL (e.g., https://contoso.sharepoint.com/sites/mysite)',
310
+ required: true
311
+ },
312
+ accessToken: {
313
+ type: 'string',
314
+ description: 'Microsoft Graph API access token with SharePoint permissions',
315
+ required: true
316
+ },
317
+ driveId: {
318
+ type: 'string',
319
+ description: 'Specific drive ID to scan (optional, uses default site drive)',
320
+ required: false
321
+ },
322
+ folderId: {
323
+ type: 'string',
324
+ description: 'Starting folder ID (optional, defaults to drive root)',
325
+ required: false
326
+ },
327
+ limit: {
328
+ type: 'number',
329
+ description: 'Maximum number of documents to scan (useful for testing)',
330
+ required: false
331
+ }
332
+ },
333
+ required: ['siteUrl', 'accessToken']
334
+ };
335
+ }
336
+ async initialize(config) {
337
+ this.config = config;
338
+ if (!this.config.siteUrl || !this.config.accessToken) {
339
+ throw new Error('SharePoint site URL and access token are required');
340
+ }
341
+ this.apiClient = this.createApiClient(this.config);
342
+ }
343
+ async destroy() {
344
+ this.config = undefined;
345
+ this.apiClient = undefined;
346
+ }
347
+ createApiClient(config) {
348
+ return axios_1.default.create({
349
+ baseURL: this.baseUrl,
350
+ headers: {
351
+ 'Authorization': `Bearer ${config.accessToken}`,
352
+ 'Content-Type': 'application/json'
353
+ },
354
+ timeout: 30000
355
+ });
356
+ }
357
+ getItemPath(item) {
358
+ // Use the full path if available from scanning
359
+ if (item.fullPath) {
360
+ return item.fullPath;
361
+ }
362
+ // Construct path from parent reference
363
+ if (item.parentReference?.path) {
364
+ const pathParts = item.parentReference.path
365
+ .split('/root:/')
366
+ .pop()
367
+ ?.split('/') || [];
368
+ pathParts.push(item.name);
369
+ return pathParts.filter(part => part.length > 0).join('/');
370
+ }
371
+ return item.name;
372
+ }
373
+ shouldIncludeSource(source, options) {
374
+ // Apply size filter
375
+ if (options?.filters?.maxSize && source.size > options.filters.maxSize) {
376
+ return false;
377
+ }
378
+ // Apply date range filter
379
+ if (options?.filters?.dateRange) {
380
+ const { from, to } = options.filters.dateRange;
381
+ if (from && source.lastModified < from)
382
+ return false;
383
+ if (to && source.lastModified > to)
384
+ return false;
385
+ }
386
+ // Apply MIME type filter
387
+ if (options?.filters?.mimeTypes && !options.filters.mimeTypes.includes(source.mimeType)) {
388
+ return false;
389
+ }
390
+ return true;
391
+ }
392
+ sleep(ms) {
393
+ return new Promise(resolve => setTimeout(resolve, ms));
394
+ }
395
+ }
396
+ exports.default = SharePointPlugin;
397
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../plugins/sharepoint/index.ts"],"names":[],"mappings":";;;;;AAAA,kDAA6C;AAC7C,wDAA0B;AAC1B,gDAAwB;AAwDxB,MAAqB,gBAAgB;IAArC;QACW,SAAI,GAAG,YAAY,CAAC;QACpB,YAAO,GAAG,OAAO,CAAC;QAClB,gBAAW,GAAG,mCAAmC,CAAC;QAClD,wBAAmB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;QAIpD,YAAO,GAAG,kCAAkC,CAAC;IA0bhE,CAAC;IAxbC,KAAK,CAAC,cAAc,CAAC,MAAoB;QACvC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,MAA0B,CAAC,CAAC;YAChE,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,MAAM,EAAG,MAA2B,CAAC,OAAO,CAAC,CAAC;YACtF,OAAO,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;QACvB,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,sCAAsC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YACrE,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,MAAoB,EAAE,OAA6B;QAC5D,IAAI,CAAC,MAAM,GAAG,MAA0B,CAAC;QACzC,IAAI,CAAC,S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CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAEO,KAAK,CAAC,EAAU;QACtB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;CACF;AAlcD,mCAkcC"}
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "sharepoint",
3
+ "version": "1.0.0",
4
+ "description": "SharePoint document source plugin",
5
+ "author": "HubDoc Tools",
6
+ "main": "index.ts",
7
+ "hubdocToolVersion": "^1.0.0",
8
+ "dependencies": {
9
+ "@pnp/sp": "^3.0.0",
10
+ "fs-extra": "^11.1.0"
11
+ }
12
+ }
@@ -1,4 +1,4 @@
1
- import { Workspace } from '../api/models';
1
+ import { Workspace } from '@api/models';
2
2
  import { DocumentMapping, HubDocBulkUpload, HubDocConfig, HubDocDocument, HubDocFolder, ImportResult } from '../types';
3
3
  import { ChunkedUploadProgress } from './chunked-uploader';
4
4
  export declare class HubDocApiService {
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.HubDocApiService = void 0;
7
- const api_1 = require("../api/api");
7
+ const api_1 = require("@api/api");
8
8
  const chalk_1 = __importDefault(require("chalk"));
9
9
  const form_data_1 = __importDefault(require("form-data"));
10
10
  const fs_extra_1 = __importDefault(require("fs-extra"));
@@ -1,4 +1,4 @@
1
- import type { TokenResponse } from '../api/models';
1
+ import type { TokenResponse } from '@api/models';
2
2
  export interface OAuthTokenServiceOptions {
3
3
  domain: string;
4
4
  clientId: string;
@@ -9,8 +9,8 @@ const child_process_1 = require("child_process");
9
9
  const http_1 = __importDefault(require("http"));
10
10
  const url_1 = require("url");
11
11
  const util_1 = require("util");
12
- const api_1 = require("../api/api");
13
- const configuration_1 = require("../api/configuration");
12
+ const api_1 = require("@api/api");
13
+ const configuration_1 = require("@api/configuration");
14
14
  const axios_1 = __importDefault(require("axios"));
15
15
  const execAsync = (0, util_1.promisify)(child_process_1.exec);
16
16
  /**
@@ -1,4 +1,4 @@
1
- import { Configuration } from '../api/configuration';
1
+ import { Configuration } from '@api/configuration';
2
2
  import { AxiosInstance } from 'axios';
3
3
  export interface PermissionAssignment {
4
4
  users?: string[];
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.PermissionManager = void 0;
7
- const api_1 = require("../api/api");
7
+ const api_1 = require("@api/api");
8
8
  const chalk_1 = __importDefault(require("chalk"));
9
9
  class PermissionManager {
10
10
  constructor(config, client) {
@@ -0,0 +1,111 @@
1
+ export interface DocumentSource {
2
+ id: string;
3
+ name: string;
4
+ path: string;
5
+ size: number;
6
+ mimeType: string;
7
+ lastModified: Date;
8
+ metadata?: Record<string, any>;
9
+ }
10
+ export interface PluginConfig {
11
+ [key: string]: any;
12
+ }
13
+ export interface SourceConnection {
14
+ id: string;
15
+ name: string;
16
+ type: string;
17
+ config: PluginConfig;
18
+ isConnected: boolean;
19
+ }
20
+ export interface ScanResult {
21
+ sources: DocumentSource[];
22
+ totalCount: number;
23
+ totalSize: number;
24
+ errors: string[];
25
+ }
26
+ export interface PluginImportOptions {
27
+ filters?: {
28
+ path?: string;
29
+ mimeTypes?: string[];
30
+ maxSize?: number;
31
+ dateRange?: {
32
+ from?: Date;
33
+ to?: Date;
34
+ };
35
+ };
36
+ batchSize?: number;
37
+ concurrent?: number;
38
+ limit?: number;
39
+ }
40
+ export interface PluginExportOptions {
41
+ targetPath: string;
42
+ overwrite?: boolean;
43
+ preserveStructure?: boolean;
44
+ metadata?: boolean;
45
+ }
46
+ export interface ImportResult {
47
+ success: boolean;
48
+ source: DocumentSource;
49
+ localPath?: string;
50
+ error?: string;
51
+ bytesTransferred?: number;
52
+ }
53
+ export interface ExportResult {
54
+ success: boolean;
55
+ targetPath: string;
56
+ source: DocumentSource;
57
+ error?: string;
58
+ bytesTransferred?: number;
59
+ }
60
+ /**
61
+ * Base interface for all document source plugins
62
+ */
63
+ export interface DocumentSourcePlugin {
64
+ readonly name: string;
65
+ readonly version: string;
66
+ readonly description: string;
67
+ readonly supportedOperations: readonly ('import' | 'export' | 'both')[];
68
+ /**
69
+ * Test if the plugin can connect with given configuration
70
+ */
71
+ testConnection(config: PluginConfig): Promise<boolean>;
72
+ /**
73
+ * Scan the external source for available documents
74
+ */
75
+ scan(config: PluginConfig, options?: PluginImportOptions): Promise<ScanResult>;
76
+ /**
77
+ * Import documents from external source to local storage
78
+ */
79
+ import(config: PluginConfig, sources: DocumentSource[], targetDir: string, options?: PluginImportOptions): Promise<ImportResult[]>;
80
+ /**
81
+ * Export documents to external source (if supported)
82
+ */
83
+ export?(config: PluginConfig, localSources: DocumentSource[], options?: PluginExportOptions): Promise<ExportResult[]>;
84
+ /**
85
+ * Get configuration schema for this plugin
86
+ */
87
+ getConfigSchema(): Record<string, any>;
88
+ /**
89
+ * Initialize plugin with configuration
90
+ */
91
+ initialize(config: PluginConfig): Promise<void>;
92
+ /**
93
+ * Cleanup plugin resources
94
+ */
95
+ destroy(): Promise<void>;
96
+ }
97
+ export interface PluginManifest {
98
+ name: string;
99
+ version: string;
100
+ description: string;
101
+ author?: string;
102
+ main: string;
103
+ dependencies?: Record<string, string>;
104
+ hubdocToolVersion: string;
105
+ }
106
+ export interface RegisteredPlugin {
107
+ manifest: PluginManifest;
108
+ plugin: DocumentSourcePlugin;
109
+ enabled: boolean;
110
+ }
111
+ //# sourceMappingURL=plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.d.ts","sourceRoot":"","sources":["../../../src/types/plugins.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,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AEhD;;OAEG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,cAAc,CAAC;IACzB,MAAM,EAAE,oBAAoB,CAAC;IAC7B,OAAO,EAAE,OAAO,CAAC;CAClB"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=plugins.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugins.js","sourceRoot":"","sources":["../../../src/types/plugins.ts"],"names":[],"mappings":""}