@requestnetwork/data-access
Version:
Main package for the Request Network data access layer.
48 lines • 1.86 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CombinedDataAccess = void 0;
const tslib_1 = require("tslib");
const no_persist_data_write_1 = require("./no-persist-data-write");
class CombinedDataAccess {
constructor(reader, writer) {
this.reader = reader;
this.writer = writer;
}
initialize() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
yield this.reader.initialize();
yield this.writer.initialize();
});
}
close() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
yield this.writer.close();
yield this.reader.close();
});
}
skipPersistence() {
return this.writer instanceof no_persist_data_write_1.NoPersistDataWrite;
}
getTransactionsByChannelId(channelId, updatedBetween) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return yield this.reader.getTransactionsByChannelId(channelId, updatedBetween);
});
}
getChannelsByTopic(topic, updatedBetween) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return yield this.reader.getChannelsByTopic(topic, updatedBetween);
});
}
getChannelsByMultipleTopics(topics, updatedBetween) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return yield this.reader.getChannelsByMultipleTopics(topics, updatedBetween);
});
}
persistTransaction(transactionData, channelId, topics) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
return yield this.writer.persistTransaction(transactionData, channelId, topics);
});
}
}
exports.CombinedDataAccess = CombinedDataAccess;
//# sourceMappingURL=combined-data-access.js.map