UNPKG

@configurator/ravendb

Version:
47 lines 1.57 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CounterBatchCommand = exports.CounterBatchOperation = void 0; const RavenCommand_1 = require("../../../Http/RavenCommand"); const Exceptions_1 = require("../../../Exceptions"); class CounterBatchOperation { get resultType() { return "CommandResult"; } constructor(counterBatch) { this._counterBatch = counterBatch; } getCommand(store, conventions, cache) { return new CounterBatchCommand(this._counterBatch); } } exports.CounterBatchOperation = CounterBatchOperation; class CounterBatchCommand extends RavenCommand_1.RavenCommand { constructor(counterBatch) { super(); if (!counterBatch) { (0, Exceptions_1.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; } } exports.CounterBatchCommand = CounterBatchCommand; //# sourceMappingURL=CounterBatchOperation.js.map