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
|
@@ -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
|
}
|
|
@@ -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
|
-
|
|
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', ['*'], {
|
|
@@ -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',
|
|
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
|
-
|
|
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
|
-
|
|
62
|
+
const storableUser = mapUserToStorable(r.user);
|
|
63
|
+
storableUsers.push(storableUser);
|
|
64
|
+
queries.push(createUpsertQuery('users', storableUser));
|
|
55
65
|
}
|
|
56
66
|
|
|
57
|
-
|
|
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',
|
|
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:
|
|
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
|
|
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:
|
|
22
|
-
id
|
|
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
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
|
18
|
-
const
|
|
19
|
-
const
|
|
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
|
-
|
|
21
|
+
storableMessages.push(mapMessageToStorable(message));
|
|
23
22
|
if (message.user) {
|
|
24
|
-
|
|
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
|
-
|
|
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 = [
|
|
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
|
-
|
|
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
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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) {
|
package/src/version.json
CHANGED