contentful-migration
Version:
Migration tooling for contentful
186 lines • 4.1 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Intent {
constructor(rawStep) {
this.type = rawStep.type;
this.meta = rawStep.meta;
this.payload = rawStep.payload;
}
getContentTypeId() {
return this.payload.contentTypeId;
}
isSameContentType(other) {
return this.getContentTypeId() === other.getContentTypeId();
}
getRelatedContentTypeIds() {
return [this.getContentTypeId()];
}
getFieldId() {
return this.payload.fieldId;
}
getInvalidMethod() {
return this.payload.invalidMethod;
}
getFieldGroupId() {
return this.payload.fieldGroupId;
}
getNewFieldGroupId() {
return this.payload.newFieldGroupId;
}
getFieldGroupProps() {
return this.payload.fieldGroupProps;
}
requiresAllEntries() {
return false;
}
requiresAllTags() {
return false;
}
requiresContentType() {
return false;
}
isContentTypeUpdate() {
return false;
}
isContentTypeDelete() {
return false;
}
isContentTypeCreate() {
return false;
}
isContentTypeAnnotate() {
return false;
}
isContentTypeTaxonomyValidation() {
return false;
}
isFieldCreate() {
return false;
}
isFieldUpdate() {
return false;
}
isFieldDelete() {
return false;
}
isFieldRename() {
return false;
}
isFieldMove() {
return false;
}
isContentTransform() {
return false;
}
isEntryDerive() {
return false;
}
isEntryTransformToType() {
return false;
}
isEditorInterfaceUpdate() {
return false;
}
isSidebarUpdate() {
return false;
}
isGroupable() {
return false;
}
isEditorInterfaceIntent() {
return false;
}
isEditorLayoutCreate() {
return false;
}
isEditorLayoutDelete() {
return false;
}
isEditorLayoutUpdate() {
return false;
}
isEditorLayoutInvalidMethod() {
return false;
}
isFieldGroupCreate() {
return false;
}
isFieldGroupDelete() {
return false;
}
isFieldGroupUpdate() {
return false;
}
isFieldGroupIdChange() {
return false;
}
isFieldGroupControlChange() {
return false;
}
isAboutContentType() {
return this.isContentTypeUpdate() || this.isContentTypeCreate() || this.isContentTypeDelete();
}
isAboutField() {
return (this.isFieldCreate() ||
this.isFieldUpdate() ||
this.isFieldMove() ||
this.isFieldRename() ||
this.isFieldDelete());
}
isAboutEditorLayout() {
return this.isEditorLayoutCreate() || this.isEditorLayoutDelete() || this.isEditorLayoutUpdate();
}
isComposedIntent() {
return false;
}
groupsWith(other) {
// A content transform does not end the group,
// but still could share a content type ID
if (other.isContentTransform()) {
return false;
}
if (other.getContentTypeId() === this.getContentTypeId()) {
return true;
}
return false;
}
shouldSave() {
return true;
}
shouldPublish() {
if (!this.shouldSave()) {
throw new Error('Cannot publish when shouldSave has falsy value');
}
return true;
}
toRaw() {
return {
type: this.type,
meta: this.meta,
payload: this.payload
};
}
getRawType() {
return this.type;
}
getTagId() {
return '';
}
isTagCreate() {
return false;
}
isTagUpdate() {
return false;
}
isTagDelete() {
return false;
}
isTagIntent() {
return false;
}
isEntrySetTags() {
return false;
}
}
exports.default = Intent;
//# sourceMappingURL=base-intent.js.map