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.
Files changed (226) hide show
  1. package/lib/commonjs/i18n/es.json +40 -40
  2. package/lib/commonjs/i18n/fr.json +40 -40
  3. package/lib/commonjs/i18n/he.json +40 -40
  4. package/lib/commonjs/i18n/hi.json +40 -40
  5. package/lib/commonjs/i18n/it.json +40 -40
  6. package/lib/commonjs/i18n/ja.json +40 -40
  7. package/lib/commonjs/i18n/ko.json +40 -40
  8. package/lib/commonjs/i18n/nl.json +40 -40
  9. package/lib/commonjs/i18n/pt-BR.json +40 -40
  10. package/lib/commonjs/i18n/ru.json +40 -40
  11. package/lib/commonjs/i18n/tr.json +40 -40
  12. package/lib/commonjs/store/QuickSqliteClient.js +37 -2
  13. package/lib/commonjs/store/QuickSqliteClient.js.map +1 -1
  14. package/lib/commonjs/store/apis/addPendingTask.js +16 -4
  15. package/lib/commonjs/store/apis/addPendingTask.js.map +1 -1
  16. package/lib/commonjs/store/apis/deleteChannel.js +4 -0
  17. package/lib/commonjs/store/apis/deleteChannel.js.map +1 -1
  18. package/lib/commonjs/store/apis/deleteMember.js +5 -0
  19. package/lib/commonjs/store/apis/deleteMember.js.map +1 -1
  20. package/lib/commonjs/store/apis/deleteMessage.js +4 -0
  21. package/lib/commonjs/store/apis/deleteMessage.js.map +1 -1
  22. package/lib/commonjs/store/apis/deleteMessagesForChannel.js +4 -0
  23. package/lib/commonjs/store/apis/deleteMessagesForChannel.js.map +1 -1
  24. package/lib/commonjs/store/apis/deletePendingTask.js +3 -0
  25. package/lib/commonjs/store/apis/deletePendingTask.js.map +1 -1
  26. package/lib/commonjs/store/apis/deleteReaction.js +5 -0
  27. package/lib/commonjs/store/apis/deleteReaction.js.map +1 -1
  28. package/lib/commonjs/store/apis/deleteReactions.js +5 -3
  29. package/lib/commonjs/store/apis/deleteReactions.js.map +1 -1
  30. package/lib/commonjs/store/apis/getAllChannelIds.js +2 -0
  31. package/lib/commonjs/store/apis/getAllChannelIds.js.map +1 -1
  32. package/lib/commonjs/store/apis/getAppSettings.js +3 -0
  33. package/lib/commonjs/store/apis/getAppSettings.js.map +1 -1
  34. package/lib/commonjs/store/apis/getChannelMessages.js +5 -0
  35. package/lib/commonjs/store/apis/getChannelMessages.js.map +1 -1
  36. package/lib/commonjs/store/apis/getChannels.js +5 -0
  37. package/lib/commonjs/store/apis/getChannels.js.map +1 -1
  38. package/lib/commonjs/store/apis/getChannelsForFilterSort.js +5 -0
  39. package/lib/commonjs/store/apis/getChannelsForFilterSort.js.map +1 -1
  40. package/lib/commonjs/store/apis/getLastSyncedAt.js +3 -0
  41. package/lib/commonjs/store/apis/getLastSyncedAt.js.map +1 -1
  42. package/lib/commonjs/store/apis/getMembers.js +4 -0
  43. package/lib/commonjs/store/apis/getMembers.js.map +1 -1
  44. package/lib/commonjs/store/apis/getPendingTasks.js +3 -0
  45. package/lib/commonjs/store/apis/getPendingTasks.js.map +1 -1
  46. package/lib/commonjs/store/apis/getReads.js +4 -0
  47. package/lib/commonjs/store/apis/getReads.js.map +1 -1
  48. package/lib/commonjs/store/apis/insertReaction.js +6 -1
  49. package/lib/commonjs/store/apis/insertReaction.js.map +1 -1
  50. package/lib/commonjs/store/apis/queries/selectChannelIdsForFilterSort.js +3 -0
  51. package/lib/commonjs/store/apis/queries/selectChannelIdsForFilterSort.js.map +1 -1
  52. package/lib/commonjs/store/apis/queries/selectChannels.js +3 -0
  53. package/lib/commonjs/store/apis/queries/selectChannels.js.map +1 -1
  54. package/lib/commonjs/store/apis/queries/selectMembersForChannels.js +3 -0
  55. package/lib/commonjs/store/apis/queries/selectMembersForChannels.js.map +1 -1
  56. package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js +3 -0
  57. package/lib/commonjs/store/apis/queries/selectMessagesForChannels.js.map +1 -1
  58. package/lib/commonjs/store/apis/queries/selectReactionsForMessages.js +3 -0
  59. package/lib/commonjs/store/apis/queries/selectReactionsForMessages.js.map +1 -1
  60. package/lib/commonjs/store/apis/queries/selectReadsForChannels.js +3 -0
  61. package/lib/commonjs/store/apis/queries/selectReadsForChannels.js.map +1 -1
  62. package/lib/commonjs/store/apis/updateMessage.js +18 -4
  63. package/lib/commonjs/store/apis/updateMessage.js.map +1 -1
  64. package/lib/commonjs/store/apis/updateReaction.js +12 -1
  65. package/lib/commonjs/store/apis/updateReaction.js.map +1 -1
  66. package/lib/commonjs/store/apis/upsertAppSettings.js +7 -1
  67. package/lib/commonjs/store/apis/upsertAppSettings.js.map +1 -1
  68. package/lib/commonjs/store/apis/upsertChannelData.js +6 -1
  69. package/lib/commonjs/store/apis/upsertChannelData.js.map +1 -1
  70. package/lib/commonjs/store/apis/upsertChannels.js +6 -3
  71. package/lib/commonjs/store/apis/upsertChannels.js.map +1 -1
  72. package/lib/commonjs/store/apis/upsertCidsForQuery.js +12 -5
  73. package/lib/commonjs/store/apis/upsertCidsForQuery.js.map +1 -1
  74. package/lib/commonjs/store/apis/upsertMembers.js +15 -3
  75. package/lib/commonjs/store/apis/upsertMembers.js.map +1 -1
  76. package/lib/commonjs/store/apis/upsertMessages.js +20 -8
  77. package/lib/commonjs/store/apis/upsertMessages.js.map +1 -1
  78. package/lib/commonjs/store/apis/upsertReads.js +18 -3
  79. package/lib/commonjs/store/apis/upsertReads.js.map +1 -1
  80. package/lib/commonjs/store/apis/upsertUserSyncStatus.js +4 -0
  81. package/lib/commonjs/store/apis/upsertUserSyncStatus.js.map +1 -1
  82. package/lib/commonjs/version.json +1 -1
  83. package/lib/module/i18n/es.json +40 -40
  84. package/lib/module/i18n/fr.json +40 -40
  85. package/lib/module/i18n/he.json +40 -40
  86. package/lib/module/i18n/hi.json +40 -40
  87. package/lib/module/i18n/it.json +40 -40
  88. package/lib/module/i18n/ja.json +40 -40
  89. package/lib/module/i18n/ko.json +40 -40
  90. package/lib/module/i18n/nl.json +40 -40
  91. package/lib/module/i18n/pt-BR.json +40 -40
  92. package/lib/module/i18n/ru.json +40 -40
  93. package/lib/module/i18n/tr.json +40 -40
  94. package/lib/module/store/QuickSqliteClient.js +37 -2
  95. package/lib/module/store/QuickSqliteClient.js.map +1 -1
  96. package/lib/module/store/apis/addPendingTask.js +16 -4
  97. package/lib/module/store/apis/addPendingTask.js.map +1 -1
  98. package/lib/module/store/apis/deleteChannel.js +4 -0
  99. package/lib/module/store/apis/deleteChannel.js.map +1 -1
  100. package/lib/module/store/apis/deleteMember.js +5 -0
  101. package/lib/module/store/apis/deleteMember.js.map +1 -1
  102. package/lib/module/store/apis/deleteMessage.js +4 -0
  103. package/lib/module/store/apis/deleteMessage.js.map +1 -1
  104. package/lib/module/store/apis/deleteMessagesForChannel.js +4 -0
  105. package/lib/module/store/apis/deleteMessagesForChannel.js.map +1 -1
  106. package/lib/module/store/apis/deletePendingTask.js +3 -0
  107. package/lib/module/store/apis/deletePendingTask.js.map +1 -1
  108. package/lib/module/store/apis/deleteReaction.js +5 -0
  109. package/lib/module/store/apis/deleteReaction.js.map +1 -1
  110. package/lib/module/store/apis/deleteReactions.js +5 -3
  111. package/lib/module/store/apis/deleteReactions.js.map +1 -1
  112. package/lib/module/store/apis/getAllChannelIds.js +2 -0
  113. package/lib/module/store/apis/getAllChannelIds.js.map +1 -1
  114. package/lib/module/store/apis/getAppSettings.js +3 -0
  115. package/lib/module/store/apis/getAppSettings.js.map +1 -1
  116. package/lib/module/store/apis/getChannelMessages.js +5 -0
  117. package/lib/module/store/apis/getChannelMessages.js.map +1 -1
  118. package/lib/module/store/apis/getChannels.js +5 -0
  119. package/lib/module/store/apis/getChannels.js.map +1 -1
  120. package/lib/module/store/apis/getChannelsForFilterSort.js +5 -0
  121. package/lib/module/store/apis/getChannelsForFilterSort.js.map +1 -1
  122. package/lib/module/store/apis/getLastSyncedAt.js +3 -0
  123. package/lib/module/store/apis/getLastSyncedAt.js.map +1 -1
  124. package/lib/module/store/apis/getMembers.js +4 -0
  125. package/lib/module/store/apis/getMembers.js.map +1 -1
  126. package/lib/module/store/apis/getPendingTasks.js +3 -0
  127. package/lib/module/store/apis/getPendingTasks.js.map +1 -1
  128. package/lib/module/store/apis/getReads.js +4 -0
  129. package/lib/module/store/apis/getReads.js.map +1 -1
  130. package/lib/module/store/apis/insertReaction.js +6 -1
  131. package/lib/module/store/apis/insertReaction.js.map +1 -1
  132. package/lib/module/store/apis/queries/selectChannelIdsForFilterSort.js +3 -0
  133. package/lib/module/store/apis/queries/selectChannelIdsForFilterSort.js.map +1 -1
  134. package/lib/module/store/apis/queries/selectChannels.js +3 -0
  135. package/lib/module/store/apis/queries/selectChannels.js.map +1 -1
  136. package/lib/module/store/apis/queries/selectMembersForChannels.js +3 -0
  137. package/lib/module/store/apis/queries/selectMembersForChannels.js.map +1 -1
  138. package/lib/module/store/apis/queries/selectMessagesForChannels.js +3 -0
  139. package/lib/module/store/apis/queries/selectMessagesForChannels.js.map +1 -1
  140. package/lib/module/store/apis/queries/selectReactionsForMessages.js +3 -0
  141. package/lib/module/store/apis/queries/selectReactionsForMessages.js.map +1 -1
  142. package/lib/module/store/apis/queries/selectReadsForChannels.js +3 -0
  143. package/lib/module/store/apis/queries/selectReadsForChannels.js.map +1 -1
  144. package/lib/module/store/apis/updateMessage.js +18 -4
  145. package/lib/module/store/apis/updateMessage.js.map +1 -1
  146. package/lib/module/store/apis/updateReaction.js +12 -1
  147. package/lib/module/store/apis/updateReaction.js.map +1 -1
  148. package/lib/module/store/apis/upsertAppSettings.js +7 -1
  149. package/lib/module/store/apis/upsertAppSettings.js.map +1 -1
  150. package/lib/module/store/apis/upsertChannelData.js +6 -1
  151. package/lib/module/store/apis/upsertChannelData.js.map +1 -1
  152. package/lib/module/store/apis/upsertChannels.js +6 -3
  153. package/lib/module/store/apis/upsertChannels.js.map +1 -1
  154. package/lib/module/store/apis/upsertCidsForQuery.js +12 -5
  155. package/lib/module/store/apis/upsertCidsForQuery.js.map +1 -1
  156. package/lib/module/store/apis/upsertMembers.js +15 -3
  157. package/lib/module/store/apis/upsertMembers.js.map +1 -1
  158. package/lib/module/store/apis/upsertMessages.js +20 -8
  159. package/lib/module/store/apis/upsertMessages.js.map +1 -1
  160. package/lib/module/store/apis/upsertReads.js +18 -3
  161. package/lib/module/store/apis/upsertReads.js.map +1 -1
  162. package/lib/module/store/apis/upsertUserSyncStatus.js +4 -0
  163. package/lib/module/store/apis/upsertUserSyncStatus.js.map +1 -1
  164. package/lib/module/version.json +1 -1
  165. package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +1 -1
  166. package/lib/typescript/i18n/es.json +40 -40
  167. package/lib/typescript/i18n/fr.json +40 -40
  168. package/lib/typescript/i18n/he.json +40 -40
  169. package/lib/typescript/i18n/hi.json +40 -40
  170. package/lib/typescript/i18n/it.json +40 -40
  171. package/lib/typescript/i18n/ja.json +40 -40
  172. package/lib/typescript/i18n/ko.json +40 -40
  173. package/lib/typescript/i18n/nl.json +40 -40
  174. package/lib/typescript/i18n/pt-BR.json +40 -40
  175. package/lib/typescript/i18n/ru.json +40 -40
  176. package/lib/typescript/i18n/tr.json +40 -40
  177. package/lib/typescript/store/QuickSqliteClient.d.ts +2 -0
  178. package/lib/typescript/store/apis/upsertMessages.d.ts +1 -2
  179. package/package.json +1 -1
  180. package/src/i18n/es.json +40 -40
  181. package/src/i18n/fr.json +40 -40
  182. package/src/i18n/he.json +40 -40
  183. package/src/i18n/hi.json +40 -40
  184. package/src/i18n/it.json +40 -40
  185. package/src/i18n/ja.json +40 -40
  186. package/src/i18n/ko.json +40 -40
  187. package/src/i18n/nl.json +40 -40
  188. package/src/i18n/pt-BR.json +40 -40
  189. package/src/i18n/ru.json +40 -40
  190. package/src/i18n/tr.json +40 -40
  191. package/src/store/QuickSqliteClient.ts +40 -3
  192. package/src/store/apis/addPendingTask.ts +20 -1
  193. package/src/store/apis/deleteChannel.ts +5 -0
  194. package/src/store/apis/deleteMember.ts +6 -0
  195. package/src/store/apis/deleteMessage.ts +6 -0
  196. package/src/store/apis/deleteMessagesForChannel.ts +6 -0
  197. package/src/store/apis/deletePendingTask.ts +4 -0
  198. package/src/store/apis/deleteReaction.ts +6 -0
  199. package/src/store/apis/deleteReactions.ts +5 -6
  200. package/src/store/apis/getAllChannelIds.ts +3 -0
  201. package/src/store/apis/getAppSettings.ts +3 -0
  202. package/src/store/apis/getChannelMessages.ts +5 -0
  203. package/src/store/apis/getChannels.ts +2 -0
  204. package/src/store/apis/getChannelsForFilterSort.ts +4 -0
  205. package/src/store/apis/getLastSyncedAt.ts +1 -0
  206. package/src/store/apis/getMembers.ts +2 -0
  207. package/src/store/apis/getPendingTasks.ts +1 -0
  208. package/src/store/apis/getReads.ts +2 -0
  209. package/src/store/apis/insertReaction.ts +8 -1
  210. package/src/store/apis/queries/selectChannelIdsForFilterSort.ts +5 -0
  211. package/src/store/apis/queries/selectChannels.ts +4 -0
  212. package/src/store/apis/queries/selectMembersForChannels.ts +4 -0
  213. package/src/store/apis/queries/selectMessagesForChannels.ts +4 -0
  214. package/src/store/apis/queries/selectReactionsForMessages.ts +4 -0
  215. package/src/store/apis/queries/selectReadsForChannels.ts +5 -0
  216. package/src/store/apis/updateMessage.ts +22 -4
  217. package/src/store/apis/updateReaction.ts +15 -1
  218. package/src/store/apis/upsertAppSettings.ts +8 -1
  219. package/src/store/apis/upsertChannelData.ts +6 -1
  220. package/src/store/apis/upsertChannels.ts +6 -1
  221. package/src/store/apis/upsertCidsForQuery.ts +10 -2
  222. package/src/store/apis/upsertMembers.ts +16 -10
  223. package/src/store/apis/upsertMessages.ts +21 -11
  224. package/src/store/apis/upsertReads.ts +13 -10
  225. package/src/store/apis/upsertUserSyncStatus.ts +5 -0
  226. package/src/version.json +1 -1
