@amityco/ts-sdk-react-native 7.5.3 → 7.6.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
|
@@ -6,6 +6,7 @@ import { getResolver } from '~/core/model';
|
|
|
6
6
|
import { inferIsDeleted } from '~/utils/inferIsDeleted';
|
|
7
7
|
import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
|
|
8
8
|
import { prepareCommunityPayload } from '../utils';
|
|
9
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* ```js
|
|
@@ -49,6 +50,7 @@ export const queryCommunities = async (
|
|
|
49
50
|
...restParams,
|
|
50
51
|
isDeleted: inferIsDeleted(includeDeleted),
|
|
51
52
|
filter: membership,
|
|
53
|
+
includeDiscoverablePrivateCommunity: params?.includeDiscoverablePrivateCommunity ?? true,
|
|
52
54
|
options,
|
|
53
55
|
},
|
|
54
56
|
},
|
|
@@ -68,5 +70,9 @@ export const queryCommunities = async (
|
|
|
68
70
|
saveCommunityUsers(data.communities, data.communityUsers);
|
|
69
71
|
}
|
|
70
72
|
|
|
71
|
-
return {
|
|
73
|
+
return {
|
|
74
|
+
data: communities.map(community => LinkedObject.community(community)),
|
|
75
|
+
cachedAt,
|
|
76
|
+
paging,
|
|
77
|
+
};
|
|
72
78
|
};
|
|
@@ -5,14 +5,15 @@ import { fireEvent } from '~/core/events';
|
|
|
5
5
|
|
|
6
6
|
import { saveCommunityUsers } from '~/communityRepository/utils/saveCommunityUsers';
|
|
7
7
|
import { prepareCommunityPayload, prepareCommunityRequest } from '../utils';
|
|
8
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
8
9
|
|
|
9
10
|
/* begin_public_function
|
|
10
11
|
id: community.update
|
|
11
12
|
*/
|
|
12
13
|
/**
|
|
13
14
|
* ```js
|
|
14
|
-
* import { updateCommunity } from '@amityco/ts-sdk
|
|
15
|
-
* const updated = await updateCommunity(communityId, { displayName: 'foobar' })
|
|
15
|
+
* import { updateCommunity } from '@amityco/ts-sdk'
|
|
16
|
+
* const updated = await updateCommunity(communityId, { displayName: 'foobar', isDiscoverable: true, requiresJoinApproval: false })
|
|
16
17
|
* ```
|
|
17
18
|
*
|
|
18
19
|
* Updates an {@link Amity.Community}
|
|
@@ -28,7 +29,14 @@ export const updateCommunity = async (
|
|
|
28
29
|
communityId: Amity.Community['communityId'],
|
|
29
30
|
patch: Patch<
|
|
30
31
|
Amity.Community,
|
|
31
|
-
|
|
32
|
+
| 'displayName'
|
|
33
|
+
| 'avatarFileId'
|
|
34
|
+
| 'description'
|
|
35
|
+
| 'postSetting'
|
|
36
|
+
| 'tags'
|
|
37
|
+
| 'metadata'
|
|
38
|
+
| 'isDiscoverable'
|
|
39
|
+
| 'requiresJoinApproval'
|
|
32
40
|
> &
|
|
33
41
|
Amity.CommunityStorySettings,
|
|
34
42
|
): Promise<Amity.Cached<Amity.Community>> => {
|
|
@@ -53,7 +61,9 @@ export const updateCommunity = async (
|
|
|
53
61
|
const { communities } = data;
|
|
54
62
|
|
|
55
63
|
return {
|
|
56
|
-
data:
|
|
64
|
+
data: LinkedObject.community(
|
|
65
|
+
communities.find(community => community.communityId === communityId)!,
|
|
66
|
+
),
|
|
57
67
|
cachedAt,
|
|
58
68
|
};
|
|
59
69
|
};
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityJoined = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.joined', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityLeft = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.left', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserAdded = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.userAdded', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserBanned = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.userBanned', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserChanged = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, members: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.userChanged', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserRemoved = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.userRemoved', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserRoleAdded = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.roleAdded', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserRoleRemoved = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.roleRemoved', callback);
|
|
@@ -16,5 +16,5 @@ import { createCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onCommunityUserUnbanned = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createCommunityMemberEventSubscriber('community.userUnbanned', callback);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { createEventSubscriber } from '~/core/events';
|
|
3
|
+
|
|
4
|
+
export const onLocalCommunityJoin = (
|
|
5
|
+
callback: (joinRequest: Amity.InternalJoinRequest) => void,
|
|
6
|
+
) => {
|
|
7
|
+
const client = getActiveClient();
|
|
8
|
+
|
|
9
|
+
const filter = async (rawPayload: Amity.InternalJoinRequest[]) => {
|
|
10
|
+
callback(rawPayload[0]);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
const disposers = [
|
|
14
|
+
createEventSubscriber(client, 'onCommunityUpdate', 'v4.local.community.joined', filter),
|
|
15
|
+
];
|
|
16
|
+
|
|
17
|
+
return () => {
|
|
18
|
+
disposers.forEach(fn => fn());
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createLocalCommunityMemberEventSubscriber } from './utils';
|
|
2
2
|
|
|
3
3
|
export const onLocalCommunityJoined = (
|
|
4
|
-
callback: (community: Amity.
|
|
4
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
5
5
|
) => createLocalCommunityMemberEventSubscriber('local.community.joined', callback);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createLocalCommunityMemberEventSubscriber } from './utils';
|
|
2
2
|
|
|
3
3
|
export const onLocalCommunityLeft = (
|
|
4
|
-
callback: (community: Amity.
|
|
4
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
5
5
|
) => createLocalCommunityMemberEventSubscriber('local.community.left', callback);
|
|
@@ -16,5 +16,5 @@ import { createLocalCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onLocalCommunityUserAdded = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createLocalCommunityMemberEventSubscriber('local.community.userAdded', callback);
|
|
@@ -16,5 +16,5 @@ import { createLocalCommunityMemberEventSubscriber } from './utils';
|
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
18
|
export const onLocalCommunityUserRemoved = (
|
|
19
|
-
callback: (community: Amity.
|
|
19
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
20
20
|
) => createLocalCommunityMemberEventSubscriber('local.community.userRemoved', callback);
|
|
@@ -22,7 +22,9 @@ import { getResolver } from '~/core/model';
|
|
|
22
22
|
*/
|
|
23
23
|
export const onUserDeleted =
|
|
24
24
|
(communityId: string) =>
|
|
25
|
-
(
|
|
25
|
+
(
|
|
26
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
27
|
+
) => {
|
|
26
28
|
const client = getActiveClient();
|
|
27
29
|
|
|
28
30
|
const filter = (payload: Amity.UserPayload) => {
|
|
@@ -53,7 +53,7 @@ function getEventRelatedMember(
|
|
|
53
53
|
|
|
54
54
|
export const createCommunityMemberEventSubscriber = (
|
|
55
55
|
event: keyof Amity.MqttCommunityUserEvents,
|
|
56
|
-
callback: (community: Amity.
|
|
56
|
+
callback: (community: Amity.InternalCommunity, members: Amity.Membership<'community'>[]) => void,
|
|
57
57
|
) => {
|
|
58
58
|
const client = getActiveClient();
|
|
59
59
|
|
|
@@ -102,7 +102,7 @@ export const createCommunityMemberEventSubscriber = (
|
|
|
102
102
|
|
|
103
103
|
export const createLocalCommunityMemberEventSubscriber = (
|
|
104
104
|
event: keyof Amity.LocalCommunityEvents,
|
|
105
|
-
callback: (community: Amity.
|
|
105
|
+
callback: (community: Amity.InternalCommunity, members: Amity.Membership<'community'>[]) => void,
|
|
106
106
|
) => {
|
|
107
107
|
const client = getActiveClient();
|
|
108
108
|
|
|
@@ -70,7 +70,10 @@ export class CommunityMembersQueryStreamController extends QueryStreamController
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
reactor(action: EnumCommunityMemberActions) {
|
|
73
|
-
return (
|
|
73
|
+
return (
|
|
74
|
+
community: Amity.InternalCommunity,
|
|
75
|
+
communityMembers: Amity.Membership<'community'>[],
|
|
76
|
+
) => {
|
|
74
77
|
const collection = pullFromCache<Amity.CommunityMemberLiveCollectionCache>(
|
|
75
78
|
this.cacheKey,
|
|
76
79
|
)?.data;
|
|
@@ -97,7 +100,10 @@ export class CommunityMembersQueryStreamController extends QueryStreamController
|
|
|
97
100
|
subscribeRTE(
|
|
98
101
|
createSubscriber: {
|
|
99
102
|
fn: (
|
|
100
|
-
reactor: (
|
|
103
|
+
reactor: (
|
|
104
|
+
channel: Amity.InternalCommunity,
|
|
105
|
+
communityUser: Amity.Membership<'community'>[],
|
|
106
|
+
) => void,
|
|
101
107
|
) => Amity.Unsubscriber;
|
|
102
108
|
action: EnumCommunityMemberActions;
|
|
103
109
|
}[],
|
|
@@ -70,7 +70,10 @@ export class SearchCommunityMembersQueryStreamController extends QueryStreamCont
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
reactor(action: EnumCommunityMemberActions) {
|
|
73
|
-
return (
|
|
73
|
+
return (
|
|
74
|
+
community: Amity.InternalCommunity,
|
|
75
|
+
communityMembers: Amity.Membership<'community'>[],
|
|
76
|
+
) => {
|
|
74
77
|
const collection = pullFromCache<Amity.SearchCommunityMemberLiveCollectionCache>(
|
|
75
78
|
this.cacheKey,
|
|
76
79
|
)?.data;
|
|
@@ -95,7 +98,10 @@ export class SearchCommunityMembersQueryStreamController extends QueryStreamCont
|
|
|
95
98
|
subscribeRTE(
|
|
96
99
|
createSubscriber: {
|
|
97
100
|
fn: (
|
|
98
|
-
reactor: (
|
|
101
|
+
reactor: (
|
|
102
|
+
channel: Amity.InternalCommunity,
|
|
103
|
+
communityUser: Amity.Membership<'community'>[],
|
|
104
|
+
) => void,
|
|
99
105
|
) => Amity.Unsubscriber;
|
|
100
106
|
action: EnumCommunityMemberActions;
|
|
101
107
|
}[],
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export enum EnumCommunityMemberActions {
|
|
2
2
|
OnCommunityJoined = 'onCommunityJoined',
|
|
3
|
+
OnLocalCommunityJoin = 'onLocalCommunityJoin',
|
|
3
4
|
OnCommunityLeft = 'onCommunityLeft',
|
|
4
5
|
OnCommunityUserBanned = 'onCommunityUserBanned',
|
|
5
6
|
OnCommunityUserChanged = 'onCommunityUserChanged',
|
|
@@ -17,7 +17,7 @@ import { createEventSubscriber } from '~/core/events';
|
|
|
17
17
|
* @category Community Events
|
|
18
18
|
*/
|
|
19
19
|
export const onLocalCommunityRoleAdded = (
|
|
20
|
-
callback: (community: Amity.
|
|
20
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
21
21
|
): Amity.Unsubscriber => {
|
|
22
22
|
const client = getActiveClient();
|
|
23
23
|
|
|
@@ -17,7 +17,7 @@ import { createEventSubscriber } from '~/core/events';
|
|
|
17
17
|
* @category Community Events
|
|
18
18
|
*/
|
|
19
19
|
export const onLocalCommunityRoleRemoved = (
|
|
20
|
-
callback: (community: Amity.
|
|
20
|
+
callback: (community: Amity.InternalCommunity, member: Amity.Membership<'community'>[]) => void,
|
|
21
21
|
): Amity.Unsubscriber => {
|
|
22
22
|
const client = getActiveClient();
|
|
23
23
|
|
|
@@ -15,5 +15,5 @@ import { createCommunityEventSubscriber } from './utils';
|
|
|
15
15
|
*
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
|
-
export const onCommunityCreated = (callback: Amity.Listener<Amity.
|
|
18
|
+
export const onCommunityCreated = (callback: Amity.Listener<Amity.InternalCommunity>) =>
|
|
19
19
|
createCommunityEventSubscriber('community.created', callback);
|
|
@@ -15,5 +15,5 @@ import { createCommunityEventSubscriber } from './utils';
|
|
|
15
15
|
*
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
|
-
export const onCommunityDeleted = (callback: Amity.Listener<Amity.
|
|
18
|
+
export const onCommunityDeleted = (callback: Amity.Listener<Amity.InternalCommunity>) =>
|
|
19
19
|
createCommunityEventSubscriber('community.deleted', callback);
|
|
@@ -15,5 +15,5 @@ import { createCommunityEventSubscriber } from './utils';
|
|
|
15
15
|
*
|
|
16
16
|
* @category Community Events
|
|
17
17
|
*/
|
|
18
|
-
export const onCommunityUpdated = (callback: Amity.Listener<Amity.
|
|
18
|
+
export const onCommunityUpdated = (callback: Amity.Listener<Amity.InternalCommunity>) =>
|
|
19
19
|
createCommunityEventSubscriber('community.updated', callback);
|
|
@@ -7,7 +7,7 @@ import { prepareCommunityPayload } from '../utils';
|
|
|
7
7
|
|
|
8
8
|
export const createCommunityEventSubscriber = (
|
|
9
9
|
event: keyof Amity.MqttCommunityEvents,
|
|
10
|
-
callback: Amity.Listener<Amity.
|
|
10
|
+
callback: Amity.Listener<Amity.InternalCommunity>,
|
|
11
11
|
) => {
|
|
12
12
|
const client = getActiveClient();
|
|
13
13
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
3
|
+
import { prepareCommunityJoinRequestPayload } from '~/communityRepository/utils';
|
|
4
|
+
import { joinRequestLinkedObject } from '~/utils/linkedObject/joinRequestLinkedObject';
|
|
5
|
+
|
|
6
|
+
/* begin_public_function
|
|
7
|
+
id: community.getMyJoinRequest
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* ```js
|
|
11
|
+
* import { community } from '@amityco/ts-sdk'
|
|
12
|
+
* const isJoined = await community.getMyJoinRequest('foobar')
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Joins a {@link Amity.Community} object
|
|
16
|
+
*
|
|
17
|
+
* @param communityId the {@link Amity.Community} to join
|
|
18
|
+
* @returns A success boolean if the {@link Amity.Community} was joined
|
|
19
|
+
*
|
|
20
|
+
* @category Community API
|
|
21
|
+
* @async
|
|
22
|
+
*/
|
|
23
|
+
export const getMyJoinRequest = async (
|
|
24
|
+
communityId: Amity.Community['communityId'],
|
|
25
|
+
): Promise<Amity.Cached<Amity.JoinRequest | undefined>> => {
|
|
26
|
+
const client = getActiveClient();
|
|
27
|
+
client.log('community/myJoinRequest', communityId);
|
|
28
|
+
|
|
29
|
+
const { data: payload } = await client.http.get<Amity.CommunityJoinRequestPayload>(
|
|
30
|
+
`/api/v4/communities/${communityId}/join/me`,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
const data = prepareCommunityJoinRequestPayload(payload);
|
|
34
|
+
|
|
35
|
+
const cachedAt = client.cache && Date.now();
|
|
36
|
+
if (client.cache) ingestInCache(data, { cachedAt });
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
data: data.joinRequests[0] ? joinRequestLinkedObject(data.joinRequests[0]) : undefined,
|
|
40
|
+
cachedAt,
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/* end_public_function */
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
3
|
+
import { pullFromCache } from '~/cache/api/pullFromCache';
|
|
4
|
+
import { upsertInCache } from '~/cache/api/upsertInCache';
|
|
5
|
+
import { prepareCommunityJoinRequestPayload } from '~/communityRepository/utils';
|
|
6
|
+
import { fireEvent } from '~/core/events';
|
|
7
|
+
import { JoinRequestStatusEnum, JoinResultStatusEnum } from '~/@types/domains/joinRequest';
|
|
8
|
+
import { joinRequestLinkedObject } from '~/utils/linkedObject/joinRequestLinkedObject';
|
|
9
|
+
|
|
10
|
+
/* begin_public_function
|
|
11
|
+
id: community.join
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* ```js
|
|
15
|
+
* import { community } from '@amityco/ts-sdk'
|
|
16
|
+
* const isJoined = await community.join('foobar')
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* Joins a {@link Amity.Community} object
|
|
20
|
+
*
|
|
21
|
+
* @param communityId the {@link Amity.Community} to join
|
|
22
|
+
* @returns A status join result
|
|
23
|
+
*
|
|
24
|
+
* @category Community API
|
|
25
|
+
* @async
|
|
26
|
+
*/
|
|
27
|
+
export const joinRequest = async (
|
|
28
|
+
communityId: Amity.Community['communityId'],
|
|
29
|
+
): Promise<Amity.JoinResult> => {
|
|
30
|
+
const client = getActiveClient();
|
|
31
|
+
client.log('community/joinRequest', communityId);
|
|
32
|
+
|
|
33
|
+
const { data: payload } = await client.http.post<Amity.CommunityJoinRequestPayload>(
|
|
34
|
+
`/api/v4/communities/${communityId}/join`,
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
const data = prepareCommunityJoinRequestPayload(payload);
|
|
38
|
+
|
|
39
|
+
const cachedAt = client.cache && Date.now();
|
|
40
|
+
if (client.cache) ingestInCache(data, { cachedAt });
|
|
41
|
+
|
|
42
|
+
const status =
|
|
43
|
+
data.joinRequests[0].status === JoinRequestStatusEnum.Approved
|
|
44
|
+
? JoinResultStatusEnum.Success
|
|
45
|
+
: JoinResultStatusEnum.Pending;
|
|
46
|
+
|
|
47
|
+
if (status === JoinResultStatusEnum.Success && client.cache) {
|
|
48
|
+
const community = pullFromCache<Amity.Community>(['community', 'get', communityId])?.data;
|
|
49
|
+
|
|
50
|
+
if (community) {
|
|
51
|
+
const updatedCommunity = {
|
|
52
|
+
...community,
|
|
53
|
+
isJoined: true,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
upsertInCache(['community', 'get', communityId], updatedCommunity);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
fireEvent('v4.local.community.joined', data.joinRequests);
|
|
61
|
+
|
|
62
|
+
return status === JoinResultStatusEnum.Success
|
|
63
|
+
? { status }
|
|
64
|
+
: { status, request: joinRequestLinkedObject(data.joinRequests[0]) };
|
|
65
|
+
};
|
|
66
|
+
/* end_public_function */
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { createEventSubscriber } from '~/core/events';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ```js
|
|
6
|
+
* import { onJoinRequestCreated } from '@amityco/ts-sdk'
|
|
7
|
+
* const dispose = onJoinRequestCreated(data => {
|
|
8
|
+
* // ...
|
|
9
|
+
* })
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Fired when an {@link Amity.CommunityJoinRequestPayload} 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 JoinRequest Events
|
|
18
|
+
*/
|
|
19
|
+
export const onJoinRequestCreated = (
|
|
20
|
+
callback: Amity.Listener<Amity.InternalJoinRequest[]>,
|
|
21
|
+
): Amity.Unsubscriber => {
|
|
22
|
+
const client = getActiveClient();
|
|
23
|
+
|
|
24
|
+
const disposers = [
|
|
25
|
+
createEventSubscriber(client, 'onJoinRequestCreated', 'local.joinRequest.created', payload =>
|
|
26
|
+
callback(payload),
|
|
27
|
+
),
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
disposers.forEach(fn => fn());
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { createEventSubscriber } from '~/core/events';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ```js
|
|
6
|
+
* import { onJoinRequestDeleted } from '@amityco/ts-sdk'
|
|
7
|
+
* const dispose = onJoinRequestDeleted(data => {
|
|
8
|
+
* // ...
|
|
9
|
+
* })
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Fired when an {@link Amity.CommunityJoinRequestPayload} 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 JoinRequest Events
|
|
18
|
+
*/
|
|
19
|
+
export const onJoinRequestDeleted = (
|
|
20
|
+
callback: Amity.Listener<Amity.InternalJoinRequest[]>,
|
|
21
|
+
): Amity.Unsubscriber => {
|
|
22
|
+
const client = getActiveClient();
|
|
23
|
+
|
|
24
|
+
const disposers = [
|
|
25
|
+
createEventSubscriber(client, 'onJoinRequestDeleted', 'local.joinRequest.deleted', payload =>
|
|
26
|
+
callback(payload),
|
|
27
|
+
),
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
disposers.forEach(fn => fn());
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
import { createEventSubscriber } from '~/core/events';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* ```js
|
|
6
|
+
* import { onJoinRequestUpdated } from '@amityco/ts-sdk'
|
|
7
|
+
* const dispose = onJoinRequestUpdated(data => {
|
|
8
|
+
* // ...
|
|
9
|
+
* })
|
|
10
|
+
* ```
|
|
11
|
+
*
|
|
12
|
+
* Fired when an {@link Amity.CommunityJoinRequestPayload} 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 JoinRequest Events
|
|
18
|
+
*/
|
|
19
|
+
export const onJoinRequestUpdated = (
|
|
20
|
+
callback: Amity.Listener<Amity.InternalJoinRequest[]>,
|
|
21
|
+
): Amity.Unsubscriber => {
|
|
22
|
+
const client = getActiveClient();
|
|
23
|
+
|
|
24
|
+
const disposers = [
|
|
25
|
+
createEventSubscriber(client, 'onJoinRequestUpdated', 'local.joinRequest.updated', payload =>
|
|
26
|
+
callback(payload),
|
|
27
|
+
),
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
return () => {
|
|
31
|
+
disposers.forEach(fn => fn());
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { fireEvent } from '~/core/events';
|
|
2
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
3
|
+
import { pullFromCache, upsertInCache } from '~/cache/api';
|
|
4
|
+
import { JoinRequestStatusEnum } from '~/@types/domains/joinRequest';
|
|
5
|
+
|
|
6
|
+
/* begin_public_function
|
|
7
|
+
id: joinRequest.approve
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* ```js
|
|
11
|
+
* import { joinRequest } from '@amityco/ts-sdk'
|
|
12
|
+
* const isAccepted = await joinRequest.approve()
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* Accepts a {@link Amity.JoinRequest} object
|
|
16
|
+
*
|
|
17
|
+
* @param joinRequest the {@link Amity.JoinRequest} to accept
|
|
18
|
+
* @returns A success boolean if the {@link Amity.JoinRequest} was accepted
|
|
19
|
+
*
|
|
20
|
+
* @category Join Request API
|
|
21
|
+
* @async
|
|
22
|
+
*/
|
|
23
|
+
export const approveJoinRequest = async (
|
|
24
|
+
joinRequest: Amity.InternalJoinRequest,
|
|
25
|
+
): Promise<boolean> => {
|
|
26
|
+
const client = getActiveClient();
|
|
27
|
+
client.log('joinRequest/approveJoinRequest', joinRequest.joinRequestId);
|
|
28
|
+
|
|
29
|
+
const { data } = await client.http.post<{ success: boolean }>(
|
|
30
|
+
`/api/v4/communities/${joinRequest.targetId}/join/approve`,
|
|
31
|
+
{
|
|
32
|
+
userId: joinRequest.requestorInternalId,
|
|
33
|
+
},
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const joinRequestCache = pullFromCache<Amity.InternalJoinRequest>([
|
|
37
|
+
'joinRequest',
|
|
38
|
+
'get',
|
|
39
|
+
joinRequest.joinRequestId,
|
|
40
|
+
])?.data;
|
|
41
|
+
|
|
42
|
+
if (joinRequestCache) {
|
|
43
|
+
upsertInCache(['joinRequest', 'get', joinRequest.joinRequestId], {
|
|
44
|
+
status: JoinRequestStatusEnum.Approved,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
fireEvent('local.joinRequest.updated', [joinRequestCache]);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return data.success;
|
|
51
|
+
};
|
|
52
|
+
/* end_public_function */
|