ravendb
Version:
RavenDB client for Node.js
65 lines • 2.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetIndexesCommand = exports.GetIndexesOperation = void 0;
const RavenCommand_js_1 = require("../../../Http/RavenCommand.js");
const IndexDefinition_js_1 = require("../../Indexes/IndexDefinition.js");
const ObjectUtil_js_1 = require("../../../Utility/ObjectUtil.js");
class GetIndexesOperation {
_start;
_pageSize;
constructor(start, pageSize) {
this._start = start;
this._pageSize = pageSize;
}
getCommand(conventions) {
return new GetIndexesCommand(this._start, this._pageSize, conventions);
}
get resultType() {
return "CommandResult";
}
}
exports.GetIndexesOperation = GetIndexesOperation;
const indexDefTypeInfo = {
nestedTypes: {
"results[]": "IndexDefinition",
"results[].maps": "Set"
},
};
const knownTypes = new Map([[IndexDefinition_js_1.IndexDefinition.name, IndexDefinition_js_1.IndexDefinition]]);
class GetIndexesCommand extends RavenCommand_js_1.RavenCommand {
_start;
_pageSize;
_conventions;
constructor(start, pageSize, conventions) {
super();
this._start = start;
this._pageSize = pageSize;
this._conventions = conventions;
}
createRequest(node) {
const uri = node.url + "/databases/" + node.database
+ "/indexes?start=" + this._start + "&pageSize=" + this._pageSize;
return { uri };
}
async setResponseAsync(bodyStream, fromCache) {
if (!bodyStream) {
this._throwInvalidResponse();
}
let body = null;
const result = await this._pipeline()
.collectBody(b => body = b)
.parseJsonSync()
.objectKeysTransform({
defaultTransform: ObjectUtil_js_1.ObjectUtil.camel,
ignorePaths: [/fields\.[^.]+$/i, /results\.\[]\.configuration\./i]
})
.process(bodyStream);
this.result = this._reviveResultTypes(result, this._conventions, indexDefTypeInfo, knownTypes)["results"];
return body;
}
get isReadRequest() {
return true;
}
}
exports.GetIndexesCommand = GetIndexesCommand;
//# sourceMappingURL=GetIndexesOperation.js.map