@botonic/plugin-contentful
Version:
## What Does This Plugin Do?
55 lines (54 loc) • 2.15 kB
TypeScript
import { CMS, ContentId, ContentType } from '../../cms';
import { CmsInfo } from '../../cms/cms-info';
import { ManageCms, ManageContext } from '../../manage-cms';
import { ContentDeleter } from '../../manage-cms/content-deleter';
import { FieldsValues } from '../../manage-cms/manage-cms';
import { Stringable } from '../../util/objects';
import { Record } from './csv-import';
export declare class ContentToImport implements Stringable {
readonly contentId: ContentId;
readonly name: string;
readonly fields: FieldsValues;
constructor(contentId: ContentId, name: string, fields: FieldsValues);
toString(): string;
}
/**
* Reduce all the records read from a csv into ContentToImport's
* and delegates to ContentUpdater.
* It also checks consistency of all records of a given content
*/
export declare class ImportRecordReducer {
readonly importer: ImportContentUpdater;
readonly options: {
resumeErrors?: boolean;
};
pending: Record[];
constructor(importer: ImportContentUpdater, options: {
resumeErrors?: boolean;
});
consume(record: Record): Promise<void>;
checkLast(record: Record, last: Record): boolean;
flush(): Promise<void>;
private last;
private value;
}
/**
* - If ContentToImport only has shortText and its value is empty,
* it'll assume that the content needs to be removed for this locale.
* Its fields will be deleted and all buttons which target it will be removed.
* - Otherwise, the specified fields will be overwritten
*/
export declare class ImportContentUpdater {
readonly manageCms: ManageCms;
readonly cms: CMS;
readonly info: CmsInfo;
readonly context: ManageContext;
readonly deleter: ContentDeleter;
private defaultLocaleContents;
constructor(manageCms: ManageCms, cms: CMS, info: CmsInfo, context: ManageContext, deleter: ContentDeleter);
update(content: ContentToImport): Promise<void>;
private updateFields;
contentTypes(): Promise<ContentType[]>;
warnMissingFields(content: ContentToImport, _newVals: FieldsValues): Promise<void>;
mustBeDeleted(content: ContentToImport): boolean;
}