var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.channelExists = void 0;
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
var _SqliteClient = require("../SqliteClient");
var channelExists = exports.channelExists = function () {
  var _ref2 = (0, _asyncToGenerator2["default"])(_regenerator["default"].mark(function _callee(_ref) {
    var cid, channels;
    return _regenerator["default"].wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          cid = _ref.cid;
          _context.next = 3;
          return _SqliteClient.SqliteClient.executeSql('SELECT EXISTS(SELECT 1 FROM channels WHERE cid = ?)', [cid]);
        case 3:
          channels = _context.sent;
          _SqliteClient.SqliteClient.logger == null || _SqliteClient.SqliteClient.logger('info', 'channelExists', {
            cid: cid
          });
          return _context.abrupt("return", channels.length > 0);
        case 6:
        case "end":
          return _context.stop();
      }
    }, _callee);
  }));
  return function channelExists(_x) {
    return _ref2.apply(this, arguments);
  };
}();
//# sourceMappingURL=channelExists.js.map