contentful-migration
Version:
Migration tooling for contentful
47 lines • 1.77 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_create_1 = require("../action/field-create");
const chalk_1 = __importDefault(require("chalk"));
const editor_layout_create_field_1 = require("../action/editor-layout/editor-layout-create-field");
class FieldCreateIntent extends base_intent_1.default {
isFieldCreate() {
return true;
}
groupsWith(other) {
const sameContentType = other.getContentTypeId() === this.getContentTypeId();
return ((other.isContentTypeUpdate() ||
other.isContentTypeCreate() ||
other.isContentTypeAnnotate() ||
other.isFieldCreate() ||
other.isFieldUpdate() ||
other.isFieldMove()) &&
sameContentType);
}
endsGroup() {
return false;
}
toActions() {
return [
new field_create_1.FieldCreateAction(this.getContentTypeId(), this.getFieldId()),
new editor_layout_create_field_1.EditorLayoutCreateFieldAction(this.getContentTypeId(), this.getFieldId())
];
}
toPlanMessage() {
return {
heading: (0, chalk_1.default) `Update Content Type {bold.yellow ${this.getContentTypeId()}}`,
sections: [
{
heading: (0, chalk_1.default) `Create field {yellow ${this.getFieldId()}}`,
details: []
}
],
details: []
};
}
}
exports.default = FieldCreateIntent;
//# sourceMappingURL=field-create.js.map