@amityco/ts-sdk-react-native 7.5.4-a561051.0 → 7.6.1-f7cc558.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/dist/@types/core/events.d.ts +7 -0
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +5 -1
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +38 -5
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/channel.d.ts +1 -0
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/@types/domains/client.d.ts +10 -0
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +51 -1
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/content.d.ts +5 -2
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/@types/domains/group.d.ts +2 -0
- package/dist/@types/domains/group.d.ts.map +1 -1
- package/dist/@types/domains/invitation.d.ts +92 -0
- package/dist/@types/domains/invitation.d.ts.map +1 -0
- package/dist/@types/domains/joinRequest.d.ts +53 -0
- package/dist/@types/domains/joinRequest.d.ts.map +1 -0
- package/dist/@types/domains/notification.d.ts +4 -2
- package/dist/@types/domains/notification.d.ts.map +1 -1
- package/dist/@types/domains/pinnedPost.d.ts +1 -1
- package/dist/@types/domains/pinnedPost.d.ts.map +1 -1
- package/dist/@types/index.d.ts +5 -0
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/channelRepository/channelMembership/observers/getMembers/ChannelMemberLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberQueryStreamController.d.ts +2 -2
- package/dist/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberQueryStreamController.d.ts.map +1 -1
- package/dist/client/api/index.d.ts +1 -0
- package/dist/client/api/index.d.ts.map +1 -1
- package/dist/client/api/resumeSession.d.ts +32 -0
- package/dist/client/api/resumeSession.d.ts.map +1 -0
- package/dist/client/api/tests/resumeSession.test.d.ts +2 -0
- package/dist/client/api/tests/resumeSession.test.d.ts.map +1 -0
- package/dist/communityRepository/api/createCommunity.d.ts +3 -3
- package/dist/communityRepository/api/createCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/deleteCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunities.d.ts +1 -1
- package/dist/communityRepository/api/getCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts +2 -2
- package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/getRecommendedCommunities.d.ts +3 -1
- package/dist/communityRepository/api/getRecommendedCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/getTrendingCommunities.d.ts +3 -1
- package/dist/communityRepository/api/getTrendingCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/joinCommunity.d.ts +3 -0
- package/dist/communityRepository/api/joinCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/queryCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/updateCommunity.d.ts +3 -3
- package/dist/communityRepository/api/updateCommunity.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/index.d.ts +1 -0
- package/dist/communityRepository/communityMembership/events/index.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoin.d.ts +2 -0
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoin.d.ts.map +1 -0
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/utils.d.ts +2 -2
- package/dist/communityRepository/communityMembership/events/utils.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/enums.d.ts +2 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/enums.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/enums.d.ts +1 -0
- package/dist/communityRepository/communityMembership/observers/searchMembers/enums.d.ts.map +1 -1
- package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts +1 -1
- package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts.map +1 -1
- package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts +1 -1
- package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts.map +1 -1
- package/dist/communityRepository/events/onCommunityCreated.d.ts +1 -1
- package/dist/communityRepository/events/onCommunityCreated.d.ts.map +1 -1
- package/dist/communityRepository/events/onCommunityDeleted.d.ts +1 -1
- package/dist/communityRepository/events/onCommunityDeleted.d.ts.map +1 -1
- package/dist/communityRepository/events/onCommunityUpdated.d.ts +1 -1
- package/dist/communityRepository/events/onCommunityUpdated.d.ts.map +1 -1
- package/dist/communityRepository/events/utils.d.ts +1 -1
- package/dist/communityRepository/events/utils.d.ts.map +1 -1
- package/dist/communityRepository/internalAPI/getMyJoinRequest.d.ts +16 -0
- package/dist/communityRepository/internalAPI/getMyJoinRequest.d.ts.map +1 -0
- package/dist/communityRepository/internalAPI/joinCommunity.d.ts +16 -0
- package/dist/communityRepository/internalAPI/joinCommunity.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/events/index.d.ts +4 -0
- package/dist/communityRepository/joinRequest/events/index.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestCreated.d.ts +17 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestCreated.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestDeleted.d.ts +17 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestDeleted.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestUpdated.d.ts +17 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestUpdated.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts +16 -0
- package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts +16 -0
- package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts +16 -0
- package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts.map +1 -0
- package/dist/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunities/CommunitiesPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunity.d.ts.map +1 -1
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.d.ts +14 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.d.ts +9 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.d.ts +15 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequestList/enum.d.ts +6 -0
- package/dist/communityRepository/observers/getJoinRequestList/enum.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequestList.d.ts +12 -0
- package/dist/communityRepository/observers/getJoinRequestList.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.d.ts +14 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts +9 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.d.ts +15 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests/enum.d.ts +6 -0
- package/dist/communityRepository/observers/getJoinRequests/enum.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests.d.ts +12 -0
- package/dist/communityRepository/observers/getJoinRequests.d.ts.map +1 -0
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getRecommendedCommunities/enums.d.ts +2 -1
- package/dist/communityRepository/observers/getRecommendedCommunities/enums.d.ts.map +1 -1
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.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.map +1 -1
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/utils/communityWithMembership.d.ts +1 -1
- package/dist/communityRepository/utils/communityWithMembership.d.ts.map +1 -1
- package/dist/communityRepository/utils/payload.d.ts +2 -1
- package/dist/communityRepository/utils/payload.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/index.cjs.js +3209 -1543
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +3374 -1710
- package/dist/index.umd.js +3 -3
- package/dist/invitationRepository/events/index.d.ts +4 -0
- package/dist/invitationRepository/events/index.d.ts.map +1 -0
- package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts +17 -0
- package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts.map +1 -0
- package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts +17 -0
- package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts.map +1 -0
- package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts +17 -0
- package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts.map +1 -0
- package/dist/invitationRepository/index.d.ts +3 -0
- package/dist/invitationRepository/index.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/acceptInvitation.d.ts +16 -0
- package/dist/invitationRepository/internalApi/acceptInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/createInvitations.d.ts +21 -0
- package/dist/invitationRepository/internalApi/createInvitations.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/getInvitation.d.ts +17 -0
- package/dist/invitationRepository/internalApi/getInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/index.d.ts +4 -0
- package/dist/invitationRepository/internalApi/index.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/rejectInvitation.d.ts +16 -0
- package/dist/invitationRepository/internalApi/rejectInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts +14 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts +5 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts +15 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations/enums.d.ts +6 -0
- package/dist/invitationRepository/observers/getInvitations/enums.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations.d.ts +12 -0
- package/dist/invitationRepository/observers/getInvitations.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts +12 -0
- package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts +14 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts +5 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts +15 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/index.d.ts +2 -0
- package/dist/invitationRepository/observers/index.d.ts.map +1 -0
- package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts +2 -0
- package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/utils/index.d.ts +2 -0
- package/dist/invitationRepository/utils/index.d.ts.map +1 -0
- package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts +2 -0
- package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts.map +1 -0
- package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts +2 -0
- package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts.map +1 -0
- package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
- package/dist/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.d.ts.map +1 -1
- package/dist/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.d.ts.map +1 -1
- package/dist/subChannelRepository/utils/prepareSubChannelPayload.d.ts.map +1 -1
- package/dist/utils/linkedObject/channelLinkedObject.d.ts.map +1 -1
- package/dist/utils/linkedObject/channelMemberLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/channelMemberLinkedObject.d.ts.map +1 -0
- package/dist/utils/linkedObject/communityLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/communityLinkedObject.d.ts.map +1 -0
- package/dist/utils/linkedObject/index.d.ts +4 -0
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/invitationLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/invitationLinkedObject.d.ts.map +1 -0
- package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts.map +1 -0
- package/dist/utils/tests/dummy/comment.d.ts +1 -1
- package/dist/utils/tests/dummy/community.d.ts +2 -0
- package/dist/utils/tests/dummy/community.d.ts.map +1 -1
- package/dist/utils/tests/dummy/post.d.ts +3 -3
- package/package.json +2 -1
- package/src/@types/core/events.ts +10 -0
- package/src/@types/core/model.ts +8 -1
- package/src/@types/core/payload.ts +48 -5
- package/src/@types/domains/channel.ts +1 -0
- package/src/@types/domains/client.ts +12 -0
- package/src/@types/domains/community.ts +82 -3
- package/src/@types/domains/content.ts +15 -1
- package/src/@types/domains/group.ts +2 -0
- package/src/@types/domains/invitation.ts +119 -0
- package/src/@types/domains/joinRequest.ts +66 -0
- package/src/@types/domains/notification.ts +2 -0
- package/src/@types/domains/pinnedPost.ts +1 -1
- package/src/@types/index.ts +5 -0
- package/src/channelRepository/channelMembership/observers/getMembers/ChannelMemberLiveCollectionController.ts +3 -1
- package/src/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberLiveCollectionController.ts +2 -1
- package/src/channelRepository/channelMembership/observers/searchMembers/SearchChannelMemberQueryStreamController.ts +2 -2
- package/src/client/api/index.ts +1 -0
- package/src/client/api/resumeSession.ts +282 -0
- package/src/client/api/tests/resumeSession.test.ts +173 -0
- package/src/communityRepository/api/createCommunity.ts +6 -3
- package/src/communityRepository/api/deleteCommunity.ts +2 -1
- package/src/communityRepository/api/getCommunities.ts +9 -2
- package/src/communityRepository/api/getCommunity.ts +12 -3
- package/src/communityRepository/api/getRecommendedCommunities.ts +11 -4
- package/src/communityRepository/api/getTrendingCommunities.ts +11 -4
- package/src/communityRepository/api/joinCommunity.ts +4 -1
- package/src/communityRepository/api/queryCommunities.ts +7 -1
- package/src/communityRepository/api/updateCommunity.ts +14 -4
- package/src/communityRepository/communityMembership/events/index.ts +1 -0
- package/src/communityRepository/communityMembership/events/onCommunityJoined.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityLeft.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserAdded.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserBanned.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserChanged.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserRemoved.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserRoleAdded.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserUnbanned.ts +1 -1
- package/src/communityRepository/communityMembership/events/onLocalCommunityJoin.ts +20 -0
- package/src/communityRepository/communityMembership/events/onLocalCommunityJoined.ts +1 -1
- package/src/communityRepository/communityMembership/events/onLocalCommunityLeft.ts +1 -1
- package/src/communityRepository/communityMembership/events/onLocalCommunityUserAdded.ts +1 -1
- package/src/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.ts +1 -1
- package/src/communityRepository/communityMembership/events/onUserDeleted.ts +3 -1
- package/src/communityRepository/communityMembership/events/utils.ts +2 -2
- package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.ts +8 -2
- package/src/communityRepository/communityMembership/observers/getMembers/enums.ts +1 -0
- package/src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.ts +8 -2
- package/src/communityRepository/communityMembership/observers/searchMembers/enums.ts +1 -0
- package/src/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.ts +1 -1
- package/src/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.ts +1 -1
- package/src/communityRepository/events/onCommunityCreated.ts +1 -1
- package/src/communityRepository/events/onCommunityDeleted.ts +1 -1
- package/src/communityRepository/events/onCommunityUpdated.ts +1 -1
- package/src/communityRepository/events/utils.ts +1 -1
- package/src/communityRepository/internalAPI/getMyJoinRequest.ts +43 -0
- package/src/communityRepository/internalAPI/joinCommunity.ts +66 -0
- package/src/communityRepository/joinRequest/events/index.ts +3 -0
- package/src/communityRepository/joinRequest/events/onJoinRequestCreated.ts +33 -0
- package/src/communityRepository/joinRequest/events/onJoinRequestDeleted.ts +33 -0
- package/src/communityRepository/joinRequest/events/onJoinRequestUpdated.ts +33 -0
- package/src/communityRepository/joinRequest/internalAPI/approveJoinRequest.ts +52 -0
- package/src/communityRepository/joinRequest/internalAPI/cancelJoinRequest.ts +49 -0
- package/src/communityRepository/joinRequest/internalAPI/rejectJoinRequest.ts +52 -0
- package/src/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.ts +6 -0
- package/src/communityRepository/observers/getCommunities/CommunitiesPaginationController.ts +1 -0
- package/src/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/getCommunity.ts +26 -11
- package/src/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.ts +135 -0
- package/src/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.ts +30 -0
- package/src/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.ts +116 -0
- package/src/communityRepository/observers/getJoinRequestList/enum.ts +5 -0
- package/src/communityRepository/observers/getJoinRequestList.ts +51 -0
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.ts +126 -0
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts +25 -0
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.ts +108 -0
- package/src/communityRepository/observers/getJoinRequests/enum.ts +5 -0
- package/src/communityRepository/observers/getJoinRequests.ts +44 -0
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.ts +8 -1
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesPaginationController.ts +6 -1
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/getRecommendedCommunities/enums.ts +1 -0
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.ts +9 -1
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesPaginationController.ts +6 -1
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/index.ts +1 -0
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesLiveCollectionController.ts +6 -0
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.ts +1 -0
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityLiveCollectionController.ts +6 -0
- package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityPaginationController.ts +1 -0
- package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.ts +2 -2
- package/src/communityRepository/utils/communityWithMembership.ts +9 -5
- package/src/communityRepository/utils/payload.ts +28 -2
- package/src/core/liveCollection/PaginationController.ts +1 -1
- package/src/core/liveCollection/PaginationNoPageController.ts +1 -1
- package/src/core/model/idResolvers.ts +3 -0
- package/src/core/model/index.ts +3 -0
- package/src/index.ts +2 -0
- package/src/invitationRepository/events/index.ts +3 -0
- package/src/invitationRepository/events/onLocalInvitationCreated.ts +33 -0
- package/src/invitationRepository/events/onLocalInvitationDeleted.ts +33 -0
- package/src/invitationRepository/events/onLocalInvitationUpdated.ts +33 -0
- package/src/invitationRepository/index.ts +2 -0
- package/src/invitationRepository/internalApi/acceptInvitation.ts +45 -0
- package/src/invitationRepository/internalApi/createInvitations.ts +52 -0
- package/src/invitationRepository/internalApi/getInvitation.ts +47 -0
- package/src/invitationRepository/internalApi/index.ts +3 -0
- package/src/invitationRepository/internalApi/rejectInvitation.ts +45 -0
- package/src/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.ts +148 -0
- package/src/invitationRepository/observers/getInvitations/InvitationsPaginationController.ts +19 -0
- package/src/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.ts +97 -0
- package/src/invitationRepository/observers/getInvitations/enums.ts +5 -0
- package/src/invitationRepository/observers/getInvitations.ts +44 -0
- package/src/invitationRepository/observers/getMyCommunityInvitations.ts +48 -0
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.ts +148 -0
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.ts +22 -0
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.ts +105 -0
- package/src/invitationRepository/observers/index.ts +1 -0
- package/src/invitationRepository/utils/convertRawInvitationToInternalInvitation.ts +8 -0
- package/src/invitationRepository/utils/index.ts +1 -0
- package/src/invitationRepository/utils/prepareInvitationPayload.ts +12 -0
- package/src/invitationRepository/utils/prepareMyInvitationsPayload.ts +12 -0
- package/src/messagePreview/utils/getChannelMessagePreviewWithUser.ts +3 -3
- package/src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.ts +7 -1
- package/src/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.ts +7 -1
- package/src/subChannelRepository/utils/prepareSubChannelPayload.ts +4 -0
- package/src/utils/linkedObject/channelLinkedObject.ts +19 -0
- package/src/utils/linkedObject/channelMemberLinkedObject.ts +20 -0
- package/src/utils/linkedObject/communityLinkedObject.ts +57 -0
- package/src/utils/linkedObject/index.ts +8 -0
- package/src/utils/linkedObject/invitationLinkedObject.ts +37 -0
- package/src/utils/linkedObject/joinRequestLinkedObject.ts +31 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PaginationController } from '~/core/liveCollection/PaginationController';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* TODO: handle cache receive cache option, and cache policy
|
|
5
|
+
* TODO: check if querybyIds is supported
|
|
6
|
+
*/
|
|
7
|
+
export class JoinRequestsPaginationController extends PaginationController<
|
|
8
|
+
'joinRequest',
|
|
9
|
+
Amity.JoinRequestLiveCollection
|
|
10
|
+
> {
|
|
11
|
+
async getRequest(queryParams: Amity.JoinRequestLiveCollection, token: string | undefined) {
|
|
12
|
+
const { limit = 20, communityId, ...params } = queryParams;
|
|
13
|
+
const options = token ? { token } : { limit };
|
|
14
|
+
|
|
15
|
+
const { data: queryResponse } = await this.http.get<
|
|
16
|
+
Amity.CommunityJoinRequestPayload & Amity.Pagination
|
|
17
|
+
>(`/api/v4/communities/${communityId}/join`, {
|
|
18
|
+
params: {
|
|
19
|
+
...params,
|
|
20
|
+
options,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
return queryResponse;
|
|
24
|
+
}
|
|
25
|
+
}
|
package/src/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.ts
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { QueryStreamController } from '~/core/liveCollection/QueryStreamController';
|
|
2
|
+
import { pullFromCache, pushToCache } from '~/cache/api';
|
|
3
|
+
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
|
+
import { getResolver } from '~/core/model';
|
|
5
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
6
|
+
import { EnumJoinRequestAction } from './enum';
|
|
7
|
+
|
|
8
|
+
export class JoinRequestsQueryStreamController extends QueryStreamController<
|
|
9
|
+
Amity.CommunityJoinRequestPayload,
|
|
10
|
+
Amity.JoinRequestLiveCollection
|
|
11
|
+
> {
|
|
12
|
+
private notifyChange: (params: Amity.LiveCollectionNotifyParams) => void;
|
|
13
|
+
|
|
14
|
+
private preparePayload: (
|
|
15
|
+
response: Amity.CommunityJoinRequestPayload,
|
|
16
|
+
) => Amity.ProcessedJoinRequestPayload;
|
|
17
|
+
|
|
18
|
+
constructor(
|
|
19
|
+
query: Amity.JoinRequestLiveCollection,
|
|
20
|
+
cacheKey: string[],
|
|
21
|
+
notifyChange: (params: Amity.LiveCollectionNotifyParams) => void,
|
|
22
|
+
preparePayload: (
|
|
23
|
+
response: Amity.CommunityJoinRequestPayload,
|
|
24
|
+
) => Amity.ProcessedJoinRequestPayload,
|
|
25
|
+
) {
|
|
26
|
+
super(query, cacheKey);
|
|
27
|
+
this.notifyChange = notifyChange;
|
|
28
|
+
this.preparePayload = preparePayload;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
async saveToMainDB(response: Amity.CommunityJoinRequestPayload) {
|
|
32
|
+
const processedPayload = await this.preparePayload(response);
|
|
33
|
+
|
|
34
|
+
const client = getActiveClient();
|
|
35
|
+
const cachedAt = client.cache && Date.now();
|
|
36
|
+
|
|
37
|
+
if (client.cache) {
|
|
38
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
appendToQueryStream(
|
|
43
|
+
response: Amity.CommunityJoinRequestPayload & Partial<Amity.Pagination>,
|
|
44
|
+
direction: Amity.LiveCollectionPageDirection,
|
|
45
|
+
refresh = false,
|
|
46
|
+
) {
|
|
47
|
+
if (refresh) {
|
|
48
|
+
pushToCache(this.cacheKey, {
|
|
49
|
+
data: response.joinRequests.map(joinRequest =>
|
|
50
|
+
getResolver('joinRequest')({ joinRequestId: joinRequest._id }),
|
|
51
|
+
),
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
const collection = pullFromCache<Amity.JoinRequestLiveCollectionCache>(this.cacheKey)?.data;
|
|
55
|
+
|
|
56
|
+
const joinRequests = collection?.data ?? [];
|
|
57
|
+
|
|
58
|
+
pushToCache(this.cacheKey, {
|
|
59
|
+
...collection,
|
|
60
|
+
data: [
|
|
61
|
+
...new Set([
|
|
62
|
+
...joinRequests,
|
|
63
|
+
...response.joinRequests.map(joinRequest =>
|
|
64
|
+
getResolver('joinRequest')({ joinRequestId: joinRequest._id }),
|
|
65
|
+
),
|
|
66
|
+
]),
|
|
67
|
+
],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
reactor(action: EnumJoinRequestAction) {
|
|
73
|
+
return (joinRequest: Amity.InternalJoinRequest[]) => {
|
|
74
|
+
const collection = pullFromCache<Amity.JoinRequestLiveCollectionCache>(this.cacheKey)?.data;
|
|
75
|
+
if (!collection) return;
|
|
76
|
+
|
|
77
|
+
if (action === EnumJoinRequestAction.OnLocalJoinRequestUpdated) {
|
|
78
|
+
const isExist = collection.data.find(id => id === joinRequest[0].joinRequestId);
|
|
79
|
+
if (!isExist) return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (action === EnumJoinRequestAction.OnLocalJoinRequestCreated) {
|
|
83
|
+
collection.data = [
|
|
84
|
+
...new Set([
|
|
85
|
+
...joinRequest.map(joinRequest => joinRequest.joinRequestId),
|
|
86
|
+
...collection.data,
|
|
87
|
+
]),
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (action === EnumJoinRequestAction.OnLocalJoinRequestDeleted) {
|
|
92
|
+
collection.data = collection.data.filter(id => id !== joinRequest[0].joinRequestId);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
pushToCache(this.cacheKey, collection);
|
|
96
|
+
this.notifyChange({ origin: Amity.LiveDataOrigin.EVENT, loading: false });
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
subscribeRTE(
|
|
101
|
+
createSubscriber: {
|
|
102
|
+
fn: (reactor: Amity.Listener<Amity.InternalJoinRequest[]>) => Amity.Unsubscriber;
|
|
103
|
+
action: EnumJoinRequestAction;
|
|
104
|
+
}[],
|
|
105
|
+
) {
|
|
106
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { dropFromCache } from '~/cache/api/dropFromCache';
|
|
2
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
3
|
+
import { ENABLE_CACHE_MESSAGE } from '~/utils/constants';
|
|
4
|
+
import { JoinRequestsLiveCollectionController } from './getJoinRequests/JoinRequestsLiveCollectionController';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Get Join Requests
|
|
8
|
+
*
|
|
9
|
+
* @param params the query parameters
|
|
10
|
+
* @param callback the callback to be called when the join request are updated
|
|
11
|
+
* @returns joinRequests
|
|
12
|
+
*
|
|
13
|
+
* @category joinRequest Live Collection
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
export const getJoinRequests = (
|
|
17
|
+
params: Amity.JoinRequestLiveCollection,
|
|
18
|
+
callback: Amity.LiveCollectionCallback<Amity.JoinRequest>,
|
|
19
|
+
config?: Amity.LiveCollectionConfig,
|
|
20
|
+
) => {
|
|
21
|
+
const { log, cache } = getActiveClient();
|
|
22
|
+
|
|
23
|
+
if (!cache) {
|
|
24
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const timestamp = Date.now();
|
|
28
|
+
log(`getJoinRequests: (tmpid: ${timestamp}) > listen`);
|
|
29
|
+
|
|
30
|
+
const joinRequestLiveCollection = new JoinRequestsLiveCollectionController(params, callback);
|
|
31
|
+
|
|
32
|
+
const disposers = joinRequestLiveCollection.startSubscription();
|
|
33
|
+
|
|
34
|
+
const cacheKey = joinRequestLiveCollection.getCacheKey();
|
|
35
|
+
|
|
36
|
+
disposers.push(() => {
|
|
37
|
+
dropFromCache(cacheKey);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return () => {
|
|
41
|
+
log(`getJoinRequests (tmpid: ${timestamp}) > dispose`);
|
|
42
|
+
disposers.forEach(fn => fn());
|
|
43
|
+
};
|
|
44
|
+
};
|
|
@@ -13,8 +13,11 @@ import {
|
|
|
13
13
|
onLocalCommunityJoined,
|
|
14
14
|
onLocalCommunityLeft,
|
|
15
15
|
onCommunityUserChanged,
|
|
16
|
+
onLocalCommunityJoin,
|
|
16
17
|
} from '~/communityRepository/communityMembership';
|
|
17
18
|
import { isNonNullable } from '~/utils';
|
|
19
|
+
import { communityLinkedObject } from '~/utils/linkedObject/communityLinkedObject';
|
|
20
|
+
import { convertEventPayload } from '~/utils/event';
|
|
18
21
|
|
|
19
22
|
export class RecommendedCommunityLiveCollectionController extends LiveCollectionController<
|
|
20
23
|
'community',
|
|
@@ -81,6 +84,10 @@ export class RecommendedCommunityLiveCollectionController extends LiveCollection
|
|
|
81
84
|
{ fn: onCommunityUserChanged, action: EnumCommunityMemberActions.OnMemberCountChanged },
|
|
82
85
|
{ fn: onLocalCommunityJoined, action: EnumCommunityMemberActions.OnCommunityJoined },
|
|
83
86
|
{ fn: onLocalCommunityLeft, action: EnumCommunityMemberActions.OnCommunityLeft },
|
|
87
|
+
{
|
|
88
|
+
fn: convertEventPayload(onLocalCommunityJoin, 'targetId', 'community'),
|
|
89
|
+
action: EnumCommunityActions.OnCommunityUpdated,
|
|
90
|
+
},
|
|
84
91
|
]);
|
|
85
92
|
}
|
|
86
93
|
|
|
@@ -94,7 +101,7 @@ export class RecommendedCommunityLiveCollectionController extends LiveCollection
|
|
|
94
101
|
collection.data
|
|
95
102
|
.map(id => pullFromCache<Amity.Community>(['community', 'get', id]))
|
|
96
103
|
.filter(isNonNullable)
|
|
97
|
-
.map(({ data }) => data) ?? [];
|
|
104
|
+
.map(({ data }) => communityLinkedObject(data)) ?? [];
|
|
98
105
|
|
|
99
106
|
if (!this.shouldNotify(data) && origin === 'event') return;
|
|
100
107
|
|
|
@@ -14,7 +14,11 @@ export class RecommendedCommunitiesPaginationController extends PaginationContro
|
|
|
14
14
|
queryParams: Amity.RecommendedCommunityLiveCollection,
|
|
15
15
|
token: string | undefined,
|
|
16
16
|
) {
|
|
17
|
-
const {
|
|
17
|
+
const {
|
|
18
|
+
limit = COLLECTION_DEFAULT_PAGINATION_LIMIT,
|
|
19
|
+
includeDiscoverablePrivateCommunity,
|
|
20
|
+
...params
|
|
21
|
+
} = queryParams;
|
|
18
22
|
const options = token ? { token } : { limit };
|
|
19
23
|
|
|
20
24
|
const { data: queryResponse } = await this.http.get<Amity.CommunityPayload & Amity.Pagination>(
|
|
@@ -23,6 +27,7 @@ export class RecommendedCommunitiesPaginationController extends PaginationContro
|
|
|
23
27
|
params: {
|
|
24
28
|
...params,
|
|
25
29
|
options,
|
|
30
|
+
includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity ?? true,
|
|
26
31
|
},
|
|
27
32
|
},
|
|
28
33
|
);
|
|
@@ -66,7 +66,7 @@ export class RecommendedCommunitiesQueryStreamController extends QueryStreamCont
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
reactor(action: EnumCommunityActions | EnumCommunityMemberActions) {
|
|
69
|
-
return (community: Amity.
|
|
69
|
+
return (community: Amity.InternalCommunity) => {
|
|
70
70
|
const collection = pullFromCache<Amity.RecommendedCommunityLiveCollectionCache>(
|
|
71
71
|
this.cacheKey,
|
|
72
72
|
)?.data;
|
|
@@ -79,7 +79,7 @@ export class RecommendedCommunitiesQueryStreamController extends QueryStreamCont
|
|
|
79
79
|
|
|
80
80
|
subscribeRTE(
|
|
81
81
|
createSubscriber: {
|
|
82
|
-
fn: (reactor: (channel: Amity.
|
|
82
|
+
fn: (reactor: (channel: Amity.InternalCommunity) => void) => Amity.Unsubscriber;
|
|
83
83
|
action: EnumCommunityActions | EnumCommunityMemberActions;
|
|
84
84
|
}[],
|
|
85
85
|
) {
|
|
@@ -13,8 +13,12 @@ import {
|
|
|
13
13
|
onLocalCommunityJoined,
|
|
14
14
|
onLocalCommunityLeft,
|
|
15
15
|
onCommunityUserChanged,
|
|
16
|
+
onLocalCommunityJoin,
|
|
16
17
|
} from '~/communityRepository/communityMembership';
|
|
18
|
+
|
|
17
19
|
import { isNonNullable } from '~/utils';
|
|
20
|
+
import { communityLinkedObject } from '~/utils/linkedObject/communityLinkedObject';
|
|
21
|
+
import { convertEventPayload } from '~/utils/event';
|
|
18
22
|
|
|
19
23
|
export class TrendingCommunityLiveCollectionController extends LiveCollectionController<
|
|
20
24
|
'community',
|
|
@@ -81,6 +85,10 @@ export class TrendingCommunityLiveCollectionController extends LiveCollectionCon
|
|
|
81
85
|
{ fn: onCommunityUserChanged, action: EnumCommunityMemberActions.OnMemberCountChanged },
|
|
82
86
|
{ fn: onLocalCommunityJoined, action: EnumCommunityMemberActions.OnCommunityJoined },
|
|
83
87
|
{ fn: onLocalCommunityLeft, action: EnumCommunityMemberActions.OnCommunityLeft },
|
|
88
|
+
{
|
|
89
|
+
fn: convertEventPayload(onLocalCommunityJoin, 'targetId', 'community'),
|
|
90
|
+
action: EnumCommunityActions.OnCommunityUpdated,
|
|
91
|
+
},
|
|
84
92
|
]);
|
|
85
93
|
}
|
|
86
94
|
|
|
@@ -94,7 +102,7 @@ export class TrendingCommunityLiveCollectionController extends LiveCollectionCon
|
|
|
94
102
|
collection.data
|
|
95
103
|
.map(id => pullFromCache<Amity.Community>(['community', 'get', id]))
|
|
96
104
|
.filter(isNonNullable)
|
|
97
|
-
.map(({ data }) => data) ?? [];
|
|
105
|
+
.map(({ data }) => communityLinkedObject(data)) ?? [];
|
|
98
106
|
|
|
99
107
|
if (!this.shouldNotify(data) && origin === 'event') return;
|
|
100
108
|
|
|
@@ -11,7 +11,11 @@ export class TrendingCommunitiesPaginationController extends PaginationControlle
|
|
|
11
11
|
Amity.TrendingCommunityLiveCollection
|
|
12
12
|
> {
|
|
13
13
|
async getRequest(queryParams: Amity.TrendingCommunityLiveCollection, token: string | undefined) {
|
|
14
|
-
const {
|
|
14
|
+
const {
|
|
15
|
+
limit = COLLECTION_DEFAULT_PAGINATION_LIMIT,
|
|
16
|
+
includeDiscoverablePrivateCommunity,
|
|
17
|
+
...params
|
|
18
|
+
} = queryParams;
|
|
15
19
|
const options = token ? { token } : { limit };
|
|
16
20
|
|
|
17
21
|
const { data: queryResponse } = await this.http.get<Amity.CommunityPayload & Amity.Pagination>(
|
|
@@ -20,6 +24,7 @@ export class TrendingCommunitiesPaginationController extends PaginationControlle
|
|
|
20
24
|
params: {
|
|
21
25
|
...params,
|
|
22
26
|
options,
|
|
27
|
+
includeDiscoverablePrivateCommunity: includeDiscoverablePrivateCommunity ?? true,
|
|
23
28
|
},
|
|
24
29
|
},
|
|
25
30
|
);
|
|
@@ -64,7 +64,7 @@ export class TrendingCommunitiesQueryStreamController extends QueryStreamControl
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
reactor(action: EnumCommunityActions | EnumCommunityMemberActions) {
|
|
67
|
-
return (community: Amity.
|
|
67
|
+
return (community: Amity.InternalCommunity) => {
|
|
68
68
|
const collection = pullFromCache<Amity.TrendingCommunityLiveCollectionCache>(
|
|
69
69
|
this.cacheKey,
|
|
70
70
|
)?.data;
|
|
@@ -77,7 +77,7 @@ export class TrendingCommunitiesQueryStreamController extends QueryStreamControl
|
|
|
77
77
|
|
|
78
78
|
subscribeRTE(
|
|
79
79
|
createSubscriber: {
|
|
80
|
-
fn: (reactor: (channel: Amity.
|
|
80
|
+
fn: (reactor: (channel: Amity.InternalCommunity) => void) => Amity.Unsubscriber;
|
|
81
81
|
action: EnumCommunityActions | EnumCommunityMemberActions;
|
|
82
82
|
}[],
|
|
83
83
|
) {
|
|
@@ -15,8 +15,10 @@ import {
|
|
|
15
15
|
onCommunityLeft,
|
|
16
16
|
onLocalCommunityLeft,
|
|
17
17
|
onCommunityUserChanged,
|
|
18
|
+
onLocalCommunityJoin,
|
|
18
19
|
} from '~/communityRepository/communityMembership';
|
|
19
20
|
import { isNonNullable } from '~/utils';
|
|
21
|
+
import { convertEventPayload } from '~/utils/event';
|
|
20
22
|
|
|
21
23
|
export class SearchCommunityLiveCollectionController extends LiveCollectionController<
|
|
22
24
|
'community',
|
|
@@ -81,6 +83,10 @@ export class SearchCommunityLiveCollectionController extends LiveCollectionContr
|
|
|
81
83
|
{ fn: onCommunityUserChanged, action: EnumCommunityMemberActions.OnMemberCountChanged },
|
|
82
84
|
{ fn: onLocalCommunityJoined, action: EnumCommunityMemberActions.OnCommunityJoined },
|
|
83
85
|
{ fn: onLocalCommunityLeft, action: EnumCommunityMemberActions.OnCommunityLeft },
|
|
86
|
+
{
|
|
87
|
+
fn: convertEventPayload(onLocalCommunityJoin, 'targetId', 'community'),
|
|
88
|
+
action: EnumCommunityActions.OnCommunityUpdated,
|
|
89
|
+
},
|
|
84
90
|
]);
|
|
85
91
|
}
|
|
86
92
|
|
package/src/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.ts
CHANGED
|
@@ -22,6 +22,7 @@ export class CommunitiesPaginationController extends PaginationController<
|
|
|
22
22
|
isDeleted: inferIsDeleted(params.includeDeleted),
|
|
23
23
|
keyword: params.displayName,
|
|
24
24
|
filter: params.membership,
|
|
25
|
+
includeDiscoverablePrivateCommunity: params.includeDiscoverablePrivateCommunity ?? true,
|
|
25
26
|
options,
|
|
26
27
|
},
|
|
27
28
|
},
|
|
@@ -60,7 +60,7 @@ export class CommunitiesQueryStreamController extends QueryStreamController<
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
reactor(action: EnumCommunityActions | EnumCommunityMemberActions) {
|
|
63
|
-
return (community: Amity.
|
|
63
|
+
return (community: Amity.InternalCommunity) => {
|
|
64
64
|
const collection = pullFromCache<Amity.SearchCommunityLiveCollectionCache>(
|
|
65
65
|
this.cacheKey,
|
|
66
66
|
)?.data;
|
|
@@ -73,7 +73,7 @@ export class CommunitiesQueryStreamController extends QueryStreamController<
|
|
|
73
73
|
|
|
74
74
|
subscribeRTE(
|
|
75
75
|
createSubscriber: {
|
|
76
|
-
fn: (reactor: (channel: Amity.
|
|
76
|
+
fn: (reactor: (channel: Amity.InternalCommunity) => void) => Amity.Unsubscriber;
|
|
77
77
|
action: EnumCommunityActions | EnumCommunityMemberActions;
|
|
78
78
|
}[],
|
|
79
79
|
) {
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
onLocalCommunityJoined,
|
|
16
16
|
onLocalCommunityLeft,
|
|
17
17
|
onCommunityUserChanged,
|
|
18
|
+
onLocalCommunityJoin,
|
|
18
19
|
} from '~/communityRepository/communityMembership';
|
|
19
20
|
|
|
20
21
|
import { isNonNullable } from '~/utils';
|
|
@@ -24,6 +25,7 @@ import { prepareSemanticSearchCommunityPayload } from '~/communityRepository/uti
|
|
|
24
25
|
import { getActiveClient } from '~/client';
|
|
25
26
|
import { EnumCommunityMemberActions } from '~/communityRepository/communityMembership/observers/getMembers/enums';
|
|
26
27
|
import { filterByCommunityMembership } from '~/core/query';
|
|
28
|
+
import { convertEventPayload } from '~/utils/event';
|
|
27
29
|
|
|
28
30
|
export class SemanticSearchCommunityLiveCollectionController extends LiveCollectionController<
|
|
29
31
|
'semanticSearchCommunity',
|
|
@@ -94,6 +96,10 @@ export class SemanticSearchCommunityLiveCollectionController extends LiveCollect
|
|
|
94
96
|
{ fn: onCommunityUserChanged, action: EnumCommunityMemberActions.OnMemberCountChanged },
|
|
95
97
|
{ fn: onLocalCommunityJoined, action: EnumCommunityMemberActions.OnCommunityJoined },
|
|
96
98
|
{ fn: onLocalCommunityLeft, action: EnumCommunityMemberActions.OnCommunityLeft },
|
|
99
|
+
{
|
|
100
|
+
fn: convertEventPayload(onLocalCommunityJoin, 'targetId', 'community'),
|
|
101
|
+
action: EnumCommunityActions.OnCommunityUpdated,
|
|
102
|
+
},
|
|
97
103
|
]);
|
|
98
104
|
}
|
|
99
105
|
|
|
@@ -29,6 +29,7 @@ export class SemanticSearchCommunityPaginationController extends PaginationContr
|
|
|
29
29
|
...params,
|
|
30
30
|
filter: communityMembershipStatus ?? AmityCommunityMemberStatusFilter.ALL,
|
|
31
31
|
options,
|
|
32
|
+
includeDiscoverablePrivateCommunity: params.includeDiscoverablePrivateCommunity ?? true,
|
|
32
33
|
},
|
|
33
34
|
});
|
|
34
35
|
return queryResponse;
|
|
@@ -63,7 +63,7 @@ export class SemanticSearchCommunityQueryStreamController extends QueryStreamCon
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
reactor(action: EnumCommunityActions | EnumCommunityMemberActions) {
|
|
66
|
-
return (community: Amity.
|
|
66
|
+
return (community: Amity.InternalCommunity) => {
|
|
67
67
|
const collection = pullFromCache<Amity.CommunityLiveCollectionCache>(this.cacheKey)?.data;
|
|
68
68
|
if (!collection) return;
|
|
69
69
|
|
|
@@ -77,7 +77,7 @@ export class SemanticSearchCommunityQueryStreamController extends QueryStreamCon
|
|
|
77
77
|
|
|
78
78
|
subscribeRTE(
|
|
79
79
|
createSubscriber: {
|
|
80
|
-
fn: (reactor: (community: Amity.
|
|
80
|
+
fn: (reactor: (community: Amity.InternalCommunity) => void) => Amity.Unsubscriber;
|
|
81
81
|
action: EnumCommunityActions | EnumCommunityMemberActions;
|
|
82
82
|
}[],
|
|
83
83
|
) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { pullFromCache } from '~/cache/api';
|
|
2
|
-
import { getActiveUser } from '~/client';
|
|
2
|
+
import { getActiveUser } from '~/client/api/activeUser';
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
* verifies membership status
|
|
@@ -12,7 +12,7 @@ function isMember(membership: Amity.Membership<'community'>['communityMembership
|
|
|
12
12
|
* checks if currently logged in user is part of the community
|
|
13
13
|
*/
|
|
14
14
|
function isCurrentUserPartOfCommunity(
|
|
15
|
-
c: Amity.
|
|
15
|
+
c: Amity.InternalCommunity,
|
|
16
16
|
m: Amity.Membership<'community'>,
|
|
17
17
|
): boolean {
|
|
18
18
|
const { userId } = getActiveUser();
|
|
@@ -28,11 +28,15 @@ function isCurrentUserPartOfCommunity(
|
|
|
28
28
|
* Althought this can be calculated, it's not scalable.
|
|
29
29
|
*/
|
|
30
30
|
export function updateMembershipStatus(
|
|
31
|
-
communities: Amity.
|
|
31
|
+
communities: Amity.RawCommunity[],
|
|
32
32
|
communityUsers: Amity.Membership<'community'>[],
|
|
33
|
-
): Amity.
|
|
33
|
+
): Amity.InternalCommunity[] {
|
|
34
34
|
return communities.map(c => {
|
|
35
|
-
const cachedCommunity = pullFromCache<Amity.
|
|
35
|
+
const cachedCommunity = pullFromCache<Amity.InternalCommunity>([
|
|
36
|
+
'community',
|
|
37
|
+
'get',
|
|
38
|
+
c.communityId,
|
|
39
|
+
]);
|
|
36
40
|
if (cachedCommunity?.data && cachedCommunity?.data.hasOwnProperty('isJoined')) {
|
|
37
41
|
return {
|
|
38
42
|
...cachedCommunity.data,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CommunityPostSettingMaps, DefaultCommunityPostSetting } from '~/@types';
|
|
2
2
|
import { updateMembershipStatus } from './communityWithMembership';
|
|
3
|
+
import { convertRawUserToInternalUser } from '~/userRepository/utils/convertRawUserToInternalUser';
|
|
3
4
|
|
|
4
5
|
const getMatchPostSetting = (value: {
|
|
5
6
|
needApprovalOnPostCreation: Amity.RawCommunity['needApprovalOnPostCreation'];
|
|
@@ -13,7 +14,7 @@ const getMatchPostSetting = (value: {
|
|
|
13
14
|
) ?? DefaultCommunityPostSetting;
|
|
14
15
|
|
|
15
16
|
export function addPostSetting({ communities }: { communities: Amity.RawCommunity[] }) {
|
|
16
|
-
return communities.map<Amity.
|
|
17
|
+
return communities.map<Amity.InternalCommunity>(
|
|
17
18
|
({ needApprovalOnPostCreation, onlyAdminCanPost, ...restCommunityPayload }) => ({
|
|
18
19
|
postSetting: getMatchPostSetting({
|
|
19
20
|
needApprovalOnPostCreation,
|
|
@@ -29,10 +30,13 @@ export const prepareCommunityPayload = (
|
|
|
29
30
|
): Amity.ProcessedCommunityPayload => {
|
|
30
31
|
const communitiesWithPostSetting = addPostSetting({ communities: rawPayload.communities });
|
|
31
32
|
|
|
33
|
+
// Convert users to internal format
|
|
34
|
+
const internalUsers = rawPayload.users.map(convertRawUserToInternalUser);
|
|
35
|
+
|
|
32
36
|
// map users with community
|
|
33
37
|
const mappedCommunityUsers: Array<Amity.Membership<'community'>> = rawPayload.communityUsers.map(
|
|
34
38
|
communityUser => {
|
|
35
|
-
const user =
|
|
39
|
+
const user = internalUsers.find(user => user.userId === communityUser.userId)!;
|
|
36
40
|
|
|
37
41
|
return {
|
|
38
42
|
...communityUser,
|
|
@@ -48,11 +52,33 @@ export const prepareCommunityPayload = (
|
|
|
48
52
|
|
|
49
53
|
return {
|
|
50
54
|
...rawPayload,
|
|
55
|
+
users: rawPayload.users.map(convertRawUserToInternalUser),
|
|
51
56
|
communities: communityWithMembershipStatus,
|
|
52
57
|
communityUsers: mappedCommunityUsers,
|
|
53
58
|
};
|
|
54
59
|
};
|
|
55
60
|
|
|
61
|
+
export const prepareCommunityJoinRequestPayload = (
|
|
62
|
+
rawPayload: Amity.CommunityJoinRequestPayload,
|
|
63
|
+
): Amity.ProcessedJoinRequestPayload => {
|
|
64
|
+
const mappedJoinRequests: Array<Amity.InternalJoinRequest> = rawPayload.joinRequests.map(
|
|
65
|
+
joinRequest => {
|
|
66
|
+
return {
|
|
67
|
+
...joinRequest,
|
|
68
|
+
joinRequestId: joinRequest._id,
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const users = rawPayload.users.map(convertRawUserToInternalUser);
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
...rawPayload,
|
|
77
|
+
joinRequests: mappedJoinRequests,
|
|
78
|
+
users,
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
|
|
56
82
|
export const prepareCommunityMembershipPayload = (
|
|
57
83
|
rawPayload: Amity.CommunityMembershipPayload,
|
|
58
84
|
): Amity.ProcessedCommunityMembershipPayload => {
|
package/src/core/model/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { createEventSubscriber } from '~/core/events';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ```js
|
|
6
|
+
* import { onLocalInvitationCreated } from '@amityco/ts-sdk'
|
|
7
|
+
* const dispose = onLocalInvitationCreated(data => {
|
|
8
|
+
* // ...
|
|
9
|
+
* })
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Fired when an {@link Amity.InvitationPayload} has been created
|
|
13
|
+
*
|
|
14
|
+
* @param callback The function to call when the event was fired
|
|
15
|
+
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
16
|
+
*
|
|
17
|
+
* @category Invitation Events
|
|
18
|
+
*/
|
|
19
|
+
export const onLocalInvitationCreated = (
|
|
20
|
+
callback: Amity.Listener<Amity.InternalInvitation[]>,
|
|
21
|
+
): Amity.Unsubscriber => {
|
|
22
|
+
const client = getActiveClient();
|
|
23
|
+
|
|
24
|
+
const disposers = [
|
|
25
|
+
createEventSubscriber(client, 'onLocalInvitationCreated', 'local.invitation.created', payload =>
|
|
26
|
+
callback(payload),
|
|
27
|
+
),
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
disposers.forEach(fn => fn());
|
|
32
|
+
};
|
|
33
|
+
};
|