UNPKG

contentful-migration

Version:
48 lines 1.5 kB
"use strict"; 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 tag_update_1 = require("../action/tag-update"); const chalk_1 = __importDefault(require("chalk")); const lodash_1 = require("lodash"); class TagUpdateIntent extends base_intent_1.default { isTagIntent() { return true; } getTagId() { return this.payload.tagId; } isTagUpdate() { return true; } groupsWith(other) { const sameTag = other.getTagId() === this.getTagId(); return (other.isTagUpdate() || other.isTagCreate()) && sameTag; } endsGroup() { return false; } shouldPublish() { return false; } requiresAllTags() { return true; } toActions() { return [new tag_update_1.TagUpdateAction(this.getTagId(), 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 Tag {bold.yellow ${this.getTagId()}}`, details, sections: [] }; } } exports.default = TagUpdateIntent; //# sourceMappingURL=tag-update.js.map