@botonic/plugin-contentful
Version:
## What Does This Plugin Do?
47 lines (46 loc) • 1.46 kB
TypeScript
import parser from 'csv-parse';
import { ContentType } from '../../cms';
import { ContentField, ContentFieldType } from '../../manage-cms/fields';
import { ReadCsvOptions } from './import-csv-from-translators';
import { ImportRecordReducer } from './import-updater';
export declare const PARSE_OPTIONS: parser.Options;
export interface Record {
Model: ContentType;
Code: string;
Id: string;
Field: ContentFieldType;
from: string;
to: string;
}
export declare function recordId(record: Record): string;
export interface CsvImportOptions {
readonly nameFilter?: (contentName: string) => boolean;
}
export declare class CsvImport {
private readonly importer;
private readonly options;
constructor(importer: ImportRecordReducer, options?: CsvImportOptions);
static HeaderSkipper: {
new (): {
first: boolean;
skipFirst(record: Record): boolean;
};
};
import(options: ReadCsvOptions): Promise<void>;
private sortRecords;
private importRecords;
extraColumnsMustBeEmpty(record: Record): void;
}
export declare class RecordFixer {
readonly record: Record;
readonly field: ContentField;
constructor(record: Record);
fix(): void;
fixCapitals(): void;
fixTrimmingQuotes(): void;
fixExcelNewLine(): void;
private fixStringArraySeparators;
checkKeywordLen(): void;
private removeLastEmptyItem;
complain(msg: string): void;
}