UNPKG

stream-chat-react-native-core

Version:

The official React Native and Expo components for Stream Chat, a service for building chat applications

107 lines 4.78 kB
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.OfflineDB = void 0; var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); var _streamChat = require("stream-chat"); var api = _interopRequireWildcard(require("./apis")); var _SqliteClient = require("./SqliteClient"); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2.default)(o), (0, _possibleConstructorReturn2.default)(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2.default)(t).constructor) : o.apply(t, e)); } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); } var OfflineDB = exports.OfflineDB = function (_AbstractOfflineDB) { function OfflineDB({ client }) { var _this; (0, _classCallCheck2.default)(this, OfflineDB); _this = _callSuper(this, OfflineDB, [{ client }]); _this.upsertCidsForQuery = api.upsertCidsForQuery; _this.upsertChannels = api.upsertChannels; _this.upsertUserSyncStatus = ({ userId, lastSyncedAt, execute }) => api.upsertUserSyncStatus({ currentUserId: userId, execute, lastSyncedAt }); _this.upsertAppSettings = ({ appSettings, userId, execute }) => api.upsertAppSettings({ appSettings, currentUserId: userId, execute }); _this.upsertPoll = api.upsertPoll; _this.upsertDraft = api.upsertDraft; _this.getDraft = api.getDraft; _this.deleteDraft = api.deleteDraft; _this.upsertChannelData = api.upsertChannelData; _this.upsertReads = api.upsertReads; _this.upsertMessages = api.upsertMessages; _this.upsertMembers = api.upsertMembers; _this.updateMessage = api.updateMessage; _this.getChannels = ({ cids, userId }) => api.getChannels({ channelIds: cids, currentUserId: userId }); _this.getChannelsForQuery = ({ userId, filters, options, sort }) => api.getChannelsForFilterSort({ currentUserId: userId, filters, options, sort }); _this.getAllChannelCids = api.getAllChannelIds; _this.getLastSyncedAt = ({ userId }) => api.getLastSyncedAt({ currentUserId: userId }); _this.getAppSettings = ({ userId }) => api.getAppSettings({ currentUserId: userId }); _this.getReactions = api.getReactionsForFilterSort; _this.addPendingTask = api.addPendingTask; _this.updatePendingTask = api.updatePendingTask; _this.deletePendingTask = api.deletePendingTask; _this.deleteReaction = api.deleteReaction; _this.deleteMember = api.deleteMember; _this.deleteChannel = api.deleteChannel; _this.deleteMessagesForChannel = api.deleteMessagesForChannel; _this.dropPendingTasks = api.dropPendingTasks; _this.hardDeleteMessage = api.deleteMessage; _this.softDeleteMessage = api.softDeleteMessage; _this.getPendingTasks = api.getPendingTasks; _this.updateReaction = api.updateReaction; _this.insertReaction = api.insertReaction; _this.channelExists = api.channelExists; _this.resetDB = _SqliteClient.SqliteClient.resetDB; _this.executeSqlBatch = _SqliteClient.SqliteClient.executeSqlBatch; _this.initializeDB = _SqliteClient.SqliteClient.initializeDatabase; return _this; } (0, _inherits2.default)(OfflineDB, _AbstractOfflineDB); return (0, _createClass2.default)(OfflineDB); }(_streamChat.AbstractOfflineDB); //# sourceMappingURL=OfflineDB.js.map