@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.
- package/dist/index.d.ts +1 -1
- package/dist/plugins/alfresco/index.d.ts +26 -0
- package/dist/plugins/alfresco/index.d.ts.map +1 -0
- package/dist/plugins/alfresco/index.js +405 -0
- package/dist/plugins/alfresco/index.js.map +1 -0
- package/dist/plugins/alfresco/plugin.json +12 -0
- package/dist/plugins/aws-s3/index.d.ts +23 -0
- package/dist/plugins/aws-s3/index.d.ts.map +1 -0
- package/dist/plugins/aws-s3/index.js +383 -0
- package/dist/plugins/aws-s3/index.js.map +1 -0
- package/dist/plugins/aws-s3/plugin.json +12 -0
- package/dist/plugins/azure-blob/index.d.ts +23 -0
- package/dist/plugins/azure-blob/index.d.ts.map +1 -0
- package/dist/plugins/azure-blob/index.js +340 -0
- package/dist/plugins/azure-blob/index.js.map +1 -0
- package/dist/plugins/azure-blob/plugin.json +12 -0
- package/dist/plugins/box/index.d.ts +26 -0
- package/dist/plugins/box/index.d.ts.map +1 -0
- package/dist/plugins/box/index.js +387 -0
- package/dist/plugins/box/index.js.map +1 -0
- package/dist/plugins/box/plugin.json +12 -0
- package/dist/plugins/core/index.d.ts +25 -0
- package/dist/plugins/core/index.d.ts.map +1 -0
- package/dist/plugins/core/index.js +400 -0
- package/dist/plugins/core/index.js.map +1 -0
- package/dist/plugins/core/plugin.json +26 -0
- package/dist/plugins/dropbox/index.d.ts +27 -0
- package/dist/plugins/dropbox/index.d.ts.map +1 -0
- package/dist/plugins/dropbox/index.js +375 -0
- package/dist/plugins/dropbox/index.js.map +1 -0
- package/dist/plugins/dropbox/plugin.json +12 -0
- package/dist/plugins/filesystem/index.d.ts +22 -0
- package/dist/plugins/filesystem/index.d.ts.map +1 -0
- package/dist/plugins/filesystem/index.js +306 -0
- package/dist/plugins/filesystem/index.js.map +1 -0
- package/dist/plugins/filesystem/plugin.json +12 -0
- package/dist/plugins/googledrive/index.d.ts +27 -0
- package/dist/plugins/googledrive/index.d.ts.map +1 -0
- package/dist/plugins/googledrive/index.js +383 -0
- package/dist/plugins/googledrive/index.js.map +1 -0
- package/dist/plugins/googledrive/plugin.json +12 -0
- package/dist/plugins/nuxeo/index.d.ts +24 -0
- package/dist/plugins/nuxeo/index.d.ts.map +1 -0
- package/dist/plugins/nuxeo/index.js +405 -0
- package/dist/plugins/nuxeo/index.js.map +1 -0
- package/dist/plugins/nuxeo/plugin.json +12 -0
- package/dist/plugins/onedrive/index.d.ts +25 -0
- package/dist/plugins/onedrive/index.d.ts.map +1 -0
- package/dist/plugins/onedrive/index.js +362 -0
- package/dist/plugins/onedrive/index.js.map +1 -0
- package/dist/plugins/onedrive/plugin.json +12 -0
- package/dist/plugins/opentext/index.d.ts +26 -0
- package/dist/plugins/opentext/index.d.ts.map +1 -0
- package/dist/plugins/opentext/index.js +440 -0
- package/dist/plugins/opentext/index.js.map +1 -0
- package/dist/plugins/opentext/plugin.json +12 -0
- package/dist/plugins/sharepoint/index.d.ts +27 -0
- package/dist/plugins/sharepoint/index.d.ts.map +1 -0
- package/dist/plugins/sharepoint/index.js +397 -0
- package/dist/plugins/sharepoint/index.js.map +1 -0
- package/dist/plugins/sharepoint/plugin.json +12 -0
- package/dist/services/hubdoc-api.d.ts +1 -1
- package/dist/services/hubdoc-api.js +1 -1
- package/dist/services/oauth-token-service.d.ts +1 -1
- package/dist/services/oauth-token-service.js +2 -2
- package/dist/services/permission-manager.d.ts +1 -1
- package/dist/services/permission-manager.js +1 -1
- package/dist/src/types/plugins.d.ts +111 -0
- package/dist/src/types/plugins.d.ts.map +1 -0
- package/dist/src/types/plugins.js +3 -0
- package/dist/src/types/plugins.js.map +1 -0
- package/dist/src/utils/concurrent-processor.d.ts +63 -0
- package/dist/src/utils/concurrent-processor.d.ts.map +1 -0
- package/dist/src/utils/concurrent-processor.js +240 -0
- package/dist/src/utils/concurrent-processor.js.map +1 -0
- package/dist/src/utils/xml-metadata.d.ts +47 -0
- package/dist/src/utils/xml-metadata.d.ts.map +1 -0
- package/dist/src/utils/xml-metadata.js +200 -0
- package/dist/src/utils/xml-metadata.js.map +1 -0
- package/dist/types/index.d.ts +1 -1
- package/package.json +10 -2
- package/plugins/aws-s3/index.ts +2 -2
- package/plugins/sharepoint/index.ts +1 -1
|
@@ -0,0 +1,405 @@
|
|
|
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 NuxeoPlugin {
|
|
10
|
+
constructor() {
|
|
11
|
+
this.name = 'nuxeo';
|
|
12
|
+
this.version = '1.0.0';
|
|
13
|
+
this.description = 'Nuxeo ECM document source';
|
|
14
|
+
this.supportedOperations = ['import', 'export', 'both'];
|
|
15
|
+
}
|
|
16
|
+
async testConnection(config) {
|
|
17
|
+
try {
|
|
18
|
+
const client = this.createApiClient(config);
|
|
19
|
+
const response = await client.get('/user/Administrator');
|
|
20
|
+
return response.status === 200;
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
console.error(`Nuxeo connection test failed: ${error.message}`);
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async scan(config, options) {
|
|
28
|
+
this.config = config;
|
|
29
|
+
this.apiClient = this.createApiClient(this.config);
|
|
30
|
+
const sources = [];
|
|
31
|
+
const errors = [];
|
|
32
|
+
let totalSize = 0;
|
|
33
|
+
try {
|
|
34
|
+
const limit = this.config.limit || options?.limit;
|
|
35
|
+
console.log(`🔍 Scanning Nuxeo repository${limit ? ` (limit: ${limit})` : ''}...`);
|
|
36
|
+
const rootPath = this.config.rootPath || '/default-domain/workspaces';
|
|
37
|
+
const documents = await this.scanPath(rootPath);
|
|
38
|
+
let processedCount = 0;
|
|
39
|
+
for (const doc of documents) {
|
|
40
|
+
if (!doc.isFolder && doc.properties['file:content']) {
|
|
41
|
+
const fileContent = doc.properties['file:content'];
|
|
42
|
+
const source = {
|
|
43
|
+
id: doc.uid,
|
|
44
|
+
name: fileContent.name || doc.name,
|
|
45
|
+
path: this.getDocumentPath(doc),
|
|
46
|
+
size: fileContent.length || 0,
|
|
47
|
+
mimeType: fileContent['mime-type'] || 'application/octet-stream',
|
|
48
|
+
lastModified: new Date(doc.properties['dc:modified']),
|
|
49
|
+
metadata: {
|
|
50
|
+
nuxeoUid: doc.uid,
|
|
51
|
+
nuxeoPath: doc.path,
|
|
52
|
+
docType: doc.type,
|
|
53
|
+
title: doc.properties['dc:title'],
|
|
54
|
+
description: doc.properties['dc:description'],
|
|
55
|
+
creator: doc.properties['dc:creator'],
|
|
56
|
+
lastContributor: doc.properties['dc:lastContributor'],
|
|
57
|
+
createdAt: doc.properties['dc:created'],
|
|
58
|
+
state: doc.state,
|
|
59
|
+
facets: doc.facets,
|
|
60
|
+
changeToken: doc.changeToken,
|
|
61
|
+
digest: fileContent.digest
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
// Apply filters
|
|
65
|
+
if (this.shouldIncludeSource(source, options)) {
|
|
66
|
+
sources.push(source);
|
|
67
|
+
totalSize += source.size;
|
|
68
|
+
processedCount++;
|
|
69
|
+
// Check limit
|
|
70
|
+
if (limit && processedCount >= limit) {
|
|
71
|
+
console.log(`📏 Reached limit of ${limit} files`);
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
sources,
|
|
79
|
+
totalCount: sources.length,
|
|
80
|
+
totalSize,
|
|
81
|
+
errors
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
return {
|
|
86
|
+
sources: [],
|
|
87
|
+
totalCount: 0,
|
|
88
|
+
totalSize: 0,
|
|
89
|
+
errors: [`Nuxeo scan failed: ${error.message}`]
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
async scanPath(docPath) {
|
|
94
|
+
if (!this.apiClient)
|
|
95
|
+
throw new Error('API client not initialized');
|
|
96
|
+
const allDocuments = [];
|
|
97
|
+
let currentPageIndex = 0;
|
|
98
|
+
const pageSize = 100;
|
|
99
|
+
try {
|
|
100
|
+
while (true) {
|
|
101
|
+
// Use NXQL query to get all documents under the specified path
|
|
102
|
+
const query = `SELECT * FROM Document WHERE ecm:path STARTSWITH '${docPath}' AND ecm:isVersion = 0 AND ecm:isTrashed = 0`;
|
|
103
|
+
const response = await this.apiClient.get('/search/lang/NXQL/execute', {
|
|
104
|
+
params: {
|
|
105
|
+
query: query,
|
|
106
|
+
currentPageIndex: currentPageIndex,
|
|
107
|
+
pageSize: pageSize,
|
|
108
|
+
sortBy: 'dc:title',
|
|
109
|
+
sortOrder: 'ASC'
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
const documents = response.data.entries || [];
|
|
113
|
+
if (documents.length === 0) {
|
|
114
|
+
break;
|
|
115
|
+
}
|
|
116
|
+
// Process both files and folders
|
|
117
|
+
for (const doc of documents) {
|
|
118
|
+
allDocuments.push(doc);
|
|
119
|
+
// If it's a folder and has children, we could recursively scan
|
|
120
|
+
// but the STARTSWITH query should already include all descendants
|
|
121
|
+
}
|
|
122
|
+
// Check if there are more pages
|
|
123
|
+
if (documents.length < pageSize) {
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
currentPageIndex++;
|
|
127
|
+
}
|
|
128
|
+
return allDocuments;
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
if (error.response?.status === 404) {
|
|
132
|
+
console.warn(`Warning: Path not found: ${docPath}`);
|
|
133
|
+
return [];
|
|
134
|
+
}
|
|
135
|
+
throw error;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
async import(config, sources, targetDir, options) {
|
|
139
|
+
this.config = config;
|
|
140
|
+
this.apiClient = this.createApiClient(this.config);
|
|
141
|
+
const results = [];
|
|
142
|
+
const batchSize = options?.batchSize || 5;
|
|
143
|
+
// Process in batches to respect API limits
|
|
144
|
+
for (let i = 0; i < sources.length; i += batchSize) {
|
|
145
|
+
const batch = sources.slice(i, i + batchSize);
|
|
146
|
+
for (const source of batch) {
|
|
147
|
+
const result = await this.importSingle(source, targetDir);
|
|
148
|
+
results.push(result);
|
|
149
|
+
// Small delay to respect rate limits
|
|
150
|
+
await this.sleep(200);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
return results;
|
|
154
|
+
}
|
|
155
|
+
async importSingle(source, targetDir) {
|
|
156
|
+
try {
|
|
157
|
+
if (!this.apiClient)
|
|
158
|
+
throw new Error('API client not initialized');
|
|
159
|
+
const targetPath = path_1.default.join(targetDir, source.path);
|
|
160
|
+
const targetDirectory = path_1.default.dirname(targetPath);
|
|
161
|
+
await fs_extra_1.default.ensureDir(targetDirectory);
|
|
162
|
+
// Download file content from Nuxeo using the blob download endpoint
|
|
163
|
+
const response = await this.apiClient.get(`/id/${source.id}/@blob/file:content`, {
|
|
164
|
+
responseType: 'stream'
|
|
165
|
+
});
|
|
166
|
+
const writer = fs_extra_1.default.createWriteStream(targetPath);
|
|
167
|
+
response.data.pipe(writer);
|
|
168
|
+
return new Promise((resolve) => {
|
|
169
|
+
writer.on('finish', () => {
|
|
170
|
+
resolve({
|
|
171
|
+
success: true,
|
|
172
|
+
source,
|
|
173
|
+
localPath: targetPath,
|
|
174
|
+
bytesTransferred: source.size
|
|
175
|
+
});
|
|
176
|
+
});
|
|
177
|
+
writer.on('error', (error) => {
|
|
178
|
+
resolve({
|
|
179
|
+
success: false,
|
|
180
|
+
source,
|
|
181
|
+
error: error.message
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
return {
|
|
188
|
+
success: false,
|
|
189
|
+
source,
|
|
190
|
+
error: error.message
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
async export(config, localSources, options) {
|
|
195
|
+
this.config = config;
|
|
196
|
+
this.apiClient = this.createApiClient(this.config);
|
|
197
|
+
const results = [];
|
|
198
|
+
const rootPath = this.config.rootPath || '/default-domain/workspaces';
|
|
199
|
+
for (const source of localSources) {
|
|
200
|
+
try {
|
|
201
|
+
// Determine target path in Nuxeo
|
|
202
|
+
let targetPath = rootPath;
|
|
203
|
+
if (options?.preserveStructure && source.path.includes('/')) {
|
|
204
|
+
const folderPath = path_1.default.dirname(source.path);
|
|
205
|
+
const targetFolderId = await this.createFolderStructure(folderPath, rootPath);
|
|
206
|
+
targetPath = targetFolderId;
|
|
207
|
+
}
|
|
208
|
+
// Read local file
|
|
209
|
+
const fileContent = await fs_extra_1.default.readFile(source.id);
|
|
210
|
+
// Normalize filename to NFC to handle accented characters consistently across platforms
|
|
211
|
+
const fileName = (options?.preserveStructure ? path_1.default.basename(source.path) : source.name).normalize('NFC');
|
|
212
|
+
// Create document in Nuxeo using multipart form data
|
|
213
|
+
const FormData = require('form-data');
|
|
214
|
+
const form = new FormData();
|
|
215
|
+
// Document metadata
|
|
216
|
+
const docData = {
|
|
217
|
+
'entity-type': 'document',
|
|
218
|
+
type: 'File',
|
|
219
|
+
name: fileName,
|
|
220
|
+
properties: {
|
|
221
|
+
'dc:title': fileName,
|
|
222
|
+
'dc:description': `Uploaded via hubdoc-tools`
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
form.append('entity-type', 'document');
|
|
226
|
+
form.append('type', 'File');
|
|
227
|
+
form.append('name', fileName);
|
|
228
|
+
form.append('properties', JSON.stringify({
|
|
229
|
+
'dc:title': fileName,
|
|
230
|
+
'dc:description': 'Uploaded via hubdoc-tools'
|
|
231
|
+
}));
|
|
232
|
+
// Attach file
|
|
233
|
+
form.append('file', fileContent, {
|
|
234
|
+
filename: fileName,
|
|
235
|
+
contentType: source.mimeType || 'application/octet-stream'
|
|
236
|
+
});
|
|
237
|
+
const uploadResponse = await this.apiClient.post(`/path${targetPath}`, form, {
|
|
238
|
+
headers: {
|
|
239
|
+
...form.getHeaders()
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
const resultTargetPath = options?.preserveStructure ? source.path : source.name;
|
|
243
|
+
results.push({
|
|
244
|
+
success: true,
|
|
245
|
+
targetPath: resultTargetPath,
|
|
246
|
+
source,
|
|
247
|
+
bytesTransferred: source.size
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
results.push({
|
|
252
|
+
success: false,
|
|
253
|
+
targetPath: options?.targetPath || '',
|
|
254
|
+
source,
|
|
255
|
+
error: error.message
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
return results;
|
|
260
|
+
}
|
|
261
|
+
async createFolderStructure(folderPath, parentPath) {
|
|
262
|
+
if (!this.apiClient)
|
|
263
|
+
throw new Error('API client not initialized');
|
|
264
|
+
const parts = folderPath.split('/').filter(part => part.length > 0);
|
|
265
|
+
let currentPath = parentPath;
|
|
266
|
+
for (const folderName of parts) {
|
|
267
|
+
const expectedPath = `${currentPath}/${folderName}`;
|
|
268
|
+
try {
|
|
269
|
+
// Check if folder already exists
|
|
270
|
+
const response = await this.apiClient.get(`/path${expectedPath}`);
|
|
271
|
+
if (response.data && response.data.type === 'Folder') {
|
|
272
|
+
currentPath = expectedPath;
|
|
273
|
+
continue;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
catch (error) {
|
|
277
|
+
// Folder doesn't exist, create it
|
|
278
|
+
if (error.response?.status === 404) {
|
|
279
|
+
try {
|
|
280
|
+
const createResponse = await this.apiClient.post(`/path${currentPath}`, {
|
|
281
|
+
'entity-type': 'document',
|
|
282
|
+
type: 'Folder',
|
|
283
|
+
name: folderName,
|
|
284
|
+
properties: {
|
|
285
|
+
'dc:title': folderName
|
|
286
|
+
}
|
|
287
|
+
}, {
|
|
288
|
+
headers: {
|
|
289
|
+
'Content-Type': 'application/json'
|
|
290
|
+
}
|
|
291
|
+
});
|
|
292
|
+
currentPath = expectedPath;
|
|
293
|
+
}
|
|
294
|
+
catch (createError) {
|
|
295
|
+
throw new Error(`Failed to create folder ${folderName}: ${createError.message}`);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
throw error;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
return currentPath;
|
|
304
|
+
}
|
|
305
|
+
getConfigSchema() {
|
|
306
|
+
return {
|
|
307
|
+
type: 'object',
|
|
308
|
+
properties: {
|
|
309
|
+
baseUrl: {
|
|
310
|
+
type: 'string',
|
|
311
|
+
description: 'Nuxeo base URL (e.g., http://localhost:8080/nuxeo)',
|
|
312
|
+
required: true
|
|
313
|
+
},
|
|
314
|
+
username: {
|
|
315
|
+
type: 'string',
|
|
316
|
+
description: 'Nuxeo username',
|
|
317
|
+
required: true
|
|
318
|
+
},
|
|
319
|
+
password: {
|
|
320
|
+
type: 'string',
|
|
321
|
+
description: 'Nuxeo password',
|
|
322
|
+
required: true
|
|
323
|
+
},
|
|
324
|
+
repository: {
|
|
325
|
+
type: 'string',
|
|
326
|
+
description: 'Nuxeo repository name (default: default)',
|
|
327
|
+
default: 'default'
|
|
328
|
+
},
|
|
329
|
+
rootPath: {
|
|
330
|
+
type: 'string',
|
|
331
|
+
description: 'Starting path in Nuxeo (default: /default-domain/workspaces)',
|
|
332
|
+
default: '/default-domain/workspaces'
|
|
333
|
+
},
|
|
334
|
+
limit: {
|
|
335
|
+
type: 'number',
|
|
336
|
+
description: 'Maximum number of documents to scan (useful for testing)',
|
|
337
|
+
required: false
|
|
338
|
+
}
|
|
339
|
+
},
|
|
340
|
+
required: ['baseUrl', 'username', 'password']
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
async initialize(config) {
|
|
344
|
+
this.config = config;
|
|
345
|
+
if (!this.config.baseUrl || !this.config.username || !this.config.password) {
|
|
346
|
+
throw new Error('Nuxeo base URL, username, and password are required');
|
|
347
|
+
}
|
|
348
|
+
this.apiClient = this.createApiClient(this.config);
|
|
349
|
+
}
|
|
350
|
+
async destroy() {
|
|
351
|
+
this.config = undefined;
|
|
352
|
+
this.apiClient = undefined;
|
|
353
|
+
}
|
|
354
|
+
createApiClient(config) {
|
|
355
|
+
const repository = config.repository || 'default';
|
|
356
|
+
const baseURL = `${config.baseUrl.replace(/\/$/, '')}/api/v1/repo/${repository}`;
|
|
357
|
+
return axios_1.default.create({
|
|
358
|
+
baseURL,
|
|
359
|
+
auth: {
|
|
360
|
+
username: config.username,
|
|
361
|
+
password: config.password
|
|
362
|
+
},
|
|
363
|
+
headers: {
|
|
364
|
+
'Content-Type': 'application/json',
|
|
365
|
+
'Accept': 'application/json'
|
|
366
|
+
},
|
|
367
|
+
timeout: 30000
|
|
368
|
+
});
|
|
369
|
+
}
|
|
370
|
+
getDocumentPath(doc) {
|
|
371
|
+
// Remove the repository-specific prefix from the path
|
|
372
|
+
let cleanPath = doc.path.replace(/^\/default-domain\/workspaces\//, '');
|
|
373
|
+
// If the document has a file content, use the file name
|
|
374
|
+
if (doc.properties['file:content']?.name) {
|
|
375
|
+
const pathParts = cleanPath.split('/');
|
|
376
|
+
pathParts[pathParts.length - 1] = doc.properties['file:content'].name;
|
|
377
|
+
cleanPath = pathParts.join('/');
|
|
378
|
+
}
|
|
379
|
+
return cleanPath || doc.name;
|
|
380
|
+
}
|
|
381
|
+
shouldIncludeSource(source, options) {
|
|
382
|
+
// Apply size filter
|
|
383
|
+
if (options?.filters?.maxSize && source.size > options.filters.maxSize) {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
// Apply date range filter
|
|
387
|
+
if (options?.filters?.dateRange) {
|
|
388
|
+
const { from, to } = options.filters.dateRange;
|
|
389
|
+
if (from && source.lastModified < from)
|
|
390
|
+
return false;
|
|
391
|
+
if (to && source.lastModified > to)
|
|
392
|
+
return false;
|
|
393
|
+
}
|
|
394
|
+
// Apply MIME type filter
|
|
395
|
+
if (options?.filters?.mimeTypes && !options.filters.mimeTypes.includes(source.mimeType)) {
|
|
396
|
+
return false;
|
|
397
|
+
}
|
|
398
|
+
return true;
|
|
399
|
+
}
|
|
400
|
+
sleep(ms) {
|
|
401
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
exports.default = NuxeoPlugin;
|
|
405
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../plugins/nuxeo/index.ts"],"names":[],"mappings":";;;;;AAAA,kDAA6C;AAC7C,wDAA0B;AAC1B,gDAAwB;AAkDxB,MAAqB,WAAW;IAAhC;QACW,SAAI,GAAG,OAAO,CAAC;QACf,YAAO,GAAG,OAAO,CAAC;QAClB,gBAAW,GAAG,2BAA2B,CAAC;QAC1C,wBAAmB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;IAucvE,CAAC;IAlcC,KAAK,CAAC,cAAc,CAAC,MAAoB;QACvC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC,MAAqB,CAAC,CAAC;YAC3D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;YACzD,OAAO,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC;QACjC,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,OAAO,CAAC,KAAK,CAAC,iCAAiC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;YAChE,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,MAAoB,EAAE,OAA6B;Q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,IAAI,CAAC;YACtE,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAClC,CAAC;QAED,OAAO,SAAS,IAAI,GAAG,CAAC,IAAI,CAAC;IAC/B,CAAC;IAEO,mBAAmB,CAAC,MAAsB,EAAE,OAA6B;QAC/E,oBAAoB;QACpB,IAAI,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACvE,OAAO,KAAK,CAAC;QACf,CAAC;QAED,0BAA0B;QAC1B,IAAI,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC;YAChC,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;YAC/C,IAAI,IAAI,IAAI,MAAM,CAAC,YAAY,GAAG,IAAI;gBAAE,OAAO,KAAK,CAAC;YACrD,IAAI,EAAE,IAAI,MAAM,CAAC,YAAY,GAAG,EAAE;gBAAE,OAAO,KAAK,CAAC;QACnD,CAAC;QAED,yBAAyB;QACzB,IAAI,OAAO,EAAE,OAAO,EAAE,SAAS,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC;YACxF,OAAO,KAAK,CAAC;QACf,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;AA3cD,8BA2cC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { DocumentSourcePlugin, DocumentSource, PluginConfig, ScanResult, PluginImportOptions, PluginExportOptions, ImportResult, ExportResult } from '../../src/types/plugins';
|
|
2
|
+
export default class OneDrivePlugin implements DocumentSourcePlugin {
|
|
3
|
+
readonly name = "onedrive";
|
|
4
|
+
readonly version = "1.0.0";
|
|
5
|
+
readonly description = "Microsoft OneDrive/SharePoint document source";
|
|
6
|
+
readonly supportedOperations: readonly ["import", "export", "both"];
|
|
7
|
+
private config?;
|
|
8
|
+
private apiClient?;
|
|
9
|
+
private baseUrl;
|
|
10
|
+
testConnection(config: PluginConfig): Promise<boolean>;
|
|
11
|
+
scan(config: PluginConfig, options?: PluginImportOptions): Promise<ScanResult>;
|
|
12
|
+
private scanFolder;
|
|
13
|
+
import(config: PluginConfig, sources: DocumentSource[], targetDir: string, options?: PluginImportOptions): Promise<ImportResult[]>;
|
|
14
|
+
private importSingle;
|
|
15
|
+
export?(config: PluginConfig, localSources: DocumentSource[], options?: PluginExportOptions): Promise<ExportResult[]>;
|
|
16
|
+
private createFolderStructure;
|
|
17
|
+
getConfigSchema(): Record<string, any>;
|
|
18
|
+
initialize(config: PluginConfig): Promise<void>;
|
|
19
|
+
destroy(): Promise<void>;
|
|
20
|
+
private createApiClient;
|
|
21
|
+
private getRelativePath;
|
|
22
|
+
private shouldIncludeSource;
|
|
23
|
+
private sleep;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../plugins/onedrive/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,YAAY,EACZ,UAAU,EACV,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,YAAY,EACb,MAAM,yBAAyB,CAAC;AA6BjC,MAAM,CAAC,OAAO,OAAO,cAAe,YAAW,oBAAoB;IACjE,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,OAAO,WAAW;IAC3B,QAAQ,CAAC,WAAW,mDAAmD;IACvE,QAAQ,CAAC,mBAAmB,wCAAyC;IAErE,OAAO,CAAC,MAAM,CAAC,CAAiB;IAChC,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