UNPKG

contentful-migration

Version:
58 lines 2.41 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 editorinterface_update_1 = require("../action/editorinterface-update"); const chalk_1 = __importDefault(require("chalk")); const editorinterface_save_1 = require("../action/editorinterface-save"); class EditorInterfaceUpdateIntent extends base_intent_1.default { isEditorInterfaceUpdate() { return true; } isEditorInterfaceIntent() { return true; } isGroupable() { return true; } groupsWith(other) { return other.isGroupable() && other.isEditorInterfaceIntent() && this.isSameContentType(other); } endsGroup() { return false; } shouldSave() { return false; } shouldPublish() { return false; } toActions() { return [ new editorinterface_update_1.UpdateEditorInterfaceAction(this.payload.contentTypeId, this.payload.editorInterface.fieldId, this.payload.editorInterface.widgetId, this.payload.editorInterface.settings, this.payload.editorInterface.widgetNamespace), new editorinterface_save_1.SaveEditorInterfaceAction(this.payload.contentTypeId) ]; } toPlanMessage() { const { widgetId, fieldId, settings, widgetNamespace } = this.payload.editorInterface; let createDetails = [(0, chalk_1.default) `{italic widgetId}: "${widgetId}"`]; if (widgetNamespace) { createDetails = [...createDetails, (0, chalk_1.default) `{italic widgetNamespace}: "${widgetNamespace}"`]; } Object.keys(settings).forEach((settingName) => createDetails.push((0, chalk_1.default) `{italic ${settingName}}: "${settings[settingName].toString()}"`)); return { heading: (0, chalk_1.default) `Update field controls for Content Type {bold.yellow ${this.getContentTypeId()}}`, details: [], sections: [ { heading: (0, chalk_1.default) `Update field {yellow ${fieldId}}`, details: createDetails } ] }; } } exports.default = EditorInterfaceUpdateIntent; //# sourceMappingURL=editorinterface-update.js.map