@amityco/ts-sdk 0.0.1-beta.40 → 0.0.1-beta.42.1
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/README.md +3 -1
- package/dist/@types/core/model.d.ts +3 -1
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/domains/category.d.ts +1 -1
- package/dist/@types/domains/category.d.ts.map +1 -1
- package/dist/@types/domains/comment.d.ts +1 -1
- package/dist/@types/domains/comment.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +1 -1
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/@types/domains/message.d.ts +1 -1
- package/dist/@types/domains/message.d.ts.map +1 -1
- package/dist/@types/domains/post.d.ts +1 -1
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/@types/domains/subChannel.d.ts +1 -1
- package/dist/@types/domains/subChannel.d.ts.map +1 -1
- package/dist/category/api/queryCategories.d.ts.map +1 -1
- package/dist/category/observers/liveCategories.d.ts.map +1 -1
- package/dist/channel/api/addChannelMembers.d.ts.map +1 -1
- package/dist/channel/api/addChannelMembersRole.d.ts.map +1 -1
- package/dist/channel/api/banChannelMembers.d.ts.map +1 -1
- package/dist/channel/api/createChannel.d.ts.map +1 -1
- package/dist/channel/api/getChannel.d.ts.map +1 -1
- package/dist/channel/api/joinChannel.d.ts.map +1 -1
- package/dist/channel/api/leaveChannel.d.ts.map +1 -1
- package/dist/channel/api/queryChannelMembers.d.ts.map +1 -1
- package/dist/channel/api/queryChannels.d.ts.map +1 -1
- package/dist/channel/api/removeChannelMembers.d.ts.map +1 -1
- package/dist/channel/api/removeChannelMembersRole.d.ts +1 -1
- package/dist/channel/api/removeChannelMembersRole.d.ts.map +1 -1
- package/dist/channel/api/startReading.d.ts +3 -3
- package/dist/channel/api/startReading.d.ts.map +1 -1
- package/dist/channel/api/stopReading.d.ts +2 -2
- package/dist/channel/api/stopReading.d.ts.map +1 -1
- package/dist/channel/api/unbanChannelMembers.d.ts.map +1 -1
- package/dist/channel/api/updateChannel.d.ts.map +1 -1
- package/dist/channel/observers/liveChannel.d.ts.map +1 -1
- package/dist/client/api/connectClient.d.ts.map +1 -1
- package/dist/client/api/disconnectClient.d.ts.map +1 -1
- package/dist/client/api/renewal.d.ts.map +1 -1
- package/dist/comment/api/createComment.d.ts.map +1 -1
- package/dist/comment/api/deleteComment.d.ts.map +1 -1
- package/dist/comment/api/getComment.d.ts.map +1 -1
- package/dist/comment/api/getComments.d.ts.map +1 -1
- package/dist/comment/api/queryComments.d.ts.map +1 -1
- package/dist/comment/api/tests/queryComments.test.d.ts +2 -0
- package/dist/comment/api/tests/queryComments.test.d.ts.map +1 -0
- package/dist/comment/api/updateComment.d.ts.map +1 -1
- package/dist/comment/observers/liveComments.d.ts.map +1 -1
- package/dist/community/api/addCommunityMembers.d.ts.map +1 -1
- package/dist/community/api/addCommunityMembersRoles.d.ts.map +1 -1
- package/dist/community/api/createCommunity.d.ts.map +1 -1
- package/dist/community/api/deleteCommunity.d.ts.map +1 -1
- package/dist/community/api/getCommunity.d.ts.map +1 -1
- package/dist/community/api/getRecommendedCommunities.d.ts.map +1 -1
- package/dist/community/api/getTopTrendingCommunities.d.ts.map +1 -1
- package/dist/community/api/joinCommunity.d.ts.map +1 -1
- package/dist/community/api/leaveCommunity.d.ts.map +1 -1
- package/dist/community/api/queryCommunities.d.ts.map +1 -1
- package/dist/community/api/queryCommunityMembers.d.ts.map +1 -1
- package/dist/community/api/removeCommunityMembers.d.ts.map +1 -1
- package/dist/community/api/removeCommunityMembersRoles.d.ts.map +1 -1
- package/dist/community/api/updateCommunity.d.ts.map +1 -1
- package/dist/community/observers/liveCommunities.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/identifyModel.d.ts.map +1 -1
- package/dist/core/model/index.d.ts +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/core/transports/http.d.ts.map +1 -1
- package/dist/feed/api/queryGlobalFeed.d.ts.map +1 -1
- package/dist/file/api/createFile.d.ts.map +1 -1
- package/dist/file/api/createImage.d.ts.map +1 -1
- package/dist/file/api/createVideo.d.ts.map +1 -1
- package/dist/file/api/deleteFile.d.ts.map +1 -1
- package/dist/file/api/getFile.d.ts.map +1 -1
- package/dist/follow/api/acceptFollower.d.ts.map +1 -1
- package/dist/follow/api/declineFollower.d.ts.map +1 -1
- package/dist/follow/api/follow.d.ts.map +1 -1
- package/dist/follow/api/getFollowInfo.d.ts.map +1 -1
- package/dist/follow/api/queryFollowers.d.ts.map +1 -1
- package/dist/follow/api/queryFollowings.d.ts.map +1 -1
- package/dist/follow/api/unfollow.d.ts.map +1 -1
- package/dist/follow/observers/index.d.ts +1 -0
- package/dist/follow/observers/index.d.ts.map +1 -1
- package/dist/follow/observers/liveFollowInfo.d.ts +21 -0
- package/dist/follow/observers/liveFollowInfo.d.ts.map +1 -0
- package/dist/follow/observers/tests/liveFollowInfo.test.d.ts +2 -0
- package/dist/follow/observers/tests/liveFollowInfo.test.d.ts.map +1 -0
- package/dist/index.cjs.js +511 -109
- package/dist/index.esm.js +511 -110
- package/dist/index.umd.js +2 -2
- package/dist/message/api/createMessage.d.ts +2 -1
- package/dist/message/api/createMessage.d.ts.map +1 -1
- package/dist/message/api/deleteMessage.d.ts.map +1 -1
- package/dist/message/api/getMessage.d.ts.map +1 -1
- package/dist/message/api/queryMessages.d.ts.map +1 -1
- package/dist/message/api/updateMessage.d.ts.map +1 -1
- package/dist/message/observers/liveMessages.d.ts.map +1 -1
- package/dist/message/utils/index.d.ts +3 -2
- package/dist/message/utils/index.d.ts.map +1 -1
- package/dist/poll/api/closePoll.d.ts.map +1 -1
- package/dist/poll/api/createPoll.d.ts.map +1 -1
- package/dist/poll/api/deletePoll.d.ts.map +1 -1
- package/dist/poll/api/getPoll.d.ts.map +1 -1
- package/dist/poll/api/votePoll.d.ts.map +1 -1
- package/dist/post/api/approvePost.d.ts.map +1 -1
- package/dist/post/api/createPost.d.ts.map +1 -1
- package/dist/post/api/declinePost.d.ts.map +1 -1
- package/dist/post/api/deletePost.d.ts.map +1 -1
- package/dist/post/api/getPost.d.ts.map +1 -1
- package/dist/post/api/getPosts.d.ts.map +1 -1
- package/dist/post/api/queryPosts.d.ts.map +1 -1
- package/dist/post/api/updatePost.d.ts.map +1 -1
- package/dist/post/observers/livePosts.d.ts.map +1 -1
- package/dist/reaction/api/addReaction.d.ts.map +1 -1
- package/dist/reaction/api/queryReactions.d.ts.map +1 -1
- package/dist/reaction/api/removeReaction.d.ts.map +1 -1
- package/dist/report/api/createReport.d.ts.map +1 -1
- package/dist/report/api/deleteReport.d.ts.map +1 -1
- package/dist/report/api/isReportedByMe.d.ts.map +1 -1
- package/dist/stream/api/createStream.d.ts.map +1 -1
- package/dist/stream/api/deleteStream.d.ts.map +1 -1
- package/dist/stream/api/getStream.d.ts.map +1 -1
- package/dist/stream/api/queryStreams.d.ts.map +1 -1
- package/dist/stream/api/updateStream.d.ts.map +1 -1
- package/dist/subChannel/api/createSubChannel.d.ts.map +1 -1
- package/dist/subChannel/api/deleteSubChannel.d.ts.map +1 -1
- package/dist/subChannel/api/getSubChannel.d.ts.map +1 -1
- package/dist/subChannel/api/querySubChannels.d.ts.map +1 -1
- package/dist/subChannel/api/updateSubChannel.d.ts.map +1 -1
- package/dist/user/api/getUser.d.ts.map +1 -1
- package/dist/user/api/getUsers.d.ts.map +1 -1
- package/dist/user/api/queryUsers.d.ts.map +1 -1
- package/dist/user/api/updateUser.d.ts.map +1 -1
- package/dist/utils/liveObject.d.ts +1 -1
- package/dist/utils/liveObject.d.ts.map +1 -1
- package/dist/utils/tests/dummy/comment.d.ts +77 -0
- package/dist/utils/tests/dummy/comment.d.ts.map +1 -0
- package/dist/utils/tests/dummy/community.d.ts +1 -1
- package/dist/utils/tests/dummy/index.d.ts +1 -0
- package/dist/utils/tests/dummy/index.d.ts.map +1 -1
- package/dist/utils/tests/dummy/post.d.ts +0 -12
- package/dist/utils/tests/dummy/post.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/model.ts +3 -1
- package/src/@types/domains/category.ts +1 -1
- package/src/@types/domains/comment.ts +1 -1
- package/src/@types/domains/community.ts +1 -1
- package/src/@types/domains/message.ts +1 -1
- package/src/@types/domains/post.ts +1 -1
- package/src/@types/domains/subChannel.ts +1 -1
- package/src/category/api/queryCategories.ts +5 -1
- package/src/category/observers/liveCategories.ts +3 -1
- package/src/category/observers/tests/liveCategories.test.ts +1 -3
- package/src/channel/api/addChannelMembers.ts +4 -0
- package/src/channel/api/addChannelMembersRole.ts +4 -0
- package/src/channel/api/banChannelMembers.ts +4 -0
- package/src/channel/api/createChannel.ts +4 -0
- package/src/channel/api/getChannel.ts +4 -0
- package/src/channel/api/joinChannel.ts +4 -0
- package/src/channel/api/leaveChannel.ts +4 -0
- package/src/channel/api/queryChannelMembers.ts +4 -0
- package/src/channel/api/queryChannels.ts +4 -0
- package/src/channel/api/removeChannelMembers.ts +4 -0
- package/src/channel/api/removeChannelMembersRole.ts +5 -1
- package/src/channel/api/startReading.ts +7 -3
- package/src/channel/api/stopReading.ts +6 -2
- package/src/channel/api/unbanChannelMembers.ts +4 -0
- package/src/channel/api/updateChannel.ts +4 -0
- package/src/channel/observers/liveChannel.ts +16 -1
- package/src/client/api/connectClient.ts +4 -0
- package/src/client/api/disconnectClient.ts +4 -0
- package/src/client/api/getToken.ts +1 -1
- package/src/client/api/renewal.ts +4 -0
- package/src/client/api/tests/getToken.test.ts +2 -2
- package/src/comment/api/createComment.ts +4 -0
- package/src/comment/api/deleteComment.ts +4 -0
- package/src/comment/api/getComment.ts +4 -0
- package/src/comment/api/getComments.ts +4 -0
- package/src/comment/api/queryComments.ts +6 -1
- package/src/comment/api/tests/createComment.test.ts +17 -112
- package/src/comment/api/tests/queryComments.test.ts +147 -0
- package/src/comment/api/tests/updateComment.test.ts +14 -85
- package/src/comment/api/updateComment.ts +4 -0
- package/src/comment/observers/liveComments.ts +3 -1
- package/src/community/api/addCommunityMembers.ts +4 -0
- package/src/community/api/addCommunityMembersRoles.ts +4 -0
- package/src/community/api/createCommunity.ts +4 -0
- package/src/community/api/deleteCommunity.ts +4 -0
- package/src/community/api/getCommunity.ts +4 -0
- package/src/community/api/getRecommendedCommunities.ts +4 -0
- package/src/community/api/getTopTrendingCommunities.ts +4 -0
- package/src/community/api/joinCommunity.ts +4 -0
- package/src/community/api/leaveCommunity.ts +4 -0
- package/src/community/api/queryCommunities.ts +6 -1
- package/src/community/api/queryCommunityMembers.ts +4 -0
- package/src/community/api/removeCommunityMembers.ts +4 -0
- package/src/community/api/removeCommunityMembersRoles.ts +4 -0
- package/src/community/api/test/queryCommunity.test.ts +30 -0
- package/src/community/api/updateCommunity.ts +4 -0
- package/src/community/observers/liveCommunities.ts +4 -1
- package/src/community/observers/tests/liveCommunities.test.ts +2 -2
- package/src/core/model/idResolvers.ts +1 -0
- package/src/core/model/identifyModel.ts +2 -1
- package/src/core/model/index.ts +11 -2
- package/src/core/transports/http.ts +5 -0
- package/src/core/transports/test/http.test.ts +12 -0
- package/src/feed/api/queryGlobalFeed.ts +4 -0
- package/src/file/api/createFile.ts +4 -0
- package/src/file/api/createImage.ts +4 -0
- package/src/file/api/createVideo.ts +4 -0
- package/src/file/api/deleteFile.ts +4 -0
- package/src/file/api/getFile.ts +4 -0
- package/src/follow/api/acceptFollower.ts +4 -0
- package/src/follow/api/declineFollower.ts +4 -0
- package/src/follow/api/follow.ts +4 -0
- package/src/follow/api/getFollowInfo.ts +8 -8
- package/src/follow/api/queryFollowers.ts +4 -0
- package/src/follow/api/queryFollowings.ts +4 -0
- package/src/follow/api/unfollow.ts +4 -0
- package/src/follow/observers/index.ts +1 -0
- package/src/follow/observers/liveFollowInfo.ts +29 -0
- package/src/follow/observers/tests/liveFollowInfo.test.ts +198 -0
- package/src/message/api/createMessage.ts +24 -7
- package/src/message/api/deleteMessage.ts +4 -0
- package/src/message/api/getMessage.ts +4 -0
- package/src/message/api/queryMessages.ts +4 -0
- package/src/message/api/tests/createMessage.test.ts +42 -2
- package/src/message/api/tests/queryMessages.test.ts +30 -0
- package/src/message/api/updateMessage.ts +4 -0
- package/src/message/observers/liveMessages.ts +14 -15
- package/src/message/tests/observers/liveMessages.test.ts +2 -2
- package/src/message/utils/index.ts +10 -1
- package/src/poll/api/closePoll.ts +4 -0
- package/src/poll/api/createPoll.ts +4 -0
- package/src/poll/api/deletePoll.ts +4 -0
- package/src/poll/api/getPoll.ts +4 -0
- package/src/poll/api/votePoll.ts +4 -0
- package/src/post/api/approvePost.ts +4 -0
- package/src/post/api/createPost.ts +4 -0
- package/src/post/api/declinePost.ts +4 -0
- package/src/post/api/deletePost.ts +4 -0
- package/src/post/api/getPost.ts +4 -0
- package/src/post/api/getPosts.ts +3 -0
- package/src/post/api/queryPosts.ts +6 -1
- package/src/post/api/tests/queryPosts.test.ts +30 -0
- package/src/post/api/updatePost.ts +4 -0
- package/src/post/observers/livePosts.ts +4 -2
- package/src/post/observers/tests/livePosts.test.ts +4 -5
- package/src/reaction/api/addReaction.ts +4 -0
- package/src/reaction/api/queryReactions.ts +4 -0
- package/src/reaction/api/removeReaction.ts +4 -0
- package/src/reaction/api/tests/addReaction.test.ts +13 -0
- package/src/reaction/api/tests/removeReaction.test.ts +13 -0
- package/src/report/api/createReport.ts +4 -0
- package/src/report/api/deleteReport.ts +4 -0
- package/src/report/api/isReportedByMe.ts +4 -0
- package/src/stream/api/createStream.ts +4 -0
- package/src/stream/api/deleteStream.ts +3 -0
- package/src/stream/api/getStream.ts +4 -0
- package/src/stream/api/queryStreams.ts +4 -0
- package/src/stream/api/updateStream.ts +3 -0
- package/src/subChannel/api/createSubChannel.ts +4 -0
- package/src/subChannel/api/deleteSubChannel.ts +4 -0
- package/src/subChannel/api/getSubChannel.ts +4 -0
- package/src/subChannel/api/querySubChannels.ts +6 -1
- package/src/subChannel/api/updateSubChannel.ts +4 -0
- package/src/subChannel/observers/liveSubChannels.ts +2 -2
- package/src/subChannel/observers/tests/liveSubChannels.test.ts +5 -2
- package/src/user/api/getUser.ts +4 -0
- package/src/user/api/getUsers.ts +3 -0
- package/src/user/api/queryUsers.ts +4 -0
- package/src/user/api/updateUser.ts +4 -0
- package/src/utils/liveObject.ts +1 -4
- package/src/utils/tests/dummy/comment.ts +268 -0
- package/src/utils/tests/dummy/index.ts +1 -0
- package/src/utils/tests/dummy/post.ts +0 -114
- package/dist/post/tests/api/getPost.test.d.ts +0 -2
- package/dist/post/tests/api/getPost.test.d.ts.map +0 -1
- package/dist/post/tests/api/queryPosts.test.d.ts +0 -2
- package/dist/post/tests/api/queryPosts.test.d.ts.map +0 -1
- package/src/post/tests/api/getPost.test.ts +0 -98
- package/src/post/tests/api/queryPosts.test.ts +0 -123
package/dist/index.cjs.js
CHANGED
|
@@ -95,8 +95,8 @@ const PostContentType = Object.freeze({
|
|
|
95
95
|
|
|
96
96
|
function getVersion() {
|
|
97
97
|
try {
|
|
98
|
-
// the string ''v0.0.1-beta.
|
|
99
|
-
return 'v0.0.1-beta.
|
|
98
|
+
// the string ''v0.0.1-beta.42.1-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
99
|
+
return 'v0.0.1-beta.42.1-cjs';
|
|
100
100
|
}
|
|
101
101
|
catch (error) {
|
|
102
102
|
return '__dev__';
|
|
@@ -512,6 +512,7 @@ const idResolvers = {
|
|
|
512
512
|
reaction: ({ reactionId }) => reactionId,
|
|
513
513
|
stream: ({ streamId }) => streamId,
|
|
514
514
|
follow: ({ from, to }) => `${from}#${to}`,
|
|
515
|
+
followInfo: ({ userId }) => userId,
|
|
515
516
|
followCount: ({ userId }) => userId,
|
|
516
517
|
feed: ({ targetId, feedId }) => `${targetId}#${feedId}`,
|
|
517
518
|
};
|
|
@@ -550,8 +551,9 @@ const CRITERIAS = {
|
|
|
550
551
|
reaction: ['reactionId'],
|
|
551
552
|
stream: ['streamId'],
|
|
552
553
|
follow: ['from', 'to'],
|
|
553
|
-
followCount: ['userId', 'followerCount'],
|
|
554
554
|
feed: ['feedId', 'feedType'],
|
|
555
|
+
followInfo: ['userId', 'status'],
|
|
556
|
+
followCount: ['userId', 'followerCount'],
|
|
555
557
|
};
|
|
556
558
|
/** @hidden */
|
|
557
559
|
const hasKeys = (object, needles) => {
|
|
@@ -616,7 +618,15 @@ const PAYLOAD2MODEL = {
|
|
|
616
618
|
};
|
|
617
619
|
/** hidden */
|
|
618
620
|
const hasUpdates = (prevData, nextData) => {
|
|
619
|
-
|
|
621
|
+
if ('updatedAt' in prevData && 'updatedAt' in nextData) {
|
|
622
|
+
return new Date(prevData.updatedAt) < new Date(nextData.updatedAt);
|
|
623
|
+
}
|
|
624
|
+
/*
|
|
625
|
+
* hasUpdates is used to identify the latest object among many. If the object
|
|
626
|
+
* does not extend ${Amity.UpdatedAt}, then there is no way to differentiate.
|
|
627
|
+
* So it is considered by default that the object hasUpdates
|
|
628
|
+
*/
|
|
629
|
+
return true;
|
|
620
630
|
};
|
|
621
631
|
/** hidden */
|
|
622
632
|
function getFutureDate(date = new Date().toISOString()) {
|
|
@@ -1473,6 +1483,10 @@ const createHttpTransport = (endpoint) => {
|
|
|
1473
1483
|
});
|
|
1474
1484
|
instance.interceptors.request.use(config => {
|
|
1475
1485
|
var _a;
|
|
1486
|
+
// do not check expiration for token creation url
|
|
1487
|
+
if (config.url === '/api/v4/sessions') {
|
|
1488
|
+
return config;
|
|
1489
|
+
}
|
|
1476
1490
|
// check global.ts for the extension of AxiosRequestConfig
|
|
1477
1491
|
const tokenExpiry = (_a = config.metadata) === null || _a === void 0 ? void 0 : _a.tokenExpiry;
|
|
1478
1492
|
if (tokenExpiry) {
|
|
@@ -20478,7 +20492,7 @@ const getToken = async (params) => {
|
|
|
20478
20492
|
const client = getActiveClient();
|
|
20479
20493
|
client.log('client/api/getToken', params);
|
|
20480
20494
|
const deviceInfo = getDeviceInfo();
|
|
20481
|
-
const { data } = await client.http.post('/api/
|
|
20495
|
+
const { data } = await client.http.post('/api/v4/sessions', Object.assign(Object.assign({}, params), { deviceInfo }), {
|
|
20482
20496
|
// @ts-ignore
|
|
20483
20497
|
headers: { 'X-API-Key': client.apiKey },
|
|
20484
20498
|
});
|
|
@@ -20514,6 +20528,9 @@ const setClientToken = async (params) => {
|
|
|
20514
20528
|
return { accessToken, users, refreshToken };
|
|
20515
20529
|
};
|
|
20516
20530
|
|
|
20531
|
+
/* begin_public_function
|
|
20532
|
+
id: client.logout
|
|
20533
|
+
*/
|
|
20517
20534
|
/**
|
|
20518
20535
|
* ```js
|
|
20519
20536
|
* import { disconnectClient } from '@amityco/ts-sdk'
|
|
@@ -20562,7 +20579,8 @@ const disconnectClient = async () => {
|
|
|
20562
20579
|
client.cache = { data: {} };
|
|
20563
20580
|
}
|
|
20564
20581
|
return !client.ws.connected;
|
|
20565
|
-
};
|
|
20582
|
+
};
|
|
20583
|
+
/* end_public_function */
|
|
20566
20584
|
|
|
20567
20585
|
/**
|
|
20568
20586
|
* Ingest a payload (v3) into the cache
|
|
@@ -20766,6 +20784,9 @@ const onTokenTerminated = (callback) => {
|
|
|
20766
20784
|
* to be cleared
|
|
20767
20785
|
*/
|
|
20768
20786
|
const subscriptions = [];
|
|
20787
|
+
/* begin_public_function
|
|
20788
|
+
id: client.login
|
|
20789
|
+
*/
|
|
20769
20790
|
/**
|
|
20770
20791
|
* ```js
|
|
20771
20792
|
* import { connectClient } from '@amityco/ts-sdk/client/api'
|
|
@@ -20860,8 +20881,12 @@ const connectClient = async (params, sessionHandler, config) => {
|
|
|
20860
20881
|
subscriptions.forEach(fn => fn());
|
|
20861
20882
|
}));
|
|
20862
20883
|
return client.ws.connected;
|
|
20863
|
-
};
|
|
20884
|
+
};
|
|
20885
|
+
/* end_public_function */
|
|
20864
20886
|
|
|
20887
|
+
/* begin_public_function
|
|
20888
|
+
id: client.renew_access_token
|
|
20889
|
+
*/
|
|
20865
20890
|
/*
|
|
20866
20891
|
* Renewal defintion accepted by SessionHandler interface
|
|
20867
20892
|
*
|
|
@@ -20920,7 +20945,8 @@ const renewal = () => {
|
|
|
20920
20945
|
}, ACCESS_TOKEN_WATCHER_INTERVAL);
|
|
20921
20946
|
},
|
|
20922
20947
|
};
|
|
20923
|
-
};
|
|
20948
|
+
};
|
|
20949
|
+
/* end_public_function */
|
|
20924
20950
|
|
|
20925
20951
|
const ABOUT_TO_EXPIRE_THRESHOLD = 80 / 100;
|
|
20926
20952
|
const COMPENSATED_DELAY = 5 * MINUTE;
|
|
@@ -21115,6 +21141,9 @@ const pushToTombstone = (model, modelId) => {
|
|
|
21115
21141
|
pushToCache(cacheKey, data);
|
|
21116
21142
|
};
|
|
21117
21143
|
|
|
21144
|
+
/* begin_public_function
|
|
21145
|
+
id: user.get
|
|
21146
|
+
*/
|
|
21118
21147
|
/**
|
|
21119
21148
|
* ```js
|
|
21120
21149
|
* import { getUser } from '@amityco/ts-sdk'
|
|
@@ -21157,6 +21186,7 @@ const getUser = async (userId, isLive = false) => {
|
|
|
21157
21186
|
cachedAt,
|
|
21158
21187
|
};
|
|
21159
21188
|
};
|
|
21189
|
+
/* end_public_function */
|
|
21160
21190
|
/**
|
|
21161
21191
|
* ```js
|
|
21162
21192
|
* import { getUser } from '@amityco/ts-sdk'
|
|
@@ -21176,6 +21206,9 @@ getUser.locally = (userId) => {
|
|
|
21176
21206
|
return client.cache && pullFromCache(['user', 'get', userId]);
|
|
21177
21207
|
};
|
|
21178
21208
|
|
|
21209
|
+
/* begin_public_function
|
|
21210
|
+
id: user.get_by_ids
|
|
21211
|
+
*/
|
|
21179
21212
|
/**
|
|
21180
21213
|
* ```js
|
|
21181
21214
|
* import { getUsers } from '@amityco/ts-sdk'
|
|
@@ -21266,6 +21299,9 @@ function __rest(s, e) {
|
|
|
21266
21299
|
return t;
|
|
21267
21300
|
}
|
|
21268
21301
|
|
|
21302
|
+
/* begin_public_function
|
|
21303
|
+
id: user.query, user.search
|
|
21304
|
+
*/
|
|
21269
21305
|
/**
|
|
21270
21306
|
* ```js
|
|
21271
21307
|
* import { queryUsers } from '@amityco/ts-sdk'
|
|
@@ -21309,6 +21345,7 @@ const queryUsers = async (query = {}) => {
|
|
|
21309
21345
|
const nextPage = toPage(paging.next);
|
|
21310
21346
|
return { data: users, cachedAt, prevPage, nextPage };
|
|
21311
21347
|
};
|
|
21348
|
+
/* end_public_function */
|
|
21312
21349
|
/**
|
|
21313
21350
|
* ```js
|
|
21314
21351
|
* import { queryUsers } from '@amityco/ts-sdk'
|
|
@@ -21344,6 +21381,9 @@ queryUsers.locally = (query = {}) => {
|
|
|
21344
21381
|
: undefined;
|
|
21345
21382
|
};
|
|
21346
21383
|
|
|
21384
|
+
/* begin_public_function
|
|
21385
|
+
id: client.update_user
|
|
21386
|
+
*/
|
|
21347
21387
|
/**
|
|
21348
21388
|
* ```js
|
|
21349
21389
|
* import { updateUser } from '@amityco/ts-sdk'
|
|
@@ -21378,7 +21418,8 @@ const updateUser = async (userId, patch) => {
|
|
|
21378
21418
|
data: users.find(user => user.userId === userId),
|
|
21379
21419
|
cachedAt,
|
|
21380
21420
|
};
|
|
21381
|
-
};
|
|
21421
|
+
};
|
|
21422
|
+
/* end_public_function */
|
|
21382
21423
|
|
|
21383
21424
|
/**
|
|
21384
21425
|
* ```js
|
|
@@ -21683,6 +21724,9 @@ const observeUser = (userId, callback) => {
|
|
|
21683
21724
|
};
|
|
21684
21725
|
};
|
|
21685
21726
|
|
|
21727
|
+
/* begin_public_function
|
|
21728
|
+
id: file.get
|
|
21729
|
+
*/
|
|
21686
21730
|
/**
|
|
21687
21731
|
* ```js
|
|
21688
21732
|
* import { getFile } from '@amityco/ts-sdk'
|
|
@@ -21711,6 +21755,7 @@ const getFile = async (fileId) => {
|
|
|
21711
21755
|
cachedAt,
|
|
21712
21756
|
};
|
|
21713
21757
|
};
|
|
21758
|
+
/* end_public_function */
|
|
21714
21759
|
/**
|
|
21715
21760
|
* ```js
|
|
21716
21761
|
* import { getFile } from '@amityco/ts-sdk'
|
|
@@ -21738,6 +21783,9 @@ getFile.locally = (fileId) => {
|
|
|
21738
21783
|
};
|
|
21739
21784
|
};
|
|
21740
21785
|
|
|
21786
|
+
/* begin_public_function
|
|
21787
|
+
id: file.upload.file
|
|
21788
|
+
*/
|
|
21741
21789
|
/**
|
|
21742
21790
|
* ```js
|
|
21743
21791
|
* import { createFile } from '@amityco/ts-sdk'
|
|
@@ -21777,8 +21825,12 @@ const createFile = async (formData, onProgress) => {
|
|
|
21777
21825
|
cachedAt,
|
|
21778
21826
|
};
|
|
21779
21827
|
};
|
|
21828
|
+
/* end_public_function */
|
|
21780
21829
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
21781
21830
|
|
|
21831
|
+
/* begin_public_function
|
|
21832
|
+
id: file.delete
|
|
21833
|
+
*/
|
|
21782
21834
|
/**
|
|
21783
21835
|
* ```js
|
|
21784
21836
|
* import { deleteFile } from '@amityco/ts-sdk'
|
|
@@ -21800,7 +21852,8 @@ const deleteFile = async (fileId) => {
|
|
|
21800
21852
|
await client.http.delete(`/api/v3/files/${fileId}`);
|
|
21801
21853
|
dropFromCache(['file', 'get', fileId], true);
|
|
21802
21854
|
return { success: true };
|
|
21803
|
-
};
|
|
21855
|
+
};
|
|
21856
|
+
/* end_public_function */
|
|
21804
21857
|
|
|
21805
21858
|
/**
|
|
21806
21859
|
* Allow to query a file url with a selected size
|
|
@@ -21813,6 +21866,9 @@ const fileUrlWithSize = (fileUrl, size) => {
|
|
|
21813
21866
|
return `${fileUrl}?size=${size}`;
|
|
21814
21867
|
};
|
|
21815
21868
|
|
|
21869
|
+
/* begin_public_function
|
|
21870
|
+
id: file.upload.video
|
|
21871
|
+
*/
|
|
21816
21872
|
/**
|
|
21817
21873
|
* ```js
|
|
21818
21874
|
* import { createVideo } from '@amityco/ts-sdk'
|
|
@@ -21856,8 +21912,12 @@ const createVideo = async (formData, feedType, onProgress) => {
|
|
|
21856
21912
|
cachedAt,
|
|
21857
21913
|
};
|
|
21858
21914
|
};
|
|
21915
|
+
/* end_public_function */
|
|
21859
21916
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
21860
21917
|
|
|
21918
|
+
/* begin_public_function
|
|
21919
|
+
id: file.upload.image
|
|
21920
|
+
*/
|
|
21861
21921
|
/**
|
|
21862
21922
|
* ```js
|
|
21863
21923
|
* import { createImage } from '@amityco/ts-sdk'
|
|
@@ -21897,6 +21957,7 @@ const createImage = async (formData, onProgress) => {
|
|
|
21897
21957
|
cachedAt,
|
|
21898
21958
|
};
|
|
21899
21959
|
};
|
|
21960
|
+
/* end_public_function */
|
|
21900
21961
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
21901
21962
|
|
|
21902
21963
|
/**
|
|
@@ -22140,8 +22201,8 @@ function convertParams(_a) {
|
|
|
22140
22201
|
return Object.assign({ messageFeedId: subChannelId, mentionedUsers: mentionees }, rest);
|
|
22141
22202
|
}
|
|
22142
22203
|
function convertQueryParams$1(_a) {
|
|
22143
|
-
var { page, sortBy, subChannelId, tags } = _a, rest = __rest(_a, ["page", "sortBy", "subChannelId", "tags"]);
|
|
22144
|
-
const out = Object.assign(Object.assign({}, rest), { messageFeedId: subChannelId, options: { token: toToken(page || { limit: 10 }, 'afterbeforeraw') } });
|
|
22204
|
+
var { page, sortBy, subChannelId, tags, includeDeleted } = _a, rest = __rest(_a, ["page", "sortBy", "subChannelId", "tags", "includeDeleted"]);
|
|
22205
|
+
const out = Object.assign(Object.assign({}, rest), { messageFeedId: subChannelId, isDeleted: includeDeleted === false ? false : undefined, options: { token: toToken(page || { limit: 10 }, 'afterbeforeraw') } });
|
|
22145
22206
|
if (sortBy !== undefined) {
|
|
22146
22207
|
out.options.sortBy = sortBy;
|
|
22147
22208
|
}
|
|
@@ -22151,6 +22212,9 @@ function convertQueryParams$1(_a) {
|
|
|
22151
22212
|
return out;
|
|
22152
22213
|
}
|
|
22153
22214
|
|
|
22215
|
+
/* begin_public_function
|
|
22216
|
+
id: message.get
|
|
22217
|
+
*/
|
|
22154
22218
|
/**
|
|
22155
22219
|
* ```js
|
|
22156
22220
|
* import { getMessage } from '@amityco/ts-sdk'
|
|
@@ -22196,6 +22260,7 @@ const getMessage = async (messageId, isLive = false) => {
|
|
|
22196
22260
|
cachedAt,
|
|
22197
22261
|
};
|
|
22198
22262
|
};
|
|
22263
|
+
/* end_public_function */
|
|
22199
22264
|
/**
|
|
22200
22265
|
* ```js
|
|
22201
22266
|
* import { getMessage } from '@amityco/ts-sdk'
|
|
@@ -22287,6 +22352,9 @@ getMessages.locally = (messageIds) => {
|
|
|
22287
22352
|
};
|
|
22288
22353
|
};
|
|
22289
22354
|
|
|
22355
|
+
/* begin_public_function
|
|
22356
|
+
id: message.query
|
|
22357
|
+
*/
|
|
22290
22358
|
/**
|
|
22291
22359
|
* ```js
|
|
22292
22360
|
* import { queryMessages } from '@amityco/ts-sdk'
|
|
@@ -22327,6 +22395,7 @@ const queryMessages = async (query) => {
|
|
|
22327
22395
|
const prevPage = toPageRaw(paging.previous);
|
|
22328
22396
|
return { data: messages, cachedAt, prevPage, nextPage };
|
|
22329
22397
|
};
|
|
22398
|
+
/* end_public_function */
|
|
22330
22399
|
/**
|
|
22331
22400
|
* ```js
|
|
22332
22401
|
* import { queryMessages } from '@amityco/ts-sdk'
|
|
@@ -22364,8 +22433,12 @@ queryMessages.locally = (query) => {
|
|
|
22364
22433
|
|
|
22365
22434
|
const uuid = () => nativeIdGenerator__default["default"].v4().toString();
|
|
22366
22435
|
|
|
22436
|
+
const getLocalId = () => `LOCAL_${uuid()}`;
|
|
22367
22437
|
// FIXME: temp solution
|
|
22368
22438
|
let uniqueId;
|
|
22439
|
+
/* begin_public_function
|
|
22440
|
+
id: message.create.text_message, message.create.image_message, message.create.file_message, message.create.video_message, message.create.audio_message, message.create.custom_message
|
|
22441
|
+
*/
|
|
22369
22442
|
/**
|
|
22370
22443
|
* ```js
|
|
22371
22444
|
* import { createMessage, createQuery, runQuery } from '@amityco/ts-sdk'
|
|
@@ -22391,7 +22464,7 @@ let uniqueId;
|
|
|
22391
22464
|
const createMessage = async (bundle) => {
|
|
22392
22465
|
const client = getActiveClient();
|
|
22393
22466
|
client.log('message/createMessage', bundle);
|
|
22394
|
-
const referenceId = uniqueId;
|
|
22467
|
+
const referenceId = bundle.referenceId || uniqueId || getLocalId();
|
|
22395
22468
|
uniqueId = undefined;
|
|
22396
22469
|
const { data: payload } = await client.http.post('/api/v5/messages', Object.assign(Object.assign({}, convertParams(bundle)), { referenceId }));
|
|
22397
22470
|
const data = prepareMessagePayload(payload);
|
|
@@ -22424,8 +22497,9 @@ const createMessage = async (bundle) => {
|
|
|
22424
22497
|
*
|
|
22425
22498
|
* @category Message API
|
|
22426
22499
|
*/
|
|
22427
|
-
createMessage.optimistically = (
|
|
22428
|
-
var
|
|
22500
|
+
createMessage.optimistically = (_a) => {
|
|
22501
|
+
var _b, _c;
|
|
22502
|
+
var { referenceId } = _a, bundle = __rest(_a, ["referenceId"]);
|
|
22429
22503
|
const client = getActiveClient();
|
|
22430
22504
|
if (!client.cache)
|
|
22431
22505
|
return;
|
|
@@ -22436,9 +22510,8 @@ createMessage.optimistically = (bundle) => {
|
|
|
22436
22510
|
* Updated to handle client requirement to add messageId while uploading
|
|
22437
22511
|
* message with image. Temporary!
|
|
22438
22512
|
*/
|
|
22439
|
-
|
|
22440
|
-
|
|
22441
|
-
const bundleWithMessageId = Object.assign({ messageId: localId, uniqueId: localId }, bundle);
|
|
22513
|
+
uniqueId = referenceId || getLocalId();
|
|
22514
|
+
const bundleWithMessageId = Object.assign({ messageId: uniqueId, uniqueId }, bundle);
|
|
22442
22515
|
client.log('message/createMessage.optimistically', bundleWithMessageId);
|
|
22443
22516
|
const subChannel = pullFromCache(['subChannel', 'get', bundle.subChannelId]);
|
|
22444
22517
|
if (subChannel) {
|
|
@@ -22446,13 +22519,13 @@ createMessage.optimistically = (bundle) => {
|
|
|
22446
22519
|
if (subChannel.data.channelId === subChannel.data.subChannelId) {
|
|
22447
22520
|
const channel = pullFromCache(['channel', 'get', subChannel.data.channelId]);
|
|
22448
22521
|
if (channel === null || channel === void 0 ? void 0 : channel.data) {
|
|
22449
|
-
upsertInCache(['channel', 'get', subChannel.data.channelId], Object.assign(Object.assign({}, channel.data), { messageCount: ((
|
|
22522
|
+
upsertInCache(['channel', 'get', subChannel.data.channelId], Object.assign(Object.assign({}, channel.data), { messageCount: ((_b = channel.data.messageCount) !== null && _b !== void 0 ? _b : 0) + 1 }));
|
|
22450
22523
|
}
|
|
22451
22524
|
}
|
|
22452
22525
|
}
|
|
22453
22526
|
// as reused to update created and updated time, which should be the same
|
|
22454
22527
|
const createdTime = new Date().toISOString();
|
|
22455
|
-
const message = Object.assign({ creatorId: client.userId, channelSegment: ((
|
|
22528
|
+
const message = Object.assign({ creatorId: client.userId, channelSegment: ((_c = subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.messageCount) !== null && _c !== void 0 ? _c : 0) + 1, childrenNumber: 0, createdAt: createdTime, updatedAt: createdTime }, bundleWithMessageId);
|
|
22456
22529
|
const cachedAt = UNSYNCED_OBJECT_CACHED_AT_VALUE;
|
|
22457
22530
|
pushToCache(['message', 'get', message.messageId], message, { cachedAt });
|
|
22458
22531
|
fireEvent('local.message.created', { messages: [message] });
|
|
@@ -22460,8 +22533,12 @@ createMessage.optimistically = (bundle) => {
|
|
|
22460
22533
|
cachedAt,
|
|
22461
22534
|
data: message,
|
|
22462
22535
|
};
|
|
22463
|
-
};
|
|
22536
|
+
};
|
|
22537
|
+
/* end_public_function */
|
|
22464
22538
|
|
|
22539
|
+
/* begin_public_function
|
|
22540
|
+
id: message.edit
|
|
22541
|
+
*/
|
|
22465
22542
|
/**
|
|
22466
22543
|
* ```js
|
|
22467
22544
|
* import { updateMessage } from '@amityco/ts-sdk'
|
|
@@ -22527,8 +22604,12 @@ updateMessage.optimistically = (messageId, patch) => {
|
|
|
22527
22604
|
data: updated,
|
|
22528
22605
|
cachedAt,
|
|
22529
22606
|
};
|
|
22530
|
-
};
|
|
22607
|
+
};
|
|
22608
|
+
/* end_public_function */
|
|
22531
22609
|
|
|
22610
|
+
/* begin_public_function
|
|
22611
|
+
id: message.soft_delete
|
|
22612
|
+
*/
|
|
22532
22613
|
/**
|
|
22533
22614
|
* ```js
|
|
22534
22615
|
* import { deleteMessage } from '@amityco/ts-sdk'
|
|
@@ -22579,7 +22660,8 @@ deleteMessage.optimistically = (messageId) => {
|
|
|
22579
22660
|
data: deleted,
|
|
22580
22661
|
cachedAt,
|
|
22581
22662
|
};
|
|
22582
|
-
};
|
|
22663
|
+
};
|
|
22664
|
+
/* end_public_function */
|
|
22583
22665
|
|
|
22584
22666
|
/**
|
|
22585
22667
|
* Attach user object to membership model
|
|
@@ -22641,6 +22723,9 @@ const prepareMembershipPayload = (payload, memberProp, userIdProp = 'userId', us
|
|
|
22641
22723
|
return Object.assign(Object.assign({}, rest), { [memberProp]: members });
|
|
22642
22724
|
};
|
|
22643
22725
|
|
|
22726
|
+
/* begin_public_function
|
|
22727
|
+
id: post.query, feed.query.community_feed, feed.query.user_feed
|
|
22728
|
+
*/
|
|
22644
22729
|
/**
|
|
22645
22730
|
* ```js
|
|
22646
22731
|
* import { queryPosts } from '@amityco/ts-sdk'
|
|
@@ -22658,13 +22743,13 @@ const prepareMembershipPayload = (payload, memberProp, userIdProp = 'userId', us
|
|
|
22658
22743
|
const queryPosts = async (query) => {
|
|
22659
22744
|
const client = getActiveClient();
|
|
22660
22745
|
client.log('post/queryPosts', query);
|
|
22661
|
-
const { page = { limit: 10 } } = query, params = __rest(query, ["page"]);
|
|
22746
|
+
const { page = { limit: 10 }, includeDeleted } = query, params = __rest(query, ["page", "includeDeleted"]);
|
|
22662
22747
|
const { dataTypes, matchingOnlyParentPost } = params;
|
|
22663
22748
|
// API-FIX: parameters should be querystring. (1)
|
|
22664
22749
|
// API-FIX: backend should answer Amity.Response (2)
|
|
22665
22750
|
// const { data } = await client.http.get<Amity.Response<Amity.PagedResponse<Amity.PostPayload>>>(
|
|
22666
22751
|
const { data } = await client.http.get(`/api/v4/posts`, {
|
|
22667
|
-
params: Object.assign(Object.assign({}, params), {
|
|
22752
|
+
params: Object.assign(Object.assign({}, params), { isDeleted: includeDeleted === false ? false : undefined,
|
|
22668
22753
|
/*
|
|
22669
22754
|
* when creating post like image, file, video BE will create 2 posts
|
|
22670
22755
|
* 1. parent post to store text with dataType=text
|
|
@@ -22692,6 +22777,7 @@ const queryPosts = async (query) => {
|
|
|
22692
22777
|
const prevPage = toPageRaw(paging.previous);
|
|
22693
22778
|
return { data: posts, cachedAt, prevPage, nextPage };
|
|
22694
22779
|
};
|
|
22780
|
+
/* end_public_function */
|
|
22695
22781
|
/**
|
|
22696
22782
|
* ```js
|
|
22697
22783
|
* import { queryPosts } from '@amityco/ts-sdk'
|
|
@@ -22727,6 +22813,9 @@ queryPosts.locally = (query) => {
|
|
|
22727
22813
|
: undefined;
|
|
22728
22814
|
};
|
|
22729
22815
|
|
|
22816
|
+
/* begin_public_function
|
|
22817
|
+
id: post.get_by_ids
|
|
22818
|
+
*/
|
|
22730
22819
|
/**
|
|
22731
22820
|
* ```js
|
|
22732
22821
|
* import { getPosts } from '@amityco/ts-sdk'
|
|
@@ -22790,6 +22879,9 @@ getPosts.locally = (postIds) => {
|
|
|
22790
22879
|
};
|
|
22791
22880
|
};
|
|
22792
22881
|
|
|
22882
|
+
/* begin_public_function
|
|
22883
|
+
id: post.get
|
|
22884
|
+
*/
|
|
22793
22885
|
/**
|
|
22794
22886
|
* ```js
|
|
22795
22887
|
* import { getPost } from '@amityco/ts-sdk'
|
|
@@ -22830,6 +22922,7 @@ const getPost = async (postId) => {
|
|
|
22830
22922
|
cachedAt,
|
|
22831
22923
|
};
|
|
22832
22924
|
};
|
|
22925
|
+
/* end_public_function */
|
|
22833
22926
|
/**
|
|
22834
22927
|
* ```js
|
|
22835
22928
|
* import { getPost } from '@amityco/ts-sdk'
|
|
@@ -22857,6 +22950,9 @@ getPost.locally = (postId) => {
|
|
|
22857
22950
|
};
|
|
22858
22951
|
};
|
|
22859
22952
|
|
|
22953
|
+
/* begin_public_function
|
|
22954
|
+
id: post.create.text_post, post.create.image_post, post.create.file_post, post.create.video_post, post.create.poll_post, post.create.livestream_post, post.create.custom_post
|
|
22955
|
+
*/
|
|
22860
22956
|
/**
|
|
22861
22957
|
* ```js
|
|
22862
22958
|
* import { createPost } from '@amityco/ts-sdk'
|
|
@@ -22894,8 +22990,12 @@ const createPost = async (bundle) => {
|
|
|
22894
22990
|
data: posts[0],
|
|
22895
22991
|
cachedAt,
|
|
22896
22992
|
};
|
|
22897
|
-
};
|
|
22993
|
+
};
|
|
22994
|
+
/* end_public_function */
|
|
22898
22995
|
|
|
22996
|
+
/* begin_public_function
|
|
22997
|
+
id: post.edit
|
|
22998
|
+
*/
|
|
22899
22999
|
/**
|
|
22900
23000
|
* ```js
|
|
22901
23001
|
* import { updatePost } from '@amityco/ts-sdk'
|
|
@@ -22927,7 +23027,8 @@ const updatePost = async (postId, patch) => {
|
|
|
22927
23027
|
data: posts.find(post => post.postId === postId),
|
|
22928
23028
|
cachedAt,
|
|
22929
23029
|
};
|
|
22930
|
-
};
|
|
23030
|
+
};
|
|
23031
|
+
/* end_public_function */
|
|
22931
23032
|
|
|
22932
23033
|
const getMatchPostSetting = (value) => {
|
|
22933
23034
|
var _a;
|
|
@@ -22953,6 +23054,9 @@ const prepareCommunityRequest = (params) => {
|
|
|
22953
23054
|
return Object.assign(Object.assign({}, restParam), (postSetting ? CommunityPostSettingMaps[postSetting] : undefined));
|
|
22954
23055
|
};
|
|
22955
23056
|
|
|
23057
|
+
/* begin_public_function
|
|
23058
|
+
id: community.query
|
|
23059
|
+
*/
|
|
22956
23060
|
/**
|
|
22957
23061
|
* ```js
|
|
22958
23062
|
* import { queryCommunities } from '@amityco/ts-sdk'
|
|
@@ -22973,12 +23077,12 @@ const queryCommunities = async (query) => {
|
|
|
22973
23077
|
client.log('channel/queryCommunities', query);
|
|
22974
23078
|
// safe decapsulation
|
|
22975
23079
|
const _a = query !== null && query !== void 0 ? query : {}, { page } = _a, params = __rest(_a, ["page"]);
|
|
22976
|
-
const _b = params !== null && params !== void 0 ? params : {}, { displayName, membership } = _b, restParams = __rest(_b, ["displayName", "membership"]);
|
|
23080
|
+
const _b = params !== null && params !== void 0 ? params : {}, { displayName, membership, includeDeleted } = _b, restParams = __rest(_b, ["displayName", "membership", "includeDeleted"]);
|
|
22977
23081
|
// API-FIX: parameters should be querystring.
|
|
22978
23082
|
// API-FIX: backend doesnt answer Amity.Response
|
|
22979
23083
|
// const { data } = await client.http.get<Amity.Response<Amity.PagedResponse<CommunityPayload>>>(
|
|
22980
23084
|
const { data } = await client.http.get(`/api/v3/communities`, {
|
|
22981
|
-
params: Object.assign(Object.assign({}, restParams), { keyword: displayName, filter: membership, options: {
|
|
23085
|
+
params: Object.assign(Object.assign({}, restParams), { isDeleted: includeDeleted === false ? false : undefined, keyword: displayName, filter: membership, options: {
|
|
22982
23086
|
token: toToken(page, 'skiplimit'),
|
|
22983
23087
|
} }),
|
|
22984
23088
|
});
|
|
@@ -22999,6 +23103,7 @@ const queryCommunities = async (query) => {
|
|
|
22999
23103
|
const prevPage = toPage(paging.previous);
|
|
23000
23104
|
return { data: communities, cachedAt, prevPage, nextPage };
|
|
23001
23105
|
};
|
|
23106
|
+
/* end_public_function */
|
|
23002
23107
|
/**
|
|
23003
23108
|
* ```js
|
|
23004
23109
|
* import { queryCommunities } from '@amityco/ts-sdk'
|
|
@@ -23080,6 +23185,9 @@ getCommunities.locally = (communityIds) => {
|
|
|
23080
23185
|
};
|
|
23081
23186
|
};
|
|
23082
23187
|
|
|
23188
|
+
/* begin_public_function
|
|
23189
|
+
id: community.get
|
|
23190
|
+
*/
|
|
23083
23191
|
/**
|
|
23084
23192
|
* ```js
|
|
23085
23193
|
* import { getCommunity } from '@amityco/ts-sdk'
|
|
@@ -23109,6 +23217,7 @@ const getCommunity = async (communityId) => {
|
|
|
23109
23217
|
cachedAt,
|
|
23110
23218
|
};
|
|
23111
23219
|
};
|
|
23220
|
+
/* end_public_function */
|
|
23112
23221
|
/**
|
|
23113
23222
|
* ```js
|
|
23114
23223
|
* import { getCommunity } from '@amityco/ts-sdk'
|
|
@@ -23136,6 +23245,9 @@ getCommunity.locally = (communityId) => {
|
|
|
23136
23245
|
};
|
|
23137
23246
|
};
|
|
23138
23247
|
|
|
23248
|
+
/* begin_public_function
|
|
23249
|
+
id: community.create
|
|
23250
|
+
*/
|
|
23139
23251
|
/**
|
|
23140
23252
|
* ```js
|
|
23141
23253
|
* import { createCommunity } from '@amityco/ts-sdk'
|
|
@@ -23164,8 +23276,12 @@ const createCommunity = async (bundle) => {
|
|
|
23164
23276
|
data: communities[0],
|
|
23165
23277
|
cachedAt,
|
|
23166
23278
|
};
|
|
23167
|
-
};
|
|
23279
|
+
};
|
|
23280
|
+
/* end_public_function */
|
|
23168
23281
|
|
|
23282
|
+
/* begin_public_function
|
|
23283
|
+
id: community.update
|
|
23284
|
+
*/
|
|
23169
23285
|
/**
|
|
23170
23286
|
* ```js
|
|
23171
23287
|
* import { updateCommunity } from '@amityco/ts-sdk'
|
|
@@ -23195,8 +23311,12 @@ const updateCommunity = async (communityId, patch) => {
|
|
|
23195
23311
|
data: communities.find(community => community.communityId === communityId),
|
|
23196
23312
|
cachedAt,
|
|
23197
23313
|
};
|
|
23198
|
-
};
|
|
23314
|
+
};
|
|
23315
|
+
/* end_public_function */
|
|
23199
23316
|
|
|
23317
|
+
/* begin_public_function
|
|
23318
|
+
id: community.delete
|
|
23319
|
+
*/
|
|
23200
23320
|
/**
|
|
23201
23321
|
* ```js
|
|
23202
23322
|
* import { deleteCommunity } from '@amityco/ts-sdk'
|
|
@@ -23226,8 +23346,12 @@ const deleteCommunity = async (communityId) => {
|
|
|
23226
23346
|
users: [],
|
|
23227
23347
|
});
|
|
23228
23348
|
return deleted.data;
|
|
23229
|
-
};
|
|
23349
|
+
};
|
|
23350
|
+
/* end_public_function */
|
|
23230
23351
|
|
|
23352
|
+
/* begin_public_function
|
|
23353
|
+
id: community.join
|
|
23354
|
+
*/
|
|
23231
23355
|
/**
|
|
23232
23356
|
* ```js
|
|
23233
23357
|
* import { joinCommunity } from '@amityco/ts-sdk'
|
|
@@ -23253,8 +23377,12 @@ const joinCommunity = async (communityId) => {
|
|
|
23253
23377
|
ingestInCache(data, { cachedAt });
|
|
23254
23378
|
const { communityUsers } = data;
|
|
23255
23379
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership === 'member');
|
|
23256
|
-
};
|
|
23380
|
+
};
|
|
23381
|
+
/* end_public_function */
|
|
23257
23382
|
|
|
23383
|
+
/* begin_public_function
|
|
23384
|
+
id: community.leave
|
|
23385
|
+
*/
|
|
23258
23386
|
/**
|
|
23259
23387
|
* ```js
|
|
23260
23388
|
* import { leaveCommunity } from '@amityco/ts-sdk'
|
|
@@ -23280,8 +23408,12 @@ const leaveCommunity = async (communityId) => {
|
|
|
23280
23408
|
ingestInCache(data, { cachedAt });
|
|
23281
23409
|
const { communityUsers } = data;
|
|
23282
23410
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership !== 'member');
|
|
23283
|
-
};
|
|
23411
|
+
};
|
|
23412
|
+
/* end_public_function */
|
|
23284
23413
|
|
|
23414
|
+
/* begin_public_function
|
|
23415
|
+
id: community.membership.query
|
|
23416
|
+
*/
|
|
23285
23417
|
/**
|
|
23286
23418
|
* ```js
|
|
23287
23419
|
* import { queryCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23325,6 +23457,7 @@ const queryCommunityMembers = async (query) => {
|
|
|
23325
23457
|
const prevPage = toPage(paging.previous);
|
|
23326
23458
|
return { data: communityUsers, cachedAt, nextPage, prevPage };
|
|
23327
23459
|
};
|
|
23460
|
+
/* end_public_function */
|
|
23328
23461
|
/**
|
|
23329
23462
|
* ```js
|
|
23330
23463
|
* import { queryCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23364,6 +23497,9 @@ queryCommunityMembers.locally = (query) => {
|
|
|
23364
23497
|
: undefined;
|
|
23365
23498
|
};
|
|
23366
23499
|
|
|
23500
|
+
/* begin_public_function
|
|
23501
|
+
id: community.membership.add_members
|
|
23502
|
+
*/
|
|
23367
23503
|
/**
|
|
23368
23504
|
* ```js
|
|
23369
23505
|
* import { addCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23389,8 +23525,12 @@ const addCommunityMembers = async (communityId, userIds) => {
|
|
|
23389
23525
|
ingestInCache(data);
|
|
23390
23526
|
const { communityUsers } = data;
|
|
23391
23527
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership === 'member');
|
|
23392
|
-
};
|
|
23528
|
+
};
|
|
23529
|
+
/* end_public_function */
|
|
23393
23530
|
|
|
23531
|
+
/* begin_public_function
|
|
23532
|
+
id: community.membership.remove_member
|
|
23533
|
+
*/
|
|
23394
23534
|
/**
|
|
23395
23535
|
* ```js
|
|
23396
23536
|
* import { removeCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23416,8 +23556,12 @@ const removeCommunityMembers = async (communityId, userIds) => {
|
|
|
23416
23556
|
ingestInCache(data);
|
|
23417
23557
|
const { communityUsers } = data;
|
|
23418
23558
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership !== 'member');
|
|
23419
|
-
};
|
|
23559
|
+
};
|
|
23560
|
+
/* end_public_function */
|
|
23420
23561
|
|
|
23562
|
+
/* begin_public_function
|
|
23563
|
+
id: community.moderation.add_roles
|
|
23564
|
+
*/
|
|
23421
23565
|
/**
|
|
23422
23566
|
* ```js
|
|
23423
23567
|
* import { addCommunityMembersRoles } from '@amityco/ts-sdk'
|
|
@@ -23444,8 +23588,12 @@ const addCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
|
23444
23588
|
const { communityUsers } = data;
|
|
23445
23589
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId &&
|
|
23446
23590
|
roleIds.some(role => communityUser.roles.includes(role)));
|
|
23447
|
-
};
|
|
23591
|
+
};
|
|
23592
|
+
/* end_public_function */
|
|
23448
23593
|
|
|
23594
|
+
/* begin_public_function
|
|
23595
|
+
id: community.moderation.remove_roles
|
|
23596
|
+
*/
|
|
23449
23597
|
/**
|
|
23450
23598
|
* ```js
|
|
23451
23599
|
* import { removeCommunityMembersRoles } from '@amityco/ts-sdk'
|
|
@@ -23472,8 +23620,12 @@ const removeCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
|
23472
23620
|
const { communityUsers } = data;
|
|
23473
23621
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId &&
|
|
23474
23622
|
!roleIds.some(role => communityUser.roles.includes(role)));
|
|
23475
|
-
};
|
|
23623
|
+
};
|
|
23624
|
+
/* end_public_function */
|
|
23476
23625
|
|
|
23626
|
+
/* begin_public_function
|
|
23627
|
+
id: community.query.trending_communities
|
|
23628
|
+
*/
|
|
23477
23629
|
/**
|
|
23478
23630
|
* ```js
|
|
23479
23631
|
* import { getTopTrendingCommunities } from '@amityco/ts-sdk'
|
|
@@ -23505,6 +23657,7 @@ const getTopTrendingCommunities = async (query) => {
|
|
|
23505
23657
|
}
|
|
23506
23658
|
return { data: communities, cachedAt };
|
|
23507
23659
|
};
|
|
23660
|
+
/* end_public_function */
|
|
23508
23661
|
/**
|
|
23509
23662
|
* ```js
|
|
23510
23663
|
* import { getTopTrendingCommunities } from '@amityco/ts-sdk'
|
|
@@ -23538,6 +23691,9 @@ getTopTrendingCommunities.locally = (query) => {
|
|
|
23538
23691
|
: undefined;
|
|
23539
23692
|
};
|
|
23540
23693
|
|
|
23694
|
+
/* begin_public_function
|
|
23695
|
+
id: community.query.recommended_communities
|
|
23696
|
+
*/
|
|
23541
23697
|
/**
|
|
23542
23698
|
* ```js
|
|
23543
23699
|
* import { getRecommendedCommunities } from '@amityco/ts-sdk'
|
|
@@ -23569,6 +23725,7 @@ const getRecommendedCommunities = async (query) => {
|
|
|
23569
23725
|
}
|
|
23570
23726
|
return { data: communities, cachedAt };
|
|
23571
23727
|
};
|
|
23728
|
+
/* end_public_function */
|
|
23572
23729
|
/**
|
|
23573
23730
|
* ```js
|
|
23574
23731
|
* import { getRecommendedCommunities } from '@amityco/ts-sdk'
|
|
@@ -23602,6 +23759,9 @@ getRecommendedCommunities.locally = (query) => {
|
|
|
23602
23759
|
: undefined;
|
|
23603
23760
|
};
|
|
23604
23761
|
|
|
23762
|
+
/* begin_public_function
|
|
23763
|
+
id: post.soft_delete, post.hard_delete
|
|
23764
|
+
*/
|
|
23605
23765
|
/**
|
|
23606
23766
|
* ```js
|
|
23607
23767
|
* import { deletePost } from '@amityco/ts-sdk'
|
|
@@ -23664,8 +23824,12 @@ const deletePost = async (postId, permanent = false) => {
|
|
|
23664
23824
|
upsertInCache(['post', 'get', postId], { isDeleted: true });
|
|
23665
23825
|
}
|
|
23666
23826
|
return deleted;
|
|
23667
|
-
};
|
|
23827
|
+
};
|
|
23828
|
+
/* end_public_function */
|
|
23668
23829
|
|
|
23830
|
+
/* begin_public_function
|
|
23831
|
+
id: post.approve
|
|
23832
|
+
*/
|
|
23669
23833
|
/**
|
|
23670
23834
|
* ```js
|
|
23671
23835
|
* import { approvePost } from '@amityco/ts-sdk'
|
|
@@ -23698,8 +23862,12 @@ const approvePost = async (postId) => {
|
|
|
23698
23862
|
data: data.posts.find(post => post.postId === postId),
|
|
23699
23863
|
cachedAt,
|
|
23700
23864
|
};
|
|
23701
|
-
};
|
|
23865
|
+
};
|
|
23866
|
+
/* end_public_function */
|
|
23702
23867
|
|
|
23868
|
+
/* begin_public_function
|
|
23869
|
+
id: post.decline
|
|
23870
|
+
*/
|
|
23703
23871
|
/**
|
|
23704
23872
|
* ```js
|
|
23705
23873
|
* import { declinePost } from '@amityco/ts-sdk'
|
|
@@ -23732,8 +23900,12 @@ const declinePost = async (postId) => {
|
|
|
23732
23900
|
data: payload.posts.find(post => post.postId === postId),
|
|
23733
23901
|
cachedAt,
|
|
23734
23902
|
};
|
|
23735
|
-
};
|
|
23903
|
+
};
|
|
23904
|
+
/* end_public_function */
|
|
23736
23905
|
|
|
23906
|
+
/* begin_public_function
|
|
23907
|
+
id: comment.query
|
|
23908
|
+
*/
|
|
23737
23909
|
/**
|
|
23738
23910
|
* ```js
|
|
23739
23911
|
* import { queryComments } from '@amityco/ts-sdk'
|
|
@@ -23751,7 +23923,7 @@ const declinePost = async (postId) => {
|
|
|
23751
23923
|
const queryComments = async (query) => {
|
|
23752
23924
|
const client = getActiveClient();
|
|
23753
23925
|
client.log('comment/queryComments', query);
|
|
23754
|
-
const { page = { limit: 10 } } = query, params = __rest(query, ["page"]);
|
|
23926
|
+
const { page = { limit: 10 }, includeDeleted } = query, params = __rest(query, ["page", "includeDeleted"]);
|
|
23755
23927
|
const options = {
|
|
23756
23928
|
type: params.sortBy ? 'pagination' : undefined,
|
|
23757
23929
|
token: toToken(page, params.sortBy ? 'skiplimit' : 'afterbefore'),
|
|
@@ -23761,7 +23933,7 @@ const queryComments = async (query) => {
|
|
|
23761
23933
|
// API-FIX: backend should answer Amity.Response (2)
|
|
23762
23934
|
// const { data } = await client.http.get<Amity.Response<Amity.PagedResponse<Amity.CommentPayload>>>(
|
|
23763
23935
|
const { data } = await client.http.get(`/api/v3/comments`, {
|
|
23764
|
-
params: Object.assign(Object.assign({}, params), {
|
|
23936
|
+
params: Object.assign(Object.assign({}, params), { isDeleted: includeDeleted === false ? false : undefined,
|
|
23765
23937
|
// filterByParentId, API-FIX: backend does not support this boolean LOL. what the hell seriously.
|
|
23766
23938
|
options }),
|
|
23767
23939
|
});
|
|
@@ -23783,6 +23955,7 @@ const queryComments = async (query) => {
|
|
|
23783
23955
|
const prevPage = toPage(paging.previous);
|
|
23784
23956
|
return { data: comments, cachedAt, prevPage, nextPage };
|
|
23785
23957
|
};
|
|
23958
|
+
/* end_public_function */
|
|
23786
23959
|
/**
|
|
23787
23960
|
* ```js
|
|
23788
23961
|
* import { queryComments } from '@amityco/ts-sdk'
|
|
@@ -23818,6 +23991,9 @@ queryComments.locally = (query) => {
|
|
|
23818
23991
|
: undefined;
|
|
23819
23992
|
};
|
|
23820
23993
|
|
|
23994
|
+
/* begin_public_function
|
|
23995
|
+
id: comment.get_by_ids
|
|
23996
|
+
*/
|
|
23821
23997
|
/**
|
|
23822
23998
|
* ```js
|
|
23823
23999
|
* import { getComments } from '@amityco/ts-sdk'
|
|
@@ -23848,6 +24024,7 @@ const getComments = async (commentIds) => {
|
|
|
23848
24024
|
cachedAt,
|
|
23849
24025
|
};
|
|
23850
24026
|
};
|
|
24027
|
+
/* end_public_function */
|
|
23851
24028
|
/**
|
|
23852
24029
|
* ```js
|
|
23853
24030
|
* import { getComments } from '@amityco/ts-sdk'
|
|
@@ -23880,6 +24057,9 @@ getComments.locally = (commentIds) => {
|
|
|
23880
24057
|
};
|
|
23881
24058
|
};
|
|
23882
24059
|
|
|
24060
|
+
/* begin_public_function
|
|
24061
|
+
id: comment.get
|
|
24062
|
+
*/
|
|
23883
24063
|
/**
|
|
23884
24064
|
* ```js
|
|
23885
24065
|
* import { getComment } from '@amityco/ts-sdk'
|
|
@@ -23919,6 +24099,7 @@ const getComment = async (commentId) => {
|
|
|
23919
24099
|
cachedAt,
|
|
23920
24100
|
};
|
|
23921
24101
|
};
|
|
24102
|
+
/* end_public_function */
|
|
23922
24103
|
/**
|
|
23923
24104
|
* ```js
|
|
23924
24105
|
* import { getComment } from '@amityco/ts-sdk'
|
|
@@ -23946,6 +24127,9 @@ getComment.locally = (commentId) => {
|
|
|
23946
24127
|
};
|
|
23947
24128
|
};
|
|
23948
24129
|
|
|
24130
|
+
/* begin_public_function
|
|
24131
|
+
id: comment.create
|
|
24132
|
+
*/
|
|
23949
24133
|
/**
|
|
23950
24134
|
* ```js
|
|
23951
24135
|
* import { createComment } from '@amityco/ts-sdk'
|
|
@@ -23985,8 +24169,12 @@ const createComment = async (bundle) => {
|
|
|
23985
24169
|
data: comments[0],
|
|
23986
24170
|
cachedAt,
|
|
23987
24171
|
};
|
|
23988
|
-
};
|
|
24172
|
+
};
|
|
24173
|
+
/* end_public_function */
|
|
23989
24174
|
|
|
24175
|
+
/* begin_public_function
|
|
24176
|
+
id: comment.update_comment
|
|
24177
|
+
*/
|
|
23990
24178
|
/**
|
|
23991
24179
|
* ```js
|
|
23992
24180
|
* import { updateComment } from '@amityco/ts-sdk'
|
|
@@ -24017,8 +24205,12 @@ const updateComment = async (commentId, patch) => {
|
|
|
24017
24205
|
data: comments.find(comment => comment.commentId === commentId),
|
|
24018
24206
|
cachedAt,
|
|
24019
24207
|
};
|
|
24020
|
-
};
|
|
24208
|
+
};
|
|
24209
|
+
/* end_public_function */
|
|
24021
24210
|
|
|
24211
|
+
/* begin_public_function
|
|
24212
|
+
id: comment.soft_delete, comment.hard_delete
|
|
24213
|
+
*/
|
|
24022
24214
|
/**
|
|
24023
24215
|
* ```js
|
|
24024
24216
|
* import { deleteComment } from '@amityco/ts-sdk'
|
|
@@ -24071,7 +24263,8 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
24071
24263
|
upsertInCache(['comment', 'get', commentId], { isDeleted: true });
|
|
24072
24264
|
}
|
|
24073
24265
|
return deleted;
|
|
24074
|
-
};
|
|
24266
|
+
};
|
|
24267
|
+
/* end_public_function */
|
|
24075
24268
|
|
|
24076
24269
|
/** @hidden */
|
|
24077
24270
|
const preparePayloadForCache = (event, payload) => {
|
|
@@ -24111,6 +24304,9 @@ const preparePayloadForCache = (event, payload) => {
|
|
|
24111
24304
|
}
|
|
24112
24305
|
};
|
|
24113
24306
|
|
|
24307
|
+
/* begin_public_function
|
|
24308
|
+
id: reaction.add
|
|
24309
|
+
*/
|
|
24114
24310
|
/**
|
|
24115
24311
|
* ```js
|
|
24116
24312
|
* import { addReaction } from '@amityco/ts-sdk'
|
|
@@ -24151,6 +24347,7 @@ const addReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
24151
24347
|
}
|
|
24152
24348
|
return true;
|
|
24153
24349
|
};
|
|
24350
|
+
/* end_public_function */
|
|
24154
24351
|
/**
|
|
24155
24352
|
* ```js
|
|
24156
24353
|
* import { addReaction } from '@amityco/ts-sdk'
|
|
@@ -24191,6 +24388,9 @@ addReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
|
24191
24388
|
return (_e = (_d = reaction === null || reaction === void 0 ? void 0 : reaction.myReactions) === null || _d === void 0 ? void 0 : _d.includes(reactionName)) !== null && _e !== void 0 ? _e : false;
|
|
24192
24389
|
};
|
|
24193
24390
|
|
|
24391
|
+
/* begin_public_function
|
|
24392
|
+
id: reaction.remove
|
|
24393
|
+
*/
|
|
24194
24394
|
/**
|
|
24195
24395
|
* ```js
|
|
24196
24396
|
* import { deleteReaction } from '@amityco/ts-sdk'
|
|
@@ -24233,6 +24433,7 @@ const removeReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
24233
24433
|
}
|
|
24234
24434
|
return true;
|
|
24235
24435
|
};
|
|
24436
|
+
/* end_public_function */
|
|
24236
24437
|
/**
|
|
24237
24438
|
* ```js
|
|
24238
24439
|
* import { removeReaction } from '@amityco/ts-sdk'
|
|
@@ -24273,6 +24474,9 @@ removeReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
|
24273
24474
|
return (_e = !((_d = reaction === null || reaction === void 0 ? void 0 : reaction.myReactions) === null || _d === void 0 ? void 0 : _d.includes(reactionName))) !== null && _e !== void 0 ? _e : false;
|
|
24274
24475
|
};
|
|
24275
24476
|
|
|
24477
|
+
/* begin_public_function
|
|
24478
|
+
id: reaction.query
|
|
24479
|
+
*/
|
|
24276
24480
|
/**
|
|
24277
24481
|
* ```js
|
|
24278
24482
|
* import { queryReactions } from '@amityco/ts-sdk'
|
|
@@ -24307,7 +24511,8 @@ const queryReactions = async (query) => {
|
|
|
24307
24511
|
const nextPage = toPageRaw(paging.next);
|
|
24308
24512
|
const prevPage = toPageRaw(paging.previous);
|
|
24309
24513
|
return { data: reactions, prevPage, nextPage };
|
|
24310
|
-
};
|
|
24514
|
+
};
|
|
24515
|
+
/* end_public_function */
|
|
24311
24516
|
|
|
24312
24517
|
const createPostEventSubscriber = (event, callback) => {
|
|
24313
24518
|
const client = getActiveClient();
|
|
@@ -25054,6 +25259,9 @@ var REFERENCE_TYPES = {
|
|
|
25054
25259
|
},
|
|
25055
25260
|
};
|
|
25056
25261
|
|
|
25262
|
+
/* begin_public_function
|
|
25263
|
+
id: user.flag, message.flag, post.flag, comment.flag
|
|
25264
|
+
*/
|
|
25057
25265
|
/**
|
|
25058
25266
|
* ```js
|
|
25059
25267
|
* import { createReport } from '@amityco/ts-sdk'
|
|
@@ -25094,8 +25302,12 @@ const createReport = async (referenceType, referenceId) => {
|
|
|
25094
25302
|
}
|
|
25095
25303
|
fireEvent(`${referenceType}.flagged`, payload);
|
|
25096
25304
|
return !!payload;
|
|
25097
|
-
};
|
|
25305
|
+
};
|
|
25306
|
+
/* end_public_function */
|
|
25098
25307
|
|
|
25308
|
+
/* begin_public_function
|
|
25309
|
+
id: user.unflag, message.unflag, post.unflag, comment.unflag
|
|
25310
|
+
*/
|
|
25099
25311
|
/**
|
|
25100
25312
|
* ```js
|
|
25101
25313
|
* import { deleteReport } from '@amityco/ts-sdk'
|
|
@@ -25137,8 +25349,12 @@ const deleteReport = async (referenceType, referenceId) => {
|
|
|
25137
25349
|
// @ts-ignore
|
|
25138
25350
|
fireEvent(`${referenceType}.unflagged`, payload);
|
|
25139
25351
|
return !!payload;
|
|
25140
|
-
};
|
|
25352
|
+
};
|
|
25353
|
+
/* end_public_function */
|
|
25141
25354
|
|
|
25355
|
+
/* begin_public_function
|
|
25356
|
+
id: user.check_flag_by_me, message.check_flag_by_me, post.check_flag_by_me, comment.check_flag_by_me
|
|
25357
|
+
*/
|
|
25142
25358
|
/**
|
|
25143
25359
|
* ```js
|
|
25144
25360
|
* import { isReportedByMe } from '@amityco/ts-sdk'
|
|
@@ -25165,7 +25381,8 @@ const isReportedByMe = async (referenceType, referenceId) => {
|
|
|
25165
25381
|
[primaryKey]: referenceId,
|
|
25166
25382
|
}))) !== null && _a !== void 0 ? _a : {};
|
|
25167
25383
|
return (_b = result !== null && result !== void 0 ? result : isFlagByMe) !== null && _b !== void 0 ? _b : false;
|
|
25168
|
-
};
|
|
25384
|
+
};
|
|
25385
|
+
/* end_public_function */
|
|
25169
25386
|
|
|
25170
25387
|
function convertFromRaw$1(_a, params) {
|
|
25171
25388
|
var { _id } = _a, rest = __rest(_a, ["_id"]);
|
|
@@ -25200,6 +25417,9 @@ const prepareChannelPayload = (rawPayload) => {
|
|
|
25200
25417
|
return Object.assign(Object.assign({}, rawPayload), { channels, channelUsers });
|
|
25201
25418
|
};
|
|
25202
25419
|
|
|
25420
|
+
/* begin_public_function
|
|
25421
|
+
id: channel.query
|
|
25422
|
+
*/
|
|
25203
25423
|
/**
|
|
25204
25424
|
* ```js
|
|
25205
25425
|
* import { queryChannels } from '@amityco/ts-sdk'
|
|
@@ -25245,6 +25465,7 @@ const queryChannels = async (query) => {
|
|
|
25245
25465
|
const prevPage = toPage(paging.previous);
|
|
25246
25466
|
return { data: channels, cachedAt, prevPage, nextPage };
|
|
25247
25467
|
};
|
|
25468
|
+
/* end_public_function */
|
|
25248
25469
|
/**
|
|
25249
25470
|
* ```js
|
|
25250
25471
|
* import { queryChannels } from '@amityco/ts-sdk'
|
|
@@ -25342,6 +25563,9 @@ getChannels.locally = (channelIds) => {
|
|
|
25342
25563
|
};
|
|
25343
25564
|
};
|
|
25344
25565
|
|
|
25566
|
+
/* begin_public_function
|
|
25567
|
+
id: channel.get
|
|
25568
|
+
*/
|
|
25345
25569
|
/**
|
|
25346
25570
|
* ```js
|
|
25347
25571
|
* import { getChannel } from '@amityco/ts-sdk'
|
|
@@ -25380,6 +25604,7 @@ const getChannel = async (channelId) => {
|
|
|
25380
25604
|
cachedAt,
|
|
25381
25605
|
};
|
|
25382
25606
|
};
|
|
25607
|
+
/* end_public_function */
|
|
25383
25608
|
/**
|
|
25384
25609
|
* ```js
|
|
25385
25610
|
* import { getChannel } from '@amityco/ts-sdk'
|
|
@@ -25407,6 +25632,9 @@ getChannel.locally = (channelId) => {
|
|
|
25407
25632
|
};
|
|
25408
25633
|
};
|
|
25409
25634
|
|
|
25635
|
+
/* begin_public_function
|
|
25636
|
+
id: channel.create
|
|
25637
|
+
*/
|
|
25410
25638
|
/**
|
|
25411
25639
|
* ```js
|
|
25412
25640
|
* import { createChannel } from '@amityco/ts-sdk'
|
|
@@ -25440,8 +25668,12 @@ const createChannel = async (bundle) => {
|
|
|
25440
25668
|
data: channels[0],
|
|
25441
25669
|
cachedAt,
|
|
25442
25670
|
};
|
|
25443
|
-
};
|
|
25671
|
+
};
|
|
25672
|
+
/* end_public_function */
|
|
25444
25673
|
|
|
25674
|
+
/* begin_public_function
|
|
25675
|
+
id: channel.update
|
|
25676
|
+
*/
|
|
25445
25677
|
/**
|
|
25446
25678
|
* ```js
|
|
25447
25679
|
* import { updateChannel } from '@amityco/ts-sdk'
|
|
@@ -25470,7 +25702,8 @@ const updateChannel = async (channelId, patch) => {
|
|
|
25470
25702
|
data: channels.find(channel => channel.channelId === channelId),
|
|
25471
25703
|
cachedAt,
|
|
25472
25704
|
};
|
|
25473
|
-
};
|
|
25705
|
+
};
|
|
25706
|
+
/* end_public_function */
|
|
25474
25707
|
|
|
25475
25708
|
/**
|
|
25476
25709
|
* ```js
|
|
@@ -25495,6 +25728,9 @@ const deleteChannel = async (channelId) => {
|
|
|
25495
25728
|
return deleted.data;
|
|
25496
25729
|
};
|
|
25497
25730
|
|
|
25731
|
+
/* begin_public_function
|
|
25732
|
+
id: channel.join
|
|
25733
|
+
*/
|
|
25498
25734
|
/**
|
|
25499
25735
|
* ```js
|
|
25500
25736
|
* import { joinChannel } from '@amityco/ts-sdk'
|
|
@@ -25518,8 +25754,12 @@ const joinChannel = async (channelId) => {
|
|
|
25518
25754
|
ingestInCache(data);
|
|
25519
25755
|
const { channelUsers } = data;
|
|
25520
25756
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership === 'member');
|
|
25521
|
-
};
|
|
25757
|
+
};
|
|
25758
|
+
/* end_public_function */
|
|
25522
25759
|
|
|
25760
|
+
/* begin_public_function
|
|
25761
|
+
id: channel.leave
|
|
25762
|
+
*/
|
|
25523
25763
|
/**
|
|
25524
25764
|
* ```js
|
|
25525
25765
|
* import { leaveChannel } from '@amityco/ts-sdk'
|
|
@@ -25543,8 +25783,12 @@ const leaveChannel = async (channelId) => {
|
|
|
25543
25783
|
ingestInCache(data);
|
|
25544
25784
|
const { channelUsers } = data;
|
|
25545
25785
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership !== 'member');
|
|
25546
|
-
};
|
|
25786
|
+
};
|
|
25787
|
+
/* end_public_function */
|
|
25547
25788
|
|
|
25789
|
+
/* begin_public_function
|
|
25790
|
+
id: channel.member.query, channel.member.search
|
|
25791
|
+
*/
|
|
25548
25792
|
/**
|
|
25549
25793
|
* ```js
|
|
25550
25794
|
* import { queryChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25593,6 +25837,7 @@ const queryChannelMembers = async (query) => {
|
|
|
25593
25837
|
prevPage,
|
|
25594
25838
|
};
|
|
25595
25839
|
};
|
|
25840
|
+
/* end_public_function */
|
|
25596
25841
|
/**
|
|
25597
25842
|
* ```js
|
|
25598
25843
|
* import { queryChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25633,6 +25878,9 @@ queryChannelMembers.locally = (query) => {
|
|
|
25633
25878
|
: undefined;
|
|
25634
25879
|
};
|
|
25635
25880
|
|
|
25881
|
+
/* begin_public_function
|
|
25882
|
+
id: channel.member.add
|
|
25883
|
+
*/
|
|
25636
25884
|
/**
|
|
25637
25885
|
* ```js
|
|
25638
25886
|
* import { addChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25661,8 +25909,12 @@ const addChannelMembers = async (channelId, userIds) => {
|
|
|
25661
25909
|
ingestInCache(data);
|
|
25662
25910
|
const { channelUsers } = data;
|
|
25663
25911
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership === 'member');
|
|
25664
|
-
};
|
|
25912
|
+
};
|
|
25913
|
+
/* end_public_function */
|
|
25665
25914
|
|
|
25915
|
+
/* begin_public_function
|
|
25916
|
+
id: channel.member.remove
|
|
25917
|
+
*/
|
|
25666
25918
|
/**
|
|
25667
25919
|
* ```js
|
|
25668
25920
|
* import { removeChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25691,8 +25943,12 @@ const removeChannelMembers = async (channelId, userIds) => {
|
|
|
25691
25943
|
ingestInCache(data);
|
|
25692
25944
|
const { channelUsers } = data;
|
|
25693
25945
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership !== 'member');
|
|
25694
|
-
};
|
|
25946
|
+
};
|
|
25947
|
+
/* end_public_function */
|
|
25695
25948
|
|
|
25949
|
+
/* begin_public_function
|
|
25950
|
+
id: channel.moderation.add_roles
|
|
25951
|
+
*/
|
|
25696
25952
|
/**
|
|
25697
25953
|
* ```js
|
|
25698
25954
|
* import { addChannelMembersRole } from '@amityco/ts-sdk'
|
|
@@ -25718,8 +25974,12 @@ const addChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
25718
25974
|
ingestInCache(data);
|
|
25719
25975
|
const { channelUsers } = data;
|
|
25720
25976
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.roles.includes(roleId));
|
|
25721
|
-
};
|
|
25977
|
+
};
|
|
25978
|
+
/* end_public_function */
|
|
25722
25979
|
|
|
25980
|
+
/* begin_public_function
|
|
25981
|
+
id: channel.moderation.remove_roles
|
|
25982
|
+
*/
|
|
25723
25983
|
/**
|
|
25724
25984
|
* ```js
|
|
25725
25985
|
* import { removeChannelMembersRole } from '@amityco/ts-sdk'
|
|
@@ -25730,7 +25990,7 @@ const addChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
25730
25990
|
*
|
|
25731
25991
|
* @param channelId The ID of the {@link Amity.Channel} to perform
|
|
25732
25992
|
* @param roleId The ID of the {@link Amity.Role} to apply
|
|
25733
|
-
* @param
|
|
25993
|
+
* @param userIds Array of IDs of the {@link Amity.User} to perform
|
|
25734
25994
|
* @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.User} in the {@link Amity.Channel}
|
|
25735
25995
|
*
|
|
25736
25996
|
* @category Channel API
|
|
@@ -25745,8 +26005,12 @@ const removeChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
25745
26005
|
ingestInCache(data);
|
|
25746
26006
|
const { channelUsers } = data;
|
|
25747
26007
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && !channelUser.roles.includes(roleId));
|
|
25748
|
-
};
|
|
26008
|
+
};
|
|
26009
|
+
/* end_public_function */
|
|
25749
26010
|
|
|
26011
|
+
/* begin_public_function
|
|
26012
|
+
id: channel.moderation.ban_members
|
|
26013
|
+
*/
|
|
25750
26014
|
/**
|
|
25751
26015
|
* ```js
|
|
25752
26016
|
* import { banChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25776,8 +26040,12 @@ const banChannelMembers = async (channelId, userIds) => {
|
|
|
25776
26040
|
data: channelUsers === null || channelUsers === void 0 ? void 0 : channelUsers.filter(user => user.membership === 'banned'),
|
|
25777
26041
|
cachedAt,
|
|
25778
26042
|
};
|
|
25779
|
-
};
|
|
26043
|
+
};
|
|
26044
|
+
/* end_public_function */
|
|
25780
26045
|
|
|
26046
|
+
/* begin_public_function
|
|
26047
|
+
id: channel.moderation.unban_members
|
|
26048
|
+
*/
|
|
25781
26049
|
/**
|
|
25782
26050
|
* ```js
|
|
25783
26051
|
* import { unbanChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25807,8 +26075,12 @@ const unbanChannelMembers = async (channelId, userIds) => {
|
|
|
25807
26075
|
data: channelUsers === null || channelUsers === void 0 ? void 0 : channelUsers.filter(user => user.membership === 'member'),
|
|
25808
26076
|
cachedAt,
|
|
25809
26077
|
};
|
|
25810
|
-
};
|
|
26078
|
+
};
|
|
26079
|
+
/* end_public_function */
|
|
25811
26080
|
|
|
26081
|
+
/* begin_public_function
|
|
26082
|
+
id: channel.start_reading
|
|
26083
|
+
*/
|
|
25812
26084
|
/**
|
|
25813
26085
|
* ```js
|
|
25814
26086
|
* import { startReading } from '@amityco/ts-sdk'
|
|
@@ -25817,9 +26089,9 @@ const unbanChannelMembers = async (channelId, userIds) => {
|
|
|
25817
26089
|
*
|
|
25818
26090
|
* Mark all messages as read and start reading message inside channel
|
|
25819
26091
|
*
|
|
25820
|
-
* @param
|
|
25821
|
-
* @param
|
|
25822
|
-
* @return
|
|
26092
|
+
* @param subChannelId - The channel ID to start reading.
|
|
26093
|
+
* @param userId - The user ID of channel member.
|
|
26094
|
+
* @return A success boolean if the channel reading of the sub channel had begun.
|
|
25823
26095
|
*
|
|
25824
26096
|
* @category Message API
|
|
25825
26097
|
* @async
|
|
@@ -25845,8 +26117,12 @@ const startReading = async (subChannelId, userId = getActiveClient().userId) =>
|
|
|
25845
26117
|
channelId,
|
|
25846
26118
|
});
|
|
25847
26119
|
return !!result;
|
|
25848
|
-
};
|
|
26120
|
+
};
|
|
26121
|
+
/* end_public_function */
|
|
25849
26122
|
|
|
26123
|
+
/* begin_public_function
|
|
26124
|
+
id: channel.stop_reading
|
|
26125
|
+
*/
|
|
25850
26126
|
/**
|
|
25851
26127
|
* ```js
|
|
25852
26128
|
* import { stopReading } from '@amityco/ts-sdk'
|
|
@@ -25855,8 +26131,8 @@ const startReading = async (subChannelId, userId = getActiveClient().userId) =>
|
|
|
25855
26131
|
*
|
|
25856
26132
|
* Stop reading message inside channel
|
|
25857
26133
|
*
|
|
25858
|
-
* @param
|
|
25859
|
-
* @return
|
|
26134
|
+
* @param subChannelId - The channel ID to stop reading.
|
|
26135
|
+
* @return A success boolean if the sub channel reading was halted.
|
|
25860
26136
|
*
|
|
25861
26137
|
* @category Message API
|
|
25862
26138
|
* @async
|
|
@@ -25881,7 +26157,8 @@ const stopReading = async (subChannelId) => {
|
|
|
25881
26157
|
channelId,
|
|
25882
26158
|
});
|
|
25883
26159
|
return !!result;
|
|
25884
|
-
};
|
|
26160
|
+
};
|
|
26161
|
+
/* end_public_function */
|
|
25885
26162
|
|
|
25886
26163
|
/**
|
|
25887
26164
|
* ```js
|
|
@@ -26513,6 +26790,11 @@ const liveChannel = (channelId, callback) => {
|
|
|
26513
26790
|
onChannelUpdated,
|
|
26514
26791
|
onChannelDeleted,
|
|
26515
26792
|
onChannelJoined,
|
|
26793
|
+
onChannelLeft,
|
|
26794
|
+
onChannelMemberAdded,
|
|
26795
|
+
onChannelMemberRemoved,
|
|
26796
|
+
onChannelMemberBanned,
|
|
26797
|
+
onChannelMemberUnbanned,
|
|
26516
26798
|
onChannelMuted,
|
|
26517
26799
|
() => onMessageCreated(() => null), // watch unread count
|
|
26518
26800
|
]);
|
|
@@ -26773,6 +27055,9 @@ function convertQueryParams(_a) {
|
|
|
26773
27055
|
return out;
|
|
26774
27056
|
}
|
|
26775
27057
|
|
|
27058
|
+
/* begin_public_function
|
|
27059
|
+
id: subchannel.query
|
|
27060
|
+
*/
|
|
26776
27061
|
/**
|
|
26777
27062
|
* ```js
|
|
26778
27063
|
* import { querySubChannels } from '@amityco/ts-sdk'
|
|
@@ -26790,9 +27075,9 @@ function convertQueryParams(_a) {
|
|
|
26790
27075
|
const querySubChannels = async (query) => {
|
|
26791
27076
|
const client = getActiveClient();
|
|
26792
27077
|
client.log('channel/querySubChannels', query);
|
|
26793
|
-
const _a = convertQueryParams(query), { page = { limit: 10 }, channelId } = _a, params = __rest(_a, ["page", "channelId"]);
|
|
27078
|
+
const _a = convertQueryParams(query), { page = { limit: 10 }, channelId, includeDeleted } = _a, params = __rest(_a, ["page", "channelId", "includeDeleted"]);
|
|
26794
27079
|
const response = await client.http.get(`/api/v5/message-feeds/channel/${channelId}`, {
|
|
26795
|
-
params: Object.assign(Object.assign({}, params), { options: {
|
|
27080
|
+
params: Object.assign(Object.assign({}, params), { isDeleted: includeDeleted === false ? false : undefined, options: {
|
|
26796
27081
|
token: toToken(page, 'skiplimit'),
|
|
26797
27082
|
} }),
|
|
26798
27083
|
});
|
|
@@ -26814,6 +27099,7 @@ const querySubChannels = async (query) => {
|
|
|
26814
27099
|
const prevPage = toPage(paging.previous);
|
|
26815
27100
|
return { data: subChannels, cachedAt, prevPage, nextPage };
|
|
26816
27101
|
};
|
|
27102
|
+
/* end_public_function */
|
|
26817
27103
|
/**
|
|
26818
27104
|
* ```js
|
|
26819
27105
|
* import { querySubChannels } from '@amityco/ts-sdk'
|
|
@@ -26914,6 +27200,9 @@ getSubChannels.locally = (subChannelIds) => {
|
|
|
26914
27200
|
};
|
|
26915
27201
|
};
|
|
26916
27202
|
|
|
27203
|
+
/* begin_public_function
|
|
27204
|
+
id: subchannel.get
|
|
27205
|
+
*/
|
|
26917
27206
|
/**
|
|
26918
27207
|
* ```js
|
|
26919
27208
|
* import { getSubChannel } from '@amityco/ts-sdk'
|
|
@@ -26951,6 +27240,7 @@ const getSubChannel = async (subChannelId) => {
|
|
|
26951
27240
|
throw error;
|
|
26952
27241
|
}
|
|
26953
27242
|
};
|
|
27243
|
+
/* end_public_function */
|
|
26954
27244
|
/**
|
|
26955
27245
|
* ```js
|
|
26956
27246
|
* import { getSubChannel } from '@amityco/ts-sdk'
|
|
@@ -26978,6 +27268,9 @@ getSubChannel.locally = (subChannelId) => {
|
|
|
26978
27268
|
};
|
|
26979
27269
|
};
|
|
26980
27270
|
|
|
27271
|
+
/* begin_public_function
|
|
27272
|
+
id: subchannel.create
|
|
27273
|
+
*/
|
|
26981
27274
|
/**
|
|
26982
27275
|
* ```js
|
|
26983
27276
|
* import { createSubChannel } from '@amityco/ts-sdk'
|
|
@@ -27008,8 +27301,12 @@ const createSubChannel = async (bundle) => {
|
|
|
27008
27301
|
data: data.messageFeeds[0],
|
|
27009
27302
|
cachedAt,
|
|
27010
27303
|
};
|
|
27011
|
-
};
|
|
27304
|
+
};
|
|
27305
|
+
/* end_public_function */
|
|
27012
27306
|
|
|
27307
|
+
/* begin_public_function
|
|
27308
|
+
id: subchannel.update
|
|
27309
|
+
*/
|
|
27013
27310
|
/**
|
|
27014
27311
|
* ```js
|
|
27015
27312
|
* import { updateSubChannel } from '@amityco/ts-sdk'
|
|
@@ -27038,8 +27335,12 @@ const updateSubChannel = async (subChannelId, patch) => {
|
|
|
27038
27335
|
data: data.messageFeeds[0],
|
|
27039
27336
|
cachedAt,
|
|
27040
27337
|
};
|
|
27041
|
-
};
|
|
27338
|
+
};
|
|
27339
|
+
/* end_public_function */
|
|
27042
27340
|
|
|
27341
|
+
/* begin_public_function
|
|
27342
|
+
id: subchannel.soft_delete, subchannel.hard_delete
|
|
27343
|
+
*/
|
|
27043
27344
|
/**
|
|
27044
27345
|
* ```js
|
|
27045
27346
|
* import { deleteSubChannel } from '@amityco/ts-sdk'
|
|
@@ -27070,7 +27371,8 @@ const deleteSubChannel = async (subChannelId, permanent = false) => {
|
|
|
27070
27371
|
}
|
|
27071
27372
|
fireEvent('local.message-feed.deleted', { messageFeeds: [deleted] });
|
|
27072
27373
|
return deleted;
|
|
27073
|
-
};
|
|
27374
|
+
};
|
|
27375
|
+
/* end_public_function */
|
|
27074
27376
|
|
|
27075
27377
|
/**
|
|
27076
27378
|
* ```js
|
|
@@ -27218,8 +27520,8 @@ const liveSubChannels = (params, callback, config) => {
|
|
|
27218
27520
|
const responder = (data) => {
|
|
27219
27521
|
var _a;
|
|
27220
27522
|
let subChannels = data.data;
|
|
27221
|
-
if (params.
|
|
27222
|
-
subChannels = filterByPropEquality(subChannels, 'isDeleted',
|
|
27523
|
+
if (params.includeDeleted === false) {
|
|
27524
|
+
subChannels = filterByPropEquality(subChannels, 'isDeleted', false);
|
|
27223
27525
|
}
|
|
27224
27526
|
subChannels.sort(sortByLastActivity);
|
|
27225
27527
|
callback({
|
|
@@ -27364,9 +27666,11 @@ const liveMessages = (params, callback, config) => {
|
|
|
27364
27666
|
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
27365
27667
|
/*
|
|
27366
27668
|
* for cases when message is deleted via RTE, this flag is used to get
|
|
27367
|
-
* items
|
|
27669
|
+
* items from cache that are !deleted
|
|
27368
27670
|
*/
|
|
27369
|
-
|
|
27671
|
+
if (params.includeDeleted === false) {
|
|
27672
|
+
messages = filterByPropEquality(messages, 'isDeleted', false);
|
|
27673
|
+
}
|
|
27370
27674
|
callback({
|
|
27371
27675
|
onNextPage: onFetch,
|
|
27372
27676
|
data: messages,
|
|
@@ -27375,17 +27679,12 @@ const liveMessages = (params, callback, config) => {
|
|
|
27375
27679
|
error: data.error,
|
|
27376
27680
|
});
|
|
27377
27681
|
};
|
|
27378
|
-
const realtimeRouter = (
|
|
27682
|
+
const realtimeRouter = (_) => (message) => {
|
|
27379
27683
|
var _a;
|
|
27380
27684
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
27381
|
-
if (params.subChannelId !== message.subChannelId || !collection)
|
|
27685
|
+
if (params.subChannelId !== (message === null || message === void 0 ? void 0 : message.subChannelId) || !collection)
|
|
27382
27686
|
return;
|
|
27383
|
-
|
|
27384
|
-
collection.data = [...new Set([message.messageId, ...collection.data])];
|
|
27385
|
-
}
|
|
27386
|
-
else if (['onDelete'].includes(action)) {
|
|
27387
|
-
collection.data = collection.data.filter(m => m !== message.messageId);
|
|
27388
|
-
}
|
|
27687
|
+
collection.data = [...new Set([message.messageId, ...collection.data])];
|
|
27389
27688
|
pushToCache(cacheKey, collection);
|
|
27390
27689
|
responder(collection);
|
|
27391
27690
|
};
|
|
@@ -27396,7 +27695,7 @@ const liveMessages = (params, callback, config) => {
|
|
|
27396
27695
|
if (messages.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
27397
27696
|
return;
|
|
27398
27697
|
const query = createQuery(queryMessages, Object.assign(Object.assign({}, queryParams), { page: (_e = (_d = collection === null || collection === void 0 ? void 0 : collection.params) === null || _d === void 0 ? void 0 : _d.page) !== null && _e !== void 0 ? _e : { limit } }));
|
|
27399
|
-
runQuery(query, ({ data: result, error, loading,
|
|
27698
|
+
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
27400
27699
|
const data = {
|
|
27401
27700
|
loading,
|
|
27402
27701
|
error,
|
|
@@ -27410,11 +27709,12 @@ const liveMessages = (params, callback, config) => {
|
|
|
27410
27709
|
responder(data);
|
|
27411
27710
|
}, queryOptions(policy));
|
|
27412
27711
|
};
|
|
27413
|
-
disposers.push(onMessageFetched(realtimeRouter(
|
|
27712
|
+
disposers.push(onMessageFetched(realtimeRouter()), onMessageCreated(realtimeRouter()), onMessageUpdated(realtimeRouter()), onMessageDeleted(realtimeRouter()), onMessageFlagged(realtimeRouter()), onMessageUnflagged(realtimeRouter()), onMessageFlagCleared(realtimeRouter()), onMessageReactionAdded(realtimeRouter()), onMessageReactionRemoved(realtimeRouter()));
|
|
27414
27713
|
onFetch();
|
|
27415
27714
|
return () => {
|
|
27416
27715
|
log(`liveMessages(tmpid: ${timestamp}) > dispose`);
|
|
27417
27716
|
disposers.forEach(fn => fn());
|
|
27717
|
+
dropFromCache(cacheKey);
|
|
27418
27718
|
};
|
|
27419
27719
|
};
|
|
27420
27720
|
|
|
@@ -27890,8 +28190,10 @@ const liveCommunities = (params, callback, config) => {
|
|
|
27890
28190
|
.map(communityId => pullFromCache(['community', 'get', communityId]))
|
|
27891
28191
|
.filter(Boolean)
|
|
27892
28192
|
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
27893
|
-
communities = filterByPropEquality(communities, 'isDeleted', params.isDeleted);
|
|
27894
28193
|
communities = filterByPropEquality(communities, 'displayName', params.displayName);
|
|
28194
|
+
if (params.includeDeleted === false) {
|
|
28195
|
+
communities = filterByPropEquality(communities, 'isDeleted', false);
|
|
28196
|
+
}
|
|
27895
28197
|
if (params.categoryId) {
|
|
27896
28198
|
communities = communities.filter(c => { var _a; return (_a = c.categoryIds) === null || _a === void 0 ? void 0 : _a.includes(params.categoryId); });
|
|
27897
28199
|
}
|
|
@@ -28113,6 +28415,9 @@ const liveCommunityMembers = (params, callback, config) => {
|
|
|
28113
28415
|
};
|
|
28114
28416
|
};
|
|
28115
28417
|
|
|
28418
|
+
/* begin_public_function
|
|
28419
|
+
id: community.category.query
|
|
28420
|
+
*/
|
|
28116
28421
|
/**
|
|
28117
28422
|
* ```js
|
|
28118
28423
|
* import { queryCategories } from '@amityco/ts-sdk'
|
|
@@ -28130,9 +28435,9 @@ const liveCommunityMembers = (params, callback, config) => {
|
|
|
28130
28435
|
const queryCategories = async (query) => {
|
|
28131
28436
|
const client = getActiveClient();
|
|
28132
28437
|
client.log('category/queryCategories', query);
|
|
28133
|
-
const _a = query !== null && query !== void 0 ? query : {}, { page = { limit: 10 } } = _a, params = __rest(_a, ["page"]);
|
|
28438
|
+
const _a = query !== null && query !== void 0 ? query : {}, { page = { limit: 10 }, includeDeleted } = _a, params = __rest(_a, ["page", "includeDeleted"]);
|
|
28134
28439
|
const { data } = await client.http.get(`/api/v3/community-categories`, {
|
|
28135
|
-
params: Object.assign(Object.assign({}, params), { options: {
|
|
28440
|
+
params: Object.assign(Object.assign({}, params), { isDeleted: includeDeleted === false ? false : undefined, options: {
|
|
28136
28441
|
token: toToken(page, 'skiplimit'),
|
|
28137
28442
|
} }),
|
|
28138
28443
|
});
|
|
@@ -28275,7 +28580,9 @@ const liveCategories = (params, callback, config) => {
|
|
|
28275
28580
|
.map(categoryId => pullFromCache(['category', 'get', categoryId]))
|
|
28276
28581
|
.filter(Boolean)
|
|
28277
28582
|
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
28278
|
-
|
|
28583
|
+
if (params.includeDeleted === false) {
|
|
28584
|
+
categories = filterByPropEquality(categories, 'isDeleted', false);
|
|
28585
|
+
}
|
|
28279
28586
|
switch (params.sortBy) {
|
|
28280
28587
|
case 'firstCreated':
|
|
28281
28588
|
categories = categories.sort(sortByFirstCreated);
|
|
@@ -28331,6 +28638,9 @@ const liveCategories = (params, callback, config) => {
|
|
|
28331
28638
|
};
|
|
28332
28639
|
};
|
|
28333
28640
|
|
|
28641
|
+
/* begin_public_function
|
|
28642
|
+
id: feed.query.global_feed
|
|
28643
|
+
*/
|
|
28334
28644
|
/**
|
|
28335
28645
|
* ```js
|
|
28336
28646
|
* import { queryGlobalFeed } from '@amityco/ts-sdk'
|
|
@@ -28371,6 +28681,7 @@ const queryGlobalFeed = async (query) => {
|
|
|
28371
28681
|
const prevPage = toPage(paging.previous);
|
|
28372
28682
|
return { data: posts, cachedAt, prevPage, nextPage };
|
|
28373
28683
|
};
|
|
28684
|
+
/* end_public_function */
|
|
28374
28685
|
/**
|
|
28375
28686
|
* ```js
|
|
28376
28687
|
* import { queryGlobalFeed } from '@amityco/ts-sdk'
|
|
@@ -28461,6 +28772,9 @@ queryFollows.locally = (key, query) => {
|
|
|
28461
28772
|
: undefined;
|
|
28462
28773
|
};
|
|
28463
28774
|
|
|
28775
|
+
/* begin_public_function
|
|
28776
|
+
id: user.relationship.query_my_followers, user.relationship.query_followers
|
|
28777
|
+
*/
|
|
28464
28778
|
/**
|
|
28465
28779
|
* ```js
|
|
28466
28780
|
* import { queryFollowers } from '@amityco/ts-sdk'
|
|
@@ -28476,6 +28790,7 @@ queryFollows.locally = (key, query) => {
|
|
|
28476
28790
|
* @async
|
|
28477
28791
|
*/
|
|
28478
28792
|
const queryFollowers = async (query) => queryFollows('followers', query);
|
|
28793
|
+
/* end_public_function */
|
|
28479
28794
|
/**
|
|
28480
28795
|
* ```js
|
|
28481
28796
|
* import { queryFollowers } from '@amityco/ts-sdk'
|
|
@@ -28491,6 +28806,9 @@ const queryFollowers = async (query) => queryFollows('followers', query);
|
|
|
28491
28806
|
*/
|
|
28492
28807
|
queryFollowers.locally = (query) => queryFollows.locally('followers', query);
|
|
28493
28808
|
|
|
28809
|
+
/* begin_public_function
|
|
28810
|
+
id: user.relationship.query_my_followings, user.relationship.query_followings
|
|
28811
|
+
*/
|
|
28494
28812
|
/**
|
|
28495
28813
|
* ```js
|
|
28496
28814
|
* import { queryFollowings } from '@amityco/ts-sdk'
|
|
@@ -28506,6 +28824,7 @@ queryFollowers.locally = (query) => queryFollows.locally('followers', query);
|
|
|
28506
28824
|
* @async
|
|
28507
28825
|
*/
|
|
28508
28826
|
const queryFollowings = async (query) => queryFollows('following', query);
|
|
28827
|
+
/* end_public_function */
|
|
28509
28828
|
/**
|
|
28510
28829
|
* ```js
|
|
28511
28830
|
* import { queryFollowings } from '@amityco/ts-sdk'
|
|
@@ -28521,11 +28840,9 @@ const queryFollowings = async (query) => queryFollows('following', query);
|
|
|
28521
28840
|
*/
|
|
28522
28841
|
queryFollowings.locally = (query) => queryFollows.locally('following', query);
|
|
28523
28842
|
|
|
28524
|
-
|
|
28525
|
-
|
|
28526
|
-
|
|
28527
|
-
`${getActiveClient().userId}#${userId}`,
|
|
28528
|
-
];
|
|
28843
|
+
/* begin_public_function
|
|
28844
|
+
id: user.relationship.get_follow_info, user.relationship.get_my_follow_info
|
|
28845
|
+
*/
|
|
28529
28846
|
/**
|
|
28530
28847
|
* ```js
|
|
28531
28848
|
* import { getFollowInfo } from '@amityco/ts-sdk'
|
|
@@ -28549,13 +28866,16 @@ const getFollowInfo = async (userId) => {
|
|
|
28549
28866
|
const followInfo = 'follows' in data
|
|
28550
28867
|
? Object.assign(Object.assign({}, data.followCounts[0]), { status: (_b = (_a = data.follows) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.status }) : data.followCounts[0];
|
|
28551
28868
|
if (client.cache) {
|
|
28552
|
-
pushToCache(
|
|
28869
|
+
pushToCache(['followInfo', 'get', userId], followInfo, {
|
|
28870
|
+
cachedAt,
|
|
28871
|
+
});
|
|
28553
28872
|
}
|
|
28554
28873
|
return {
|
|
28555
28874
|
data: followInfo,
|
|
28556
28875
|
cachedAt,
|
|
28557
28876
|
};
|
|
28558
28877
|
};
|
|
28878
|
+
/* end_public_function */
|
|
28559
28879
|
/**
|
|
28560
28880
|
* ```js
|
|
28561
28881
|
* import { getFollowInfo } from '@amityco/ts-sdk'
|
|
@@ -28575,7 +28895,7 @@ getFollowInfo.locally = (userId) => {
|
|
|
28575
28895
|
if (!client.cache) {
|
|
28576
28896
|
return;
|
|
28577
28897
|
}
|
|
28578
|
-
const cached = pullFromCache(
|
|
28898
|
+
const cached = pullFromCache(['followInfo', 'get', userId]);
|
|
28579
28899
|
if (!cached) {
|
|
28580
28900
|
return;
|
|
28581
28901
|
}
|
|
@@ -28585,6 +28905,9 @@ getFollowInfo.locally = (userId) => {
|
|
|
28585
28905
|
};
|
|
28586
28906
|
};
|
|
28587
28907
|
|
|
28908
|
+
/* begin_public_function
|
|
28909
|
+
id: user.relationship.follow
|
|
28910
|
+
*/
|
|
28588
28911
|
/**
|
|
28589
28912
|
* ```js
|
|
28590
28913
|
* import { follow } from '@amityco/ts-sdk'
|
|
@@ -28612,8 +28935,12 @@ const follow = async (userId) => {
|
|
|
28612
28935
|
data: data.follows[0],
|
|
28613
28936
|
cachedAt,
|
|
28614
28937
|
};
|
|
28615
|
-
};
|
|
28938
|
+
};
|
|
28939
|
+
/* end_public_function */
|
|
28616
28940
|
|
|
28941
|
+
/* begin_public_function
|
|
28942
|
+
id: user.relationship.unfollow
|
|
28943
|
+
*/
|
|
28617
28944
|
/**
|
|
28618
28945
|
* ```js
|
|
28619
28946
|
* import { unfollow } from '@amityco/ts-sdk'
|
|
@@ -28637,8 +28964,12 @@ const unfollow = async (userId) => {
|
|
|
28637
28964
|
}
|
|
28638
28965
|
fireEvent('follow.unfollowed', data);
|
|
28639
28966
|
return true;
|
|
28640
|
-
};
|
|
28967
|
+
};
|
|
28968
|
+
/* end_public_function */
|
|
28641
28969
|
|
|
28970
|
+
/* begin_public_function
|
|
28971
|
+
id: user.relationship.accept_follow
|
|
28972
|
+
*/
|
|
28642
28973
|
/**
|
|
28643
28974
|
* ```js
|
|
28644
28975
|
* import { acceptFollower } from '@amityco/ts-sdk'
|
|
@@ -28662,8 +28993,12 @@ const acceptFollower = async (userId) => {
|
|
|
28662
28993
|
}
|
|
28663
28994
|
fireEvent('follow.accepted', data);
|
|
28664
28995
|
return true;
|
|
28665
|
-
};
|
|
28996
|
+
};
|
|
28997
|
+
/* end_public_function */
|
|
28666
28998
|
|
|
28999
|
+
/* begin_public_function
|
|
29000
|
+
id: user.relationship.decline_follow
|
|
29001
|
+
*/
|
|
28667
29002
|
/**
|
|
28668
29003
|
* ```js
|
|
28669
29004
|
* import { declineFollower } from '@amityco/ts-sdk'
|
|
@@ -28687,7 +29022,8 @@ const declineFollower = async (userId) => {
|
|
|
28687
29022
|
}
|
|
28688
29023
|
fireEvent('follow.requestDeclined', data);
|
|
28689
29024
|
return true;
|
|
28690
|
-
};
|
|
29025
|
+
};
|
|
29026
|
+
/* end_public_function */
|
|
28691
29027
|
|
|
28692
29028
|
const createFollowEventSubscriber = (event, callback) => {
|
|
28693
29029
|
const client = getActiveClient();
|
|
@@ -29171,6 +29507,29 @@ const liveFollowings = (params, callback, config) => {
|
|
|
29171
29507
|
};
|
|
29172
29508
|
};
|
|
29173
29509
|
|
|
29510
|
+
/**
|
|
29511
|
+
* ```js
|
|
29512
|
+
* import { liveFollowInfo } from '@amityco/ts-sdk';
|
|
29513
|
+
*
|
|
29514
|
+
* let followInfo;
|
|
29515
|
+
*
|
|
29516
|
+
* const unsubscribe = liveFollowInfo(userId, response => {
|
|
29517
|
+
* followInfo = response.data;
|
|
29518
|
+
* });
|
|
29519
|
+
* ```
|
|
29520
|
+
*
|
|
29521
|
+
* Observe all mutation on a given {@link Amity.FollowCount} object
|
|
29522
|
+
*
|
|
29523
|
+
* @param userId the ID of the current user
|
|
29524
|
+
* @param callback the function to call when new data are available
|
|
29525
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing
|
|
29526
|
+
*
|
|
29527
|
+
* @category FollowInfo Live Object
|
|
29528
|
+
*/
|
|
29529
|
+
const liveFollowInfo = (userId, callback) => {
|
|
29530
|
+
return liveObject(userId, callback, 'userId', getFollowInfo, [onFollowInfoUpdated]);
|
|
29531
|
+
};
|
|
29532
|
+
|
|
29174
29533
|
/**
|
|
29175
29534
|
* ```js
|
|
29176
29535
|
* import { observePosts } from '@amityco/ts-sdk'
|
|
@@ -29330,9 +29689,11 @@ const livePosts = (params, callback, config) => {
|
|
|
29330
29689
|
.map(postId => pullFromCache(['post', 'get', postId]))
|
|
29331
29690
|
.filter(Boolean)
|
|
29332
29691
|
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
29333
|
-
posts = filterByPropEquality(posts, 'isDeleted', params.isDeleted);
|
|
29334
29692
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
29335
29693
|
posts = posts.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
29694
|
+
if (params.includeDeleted === false) {
|
|
29695
|
+
posts = filterByPropEquality(posts, 'isDeleted', false);
|
|
29696
|
+
}
|
|
29336
29697
|
if (params.tags) {
|
|
29337
29698
|
posts = posts.filter(p => { var _a; return (_a = p.tags) === null || _a === void 0 ? void 0 : _a.some(t => { var _a; return (_a = params.tags) === null || _a === void 0 ? void 0 : _a.includes(t); }); });
|
|
29338
29699
|
}
|
|
@@ -29547,7 +29908,9 @@ const liveComments = (params, callback, config) => {
|
|
|
29547
29908
|
.map(commentId => pullFromCache(['comment', 'get', commentId]))
|
|
29548
29909
|
.filter(Boolean)
|
|
29549
29910
|
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
29550
|
-
|
|
29911
|
+
if (params.includeDeleted === false) {
|
|
29912
|
+
comments = filterByPropEquality(comments, 'isDeleted', false);
|
|
29913
|
+
}
|
|
29551
29914
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
29552
29915
|
comments = comments.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
29553
29916
|
callback({
|
|
@@ -29605,6 +29968,9 @@ const liveComments = (params, callback, config) => {
|
|
|
29605
29968
|
};
|
|
29606
29969
|
};
|
|
29607
29970
|
|
|
29971
|
+
/* begin_public_function
|
|
29972
|
+
id: poll.get
|
|
29973
|
+
*/
|
|
29608
29974
|
/**
|
|
29609
29975
|
* ```js
|
|
29610
29976
|
* import { getPoll } from '@amityco/ts-sdk'
|
|
@@ -29632,6 +29998,7 @@ const getPoll = async (pollId) => {
|
|
|
29632
29998
|
cachedAt,
|
|
29633
29999
|
};
|
|
29634
30000
|
};
|
|
30001
|
+
/* end_public_function */
|
|
29635
30002
|
/**
|
|
29636
30003
|
* ```js
|
|
29637
30004
|
* import { getPoll } from '@amityco/ts-sdk'
|
|
@@ -29659,6 +30026,9 @@ getPoll.locally = (pollId) => {
|
|
|
29659
30026
|
};
|
|
29660
30027
|
};
|
|
29661
30028
|
|
|
30029
|
+
/* begin_public_function
|
|
30030
|
+
id: poll.create
|
|
30031
|
+
*/
|
|
29662
30032
|
/**
|
|
29663
30033
|
* ```js
|
|
29664
30034
|
* import { createPoll } from '@amityco/ts-sdk'
|
|
@@ -29692,8 +30062,12 @@ const createPoll = async (bundle) => {
|
|
|
29692
30062
|
data: polls[0],
|
|
29693
30063
|
cachedAt,
|
|
29694
30064
|
};
|
|
29695
|
-
};
|
|
30065
|
+
};
|
|
30066
|
+
/* end_public_function */
|
|
29696
30067
|
|
|
30068
|
+
/* begin_public_function
|
|
30069
|
+
id: poll.close
|
|
30070
|
+
*/
|
|
29697
30071
|
/**
|
|
29698
30072
|
* ```js
|
|
29699
30073
|
* import { closePoll } from '@amityco/ts-sdk'
|
|
@@ -29721,8 +30095,12 @@ const closePoll = async (pollId) => {
|
|
|
29721
30095
|
data: polls.find(poll => poll.pollId === pollId),
|
|
29722
30096
|
cachedAt,
|
|
29723
30097
|
};
|
|
29724
|
-
};
|
|
30098
|
+
};
|
|
30099
|
+
/* end_public_function */
|
|
29725
30100
|
|
|
30101
|
+
/* begin_public_function
|
|
30102
|
+
id: poll.delete
|
|
30103
|
+
*/
|
|
29726
30104
|
/**
|
|
29727
30105
|
* ```js
|
|
29728
30106
|
* import { deletePoll } from '@amityco/ts-sdk'
|
|
@@ -29748,8 +30126,12 @@ const deletePoll = async (pollId) => {
|
|
|
29748
30126
|
upsertInCache(['poll', 'get', pollId], deleted);
|
|
29749
30127
|
fireEvent('poll.deleted', { polls: [deleted], users: [] });
|
|
29750
30128
|
return success;
|
|
29751
|
-
};
|
|
30129
|
+
};
|
|
30130
|
+
/* end_public_function */
|
|
29752
30131
|
|
|
30132
|
+
/* begin_public_function
|
|
30133
|
+
id: poll.vote
|
|
30134
|
+
*/
|
|
29753
30135
|
/**
|
|
29754
30136
|
* ```js
|
|
29755
30137
|
* import { votePoll } from '@amityco/ts-sdk'
|
|
@@ -29778,7 +30160,8 @@ const votePoll = async (pollId, answerIds) => {
|
|
|
29778
30160
|
data: polls.find(poll => poll.pollId === pollId),
|
|
29779
30161
|
cachedAt,
|
|
29780
30162
|
};
|
|
29781
|
-
};
|
|
30163
|
+
};
|
|
30164
|
+
/* end_public_function */
|
|
29782
30165
|
|
|
29783
30166
|
/**
|
|
29784
30167
|
* ```js
|
|
@@ -29874,6 +30257,9 @@ const observePoll = (pollId, callback, policy = 'cache_then_server') => {
|
|
|
29874
30257
|
};
|
|
29875
30258
|
};
|
|
29876
30259
|
|
|
30260
|
+
/* begin_public_function
|
|
30261
|
+
id: stream.get
|
|
30262
|
+
*/
|
|
29877
30263
|
/**
|
|
29878
30264
|
* ```js
|
|
29879
30265
|
* import { getStream } from '@amityco/ts-sdk'
|
|
@@ -29901,6 +30287,7 @@ const getStream = async (streamId) => {
|
|
|
29901
30287
|
cachedAt,
|
|
29902
30288
|
};
|
|
29903
30289
|
};
|
|
30290
|
+
/* end_public_function */
|
|
29904
30291
|
/**
|
|
29905
30292
|
* ```js
|
|
29906
30293
|
* import { getStream } from '@amityco/ts-sdk'
|
|
@@ -29928,6 +30315,9 @@ getStream.locally = (streamId) => {
|
|
|
29928
30315
|
};
|
|
29929
30316
|
};
|
|
29930
30317
|
|
|
30318
|
+
/* begin_public_function
|
|
30319
|
+
id: stream.query
|
|
30320
|
+
*/
|
|
29931
30321
|
/**
|
|
29932
30322
|
* ```js
|
|
29933
30323
|
* import { queryStreams } from '@amityco/ts-sdk'
|
|
@@ -29962,6 +30352,7 @@ const queryStreams = async (query) => {
|
|
|
29962
30352
|
const prevPage = toPage(paging.previous);
|
|
29963
30353
|
return { data: videoStreamings, cachedAt, prevPage, nextPage };
|
|
29964
30354
|
};
|
|
30355
|
+
/* end_public_function */
|
|
29965
30356
|
/**
|
|
29966
30357
|
* ```js
|
|
29967
30358
|
* import { queryStreams } from '@amityco/ts-sdk'
|
|
@@ -29981,6 +30372,9 @@ queryStreams.locally = (query) => {
|
|
|
29981
30372
|
// TODO
|
|
29982
30373
|
};
|
|
29983
30374
|
|
|
30375
|
+
/* begin_public_function
|
|
30376
|
+
id: stream.create
|
|
30377
|
+
*/
|
|
29984
30378
|
/**
|
|
29985
30379
|
* ```js
|
|
29986
30380
|
* import { createStream } from '@amityco/ts-sdk'
|
|
@@ -30007,8 +30401,12 @@ const createStream = async (bundle) => {
|
|
|
30007
30401
|
data: videoStreamings[0],
|
|
30008
30402
|
cachedAt,
|
|
30009
30403
|
};
|
|
30010
|
-
};
|
|
30404
|
+
};
|
|
30405
|
+
/* end_public_function */
|
|
30011
30406
|
|
|
30407
|
+
/* begin_public_function
|
|
30408
|
+
id: stream.update
|
|
30409
|
+
*/
|
|
30012
30410
|
/**
|
|
30013
30411
|
* ```js
|
|
30014
30412
|
* import { updateStream } from '@amityco/ts-sdk'
|
|
@@ -30039,6 +30437,9 @@ const updateStream = async (streamId, patch) => {
|
|
|
30039
30437
|
};
|
|
30040
30438
|
|
|
30041
30439
|
// import { unwrapPayload } from '~/core/transports'
|
|
30440
|
+
/* begin_public_function
|
|
30441
|
+
id: stream.delete
|
|
30442
|
+
*/
|
|
30042
30443
|
/**
|
|
30043
30444
|
* ```js
|
|
30044
30445
|
* import { deleteStream } from '@amityco/ts-sdk'
|
|
@@ -30312,6 +30713,7 @@ exports.liveComments = liveComments;
|
|
|
30312
30713
|
exports.liveCommunities = liveCommunities;
|
|
30313
30714
|
exports.liveCommunity = liveCommunity;
|
|
30314
30715
|
exports.liveCommunityMembers = liveCommunityMembers;
|
|
30716
|
+
exports.liveFollowInfo = liveFollowInfo;
|
|
30315
30717
|
exports.liveFollowers = liveFollowers;
|
|
30316
30718
|
exports.liveFollowings = liveFollowings;
|
|
30317
30719
|
exports.liveMessage = liveMessage;
|