'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2019, 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ /** * * @class APISpec * @hideconstructor * @classdesc */ define([], function () { var APISpec = function () { function APISpec() { _classCallCheck(this, APISpec); } APISpec.prototype.getAPISpec = function getAPISpec() { var _this = this; if (!this.apiSpec) { this.apiSpec = { name: 'savedPrompts API', events: { propagationInfo: { namespace: 'savedPrompts', callStack: { name: 'getSavedPrompts' }, info: { supportsUndoRedo: true, refresh: { dataIfQueryChanged: true } } }, actions: { // todo: for now we wire off the new api events mechanism for Prompts API. // we need to consider the entire prompts feature in the future if we want to enable events here. 'save': { eventName: 'savedprompts:save', getInfo: function getInfo(args) { return { promptValueSpec: args ? args[0] : undefined }; }, getUndoActions: function getUndoActions() { var currentValue = _this.widgetModel.get('savedPrompts'); return [{ name: 'reset', params: [currentValue ? JSON.parse(JSON.stringify(currentValue)) : undefined, true] }]; } }, 'reset': { eventName: 'savedprompts:reset', getInfo: function getInfo(args) { return { promptValueSpec: args ? args[0] : undefined }; }, getUndoActions: function getUndoActions(args) { return [{ name: 'reset', params: [args[0], true] }]; }, isTriggerEvent: function isTriggerEvent(action, undoActions, returnValue) { return returnValue; } } } } }; } return this.apiSpec; }; return APISpec; }(); return APISpec; }); //# sourceMappingURL=SavedPromptsAPISpec.js.map