Merge pull request #78 from Poimen/fix-issue-76

Adds extra options to delete
This commit is contained in:
Nicolas Dextraze 2019-05-20 13:01:26 -07:00 committed by GitHub
commit 930b900426
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 9 deletions

View File

@ -23,7 +23,7 @@ Install using `npm install node-eventstore-client`
### Dependencies ### Dependencies
- Node.js >= 4.0 - Node.js >= 4.0
- Modules: [long](https://www.npmjs.org/package/long), [protobufjs](https://www.npmjs.org/package/protobufjs), [uuid](https://www.npmjs.org/package/uuid) (installed via `npm install`) - Modules: [long](https://www.npmjs.org/package/long), [protobufjs](https://www.npmjs.org/package/protobufjs), [uuid](https://www.npmjs.org/package/uuid), [strict-event-emitter-types](https://www.npmjs.com/package/strict-event-emitter-types) (installed via `npm install`)
### Install and run an Eventstore on localhost ### Install and run an Eventstore on localhost

2
index.d.ts vendored
View File

@ -88,7 +88,7 @@ export class ProjectionsManager {
getQuery(name: string, userCredentials: UserCredentials): Promise<string>; getQuery(name: string, userCredentials: UserCredentials): Promise<string>;
getState(name: string, userCredentials: UserCredentials): Promise<string>; getState(name: string, userCredentials: UserCredentials): Promise<string>;
updateQuery(name: string, query: string, userCredentials: UserCredentials): Promise<void>; updateQuery(name: string, query: string, userCredentials: UserCredentials): Promise<void>;
deleteQuery(name: string, deleteEmittedStreams: boolean, userCredentials: UserCredentials): Promise<void>; delete(name: string, deleteEmittedStreams: boolean, deleteStateStream: boolean, deleteCheckpointStream: boolean, userCredentials: UserCredentials): Promise<void>;
} }
// Expose errors // Expose errors

View File

@ -106,8 +106,8 @@ ProjectionsClient.prototype.updateQuery = function(httpEndPoint, name, query, us
return this.sendPut(httpEndPoint + '/projection/' + name + '/query?type=JS', query, userCredentials, HTTP_OK); return this.sendPut(httpEndPoint + '/projection/' + name + '/query?type=JS', query, userCredentials, HTTP_OK);
}; };
ProjectionsClient.prototype.delete = function(httpEndPoint, name, deleteEmittedStreams, userCredentials) { ProjectionsClient.prototype.delete = function(httpEndPoint, name, deleteEmittedStreams, deleteStateStream, deleteCheckpointStream, userCredentials) {
return this.sendDelete(httpEndPoint + '/projection/' + name + '?deleteEmittedStreams=' + deleteEmittedStreams, userCredentials, HTTP_OK); return this.sendDelete(httpEndPoint + '/projection/' + name + '?deleteStateStream=' + deleteStateStream + '&deleteCheckpointStream=' + deleteCheckpointStream + '&deleteEmittedStreams=' + deleteEmittedStreams, '', userCredentials, HTTP_OK);
}; };
ProjectionsClient.prototype.request = function(method, _url, data, userCredentials, expectedCode) { ProjectionsClient.prototype.request = function(method, _url, data, userCredentials, expectedCode) {

View File

@ -202,11 +202,13 @@ ProjectionsManager.prototype.updateQuery = function(name, query, userCredentials
* Updates the definition of a query. * Updates the definition of a query.
* @param name The name of the projection. * @param name The name of the projection.
* @param deleteEmittedStreams Whether to delete the streams that were emitted by this 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. * @param userCredentials Credentials for a user with permission to delete a projection.
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
ProjectionsManager.prototype.delete = function(name, deleteEmittedStreams, userCredentials) { ProjectionsManager.prototype.delete = function(name, deleteEmittedStreams, deleteStateStream, deleteCheckpointStream, userCredentials) {
return this._client.delete(this._httpEndPoint, name, deleteEmittedStreams, userCredentials); return this._client.delete(this._httpEndPoint, name, deleteEmittedStreams, deleteStateStream, deleteCheckpointStream, userCredentials);
}; };
module.exports = ProjectionsManager; module.exports = ProjectionsManager;