@@ -6,6 +6,11 @@ export const deleteChannel = ({ cid, flush = true }: { cid: string; flush?: bool
6
6
  cid,
7
7
  });
8
8
 
9
+ QuickSqliteClient.logger?.('info', 'deleteChannel', {
10
+ cid,
11
+ flush,
12
+ });
13
+
9
14
  if (flush) {
10
15
  QuickSqliteClient.executeSql.apply(null, query);
11
16
  }
@@ -17,6 +17,12 @@ export const deleteMember = ({
17
17
  userId: member.user_id,
18
18
  });
19
19
 
20
+ QuickSqliteClient.logger?.('info', 'deleteMember', {
21
+ cid,
22
+ flush,
23
+ userId: member.user_id,
24
+ });
25
+
20
26
  if (flush) {
21
27
  QuickSqliteClient.executeSql.apply(null, query);
22
28
  }
@@ -5,6 +5,12 @@ export const deleteMessage = ({ flush = true, id }: { id: string; flush?: boolea
5
5
  const query = createDeleteQuery('messages', {
6
6
  id,
7
7
  });
8
+
9
+ QuickSqliteClient.logger?.('info', 'deleteMessage', {
10
+ flush,
11
+ id,
12
+ });
13
+
8
14
  if (flush) {
9
15
  QuickSqliteClient.executeSql.apply(null, query);
10
16
  }
@@ -11,6 +11,12 @@ export const deleteMessagesForChannel = ({
11
11
  const query = createDeleteQuery('messages', {
12
12
  cid,
13
13
  });
14
+
15
+ QuickSqliteClient.logger?.('info', 'deleteMessagesForChannel', {
16
+ cid,
17
+ flush,
18
+ });
19
+
14
20
  if (flush) {
15
21
  QuickSqliteClient.executeSql.apply(null, query);
16
22
  }
@@ -6,6 +6,10 @@ export const deletePendingTask = ({ id }: { id: number }) => {
6
6
  id,
7
7
  });
8
8
 
9
+ QuickSqliteClient.logger?.('info', 'deletePendingTask', {
10
+ id,
11
+ });
12
+
9
13
  QuickSqliteClient.executeSql.apply(null, query);
10
14
 
11
15
  return [query];
@@ -18,6 +18,12 @@ export const deleteReaction = ({
18
18
  userId,
19
19
  });
20
20
 
21
+ QuickSqliteClient.logger?.('info', 'deleteReaction', {
22
+ messageId,
23
+ type: reactionType,
24
+ userId,
25
+ });
26
+
21
27
  if (flush) {
22
28
  QuickSqliteClient.executeSql.apply(null, query);
23
29
  }
@@ -11,13 +11,12 @@ export const deleteReactionsForMessage = ({
11
11
  const query = createDeleteQuery('reactions', {
12
12
  messageId,
13
13
  });
14
+ console.log('deleteReactionsForMessage', {
15
+ flush,
16
+ messageId,
17
+ });
14
18
  if (flush) {
15
- QuickSqliteClient.executeSql.apply(
16
- null,
17
- createDeleteQuery('reactions', {
18
- messageId,
19
- }),
20
- );
19
+ QuickSqliteClient.executeSql.apply(null, query);
21
20
  }
22
21
 
23
22
  return [query];
@@ -1,7 +1,10 @@
1
1
  import { selectChannels } from './queries/selectChannels';
2
2
 
3
+ import { QuickSqliteClient } from '../QuickSqliteClient';
4
+
3
5
  export const getAllChannelIds = () => {
4
6
  const channels = selectChannels();
5
7
 
8
+ QuickSqliteClient.logger?.('info', 'getAllChannelIds');
6
9
  return channels.map((c) => c.cid);
7
10
  };
@@ -8,6 +8,9 @@ export const getAppSettings = ({
8
8
  }: {
9
9
  currentUserId: string;
10
10
  }): AppSettingsAPIResponse => {
11
+ QuickSqliteClient.logger?.('info', 'getAppSettings', {
12
+ currentUserId,
13
+ });
11
14
  const result = QuickSqliteClient.executeSql.apply(
12
15
  null,
13
16
  createSelectQuery('userSyncStatus', ['*'], {
@@ -7,6 +7,7 @@ import { selectReactionsForMessages } from './queries/selectReactionsForMessages
7
7
  import type { DefaultStreamChatGenerics } from '../../types/types';
8
8
  import { isBlockedMessage } from '../../utils/utils';
9
9
  import { mapStorableToMessage } from '../mappers/mapStorableToMessage';
10
+ import { QuickSqliteClient } from '../QuickSqliteClient';
10
11
  import type { TableRowJoinedUser } from '../types';
11
12
 
12
13
  export const getChannelMessages = <
@@ -18,6 +19,10 @@ export const getChannelMessages = <
18
19
  channelIds: string[];
19
20
  currentUserId: string;
20
21
  }) => {
22
+ QuickSqliteClient.logger?.('info', 'getChannelMessages', {
23
+ channelIds,
24
+ currentUserId,
25
+ });
21
26
  const messageRows = selectMessagesForChannels(channelIds);
22
27
  const messageIds = messageRows.map(({ id }) => id);
23
28
 
@@ -7,6 +7,7 @@ import { selectChannels } from './queries/selectChannels';
7
7
 
8
8
  import type { DefaultStreamChatGenerics } from '../../types/types';
9
9
  import { mapStorableToChannel } from '../mappers/mapStorableToChannel';
10
+ import { QuickSqliteClient } from '../QuickSqliteClient';
10
11
 
11
12
  /**
12
13
  * Returns the list of channels with state enriched for given channel ids.
@@ -26,6 +27,7 @@ export const getChannels = <
26
27
  channelIds: string[];
27
28
  currentUserId: string;
28
29
  }): Omit<ChannelAPIResponse<StreamChatGenerics>, 'duration'>[] => {
30
+ QuickSqliteClient.logger?.('info', 'getChannels', { channelIds, currentUserId });
29
31
  const channels = selectChannels({ channelIds });
30
32
 
31
33
  const cidVsMembers = getMembers<StreamChatGenerics>({ channelIds });
@@ -4,6 +4,8 @@ import type { ChannelAPIResponse, ChannelFilters, ChannelSort } from 'stream-cha
4
4
  import { getChannels } from './getChannels';
5
5
  import { selectChannelIdsForFilterSort } from './queries/selectChannelIdsForFilterSort';
6
6
 
7
+ import { QuickSqliteClient } from '../QuickSqliteClient';
8
+
7
9
  /**
8
10
  * Gets the channels from database for given filter and sort query.
9
11
  *
@@ -30,6 +32,8 @@ export const getChannelsForFilterSort = <
30
32
  return null;
31
33
  }
32
34
 
35
+ QuickSqliteClient.logger?.('info', 'getChannelsForFilterSort', { filters, sort });
36
+
33
37
  const channelIds = selectChannelIdsForFilterSort({ filters, sort });
34
38
 
35
39
  if (!channelIds) return null;
@@ -6,6 +6,7 @@ export const getLastSyncedAt = ({
6
6
  }: {
7
7
  currentUserId: string;
8
8
  }): number | undefined => {
9
+ QuickSqliteClient.logger?.('info', 'getLastSyncedAt', { currentUserId });
9
10
  const result = QuickSqliteClient.executeSql.apply(
10
11
  null,
11
12
  createSelectQuery('userSyncStatus', ['*'], {
@@ -4,6 +4,7 @@ import { selectMembersForChannels } from './queries/selectMembersForChannels';
4
4
 
5
5
  import type { DefaultStreamChatGenerics } from '../../types/types';
6
6
  import { mapStorableToMember } from '../mappers/mapStorableToMember';
7
+ import { QuickSqliteClient } from '../QuickSqliteClient';
7
8
 
8
9
  export const getMembers = <
9
10
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
@@ -12,6 +13,7 @@ export const getMembers = <
12
13
  }: {
13
14
  channelIds: string[];
14
15
  }) => {
16
+ QuickSqliteClient.logger?.('info', 'getMembers', { channelIds });
15
17
  const memberRows = selectMembersForChannels(channelIds);
16
18
  const cidVsMembers: Record<string, ChannelMemberResponse<StreamChatGenerics>[]> = {};
17
19
  memberRows.forEach((member) => {
@@ -8,6 +8,7 @@ export const getPendingTasks = (conditions: { messageId?: string } = {}) => {
8
8
  createdAt: 1,
9
9
  });
10
10
 
11
+ QuickSqliteClient.logger?.('info', 'getPendingTasks', { conditions });
11
12
  const result = QuickSqliteClient.executeSql.apply(null, query);
12
13
 
13
14
  return result.map((r: TableRowJoinedUser<'pendingTasks'>) => mapStorableToTask(r));
@@ -4,6 +4,7 @@ import { selectReadsForChannels } from './queries/selectReadsForChannels';
4
4
 
5
5
  import type { DefaultStreamChatGenerics } from '../../types/types';
6
6
  import { mapStorableToRead } from '../mappers/mapStorableToRead';
7
+ import { QuickSqliteClient } from '../QuickSqliteClient';
7
8
 
8
9
  export const getReads = <
9
10
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
@@ -12,6 +13,7 @@ export const getReads = <
12
13
  }: {
13
14
  channelIds: string[];
14
15
  }) => {
16
+ QuickSqliteClient.logger?.('info', 'getReads', { channelIds });
15
17
  const reads = selectReadsForChannels(channelIds);
16
18
  const cidVsReads: Record<string, ReadResponse<StreamChatGenerics>[]> = {};
17
19
 
@@ -14,13 +14,20 @@ export const insertReaction = ({
14
14
  }) => {
15
15
  const queries: PreparedQueries[] = [];
16
16
 
17
- queries.push(createUpsertQuery('reactions', mapReactionToStorable(reaction)));
17
+ const storableReaction = mapReactionToStorable(reaction);
18
+
19
+ queries.push(createUpsertQuery('reactions', storableReaction));
18
20
 
19
21
  queries.push([
20
22
  'UPDATE messages SET reactionCounts = reactionCounts + 1 WHERE id = ?',
21
23
  [reaction.message_id],
22
24
  ]);
23
25
 
26
+ QuickSqliteClient.logger?.('info', 'insertReaction', {
27
+ flush,
28
+ reaction: storableReaction,
29
+ });
30
+
24
31
  if (flush) {
25
32
  QuickSqliteClient.executeSqlBatch(queries);
26
33
  }
@@ -26,6 +26,11 @@ export const selectChannelIdsForFilterSort = <
26
26
  sort?: ChannelSort<StreamChatGenerics>;
27
27
  }): string[] | null => {
28
28
  const query = convertFilterSortToQuery({ filters, sort });
29
+
30
+ QuickSqliteClient.logger?.('info', 'selectChannelIdsForFilterSort', {
31
+ query,
32
+ });
33
+
29
34
  const results = QuickSqliteClient.executeSql.apply(
30
35
  null,
31
36
  createSelectQuery('channelQueries', ['*'], {
@@ -15,6 +15,10 @@ export const selectChannels = ({
15
15
  : undefined,
16
16
  );
17
17
 
18
+ QuickSqliteClient.logger?.('info', 'selectChannels', {
19
+ channelIds,
20
+ });
21
+
18
22
  const result = QuickSqliteClient.executeSql.apply(null, query);
19
23
 
20
24
  if (channelIds) {
@@ -12,6 +12,10 @@ export const selectMembersForChannels = (cids: string[]): TableRowJoinedUser<'me
12
12
  .map((name) => `'${name}', b.${name}`)
13
13
  .join(', ');
14
14
 
15
+ QuickSqliteClient.logger?.('info', 'selectMembersForChannels', {
16
+ cids,
17
+ });
18
+
15
19
  const result = QuickSqliteClient.executeSql(
16
20
  `SELECT
17
21
  json_object(
@@ -11,6 +11,10 @@ export const selectMessagesForChannels = (cids: string[]): TableRowJoinedUser<'m
11
11
  .map((name) => `'${name}', b.${name}`)
12
12
  .join(', ');
13
13
 
14
+ QuickSqliteClient.logger?.('info', 'selectMessagesForChannels', {
15
+ cids,
16
+ });
17
+
14
18
  const result = QuickSqliteClient.executeSql(
15
19
  `SELECT
16
20
  json_object(
@@ -13,6 +13,10 @@ export const selectReactionsForMessages = (
13
13
  .map((name) => `'${name}', b.${name}`)
14
14
  .join(', ');
15
15
 
16
+ QuickSqliteClient.logger?.('info', 'selectReactionsForMessages', {
17
+ messageIds,
18
+ });
19
+
16
20
  const result = QuickSqliteClient.executeSql(
17
21
  `SELECT
18
22
  json_object(
@@ -10,6 +10,11 @@ export const selectReadsForChannels = (cids: string[]): TableRowJoinedUser<'read
10
10
  const userColumnNames = Object.keys(tables.users.columns)
11
11
  .map((name) => `'${name}', b.${name}`)
12
12
  .join(', ');
13
+
14
+ QuickSqliteClient.logger?.('info', 'selectReadsForChannels', {
15
+ cids,
16
+ });
17
+
13
18
  const result = QuickSqliteClient.executeSql(
14
19
  `SELECT
15
20
  json_object(
@@ -30,14 +30,20 @@ export const updateMessage = ({
30
30
  return queries;
31
31
  }
32
32
 
33
+ const storableMessage = mapMessageToStorable(message);
34
+
33
35
  queries.push(
34
- createUpdateQuery('messages', mapMessageToStorable(message), {
36
+ createUpdateQuery('messages', storableMessage, {
35
37
  id: message.id,
36
38
  }),
37
39
  );
38
40
 
41
+ const storableUsers: Array<ReturnType<typeof mapUserToStorable>> = [];
42
+
39
43
  if (message.user) {
40
- queries.push(createUpsertQuery('users', mapUserToStorable(message.user)));
44
+ const storableUser = mapUserToStorable(message.user);
45
+ storableUsers.push(storableUser);
46
+ queries.push(createUpsertQuery('users', storableUser));
41
47
  }
42
48
 
43
49
  queries.push(
@@ -49,12 +55,24 @@ export const updateMessage = ({
49
55
  const latestReactions = message.latest_reactions || [];
50
56
  const ownReactions = message.own_reactions || [];
51
57
 
58
+ const storableReactions: Array<ReturnType<typeof mapReactionToStorable>> = [];
59
+
52
60
  [...latestReactions, ...ownReactions].forEach((r) => {
53
61
  if (r.user) {
54
- queries.push(createUpsertQuery('users', mapUserToStorable(r.user)));
62
+ const storableUser = mapUserToStorable(r.user);
63
+ storableUsers.push(storableUser);
64
+ queries.push(createUpsertQuery('users', storableUser));
55
65
  }
56
66
 
57
- queries.push(createUpsertQuery('reactions', mapReactionToStorable(r)));
67
+ const storableReaction = mapReactionToStorable(r);
68
+ storableReactions.push(storableReaction);
69
+ queries.push(createUpsertQuery('reactions', storableReaction));
70
+ });
71
+
72
+ QuickSqliteClient.logger?.('info', 'updateMessage', {
73
+ message: storableMessage,
74
+ reactions: storableReactions,
75
+ users: storableUsers,
58
76
  });
59
77
 
60
78
  if (flush) {
@@ -18,20 +18,27 @@ export const updateReaction = ({
18
18
  flush?: boolean;
19
19
  }) => {
20
20
  const queries: PreparedQueries[] = [];
21
+ let storableUser: ReturnType<typeof mapUserToStorable> | undefined;
21
22
 
22
23
  if (reaction.user) {
24
+ storableUser = mapUserToStorable(reaction.user);
23
25
  queries.push(createUpsertQuery('users', mapUserToStorable(reaction.user)));
24
26
  }
25
27
 
28
+ const storableReaction = mapReactionToStorable(reaction);
29
+
26
30
  queries.push(
27
- createUpdateQuery('reactions', mapReactionToStorable(reaction), {
31
+ createUpdateQuery('reactions', storableReaction, {
28
32
  messageId: reaction.message_id,
29
33
  userId: reaction.user_id,
30
34
  }),
31
35
  );
32
36
 
37
+ let updatedReactionCounts: string | undefined;
38
+
33
39
  if (message.reaction_counts) {
34
40
  const { reactionCounts } = mapMessageToStorable(message);
41
+ updatedReactionCounts = reactionCounts;
35
42
 
36
43
  queries.push(
37
44
  createUpdateQuery(
@@ -46,6 +53,13 @@ export const updateReaction = ({
46
53
  );
47
54
  }
48
55
 
56
+ QuickSqliteClient.logger?.('info', 'updateReaction', {
57
+ addedUser: storableUser,
58
+ flush,
59
+ updatedReaction: storableReaction,
60
+ updatedReactionCounts,
61
+ });
62
+
49
63
  if (flush) {
50
64
  QuickSqliteClient.executeSqlBatch(queries);
51
65
  }
@@ -12,8 +12,15 @@ export const upsertAppSettings = ({
12
12
  currentUserId: string;
13
13
  flush?: boolean;
14
14
  }) => {
15
+ const storableAppSettings = JSON.stringify(appSettings);
15
16
  const query = createUpsertQuery('userSyncStatus', {
16
- appSettings: JSON.stringify(appSettings),
17
+ appSettings: storableAppSettings,
18
+ userId: currentUserId,
19
+ });
20
+
21
+ QuickSqliteClient.logger?.('info', 'upsertAppSettings', {
22
+ appSettings: storableAppSettings,
23
+ flush,
17
24
  userId: currentUserId,
18
25
  });
19
26
 
@@ -11,7 +11,12 @@ export const upsertChannelData = ({
11
11
  channel: ChannelResponse;
12
12
  flush?: boolean;
13
13
  }) => {
14
- const query = createUpsertQuery('channels', mapChannelDataToStorable(channel));
14
+ const storableChannel = mapChannelDataToStorable(channel);
15
+ const query = createUpsertQuery('channels', storableChannel);
16
+ QuickSqliteClient.logger?.('info', 'upsertChannelData', {
17
+ channel: storableChannel,
18
+ flush,
19
+ });
15
20
  if (flush) {
16
21
  QuickSqliteClient.executeSqlBatch([query]);
17
22
  }
@@ -27,8 +27,13 @@ export const upsertChannels = ({
27
27
  // Update the database only if the query is provided.
28
28
  let queries: PreparedQueries[] = [];
29
29
 
30
+ const channelIds = channels.map((channel) => channel.channel.cid);
31
+
32
+ QuickSqliteClient.logger?.('info', 'upsertChannels', {
33
+ channelIds,
34
+ });
35
+
30
36
  if (filters || sort) {
31
- const channelIds = channels.map((channel) => channel.channel.cid);
32
37
  queries = queries.concat(
33
38
  upsertCidsForQuery({
34
39
  cids: channelIds,
@@ -17,9 +17,17 @@ export const upsertCidsForQuery = ({
17
17
  sort?: ChannelSort;
18
18
  }) => {
19
19
  // Update the database only if the query is provided.
20
+ const cidsString = JSON.stringify(cids);
21
+ const id = convertFilterSortToQuery({ filters, sort });
20
22
  const query = createUpsertQuery('channelQueries', {
21
- cids: JSON.stringify(cids),
22
- id: convertFilterSortToQuery({ filters, sort }),
23
+ cids: cidsString,
24
+ id,
25
+ });
26
+
27
+ QuickSqliteClient.logger?.('info', 'upsertCidsForQuery', {
28
+ cids: cidsString,
29
+ flush,
30
+ id,
23
31
  });
24
32
 
25
33
  if (flush) {
@@ -17,20 +17,26 @@ export const upsertMembers = ({
17
17
  }) => {
18
18
  const queries: PreparedQueries[] = [];
19
19
 
20
+ const storableUsers: Array<ReturnType<typeof mapUserToStorable>> = [];
21
+ const storableMembers: Array<ReturnType<typeof mapMemberToStorable>> = [];
22
+
20
23
  members?.forEach((member) => {
21
24
  if (member.user) {
22
- queries.push(createUpsertQuery('users', mapUserToStorable(member.user)));
25
+ const storableUser = mapUserToStorable(member.user);
26
+ storableUsers.push(storableUser);
27
+ queries.push(createUpsertQuery('users', storableUser));
23
28
  }
29
+ const storableMember = mapMemberToStorable({ cid, member });
30
+ storableMembers.push(storableMember);
31
+
32
+ queries.push(createUpsertQuery('members', storableMember));
33
+ });
24
34
 
25
- queries.push(
26
- createUpsertQuery(
27
- 'members',
28
- mapMemberToStorable({
29
- cid,
30
- member,
31
- }),
32
- ),
33
- );
35
+ QuickSqliteClient.logger?.('info', 'upsertMembers', {
36
+ cid,
37
+ flush,
38
+ storableMembers,
39
+ storableUsers,
34
40
  });
35
41
 
36
42
  if (flush) {
@@ -5,7 +5,6 @@ import { mapReactionToStorable } from '../mappers/mapReactionToStorable';
5
5
  import { mapUserToStorable } from '../mappers/mapUserToStorable';
6
6
  import { QuickSqliteClient } from '../QuickSqliteClient';
7
7
  import { createUpsertQuery } from '../sqlite-utils/createUpsertQuery';
8
- import type { PreparedQueries } from '../types';
9
8
 
10
9
  export const upsertMessages = ({
11
10
  flush = true,
@@ -14,26 +13,37 @@ export const upsertMessages = ({
14
13
  messages: MessageResponse[];
15
14
  flush?: boolean;
16
15
  }) => {
17
- const usersToUpsert: PreparedQueries[] = [];
18
- const messagesToUpsert: PreparedQueries[] = [];
19
- const reactionsToUpsert: PreparedQueries[] = [];
16
+ const storableMessages: Array<ReturnType<typeof mapMessageToStorable>> = [];
17
+ const storableUsers: Array<ReturnType<typeof mapUserToStorable>> = [];
18
+ const storableReactions: Array<ReturnType<typeof mapReactionToStorable>> = [];
20
19
 
21
20
  messages?.forEach((message: MessageResponse) => {
22
- messagesToUpsert.push(createUpsertQuery('messages', mapMessageToStorable(message)));
21
+ storableMessages.push(mapMessageToStorable(message));
23
22
  if (message.user) {
24
- usersToUpsert.push(createUpsertQuery('users', mapUserToStorable(message.user)));
23
+ storableUsers.push(mapUserToStorable(message.user));
25
24
  }
26
-
27
25
  [...(message.latest_reactions || []), ...(message.own_reactions || [])].forEach((r) => {
28
26
  if (r.user) {
29
- usersToUpsert.push(createUpsertQuery('users', mapUserToStorable(r.user)));
27
+ storableUsers.push(mapUserToStorable(r.user));
30
28
  }
31
-
32
- reactionsToUpsert.push(createUpsertQuery('reactions', mapReactionToStorable(r)));
29
+ storableReactions.push(mapReactionToStorable(r));
33
30
  });
34
31
  });
35
32
 
36
- const finalQueries = [...messagesToUpsert, ...reactionsToUpsert, ...usersToUpsert];
33
+ const finalQueries = [
34
+ ...storableMessages.map((storableMessage) => createUpsertQuery('messages', storableMessage)),
35
+ ...storableUsers.map((storableUser) => createUpsertQuery('users', storableUser)),
36
+ ...storableReactions.map((storableReaction) =>
37
+ createUpsertQuery('reactions', storableReaction),
38
+ ),
39
+ ];
40
+
41
+ QuickSqliteClient.logger?.('info', 'upsertMessages', {
42
+ flush,
43
+ messages: storableMessages,
44
+ reactions: storableReactions,
45
+ users: storableUsers,
46
+ });
37
47
 
38
48
  if (flush) {
39
49
  QuickSqliteClient.executeSqlBatch(finalQueries);
@@ -17,20 +17,23 @@ export const upsertReads = ({
17
17
  }) => {
18
18
  const queries: PreparedQueries[] = [];
19
19
 
20
+ const storableReads: Array<ReturnType<typeof mapReadToStorable>> = [];
21
+ const storableUsers: Array<ReturnType<typeof mapUserToStorable>> = [];
22
+
20
23
  reads?.forEach((read) => {
21
24
  if (read.user) {
22
- queries.push(createUpsertQuery('users', mapUserToStorable(read.user)));
25
+ storableUsers.push(mapUserToStorable(read.user));
23
26
  }
27
+ storableReads.push(mapReadToStorable({ cid, read }));
28
+ });
29
+
30
+ queries.push(...storableUsers.map((storableUser) => createUpsertQuery('users', storableUser)));
31
+ queries.push(...storableReads.map((storableRead) => createUpsertQuery('reads', storableRead)));
24
32
 
25
- queries.push(
26
- createUpsertQuery(
27
- 'reads',
28
- mapReadToStorable({
29
- cid,
30
- read,
31
- }),
32
- ),
33
- );
33
+ QuickSqliteClient.logger?.('info', 'upsertReads', {
34
+ flush,
35
+ reads: storableReads,
36
+ users: storableUsers,
34
37
  });
35
38
 
36
39
  if (flush) {
@@ -13,5 +13,10 @@ export const upsertUserSyncStatus = ({
13
13
  userId: currentUserId,
14
14
  });
15
15
 
16
+ QuickSqliteClient.logger?.('info', 'upsertUserSyncStatus', {
17
+ lastSyncedAt,
18
+ userId: currentUserId,
19
+ });
20
+
16
21
  QuickSqliteClient.executeSql.apply(null, query);
17
22
  };
package/src/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "5.26.0-beta.6"
2
+ "version": "5.26.0"
3
3
  }