2019-09-13 00:16:42 +02:00
|
|
|
/* eslint @typescript-eslint/no-unused-vars: 0, no-unused-vars: ["error", { "argsIgnorePattern": ".*" }], */
|
|
|
|
|
2019-10-02 20:22:32 +02:00
|
|
|
const Setting = require('lib/models/Setting');
|
|
|
|
|
2018-02-26 21:25:54 +02:00
|
|
|
class InteropService_Exporter_Base {
|
2020-01-18 15:16:14 +02:00
|
|
|
constructor() {
|
|
|
|
this.context_ = {};
|
|
|
|
}
|
|
|
|
|
2020-01-24 23:46:48 +02:00
|
|
|
async init(destDir, options = {}) {}
|
2020-01-18 15:16:14 +02:00
|
|
|
async prepareForProcessingItemType(type, itemsToExport) {}
|
2018-02-26 21:25:54 +02:00
|
|
|
async processItem(ItemClass, item) {}
|
|
|
|
async processResource(resource, filePath) {}
|
|
|
|
async close() {}
|
|
|
|
|
2018-06-26 01:07:53 +02:00
|
|
|
setMetadata(md) {
|
|
|
|
this.metadata_ = md;
|
|
|
|
}
|
|
|
|
|
|
|
|
metadata() {
|
|
|
|
return this.metadata_;
|
|
|
|
}
|
|
|
|
|
2018-11-21 02:36:23 +02:00
|
|
|
updateContext(context) {
|
2020-01-18 15:16:14 +02:00
|
|
|
this.context_ = Object.assign(this.context_, context);
|
2018-11-21 02:36:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
context() {
|
|
|
|
return this.context_;
|
|
|
|
}
|
|
|
|
|
2018-02-26 21:25:54 +02:00
|
|
|
async temporaryDirectory_(createIt) {
|
|
|
|
const md5 = require('md5');
|
2019-10-02 20:22:32 +02:00
|
|
|
const tempDir = `${Setting.value('tempDir')}/${md5(Math.random() + Date.now())}`;
|
2018-02-26 21:25:54 +02:00
|
|
|
if (createIt) await require('fs-extra').mkdirp(tempDir);
|
|
|
|
return tempDir;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-29 15:43:53 +02:00
|
|
|
module.exports = InteropService_Exporter_Base;
|