stream-chat-react-native-core 5.26.0-beta.6 → 5.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/i18n/es.json +40 -40
- package/lib/commonjs/i18n/fr.json +40 -40
- package/lib/commonjs/i18n/he.json +40 -40
- package/lib/commonjs/i18n/hi.json +40 -40
- package/lib/commonjs/i18n/it.json +40 -40
- package/lib/commonjs/i18n/ja.json +40 -40
- package/lib/commonjs/i18n/ko.json +40 -40
- package/lib/commonjs/i18n/nl.json +40 -40
- package/lib/commonjs/i18n/pt-BR.json +40 -40
- package/lib/commonjs/i18n/ru.json +40 -40
- package/lib/commonjs/i18n/tr.json +40 -40
- package/lib/commonjs/store/QuickSqliteClient.js +37 -2
- package/lib/commonjs/store/QuickSqliteClient.js.map +1 -1
- package/lib/commonjs/store/apis/addPendingTask.js +16 -4
- package/lib/commonjs/store/apis/addPendingTask.js.map +1 -1
- package/lib/commonjs/store/apis/deleteChannel.js +4 -0
- package/lib/commonjs/store/apis/deleteChannel.js.map +1 -1
- package/lib/commonjs/store/apis/deleteMember.js +5 -0
- package/lib/commonjs/store/apis/deleteMember.js.map +1 -1
- package/lib/commonjs/store/apis/deleteMessage.js +4 -0
- package/lib/commonjs/store/apis/deleteMessage.js.map +1 -1
- package/lib/commonjs/store/apis/deleteMessagesForChannel.js +4 -0
- package/lib/commonjs/store/apis/deleteMessagesForChannel.js.map +1 -1
- package/lib/commonjs/store/apis/deletePendingTask.js +3 -0
- package/lib/commonjs/store/apis/deletePendingTask.js.map +1 -1
- package/lib/commonjs/store/apis/deleteReaction.js +5 -0
- package/lib/commonjs/store/apis/deleteReaction.js.map +1 -1
- package/lib/commonjs/store/apis/deleteReactions.js +5 -3
- package/lib/commonjs/store/apis/deleteReactions.js.map +1 -1
- package/lib/commonjs/store/apis/getAllChannelIds.js +2 -0
- package/lib/commonjs/store/apis/getAllChannelIds.js.map +1 -1
- package/lib/commonjs/store/apis/getAppSettings.js +3 -0
- package/lib/commonjs/store/apis/getAppSettings.js.map +1 -1
- package/lib/commonjs/store/apis/getChannelMessages.js +5 -0
- package/lib/commonjs/store/apis/getChannelMessages.js.map +1 -1
- package/lib/commonjs/store/apis/getChannels.js +5 -0
- package/lib/commonjs/store/apis/getChannels.js.map +1 -1
- package/lib/commonjs/store/apis/getChannelsForFilterSort.js +5 -0
- package/lib/commonjs/store/apis/getChannelsForFilterSort.js.map +1 -1
- package/lib/commonjs/store/apis/getLastSyncedAt.js +3 -0
- package/lib/commonjs/store/apis/getLastSyncedAt.js.map +1 -1
- package/lib/commonjs/store/apis/getMembers.js +4 -0
- package/lib/commonjs/store/apis/getMembers.js.map +1 -1
- package/lib/commonjs/store/apis/getPendingTasks.js +3 -0
- package/lib/commonjs/store/apis/getPendingTasks.js.map +1 -1
- package/lib/commonjs/store/apis/getReads.js +4 -0
- package/lib/commonjs/store/apis/getReads.js.map +1 -1
- package/lib/commonjs/store/apis/insertReaction.js +6 -1
- package/lib/commonjs/store/apis/insertReaction.js.map +1 -1
- package/lib/commonjs/store/apis/queries/selectChannelIdsForFilterSort.js +3 -0
- package/lib/commonjs/store/apis/queries/selectChannelIdsForFilterSort.js.map +1 -1
- package/lib/commonjs/store/apis/queries/selectChannels.js +3 -0
- package/lib/commonjs/store/apis/queries/selectChannels.js.map +1 -1
- package/lib/commonjs/store/apis/queries/selectMembersForChannels.js +3 -0
- package/lib/commonjs/store/apis/queries/selectMembersForChannels.js.map +1 -1
- package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js +3 -0
- package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js.map +1 -1
- package/lib/commonjs/store/apis/queries/selectReactionsForMessages.js +3 -0
- package/lib/commonjs/store/apis/queries/selectReactionsForMessages.js.map +1 -1
- package/lib/commonjs/store/apis/queries/selectReadsForChannels.js +3 -0
- package/lib/commonjs/store/apis/queries/selectReadsForChannels.js.map +1 -1
- package/lib/commonjs/store/apis/updateMessage.js +18 -4
- package/lib/commonjs/store/apis/updateMessage.js.map +1 -1
- package/lib/commonjs/store/apis/updateReaction.js +12 -1
- package/lib/commonjs/store/apis/updateReaction.js.map +1 -1
- package/lib/commonjs/store/apis/upsertAppSettings.js +7 -1
- package/lib/commonjs/store/apis/upsertAppSettings.js.map +1 -1
- package/lib/commonjs/store/apis/upsertChannelData.js +6 -1
- package/lib/commonjs/store/apis/upsertChannelData.js.map +1 -1
- package/lib/commonjs/store/apis/upsertChannels.js +6 -3
- package/lib/commonjs/store/apis/upsertChannels.js.map +1 -1
- package/lib/commonjs/store/apis/upsertCidsForQuery.js +12 -5
- package/lib/commonjs/store/apis/upsertCidsForQuery.js.map +1 -1
- package/lib/commonjs/store/apis/upsertMembers.js +15 -3
- package/lib/commonjs/store/apis/upsertMembers.js.map +1 -1
- package/lib/commonjs/store/apis/upsertMessages.js +20 -8
- package/lib/commonjs/store/apis/upsertMessages.js.map +1 -1
- package/lib/commonjs/store/apis/upsertReads.js +18 -3
- package/lib/commonjs/store/apis/upsertReads.js.map +1 -1
- package/lib/commonjs/store/apis/upsertUserSyncStatus.js +4 -0
- package/lib/commonjs/store/apis/upsertUserSyncStatus.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/i18n/es.json +40 -40
- package/lib/module/i18n/fr.json +40 -40
- package/lib/module/i18n/he.json +40 -40
- package/lib/module/i18n/hi.json +40 -40
- package/lib/module/i18n/it.json +40 -40
- package/lib/module/i18n/ja.json +40 -40
- package/lib/module/i18n/ko.json +40 -40
- package/lib/module/i18n/nl.json +40 -40
- package/lib/module/i18n/pt-BR.json +40 -40
- package/lib/module/i18n/ru.json +40 -40
- package/lib/module/i18n/tr.json +40 -40
- package/lib/module/store/QuickSqliteClient.js +37 -2
- package/lib/module/store/QuickSqliteClient.js.map +1 -1
- package/lib/module/store/apis/addPendingTask.js +16 -4
- package/lib/module/store/apis/addPendingTask.js.map +1 -1
- package/lib/module/store/apis/deleteChannel.js +4 -0
- package/lib/module/store/apis/deleteChannel.js.map +1 -1
- package/lib/module/store/apis/deleteMember.js +5 -0
- package/lib/module/store/apis/deleteMember.js.map +1 -1
- package/lib/module/store/apis/deleteMessage.js +4 -0
- package/lib/module/store/apis/deleteMessage.js.map +1 -1
- package/lib/module/store/apis/deleteMessagesForChannel.js +4 -0
- package/lib/module/store/apis/deleteMessagesForChannel.js.map +1 -1
- package/lib/module/store/apis/deletePendingTask.js +3 -0
- package/lib/module/store/apis/deletePendingTask.js.map +1 -1
- package/lib/module/store/apis/deleteReaction.js +5 -0
- package/lib/module/store/apis/deleteReaction.js.map +1 -1
- package/lib/module/store/apis/deleteReactions.js +5 -3
- package/lib/module/store/apis/deleteReactions.js.map +1 -1
- package/lib/module/store/apis/getAllChannelIds.js +2 -0
- package/lib/module/store/apis/getAllChannelIds.js.map +1 -1
- package/lib/module/store/apis/getAppSettings.js +3 -0
- package/lib/module/store/apis/getAppSettings.js.map +1 -1
- package/lib/module/store/apis/getChannelMessages.js +5 -0
- package/lib/module/store/apis/getChannelMessages.js.map +1 -1
- package/lib/module/store/apis/getChannels.js +5 -0
- package/lib/module/store/apis/getChannels.js.map +1 -1
- package/lib/module/store/apis/getChannelsForFilterSort.js +5 -0
- package/lib/module/store/apis/getChannelsForFilterSort.js.map +1 -1
- package/lib/module/store/apis/getLastSyncedAt.js +3 -0
- package/lib/module/store/apis/getLastSyncedAt.js.map +1 -1
- package/lib/module/store/apis/getMembers.js +4 -0
- package/lib/module/store/apis/getMembers.js.map +1 -1
- package/lib/module/store/apis/getPendingTasks.js +3 -0
- package/lib/module/store/apis/getPendingTasks.js.map +1 -1
- package/lib/module/store/apis/getReads.js +4 -0
- package/lib/module/store/apis/getReads.js.map +1 -1
- package/lib/module/store/apis/insertReaction.js +6 -1
- package/lib/module/store/apis/insertReaction.js.map +1 -1
- package/lib/module/store/apis/queries/selectChannelIdsForFilterSort.js +3 -0
- package/lib/module/store/apis/queries/selectChannelIdsForFilterSort.js.map +1 -1
- package/lib/module/store/apis/queries/selectChannels.js +3 -0
- package/lib/module/store/apis/queries/selectChannels.js.map +1 -1
- package/lib/module/store/apis/queries/selectMembersForChannels.js +3 -0
- package/lib/module/store/apis/queries/selectMembersForChannels.js.map +1 -1
- package/lib/module/store/apis/queries/selectMessagesForChannels.js +3 -0
- package/lib/module/store/apis/queries/selectMessagesForChannels.js.map +1 -1
- package/lib/module/store/apis/queries/selectReactionsForMessages.js +3 -0
- package/lib/module/store/apis/queries/selectReactionsForMessages.js.map +1 -1
- package/lib/module/store/apis/queries/selectReadsForChannels.js +3 -0
- package/lib/module/store/apis/queries/selectReadsForChannels.js.map +1 -1
- package/lib/module/store/apis/updateMessage.js +18 -4
- package/lib/module/store/apis/updateMessage.js.map +1 -1
- package/lib/module/store/apis/updateReaction.js +12 -1
- package/lib/module/store/apis/updateReaction.js.map +1 -1
- package/lib/module/store/apis/upsertAppSettings.js +7 -1
- package/lib/module/store/apis/upsertAppSettings.js.map +1 -1
- package/lib/module/store/apis/upsertChannelData.js +6 -1
- package/lib/module/store/apis/upsertChannelData.js.map +1 -1
- package/lib/module/store/apis/upsertChannels.js +6 -3
- package/lib/module/store/apis/upsertChannels.js.map +1 -1
- package/lib/module/store/apis/upsertCidsForQuery.js +12 -5
- package/lib/module/store/apis/upsertCidsForQuery.js.map +1 -1
- package/lib/module/store/apis/upsertMembers.js +15 -3
- package/lib/module/store/apis/upsertMembers.js.map +1 -1
- package/lib/module/store/apis/upsertMessages.js +20 -8
- package/lib/module/store/apis/upsertMessages.js.map +1 -1
- package/lib/module/store/apis/upsertReads.js +18 -3
- package/lib/module/store/apis/upsertReads.js.map +1 -1
- package/lib/module/store/apis/upsertUserSyncStatus.js +4 -0
- package/lib/module/store/apis/upsertUserSyncStatus.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +1 -1
- package/lib/typescript/i18n/es.json +40 -40
- package/lib/typescript/i18n/fr.json +40 -40
- package/lib/typescript/i18n/he.json +40 -40
- package/lib/typescript/i18n/hi.json +40 -40
- package/lib/typescript/i18n/it.json +40 -40
- package/lib/typescript/i18n/ja.json +40 -40
- package/lib/typescript/i18n/ko.json +40 -40
- package/lib/typescript/i18n/nl.json +40 -40
- package/lib/typescript/i18n/pt-BR.json +40 -40
- package/lib/typescript/i18n/ru.json +40 -40
- package/lib/typescript/i18n/tr.json +40 -40
- package/lib/typescript/store/QuickSqliteClient.d.ts +2 -0
- package/lib/typescript/store/apis/upsertMessages.d.ts +1 -2
- package/package.json +1 -1
- package/src/i18n/es.json +40 -40
- package/src/i18n/fr.json +40 -40
- package/src/i18n/he.json +40 -40
- package/src/i18n/hi.json +40 -40
- package/src/i18n/it.json +40 -40
- package/src/i18n/ja.json +40 -40
- package/src/i18n/ko.json +40 -40
- package/src/i18n/nl.json +40 -40
- package/src/i18n/pt-BR.json +40 -40
- package/src/i18n/ru.json +40 -40
- package/src/i18n/tr.json +40 -40
- package/src/store/QuickSqliteClient.ts +40 -3
- package/src/store/apis/addPendingTask.ts +20 -1
- package/src/store/apis/deleteChannel.ts +5 -0
- package/src/store/apis/deleteMember.ts +6 -0
- package/src/store/apis/deleteMessage.ts +6 -0
- package/src/store/apis/deleteMessagesForChannel.ts +6 -0
- package/src/store/apis/deletePendingTask.ts +4 -0
- package/src/store/apis/deleteReaction.ts +6 -0
- package/src/store/apis/deleteReactions.ts +5 -6
- package/src/store/apis/getAllChannelIds.ts +3 -0
- package/src/store/apis/getAppSettings.ts +3 -0
- package/src/store/apis/getChannelMessages.ts +5 -0
- package/src/store/apis/getChannels.ts +2 -0
- package/src/store/apis/getChannelsForFilterSort.ts +4 -0
- package/src/store/apis/getLastSyncedAt.ts +1 -0
- package/src/store/apis/getMembers.ts +2 -0
- package/src/store/apis/getPendingTasks.ts +1 -0
- package/src/store/apis/getReads.ts +2 -0
- package/src/store/apis/insertReaction.ts +8 -1
- package/src/store/apis/queries/selectChannelIdsForFilterSort.ts +5 -0
- package/src/store/apis/queries/selectChannels.ts +4 -0
- package/src/store/apis/queries/selectMembersForChannels.ts +4 -0
- package/src/store/apis/queries/selectMessagesForChannels.ts +4 -0
- package/src/store/apis/queries/selectReactionsForMessages.ts +4 -0
- package/src/store/apis/queries/selectReadsForChannels.ts +5 -0
- package/src/store/apis/updateMessage.ts +22 -4
- package/src/store/apis/updateReaction.ts +15 -1
- package/src/store/apis/upsertAppSettings.ts +8 -1
- package/src/store/apis/upsertChannelData.ts +6 -1
- package/src/store/apis/upsertChannels.ts +6 -1
- package/src/store/apis/upsertCidsForQuery.ts +10 -2
- package/src/store/apis/upsertMembers.ts +16 -10
- package/src/store/apis/upsertMessages.ts +21 -11
- package/src/store/apis/upsertReads.ts +13 -10
- package/src/store/apis/upsertUserSyncStatus.ts +5 -0
- package/src/version.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_constants","require","_schema","_createCreateTableQuery","sqlite","QuickSQLite","e","isRemoteDebuggerError","Error","message","includes","QuickSqliteClient","_createClass2","_classCallCheck2","exports","dbVersion","dbName","DB_NAME","dbLocation","DB_LOCATION","getDbVersion","setDbVersion","version","openDB","open","execute","console","error","closeDB","close","executeSqlBatch","queries","length","executeBatch","executeSql","query","params","_sqlite$execute","rows","_array","dropTables","Object","keys","tables","map","table","deleteDatabase","initializeDatabase","undefined","getUserPragmaVersion","updateUserPragmaVersion","q","reduce","queriesSoFar","tableName","push","apply","_toConsumableArray2","createCreateTableQuery","_sqlite$execute2","result","user_version","resetDB"],"sources":["QuickSqliteClient.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport type { QuickSQLite } from 'react-native-quick-sqlite';\nlet sqlite: typeof QuickSQLite;\n\ntry {\n sqlite = require('react-native-quick-sqlite').QuickSQLite;\n} catch (e) {\n // We want to throw the original error when remote debugger (e.g. Chrome) is enabled.\n // QuickSQLite can only be used when synchronous method invocations (JSI) are possible.\n // e.g on-device debugger (e.g. Flipper).\n const isRemoteDebuggerError = e instanceof Error && e.message.includes('Failed to install');\n if (isRemoteDebuggerError) {\n throw e;\n }\n // Reaching here will mean that QuickSQLite is not installed for one of the reasons\n // 1. Running on regular expo, where we don't support offline storage yet.\n // 2. Offline support is disabled, in which case this library is not installed.\n}\n\nimport { DB_LOCATION, DB_NAME } from './constants';\nimport { tables } from './schema';\nimport { createCreateTableQuery } from './sqlite-utils/createCreateTableQuery';\nimport type { PreparedQueries, Table } from './types';\n\n/**\n * QuickSqliteClient takes care of any direct interaction with sqlite.\n * This way usage react-native-quick-sqlite package is scoped to a single class/file.\n *\n */\nexport class QuickSqliteClient {\n static dbVersion = 3;\n\n static dbName = DB_NAME;\n static dbLocation = DB_LOCATION;\n\n static getDbVersion = () => QuickSqliteClient.dbVersion;\n // Force a specific db version. This is mainly useful for testsuit.\n static setDbVersion = (version: number) => (QuickSqliteClient.dbVersion = version);\n\n static openDB = () => {\n try {\n sqlite.open(QuickSqliteClient.dbName, QuickSqliteClient.dbLocation);\n sqlite.execute(QuickSqliteClient.dbName, `PRAGMA foreign_keys = ON`, []);\n } catch (e) {\n console.error(`Error opening database ${QuickSqliteClient.dbName}: ${e}`);\n }\n };\n\n static closeDB = () => {\n try {\n sqlite.close(QuickSqliteClient.dbName);\n } catch (e) {\n console.error(`Error closing database ${QuickSqliteClient.dbName}: ${e}`);\n }\n };\n\n static executeSqlBatch = (queries: PreparedQueries[]) => {\n if (!queries || !queries.length) return;\n\n QuickSqliteClient.openDB();\n try {\n sqlite.executeBatch(DB_NAME, queries);\n\n QuickSqliteClient.closeDB();\n } catch (e) {\n QuickSqliteClient.closeDB();\n throw new Error(`Query/queries failed: ${e}`);\n }\n };\n\n static executeSql = (query: string, params?: string[]) => {\n try {\n QuickSqliteClient.openDB();\n const { rows } = sqlite.execute(DB_NAME, query, params);\n QuickSqliteClient.closeDB();\n\n return rows ? rows._array : [];\n } catch (e) {\n QuickSqliteClient.closeDB();\n throw new Error(`Query/queries failed: ${e}: `);\n }\n };\n\n static dropTables = () => {\n const queries: PreparedQueries[] = Object.keys(tables).map((table) => [\n `DROP TABLE IF EXISTS ${table}`,\n [],\n ]);\n\n QuickSqliteClient.executeSqlBatch(queries);\n };\n\n static deleteDatabase = () => {\n try {\n sqlite.delete(QuickSqliteClient.dbName, QuickSqliteClient.dbLocation);\n } catch (e) {\n throw new Error(`Error deleting DB: ${e}`);\n }\n\n return true;\n };\n\n static initializeDatabase = () => {\n if (sqlite === undefined) {\n throw new Error(\n 'Please install \"react-native-quick-sqlite\" package to enable offline support',\n );\n }\n\n const version = QuickSqliteClient.getUserPragmaVersion();\n\n if (version !== QuickSqliteClient.dbVersion) {\n QuickSqliteClient.dropTables();\n QuickSqliteClient.updateUserPragmaVersion(QuickSqliteClient.dbVersion);\n }\n const q = (Object.keys(tables) as Table[]).reduce<PreparedQueries[]>(\n (queriesSoFar, tableName) => {\n queriesSoFar.push(...createCreateTableQuery(tableName));\n return queriesSoFar;\n },\n [],\n );\n\n QuickSqliteClient.executeSqlBatch(q);\n };\n\n static updateUserPragmaVersion = (version: number) => {\n QuickSqliteClient.openDB();\n sqlite.execute(DB_NAME, `PRAGMA user_version = ${version}`, []);\n QuickSqliteClient.closeDB();\n };\n\n static getUserPragmaVersion = () => {\n QuickSqliteClient.openDB();\n try {\n const { rows } = sqlite.execute(DB_NAME, `PRAGMA user_version`, []);\n const result = rows ? rows._array : [];\n QuickSqliteClient.closeDB();\n return result[0].user_version as number;\n } catch (e) {\n QuickSqliteClient.closeDB();\n throw new Error(`Querying for user_version failed: ${e}`);\n }\n };\n\n static resetDB = () => {\n QuickSqliteClient.dropTables();\n QuickSqliteClient.initializeDatabase();\n };\n}\n"],"mappings":";;;;;;;;AAmBA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,uBAAA,GAAAF,OAAA;AAnBA,IAAIG,MAA0B;AAE9B,IAAI;EACFA,MAAM,GAAGH,OAAO,CAAC,2BAA2B,CAAC,CAACI,WAAW;AAC3D,CAAC,CAAC,OAAOC,CAAC,EA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CAAC;EAC1B,IAAI;IACF,IAAAoC,gBAAA,GAAiBvD,MAAM,CAACqB,OAAO,CAACR,kBAAO,yBAAyB,EAAE,CAAC;MAA3DqB,IAAI,GAAAqB,gBAAA,CAAJrB,IAAI;IACZ,IAAMsB,MAAM,GAAGtB,IAAI,GAAGA,IAAI,CAACC,MAAM,GAAG,EAAE;IACtC5B,iBAAiB,CAACiB,OAAO,CAAC,CAAC;IAC3B,OAAOgC,MAAM,CAAC,CAAC,CAAC,CAACC,YAAY;EAC/B,CAAC,CAAC,OAAOvD,CAAC,EAAE;IACVK,iBAAiB,CAACiB,OAAO,CAAC,CAAC;IAC3B,MAAM,IAAIpB,KAAK,wCAAsCF,CAAG,CAAC;EAC3D;AACF,CAAC;AAlHUK,iBAAiB,CAoHrBmD,OAAO,GAAG,YAAM;EACrBnD,iBAAiB,CAAC6B,UAAU,CAAC,CAAC;EAC9B7B,iBAAiB,CAACoC,kBAAkB,CAAC,CAAC;AACxC,CAAC"}
|
|
1
|
+
{"version":3,"names":["_constants","require","_schema","_createCreateTableQuery","sqlite","QuickSQLite","e","isRemoteDebuggerError","Error","message","includes","QuickSqliteClient","_createClass2","_classCallCheck2","exports","dbVersion","dbName","DB_NAME","dbLocation","DB_LOCATION","getDbVersion","setDbVersion","version","openDB","open","execute","logger","error","console","closeDB","close","executeSqlBatch","queries","length","executeBatch","executeSql","query","params","_sqlite$execute","rows","_array","dropTables","Object","keys","tables","map","table","deleteDatabase","dbname","initializeDatabase","undefined","getUserPragmaVersion","updateUserPragmaVersion","q","reduce","queriesSoFar","tableName","push","apply","_toConsumableArray2","createCreateTableQuery","_sqlite$execute2","result","user_version","resetDB"],"sources":["QuickSqliteClient.ts"],"sourcesContent":["/* eslint-disable no-underscore-dangle */\nimport type { QuickSQLite } from 'react-native-quick-sqlite';\nlet sqlite: typeof QuickSQLite;\n\ntry {\n sqlite = require('react-native-quick-sqlite').QuickSQLite;\n} catch (e) {\n // We want to throw the original error when remote debugger (e.g. Chrome) is enabled.\n // QuickSQLite can only be used when synchronous method invocations (JSI) are possible.\n // e.g on-device debugger (e.g. Flipper).\n const isRemoteDebuggerError = e instanceof Error && e.message.includes('Failed to install');\n if (isRemoteDebuggerError) {\n throw e;\n }\n // Reaching here will mean that QuickSQLite is not installed for one of the reasons\n // 1. Running on regular expo, where we don't support offline storage yet.\n // 2. Offline support is disabled, in which case this library is not installed.\n}\n\nimport { Logger } from 'stream-chat';\n\nimport { DB_LOCATION, DB_NAME } from './constants';\nimport { tables } from './schema';\nimport { createCreateTableQuery } from './sqlite-utils/createCreateTableQuery';\nimport type { PreparedQueries, Table } from './types';\n\n/**\n * QuickSqliteClient takes care of any direct interaction with sqlite.\n * This way usage react-native-quick-sqlite package is scoped to a single class/file.\n *\n */\nexport class QuickSqliteClient {\n static dbVersion = 3;\n\n static dbName = DB_NAME;\n static dbLocation = DB_LOCATION;\n static logger: Logger | undefined;\n\n static getDbVersion = () => QuickSqliteClient.dbVersion;\n // Force a specific db version. This is mainly useful for testsuit.\n static setDbVersion = (version: number) => (QuickSqliteClient.dbVersion = version);\n\n static openDB = () => {\n try {\n sqlite.open(QuickSqliteClient.dbName, QuickSqliteClient.dbLocation);\n sqlite.execute(QuickSqliteClient.dbName, `PRAGMA foreign_keys = ON`, []);\n } catch (e) {\n this.logger?.('error', `Error opening database ${QuickSqliteClient.dbName}`, {\n error: e,\n });\n console.error(`Error opening database ${QuickSqliteClient.dbName}: ${e}`);\n }\n };\n\n static closeDB = () => {\n try {\n sqlite.close(QuickSqliteClient.dbName);\n } catch (e) {\n this.logger?.('error', `Error closing database ${QuickSqliteClient.dbName}`, {\n error: e,\n });\n console.error(`Error closing database ${QuickSqliteClient.dbName}: ${e}`);\n }\n };\n\n static executeSqlBatch = (queries: PreparedQueries[]) => {\n if (!queries || !queries.length) return;\n\n QuickSqliteClient.openDB();\n try {\n sqlite.executeBatch(DB_NAME, queries);\n\n QuickSqliteClient.closeDB();\n } catch (e) {\n QuickSqliteClient.closeDB();\n this.logger?.('error', `SqlBatch queries failed`, {\n error: e,\n queries,\n });\n throw new Error(`Queries failed: ${e}`);\n }\n };\n\n static executeSql = (query: string, params?: string[]) => {\n try {\n QuickSqliteClient.openDB();\n const { rows } = sqlite.execute(DB_NAME, query, params);\n QuickSqliteClient.closeDB();\n\n return rows ? rows._array : [];\n } catch (e) {\n QuickSqliteClient.closeDB();\n this.logger?.('error', `Sql single query failed`, {\n error: e,\n query,\n });\n throw new Error(`Query failed: ${e}: `);\n }\n };\n\n static dropTables = () => {\n const queries: PreparedQueries[] = Object.keys(tables).map((table) => [\n `DROP TABLE IF EXISTS ${table}`,\n [],\n ]);\n this.logger?.('info', `Dropping tables`, {\n tables: Object.keys(tables),\n });\n QuickSqliteClient.executeSqlBatch(queries);\n };\n\n static deleteDatabase = () => {\n this.logger?.('info', `deleteDatabase`, {\n dbLocation: QuickSqliteClient.dbLocation,\n dbname: QuickSqliteClient.dbName,\n });\n try {\n sqlite.delete(QuickSqliteClient.dbName, QuickSqliteClient.dbLocation);\n } catch (e) {\n this.logger?.('error', `Error deleting DB`, {\n dbLocation: QuickSqliteClient.dbLocation,\n dbname: QuickSqliteClient.dbName,\n error: e,\n });\n throw new Error(`Error deleting DB: ${e}`);\n }\n\n return true;\n };\n\n static initializeDatabase = () => {\n if (sqlite === undefined) {\n throw new Error(\n 'Please install \"react-native-quick-sqlite\" package to enable offline support',\n );\n }\n\n const version = QuickSqliteClient.getUserPragmaVersion();\n\n if (version !== QuickSqliteClient.dbVersion) {\n QuickSqliteClient.logger?.('info', `DB version mismatch`);\n QuickSqliteClient.dropTables();\n QuickSqliteClient.updateUserPragmaVersion(QuickSqliteClient.dbVersion);\n }\n QuickSqliteClient.logger?.('info', `create tables if not exists`, {\n tables: Object.keys(tables),\n });\n const q = (Object.keys(tables) as Table[]).reduce<PreparedQueries[]>(\n (queriesSoFar, tableName) => {\n queriesSoFar.push(...createCreateTableQuery(tableName));\n return queriesSoFar;\n },\n [],\n );\n\n QuickSqliteClient.executeSqlBatch(q);\n };\n\n static updateUserPragmaVersion = (version: number) => {\n QuickSqliteClient.logger?.('info', `updateUserPragmaVersion to ${version}`);\n QuickSqliteClient.openDB();\n sqlite.execute(DB_NAME, `PRAGMA user_version = ${version}`, []);\n QuickSqliteClient.closeDB();\n };\n\n static getUserPragmaVersion = () => {\n QuickSqliteClient.openDB();\n try {\n const { rows } = sqlite.execute(DB_NAME, `PRAGMA user_version`, []);\n const result = rows ? rows._array : [];\n this.logger?.('info', `getUserPragmaVersion`, {\n result,\n });\n QuickSqliteClient.closeDB();\n return result[0].user_version as number;\n } catch (e) {\n QuickSqliteClient.closeDB();\n throw new Error(`Querying for user_version failed: ${e}`);\n }\n };\n\n static resetDB = () => {\n this.logger?.('info', `resetDB`);\n QuickSqliteClient.dropTables();\n QuickSqliteClient.initializeDatabase();\n };\n}\n"],"mappings":";;;;;;;;AAqBA,IAAAA,UAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,uBAAA,GAAAF,OAAA;AArBA,IAAIG,MAA0B;AAE9B,IAAI;EACFA,MAAM,GAAGH,OAAO,CAAC,2BAA2B,CAAC,CAACI,WAAW;AAC3D,CAAC,CAAC,OAAOC,CAAC,EAAE;EAIV,IAAMC,qBAAqB,GAAGD,CAAC,YAAYE,KAAK,IAAIF,CAAC,CAACG,OAAO,CAACC,QAAQ,CAAC,mBAAmB,CAAC;EAC3F,IAAIH,qBAAqB,EAAE;IACzB,MAAMD,CAAC;EACT;AAIF;AAAC,IAcYK,iBAAiB,OAAAC,aAAA,sBAAAD,kBAAA;EAAA,IAAAE,gBAAA,mBAAAF,iBAAA;AAAA;AAAAG,OAAA,CAAAH,iBAAA,GAAAA,iBAAA;AAAjBA,iBAAiB,CACrBI,SAAS,GAAG,CAAC;AADTJ,iBAAiB,CAGrBK,MAAM,GAAGC,kBAAO;AAHZN,iBAAiB,CAIrBO,UAAU,GAAGC,sBAAW;AAJpBR,iBAAiB,CAOrBS,YAAY,G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A1I/B7B,iBAAiB,CA2InBe,MAAM,oBA3IJf,iBAAiB,CA2InBe,MAAM,CAAG,MAAM,0BAA0B;MAC5CoC,MAAM,EAANA;IACF,CAAC,CAAC;IACFnD,iBAAiB,CAACkB,OAAO,CAAC,CAAC;IAC3B,OAAOiC,MAAM,CAAC,CAAC,CAAC,CAACC,YAAY;EAC/B,CAAC,CAAC,OAAOzD,CAAC,EAAE;IACVK,iBAAiB,CAACkB,OAAO,CAAC,CAAC;IAC3B,MAAM,IAAIrB,KAAK,wCAAsCF,CAAG,CAAC;EAC3D;AACF,CAAC;AApJUK,iBAAiB,CAsJrBqD,OAAO,GAAG,YAAM;EAtJZrD,iBAAiB,CAuJrBe,MAAM,oBAvJFf,iBAAiB,CAuJrBe,MAAM,CAAG,MAAM,WAAW,CAAC;EAChCf,iBAAiB,CAAC8B,UAAU,CAAC,CAAC;EAC9B9B,iBAAiB,CAACsC,kBAAkB,CAAC,CAAC;AACxC,CAAC"}
|
|
@@ -8,13 +8,25 @@ var _createDeleteQuery = require("../sqlite-utils/createDeleteQuery");
|
|
|
8
8
|
var _createUpsertQuery = require("../sqlite-utils/createUpsertQuery");
|
|
9
9
|
var addPendingTask = function addPendingTask(task) {
|
|
10
10
|
var storable = (0, _mapTaskToStorable.mapTaskToStorable)(task);
|
|
11
|
+
var channelId = storable.channelId,
|
|
12
|
+
channelType = storable.channelType,
|
|
13
|
+
payload = storable.payload,
|
|
14
|
+
type = storable.type;
|
|
11
15
|
var query = (0, _createUpsertQuery.createUpsertQuery)('pendingTasks', storable);
|
|
16
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'addPendingTask', {
|
|
17
|
+
channelId: channelId,
|
|
18
|
+
channelType: channelType,
|
|
19
|
+
id: task.id,
|
|
20
|
+
type: type
|
|
21
|
+
});
|
|
12
22
|
_QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, query);
|
|
13
23
|
return function () {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
24
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'deletePendingTaskAfterAddition', {
|
|
25
|
+
channelId: channelId,
|
|
26
|
+
channelType: channelType,
|
|
27
|
+
id: task.id,
|
|
28
|
+
type: type
|
|
29
|
+
});
|
|
18
30
|
var query = (0, _createDeleteQuery.createDeleteQuery)('pendingTasks', {
|
|
19
31
|
channelId: channelId,
|
|
20
32
|
channelType: channelType,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_mapTaskToStorable","require","_QuickSqliteClient","_createDeleteQuery","_createUpsertQuery","addPendingTask","task","storable","mapTaskToStorable","
|
|
1
|
+
{"version":3,"names":["_mapTaskToStorable","require","_QuickSqliteClient","_createDeleteQuery","_createUpsertQuery","addPendingTask","task","storable","mapTaskToStorable","channelId","channelType","payload","type","query","createUpsertQuery","QuickSqliteClient","logger","id","executeSql","apply","createDeleteQuery","exports"],"sources":["addPendingTask.ts"],"sourcesContent":["import { mapTaskToStorable } from '../mappers/mapTaskToStorable';\nimport { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\nimport { createUpsertQuery } from '../sqlite-utils/createUpsertQuery';\nimport type { PendingTask } from '../types';\n\n/*\n * addPendingTask - Adds a pending task to the database\n *\n * @param {PendingTask} task - The task to add\n *\n * @return {() => void} - A function that can be called to remove the task from the database\n */\nexport const addPendingTask = (task: PendingTask) => {\n const storable = mapTaskToStorable(task);\n const { channelId, channelType, payload, type } = storable;\n const query = createUpsertQuery('pendingTasks', storable);\n QuickSqliteClient.logger?.('info', 'addPendingTask', {\n channelId,\n channelType,\n id: task.id,\n type,\n });\n\n QuickSqliteClient.executeSql.apply(null, query);\n\n return () => {\n QuickSqliteClient.logger?.('info', 'deletePendingTaskAfterAddition', {\n channelId,\n channelType,\n id: task.id,\n type,\n });\n const query = createDeleteQuery('pendingTasks', {\n channelId,\n channelType,\n payload,\n type,\n });\n\n QuickSqliteClient.executeSql.apply(null, query);\n };\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AACA,IAAAG,kBAAA,GAAAH,OAAA;AAUO,IAAMI,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,IAAiB,EAAK;EACnD,IAAMC,QAAQ,GAAG,IAAAC,oCAAiB,EAACF,IAAI,CAAC;EACxC,IAAQG,SAAS,GAAiCF,QAAQ,CAAlDE,SAAS;IAAEC,WAAW,GAAoBH,QAAQ,CAAvCG,WAAW;IAAEC,OAAO,GAAWJ,QAAQ,CAA1BI,OAAO;IAAEC,IAAI,GAAKL,QAAQ,CAAjBK,IAAI;EAC7C,IAAMC,KAAK,GAAG,IAAAC,oCAAiB,EAAC,cAAc,EAAEP,QAAQ,CAAC;EACzDQ,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,gBAAgB,EAAE;IACnDP,SAAS,EAATA,SAAS;IACTC,WAAW,EAAXA,WAAW;IACXO,EAAE,EAAEX,IAAI,CAACW,EAAE;IACXL,IAAI,EAAJA;EACF,CAAC,CAAC;EAEFG,oCAAiB,CAACG,UAAU,CAACC,KAAK,CAAC,IAAI,EAAEN,KAAK,CAAC;EAE/C,OAAO,YAAM;IACXE,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,gCAAgC,EAAE;MACnEP,SAAS,EAATA,SAAS;MACTC,WAAW,EAAXA,WAAW;MACXO,EAAE,EAAEX,IAAI,CAACW,EAAE;MACXL,IAAI,EAAJA;IACF,CAAC,CAAC;IACF,IAAMC,KAAK,GAAG,IAAAO,oCAAiB,EAAC,cAAc,EAAE;MAC9CX,SAAS,EAATA,SAAS;MACTC,WAAW,EAAXA,WAAW;MACXC,OAAO,EAAPA,OAAO;MACPC,IAAI,EAAJA;IACF,CAAC,CAAC;IAEFG,oCAAiB,CAACG,UAAU,CAACC,KAAK,CAAC,IAAI,EAAEN,KAAK,CAAC;EACjD,CAAC;AACH,CAAC;AAACQ,OAAA,CAAAhB,cAAA,GAAAA,cAAA"}
|
|
@@ -11,6 +11,10 @@ var deleteChannel = function deleteChannel(_ref) {
|
|
|
11
11
|
var query = (0, _createDeleteQuery.createDeleteQuery)('channels', {
|
|
12
12
|
cid: cid
|
|
13
13
|
});
|
|
14
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'deleteChannel', {
|
|
15
|
+
cid: cid,
|
|
16
|
+
flush: flush
|
|
17
|
+
});
|
|
14
18
|
if (flush) {
|
|
15
19
|
_QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, query);
|
|
16
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deleteChannel","_ref","cid","_ref$flush","flush","query","createDeleteQuery","QuickSqliteClient","executeSql","apply","exports"],"sources":["deleteChannel.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deleteChannel = ({ cid, flush = true }: { cid: string; flush?: boolean }) => {\n const query = createDeleteQuery('channels', {\n cid,\n });\n\n if (flush) {\n QuickSqliteClient.executeSql.apply(null, query);\n }\n\n return [query];\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAAgE;EAAA,IAA1DC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAAC,UAAA,GAAAF,IAAA,CAAEG,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;EAC/C,IAAME,KAAK,GAAG,IAAAC,oCAAiB,EAAC,UAAU,EAAE;IAC1CJ,GAAG,EAAHA;EACF,CAAC,CAAC;EAEF,
|
|
1
|
+
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deleteChannel","_ref","cid","_ref$flush","flush","query","createDeleteQuery","QuickSqliteClient","logger","executeSql","apply","exports"],"sources":["deleteChannel.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deleteChannel = ({ cid, flush = true }: { cid: string; flush?: boolean }) => {\n const query = createDeleteQuery('channels', {\n cid,\n });\n\n QuickSqliteClient.logger?.('info', 'deleteChannel', {\n cid,\n flush,\n });\n\n if (flush) {\n QuickSqliteClient.executeSql.apply(null, query);\n }\n\n return [query];\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAAgE;EAAA,IAA1DC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAAC,UAAA,GAAAF,IAAA,CAAEG,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;EAC/C,IAAME,KAAK,GAAG,IAAAC,oCAAiB,EAAC,UAAU,EAAE;IAC1CJ,GAAG,EAAHA;EACF,CAAC,CAAC;EAEFK,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,eAAe,EAAE;IAClDN,GAAG,EAAHA,GAAG;IACHE,KAAK,EAALA;EACF,CAAC,CAAC;EAEF,IAAIA,KAAK,EAAE;IACTG,oCAAiB,CAACE,UAAU,CAACC,KAAK,CAAC,IAAI,EAAEL,KAAK,CAAC;EACjD;EAEA,OAAO,CAACA,KAAK,CAAC;AAChB,CAAC;AAACM,OAAA,CAAAX,aAAA,GAAAA,aAAA"}
|
|
@@ -13,6 +13,11 @@ var deleteMember = function deleteMember(_ref) {
|
|
|
13
13
|
cid: cid,
|
|
14
14
|
userId: member.user_id
|
|
15
15
|
});
|
|
16
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'deleteMember', {
|
|
17
|
+
cid: cid,
|
|
18
|
+
flush: flush,
|
|
19
|
+
userId: member.user_id
|
|
20
|
+
});
|
|
16
21
|
if (flush) {
|
|
17
22
|
_QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, query);
|
|
18
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deleteMember","_ref","cid","_ref$flush","flush","member","query","createDeleteQuery","userId","user_id","QuickSqliteClient","executeSql","apply","exports"],"sources":["deleteMember.ts"],"sourcesContent":["import type { ChannelMemberResponse } from 'stream-chat';\n\nimport { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deleteMember = ({\n cid,\n flush = true,\n member,\n}: {\n cid: string;\n member: ChannelMemberResponse;\n flush?: boolean;\n}) => {\n const query = createDeleteQuery('members', {\n cid,\n userId: member.user_id,\n });\n\n if (flush) {\n QuickSqliteClient.executeSql.apply(null, query);\n }\n\n return [query];\n};\n"],"mappings":";;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAQnB;EAAA,IAPJC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAAC,UAAA,GAAAF,IAAA,CACHG,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;IACZE,MAAM,GAAAJ,IAAA,CAANI,MAAM;EAMN,IAAMC,KAAK,GAAG,IAAAC,oCAAiB,EAAC,SAAS,EAAE;IACzCL,GAAG,EAAHA,GAAG;IACHM,MAAM,EAAEH,MAAM,CAACI;EACjB,CAAC,CAAC;EAEF,IAAIL,KAAK,EAAE;IACTM,oCAAiB,
|
|
1
|
+
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deleteMember","_ref","cid","_ref$flush","flush","member","query","createDeleteQuery","userId","user_id","QuickSqliteClient","logger","executeSql","apply","exports"],"sources":["deleteMember.ts"],"sourcesContent":["import type { ChannelMemberResponse } from 'stream-chat';\n\nimport { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deleteMember = ({\n cid,\n flush = true,\n member,\n}: {\n cid: string;\n member: ChannelMemberResponse;\n flush?: boolean;\n}) => {\n const query = createDeleteQuery('members', {\n cid,\n userId: member.user_id,\n });\n\n QuickSqliteClient.logger?.('info', 'deleteMember', {\n cid,\n flush,\n userId: member.user_id,\n });\n\n if (flush) {\n QuickSqliteClient.executeSql.apply(null, query);\n }\n\n return [query];\n};\n"],"mappings":";;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,YAAY,GAAG,SAAfA,YAAYA,CAAAC,IAAA,EAQnB;EAAA,IAPJC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAAC,UAAA,GAAAF,IAAA,CACHG,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;IACZE,MAAM,GAAAJ,IAAA,CAANI,MAAM;EAMN,IAAMC,KAAK,GAAG,IAAAC,oCAAiB,EAAC,SAAS,EAAE;IACzCL,GAAG,EAAHA,GAAG;IACHM,MAAM,EAAEH,MAAM,CAACI;EACjB,CAAC,CAAC;EAEFC,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,cAAc,EAAE;IACjDT,GAAG,EAAHA,GAAG;IACHE,KAAK,EAALA,KAAK;IACLI,MAAM,EAAEH,MAAM,CAACI;EACjB,CAAC,CAAC;EAEF,IAAIL,KAAK,EAAE;IACTM,oCAAiB,CAACE,UAAU,CAACC,KAAK,CAAC,IAAI,EAAEP,KAAK,CAAC;EACjD;EAEA,OAAO,CAACA,KAAK,CAAC;AAChB,CAAC;AAACQ,OAAA,CAAAd,YAAA,GAAAA,YAAA"}
|
|
@@ -11,6 +11,10 @@ var deleteMessage = function deleteMessage(_ref) {
|
|
|
11
11
|
var query = (0, _createDeleteQuery.createDeleteQuery)('messages', {
|
|
12
12
|
id: id
|
|
13
13
|
});
|
|
14
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'deleteMessage', {
|
|
15
|
+
flush: flush,
|
|
16
|
+
id: id
|
|
17
|
+
});
|
|
14
18
|
if (flush) {
|
|
15
19
|
_QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, query);
|
|
16
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deleteMessage","_ref","_ref$flush","flush","id","query","createDeleteQuery","QuickSqliteClient","executeSql","apply","exports"],"sources":["deleteMessage.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deleteMessage = ({ flush = true, id }: { id: string; flush?: boolean }) => {\n const query = createDeleteQuery('messages', {\n id,\n });\n if (flush) {\n QuickSqliteClient.executeSql.apply(null, query);\n }\n\n return [query];\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAA8D;EAAA,IAAAC,UAAA,GAAAD,IAAA,CAAxDE,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;IAAEE,EAAE,GAAAH,IAAA,CAAFG,EAAE;EAC9C,IAAMC,KAAK,GAAG,IAAAC,oCAAiB,EAAC,UAAU,EAAE;IAC1CF,EAAE,EAAFA;EACF,CAAC,CAAC;EACF,IAAID,KAAK,EAAE;IACTI,oCAAiB,
|
|
1
|
+
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deleteMessage","_ref","_ref$flush","flush","id","query","createDeleteQuery","QuickSqliteClient","logger","executeSql","apply","exports"],"sources":["deleteMessage.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deleteMessage = ({ flush = true, id }: { id: string; flush?: boolean }) => {\n const query = createDeleteQuery('messages', {\n id,\n });\n\n QuickSqliteClient.logger?.('info', 'deleteMessage', {\n flush,\n id,\n });\n\n if (flush) {\n QuickSqliteClient.executeSql.apply(null, query);\n }\n\n return [query];\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,aAAa,GAAG,SAAhBA,aAAaA,CAAAC,IAAA,EAA8D;EAAA,IAAAC,UAAA,GAAAD,IAAA,CAAxDE,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;IAAEE,EAAE,GAAAH,IAAA,CAAFG,EAAE;EAC9C,IAAMC,KAAK,GAAG,IAAAC,oCAAiB,EAAC,UAAU,EAAE;IAC1CF,EAAE,EAAFA;EACF,CAAC,CAAC;EAEFG,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,eAAe,EAAE;IAClDL,KAAK,EAALA,KAAK;IACLC,EAAE,EAAFA;EACF,CAAC,CAAC;EAEF,IAAID,KAAK,EAAE;IACTI,oCAAiB,CAACE,UAAU,CAACC,KAAK,CAAC,IAAI,EAAEL,KAAK,CAAC;EACjD;EAEA,OAAO,CAACA,KAAK,CAAC;AAChB,CAAC;AAACM,OAAA,CAAAX,aAAA,GAAAA,aAAA"}
|
|
@@ -11,6 +11,10 @@ var deleteMessagesForChannel = function deleteMessagesForChannel(_ref) {
|
|
|
11
11
|
var query = (0, _createDeleteQuery.createDeleteQuery)('messages', {
|
|
12
12
|
cid: cid
|
|
13
13
|
});
|
|
14
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'deleteMessagesForChannel', {
|
|
15
|
+
cid: cid,
|
|
16
|
+
flush: flush
|
|
17
|
+
});
|
|
14
18
|
if (flush) {
|
|
15
19
|
_QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, query);
|
|
16
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deleteMessagesForChannel","_ref","cid","_ref$flush","flush","query","createDeleteQuery","QuickSqliteClient","executeSql","apply","exports"],"sources":["deleteMessagesForChannel.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deleteMessagesForChannel = ({\n cid,\n flush = true,\n}: {\n cid: string;\n flush?: boolean;\n}) => {\n const query = createDeleteQuery('messages', {\n cid,\n });\n if (flush) {\n QuickSqliteClient.executeSql.apply(null, query);\n }\n\n return [query];\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAAC,IAAA,EAM/B;EAAA,IALJC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAAC,UAAA,GAAAF,IAAA,CACHG,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;EAKZ,IAAME,KAAK,GAAG,IAAAC,oCAAiB,EAAC,UAAU,EAAE;IAC1CJ,GAAG,EAAHA;EACF,CAAC,CAAC;EACF,
|
|
1
|
+
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deleteMessagesForChannel","_ref","cid","_ref$flush","flush","query","createDeleteQuery","QuickSqliteClient","logger","executeSql","apply","exports"],"sources":["deleteMessagesForChannel.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deleteMessagesForChannel = ({\n cid,\n flush = true,\n}: {\n cid: string;\n flush?: boolean;\n}) => {\n const query = createDeleteQuery('messages', {\n cid,\n });\n\n QuickSqliteClient.logger?.('info', 'deleteMessagesForChannel', {\n cid,\n flush,\n });\n\n if (flush) {\n QuickSqliteClient.executeSql.apply(null, query);\n }\n\n return [query];\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAAC,IAAA,EAM/B;EAAA,IALJC,GAAG,GAAAD,IAAA,CAAHC,GAAG;IAAAC,UAAA,GAAAF,IAAA,CACHG,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;EAKZ,IAAME,KAAK,GAAG,IAAAC,oCAAiB,EAAC,UAAU,EAAE;IAC1CJ,GAAG,EAAHA;EACF,CAAC,CAAC;EAEFK,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,0BAA0B,EAAE;IAC7DN,GAAG,EAAHA,GAAG;IACHE,KAAK,EAALA;EACF,CAAC,CAAC;EAEF,IAAIA,KAAK,EAAE;IACTG,oCAAiB,CAACE,UAAU,CAACC,KAAK,CAAC,IAAI,EAAEL,KAAK,CAAC;EACjD;EAEA,OAAO,CAACA,KAAK,CAAC;AAChB,CAAC;AAACM,OAAA,CAAAX,wBAAA,GAAAA,wBAAA"}
|
|
@@ -9,6 +9,9 @@ var deletePendingTask = function deletePendingTask(_ref) {
|
|
|
9
9
|
var query = (0, _createDeleteQuery.createDeleteQuery)('pendingTasks', {
|
|
10
10
|
id: id
|
|
11
11
|
});
|
|
12
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'deletePendingTask', {
|
|
13
|
+
id: id
|
|
14
|
+
});
|
|
12
15
|
_QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, query);
|
|
13
16
|
return [query];
|
|
14
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deletePendingTask","_ref","id","query","createDeleteQuery","QuickSqliteClient","executeSql","apply","exports"],"sources":["deletePendingTask.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deletePendingTask = ({ id }: { id: number }) => {\n const query = createDeleteQuery('pendingTasks', {\n id,\n });\n\n QuickSqliteClient.executeSql.apply(null, query);\n\n return [query];\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAA+B;EAAA,IAAzBC,EAAE,GAAAD,IAAA,CAAFC,EAAE;EACpC,IAAMC,KAAK,GAAG,IAAAC,oCAAiB,EAAC,cAAc,EAAE;IAC9CF,EAAE,EAAFA;EACF,CAAC,CAAC;EAEFG,oCAAiB,CAACC,UAAU,CAACC,KAAK,CAAC,IAAI,
|
|
1
|
+
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deletePendingTask","_ref","id","query","createDeleteQuery","QuickSqliteClient","logger","executeSql","apply","exports"],"sources":["deletePendingTask.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deletePendingTask = ({ id }: { id: number }) => {\n const query = createDeleteQuery('pendingTasks', {\n id,\n });\n\n QuickSqliteClient.logger?.('info', 'deletePendingTask', {\n id,\n });\n\n QuickSqliteClient.executeSql.apply(null, query);\n\n return [query];\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,iBAAiB,GAAG,SAApBA,iBAAiBA,CAAAC,IAAA,EAA+B;EAAA,IAAzBC,EAAE,GAAAD,IAAA,CAAFC,EAAE;EACpC,IAAMC,KAAK,GAAG,IAAAC,oCAAiB,EAAC,cAAc,EAAE;IAC9CF,EAAE,EAAFA;EACF,CAAC,CAAC;EAEFG,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,mBAAmB,EAAE;IACtDJ,EAAE,EAAFA;EACF,CAAC,CAAC;EAEFG,oCAAiB,CAACE,UAAU,CAACC,KAAK,CAAC,IAAI,EAAEL,KAAK,CAAC;EAE/C,OAAO,CAACA,KAAK,CAAC;AAChB,CAAC;AAACM,OAAA,CAAAT,iBAAA,GAAAA,iBAAA"}
|
|
@@ -15,6 +15,11 @@ var deleteReaction = function deleteReaction(_ref) {
|
|
|
15
15
|
type: reactionType,
|
|
16
16
|
userId: userId
|
|
17
17
|
});
|
|
18
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'deleteReaction', {
|
|
19
|
+
messageId: messageId,
|
|
20
|
+
type: reactionType,
|
|
21
|
+
userId: userId
|
|
22
|
+
});
|
|
18
23
|
if (flush) {
|
|
19
24
|
_QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, query);
|
|
20
25
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deleteReaction","_ref","_ref$flush","flush","messageId","reactionType","userId","query","createDeleteQuery","type","QuickSqliteClient","executeSql","apply","exports"],"sources":["deleteReaction.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deleteReaction = ({\n flush = true,\n messageId,\n reactionType,\n userId,\n}: {\n messageId: string;\n reactionType: string;\n userId: string;\n flush?: boolean;\n}) => {\n const query = createDeleteQuery('reactions', {\n messageId,\n type: reactionType,\n userId,\n });\n\n if (flush) {\n QuickSqliteClient.executeSql.apply(null, query);\n }\n\n return [query];\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAUrB;EAAA,IAAAC,UAAA,GAAAD,IAAA,CATJE,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;IACZE,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,MAAM,GAAAL,IAAA,CAANK,MAAM;EAON,IAAMC,KAAK,GAAG,IAAAC,oCAAiB,EAAC,WAAW,EAAE;IAC3CJ,SAAS,EAATA,SAAS;IACTK,IAAI,EAAEJ,YAAY;IAClBC,MAAM,EAANA;EACF,CAAC,CAAC;EAEF,IAAIH,KAAK,EAAE;IACTO,oCAAiB,
|
|
1
|
+
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deleteReaction","_ref","_ref$flush","flush","messageId","reactionType","userId","query","createDeleteQuery","type","QuickSqliteClient","logger","executeSql","apply","exports"],"sources":["deleteReaction.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deleteReaction = ({\n flush = true,\n messageId,\n reactionType,\n userId,\n}: {\n messageId: string;\n reactionType: string;\n userId: string;\n flush?: boolean;\n}) => {\n const query = createDeleteQuery('reactions', {\n messageId,\n type: reactionType,\n userId,\n });\n\n QuickSqliteClient.logger?.('info', 'deleteReaction', {\n messageId,\n type: reactionType,\n userId,\n });\n\n if (flush) {\n QuickSqliteClient.executeSql.apply(null, query);\n }\n\n return [query];\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAUrB;EAAA,IAAAC,UAAA,GAAAD,IAAA,CATJE,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;IACZE,SAAS,GAAAH,IAAA,CAATG,SAAS;IACTC,YAAY,GAAAJ,IAAA,CAAZI,YAAY;IACZC,MAAM,GAAAL,IAAA,CAANK,MAAM;EAON,IAAMC,KAAK,GAAG,IAAAC,oCAAiB,EAAC,WAAW,EAAE;IAC3CJ,SAAS,EAATA,SAAS;IACTK,IAAI,EAAEJ,YAAY;IAClBC,MAAM,EAANA;EACF,CAAC,CAAC;EAEFI,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,gBAAgB,EAAE;IACnDP,SAAS,EAATA,SAAS;IACTK,IAAI,EAAEJ,YAAY;IAClBC,MAAM,EAANA;EACF,CAAC,CAAC;EAEF,IAAIH,KAAK,EAAE;IACTO,oCAAiB,CAACE,UAAU,CAACC,KAAK,CAAC,IAAI,EAAEN,KAAK,CAAC;EACjD;EAEA,OAAO,CAACA,KAAK,CAAC;AAChB,CAAC;AAACO,OAAA,CAAAd,cAAA,GAAAA,cAAA"}
|
|
@@ -11,10 +11,12 @@ var deleteReactionsForMessage = function deleteReactionsForMessage(_ref) {
|
|
|
11
11
|
var query = (0, _createDeleteQuery.createDeleteQuery)('reactions', {
|
|
12
12
|
messageId: messageId
|
|
13
13
|
});
|
|
14
|
+
console.log('deleteReactionsForMessage', {
|
|
15
|
+
flush: flush,
|
|
16
|
+
messageId: messageId
|
|
17
|
+
});
|
|
14
18
|
if (flush) {
|
|
15
|
-
_QuickSqliteClient.QuickSqliteClient.executeSql.apply(null,
|
|
16
|
-
messageId: messageId
|
|
17
|
-
}));
|
|
19
|
+
_QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, query);
|
|
18
20
|
}
|
|
19
21
|
return [query];
|
|
20
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deleteReactionsForMessage","_ref","_ref$flush","flush","messageId","query","createDeleteQuery","QuickSqliteClient","executeSql","apply","exports"],"sources":["deleteReactions.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deleteReactionsForMessage = ({\n flush = true,\n messageId,\n}: {\n messageId: string;\n flush?: boolean;\n}) => {\n const query = createDeleteQuery('reactions', {\n messageId,\n });\n if (flush) {\n QuickSqliteClient.executeSql.apply(
|
|
1
|
+
{"version":3,"names":["_QuickSqliteClient","require","_createDeleteQuery","deleteReactionsForMessage","_ref","_ref$flush","flush","messageId","query","createDeleteQuery","console","log","QuickSqliteClient","executeSql","apply","exports"],"sources":["deleteReactions.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createDeleteQuery } from '../sqlite-utils/createDeleteQuery';\n\nexport const deleteReactionsForMessage = ({\n flush = true,\n messageId,\n}: {\n messageId: string;\n flush?: boolean;\n}) => {\n const query = createDeleteQuery('reactions', {\n messageId,\n });\n console.log('deleteReactionsForMessage', {\n flush,\n messageId,\n });\n if (flush) {\n QuickSqliteClient.executeSql.apply(null, query);\n }\n\n return [query];\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,yBAAyB,GAAG,SAA5BA,yBAAyBA,CAAAC,IAAA,EAMhC;EAAA,IAAAC,UAAA,GAAAD,IAAA,CALJE,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;IACZE,SAAS,GAAAH,IAAA,CAATG,SAAS;EAKT,IAAMC,KAAK,GAAG,IAAAC,oCAAiB,EAAC,WAAW,EAAE;IAC3CF,SAAS,EAATA;EACF,CAAC,CAAC;EACFG,OAAO,CAACC,GAAG,CAAC,2BAA2B,EAAE;IACvCL,KAAK,EAALA,KAAK;IACLC,SAAS,EAATA;EACF,CAAC,CAAC;EACF,IAAID,KAAK,EAAE;IACTM,oCAAiB,CAACC,UAAU,CAACC,KAAK,CAAC,IAAI,EAAEN,KAAK,CAAC;EACjD;EAEA,OAAO,CAACA,KAAK,CAAC;AAChB,CAAC;AAACO,OAAA,CAAAZ,yBAAA,GAAAA,yBAAA"}
|
|
@@ -3,8 +3,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
3
3
|
});
|
|
4
4
|
exports.getAllChannelIds = void 0;
|
|
5
5
|
var _selectChannels = require("./queries/selectChannels");
|
|
6
|
+
var _QuickSqliteClient = require("../QuickSqliteClient");
|
|
6
7
|
var getAllChannelIds = function getAllChannelIds() {
|
|
7
8
|
var channels = (0, _selectChannels.selectChannels)();
|
|
9
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'getAllChannelIds');
|
|
8
10
|
return channels.map(function (c) {
|
|
9
11
|
return c.cid;
|
|
10
12
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_selectChannels","require","getAllChannelIds","channels","selectChannels","map","c","cid","exports"],"sources":["getAllChannelIds.ts"],"sourcesContent":["import { selectChannels } from './queries/selectChannels';\n\nexport const getAllChannelIds = () => {\n const channels = selectChannels();\n\n return channels.map((c) => c.cid);\n};\n"],"mappings":";;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEO,
|
|
1
|
+
{"version":3,"names":["_selectChannels","require","_QuickSqliteClient","getAllChannelIds","channels","selectChannels","QuickSqliteClient","logger","map","c","cid","exports"],"sources":["getAllChannelIds.ts"],"sourcesContent":["import { selectChannels } from './queries/selectChannels';\n\nimport { QuickSqliteClient } from '../QuickSqliteClient';\n\nexport const getAllChannelIds = () => {\n const channels = selectChannels();\n\n QuickSqliteClient.logger?.('info', 'getAllChannelIds');\n return channels.map((c) => c.cid);\n};\n"],"mappings":";;;;AAAA,IAAAA,eAAA,GAAAC,OAAA;AAEA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,gBAAgB,GAAG,SAAnBA,gBAAgBA,CAAA,EAAS;EACpC,IAAMC,QAAQ,GAAG,IAAAC,8BAAc,EAAC,CAAC;EAEjCC,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,kBAAkB,CAAC;EACtD,OAAOH,QAAQ,CAACI,GAAG,CAAC,UAACC,CAAC;IAAA,OAAKA,CAAC,CAACC,GAAG;EAAA,EAAC;AACnC,CAAC;AAACC,OAAA,CAAAR,gBAAA,GAAAA,gBAAA"}
|
|
@@ -7,6 +7,9 @@ var _createSelectQuery = require("../sqlite-utils/createSelectQuery");
|
|
|
7
7
|
var getAppSettings = function getAppSettings(_ref) {
|
|
8
8
|
var _result$;
|
|
9
9
|
var currentUserId = _ref.currentUserId;
|
|
10
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'getAppSettings', {
|
|
11
|
+
currentUserId: currentUserId
|
|
12
|
+
});
|
|
10
13
|
var result = _QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, (0, _createSelectQuery.createSelectQuery)('userSyncStatus', ['*'], {
|
|
11
14
|
userId: currentUserId
|
|
12
15
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_QuickSqliteClient","require","_createSelectQuery","getAppSettings","_ref","_result$","currentUserId","
|
|
1
|
+
{"version":3,"names":["_QuickSqliteClient","require","_createSelectQuery","getAppSettings","_ref","_result$","currentUserId","QuickSqliteClient","logger","result","executeSql","apply","createSelectQuery","userId","appSettings","JSON","parse","exports"],"sources":["getAppSettings.ts"],"sourcesContent":["import type { AppSettingsAPIResponse } from 'stream-chat';\n\nimport { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createSelectQuery } from '../sqlite-utils/createSelectQuery';\n\nexport const getAppSettings = ({\n currentUserId,\n}: {\n currentUserId: string;\n}): AppSettingsAPIResponse => {\n QuickSqliteClient.logger?.('info', 'getAppSettings', {\n currentUserId,\n });\n const result = QuickSqliteClient.executeSql.apply(\n null,\n createSelectQuery('userSyncStatus', ['*'], {\n userId: currentUserId,\n }),\n );\n\n return result[0]?.appSettings ? JSON.parse(result[0].appSettings) : null;\n};\n"],"mappings":";;;;AAEA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAIG;EAAA,IAAAC,QAAA;EAAA,IAH5BC,aAAa,GAAAF,IAAA,CAAbE,aAAa;EAIbC,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,gBAAgB,EAAE;IACnDF,aAAa,EAAbA;EACF,CAAC,CAAC;EACF,IAAMG,MAAM,GAAGF,oCAAiB,CAACG,UAAU,CAACC,KAAK,CAC/C,IAAI,EACJ,IAAAC,oCAAiB,EAAC,gBAAgB,EAAE,CAAC,GAAG,CAAC,EAAE;IACzCC,MAAM,EAAEP;EACV,CAAC,CACH,CAAC;EAED,OAAO,CAAAD,QAAA,GAAAI,MAAM,CAAC,CAAC,CAAC,aAATJ,QAAA,CAAWS,WAAW,GAAGC,IAAI,CAACC,KAAK,CAACP,MAAM,CAAC,CAAC,CAAC,CAACK,WAAW,CAAC,GAAG,IAAI;AAC1E,CAAC;AAACG,OAAA,CAAAd,cAAA,GAAAA,cAAA"}
|
|
@@ -6,9 +6,14 @@ var _selectMessagesForChannels = require("./queries/selectMessagesForChannels");
|
|
|
6
6
|
var _selectReactionsForMessages = require("./queries/selectReactionsForMessages");
|
|
7
7
|
var _utils = require("../../utils/utils");
|
|
8
8
|
var _mapStorableToMessage = require("../mappers/mapStorableToMessage");
|
|
9
|
+
var _QuickSqliteClient = require("../QuickSqliteClient");
|
|
9
10
|
var getChannelMessages = function getChannelMessages(_ref) {
|
|
10
11
|
var channelIds = _ref.channelIds,
|
|
11
12
|
currentUserId = _ref.currentUserId;
|
|
13
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'getChannelMessages', {
|
|
14
|
+
channelIds: channelIds,
|
|
15
|
+
currentUserId: currentUserId
|
|
16
|
+
});
|
|
12
17
|
var messageRows = (0, _selectMessagesForChannels.selectMessagesForChannels)(channelIds);
|
|
13
18
|
var messageIds = messageRows.map(function (_ref2) {
|
|
14
19
|
var id = _ref2.id;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_selectMessagesForChannels","require","_selectReactionsForMessages","_utils","_mapStorableToMessage","getChannelMessages","_ref","channelIds","currentUserId","messageRows","selectMessagesForChannels","messageIds","map","_ref2","id","reactionRows","selectReactionsForMessages","messageIdVsReactions","forEach","reaction","messageId","push","cidVsMessages","m","cid","isBlockedMessage","mapStorableToMessage","messageRow","exports"],"sources":["getChannelMessages.ts"],"sourcesContent":["import type { MessageResponse } from 'stream-chat';\n\nimport { selectMessagesForChannels } from './queries/selectMessagesForChannels';\n\nimport { selectReactionsForMessages } from './queries/selectReactionsForMessages';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { isBlockedMessage } from '../../utils/utils';\nimport { mapStorableToMessage } from '../mappers/mapStorableToMessage';\nimport type { TableRowJoinedUser } from '../types';\n\nexport const getChannelMessages = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n channelIds,\n currentUserId,\n}: {\n channelIds: string[];\n currentUserId: string;\n}) => {\n const messageRows = selectMessagesForChannels(channelIds);\n const messageIds = messageRows.map(({ id }) => id);\n\n // Populate the message reactions.\n const reactionRows = selectReactionsForMessages(messageIds);\n const messageIdVsReactions: Record<string, TableRowJoinedUser<'reactions'>[]> = {};\n reactionRows.forEach((reaction) => {\n if (!messageIdVsReactions[reaction.messageId]) {\n messageIdVsReactions[reaction.messageId] = [];\n }\n messageIdVsReactions[reaction.messageId].push(reaction);\n });\n\n // Populate the messages.\n const cidVsMessages: Record<string, MessageResponse<StreamChatGenerics>[]> = {};\n messageRows.forEach((m) => {\n if (!cidVsMessages[m.cid]) {\n cidVsMessages[m.cid] = [];\n }\n\n if (!isBlockedMessage(m)) {\n cidVsMessages[m.cid].push(\n mapStorableToMessage<StreamChatGenerics>({\n currentUserId,\n messageRow: m,\n reactionRows: messageIdVsReactions[m.id],\n }),\n );\n }\n });\n\n return cidVsMessages;\n};\n"],"mappings":";;;;AAEA,IAAAA,0BAAA,GAAAC,OAAA;AAEA,IAAAC,2BAAA,GAAAD,OAAA;AAGA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AAGO,
|
|
1
|
+
{"version":3,"names":["_selectMessagesForChannels","require","_selectReactionsForMessages","_utils","_mapStorableToMessage","_QuickSqliteClient","getChannelMessages","_ref","channelIds","currentUserId","QuickSqliteClient","logger","messageRows","selectMessagesForChannels","messageIds","map","_ref2","id","reactionRows","selectReactionsForMessages","messageIdVsReactions","forEach","reaction","messageId","push","cidVsMessages","m","cid","isBlockedMessage","mapStorableToMessage","messageRow","exports"],"sources":["getChannelMessages.ts"],"sourcesContent":["import type { MessageResponse } from 'stream-chat';\n\nimport { selectMessagesForChannels } from './queries/selectMessagesForChannels';\n\nimport { selectReactionsForMessages } from './queries/selectReactionsForMessages';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { isBlockedMessage } from '../../utils/utils';\nimport { mapStorableToMessage } from '../mappers/mapStorableToMessage';\nimport { QuickSqliteClient } from '../QuickSqliteClient';\nimport type { TableRowJoinedUser } from '../types';\n\nexport const getChannelMessages = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n channelIds,\n currentUserId,\n}: {\n channelIds: string[];\n currentUserId: string;\n}) => {\n QuickSqliteClient.logger?.('info', 'getChannelMessages', {\n channelIds,\n currentUserId,\n });\n const messageRows = selectMessagesForChannels(channelIds);\n const messageIds = messageRows.map(({ id }) => id);\n\n // Populate the message reactions.\n const reactionRows = selectReactionsForMessages(messageIds);\n const messageIdVsReactions: Record<string, TableRowJoinedUser<'reactions'>[]> = {};\n reactionRows.forEach((reaction) => {\n if (!messageIdVsReactions[reaction.messageId]) {\n messageIdVsReactions[reaction.messageId] = [];\n }\n messageIdVsReactions[reaction.messageId].push(reaction);\n });\n\n // Populate the messages.\n const cidVsMessages: Record<string, MessageResponse<StreamChatGenerics>[]> = {};\n messageRows.forEach((m) => {\n if (!cidVsMessages[m.cid]) {\n cidVsMessages[m.cid] = [];\n }\n\n if (!isBlockedMessage(m)) {\n cidVsMessages[m.cid].push(\n mapStorableToMessage<StreamChatGenerics>({\n currentUserId,\n messageRow: m,\n reactionRows: messageIdVsReactions[m.id],\n }),\n );\n }\n });\n\n return cidVsMessages;\n};\n"],"mappings":";;;;AAEA,IAAAA,0BAAA,GAAAC,OAAA;AAEA,IAAAC,2BAAA,GAAAD,OAAA;AAGA,IAAAE,MAAA,GAAAF,OAAA;AACA,IAAAG,qBAAA,GAAAH,OAAA;AACA,IAAAI,kBAAA,GAAAJ,OAAA;AAGO,IAAMK,kBAAkB,GAAG,SAArBA,kBAAkBA,CAAAC,IAAA,EAQzB;EAAA,IALJC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,aAAa,GAAAF,IAAA,CAAbE,aAAa;EAKbC,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,oBAAoB,EAAE;IACvDH,UAAU,EAAVA,UA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require("./getMembers");
|
|
|
9
9
|
var _getReads = require("./getReads");
|
|
10
10
|
var _selectChannels = require("./queries/selectChannels");
|
|
11
11
|
var _mapStorableToChannel = require("../mappers/mapStorableToChannel");
|
|
12
|
+
var _QuickSqliteClient = require("../QuickSqliteClient");
|
|
12
13
|
var getChannels = function getChannels(_ref) {
|
|
13
14
|
var channelIds = _ref.channelIds,
|
|
14
15
|
currentUserId = _ref.currentUserId;
|
|
16
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'getChannels', {
|
|
17
|
+
channelIds: channelIds,
|
|
18
|
+
currentUserId: currentUserId
|
|
19
|
+
});
|
|
15
20
|
var channels = (0, _selectChannels.selectChannels)({
|
|
16
21
|
channelIds: channelIds
|
|
17
22
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_getChannelMessages","require","_getMembers","_getReads","_selectChannels","_mapStorableToChannel","getChannels","_ref","channelIds","currentUserId","channels","selectChannels","cidVsMembers","getMembers","cidVsReads","getReads","cidVsMessages","getChannelMessages","map","c","_extends2","mapStorableToChannel","members","cid","messages","pinned_messages","read","exports"],"sources":["getChannels.ts"],"sourcesContent":["import type { ChannelAPIResponse } from 'stream-chat';\n\nimport { getChannelMessages } from './getChannelMessages';\nimport { getMembers } from './getMembers';\nimport { getReads } from './getReads';\nimport { selectChannels } from './queries/selectChannels';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { mapStorableToChannel } from '../mappers/mapStorableToChannel';\n\n/**\n * Returns the list of channels with state enriched for given channel ids.\n *\n * @param {Object} param\n * @param {Array} param.channelIds List of channel ids to fetch.\n * @param {Array} param.currentUserId Id of the current logged in user.\n *\n * @returns {Array} Channels with enriched state.\n */\nexport const getChannels = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n channelIds,\n currentUserId,\n}: {\n channelIds: string[];\n currentUserId: string;\n}): Omit<ChannelAPIResponse<StreamChatGenerics>, 'duration'>[] => {\n const channels = selectChannels({ channelIds });\n\n const cidVsMembers = getMembers<StreamChatGenerics>({ channelIds });\n const cidVsReads = getReads<StreamChatGenerics>({ channelIds });\n const cidVsMessages = getChannelMessages<StreamChatGenerics>({\n channelIds,\n currentUserId,\n });\n\n // Enrich the channels with state\n return channels.map((c) => ({\n ...mapStorableToChannel<StreamChatGenerics>(c),\n members: cidVsMembers[c.cid],\n messages: cidVsMessages[c.cid],\n pinned_messages: [],\n read: cidVsReads[c.cid],\n }));\n};\n"],"mappings":";;;;;;AAEA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAGA,IAAAI,qBAAA,GAAAJ,OAAA;AAWO,
|
|
1
|
+
{"version":3,"names":["_getChannelMessages","require","_getMembers","_getReads","_selectChannels","_mapStorableToChannel","_QuickSqliteClient","getChannels","_ref","channelIds","currentUserId","QuickSqliteClient","logger","channels","selectChannels","cidVsMembers","getMembers","cidVsReads","getReads","cidVsMessages","getChannelMessages","map","c","_extends2","mapStorableToChannel","members","cid","messages","pinned_messages","read","exports"],"sources":["getChannels.ts"],"sourcesContent":["import type { ChannelAPIResponse } from 'stream-chat';\n\nimport { getChannelMessages } from './getChannelMessages';\nimport { getMembers } from './getMembers';\nimport { getReads } from './getReads';\nimport { selectChannels } from './queries/selectChannels';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { mapStorableToChannel } from '../mappers/mapStorableToChannel';\nimport { QuickSqliteClient } from '../QuickSqliteClient';\n\n/**\n * Returns the list of channels with state enriched for given channel ids.\n *\n * @param {Object} param\n * @param {Array} param.channelIds List of channel ids to fetch.\n * @param {Array} param.currentUserId Id of the current logged in user.\n *\n * @returns {Array} Channels with enriched state.\n */\nexport const getChannels = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n channelIds,\n currentUserId,\n}: {\n channelIds: string[];\n currentUserId: string;\n}): Omit<ChannelAPIResponse<StreamChatGenerics>, 'duration'>[] => {\n QuickSqliteClient.logger?.('info', 'getChannels', { channelIds, currentUserId });\n const channels = selectChannels({ channelIds });\n\n const cidVsMembers = getMembers<StreamChatGenerics>({ channelIds });\n const cidVsReads = getReads<StreamChatGenerics>({ channelIds });\n const cidVsMessages = getChannelMessages<StreamChatGenerics>({\n channelIds,\n currentUserId,\n });\n\n // Enrich the channels with state\n return channels.map((c) => ({\n ...mapStorableToChannel<StreamChatGenerics>(c),\n members: cidVsMembers[c.cid],\n messages: cidVsMessages[c.cid],\n pinned_messages: [],\n read: cidVsReads[c.cid],\n }));\n};\n"],"mappings":";;;;;;AAEA,IAAAA,mBAAA,GAAAC,OAAA;AACA,IAAAC,WAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AACA,IAAAG,eAAA,GAAAH,OAAA;AAGA,IAAAI,qBAAA,GAAAJ,OAAA;AACA,IAAAK,kBAAA,GAAAL,OAAA;AAWO,IAAMM,WAAW,GAAG,SAAdA,WAAWA,CAAAC,IAAA,EAQ0C;EAAA,IALhEC,UAAU,GAAAD,IAAA,CAAVC,UAAU;IACVC,aAAa,GAAAF,IAAA,CAAbE,aAAa;EAKbC,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,aAAa,EAAE;IAAEH,UAAU,EAAVA,UAAU;IAAEC,aAAa,EAAbA;EAAc,CAAC,CAAC;EAChF,IAAMG,QAAQ,GAAG,IAAAC,8BAAc,EAAC;IAAEL,UAAU,EAAVA;EAAW,CAAC,CAAC;EAE/C,IAAMM,YAAY,GAAG,IAAAC,sBAAU,EAAqB;IAAEP,UAAU,EAAVA;EAAW,CAAC,CAAC;EACnE,IAAMQ,UAAU,GAAG,IAAAC,kBAAQ,EAAqB;IAAET,UAAU,EAAVA;EAAW,CAAC,CAAC;EAC/D,IAAMU,aAAa,GAAG,IAAAC,sCAAkB,EAAqB;IAC3DX,UAAU,EAAVA,UAAU;IACVC,aAAa,EAAbA;EACF,CAAC,CAAC;EAGF,OAAOG,QAAQ,CAACQ,GAAG,CAAC,UAACC,CAAC;IAAA,WAAAC,SAAA,iBACjB,IAAAC,0CAAoB,EAAqBF,CAAC,CAAC;MAC9CG,OAAO,EAAEV,YAAY,CAACO,CAAC,CAACI,GAAG,CAAC;MAC5BC,QAAQ,EAAER,aAAa,CAACG,CAAC,CAACI,GAAG,CAAC;MAC9BE,eAAe,EAAE,EAAE;MACnBC,IAAI,EAAEZ,UAAU,CAACK,CAAC,CAACI,GAAG;IAAC;EAAA,CACvB,CAAC;AACL,CAAC;AAACI,OAAA,CAAAvB,WAAA,GAAAA,WAAA"}
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
exports.getChannelsForFilterSort = void 0;
|
|
5
5
|
var _getChannels = require("./getChannels");
|
|
6
6
|
var _selectChannelIdsForFilterSort = require("./queries/selectChannelIdsForFilterSort");
|
|
7
|
+
var _QuickSqliteClient = require("../QuickSqliteClient");
|
|
7
8
|
var getChannelsForFilterSort = function getChannelsForFilterSort(_ref) {
|
|
8
9
|
var currentUserId = _ref.currentUserId,
|
|
9
10
|
filters = _ref.filters,
|
|
@@ -12,6 +13,10 @@ var getChannelsForFilterSort = function getChannelsForFilterSort(_ref) {
|
|
|
12
13
|
console.warn('Please provide the query (filters/sort) to fetch channels from DB');
|
|
13
14
|
return null;
|
|
14
15
|
}
|
|
16
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'getChannelsForFilterSort', {
|
|
17
|
+
filters: filters,
|
|
18
|
+
sort: sort
|
|
19
|
+
});
|
|
15
20
|
var channelIds = (0, _selectChannelIdsForFilterSort.selectChannelIdsForFilterSort)({
|
|
16
21
|
filters: filters,
|
|
17
22
|
sort: sort
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_getChannels","require","_selectChannelIdsForFilterSort","getChannelsForFilterSort","_ref","currentUserId","filters","sort","console","warn","channelIds","selectChannelIdsForFilterSort","length","getChannels","exports"],"sources":["getChannelsForFilterSort.ts"],"sourcesContent":["import type { DefaultStreamChatGenerics } from 'src/types/types';\nimport type { ChannelAPIResponse, ChannelFilters, ChannelSort } from 'stream-chat';\n\nimport { getChannels } from './getChannels';\nimport { selectChannelIdsForFilterSort } from './queries/selectChannelIdsForFilterSort';\n\n/**\n * Gets the channels from database for given filter and sort query.\n *\n * @param {Object} param\n * @param {string} param.currentUserId Id of current logged in user\n * @param {Object} param.filters Filters for channels https://getstream.io/chat/docs/javascript/query_channels/?language=javascript&q=su#query-parameters\n * @param {Object} param.sort Sort for channels https://getstream.io/chat/docs/javascript/query_channels/?language=javascript&q=su#query-parameters\n *\n * @returns Array of channels corresponding to filters & sort. Returns null if filters + sort query doesn't exist in \"channelQueries\" table.\n */\nexport const getChannelsForFilterSort = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n currentUserId,\n filters,\n sort,\n}: {\n currentUserId: string;\n filters?: ChannelFilters<StreamChatGenerics>;\n sort?: ChannelSort<StreamChatGenerics>;\n}): Omit<ChannelAPIResponse<StreamChatGenerics>, 'duration'>[] | null => {\n if (!filters && !sort) {\n console.warn('Please provide the query (filters/sort) to fetch channels from DB');\n return null;\n }\n\n const channelIds = selectChannelIdsForFilterSort({ filters, sort });\n\n if (!channelIds) return null;\n\n if (channelIds.length === 0) {\n return [];\n }\n\n return getChannels({\n channelIds,\n currentUserId,\n });\n};\n"],"mappings":";;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAD,OAAA;AAYO,
|
|
1
|
+
{"version":3,"names":["_getChannels","require","_selectChannelIdsForFilterSort","_QuickSqliteClient","getChannelsForFilterSort","_ref","currentUserId","filters","sort","console","warn","QuickSqliteClient","logger","channelIds","selectChannelIdsForFilterSort","length","getChannels","exports"],"sources":["getChannelsForFilterSort.ts"],"sourcesContent":["import type { DefaultStreamChatGenerics } from 'src/types/types';\nimport type { ChannelAPIResponse, ChannelFilters, ChannelSort } from 'stream-chat';\n\nimport { getChannels } from './getChannels';\nimport { selectChannelIdsForFilterSort } from './queries/selectChannelIdsForFilterSort';\n\nimport { QuickSqliteClient } from '../QuickSqliteClient';\n\n/**\n * Gets the channels from database for given filter and sort query.\n *\n * @param {Object} param\n * @param {string} param.currentUserId Id of current logged in user\n * @param {Object} param.filters Filters for channels https://getstream.io/chat/docs/javascript/query_channels/?language=javascript&q=su#query-parameters\n * @param {Object} param.sort Sort for channels https://getstream.io/chat/docs/javascript/query_channels/?language=javascript&q=su#query-parameters\n *\n * @returns Array of channels corresponding to filters & sort. Returns null if filters + sort query doesn't exist in \"channelQueries\" table.\n */\nexport const getChannelsForFilterSort = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n currentUserId,\n filters,\n sort,\n}: {\n currentUserId: string;\n filters?: ChannelFilters<StreamChatGenerics>;\n sort?: ChannelSort<StreamChatGenerics>;\n}): Omit<ChannelAPIResponse<StreamChatGenerics>, 'duration'>[] | null => {\n if (!filters && !sort) {\n console.warn('Please provide the query (filters/sort) to fetch channels from DB');\n return null;\n }\n\n QuickSqliteClient.logger?.('info', 'getChannelsForFilterSort', { filters, sort });\n\n const channelIds = selectChannelIdsForFilterSort({ filters, sort });\n\n if (!channelIds) return null;\n\n if (channelIds.length === 0) {\n return [];\n }\n\n return getChannels({\n channelIds,\n currentUserId,\n });\n};\n"],"mappings":";;;;AAGA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,8BAAA,GAAAD,OAAA;AAEA,IAAAE,kBAAA,GAAAF,OAAA;AAYO,IAAMG,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAAC,IAAA,EAUoC;EAAA,IAPvEC,aAAa,GAAAD,IAAA,CAAbC,aAAa;IACbC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IACPC,IAAI,GAAAH,IAAA,CAAJG,IAAI;EAMJ,IAAI,CAACD,OAAO,IAAI,CAACC,IAAI,EAAE;IACrBC,OAAO,CAACC,IAAI,CAAC,mEAAmE,CAAC;IACjF,OAAO,IAAI;EACb;EAEAC,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,0BAA0B,EAAE;IAAEL,OAAO,EAAPA,OAAO;IAAEC,IAAI,EAAJA;EAAK,CAAC,CAAC;EAEjF,IAAMK,UAAU,GAAG,IAAAC,4DAA6B,EAAC;IAAEP,OAAO,EAAPA,OAAO;IAAEC,IAAI,EAAJA;EAAK,CAAC,CAAC;EAEnE,IAAI,CAACK,UAAU,EAAE,OAAO,IAAI;EAE5B,IAAIA,UAAU,CAACE,MAAM,KAAK,CAAC,EAAE;IAC3B,OAAO,EAAE;EACX;EAEA,OAAO,IAAAC,wBAAW,EAAC;IACjBH,UAAU,EAAVA,UAAU;IACVP,aAAa,EAAbA;EACF,CAAC,CAAC;AACJ,CAAC;AAACW,OAAA,CAAAb,wBAAA,GAAAA,wBAAA"}
|
|
@@ -7,6 +7,9 @@ var _createSelectQuery = require("../sqlite-utils/createSelectQuery");
|
|
|
7
7
|
var getLastSyncedAt = function getLastSyncedAt(_ref) {
|
|
8
8
|
var _result$;
|
|
9
9
|
var currentUserId = _ref.currentUserId;
|
|
10
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'getLastSyncedAt', {
|
|
11
|
+
currentUserId: currentUserId
|
|
12
|
+
});
|
|
10
13
|
var result = _QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, (0, _createSelectQuery.createSelectQuery)('userSyncStatus', ['*'], {
|
|
11
14
|
userId: currentUserId
|
|
12
15
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_QuickSqliteClient","require","_createSelectQuery","getLastSyncedAt","_ref","_result$","currentUserId","
|
|
1
|
+
{"version":3,"names":["_QuickSqliteClient","require","_createSelectQuery","getLastSyncedAt","_ref","_result$","currentUserId","QuickSqliteClient","logger","result","executeSql","apply","createSelectQuery","userId","lastSyncedAt","exports"],"sources":["getLastSyncedAt.ts"],"sourcesContent":["import { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createSelectQuery } from '../sqlite-utils/createSelectQuery';\n\nexport const getLastSyncedAt = ({\n currentUserId,\n}: {\n currentUserId: string;\n}): number | undefined => {\n QuickSqliteClient.logger?.('info', 'getLastSyncedAt', { currentUserId });\n const result = QuickSqliteClient.executeSql.apply(\n null,\n createSelectQuery('userSyncStatus', ['*'], {\n userId: currentUserId,\n }),\n );\n\n return result[0]?.lastSyncedAt;\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,IAAME,eAAe,GAAG,SAAlBA,eAAeA,CAAAC,IAAA,EAIF;EAAA,IAAAC,QAAA;EAAA,IAHxBC,aAAa,GAAAF,IAAA,CAAbE,aAAa;EAIbC,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,iBAAiB,EAAE;IAAEF,aAAa,EAAbA;EAAc,CAAC,CAAC;EACxE,IAAMG,MAAM,GAAGF,oCAAiB,CAACG,UAAU,CAACC,KAAK,CAC/C,IAAI,EACJ,IAAAC,oCAAiB,EAAC,gBAAgB,EAAE,CAAC,GAAG,CAAC,EAAE;IACzCC,MAAM,EAAEP;EACV,CAAC,CACH,CAAC;EAED,QAAAD,QAAA,GAAOI,MAAM,CAAC,CAAC,CAAC,qBAATJ,QAAA,CAAWS,YAAY;AAChC,CAAC;AAACC,OAAA,CAAAZ,eAAA,GAAAA,eAAA"}
|
|
@@ -4,8 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
exports.getMembers = void 0;
|
|
5
5
|
var _selectMembersForChannels = require("./queries/selectMembersForChannels");
|
|
6
6
|
var _mapStorableToMember = require("../mappers/mapStorableToMember");
|
|
7
|
+
var _QuickSqliteClient = require("../QuickSqliteClient");
|
|
7
8
|
var getMembers = function getMembers(_ref) {
|
|
8
9
|
var channelIds = _ref.channelIds;
|
|
10
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'getMembers', {
|
|
11
|
+
channelIds: channelIds
|
|
12
|
+
});
|
|
9
13
|
var memberRows = (0, _selectMembersForChannels.selectMembersForChannels)(channelIds);
|
|
10
14
|
var cidVsMembers = {};
|
|
11
15
|
memberRows.forEach(function (member) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_selectMembersForChannels","require","_mapStorableToMember","getMembers","_ref","channelIds","memberRows","selectMembersForChannels","cidVsMembers","forEach","member","cid","push","mapStorableToMember","exports"],"sources":["getMembers.ts"],"sourcesContent":["import type { ChannelMemberResponse } from 'stream-chat';\n\nimport { selectMembersForChannels } from './queries/selectMembersForChannels';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { mapStorableToMember } from '../mappers/mapStorableToMember';\n\nexport const getMembers = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n channelIds,\n}: {\n channelIds: string[];\n}) => {\n const memberRows = selectMembersForChannels(channelIds);\n const cidVsMembers: Record<string, ChannelMemberResponse<StreamChatGenerics>[]> = {};\n memberRows.forEach((member) => {\n if (!cidVsMembers[member.cid]) {\n cidVsMembers[member.cid] = [];\n }\n\n cidVsMembers[member.cid].push(mapStorableToMember<StreamChatGenerics>(member));\n });\n\n return cidVsMembers;\n};\n"],"mappings":";;;;AAEA,IAAAA,yBAAA,GAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AAEO,
|
|
1
|
+
{"version":3,"names":["_selectMembersForChannels","require","_mapStorableToMember","_QuickSqliteClient","getMembers","_ref","channelIds","QuickSqliteClient","logger","memberRows","selectMembersForChannels","cidVsMembers","forEach","member","cid","push","mapStorableToMember","exports"],"sources":["getMembers.ts"],"sourcesContent":["import type { ChannelMemberResponse } from 'stream-chat';\n\nimport { selectMembersForChannels } from './queries/selectMembersForChannels';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { mapStorableToMember } from '../mappers/mapStorableToMember';\nimport { QuickSqliteClient } from '../QuickSqliteClient';\n\nexport const getMembers = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n channelIds,\n}: {\n channelIds: string[];\n}) => {\n QuickSqliteClient.logger?.('info', 'getMembers', { channelIds });\n const memberRows = selectMembersForChannels(channelIds);\n const cidVsMembers: Record<string, ChannelMemberResponse<StreamChatGenerics>[]> = {};\n memberRows.forEach((member) => {\n if (!cidVsMembers[member.cid]) {\n cidVsMembers[member.cid] = [];\n }\n\n cidVsMembers[member.cid].push(mapStorableToMember<StreamChatGenerics>(member));\n });\n\n return cidVsMembers;\n};\n"],"mappings":";;;;AAEA,IAAAA,yBAAA,GAAAC,OAAA;AAGA,IAAAC,oBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AAEO,IAAMG,UAAU,GAAG,SAAbA,UAAUA,CAAAC,IAAA,EAMjB;EAAA,IAHJC,UAAU,GAAAD,IAAA,CAAVC,UAAU;EAIVC,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,YAAY,EAAE;IAAEF,UAAU,EAAVA;EAAW,CAAC,CAAC;EAChE,IAAMG,UAAU,GAAG,IAAAC,kDAAwB,EAACJ,UAAU,CAAC;EACvD,IAAMK,YAAyE,GAAG,CAAC,CAAC;EACpFF,UAAU,CAACG,OAAO,CAAC,UAACC,MAAM,EAAK;IAC7B,IAAI,CAACF,YAAY,CAACE,MAAM,CAACC,GAAG,CAAC,EAAE;MAC7BH,YAAY,CAACE,MAAM,CAACC,GAAG,CAAC,GAAG,EAAE;IAC/B;IAEAH,YAAY,CAACE,MAAM,CAACC,GAAG,CAAC,CAACC,IAAI,CAAC,IAAAC,wCAAmB,EAAqBH,MAAM,CAAC,CAAC;EAChF,CAAC,CAAC;EAEF,OAAOF,YAAY;AACrB,CAAC;AAACM,OAAA,CAAAb,UAAA,GAAAA,UAAA"}
|
|
@@ -10,6 +10,9 @@ var getPendingTasks = function getPendingTasks() {
|
|
|
10
10
|
var query = (0, _createSelectQuery.createSelectQuery)('pendingTasks', ['*'], conditions, {
|
|
11
11
|
createdAt: 1
|
|
12
12
|
});
|
|
13
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'getPendingTasks', {
|
|
14
|
+
conditions: conditions
|
|
15
|
+
});
|
|
13
16
|
var result = _QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, query);
|
|
14
17
|
return result.map(function (r) {
|
|
15
18
|
return (0, _mapStorableToTask.mapStorableToTask)(r);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_mapStorableToTask","require","_QuickSqliteClient","_createSelectQuery","getPendingTasks","conditions","arguments","length","undefined","query","createSelectQuery","createdAt","
|
|
1
|
+
{"version":3,"names":["_mapStorableToTask","require","_QuickSqliteClient","_createSelectQuery","getPendingTasks","conditions","arguments","length","undefined","query","createSelectQuery","createdAt","QuickSqliteClient","logger","result","executeSql","apply","map","r","mapStorableToTask","exports"],"sources":["getPendingTasks.ts"],"sourcesContent":["import { mapStorableToTask } from '../mappers/mapStorableToTask';\nimport { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createSelectQuery } from '../sqlite-utils/createSelectQuery';\nimport type { TableRowJoinedUser } from '../types';\n\nexport const getPendingTasks = (conditions: { messageId?: string } = {}) => {\n const query = createSelectQuery('pendingTasks', ['*'], conditions, {\n createdAt: 1,\n });\n\n QuickSqliteClient.logger?.('info', 'getPendingTasks', { conditions });\n const result = QuickSqliteClient.executeSql.apply(null, query);\n\n return result.map((r: TableRowJoinedUser<'pendingTasks'>) => mapStorableToTask(r));\n};\n"],"mappings":";;;;AAAA,IAAAA,kBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AAGO,IAAMG,eAAe,GAAG,SAAlBA,eAAeA,CAAA,EAAgD;EAAA,IAA5CC,UAAkC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,CAAC,CAAC;EACrE,IAAMG,KAAK,GAAG,IAAAC,oCAAiB,EAAC,cAAc,EAAE,CAAC,GAAG,CAAC,EAAEL,UAAU,EAAE;IACjEM,SAAS,EAAE;EACb,CAAC,CAAC;EAEFC,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,iBAAiB,EAAE;IAAER,UAAU,EAAVA;EAAW,CAAC,CAAC;EACrE,IAAMS,MAAM,GAAGF,oCAAiB,CAACG,UAAU,CAACC,KAAK,CAAC,IAAI,EAAEP,KAAK,CAAC;EAE9D,OAAOK,MAAM,CAACG,GAAG,CAAC,UAACC,CAAqC;IAAA,OAAK,IAAAC,oCAAiB,EAACD,CAAC,CAAC;EAAA,EAAC;AACpF,CAAC;AAACE,OAAA,CAAAhB,eAAA,GAAAA,eAAA"}
|
|
@@ -4,8 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
exports.getReads = void 0;
|
|
5
5
|
var _selectReadsForChannels = require("./queries/selectReadsForChannels");
|
|
6
6
|
var _mapStorableToRead = require("../mappers/mapStorableToRead");
|
|
7
|
+
var _QuickSqliteClient = require("../QuickSqliteClient");
|
|
7
8
|
var getReads = function getReads(_ref) {
|
|
8
9
|
var channelIds = _ref.channelIds;
|
|
10
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'getReads', {
|
|
11
|
+
channelIds: channelIds
|
|
12
|
+
});
|
|
9
13
|
var reads = (0, _selectReadsForChannels.selectReadsForChannels)(channelIds);
|
|
10
14
|
var cidVsReads = {};
|
|
11
15
|
reads.forEach(function (read) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_selectReadsForChannels","require","_mapStorableToRead","getReads","_ref","channelIds","reads","selectReadsForChannels","cidVsReads","forEach","read","cid","push","mapStorableToRead","exports"],"sources":["getReads.ts"],"sourcesContent":["import type { ReadResponse } from 'stream-chat';\n\nimport { selectReadsForChannels } from './queries/selectReadsForChannels';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { mapStorableToRead } from '../mappers/mapStorableToRead';\n\nexport const getReads = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n channelIds,\n}: {\n channelIds: string[];\n}) => {\n const reads = selectReadsForChannels(channelIds);\n const cidVsReads: Record<string, ReadResponse<StreamChatGenerics>[]> = {};\n\n reads.forEach((read) => {\n if (!cidVsReads[read.cid]) {\n cidVsReads[read.cid] = [];\n }\n cidVsReads[read.cid].push(mapStorableToRead<StreamChatGenerics>(read));\n });\n\n return cidVsReads;\n};\n"],"mappings":";;;;AAEA,IAAAA,uBAAA,GAAAC,OAAA;AAGA,IAAAC,kBAAA,GAAAD,OAAA;AAEO,
|
|
1
|
+
{"version":3,"names":["_selectReadsForChannels","require","_mapStorableToRead","_QuickSqliteClient","getReads","_ref","channelIds","QuickSqliteClient","logger","reads","selectReadsForChannels","cidVsReads","forEach","read","cid","push","mapStorableToRead","exports"],"sources":["getReads.ts"],"sourcesContent":["import type { ReadResponse } from 'stream-chat';\n\nimport { selectReadsForChannels } from './queries/selectReadsForChannels';\n\nimport type { DefaultStreamChatGenerics } from '../../types/types';\nimport { mapStorableToRead } from '../mappers/mapStorableToRead';\nimport { QuickSqliteClient } from '../QuickSqliteClient';\n\nexport const getReads = <\n StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,\n>({\n channelIds,\n}: {\n channelIds: string[];\n}) => {\n QuickSqliteClient.logger?.('info', 'getReads', { channelIds });\n const reads = selectReadsForChannels(channelIds);\n const cidVsReads: Record<string, ReadResponse<StreamChatGenerics>[]> = {};\n\n reads.forEach((read) => {\n if (!cidVsReads[read.cid]) {\n cidVsReads[read.cid] = [];\n }\n cidVsReads[read.cid].push(mapStorableToRead<StreamChatGenerics>(read));\n });\n\n return cidVsReads;\n};\n"],"mappings":";;;;AAEA,IAAAA,uBAAA,GAAAC,OAAA;AAGA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AAEO,IAAMG,QAAQ,GAAG,SAAXA,QAAQA,CAAAC,IAAA,EAMf;EAAA,IAHJC,UAAU,GAAAD,IAAA,CAAVC,UAAU;EAIVC,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,UAAU,EAAE;IAAEF,UAAU,EAAVA;EAAW,CAAC,CAAC;EAC9D,IAAMG,KAAK,GAAG,IAAAC,8CAAsB,EAACJ,UAAU,CAAC;EAChD,IAAMK,UAA8D,GAAG,CAAC,CAAC;EAEzEF,KAAK,CAACG,OAAO,CAAC,UAACC,IAAI,EAAK;IACtB,IAAI,CAACF,UAAU,CAACE,IAAI,CAACC,GAAG,CAAC,EAAE;MACzBH,UAAU,CAACE,IAAI,CAACC,GAAG,CAAC,GAAG,EAAE;IAC3B;IACAH,UAAU,CAACE,IAAI,CAACC,GAAG,CAAC,CAACC,IAAI,CAAC,IAAAC,oCAAiB,EAAqBH,IAAI,CAAC,CAAC;EACxE,CAAC,CAAC;EAEF,OAAOF,UAAU;AACnB,CAAC;AAACM,OAAA,CAAAb,QAAA,GAAAA,QAAA"}
|
|
@@ -10,8 +10,13 @@ var insertReaction = function insertReaction(_ref) {
|
|
|
10
10
|
flush = _ref$flush === void 0 ? true : _ref$flush,
|
|
11
11
|
reaction = _ref.reaction;
|
|
12
12
|
var queries = [];
|
|
13
|
-
|
|
13
|
+
var storableReaction = (0, _mapReactionToStorable.mapReactionToStorable)(reaction);
|
|
14
|
+
queries.push((0, _createUpsertQuery.createUpsertQuery)('reactions', storableReaction));
|
|
14
15
|
queries.push(['UPDATE messages SET reactionCounts = reactionCounts + 1 WHERE id = ?', [reaction.message_id]]);
|
|
16
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'insertReaction', {
|
|
17
|
+
flush: flush,
|
|
18
|
+
reaction: storableReaction
|
|
19
|
+
});
|
|
15
20
|
if (flush) {
|
|
16
21
|
_QuickSqliteClient.QuickSqliteClient.executeSqlBatch(queries);
|
|
17
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_mapReactionToStorable","require","_QuickSqliteClient","_createUpsertQuery","insertReaction","_ref","_ref$flush","flush","reaction","queries","
|
|
1
|
+
{"version":3,"names":["_mapReactionToStorable","require","_QuickSqliteClient","_createUpsertQuery","insertReaction","_ref","_ref$flush","flush","reaction","queries","storableReaction","mapReactionToStorable","push","createUpsertQuery","message_id","QuickSqliteClient","logger","executeSqlBatch","exports"],"sources":["insertReaction.ts"],"sourcesContent":["import type { ReactionResponse } from 'stream-chat';\n\nimport { mapReactionToStorable } from '../mappers/mapReactionToStorable';\nimport { QuickSqliteClient } from '../QuickSqliteClient';\nimport { createUpsertQuery } from '../sqlite-utils/createUpsertQuery';\nimport type { PreparedQueries } from '../types';\n\nexport const insertReaction = ({\n flush = true,\n reaction,\n}: {\n reaction: ReactionResponse;\n flush?: boolean;\n}) => {\n const queries: PreparedQueries[] = [];\n\n const storableReaction = mapReactionToStorable(reaction);\n\n queries.push(createUpsertQuery('reactions', storableReaction));\n\n queries.push([\n 'UPDATE messages SET reactionCounts = reactionCounts + 1 WHERE id = ?',\n [reaction.message_id],\n ]);\n\n QuickSqliteClient.logger?.('info', 'insertReaction', {\n flush,\n reaction: storableReaction,\n });\n\n if (flush) {\n QuickSqliteClient.executeSqlBatch(queries);\n }\n\n return queries;\n};\n"],"mappings":";;;;AAEA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAD,OAAA;AACA,IAAAE,kBAAA,GAAAF,OAAA;AAGO,IAAMG,cAAc,GAAG,SAAjBA,cAAcA,CAAAC,IAAA,EAMrB;EAAA,IAAAC,UAAA,GAAAD,IAAA,CALJE,KAAK;IAALA,KAAK,GAAAD,UAAA,cAAG,IAAI,GAAAA,UAAA;IACZE,QAAQ,GAAAH,IAAA,CAARG,QAAQ;EAKR,IAAMC,OAA0B,GAAG,EAAE;EAErC,IAAMC,gBAAgB,GAAG,IAAAC,4CAAqB,EAACH,QAAQ,CAAC;EAExDC,OAAO,CAACG,IAAI,CAAC,IAAAC,oCAAiB,EAAC,WAAW,EAAEH,gBAAgB,CAAC,CAAC;EAE9DD,OAAO,CAACG,IAAI,CAAC,CACX,sEAAsE,EACtE,CAACJ,QAAQ,CAACM,UAAU,CAAC,CACtB,CAAC;EAEFC,oCAAiB,CAACC,MAAM,oBAAxBD,oCAAiB,CAACC,MAAM,CAAG,MAAM,EAAE,gBAAgB,EAAE;IACnDT,KAAK,EAALA,KAAK;IACLC,QAAQ,EAAEE;EACZ,CAAC,CAAC;EAEF,IAAIH,KAAK,EAAE;IACTQ,oCAAiB,CAACE,eAAe,CAACR,OAAO,CAAC;EAC5C;EAEA,OAAOA,OAAO;AAChB,CAAC;AAACS,OAAA,CAAAd,cAAA,GAAAA,cAAA"}
|
|
@@ -13,6 +13,9 @@ var selectChannelIdsForFilterSort = function selectChannelIdsForFilterSort(_ref)
|
|
|
13
13
|
filters: filters,
|
|
14
14
|
sort: sort
|
|
15
15
|
});
|
|
16
|
+
_QuickSqliteClient.QuickSqliteClient.logger == null ? void 0 : _QuickSqliteClient.QuickSqliteClient.logger('info', 'selectChannelIdsForFilterSort', {
|
|
17
|
+
query: query
|
|
18
|
+
});
|
|
16
19
|
var results = _QuickSqliteClient.QuickSqliteClient.executeSql.apply(null, (0, _createSelectQuery.createSelectQuery)('channelQueries', ['*'], {
|
|
17
20
|
id: query
|
|
18
21
|
}));
|