ravendb
Version:
RavenDB client for Node.js
38 lines • 1.26 kB
JavaScript
import { RavenCommand } from "../../Http/RavenCommand.js";
import { writeIndexQuery } from "../Queries/IndexQuery.js";
import { throwError } from "../../Exceptions/index.js";
export class QueryStreamCommand extends RavenCommand {
_conventions;
_indexQuery;
constructor(conventions, query) {
super();
if (!conventions) {
throwError("InvalidArgumentException", "Conventions cannot be null.");
}
if (!query) {
throwError("InvalidArgumentException", "Query cannot be null.");
}
this._conventions = conventions;
this._indexQuery = query;
this._responseType = "Empty";
}
createRequest(node) {
return {
method: "POST",
uri: `${node.url}/databases/${node.database}/streams/queries?format=jsonl`,
body: 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;
}
}
//# sourceMappingURL=QueryStreamCommand.js.map