@amityco/ts-sdk 7.5.3 → 7.5.4-2d34fd5f.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +26 -26
- package/dist/@types/core/events.d.ts +7 -0
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +5 -1
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +38 -5
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/client.d.ts +10 -0
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +51 -1
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/content.d.ts +11 -2
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/@types/domains/feed.d.ts +2 -1
- package/dist/@types/domains/feed.d.ts.map +1 -1
- package/dist/@types/domains/file.d.ts +3 -1
- package/dist/@types/domains/file.d.ts.map +1 -1
- package/dist/@types/domains/invitation.d.ts +92 -0
- package/dist/@types/domains/invitation.d.ts.map +1 -0
- package/dist/@types/domains/joinRequest.d.ts +53 -0
- package/dist/@types/domains/joinRequest.d.ts.map +1 -0
- package/dist/@types/domains/notification.d.ts +4 -2
- package/dist/@types/domains/notification.d.ts.map +1 -1
- package/dist/@types/domains/pinnedPost.d.ts +1 -1
- package/dist/@types/domains/pinnedPost.d.ts.map +1 -1
- package/dist/@types/domains/post.d.ts +3 -0
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/@types/index.d.ts +5 -0
- package/dist/@types/index.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/deleteCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunities.d.ts +1 -1
- package/dist/communityRepository/api/getCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/getCommunity.d.ts +2 -2
- package/dist/communityRepository/api/getCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/getRecommendedCommunities.d.ts +3 -1
- package/dist/communityRepository/api/getRecommendedCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/getTrendingCommunities.d.ts +3 -1
- package/dist/communityRepository/api/getTrendingCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/joinCommunity.d.ts +3 -0
- package/dist/communityRepository/api/joinCommunity.d.ts.map +1 -1
- package/dist/communityRepository/api/queryCommunities.d.ts.map +1 -1
- package/dist/communityRepository/api/updateCommunity.d.ts +2 -2
- package/dist/communityRepository/api/updateCommunity.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/index.d.ts +1 -0
- package/dist/communityRepository/communityMembership/events/index.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityJoined.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityLeft.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserAdded.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserBanned.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserChanged.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRemoved.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRoleAdded.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onCommunityUserUnbanned.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoin.d.ts +2 -0
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoin.d.ts.map +1 -0
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityJoined.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityLeft.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityUserAdded.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts +1 -1
- package/dist/communityRepository/communityMembership/events/onUserDeleted.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/events/utils.d.ts +2 -2
- package/dist/communityRepository/communityMembership/events/utils.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/enums.d.ts +2 -1
- package/dist/communityRepository/communityMembership/observers/getMembers/enums.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/communityMembership/observers/searchMembers/enums.d.ts +1 -0
- package/dist/communityRepository/communityMembership/observers/searchMembers/enums.d.ts.map +1 -1
- package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts +1 -1
- package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.d.ts.map +1 -1
- package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts +1 -1
- package/dist/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.d.ts.map +1 -1
- package/dist/communityRepository/events/onCommunityCreated.d.ts +1 -1
- package/dist/communityRepository/events/onCommunityCreated.d.ts.map +1 -1
- package/dist/communityRepository/events/onCommunityDeleted.d.ts +1 -1
- package/dist/communityRepository/events/onCommunityDeleted.d.ts.map +1 -1
- package/dist/communityRepository/events/onCommunityUpdated.d.ts +1 -1
- package/dist/communityRepository/events/onCommunityUpdated.d.ts.map +1 -1
- package/dist/communityRepository/events/utils.d.ts +1 -1
- package/dist/communityRepository/events/utils.d.ts.map +1 -1
- package/dist/communityRepository/internalAPI/getMyJoinRequest.d.ts +16 -0
- package/dist/communityRepository/internalAPI/getMyJoinRequest.d.ts.map +1 -0
- package/dist/communityRepository/internalAPI/joinCommunity.d.ts +16 -0
- package/dist/communityRepository/internalAPI/joinCommunity.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/events/index.d.ts +4 -0
- package/dist/communityRepository/joinRequest/events/index.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestCreated.d.ts +17 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestCreated.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestDeleted.d.ts +17 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestDeleted.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestUpdated.d.ts +17 -0
- package/dist/communityRepository/joinRequest/events/onJoinRequestUpdated.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts +16 -0
- package/dist/communityRepository/joinRequest/internalAPI/approveJoinRequest.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts +16 -0
- package/dist/communityRepository/joinRequest/internalAPI/cancelJoinRequest.d.ts.map +1 -0
- package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts +16 -0
- package/dist/communityRepository/joinRequest/internalAPI/rejectJoinRequest.d.ts.map +1 -0
- package/dist/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunities/CommunitiesPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getCommunity.d.ts.map +1 -1
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.d.ts +14 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.d.ts +9 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.d.ts +15 -0
- package/dist/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequestList/enum.d.ts +6 -0
- package/dist/communityRepository/observers/getJoinRequestList/enum.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequestList.d.ts +12 -0
- package/dist/communityRepository/observers/getJoinRequestList.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.d.ts +14 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts +9 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.d.ts +15 -0
- package/dist/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests/enum.d.ts +6 -0
- package/dist/communityRepository/observers/getJoinRequests/enum.d.ts.map +1 -0
- package/dist/communityRepository/observers/getJoinRequests.d.ts +12 -0
- package/dist/communityRepository/observers/getJoinRequests.d.ts.map +1 -0
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getRecommendedCommunities/enums.d.ts +2 -1
- package/dist/communityRepository/observers/getRecommendedCommunities/enums.d.ts.map +1 -1
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/observers/index.d.ts +1 -0
- package/dist/communityRepository/observers/index.d.ts.map +1 -1
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityLiveCollectionController.d.ts.map +1 -1
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityPaginationController.d.ts.map +1 -1
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts +2 -2
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts.map +1 -1
- package/dist/communityRepository/utils/communityWithMembership.d.ts +1 -1
- package/dist/communityRepository/utils/communityWithMembership.d.ts.map +1 -1
- package/dist/communityRepository/utils/payload.d.ts +2 -1
- package/dist/communityRepository/utils/payload.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts +1 -1
- package/dist/feedRepository/api/getCustomRankingGlobalFeed.d.ts.map +1 -1
- package/dist/feedRepository/api/queryGlobalFeed.d.ts.map +1 -1
- package/dist/fileRepository/api/index.d.ts +1 -0
- package/dist/fileRepository/api/index.d.ts.map +1 -1
- package/dist/fileRepository/api/uploadClip.d.ts +17 -0
- package/dist/fileRepository/api/uploadClip.d.ts.map +1 -0
- package/dist/index.cjs.js +3047 -1474
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +3265 -1693
- package/dist/index.umd.js +4 -4
- package/dist/invitationRepository/events/index.d.ts +4 -0
- package/dist/invitationRepository/events/index.d.ts.map +1 -0
- package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts +17 -0
- package/dist/invitationRepository/events/onLocalInvitationCreated.d.ts.map +1 -0
- package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts +17 -0
- package/dist/invitationRepository/events/onLocalInvitationDeleted.d.ts.map +1 -0
- package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts +17 -0
- package/dist/invitationRepository/events/onLocalInvitationUpdated.d.ts.map +1 -0
- package/dist/invitationRepository/index.d.ts +3 -0
- package/dist/invitationRepository/index.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/acceptInvitation.d.ts +16 -0
- package/dist/invitationRepository/internalApi/acceptInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/createInvitations.d.ts +21 -0
- package/dist/invitationRepository/internalApi/createInvitations.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/getInvitation.d.ts +17 -0
- package/dist/invitationRepository/internalApi/getInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/index.d.ts +4 -0
- package/dist/invitationRepository/internalApi/index.d.ts.map +1 -0
- package/dist/invitationRepository/internalApi/rejectInvitation.d.ts +16 -0
- package/dist/invitationRepository/internalApi/rejectInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts +14 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts +5 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsPaginationController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts +15 -0
- package/dist/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations/enums.d.ts +6 -0
- package/dist/invitationRepository/observers/getInvitations/enums.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getInvitations.d.ts +12 -0
- package/dist/invitationRepository/observers/getInvitations.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts +12 -0
- package/dist/invitationRepository/observers/getMyCommunityInvitations.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts +14 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts +5 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts +15 -0
- package/dist/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.d.ts.map +1 -0
- package/dist/invitationRepository/observers/index.d.ts +2 -0
- package/dist/invitationRepository/observers/index.d.ts.map +1 -0
- package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts +2 -0
- package/dist/invitationRepository/utils/convertRawInvitationToInternalInvitation.d.ts.map +1 -0
- package/dist/invitationRepository/utils/index.d.ts +2 -0
- package/dist/invitationRepository/utils/index.d.ts.map +1 -0
- package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts +2 -0
- package/dist/invitationRepository/utils/prepareInvitationPayload.d.ts.map +1 -0
- package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts +2 -0
- package/dist/invitationRepository/utils/prepareMyInvitationsPayload.d.ts.map +1 -0
- package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
- package/dist/postRepository/api/createClipPost.d.ts +32 -0
- package/dist/postRepository/api/createClipPost.d.ts.map +1 -0
- package/dist/postRepository/api/index.d.ts +1 -0
- package/dist/postRepository/api/index.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/subChannelRepository/utils/prepareSubChannelPayload.d.ts.map +1 -1
- package/dist/utils/linkedObject/communityLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/communityLinkedObject.d.ts.map +1 -0
- package/dist/utils/linkedObject/index.d.ts +3 -0
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/invitationLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/invitationLinkedObject.d.ts.map +1 -0
- package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts +2 -0
- package/dist/utils/linkedObject/joinRequestLinkedObject.d.ts.map +1 -0
- package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
- package/dist/utils/postTypePredicate.d.ts +1 -0
- 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 +10 -0
- package/src/@types/core/model.ts +8 -1
- package/src/@types/core/payload.ts +48 -5
- package/src/@types/domains/client.ts +12 -0
- package/src/@types/domains/community.ts +82 -3
- package/src/@types/domains/content.ts +25 -1
- package/src/@types/domains/feed.ts +2 -1
- package/src/@types/domains/file.ts +5 -0
- package/src/@types/domains/invitation.ts +119 -0
- package/src/@types/domains/joinRequest.ts +66 -0
- package/src/@types/domains/notification.ts +2 -0
- package/src/@types/domains/pinnedPost.ts +1 -1
- package/src/@types/domains/post.ts +4 -0
- package/src/@types/index.ts +5 -0
- package/src/communityRepository/api/createCommunity.ts +5 -2
- package/src/communityRepository/api/deleteCommunity.ts +2 -1
- package/src/communityRepository/api/getCommunities.ts +9 -2
- package/src/communityRepository/api/getCommunity.ts +12 -3
- package/src/communityRepository/api/getRecommendedCommunities.ts +11 -4
- package/src/communityRepository/api/getTrendingCommunities.ts +11 -4
- package/src/communityRepository/api/joinCommunity.ts +4 -1
- package/src/communityRepository/api/queryCommunities.ts +7 -1
- package/src/communityRepository/api/updateCommunity.ts +13 -3
- package/src/communityRepository/communityMembership/events/index.ts +1 -0
- package/src/communityRepository/communityMembership/events/onCommunityJoined.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityLeft.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserAdded.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserBanned.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserChanged.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserRemoved.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserRoleAdded.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserRoleRemoved.ts +1 -1
- package/src/communityRepository/communityMembership/events/onCommunityUserUnbanned.ts +1 -1
- package/src/communityRepository/communityMembership/events/onLocalCommunityJoin.ts +20 -0
- package/src/communityRepository/communityMembership/events/onLocalCommunityJoined.ts +1 -1
- package/src/communityRepository/communityMembership/events/onLocalCommunityLeft.ts +1 -1
- package/src/communityRepository/communityMembership/events/onLocalCommunityUserAdded.ts +1 -1
- package/src/communityRepository/communityMembership/events/onLocalCommunityUserRemoved.ts +1 -1
- package/src/communityRepository/communityMembership/events/onUserDeleted.ts +3 -1
- package/src/communityRepository/communityMembership/events/utils.ts +2 -2
- package/src/communityRepository/communityMembership/observers/getMembers/CommunityMembersQueryStreamController.ts +8 -2
- package/src/communityRepository/communityMembership/observers/getMembers/enums.ts +1 -0
- package/src/communityRepository/communityMembership/observers/searchMembers/SearchCommunityMembersQueryStreamController.ts +8 -2
- package/src/communityRepository/communityMembership/observers/searchMembers/enums.ts +1 -0
- package/src/communityRepository/communityModeration/events/onLocalCommunityRoleAdded.ts +1 -1
- package/src/communityRepository/communityModeration/events/onLocalCommunityRoleRemoved.ts +1 -1
- package/src/communityRepository/events/onCommunityCreated.ts +1 -1
- package/src/communityRepository/events/onCommunityDeleted.ts +1 -1
- package/src/communityRepository/events/onCommunityUpdated.ts +1 -1
- package/src/communityRepository/events/utils.ts +1 -1
- package/src/communityRepository/internalAPI/getMyJoinRequest.ts +43 -0
- package/src/communityRepository/internalAPI/joinCommunity.ts +66 -0
- package/src/communityRepository/joinRequest/events/index.ts +3 -0
- package/src/communityRepository/joinRequest/events/onJoinRequestCreated.ts +33 -0
- package/src/communityRepository/joinRequest/events/onJoinRequestDeleted.ts +33 -0
- package/src/communityRepository/joinRequest/events/onJoinRequestUpdated.ts +33 -0
- package/src/communityRepository/joinRequest/internalAPI/approveJoinRequest.ts +52 -0
- package/src/communityRepository/joinRequest/internalAPI/cancelJoinRequest.ts +49 -0
- package/src/communityRepository/joinRequest/internalAPI/rejectJoinRequest.ts +52 -0
- package/src/communityRepository/observers/getCommunities/CommunitiesLiveCollectionController.ts +6 -0
- package/src/communityRepository/observers/getCommunities/CommunitiesPaginationController.ts +1 -0
- package/src/communityRepository/observers/getCommunities/CommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/getCommunity.ts +26 -11
- package/src/communityRepository/observers/getJoinRequestList/JoinRequestListLiveCollectionController.ts +135 -0
- package/src/communityRepository/observers/getJoinRequestList/JoinRequestListPaginationController.ts +30 -0
- package/src/communityRepository/observers/getJoinRequestList/JoinRequestListQueryStreamController.ts +116 -0
- package/src/communityRepository/observers/getJoinRequestList/enum.ts +5 -0
- package/src/communityRepository/observers/getJoinRequestList.ts +51 -0
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsLiveCollectionController.ts +126 -0
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsPaginationController.ts +25 -0
- package/src/communityRepository/observers/getJoinRequests/JoinRequestsQueryStreamController.ts +108 -0
- package/src/communityRepository/observers/getJoinRequests/enum.ts +5 -0
- package/src/communityRepository/observers/getJoinRequests.ts +44 -0
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesLiveCollectionController.ts +8 -1
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesPaginationController.ts +6 -1
- package/src/communityRepository/observers/getRecommendedCommunities/RecommendedCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/getRecommendedCommunities/enums.ts +1 -0
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesLiveCollectionController.ts +9 -1
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesPaginationController.ts +6 -1
- package/src/communityRepository/observers/getTrendingCommunities/TrendingCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/index.ts +1 -0
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesLiveCollectionController.ts +6 -0
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesPaginationController.ts +1 -0
- package/src/communityRepository/observers/searchCommunities/SearchCommunitiesQueryStreamController.ts +2 -2
- package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityLiveCollectionController.ts +6 -0
- package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityPaginationController.ts +1 -0
- package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.ts +2 -2
- package/src/communityRepository/utils/communityWithMembership.ts +9 -5
- package/src/communityRepository/utils/payload.ts +28 -2
- package/src/core/liveCollection/PaginationController.ts +1 -1
- package/src/core/liveCollection/PaginationNoPageController.ts +1 -1
- package/src/core/model/idResolvers.ts +3 -0
- package/src/core/model/index.ts +3 -0
- package/src/feedRepository/api/getCustomRankingGlobalFeed.ts +1 -1
- package/src/feedRepository/api/queryGlobalFeed.ts +3 -1
- package/src/fileRepository/api/index.ts +1 -0
- package/src/fileRepository/api/uploadClip.ts +71 -0
- package/src/index.ts +2 -0
- package/src/invitationRepository/events/index.ts +3 -0
- package/src/invitationRepository/events/onLocalInvitationCreated.ts +33 -0
- package/src/invitationRepository/events/onLocalInvitationDeleted.ts +33 -0
- package/src/invitationRepository/events/onLocalInvitationUpdated.ts +33 -0
- package/src/invitationRepository/index.ts +2 -0
- package/src/invitationRepository/internalApi/acceptInvitation.ts +45 -0
- package/src/invitationRepository/internalApi/createInvitations.ts +52 -0
- package/src/invitationRepository/internalApi/getInvitation.ts +47 -0
- package/src/invitationRepository/internalApi/index.ts +3 -0
- package/src/invitationRepository/internalApi/rejectInvitation.ts +45 -0
- package/src/invitationRepository/observers/getInvitations/InvitationsLiveCollectionController.ts +148 -0
- package/src/invitationRepository/observers/getInvitations/InvitationsPaginationController.ts +19 -0
- package/src/invitationRepository/observers/getInvitations/InvitationsQueryStreamController.ts +97 -0
- package/src/invitationRepository/observers/getInvitations/enums.ts +5 -0
- package/src/invitationRepository/observers/getInvitations.ts +44 -0
- package/src/invitationRepository/observers/getMyCommunityInvitations.ts +48 -0
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsLiveCollectionController.ts +148 -0
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsPaginationController.ts +22 -0
- package/src/invitationRepository/observers/getMyInvitations/MyInvitationsQueryStreamController.ts +105 -0
- package/src/invitationRepository/observers/index.ts +1 -0
- package/src/invitationRepository/utils/convertRawInvitationToInternalInvitation.ts +8 -0
- package/src/invitationRepository/utils/index.ts +1 -0
- package/src/invitationRepository/utils/prepareInvitationPayload.ts +12 -0
- package/src/invitationRepository/utils/prepareMyInvitationsPayload.ts +12 -0
- package/src/messagePreview/utils/getChannelMessagePreviewWithUser.ts +3 -3
- package/src/postRepository/api/createClipPost.ts +62 -0
- package/src/postRepository/api/index.ts +2 -0
- package/src/postRepository/api/queryPosts.ts +1 -1
- package/src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.ts +7 -1
- package/src/postRepository/observers/getPinnedPosts/PinnedPostQueryStreamController.ts +7 -1
- package/src/postRepository/observers/getPosts/PostPaginationController.ts +1 -1
- package/src/subChannelRepository/utils/prepareSubChannelPayload.ts +4 -0
- package/src/utils/linkedObject/communityLinkedObject.ts +57 -0
- package/src/utils/linkedObject/index.ts +6 -0
- package/src/utils/linkedObject/invitationLinkedObject.ts +37 -0
- package/src/utils/linkedObject/joinRequestLinkedObject.ts +31 -0
- package/src/utils/linkedObject/postLinkedObject.ts +12 -1
- package/src/utils/postTypePredicate.ts +10 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { pullFromCache } from '~/cache/api';
|
|
1
|
+
import { pullFromCache } from '~/cache/api/pullFromCache';
|
|
2
2
|
import { getChannelMessagePreview } from './getChannelMessagePreview';
|
|
3
|
-
import {
|
|
3
|
+
import { userLinkedObject } from '~/utils/linkedObject/userLinkedObject';
|
|
4
4
|
|
|
5
5
|
export const getChannelMessagePreviewWithUser = (
|
|
6
6
|
channel: Amity.StaticInternalChannel,
|
|
@@ -20,7 +20,7 @@ export const getChannelMessagePreviewWithUser = (
|
|
|
20
20
|
const messagePreviewWithUser = messagePreview
|
|
21
21
|
? {
|
|
22
22
|
...messagePreview,
|
|
23
|
-
user: internalUser ?
|
|
23
|
+
user: internalUser ? userLinkedObject(internalUser) : undefined,
|
|
24
24
|
}
|
|
25
25
|
: null;
|
|
26
26
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { getActiveClient } from '~/client/api/activeClient';
|
|
2
|
+
|
|
3
|
+
import { ingestInCache } from '~/cache/api/ingestInCache';
|
|
4
|
+
import { fireEvent } from '~/core/events';
|
|
5
|
+
import { prepareMembershipPayload } from '~/group/utils';
|
|
6
|
+
import { LinkedObject } from '~/utils/linkedObject';
|
|
7
|
+
|
|
8
|
+
/* begin_public_function
|
|
9
|
+
id: post.create.clip_post
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* ```js
|
|
13
|
+
* import { PostRepository } from '@amityco/ts-sdk'
|
|
14
|
+
* const created = await PostRepository.createClipPost({
|
|
15
|
+
* targetType: 'user',
|
|
16
|
+
* targetId: 'foobar',
|
|
17
|
+
* dataType: 'clip',
|
|
18
|
+
* data: { text: 'hello world' },
|
|
19
|
+
* attachments: [{ type: 'clip', fileId: 'fileId123', displayMode: 'fill', isMuted: false }]
|
|
20
|
+
* }))
|
|
21
|
+
* ```
|
|
22
|
+
*
|
|
23
|
+
* Creates an {@link Amity.Post}
|
|
24
|
+
*
|
|
25
|
+
* @param bundle The data necessary to create a new {@link Amity.Post}
|
|
26
|
+
* @returns The newly created {@link Amity.Post}
|
|
27
|
+
*
|
|
28
|
+
* @category Post API
|
|
29
|
+
* @async
|
|
30
|
+
*/
|
|
31
|
+
export const createClipPost = async <T extends Amity.PostContentType | string>(
|
|
32
|
+
bundle: Pick<Amity.Post<T>, 'targetType' | 'targetId'> &
|
|
33
|
+
Partial<Pick<Amity.Post<T>, 'metadata' | 'mentionees' | 'tags'>> & {
|
|
34
|
+
data: { [k: string]: any };
|
|
35
|
+
attachments: {
|
|
36
|
+
type: T;
|
|
37
|
+
fileId: Amity.File['fileId'];
|
|
38
|
+
displayMode?: Amity.ClipDisplayMode;
|
|
39
|
+
isMuted?: boolean;
|
|
40
|
+
}[];
|
|
41
|
+
},
|
|
42
|
+
): Promise<Amity.Cached<Amity.Post>> => {
|
|
43
|
+
const client = getActiveClient();
|
|
44
|
+
client.log('post/createPost', bundle);
|
|
45
|
+
|
|
46
|
+
const { data: payload } = await client.http.post<Amity.PostPayload>('/api/v4/posts', bundle);
|
|
47
|
+
|
|
48
|
+
fireEvent('post.created', payload);
|
|
49
|
+
|
|
50
|
+
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
51
|
+
const cachedAt = client.cache && Date.now();
|
|
52
|
+
|
|
53
|
+
if (client.cache) ingestInCache(data, { cachedAt });
|
|
54
|
+
|
|
55
|
+
const { posts } = data;
|
|
56
|
+
|
|
57
|
+
return {
|
|
58
|
+
data: LinkedObject.post(posts[0]),
|
|
59
|
+
cachedAt,
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
/* end_public_function */
|
|
@@ -43,7 +43,7 @@ export const queryPosts = async (
|
|
|
43
43
|
// API-FIX: parameters should be querystring. (1)
|
|
44
44
|
// API-FIX: backend should answer Amity.Response (2)
|
|
45
45
|
// const { data } = await client.http.get<Amity.Response<Amity.PagedResponse<Amity.PostPayload>>>(
|
|
46
|
-
const { data } = await client.http.get<Amity.PostPayload & Amity.Pagination>(`/api/
|
|
46
|
+
const { data } = await client.http.get<Amity.PostPayload & Amity.Pagination>(`/api/v5/posts`, {
|
|
47
47
|
params: {
|
|
48
48
|
...params,
|
|
49
49
|
isDeleted: inferIsDeleted(includeDeleted),
|
package/src/postRepository/observers/getGlobalPinnedPosts/GlobalPinnedPostQueryStreamController.ts
CHANGED
|
@@ -4,6 +4,7 @@ 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';
|
|
7
8
|
|
|
8
9
|
export class GlobalPinnedPostQueryStreamController extends QueryStreamController<
|
|
9
10
|
Amity.PinnedPostPayload,
|
|
@@ -30,7 +31,12 @@ export class GlobalPinnedPostQueryStreamController extends QueryStreamController
|
|
|
30
31
|
const cachedAt = client.cache && Date.now();
|
|
31
32
|
|
|
32
33
|
if (client.cache) {
|
|
33
|
-
|
|
34
|
+
const processedPayload = {
|
|
35
|
+
...response,
|
|
36
|
+
users: response.users.map(convertRawUserToInternalUser),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
34
40
|
}
|
|
35
41
|
}
|
|
36
42
|
|
|
@@ -3,6 +3,7 @@ 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';
|
|
6
7
|
|
|
7
8
|
export class PinnedPostQueryStreamController extends QueryStreamController<
|
|
8
9
|
Amity.PinnedPostPayload,
|
|
@@ -29,7 +30,12 @@ export class PinnedPostQueryStreamController extends QueryStreamController<
|
|
|
29
30
|
const cachedAt = client.cache && Date.now();
|
|
30
31
|
|
|
31
32
|
if (client.cache) {
|
|
32
|
-
|
|
33
|
+
const processedPayload = {
|
|
34
|
+
...response,
|
|
35
|
+
users: response.users ? response.users.map(convertRawUserToInternalUser) : [],
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
33
39
|
}
|
|
34
40
|
}
|
|
35
41
|
|
|
@@ -23,7 +23,7 @@ export class PostPaginationController extends PaginationController<
|
|
|
23
23
|
const options = token ? { ...baseOptions, token } : { ...baseOptions, limit };
|
|
24
24
|
|
|
25
25
|
const { data: queryResponse } = await this.http.get<Amity.PostPayload & Amity.Pagination>(
|
|
26
|
-
`/api/
|
|
26
|
+
`/api/v5/posts`,
|
|
27
27
|
{
|
|
28
28
|
params: {
|
|
29
29
|
...params,
|
|
@@ -4,6 +4,7 @@ import { convertFromRaw as convertMessageFromRaw } from '~/messageRepository/uti
|
|
|
4
4
|
import { convertFromRaw as convertSubChannelFromRaw } from './convertSubChannelFromRaw';
|
|
5
5
|
|
|
6
6
|
import { updateSubChannelMessagePreviewCache } from '../../messagePreview/utils/updateSubChannelMessagePreviewCache';
|
|
7
|
+
import { convertRawUserToInternalUser } from '~/userRepository/utils/convertRawUserToInternalUser';
|
|
7
8
|
|
|
8
9
|
export const MARKER_INCLUDED_SUB_CHANNEL_TYPE = ['broadcast', 'conversation', 'community'];
|
|
9
10
|
|
|
@@ -44,10 +45,13 @@ export const prepareSubChannelPayload = async (
|
|
|
44
45
|
|
|
45
46
|
const messages = rawPayload.messages.map(m => convertMessageFromRaw(m));
|
|
46
47
|
|
|
48
|
+
const user = rawPayload.users.map(convertRawUserToInternalUser);
|
|
49
|
+
|
|
47
50
|
return {
|
|
48
51
|
...rawPayload,
|
|
49
52
|
messageFeeds,
|
|
50
53
|
messages,
|
|
54
|
+
users: user,
|
|
51
55
|
};
|
|
52
56
|
};
|
|
53
57
|
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { InvitationTypeEnum } from '~/@types';
|
|
2
|
+
import { getMyJoinRequest } from '~/communityRepository/internalAPI/getMyJoinRequest';
|
|
3
|
+
import { joinRequest } from '~/communityRepository/internalAPI/joinCommunity';
|
|
4
|
+
import { getJoinRequests } from '~/communityRepository/observers/getJoinRequests';
|
|
5
|
+
import { createInvitations } from '~/invitationRepository/internalApi';
|
|
6
|
+
import { getInvitation } from '~/invitationRepository/internalApi/getInvitation';
|
|
7
|
+
import { getInvitations } from '~/invitationRepository/observers/getInvitations';
|
|
8
|
+
|
|
9
|
+
export const communityLinkedObject = (community: Amity.InternalCommunity): Amity.Community => {
|
|
10
|
+
return {
|
|
11
|
+
...community,
|
|
12
|
+
createInvitations: async (userIds: string[]): Promise<void> => {
|
|
13
|
+
await createInvitations({
|
|
14
|
+
type: InvitationTypeEnum.CommunityMemberInvite,
|
|
15
|
+
targetType: 'community',
|
|
16
|
+
targetId: community.communityId,
|
|
17
|
+
userIds,
|
|
18
|
+
});
|
|
19
|
+
},
|
|
20
|
+
getMemberInvitations: (
|
|
21
|
+
params: Pick<Amity.InvitationLiveCollection, 'limit' | 'sortBy' | 'statuses'>,
|
|
22
|
+
callback: Amity.LiveCollectionCallback<Amity.Invitation>,
|
|
23
|
+
): Amity.Unsubscriber => {
|
|
24
|
+
return getInvitations(
|
|
25
|
+
{
|
|
26
|
+
...params,
|
|
27
|
+
targetId: community.communityId,
|
|
28
|
+
targetType: 'community',
|
|
29
|
+
type: InvitationTypeEnum.CommunityMemberInvite,
|
|
30
|
+
},
|
|
31
|
+
callback,
|
|
32
|
+
);
|
|
33
|
+
},
|
|
34
|
+
getInvitation: async () => {
|
|
35
|
+
const { data } = await getInvitation('community', community.communityId);
|
|
36
|
+
return data;
|
|
37
|
+
},
|
|
38
|
+
join: async () => joinRequest(community.communityId),
|
|
39
|
+
|
|
40
|
+
getJoinRequests: (
|
|
41
|
+
params: Omit<Amity.QueryJoinRequest, 'communityId'>,
|
|
42
|
+
callback: Amity.LiveCollectionCallback<Amity.JoinRequest>,
|
|
43
|
+
): Amity.Unsubscriber => {
|
|
44
|
+
return getJoinRequests(
|
|
45
|
+
{
|
|
46
|
+
...params,
|
|
47
|
+
communityId: community.communityId,
|
|
48
|
+
},
|
|
49
|
+
callback,
|
|
50
|
+
);
|
|
51
|
+
},
|
|
52
|
+
getMyJoinRequest: async () => {
|
|
53
|
+
const { data } = await getMyJoinRequest(community.communityId);
|
|
54
|
+
return data;
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
};
|
|
@@ -11,6 +11,9 @@ import { channelLinkedObject } from './channelLinkedObject';
|
|
|
11
11
|
import { adLinkedObject } from './adLinkedObject';
|
|
12
12
|
import { pinnedPostLinkedObject } from './pinnedPostLinkedObject';
|
|
13
13
|
import { notificationTrayLinkedObject } from './notificationTrayLinkedObject';
|
|
14
|
+
import { communityLinkedObject } from './communityLinkedObject';
|
|
15
|
+
import { invitationLinkedObject } from './invitationLinkedObject';
|
|
16
|
+
import { joinRequestLinkedObject } from './joinRequestLinkedObject';
|
|
14
17
|
|
|
15
18
|
export const LinkedObject = {
|
|
16
19
|
ad: adLinkedObject,
|
|
@@ -26,4 +29,7 @@ export const LinkedObject = {
|
|
|
26
29
|
channel: channelLinkedObject,
|
|
27
30
|
pinnedPost: pinnedPostLinkedObject,
|
|
28
31
|
notificationTray: notificationTrayLinkedObject,
|
|
32
|
+
community: communityLinkedObject,
|
|
33
|
+
invitation: invitationLinkedObject,
|
|
34
|
+
joinRequest: joinRequestLinkedObject,
|
|
29
35
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { pullFromCache } from '~/cache/api';
|
|
2
|
+
import { userLinkedObject } from './userLinkedObject';
|
|
3
|
+
import { acceptInvitation, rejectInvitation } from '~/invitationRepository/internalApi';
|
|
4
|
+
|
|
5
|
+
export const invitationLinkedObject = (invitation: Amity.InternalInvitation): Amity.Invitation => {
|
|
6
|
+
return {
|
|
7
|
+
...invitation,
|
|
8
|
+
get user(): Amity.User | undefined {
|
|
9
|
+
const cacheData = pullFromCache<Amity.User>(['user', 'get', invitation.invitedUserPublicId]);
|
|
10
|
+
if (cacheData?.data) return userLinkedObject(cacheData.data);
|
|
11
|
+
return undefined;
|
|
12
|
+
},
|
|
13
|
+
get createdBy(): Amity.User | undefined {
|
|
14
|
+
const cacheData = pullFromCache<Amity.User>(['user', 'get', invitation.inviterUserPublicId]);
|
|
15
|
+
if (cacheData?.data) return userLinkedObject(cacheData.data);
|
|
16
|
+
return undefined;
|
|
17
|
+
},
|
|
18
|
+
get target(): Amity.InvitationTarget<Amity.InvitationTargetType> | undefined {
|
|
19
|
+
if (invitation.targetType === 'community') {
|
|
20
|
+
const cacheData = pullFromCache<Amity.InternalCommunity>([
|
|
21
|
+
'community',
|
|
22
|
+
'get',
|
|
23
|
+
invitation.targetId,
|
|
24
|
+
]);
|
|
25
|
+
if (cacheData?.data) return cacheData.data;
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
return undefined;
|
|
29
|
+
},
|
|
30
|
+
accept: async () => {
|
|
31
|
+
await acceptInvitation(invitation._id);
|
|
32
|
+
},
|
|
33
|
+
reject: async () => {
|
|
34
|
+
await rejectInvitation(invitation._id);
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { pullFromCache } from '~/cache/api';
|
|
2
|
+
import { userLinkedObject } from './userLinkedObject';
|
|
3
|
+
import { approveJoinRequest } from '~/communityRepository/joinRequest/internalAPI/approveJoinRequest';
|
|
4
|
+
import { cancelJoinRequest } from '~/communityRepository/joinRequest/internalAPI/cancelJoinRequest';
|
|
5
|
+
import { rejectJoinRequest } from '~/communityRepository/joinRequest/internalAPI/rejectJoinRequest';
|
|
6
|
+
|
|
7
|
+
export const joinRequestLinkedObject = (
|
|
8
|
+
joinRequest: Amity.InternalJoinRequest,
|
|
9
|
+
): Amity.JoinRequest => {
|
|
10
|
+
return {
|
|
11
|
+
...joinRequest,
|
|
12
|
+
get user(): Amity.User | undefined {
|
|
13
|
+
const user = pullFromCache<Amity.InternalUser>([
|
|
14
|
+
'user',
|
|
15
|
+
'get',
|
|
16
|
+
joinRequest.requestorPublicId,
|
|
17
|
+
])?.data;
|
|
18
|
+
if (!user) return undefined;
|
|
19
|
+
return userLinkedObject(user);
|
|
20
|
+
},
|
|
21
|
+
cancel: async () => {
|
|
22
|
+
await cancelJoinRequest(joinRequest);
|
|
23
|
+
},
|
|
24
|
+
approve: async () => {
|
|
25
|
+
await approveJoinRequest(joinRequest);
|
|
26
|
+
},
|
|
27
|
+
reject: async () => {
|
|
28
|
+
await rejectJoinRequest(joinRequest);
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
};
|
|
@@ -2,7 +2,12 @@ import { pullFromCache } from '~/cache/api';
|
|
|
2
2
|
import { commentLinkedObject } from '~/utils/linkedObject/commentLinkedObject';
|
|
3
3
|
import AnalyticsEngine from '../../analytic/service/analytic/AnalyticsEngine';
|
|
4
4
|
import { userLinkedObject } from './userLinkedObject';
|
|
5
|
-
import {
|
|
5
|
+
import {
|
|
6
|
+
isAmityClipPost,
|
|
7
|
+
isAmityFilePost,
|
|
8
|
+
isAmityImagePost,
|
|
9
|
+
isAmityVideoPost,
|
|
10
|
+
} from '../postTypePredicate';
|
|
6
11
|
|
|
7
12
|
export const postLinkedObject = (post: Amity.InternalPost): Amity.Post => {
|
|
8
13
|
return {
|
|
@@ -64,5 +69,11 @@ export const postLinkedObject = (post: Amity.InternalPost): Amity.Post => {
|
|
|
64
69
|
? pullFromCache<Amity.File<'file'>>(['file', 'get', post?.data?.fileId])?.data
|
|
65
70
|
: undefined;
|
|
66
71
|
},
|
|
72
|
+
|
|
73
|
+
getClipInfo(): Amity.File<'clip'> | undefined {
|
|
74
|
+
return isAmityClipPost(post)
|
|
75
|
+
? pullFromCache<Amity.File<'clip'>>(['file', 'get', post?.data?.fileId])?.data
|
|
76
|
+
: undefined;
|
|
77
|
+
},
|
|
67
78
|
};
|
|
68
79
|
};
|
|
@@ -25,3 +25,13 @@ export function isAmityVideoPost(post: Amity.InternalPost): post is Amity.Post<'
|
|
|
25
25
|
post.dataType === 'video'
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
|
+
|
|
29
|
+
export function isAmityClipPost(post: Amity.InternalPost): post is Amity.Post<'clip'> {
|
|
30
|
+
return !!(
|
|
31
|
+
post.data &&
|
|
32
|
+
typeof post.data !== 'string' &&
|
|
33
|
+
'fileId' in post.data &&
|
|
34
|
+
'thumbnailFileId' in post.data &&
|
|
35
|
+
post.dataType === 'clip'
|
|
36
|
+
);
|
|
37
|
+
}
|