ravendb
Version:
RavenDB client for Node.js
51 lines • 1.57 kB
JavaScript
import { RavenCommand } from "../../../Http/RavenCommand.js";
import { RaftIdGenerator } from "../../../Utility/RaftIdGenerator.js";
export class UpdateEtlOperation {
_taskId;
_configuration;
constructor(taskId, configuration) {
this._taskId = taskId;
this._configuration = configuration;
}
getCommand(conventions) {
return new UpdateEtlCommand(conventions, this._taskId, this._configuration);
}
get resultType() {
return "CommandResult";
}
}
class UpdateEtlCommand extends RavenCommand {
_conventions;
_taskId;
_configuration;
constructor(conventions, taskId, configuration) {
super();
this._conventions = conventions;
this._taskId = taskId;
this._configuration = configuration;
}
get isReadRequest() {
return false;
}
createRequest(node) {
const uri = node.url + "/databases/" + node.database + "/admin/etl?id=" + this._taskId;
const body = this._serializer.serialize(this._configuration.serialize(this._conventions));
const headers = this._headers().typeAppJson().build();
return {
uri,
method: "PUT",
headers,
body
};
}
async setResponseAsync(bodyStream, fromCache) {
if (!bodyStream) {
this._throwInvalidResponse();
}
return this._parseResponseDefaultAsync(bodyStream);
}
getRaftUniqueRequestId() {
return RaftIdGenerator.newId();
}
}
//# sourceMappingURL=UpdateEtlOperation.js.map