@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.esm.js
CHANGED
|
@@ -81,8 +81,8 @@ const PostContentType = Object.freeze({
|
|
|
81
81
|
|
|
82
82
|
function getVersion() {
|
|
83
83
|
try {
|
|
84
|
-
// the string ''v0.0.1-beta.
|
|
85
|
-
return 'v0.0.1-beta.
|
|
84
|
+
// the string ''v0.0.1-beta.42.1-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
85
|
+
return 'v0.0.1-beta.42.1-esm';
|
|
86
86
|
}
|
|
87
87
|
catch (error) {
|
|
88
88
|
return '__dev__';
|
|
@@ -498,6 +498,7 @@ const idResolvers = {
|
|
|
498
498
|
reaction: ({ reactionId }) => reactionId,
|
|
499
499
|
stream: ({ streamId }) => streamId,
|
|
500
500
|
follow: ({ from, to }) => `${from}#${to}`,
|
|
501
|
+
followInfo: ({ userId }) => userId,
|
|
501
502
|
followCount: ({ userId }) => userId,
|
|
502
503
|
feed: ({ targetId, feedId }) => `${targetId}#${feedId}`,
|
|
503
504
|
};
|
|
@@ -536,8 +537,9 @@ const CRITERIAS = {
|
|
|
536
537
|
reaction: ['reactionId'],
|
|
537
538
|
stream: ['streamId'],
|
|
538
539
|
follow: ['from', 'to'],
|
|
539
|
-
followCount: ['userId', 'followerCount'],
|
|
540
540
|
feed: ['feedId', 'feedType'],
|
|
541
|
+
followInfo: ['userId', 'status'],
|
|
542
|
+
followCount: ['userId', 'followerCount'],
|
|
541
543
|
};
|
|
542
544
|
/** @hidden */
|
|
543
545
|
const hasKeys = (object, needles) => {
|
|
@@ -602,7 +604,15 @@ const PAYLOAD2MODEL = {
|
|
|
602
604
|
};
|
|
603
605
|
/** hidden */
|
|
604
606
|
const hasUpdates = (prevData, nextData) => {
|
|
605
|
-
|
|
607
|
+
if ('updatedAt' in prevData && 'updatedAt' in nextData) {
|
|
608
|
+
return new Date(prevData.updatedAt) < new Date(nextData.updatedAt);
|
|
609
|
+
}
|
|
610
|
+
/*
|
|
611
|
+
* hasUpdates is used to identify the latest object among many. If the object
|
|
612
|
+
* does not extend ${Amity.UpdatedAt}, then there is no way to differentiate.
|
|
613
|
+
* So it is considered by default that the object hasUpdates
|
|
614
|
+
*/
|
|
615
|
+
return true;
|
|
606
616
|
};
|
|
607
617
|
/** hidden */
|
|
608
618
|
function getFutureDate(date = new Date().toISOString()) {
|
|
@@ -1459,6 +1469,10 @@ const createHttpTransport = (endpoint) => {
|
|
|
1459
1469
|
});
|
|
1460
1470
|
instance.interceptors.request.use(config => {
|
|
1461
1471
|
var _a;
|
|
1472
|
+
// do not check expiration for token creation url
|
|
1473
|
+
if (config.url === '/api/v4/sessions') {
|
|
1474
|
+
return config;
|
|
1475
|
+
}
|
|
1462
1476
|
// check global.ts for the extension of AxiosRequestConfig
|
|
1463
1477
|
const tokenExpiry = (_a = config.metadata) === null || _a === void 0 ? void 0 : _a.tokenExpiry;
|
|
1464
1478
|
if (tokenExpiry) {
|
|
@@ -20464,7 +20478,7 @@ const getToken = async (params) => {
|
|
|
20464
20478
|
const client = getActiveClient();
|
|
20465
20479
|
client.log('client/api/getToken', params);
|
|
20466
20480
|
const deviceInfo = getDeviceInfo();
|
|
20467
|
-
const { data } = await client.http.post('/api/
|
|
20481
|
+
const { data } = await client.http.post('/api/v4/sessions', Object.assign(Object.assign({}, params), { deviceInfo }), {
|
|
20468
20482
|
// @ts-ignore
|
|
20469
20483
|
headers: { 'X-API-Key': client.apiKey },
|
|
20470
20484
|
});
|
|
@@ -20500,6 +20514,9 @@ const setClientToken = async (params) => {
|
|
|
20500
20514
|
return { accessToken, users, refreshToken };
|
|
20501
20515
|
};
|
|
20502
20516
|
|
|
20517
|
+
/* begin_public_function
|
|
20518
|
+
id: client.logout
|
|
20519
|
+
*/
|
|
20503
20520
|
/**
|
|
20504
20521
|
* ```js
|
|
20505
20522
|
* import { disconnectClient } from '@amityco/ts-sdk'
|
|
@@ -20548,7 +20565,8 @@ const disconnectClient = async () => {
|
|
|
20548
20565
|
client.cache = { data: {} };
|
|
20549
20566
|
}
|
|
20550
20567
|
return !client.ws.connected;
|
|
20551
|
-
};
|
|
20568
|
+
};
|
|
20569
|
+
/* end_public_function */
|
|
20552
20570
|
|
|
20553
20571
|
/**
|
|
20554
20572
|
* Ingest a payload (v3) into the cache
|
|
@@ -20752,6 +20770,9 @@ const onTokenTerminated = (callback) => {
|
|
|
20752
20770
|
* to be cleared
|
|
20753
20771
|
*/
|
|
20754
20772
|
const subscriptions = [];
|
|
20773
|
+
/* begin_public_function
|
|
20774
|
+
id: client.login
|
|
20775
|
+
*/
|
|
20755
20776
|
/**
|
|
20756
20777
|
* ```js
|
|
20757
20778
|
* import { connectClient } from '@amityco/ts-sdk/client/api'
|
|
@@ -20846,8 +20867,12 @@ const connectClient = async (params, sessionHandler, config) => {
|
|
|
20846
20867
|
subscriptions.forEach(fn => fn());
|
|
20847
20868
|
}));
|
|
20848
20869
|
return client.ws.connected;
|
|
20849
|
-
};
|
|
20870
|
+
};
|
|
20871
|
+
/* end_public_function */
|
|
20850
20872
|
|
|
20873
|
+
/* begin_public_function
|
|
20874
|
+
id: client.renew_access_token
|
|
20875
|
+
*/
|
|
20851
20876
|
/*
|
|
20852
20877
|
* Renewal defintion accepted by SessionHandler interface
|
|
20853
20878
|
*
|
|
@@ -20906,7 +20931,8 @@ const renewal = () => {
|
|
|
20906
20931
|
}, ACCESS_TOKEN_WATCHER_INTERVAL);
|
|
20907
20932
|
},
|
|
20908
20933
|
};
|
|
20909
|
-
};
|
|
20934
|
+
};
|
|
20935
|
+
/* end_public_function */
|
|
20910
20936
|
|
|
20911
20937
|
const ABOUT_TO_EXPIRE_THRESHOLD = 80 / 100;
|
|
20912
20938
|
const COMPENSATED_DELAY = 5 * MINUTE;
|
|
@@ -21101,6 +21127,9 @@ const pushToTombstone = (model, modelId) => {
|
|
|
21101
21127
|
pushToCache(cacheKey, data);
|
|
21102
21128
|
};
|
|
21103
21129
|
|
|
21130
|
+
/* begin_public_function
|
|
21131
|
+
id: user.get
|
|
21132
|
+
*/
|
|
21104
21133
|
/**
|
|
21105
21134
|
* ```js
|
|
21106
21135
|
* import { getUser } from '@amityco/ts-sdk'
|
|
@@ -21143,6 +21172,7 @@ const getUser = async (userId, isLive = false) => {
|
|
|
21143
21172
|
cachedAt,
|
|
21144
21173
|
};
|
|
21145
21174
|
};
|
|
21175
|
+
/* end_public_function */
|
|
21146
21176
|
/**
|
|
21147
21177
|
* ```js
|
|
21148
21178
|
* import { getUser } from '@amityco/ts-sdk'
|
|
@@ -21162,6 +21192,9 @@ getUser.locally = (userId) => {
|
|
|
21162
21192
|
return client.cache && pullFromCache(['user', 'get', userId]);
|
|
21163
21193
|
};
|
|
21164
21194
|
|
|
21195
|
+
/* begin_public_function
|
|
21196
|
+
id: user.get_by_ids
|
|
21197
|
+
*/
|
|
21165
21198
|
/**
|
|
21166
21199
|
* ```js
|
|
21167
21200
|
* import { getUsers } from '@amityco/ts-sdk'
|
|
@@ -21252,6 +21285,9 @@ function __rest(s, e) {
|
|
|
21252
21285
|
return t;
|
|
21253
21286
|
}
|
|
21254
21287
|
|
|
21288
|
+
/* begin_public_function
|
|
21289
|
+
id: user.query, user.search
|
|
21290
|
+
*/
|
|
21255
21291
|
/**
|
|
21256
21292
|
* ```js
|
|
21257
21293
|
* import { queryUsers } from '@amityco/ts-sdk'
|
|
@@ -21295,6 +21331,7 @@ const queryUsers = async (query = {}) => {
|
|
|
21295
21331
|
const nextPage = toPage(paging.next);
|
|
21296
21332
|
return { data: users, cachedAt, prevPage, nextPage };
|
|
21297
21333
|
};
|
|
21334
|
+
/* end_public_function */
|
|
21298
21335
|
/**
|
|
21299
21336
|
* ```js
|
|
21300
21337
|
* import { queryUsers } from '@amityco/ts-sdk'
|
|
@@ -21330,6 +21367,9 @@ queryUsers.locally = (query = {}) => {
|
|
|
21330
21367
|
: undefined;
|
|
21331
21368
|
};
|
|
21332
21369
|
|
|
21370
|
+
/* begin_public_function
|
|
21371
|
+
id: client.update_user
|
|
21372
|
+
*/
|
|
21333
21373
|
/**
|
|
21334
21374
|
* ```js
|
|
21335
21375
|
* import { updateUser } from '@amityco/ts-sdk'
|
|
@@ -21364,7 +21404,8 @@ const updateUser = async (userId, patch) => {
|
|
|
21364
21404
|
data: users.find(user => user.userId === userId),
|
|
21365
21405
|
cachedAt,
|
|
21366
21406
|
};
|
|
21367
|
-
};
|
|
21407
|
+
};
|
|
21408
|
+
/* end_public_function */
|
|
21368
21409
|
|
|
21369
21410
|
/**
|
|
21370
21411
|
* ```js
|
|
@@ -21669,6 +21710,9 @@ const observeUser = (userId, callback) => {
|
|
|
21669
21710
|
};
|
|
21670
21711
|
};
|
|
21671
21712
|
|
|
21713
|
+
/* begin_public_function
|
|
21714
|
+
id: file.get
|
|
21715
|
+
*/
|
|
21672
21716
|
/**
|
|
21673
21717
|
* ```js
|
|
21674
21718
|
* import { getFile } from '@amityco/ts-sdk'
|
|
@@ -21697,6 +21741,7 @@ const getFile = async (fileId) => {
|
|
|
21697
21741
|
cachedAt,
|
|
21698
21742
|
};
|
|
21699
21743
|
};
|
|
21744
|
+
/* end_public_function */
|
|
21700
21745
|
/**
|
|
21701
21746
|
* ```js
|
|
21702
21747
|
* import { getFile } from '@amityco/ts-sdk'
|
|
@@ -21724,6 +21769,9 @@ getFile.locally = (fileId) => {
|
|
|
21724
21769
|
};
|
|
21725
21770
|
};
|
|
21726
21771
|
|
|
21772
|
+
/* begin_public_function
|
|
21773
|
+
id: file.upload.file
|
|
21774
|
+
*/
|
|
21727
21775
|
/**
|
|
21728
21776
|
* ```js
|
|
21729
21777
|
* import { createFile } from '@amityco/ts-sdk'
|
|
@@ -21763,8 +21811,12 @@ const createFile = async (formData, onProgress) => {
|
|
|
21763
21811
|
cachedAt,
|
|
21764
21812
|
};
|
|
21765
21813
|
};
|
|
21814
|
+
/* end_public_function */
|
|
21766
21815
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
21767
21816
|
|
|
21817
|
+
/* begin_public_function
|
|
21818
|
+
id: file.delete
|
|
21819
|
+
*/
|
|
21768
21820
|
/**
|
|
21769
21821
|
* ```js
|
|
21770
21822
|
* import { deleteFile } from '@amityco/ts-sdk'
|
|
@@ -21786,7 +21838,8 @@ const deleteFile = async (fileId) => {
|
|
|
21786
21838
|
await client.http.delete(`/api/v3/files/${fileId}`);
|
|
21787
21839
|
dropFromCache(['file', 'get', fileId], true);
|
|
21788
21840
|
return { success: true };
|
|
21789
|
-
};
|
|
21841
|
+
};
|
|
21842
|
+
/* end_public_function */
|
|
21790
21843
|
|
|
21791
21844
|
/**
|
|
21792
21845
|
* Allow to query a file url with a selected size
|
|
@@ -21799,6 +21852,9 @@ const fileUrlWithSize = (fileUrl, size) => {
|
|
|
21799
21852
|
return `${fileUrl}?size=${size}`;
|
|
21800
21853
|
};
|
|
21801
21854
|
|
|
21855
|
+
/* begin_public_function
|
|
21856
|
+
id: file.upload.video
|
|
21857
|
+
*/
|
|
21802
21858
|
/**
|
|
21803
21859
|
* ```js
|
|
21804
21860
|
* import { createVideo } from '@amityco/ts-sdk'
|
|
@@ -21842,8 +21898,12 @@ const createVideo = async (formData, feedType, onProgress) => {
|
|
|
21842
21898
|
cachedAt,
|
|
21843
21899
|
};
|
|
21844
21900
|
};
|
|
21901
|
+
/* end_public_function */
|
|
21845
21902
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
21846
21903
|
|
|
21904
|
+
/* begin_public_function
|
|
21905
|
+
id: file.upload.image
|
|
21906
|
+
*/
|
|
21847
21907
|
/**
|
|
21848
21908
|
* ```js
|
|
21849
21909
|
* import { createImage } from '@amityco/ts-sdk'
|
|
@@ -21883,6 +21943,7 @@ const createImage = async (formData, onProgress) => {
|
|
|
21883
21943
|
cachedAt,
|
|
21884
21944
|
};
|
|
21885
21945
|
};
|
|
21946
|
+
/* end_public_function */
|
|
21886
21947
|
// TODO: consider doing local creation with URL.createObjectURL()
|
|
21887
21948
|
|
|
21888
21949
|
/**
|
|
@@ -22126,8 +22187,8 @@ function convertParams(_a) {
|
|
|
22126
22187
|
return Object.assign({ messageFeedId: subChannelId, mentionedUsers: mentionees }, rest);
|
|
22127
22188
|
}
|
|
22128
22189
|
function convertQueryParams$1(_a) {
|
|
22129
|
-
var { page, sortBy, subChannelId, tags } = _a, rest = __rest(_a, ["page", "sortBy", "subChannelId", "tags"]);
|
|
22130
|
-
const out = Object.assign(Object.assign({}, rest), { messageFeedId: subChannelId, options: { token: toToken(page || { limit: 10 }, 'afterbeforeraw') } });
|
|
22190
|
+
var { page, sortBy, subChannelId, tags, includeDeleted } = _a, rest = __rest(_a, ["page", "sortBy", "subChannelId", "tags", "includeDeleted"]);
|
|
22191
|
+
const out = Object.assign(Object.assign({}, rest), { messageFeedId: subChannelId, isDeleted: includeDeleted === false ? false : undefined, options: { token: toToken(page || { limit: 10 }, 'afterbeforeraw') } });
|
|
22131
22192
|
if (sortBy !== undefined) {
|
|
22132
22193
|
out.options.sortBy = sortBy;
|
|
22133
22194
|
}
|
|
@@ -22137,6 +22198,9 @@ function convertQueryParams$1(_a) {
|
|
|
22137
22198
|
return out;
|
|
22138
22199
|
}
|
|
22139
22200
|
|
|
22201
|
+
/* begin_public_function
|
|
22202
|
+
id: message.get
|
|
22203
|
+
*/
|
|
22140
22204
|
/**
|
|
22141
22205
|
* ```js
|
|
22142
22206
|
* import { getMessage } from '@amityco/ts-sdk'
|
|
@@ -22182,6 +22246,7 @@ const getMessage = async (messageId, isLive = false) => {
|
|
|
22182
22246
|
cachedAt,
|
|
22183
22247
|
};
|
|
22184
22248
|
};
|
|
22249
|
+
/* end_public_function */
|
|
22185
22250
|
/**
|
|
22186
22251
|
* ```js
|
|
22187
22252
|
* import { getMessage } from '@amityco/ts-sdk'
|
|
@@ -22273,6 +22338,9 @@ getMessages.locally = (messageIds) => {
|
|
|
22273
22338
|
};
|
|
22274
22339
|
};
|
|
22275
22340
|
|
|
22341
|
+
/* begin_public_function
|
|
22342
|
+
id: message.query
|
|
22343
|
+
*/
|
|
22276
22344
|
/**
|
|
22277
22345
|
* ```js
|
|
22278
22346
|
* import { queryMessages } from '@amityco/ts-sdk'
|
|
@@ -22313,6 +22381,7 @@ const queryMessages = async (query) => {
|
|
|
22313
22381
|
const prevPage = toPageRaw(paging.previous);
|
|
22314
22382
|
return { data: messages, cachedAt, prevPage, nextPage };
|
|
22315
22383
|
};
|
|
22384
|
+
/* end_public_function */
|
|
22316
22385
|
/**
|
|
22317
22386
|
* ```js
|
|
22318
22387
|
* import { queryMessages } from '@amityco/ts-sdk'
|
|
@@ -22350,8 +22419,12 @@ queryMessages.locally = (query) => {
|
|
|
22350
22419
|
|
|
22351
22420
|
const uuid = () => nativeIdGenerator.v4().toString();
|
|
22352
22421
|
|
|
22422
|
+
const getLocalId = () => `LOCAL_${uuid()}`;
|
|
22353
22423
|
// FIXME: temp solution
|
|
22354
22424
|
let uniqueId;
|
|
22425
|
+
/* begin_public_function
|
|
22426
|
+
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
|
|
22427
|
+
*/
|
|
22355
22428
|
/**
|
|
22356
22429
|
* ```js
|
|
22357
22430
|
* import { createMessage, createQuery, runQuery } from '@amityco/ts-sdk'
|
|
@@ -22377,7 +22450,7 @@ let uniqueId;
|
|
|
22377
22450
|
const createMessage = async (bundle) => {
|
|
22378
22451
|
const client = getActiveClient();
|
|
22379
22452
|
client.log('message/createMessage', bundle);
|
|
22380
|
-
const referenceId = uniqueId;
|
|
22453
|
+
const referenceId = bundle.referenceId || uniqueId || getLocalId();
|
|
22381
22454
|
uniqueId = undefined;
|
|
22382
22455
|
const { data: payload } = await client.http.post('/api/v5/messages', Object.assign(Object.assign({}, convertParams(bundle)), { referenceId }));
|
|
22383
22456
|
const data = prepareMessagePayload(payload);
|
|
@@ -22410,8 +22483,9 @@ const createMessage = async (bundle) => {
|
|
|
22410
22483
|
*
|
|
22411
22484
|
* @category Message API
|
|
22412
22485
|
*/
|
|
22413
|
-
createMessage.optimistically = (
|
|
22414
|
-
var
|
|
22486
|
+
createMessage.optimistically = (_a) => {
|
|
22487
|
+
var _b, _c;
|
|
22488
|
+
var { referenceId } = _a, bundle = __rest(_a, ["referenceId"]);
|
|
22415
22489
|
const client = getActiveClient();
|
|
22416
22490
|
if (!client.cache)
|
|
22417
22491
|
return;
|
|
@@ -22422,9 +22496,8 @@ createMessage.optimistically = (bundle) => {
|
|
|
22422
22496
|
* Updated to handle client requirement to add messageId while uploading
|
|
22423
22497
|
* message with image. Temporary!
|
|
22424
22498
|
*/
|
|
22425
|
-
|
|
22426
|
-
|
|
22427
|
-
const bundleWithMessageId = Object.assign({ messageId: localId, uniqueId: localId }, bundle);
|
|
22499
|
+
uniqueId = referenceId || getLocalId();
|
|
22500
|
+
const bundleWithMessageId = Object.assign({ messageId: uniqueId, uniqueId }, bundle);
|
|
22428
22501
|
client.log('message/createMessage.optimistically', bundleWithMessageId);
|
|
22429
22502
|
const subChannel = pullFromCache(['subChannel', 'get', bundle.subChannelId]);
|
|
22430
22503
|
if (subChannel) {
|
|
@@ -22432,13 +22505,13 @@ createMessage.optimistically = (bundle) => {
|
|
|
22432
22505
|
if (subChannel.data.channelId === subChannel.data.subChannelId) {
|
|
22433
22506
|
const channel = pullFromCache(['channel', 'get', subChannel.data.channelId]);
|
|
22434
22507
|
if (channel === null || channel === void 0 ? void 0 : channel.data) {
|
|
22435
|
-
upsertInCache(['channel', 'get', subChannel.data.channelId], Object.assign(Object.assign({}, channel.data), { messageCount: ((
|
|
22508
|
+
upsertInCache(['channel', 'get', subChannel.data.channelId], Object.assign(Object.assign({}, channel.data), { messageCount: ((_b = channel.data.messageCount) !== null && _b !== void 0 ? _b : 0) + 1 }));
|
|
22436
22509
|
}
|
|
22437
22510
|
}
|
|
22438
22511
|
}
|
|
22439
22512
|
// as reused to update created and updated time, which should be the same
|
|
22440
22513
|
const createdTime = new Date().toISOString();
|
|
22441
|
-
const message = Object.assign({ creatorId: client.userId, channelSegment: ((
|
|
22514
|
+
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);
|
|
22442
22515
|
const cachedAt = UNSYNCED_OBJECT_CACHED_AT_VALUE;
|
|
22443
22516
|
pushToCache(['message', 'get', message.messageId], message, { cachedAt });
|
|
22444
22517
|
fireEvent('local.message.created', { messages: [message] });
|
|
@@ -22446,8 +22519,12 @@ createMessage.optimistically = (bundle) => {
|
|
|
22446
22519
|
cachedAt,
|
|
22447
22520
|
data: message,
|
|
22448
22521
|
};
|
|
22449
|
-
};
|
|
22522
|
+
};
|
|
22523
|
+
/* end_public_function */
|
|
22450
22524
|
|
|
22525
|
+
/* begin_public_function
|
|
22526
|
+
id: message.edit
|
|
22527
|
+
*/
|
|
22451
22528
|
/**
|
|
22452
22529
|
* ```js
|
|
22453
22530
|
* import { updateMessage } from '@amityco/ts-sdk'
|
|
@@ -22513,8 +22590,12 @@ updateMessage.optimistically = (messageId, patch) => {
|
|
|
22513
22590
|
data: updated,
|
|
22514
22591
|
cachedAt,
|
|
22515
22592
|
};
|
|
22516
|
-
};
|
|
22593
|
+
};
|
|
22594
|
+
/* end_public_function */
|
|
22517
22595
|
|
|
22596
|
+
/* begin_public_function
|
|
22597
|
+
id: message.soft_delete
|
|
22598
|
+
*/
|
|
22518
22599
|
/**
|
|
22519
22600
|
* ```js
|
|
22520
22601
|
* import { deleteMessage } from '@amityco/ts-sdk'
|
|
@@ -22565,7 +22646,8 @@ deleteMessage.optimistically = (messageId) => {
|
|
|
22565
22646
|
data: deleted,
|
|
22566
22647
|
cachedAt,
|
|
22567
22648
|
};
|
|
22568
|
-
};
|
|
22649
|
+
};
|
|
22650
|
+
/* end_public_function */
|
|
22569
22651
|
|
|
22570
22652
|
/**
|
|
22571
22653
|
* Attach user object to membership model
|
|
@@ -22627,6 +22709,9 @@ const prepareMembershipPayload = (payload, memberProp, userIdProp = 'userId', us
|
|
|
22627
22709
|
return Object.assign(Object.assign({}, rest), { [memberProp]: members });
|
|
22628
22710
|
};
|
|
22629
22711
|
|
|
22712
|
+
/* begin_public_function
|
|
22713
|
+
id: post.query, feed.query.community_feed, feed.query.user_feed
|
|
22714
|
+
*/
|
|
22630
22715
|
/**
|
|
22631
22716
|
* ```js
|
|
22632
22717
|
* import { queryPosts } from '@amityco/ts-sdk'
|
|
@@ -22644,13 +22729,13 @@ const prepareMembershipPayload = (payload, memberProp, userIdProp = 'userId', us
|
|
|
22644
22729
|
const queryPosts = async (query) => {
|
|
22645
22730
|
const client = getActiveClient();
|
|
22646
22731
|
client.log('post/queryPosts', query);
|
|
22647
|
-
const { page = { limit: 10 } } = query, params = __rest(query, ["page"]);
|
|
22732
|
+
const { page = { limit: 10 }, includeDeleted } = query, params = __rest(query, ["page", "includeDeleted"]);
|
|
22648
22733
|
const { dataTypes, matchingOnlyParentPost } = params;
|
|
22649
22734
|
// API-FIX: parameters should be querystring. (1)
|
|
22650
22735
|
// API-FIX: backend should answer Amity.Response (2)
|
|
22651
22736
|
// const { data } = await client.http.get<Amity.Response<Amity.PagedResponse<Amity.PostPayload>>>(
|
|
22652
22737
|
const { data } = await client.http.get(`/api/v4/posts`, {
|
|
22653
|
-
params: Object.assign(Object.assign({}, params), {
|
|
22738
|
+
params: Object.assign(Object.assign({}, params), { isDeleted: includeDeleted === false ? false : undefined,
|
|
22654
22739
|
/*
|
|
22655
22740
|
* when creating post like image, file, video BE will create 2 posts
|
|
22656
22741
|
* 1. parent post to store text with dataType=text
|
|
@@ -22678,6 +22763,7 @@ const queryPosts = async (query) => {
|
|
|
22678
22763
|
const prevPage = toPageRaw(paging.previous);
|
|
22679
22764
|
return { data: posts, cachedAt, prevPage, nextPage };
|
|
22680
22765
|
};
|
|
22766
|
+
/* end_public_function */
|
|
22681
22767
|
/**
|
|
22682
22768
|
* ```js
|
|
22683
22769
|
* import { queryPosts } from '@amityco/ts-sdk'
|
|
@@ -22713,6 +22799,9 @@ queryPosts.locally = (query) => {
|
|
|
22713
22799
|
: undefined;
|
|
22714
22800
|
};
|
|
22715
22801
|
|
|
22802
|
+
/* begin_public_function
|
|
22803
|
+
id: post.get_by_ids
|
|
22804
|
+
*/
|
|
22716
22805
|
/**
|
|
22717
22806
|
* ```js
|
|
22718
22807
|
* import { getPosts } from '@amityco/ts-sdk'
|
|
@@ -22776,6 +22865,9 @@ getPosts.locally = (postIds) => {
|
|
|
22776
22865
|
};
|
|
22777
22866
|
};
|
|
22778
22867
|
|
|
22868
|
+
/* begin_public_function
|
|
22869
|
+
id: post.get
|
|
22870
|
+
*/
|
|
22779
22871
|
/**
|
|
22780
22872
|
* ```js
|
|
22781
22873
|
* import { getPost } from '@amityco/ts-sdk'
|
|
@@ -22816,6 +22908,7 @@ const getPost = async (postId) => {
|
|
|
22816
22908
|
cachedAt,
|
|
22817
22909
|
};
|
|
22818
22910
|
};
|
|
22911
|
+
/* end_public_function */
|
|
22819
22912
|
/**
|
|
22820
22913
|
* ```js
|
|
22821
22914
|
* import { getPost } from '@amityco/ts-sdk'
|
|
@@ -22843,6 +22936,9 @@ getPost.locally = (postId) => {
|
|
|
22843
22936
|
};
|
|
22844
22937
|
};
|
|
22845
22938
|
|
|
22939
|
+
/* begin_public_function
|
|
22940
|
+
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
|
|
22941
|
+
*/
|
|
22846
22942
|
/**
|
|
22847
22943
|
* ```js
|
|
22848
22944
|
* import { createPost } from '@amityco/ts-sdk'
|
|
@@ -22880,8 +22976,12 @@ const createPost = async (bundle) => {
|
|
|
22880
22976
|
data: posts[0],
|
|
22881
22977
|
cachedAt,
|
|
22882
22978
|
};
|
|
22883
|
-
};
|
|
22979
|
+
};
|
|
22980
|
+
/* end_public_function */
|
|
22884
22981
|
|
|
22982
|
+
/* begin_public_function
|
|
22983
|
+
id: post.edit
|
|
22984
|
+
*/
|
|
22885
22985
|
/**
|
|
22886
22986
|
* ```js
|
|
22887
22987
|
* import { updatePost } from '@amityco/ts-sdk'
|
|
@@ -22913,7 +23013,8 @@ const updatePost = async (postId, patch) => {
|
|
|
22913
23013
|
data: posts.find(post => post.postId === postId),
|
|
22914
23014
|
cachedAt,
|
|
22915
23015
|
};
|
|
22916
|
-
};
|
|
23016
|
+
};
|
|
23017
|
+
/* end_public_function */
|
|
22917
23018
|
|
|
22918
23019
|
const getMatchPostSetting = (value) => {
|
|
22919
23020
|
var _a;
|
|
@@ -22939,6 +23040,9 @@ const prepareCommunityRequest = (params) => {
|
|
|
22939
23040
|
return Object.assign(Object.assign({}, restParam), (postSetting ? CommunityPostSettingMaps[postSetting] : undefined));
|
|
22940
23041
|
};
|
|
22941
23042
|
|
|
23043
|
+
/* begin_public_function
|
|
23044
|
+
id: community.query
|
|
23045
|
+
*/
|
|
22942
23046
|
/**
|
|
22943
23047
|
* ```js
|
|
22944
23048
|
* import { queryCommunities } from '@amityco/ts-sdk'
|
|
@@ -22959,12 +23063,12 @@ const queryCommunities = async (query) => {
|
|
|
22959
23063
|
client.log('channel/queryCommunities', query);
|
|
22960
23064
|
// safe decapsulation
|
|
22961
23065
|
const _a = query !== null && query !== void 0 ? query : {}, { page } = _a, params = __rest(_a, ["page"]);
|
|
22962
|
-
const _b = params !== null && params !== void 0 ? params : {}, { displayName, membership } = _b, restParams = __rest(_b, ["displayName", "membership"]);
|
|
23066
|
+
const _b = params !== null && params !== void 0 ? params : {}, { displayName, membership, includeDeleted } = _b, restParams = __rest(_b, ["displayName", "membership", "includeDeleted"]);
|
|
22963
23067
|
// API-FIX: parameters should be querystring.
|
|
22964
23068
|
// API-FIX: backend doesnt answer Amity.Response
|
|
22965
23069
|
// const { data } = await client.http.get<Amity.Response<Amity.PagedResponse<CommunityPayload>>>(
|
|
22966
23070
|
const { data } = await client.http.get(`/api/v3/communities`, {
|
|
22967
|
-
params: Object.assign(Object.assign({}, restParams), { keyword: displayName, filter: membership, options: {
|
|
23071
|
+
params: Object.assign(Object.assign({}, restParams), { isDeleted: includeDeleted === false ? false : undefined, keyword: displayName, filter: membership, options: {
|
|
22968
23072
|
token: toToken(page, 'skiplimit'),
|
|
22969
23073
|
} }),
|
|
22970
23074
|
});
|
|
@@ -22985,6 +23089,7 @@ const queryCommunities = async (query) => {
|
|
|
22985
23089
|
const prevPage = toPage(paging.previous);
|
|
22986
23090
|
return { data: communities, cachedAt, prevPage, nextPage };
|
|
22987
23091
|
};
|
|
23092
|
+
/* end_public_function */
|
|
22988
23093
|
/**
|
|
22989
23094
|
* ```js
|
|
22990
23095
|
* import { queryCommunities } from '@amityco/ts-sdk'
|
|
@@ -23066,6 +23171,9 @@ getCommunities.locally = (communityIds) => {
|
|
|
23066
23171
|
};
|
|
23067
23172
|
};
|
|
23068
23173
|
|
|
23174
|
+
/* begin_public_function
|
|
23175
|
+
id: community.get
|
|
23176
|
+
*/
|
|
23069
23177
|
/**
|
|
23070
23178
|
* ```js
|
|
23071
23179
|
* import { getCommunity } from '@amityco/ts-sdk'
|
|
@@ -23095,6 +23203,7 @@ const getCommunity = async (communityId) => {
|
|
|
23095
23203
|
cachedAt,
|
|
23096
23204
|
};
|
|
23097
23205
|
};
|
|
23206
|
+
/* end_public_function */
|
|
23098
23207
|
/**
|
|
23099
23208
|
* ```js
|
|
23100
23209
|
* import { getCommunity } from '@amityco/ts-sdk'
|
|
@@ -23122,6 +23231,9 @@ getCommunity.locally = (communityId) => {
|
|
|
23122
23231
|
};
|
|
23123
23232
|
};
|
|
23124
23233
|
|
|
23234
|
+
/* begin_public_function
|
|
23235
|
+
id: community.create
|
|
23236
|
+
*/
|
|
23125
23237
|
/**
|
|
23126
23238
|
* ```js
|
|
23127
23239
|
* import { createCommunity } from '@amityco/ts-sdk'
|
|
@@ -23150,8 +23262,12 @@ const createCommunity = async (bundle) => {
|
|
|
23150
23262
|
data: communities[0],
|
|
23151
23263
|
cachedAt,
|
|
23152
23264
|
};
|
|
23153
|
-
};
|
|
23265
|
+
};
|
|
23266
|
+
/* end_public_function */
|
|
23154
23267
|
|
|
23268
|
+
/* begin_public_function
|
|
23269
|
+
id: community.update
|
|
23270
|
+
*/
|
|
23155
23271
|
/**
|
|
23156
23272
|
* ```js
|
|
23157
23273
|
* import { updateCommunity } from '@amityco/ts-sdk'
|
|
@@ -23181,8 +23297,12 @@ const updateCommunity = async (communityId, patch) => {
|
|
|
23181
23297
|
data: communities.find(community => community.communityId === communityId),
|
|
23182
23298
|
cachedAt,
|
|
23183
23299
|
};
|
|
23184
|
-
};
|
|
23300
|
+
};
|
|
23301
|
+
/* end_public_function */
|
|
23185
23302
|
|
|
23303
|
+
/* begin_public_function
|
|
23304
|
+
id: community.delete
|
|
23305
|
+
*/
|
|
23186
23306
|
/**
|
|
23187
23307
|
* ```js
|
|
23188
23308
|
* import { deleteCommunity } from '@amityco/ts-sdk'
|
|
@@ -23212,8 +23332,12 @@ const deleteCommunity = async (communityId) => {
|
|
|
23212
23332
|
users: [],
|
|
23213
23333
|
});
|
|
23214
23334
|
return deleted.data;
|
|
23215
|
-
};
|
|
23335
|
+
};
|
|
23336
|
+
/* end_public_function */
|
|
23216
23337
|
|
|
23338
|
+
/* begin_public_function
|
|
23339
|
+
id: community.join
|
|
23340
|
+
*/
|
|
23217
23341
|
/**
|
|
23218
23342
|
* ```js
|
|
23219
23343
|
* import { joinCommunity } from '@amityco/ts-sdk'
|
|
@@ -23239,8 +23363,12 @@ const joinCommunity = async (communityId) => {
|
|
|
23239
23363
|
ingestInCache(data, { cachedAt });
|
|
23240
23364
|
const { communityUsers } = data;
|
|
23241
23365
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership === 'member');
|
|
23242
|
-
};
|
|
23366
|
+
};
|
|
23367
|
+
/* end_public_function */
|
|
23243
23368
|
|
|
23369
|
+
/* begin_public_function
|
|
23370
|
+
id: community.leave
|
|
23371
|
+
*/
|
|
23244
23372
|
/**
|
|
23245
23373
|
* ```js
|
|
23246
23374
|
* import { leaveCommunity } from '@amityco/ts-sdk'
|
|
@@ -23266,8 +23394,12 @@ const leaveCommunity = async (communityId) => {
|
|
|
23266
23394
|
ingestInCache(data, { cachedAt });
|
|
23267
23395
|
const { communityUsers } = data;
|
|
23268
23396
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership !== 'member');
|
|
23269
|
-
};
|
|
23397
|
+
};
|
|
23398
|
+
/* end_public_function */
|
|
23270
23399
|
|
|
23400
|
+
/* begin_public_function
|
|
23401
|
+
id: community.membership.query
|
|
23402
|
+
*/
|
|
23271
23403
|
/**
|
|
23272
23404
|
* ```js
|
|
23273
23405
|
* import { queryCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23311,6 +23443,7 @@ const queryCommunityMembers = async (query) => {
|
|
|
23311
23443
|
const prevPage = toPage(paging.previous);
|
|
23312
23444
|
return { data: communityUsers, cachedAt, nextPage, prevPage };
|
|
23313
23445
|
};
|
|
23446
|
+
/* end_public_function */
|
|
23314
23447
|
/**
|
|
23315
23448
|
* ```js
|
|
23316
23449
|
* import { queryCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23350,6 +23483,9 @@ queryCommunityMembers.locally = (query) => {
|
|
|
23350
23483
|
: undefined;
|
|
23351
23484
|
};
|
|
23352
23485
|
|
|
23486
|
+
/* begin_public_function
|
|
23487
|
+
id: community.membership.add_members
|
|
23488
|
+
*/
|
|
23353
23489
|
/**
|
|
23354
23490
|
* ```js
|
|
23355
23491
|
* import { addCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23375,8 +23511,12 @@ const addCommunityMembers = async (communityId, userIds) => {
|
|
|
23375
23511
|
ingestInCache(data);
|
|
23376
23512
|
const { communityUsers } = data;
|
|
23377
23513
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership === 'member');
|
|
23378
|
-
};
|
|
23514
|
+
};
|
|
23515
|
+
/* end_public_function */
|
|
23379
23516
|
|
|
23517
|
+
/* begin_public_function
|
|
23518
|
+
id: community.membership.remove_member
|
|
23519
|
+
*/
|
|
23380
23520
|
/**
|
|
23381
23521
|
* ```js
|
|
23382
23522
|
* import { removeCommunityMembers } from '@amityco/ts-sdk'
|
|
@@ -23402,8 +23542,12 @@ const removeCommunityMembers = async (communityId, userIds) => {
|
|
|
23402
23542
|
ingestInCache(data);
|
|
23403
23543
|
const { communityUsers } = data;
|
|
23404
23544
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId && communityUser.communityMembership !== 'member');
|
|
23405
|
-
};
|
|
23545
|
+
};
|
|
23546
|
+
/* end_public_function */
|
|
23406
23547
|
|
|
23548
|
+
/* begin_public_function
|
|
23549
|
+
id: community.moderation.add_roles
|
|
23550
|
+
*/
|
|
23407
23551
|
/**
|
|
23408
23552
|
* ```js
|
|
23409
23553
|
* import { addCommunityMembersRoles } from '@amityco/ts-sdk'
|
|
@@ -23430,8 +23574,12 @@ const addCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
|
23430
23574
|
const { communityUsers } = data;
|
|
23431
23575
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId &&
|
|
23432
23576
|
roleIds.some(role => communityUser.roles.includes(role)));
|
|
23433
|
-
};
|
|
23577
|
+
};
|
|
23578
|
+
/* end_public_function */
|
|
23434
23579
|
|
|
23580
|
+
/* begin_public_function
|
|
23581
|
+
id: community.moderation.remove_roles
|
|
23582
|
+
*/
|
|
23435
23583
|
/**
|
|
23436
23584
|
* ```js
|
|
23437
23585
|
* import { removeCommunityMembersRoles } from '@amityco/ts-sdk'
|
|
@@ -23458,8 +23606,12 @@ const removeCommunityMembersRoles = async (communityId, roleIds, userIds) => {
|
|
|
23458
23606
|
const { communityUsers } = data;
|
|
23459
23607
|
return !!communityUsers.find(communityUser => communityUser.communityId === communityId &&
|
|
23460
23608
|
!roleIds.some(role => communityUser.roles.includes(role)));
|
|
23461
|
-
};
|
|
23609
|
+
};
|
|
23610
|
+
/* end_public_function */
|
|
23462
23611
|
|
|
23612
|
+
/* begin_public_function
|
|
23613
|
+
id: community.query.trending_communities
|
|
23614
|
+
*/
|
|
23463
23615
|
/**
|
|
23464
23616
|
* ```js
|
|
23465
23617
|
* import { getTopTrendingCommunities } from '@amityco/ts-sdk'
|
|
@@ -23491,6 +23643,7 @@ const getTopTrendingCommunities = async (query) => {
|
|
|
23491
23643
|
}
|
|
23492
23644
|
return { data: communities, cachedAt };
|
|
23493
23645
|
};
|
|
23646
|
+
/* end_public_function */
|
|
23494
23647
|
/**
|
|
23495
23648
|
* ```js
|
|
23496
23649
|
* import { getTopTrendingCommunities } from '@amityco/ts-sdk'
|
|
@@ -23524,6 +23677,9 @@ getTopTrendingCommunities.locally = (query) => {
|
|
|
23524
23677
|
: undefined;
|
|
23525
23678
|
};
|
|
23526
23679
|
|
|
23680
|
+
/* begin_public_function
|
|
23681
|
+
id: community.query.recommended_communities
|
|
23682
|
+
*/
|
|
23527
23683
|
/**
|
|
23528
23684
|
* ```js
|
|
23529
23685
|
* import { getRecommendedCommunities } from '@amityco/ts-sdk'
|
|
@@ -23555,6 +23711,7 @@ const getRecommendedCommunities = async (query) => {
|
|
|
23555
23711
|
}
|
|
23556
23712
|
return { data: communities, cachedAt };
|
|
23557
23713
|
};
|
|
23714
|
+
/* end_public_function */
|
|
23558
23715
|
/**
|
|
23559
23716
|
* ```js
|
|
23560
23717
|
* import { getRecommendedCommunities } from '@amityco/ts-sdk'
|
|
@@ -23588,6 +23745,9 @@ getRecommendedCommunities.locally = (query) => {
|
|
|
23588
23745
|
: undefined;
|
|
23589
23746
|
};
|
|
23590
23747
|
|
|
23748
|
+
/* begin_public_function
|
|
23749
|
+
id: post.soft_delete, post.hard_delete
|
|
23750
|
+
*/
|
|
23591
23751
|
/**
|
|
23592
23752
|
* ```js
|
|
23593
23753
|
* import { deletePost } from '@amityco/ts-sdk'
|
|
@@ -23650,8 +23810,12 @@ const deletePost = async (postId, permanent = false) => {
|
|
|
23650
23810
|
upsertInCache(['post', 'get', postId], { isDeleted: true });
|
|
23651
23811
|
}
|
|
23652
23812
|
return deleted;
|
|
23653
|
-
};
|
|
23813
|
+
};
|
|
23814
|
+
/* end_public_function */
|
|
23654
23815
|
|
|
23816
|
+
/* begin_public_function
|
|
23817
|
+
id: post.approve
|
|
23818
|
+
*/
|
|
23655
23819
|
/**
|
|
23656
23820
|
* ```js
|
|
23657
23821
|
* import { approvePost } from '@amityco/ts-sdk'
|
|
@@ -23684,8 +23848,12 @@ const approvePost = async (postId) => {
|
|
|
23684
23848
|
data: data.posts.find(post => post.postId === postId),
|
|
23685
23849
|
cachedAt,
|
|
23686
23850
|
};
|
|
23687
|
-
};
|
|
23851
|
+
};
|
|
23852
|
+
/* end_public_function */
|
|
23688
23853
|
|
|
23854
|
+
/* begin_public_function
|
|
23855
|
+
id: post.decline
|
|
23856
|
+
*/
|
|
23689
23857
|
/**
|
|
23690
23858
|
* ```js
|
|
23691
23859
|
* import { declinePost } from '@amityco/ts-sdk'
|
|
@@ -23718,8 +23886,12 @@ const declinePost = async (postId) => {
|
|
|
23718
23886
|
data: payload.posts.find(post => post.postId === postId),
|
|
23719
23887
|
cachedAt,
|
|
23720
23888
|
};
|
|
23721
|
-
};
|
|
23889
|
+
};
|
|
23890
|
+
/* end_public_function */
|
|
23722
23891
|
|
|
23892
|
+
/* begin_public_function
|
|
23893
|
+
id: comment.query
|
|
23894
|
+
*/
|
|
23723
23895
|
/**
|
|
23724
23896
|
* ```js
|
|
23725
23897
|
* import { queryComments } from '@amityco/ts-sdk'
|
|
@@ -23737,7 +23909,7 @@ const declinePost = async (postId) => {
|
|
|
23737
23909
|
const queryComments = async (query) => {
|
|
23738
23910
|
const client = getActiveClient();
|
|
23739
23911
|
client.log('comment/queryComments', query);
|
|
23740
|
-
const { page = { limit: 10 } } = query, params = __rest(query, ["page"]);
|
|
23912
|
+
const { page = { limit: 10 }, includeDeleted } = query, params = __rest(query, ["page", "includeDeleted"]);
|
|
23741
23913
|
const options = {
|
|
23742
23914
|
type: params.sortBy ? 'pagination' : undefined,
|
|
23743
23915
|
token: toToken(page, params.sortBy ? 'skiplimit' : 'afterbefore'),
|
|
@@ -23747,7 +23919,7 @@ const queryComments = async (query) => {
|
|
|
23747
23919
|
// API-FIX: backend should answer Amity.Response (2)
|
|
23748
23920
|
// const { data } = await client.http.get<Amity.Response<Amity.PagedResponse<Amity.CommentPayload>>>(
|
|
23749
23921
|
const { data } = await client.http.get(`/api/v3/comments`, {
|
|
23750
|
-
params: Object.assign(Object.assign({}, params), {
|
|
23922
|
+
params: Object.assign(Object.assign({}, params), { isDeleted: includeDeleted === false ? false : undefined,
|
|
23751
23923
|
// filterByParentId, API-FIX: backend does not support this boolean LOL. what the hell seriously.
|
|
23752
23924
|
options }),
|
|
23753
23925
|
});
|
|
@@ -23769,6 +23941,7 @@ const queryComments = async (query) => {
|
|
|
23769
23941
|
const prevPage = toPage(paging.previous);
|
|
23770
23942
|
return { data: comments, cachedAt, prevPage, nextPage };
|
|
23771
23943
|
};
|
|
23944
|
+
/* end_public_function */
|
|
23772
23945
|
/**
|
|
23773
23946
|
* ```js
|
|
23774
23947
|
* import { queryComments } from '@amityco/ts-sdk'
|
|
@@ -23804,6 +23977,9 @@ queryComments.locally = (query) => {
|
|
|
23804
23977
|
: undefined;
|
|
23805
23978
|
};
|
|
23806
23979
|
|
|
23980
|
+
/* begin_public_function
|
|
23981
|
+
id: comment.get_by_ids
|
|
23982
|
+
*/
|
|
23807
23983
|
/**
|
|
23808
23984
|
* ```js
|
|
23809
23985
|
* import { getComments } from '@amityco/ts-sdk'
|
|
@@ -23834,6 +24010,7 @@ const getComments = async (commentIds) => {
|
|
|
23834
24010
|
cachedAt,
|
|
23835
24011
|
};
|
|
23836
24012
|
};
|
|
24013
|
+
/* end_public_function */
|
|
23837
24014
|
/**
|
|
23838
24015
|
* ```js
|
|
23839
24016
|
* import { getComments } from '@amityco/ts-sdk'
|
|
@@ -23866,6 +24043,9 @@ getComments.locally = (commentIds) => {
|
|
|
23866
24043
|
};
|
|
23867
24044
|
};
|
|
23868
24045
|
|
|
24046
|
+
/* begin_public_function
|
|
24047
|
+
id: comment.get
|
|
24048
|
+
*/
|
|
23869
24049
|
/**
|
|
23870
24050
|
* ```js
|
|
23871
24051
|
* import { getComment } from '@amityco/ts-sdk'
|
|
@@ -23905,6 +24085,7 @@ const getComment = async (commentId) => {
|
|
|
23905
24085
|
cachedAt,
|
|
23906
24086
|
};
|
|
23907
24087
|
};
|
|
24088
|
+
/* end_public_function */
|
|
23908
24089
|
/**
|
|
23909
24090
|
* ```js
|
|
23910
24091
|
* import { getComment } from '@amityco/ts-sdk'
|
|
@@ -23932,6 +24113,9 @@ getComment.locally = (commentId) => {
|
|
|
23932
24113
|
};
|
|
23933
24114
|
};
|
|
23934
24115
|
|
|
24116
|
+
/* begin_public_function
|
|
24117
|
+
id: comment.create
|
|
24118
|
+
*/
|
|
23935
24119
|
/**
|
|
23936
24120
|
* ```js
|
|
23937
24121
|
* import { createComment } from '@amityco/ts-sdk'
|
|
@@ -23971,8 +24155,12 @@ const createComment = async (bundle) => {
|
|
|
23971
24155
|
data: comments[0],
|
|
23972
24156
|
cachedAt,
|
|
23973
24157
|
};
|
|
23974
|
-
};
|
|
24158
|
+
};
|
|
24159
|
+
/* end_public_function */
|
|
23975
24160
|
|
|
24161
|
+
/* begin_public_function
|
|
24162
|
+
id: comment.update_comment
|
|
24163
|
+
*/
|
|
23976
24164
|
/**
|
|
23977
24165
|
* ```js
|
|
23978
24166
|
* import { updateComment } from '@amityco/ts-sdk'
|
|
@@ -24003,8 +24191,12 @@ const updateComment = async (commentId, patch) => {
|
|
|
24003
24191
|
data: comments.find(comment => comment.commentId === commentId),
|
|
24004
24192
|
cachedAt,
|
|
24005
24193
|
};
|
|
24006
|
-
};
|
|
24194
|
+
};
|
|
24195
|
+
/* end_public_function */
|
|
24007
24196
|
|
|
24197
|
+
/* begin_public_function
|
|
24198
|
+
id: comment.soft_delete, comment.hard_delete
|
|
24199
|
+
*/
|
|
24008
24200
|
/**
|
|
24009
24201
|
* ```js
|
|
24010
24202
|
* import { deleteComment } from '@amityco/ts-sdk'
|
|
@@ -24057,7 +24249,8 @@ const deleteComment = async (commentId, permanent = false) => {
|
|
|
24057
24249
|
upsertInCache(['comment', 'get', commentId], { isDeleted: true });
|
|
24058
24250
|
}
|
|
24059
24251
|
return deleted;
|
|
24060
|
-
};
|
|
24252
|
+
};
|
|
24253
|
+
/* end_public_function */
|
|
24061
24254
|
|
|
24062
24255
|
/** @hidden */
|
|
24063
24256
|
const preparePayloadForCache = (event, payload) => {
|
|
@@ -24097,6 +24290,9 @@ const preparePayloadForCache = (event, payload) => {
|
|
|
24097
24290
|
}
|
|
24098
24291
|
};
|
|
24099
24292
|
|
|
24293
|
+
/* begin_public_function
|
|
24294
|
+
id: reaction.add
|
|
24295
|
+
*/
|
|
24100
24296
|
/**
|
|
24101
24297
|
* ```js
|
|
24102
24298
|
* import { addReaction } from '@amityco/ts-sdk'
|
|
@@ -24137,6 +24333,7 @@ const addReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
24137
24333
|
}
|
|
24138
24334
|
return true;
|
|
24139
24335
|
};
|
|
24336
|
+
/* end_public_function */
|
|
24140
24337
|
/**
|
|
24141
24338
|
* ```js
|
|
24142
24339
|
* import { addReaction } from '@amityco/ts-sdk'
|
|
@@ -24177,6 +24374,9 @@ addReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
|
24177
24374
|
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;
|
|
24178
24375
|
};
|
|
24179
24376
|
|
|
24377
|
+
/* begin_public_function
|
|
24378
|
+
id: reaction.remove
|
|
24379
|
+
*/
|
|
24180
24380
|
/**
|
|
24181
24381
|
* ```js
|
|
24182
24382
|
* import { deleteReaction } from '@amityco/ts-sdk'
|
|
@@ -24219,6 +24419,7 @@ const removeReaction = async (referenceType, referenceId, reactionName) => {
|
|
|
24219
24419
|
}
|
|
24220
24420
|
return true;
|
|
24221
24421
|
};
|
|
24422
|
+
/* end_public_function */
|
|
24222
24423
|
/**
|
|
24223
24424
|
* ```js
|
|
24224
24425
|
* import { removeReaction } from '@amityco/ts-sdk'
|
|
@@ -24259,6 +24460,9 @@ removeReaction.optimistically = (referenceType, referenceId, reactionName) => {
|
|
|
24259
24460
|
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;
|
|
24260
24461
|
};
|
|
24261
24462
|
|
|
24463
|
+
/* begin_public_function
|
|
24464
|
+
id: reaction.query
|
|
24465
|
+
*/
|
|
24262
24466
|
/**
|
|
24263
24467
|
* ```js
|
|
24264
24468
|
* import { queryReactions } from '@amityco/ts-sdk'
|
|
@@ -24293,7 +24497,8 @@ const queryReactions = async (query) => {
|
|
|
24293
24497
|
const nextPage = toPageRaw(paging.next);
|
|
24294
24498
|
const prevPage = toPageRaw(paging.previous);
|
|
24295
24499
|
return { data: reactions, prevPage, nextPage };
|
|
24296
|
-
};
|
|
24500
|
+
};
|
|
24501
|
+
/* end_public_function */
|
|
24297
24502
|
|
|
24298
24503
|
const createPostEventSubscriber = (event, callback) => {
|
|
24299
24504
|
const client = getActiveClient();
|
|
@@ -25040,6 +25245,9 @@ var REFERENCE_TYPES = {
|
|
|
25040
25245
|
},
|
|
25041
25246
|
};
|
|
25042
25247
|
|
|
25248
|
+
/* begin_public_function
|
|
25249
|
+
id: user.flag, message.flag, post.flag, comment.flag
|
|
25250
|
+
*/
|
|
25043
25251
|
/**
|
|
25044
25252
|
* ```js
|
|
25045
25253
|
* import { createReport } from '@amityco/ts-sdk'
|
|
@@ -25080,8 +25288,12 @@ const createReport = async (referenceType, referenceId) => {
|
|
|
25080
25288
|
}
|
|
25081
25289
|
fireEvent(`${referenceType}.flagged`, payload);
|
|
25082
25290
|
return !!payload;
|
|
25083
|
-
};
|
|
25291
|
+
};
|
|
25292
|
+
/* end_public_function */
|
|
25084
25293
|
|
|
25294
|
+
/* begin_public_function
|
|
25295
|
+
id: user.unflag, message.unflag, post.unflag, comment.unflag
|
|
25296
|
+
*/
|
|
25085
25297
|
/**
|
|
25086
25298
|
* ```js
|
|
25087
25299
|
* import { deleteReport } from '@amityco/ts-sdk'
|
|
@@ -25123,8 +25335,12 @@ const deleteReport = async (referenceType, referenceId) => {
|
|
|
25123
25335
|
// @ts-ignore
|
|
25124
25336
|
fireEvent(`${referenceType}.unflagged`, payload);
|
|
25125
25337
|
return !!payload;
|
|
25126
|
-
};
|
|
25338
|
+
};
|
|
25339
|
+
/* end_public_function */
|
|
25127
25340
|
|
|
25341
|
+
/* begin_public_function
|
|
25342
|
+
id: user.check_flag_by_me, message.check_flag_by_me, post.check_flag_by_me, comment.check_flag_by_me
|
|
25343
|
+
*/
|
|
25128
25344
|
/**
|
|
25129
25345
|
* ```js
|
|
25130
25346
|
* import { isReportedByMe } from '@amityco/ts-sdk'
|
|
@@ -25151,7 +25367,8 @@ const isReportedByMe = async (referenceType, referenceId) => {
|
|
|
25151
25367
|
[primaryKey]: referenceId,
|
|
25152
25368
|
}))) !== null && _a !== void 0 ? _a : {};
|
|
25153
25369
|
return (_b = result !== null && result !== void 0 ? result : isFlagByMe) !== null && _b !== void 0 ? _b : false;
|
|
25154
|
-
};
|
|
25370
|
+
};
|
|
25371
|
+
/* end_public_function */
|
|
25155
25372
|
|
|
25156
25373
|
function convertFromRaw$1(_a, params) {
|
|
25157
25374
|
var { _id } = _a, rest = __rest(_a, ["_id"]);
|
|
@@ -25186,6 +25403,9 @@ const prepareChannelPayload = (rawPayload) => {
|
|
|
25186
25403
|
return Object.assign(Object.assign({}, rawPayload), { channels, channelUsers });
|
|
25187
25404
|
};
|
|
25188
25405
|
|
|
25406
|
+
/* begin_public_function
|
|
25407
|
+
id: channel.query
|
|
25408
|
+
*/
|
|
25189
25409
|
/**
|
|
25190
25410
|
* ```js
|
|
25191
25411
|
* import { queryChannels } from '@amityco/ts-sdk'
|
|
@@ -25231,6 +25451,7 @@ const queryChannels = async (query) => {
|
|
|
25231
25451
|
const prevPage = toPage(paging.previous);
|
|
25232
25452
|
return { data: channels, cachedAt, prevPage, nextPage };
|
|
25233
25453
|
};
|
|
25454
|
+
/* end_public_function */
|
|
25234
25455
|
/**
|
|
25235
25456
|
* ```js
|
|
25236
25457
|
* import { queryChannels } from '@amityco/ts-sdk'
|
|
@@ -25328,6 +25549,9 @@ getChannels.locally = (channelIds) => {
|
|
|
25328
25549
|
};
|
|
25329
25550
|
};
|
|
25330
25551
|
|
|
25552
|
+
/* begin_public_function
|
|
25553
|
+
id: channel.get
|
|
25554
|
+
*/
|
|
25331
25555
|
/**
|
|
25332
25556
|
* ```js
|
|
25333
25557
|
* import { getChannel } from '@amityco/ts-sdk'
|
|
@@ -25366,6 +25590,7 @@ const getChannel = async (channelId) => {
|
|
|
25366
25590
|
cachedAt,
|
|
25367
25591
|
};
|
|
25368
25592
|
};
|
|
25593
|
+
/* end_public_function */
|
|
25369
25594
|
/**
|
|
25370
25595
|
* ```js
|
|
25371
25596
|
* import { getChannel } from '@amityco/ts-sdk'
|
|
@@ -25393,6 +25618,9 @@ getChannel.locally = (channelId) => {
|
|
|
25393
25618
|
};
|
|
25394
25619
|
};
|
|
25395
25620
|
|
|
25621
|
+
/* begin_public_function
|
|
25622
|
+
id: channel.create
|
|
25623
|
+
*/
|
|
25396
25624
|
/**
|
|
25397
25625
|
* ```js
|
|
25398
25626
|
* import { createChannel } from '@amityco/ts-sdk'
|
|
@@ -25426,8 +25654,12 @@ const createChannel = async (bundle) => {
|
|
|
25426
25654
|
data: channels[0],
|
|
25427
25655
|
cachedAt,
|
|
25428
25656
|
};
|
|
25429
|
-
};
|
|
25657
|
+
};
|
|
25658
|
+
/* end_public_function */
|
|
25430
25659
|
|
|
25660
|
+
/* begin_public_function
|
|
25661
|
+
id: channel.update
|
|
25662
|
+
*/
|
|
25431
25663
|
/**
|
|
25432
25664
|
* ```js
|
|
25433
25665
|
* import { updateChannel } from '@amityco/ts-sdk'
|
|
@@ -25456,7 +25688,8 @@ const updateChannel = async (channelId, patch) => {
|
|
|
25456
25688
|
data: channels.find(channel => channel.channelId === channelId),
|
|
25457
25689
|
cachedAt,
|
|
25458
25690
|
};
|
|
25459
|
-
};
|
|
25691
|
+
};
|
|
25692
|
+
/* end_public_function */
|
|
25460
25693
|
|
|
25461
25694
|
/**
|
|
25462
25695
|
* ```js
|
|
@@ -25481,6 +25714,9 @@ const deleteChannel = async (channelId) => {
|
|
|
25481
25714
|
return deleted.data;
|
|
25482
25715
|
};
|
|
25483
25716
|
|
|
25717
|
+
/* begin_public_function
|
|
25718
|
+
id: channel.join
|
|
25719
|
+
*/
|
|
25484
25720
|
/**
|
|
25485
25721
|
* ```js
|
|
25486
25722
|
* import { joinChannel } from '@amityco/ts-sdk'
|
|
@@ -25504,8 +25740,12 @@ const joinChannel = async (channelId) => {
|
|
|
25504
25740
|
ingestInCache(data);
|
|
25505
25741
|
const { channelUsers } = data;
|
|
25506
25742
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership === 'member');
|
|
25507
|
-
};
|
|
25743
|
+
};
|
|
25744
|
+
/* end_public_function */
|
|
25508
25745
|
|
|
25746
|
+
/* begin_public_function
|
|
25747
|
+
id: channel.leave
|
|
25748
|
+
*/
|
|
25509
25749
|
/**
|
|
25510
25750
|
* ```js
|
|
25511
25751
|
* import { leaveChannel } from '@amityco/ts-sdk'
|
|
@@ -25529,8 +25769,12 @@ const leaveChannel = async (channelId) => {
|
|
|
25529
25769
|
ingestInCache(data);
|
|
25530
25770
|
const { channelUsers } = data;
|
|
25531
25771
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership !== 'member');
|
|
25532
|
-
};
|
|
25772
|
+
};
|
|
25773
|
+
/* end_public_function */
|
|
25533
25774
|
|
|
25775
|
+
/* begin_public_function
|
|
25776
|
+
id: channel.member.query, channel.member.search
|
|
25777
|
+
*/
|
|
25534
25778
|
/**
|
|
25535
25779
|
* ```js
|
|
25536
25780
|
* import { queryChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25579,6 +25823,7 @@ const queryChannelMembers = async (query) => {
|
|
|
25579
25823
|
prevPage,
|
|
25580
25824
|
};
|
|
25581
25825
|
};
|
|
25826
|
+
/* end_public_function */
|
|
25582
25827
|
/**
|
|
25583
25828
|
* ```js
|
|
25584
25829
|
* import { queryChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25619,6 +25864,9 @@ queryChannelMembers.locally = (query) => {
|
|
|
25619
25864
|
: undefined;
|
|
25620
25865
|
};
|
|
25621
25866
|
|
|
25867
|
+
/* begin_public_function
|
|
25868
|
+
id: channel.member.add
|
|
25869
|
+
*/
|
|
25622
25870
|
/**
|
|
25623
25871
|
* ```js
|
|
25624
25872
|
* import { addChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25647,8 +25895,12 @@ const addChannelMembers = async (channelId, userIds) => {
|
|
|
25647
25895
|
ingestInCache(data);
|
|
25648
25896
|
const { channelUsers } = data;
|
|
25649
25897
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership === 'member');
|
|
25650
|
-
};
|
|
25898
|
+
};
|
|
25899
|
+
/* end_public_function */
|
|
25651
25900
|
|
|
25901
|
+
/* begin_public_function
|
|
25902
|
+
id: channel.member.remove
|
|
25903
|
+
*/
|
|
25652
25904
|
/**
|
|
25653
25905
|
* ```js
|
|
25654
25906
|
* import { removeChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25677,8 +25929,12 @@ const removeChannelMembers = async (channelId, userIds) => {
|
|
|
25677
25929
|
ingestInCache(data);
|
|
25678
25930
|
const { channelUsers } = data;
|
|
25679
25931
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.membership !== 'member');
|
|
25680
|
-
};
|
|
25932
|
+
};
|
|
25933
|
+
/* end_public_function */
|
|
25681
25934
|
|
|
25935
|
+
/* begin_public_function
|
|
25936
|
+
id: channel.moderation.add_roles
|
|
25937
|
+
*/
|
|
25682
25938
|
/**
|
|
25683
25939
|
* ```js
|
|
25684
25940
|
* import { addChannelMembersRole } from '@amityco/ts-sdk'
|
|
@@ -25704,8 +25960,12 @@ const addChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
25704
25960
|
ingestInCache(data);
|
|
25705
25961
|
const { channelUsers } = data;
|
|
25706
25962
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && channelUser.roles.includes(roleId));
|
|
25707
|
-
};
|
|
25963
|
+
};
|
|
25964
|
+
/* end_public_function */
|
|
25708
25965
|
|
|
25966
|
+
/* begin_public_function
|
|
25967
|
+
id: channel.moderation.remove_roles
|
|
25968
|
+
*/
|
|
25709
25969
|
/**
|
|
25710
25970
|
* ```js
|
|
25711
25971
|
* import { removeChannelMembersRole } from '@amityco/ts-sdk'
|
|
@@ -25716,7 +25976,7 @@ const addChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
25716
25976
|
*
|
|
25717
25977
|
* @param channelId The ID of the {@link Amity.Channel} to perform
|
|
25718
25978
|
* @param roleId The ID of the {@link Amity.Role} to apply
|
|
25719
|
-
* @param
|
|
25979
|
+
* @param userIds Array of IDs of the {@link Amity.User} to perform
|
|
25720
25980
|
* @returns A success boolean if the {@link Amity.Role} were removed from list of {@link Amity.User} in the {@link Amity.Channel}
|
|
25721
25981
|
*
|
|
25722
25982
|
* @category Channel API
|
|
@@ -25731,8 +25991,12 @@ const removeChannelMembersRole = async (channelId, roleId, userIds) => {
|
|
|
25731
25991
|
ingestInCache(data);
|
|
25732
25992
|
const { channelUsers } = data;
|
|
25733
25993
|
return !!channelUsers.find(channelUser => channelUser.channelId === channelId && !channelUser.roles.includes(roleId));
|
|
25734
|
-
};
|
|
25994
|
+
};
|
|
25995
|
+
/* end_public_function */
|
|
25735
25996
|
|
|
25997
|
+
/* begin_public_function
|
|
25998
|
+
id: channel.moderation.ban_members
|
|
25999
|
+
*/
|
|
25736
26000
|
/**
|
|
25737
26001
|
* ```js
|
|
25738
26002
|
* import { banChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25762,8 +26026,12 @@ const banChannelMembers = async (channelId, userIds) => {
|
|
|
25762
26026
|
data: channelUsers === null || channelUsers === void 0 ? void 0 : channelUsers.filter(user => user.membership === 'banned'),
|
|
25763
26027
|
cachedAt,
|
|
25764
26028
|
};
|
|
25765
|
-
};
|
|
26029
|
+
};
|
|
26030
|
+
/* end_public_function */
|
|
25766
26031
|
|
|
26032
|
+
/* begin_public_function
|
|
26033
|
+
id: channel.moderation.unban_members
|
|
26034
|
+
*/
|
|
25767
26035
|
/**
|
|
25768
26036
|
* ```js
|
|
25769
26037
|
* import { unbanChannelMembers } from '@amityco/ts-sdk'
|
|
@@ -25793,8 +26061,12 @@ const unbanChannelMembers = async (channelId, userIds) => {
|
|
|
25793
26061
|
data: channelUsers === null || channelUsers === void 0 ? void 0 : channelUsers.filter(user => user.membership === 'member'),
|
|
25794
26062
|
cachedAt,
|
|
25795
26063
|
};
|
|
25796
|
-
};
|
|
26064
|
+
};
|
|
26065
|
+
/* end_public_function */
|
|
25797
26066
|
|
|
26067
|
+
/* begin_public_function
|
|
26068
|
+
id: channel.start_reading
|
|
26069
|
+
*/
|
|
25798
26070
|
/**
|
|
25799
26071
|
* ```js
|
|
25800
26072
|
* import { startReading } from '@amityco/ts-sdk'
|
|
@@ -25803,9 +26075,9 @@ const unbanChannelMembers = async (channelId, userIds) => {
|
|
|
25803
26075
|
*
|
|
25804
26076
|
* Mark all messages as read and start reading message inside channel
|
|
25805
26077
|
*
|
|
25806
|
-
* @param
|
|
25807
|
-
* @param
|
|
25808
|
-
* @return
|
|
26078
|
+
* @param subChannelId - The channel ID to start reading.
|
|
26079
|
+
* @param userId - The user ID of channel member.
|
|
26080
|
+
* @return A success boolean if the channel reading of the sub channel had begun.
|
|
25809
26081
|
*
|
|
25810
26082
|
* @category Message API
|
|
25811
26083
|
* @async
|
|
@@ -25831,8 +26103,12 @@ const startReading = async (subChannelId, userId = getActiveClient().userId) =>
|
|
|
25831
26103
|
channelId,
|
|
25832
26104
|
});
|
|
25833
26105
|
return !!result;
|
|
25834
|
-
};
|
|
26106
|
+
};
|
|
26107
|
+
/* end_public_function */
|
|
25835
26108
|
|
|
26109
|
+
/* begin_public_function
|
|
26110
|
+
id: channel.stop_reading
|
|
26111
|
+
*/
|
|
25836
26112
|
/**
|
|
25837
26113
|
* ```js
|
|
25838
26114
|
* import { stopReading } from '@amityco/ts-sdk'
|
|
@@ -25841,8 +26117,8 @@ const startReading = async (subChannelId, userId = getActiveClient().userId) =>
|
|
|
25841
26117
|
*
|
|
25842
26118
|
* Stop reading message inside channel
|
|
25843
26119
|
*
|
|
25844
|
-
* @param
|
|
25845
|
-
* @return
|
|
26120
|
+
* @param subChannelId - The channel ID to stop reading.
|
|
26121
|
+
* @return A success boolean if the sub channel reading was halted.
|
|
25846
26122
|
*
|
|
25847
26123
|
* @category Message API
|
|
25848
26124
|
* @async
|
|
@@ -25867,7 +26143,8 @@ const stopReading = async (subChannelId) => {
|
|
|
25867
26143
|
channelId,
|
|
25868
26144
|
});
|
|
25869
26145
|
return !!result;
|
|
25870
|
-
};
|
|
26146
|
+
};
|
|
26147
|
+
/* end_public_function */
|
|
25871
26148
|
|
|
25872
26149
|
/**
|
|
25873
26150
|
* ```js
|
|
@@ -26499,6 +26776,11 @@ const liveChannel = (channelId, callback) => {
|
|
|
26499
26776
|
onChannelUpdated,
|
|
26500
26777
|
onChannelDeleted,
|
|
26501
26778
|
onChannelJoined,
|
|
26779
|
+
onChannelLeft,
|
|
26780
|
+
onChannelMemberAdded,
|
|
26781
|
+
onChannelMemberRemoved,
|
|
26782
|
+
onChannelMemberBanned,
|
|
26783
|
+
onChannelMemberUnbanned,
|
|
26502
26784
|
onChannelMuted,
|
|
26503
26785
|
() => onMessageCreated(() => null), // watch unread count
|
|
26504
26786
|
]);
|
|
@@ -26759,6 +27041,9 @@ function convertQueryParams(_a) {
|
|
|
26759
27041
|
return out;
|
|
26760
27042
|
}
|
|
26761
27043
|
|
|
27044
|
+
/* begin_public_function
|
|
27045
|
+
id: subchannel.query
|
|
27046
|
+
*/
|
|
26762
27047
|
/**
|
|
26763
27048
|
* ```js
|
|
26764
27049
|
* import { querySubChannels } from '@amityco/ts-sdk'
|
|
@@ -26776,9 +27061,9 @@ function convertQueryParams(_a) {
|
|
|
26776
27061
|
const querySubChannels = async (query) => {
|
|
26777
27062
|
const client = getActiveClient();
|
|
26778
27063
|
client.log('channel/querySubChannels', query);
|
|
26779
|
-
const _a = convertQueryParams(query), { page = { limit: 10 }, channelId } = _a, params = __rest(_a, ["page", "channelId"]);
|
|
27064
|
+
const _a = convertQueryParams(query), { page = { limit: 10 }, channelId, includeDeleted } = _a, params = __rest(_a, ["page", "channelId", "includeDeleted"]);
|
|
26780
27065
|
const response = await client.http.get(`/api/v5/message-feeds/channel/${channelId}`, {
|
|
26781
|
-
params: Object.assign(Object.assign({}, params), { options: {
|
|
27066
|
+
params: Object.assign(Object.assign({}, params), { isDeleted: includeDeleted === false ? false : undefined, options: {
|
|
26782
27067
|
token: toToken(page, 'skiplimit'),
|
|
26783
27068
|
} }),
|
|
26784
27069
|
});
|
|
@@ -26800,6 +27085,7 @@ const querySubChannels = async (query) => {
|
|
|
26800
27085
|
const prevPage = toPage(paging.previous);
|
|
26801
27086
|
return { data: subChannels, cachedAt, prevPage, nextPage };
|
|
26802
27087
|
};
|
|
27088
|
+
/* end_public_function */
|
|
26803
27089
|
/**
|
|
26804
27090
|
* ```js
|
|
26805
27091
|
* import { querySubChannels } from '@amityco/ts-sdk'
|
|
@@ -26900,6 +27186,9 @@ getSubChannels.locally = (subChannelIds) => {
|
|
|
26900
27186
|
};
|
|
26901
27187
|
};
|
|
26902
27188
|
|
|
27189
|
+
/* begin_public_function
|
|
27190
|
+
id: subchannel.get
|
|
27191
|
+
*/
|
|
26903
27192
|
/**
|
|
26904
27193
|
* ```js
|
|
26905
27194
|
* import { getSubChannel } from '@amityco/ts-sdk'
|
|
@@ -26937,6 +27226,7 @@ const getSubChannel = async (subChannelId) => {
|
|
|
26937
27226
|
throw error;
|
|
26938
27227
|
}
|
|
26939
27228
|
};
|
|
27229
|
+
/* end_public_function */
|
|
26940
27230
|
/**
|
|
26941
27231
|
* ```js
|
|
26942
27232
|
* import { getSubChannel } from '@amityco/ts-sdk'
|
|
@@ -26964,6 +27254,9 @@ getSubChannel.locally = (subChannelId) => {
|
|
|
26964
27254
|
};
|
|
26965
27255
|
};
|
|
26966
27256
|
|
|
27257
|
+
/* begin_public_function
|
|
27258
|
+
id: subchannel.create
|
|
27259
|
+
*/
|
|
26967
27260
|
/**
|
|
26968
27261
|
* ```js
|
|
26969
27262
|
* import { createSubChannel } from '@amityco/ts-sdk'
|
|
@@ -26994,8 +27287,12 @@ const createSubChannel = async (bundle) => {
|
|
|
26994
27287
|
data: data.messageFeeds[0],
|
|
26995
27288
|
cachedAt,
|
|
26996
27289
|
};
|
|
26997
|
-
};
|
|
27290
|
+
};
|
|
27291
|
+
/* end_public_function */
|
|
26998
27292
|
|
|
27293
|
+
/* begin_public_function
|
|
27294
|
+
id: subchannel.update
|
|
27295
|
+
*/
|
|
26999
27296
|
/**
|
|
27000
27297
|
* ```js
|
|
27001
27298
|
* import { updateSubChannel } from '@amityco/ts-sdk'
|
|
@@ -27024,8 +27321,12 @@ const updateSubChannel = async (subChannelId, patch) => {
|
|
|
27024
27321
|
data: data.messageFeeds[0],
|
|
27025
27322
|
cachedAt,
|
|
27026
27323
|
};
|
|
27027
|
-
};
|
|
27324
|
+
};
|
|
27325
|
+
/* end_public_function */
|
|
27028
27326
|
|
|
27327
|
+
/* begin_public_function
|
|
27328
|
+
id: subchannel.soft_delete, subchannel.hard_delete
|
|
27329
|
+
*/
|
|
27029
27330
|
/**
|
|
27030
27331
|
* ```js
|
|
27031
27332
|
* import { deleteSubChannel } from '@amityco/ts-sdk'
|
|
@@ -27056,7 +27357,8 @@ const deleteSubChannel = async (subChannelId, permanent = false) => {
|
|
|
27056
27357
|
}
|
|
27057
27358
|
fireEvent('local.message-feed.deleted', { messageFeeds: [deleted] });
|
|
27058
27359
|
return deleted;
|
|
27059
|
-
};
|
|
27360
|
+
};
|
|
27361
|
+
/* end_public_function */
|
|
27060
27362
|
|
|
27061
27363
|
/**
|
|
27062
27364
|
* ```js
|
|
@@ -27204,8 +27506,8 @@ const liveSubChannels = (params, callback, config) => {
|
|
|
27204
27506
|
const responder = (data) => {
|
|
27205
27507
|
var _a;
|
|
27206
27508
|
let subChannels = data.data;
|
|
27207
|
-
if (params.
|
|
27208
|
-
subChannels = filterByPropEquality(subChannels, 'isDeleted',
|
|
27509
|
+
if (params.includeDeleted === false) {
|
|
27510
|
+
subChannels = filterByPropEquality(subChannels, 'isDeleted', false);
|
|
27209
27511
|
}
|
|
27210
27512
|
subChannels.sort(sortByLastActivity);
|
|
27211
27513
|
callback({
|
|
@@ -27350,9 +27652,11 @@ const liveMessages = (params, callback, config) => {
|
|
|
27350
27652
|
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
27351
27653
|
/*
|
|
27352
27654
|
* for cases when message is deleted via RTE, this flag is used to get
|
|
27353
|
-
* items
|
|
27655
|
+
* items from cache that are !deleted
|
|
27354
27656
|
*/
|
|
27355
|
-
|
|
27657
|
+
if (params.includeDeleted === false) {
|
|
27658
|
+
messages = filterByPropEquality(messages, 'isDeleted', false);
|
|
27659
|
+
}
|
|
27356
27660
|
callback({
|
|
27357
27661
|
onNextPage: onFetch,
|
|
27358
27662
|
data: messages,
|
|
@@ -27361,17 +27665,12 @@ const liveMessages = (params, callback, config) => {
|
|
|
27361
27665
|
error: data.error,
|
|
27362
27666
|
});
|
|
27363
27667
|
};
|
|
27364
|
-
const realtimeRouter = (
|
|
27668
|
+
const realtimeRouter = (_) => (message) => {
|
|
27365
27669
|
var _a;
|
|
27366
27670
|
const collection = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
27367
|
-
if (params.subChannelId !== message.subChannelId || !collection)
|
|
27671
|
+
if (params.subChannelId !== (message === null || message === void 0 ? void 0 : message.subChannelId) || !collection)
|
|
27368
27672
|
return;
|
|
27369
|
-
|
|
27370
|
-
collection.data = [...new Set([message.messageId, ...collection.data])];
|
|
27371
|
-
}
|
|
27372
|
-
else if (['onDelete'].includes(action)) {
|
|
27373
|
-
collection.data = collection.data.filter(m => m !== message.messageId);
|
|
27374
|
-
}
|
|
27673
|
+
collection.data = [...new Set([message.messageId, ...collection.data])];
|
|
27375
27674
|
pushToCache(cacheKey, collection);
|
|
27376
27675
|
responder(collection);
|
|
27377
27676
|
};
|
|
@@ -27382,7 +27681,7 @@ const liveMessages = (params, callback, config) => {
|
|
|
27382
27681
|
if (messages.length > 0 && !((_c = collection === null || collection === void 0 ? void 0 : collection.params) === null || _c === void 0 ? void 0 : _c.page))
|
|
27383
27682
|
return;
|
|
27384
27683
|
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 } }));
|
|
27385
|
-
runQuery(query, ({ data: result, error, loading,
|
|
27684
|
+
runQuery(query, ({ data: result, error, loading, nextPage: page }) => {
|
|
27386
27685
|
const data = {
|
|
27387
27686
|
loading,
|
|
27388
27687
|
error,
|
|
@@ -27396,11 +27695,12 @@ const liveMessages = (params, callback, config) => {
|
|
|
27396
27695
|
responder(data);
|
|
27397
27696
|
}, queryOptions(policy));
|
|
27398
27697
|
};
|
|
27399
|
-
disposers.push(onMessageFetched(realtimeRouter(
|
|
27698
|
+
disposers.push(onMessageFetched(realtimeRouter()), onMessageCreated(realtimeRouter()), onMessageUpdated(realtimeRouter()), onMessageDeleted(realtimeRouter()), onMessageFlagged(realtimeRouter()), onMessageUnflagged(realtimeRouter()), onMessageFlagCleared(realtimeRouter()), onMessageReactionAdded(realtimeRouter()), onMessageReactionRemoved(realtimeRouter()));
|
|
27400
27699
|
onFetch();
|
|
27401
27700
|
return () => {
|
|
27402
27701
|
log(`liveMessages(tmpid: ${timestamp}) > dispose`);
|
|
27403
27702
|
disposers.forEach(fn => fn());
|
|
27703
|
+
dropFromCache(cacheKey);
|
|
27404
27704
|
};
|
|
27405
27705
|
};
|
|
27406
27706
|
|
|
@@ -27876,8 +28176,10 @@ const liveCommunities = (params, callback, config) => {
|
|
|
27876
28176
|
.map(communityId => pullFromCache(['community', 'get', communityId]))
|
|
27877
28177
|
.filter(Boolean)
|
|
27878
28178
|
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
27879
|
-
communities = filterByPropEquality(communities, 'isDeleted', params.isDeleted);
|
|
27880
28179
|
communities = filterByPropEquality(communities, 'displayName', params.displayName);
|
|
28180
|
+
if (params.includeDeleted === false) {
|
|
28181
|
+
communities = filterByPropEquality(communities, 'isDeleted', false);
|
|
28182
|
+
}
|
|
27881
28183
|
if (params.categoryId) {
|
|
27882
28184
|
communities = communities.filter(c => { var _a; return (_a = c.categoryIds) === null || _a === void 0 ? void 0 : _a.includes(params.categoryId); });
|
|
27883
28185
|
}
|
|
@@ -28099,6 +28401,9 @@ const liveCommunityMembers = (params, callback, config) => {
|
|
|
28099
28401
|
};
|
|
28100
28402
|
};
|
|
28101
28403
|
|
|
28404
|
+
/* begin_public_function
|
|
28405
|
+
id: community.category.query
|
|
28406
|
+
*/
|
|
28102
28407
|
/**
|
|
28103
28408
|
* ```js
|
|
28104
28409
|
* import { queryCategories } from '@amityco/ts-sdk'
|
|
@@ -28116,9 +28421,9 @@ const liveCommunityMembers = (params, callback, config) => {
|
|
|
28116
28421
|
const queryCategories = async (query) => {
|
|
28117
28422
|
const client = getActiveClient();
|
|
28118
28423
|
client.log('category/queryCategories', query);
|
|
28119
|
-
const _a = query !== null && query !== void 0 ? query : {}, { page = { limit: 10 } } = _a, params = __rest(_a, ["page"]);
|
|
28424
|
+
const _a = query !== null && query !== void 0 ? query : {}, { page = { limit: 10 }, includeDeleted } = _a, params = __rest(_a, ["page", "includeDeleted"]);
|
|
28120
28425
|
const { data } = await client.http.get(`/api/v3/community-categories`, {
|
|
28121
|
-
params: Object.assign(Object.assign({}, params), { options: {
|
|
28426
|
+
params: Object.assign(Object.assign({}, params), { isDeleted: includeDeleted === false ? false : undefined, options: {
|
|
28122
28427
|
token: toToken(page, 'skiplimit'),
|
|
28123
28428
|
} }),
|
|
28124
28429
|
});
|
|
@@ -28261,7 +28566,9 @@ const liveCategories = (params, callback, config) => {
|
|
|
28261
28566
|
.map(categoryId => pullFromCache(['category', 'get', categoryId]))
|
|
28262
28567
|
.filter(Boolean)
|
|
28263
28568
|
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
28264
|
-
|
|
28569
|
+
if (params.includeDeleted === false) {
|
|
28570
|
+
categories = filterByPropEquality(categories, 'isDeleted', false);
|
|
28571
|
+
}
|
|
28265
28572
|
switch (params.sortBy) {
|
|
28266
28573
|
case 'firstCreated':
|
|
28267
28574
|
categories = categories.sort(sortByFirstCreated);
|
|
@@ -28317,6 +28624,9 @@ const liveCategories = (params, callback, config) => {
|
|
|
28317
28624
|
};
|
|
28318
28625
|
};
|
|
28319
28626
|
|
|
28627
|
+
/* begin_public_function
|
|
28628
|
+
id: feed.query.global_feed
|
|
28629
|
+
*/
|
|
28320
28630
|
/**
|
|
28321
28631
|
* ```js
|
|
28322
28632
|
* import { queryGlobalFeed } from '@amityco/ts-sdk'
|
|
@@ -28357,6 +28667,7 @@ const queryGlobalFeed = async (query) => {
|
|
|
28357
28667
|
const prevPage = toPage(paging.previous);
|
|
28358
28668
|
return { data: posts, cachedAt, prevPage, nextPage };
|
|
28359
28669
|
};
|
|
28670
|
+
/* end_public_function */
|
|
28360
28671
|
/**
|
|
28361
28672
|
* ```js
|
|
28362
28673
|
* import { queryGlobalFeed } from '@amityco/ts-sdk'
|
|
@@ -28447,6 +28758,9 @@ queryFollows.locally = (key, query) => {
|
|
|
28447
28758
|
: undefined;
|
|
28448
28759
|
};
|
|
28449
28760
|
|
|
28761
|
+
/* begin_public_function
|
|
28762
|
+
id: user.relationship.query_my_followers, user.relationship.query_followers
|
|
28763
|
+
*/
|
|
28450
28764
|
/**
|
|
28451
28765
|
* ```js
|
|
28452
28766
|
* import { queryFollowers } from '@amityco/ts-sdk'
|
|
@@ -28462,6 +28776,7 @@ queryFollows.locally = (key, query) => {
|
|
|
28462
28776
|
* @async
|
|
28463
28777
|
*/
|
|
28464
28778
|
const queryFollowers = async (query) => queryFollows('followers', query);
|
|
28779
|
+
/* end_public_function */
|
|
28465
28780
|
/**
|
|
28466
28781
|
* ```js
|
|
28467
28782
|
* import { queryFollowers } from '@amityco/ts-sdk'
|
|
@@ -28477,6 +28792,9 @@ const queryFollowers = async (query) => queryFollows('followers', query);
|
|
|
28477
28792
|
*/
|
|
28478
28793
|
queryFollowers.locally = (query) => queryFollows.locally('followers', query);
|
|
28479
28794
|
|
|
28795
|
+
/* begin_public_function
|
|
28796
|
+
id: user.relationship.query_my_followings, user.relationship.query_followings
|
|
28797
|
+
*/
|
|
28480
28798
|
/**
|
|
28481
28799
|
* ```js
|
|
28482
28800
|
* import { queryFollowings } from '@amityco/ts-sdk'
|
|
@@ -28492,6 +28810,7 @@ queryFollowers.locally = (query) => queryFollows.locally('followers', query);
|
|
|
28492
28810
|
* @async
|
|
28493
28811
|
*/
|
|
28494
28812
|
const queryFollowings = async (query) => queryFollows('following', query);
|
|
28813
|
+
/* end_public_function */
|
|
28495
28814
|
/**
|
|
28496
28815
|
* ```js
|
|
28497
28816
|
* import { queryFollowings } from '@amityco/ts-sdk'
|
|
@@ -28507,11 +28826,9 @@ const queryFollowings = async (query) => queryFollows('following', query);
|
|
|
28507
28826
|
*/
|
|
28508
28827
|
queryFollowings.locally = (query) => queryFollows.locally('following', query);
|
|
28509
28828
|
|
|
28510
|
-
|
|
28511
|
-
|
|
28512
|
-
|
|
28513
|
-
`${getActiveClient().userId}#${userId}`,
|
|
28514
|
-
];
|
|
28829
|
+
/* begin_public_function
|
|
28830
|
+
id: user.relationship.get_follow_info, user.relationship.get_my_follow_info
|
|
28831
|
+
*/
|
|
28515
28832
|
/**
|
|
28516
28833
|
* ```js
|
|
28517
28834
|
* import { getFollowInfo } from '@amityco/ts-sdk'
|
|
@@ -28535,13 +28852,16 @@ const getFollowInfo = async (userId) => {
|
|
|
28535
28852
|
const followInfo = 'follows' in data
|
|
28536
28853
|
? 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];
|
|
28537
28854
|
if (client.cache) {
|
|
28538
|
-
pushToCache(
|
|
28855
|
+
pushToCache(['followInfo', 'get', userId], followInfo, {
|
|
28856
|
+
cachedAt,
|
|
28857
|
+
});
|
|
28539
28858
|
}
|
|
28540
28859
|
return {
|
|
28541
28860
|
data: followInfo,
|
|
28542
28861
|
cachedAt,
|
|
28543
28862
|
};
|
|
28544
28863
|
};
|
|
28864
|
+
/* end_public_function */
|
|
28545
28865
|
/**
|
|
28546
28866
|
* ```js
|
|
28547
28867
|
* import { getFollowInfo } from '@amityco/ts-sdk'
|
|
@@ -28561,7 +28881,7 @@ getFollowInfo.locally = (userId) => {
|
|
|
28561
28881
|
if (!client.cache) {
|
|
28562
28882
|
return;
|
|
28563
28883
|
}
|
|
28564
|
-
const cached = pullFromCache(
|
|
28884
|
+
const cached = pullFromCache(['followInfo', 'get', userId]);
|
|
28565
28885
|
if (!cached) {
|
|
28566
28886
|
return;
|
|
28567
28887
|
}
|
|
@@ -28571,6 +28891,9 @@ getFollowInfo.locally = (userId) => {
|
|
|
28571
28891
|
};
|
|
28572
28892
|
};
|
|
28573
28893
|
|
|
28894
|
+
/* begin_public_function
|
|
28895
|
+
id: user.relationship.follow
|
|
28896
|
+
*/
|
|
28574
28897
|
/**
|
|
28575
28898
|
* ```js
|
|
28576
28899
|
* import { follow } from '@amityco/ts-sdk'
|
|
@@ -28598,8 +28921,12 @@ const follow = async (userId) => {
|
|
|
28598
28921
|
data: data.follows[0],
|
|
28599
28922
|
cachedAt,
|
|
28600
28923
|
};
|
|
28601
|
-
};
|
|
28924
|
+
};
|
|
28925
|
+
/* end_public_function */
|
|
28602
28926
|
|
|
28927
|
+
/* begin_public_function
|
|
28928
|
+
id: user.relationship.unfollow
|
|
28929
|
+
*/
|
|
28603
28930
|
/**
|
|
28604
28931
|
* ```js
|
|
28605
28932
|
* import { unfollow } from '@amityco/ts-sdk'
|
|
@@ -28623,8 +28950,12 @@ const unfollow = async (userId) => {
|
|
|
28623
28950
|
}
|
|
28624
28951
|
fireEvent('follow.unfollowed', data);
|
|
28625
28952
|
return true;
|
|
28626
|
-
};
|
|
28953
|
+
};
|
|
28954
|
+
/* end_public_function */
|
|
28627
28955
|
|
|
28956
|
+
/* begin_public_function
|
|
28957
|
+
id: user.relationship.accept_follow
|
|
28958
|
+
*/
|
|
28628
28959
|
/**
|
|
28629
28960
|
* ```js
|
|
28630
28961
|
* import { acceptFollower } from '@amityco/ts-sdk'
|
|
@@ -28648,8 +28979,12 @@ const acceptFollower = async (userId) => {
|
|
|
28648
28979
|
}
|
|
28649
28980
|
fireEvent('follow.accepted', data);
|
|
28650
28981
|
return true;
|
|
28651
|
-
};
|
|
28982
|
+
};
|
|
28983
|
+
/* end_public_function */
|
|
28652
28984
|
|
|
28985
|
+
/* begin_public_function
|
|
28986
|
+
id: user.relationship.decline_follow
|
|
28987
|
+
*/
|
|
28653
28988
|
/**
|
|
28654
28989
|
* ```js
|
|
28655
28990
|
* import { declineFollower } from '@amityco/ts-sdk'
|
|
@@ -28673,7 +29008,8 @@ const declineFollower = async (userId) => {
|
|
|
28673
29008
|
}
|
|
28674
29009
|
fireEvent('follow.requestDeclined', data);
|
|
28675
29010
|
return true;
|
|
28676
|
-
};
|
|
29011
|
+
};
|
|
29012
|
+
/* end_public_function */
|
|
28677
29013
|
|
|
28678
29014
|
const createFollowEventSubscriber = (event, callback) => {
|
|
28679
29015
|
const client = getActiveClient();
|
|
@@ -29157,6 +29493,29 @@ const liveFollowings = (params, callback, config) => {
|
|
|
29157
29493
|
};
|
|
29158
29494
|
};
|
|
29159
29495
|
|
|
29496
|
+
/**
|
|
29497
|
+
* ```js
|
|
29498
|
+
* import { liveFollowInfo } from '@amityco/ts-sdk';
|
|
29499
|
+
*
|
|
29500
|
+
* let followInfo;
|
|
29501
|
+
*
|
|
29502
|
+
* const unsubscribe = liveFollowInfo(userId, response => {
|
|
29503
|
+
* followInfo = response.data;
|
|
29504
|
+
* });
|
|
29505
|
+
* ```
|
|
29506
|
+
*
|
|
29507
|
+
* Observe all mutation on a given {@link Amity.FollowCount} object
|
|
29508
|
+
*
|
|
29509
|
+
* @param userId the ID of the current user
|
|
29510
|
+
* @param callback the function to call when new data are available
|
|
29511
|
+
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing
|
|
29512
|
+
*
|
|
29513
|
+
* @category FollowInfo Live Object
|
|
29514
|
+
*/
|
|
29515
|
+
const liveFollowInfo = (userId, callback) => {
|
|
29516
|
+
return liveObject(userId, callback, 'userId', getFollowInfo, [onFollowInfoUpdated]);
|
|
29517
|
+
};
|
|
29518
|
+
|
|
29160
29519
|
/**
|
|
29161
29520
|
* ```js
|
|
29162
29521
|
* import { observePosts } from '@amityco/ts-sdk'
|
|
@@ -29316,9 +29675,11 @@ const livePosts = (params, callback, config) => {
|
|
|
29316
29675
|
.map(postId => pullFromCache(['post', 'get', postId]))
|
|
29317
29676
|
.filter(Boolean)
|
|
29318
29677
|
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
29319
|
-
posts = filterByPropEquality(posts, 'isDeleted', params.isDeleted);
|
|
29320
29678
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
29321
29679
|
posts = posts.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
29680
|
+
if (params.includeDeleted === false) {
|
|
29681
|
+
posts = filterByPropEquality(posts, 'isDeleted', false);
|
|
29682
|
+
}
|
|
29322
29683
|
if (params.tags) {
|
|
29323
29684
|
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); }); });
|
|
29324
29685
|
}
|
|
@@ -29533,7 +29894,9 @@ const liveComments = (params, callback, config) => {
|
|
|
29533
29894
|
.map(commentId => pullFromCache(['comment', 'get', commentId]))
|
|
29534
29895
|
.filter(Boolean)
|
|
29535
29896
|
.map(({ data }) => data)) !== null && _a !== void 0 ? _a : [];
|
|
29536
|
-
|
|
29897
|
+
if (params.includeDeleted === false) {
|
|
29898
|
+
comments = filterByPropEquality(comments, 'isDeleted', false);
|
|
29899
|
+
}
|
|
29537
29900
|
const sortBy = params.sortBy ? params.sortBy : 'lastCreated';
|
|
29538
29901
|
comments = comments.sort(sortBy === 'lastCreated' ? sortByLastCreated : sortByFirstCreated);
|
|
29539
29902
|
callback({
|
|
@@ -29591,6 +29954,9 @@ const liveComments = (params, callback, config) => {
|
|
|
29591
29954
|
};
|
|
29592
29955
|
};
|
|
29593
29956
|
|
|
29957
|
+
/* begin_public_function
|
|
29958
|
+
id: poll.get
|
|
29959
|
+
*/
|
|
29594
29960
|
/**
|
|
29595
29961
|
* ```js
|
|
29596
29962
|
* import { getPoll } from '@amityco/ts-sdk'
|
|
@@ -29618,6 +29984,7 @@ const getPoll = async (pollId) => {
|
|
|
29618
29984
|
cachedAt,
|
|
29619
29985
|
};
|
|
29620
29986
|
};
|
|
29987
|
+
/* end_public_function */
|
|
29621
29988
|
/**
|
|
29622
29989
|
* ```js
|
|
29623
29990
|
* import { getPoll } from '@amityco/ts-sdk'
|
|
@@ -29645,6 +30012,9 @@ getPoll.locally = (pollId) => {
|
|
|
29645
30012
|
};
|
|
29646
30013
|
};
|
|
29647
30014
|
|
|
30015
|
+
/* begin_public_function
|
|
30016
|
+
id: poll.create
|
|
30017
|
+
*/
|
|
29648
30018
|
/**
|
|
29649
30019
|
* ```js
|
|
29650
30020
|
* import { createPoll } from '@amityco/ts-sdk'
|
|
@@ -29678,8 +30048,12 @@ const createPoll = async (bundle) => {
|
|
|
29678
30048
|
data: polls[0],
|
|
29679
30049
|
cachedAt,
|
|
29680
30050
|
};
|
|
29681
|
-
};
|
|
30051
|
+
};
|
|
30052
|
+
/* end_public_function */
|
|
29682
30053
|
|
|
30054
|
+
/* begin_public_function
|
|
30055
|
+
id: poll.close
|
|
30056
|
+
*/
|
|
29683
30057
|
/**
|
|
29684
30058
|
* ```js
|
|
29685
30059
|
* import { closePoll } from '@amityco/ts-sdk'
|
|
@@ -29707,8 +30081,12 @@ const closePoll = async (pollId) => {
|
|
|
29707
30081
|
data: polls.find(poll => poll.pollId === pollId),
|
|
29708
30082
|
cachedAt,
|
|
29709
30083
|
};
|
|
29710
|
-
};
|
|
30084
|
+
};
|
|
30085
|
+
/* end_public_function */
|
|
29711
30086
|
|
|
30087
|
+
/* begin_public_function
|
|
30088
|
+
id: poll.delete
|
|
30089
|
+
*/
|
|
29712
30090
|
/**
|
|
29713
30091
|
* ```js
|
|
29714
30092
|
* import { deletePoll } from '@amityco/ts-sdk'
|
|
@@ -29734,8 +30112,12 @@ const deletePoll = async (pollId) => {
|
|
|
29734
30112
|
upsertInCache(['poll', 'get', pollId], deleted);
|
|
29735
30113
|
fireEvent('poll.deleted', { polls: [deleted], users: [] });
|
|
29736
30114
|
return success;
|
|
29737
|
-
};
|
|
30115
|
+
};
|
|
30116
|
+
/* end_public_function */
|
|
29738
30117
|
|
|
30118
|
+
/* begin_public_function
|
|
30119
|
+
id: poll.vote
|
|
30120
|
+
*/
|
|
29739
30121
|
/**
|
|
29740
30122
|
* ```js
|
|
29741
30123
|
* import { votePoll } from '@amityco/ts-sdk'
|
|
@@ -29764,7 +30146,8 @@ const votePoll = async (pollId, answerIds) => {
|
|
|
29764
30146
|
data: polls.find(poll => poll.pollId === pollId),
|
|
29765
30147
|
cachedAt,
|
|
29766
30148
|
};
|
|
29767
|
-
};
|
|
30149
|
+
};
|
|
30150
|
+
/* end_public_function */
|
|
29768
30151
|
|
|
29769
30152
|
/**
|
|
29770
30153
|
* ```js
|
|
@@ -29860,6 +30243,9 @@ const observePoll = (pollId, callback, policy = 'cache_then_server') => {
|
|
|
29860
30243
|
};
|
|
29861
30244
|
};
|
|
29862
30245
|
|
|
30246
|
+
/* begin_public_function
|
|
30247
|
+
id: stream.get
|
|
30248
|
+
*/
|
|
29863
30249
|
/**
|
|
29864
30250
|
* ```js
|
|
29865
30251
|
* import { getStream } from '@amityco/ts-sdk'
|
|
@@ -29887,6 +30273,7 @@ const getStream = async (streamId) => {
|
|
|
29887
30273
|
cachedAt,
|
|
29888
30274
|
};
|
|
29889
30275
|
};
|
|
30276
|
+
/* end_public_function */
|
|
29890
30277
|
/**
|
|
29891
30278
|
* ```js
|
|
29892
30279
|
* import { getStream } from '@amityco/ts-sdk'
|
|
@@ -29914,6 +30301,9 @@ getStream.locally = (streamId) => {
|
|
|
29914
30301
|
};
|
|
29915
30302
|
};
|
|
29916
30303
|
|
|
30304
|
+
/* begin_public_function
|
|
30305
|
+
id: stream.query
|
|
30306
|
+
*/
|
|
29917
30307
|
/**
|
|
29918
30308
|
* ```js
|
|
29919
30309
|
* import { queryStreams } from '@amityco/ts-sdk'
|
|
@@ -29948,6 +30338,7 @@ const queryStreams = async (query) => {
|
|
|
29948
30338
|
const prevPage = toPage(paging.previous);
|
|
29949
30339
|
return { data: videoStreamings, cachedAt, prevPage, nextPage };
|
|
29950
30340
|
};
|
|
30341
|
+
/* end_public_function */
|
|
29951
30342
|
/**
|
|
29952
30343
|
* ```js
|
|
29953
30344
|
* import { queryStreams } from '@amityco/ts-sdk'
|
|
@@ -29967,6 +30358,9 @@ queryStreams.locally = (query) => {
|
|
|
29967
30358
|
// TODO
|
|
29968
30359
|
};
|
|
29969
30360
|
|
|
30361
|
+
/* begin_public_function
|
|
30362
|
+
id: stream.create
|
|
30363
|
+
*/
|
|
29970
30364
|
/**
|
|
29971
30365
|
* ```js
|
|
29972
30366
|
* import { createStream } from '@amityco/ts-sdk'
|
|
@@ -29993,8 +30387,12 @@ const createStream = async (bundle) => {
|
|
|
29993
30387
|
data: videoStreamings[0],
|
|
29994
30388
|
cachedAt,
|
|
29995
30389
|
};
|
|
29996
|
-
};
|
|
30390
|
+
};
|
|
30391
|
+
/* end_public_function */
|
|
29997
30392
|
|
|
30393
|
+
/* begin_public_function
|
|
30394
|
+
id: stream.update
|
|
30395
|
+
*/
|
|
29998
30396
|
/**
|
|
29999
30397
|
* ```js
|
|
30000
30398
|
* import { updateStream } from '@amityco/ts-sdk'
|
|
@@ -30025,6 +30423,9 @@ const updateStream = async (streamId, patch) => {
|
|
|
30025
30423
|
};
|
|
30026
30424
|
|
|
30027
30425
|
// import { unwrapPayload } from '~/core/transports'
|
|
30426
|
+
/* begin_public_function
|
|
30427
|
+
id: stream.delete
|
|
30428
|
+
*/
|
|
30028
30429
|
/**
|
|
30029
30430
|
* ```js
|
|
30030
30431
|
* import { deleteStream } from '@amityco/ts-sdk'
|
|
@@ -30175,4 +30576,4 @@ const createUserToken = async (apiKey, apiRegion, params) => {
|
|
|
30175
30576
|
return { accessToken: data.accessToken };
|
|
30176
30577
|
};
|
|
30177
30578
|
|
|
30178
|
-
export { API_REGIONS, CommunityPostSettingMaps, CommunityPostSettings, ContentFeedType, DefaultCommunityPostSetting, FileType, MessageContentType, PostContentType, SubscriptionLevels, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, acceptFollower, addChannelMembers, addChannelMembersRole, addCommunityMembers, addCommunityMembersRoles, addReaction, approvePost, backupCache, banChannelMembers, closePoll, connectClient, createChannel, createClient, createComment, createCommunity, createFile, createImage, createMessage, createPoll, createPost, createQuery, createReport, createStream, createSubChannel, createUserToken, createVideo, declineFollower, declinePost, deleteChannel, deleteComment, deleteCommunity, deleteFile, deleteMessage, deletePoll, deletePost, deleteReport, deleteStream, deleteSubChannel, disableCache, disconnectClient, disposeStream, dropFromCache, enableCache, fileUrlWithSize, filterByChannelMembership, filterByFeedType, filterByPropEquality, filterByPropInclusion, follow, getActiveClient, getCategory, getChannel, getChannelTopic, getChannels, getComment, getCommentTopic, getComments, getCommunities, getCommunity, getCommunityTopic, getFeedSettings, getFile, getFollowInfo, getMessage, getMessageTopic, getMessages, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPoll, getPost, getPostTopic, getPosts, getRecommendedCommunities, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStream, getSubChannel, getSubChannelTopic, getSubChannels, getTopTrendingCommunities, getUser, getUserTopic, getUsers, isAfterBefore, isAfterBeforeRaw, isCachable, isConnected, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, joinChannel, joinCommunity, leaveChannel, leaveCommunity, liveCategories, liveChannel, liveChannelMembers, liveChannels, liveComment, liveComments, liveCommunities, liveCommunity, liveCommunityMembers, liveFollowers, liveFollowings, liveMessage, liveMessages, livePost, livePosts, liveReactions, liveSubChannel, liveSubChannels, liveUser, liveUsers, mergeInCache, observeChannel, observeChannels, observeComment, observeComments, observeCommunity, observeFile, observeFollowInfo, observeFollowers, observeFollowings, observeMessage, observeMessages, observePoll, observePost, observePosts, observeUser, onChannelCreated, onChannelDeleted, onChannelJoined, onChannelLeft, onChannelMemberAdded, onChannelMemberBanned, onChannelMemberRemoved, onChannelMemberUnbanned, onChannelMuted, onChannelUpdated, onClientBanned, onClientDisconnected, onCommentCreated, onCommentDeleted, onCommentFlagged, onCommentReactionAdded, onCommentReactionRemoved, onCommentUnflagged, onCommentUpdated, onCommunityCreated, onCommunityDeleted, onCommunityJoined, onCommunityLeft, onCommunityUpdated, onCommunityUserAdded, onCommunityUserBanned, onCommunityUserChanged, onCommunityUserRemoved, onCommunityUserRoleAdded, onCommunityUserRoleRemoved, onCommunityUserUnbanned, onConnectionError, onFollowInfoUpdated, onFollowRequestAccepted, onFollowRequestCanceled, onFollowRequestDeclined, onFollowerDeleted, onFollowerRequested, onMessageCreated, onMessageDeleted, onMessageFlagCleared, onMessageFlagged, onMessageReactionAdded, onMessageReactionRemoved, onMessageUnflagged, onMessageUpdated, onPollDeleted, onPollUpdated, onPostApproved, onPostCreated, onPostDeclined, onPostDeleted, onPostFlagged, onPostReactionAdded, onPostReactionRemoved, onPostUnflagged, onPostUpdated, onReactionAdded, onReactionRemoved, onReactorAdded, onReactorRemoved, onSessionStateChange, onStreamRecorded, onStreamStarted, onStreamStopped, onSubChannelCreated, onSubChannelDeleted, onSubChannelUpdated, onUserDeleted, onUserFlagCleared, onUserFlagged, onUserFollowed, onUserUnflagged, onUserUnfollowed, onUserUpdated, pullFromCache, pushToCache, queryCache, queryCategories, queryChannelMembers, queryChannels, queryComments, queryCommunities, queryCommunityMembers, queryFollowers, queryFollowings, queryGlobalFeed, queryMessages, queryOptions, queryPosts, queryReactions, queryRoles, queryStreams, querySubChannels, queryUsers, removeChannelMembers, removeChannelMembersRole, removeCommunityMembers, removeCommunityMembersRoles, removeReaction, renewal, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByLastActivity, sortByLastCreated, sortByName, sortBySegmentNumber, startReading, stopReading, subscribeTopic, toPage, toPageRaw, toToken, unbanChannelMembers, unfollow, updateChannel, updateComment, updateCommunity, updateMessage, updatePost, updateStream, updateSubChannel, updateUser, upsertInCache, votePoll, wipeCache };
|
|
30579
|
+
export { API_REGIONS, CommunityPostSettingMaps, CommunityPostSettings, ContentFeedType, DefaultCommunityPostSetting, FileType, MessageContentType, PostContentType, SubscriptionLevels, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, acceptFollower, addChannelMembers, addChannelMembersRole, addCommunityMembers, addCommunityMembersRoles, addReaction, approvePost, backupCache, banChannelMembers, closePoll, connectClient, createChannel, createClient, createComment, createCommunity, createFile, createImage, createMessage, createPoll, createPost, createQuery, createReport, createStream, createSubChannel, createUserToken, createVideo, declineFollower, declinePost, deleteChannel, deleteComment, deleteCommunity, deleteFile, deleteMessage, deletePoll, deletePost, deleteReport, deleteStream, deleteSubChannel, disableCache, disconnectClient, disposeStream, dropFromCache, enableCache, fileUrlWithSize, filterByChannelMembership, filterByFeedType, filterByPropEquality, filterByPropInclusion, follow, getActiveClient, getCategory, getChannel, getChannelTopic, getChannels, getComment, getCommentTopic, getComments, getCommunities, getCommunity, getCommunityTopic, getFeedSettings, getFile, getFollowInfo, getMessage, getMessageTopic, getMessages, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPoll, getPost, getPostTopic, getPosts, getRecommendedCommunities, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStream, getSubChannel, getSubChannelTopic, getSubChannels, getTopTrendingCommunities, getUser, getUserTopic, getUsers, isAfterBefore, isAfterBeforeRaw, isCachable, isConnected, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, joinChannel, joinCommunity, leaveChannel, leaveCommunity, liveCategories, liveChannel, liveChannelMembers, liveChannels, liveComment, liveComments, liveCommunities, liveCommunity, liveCommunityMembers, liveFollowInfo, liveFollowers, liveFollowings, liveMessage, liveMessages, livePost, livePosts, liveReactions, liveSubChannel, liveSubChannels, liveUser, liveUsers, mergeInCache, observeChannel, observeChannels, observeComment, observeComments, observeCommunity, observeFile, observeFollowInfo, observeFollowers, observeFollowings, observeMessage, observeMessages, observePoll, observePost, observePosts, observeUser, onChannelCreated, onChannelDeleted, onChannelJoined, onChannelLeft, onChannelMemberAdded, onChannelMemberBanned, onChannelMemberRemoved, onChannelMemberUnbanned, onChannelMuted, onChannelUpdated, onClientBanned, onClientDisconnected, onCommentCreated, onCommentDeleted, onCommentFlagged, onCommentReactionAdded, onCommentReactionRemoved, onCommentUnflagged, onCommentUpdated, onCommunityCreated, onCommunityDeleted, onCommunityJoined, onCommunityLeft, onCommunityUpdated, onCommunityUserAdded, onCommunityUserBanned, onCommunityUserChanged, onCommunityUserRemoved, onCommunityUserRoleAdded, onCommunityUserRoleRemoved, onCommunityUserUnbanned, onConnectionError, onFollowInfoUpdated, onFollowRequestAccepted, onFollowRequestCanceled, onFollowRequestDeclined, onFollowerDeleted, onFollowerRequested, onMessageCreated, onMessageDeleted, onMessageFlagCleared, onMessageFlagged, onMessageReactionAdded, onMessageReactionRemoved, onMessageUnflagged, onMessageUpdated, onPollDeleted, onPollUpdated, onPostApproved, onPostCreated, onPostDeclined, onPostDeleted, onPostFlagged, onPostReactionAdded, onPostReactionRemoved, onPostUnflagged, onPostUpdated, onReactionAdded, onReactionRemoved, onReactorAdded, onReactorRemoved, onSessionStateChange, onStreamRecorded, onStreamStarted, onStreamStopped, onSubChannelCreated, onSubChannelDeleted, onSubChannelUpdated, onUserDeleted, onUserFlagCleared, onUserFlagged, onUserFollowed, onUserUnflagged, onUserUnfollowed, onUserUpdated, pullFromCache, pushToCache, queryCache, queryCategories, queryChannelMembers, queryChannels, queryComments, queryCommunities, queryCommunityMembers, queryFollowers, queryFollowings, queryGlobalFeed, queryMessages, queryOptions, queryPosts, queryReactions, queryRoles, queryStreams, querySubChannels, queryUsers, removeChannelMembers, removeChannelMembersRole, removeCommunityMembers, removeCommunityMembersRoles, removeReaction, renewal, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByLastActivity, sortByLastCreated, sortByName, sortBySegmentNumber, startReading, stopReading, subscribeTopic, toPage, toPageRaw, toToken, unbanChannelMembers, unfollow, updateChannel, updateComment, updateCommunity, updateMessage, updatePost, updateStream, updateSubChannel, updateUser, upsertInCache, votePoll, wipeCache };
|