ravendb
Version:
RavenDB client for Node.js
43 lines • 1.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetConflictsCommand = void 0;
const RavenCommand_js_1 = require("../../Http/RavenCommand.js");
const DateUtil_js_1 = require("../../Utility/DateUtil.js");
class GetConflictsCommand extends RavenCommand_js_1.RavenCommand {
_id;
_conventions;
constructor(id, conventions) {
super();
this._id = id;
this._conventions = conventions;
}
get isReadRequest() {
return true;
}
createRequest(node) {
const uri = node.url + "/databases/" + node.database
+ "/replication/conflicts?docId=" + encodeURIComponent(this._id);
return {
method: "GET",
uri
};
}
async setResponseAsync(bodyStream, fromCache) {
if (!bodyStream) {
this._throwInvalidResponse();
}
let body = null;
const payload = await this._defaultPipeline(_ => body = _).process(bodyStream);
const { results, ...otherProps } = payload;
this.result = {
...otherProps,
results: results.map(r => ({
...r,
lastModified: DateUtil_js_1.DateUtil.utc.parse(r.lastModified)
}))
};
return body;
}
}
exports.GetConflictsCommand = GetConflictsCommand;
//# sourceMappingURL=GetConflictsCommand.js.map