From 6e5492283478c61607124b63ca53c00d6251e823 Mon Sep 17 00:00:00 2001 From: Reinier Battenberg Date: Sat, 6 Apr 2019 11:39:30 +0200 Subject: [PATCH] feat: Release compiled versions --- dist/jcognos.cjs.js | 46 ++++++++++++++++++++++++++++++++++++++------- dist/jcognos.esm.js | 46 ++++++++++++++++++++++++++++++++++++++------- dist/jcognos.js | 46 ++++++++++++++++++++++++++++++++++++++------- 3 files changed, 117 insertions(+), 21 deletions(-) diff --git a/dist/jcognos.cjs.js b/dist/jcognos.cjs.js index 79f595d..2bdd2da 100644 --- a/dist/jcognos.cjs.js +++ b/dist/jcognos.cjs.js @@ -413,9 +413,7 @@ var CognosRequest = (function() { result = response; } else { try { - result = response.replace(/=\\'/g, "='"); - result = result.replace(/\\']/g, "']"); - result = JSON.parse(result); + result = response.data; } catch (err) { me.log('No valid JSON returned from delete request. ' + path); result = response; @@ -1416,7 +1414,7 @@ var Cognos = (function() { if (id) { result = me.requester .put('bi/v1/palettes/' + id, false, palette) - .then(function(data) { + .then(function() { me.log('saved palette ' + id); return id; }) @@ -1432,7 +1430,7 @@ var Cognos = (function() { .then(function() { me.log('We have been reset, savePalette again'); me.resetting = false; - return me.savePalettes(id, palette); + return me.savePalette(id, palette); }) .catch(function() { throw err; @@ -1441,7 +1439,7 @@ var Cognos = (function() { } else { result = me.requester .post('bi/v1/palettes/my', palette, true) - .then(function(data) { + .then(function() { me.log('saved palette'); }) .catch(function(err) { @@ -1451,7 +1449,7 @@ var Cognos = (function() { .then(function() { me.log('We have been reset, savePalette again'); me.resetting = false; - return me.savePalettes(palette, id); + return me.savePalette(palette, id); }) .catch(function() { throw err; @@ -1461,6 +1459,40 @@ var Cognos = (function() { return result; } + }, + { + key: 'deletePalette', + value: function deletePalette(id) { + var me = this; + var params = { + force: 'true' + }; + var result = me.requester + .delete('bi/v1/palettes/' + id, params, false) + .then(function() { + me.log('deleted palette ' + id); + return id; + }) + .catch(function(err) { + me.error('CognosRequest : Error in deletePalette', err); + + if (err == 'Not Found') { + throw 'Palette with id ' + id + ' is not found'; + } + + return me + .handleError(err) + .then(function() { + me.log('We have been reset, deletePalette again'); + me.resetting = false; + return me.deletePalette(id); + }) + .catch(function() { + throw err; + }); + }); + return result; + } } ]); diff --git a/dist/jcognos.esm.js b/dist/jcognos.esm.js index 0c6883b..0587ba3 100644 --- a/dist/jcognos.esm.js +++ b/dist/jcognos.esm.js @@ -405,9 +405,7 @@ var CognosRequest = (function() { result = response; } else { try { - result = response.replace(/=\\'/g, "='"); - result = result.replace(/\\']/g, "']"); - result = JSON.parse(result); + result = response.data; } catch (err) { me.log('No valid JSON returned from delete request. ' + path); result = response; @@ -1408,7 +1406,7 @@ var Cognos = (function() { if (id) { result = me.requester .put('bi/v1/palettes/' + id, false, palette) - .then(function(data) { + .then(function() { me.log('saved palette ' + id); return id; }) @@ -1424,7 +1422,7 @@ var Cognos = (function() { .then(function() { me.log('We have been reset, savePalette again'); me.resetting = false; - return me.savePalettes(id, palette); + return me.savePalette(id, palette); }) .catch(function() { throw err; @@ -1433,7 +1431,7 @@ var Cognos = (function() { } else { result = me.requester .post('bi/v1/palettes/my', palette, true) - .then(function(data) { + .then(function() { me.log('saved palette'); }) .catch(function(err) { @@ -1443,7 +1441,7 @@ var Cognos = (function() { .then(function() { me.log('We have been reset, savePalette again'); me.resetting = false; - return me.savePalettes(palette, id); + return me.savePalette(palette, id); }) .catch(function() { throw err; @@ -1453,6 +1451,40 @@ var Cognos = (function() { return result; } + }, + { + key: 'deletePalette', + value: function deletePalette(id) { + var me = this; + var params = { + force: 'true' + }; + var result = me.requester + .delete('bi/v1/palettes/' + id, params, false) + .then(function() { + me.log('deleted palette ' + id); + return id; + }) + .catch(function(err) { + me.error('CognosRequest : Error in deletePalette', err); + + if (err == 'Not Found') { + throw 'Palette with id ' + id + ' is not found'; + } + + return me + .handleError(err) + .then(function() { + me.log('We have been reset, deletePalette again'); + me.resetting = false; + return me.deletePalette(id); + }) + .catch(function() { + throw err; + }); + }); + return result; + } } ]); diff --git a/dist/jcognos.js b/dist/jcognos.js index 2bf2da4..86a4d1c 100644 --- a/dist/jcognos.js +++ b/dist/jcognos.js @@ -17050,9 +17050,7 @@ result = response; } else { try { - result = response.replace(/=\\'/g, "='"); - result = result.replace(/\\']/g, "']"); - result = JSON.parse(result); + result = response.data; } catch (err) { me.log('No valid JSON returned from delete request. ' + path); result = response; @@ -19501,7 +19499,7 @@ if (id) { result = me.requester .put('bi/v1/palettes/' + id, false, palette) - .then(function(data) { + .then(function() { me.log('saved palette ' + id); return id; }) @@ -19517,7 +19515,7 @@ .then(function() { me.log('We have been reset, savePalette again'); me.resetting = false; - return me.savePalettes(id, palette); + return me.savePalette(id, palette); }) .catch(function() { throw err; @@ -19526,7 +19524,7 @@ } else { result = me.requester .post('bi/v1/palettes/my', palette, true) - .then(function(data) { + .then(function() { me.log('saved palette'); }) .catch(function(err) { @@ -19536,7 +19534,7 @@ .then(function() { me.log('We have been reset, savePalette again'); me.resetting = false; - return me.savePalettes(palette, id); + return me.savePalette(palette, id); }) .catch(function() { throw err; @@ -19546,6 +19544,40 @@ return result; } + }, + { + key: 'deletePalette', + value: function deletePalette(id) { + var me = this; + var params = { + force: 'true' + }; + var result = me.requester + .delete('bi/v1/palettes/' + id, params, false) + .then(function() { + me.log('deleted palette ' + id); + return id; + }) + .catch(function(err) { + me.error('CognosRequest : Error in deletePalette', err); + + if (err == 'Not Found') { + throw 'Palette with id ' + id + ' is not found'; + } + + return me + .handleError(err) + .then(function() { + me.log('We have been reset, deletePalette again'); + me.resetting = false; + return me.deletePalette(id); + }) + .catch(function() { + throw err; + }); + }); + return result; + } } ]);