UNPKG

@configurator/ravendb

Version:
41 lines 1.52 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.QueryStreamCommand = void 0; const RavenCommand_1 = require("../../Http/RavenCommand"); const IndexQuery_1 = require("../Queries/IndexQuery"); const Exceptions_1 = require("../../Exceptions"); class QueryStreamCommand extends RavenCommand_1.RavenCommand { constructor(conventions, query) { super(); if (!conventions) { (0, Exceptions_1.throwError)("InvalidArgumentException", "Conventions cannot be null."); } if (!query) { (0, Exceptions_1.throwError)("InvalidArgumentException", "Query cannot be null."); } this._conventions = conventions; this._indexQuery = query; this._responseType = "Empty"; } createRequest(node) { const format = this._conventions.useJsonlStreaming ? 'jsonl' : 'json'; return { method: "POST", uri: `${node.url}/databases/${node.database}/streams/queries?format=${format}`, body: (0, IndexQuery_1.writeIndexQuery)(this._conventions, this._indexQuery), headers: this._headers().typeAppJson().build() }; } async processResponse(cache, response, bodyStream, url) { this.result = { response, stream: bodyStream }; return "Manually"; } get isReadRequest() { return true; } } exports.QueryStreamCommand = QueryStreamCommand; //# sourceMappingURL=QueryStreamCommand.js.map