@amityco/ts-sdk 7.5.1-37cf937.0 → 7.5.1-3eaba4ad.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 +0 -7
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +1 -5
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +5 -38
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/channel.d.ts +2 -0
- package/dist/@types/domains/channel.d.ts.map +1 -1
- package/dist/@types/domains/client.d.ts +0 -10
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +1 -48
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/content.d.ts +4 -1
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/@types/domains/notification.d.ts +2 -4
- package/dist/@types/domains/notification.d.ts.map +1 -1
- package/dist/@types/domains/post.d.ts +2 -0
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/@types/domains/stream.d.ts +4 -0
- package/dist/@types/domains/stream.d.ts.map +1 -1
- package/dist/@types/index.d.ts +0 -3
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/channelRepository/api/createChannel.d.ts +3 -1
- package/dist/channelRepository/api/createChannel.d.ts.map +1 -1
- package/dist/channelRepository/internalApi/getChannel.d.ts.map +1 -1
- package/dist/communityRepository/api/createCommunity.d.ts +2 -2
- package/dist/communityRepository/api/createCommunity.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 +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/getRecommendedCommunities.d.ts +1 -3
- package/dist/communityRepository/api/getRecommendedCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/getTrendingCommunities.d.ts +1 -3
- package/dist/communityRepository/api/getTrendingCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/joinCommunity.d.ts +0 -3
- 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 +2 -2
- package/dist/communityRepository/api/updateCommunity.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/index.d.ts +0 -1
- 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/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/searchMembers/SearchCommunityMembersQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.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/observers/getCommunities/CommunitiesLiveCollectionController.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/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.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/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.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 +0 -1
- package/dist/communityRepository/observers/index.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/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 +1 -2
- 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 +5109 -6403
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +2578 -3871
- package/dist/index.umd.js +4 -4
- package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts +2 -0
- package/dist/messagePreview/utils/getChannelMessagePreviewWithUser.d.ts.map +1 -1
- package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
- package/dist/messageRepository/api/deleteMessage.d.ts.map +1 -1
- package/dist/messageRepository/observers/getMessages/MessageQueryStreamController.d.ts.map +1 -1
- package/dist/postRepository/api/createPost.d.ts.map +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/postRepository/utils/payload.d.ts.map +1 -1
- package/dist/streamRepository/api/createStream.d.ts +1 -1
- package/dist/streamRepository/api/createStream.d.ts.map +1 -1
- package/dist/streamRepository/api/editStream.d.ts +18 -0
- package/dist/streamRepository/api/editStream.d.ts.map +1 -0
- package/dist/streamRepository/api/index.d.ts +1 -0
- package/dist/streamRepository/api/index.d.ts.map +1 -1
- package/dist/streamRepository/api/updateStream.d.ts +4 -1
- package/dist/streamRepository/api/updateStream.d.ts.map +1 -1
- package/dist/streamRepository/internalApi/getLiveChat.d.ts +16 -0
- package/dist/streamRepository/internalApi/getLiveChat.d.ts.map +1 -0
- package/dist/streamRepository/internalApi/getStream.d.ts +2 -2
- package/dist/streamRepository/internalApi/getStream.d.ts.map +1 -1
- package/dist/subChannelRepository/utils/prepareSubChannelPayload.d.ts.map +1 -1
- package/dist/utils/linkedObject/index.d.ts +0 -3
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
- package/dist/utils/linkedObject/streamLinkedObject.d.ts.map +1 -1
- package/dist/utils/postTypePredicate.d.ts +4 -3
- package/dist/utils/postTypePredicate.d.ts.map +1 -1
- package/dist/utils/tests/dummy/comment.d.ts +1 -1
- package/dist/utils/tests/dummy/post.d.ts +3 -3
- package/package.json +1 -1
- package/src/@types/core/events.ts +0 -10
- package/src/@types/core/model.ts +1 -8
- package/src/@types/core/payload.ts +5 -48
- package/src/@types/domains/channel.ts +3 -0
- package/src/@types/domains/client.ts +0 -12
- package/src/@types/domains/community.ts +1 -73
- package/src/@types/domains/content.ts +6 -0
- package/src/@types/domains/notification.ts +0 -2
- package/src/@types/domains/post.ts +2 -0
- package/src/@types/domains/stream.ts +4 -0
- package/src/@types/index.ts +0 -3
- package/src/channelRepository/api/createChannel.ts +12 -9
- package/src/channelRepository/internalApi/getChannel.ts +0 -1
- package/src/channelRepository/utils/constructChannelObject.ts +2 -2
- package/src/communityRepository/api/createCommunity.ts +2 -5
- package/src/communityRepository/api/getCommunities.ts +2 -9
- package/src/communityRepository/api/getCommunity.ts +2 -13
- package/src/communityRepository/api/getRecommendedCommunities.ts +4 -11
- package/src/communityRepository/api/getTrendingCommunities.ts +4 -11
- package/src/communityRepository/api/joinCommunity.ts +1 -4
- package/src/communityRepository/api/queryCommunities.ts +1 -6
- package/src/communityRepository/api/updateCommunity.ts +3 -13
- package/src/communityRepository/communityMembership/events/index.ts +0 -1
- 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/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 +1 -3
- package/src/communityRepository/communityMembership/events/utils.ts +2 -2
- package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.ts +2 -8
- package/src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.ts +2 -8
- 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/observers/getCommunities/CommunitiesLiveCollectionController.ts +0 -6
- package/src/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/getCommunity.ts +0 -3
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.ts +1 -2
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.ts +1 -2
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/index.ts +0 -1
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.ts +0 -1
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.ts +2 -2
- package/src/communityRepository/utils/communityWithMembership.ts +5 -9
- package/src/communityRepository/utils/payload.ts +2 -28
- package/src/core/liveCollection/PaginationController.ts +1 -1
- package/src/core/liveCollection/PaginationNoPageController.ts +1 -1
- package/src/core/model/idResolvers.ts +0 -3
- package/src/core/model/index.ts +0 -3
- package/src/index.ts +0 -2
- package/src/messagePreview/utils/getChannelMessagePreviewWithUser.ts +1 -1
- package/src/messageRepository/api/deleteMessage.ts +16 -0
- package/src/messageRepository/observers/getMessages/MessageQueryStreamController.ts +13 -0
- package/src/postRepository/api/createPost.ts +3 -2
- package/src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.ts +1 -7
- package/src/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.ts +1 -7
- package/src/postRepository/utils/payload.ts +35 -1
- package/src/streamRepository/api/createStream.ts +4 -1
- package/src/streamRepository/api/editStream.ts +51 -0
- package/src/streamRepository/api/index.ts +1 -0
- package/src/streamRepository/api/updateStream.ts +8 -1
- package/src/streamRepository/internalApi/getLiveChat.ts +59 -0
- package/src/streamRepository/internalApi/getStream.ts +3 -3
- package/src/streamRepository/observers/getStreams/GetStreamsLiveCollectionController.ts +1 -1
- package/src/subChannelRepository/utils/prepareSubChannelPayload.ts +0 -4
- package/src/utils/linkedObject/index.ts +0 -6
- package/src/utils/linkedObject/postLinkedObject.ts +34 -11
- package/src/utils/linkedObject/streamLinkedObject.ts +2 -0
- package/src/utils/postTypePredicate.ts +16 -3
- package/dist/@types/domains/invitation.d.ts +0 -87
- package/dist/@types/domains/invitation.d.ts.map +0 -1
- package/dist/@types/domains/joinRequest.d.ts +0 -53
- package/dist/@types/domains/joinRequest.d.ts.map +0 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoin.d.ts +0 -2
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoin.d.ts.map +0 -1
- package/dist/communityRepository/internalAPI/getMyJoinRequest.d.ts +0 -16
- package/dist/communityRepository/internalAPI/getMyJoinRequest.d.ts.map +0 -1
- package/dist/communityRepository/internalAPI/joinCommunity.d.ts +0 -16
- package/dist/communityRepository/internalAPI/joinCommunity.d.ts.map +0 -1
- package/dist/communityRepository/joinRequest/events/index.d.ts +0 -4
- package/dist/communityRepository/joinRequest/events/index.d.ts.map +0 -1
- package/dist/communityRepository/joinRequest/events/onJoinRequestCreated.d.ts +0 -17
- package/dist/communityRepository/joinRequest/events/onJoinRequestCreated.d.ts.map +0 -1
- package/dist/communityRepository/joinRequest/events/onJoinRequestDeleted.d.ts +0 -17
- package/dist/communityRepository/joinRequest/events/onJoinRequestDeleted.d.ts.map +0 -1
- package/dist/communityRepository/joinRequest/events/onJoinRequestUpdated.d.ts +0 -17
- package/dist/communityRepository/joinRequest/events/onJoinRequestUpdated.d.ts.map +0 -1
- package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts +0 -16
- package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts.map +0 -1
- package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts +0 -16
- package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts.map +0 -1
- package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts +0 -16
- package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts.map +0 -1
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.d.ts +0 -14
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.d.ts.map +0 -1
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.d.ts +0 -9
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.d.ts.map +0 -1
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.d.ts +0 -15
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.d.ts.map +0 -1
- package/dist/communityRepository/observers/getJoinRequestList/enum.d.ts +0 -6
- package/dist/communityRepository/observers/getJoinRequestList/enum.d.ts.map +0 -1
- package/dist/communityRepository/observers/getJoinRequestList.d.ts +0 -12
- package/dist/communityRepository/observers/getJoinRequestList.d.ts.map +0 -1
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.d.ts +0 -14
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.d.ts.map +0 -1
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts +0 -9
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts.map +0 -1
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.d.ts +0 -15
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.d.ts.map +0 -1
- package/dist/communityRepository/observers/getJoinRequests/enum.d.ts +0 -6
- package/dist/communityRepository/observers/getJoinRequests/enum.d.ts.map +0 -1
- package/dist/communityRepository/observers/getJoinRequests.d.ts +0 -12
- package/dist/communityRepository/observers/getJoinRequests.d.ts.map +0 -1
- package/dist/invitationRepository/events/index.d.ts +0 -4
- package/dist/invitationRepository/events/index.d.ts.map +0 -1
- package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts +0 -17
- package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts.map +0 -1
- package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts +0 -17
- package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts.map +0 -1
- package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts +0 -17
- package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts.map +0 -1
- package/dist/invitationRepository/index.d.ts +0 -3
- package/dist/invitationRepository/index.d.ts.map +0 -1
- package/dist/invitationRepository/internalApi/acceptInvitation.d.ts +0 -16
- package/dist/invitationRepository/internalApi/acceptInvitation.d.ts.map +0 -1
- package/dist/invitationRepository/internalApi/createInvitations.d.ts +0 -21
- package/dist/invitationRepository/internalApi/createInvitations.d.ts.map +0 -1
- package/dist/invitationRepository/internalApi/getInvitation.d.ts +0 -17
- package/dist/invitationRepository/internalApi/getInvitation.d.ts.map +0 -1
- package/dist/invitationRepository/internalApi/index.d.ts +0 -4
- package/dist/invitationRepository/internalApi/index.d.ts.map +0 -1
- package/dist/invitationRepository/internalApi/rejectInvitation.d.ts +0 -16
- package/dist/invitationRepository/internalApi/rejectInvitation.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts +0 -14
- package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts +0 -5
- package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts +0 -15
- package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getInvitations/enums.d.ts +0 -6
- package/dist/invitationRepository/observers/getInvitations/enums.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getInvitations.d.ts +0 -12
- package/dist/invitationRepository/observers/getInvitations.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts +0 -12
- package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts +0 -14
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts +0 -5
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts.map +0 -1
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts +0 -15
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts.map +0 -1
- package/dist/invitationRepository/observers/index.d.ts +0 -2
- package/dist/invitationRepository/observers/index.d.ts.map +0 -1
- package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts +0 -2
- package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts.map +0 -1
- package/dist/invitationRepository/utils/index.d.ts +0 -2
- package/dist/invitationRepository/utils/index.d.ts.map +0 -1
- package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts +0 -2
- package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts.map +0 -1
- package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts +0 -2
- package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts.map +0 -1
- package/dist/utils/linkedObject/communityLinkedObject.d.ts +0 -2
- package/dist/utils/linkedObject/communityLinkedObject.d.ts.map +0 -1
- package/dist/utils/linkedObject/invitationLinkedObject.d.ts +0 -2
- package/dist/utils/linkedObject/invitationLinkedObject.d.ts.map +0 -1
- package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts +0 -2
- package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts.map +0 -1
- package/src/@types/domains/invitation.ts +0 -115
- package/src/@types/domains/joinRequest.ts +0 -66
- package/src/communityRepository/communityMembership/events/onLocalCommunityJoin.ts +0 -20
- package/src/communityRepository/internalAPI/getMyJoinRequest.ts +0 -43
- package/src/communityRepository/internalAPI/joinCommunity.ts +0 -66
- package/src/communityRepository/joinRequest/events/index.ts +0 -3
- package/src/communityRepository/joinRequest/events/onJoinRequestCreated.ts +0 -33
- package/src/communityRepository/joinRequest/events/onJoinRequestDeleted.ts +0 -33
- package/src/communityRepository/joinRequest/events/onJoinRequestUpdated.ts +0 -33
- package/src/communityRepository/joinRequest/internalAPI/approveJoinRequest.ts +0 -52
- package/src/communityRepository/joinRequest/internalAPI/cancelJoinRequest.ts +0 -46
- package/src/communityRepository/joinRequest/internalAPI/rejectJoinRequest.ts +0 -52
- package/src/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.ts +0 -130
- package/src/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.ts +0 -30
- package/src/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.ts +0 -112
- package/src/communityRepository/observers/getJoinRequestList/enum.ts +0 -5
- package/src/communityRepository/observers/getJoinRequestList.ts +0 -51
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.ts +0 -126
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts +0 -26
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.ts +0 -108
- package/src/communityRepository/observers/getJoinRequests/enum.ts +0 -5
- package/src/communityRepository/observers/getJoinRequests.ts +0 -44
- package/src/invitationRepository/events/index.ts +0 -3
- package/src/invitationRepository/events/onLocalInvitationCreated.ts +0 -33
- package/src/invitationRepository/events/onLocalInvitationDeleted.ts +0 -33
- package/src/invitationRepository/events/onLocalInvitationUpdated.ts +0 -33
- package/src/invitationRepository/index.ts +0 -2
- package/src/invitationRepository/internalApi/acceptInvitation.ts +0 -45
- package/src/invitationRepository/internalApi/createInvitations.ts +0 -52
- package/src/invitationRepository/internalApi/getInvitation.ts +0 -47
- package/src/invitationRepository/internalApi/index.ts +0 -3
- package/src/invitationRepository/internalApi/rejectInvitation.ts +0 -45
- package/src/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.ts +0 -148
- package/src/invitationRepository/observers/getInvitations/InvitationsPaginationController.ts +0 -19
- package/src/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.ts +0 -97
- package/src/invitationRepository/observers/getInvitations/enums.ts +0 -5
- package/src/invitationRepository/observers/getInvitations.ts +0 -44
- package/src/invitationRepository/observers/getMyCommunityInvitations.ts +0 -48
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.ts +0 -148
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.ts +0 -22
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.ts +0 -105
- package/src/invitationRepository/observers/index.ts +0 -1
- package/src/invitationRepository/utils/convertRawInvitationToInternalInvitation.ts +0 -8
- package/src/invitationRepository/utils/index.ts +0 -1
- package/src/invitationRepository/utils/prepareInvitationPayload.ts +0 -12
- package/src/invitationRepository/utils/prepareMyInvitationsPayload.ts +0 -12
- package/src/utils/linkedObject/communityLinkedObject.ts +0 -58
- package/src/utils/linkedObject/invitationLinkedObject.ts +0 -37
- package/src/utils/linkedObject/joinRequestLinkedObject.ts +0 -31
|
@@ -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.Community>) =>
|
|
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.Community>) =>
|
|
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.Community>,
|
|
11
11
|
) => {
|
|
12
12
|
const client = getActiveClient();
|
|
13
13
|
|
package/src/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.ts
CHANGED
|
@@ -25,10 +25,8 @@ import {
|
|
|
25
25
|
onLocalCommunityJoined,
|
|
26
26
|
onLocalCommunityLeft,
|
|
27
27
|
onCommunityUserChanged,
|
|
28
|
-
onLocalCommunityJoin,
|
|
29
28
|
} from '~/communityRepository/communityMembership';
|
|
30
29
|
import { isNonNullable } from '~/utils';
|
|
31
|
-
import { convertEventPayload } from '~/utils/event';
|
|
32
30
|
|
|
33
31
|
export class CommunityLiveCollectionController extends LiveCollectionController<
|
|
34
32
|
'community',
|
|
@@ -94,10 +92,6 @@ export class CommunityLiveCollectionController extends LiveCollectionController<
|
|
|
94
92
|
{ fn: onCommunityUserChanged, action: EnumCommunityMemberActions.OnMemberCountChanged },
|
|
95
93
|
{ fn: onLocalCommunityJoined, action: EnumCommunityMemberActions.OnCommunityJoined },
|
|
96
94
|
{ fn: onLocalCommunityLeft, action: EnumCommunityMemberActions.OnCommunityLeft },
|
|
97
|
-
{
|
|
98
|
-
fn: convertEventPayload(onLocalCommunityJoin, 'targetId', 'community'),
|
|
99
|
-
action: EnumCommunityActions.OnCommunityUpdated,
|
|
100
|
-
},
|
|
101
95
|
]);
|
|
102
96
|
}
|
|
103
97
|
|
package/src/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.ts
CHANGED
|
@@ -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.Community) => {
|
|
64
64
|
const collection = pullFromCache<Amity.CommunityLiveCollectionCache>(this.cacheKey)?.data;
|
|
65
65
|
if (!collection) return;
|
|
66
66
|
|
|
@@ -76,7 +76,7 @@ export class CommunitiesQueryStreamController extends QueryStreamController<
|
|
|
76
76
|
|
|
77
77
|
subscribeRTE(
|
|
78
78
|
createSubscriber: {
|
|
79
|
-
fn: (reactor: (channel: Amity.
|
|
79
|
+
fn: (reactor: (channel: Amity.Community) => void) => Amity.Unsubscriber;
|
|
80
80
|
action: EnumCommunityActions | EnumCommunityMemberActions;
|
|
81
81
|
}[],
|
|
82
82
|
) {
|
|
@@ -9,9 +9,7 @@ import {
|
|
|
9
9
|
onCommunityLeft,
|
|
10
10
|
onLocalCommunityJoined,
|
|
11
11
|
onLocalCommunityLeft,
|
|
12
|
-
onLocalCommunityJoin,
|
|
13
12
|
} from '../communityMembership/events';
|
|
14
|
-
import { convertEventPayload } from '~/utils/event';
|
|
15
13
|
|
|
16
14
|
/* begin_public_function
|
|
17
15
|
id: community.get
|
|
@@ -49,7 +47,6 @@ export const getCommunity = (
|
|
|
49
47
|
onCommunityUserBanned,
|
|
50
48
|
onCommunityUserUnbanned,
|
|
51
49
|
onCommunityUserChanged,
|
|
52
|
-
convertEventPayload(onLocalCommunityJoin, 'targetId', 'community'),
|
|
53
50
|
]);
|
|
54
51
|
};
|
|
55
52
|
/* end_public_function */
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
onCommunityUserChanged,
|
|
16
16
|
} from '~/communityRepository/communityMembership';
|
|
17
17
|
import { isNonNullable } from '~/utils';
|
|
18
|
-
import { communityLinkedObject } from '~/utils/linkedObject/communityLinkedObject';
|
|
19
18
|
|
|
20
19
|
export class RecommendedCommunityLiveCollectionController extends LiveCollectionController<
|
|
21
20
|
'community',
|
|
@@ -95,7 +94,7 @@ export class RecommendedCommunityLiveCollectionController extends LiveCollection
|
|
|
95
94
|
collection.data
|
|
96
95
|
.map(id => pullFromCache<Amity.Community>(['community', 'get', id]))
|
|
97
96
|
.filter(isNonNullable)
|
|
98
|
-
.map(({ data }) =>
|
|
97
|
+
.map(({ data }) => data) ?? [];
|
|
99
98
|
|
|
100
99
|
if (!this.shouldNotify(data) && origin === 'event') return;
|
|
101
100
|
|
|
@@ -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.Community) => {
|
|
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.Community) => void) => Amity.Unsubscriber;
|
|
83
83
|
action: EnumCommunityActions | EnumCommunityMemberActions;
|
|
84
84
|
}[],
|
|
85
85
|
) {
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
onCommunityUserChanged,
|
|
16
16
|
} from '~/communityRepository/communityMembership';
|
|
17
17
|
import { isNonNullable } from '~/utils';
|
|
18
|
-
import { communityLinkedObject } from '~/utils/linkedObject/communityLinkedObject';
|
|
19
18
|
|
|
20
19
|
export class TrendingCommunityLiveCollectionController extends LiveCollectionController<
|
|
21
20
|
'community',
|
|
@@ -95,7 +94,7 @@ export class TrendingCommunityLiveCollectionController extends LiveCollectionCon
|
|
|
95
94
|
collection.data
|
|
96
95
|
.map(id => pullFromCache<Amity.Community>(['community', 'get', id]))
|
|
97
96
|
.filter(isNonNullable)
|
|
98
|
-
.map(({ data }) =>
|
|
97
|
+
.map(({ data }) => data) ?? [];
|
|
99
98
|
|
|
100
99
|
if (!this.shouldNotify(data) && origin === 'event') return;
|
|
101
100
|
|
|
@@ -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.Community) => {
|
|
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.Community) => void) => Amity.Unsubscriber;
|
|
81
81
|
action: EnumCommunityActions | EnumCommunityMemberActions;
|
|
82
82
|
}[],
|
|
83
83
|
) {
|
package/src/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.ts
CHANGED
|
@@ -22,7 +22,6 @@ 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,
|
|
26
25
|
options,
|
|
27
26
|
},
|
|
28
27
|
},
|
|
@@ -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.Community) => {
|
|
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.Community) => void) => Amity.Unsubscriber;
|
|
77
77
|
action: EnumCommunityActions | EnumCommunityMemberActions;
|
|
78
78
|
}[],
|
|
79
79
|
) {
|
|
@@ -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.Community) => {
|
|
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.Community) => 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';
|
|
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.Community,
|
|
16
16
|
m: Amity.Membership<'community'>,
|
|
17
17
|
): boolean {
|
|
18
18
|
const { userId } = getActiveUser();
|
|
@@ -28,15 +28,11 @@ 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.Community[],
|
|
32
32
|
communityUsers: Amity.Membership<'community'>[],
|
|
33
|
-
): Amity.
|
|
33
|
+
): Amity.Community[] {
|
|
34
34
|
return communities.map(c => {
|
|
35
|
-
const cachedCommunity = pullFromCache<Amity.
|
|
36
|
-
'community',
|
|
37
|
-
'get',
|
|
38
|
-
c.communityId,
|
|
39
|
-
]);
|
|
35
|
+
const cachedCommunity = pullFromCache<Amity.Community>(['community', 'get', c.communityId]);
|
|
40
36
|
if (cachedCommunity?.data && cachedCommunity?.data.hasOwnProperty('isJoined')) {
|
|
41
37
|
return {
|
|
42
38
|
...cachedCommunity.data,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CommunityPostSettingMaps, DefaultCommunityPostSetting } from '~/@types';
|
|
2
2
|
import { updateMembershipStatus } from './communityWithMembership';
|
|
3
|
-
import { convertRawUserToInternalUser } from '~/userRepository/utils/convertRawUserToInternalUser';
|
|
4
3
|
|
|
5
4
|
const getMatchPostSetting = (value: {
|
|
6
5
|
needApprovalOnPostCreation: Amity.RawCommunity['needApprovalOnPostCreation'];
|
|
@@ -14,7 +13,7 @@ const getMatchPostSetting = (value: {
|
|
|
14
13
|
) ?? DefaultCommunityPostSetting;
|
|
15
14
|
|
|
16
15
|
export function addPostSetting({ communities }: { communities: Amity.RawCommunity[] }) {
|
|
17
|
-
return communities.map<Amity.
|
|
16
|
+
return communities.map<Amity.Community>(
|
|
18
17
|
({ needApprovalOnPostCreation, onlyAdminCanPost, ...restCommunityPayload }) => ({
|
|
19
18
|
postSetting: getMatchPostSetting({
|
|
20
19
|
needApprovalOnPostCreation,
|
|
@@ -30,13 +29,10 @@ export const prepareCommunityPayload = (
|
|
|
30
29
|
): Amity.ProcessedCommunityPayload => {
|
|
31
30
|
const communitiesWithPostSetting = addPostSetting({ communities: rawPayload.communities });
|
|
32
31
|
|
|
33
|
-
// Convert users to internal format
|
|
34
|
-
const internalUsers = rawPayload.users.map(convertRawUserToInternalUser);
|
|
35
|
-
|
|
36
32
|
// map users with community
|
|
37
33
|
const mappedCommunityUsers: Array<Amity.Membership<'community'>> = rawPayload.communityUsers.map(
|
|
38
34
|
communityUser => {
|
|
39
|
-
const user =
|
|
35
|
+
const user = rawPayload.users.find(user => user.userId === communityUser.userId)!;
|
|
40
36
|
|
|
41
37
|
return {
|
|
42
38
|
...communityUser,
|
|
@@ -52,33 +48,11 @@ export const prepareCommunityPayload = (
|
|
|
52
48
|
|
|
53
49
|
return {
|
|
54
50
|
...rawPayload,
|
|
55
|
-
users: rawPayload.users.map(convertRawUserToInternalUser),
|
|
56
51
|
communities: communityWithMembershipStatus,
|
|
57
52
|
communityUsers: mappedCommunityUsers,
|
|
58
53
|
};
|
|
59
54
|
};
|
|
60
55
|
|
|
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
|
-
|
|
82
56
|
export const prepareCommunityMembershipPayload = (
|
|
83
57
|
rawPayload: Amity.CommunityMembershipPayload,
|
|
84
58
|
): Amity.ProcessedCommunityMembershipPayload => {
|
package/src/core/model/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -23,6 +23,22 @@ export const deleteMessage = async (
|
|
|
23
23
|
const client = getActiveClient();
|
|
24
24
|
client.log('message/deleteMessage', messageId);
|
|
25
25
|
|
|
26
|
+
if (messageId.includes('LOCAL_')) {
|
|
27
|
+
const message = pullFromCache<Amity.InternalMessage>(['message', 'get', messageId])?.data;
|
|
28
|
+
if (!message) throw Error('messageId not found');
|
|
29
|
+
|
|
30
|
+
const deletedMessage = {
|
|
31
|
+
...message,
|
|
32
|
+
isDeleted: true,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
fireEvent('local.message.deleted', {
|
|
36
|
+
messages: [deletedMessage],
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
return LinkedObject.message(deletedMessage);
|
|
40
|
+
}
|
|
41
|
+
|
|
26
42
|
// API-FIX: This endpoint has not been implemented yet.
|
|
27
43
|
const { data: deleted } = await client.http.delete<Amity.MessagePayload>(
|
|
28
44
|
`/api/v5/messages/${encodeURIComponent(messageId)}`,
|
|
@@ -116,6 +116,19 @@ export class MessageQueryStreamController extends QueryStreamController<
|
|
|
116
116
|
pushToCache(this.cacheKey, collection);
|
|
117
117
|
}
|
|
118
118
|
|
|
119
|
+
if (action === 'onDelete' && payload.syncState === Amity.SyncState.Error) {
|
|
120
|
+
const collection = pullFromCache<Amity.MessageLiveCollectionCache>(this.cacheKey)?.data;
|
|
121
|
+
if (!collection) return;
|
|
122
|
+
|
|
123
|
+
if (collection.data.includes(payload.messageId)) {
|
|
124
|
+
const newCollectionData = collection.data.filter(
|
|
125
|
+
messageId => messageId !== payload.messageId,
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
pushToCache(this.cacheKey, { ...collection, data: newCollectionData });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
119
132
|
this.notifyChange({ origin: Amity.LiveDataOrigin.EVENT, loading: false });
|
|
120
133
|
};
|
|
121
134
|
}
|
|
@@ -2,8 +2,8 @@ import { getActiveClient } from '~/client/api';
|
|
|
2
2
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import { fireEvent } from '~/core/events';
|
|
5
|
-
import { prepareMembershipPayload } from '~/group/utils';
|
|
6
5
|
import { LinkedObject } from '~/utils/linkedObject';
|
|
6
|
+
import { preparePostPayload } from '../utils/payload';
|
|
7
7
|
|
|
8
8
|
/* begin_public_function
|
|
9
9
|
id: post.create.text_post, post.create.image_post, post.create.file_post, post.create.video_post, post.create.poll_post, post.create.livestream_post, post.create.custom_post
|
|
@@ -46,7 +46,8 @@ export const createPost = async <T extends Amity.PostContentType | string>(
|
|
|
46
46
|
|
|
47
47
|
fireEvent('post.created', payload);
|
|
48
48
|
|
|
49
|
-
const data =
|
|
49
|
+
const data = preparePostPayload(payload);
|
|
50
|
+
|
|
50
51
|
const cachedAt = client.cache && Date.now();
|
|
51
52
|
|
|
52
53
|
if (client.cache) ingestInCache(data, { cachedAt });
|
package/src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
|
4
4
|
import { getResolver } from '~/core/model';
|
|
5
5
|
import { getActiveClient } from '~/client';
|
|
6
6
|
import { EnumPostActions } from '../enums';
|
|
7
|
-
import { convertRawUserToInternalUser } from '~/userRepository/utils/convertRawUserToInternalUser';
|
|
8
7
|
|
|
9
8
|
export class GlobalPinnedPostQueryStreamController extends QueryStreamController<
|
|
10
9
|
Amity.PinnedPostPayload,
|
|
@@ -31,12 +30,7 @@ export class GlobalPinnedPostQueryStreamController extends QueryStreamController
|
|
|
31
30
|
const cachedAt = client.cache && Date.now();
|
|
32
31
|
|
|
33
32
|
if (client.cache) {
|
|
34
|
-
|
|
35
|
-
...response,
|
|
36
|
-
users: response.users.map(convertRawUserToInternalUser),
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
ingestInCache(processedPayload, { cachedAt });
|
|
33
|
+
ingestInCache(response, { cachedAt });
|
|
40
34
|
}
|
|
41
35
|
}
|
|
42
36
|
|
|
@@ -3,7 +3,6 @@ import { pullFromCache, pushToCache } from '~/cache/api';
|
|
|
3
3
|
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
4
|
import { getResolver } from '~/core/model';
|
|
5
5
|
import { getActiveClient } from '~/client';
|
|
6
|
-
import { convertRawUserToInternalUser } from '~/userRepository/utils/convertRawUserToInternalUser';
|
|
7
6
|
|
|
8
7
|
export class PinnedPostQueryStreamController extends QueryStreamController<
|
|
9
8
|
Amity.PinnedPostPayload,
|
|
@@ -30,12 +29,7 @@ export class PinnedPostQueryStreamController extends QueryStreamController<
|
|
|
30
29
|
const cachedAt = client.cache && Date.now();
|
|
31
30
|
|
|
32
31
|
if (client.cache) {
|
|
33
|
-
|
|
34
|
-
...response,
|
|
35
|
-
users: response.users ? response.users.map(convertRawUserToInternalUser) : [],
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
ingestInCache(processedPayload, { cachedAt });
|
|
32
|
+
ingestInCache(response, { cachedAt });
|
|
39
33
|
}
|
|
40
34
|
}
|
|
41
35
|
|
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
import { addPostSetting } from '~/communityRepository/utils';
|
|
2
2
|
import { updateMembershipStatus } from '~/communityRepository/utils/communityWithMembership';
|
|
3
|
+
import { isAmityLivestreamPost } from '~/utils/postTypePredicate';
|
|
4
|
+
|
|
5
|
+
const updateStreamReferences = (
|
|
6
|
+
streams: Amity.RawStream[],
|
|
7
|
+
streamId: string | undefined,
|
|
8
|
+
postId: string,
|
|
9
|
+
) => {
|
|
10
|
+
if (!streamId) return streams;
|
|
11
|
+
|
|
12
|
+
return streams.map(stream =>
|
|
13
|
+
stream.streamId === streamId
|
|
14
|
+
? {
|
|
15
|
+
...stream,
|
|
16
|
+
referenceType: 'post',
|
|
17
|
+
referenceId: postId,
|
|
18
|
+
postId,
|
|
19
|
+
}
|
|
20
|
+
: stream,
|
|
21
|
+
);
|
|
22
|
+
};
|
|
3
23
|
|
|
4
24
|
export const preparePostPayload = (payload: Amity.PostPayload): Amity.ProcessedPostPayload => {
|
|
5
|
-
const { posts: postsData, ...postPayload } = payload;
|
|
25
|
+
const { posts: postsData, postChildren, videoStreamings, ...postPayload } = payload;
|
|
6
26
|
|
|
7
27
|
// Unpack community payload by mapping payload field to postSetting value.
|
|
8
28
|
const communitiesWithPostSetting = addPostSetting({ communities: postPayload.communities });
|
|
@@ -24,18 +44,32 @@ export const preparePostPayload = (payload: Amity.PostPayload): Amity.ProcessedP
|
|
|
24
44
|
mappedCommunityUsers,
|
|
25
45
|
);
|
|
26
46
|
|
|
47
|
+
let mappedNewStream: Amity.RawStream[] = [];
|
|
48
|
+
|
|
27
49
|
// feed type
|
|
28
50
|
const posts = postsData.map(post => {
|
|
29
51
|
const feedType = postPayload.feeds.find(feed => feed.feedId === post.feedId)?.feedType;
|
|
52
|
+
const childPost = payload.postChildren.find(children => children.parentPostId === post.postId);
|
|
53
|
+
|
|
54
|
+
if (isAmityLivestreamPost(childPost)) {
|
|
55
|
+
mappedNewStream = updateStreamReferences(
|
|
56
|
+
videoStreamings,
|
|
57
|
+
childPost.data?.streamId,
|
|
58
|
+
post.postId,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
30
61
|
|
|
31
62
|
return {
|
|
32
63
|
...post,
|
|
64
|
+
childPost,
|
|
33
65
|
feedType,
|
|
34
66
|
};
|
|
35
67
|
});
|
|
36
68
|
|
|
37
69
|
return {
|
|
38
70
|
...postPayload,
|
|
71
|
+
postChildren,
|
|
72
|
+
videoStreamings: mappedNewStream,
|
|
39
73
|
posts,
|
|
40
74
|
communities: communityWithMembershipStatus,
|
|
41
75
|
communityUsers: mappedCommunityUsers,
|
|
@@ -21,7 +21,10 @@ import { LinkedObject } from '~/utils/linkedObject';
|
|
|
21
21
|
* @async
|
|
22
22
|
*/
|
|
23
23
|
export const createStream = async (
|
|
24
|
-
bundle: Pick<
|
|
24
|
+
bundle: Pick<
|
|
25
|
+
Amity.InternalStream,
|
|
26
|
+
'title' | 'thumbnailFileId' | 'description' | 'channelEnabled'
|
|
27
|
+
> & {
|
|
25
28
|
isSecure?: boolean;
|
|
26
29
|
},
|
|
27
30
|
): Promise<Amity.Cached<Amity.Stream>> => {
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api';
|
|
2
|
+
|
|
3
|
+
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
5
|
+
|
|
6
|
+
/* begin_public_function
|
|
7
|
+
id: stream.update
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
*
|
|
11
|
+
* ```js
|
|
12
|
+
* import { StreamRepository } from '@amityco/ts-sdk'
|
|
13
|
+
* const updated = await StreamRepository.editStream(streamId, { title: 'foobar' })
|
|
14
|
+
* ```
|
|
15
|
+
*
|
|
16
|
+
* Updates an {@link Amity.Stream}
|
|
17
|
+
*
|
|
18
|
+
* @param streamId The ID of the {@link Amity.Stream} to edit
|
|
19
|
+
* @param patch The patch data to apply
|
|
20
|
+
* @returns the updated {@link Amity.Stream} object
|
|
21
|
+
*
|
|
22
|
+
* @category Stream API
|
|
23
|
+
* @async
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
export const editStream = async (
|
|
27
|
+
streamId: Amity.Stream['streamId'],
|
|
28
|
+
patch: Patch<
|
|
29
|
+
Amity.Stream,
|
|
30
|
+
'title' | 'thumbnailFileId' | 'description' | 'metadata' | 'channelEnabled'
|
|
31
|
+
>,
|
|
32
|
+
): Promise<Amity.Cached<Amity.Stream>> => {
|
|
33
|
+
const client = getActiveClient();
|
|
34
|
+
client.log('stream/updateStream', streamId, patch);
|
|
35
|
+
|
|
36
|
+
const { data } = await client.http.put<Amity.StreamPayload>(
|
|
37
|
+
`/api/v3/video-streaming/${streamId}`,
|
|
38
|
+
patch,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
const cachedAt = client.cache && Date.now();
|
|
42
|
+
if (client.cache) ingestInCache(data, { cachedAt });
|
|
43
|
+
|
|
44
|
+
const { videoStreamings } = data;
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
data: LinkedObject.stream(videoStreamings.find(stream => stream.streamId === streamId)!),
|
|
48
|
+
cachedAt,
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/* end_public_function */
|
|
@@ -7,6 +7,9 @@ import { LinkedObject } from '~/utils/linkedObject';
|
|
|
7
7
|
id: stream.update
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
10
|
+
* @deprecated this function is deprecated,
|
|
11
|
+
* please use {@link Amity.StreamRepository.editStream} instead.
|
|
12
|
+
*
|
|
10
13
|
* ```js
|
|
11
14
|
* import { updateStream } from '@amityco/ts-sdk'
|
|
12
15
|
* const updated = await updateStream(streamId, { title: 'foobar' })
|
|
@@ -21,9 +24,13 @@ import { LinkedObject } from '~/utils/linkedObject';
|
|
|
21
24
|
* @category Stream API
|
|
22
25
|
* @async
|
|
23
26
|
*/
|
|
27
|
+
|
|
24
28
|
export const updateStream = async (
|
|
25
29
|
streamId: Amity.Stream['streamId'],
|
|
26
|
-
patch: Patch<
|
|
30
|
+
patch: Patch<
|
|
31
|
+
Amity.Stream,
|
|
32
|
+
'title' | 'thumbnailFileId' | 'description' | 'metadata' | 'channelEnabled'
|
|
33
|
+
>,
|
|
27
34
|
): Promise<Amity.Cached<Amity.Stream>> => {
|
|
28
35
|
const client = getActiveClient();
|
|
29
36
|
client.log('stream/updateStream', streamId, patch);
|