From 35f720f94fa4feb10dd7f7488aed4b3090862149 Mon Sep 17 00:00:00 2001 From: Richard Shephard Date: Thu, 16 May 2019 11:56:25 +0200 Subject: [PATCH] Added extra parameters to delete projections --- src/projections/projectionsClient.js | 6 ++++-- src/projections/projectionsManager.js | 12 +++++++----- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/projections/projectionsClient.js b/src/projections/projectionsClient.js index 781694a..2808c74 100644 --- a/src/projections/projectionsClient.js +++ b/src/projections/projectionsClient.js @@ -102,8 +102,10 @@ ProjectionsClient.prototype.updateQuery = function(httpEndPoint, name, query, us return this.sendPut(httpEndPoint + '/projection/' + name + '/query?type=JS', query, userCredentials, HTTP_OK); }; -ProjectionsClient.prototype.delete = function(httpEndPoint, name, deleteEmittedStreams, userCredentials) { - return this.sendDelete(httpEndPoint + '/projection/' + name + '?deleteEmittedStreams=' + deleteEmittedStreams, userCredentials, HTTP_OK); +ProjectionsClient.prototype.delete = function(httpEndPoint, name, deleteEmittedStreams, deleteStateStream, deleteCheckpointStream, userCredentials) { + const stateStream = (deleteStateStream === undefined) ? false : deleteStateStream; + const checkpointStream = (deleteCheckpointStream === undefined) ? false : deleteCheckpointStream; + return this.sendDelete(httpEndPoint + '/projection/' + name + '?deleteStateStream=' + stateStream + '&deleteCheckpointStream' + checkpointStream + '&deleteEmittedStreams=' + deleteEmittedStreams, userCredentials, HTTP_OK); }; ProjectionsClient.prototype.request = function(method, _url, data, userCredentials, expectedCode) { diff --git a/src/projections/projectionsManager.js b/src/projections/projectionsManager.js index f453d4b..0c2fcf0 100644 --- a/src/projections/projectionsManager.js +++ b/src/projections/projectionsManager.js @@ -190,13 +190,15 @@ ProjectionsManager.prototype.updateQuery = function(name, query, userCredentials /** * Updates the definition of a query. - * @param name The name of the projection. - * @param deleteEmittedStreams Whether to delete the streams that were emitted by this projection. - * @param userCredentials Credentials for a user with permission to delete a projection. + * @param name The name of the projection. + * @param deleteEmittedStreams Whether to delete the streams that were emitted by this projection. + * @param deleteStateStream Where to delete the state stream for this projection + * @param deleteCheckpointStream Where to delete the checkpoint stream for this projection + * @param userCredentials Credentials for a user with permission to delete a projection. * @returns {Promise} */ -ProjectionsManager.prototype.delete = function(name, deleteEmittedStreams, userCredentials) { - return this._client.delete(this._httpEndPoint, name, deleteEmittedStreams, userCredentials); +ProjectionsManager.prototype.delete = function(name, deleteEmittedStreams, deleteStateStream, deleteCheckpointStream, userCredentials) { + return this._client.delete(this._httpEndPoint, name, deleteEmittedStreams, deleteStateStream, deleteCheckpointStream, userCredentials); }; module.exports = ProjectionsManager; \ No newline at end of file