@botonic/plugin-contentful
Version:
## What Does This Plugin Do?
37 lines (36 loc) • 1.5 kB
TypeScript
/// <reference types="node" />
import stringify from 'csv-stringify';
import * as stream from 'stream';
import { CMS, CommonFields, Content } from '../../index';
import { I18nField } from '../../manage-cms/fields';
import { Locale } from '../../nlp';
type CsvLine = string[];
interface CsvExportOptions {
readonly nameFilter?: (name: string) => boolean;
readonly stringFilter?: (text: string) => boolean;
}
export declare const skipEmptyStrings: (str: string) => boolean;
/***
* @see I18nEntryTraverser limitations.
* It should be reimplemented without traversing field references.
* Uses https://csv.js.org/stringify/api/
*/
export declare class CsvExport {
private readonly options;
private toFields;
constructor(options: CsvExportOptions, postprocessor?: (field: I18nField) => I18nField);
static sortRows(a: string[], b: string[]): number;
write(fname: string, cms: CMS, locale: Locale): Promise<void>;
toPromise(writable: stream.Writable): Promise<void>;
generate(cms: CMS, from: Locale): AsyncGenerator<CsvLine>;
}
export declare class ContentToCsvLines {
private readonly options;
private readonly postprocessor?;
constructor(options: CsvExportOptions, postprocessor?: ((field: I18nField) => I18nField) | undefined);
getCsvLines(content: Content): CsvLine[];
getFields(content: Content): I18nField[];
getCommonFields(common: CommonFields): I18nField[];
}
export declare function create_stringifier(): stringify.Stringifier;
export {};