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';
|
2023-07-18 15:58:06 +02:00
|
|
|
import shim from '../../shim';
|
2024-01-10 00:03:34 +02:00
|
|
|
import { type ExportMetadata } from './Module';
|
|
|
|
import { ExportOptions } from './types';
|
2020-10-09 19:35:46 +02:00
|
|
|
|
|
|
|
export default class InteropService_Exporter_Base {
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2020-11-12 21:13:28 +02:00
|
|
|
private context_: any = {};
|
2024-01-10 00:03:34 +02:00
|
|
|
private metadata_: ExportMetadata = null;
|
2020-10-09 19:35:46 +02:00
|
|
|
|
2024-01-10 00:03:34 +02:00
|
|
|
public async init(_destDir: string, _options: ExportOptions = {}) {}
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2023-06-30 11:22:47 +02:00
|
|
|
public async prepareForProcessingItemType(_itemType: number, _itemsToExport: any[]) {}
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2023-06-30 11:22:47 +02:00
|
|
|
public async processItem(_itemType: number, _item: any) {}
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2023-06-30 11:22:47 +02:00
|
|
|
public async processResource(_resource: any, _filePath: string) {}
|
2023-03-06 16:22:01 +02:00
|
|
|
public async close() {}
|
2020-10-09 19:35:46 +02:00
|
|
|
|
2024-01-10 00:03:34 +02:00
|
|
|
public setMetadata(md: ExportMetadata) {
|
2020-10-09 19:35:46 +02:00
|
|
|
this.metadata_ = md;
|
|
|
|
}
|
|
|
|
|
2023-03-06 16:22:01 +02:00
|
|
|
public metadata() {
|
2020-10-09 19:35:46 +02:00
|
|
|
return this.metadata_;
|
|
|
|
}
|
|
|
|
|
2024-04-05 13:16:49 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
2023-03-06 16:22:01 +02:00
|
|
|
public updateContext(context: any) {
|
2023-06-01 13:02:36 +02:00
|
|
|
this.context_ = { ...this.context_, ...context };
|
2020-10-09 19:35:46 +02:00
|
|
|
}
|
|
|
|
|
2023-03-06 16:22:01 +02:00
|
|
|
public context() {
|
2020-10-09 19:35:46 +02:00
|
|
|
return this.context_;
|
|
|
|
}
|
|
|
|
|
2023-03-06 16:22:01 +02:00
|
|
|
protected 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())}`;
|
2023-07-18 15:58:06 +02:00
|
|
|
if (createIt) await shim.fsDriver().mkdir(tempDir);
|
2020-10-09 19:35:46 +02:00
|
|
|
return tempDir;
|
|
|
|
}
|
|
|
|
}
|