@amityco/ts-sdk 7.5.1-3d3fd19.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 +1 -8
- 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 -51
- 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/channelRepository/observers/getChannel.d.ts.map +1 -1
- package/dist/channelRepository/observers/getChannels/ChannelLiveCollectionController.d.ts.map +1 -1
- package/dist/channelRepository/observers/getTotalChannelsUnread.d.ts.map +1 -1
- package/dist/channelRepository/utils/prepareChannelPayload.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/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/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/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 +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/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 +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 +5113 -6421
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +2588 -3895
- 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 +1 -11
- 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 +3 -82
- 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/observers/getChannel.ts +1 -11
- package/src/channelRepository/observers/getChannels/ChannelLiveCollectionController.ts +1 -10
- package/src/channelRepository/observers/getTotalChannelsUnread.ts +1 -3
- package/src/channelRepository/utils/constructChannelObject.ts +2 -2
- package/src/channelRepository/utils/prepareChannelPayload.ts +1 -6
- package/src/client/utils/ReadReceiptSync/readReceiptSyncEngine.ts +1 -1
- 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 -7
- 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/CommunitiesPaginationController.ts +0 -1
- 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/RecommendedCommunitiesPaginationController.ts +1 -6
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.ts +1 -2
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesPaginationController.ts +1 -6
- 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/SemanticSearchCommunityPaginationController.ts +0 -1
- 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/events/onMessageCreated.ts +1 -1
- 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 -92
- 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 -119
- 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 -57
- package/src/utils/linkedObject/invitationLinkedObject.ts +0 -37
- package/src/utils/linkedObject/joinRequestLinkedObject.ts +0 -31
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { dropFromCache } from '~/cache/api/dropFromCache';
|
|
2
|
-
import { getActiveClient } from '~/client/api/activeClient';
|
|
3
|
-
import { ENABLE_CACHE_MESSAGE } from '~/utils/constants';
|
|
4
|
-
import { JoinRequestsLiveCollectionController } from './getJoinRequests/JoinRequestsLiveCollectionController';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Get Join Requests
|
|
8
|
-
*
|
|
9
|
-
* @param params the query parameters
|
|
10
|
-
* @param callback the callback to be called when the join request are updated
|
|
11
|
-
* @returns joinRequests
|
|
12
|
-
*
|
|
13
|
-
* @category joinRequest Live Collection
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
export const getJoinRequests = (
|
|
17
|
-
params: Amity.JoinRequestLiveCollection,
|
|
18
|
-
callback: Amity.LiveCollectionCallback<Amity.JoinRequest>,
|
|
19
|
-
config?: Amity.LiveCollectionConfig,
|
|
20
|
-
) => {
|
|
21
|
-
const { log, cache } = getActiveClient();
|
|
22
|
-
|
|
23
|
-
if (!cache) {
|
|
24
|
-
console.log(ENABLE_CACHE_MESSAGE);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const timestamp = Date.now();
|
|
28
|
-
log(`getJoinRequests: (tmpid: ${timestamp}) > listen`);
|
|
29
|
-
|
|
30
|
-
const joinRequestLiveCollection = new JoinRequestsLiveCollectionController(params, callback);
|
|
31
|
-
|
|
32
|
-
const disposers = joinRequestLiveCollection.startSubscription();
|
|
33
|
-
|
|
34
|
-
const cacheKey = joinRequestLiveCollection.getCacheKey();
|
|
35
|
-
|
|
36
|
-
disposers.push(() => {
|
|
37
|
-
dropFromCache(cacheKey);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
return () => {
|
|
41
|
-
log(`getJoinRequests (tmpid: ${timestamp}) > dispose`);
|
|
42
|
-
disposers.forEach(fn => fn());
|
|
43
|
-
};
|
|
44
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
-
import { createEventSubscriber } from '~/core/events';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* ```js
|
|
6
|
-
* import { onLocalInvitationCreated } from '@amityco/ts-sdk'
|
|
7
|
-
* const dispose = onLocalInvitationCreated(data => {
|
|
8
|
-
* // ...
|
|
9
|
-
* })
|
|
10
|
-
* ```
|
|
11
|
-
*
|
|
12
|
-
* Fired when an {@link Amity.InvitationPayload} has been created
|
|
13
|
-
*
|
|
14
|
-
* @param callback The function to call when the event was fired
|
|
15
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
16
|
-
*
|
|
17
|
-
* @category Invitation Events
|
|
18
|
-
*/
|
|
19
|
-
export const onLocalInvitationCreated = (
|
|
20
|
-
callback: Amity.Listener<Amity.InternalInvitation[]>,
|
|
21
|
-
): Amity.Unsubscriber => {
|
|
22
|
-
const client = getActiveClient();
|
|
23
|
-
|
|
24
|
-
const disposers = [
|
|
25
|
-
createEventSubscriber(client, 'onLocalInvitationCreated', 'local.invitation.created', payload =>
|
|
26
|
-
callback(payload),
|
|
27
|
-
),
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
return () => {
|
|
31
|
-
disposers.forEach(fn => fn());
|
|
32
|
-
};
|
|
33
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { createEventSubscriber } from '~/core/events';
|
|
2
|
-
import { getActiveClient } from '~/client/api/activeClient';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* ```js
|
|
6
|
-
* import { onLocalInvitationDeleted } from '@amityco/ts-sdk'
|
|
7
|
-
* const dispose = onLocalInvitationDeleted(data => {
|
|
8
|
-
* // ...
|
|
9
|
-
* })
|
|
10
|
-
* ```
|
|
11
|
-
*
|
|
12
|
-
* Fired when an {@link Amity.InvitationPayload} has been deleted
|
|
13
|
-
*
|
|
14
|
-
* @param callback The function to call when the event was fired
|
|
15
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
16
|
-
*
|
|
17
|
-
* @category Invitation Events
|
|
18
|
-
*/
|
|
19
|
-
export const onLocalInvitationDeleted = (
|
|
20
|
-
callback: Amity.Listener<Amity.InternalInvitation[]>,
|
|
21
|
-
): Amity.Unsubscriber => {
|
|
22
|
-
const client = getActiveClient();
|
|
23
|
-
|
|
24
|
-
const disposers = [
|
|
25
|
-
createEventSubscriber(client, 'onLocalInvitationDeleted', 'local.invitation.deleted', payload =>
|
|
26
|
-
callback(payload),
|
|
27
|
-
),
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
return () => {
|
|
31
|
-
disposers.forEach(fn => fn());
|
|
32
|
-
};
|
|
33
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
-
import { createEventSubscriber } from '~/core/events';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* ```js
|
|
6
|
-
* import { onLocalInvitationUpdated } from '@amityco/ts-sdk'
|
|
7
|
-
* const dispose = onLocalInvitationUpdated(data => {
|
|
8
|
-
* // ...
|
|
9
|
-
* })
|
|
10
|
-
* ```
|
|
11
|
-
*
|
|
12
|
-
* Fired when an {@link Amity.InvitationPayload} has been updated
|
|
13
|
-
*
|
|
14
|
-
* @param callback The function to call when the event was fired
|
|
15
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
16
|
-
*
|
|
17
|
-
* @category Invitation Events
|
|
18
|
-
*/
|
|
19
|
-
export const onLocalInvitationUpdated = (
|
|
20
|
-
callback: Amity.Listener<Amity.InternalInvitation[]>,
|
|
21
|
-
): Amity.Unsubscriber => {
|
|
22
|
-
const client = getActiveClient();
|
|
23
|
-
|
|
24
|
-
const disposers = [
|
|
25
|
-
createEventSubscriber(client, 'onLocalInvitationUpdated', 'local.invitation.updated', payload =>
|
|
26
|
-
callback(payload),
|
|
27
|
-
),
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
return () => {
|
|
31
|
-
disposers.forEach(fn => fn());
|
|
32
|
-
};
|
|
33
|
-
};
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { fireEvent } from '~/core/events';
|
|
2
|
-
import { getActiveClient } from '~/client/api/activeClient';
|
|
3
|
-
import { pullFromCache, upsertInCache } from '~/cache/api';
|
|
4
|
-
import { InvitationStatusEnum } from '~/@types';
|
|
5
|
-
|
|
6
|
-
/* begin_public_function
|
|
7
|
-
id: invitation.accept
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* ```js
|
|
11
|
-
* import { acceptInvitation } from '@amityco/ts-sdk'
|
|
12
|
-
* const isAccepted = await acceptInvitation(invitationId)
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* Accepts a {@link Amity.Invitation} object
|
|
16
|
-
*
|
|
17
|
-
* @param invitationId the {@link Amity.Invitation} to accept
|
|
18
|
-
* @returns A success boolean if the {@link Amity.Invitation} was accepted
|
|
19
|
-
*
|
|
20
|
-
* @category Invitation API
|
|
21
|
-
* @async
|
|
22
|
-
*/
|
|
23
|
-
export const acceptInvitation = async (invitationId: Amity.Invitation['_id']): Promise<boolean> => {
|
|
24
|
-
const client = getActiveClient();
|
|
25
|
-
client.log('invitation/acceptInvitation', invitationId);
|
|
26
|
-
|
|
27
|
-
const { data } = await client.http.post<{ success: boolean }>(
|
|
28
|
-
`/api/v1/invitations/${invitationId}/accept`,
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const invitation = pullFromCache<Amity.InternalInvitation>([
|
|
32
|
-
'invitation',
|
|
33
|
-
'get',
|
|
34
|
-
invitationId,
|
|
35
|
-
])?.data;
|
|
36
|
-
|
|
37
|
-
if (invitation) {
|
|
38
|
-
upsertInCache(['invitation', 'get', invitationId], { status: InvitationStatusEnum.Approved });
|
|
39
|
-
|
|
40
|
-
fireEvent('local.invitation.updated', [invitation]);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return data.success;
|
|
44
|
-
};
|
|
45
|
-
/* end_public_function */
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { fireEvent } from '~/core/events';
|
|
2
|
-
import { getActiveClient } from '~/client/api/activeClient';
|
|
3
|
-
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
|
-
import { prepareInvitationPayload } from '../utils';
|
|
5
|
-
|
|
6
|
-
/* begin_public_function
|
|
7
|
-
id: invitation.createInvitations
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* ```js
|
|
11
|
-
* import { createInvitations } from '@amityco/ts-sdk'
|
|
12
|
-
* const created = await createInvitations({
|
|
13
|
-
* type: string,
|
|
14
|
-
* targetType: string,
|
|
15
|
-
* targetId: string,
|
|
16
|
-
* userIds: string[]
|
|
17
|
-
* }))
|
|
18
|
-
* ```
|
|
19
|
-
*
|
|
20
|
-
* Creates an {@link Amity.Invitation}
|
|
21
|
-
*
|
|
22
|
-
* @param bundle The data necessary to create a new {@link Amity.Invitation}
|
|
23
|
-
* @returns The newly created {@link Amity.Invitation}
|
|
24
|
-
*
|
|
25
|
-
* @category Invitation API
|
|
26
|
-
* @async
|
|
27
|
-
*/
|
|
28
|
-
export const createInvitations = async (
|
|
29
|
-
bundle: Amity.CreateInvitations,
|
|
30
|
-
): Promise<Amity.Cached<Amity.InternalInvitation[]>> => {
|
|
31
|
-
const client = getActiveClient();
|
|
32
|
-
client.log('invitation/createInvitations', bundle);
|
|
33
|
-
|
|
34
|
-
const { data: payload } = await client.http.post<Amity.InvitationPayload>(
|
|
35
|
-
'/api/v1/invitations',
|
|
36
|
-
bundle,
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const data = prepareInvitationPayload(payload);
|
|
40
|
-
|
|
41
|
-
const cachedAt = client.cache && Date.now();
|
|
42
|
-
|
|
43
|
-
if (client.cache) ingestInCache(data, { cachedAt });
|
|
44
|
-
|
|
45
|
-
fireEvent('local.invitation.created', data.invitations);
|
|
46
|
-
|
|
47
|
-
return {
|
|
48
|
-
data: data.invitations,
|
|
49
|
-
cachedAt,
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
/* end_public_function */
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
-
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
3
|
-
import { prepareMyInvitationsPayload } from '../utils/prepareMyInvitationsPayload';
|
|
4
|
-
import { invitationLinkedObject } from '~/utils/linkedObject/invitationLinkedObject';
|
|
5
|
-
|
|
6
|
-
/* begin_public_function
|
|
7
|
-
id: invitation.get
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* ```js
|
|
11
|
-
* import { getInvitation } from '@amityco/ts-sdk'
|
|
12
|
-
* const { invitation } = await getInvitation(targetType, targetId)
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* Get a {@link Amity.Invitation} object
|
|
16
|
-
*
|
|
17
|
-
* @param targetType The type of the target of the {@link Amity.Invitation}
|
|
18
|
-
* @param targetId The ID of the target of the {@link Amity.Invitation}
|
|
19
|
-
* @returns A {@link Amity.Invitation} object
|
|
20
|
-
*
|
|
21
|
-
* @category Invitation API
|
|
22
|
-
* @async
|
|
23
|
-
*/
|
|
24
|
-
export const getInvitation = async (
|
|
25
|
-
targetType: Amity.Invitation['targetType'],
|
|
26
|
-
targetId: Amity.Invitation['targetId'],
|
|
27
|
-
): Promise<Amity.Cached<Amity.Invitation | undefined>> => {
|
|
28
|
-
const client = getActiveClient();
|
|
29
|
-
client.log('invitation/getInvitation', targetType, targetId);
|
|
30
|
-
|
|
31
|
-
const { data: payload } = await client.http.get<Amity.MyInvitationsPayload>(
|
|
32
|
-
`/api/v1/invitations/me`,
|
|
33
|
-
{ params: { targetType, targetId } },
|
|
34
|
-
);
|
|
35
|
-
|
|
36
|
-
const data = prepareMyInvitationsPayload(payload);
|
|
37
|
-
|
|
38
|
-
const cachedAt = client.cache && Date.now();
|
|
39
|
-
|
|
40
|
-
if (client.cache) ingestInCache(data, { cachedAt });
|
|
41
|
-
|
|
42
|
-
return {
|
|
43
|
-
data: data.invitations[0] ? invitationLinkedObject(data.invitations[0]) : undefined,
|
|
44
|
-
cachedAt,
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
/* end_public_function */
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { fireEvent } from '~/core/events';
|
|
2
|
-
import { InvitationStatusEnum } from '~/@types';
|
|
3
|
-
import { pullFromCache, upsertInCache } from '~/cache/api';
|
|
4
|
-
import { getActiveClient } from '~/client/api/activeClient';
|
|
5
|
-
|
|
6
|
-
/* begin_public_function
|
|
7
|
-
id: invitation.reject
|
|
8
|
-
*/
|
|
9
|
-
/**
|
|
10
|
-
* ```js
|
|
11
|
-
* import { rejectInvitation } from '@amityco/ts-sdk'
|
|
12
|
-
* const isRejected = await rejectInvitation(invitationId)
|
|
13
|
-
* ```
|
|
14
|
-
*
|
|
15
|
-
* Rejects a {@link Amity.Invitation} object
|
|
16
|
-
*
|
|
17
|
-
* @param invitationId the {@link Amity.Invitation} to reject
|
|
18
|
-
* @returns A success boolean if the {@link Amity.Invitation} was rejected
|
|
19
|
-
*
|
|
20
|
-
* @category Invitation API
|
|
21
|
-
* @async
|
|
22
|
-
*/
|
|
23
|
-
export const rejectInvitation = async (invitationId: Amity.Invitation['_id']): Promise<boolean> => {
|
|
24
|
-
const client = getActiveClient();
|
|
25
|
-
client.log('invitation/rejectInvitation', invitationId);
|
|
26
|
-
|
|
27
|
-
const { data } = await client.http.post<{ success: boolean }>(
|
|
28
|
-
`/api/v1/invitations/${invitationId}/reject`,
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const invitation = pullFromCache<Amity.InternalInvitation>([
|
|
32
|
-
'invitation',
|
|
33
|
-
'get',
|
|
34
|
-
invitationId,
|
|
35
|
-
])?.data;
|
|
36
|
-
|
|
37
|
-
if (invitation) {
|
|
38
|
-
upsertInCache(['invitation', 'get', invitationId], { status: InvitationStatusEnum.Rejected });
|
|
39
|
-
|
|
40
|
-
fireEvent('local.invitation.updated', [invitation]);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return data.success;
|
|
44
|
-
};
|
|
45
|
-
/* end_public_function */
|
package/src/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.ts
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import hash from 'object-hash';
|
|
2
|
-
import { isNonNullable } from '~/utils';
|
|
3
|
-
import { InvitationActionsEnum } from './enums';
|
|
4
|
-
import { invitationLinkedObject } from '~/utils/linkedObject/invitationLinkedObject';
|
|
5
|
-
import { pullFromCache, pushToCache } from '~/cache/api';
|
|
6
|
-
import { sortByFirstCreated, sortByLastCreated } from '~/core/query';
|
|
7
|
-
import { InvitationsPaginationController } from './InvitationsPaginationController';
|
|
8
|
-
import { InvitationsQueryStreamController } from './InvitationsQueryStreamController';
|
|
9
|
-
import { LiveCollectionController } from '~/core/liveCollection/LiveCollectionController';
|
|
10
|
-
import { prepareInvitationPayload } from '~/invitationRepository/utils';
|
|
11
|
-
import {
|
|
12
|
-
onLocalInvitationCreated,
|
|
13
|
-
onLocalInvitationDeleted,
|
|
14
|
-
onLocalInvitationUpdated,
|
|
15
|
-
} from '~/invitationRepository/events';
|
|
16
|
-
|
|
17
|
-
export class InvitationsLiveCollectionController extends LiveCollectionController<
|
|
18
|
-
'invitation',
|
|
19
|
-
Amity.InvitationLiveCollection,
|
|
20
|
-
Amity.Invitation,
|
|
21
|
-
InvitationsPaginationController
|
|
22
|
-
> {
|
|
23
|
-
private queryStreamController: InvitationsQueryStreamController;
|
|
24
|
-
|
|
25
|
-
private query: Amity.InvitationLiveCollection;
|
|
26
|
-
|
|
27
|
-
constructor(
|
|
28
|
-
query: Amity.InvitationLiveCollection,
|
|
29
|
-
callback: Amity.LiveCollectionCallback<Amity.Invitation>,
|
|
30
|
-
) {
|
|
31
|
-
const queryStreamId = hash(query);
|
|
32
|
-
const cacheKey = ['invitation', 'collection', queryStreamId];
|
|
33
|
-
const paginationController = new InvitationsPaginationController(query);
|
|
34
|
-
|
|
35
|
-
super(paginationController, queryStreamId, cacheKey, callback);
|
|
36
|
-
|
|
37
|
-
this.query = query;
|
|
38
|
-
this.queryStreamController = new InvitationsQueryStreamController(
|
|
39
|
-
this.query,
|
|
40
|
-
this.cacheKey,
|
|
41
|
-
this.notifyChange.bind(this),
|
|
42
|
-
prepareInvitationPayload,
|
|
43
|
-
);
|
|
44
|
-
|
|
45
|
-
this.callback = callback.bind(this);
|
|
46
|
-
this.loadPage({ initial: true });
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
protected setup() {
|
|
50
|
-
const collection = pullFromCache<Amity.InvitationLiveCollectionCache>(this.cacheKey)?.data;
|
|
51
|
-
if (!collection) {
|
|
52
|
-
pushToCache(this.cacheKey, {
|
|
53
|
-
data: [],
|
|
54
|
-
params: this.query,
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
protected async persistModel(queryPayload: Amity.InvitationPayload & Amity.Pagination) {
|
|
60
|
-
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
protected persistQueryStream({
|
|
64
|
-
response,
|
|
65
|
-
direction,
|
|
66
|
-
refresh,
|
|
67
|
-
}: Amity.LiveCollectionPersistQueryStreamParams<'invitation'>) {
|
|
68
|
-
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
startSubscription() {
|
|
72
|
-
return this.queryStreamController.subscribeRTE([
|
|
73
|
-
{
|
|
74
|
-
fn: onLocalInvitationCreated,
|
|
75
|
-
action: InvitationActionsEnum.OnLocalInvitationCreated,
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
fn: onLocalInvitationUpdated,
|
|
79
|
-
action: InvitationActionsEnum.OnLocalInvitationUpdated,
|
|
80
|
-
},
|
|
81
|
-
{
|
|
82
|
-
fn: onLocalInvitationDeleted,
|
|
83
|
-
action: InvitationActionsEnum.OnLocalInvitationDeleted,
|
|
84
|
-
},
|
|
85
|
-
]);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
notifyChange({ origin, loading, error }: Amity.LiveCollectionNotifyParams) {
|
|
89
|
-
const collection = pullFromCache<Amity.InvitationLiveCollectionCache>(this.cacheKey)?.data;
|
|
90
|
-
if (!collection) return;
|
|
91
|
-
|
|
92
|
-
const data = this.applyFilter(
|
|
93
|
-
collection.data
|
|
94
|
-
.map(id => pullFromCache<Amity.InternalInvitation>(['invitation', 'get', id])!)
|
|
95
|
-
.filter(isNonNullable)
|
|
96
|
-
.map(({ data }) => invitationLinkedObject(data)) ?? [],
|
|
97
|
-
);
|
|
98
|
-
|
|
99
|
-
if (!this.shouldNotify(data) && origin === 'event') return;
|
|
100
|
-
|
|
101
|
-
this.callback({
|
|
102
|
-
onNextPage: () => this.loadPage({ direction: Amity.LiveCollectionPageDirection.NEXT }),
|
|
103
|
-
data,
|
|
104
|
-
hasNextPage: !!this.paginationController.getNextToken(),
|
|
105
|
-
loading,
|
|
106
|
-
error,
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
applyFilter(data: Amity.Invitation[]) {
|
|
111
|
-
let invitations = data;
|
|
112
|
-
|
|
113
|
-
if (this.query.targetId) {
|
|
114
|
-
invitations = invitations.filter(invitation => invitation.targetId === this.query.targetId);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
if (this.query.statuses) {
|
|
118
|
-
invitations = invitations.filter(invitation =>
|
|
119
|
-
this.query.statuses?.includes(invitation.status),
|
|
120
|
-
);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
if (this.query.targetType) {
|
|
124
|
-
invitations = invitations.filter(
|
|
125
|
-
invitation => invitation.targetType === this.query.targetType,
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (this.query.type) {
|
|
130
|
-
invitations = invitations.filter(invitation => invitation.type === this.query.type);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const sortFn = (() => {
|
|
134
|
-
switch (this.query.sortBy) {
|
|
135
|
-
case 'firstCreated':
|
|
136
|
-
return sortByFirstCreated;
|
|
137
|
-
case 'lastCreated':
|
|
138
|
-
return sortByLastCreated;
|
|
139
|
-
default:
|
|
140
|
-
return sortByLastCreated;
|
|
141
|
-
}
|
|
142
|
-
})();
|
|
143
|
-
|
|
144
|
-
invitations = invitations.sort(sortFn);
|
|
145
|
-
|
|
146
|
-
return invitations;
|
|
147
|
-
}
|
|
148
|
-
}
|
package/src/invitationRepository/observers/getInvitations/InvitationsPaginationController.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { COLLECTION_DEFAULT_PAGINATION_LIMIT } from '~/utils/constants';
|
|
2
|
-
import { PaginationController } from '~/core/liveCollection/PaginationController';
|
|
3
|
-
|
|
4
|
-
export class InvitationsPaginationController extends PaginationController<
|
|
5
|
-
'invitation',
|
|
6
|
-
Amity.InvitationLiveCollection
|
|
7
|
-
> {
|
|
8
|
-
async getRequest(queryParams: Amity.InvitationLiveCollection, token: string | undefined) {
|
|
9
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, ...params } = queryParams;
|
|
10
|
-
const options = token ? { token } : { limit };
|
|
11
|
-
|
|
12
|
-
const { data } = await this.http.get<Amity.InvitationPayload & Amity.Pagination>(
|
|
13
|
-
'/api/v1/invitations',
|
|
14
|
-
{ params: { ...params, options } },
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
return data;
|
|
18
|
-
}
|
|
19
|
-
}
|
package/src/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
-
import { getResolver } from '~/core/model';
|
|
3
|
-
import { InvitationActionsEnum } from './enums';
|
|
4
|
-
import { pullFromCache, pushToCache } from '~/cache/api';
|
|
5
|
-
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
6
|
-
import { QueryStreamController } from '~/core/liveCollection/QueryStreamController';
|
|
7
|
-
|
|
8
|
-
export class InvitationsQueryStreamController extends QueryStreamController<
|
|
9
|
-
Amity.InvitationPayload,
|
|
10
|
-
Amity.InvitationLiveCollection
|
|
11
|
-
> {
|
|
12
|
-
private notifyChange: (params: Amity.LiveCollectionNotifyParams) => void;
|
|
13
|
-
|
|
14
|
-
private preparePayload: (response: Amity.InvitationPayload) => Amity.ProcessedInvitationPayload;
|
|
15
|
-
|
|
16
|
-
constructor(
|
|
17
|
-
query: Amity.InvitationLiveCollection,
|
|
18
|
-
cacheKey: string[],
|
|
19
|
-
notifyChange: (params: Amity.LiveCollectionNotifyParams) => void,
|
|
20
|
-
preparePayload: (response: Amity.InvitationPayload) => Amity.ProcessedInvitationPayload,
|
|
21
|
-
) {
|
|
22
|
-
super(query, cacheKey);
|
|
23
|
-
this.notifyChange = notifyChange;
|
|
24
|
-
this.preparePayload = preparePayload;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async saveToMainDB(response: Amity.InvitationPayload) {
|
|
28
|
-
const processedPayload = await this.preparePayload(response);
|
|
29
|
-
|
|
30
|
-
const client = getActiveClient();
|
|
31
|
-
const cachedAt = client.cache && Date.now();
|
|
32
|
-
|
|
33
|
-
if (client.cache) {
|
|
34
|
-
ingestInCache(processedPayload, { cachedAt });
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
appendToQueryStream(
|
|
39
|
-
response: Amity.InvitationPayload & Partial<Amity.Pagination>,
|
|
40
|
-
direction: Amity.LiveCollectionPageDirection,
|
|
41
|
-
refresh = false,
|
|
42
|
-
) {
|
|
43
|
-
if (refresh) {
|
|
44
|
-
pushToCache(this.cacheKey, {
|
|
45
|
-
data: response.invitations.map(getResolver('invitation')),
|
|
46
|
-
});
|
|
47
|
-
} else {
|
|
48
|
-
const collection = pullFromCache<Amity.InvitationLiveCollectionCache>(this.cacheKey)?.data;
|
|
49
|
-
|
|
50
|
-
const invitations = collection?.data ?? [];
|
|
51
|
-
|
|
52
|
-
pushToCache(this.cacheKey, {
|
|
53
|
-
...collection,
|
|
54
|
-
data: [
|
|
55
|
-
...new Set([...invitations, ...response.invitations.map(getResolver('invitation'))]),
|
|
56
|
-
],
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
reactor(action: InvitationActionsEnum) {
|
|
62
|
-
return (invitations: Amity.InternalInvitation[]) => {
|
|
63
|
-
const collection = pullFromCache<Amity.InvitationLiveCollectionCache>(this.cacheKey)?.data;
|
|
64
|
-
if (!collection) return;
|
|
65
|
-
|
|
66
|
-
if (action === InvitationActionsEnum.OnLocalInvitationUpdated) {
|
|
67
|
-
const isExist = collection.data.find(id => id === invitations[0].invitationId);
|
|
68
|
-
if (!isExist) return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (action === InvitationActionsEnum.OnLocalInvitationCreated) {
|
|
72
|
-
collection.data = [
|
|
73
|
-
...new Set([
|
|
74
|
-
...invitations.map(invitation => invitation.invitationId),
|
|
75
|
-
...collection.data,
|
|
76
|
-
]),
|
|
77
|
-
];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
if (action === InvitationActionsEnum.OnLocalInvitationDeleted) {
|
|
81
|
-
collection.data = collection.data.filter(id => id !== invitations[0].invitationId);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
pushToCache(this.cacheKey, collection);
|
|
85
|
-
this.notifyChange({ origin: Amity.LiveDataOrigin.EVENT, loading: false });
|
|
86
|
-
};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
subscribeRTE(
|
|
90
|
-
createSubscriber: {
|
|
91
|
-
fn: (reactor: Amity.Listener<Amity.InternalInvitation[]>) => Amity.Unsubscriber;
|
|
92
|
-
action: InvitationActionsEnum;
|
|
93
|
-
}[],
|
|
94
|
-
) {
|
|
95
|
-
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
96
|
-
}
|
|
97
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { dropFromCache } from '~/cache/api';
|
|
2
|
-
import { getActiveClient } from '~/client/api/activeClient';
|
|
3
|
-
import { ENABLE_CACHE_MESSAGE } from '~/utils/constants';
|
|
4
|
-
import { InvitationsLiveCollectionController } from './getInvitations/InvitationsLiveCollectionController';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Get invitations
|
|
8
|
-
*
|
|
9
|
-
* @param params the query parameters
|
|
10
|
-
* @param callback the callback to be called when the invitations are updated
|
|
11
|
-
* @returns invitations
|
|
12
|
-
*
|
|
13
|
-
* @category Invitation Live Collection
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
export const getInvitations = (
|
|
17
|
-
params: Amity.InvitationLiveCollection,
|
|
18
|
-
callback: Amity.LiveCollectionCallback<Amity.Invitation>,
|
|
19
|
-
config?: Amity.LiveCollectionConfig,
|
|
20
|
-
) => {
|
|
21
|
-
const { log, cache } = getActiveClient();
|
|
22
|
-
|
|
23
|
-
if (!cache) {
|
|
24
|
-
console.log(ENABLE_CACHE_MESSAGE);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const timestamp = Date.now();
|
|
28
|
-
log(`getInvitations: (tmpid: ${timestamp}) > listen`);
|
|
29
|
-
|
|
30
|
-
const invitationsLiveCollection = new InvitationsLiveCollectionController(params, callback);
|
|
31
|
-
|
|
32
|
-
const disposers = invitationsLiveCollection.startSubscription();
|
|
33
|
-
|
|
34
|
-
const cacheKey = invitationsLiveCollection.getCacheKey();
|
|
35
|
-
|
|
36
|
-
disposers.push(() => {
|
|
37
|
-
dropFromCache(cacheKey);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
return () => {
|
|
41
|
-
log(`getInvitations (tmpid: ${timestamp}) > dispose`);
|
|
42
|
-
disposers.forEach(fn => fn());
|
|
43
|
-
};
|
|
44
|
-
};
|