ravendb
Version:
RavenDB client for Node.js
48 lines • 1.6 kB
JavaScript
import { throwError } from "../../../Exceptions/index.js";
import { RavenCommand } from "../../../Http/RavenCommand.js";
export class TimeSeriesBatchOperation {
_documentId;
_operation;
get resultType() {
return "CommandResult";
}
constructor(documentId, operation) {
if (!documentId) {
throwError("InvalidArgumentException", "Document id cannot be null");
}
if (!operation) {
throwError("InvalidArgumentException", "Operation cannot be null");
}
this._documentId = documentId;
this._operation = operation;
}
getCommand(store, conventions, httpCache) {
return new TimeSeriesBatchCommand(this._documentId, this._operation, conventions);
}
}
class TimeSeriesBatchCommand extends RavenCommand {
_documentId;
_operation;
_conventions;
constructor(documentId, operation, conventions) {
super();
this._documentId = documentId;
this._operation = operation;
this._conventions = conventions;
}
createRequest(node) {
const uri = node.url + "/databases/" + node.database + "/timeseries?docId=" + this._urlEncode(this._documentId);
const payload = this._operation.serialize(this._conventions);
const body = this._serializer.serialize(payload);
return {
method: "POST",
uri,
body,
headers: this._headers().typeAppJson().build()
};
}
get isReadRequest() {
return false;
}
}
//# sourceMappingURL=TimeSeriesBatchOperation.js.map