contentful-migration
Version:
Migration tooling for contentful
43 lines • 1.67 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 content_type_update_1 = require("../action/content-type-update");
const chalk_1 = __importDefault(require("chalk"));
const lodash_1 = require("lodash");
class ContentTypeUpdateIntent extends base_intent_1.default {
isContentTypeUpdate() {
return true;
}
groupsWith(other) {
const sameContentType = other.getContentTypeId() === this.getContentTypeId();
return ((other.isContentTypeUpdate() ||
other.isContentTypeCreate() ||
other.isContentTypeAnnotate() ||
other.isContentTypeTaxonomyValidation() ||
other.isFieldCreate() ||
other.isFieldUpdate() ||
other.isFieldMove()) &&
sameContentType);
}
endsGroup() {
return false;
}
toActions() {
return [new content_type_update_1.ContentTypeUpdateAction(this.getContentTypeId(), this.payload.props)];
}
toPlanMessage() {
const details = (0, lodash_1.entries)(this.payload.props).map(([key, value]) => {
return (0, chalk_1.default) `{italic ${key}}: ${JSON.stringify(value)}`;
});
return {
heading: (0, chalk_1.default) `Update Content Type {bold.yellow ${this.getContentTypeId()}}`,
details,
sections: []
};
}
}
exports.default = ContentTypeUpdateIntent;
//# sourceMappingURL=content-type-update.js.map