ravendb
Version:
RavenDB client for Node.js
44 lines • 1.34 kB
JavaScript
import { RavenCommand } from "../../../Http/RavenCommand.js";
import { throwError } from "../../../Exceptions/index.js";
export class CounterBatchOperation {
get resultType() {
return "CommandResult";
}
_counterBatch;
constructor(counterBatch) {
this._counterBatch = counterBatch;
}
getCommand(store, conventions, cache) {
return new CounterBatchCommand(this._counterBatch);
}
}
export class CounterBatchCommand extends RavenCommand {
_counterBatch;
constructor(counterBatch) {
super();
if (!counterBatch) {
throwError("InvalidArgumentException", "CounterBatch cannot be null.");
}
this._counterBatch = counterBatch;
}
createRequest(node) {
const uri = node.url + "/databases/" + node.database + "/counters";
const body = JSON.stringify(this._counterBatch.serialize());
return {
method: "POST",
uri,
body,
headers: this._headers().typeAppJson().build()
};
}
async setResponseAsync(bodyStream, fromCache) {
if (!bodyStream) {
return;
}
return await this._parseResponseDefaultAsync(bodyStream);
}
get isReadRequest() {
return false;
}
}
//# sourceMappingURL=CounterBatchOperation.js.map