2020-10-09 19:35:46 +02:00
|
|
|
/* eslint @typescript-eslint/no-unused-vars: 0, no-unused-vars: ["error", { "argsIgnorePattern": ".*" }], */
|
|
|
|
|
2021-01-22 19:41:11 +02:00
|
|
|
import Setting from '../../models/Setting';
|
2020-10-09 19:35:46 +02:00
|
|
|
|
|
|
|
export default class InteropService_Exporter_Base {
|
2020-11-12 21:13:28 +02:00
|
|
|
private context_: any = {};
|
|
|
|
private metadata_: any = {};
|
2020-10-09 19:35:46 +02:00
|
|
|
|
|
|
|
// @ts-ignore
|
2020-11-12 21:13:28 +02:00
|
|
|
async init(destDir: string, options: any = {}) {}
|
2020-10-09 19:35:46 +02:00
|
|
|
// @ts-ignore
|
2020-11-12 21:13:28 +02:00
|
|
|
async prepareForProcessingItemType(itemType: number, itemsToExport: any[]) {}
|
2020-10-09 19:35:46 +02:00
|
|
|
// @ts-ignore
|
2020-11-12 21:13:28 +02:00
|
|
|
async processItem(itemType: number, item: any) {}
|
2020-10-09 19:35:46 +02:00
|
|
|
// @ts-ignore
|
2020-11-12 21:13:28 +02:00
|
|
|
async processResource(resource: any, filePath: string) {}
|
2020-10-09 19:35:46 +02:00
|
|
|
async close() {}
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
setMetadata(md: any) {
|
2020-10-09 19:35:46 +02:00
|
|
|
this.metadata_ = md;
|
|
|
|
}
|
|
|
|
|
|
|
|
metadata() {
|
|
|
|
return this.metadata_;
|
|
|
|
}
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
updateContext(context: any) {
|
2020-10-09 19:35:46 +02:00
|
|
|
this.context_ = Object.assign({}, this.context_, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
context() {
|
|
|
|
return this.context_;
|
|
|
|
}
|
|
|
|
|
2020-11-12 21:13:28 +02:00
|
|
|
async temporaryDirectory_(createIt: boolean) {
|
2020-10-09 19:35:46 +02:00
|
|
|
const md5 = require('md5');
|
|
|
|
const tempDir = `${Setting.value('tempDir')}/${md5(Math.random() + Date.now())}`;
|
|
|
|
if (createIt) await require('fs-extra').mkdirp(tempDir);
|
|
|
|
return tempDir;
|
|
|
|
}
|
|
|
|
}
|