contentful-migration
Version:
Migration tooling for contentful
64 lines • 2.79 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const base_intent_1 = __importDefault(require("./base-intent"));
const field_rename_1 = require("../action/field-rename");
const entry_field_rename_1 = require("../action/entry-field-rename");
const editorinterface_copy_1 = require("../action/editorinterface-copy");
const editorinterface_save_1 = require("../action/editorinterface-save");
const editorinterface_reset_1 = require("../action/editorinterface-reset");
const content_type_save_1 = require("../action/content-type-save");
const content_type_publish_1 = require("../action/content-type-publish");
const field_update_1 = require("../action/field-update");
const chalk_1 = __importDefault(require("chalk"));
const editor_layout_rename_field_1 = require("../action/editor-layout/editor-layout-rename-field");
class FieldRenameIntent extends base_intent_1.default {
isFieldRename() {
return true;
}
groupsWith() {
return false;
}
endsGroup() {
return true;
}
getNewId() {
return this.payload.props.newId;
}
shouldSave() {
return false;
}
shouldPublish() {
return false;
}
toActions() {
const ctId = this.getContentTypeId();
return [
new field_update_1.FieldUpdateAction(ctId, this.getFieldId(), { newId: this.getNewId() }),
new content_type_save_1.ContentTypeSaveAction(ctId),
new content_type_publish_1.ContentTypePublishAction(ctId),
new field_rename_1.FieldRenameAction(ctId, this.getFieldId(), { newId: this.getNewId() }),
new editorinterface_copy_1.CopyEditorInterfaceAction(ctId, this.getFieldId(), this.getNewId()),
new editorinterface_reset_1.ResetEditorInterfaceAction(ctId, this.getFieldId()),
new editor_layout_rename_field_1.EditorLayoutRenameFieldAction(ctId, this.getFieldId(), this.getNewId()),
new editorinterface_save_1.SaveEditorInterfaceAction(ctId),
new entry_field_rename_1.EntryFieldRenameAction(ctId, this.payload.fieldId, { newId: this.getNewId() })
];
}
toPlanMessage() {
return {
heading: (0, chalk_1.default) `Update Content Type {bold.yellow ${this.getContentTypeId()}}`,
sections: [
{
heading: (0, chalk_1.default) `Rename field {yellow ${this.getFieldId()}} to {yellow ${this.getNewId()}}`,
details: []
}
],
details: []
};
}
}
exports.default = FieldRenameIntent;
//# sourceMappingURL=field-rename.js.map