ravendb
Version:
RavenDB client for Node.js
67 lines • 2.33 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetReplicationHubAccessOperation = void 0;
const RavenCommand_js_1 = require("../../../Http/RavenCommand.js");
const StringUtil_js_1 = require("../../../Utility/StringUtil.js");
const index_js_1 = require("../../../Exceptions/index.js");
class GetReplicationHubAccessOperation {
_hubName;
_start;
_pageSize;
constructor(hubName, start = 0, pageSize = 25) {
this._hubName = hubName;
this._start = start;
this._pageSize = pageSize;
}
getCommand(conventions) {
return new GetReplicationHubAccessCommand(conventions, this._hubName, this._start, this._pageSize);
}
get resultType() {
return "CommandResult";
}
}
exports.GetReplicationHubAccessOperation = GetReplicationHubAccessOperation;
class GetReplicationHubAccessCommand extends RavenCommand_js_1.RavenCommand {
_conventions;
_hubName;
_start;
_pageSize;
constructor(conventions, hubName, start, pageSize) {
super();
if (StringUtil_js_1.StringUtil.isNullOrWhitespace(hubName)) {
(0, index_js_1.throwError)("InvalidArgumentException", "Value cannot be null or whitespace.");
}
this._conventions = conventions;
this._hubName = hubName;
this._start = start;
this._pageSize = pageSize;
}
get isReadRequest() {
return true;
}
createRequest(node) {
const uri = node.url + "/databases/" + node.database
+ "/admin/tasks/pull-replication/hub/access?name=" + this._urlEncode(this._hubName)
+ "&start=" + this._start
+ "&pageSize=" + this._pageSize;
return {
uri,
method: "GET"
};
}
async setResponseAsync(bodyStream, fromCache) {
if (!bodyStream) {
return;
}
let body = null;
const rawResults = await this._defaultPipeline(_ => body = _).process(bodyStream);
this.result = this._conventions.objectMapper.fromObjectLiteral(rawResults, {
nestedTypes: {
"results[].notAfter": "date",
"results[].notBefore": "date"
}
}).results;
return body;
}
}
//# sourceMappingURL=GetReplicationHubAccessOperation.js.map