@amityco/ts-sdk-react-native 6.23.0 → 6.23.1-d5c2fe6.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/.env +26 -26
- package/dist/@types/core/events.d.ts +5 -0
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +16 -1
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/client/api/secureLogout.d.ts +1 -1
- package/dist/client/utils/ReadReceiptSync/readReceiptSyncEngine.d.ts.map +1 -1
- package/dist/commentRepository/api/deleteComment.d.ts.map +1 -1
- package/dist/commentRepository/events/utils.d.ts.map +1 -1
- package/dist/commentRepository/internalApi/createComment.d.ts.map +1 -1
- package/dist/communityRepository/api/createCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/queryCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/updateCommunity.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersLiveCollectionController.d.ts +14 -0
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersLiveCollectionController.d.ts.map +1 -0
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersPaginationController.d.ts +9 -0
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersPaginationController.d.ts.map +1 -0
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts +15 -0
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -0
- package/dist/communityRepository/communityMembership/observers/getMembers/enums.d.ts +10 -0
- package/dist/communityRepository/communityMembership/observers/getMembers/enums.d.ts.map +1 -0
- package/dist/communityRepository/communityMembership/observers/getMembers.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers.d.ts +20 -0
- package/dist/communityRepository/communityMembership/observers/searchMembers.d.ts.map +1 -0
- package/dist/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.d.ts +14 -0
- package/dist/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getCommunities/CommunitiesPaginationController.d.ts +9 -0
- package/dist/communityRepository/observers/getCommunities/CommunitiesPaginationController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts +15 -0
- package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getCommunities/enums.d.ts +6 -0
- package/dist/communityRepository/observers/getCommunities/enums.d.ts.map +1 -0
- package/dist/communityRepository/observers/getCommunities.d.ts.map +1 -1
- package/dist/communityRepository/observers/index.d.ts +1 -0
- package/dist/communityRepository/observers/index.d.ts.map +1 -1
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesLiveCollectionController.d.ts +14 -0
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesLiveCollectionController.d.ts.map +1 -0
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.d.ts +9 -0
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.d.ts.map +1 -0
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts +15 -0
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts.map +1 -0
- package/dist/communityRepository/observers/searchCommunities/enums.d.ts +6 -0
- package/dist/communityRepository/observers/searchCommunities/enums.d.ts.map +1 -0
- package/dist/communityRepository/observers/searchCommunities.d.ts +20 -0
- package/dist/communityRepository/observers/searchCommunities.d.ts.map +1 -0
- package/dist/communityRepository/utils/payload.d.ts.map +1 -1
- package/dist/communityRepository/utils/saveCommunityUsers.d.ts +2 -0
- package/dist/communityRepository/utils/saveCommunityUsers.d.ts.map +1 -0
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/liveCollection/LiveCollectionController.d.ts +4 -1
- package/dist/core/liveCollection/LiveCollectionController.d.ts.map +1 -1
- package/dist/index.cjs.js +1149 -797
- package/dist/index.esm.js +1148 -796
- package/dist/index.umd.js +4 -4
- package/dist/marker/events/onChannelUnreadUpdatedLocal.d.ts +12 -0
- package/dist/marker/events/onChannelUnreadUpdatedLocal.d.ts.map +1 -0
- package/dist/marker/events/onSubChannelUnreadUpdatedLocal.d.ts +12 -0
- package/dist/marker/events/onSubChannelUnreadUpdatedLocal.d.ts.map +1 -0
- package/dist/marker/events/onUserFeedMarkerUpdated.d.ts.map +1 -1
- package/dist/marker/utils/reCalculateChannelUnreadInfo.d.ts +1 -1
- package/dist/marker/utils/reCalculateChannelUnreadInfo.d.ts.map +1 -1
- package/dist/postRepository/observers/getPost.d.ts.map +1 -1
- package/dist/postRepository/observers/getPosts.d.ts.map +1 -1
- package/dist/streamRepository/api/getStreams.d.ts +2 -2
- package/dist/streamRepository/events/onStreamFlagged.d.ts +17 -0
- package/dist/streamRepository/events/onStreamFlagged.d.ts.map +1 -0
- package/dist/streamRepository/events/onStreamTerminated.d.ts +17 -0
- package/dist/streamRepository/events/onStreamTerminated.d.ts.map +1 -0
- package/dist/streamRepository/observers/getStreams.d.ts +1 -1
- package/dist/utils/liveObject.d.ts +3 -0
- package/dist/utils/liveObject.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/events.ts +8 -0
- package/src/@types/domains/community.ts +26 -1
- package/src/channelRepository/channelMembership/observers/getMembers/ChannelMemberLiveCollectionController.ts +2 -2
- package/src/channelRepository/observers/getChannel.ts +2 -2
- package/src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts +7 -7
- package/src/client/api/secureLogout.ts +1 -1
- package/src/client/utils/ReadReceiptSync/readReceiptSyncEngine.ts +6 -3
- package/src/commentRepository/api/createComment.ts +2 -2
- package/src/commentRepository/api/deleteComment.ts +2 -4
- package/src/commentRepository/events/utils.ts +8 -5
- package/src/commentRepository/internalApi/createComment.ts +3 -2
- package/src/commentRepository/internalApi/deleteComment.ts +2 -2
- package/src/communityRepository/api/createCommunity.ts +5 -2
- package/src/communityRepository/api/getCommunities.ts +5 -1
- package/src/communityRepository/api/getCommunity.ts +5 -1
- package/src/communityRepository/api/queryCommunities.ts +2 -2
- package/src/communityRepository/api/updateCommunity.ts +5 -1
- package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersLiveCollectionController.ts +152 -0
- package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersPaginationController.ts +26 -0
- package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.ts +107 -0
- package/src/communityRepository/communityMembership/observers/getMembers/enums.ts +9 -0
- package/src/communityRepository/communityMembership/observers/getMembers.ts +15 -128
- package/src/communityRepository/communityMembership/observers/searchMembers.ts +60 -0
- package/src/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.ts +147 -0
- package/src/communityRepository/observers/getCommunities/CommunitiesPaginationController.ts +31 -0
- package/src/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.ts +88 -0
- package/src/communityRepository/observers/getCommunities/enums.ts +5 -0
- package/src/communityRepository/observers/getCommunities.ts +7 -150
- package/src/communityRepository/observers/index.ts +1 -0
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesLiveCollectionController.ts +129 -0
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.ts +31 -0
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.ts +81 -0
- package/src/communityRepository/observers/searchCommunities/enums.ts +5 -0
- package/src/communityRepository/observers/searchCommunities.ts +56 -0
- package/src/communityRepository/utils/payload.ts +35 -1
- package/src/communityRepository/utils/saveCommunityUsers.ts +16 -0
- package/src/core/liveCollection/LiveCollectionController.ts +6 -3
- package/src/marker/events/onChannelUnreadUpdatedLocal.ts +29 -0
- package/src/marker/events/onSubChannelMarkerFetched.ts +1 -1
- package/src/marker/events/onSubChannelUnreadUpdatedLocal.ts +29 -0
- package/src/marker/events/onUserFeedMarkerUpdated.ts +3 -4
- package/src/marker/utils/reCalculateChannelUnreadInfo.ts +7 -3
- package/src/messageRepository/observers/getMessages/MessageLiveCollectionController.ts +3 -3
- package/src/postRepository/api/editPost.ts +1 -1
- package/src/postRepository/api/updatePost.ts +1 -1
- package/src/postRepository/observers/getPost.ts +26 -0
- package/src/postRepository/observers/getPosts.ts +31 -0
- package/src/storyRepository/observers/getGlobalStoryTargets/GlobalStoryLiveCollectionController.ts +2 -2
- package/src/storyRepository/observers/getStoriesByTargetIds/StoryLiveCollectionController.ts +1 -1
- package/src/streamRepository/api/getStreams.ts +2 -2
- package/src/streamRepository/events/onStreamFlagged.ts +37 -0
- package/src/streamRepository/events/onStreamTerminated.ts +37 -0
- package/src/streamRepository/observers/getStreams.ts +1 -1
- package/src/subChannelRepository/observers/getSubChannel.ts +2 -2
- package/src/subChannelRepository/observers/getSubChannels/SubChannelLiveCollectionController.ts +4 -4
- package/src/utils/liveObject.ts +3 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal used only
|
|
3
|
+
*
|
|
4
|
+
* Fired when an {@link Amity.userMessageFeedMarkers} has been resolved by Object Rsesolver
|
|
5
|
+
*
|
|
6
|
+
* @param callback The function to call when the event was fired
|
|
7
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
8
|
+
*
|
|
9
|
+
* @category MessageMarker Events
|
|
10
|
+
*/
|
|
11
|
+
export declare const onChannelUnreadUpdatedLocal: (callback: Amity.Listener<Amity.Events['local.channelUnread.updated']>) => Amity.Unsubscriber;
|
|
12
|
+
//# sourceMappingURL=onChannelUnreadUpdatedLocal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onChannelUnreadUpdatedLocal.d.ts","sourceRoot":"","sources":["../../../src/marker/events/onChannelUnreadUpdatedLocal.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,eAAO,MAAM,2BAA2B,aAC5B,MAAM,QAAQ,CAAC,MAAM,MAAM,CAAC,6BAA6B,CAAC,CAAC,KACpE,MAAM,YAaR,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal used only
|
|
3
|
+
*
|
|
4
|
+
* Fired when an {@link Amity.userMessageFeedMarkers} has been resolved by Object Rsesolver
|
|
5
|
+
*
|
|
6
|
+
* @param callback The function to call when the event was fired
|
|
7
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
8
|
+
*
|
|
9
|
+
* @category MessageMarker Events
|
|
10
|
+
*/
|
|
11
|
+
export declare const onSubChannelUnreadUpdatedLocal: (callback: Amity.Listener<Amity.Events['local.subChannelUnread.updated']>) => Amity.Unsubscriber;
|
|
12
|
+
//# sourceMappingURL=onSubChannelUnreadUpdatedLocal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onSubChannelUnreadUpdatedLocal.d.ts","sourceRoot":"","sources":["../../../src/marker/events/onSubChannelUnreadUpdatedLocal.ts"],"names":[],"mappings":"AAGA;;;;;;;;;GASG;AACH,eAAO,MAAM,8BAA8B,aAC/B,MAAM,QAAQ,CAAC,MAAM,MAAM,CAAC,gCAAgC,CAAC,CAAC,KACvE,MAAM,YAaR,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"onUserFeedMarkerUpdated.d.ts","sourceRoot":"","sources":["../../../src/marker/events/onUserFeedMarkerUpdated.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,aACxB,MAAM,QAAQ,CAAC,MAAM,UAAU,CAAC,KACzC,MAAM,
|
|
1
|
+
{"version":3,"file":"onUserFeedMarkerUpdated.d.ts","sourceRoot":"","sources":["../../../src/marker/events/onUserFeedMarkerUpdated.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,aACxB,MAAM,QAAQ,CAAC,MAAM,UAAU,CAAC,KACzC,MAAM,YAeR,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const reCalculateChannelUnreadInfo: (channelId: string) =>
|
|
1
|
+
export declare const reCalculateChannelUnreadInfo: (channelId: string) => Amity.ChannelUnreadInfo;
|
|
2
2
|
//# sourceMappingURL=reCalculateChannelUnreadInfo.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reCalculateChannelUnreadInfo.d.ts","sourceRoot":"","sources":["../../../src/marker/utils/reCalculateChannelUnreadInfo.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"reCalculateChannelUnreadInfo.d.ts","sourceRoot":"","sources":["../../../src/marker/utils/reCalculateChannelUnreadInfo.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,4BAA4B,cAAe,MAAM,KAAG,MAAM,iBAqCtE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/observers/getPost.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getPost.d.ts","sourceRoot":"","sources":["../../../src/postRepository/observers/getPost.ts"],"names":[],"mappings":"AAqBA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,OAAO,WACV,MAAM,IAAI,CAAC,QAAQ,CAAC,YAClB,MAAM,kBAAkB,CAAC,MAAM,IAAI,CAAC,KAC7C,MAAM,YAkER,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getPosts.d.ts","sourceRoot":"","sources":["../../../src/postRepository/observers/getPosts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getPosts.d.ts","sourceRoot":"","sources":["../../../src/postRepository/observers/getPosts.ts"],"names":[],"mappings":"AA2CA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,QAAQ,WACX,MAAM,kBAAkB,YACtB,MAAM,sBAAsB,CAAC,MAAM,IAAI,CAAC,WACzC,MAAM,oBAAoB,KAClC,MAAM,YAkLR,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ```js
|
|
3
|
-
* import { getStreams } from '@amityco/ts-sdk
|
|
3
|
+
* import { getStreams } from '@amityco/ts-sdk'
|
|
4
4
|
* const streams = await getStreams()
|
|
5
5
|
* ```
|
|
6
6
|
*
|
|
@@ -23,7 +23,7 @@ export declare const getStreams: {
|
|
|
23
23
|
}): Promise<Amity.Cached<Amity.Paged<Amity.Stream>>>;
|
|
24
24
|
/**
|
|
25
25
|
* ```js
|
|
26
|
-
* import { getStreams } from '@amityco/ts-sdk
|
|
26
|
+
* import { getStreams } from '@amityco/ts-sdk'
|
|
27
27
|
* const streams = getStreams.locally()
|
|
28
28
|
* ```
|
|
29
29
|
*
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { onStreamFlagged } from '@amityco/ts-sdk-react-native'
|
|
4
|
+
* const dispose = onStreamFlagged(stream => {
|
|
5
|
+
* // ...
|
|
6
|
+
* })
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
10
|
+
*
|
|
11
|
+
* @param callback The function to call when the event was fired
|
|
12
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
13
|
+
*
|
|
14
|
+
* @category Stream Events
|
|
15
|
+
*/
|
|
16
|
+
export declare const onStreamFlagged: (callback: Amity.Listener<Amity.InternalStream>) => Amity.Unsubscriber;
|
|
17
|
+
//# sourceMappingURL=onStreamFlagged.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onStreamFlagged.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/events/onStreamFlagged.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,eAAe,aAChB,MAAM,QAAQ,CAAC,MAAM,cAAc,CAAC,KAC7C,MAAM,YAcR,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { onStreamTerminated } from '@amityco/ts-sdk-react-native'
|
|
4
|
+
* const dispose = onStreamTerminated(stream => {
|
|
5
|
+
* // ...
|
|
6
|
+
* })
|
|
7
|
+
* ```
|
|
8
|
+
*
|
|
9
|
+
* Fired when a {@link Amity.InternalStream} has started airing
|
|
10
|
+
*
|
|
11
|
+
* @param callback The function to call when the event was fired
|
|
12
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
13
|
+
*
|
|
14
|
+
* @category Stream Events
|
|
15
|
+
*/
|
|
16
|
+
export declare const onStreamTerminated: (callback: Amity.Listener<Amity.InternalStream>) => Amity.Unsubscriber;
|
|
17
|
+
//# sourceMappingURL=onStreamTerminated.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onStreamTerminated.d.ts","sourceRoot":"","sources":["../../../src/streamRepository/events/onStreamTerminated.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,kBAAkB,aACnB,MAAM,QAAQ,CAAC,MAAM,cAAc,CAAC,KAC7C,MAAM,YAcR,CAAC"}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated This function is deprecated
|
|
3
|
+
*/
|
|
1
4
|
export declare const liveObject: <T extends Amity.Model, K extends keyof T, CallbackData extends unknown = any>(id: T[K], callback: Amity.LiveObjectCallback<CallbackData>, key: K, fetcher: (id: T[K]) => Promise<Amity.Cached<T>>, eventHandlers: ((callback: Amity.Listener<T>) => Amity.Unsubscriber)[], options?: Amity.LiveObjectOptions<T, CallbackData> | undefined) => Amity.Unsubscriber;
|
|
2
5
|
//# sourceMappingURL=liveObject.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"liveObject.d.ts","sourceRoot":"","sources":["../../src/utils/liveObject.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,UAAU,uPASiC,MAAM,YAAY,wEAEvE,MAAM,YAmFR,CAAC"}
|
|
1
|
+
{"version":3,"file":"liveObject.d.ts","sourceRoot":"","sources":["../../src/utils/liveObject.ts"],"names":[],"mappings":"AAYA;;GAEG;AACH,eAAO,MAAM,UAAU,uPASiC,MAAM,YAAY,wEAEvE,MAAM,YAmFR,CAAC"}
|
package/package.json
CHANGED
|
@@ -194,6 +194,9 @@ declare global {
|
|
|
194
194
|
userFeedMarkers: Amity.UserFeedMarkerResponse[];
|
|
195
195
|
};
|
|
196
196
|
|
|
197
|
+
'local.subChannelUnread.updated': Amity.SubChannelUnreadInfo;
|
|
198
|
+
'local.channelUnread.updated': Amity.ChannelUnreadInfo;
|
|
199
|
+
|
|
197
200
|
'local.story.created': Amity.StoryPayload;
|
|
198
201
|
'local.story.updated': Amity.StoryPayload;
|
|
199
202
|
'local.story.deleted': Amity.StoryPayload;
|
|
@@ -206,6 +209,11 @@ declare global {
|
|
|
206
209
|
'local.story.error': Amity.StoryPayload;
|
|
207
210
|
'local.story.reload': { referenceIds: Amity.Story['referenceId'][] };
|
|
208
211
|
|
|
212
|
+
'local.post.updated': Amity.PostPayload;
|
|
213
|
+
|
|
214
|
+
'local.comment.created': Amity.CommentPayload;
|
|
215
|
+
'local.comment.deleted': Amity.CommentPayload;
|
|
216
|
+
|
|
209
217
|
sessionStateChange: Amity.SessionStates;
|
|
210
218
|
// used by accessTokenExpiryWatcher
|
|
211
219
|
tokenExpired: Amity.SessionStates.TOKEN_EXPIRED;
|
|
@@ -75,6 +75,22 @@ declare global {
|
|
|
75
75
|
};
|
|
76
76
|
|
|
77
77
|
type QueryCommunities = {
|
|
78
|
+
/** @deprecated use searchCommunities instead */
|
|
79
|
+
displayName?: string;
|
|
80
|
+
membership?: 'all' | 'member' | 'notMember';
|
|
81
|
+
categoryId?: Amity.InternalCategory['categoryId'];
|
|
82
|
+
includeDeleted?: boolean;
|
|
83
|
+
tags?: Amity.Taggable['tags'];
|
|
84
|
+
sortBy?:
|
|
85
|
+
| 'firstCreated'
|
|
86
|
+
| 'lastCreated'
|
|
87
|
+
/** @deprecated sortBy displayName is not available */
|
|
88
|
+
| 'displayName';
|
|
89
|
+
page?: string;
|
|
90
|
+
limit?: number;
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
type SearchQueryCommunities = {
|
|
78
94
|
displayName?: string;
|
|
79
95
|
membership?: 'all' | 'member' | 'notMember';
|
|
80
96
|
categoryId?: Amity.InternalCategory['categoryId'];
|
|
@@ -87,16 +103,25 @@ declare global {
|
|
|
87
103
|
|
|
88
104
|
type CommunityLiveCollection = Amity.LiveCollectionParams<Omit<QueryCommunities, 'page'>>;
|
|
89
105
|
|
|
106
|
+
type SearchCommunityLiveCollection = Amity.LiveCollectionParams<
|
|
107
|
+
Omit<SearchQueryCommunities, 'page'>
|
|
108
|
+
>;
|
|
109
|
+
|
|
90
110
|
type CommunityLiveCollectionCache = Amity.LiveCollectionCache<
|
|
91
111
|
Amity.Community['communityId'],
|
|
92
112
|
Pick<QueryCommunities, 'page'>
|
|
93
113
|
>;
|
|
94
114
|
|
|
115
|
+
type SearchCommunityLiveCollectionCache = Amity.LiveCollectionCache<
|
|
116
|
+
Amity.Community['communityId'],
|
|
117
|
+
Pick<SearchQueryCommunities, 'page'>
|
|
118
|
+
>;
|
|
119
|
+
|
|
95
120
|
type QueryCommunityMembers = {
|
|
96
121
|
communityId: string;
|
|
97
122
|
memberships?: ('banned' | 'member')[];
|
|
98
123
|
roles?: string[];
|
|
99
|
-
sortBy?: 'firstCreated' | 'lastCreated';
|
|
124
|
+
sortBy?: 'firstCreated' | 'lastCreated' | 'displayName';
|
|
100
125
|
search?: Amity.InternalUser['displayName'] | Amity.InternalUser['userId'];
|
|
101
126
|
page?: string;
|
|
102
127
|
limit?: number;
|
|
@@ -52,7 +52,7 @@ export class ChannelMemberLiveCollectionController extends LiveCollectionControl
|
|
|
52
52
|
);
|
|
53
53
|
|
|
54
54
|
this.callback = callback.bind(this);
|
|
55
|
-
this.loadPage(true);
|
|
55
|
+
this.loadPage({ initial: true });
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
protected setup() {
|
|
@@ -104,7 +104,7 @@ export class ChannelMemberLiveCollectionController extends LiveCollectionControl
|
|
|
104
104
|
if (!this.shouldNotify(data) && origin === 'event') return;
|
|
105
105
|
|
|
106
106
|
this.callback({
|
|
107
|
-
onNextPage: () => this.loadPage(
|
|
107
|
+
onNextPage: () => this.loadPage({ direction: Amity.LiveCollectionPageDirection.NEXT }),
|
|
108
108
|
data,
|
|
109
109
|
hasNextPage: !!this.paginationController.getNextToken(),
|
|
110
110
|
loading,
|
|
@@ -33,8 +33,8 @@ import { isEqual } from '~/utils/isEqual';
|
|
|
33
33
|
import { updateChannelCache } from '../utils/updateChannelCache';
|
|
34
34
|
import { onChannelMarkerUpdated } from '~/marker/events/onChannelMarkerUpdated';
|
|
35
35
|
import { onSubChannelCreated } from '~/subChannelRepository';
|
|
36
|
-
import { onUserFeedMarkerUpdated } from '~/marker/events/onUserFeedMarkerUpdated';
|
|
37
36
|
import { LinkedObject } from '~/utils/linkedObject';
|
|
37
|
+
import { onChannelUnreadUpdatedLocal } from '~/marker/events/onChannelUnreadUpdatedLocal';
|
|
38
38
|
|
|
39
39
|
/* begin_public_function
|
|
40
40
|
id: channel.get
|
|
@@ -271,7 +271,7 @@ export const getChannel = (
|
|
|
271
271
|
'channel',
|
|
272
272
|
),
|
|
273
273
|
convertEventPayload(onSubChannelCreated, 'channelId', 'channel'),
|
|
274
|
-
convertEventPayload(
|
|
274
|
+
convertEventPayload(onChannelUnreadUpdatedLocal, 'channelId', 'channel'),
|
|
275
275
|
],
|
|
276
276
|
{
|
|
277
277
|
forceDispatch: true,
|
|
@@ -47,7 +47,6 @@ import { getActiveClient } from '~/client';
|
|
|
47
47
|
import { prepareChannelPayload } from '~/channelRepository/utils';
|
|
48
48
|
import { ChannelPaginationNoPageController } from './ChannelPagnationNoPageController';
|
|
49
49
|
import { PaginationController } from '~/core/liveCollection/PaginationController';
|
|
50
|
-
import { onUserFeedMarkerUpdated } from '~/marker/events/onUserFeedMarkerUpdated';
|
|
51
50
|
import { onSubChannelCreated } from '~/subChannelRepository';
|
|
52
51
|
|
|
53
52
|
import ObjectResolverEngine from '~/client/utils/ObjectResolver/objectResolverEngine';
|
|
@@ -56,6 +55,7 @@ import { resolveUnreadInfoOnChannelEvent } from '~/channelRepository/utils/resol
|
|
|
56
55
|
import { onChannelResolved } from '~/channelRepository/events/onChannelResolved';
|
|
57
56
|
import { onUserMessageFeedMarkerResolved } from '~/marker/events/onUserMessageFeedMarkerResolved';
|
|
58
57
|
import { LinkedObject } from '~/utils/linkedObject';
|
|
58
|
+
import { onChannelUnreadUpdatedLocal } from '~/marker/events/onChannelUnreadUpdatedLocal';
|
|
59
59
|
|
|
60
60
|
export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
61
61
|
'channel',
|
|
@@ -98,7 +98,7 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
98
98
|
|
|
99
99
|
this.paginationController = paginationController;
|
|
100
100
|
this.callback = callback.bind(this);
|
|
101
|
-
this.loadPage(true);
|
|
101
|
+
this.loadPage({ initial: true });
|
|
102
102
|
}
|
|
103
103
|
|
|
104
104
|
protected setup() {
|
|
@@ -148,7 +148,7 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
148
148
|
this.callback({
|
|
149
149
|
onNextPage:
|
|
150
150
|
this.paginationController instanceof ChannelPaginationController
|
|
151
|
-
? () => this.loadPage(
|
|
151
|
+
? () => this.loadPage({ direction: Amity.LiveCollectionPageDirection.NEXT })
|
|
152
152
|
: undefined,
|
|
153
153
|
data,
|
|
154
154
|
hasNextPage:
|
|
@@ -517,10 +517,6 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
517
517
|
),
|
|
518
518
|
action: Amity.ChannelActionType.OnUpdate,
|
|
519
519
|
},
|
|
520
|
-
{
|
|
521
|
-
fn: convertEventPayload(onUserFeedMarkerUpdated, 'entityId', 'channel'),
|
|
522
|
-
action: Amity.ChannelActionType.OnUpdate,
|
|
523
|
-
},
|
|
524
520
|
{
|
|
525
521
|
fn: convertEventPayload(onSubChannelCreated, 'channelId', 'channel'),
|
|
526
522
|
action: Amity.ChannelActionType.OnUpdate,
|
|
@@ -553,6 +549,10 @@ export class ChannelLiveCollectionController extends LiveCollectionController<
|
|
|
553
549
|
},
|
|
554
550
|
action: Amity.ChannelActionType.OnResolve,
|
|
555
551
|
},
|
|
552
|
+
{
|
|
553
|
+
fn: convertEventPayload(onChannelUnreadUpdatedLocal, 'channelId', 'channel'),
|
|
554
|
+
action: Amity.ChannelActionType.OnUpdate,
|
|
555
|
+
},
|
|
556
556
|
];
|
|
557
557
|
|
|
558
558
|
if (this.paginationController instanceof PaginationController) {
|
|
@@ -2,6 +2,7 @@ import { pullFromCache, pushToCache, queryCache } from '~/cache/api';
|
|
|
2
2
|
import { getActiveClient } from '../../api/activeClient';
|
|
3
3
|
import { markAsReadBySegment } from '~/subChannelRepository/api/markAsReadBySegment';
|
|
4
4
|
import { reCalculateChannelUnreadInfo } from '~/marker/utils/reCalculateChannelUnreadInfo';
|
|
5
|
+
import { fireEvent } from '~/core/events';
|
|
5
6
|
|
|
6
7
|
export class MessageReadReceiptSyncEngine {
|
|
7
8
|
private client: Amity.Client;
|
|
@@ -178,10 +179,12 @@ export class MessageReadReceiptSyncEngine {
|
|
|
178
179
|
subChannelUnreadInfo.readToSegment = segment;
|
|
179
180
|
subChannelUnreadInfo.unreadCount = Math.max(subChannelUnreadInfo.lastSegment - segment, 0);
|
|
180
181
|
|
|
181
|
-
reCalculateChannelUnreadInfo(subChannelUnreadInfo.channelId);
|
|
182
|
-
|
|
182
|
+
const channelUnreadInfo = reCalculateChannelUnreadInfo(subChannelUnreadInfo.channelId);
|
|
183
|
+
fireEvent('local.channelUnread.updated', channelUnreadInfo);
|
|
183
184
|
|
|
184
|
-
|
|
185
|
+
pushToCache(cacheKey, subChannelUnreadInfo);
|
|
186
|
+
fireEvent('local.subChannelUnread.updated', subChannelUnreadInfo);
|
|
187
|
+
}
|
|
185
188
|
|
|
186
189
|
// Step 2: Enqueue the read receipt
|
|
187
190
|
this.enqueueReadReceipt(subChannelId, segment);
|
|
@@ -53,7 +53,7 @@ export const createComment = async (
|
|
|
53
53
|
if (['post', 'content'].includes(bundle.referenceType)) {
|
|
54
54
|
const post = await getPost(bundle.referenceId);
|
|
55
55
|
|
|
56
|
-
fireEvent('post.updated', {
|
|
56
|
+
fireEvent('local.post.updated', {
|
|
57
57
|
posts: [post.data],
|
|
58
58
|
categories: [],
|
|
59
59
|
comments: [],
|
|
@@ -97,7 +97,7 @@ export const createComment = async (
|
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
fireEvent('comment.created', data);
|
|
100
|
+
fireEvent('local.comment.created', data);
|
|
101
101
|
|
|
102
102
|
return {
|
|
103
103
|
data: LinkedObject.comment(comments[0]),
|
|
@@ -64,8 +64,7 @@ export const deleteComment = async (
|
|
|
64
64
|
} else {
|
|
65
65
|
const post = await getPost(comment.data.referenceId);
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
fireEvent('post.updated', {
|
|
67
|
+
fireEvent('local.post.updated', {
|
|
69
68
|
posts: [post.data],
|
|
70
69
|
categories: [],
|
|
71
70
|
comments: [],
|
|
@@ -78,8 +77,7 @@ export const deleteComment = async (
|
|
|
78
77
|
});
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
|
|
82
|
-
fireEvent('comment.deleted', {
|
|
80
|
+
fireEvent('local.comment.deleted', {
|
|
83
81
|
comments: [deleted],
|
|
84
82
|
commentChildren: [],
|
|
85
83
|
files: [],
|
|
@@ -39,11 +39,14 @@ export const createCommentEventSubscriber = (
|
|
|
39
39
|
]);
|
|
40
40
|
|
|
41
41
|
if (parentComment?.data) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
// Skip to update parent childComment if current comment already exists
|
|
43
|
+
if (!parentComment.data.children.includes(comments[0].commentId)) {
|
|
44
|
+
pushToCache(['comment', 'get', comments[0].parentId], {
|
|
45
|
+
...parentComment.data,
|
|
46
|
+
childrenNumber: parentComment.data.childrenNumber + 1,
|
|
47
|
+
children: [...new Set([...parentComment.data.children, comments[0].commentId])],
|
|
48
|
+
});
|
|
49
|
+
}
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
52
|
|
|
@@ -27,7 +27,7 @@ export const createComment = async (
|
|
|
27
27
|
|
|
28
28
|
const post = await getPost(bundle.referenceId);
|
|
29
29
|
|
|
30
|
-
fireEvent('post.updated', {
|
|
30
|
+
fireEvent('local.post.updated', {
|
|
31
31
|
posts: [post.data],
|
|
32
32
|
categories: [],
|
|
33
33
|
comments: [],
|
|
@@ -38,7 +38,8 @@ export const createComment = async (
|
|
|
38
38
|
postChildren: [],
|
|
39
39
|
users: [],
|
|
40
40
|
});
|
|
41
|
-
|
|
41
|
+
|
|
42
|
+
fireEvent('local.comment.created', data);
|
|
42
43
|
|
|
43
44
|
const { comments } = data;
|
|
44
45
|
return {
|
|
@@ -33,7 +33,7 @@ export const deleteComment = async (
|
|
|
33
33
|
|
|
34
34
|
const post = await getPost(comment.data.referenceId);
|
|
35
35
|
|
|
36
|
-
fireEvent('post.updated', {
|
|
36
|
+
fireEvent('local.post.updated', {
|
|
37
37
|
posts: [post.data],
|
|
38
38
|
categories: [],
|
|
39
39
|
comments: [],
|
|
@@ -45,7 +45,7 @@ export const deleteComment = async (
|
|
|
45
45
|
users: [],
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
fireEvent('comment.deleted', {
|
|
48
|
+
fireEvent('local.comment.deleted', {
|
|
49
49
|
comments: [deleted],
|
|
50
50
|
commentChildren: [],
|
|
51
51
|
files: [],
|
|
@@ -2,7 +2,7 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import { fireEvent } from '~/core/events';
|
|
5
|
-
|
|
5
|
+
import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
|
|
6
6
|
import { prepareCommunityPayload, prepareCommunityRequest } from '../utils';
|
|
7
7
|
|
|
8
8
|
/* begin_public_function
|
|
@@ -53,7 +53,10 @@ export const createCommunity = async (
|
|
|
53
53
|
const data = prepareCommunityPayload(payload);
|
|
54
54
|
|
|
55
55
|
const cachedAt = client.cache && Date.now();
|
|
56
|
-
if (client.cache)
|
|
56
|
+
if (client.cache) {
|
|
57
|
+
ingestInCache(data, { cachedAt });
|
|
58
|
+
saveCommunityUsers(data.communities, data.communityUsers);
|
|
59
|
+
}
|
|
57
60
|
|
|
58
61
|
const { communities } = data;
|
|
59
62
|
return {
|
|
@@ -3,6 +3,7 @@ import { getActiveClient } from '~/client/api';
|
|
|
3
3
|
import { pullFromCache } from '~/cache/api';
|
|
4
4
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
5
5
|
|
|
6
|
+
import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
|
|
6
7
|
import { prepareCommunityPayload } from '../utils';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -36,7 +37,10 @@ export const getCommunities = async (
|
|
|
36
37
|
const data = prepareCommunityPayload(payload);
|
|
37
38
|
|
|
38
39
|
const cachedAt = client.cache && Date.now();
|
|
39
|
-
if (client.cache)
|
|
40
|
+
if (client.cache) {
|
|
41
|
+
ingestInCache(data, { cachedAt });
|
|
42
|
+
saveCommunityUsers(data.communities, data.communityUsers);
|
|
43
|
+
}
|
|
40
44
|
|
|
41
45
|
return {
|
|
42
46
|
data: data.communities,
|
|
@@ -3,6 +3,7 @@ import { getActiveClient } from '~/client/api';
|
|
|
3
3
|
import { pullFromCache } from '~/cache/api';
|
|
4
4
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
5
5
|
|
|
6
|
+
import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
|
|
6
7
|
import { prepareCommunityPayload } from '../utils';
|
|
7
8
|
|
|
8
9
|
/**
|
|
@@ -33,7 +34,10 @@ export const getCommunity = async (
|
|
|
33
34
|
const data = prepareCommunityPayload(payload);
|
|
34
35
|
|
|
35
36
|
const cachedAt = client.cache && Date.now();
|
|
36
|
-
if (client.cache)
|
|
37
|
+
if (client.cache) {
|
|
38
|
+
ingestInCache(data, { cachedAt });
|
|
39
|
+
saveCommunityUsers(data.communities, data.communityUsers);
|
|
40
|
+
}
|
|
37
41
|
|
|
38
42
|
const { communities } = data;
|
|
39
43
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { getActiveClient } from '~/client/api';
|
|
2
|
-
|
|
3
|
-
import { toPage, toToken } from '~/core/query';
|
|
4
2
|
import { pushToCache } from '~/cache/api';
|
|
5
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
6
4
|
import { getResolver } from '~/core/model';
|
|
7
5
|
|
|
8
6
|
import { inferIsDeleted } from '~/utils/inferIsDeleted';
|
|
7
|
+
import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
|
|
9
8
|
import { prepareCommunityPayload } from '../utils';
|
|
10
9
|
|
|
11
10
|
/**
|
|
@@ -67,6 +66,7 @@ export const queryCommunities = async (
|
|
|
67
66
|
|
|
68
67
|
const cacheKey = ['community', 'query', { ...params, options } as Amity.Serializable];
|
|
69
68
|
pushToCache(cacheKey, { communities: communities.map(getResolver('community')), paging });
|
|
69
|
+
saveCommunityUsers(data.communities, data.communityUsers);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
return { data: communities, cachedAt, paging };
|
|
@@ -3,6 +3,7 @@ import { getActiveClient } from '~/client/api';
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import { fireEvent } from '~/core/events';
|
|
5
5
|
|
|
6
|
+
import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
|
|
6
7
|
import { prepareCommunityPayload, prepareCommunityRequest } from '../utils';
|
|
7
8
|
|
|
8
9
|
/* begin_public_function
|
|
@@ -44,7 +45,10 @@ export const updateCommunity = async (
|
|
|
44
45
|
const data = prepareCommunityPayload(payload);
|
|
45
46
|
|
|
46
47
|
const cachedAt = client.cache && Date.now();
|
|
47
|
-
if (client.cache)
|
|
48
|
+
if (client.cache) {
|
|
49
|
+
ingestInCache(data, { cachedAt });
|
|
50
|
+
saveCommunityUsers(data.communities, data.communityUsers);
|
|
51
|
+
}
|
|
48
52
|
|
|
49
53
|
const { communities } = data;
|
|
50
54
|
|