UNPKG

contentful-migration

Version:
32 lines 1.07 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.FieldRenameAction = void 0; const action_1 = require("./action"); class FieldRenameAction extends action_1.EntityAction { constructor(contentTypeId, fieldId, props) { super(); this.contentTypeId = contentTypeId; this.fieldId = fieldId; this.props = props; } getEntityId() { return this.contentTypeId; } getEntityType() { return action_1.EntityType.ContentType; } async applyTo(ct) { const fields = ct.fields; const field = fields.getField(this.fieldId); const fieldAnnotations = ct.getFieldAnnotations(this.fieldId); fields.deleteField(this.fieldId); field.id = this.props.newId; delete field.newId; fields.setField(this.props.newId, field); if (fieldAnnotations) { ct.setFieldAnnotations(this.props.newId, fieldAnnotations); } } } exports.FieldRenameAction = FieldRenameAction; //# sourceMappingURL=field-rename.js.map