ravendb
Version:
RavenDB client for Node.js
43 lines • 1.27 kB
JavaScript
import { RaftIdGenerator } from "../../Utility/RaftIdGenerator.js";
import { RavenCommand } from "../../Http/RavenCommand.js";
export class UpdateSubscriptionCommand extends RavenCommand {
_options;
constructor(options) {
super();
this._options = options;
}
createRequest(node) {
const uri = node.url + "/databases/" + node.database + "/subscriptions/update";
const body = this._serializer.serialize(this._options);
return {
uri,
body,
headers: this._headers().typeAppJson().build(),
method: "POST"
};
}
async setResponseFromCache(cachedValue) {
this.result = {
name: this._options.name
};
}
async setResponseAsync(bodyStream, fromCache) {
if (fromCache) {
this.result = {
name: this._options.name
};
return;
}
if (!bodyStream) {
this._throwInvalidResponse();
}
return this._parseResponseDefaultAsync(bodyStream);
}
get isReadRequest() {
return false;
}
getRaftUniqueRequestId() {
return RaftIdGenerator.newId();
}
}
//# sourceMappingURL=UpdateSubscriptionCommand.js.map